void
platform_mp_setmaxid(void)
{
- int core_cnt;
- core_cnt = platform_mp_get_core_cnt();
- mp_maxid = core_cnt - 1;
+ mp_ncpus = platform_mp_get_core_cnt();
+ mp_maxid = mp_ncpus - 1;
}
int
platform_mp_probe(void)
{
- mp_ncpus = platform_mp_get_core_cnt();
return (1);
}
platform_mp_setmaxid(void)
{
- mp_maxid = 3;
+ mp_ncpus = platform_get_ncpus();
+ mp_maxid = mp_ncpus - 1;
}
int
platform_mp_probe(void)
{
- mp_ncpus = platform_get_ncpus();
-
return (mp_ncpus > 1);
}
int
platform_mp_probe(void)
{
- int ncpus;
- ncpus = ofw_cpu_early_foreach(NULL, true);
- if (ncpus <= 1) {
- mp_ncpus = 1;
- return (0);
- }
-
- mp_ncpus = MIN(ncpus, MAXCPU);
-
- return (1);
+ return (mp_ncpus > 1);
}
static boolean_t
{
mp_maxid = PCPU_GET(cpuid);
- ofw_cpu_early_foreach(virt_maxid, true);
+ mp_ncpus = ofw_cpu_early_foreach(virt_maxid, true);
+ if (mp_ncpus < 1)
+ mp_ncpus = 1;
+ mp_ncpus = MIN(ncpus, MAXCPU);
}
static boolean_t
platform_mp_setmaxid(void)
{
- mp_maxid = 1;
+ mp_maxid = 1;
+ mp_ncpus = 2;
}
int
platform_mp_probe(void)
{
- mp_ncpus = 2;
return (1);
}
{
mp_maxid = 1;
+ mp_ncpus = 2;
}
int
platform_mp_probe(void)
{
- mp_ncpus = 2;
return (1);
}
static void
mp_setmaxid(void *dummy)
{
+
cpu_mp_setmaxid();
+
+ KASSERT(mp_ncpus >= 1, ("%s: CPU count < 1", __func__));
+ KASSERT(mp_ncpus > 1 || mp_maxid == 0,
+ ("%s: one CPU but mp_maxid is not zero", __func__));
+ KASSERT(mp_maxid >= mp_ncpus - 1,
+ ("%s: counters out of sync: max %d, count %d", __func__,
+ mp_maxid, mp_ncpus));
}
SYSINIT(cpu_mp_setmaxid, SI_SUB_TUNABLES, SI_ORDER_FIRST, mp_setmaxid, NULL);
{
/*
- * mp_maxid should be already set by calls to cpu_add().
- * Just sanity check its value here.
+ * mp_ncpus and mp_maxid should be already set by calls to cpu_add().
+ * If there were no calls to cpu_add() assume this is a UP system.
*/
if (mp_ncpus == 0)
- KASSERT(mp_maxid == 0,
- ("%s: mp_ncpus is zero, but mp_maxid is not", __func__));
- else if (mp_ncpus == 1)
- mp_maxid = 0;
- else
- KASSERT(mp_maxid >= mp_ncpus - 1,
- ("%s: counters out of sync: max %d, count %d", __func__,
- mp_maxid, mp_ncpus));
+ mp_ncpus = 1;
}
int
* correctly.
*/
CPU_SETOF(0, &all_cpus);
- if (mp_ncpus == 0) {
- /*
- * No CPUs were found, so this must be a UP system. Setup
- * the variables to represent a system with a single CPU
- * with an id of 0.
- */
- mp_ncpus = 1;
- return (0);
- }
-
- /* At least one CPU was found. */
- if (mp_ncpus == 1) {
- /*
- * One CPU was found, so this must be a UP system with
- * an I/O APIC.
- */
- mp_maxid = 0;
- return (0);
- }
-
- /* At least two CPUs were found. */
- return (1);
+ return (mp_ncpus > 1);
}
/*