opnsense-src/sys/dev/ofw
Mitchell Horne ac9de183f3 ofw_cpu: check for "disabled" status during probe
Some RISC-V CPUs contain a "monitor core" with limited functionality (no
MMU). These cores appear in some device trees, but we don't run the
kernel on them; in early CPU start-up code we skip them, and they have
no impact on mp_ncpu. It seems the new trend is to mark these monitor
cores with a 'status' property of 'disabled'.

However, we still instantiate an ofw_cpu pseudo device for the disabled
core. This is generally harmless, but there is an impact when attempting
to attach the cpufreq_dt driver. It counts more OFW CPU devices (unit
number) than logical CPUs (mp_ncpus), and therefore fails to attach for
the last logical CPU.

The solution is to check the status property in ofw_cpu_probe(), and
fail if the core is marked "disabled". This is subject to the same
exception already in ofw_cpu_early_foreach(); that is, if a disabled CPU
has an 'enable-method' property, it can be used by the kernel.

Reviewed by:	andrew, jrtc27
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D48123
2025-01-10 14:59:08 -04:00
..
ofw_bus.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ofw_bus_if.m sys: Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:54:58 -06:00
ofw_bus_subr.c ofw: Fix inverted bcmp in ofw_bus_node_status_okay 2024-12-17 20:51:56 +00:00
ofw_bus_subr.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ofw_console.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ofw_cpu.c ofw_cpu: check for "disabled" status during probe 2025-01-10 14:59:08 -04:00
ofw_cpu.h ofw: convert boolean_t to bool 2024-06-26 11:14:36 -03:00
ofw_disk.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
ofw_fdt.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
ofw_firmware.c Replace calls to bus_generic_attach with bus_attach_children 2024-12-06 17:26:16 -05:00
ofw_graph.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
ofw_graph.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ofw_if.m sys: Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:54:58 -06:00
ofw_pci.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
ofw_pci.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ofw_pcib.c Replace calls to bus_generic_attach with bus_attach_children 2024-12-06 17:26:16 -05:00
ofw_standard.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
ofw_subr.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
ofw_subr.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ofwbus.c Replace calls to bus_generic_attach with bus_attach_children 2024-12-06 17:26:16 -05:00
ofwpci.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
ofwvar.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
openfirm.c ofw: convert boolean_t to bool 2024-06-26 11:14:36 -03:00
openfirm.h ofw: convert boolean_t to bool 2024-06-26 11:14:36 -03:00
openfirmio.c sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
openfirmio.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00