35 #ifndef KERN_sparc64_TLB_sun4u_H_ 36 #define KERN_sparc64_TLB_sun4u_H_ 39 #define ITLB_ENTRY_COUNT 64 40 #define DTLB_ENTRY_COUNT 64 41 #define DTLB_MAX_LOCKED_ENTRIES DTLB_ENTRY_COUNT 46 #define DTLB_MAX_LOCKED_ENTRIES 16 49 #define MEM_CONTEXT_KERNEL 0 50 #define MEM_CONTEXT_TEMP 1 54 #define PAGESIZE_64K 1 55 #define PAGESIZE_512K 2 59 #define KERNEL_PAGE_WIDTH 22 62 #define TLB_DEMAP_PAGE 0 63 #define TLB_DEMAP_CONTEXT 1 65 #define TLB_DEMAP_ALL 2 68 #define TLB_DEMAP_TYPE_SHIFT 6 71 #define TLB_DEMAP_PRIMARY 0 72 #define TLB_DEMAP_SECONDARY 1 73 #define TLB_DEMAP_NUCLEUS 2 87 #define TLB_DEMAP_CONTEXT_SHIFT 4 90 #define TLB_TAG_ACCESS_CONTEXT_SHIFT 0 91 #define TLB_TAG_ACCESS_CONTEXT_MASK ((1 << 13) - 1) 92 #define TLB_TAG_ACCESS_VPN_SHIFT 13 100 #include <arch/barrier.h> 101 #include <arch/types.h> 102 #include <arch/register.h> 103 #include <arch/cpu.h> 121 union tlb_data_access_addr {
125 unsigned tlb_entry : 6;
129 typedef union tlb_data_access_addr dtlb_data_access_addr_t;
130 typedef union tlb_data_access_addr dtlb_tag_read_addr_t;
131 typedef union tlb_data_access_addr itlb_data_access_addr_t;
132 typedef union tlb_data_access_addr itlb_tag_read_addr_t;
147 union dtlb_data_access_addr {
152 unsigned tlb_number : 2;
154 unsigned local_tlb_entry : 9;
158 typedef union dtlb_data_access_addr dtlb_data_access_addr_t;
159 typedef union dtlb_data_access_addr dtlb_tag_read_addr_t;
161 union itlb_data_access_addr {
166 unsigned tlb_number : 2;
168 unsigned local_tlb_entry : 7;
172 typedef union itlb_data_access_addr itlb_data_access_addr_t;
173 typedef union itlb_data_access_addr itlb_tag_read_addr_t;
244 static inline uint16_t tlb_dsmall_size(
void)
252 static inline uint16_t tlb_dbig_size(
void)
260 static inline uint16_t tlb_ismall_size(
void)
268 static inline uint16_t tlb_ibig_size(
void)
270 if (((ver_reg_t) ver_read()).impl == IMPL_ULTRASPARCIV_PLUS)
282 static inline uint64_t mmu_primary_context_read(
void)
291 static inline void mmu_primary_context_write(uint64_t v)
301 static inline uint64_t mmu_secondary_context_read(
void)
310 static inline void mmu_secondary_context_write(uint64_t v)
325 static inline uint64_t itlb_data_access_read(
size_t entry)
327 itlb_data_access_addr_t reg;
330 reg.tlb_entry = entry;
331 return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value);
339 static inline void itlb_data_access_write(
size_t entry, uint64_t value)
341 itlb_data_access_addr_t reg;
344 reg.tlb_entry = entry;
345 asi_u64_write(ASI_ITLB_DATA_ACCESS_REG, reg.value, value);
356 static inline uint64_t dtlb_data_access_read(
size_t entry)
358 dtlb_data_access_addr_t reg;
361 reg.tlb_entry = entry;
362 return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value);
370 static inline void dtlb_data_access_write(
size_t entry, uint64_t value)
372 dtlb_data_access_addr_t reg;
375 reg.tlb_entry = entry;
376 asi_u64_write(ASI_DTLB_DATA_ACCESS_REG, reg.value, value);
386 static inline uint64_t itlb_tag_read_read(
size_t entry)
388 itlb_tag_read_addr_t tag;
391 tag.tlb_entry = entry;
392 return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value);
401 static inline uint64_t dtlb_tag_read_read(
size_t entry)
403 dtlb_tag_read_addr_t tag;
406 tag.tlb_entry = entry;
407 return asi_u64_read(ASI_DTLB_TAG_READ_REG, tag.value);
421 static inline uint64_t itlb_data_access_read(
int tlb,
size_t entry)
423 itlb_data_access_addr_t reg;
426 reg.tlb_number = tlb;
427 reg.local_tlb_entry = entry;
428 return asi_u64_read(ASI_ITLB_DATA_ACCESS_REG, reg.value);
436 static inline void itlb_data_access_write(
int tlb,
size_t entry,
439 itlb_data_access_addr_t reg;
442 reg.tlb_number = tlb;
443 reg.local_tlb_entry = entry;
444 asi_u64_write(ASI_ITLB_DATA_ACCESS_REG, reg.value, value);
456 static inline uint64_t dtlb_data_access_read(
int tlb,
size_t entry)
458 dtlb_data_access_addr_t reg;
461 reg.tlb_number = tlb;
462 reg.local_tlb_entry = entry;
463 return asi_u64_read(ASI_DTLB_DATA_ACCESS_REG, reg.value);
472 static inline void dtlb_data_access_write(
int tlb,
size_t entry,
475 dtlb_data_access_addr_t reg;
478 reg.tlb_number = tlb;
479 reg.local_tlb_entry = entry;
480 asi_u64_write(ASI_DTLB_DATA_ACCESS_REG, reg.value, value);
491 static inline uint64_t itlb_tag_read_read(
int tlb,
size_t entry)
493 itlb_tag_read_addr_t tag;
496 tag.tlb_number = tlb;
497 tag.local_tlb_entry = entry;
498 return asi_u64_read(ASI_ITLB_TAG_READ_REG, tag.value);
508 static inline uint64_t dtlb_tag_read_read(
int tlb,
size_t entry)
510 dtlb_tag_read_addr_t tag;
513 tag.tlb_number = tlb;
514 tag.local_tlb_entry = entry;
515 return asi_u64_read(ASI_DTLB_TAG_READ_REG, tag.value);
525 static inline void itlb_tag_access_write(uint64_t v)
535 static inline uint64_t itlb_tag_access_read(
void)
544 static inline void dtlb_tag_access_write(uint64_t v)
554 static inline uint64_t dtlb_tag_access_read(
void)
564 static inline void itlb_data_in_write(uint64_t v)
566 asi_u64_write(ASI_ITLB_DATA_IN_REG, 0, v);
574 static inline void dtlb_data_in_write(uint64_t v)
576 asi_u64_write(ASI_DTLB_DATA_IN_REG, 0, v);
584 static inline uint64_t itlb_sfsr_read(
void)
593 static inline void itlb_sfsr_write(uint64_t v)
603 static inline uint64_t dtlb_sfsr_read(
void)
612 static inline void dtlb_sfsr_write(uint64_t v)
622 static inline uint64_t dtlb_sfar_read(
void)
635 static inline void itlb_demap(
int type,
int context_encoding, uintptr_t
page)
648 asi_u64_write(ASI_IMMU_DEMAP, da.value, 0);
661 static inline void dtlb_demap(
int type,
int context_encoding, uintptr_t
page)
674 asi_u64_write(ASI_DMMU_DEMAP, da.value, 0);
679 extern void fast_instruction_access_mmu_miss(unative_t, istate_t *);
683 extern void dtlb_insert_mapping(uintptr_t, uintptr_t,
int,
bool,
bool);
685 extern void dump_sfsr_and_sfar(
void);
686 extern void describe_dmmu_fault(
void);
uint64_t vpn
Definition: tlb.h:193
unsigned ow
Definition: tlb.h:227
unsigned fv
Definition: tlb.h:229
#define VA_DMMU_SFAR
Definition: mmu.h:78
#define VA_DMMU_SFSR
Definition: mmu.h:77
tte_data_t tlb_data_t
Definition: tlb.h:115
#define VA_SECONDARY_CONTEXT_REG
Definition: mmu.h:76
unsigned pr
Definition: tlb.h:225
unsigned context
Definition: tlb.h:109
#define VA_PRIMARY_CONTEXT_REG
Definition: mmu.h:75
unsigned context
Definition: tlb.h:201
unsigned w
Definition: tlb.h:226
unsigned ct
Definition: tlb.h:224
unsigned e
Definition: tlb.h:223
uint64_t vpn
Definition: tlb.h:181
unsigned context
Definition: tlb.h:182
#define VA_DMMU_TAG_ACCESS
Definition: mmu.h:80
#define VA_IMMU_TAG_ACCESS
Definition: mmu.h:56
Definition: mmu-config.c:39
#define VA_IMMU_SFSR
Definition: mmu.h:54