Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/fdt Expose SMBIOS table pointer via machdep.smb...



details:   https://anonhg.NetBSD.org/src/rev/d7a7d8c22278
branches:  trunk
changeset: 445338:d7a7d8c22278
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Oct 23 10:13:34 2018 +0000

description:
Expose SMBIOS table pointer via machdep.smbios sysctl

diffstat:

 sys/arch/arm/fdt/acpi_fdt.c |  36 ++++++++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)

diffs (77 lines):

diff -r 3ba87c0b3fb2 -r d7a7d8c22278 sys/arch/arm/fdt/acpi_fdt.c
--- a/sys/arch/arm/fdt/acpi_fdt.c       Tue Oct 23 10:12:59 2018 +0000
+++ b/sys/arch/arm/fdt/acpi_fdt.c       Tue Oct 23 10:13:34 2018 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
 #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_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 @@
        aa.aa_dmat64 = faa->faa_dmat;
 #endif
        config_found_ia(self, "acpibus", &aa, 0);
+
+       acpi_fdt_sysctl_init();
 }
 
 static void
@@ -118,3 +125,28 @@
        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);
+       }
+}



Home | Main Index | Thread Index | Old Index