mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
riscv: reject CPUs with mmu-type "riscv,none"
According to riscv/cpus.yaml in the device-tree docs, this property may exist but indicate that the CPU does not have an MMU. Detect this possibility. Reviewed by: jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D36980
This commit is contained in:
parent
6f4c938b2b
commit
330acb1883
1 changed files with 15 additions and 13 deletions
|
|
@ -403,6 +403,20 @@ cpu_mp_probe(void)
|
|||
}
|
||||
|
||||
#ifdef FDT
|
||||
static boolean_t
|
||||
cpu_check_mmu(u_int id __unused, phandle_t node, u_int addr_size __unused,
|
||||
pcell_t *reg __unused)
|
||||
{
|
||||
char type[32];
|
||||
|
||||
/* Check if this hart supports MMU. */
|
||||
if (OF_getprop(node, "mmu-type", (void *)type, sizeof(type)) == -1 ||
|
||||
strncmp(type, "riscv,none", 10) == 0)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static boolean_t
|
||||
cpu_init_fdt(u_int id, phandle_t node, u_int addr_size, pcell_t *reg)
|
||||
{
|
||||
|
|
@ -413,8 +427,7 @@ cpu_init_fdt(u_int id, phandle_t node, u_int addr_size, pcell_t *reg)
|
|||
int naps;
|
||||
int error;
|
||||
|
||||
/* Check if this hart supports MMU. */
|
||||
if (OF_getproplen(node, "mmu-type") < 0)
|
||||
if (!cpu_check_mmu(id, node, addr_size, reg))
|
||||
return (0);
|
||||
|
||||
KASSERT(id < MAXCPU, ("Too many CPUs"));
|
||||
|
|
@ -521,17 +534,6 @@ cpu_mp_announce(void)
|
|||
{
|
||||
}
|
||||
|
||||
static boolean_t
|
||||
cpu_check_mmu(u_int id, phandle_t node, u_int addr_size, pcell_t *reg)
|
||||
{
|
||||
|
||||
/* Check if this hart supports MMU. */
|
||||
if (OF_getproplen(node, "mmu-type") < 0)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_mp_setmaxid(void)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue