diff options
author | Kenji Aoyama <aoyama@cvs.openbsd.org> | 2012-01-08 01:26:38 +0000 |
---|---|---|
committer | Kenji Aoyama <aoyama@cvs.openbsd.org> | 2012-01-08 01:26:38 +0000 |
commit | 86f176c96d5dafb2e0858a6a2cd283b4bc336f69 (patch) | |
tree | 2b5c1a33e3696b87bf6e17b4f89622c5a0e1ece2 /sys | |
parent | 22808d2c653fcedb4305e4bb7429ec4a70e35503 (diff) |
Preliminary multi-processor support for luna88k. It is
work-in-progress and is not stable yet...
"Please commit" miod@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/luna88k/luna88k/locore.S | 12 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/machdep.c | 74 |
2 files changed, 66 insertions, 20 deletions
diff --git a/sys/arch/luna88k/luna88k/locore.S b/sys/arch/luna88k/luna88k/locore.S index 43209809346..b123b36c012 100644 --- a/sys/arch/luna88k/luna88k/locore.S +++ b/sys/arch/luna88k/luna88k/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.22 2011/11/19 20:40:10 miod Exp $ */ +/* $OpenBSD: locore.S,v 1.23 2012/01/08 01:26:37 aoyama Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -276,6 +276,16 @@ ASLOCAL(secondary_init) #endif /* MULTIPROCESSOR */ +#ifdef MULTIPROCESSOR + /* + * Dummy mp_atomic_begin() and mp_atomic_end() routine, so that + * we can interact with ddb if things go wrong very early during + * bootstrap. Of course this should never happen (-: + */ +ASLOCAL(dummy_mplock) + jmp r1 +#endif /* MULTIPROCESSOR */ + /* * void delay(int count) * diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c index fdd98d6ebfc..d70892d0fac 100644 --- a/sys/arch/luna88k/luna88k/machdep.c +++ b/sys/arch/luna88k/luna88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.78 2011/06/26 22:39:59 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.79 2012/01/08 01:26:37 aoyama Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -119,7 +119,7 @@ void powerdown(void); void get_fuse_rom_data(void); void get_nvram_data(void); char *nvram_by_symbol(char *); -void get_autoboot_device(void); /* in disksubr.c */ +void get_autoboot_device(void); /* in autoconf.c */ int clockintr(void *); /* in clock.c */ /* @@ -283,19 +283,12 @@ size_memory() * count it up. */ max = (void *)MAXPHYSMEM; -#if 0 - for (look = (void *)Roundup(end, STRIDE); look < max; -#else for (look = (void *)first_addr; look < max; -#endif look = (int *)((unsigned)look + STRIDE)) { unsigned save; /* if can't access, we've reached the end */ if (badaddr((vaddr_t)look, 4)) { -#if defined(DEBUG) - printf("%x\n", look); -#endif look = (int *)((int)look - STRIDE); break; } @@ -694,12 +687,27 @@ vaddr_t secondary_pre_main() { struct cpu_info *ci; + vaddr_t init_stack; + + /* + * Invoke the CMMU initialization routine as early as possible, + * so that we do not risk any memory writes to be lost during + * cache setup. + */ + cmmu_initialize_cpu(cmmu_cpu_number()); + /* + * Now initialize your cpu_info structure. + */ set_cpu_number(cmmu_cpu_number()); ci = curcpu(); + ci->ci_curproc = &proc0; + m88100_smp_setup(ci); + + splhigh(); /* - * Setup CMMUs and translation tables (shared with the master cpu). + * Enable MMU on this processor. */ pmap_bootstrap_cpu(ci->ci_cpuid); @@ -710,6 +718,7 @@ secondary_pre_main() if (init_stack == (vaddr_t)NULL) { printf("cpu%d: unable to allocate startup stack\n", ci->ci_cpuid); + __cpu_simple_unlock(&cpu_mutex); for (;;) ; } @@ -729,17 +738,21 @@ secondary_main() int s; cpu_configuration_print(0); - sched_init_cpu(ci); ncpus++; - __cpu_simple_unlock(&cpu_mutex); + sched_init_cpu(ci); microuptime(&ci->ci_schedstate.spc_runtime); ci->ci_curproc = NULL; + ci->ci_randseed = random(); - set_psr(get_psr() & ~PSR_IND); - spl0(); + __cpu_simple_unlock(&cpu_mutex); + spl0(); SCHED_LOCK(s); + set_psr(get_psr() & ~PSR_IND); + + SET(ci->ci_flags, CIF_ALIVE); + cpu_switchto(NULL, sched_chooseproc()); } @@ -752,7 +765,7 @@ secondary_main() void luna88k_ext_int(struct trapframe *eframe) { - int cpu = cpu_number(); + u_int cpu = cpu_number(); u_int32_t cur_mask, cur_int; u_int level, old_spl; @@ -804,7 +817,13 @@ luna88k_ext_int(struct trapframe *eframe) case 5: case 4: case 3: - isrdispatch_autovec(cur_int); +#ifdef MULTIPROCESSOR + if (cpu == master_cpu) { +#endif + isrdispatch_autovec(cur_int); +#ifdef MULTIPROCESSOR + } +#endif break; default: printf("luna88k_ext_int(): level %d interrupt.\n", cur_int); @@ -900,8 +919,6 @@ luna88k_bootstrap() #ifndef MULTIPROCESSOR cpuid_t master_cpu; #endif - extern void m8820x_initialize_cpu(cpuid_t); - extern void m8820x_set_sapr(cpuid_t, apr_t); cmmu = &cmmu8820x; @@ -921,6 +938,9 @@ luna88k_bootstrap() setup_board_config(); master_cpu = cmmu_init(); set_cpu_number(master_cpu); +#ifdef MULTIPROCESSOR + m88100_smp_setup(curcpu()); +#endif SET(curcpu()->ci_flags, CIF_ALIVE | CIF_PRIMARY); m88100_apply_patches(); @@ -961,8 +981,10 @@ luna88k_bootstrap() /* Initialize the "u-area" pages. */ bzero((caddr_t)curpcb, USPACE); +#ifndef MULTIPROCESSOR /* Release the cpu_mutex */ cpu_boot_secondary_processors(); +#endif #ifdef DEBUG printf("leaving luna88k_bootstrap()\n"); @@ -1156,7 +1178,7 @@ void setlevel(u_int level) { u_int32_t set_value; - int cpu = cpu_number(); + u_int cpu = cpu_number(); set_value = int_set_val[level]; @@ -1206,3 +1228,17 @@ raiseipl(int level) set_psr(psr); return (int)curspl; } + +#ifdef MULTIPROCESSOR +void +m88k_send_ipi(int ipi, cpuid_t cpu) +{ + /* nothing to do on luna88k!? */ +} + +void +m88k_broadcast_ipi(int ipi) +{ + /* nothing to do on luna88k!? */ +} +#endif |