git: 47158359cbc1 - stable/14 - legacy cpu: Add proper device_probe and device_attach routines
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 01 Dec 2024 04:56:59 UTC
The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=47158359cbc1f01fb5fa899a2287e86b61da8906 commit 47158359cbc1f01fb5fa899a2287e86b61da8906 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-10-21 14:24:28 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-12-01 02:46:04 +0000 legacy cpu: Add proper device_probe and device_attach routines Set a device description in probe and handle both adding and attaching children in attach. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D47185 (cherry picked from commit ab4f969f8d305665c478b25d4268501445fa5ba6) --- sys/x86/x86/legacy.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/sys/x86/x86/legacy.c b/sys/x86/x86/legacy.c index 6ece5e085dab..23439a4b549f 100644 --- a/sys/x86/x86/legacy.c +++ b/sys/x86/x86/legacy.c @@ -267,6 +267,8 @@ legacy_write_ivar(device_t dev, device_t child, int which, uintptr_t value) * cpufreq(4) hang off this. */ static void cpu_identify(driver_t *driver, device_t parent); +static device_probe_t cpu_probe; +static device_attach_t cpu_attach; static int cpu_read_ivar(device_t dev, device_t child, int index, uintptr_t *result); static device_t cpu_add_child(device_t bus, u_int order, const char *name, @@ -281,8 +283,8 @@ struct cpu_device { static device_method_t cpu_methods[] = { /* Device interface */ DEVMETHOD(device_identify, cpu_identify), - DEVMETHOD(device_probe, bus_generic_probe), - DEVMETHOD(device_attach, bus_generic_attach), + DEVMETHOD(device_probe, cpu_probe), + DEVMETHOD(device_attach, cpu_attach), DEVMETHOD(device_detach, bus_generic_detach), DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_suspend, bus_generic_suspend), @@ -330,6 +332,21 @@ cpu_identify(driver_t *driver, device_t parent) } } +static int +cpu_probe(device_t dev) +{ + device_set_desc(dev, "legacy CPU"); + return (BUS_PROBE_DEFAULT); +} + +static int +cpu_attach(device_t dev) +{ + bus_generic_probe(dev); + bus_generic_attach(dev); + return (0); +} + static device_t cpu_add_child(device_t bus, u_int order, const char *name, int unit) {