Changeset b6fba84 in mainline
- Timestamp:
- 2006-02-24T11:58:09Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 68656282
- Parents:
- 0d3ff9a
- Location:
- arch/sparc64
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/sparc64/include/asm.h
r0d3ff9a rb6fba84 237 237 } 238 238 239 /** Read Trap Program Counter register. 240 * 241 * @return Current value in TPC. 242 */ 243 static inline __u64 tpc_read(void) 244 { 245 __u64 v; 246 247 __asm__ volatile ("rdpr %%tpc, %0\n" : "=r" (v)); 248 249 return v; 250 } 251 252 239 253 /** Write Trap Base Address register. 240 254 * -
arch/sparc64/include/mm/tlb.h
r0d3ff9a rb6fba84 47 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 58 /** I-/D-TLB Data In/Access Register type. */ 50 59 typedef tte_data_t tlb_data_t; … … 95 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 164 /** Read IMMU TLB Data Access Register. 98 165 * … … 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 341 /** Perform IMMU TLB Demap Operation. 228 342 * -
arch/sparc64/src/mm/memory_init.c
r0d3ff9a rb6fba84 1 1 /* 2 * Copyright (C) 200 5Jakub Jermar2 * Copyright (C) 2006 Jakub Jermar 3 3 * All rights reserved. 4 4 * -
arch/sparc64/src/mm/tlb.c
r0d3ff9a rb6fba84 38 38 #include <arch/trap/trap.h> 39 39 #include <panic.h> 40 #include <arch/asm.h> 41 #include <symtab.h> 42 43 char *context_encoding[] = { 44 "Primary", 45 "Secondary", 46 "Nucleus", 47 "Reserved" 48 }; 40 49 41 50 /** Initialize ITLB and DTLB. … … 97 106 dmmu_enable(); 98 107 immu_enable(); 108 109 /* 110 * Quick hack: map frame buffer 111 */ 112 fr.address = 0x1C901000000ULL; 113 pg.address = 0xc0000000; 114 115 tag.value = 0; 116 tag.vpn = pg.vpn; 117 118 dtlb_tag_access_write(tag.value); 119 120 data.value = 0; 121 data.v = true; 122 data.size = PAGESIZE_4M; 123 data.pfn = fr.pfn; 124 data.l = true; 125 data.cp = 0; 126 data.cv = 0; 127 data.p = true; 128 data.w = true; 129 data.g = true; 130 131 dtlb_data_in_write(data.value); 132 99 133 } 100 134 … … 108 142 void fast_data_access_mmu_miss(void) 109 143 { 144 tlb_sfsr_reg_t status; 145 __address address, tpc; 146 char *tpc_str; 147 148 status.value = dtlb_sfsr_read(); 149 address = dtlb_sfar_read(); 150 tpc = tpc_read(); 151 tpc_str = get_symtab_entry(tpc); 152 153 printf("ASI=%B, Context=%s\n", status.asi, context_encoding[status.ct]); 154 printf("Faulting address: %P\n", dtlb_sfar_read()); 155 printf("TPC=%P, (%s)\n", tpc, tpc_str ? tpc_str : "?"); 110 156 panic("%s\n", __FUNCTION__); 111 157 }
Note:
See TracChangeset
for help on using the changeset viewer.