From 54345fd41bbe91db9411f88932ea2f30315705ca Mon Sep 17 00:00:00 2001 From: ps Date: Sat, 23 Sep 2000 12:18:06 +0000 Subject: Move MAXCPU from machine/smp.h to machine/param.h to fix breakage with !SMP kernels. Also, replace NCPUS with MAXCPU since they are redundant. --- sys/alpha/alpha/mp_machdep.c | 8 ++++---- sys/alpha/alpha/pmap.c | 6 +++--- sys/alpha/include/lock.h | 4 ++-- sys/alpha/include/param.h | 4 ++-- sys/alpha/include/pmap.h | 2 +- sys/amd64/include/smp.h | 10 ---------- sys/i386/include/lock.h | 4 ++-- sys/i386/include/param.h | 6 +++--- sys/i386/include/smp.h | 10 ---------- sys/kern/kern_lock.c | 4 ++-- sys/sys/lock.h | 4 ++-- sys/sys/lockmgr.h | 4 ++-- sys/sys/smp.h | 10 ---------- 13 files changed, 23 insertions(+), 53 deletions(-) (limited to 'sys') diff --git a/sys/alpha/alpha/mp_machdep.c b/sys/alpha/alpha/mp_machdep.c index 122daba..69170fc 100644 --- a/sys/alpha/alpha/mp_machdep.c +++ b/sys/alpha/alpha/mp_machdep.c @@ -60,9 +60,9 @@ volatile u_int started_cpus; volatile u_int checkstate_probed_cpus; volatile u_int checkstate_need_ast; volatile u_int checkstate_pending_ast; -struct proc* checkstate_curproc[NCPUS]; -int checkstate_cpustate[NCPUS]; -u_long checkstate_pc[NCPUS]; +struct proc* checkstate_curproc[MAXCPU]; +int checkstate_cpustate[MAXCPU]; +u_long checkstate_pc[MAXCPU]; volatile u_int resched_cpus; void (*cpustop_restartfunc) __P((void)); int mp_ncpus; @@ -71,7 +71,7 @@ int smp_started; int boot_cpu_id; u_int32_t all_cpus; -static struct globaldata *cpuno_to_globaldata[NCPUS]; +static struct globaldata *cpuno_to_globaldata[MAXCPU]; int smp_active = 0; /* are the APs allowed to run? */ SYSCTL_INT(_machdep, OID_AUTO, smp_active, CTLFLAG_RW, &smp_active, 0, ""); diff --git a/sys/alpha/alpha/pmap.c b/sys/alpha/alpha/pmap.c index 2a4852f..bdfd725 100644 --- a/sys/alpha/alpha/pmap.c +++ b/sys/alpha/alpha/pmap.c @@ -326,7 +326,7 @@ vm_offset_t kernel_vm_end; * Data for the ASN allocator */ static int pmap_maxasn; -static pmap_t pmap_active[NCPUS]; +static pmap_t pmap_active[MAXCPU]; /* * Data for the pv entry allocation mechanism @@ -1180,7 +1180,7 @@ pmap_pinit0(pmap) pmap->pm_count = 1; pmap->pm_ptphint = NULL; pmap->pm_active = 0; - for (i = 0; i < NCPUS; i++) { + for (i = 0; i < MAXCPU; i++) { pmap->pm_asn[i].asn = 0; pmap->pm_asn[i].gen = 0; } @@ -1230,7 +1230,7 @@ pmap_pinit(pmap) pmap->pm_count = 1; pmap->pm_ptphint = NULL; pmap->pm_active = 0; - for (i = 0; i < NCPUS; i++) { + for (i = 0; i < MAXCPU; i++) { pmap->pm_asn[i].asn = 0; pmap->pm_asn[i].gen = 0; } diff --git a/sys/alpha/include/lock.h b/sys/alpha/include/lock.h index 1066d46..f2e3448 100644 --- a/sys/alpha/include/lock.h +++ b/sys/alpha/include/lock.h @@ -55,7 +55,7 @@ s_unlock(struct simplelock *lkp) lkp->lock_data = 0; } -#if !defined(SIMPLELOCK_DEBUG) && NCPUS > 1 +#if !defined(SIMPLELOCK_DEBUG) && MAXCPU > 1 /* * This set of defines turns on the real functions in i386/isa/apic_ipl.s. */ @@ -64,7 +64,7 @@ s_unlock(struct simplelock *lkp) #define simple_lock_try(alp) s_lock_try(alp) #define simple_unlock(alp) s_unlock(alp) -#endif /* !SIMPLELOCK_DEBUG && NCPUS > 1 */ +#endif /* !SIMPLELOCK_DEBUG && MAXCPU > 1 */ #define COM_LOCK() #define COM_UNLOCK() diff --git a/sys/alpha/include/param.h b/sys/alpha/include/param.h index a845737..28bef01 100644 --- a/sys/alpha/include/param.h +++ b/sys/alpha/include/param.h @@ -71,9 +71,9 @@ #define OBJFORMAT_DEFAULT "elf" #ifdef SMP -#define NCPUS 32 +#define MAXCPU 32 #else -#define NCPUS 1 +#define MAXCPU 1 #endif /* diff --git a/sys/alpha/include/pmap.h b/sys/alpha/include/pmap.h index de59b66..886627c 100644 --- a/sys/alpha/include/pmap.h +++ b/sys/alpha/include/pmap.h @@ -178,7 +178,7 @@ struct pmap { struct { u_int32_t asn:8; /* address space number */ u_int32_t gen:24; /* generation number */ - } pm_asn[NCPUS]; + } pm_asn[MAXCPU]; struct pmap_statistics pm_stats; /* pmap statistics */ struct vm_page *pm_ptphint; /* pmap ptp hint */ }; diff --git a/sys/amd64/include/smp.h b/sys/amd64/include/smp.h index dab3611..1680518 100644 --- a/sys/amd64/include/smp.h +++ b/sys/amd64/include/smp.h @@ -22,16 +22,6 @@ # error APIC_IO required for SMP, add "options APIC_IO" to your config file. #endif /* SMP && !APIC_IO */ -/* - * Maximum number of CPUs we will use. - * In the !SMP case we save ourselves a litle space. - */ -#if defined(SMP) -# define MAXCPU 16 -#else -# define MAXCPU 1 -#endif /* SMP */ - #if defined(SMP) || defined(APIC_IO) #ifndef LOCORE diff --git a/sys/i386/include/lock.h b/sys/i386/include/lock.h index b4af09d..7871606 100644 --- a/sys/i386/include/lock.h +++ b/sys/i386/include/lock.h @@ -130,7 +130,7 @@ extern struct simplelock mpintr_lock; extern struct simplelock mcount_lock; extern struct simplelock panic_lock; -#if !defined(SIMPLELOCK_DEBUG) && NCPUS > 1 +#if !defined(SIMPLELOCK_DEBUG) && MAXCPU > 1 /* * This set of defines turns on the real functions in i386/isa/apic_ipl.s. */ @@ -139,7 +139,7 @@ extern struct simplelock panic_lock; #define simple_lock_try(alp) s_lock_try(alp) #define simple_unlock(alp) s_unlock(alp) -#endif /* !SIMPLELOCK_DEBUG && NCPUS > 1 */ +#endif /* !SIMPLELOCK_DEBUG && MAXCPU > 1 */ #endif /* LOCORE */ diff --git a/sys/i386/include/param.h b/sys/i386/include/param.h index 1d84ae5..cc6d991 100644 --- a/sys/i386/include/param.h +++ b/sys/i386/include/param.h @@ -65,10 +65,10 @@ #define OBJFORMAT_DEFAULT "elf" #ifdef SMP -#define NCPUS 2 +#define MAXCPU 16 #else -#define NCPUS 1 -#endif +#define MAXCPU 1 +#endif /* SMP */ /* * Round p (pointer or byte index) up to a correctly-aligned value diff --git a/sys/i386/include/smp.h b/sys/i386/include/smp.h index dab3611..1680518 100644 --- a/sys/i386/include/smp.h +++ b/sys/i386/include/smp.h @@ -22,16 +22,6 @@ # error APIC_IO required for SMP, add "options APIC_IO" to your config file. #endif /* SMP && !APIC_IO */ -/* - * Maximum number of CPUs we will use. - * In the !SMP case we save ourselves a litle space. - */ -#if defined(SMP) -# define MAXCPU 16 -#else -# define MAXCPU 1 -#endif /* SMP */ - #if defined(SMP) || defined(APIC_IO) #ifndef LOCORE diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index cc1455c..1e10fbe 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -545,7 +545,7 @@ lockmgr_printinfo(lkp) printf(" with %d pending", lkp->lk_waitcount); } -#if defined(SIMPLELOCK_DEBUG) && (NCPUS == 1 || defined(COMPILING_LINT)) +#if defined(SIMPLELOCK_DEBUG) && (MAXCPU == 1 || defined(COMPILING_LINT)) #include #include @@ -640,4 +640,4 @@ _simple_unlock(alp, id, l) } #elif defined(SIMPLELOCK_DEBUG) #error "SIMPLELOCK_DEBUG is not compatible with SMP!" -#endif /* SIMPLELOCK_DEBUG && NCPUS == 1 */ +#endif /* SIMPLELOCK_DEBUG && MAXCPU == 1 */ diff --git a/sys/sys/lock.h b/sys/sys/lock.h index 57b8b05..92ccd64 100644 --- a/sys/sys/lock.h +++ b/sys/sys/lock.h @@ -202,13 +202,13 @@ void _simple_lock __P((struct simplelock *alp, const char *, int)); #define simple_lock(alp) _simple_lock(alp, __FILE__, __LINE__) void simple_lock_init __P((struct simplelock *alp)); #else /* !SIMPLELOCK_DEBUG */ -#if NCPUS == 1 /* no multiprocessor locking is necessary */ +#if MAXCPU == 1 /* no multiprocessor locking is necessary */ #define NULL_SIMPLELOCKS #define simple_lock_init(alp) #define simple_lock(alp) #define simple_lock_try(alp) (1) /* always succeeds */ #define simple_unlock(alp) -#endif /* NCPUS == 1 */ +#endif /* MAXCPU == 1 */ #endif /* !SIMPLELOCK_DEBUG */ #endif /* !_LOCK_H_ */ diff --git a/sys/sys/lockmgr.h b/sys/sys/lockmgr.h index 57b8b05..92ccd64 100644 --- a/sys/sys/lockmgr.h +++ b/sys/sys/lockmgr.h @@ -202,13 +202,13 @@ void _simple_lock __P((struct simplelock *alp, const char *, int)); #define simple_lock(alp) _simple_lock(alp, __FILE__, __LINE__) void simple_lock_init __P((struct simplelock *alp)); #else /* !SIMPLELOCK_DEBUG */ -#if NCPUS == 1 /* no multiprocessor locking is necessary */ +#if MAXCPU == 1 /* no multiprocessor locking is necessary */ #define NULL_SIMPLELOCKS #define simple_lock_init(alp) #define simple_lock(alp) #define simple_lock_try(alp) (1) /* always succeeds */ #define simple_unlock(alp) -#endif /* NCPUS == 1 */ +#endif /* MAXCPU == 1 */ #endif /* !SIMPLELOCK_DEBUG */ #endif /* !_LOCK_H_ */ diff --git a/sys/sys/smp.h b/sys/sys/smp.h index dab3611..1680518 100644 --- a/sys/sys/smp.h +++ b/sys/sys/smp.h @@ -22,16 +22,6 @@ # error APIC_IO required for SMP, add "options APIC_IO" to your config file. #endif /* SMP && !APIC_IO */ -/* - * Maximum number of CPUs we will use. - * In the !SMP case we save ourselves a litle space. - */ -#if defined(SMP) -# define MAXCPU 16 -#else -# define MAXCPU 1 -#endif /* SMP */ - #if defined(SMP) || defined(APIC_IO) #ifndef LOCORE -- cgit v1.1