summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2009-03-15 20:07:15 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2009-03-15 20:07:15 +0000
commitabb057e2ebdbe264ef7de85bffff2cb3aab73ac2 (patch)
treecad125fc5710de126fabf8ac40d93aee1711a334 /sys
parentd645111a1580344c3de63b04d923df67842f078e (diff)
Let CPU_INFO_UNIT() be used before cpu0 attaches, and make sure
CPU_INFO_FOREACH() only covers attached cpus. With drahn@, ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/powerpc/include/cpu.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/arch/powerpc/include/cpu.h b/sys/arch/powerpc/include/cpu.h
index 1116f5db74e..61a65501c97 100644
--- a/sys/arch/powerpc/include/cpu.h
+++ b/sys/arch/powerpc/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.42 2008/11/22 14:42:29 art Exp $ */
+/* $OpenBSD: cpu.h,v 1.43 2009/03/15 20:07:14 miod Exp $ */
/* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */
/*
@@ -95,7 +95,7 @@ curcpu(void)
#define curpcb (curcpu()->ci_curpcb)
#define curpm (curcpu()->ci_curpm)
-#define CPU_INFO_UNIT(ci) ((ci)->ci_dev->dv_unit)
+#define CPU_INFO_UNIT(ci) ((ci)->ci_dev ? (ci)->ci_dev->dv_unit : 0)
#ifdef MULTIPROCESSOR
@@ -115,7 +115,7 @@ void cpu_boot_secondary_processors(void);
#define CPU_IS_PRIMARY(ci) ((ci)->ci_cpuid == 0)
#define CPU_INFO_ITERATOR int
#define CPU_INFO_FOREACH(cii, ci) \
- for (cii = 0, ci = &cpu_info[0]; cii < PPC_MAXPROCS; cii++, ci++)
+ for (cii = 0, ci = &cpu_info[0]; cii < ncpus; cii++, ci++)
void cpu_unidle(struct cpu_info *);