Module Name: src Committed By: jmcneill Date: Tue Oct 23 10:13:34 UTC 2018
Modified Files: src/sys/arch/arm/fdt: acpi_fdt.c Log Message: Expose SMBIOS table pointer via machdep.smbios sysctl To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/fdt/acpi_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/fdt/acpi_fdt.c diff -u src/sys/arch/arm/fdt/acpi_fdt.c:1.5 src/sys/arch/arm/fdt/acpi_fdt.c:1.6 --- src/sys/arch/arm/fdt/acpi_fdt.c:1.5 Sun Oct 21 12:06:22 2018 +++ src/sys/arch/arm/fdt/acpi_fdt.c Tue Oct 23 10:13:34 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_fdt.c,v 1.5 2018/10/21 12:06:22 jmcneill Exp $ */ +/* $NetBSD: acpi_fdt.c,v 1.6 2018/10/23 10:13:34 jmcneill Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill <jmcne...@invisible.ca> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.5 2018/10/21 12:06:22 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.6 2018/10/23 10:13:34 jmcneill Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v #include <sys/lwp.h> #include <sys/kmem.h> #include <sys/queue.h> +#include <sys/sysctl.h> #include <dev/fdt/fdtvar.h> @@ -53,8 +54,12 @@ static void acpi_fdt_attach(device_t, de static void acpi_fdt_poweroff(device_t); +static void acpi_fdt_sysctl_init(void); + static struct acpi_pci_context acpi_fdt_pci_context; +static uint64_t smbios_table = 0; + static const char * const compatible[] = { "netbsd,acpi", NULL @@ -109,6 +114,8 @@ acpi_fdt_attach(device_t parent, device_ aa.aa_dmat64 = faa->faa_dmat; #endif config_found_ia(self, "acpibus", &aa, 0); + + acpi_fdt_sysctl_init(); } static void @@ -118,3 +125,28 @@ acpi_fdt_poweroff(device_t dev) if (psci_available()) psci_system_off(); } + +static void +acpi_fdt_sysctl_init(void) +{ + const struct sysctlnode *rnode; + int error; + + const int chosen = OF_finddevice("/chosen"); + if (chosen >= 0) + of_getprop_uint64(chosen, "netbsd,smbios-table", &smbios_table); + + error = sysctl_createv(NULL, 0, NULL, &rnode, + CTLFLAG_PERMANENT, CTLTYPE_NODE, "machdep", NULL, + NULL, 0, NULL, 0, CTL_MACHDEP, CTL_EOL); + if (error) + return; + + if (smbios_table != 0) { + (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); + } +}