summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandrei <none@none>2006-05-18 11:33:25 -0700
committerandrei <none@none>2006-05-18 11:33:25 -0700
commit41791439485c85b85be39df263af7b95e79404b7 (patch)
treeb8a6142a358fb14c21006bfdf29fd176582b4f4c
parenta859926565cb356b64ec9747a88da4ff003ad4f8 (diff)
downloadillumos-joyent-41791439485c85b85be39df263af7b95e79404b7.tar.gz
5081104 NCPU has been outgrown on x86
-rw-r--r--usr/src/uts/i86pc/io/pcplusmp/apic.c19
-rw-r--r--usr/src/uts/i86pc/ml/genassym.c10
-rw-r--r--usr/src/uts/i86pc/ml/locore.s39
-rw-r--r--usr/src/uts/i86pc/ml/offsets.in7
-rw-r--r--usr/src/uts/i86pc/os/machdep.c2
-rw-r--r--usr/src/uts/i86pc/os/mlsetup.c32
-rw-r--r--usr/src/uts/i86pc/os/mp_machdep.c19
-rw-r--r--usr/src/uts/i86pc/os/mp_startup.c42
-rw-r--r--usr/src/uts/i86pc/os/x_call.c11
-rw-r--r--usr/src/uts/i86pc/sys/machcpuvar.h2
-rw-r--r--usr/src/uts/i86pc/sys/machparam.h39
-rw-r--r--usr/src/uts/i86pc/sys/rm_platter.h5
-rw-r--r--usr/src/uts/i86pc/sys/smp_impldefs.h10
-rw-r--r--usr/src/uts/intel/ia32/ml/exception.s1
14 files changed, 146 insertions, 92 deletions
diff --git a/usr/src/uts/i86pc/io/pcplusmp/apic.c b/usr/src/uts/i86pc/io/pcplusmp/apic.c
index 9a481d7bed..eba49fba8a 100644
--- a/usr/src/uts/i86pc/io/pcplusmp/apic.c
+++ b/usr/src/uts/i86pc/io/pcplusmp/apic.c
@@ -446,7 +446,7 @@ int apic_debug_msgbufindex = 0;
apic_cpus_info_t *apic_cpus;
-static uint_t apic_cpumask = 0;
+static cpuset_t apic_cpumask;
static uint_t apic_flag;
/* Flag to indicate that we need to shut down all processors */
@@ -988,6 +988,7 @@ acpi_probe(void)
id = apicadr[APIC_LID_REG];
local_ids[0] = (uchar_t)(((uint_t)id) >> 24);
apic_nproc = index = 1;
+ CPUSET_ONLY(apic_cpumask, 0);
apic_io_max = 0;
ap = (APIC_HEADER *) (acpi_mapic_dtp + 1);
@@ -1004,6 +1005,7 @@ acpi_probe(void)
else if (apic_nproc < NCPU) {
local_ids[index] = mpa->LocalApicId;
proc_ids[index] = mpa->ProcessorId;
+ CPUSET_ADD(apic_cpumask, index);
index++;
apic_nproc++;
} else
@@ -1100,8 +1102,6 @@ acpi_probe(void)
KM_NOSLEEP)) == NULL)
goto cleanup;
- apic_cpumask = (1 << apic_nproc) - 1;
-
/*
* ACPI doesn't provide the local apic ver, get it directly from the
* local apic
@@ -1237,7 +1237,8 @@ apic_handle_defconf()
kmem_zalloc(sizeof (*apic_cpus) * 2, KM_NOSLEEP);
if ((!apicadr) || (!apicioadr[0]) || (!apic_cpus))
goto apic_handle_defconf_fail;
- apic_cpumask = 3;
+ CPUSET_ONLY(apic_cpumask, 0);
+ CPUSET_ADD(apic_cpumask, 1);
apic_nproc = 2;
lid = apicadr[APIC_LID_REG];
apic_cpus[0].aci_local_id = (uchar_t)(lid >> APIC_ID_BIT_OFFSET);
@@ -1299,8 +1300,11 @@ apic_parse_mpct(caddr_t mpct, int bypass_cpus_and_ioapics)
/* Find max # of CPUS and allocate structure accordingly */
apic_nproc = 0;
+ CPUSET_ZERO(apic_cpumask);
while (procp->proc_entry == APIC_CPU_ENTRY) {
if (procp->proc_cpuflags & CPUFLAGS_EN) {
+ if (apic_nproc < NCPU)
+ CPUSET_ADD(apic_cpumask, apic_nproc);
apic_nproc++;
}
procp++;
@@ -1350,11 +1354,6 @@ apic_parse_mpct(caddr_t mpct, int bypass_cpus_and_ioapics)
procp++;
}
- if (!bypass_cpus_and_ioapics) {
- /* convert the number of processors into a cpumask */
- apic_cpumask = (1 << apic_nproc) - 1;
- }
-
/*
* Save start of bus entries for later use.
* Get EISA level cntrl if EISA bus is present.
@@ -2608,7 +2607,7 @@ apic_get_next_processorid(processorid_t cpu_id)
return ((processorid_t)0);
for (i = cpu_id + 1; i < NCPU; i++) {
- if (apic_cpumask & (1 << i))
+ if (CPU_IN_SET(apic_cpumask, i))
return (i);
}
diff --git a/usr/src/uts/i86pc/ml/genassym.c b/usr/src/uts/i86pc/ml/genassym.c
index 6ecdf199b1..a346a8f59b 100644
--- a/usr/src/uts/i86pc/ml/genassym.c
+++ b/usr/src/uts/i86pc/ml/genassym.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -166,7 +165,6 @@ main(int argc, char *argv[])
printf("#define\tMMU_STD_PAGESHIFT 0x%x\n", (uint_t)MMU_STD_PAGESHIFT);
printf("#define\tMMU_STD_PAGEMASK 0x%x\n", (uint_t)MMU_STD_PAGEMASK);
printf("#define\tMMU_L2_MASK 0x%x\n", (uint_t)(NPTEPERPT - 1));
- printf("#define\tMMU_PAGEOFFSET 0x%x\n", (uint_t)(MMU_PAGESIZE - 1));
printf("#define\tNPTESHIFT 0x%x\n", (uint_t)NPTESHIFT);
printf("#define\tFOURMB_PAGEOFFSET 0x%x\n", (uint_t)FOURMB_PAGEOFFSET);
printf("#define\tFOURMB_PAGESIZE 0x%x\n", (uint_t)FOURMB_PAGESIZE);
@@ -176,8 +174,6 @@ main(int argc, char *argv[])
printf("#define\tTRAPTR_NENT 0x%x\n", TRAPTR_NENT);
- printf("#define\tNCPU 0x%x\n", NCPU);
-
printf("#define\tCPU_DTRACE_NOFAULT 0x%x\n", CPU_DTRACE_NOFAULT);
printf("#define\tCPU_DTRACE_BADADDR 0x%x\n", CPU_DTRACE_BADADDR);
printf("#define\tCPU_DTRACE_ILLOP 0x%x\n", CPU_DTRACE_ILLOP);
diff --git a/usr/src/uts/i86pc/ml/locore.s b/usr/src/uts/i86pc/ml/locore.s
index b6ed089f9b..bc88297503 100644
--- a/usr/src/uts/i86pc/ml/locore.s
+++ b/usr/src/uts/i86pc/ml/locore.s
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -40,6 +39,7 @@
#include <sys/psw.h>
#include <sys/reboot.h>
#include <sys/x86_archext.h>
+#include <sys/machparam.h>
#if defined(__lint)
@@ -140,18 +140,43 @@
.NWORD trap_tr0 + TRAP_TSIZE /* limit */
.NWORD 0 /* pad */
-#if NCPU != 21
-#error "NCPU != 21, Expand padding for trap_trace_ctl"
+ /*
+ * Enough padding for 31 more CPUs (no .skip on x86 -- grrrr).
+ */
+ .NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
+#if defined(__amd64)
+
+#if NCPU != 64
+#error "NCPU != 64, Expand padding for trap_trace_ctl"
#endif
/*
- * Enough padding for 20 CPUs (no .skip on x86 -- grrrr).
+ * Enough padding for 32 more CPUs (no .skip on x86 -- grrrr).
*/
.NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
.NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+ .NWORD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+
+#else /* __amd64 */
+
+#if NCPU != 32
+#error "NCPU != 32, Expand padding for trap_trace_ctl"
+#endif
+
+#endif /* __amd64 */
/*
* CPU 0's preallocated TRAPTRACE buffer.
diff --git a/usr/src/uts/i86pc/ml/offsets.in b/usr/src/uts/i86pc/ml/offsets.in
index 13ec19da05..d3a221d0c8 100644
--- a/usr/src/uts/i86pc/ml/offsets.in
+++ b/usr/src/uts/i86pc/ml/offsets.in
@@ -5,9 +5,8 @@
\ CDDL HEADER START
\
\ The contents of this file are subject to the terms of the
-\ Common Development and Distribution License, Version 1.0 only
-\ (the "License"). You may not use this file except in compliance
-\ with the License.
+\ Common Development and Distribution License (the "License").
+\ You may not use this file except in compliance with the License.
\
\ You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
\ or http://www.opensolaris.org/os/licensing.
@@ -291,8 +290,6 @@ cpu_tables
ct_stack
ct_gdt
-\#define DEFAULTSTKSZ _CONST(CT_GDT - CT_STACK)
-
ddi_acc_impl
ahi_acc_attr ACC_ATTR
ahi_get8 ACC_GETB
diff --git a/usr/src/uts/i86pc/os/machdep.c b/usr/src/uts/i86pc/os/machdep.c
index 92ff0c425c..a98e153653 100644
--- a/usr/src/uts/i86pc/os/machdep.c
+++ b/usr/src/uts/i86pc/os/machdep.c
@@ -149,8 +149,6 @@ int vac;
void stop_other_cpus();
void debug_enter(char *);
-int procset = 1;
-
extern void pm_cfb_check_and_powerup(void);
extern void pm_cfb_rele(void);
diff --git a/usr/src/uts/i86pc/os/mlsetup.c b/usr/src/uts/i86pc/os/mlsetup.c
index 02326001f2..6e97330601 100644
--- a/usr/src/uts/i86pc/os/mlsetup.c
+++ b/usr/src/uts/i86pc/os/mlsetup.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -103,7 +102,7 @@ extern void init_tables(void);
static uint32_t
-cpuid_getval(char *name)
+bootprop_getval(char *name)
{
char prop[32];
u_longlong_t ll;
@@ -126,6 +125,7 @@ mlsetup(struct regs *rp)
extern struct chip cpu0_chip;
extern disp_t cpu0_disp;
extern char t0stack[];
+ int boot_ncpus;
ASSERT_STACK_ALIGNED();
@@ -170,13 +170,13 @@ mlsetup(struct regs *rp)
*/
cpuid_feature_ecx_include =
- cpuid_getval("cpuid_feature_ecx_include");
+ bootprop_getval("cpuid_feature_ecx_include");
cpuid_feature_ecx_exclude =
- cpuid_getval("cpuid_feature_ecx_exclude");
+ bootprop_getval("cpuid_feature_ecx_exclude");
cpuid_feature_edx_include =
- cpuid_getval("cpuid_feature_edx_include");
+ bootprop_getval("cpuid_feature_edx_include");
cpuid_feature_edx_exclude =
- cpuid_getval("cpuid_feature_edx_exclude");
+ bootprop_getval("cpuid_feature_edx_exclude");
/*
* The first lightweight pass (pass0) through the cpuid data
@@ -289,7 +289,6 @@ mlsetup(struct regs *rp)
CPU->cpu_flags = CPU_READY | CPU_RUNNING | CPU_EXISTS | CPU_ENABLE;
CPU->cpu_dispatch_pri = t0.t_pri;
- CPU->cpu_mask = 1;
CPU->cpu_id = 0;
CPU->cpu_tss = &ktss0;
@@ -343,6 +342,21 @@ mlsetup(struct regs *rp)
prom_init("kernel", (void *)NULL);
+ boot_ncpus = bootprop_getval("boot-ncpus");
+
+ /*
+ * To avoid wasting kernel memory, we're temporarily limiting the
+ * total number of processors to 32 by default until we get the
+ * capability to scan ACPI tables early on boot to detect how many
+ * processors are actually present. However, 64-bit systems
+ * can be booted with up to 64 processors by setting "boot-ncpus"
+ * boot property to 64.
+ */
+ if (boot_ncpus <= 0 || boot_ncpus > NCPU)
+ boot_ncpus = 32;
+
+ max_ncpus = boot_max_ncpus = boot_ncpus;
+
if (boothowto & RB_HALT) {
prom_printf("unix: kernel halted by -h flag\n");
prom_enter_mon();
diff --git a/usr/src/uts/i86pc/os/mp_machdep.c b/usr/src/uts/i86pc/os/mp_machdep.c
index c6b8a301f5..47da4c7672 100644
--- a/usr/src/uts/i86pc/os/mp_machdep.c
+++ b/usr/src/uts/i86pc/os/mp_machdep.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -576,17 +575,17 @@ mach_init()
static void
mach_smpinit(void)
{
- register struct psm_ops *pops;
- register processorid_t cpu_id;
- int cnt;
- int cpumask;
+ struct psm_ops *pops;
+ processorid_t cpu_id;
+ int cnt;
+ cpuset_t cpumask;
pops = mach_set[0];
cpu_id = -1;
cpu_id = (*pops->psm_get_next_processorid)(cpu_id);
- for (cnt = 0, cpumask = 0; cpu_id != -1; cnt++) {
- cpumask |= 1 << cpu_id;
+ for (cnt = 0, CPUSET_ZERO(cpumask); cpu_id != -1; cnt++) {
+ CPUSET_ADD(cpumask, cpu_id);
cpu_id = (*pops->psm_get_next_processorid)(cpu_id);
}
@@ -665,7 +664,7 @@ mach_smpinit(void)
static void
mach_picinit()
{
- register struct psm_ops *pops;
+ struct psm_ops *pops;
extern void install_spl(void); /* XXX: belongs in a header file */
#if defined(__amd64) && defined(DEBUG)
extern void *spl_patch, *slow_spl, *setsplhi_patch, *slow_setsplhi;
diff --git a/usr/src/uts/i86pc/os/mp_startup.c b/usr/src/uts/i86pc/os/mp_startup.c
index da8f8e8fa9..963c063591 100644
--- a/usr/src/uts/i86pc/os/mp_startup.c
+++ b/usr/src/uts/i86pc/os/mp_startup.c
@@ -75,7 +75,10 @@ cpu_core_t cpu_core[NCPU]; /* cpu_core structures */
*/
int use_mp = 1;
-int mp_cpus = 0x1; /* to be set by platform specific module */
+/*
+ * To be set by a PSM to indicate what CPUs are available on the system.
+ */
+cpuset_t mp_cpus = 1;
/*
* This variable is used by the hat layer to decide whether or not
@@ -84,7 +87,7 @@ int mp_cpus = 0x1; /* to be set by platform specific module */
* order to allow cross calls.
*/
int flushes_require_xcalls = 0;
-ulong_t cpu_ready_set = 1;
+cpuset_t cpu_ready_set = 1;
extern void real_mode_start(void);
extern void real_mode_end(void);
@@ -288,7 +291,6 @@ extern void *long_mode_64(void);
cp->cpu_id = cpun;
cp->cpu_self = cp;
- cp->cpu_mask = 1 << cpun;
cp->cpu_thread = tp;
cp->cpu_lwp = NULL;
cp->cpu_dispthread = tp;
@@ -906,16 +908,18 @@ workaround_errata_end()
static ushort_t *mp_map_warm_reset_vector();
static void mp_unmap_warm_reset_vector(ushort_t *warm_reset_vector);
+static cpuset_t procset = 1;
+
/*ARGSUSED*/
void
start_other_cpus(int cprboot)
{
- unsigned who;
+ unsigned int who;
+ int skipped = 0;
int cpuid = 0;
int delays = 0;
int started_cpu;
ushort_t *warm_reset_vector = NULL;
- extern int procset;
/*
* Initialize our own cpu_info.
@@ -930,7 +934,7 @@ start_other_cpus(int cprboot)
/*
* if only 1 cpu or not using MP, skip the rest of this
*/
- if (!(mp_cpus & ~(1 << cpuid)) || use_mp == 0) {
+ if (CPUSET_ISEQUAL(mp_cpus, cpu_ready_set) || use_mp == 0) {
if (use_mp == 0)
cmn_err(CE_CONT, "?***** Not in MP mode\n");
goto done;
@@ -963,15 +967,19 @@ start_other_cpus(int cprboot)
for (who = 0; who < NCPU; who++) {
if (who == cpuid)
continue;
+ if (!CPU_IN_SET(mp_cpus, who))
+ continue;
- if ((mp_cpus & (1 << who)) == 0)
+ if (ncpus >= max_ncpus) {
+ skipped = who;
continue;
+ }
mp_startup_init(who);
started_cpu = 1;
(*cpu_startf)(who, rm_platter_pa);
- while ((procset & (1 << who)) == 0) {
+ while (!CPU_IN_SET(procset, who)) {
delay(1);
if (++delays > (20 * hz)) {
@@ -994,7 +1002,6 @@ start_other_cpus(int cprboot)
if (tsc_gethrtime_enable)
tsc_sync_master(who);
-
if (dtrace_cpu_init != NULL) {
/*
* DTrace CPU initialization expects cpu_lock
@@ -1012,13 +1019,23 @@ start_other_cpus(int cprboot)
if (who == cpuid)
continue;
- if (!(procset & (1 << who)))
+ if (!CPU_IN_SET(procset, who))
continue;
- while (!(cpu_ready_set & (1 << who)))
+ while (!CPU_IN_SET(cpu_ready_set, who))
delay(1);
}
+ if (skipped) {
+ cmn_err(CE_NOTE,
+ "System detected %d CPU(s), but "
+ "only %d CPU(s) were enabled during boot.",
+ skipped + 1, ncpus);
+ cmn_err(CE_NOTE,
+ "Use \"boot-ncpus\" parameter to enable more CPU(s). "
+ "See eeprom(1M).");
+ }
+
done:
workaround_errata_end();
@@ -1059,7 +1076,6 @@ void
mp_startup(void)
{
struct cpu *cp = CPU;
- extern int procset;
uint_t new_x86_feature;
new_x86_feature = cpuid_pass1(cp);
@@ -1117,7 +1133,7 @@ mp_startup(void)
init_cpu_info(cp);
mutex_enter(&cpu_lock);
- procset |= 1 << cp->cpu_id;
+ CPUSET_ADD(procset, cp->cpu_id);
mutex_exit(&cpu_lock);
if (tsc_gethrtime_enable)
diff --git a/usr/src/uts/i86pc/os/x_call.c b/usr/src/uts/i86pc/os/x_call.c
index f9ffc38431..f29cf1a94c 100644
--- a/usr/src/uts/i86pc/os/x_call.c
+++ b/usr/src/uts/i86pc/os/x_call.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -59,7 +58,7 @@ static void xc_common(xc_func_t, xc_arg_t, xc_arg_t, xc_arg_t,
int, cpuset_t, int);
static int xc_initialized = 0;
-extern ulong_t cpu_ready_set;
+extern cpuset_t cpu_ready_set;
void
xc_init()
@@ -89,7 +88,7 @@ kdi_xc_initialized(void)
return (xc_initialized);
}
-#define CAPTURE_CPU_ARG 0xffffffff
+#define CAPTURE_CPU_ARG ~0UL
/*
* X-call interrupt service routine.
@@ -114,7 +113,7 @@ xc_serv(caddr_t arg1, caddr_t arg2)
argp = &xc_mboxes[X_CALL_MEDPRI].arg2;
arg2val = *argp;
if (arg2val != CAPTURE_CPU_ARG &&
- !(arg2val & (1 << cpup->cpu_id)))
+ !CPU_IN_SET((cpuset_t)arg2val, cpup->cpu_id))
return (DDI_INTR_UNCLAIMED);
ASSERT(arg2val == CAPTURE_CPU_ARG);
if (cpup->cpu_m.xc_pend[pri] == 0)
diff --git a/usr/src/uts/i86pc/sys/machcpuvar.h b/usr/src/uts/i86pc/sys/machcpuvar.h
index 696ede7bf1..2cd92ac3b5 100644
--- a/usr/src/uts/i86pc/sys/machcpuvar.h
+++ b/usr/src/uts/i86pc/sys/machcpuvar.h
@@ -68,7 +68,6 @@ struct machcpu {
/* data for setting priority */
/* level */
- uint_t mcpu_mask; /* bitmask for this cpu (1<<cpu_id) */
struct hat *mcpu_current_hat; /* cpu's current hat */
struct hat_cpu_info *mcpu_hat_info;
@@ -106,7 +105,6 @@ struct machcpu {
#define cpu_nodeid cpu_m.mcpu_nodeid
#define cpu_pri cpu_m.mcpu_pri
#define cpu_pri_data cpu_m.mcpu_pri_data
-#define cpu_mask cpu_m.mcpu_mask
#define cpu_current_hat cpu_m.mcpu_current_hat
#define cpu_hat_info cpu_m.mcpu_hat_info
#define cpu_ppaddr_mutex cpu_m.mcpu_ppaddr_mutex
diff --git a/usr/src/uts/i86pc/sys/machparam.h b/usr/src/uts/i86pc/sys/machparam.h
index ee3328aa3d..fd144362a2 100644
--- a/usr/src/uts/i86pc/sys/machparam.h
+++ b/usr/src/uts/i86pc/sys/machparam.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -33,7 +32,9 @@
#pragma ident "%Z%%M% %I% %E% SMI"
+#if !defined(_ASM)
#include <sys/types.h>
+#endif
#ifdef __cplusplus
extern "C" {
@@ -46,9 +47,15 @@ extern "C" {
#endif /* _ASM */
/*
- * Machine dependent parameters and limits - PC version.
+ * Machine dependent parameters and limits.
*/
-#define NCPU 21
+#if defined(__amd64)
+#define NCPU 64 /* NBBY * sizeof (ulong_t) for simple cpuset_t */
+#elif defined(__i386)
+#define NCPU 32
+#else
+#error "port me"
+#endif
/*
* The value defined below could grow to 16. hat structure and
@@ -76,7 +83,13 @@ extern "C" {
#define MMU_PAGESIZE 0x1000 /* 4096 bytes */
#define MMU_PAGESHIFT 12 /* log2(MMU_PAGESIZE) */
+
+#if !defined(_ASM)
#define MMU_PAGEOFFSET (MMU_PAGESIZE-1) /* Mask of address bits in page */
+#else /* !_ASM */
+#define MMU_PAGEOFFSET _CONST(MMU_PAGESIZE-1) /* assembler lameness */
+#endif /* !_ASM */
+
#define MMU_PAGEMASK (~MMU_PAGEOFFSET)
#define PAGESIZE 0x1000 /* All of the above, for logical */
@@ -90,14 +103,20 @@ extern "C" {
#define DATA_ALIGN PAGESIZE
/*
- * DEFAULT KERNEL THREAD stack size.
+ * DEFAULT KERNEL THREAD stack size (in pages).
*/
#if defined(__amd64)
-#define DEFAULTSTKSZ (5 * PAGESIZE)
+#define DEFAULTSTKSZ_NPGS 5
#elif defined(__i386)
-#define DEFAULTSTKSZ (2 * PAGESIZE)
+#define DEFAULTSTKSZ_NPGS 2
#endif
+#if !defined(_ASM)
+#define DEFAULTSTKSZ (DEFAULTSTKSZ_NPGS * PAGESIZE)
+#else /* !_ASM */
+#define DEFAULTSTKSZ _MUL(DEFAULTSTKSZ_NPGS, PAGESIZE) /* as(1) lameness */
+#endif /* !_ASM */
+
/*
* KERNELBASE is the virtual address at which the kernel segments start in
* all contexts.
@@ -219,7 +238,7 @@ extern "C" {
#endif /* __i386 */
-#if !defined(_KADB)
+#if !defined(_ASM) && !defined(_KADB)
extern uintptr_t kernelbase, segkmap_start, segmapsize;
#endif
diff --git a/usr/src/uts/i86pc/sys/rm_platter.h b/usr/src/uts/i86pc/sys/rm_platter.h
index efdc985ce8..8f1bc977ba 100644
--- a/usr/src/uts/i86pc/sys/rm_platter.h
+++ b/usr/src/uts/i86pc/sys/rm_platter.h
@@ -102,11 +102,6 @@ typedef struct rm_platter {
* allocated when a CPU starts up. Makes it more memory efficient and easier
* to allocate/release
*
- * IMPORTANT: i86pc/ml/offsets.in depends upon ct_stack being DEFAULTSTKSZ
- * bytes long, and followed immediately by ct_gdt. Yes, it's a hack. If
- * changing cpu_tables, you must updates offsets.in so that it can
- * continue to calculate the size of DEFAULTSTKSZ.
- *
* Note: gdt and tss should be 16 byte aligned for best performance on
* amd64. Since DEFAULTSTKSIZE is a multiple of pagesize gdt will be aligned.
* We test below that the tss is properly aligned.
diff --git a/usr/src/uts/i86pc/sys/smp_impldefs.h b/usr/src/uts/i86pc/sys/smp_impldefs.h
index 79e41e6852..e61c756381 100644
--- a/usr/src/uts/i86pc/sys/smp_impldefs.h
+++ b/usr/src/uts/i86pc/sys/smp_impldefs.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -107,10 +106,9 @@ extern void psm_modload(void);
* External Reference Data
*/
extern struct av_head autovect[]; /* array of auto intr vectors */
-extern int clock_vector; /* clock interrupt vector */
extern uint32_t rm_platter_pa; /* phy addr realmode startup storage */
extern caddr_t rm_platter_va; /* virt addr realmode startup storage */
-extern int mp_cpus; /* bit map of possible cpus found */
+extern cpuset_t mp_cpus; /* bit map of possible cpus found */
#ifdef __cplusplus
}
diff --git a/usr/src/uts/intel/ia32/ml/exception.s b/usr/src/uts/intel/ia32/ml/exception.s
index 5886ab532c..be8a251727 100644
--- a/usr/src/uts/intel/ia32/ml/exception.s
+++ b/usr/src/uts/intel/ia32/ml/exception.s
@@ -49,6 +49,7 @@
#include <sys/privregs.h>
#include <sys/dtrace.h>
#include <sys/traptrace.h>
+#include <sys/machparam.h>
/*
* only one routine in this file is interesting to lint