From a52daa5fd2b2326b04f6b97e1239168e3254e0f6 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Thu, 21 Jul 2005 00:18:28 +0000 Subject: [PATCH] Fix smbios(4) and add support for amd64 Approved by: anholt (mentor) --- sys/amd64/conf/NOTES | 2 ++ sys/conf/files.amd64 | 1 + sys/i386/bios/smbios.c | 26 ++++++++++++++++++++++---- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index facd111bf18e..4ee9a90248f1 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -299,6 +299,7 @@ options SAFE_RNDTEST # enable rndtest support # # cy: Cyclades serial driver # digi: Digiboard driver +# smbios: DMI/SMBIOS entry point # Notes on the Specialix SI/XIO driver: # The host card is memory, not IO mapped. @@ -321,6 +322,7 @@ device digi_Xr device pbio hint.pbio.0.at="isa" hint.pbio.0.port="0x360" +device smbios # sx device is i386 and pc98 only at the moment. device sx options SX_DEBUG diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index 467c9b77589c..4bfda27e88c7 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -229,6 +229,7 @@ compat/ndis/subr_ntoskrnl.c optional ndisapi pci compat/ndis/subr_pe.c optional ndisapi pci compat/ndis/subr_usbd.c optional ndisapi pci compat/ndis/winx64_wrap.S optional ndisapi pci +i386/bios/smbios.c optional smbios i386/cpufreq/powernow.c optional cpufreq i386/cpufreq/est.c optional cpufreq i386/cpufreq/p4tcc.c optional cpufreq diff --git a/sys/i386/bios/smbios.c b/sys/i386/bios/smbios.c index f9ceae20925f..c620b4cc0644 100644 --- a/sys/i386/bios/smbios.c +++ b/sys/i386/bios/smbios.c @@ -45,6 +45,11 @@ __FBSDID("$FreeBSD$"); #include #include +/* + * System Management BIOS Reference Specification, v2.4 Final + * http://www.dmtf.org/standards/published_documents/DSP0134.pdf + */ + /* * SMBIOS Entry Point Structure */ @@ -55,9 +60,9 @@ struct smbios_eps { u_int8_t SMBIOS_Major; u_int8_t SMBIOS_Minor; - u_int8_t Max_Size; + u_int16_t Max_Size; u_int8_t Revision; - u_int8_t Formatted_Area; + u_int8_t Formatted_Area[5]; u_int8_t Intermediate_Anchor[5]; /* '_DMI_' */ u_int8_t Intermediate_Checksum; @@ -113,6 +118,19 @@ smbios_identify (driver_t *driver, device_t parent) rid = 0; length = ADDR2EPS(addr)->Length; + if (length != 0x1f) { + u_int8_t major, minor; + + major = ADDR2EPS(addr)->SMBIOS_Major; + minor = ADDR2EPS(addr)->SMBIOS_Minor; + + /* SMBIOS v2.1 implementation might use 0x1e. */ + if (length == 0x1e && major == 2 && minor == 1) + length = 0x1f; + else + return; + } + child = BUS_ADD_CHILD(parent, 0, "smbios", -1); device_set_driver(child, driver); bus_set_resource(child, SYS_RES_MEMORY, rid, addr, length); @@ -170,10 +188,10 @@ smbios_attach (device_t dev) } sc->eps = RES2EPS(sc->res); - device_printf(dev, "Version: %d.%02d", + device_printf(dev, "Version: %u.%u", sc->eps->SMBIOS_Major, sc->eps->SMBIOS_Minor); if (bcd2bin(sc->eps->SMBIOS_BCD_Revision)) - printf(", Revision: %d.%02d", + printf(", BCD Revision: %u.%u", bcd2bin(sc->eps->SMBIOS_BCD_Revision >> 4), bcd2bin(sc->eps->SMBIOS_BCD_Revision & 0x0f)); printf("\n");