diff options
author | jkim <jkim@FreeBSD.org> | 2005-10-18 20:03:31 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2005-10-18 20:03:31 +0000 |
commit | d0aea4e867a47b348c295e34bed386fdc83974b6 (patch) | |
tree | 8e1ceb8039104221c44d0a41a8713f9b1d0b1b1c /sys/boot | |
parent | 81737fff083ffbd9a4647cdb650c88e3b2ddfb0b (diff) | |
download | FreeBSD-src-d0aea4e867a47b348c295e34bed386fdc83974b6.zip FreeBSD-src-d0aea4e867a47b348c295e34bed386fdc83974b6.tar.gz |
Export processor socket information. New environment variables are:
smbios.socket.enabled: number of enabled sockets
smbios.socket.populated: number of populated sockets
Diffstat (limited to 'sys/boot')
-rw-r--r-- | sys/boot/i386/libi386/smbios.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sys/boot/i386/libi386/smbios.c b/sys/boot/i386/libi386/smbios.c index 4bef81f..3550131 100644 --- a/sys/boot/i386/libi386/smbios.c +++ b/sys/boot/i386/libi386/smbios.c @@ -54,6 +54,9 @@ __FBSDID("$FreeBSD$"); #define SMBIOS_SIG "_SM_" #define SMBIOS_DMI_SIG "_DMI_" +static u_int8_t smbios_enabled_sockets = 0; +static u_int8_t smbios_populated_sockets = 0; + static u_int8_t *smbios_parse_table(const u_int8_t *dmi); static void smbios_setenv(const char *env, const u_int8_t *dmi, const int offset); @@ -66,6 +69,7 @@ smbios_detect(void) u_int8_t *smbios, *dmi, *addr; u_int16_t i, length, count; u_int32_t paddr; + char buf[4]; /* locate and validate the SMBIOS */ smbios = smbios_sigsearch(PTOV(SMBIOS_START), SMBIOS_LENGTH); @@ -79,6 +83,10 @@ smbios_detect(void) for (dmi = addr = PTOV(paddr), i = 0; dmi - addr < length && i < count; i++) dmi = smbios_parse_table(dmi); + sprintf(buf, "%d", smbios_enabled_sockets); + setenv("smbios.socket.enabled", buf, 1); + sprintf(buf, "%d", smbios_populated_sockets); + setenv("smbios.socket.populated", buf, 1); } static u_int8_t * @@ -110,6 +118,30 @@ smbios_parse_table(const u_int8_t *dmi) smbios_setenv("smbios.chassis.version", dmi, 0x06); break; + case 4: /* Type 4: Processor Information */ + /* + * Offset 18h: Processor Status + * + * Bit 7 Reserved, must be 0 + * Bit 6 CPU Socket Populated + * 1 - CPU Socket Populated + * 0 - CPU Socket Unpopulated + * Bit 5:3 Reserved, must be zero + * Bit 2:0 CPU Status + * 0h - Unknown + * 1h - CPU Enabled + * 2h - CPU Disabled by User via BIOS Setup + * 3h - CPU Disabled by BIOS (POST Error) + * 4h - CPU is Idle, waiting to be enabled + * 5-6h - Reserved + * 7h - Other + */ + if ((dmi[0x18] & 0x07) == 1) + smbios_enabled_sockets++; + if (dmi[0x18] & 0x40) + smbios_populated_sockets++; + break; + default: /* skip other types */ break; } |