mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-12 14:29:28 +00:00
Make the default FDT implementation of platform_mp_setmaxid use the cpu
nodes from the DTB by default. This will allow us to enumerate the CPUs without hard coding the CPU count into code. Reviewed by: br Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D9827
This commit is contained in:
parent
c76da62acf
commit
83d9fd40d5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=315450
@ -60,7 +60,6 @@ static platform_method_t virt_methods[] = {
|
||||
|
||||
#ifdef SMP
|
||||
PLATFORMMETHOD(platform_mp_start_ap, virt_mp_start_ap),
|
||||
PLATFORMMETHOD(platform_mp_setmaxid, virt_mp_setmaxid),
|
||||
#endif
|
||||
|
||||
PLATFORMMETHOD_END,
|
||||
|
@ -49,27 +49,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
static int running_cpus;
|
||||
|
||||
static boolean_t
|
||||
virt_maxid(u_int id, phandle_t node, u_int addr_cells, pcell_t *reg)
|
||||
{
|
||||
|
||||
if (mp_maxid < id)
|
||||
mp_maxid = id;
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
void
|
||||
virt_mp_setmaxid(platform_t plat)
|
||||
{
|
||||
|
||||
mp_maxid = PCPU_GET(cpuid);
|
||||
mp_ncpus = ofw_cpu_early_foreach(virt_maxid, true);
|
||||
if (mp_ncpus < 1)
|
||||
mp_ncpus = 1;
|
||||
mp_ncpus = MIN(mp_ncpus, MAXCPU);
|
||||
}
|
||||
|
||||
static boolean_t
|
||||
virt_start_ap(u_int id, phandle_t node, u_int addr_cells, pcell_t *reg)
|
||||
{
|
||||
|
@ -30,12 +30,14 @@
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/smp.h>
|
||||
|
||||
#include <arm/include/platform.h>
|
||||
#include <arm/include/platformvar.h>
|
||||
|
||||
#include <dev/ofw/openfirm.h>
|
||||
#include <dev/ofw/ofw_bus_subr.h>
|
||||
#include <dev/ofw/ofw_cpu.h>
|
||||
#include <dev/fdt/fdt_common.h>
|
||||
|
||||
#include "platform_if.h"
|
||||
@ -43,6 +45,10 @@ __FBSDID("$FreeBSD$");
|
||||
#define FDT_PLATFORM(plat) \
|
||||
((fdt_platform_def_t *)(plat)->cls->baseclasses[0])
|
||||
|
||||
#if defined(SMP)
|
||||
static platform_mp_setmaxid_t fdt_platform_mp_setmaxid;
|
||||
#endif
|
||||
|
||||
static int
|
||||
fdt_platform_probe(platform_t plat)
|
||||
{
|
||||
@ -66,8 +72,36 @@ fdt_platform_probe(platform_t plat)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(SMP)
|
||||
static boolean_t
|
||||
fdt_platform_maxid(u_int id, phandle_t node, u_int addr_cells, pcell_t *reg)
|
||||
{
|
||||
|
||||
if (mp_maxid < id)
|
||||
mp_maxid = id;
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
static void
|
||||
fdt_platform_mp_setmaxid(platform_t plat)
|
||||
{
|
||||
|
||||
mp_maxid = PCPU_GET(cpuid);
|
||||
mp_ncpus = ofw_cpu_early_foreach(fdt_platform_maxid, true);
|
||||
if (mp_ncpus < 1)
|
||||
mp_ncpus = 1;
|
||||
mp_ncpus = MIN(mp_ncpus, MAXCPU);
|
||||
}
|
||||
#endif
|
||||
|
||||
platform_method_t fdt_platform_methods[] = {
|
||||
PLATFORMMETHOD(platform_probe, fdt_platform_probe),
|
||||
|
||||
#if defined(SMP)
|
||||
PLATFORMMETHOD(platform_mp_setmaxid, fdt_platform_mp_setmaxid),
|
||||
#endif
|
||||
|
||||
PLATFORMMETHOD_END
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user