Changeset b4655da in mainline
- Timestamp:
- 2009-11-06T16:59:40Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 74cbac7d
- Parents:
- 66e08d02
- Location:
- kernel/arch/sparc64
- Files:
-
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/Makefile.inc
r66e08d02 rb4655da 64 64 65 65 ARCH_SOURCES = \ 66 arch/$(KARCH)/src/cpu/ cpu.c \66 arch/$(KARCH)/src/cpu/$(USARCH)/cpu.c \ 67 67 arch/$(KARCH)/src/asm.S \ 68 68 arch/$(KARCH)/src/panic.S \ … … 94 94 ifeq ($(USARCH),sun4v) 95 95 ARCH_SOURCES += \ 96 arch/$(KARCH)/src/drivers/niagara.c 96 arch/$(KARCH)/src/drivers/niagara.c \ 97 arch/$(KARCH)/src/sun4v/md.c 97 98 endif 98 99 … … 110 111 ifeq ($(CONFIG_TSB),y) 111 112 ARCH_SOURCES += \ 112 arch/$(KARCH)/src/mm/ tsb.c113 arch/$(KARCH)/src/mm/$(USARCH)/tsb.c 113 114 endif -
kernel/arch/sparc64/include/drivers/tick.h
r66e08d02 rb4655da 36 36 #define KERN_sparc64_TICK_H_ 37 37 38 #include <arch/asm.h> 38 39 #include <arch/interrupt.h> 40 41 /* mask of the "counter" field of the Tick register */ 42 #define TICK_COUNTER_MASK (~(1l << 63)) 39 43 40 44 extern void tick_init(void); 41 45 extern void tick_interrupt(int n, istate_t *istate); 46 47 /** 48 * Reads the Tick register counter. 49 */ 50 static inline uint64_t tick_counter_read(void) 51 { 52 return TICK_COUNTER_MASK & tick_read(); 53 } 42 54 43 55 #endif -
kernel/arch/sparc64/include/mm/tte.h
r66e08d02 rb4655da 36 36 #define KERN_sparc64_TTE_H_ 37 37 38 #define TTE_G (1 << 0) 39 #define TTE_W (1 << 1) 40 #define TTE_P (1 << 2) 41 #define TTE_E (1 << 3) 42 #define TTE_CV (1 << 4) 43 #define TTE_CP (1 << 5) 44 #define TTE_L (1 << 6) 45 46 #define TTE_V_SHIFT 63 47 #define TTE_SIZE_SHIFT 61 48 49 #ifndef __ASM__ 50 51 #include <arch/types.h> 52 53 /* TTE tag's VA_tag field contains bits <63:VA_TAG_PAGE_SHIFT> of the VA */ 54 #define VA_TAG_PAGE_SHIFT 22 55 56 /** Translation Table Entry - Tag. */ 57 union tte_tag { 58 uint64_t value; 59 struct { 60 unsigned g : 1; /**< Global. */ 61 unsigned : 2; /**< Reserved. */ 62 unsigned context : 13; /**< Context identifier. */ 63 unsigned : 6; /**< Reserved. */ 64 uint64_t va_tag : 42; /**< Virtual Address Tag, bits 63:22. */ 65 } __attribute__ ((packed)); 66 }; 67 68 typedef union tte_tag tte_tag_t; 69 70 /** Translation Table Entry - Data. */ 71 union tte_data { 72 uint64_t value; 73 struct { 74 unsigned v : 1; /**< Valid. */ 75 unsigned size : 2; /**< Page size of this entry. */ 76 unsigned nfo : 1; /**< No-Fault-Only. */ 77 unsigned ie : 1; /**< Invert Endianness. */ 78 unsigned soft2 : 9; /**< Software defined field. */ 79 #if defined (US) 80 unsigned diag : 9; /**< Diagnostic data. */ 81 unsigned pfn : 28; /**< Physical Address bits, bits 40:13. */ 82 #elif defined (US3) 83 unsigned : 7; /**< Reserved. */ 84 unsigned pfn : 30; /**< Physical Address bits, bits 42:13 */ 38 #if defined (SUN4U) 39 #include <arch/mm/sun4u/tte.h> 40 #elif defined (SUN4V) 41 #include <arch/mm/sun4v/tte.h> 85 42 #endif 86 unsigned soft : 6; /**< Software defined field. */87 unsigned l : 1; /**< Lock. */88 unsigned cp : 1; /**< Cacheable in physically indexed cache. */89 unsigned cv : 1; /**< Cacheable in virtually indexed cache. */90 unsigned e : 1; /**< Side-effect. */91 unsigned p : 1; /**< Privileged. */92 unsigned w : 1; /**< Writable. */93 unsigned g : 1; /**< Global. */94 } __attribute__ ((packed));95 };96 97 typedef union tte_data tte_data_t;98 99 #endif /* !def __ASM__ */100 43 101 44 #endif -
kernel/arch/sparc64/src/drivers/tick.c
r66e08d02 rb4655da 54 54 interrupt_register(14, "tick_int", tick_interrupt); 55 55 compare.int_dis = false; 56 compare.tick_cmpr = CPU->arch.clock_frequency / HZ; 56 compare.tick_cmpr = tick_counter_read() + 57 CPU->arch.clock_frequency / HZ; 57 58 CPU->arch.next_tick_cmpr = compare.tick_cmpr; 58 59 tick_compare_write(compare.value); 59 tick_write(0);60 60 61 #if defined (US3) 61 #if defined (US3) || defined (SUN4V) 62 62 /* disable STICK interrupts and clear any pending ones */ 63 63 tick_compare_reg_t stick_compare; … … 111 111 * overflow only in 146 years. 112 112 */ 113 drift = tick_ read() - CPU->arch.next_tick_cmpr;113 drift = tick_counter_read() - CPU->arch.next_tick_cmpr; 114 114 while (drift > CPU->arch.clock_frequency / HZ) { 115 115 drift -= CPU->arch.clock_frequency / HZ; 116 116 CPU->missed_clock_ticks++; 117 117 } 118 CPU->arch.next_tick_cmpr = tick_ read() +118 CPU->arch.next_tick_cmpr = tick_counter_read() + 119 119 (CPU->arch.clock_frequency / HZ) - drift; 120 120 tick_compare_write(CPU->arch.next_tick_cmpr); -
kernel/arch/sparc64/src/mm/sun4v/tlb.c
r66e08d02 rb4655da 37 37 #include <mm/as.h> 38 38 #include <mm/asid.h> 39 #include <arch/sun4v/hypercall.h> 39 40 #include <arch/mm/frame.h> 40 41 #include <arch/mm/page.h> 41 #include <arch/mm/mmu.h> 42 #include <arch/mm/tte.h> 43 #include <arch/mm/tlb.h> 42 44 #include <arch/interrupt.h> 43 45 #include <interrupt.h> … … 70 72 }; 71 73 74 /** Invalidate all unlocked ITLB and DTLB entries. */ 75 void tlb_invalidate_all(void) 76 { 77 uint64_t errno = __hypercall_fast3(MMU_DEMAP_ALL, 0, 0, 78 MMU_FLAG_DTLB | MMU_FLAG_ITLB); 79 if (errno != EOK) { 80 panic("Error code = %d.\n", errno); 81 } 82 } 83 72 84 void tlb_arch_init(void) 73 85 { 74 /* 75 * Invalidate all non-locked DTLB and ITLB entries. 76 */ 77 //MH 78 //tlb_invalidate_all(); 79 80 /* 81 * Clear both SFSRs. 82 */ 83 //MH 84 //dtlb_sfsr_write(0); 85 //itlb_sfsr_write(0); 86 tlb_invalidate_all(); 86 87 } 87 88 … … 97 98 bool locked, bool cacheable) 98 99 { 100 #if 0 99 101 tlb_tag_access_reg_t tag; 100 102 tlb_data_t data; … … 124 126 125 127 dtlb_data_in_write(data.value); 128 #endif 126 129 } 127 130 … … 135 138 void dtlb_pte_copy(pte_t *t, size_t index, bool ro) 136 139 { 140 #if 0 137 141 tlb_tag_access_reg_t tag; 138 142 tlb_data_t data; … … 163 167 164 168 dtlb_data_in_write(data.value); 169 #endif 165 170 } 166 171 … … 172 177 void itlb_pte_copy(pte_t *t, size_t index) 173 178 { 179 #if 0 174 180 tlb_tag_access_reg_t tag; 175 181 tlb_data_t data; … … 197 203 198 204 itlb_data_in_write(data.value); 205 #endif 199 206 } 200 207 … … 362 369 static void print_tlb_entry(int i, tlb_tag_read_reg_t t, tlb_data_t d) 363 370 { 371 #if 0 364 372 printf("%d: vpn=%#llx, context=%d, v=%d, size=%d, nfo=%d, " 365 373 "ie=%d, soft2=%#x, pfn=%#x, soft=%#x, l=%d, " … … 367 375 t.context, d.v, d.size, d.nfo, d.ie, d.soft2, 368 376 d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g); 377 #endif 369 378 } 370 379 … … 502 511 } 503 512 504 #if defined (US)505 /** Invalidate all unlocked ITLB and DTLB entries. */506 void tlb_invalidate_all(void)507 {508 int i;509 510 /*511 * Walk all ITLB and DTLB entries and remove all unlocked mappings.512 *513 * The kernel doesn't use global mappings so any locked global mappings514 * found must have been created by someone else. Their only purpose now515 * is to collide with proper mappings. Invalidate immediately. It should516 * be safe to invalidate them as late as now.517 */518 519 tlb_data_t d;520 tlb_tag_read_reg_t t;521 522 for (i = 0; i < ITLB_ENTRY_COUNT; i++) {523 d.value = itlb_data_access_read(i);524 if (!d.l || d.g) {525 t.value = itlb_tag_read_read(i);526 d.v = false;527 itlb_tag_access_write(t.value);528 itlb_data_access_write(i, d.value);529 }530 }531 532 for (i = 0; i < DTLB_ENTRY_COUNT; i++) {533 d.value = dtlb_data_access_read(i);534 if (!d.l || d.g) {535 t.value = dtlb_tag_read_read(i);536 d.v = false;537 dtlb_tag_access_write(t.value);538 dtlb_data_access_write(i, d.value);539 }540 }541 542 }543 544 #elif defined (US3)545 546 /** Invalidate all unlocked ITLB and DTLB entries. */547 void tlb_invalidate_all(void)548 {549 itlb_demap(TLB_DEMAP_ALL, 0, 0);550 dtlb_demap(TLB_DEMAP_ALL, 0, 0);551 }552 553 #endif554 555 513 /** Invalidate all ITLB and DTLB entries that belong to specified ASID 556 514 * (Context). -
kernel/arch/sparc64/src/sun4v/sparc64.c
r66e08d02 rb4655da 38 38 #include <arch/trap/trap.h> 39 39 #include <arch/console.h> 40 #include <arch/sun4v/md.h> 40 41 #include <console/console.h> 41 42 #include <arch/boot/boot.h> … … 68 69 bootinfo.taskmap.tasks[i].name); 69 70 } 71 72 md_init(); 70 73 } 71 74
Note:
See TracChangeset
for help on using the changeset viewer.