Changeset 18baf9c0 in mainline
- Timestamp:
- 2009-11-20T17:14:32Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3da11f37
- Parents:
- 5a4fef9
- Location:
- kernel/arch/sparc64
- Files:
-
- 3 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/sparc64/Makefile.inc
r5a4fef9 r18baf9c0 66 66 arch/$(KARCH)/src/cpu/$(USARCH)/cpu.c \ 67 67 arch/$(KARCH)/src/asm.S \ 68 arch/$(KARCH)/src/$(USARCH)/asm.S \ 68 69 arch/$(KARCH)/src/panic.S \ 69 70 arch/$(KARCH)/src/console.c \ … … 78 79 arch/$(KARCH)/src/$(USARCH)/sparc64.c \ 79 80 arch/$(KARCH)/src/$(USARCH)/start.S \ 80 arch/$(KARCH)/src/proc/ scheduler.c \81 arch/$(KARCH)/src/proc/$(USARCH)/scheduler.c \ 81 82 arch/$(KARCH)/src/proc/thread.c \ 82 83 arch/$(KARCH)/src/trap/$(USARCH)/mmu.S \ -
kernel/arch/sparc64/include/arch.h
r5a4fef9 r18baf9c0 38 38 #define KERN_sparc64_ARCH_H_ 39 39 40 #if defined (SUN4U) 41 #include <arch/sun4u/arch.h> 42 #elif defined (SUN4V) 43 #include <arch/sun4v/arch.h> 44 #endif 45 40 46 #define ASI_AIUP 0x10 /** Access to primary context with user privileges. */ 41 47 #define ASI_AIUS 0x11 /** Access to secondary context with user privileges. */ 42 #define ASI_NUCLEUS_QUAD_LDD 0x24 /** ASI for 16-byte atomic loads. */43 #define ASI_DCACHE_TAG 0x47 /** ASI D-Cache Tag. */44 #define ASI_ICBUS_CONFIG 0x4a /** ASI of the UPA_CONFIG/FIREPLANE_CONFIG register. */45 48 46 49 #define NWINDOWS 8 /** Number of register window sets. */ … … 52 55 #endif /* __ASM__ */ 53 56 57 54 58 #endif 55 59 -
kernel/arch/sparc64/include/mm/mmu.h
r5a4fef9 r18baf9c0 36 36 #define KERN_sparc64_MMU_H_ 37 37 38 #if defined(US) 39 /* LSU Control Register ASI. */ 40 #define ASI_LSU_CONTROL_REG 0x45 /**< Load/Store Unit Control Register. */ 38 #if defined (SUN4U) 39 #include <arch/mm/sun4u/mmu.h> 40 #elif defined (SUN4V) 41 #include <arch/mm/sun4v/mmu.h> 41 42 #endif 42 43 43 /* I-MMU ASIs. */44 #define ASI_IMMU 0x5045 #define ASI_IMMU_TSB_8KB_PTR_REG 0x5146 #define ASI_IMMU_TSB_64KB_PTR_REG 0x5247 #define ASI_ITLB_DATA_IN_REG 0x5448 #define ASI_ITLB_DATA_ACCESS_REG 0x5549 #define ASI_ITLB_TAG_READ_REG 0x5650 #define ASI_IMMU_DEMAP 0x5751 52 /* Virtual Addresses within ASI_IMMU. */53 #define VA_IMMU_TSB_TAG_TARGET 0x0 /**< IMMU TSB tag target register. */54 #define VA_IMMU_SFSR 0x18 /**< IMMU sync fault status register. */55 #define VA_IMMU_TSB_BASE 0x28 /**< IMMU TSB base register. */56 #define VA_IMMU_TAG_ACCESS 0x30 /**< IMMU TLB tag access register. */57 #if defined (US3)58 #define VA_IMMU_PRIMARY_EXTENSION 0x48 /**< IMMU TSB primary extension register */59 #define VA_IMMU_NUCLEUS_EXTENSION 0x58 /**< IMMU TSB nucleus extension register */60 #endif61 62 63 /* D-MMU ASIs. */64 #define ASI_DMMU 0x5865 #define ASI_DMMU_TSB_8KB_PTR_REG 0x5966 #define ASI_DMMU_TSB_64KB_PTR_REG 0x5a67 #define ASI_DMMU_TSB_DIRECT_PTR_REG 0x5b68 #define ASI_DTLB_DATA_IN_REG 0x5c69 #define ASI_DTLB_DATA_ACCESS_REG 0x5d70 #define ASI_DTLB_TAG_READ_REG 0x5e71 #define ASI_DMMU_DEMAP 0x5f72 73 /* Virtual Addresses within ASI_DMMU. */74 #define VA_DMMU_TSB_TAG_TARGET 0x0 /**< DMMU TSB tag target register. */75 #define VA_PRIMARY_CONTEXT_REG 0x8 /**< DMMU primary context register. */76 #define VA_SECONDARY_CONTEXT_REG 0x10 /**< DMMU secondary context register. */77 #define VA_DMMU_SFSR 0x18 /**< DMMU sync fault status register. */78 #define VA_DMMU_SFAR 0x20 /**< DMMU sync fault address register. */79 #define VA_DMMU_TSB_BASE 0x28 /**< DMMU TSB base register. */80 #define VA_DMMU_TAG_ACCESS 0x30 /**< DMMU TLB tag access register. */81 #define VA_DMMU_VA_WATCHPOINT_REG 0x38 /**< DMMU VA data watchpoint register. */82 #define VA_DMMU_PA_WATCHPOINT_REG 0x40 /**< DMMU PA data watchpoint register. */83 #if defined (US3)84 #define VA_DMMU_PRIMARY_EXTENSION 0x48 /**< DMMU TSB primary extension register */85 #define VA_DMMU_SECONDARY_EXTENSION 0x50 /**< DMMU TSB secondary extension register */86 #define VA_DMMU_NUCLEUS_EXTENSION 0x58 /**< DMMU TSB nucleus extension register */87 #endif88 89 #ifndef __ASM__90 91 #include <arch/asm.h>92 #include <arch/barrier.h>93 #include <arch/types.h>94 95 #if defined(US)96 /** LSU Control Register. */97 typedef union {98 uint64_t value;99 struct {100 unsigned : 23;101 unsigned pm : 8;102 unsigned vm : 8;103 unsigned pr : 1;104 unsigned pw : 1;105 unsigned vr : 1;106 unsigned vw : 1;107 unsigned : 1;108 unsigned fm : 16;109 unsigned dm : 1; /**< D-MMU enable. */110 unsigned im : 1; /**< I-MMU enable. */111 unsigned dc : 1; /**< D-Cache enable. */112 unsigned ic : 1; /**< I-Cache enable. */113 114 } __attribute__ ((packed));115 } lsu_cr_reg_t;116 #endif /* US */117 118 #endif /* !def __ASM__ */119 44 120 45 #endif -
kernel/arch/sparc64/include/mm/sun4v/mmu.h
r5a4fef9 r18baf9c0 45 45 #define ASI_SECONDARY_CONTEXT_REG 0x21 /**< secondary context register ASI. */ 46 46 47 48 49 50 51 52 53 54 55 56 57 /* I-MMU ASIs. */ 58 #define ASI_IMMU 0x50 59 #define ASI_IMMU_TSB_8KB_PTR_REG 0x51 60 #define ASI_IMMU_TSB_64KB_PTR_REG 0x52 61 #define ASI_ITLB_DATA_IN_REG 0x54 62 #define ASI_ITLB_DATA_ACCESS_REG 0x55 63 #define ASI_ITLB_TAG_READ_REG 0x56 64 #define ASI_IMMU_DEMAP 0x57 65 66 /* Virtual Addresses within ASI_IMMU. */ 67 #define VA_IMMU_TSB_TAG_TARGET 0x0 /**< IMMU TSB tag target register. */ 68 #define VA_IMMU_SFSR 0x18 /**< IMMU sync fault status register. */ 69 #define VA_IMMU_TSB_BASE 0x28 /**< IMMU TSB base register. */ 70 #define VA_IMMU_TAG_ACCESS 0x30 /**< IMMU TLB tag access register. */ 71 #if defined (US3) 72 #define VA_IMMU_PRIMARY_EXTENSION 0x48 /**< IMMU TSB primary extension register */ 73 #define VA_IMMU_NUCLEUS_EXTENSION 0x58 /**< IMMU TSB nucleus extension register */ 74 #endif 75 76 77 /* D-MMU ASIs. */ 78 #define ASI_DMMU 0x58 79 #define ASI_DMMU_TSB_8KB_PTR_REG 0x59 80 #define ASI_DMMU_TSB_64KB_PTR_REG 0x5a 81 #define ASI_DMMU_TSB_DIRECT_PTR_REG 0x5b 82 #define ASI_DTLB_DATA_IN_REG 0x5c 83 #define ASI_DTLB_DATA_ACCESS_REG 0x5d 84 #define ASI_DTLB_TAG_READ_REG 0x5e 85 #define ASI_DMMU_DEMAP 0x5f 86 87 /* Virtual Addresses within ASI_DMMU. */ 88 #define VA_DMMU_TSB_TAG_TARGET 0x0 /**< DMMU TSB tag target register. */ 89 #define VA_PRIMARY_CONTEXT_REG 0x8 /**< DMMU primary context register. */ 90 #define VA_SECONDARY_CONTEXT_REG 0x10 /**< DMMU secondary context register. */ 91 #define VA_DMMU_SFSR 0x18 /**< DMMU sync fault status register. */ 92 #define VA_DMMU_SFAR 0x20 /**< DMMU sync fault address register. */ 93 #define VA_DMMU_TSB_BASE 0x28 /**< DMMU TSB base register. */ 94 #define VA_DMMU_TAG_ACCESS 0x30 /**< DMMU TLB tag access register. */ 95 #define VA_DMMU_VA_WATCHPOINT_REG 0x38 /**< DMMU VA data watchpoint register. */ 96 #define VA_DMMU_PA_WATCHPOINT_REG 0x40 /**< DMMU PA data watchpoint register. */ 97 #if defined (US3) 98 #define VA_DMMU_PRIMARY_EXTENSION 0x48 /**< DMMU TSB primary extension register */ 99 #define VA_DMMU_SECONDARY_EXTENSION 0x50 /**< DMMU TSB secondary extension register */ 100 #define VA_DMMU_NUCLEUS_EXTENSION 0x58 /**< DMMU TSB nucleus extension register */ 101 #endif 102 103 #ifndef __ASM__ 104 105 #include <arch/asm.h> 106 #include <arch/barrier.h> 107 #include <arch/types.h> 108 109 #if defined(US) 110 /** LSU Control Register. */ 111 typedef union { 112 uint64_t value; 113 struct { 114 unsigned : 23; 115 unsigned pm : 8; 116 unsigned vm : 8; 117 unsigned pr : 1; 118 unsigned pw : 1; 119 unsigned vr : 1; 120 unsigned vw : 1; 121 unsigned : 1; 122 unsigned fm : 16; 123 unsigned dm : 1; /**< D-MMU enable. */ 124 unsigned im : 1; /**< I-MMU enable. */ 125 unsigned dc : 1; /**< D-Cache enable. */ 126 unsigned ic : 1; /**< I-Cache enable. */ 127 128 } __attribute__ ((packed)); 129 } lsu_cr_reg_t; 130 #endif /* US */ 131 132 #endif /* !def __ASM__ */ 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 47 149 #endif 48 150 -
kernel/arch/sparc64/include/sun4v/arch.h
r5a4fef9 r18baf9c0 58 58 #define SCRATCHPAD_WBUF 0x18 59 59 60 //MH - remove when cpu.h is forked 61 #define ASI_NUCLEUS_QUAD_LDD 0x24 /** ASI for 16-byte atomic loads. */ 62 #define ASI_DCACHE_TAG 0x47 /** ASI D-Cache Tag. */ 63 #define ASI_ICBUS_CONFIG 0x4a /** ASI of the UPA_CONFIG/FIREPLANE_CONFIG register. */ 64 60 65 #endif 61 66 -
kernel/arch/sparc64/include/sun4v/cpu.h
r5a4fef9 r18baf9c0 55 55 } exec_unit_t; 56 56 57 // MH 58 #if 0 57 59 typedef struct cpu_arch { 58 60 uint64_t id; /**< virtual processor ID */ … … 65 67 so that cores are equally balanced. */ 66 68 } cpu_arch_t; 69 #endif 67 70 68 71 #endif -
kernel/arch/sparc64/src/asm.S
r5a4fef9 r18baf9c0 29 29 #include <arch/arch.h> 30 30 #include <arch/stack.h> 31 #include <arch/regdef.h>32 #include <arch/mm/mmu.h>33 31 34 32 .text … … 234 232 nop 235 233 236 237 .macro WRITE_ALTERNATE_REGISTER reg, bit238 rdpr %pstate, %g1 ! save PSTATE.PEF239 wrpr %g0, (\bit | PSTATE_PRIV_BIT), %pstate240 mov %o0, \reg241 wrpr %g0, PSTATE_PRIV_BIT, %pstate242 retl243 wrpr %g1, 0, %pstate ! restore PSTATE.PEF244 .endm245 246 .macro READ_ALTERNATE_REGISTER reg, bit247 rdpr %pstate, %g1 ! save PSTATE.PEF248 wrpr %g0, (\bit | PSTATE_PRIV_BIT), %pstate249 mov \reg, %o0250 wrpr %g0, PSTATE_PRIV_BIT, %pstate251 retl252 wrpr %g1, 0, %pstate ! restore PSTATE.PEF253 .endm254 255 .global write_to_ag_g6256 write_to_ag_g6:257 WRITE_ALTERNATE_REGISTER %g6, PSTATE_AG_BIT258 259 .global write_to_ag_g7260 write_to_ag_g7:261 WRITE_ALTERNATE_REGISTER %g7, PSTATE_AG_BIT262 263 .global write_to_ig_g6264 write_to_ig_g6:265 WRITE_ALTERNATE_REGISTER %g6, PSTATE_IG_BIT266 267 .global read_from_ag_g7268 read_from_ag_g7:269 READ_ALTERNATE_REGISTER %g7, PSTATE_AG_BIT270 271 272 /** Switch to userspace.273 *274 * %o0 Userspace entry address.275 * %o1 Userspace stack pointer address.276 * %o2 Userspace address of uarg structure.277 */278 .global switch_to_userspace279 switch_to_userspace:280 save %o1, -(STACK_WINDOW_SAVE_AREA_SIZE + STACK_ARG_SAVE_AREA_SIZE), %sp281 flushw282 wrpr %g0, 0, %cleanwin ! avoid information leak283 284 mov %i2, %o0 ! uarg285 xor %o1, %o1, %o1 ! %o1 is defined to hold pcb_ptr286 ! set it to 0287 288 clr %i2289 clr %i3290 clr %i4291 clr %i5292 clr %i6293 294 wrpr %g0, 1, %tl ! enforce mapping via nucleus295 296 rdpr %cwp, %g1297 wrpr %g1, TSTATE_IE_BIT, %tstate298 wrpr %i0, 0, %tnpc299 300 /*301 * Set primary context according to secondary context.302 * Secondary context has been already installed by303 * higher-level functions.304 */305 wr %g0, ASI_DMMU, %asi306 ldxa [VA_SECONDARY_CONTEXT_REG] %asi, %g1307 stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi308 flush %i7309 310 /*311 * Spills and fills will be handled by the userspace handlers.312 */313 wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate314 315 done ! jump to userspace316 -
kernel/arch/sparc64/src/proc/sun4v/scheduler.c
r5a4fef9 r18baf9c0 1 1 /* 2 2 * Copyright (c) 2006 Jakub Jermar 3 * Copyright (c) 2009 Pavel Rimsky4 3 * All rights reserved. 5 4 * … … 38 37 #include <arch.h> 39 38 #include <arch/asm.h> 39 #include <arch/arch.h> 40 40 #include <arch/stack.h> 41 41 #include <arch/sun4v/cpu.h> 42 #include <arch/sun4v/arch.h>43 42 #include <arch/sun4v/hypercall.h> 44 43
Note:
See TracChangeset
for help on using the changeset viewer.