Rev 863 | Rev 877 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 863 | Rev 873 | ||
|---|---|---|---|
| Line 44... | Line 44... | ||
| 44 | #define PAGESIZE_8K 0 |
44 | #define PAGESIZE_8K 0 |
| 45 | #define PAGESIZE_64K 1 |
45 | #define PAGESIZE_64K 1 |
| 46 | #define PAGESIZE_512K 2 |
46 | #define PAGESIZE_512K 2 |
| 47 | #define PAGESIZE_4M 3 |
47 | #define PAGESIZE_4M 3 |
| 48 | 48 | ||
| - | 49 | union tlb_context_reg { |
|
| - | 50 | __u64 v; |
|
| - | 51 | struct { |
|
| - | 52 | unsigned long : 51; |
|
| - | 53 | unsigned context : 13; /**< Context/ASID. */ |
|
| - | 54 | } __attribute__ ((packed)); |
|
| - | 55 | }; |
|
| - | 56 | typedef union tlb_context_reg tlb_context_reg_t; |
|
| - | 57 | ||
| 49 | /** I-/D-TLB Data In/Access Register type. */ |
58 | /** I-/D-TLB Data In/Access Register type. */ |
| 50 | typedef tte_data_t tlb_data_t; |
59 | typedef tte_data_t tlb_data_t; |
| 51 | 60 | ||
| 52 | /** I-/D-TLB Data Access Address in Alternate Space. */ |
61 | /** I-/D-TLB Data Access Address in Alternate Space. */ |
| 53 | union tlb_data_access_addr { |
62 | union tlb_data_access_addr { |
| Line 92... | Line 101... | ||
| 92 | unsigned : 4; /**< Zero. */ |
101 | unsigned : 4; /**< Zero. */ |
| 93 | } __attribute__ ((packed)); |
102 | } __attribute__ ((packed)); |
| 94 | }; |
103 | }; |
| 95 | typedef union tlb_demap_addr tlb_demap_addr_t; |
104 | typedef union tlb_demap_addr tlb_demap_addr_t; |
| 96 | 105 | ||
| - | 106 | /** TLB Synchronous Fault Status Register. */ |
|
| - | 107 | union tlb_sfsr_reg { |
|
| - | 108 | __u64 value; |
|
| - | 109 | struct { |
|
| - | 110 | unsigned long : 39; /**< Implementation dependent. */ |
|
| - | 111 | unsigned nf : 1; /**< Nonfaulting load. */ |
|
| - | 112 | unsigned asi : 8; /**< ASI. */ |
|
| - | 113 | unsigned tm : 1; /**< TLB miss. */ |
|
| - | 114 | unsigned : 3; |
|
| - | 115 | unsigned ft : 5; /**< Fault type. */ |
|
| - | 116 | unsigned e : 1; /**< Side-effect bit. */ |
|
| - | 117 | unsigned ct : 2; /**< Context Register selection. */ |
|
| - | 118 | unsigned pr : 1; /**< Privilege bit. */ |
|
| - | 119 | unsigned w : 1; /**< Write bit. */ |
|
| - | 120 | unsigned ow : 1; /**< Overwrite bit. */ |
|
| - | 121 | unsigned fv : 1; /**< Fayult Valid bit. */ |
|
| - | 122 | } __attribute__ ((packed)); |
|
| - | 123 | }; |
|
| - | 124 | typedef union tlb_sfsr_reg tlb_sfsr_reg_t; |
|
| - | 125 | ||
| - | 126 | /** Read MMU Primary Context Register. |
|
| - | 127 | * |
|
| - | 128 | * @return Current value of Primary Context Register. |
|
| - | 129 | */ |
|
| - | 130 | static inline __u64 mmu_primary_context_read(void) |
|
| - | 131 | { |
|
| - | 132 | return asi_u64_read(ASI_DMMU, VA_PRIMARY_CONTEXT_REG); |
|
| - | 133 | } |
|
| - | 134 | ||
| - | 135 | /** Write MMU Primary Context Register. |
|
| - | 136 | * |
|
| - | 137 | * @param v New value of Primary Context Register. |
|
| - | 138 | */ |
|
| - | 139 | static inline void mmu_primary_context_write(__u64 v) |
|
| - | 140 | { |
|
| - | 141 | asi_u64_write(ASI_DMMU, VA_PRIMARY_CONTEXT_REG, v); |
|
| - | 142 | flush(); |
|
| - | 143 | } |
|
| - | 144 | ||
| - | 145 | /** Read MMU Secondary Context Register. |
|
| - | 146 | * |
|
| - | 147 | * @return Current value of Secondary Context Register. |
|
| - | 148 | */ |
|
| - | 149 | static inline __u64 mmu_secondary_context_read(void) |
|
| - | 150 | { |
|
| - | 151 | return asi_u64_read(ASI_DMMU, VA_SECONDARY_CONTEXT_REG); |
|
| - | 152 | } |
|
| - | 153 | ||
| - | 154 | /** Write MMU Primary Context Register. |
|
| - | 155 | * |
|
| - | 156 | * @param v New value of Primary Context Register. |
|
| - | 157 | */ |
|
| - | 158 | static inline void mmu_secondary_context_write(__u64 v) |
|
| - | 159 | { |
|
| - | 160 | asi_u64_write(ASI_DMMU, VA_PRIMARY_CONTEXT_REG, v); |
|
| - | 161 | flush(); |
|
| - | 162 | } |
|
| - | 163 | ||
| 97 | /** Read IMMU TLB Data Access Register. |
164 | /** Read IMMU TLB Data Access Register. |
| 98 | * |
165 | * |
| 99 | * @param entry TLB Entry index. |
166 | * @param entry TLB Entry index. |
| 100 | * |
167 | * |
| 101 | * @return Current value of specified IMMU TLB Data Access Register. |
168 | * @return Current value of specified IMMU TLB Data Access Register. |
| Line 222... | Line 289... | ||
| 222 | { |
289 | { |
| 223 | asi_u64_write(ASI_DTLB_DATA_IN_REG, 0, v); |
290 | asi_u64_write(ASI_DTLB_DATA_IN_REG, 0, v); |
| 224 | flush(); |
291 | flush(); |
| 225 | } |
292 | } |
| 226 | 293 | ||
| - | 294 | /** Read ITLB Synchronous Fault Status Register. |
|
| - | 295 | * |
|
| - | 296 | * @return Current content of I-SFSR register. |
|
| - | 297 | */ |
|
| - | 298 | static inline __u64 itlb_sfsr_read(void) |
|
| - | 299 | { |
|
| - | 300 | return asi_u64_read(ASI_IMMU, VA_IMMU_SFSR); |
|
| - | 301 | } |
|
| - | 302 | ||
| - | 303 | /** Write ITLB Synchronous Fault Status Register. |
|
| - | 304 | * |
|
| - | 305 | * @param v New value of I-SFSR register. |
|
| - | 306 | */ |
|
| - | 307 | static inline void itlb_sfsr_write(__u64 v) |
|
| - | 308 | { |
|
| - | 309 | asi_u64_write(ASI_IMMU, VA_IMMU_SFSR, v); |
|
| - | 310 | flush(); |
|
| - | 311 | } |
|
| - | 312 | ||
| - | 313 | /** Read DTLB Synchronous Fault Status Register. |
|
| - | 314 | * |
|
| - | 315 | * @return Current content of D-SFSR register. |
|
| - | 316 | */ |
|
| - | 317 | static inline __u64 dtlb_sfsr_read(void) |
|
| - | 318 | { |
|
| - | 319 | return asi_u64_read(ASI_DMMU, VA_DMMU_SFSR); |
|
| - | 320 | } |
|
| - | 321 | ||
| - | 322 | /** Write DTLB Synchronous Fault Status Register. |
|
| - | 323 | * |
|
| - | 324 | * @param v New value of D-SFSR register. |
|
| - | 325 | */ |
|
| - | 326 | static inline void dtlb_sfsr_write(__u64 v) |
|
| - | 327 | { |
|
| - | 328 | asi_u64_write(ASI_DMMU, VA_DMMU_SFSR, v); |
|
| - | 329 | flush(); |
|
| - | 330 | } |
|
| - | 331 | ||
| - | 332 | /** Read DTLB Synchronous Fault Address Register. |
|
| - | 333 | * |
|
| - | 334 | * @return Current content of D-SFAR register. |
|
| - | 335 | */ |
|
| - | 336 | static inline __u64 dtlb_sfar_read(void) |
|
| - | 337 | { |
|
| - | 338 | return asi_u64_read(ASI_DMMU, VA_DMMU_SFAR); |
|
| - | 339 | } |
|
| - | 340 | ||
| 227 | /** Perform IMMU TLB Demap Operation. |
341 | /** Perform IMMU TLB Demap Operation. |
| 228 | * |
342 | * |
| 229 | * @param type Selects between context and page demap. |
343 | * @param type Selects between context and page demap. |
| 230 | * @param context_encoding Specifies which Context register has Context ID for demap. |
344 | * @param context_encoding Specifies which Context register has Context ID for demap. |
| 231 | * @param page Address which is on the page to be demapped. |
345 | * @param page Address which is on the page to be demapped. |