diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2013-09-12 11:42:23 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2013-09-12 11:42:23 +0000 |
commit | a82315fd079842e0cda7e283291b9fcba758a48e (patch) | |
tree | 2b54f7ebbbe0a37647023892d109be23818314c3 /sys | |
parent | 10e0719999a9257935e99bc5f782026a6ffc499d (diff) |
Rename cpu_info_store to cpu_info_primary. Create an array of cpu_infos
for SMP, like on amd64. Add some SMP defines.
ok rapha@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/arm/arm/arm32_machdep.c | 15 | ||||
-rw-r--r-- | sys/arch/arm/arm/cpuswitch.S | 12 | ||||
-rw-r--r-- | sys/arch/arm/arm/cpuswitch7.S | 12 | ||||
-rw-r--r-- | sys/arch/arm/arm/irq_dispatch.S | 8 | ||||
-rw-r--r-- | sys/arch/arm/include/cpu.h | 24 |
5 files changed, 48 insertions, 23 deletions
diff --git a/sys/arch/arm/arm/arm32_machdep.c b/sys/arch/arm/arm/arm32_machdep.c index 72512311dce..42257595120 100644 --- a/sys/arch/arm/arm/arm32_machdep.c +++ b/sys/arch/arm/arm/arm32_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arm32_machdep.c,v 1.40 2013/03/27 00:18:19 patrick Exp $ */ +/* $OpenBSD: arm32_machdep.c,v 1.41 2013/09/12 11:42:22 patrick Exp $ */ /* $NetBSD: arm32_machdep.c,v 1.42 2003/12/30 12:33:15 pk Exp $ */ /* @@ -84,8 +84,17 @@ pv_addr_t kernelstack; /* the following is used externally (sysctl_hw) */ char machine[] = MACHINE; /* from <machine/param.h> */ -/* Our exported CPU info; we can have only one. */ -struct cpu_info cpu_info_store; +/* Statically defined CPU info. */ +struct cpu_info cpu_info_primary; +struct cpu_info *cpu_info_list = &cpu_info_primary; + +#ifdef MULTIPROCESSOR +/* + * Array of CPU info structures. Must be statically-allocated because + * curproc, etc. are used early. + */ +struct cpu_info *cpu_info[MAXCPUS] = { &cpu_info_primary }; +#endif caddr_t msgbufaddr; extern paddr_t msgbufphys; diff --git a/sys/arch/arm/arm/cpuswitch.S b/sys/arch/arm/arm/cpuswitch.S index 0e95603c9fc..b18ecf84392 100644 --- a/sys/arch/arm/arm/cpuswitch.S +++ b/sys/arch/arm/arm/cpuswitch.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cpuswitch.S,v 1.12 2011/09/20 22:02:10 miod Exp $ */ +/* $OpenBSD: cpuswitch.S,v 1.13 2013/09/12 11:42:22 patrick Exp $ */ /* $NetBSD: cpuswitch.S,v 1.41 2003/11/15 08:44:18 scw Exp $ */ /* @@ -105,10 +105,10 @@ .text -.Lcpu_info_store: - .word _C_LABEL(cpu_info_store) +.Lcpu_info_primary: + .word _C_LABEL(cpu_info_primary) .Lcurproc: - .word _C_LABEL(cpu_info_store) + CI_CURPROC + .word _C_LABEL(cpu_info_parimary) + CI_CURPROC .Lcpufuncs: .word _C_LABEL(cpufuncs) @@ -123,7 +123,7 @@ _C_LABEL(curpcb): .text #else .Lcurpcb: - .word _C_LABEL(cpu_info_store) + CI_CURPCB + .word _C_LABEL(cpu_info_primary) + CI_CURPCB #endif .Lcpu_do_powersave: @@ -185,7 +185,7 @@ ENTRY(cpu_switchto) #ifdef MULTIPROCESSOR /* XXX use curcpu() */ - ldr r2, .Lcpu_info_store + ldr r2, .Lcpu_info_primary str r2, [r1, #(P_CPU)] #else /* p->p_cpu initialized in fork1() for single-processor */ diff --git a/sys/arch/arm/arm/cpuswitch7.S b/sys/arch/arm/arm/cpuswitch7.S index b6dba01400c..75d3f2618f4 100644 --- a/sys/arch/arm/arm/cpuswitch7.S +++ b/sys/arch/arm/arm/cpuswitch7.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cpuswitch7.S,v 1.1 2013/04/30 13:04:25 patrick Exp $ */ +/* $OpenBSD: cpuswitch7.S,v 1.2 2013/09/12 11:42:22 patrick Exp $ */ /* $NetBSD: cpuswitch.S,v 1.41 2003/11/15 08:44:18 scw Exp $ */ /* @@ -105,10 +105,10 @@ .text -.Lcpu_info_store: - .word _C_LABEL(cpu_info_store) +.Lcpu_info_primary: + .word _C_LABEL(cpu_info_primary) .Lcurproc: - .word _C_LABEL(cpu_info_store) + CI_CURPROC + .word _C_LABEL(cpu_info_primary) + CI_CURPROC .Lcpufuncs: .word _C_LABEL(cpufuncs) @@ -123,7 +123,7 @@ _C_LABEL(curpcb): .text #else .Lcurpcb: - .word _C_LABEL(cpu_info_store) + CI_CURPCB + .word _C_LABEL(cpu_info_primary) + CI_CURPCB #endif .Lcpu_do_powersave: @@ -179,7 +179,7 @@ ENTRY(cpu_switchto) #ifdef MULTIPROCESSOR /* XXX use curcpu() */ - ldr r2, .Lcpu_info_store + ldr r2, .Lcpu_info_primary str r2, [r1, #(P_CPU)] #else /* p->p_cpu initialized in fork1() for single-processor */ diff --git a/sys/arch/arm/arm/irq_dispatch.S b/sys/arch/arm/arm/irq_dispatch.S index 516d618ac47..c84b131fecd 100644 --- a/sys/arch/arm/arm/irq_dispatch.S +++ b/sys/arch/arm/arm/irq_dispatch.S @@ -1,4 +1,4 @@ -/* $OpenBSD: irq_dispatch.S,v 1.8 2013/09/10 12:35:25 patrick Exp $ */ +/* $OpenBSD: irq_dispatch.S,v 1.9 2013/09/12 11:42:22 patrick Exp $ */ /* $NetBSD: irq_dispatch.S,v 1.5 2003/10/30 08:57:24 scw Exp $ */ /* @@ -86,8 +86,8 @@ */ .text .align 0 -.Lcpu_info_store: - .word _C_LABEL(cpu_info_store) +.Lcpu_info_primary: + .word _C_LABEL(cpu_info_primary) AST_LOCALS @@ -105,7 +105,7 @@ ASENTRY_NP(irq_entry) * r5 address of the curcpu struct * r6 old value of curcpu()->ci_idepth */ - ldr r5, .Lcpu_info_store + ldr r5, .Lcpu_info_primary mov r0, sp /* arg for dispatcher */ ldr r6, [r5, #CI_IDEPTH] add r1, r6, #1 diff --git a/sys/arch/arm/include/cpu.h b/sys/arch/arm/include/cpu.h index c05a6dafc1f..6af4b80e716 100644 --- a/sys/arch/arm/include/cpu.h +++ b/sys/arch/arm/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.36 2013/09/10 12:35:26 patrick Exp $ */ +/* $OpenBSD: cpu.h,v 1.37 2013/09/12 11:42:22 patrick Exp $ */ /* $NetBSD: cpu.h,v 1.34 2003/06/23 11:01:08 martin Exp $ */ /* @@ -201,9 +201,11 @@ struct cpu_info { #endif }; +extern struct cpu_info cpu_info_primary; +extern struct cpu_info *cpu_info_list; + #ifndef MULTIPROCESSOR -extern struct cpu_info cpu_info_store; -#define curcpu() (&cpu_info_store) +#define curcpu() (&cpu_info_primary) #define cpu_number() 0 #define CPU_IS_PRIMARY(ci) 1 #define CPU_INFO_ITERATOR int @@ -212,7 +214,21 @@ extern struct cpu_info cpu_info_store; #define CPU_INFO_UNIT(ci) 0 #define MAXCPUS 1 #define cpu_unidle(ci) -#endif +#else +#define cpu_number() (curcpu()->ci_cpuid) +#define CPU_IS_PRIMARY(ci) ((ci) == &cpu_info_primary) +#define CPU_INFO_ITERATOR int +#define CPU_INFO_FOREACH(cii, ci) for (cii = 0, ci = cpu_info_list; \ + ci != NULL; ci = ci->ci_next) + +#define CPU_INFO_UNIT(ci) ((ci)->ci_dev ? (ci)->ci_dev->dv_unit : 0) +#define MAXCPUS 4 +#define cpu_unidle(ci) + +extern struct cpu_info *cpu_info[MAXCPUS]; + +void cpu_boot_secondary_processors(void); +#endif /* !MULTIPROCESSOR */ /* * Scheduling glue |