From 53bafb796b654d1f7206196fd97cf8ba0b08ad7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Mon, 28 Sep 2015 12:29:58 +0200 Subject: Imported Upstream version 3.0 --- biosdecode.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'biosdecode.c') diff --git a/biosdecode.c b/biosdecode.c index 09acb43..3bbfe28 100644 --- a/biosdecode.c +++ b/biosdecode.c @@ -2,7 +2,7 @@ * BIOS Decode * * Copyright (C) 2000-2002 Alan Cox - * Copyright (C) 2002-2008 Jean Delvare + * Copyright (C) 2002-2015 Jean Delvare * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,10 +25,10 @@ * are deemed to be part of the source code. * * References: - * - DMTF "System Management BIOS Reference Specification" - * Version 2.3.4 + * - DMTF "System Management BIOS (SMBIOS) Reference Specification" + * Version 3.0.0 * http://www.dmtf.org/standards/smbios - * - Intel "Preboot Execution Environment (PXE) Specification" + * - Intel "Preboot Execution Environment (PXE) Specification" * Version 2.1 * http://www.intel.com/labs/manage/wfm/wfmspecs.htm * - ACPI "Advanced Configuration and Power Interface Specification" @@ -90,6 +90,26 @@ struct bios_entry { * SMBIOS */ +static size_t smbios3_length(const u8 *p) +{ + return p[0x06]; +} + +static int smbios3_decode(const u8 *p, size_t len) +{ + if (len < 0x18 || !checksum(p, p[0x06])) + return 0; + + printf("SMBIOS %u.%u.%u present.\n", + p[0x07], p[0x08], p[0x09]); + printf("\tStructure Table Maximum Length: %u bytes\n", + DWORD(p + 0x0C)); + printf("\tStructure Table 64-bit Address: 0x%08X%08X\n", + QWORD(p + 0x10).h, QWORD(p + 0x10).l); + + return 1; +} + static size_t smbios_length(const u8 *p) { return p[0x05] == 0x1E ? 0x1F : p[0x05]; @@ -105,7 +125,7 @@ static int smbios_decode(const u8 *p, size_t len) printf("SMBIOS %u.%u present.\n", p[0x06], p[0x07]); printf("\tStructure Table Length: %u bytes\n", - WORD(p+0x16)); + WORD(p + 0x16)); printf("\tStructure Table Address: 0x%08X\n", DWORD(p + 0x18)); printf("\tNumber Of Structures: %u\n", @@ -516,7 +536,7 @@ static int fjkeyinf_decode(const u8 *p, size_t len) return 1; printf("\tDevice %d: type %u, chip %u", i + 1, *(p + 8 + i * 4), *(p + 8 + i * 4 + 2)); - if (*(p+8+i*4+1)) /* Access method */ + if (*(p + 8 + i * 4 + 1)) /* Access method */ printf(", SMBus address 0x%x", *(p + 8 + i * 4 + 3) >> 1); printf("\n"); @@ -530,6 +550,7 @@ static int fjkeyinf_decode(const u8 *p, size_t len) */ static struct bios_entry bios_entries[] = { + { "_SM3_", 0, 0xF0000, 0xFFFFF, smbios3_length, smbios3_decode }, { "_SM_", 0, 0xF0000, 0xFFFFF, smbios_length, smbios_decode }, { "_DMI_", 0, 0xF0000, 0xFFFFF, dmi_length, dmi_decode }, { "_SYSID_", 0, 0xE0000, 0xFFFFF, sysid_length, sysid_decode }, @@ -565,7 +586,7 @@ static int parse_command_line(int argc, char * const argv[]) { "dev-mem", required_argument, NULL, 'd' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, - { 0, 0, 0, 0 } + { NULL, 0, NULL, 0 } }; while ((option = getopt_long(argc, argv, optstring, longopts, NULL)) != -1) -- cgit v1.2.3