diff options
author | Allan Jude <allanjude@FreeBSD.org> | 2021-02-23 21:17:37 +0000 |
---|---|---|
committer | Allan Jude <allanjude@FreeBSD.org> | 2021-02-23 21:17:37 +0000 |
commit | ba6e37e47f41484fc61cc034619267b82ddd056c (patch) | |
tree | 7f47570ac2a7ce78b4ec8fbfb31fafec6d6927d7 /sys/dev/smbios | |
parent | d0673fe160b04f8162f380926d455dfb966f08fb (diff) | |
download | src-ba6e37e47f41484fc61cc034619267b82ddd056c.tar.gz src-ba6e37e47f41484fc61cc034619267b82ddd056c.zip |
ipmi_smbios: Deduplicate smbios entry point discovery logic
Sponsored by: Ampere Computing LLC
Submitted by: Klara Inc.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D28743
Diffstat (limited to 'sys/dev/smbios')
-rw-r--r-- | sys/dev/smbios/smbios.c | 21 | ||||
-rw-r--r-- | sys/dev/smbios/smbios.h | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/sys/dev/smbios/smbios.c b/sys/dev/smbios/smbios.c index 10589ed8d49d..00c7e2c98d2a 100644 --- a/sys/dev/smbios/smbios.c +++ b/sys/dev/smbios/smbios.c @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); #endif #include <dev/smbios/smbios.h> +static struct smbios_softc *smbios; + /* * System Management BIOS Reference Specification, v2.4 Final * http://www.dmtf.org/standards/published_documents/DSP0134.pdf @@ -179,6 +181,7 @@ smbios_attach (device_t dev) bcd2bin(sc->eps->BCD_revision & 0x0f)); printf("\n"); + smbios = sc; return (0); bad: if (sc->res) @@ -191,6 +194,7 @@ smbios_detach (device_t dev) { struct smbios_softc *sc; + smbios = NULL; sc = device_get_softc(dev); if (sc->res) @@ -199,6 +203,23 @@ smbios_detach (device_t dev) return (0); } +int +smbios_get_structure_table(vm_paddr_t *table, vm_size_t *size) +{ + + if (smbios == NULL) + return (ENXIO); + if (smbios->eps_64bit) { + *table = smbios->eps3->structure_table_address; + *size = smbios->eps3->structure_table_max_size; + } else { + *table = smbios->eps->structure_table_address; + *size = smbios->eps->structure_table_length; + } + return (0); +} + + static int smbios_modevent (mod, what, arg) module_t mod; diff --git a/sys/dev/smbios/smbios.h b/sys/dev/smbios/smbios.h index 6503cdb73c4c..554b882f1da4 100644 --- a/sys/dev/smbios/smbios.h +++ b/sys/dev/smbios/smbios.h @@ -32,6 +32,8 @@ #ifndef _SMBIOS_H_ #define _SMBIOS_H_ +int smbios_get_structure_table(vm_paddr_t *table, vm_size_t *size); + /* * System Management BIOS */ |