diff options
author | Takuya ASADA <syuu@cvs.openbsd.org> | 2010-11-23 22:06:58 +0000 |
---|---|---|
committer | Takuya ASADA <syuu@cvs.openbsd.org> | 2010-11-23 22:06:58 +0000 |
commit | d9263f9607798c81e469c6b3ff7dda0be55705b2 (patch) | |
tree | 678fc749d8630ff7c8887f3cddb03ecc2e51a391 /sys/arch/octeon | |
parent | 3d03c809ed4b5bc94de1b69bbca15cf4c06a5322 (diff) |
passing stack pointer to secondary processors
Diffstat (limited to 'sys/arch/octeon')
-rw-r--r-- | sys/arch/octeon/octeon/locore.S | 64 | ||||
-rw-r--r-- | sys/arch/octeon/octeon/machdep.c | 13 |
2 files changed, 32 insertions, 45 deletions
diff --git a/sys/arch/octeon/octeon/locore.S b/sys/arch/octeon/octeon/locore.S index c1ad41f6d42..19711476d68 100644 --- a/sys/arch/octeon/octeon/locore.S +++ b/sys/arch/octeon/octeon/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.2 2010/11/08 12:36:57 syuu Exp $ */ +/* $OpenBSD: locore.S,v 1.3 2010/11/23 22:06:57 syuu Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -51,25 +51,16 @@ start: dmtc0 t0, COP_0_CVMCTL /* initialize cvmmemctl */ -/* dli t0, 0x1846104 # If you want to skip write buffer, use this -*/ +/* dli t0, 0x46104 +*/ dmtc0 t0, COP_0_CVMMEMCTL /* initialize pagegrain */ dli t0, 0x20000000 dmtc0 t0, COP_0_TLB_PG_GRAIN -#if defined(MULTIPROCESSOR) - rdhwr t2, $0 - beqz t2, 1f - nop - j octeon_ap_wait - nop -1: -#endif - mfc0 v0, COP_0_STATUS_REG li v1, ~(SR_INT_ENAB | SR_ERL | SR_EXL) and v0, v1 @@ -77,11 +68,27 @@ start: mtc0 zero, COP_0_CAUSE_REG # Clear soft interrupts + LA gp, _gp + +#if defined(MULTIPROCESSOR) + rdhwr t2, $0 + beqz t2, 2f + nop +1: ll t0, cpu_spinup_mask + bne t2, t0, 1b + nop + move t0, zero + sc t0, cpu_spinup_mask + beqz t0, 1b + nop + j hw_cpu_spinup_trampoline + nop +2: +#endif /* * Initialize stack and call machine startup. */ LA t0, start - FRAMESZ(CF_SZ) - LA gp, _gp PTR_S ra, CF_RA_OFFS(t0) # save pmon return address PTR_S sp, 0(t0) # and stack move sp, t0 @@ -121,15 +128,10 @@ END(get_cvmmemctl) #if defined(MULTIPROCESSOR) LEAF(hw_cpu_spinup_trampoline, 0) - mfc0 v0, COP_0_STATUS_REG - li v1, ~(SR_INT_ENAB | SR_ERL | SR_EXL) - and v0, v1 - ori v0, SR_KX | SR_UX - mtc0 v0, COP_0_STATUS_REG # disable all interrupts - mtc0 zero, COP_0_CAUSE_REG # Clear soft interrupts - LA gp, _gp - LA a0, cpu_info_boot_secondary - ld a0, 0(a0) + LA t0, cpu_spinup_a0 + ld a0, 0(t0) + LA t0, cpu_spinup_sp + ld sp, 0(t0) jal hw_cpu_hatch nop END(hw_cpu_spinup_trampoline) @@ -145,22 +147,4 @@ LEAF(hw_setcurcpu, 0) j ra nop END(hw_setcurcpu) - -/* - * Called on APs to wait until they are told to launch. - */ -LEAF(octeon_ap_wait, 0) -1: ll t0, octeon_ap_boot - bne t2, t0, 1b - nop - - move t0, zero - sc t0, octeon_ap_boot - - beqz t0, 1b - nop - - j hw_cpu_spinup_trampoline - nop -END(octeon_ap_wait) #endif /* MULTIPROCESSOR */ diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c index 0adb89d0208..0919916b12e 100644 --- a/sys/arch/octeon/octeon/machdep.c +++ b/sys/arch/octeon/octeon/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.5 2010/11/23 18:46:29 syuu Exp $ */ +/* $OpenBSD: machdep.c,v 1.6 2010/11/23 22:06:57 syuu Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -662,8 +662,8 @@ is_memory_range(paddr_t pa, psize_t len, psize_t limit) } #ifdef MULTIPROCESSOR -unsigned octeon_ap_boot = ~0; -struct cpu_info *cpu_info_boot_secondary = NULL; +uint32_t cpu_spinup_mask = 0; +uint64_t cpu_spinup_a0, cpu_spinup_sp; static int (*ipi_handler)(void *); uint32_t ipi_intr(uint32_t, struct trap_frame *); @@ -680,8 +680,9 @@ hw_cpu_boot_secondary(struct cpu_info *ci) if (kstack == NULL) panic("unable to allocate idle stack\n"); ci->ci_curprocpaddr = (void *)kstack; - cpu_info_boot_secondary = ci; - octeon_ap_boot = ci->ci_cpuid; + cpu_spinup_a0 = (uint64_t)ci; + cpu_spinup_sp = (uint64_t)(kstack + USPACE); + cpu_spinup_mask = (uint32_t)ci->ci_cpuid; while (!cpuset_isset(&cpus_running, ci)) ; @@ -722,6 +723,8 @@ hw_cpu_hatch(struct cpu_info *ci) Octeon_ConfigCache(ci); Mips_SyncCache(ci); + printf("cpu%d launched\n", cpu_number()); + cpu_startclock(ci); ncpus++; cpuset_add(&cpus_running, ci); |