diff --git a/sys/arch/arm/fdt/acpi_fdt.c b/sys/arch/arm/fdt/acpi_fdt.c index f6c74c939e7d..d8f63b383419 100644 --- a/sys/arch/arm/fdt/acpi_fdt.c +++ b/sys/arch/arm/fdt/acpi_fdt.c @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_fdt.c,v 1.23 2021/08/07 16:18:43 thorpej Exp $ */ +/* $NetBSD: acpi_fdt.c,v 1.24 2022/11/25 22:17:20 mrg Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -30,7 +30,7 @@ #include "opt_efi.h" #include -__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.23 2021/08/07 16:18:43 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.24 2022/11/25 22:17:20 mrg Exp $"); #include #include @@ -41,7 +41,6 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.23 2021/08/07 16:18:43 thorpej Exp $" #include #include #include -#include #include @@ -63,7 +62,6 @@ static void acpi_fdt_attach(device_t, device_t, void *); static void acpi_fdt_poweroff(device_t); static void acpi_fdt_smbios_init(device_t); -static void acpi_fdt_sysctl_init(void); extern struct arm32_bus_dma_tag acpi_coherent_dma_tag; @@ -124,8 +122,6 @@ acpi_fdt_attach(device_t parent, device_t self, void *aux) aa.aa_dmat = NULL; aa.aa_dmat64 = NULL; config_found(self, &aa, NULL, CFARGS_NONE); - - acpi_fdt_sysctl_init(); } static void @@ -226,27 +222,3 @@ acpi_fdt_smbios_init(device_t dev) AcpiOsUnmapMemory(sh, sizeof(*sh)); } } - -static void -acpi_fdt_sysctl_init(void) -{ - const struct sysctlnode *rnode; - int error; - - if (smbios_table == 0) { - return; - } - - error = sysctl_createv(NULL, 0, NULL, &rnode, - CTLFLAG_PERMANENT, CTLTYPE_NODE, "machdep", NULL, - NULL, 0, NULL, 0, CTL_MACHDEP, CTL_EOL); - if (error) { - return; - } - - (void)sysctl_createv(NULL, 0, &rnode, NULL, - CTLFLAG_PERMANENT | CTLFLAG_READONLY | CTLFLAG_HEX, CTLTYPE_QUAD, - "smbios", SYSCTL_DESCR("SMBIOS table pointer"), - NULL, 0, &smbios_table, sizeof(smbios_table), - CTL_CREATE, CTL_EOL); -} diff --git a/sys/dev/smbios_platform.c b/sys/dev/smbios_platform.c index 6ea668a1a6d9..2999394031b3 100644 --- a/sys/dev/smbios_platform.c +++ b/sys/dev/smbios_platform.c @@ -1,4 +1,4 @@ -/* $NetBSD: smbios_platform.c,v 1.1 2021/07/21 23:26:15 jmcneill Exp $ */ +/* $NetBSD: smbios_platform.c,v 1.2 2022/11/25 22:17:20 mrg Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -29,7 +29,7 @@ #include "isa.h" #include -__KERNEL_RCSID(0, "$NetBSD: smbios_platform.c,v 1.1 2021/07/21 23:26:15 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: smbios_platform.c,v 1.2 2022/11/25 22:17:20 mrg Exp $"); #include #include @@ -76,6 +76,20 @@ platform_init(void) struct smbios_slot *pslot; int nisa, nother; + if (smbios_entry.hdrphys) { + int err; + + err = sysctl_createv(NULL, 0, NULL, NULL, + CTLFLAG_PERMANENT | CTLFLAG_READONLY | CTLFLAG_HEX | + CTLFLAG_IMMEDIATE, CTLTYPE_QUAD, + "smbios", SYSCTL_DESCR("SMBIOS table pointer"), + NULL, smbios_entry.hdrphys, 0, 0, + CTL_MACHDEP, CTL_CREATE, CTL_EOL); + if (err != 0 && err != EEXIST) + printf("platform: sysctl_createv " + "(machdep.smbios) failed, err = %d\n", err); + } + smbios.cookie = 0; if (smbios_find_table(SMBIOS_TYPE_SYSTEM, &smbios)) { psys = smbios.tblhdr;