mirror of
https://git.jff.email/cgit/dmidecode.git
synced 2026-08-07 10:54:40 +00:00
Update upstream source from tag 'upstream/3.3'
Update to upstream version '3.3'
with Debian dir d4aebe3a01
This commit is contained in:
commit
37c536ce72
30
Makefile
30
Makefile
@ -4,7 +4,7 @@
|
||||
# VPD Decode
|
||||
#
|
||||
# Copyright (C) 2000-2002 Alan Cox <alan@redhat.com>
|
||||
# Copyright (C) 2002-2015 Jean Delvare <jdelvare@suse.de>
|
||||
# Copyright (C) 2002-2020 Jean Delvare <jdelvare@suse.de>
|
||||
#
|
||||
# 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
|
||||
@ -12,8 +12,13 @@
|
||||
# (at your option) any later version.
|
||||
#
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
|
||||
CC ?= gcc
|
||||
# Base CFLAGS can be overridden by environment
|
||||
CFLAGS ?= -O2
|
||||
# When debugging, disable -O2 and enable -g
|
||||
#CFLAGS ?= -g
|
||||
|
||||
CFLAGS += -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \
|
||||
-Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef
|
||||
|
||||
# Let lseek and mmap support 64-bit wide offsets
|
||||
@ -22,12 +27,8 @@ CFLAGS += -D_FILE_OFFSET_BITS=64
|
||||
#CFLAGS += -DBIGENDIAN
|
||||
#CFLAGS += -DALIGNMENT_WORKAROUND
|
||||
|
||||
# When debugging, disable -O2 and enable -g.
|
||||
CFLAGS += -O2
|
||||
#CFLAGS += -g
|
||||
|
||||
# Pass linker flags here
|
||||
LDFLAGS =
|
||||
# Pass linker flags here (can be set from environment too)
|
||||
LDFLAGS ?=
|
||||
|
||||
DESTDIR =
|
||||
prefix = /usr/local
|
||||
@ -61,8 +62,8 @@ all : $(PROGRAMS)
|
||||
# Programs
|
||||
#
|
||||
|
||||
dmidecode : dmidecode.o dmiopt.o dmioem.o util.o
|
||||
$(CC) $(LDFLAGS) dmidecode.o dmiopt.o dmioem.o util.o -o $@
|
||||
dmidecode : dmidecode.o dmiopt.o dmioem.o dmioutput.o util.o
|
||||
$(CC) $(LDFLAGS) dmidecode.o dmiopt.o dmioem.o dmioutput.o util.o -o $@
|
||||
|
||||
biosdecode : biosdecode.o util.o
|
||||
$(CC) $(LDFLAGS) biosdecode.o util.o -o $@
|
||||
@ -78,13 +79,16 @@ vpddecode : vpddecode.o vpdopt.o util.o
|
||||
#
|
||||
|
||||
dmidecode.o : dmidecode.c version.h types.h util.h config.h dmidecode.h \
|
||||
dmiopt.h dmioem.h
|
||||
dmiopt.h dmioem.h dmioutput.h
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
dmiopt.o : dmiopt.c config.h types.h util.h dmidecode.h dmiopt.h
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
dmioem.o : dmioem.c types.h dmidecode.h dmioem.h
|
||||
dmioem.o : dmioem.c types.h dmidecode.h dmioem.h dmioutput.h
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
dmioutput.o : dmioutput.c types.h dmioutput.h
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
biosdecode.o : biosdecode.c version.h types.h util.h config.h
|
||||
|
||||
18
NEWS
18
NEWS
@ -1,3 +1,21 @@
|
||||
Version 3.3 (Wed Oct 14 2020)
|
||||
- [BUILD] Allow overriding build settings from the environment.
|
||||
- [COMPATIBILITY] Document how the UUID fields are interpreted.
|
||||
- [PORTABILITY] Don't use memcpy on /dev/mem on arm64.
|
||||
- [PORTABILITY] Only scan /dev/mem for entry point on x86.
|
||||
- Support for SMBIOS 3.3.0. This includes new processor names, new port
|
||||
connector types, and new memory device form factors, types and
|
||||
technologies.
|
||||
- Add bios-revision, firmware-revision and system-sku-number to -s option.
|
||||
- Use the most appropriate unit for cache size.
|
||||
- Decode system slot base bus width and peers.
|
||||
- Important bug fixes:
|
||||
Fix Redfish Hostname print length
|
||||
Fix formatting of TPM table output
|
||||
Fix System Slot Information for PCIe SSD
|
||||
Don't choke on invalid processor voltage
|
||||
- Use the most appropriate unit for cache size.
|
||||
|
||||
Version 3.2 (Wed Sep 14 2018)
|
||||
- [COMPATIBILITY] The UUID is now displayed using lowercase letters, per
|
||||
RFC 4122 (#53569). You must ensure that any code parsing it is
|
||||
|
||||
5
config.h
5
config.h
@ -26,4 +26,9 @@
|
||||
#define ALIGNMENT_WORKAROUND
|
||||
#endif
|
||||
|
||||
/* Avoid unaligned memcpy on /dev/mem */
|
||||
#ifdef __aarch64__
|
||||
#define USE_SLOW_MEMCPY
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
2064
dmidecode.c
2064
dmidecode.c
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This file is part of the dmidecode project.
|
||||
*
|
||||
* Copyright (C) 2005-2008 Jean Delvare <jdelvare@suse.de>
|
||||
* Copyright (C) 2005-2020 Jean Delvare <jdelvare@suse.de>
|
||||
*
|
||||
* 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
|
||||
@ -18,6 +18,9 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef DMIDECODE_H
|
||||
#define DMIDECODE_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
struct dmi_header
|
||||
@ -30,3 +33,5 @@ struct dmi_header
|
||||
|
||||
int is_printable(const u8 *data, int len);
|
||||
const char *dmi_string(const struct dmi_header *dm, u8 s);
|
||||
|
||||
#endif
|
||||
|
||||
105
dmioem.c
105
dmioem.c
@ -2,7 +2,7 @@
|
||||
* Decoding of OEM-specific entries
|
||||
* This file is part of the dmidecode project.
|
||||
*
|
||||
* Copyright (C) 2007-2008 Jean Delvare <jdelvare@suse.de>
|
||||
* Copyright (C) 2007-2020 Jean Delvare <jdelvare@suse.de>
|
||||
*
|
||||
* 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,6 +25,7 @@
|
||||
#include "types.h"
|
||||
#include "dmidecode.h"
|
||||
#include "dmioem.h"
|
||||
#include "dmioutput.h"
|
||||
|
||||
/*
|
||||
* Globals for vendor-specific decodes
|
||||
@ -92,19 +93,19 @@ static int dmi_decode_acer(const struct dmi_header *h)
|
||||
* brands, including Fujitsu-Siemens, Medion, Lenovo,
|
||||
* and eMachines.
|
||||
*/
|
||||
printf("Acer Hotkey Function\n");
|
||||
pr_handle_name("Acer Hotkey Function");
|
||||
if (h->length < 0x0F) break;
|
||||
cap = WORD(data + 0x04);
|
||||
printf("\tFunction bitmap for Communication Button: 0x%04hx\n", cap);
|
||||
printf("\t\tWiFi: %s\n", cap & 0x0001 ? "Yes" : "No");
|
||||
printf("\t\t3G: %s\n", cap & 0x0040 ? "Yes" : "No");
|
||||
printf("\t\tWiMAX: %s\n", cap & 0x0080 ? "Yes" : "No");
|
||||
printf("\t\tBluetooth: %s\n", cap & 0x0800 ? "Yes" : "No");
|
||||
printf("\tFunction bitmap for Application Button: 0x%04hx\n", WORD(data + 0x06));
|
||||
printf("\tFunction bitmap for Media Button: 0x%04hx\n", WORD(data + 0x08));
|
||||
printf("\tFunction bitmap for Display Button: 0x%04hx\n", WORD(data + 0x0A));
|
||||
printf("\tFunction bitmap for Others Button: 0x%04hx\n", WORD(data + 0x0C));
|
||||
printf("\tCommunication Function Key Number: %d\n", data[0x0E]);
|
||||
pr_attr("Function bitmap for Communication Button", "0x%04hx", cap);
|
||||
pr_subattr("WiFi", "%s", cap & 0x0001 ? "Yes" : "No");
|
||||
pr_subattr("3G", "%s", cap & 0x0040 ? "Yes" : "No");
|
||||
pr_subattr("WiMAX", "%s", cap & 0x0080 ? "Yes" : "No");
|
||||
pr_subattr("Bluetooth", "%s", cap & 0x0800 ? "Yes" : "No");
|
||||
pr_attr("Function bitmap for Application Button", "0x%04hx", WORD(data + 0x06));
|
||||
pr_attr("Function bitmap for Media Button", "0x%04hx", WORD(data + 0x08));
|
||||
pr_attr("Function bitmap for Display Button", "0x%04hx", WORD(data + 0x0A));
|
||||
pr_attr("Function bitmap for Others Button", "0x%04hx", WORD(data + 0x0C));
|
||||
pr_attr("Communication Function Key Number", "%d", data[0x0E]);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -127,19 +128,21 @@ static void dmi_print_hp_net_iface_rec(u8 id, u8 bus, u8 dev, const u8 *mac)
|
||||
* 640K ought to be enough for anybody(said no one, ever).
|
||||
* */
|
||||
static u8 nic_ctr;
|
||||
char attr[8];
|
||||
|
||||
if (id == 0xFF)
|
||||
id = ++nic_ctr;
|
||||
|
||||
sprintf(attr, "NIC %hu", id);
|
||||
if (dev == 0x00 && bus == 0x00)
|
||||
printf("\tNIC %d: Disabled\n", id);
|
||||
pr_attr(attr, "Disabled");
|
||||
else if (dev == 0xFF && bus == 0xFF)
|
||||
printf("\tNIC %d: Not Installed\n", id);
|
||||
pr_attr(attr, "Not Installed");
|
||||
else
|
||||
{
|
||||
printf("\tNIC %d: PCI device %02x:%02x.%x, "
|
||||
"MAC address %02X:%02X:%02X:%02X:%02X:%02X\n",
|
||||
id, bus, dev >> 3, dev & 7,
|
||||
pr_attr(attr, "PCI device %02x:%02x.%x, "
|
||||
"MAC address %02X:%02X:%02X:%02X:%02X:%02X",
|
||||
bus, dev >> 3, dev & 7,
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
}
|
||||
}
|
||||
@ -157,15 +160,15 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
||||
/*
|
||||
* Vendor Specific: HPE ProLiant System/Rack Locator
|
||||
*/
|
||||
printf("%s ProLiant System/Rack Locator\n", company);
|
||||
pr_handle_name("%s ProLiant System/Rack Locator", company);
|
||||
if (h->length < 0x0B) break;
|
||||
printf("\tRack Name: %s\n", dmi_string(h, data[0x04]));
|
||||
printf("\tEnclosure Name: %s\n", dmi_string(h, data[0x05]));
|
||||
printf("\tEnclosure Model: %s\n", dmi_string(h, data[0x06]));
|
||||
printf("\tEnclosure Serial: %s\n", dmi_string(h, data[0x0A]));
|
||||
printf("\tEnclosure Bays: %d\n", data[0x08]);
|
||||
printf("\tServer Bay: %s\n", dmi_string(h, data[0x07]));
|
||||
printf("\tBays Filled: %d\n", data[0x09]);
|
||||
pr_attr("Rack Name", "%s", dmi_string(h, data[0x04]));
|
||||
pr_attr("Enclosure Name", "%s", dmi_string(h, data[0x05]));
|
||||
pr_attr("Enclosure Model", "%s", dmi_string(h, data[0x06]));
|
||||
pr_attr("Enclosure Serial", "%s", dmi_string(h, data[0x0A]));
|
||||
pr_attr("Enclosure Bays", "%d", data[0x08]);
|
||||
pr_attr("Server Bay", "%s", dmi_string(h, data[0x07]));
|
||||
pr_attr("Bays Filled", "%d", data[0x09]);
|
||||
break;
|
||||
|
||||
case 209:
|
||||
@ -189,10 +192,9 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
||||
*
|
||||
* Type 221: is deprecated in the latest docs
|
||||
*/
|
||||
printf("%s %s\n", company,
|
||||
h->type == 221 ?
|
||||
"BIOS iSCSI NIC PCI and MAC Information" :
|
||||
"BIOS PXE NIC PCI and MAC Information");
|
||||
pr_handle_name("%s %s", company, h->type == 221 ?
|
||||
"BIOS iSCSI NIC PCI and MAC Information" :
|
||||
"BIOS PXE NIC PCI and MAC Information");
|
||||
nic = 1;
|
||||
ptr = 4;
|
||||
while (h->length >= ptr + 8)
|
||||
@ -224,7 +226,8 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
||||
* 0x08 | MAC | 32B | MAC addr padded w/ 0s
|
||||
* 0x28 | Port No| BYTE | Each NIC maps to a Port
|
||||
*/
|
||||
printf("%s BIOS PXE NIC PCI and MAC Information\n", company);
|
||||
pr_handle_name("%s BIOS PXE NIC PCI and MAC Information",
|
||||
company);
|
||||
if (h->length < 0x0E) break;
|
||||
/* If the record isn't long enough, we don't have an ID
|
||||
* use 0xFF to use the internal counter.
|
||||
@ -240,22 +243,24 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
||||
*
|
||||
* Source: hpwdt kernel driver
|
||||
*/
|
||||
printf("%s 64-bit CRU Information\n", company);
|
||||
pr_handle_name("%s 64-bit CRU Information", company);
|
||||
if (h->length < 0x18) break;
|
||||
printf("\tSignature: 0x%08x", DWORD(data + 0x04));
|
||||
if (is_printable(data + 0x04, 4))
|
||||
printf(" (%c%c%c%c)", data[0x04], data[0x05],
|
||||
pr_attr("Signature", "0x%08x (%c%c%c%c)",
|
||||
DWORD(data + 0x04),
|
||||
data[0x04], data[0x05],
|
||||
data[0x06], data[0x07]);
|
||||
printf("\n");
|
||||
else
|
||||
pr_attr("Signature", "0x%08x", DWORD(data + 0x04));
|
||||
if (DWORD(data + 0x04) == 0x55524324)
|
||||
{
|
||||
u64 paddr = QWORD(data + 0x08);
|
||||
paddr.l += DWORD(data + 0x14);
|
||||
if (paddr.l < DWORD(data + 0x14))
|
||||
paddr.h++;
|
||||
printf("\tPhysical Address: 0x%08x%08x\n",
|
||||
pr_attr("Physical Address", "0x%08x%08x",
|
||||
paddr.h, paddr.l);
|
||||
printf("\tLength: 0x%08x\n", DWORD(data + 0x10));
|
||||
pr_attr("Length", "0x%08x", DWORD(data + 0x10));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -265,16 +270,16 @@ static int dmi_decode_hp(const struct dmi_header *h)
|
||||
*
|
||||
* Source: hpwdt kernel driver
|
||||
*/
|
||||
printf("%s ProLiant Information\n", company);
|
||||
pr_handle_name("%s ProLiant Information", company);
|
||||
if (h->length < 0x08) break;
|
||||
printf("\tPower Features: 0x%08x\n", DWORD(data + 0x04));
|
||||
pr_attr("Power Features", "0x%08x", DWORD(data + 0x04));
|
||||
if (h->length < 0x0C) break;
|
||||
printf("\tOmega Features: 0x%08x\n", DWORD(data + 0x08));
|
||||
pr_attr("Omega Features", "0x%08x", DWORD(data + 0x08));
|
||||
if (h->length < 0x14) break;
|
||||
feat = DWORD(data + 0x10);
|
||||
printf("\tMisc. Features: 0x%08x\n", feat);
|
||||
printf("\t\tiCRU: %s\n", feat & 0x0001 ? "Yes" : "No");
|
||||
printf("\t\tUEFI: %s\n", feat & 0x1400 ? "Yes" : "No");
|
||||
pr_attr("Misc. Features", "0x%08x", feat);
|
||||
pr_subattr("iCRU", "%s", feat & 0x0001 ? "Yes" : "No");
|
||||
pr_subattr("UEFI", "%s", feat & 0x1400 ? "Yes" : "No");
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -318,9 +323,9 @@ static int dmi_decode_ibm_lenovo(const struct dmi_header *h)
|
||||
|| strcmp(dmi_string(h, 1), "TVT-Enablement") != 0)
|
||||
return 0;
|
||||
|
||||
printf("ThinkVantage Technologies\n");
|
||||
printf("\tVersion: %u\n", data[0x04]);
|
||||
printf("\tDiagnostics: %s\n",
|
||||
pr_handle_name("ThinkVantage Technologies");
|
||||
pr_attr("Version", "%u", data[0x04]);
|
||||
pr_attr("Diagnostics", "%s",
|
||||
data[0x14] & 0x80 ? "Available" : "No");
|
||||
break;
|
||||
|
||||
@ -357,8 +362,8 @@ static int dmi_decode_ibm_lenovo(const struct dmi_header *h)
|
||||
if (data[0x06] != 0x07 || data[0x07] != 0x03 || data[0x08] != 0x01)
|
||||
return 0;
|
||||
|
||||
printf("ThinkPad Device Presence Detection\n");
|
||||
printf("\tFingerprint Reader: %s\n",
|
||||
pr_handle_name("ThinkPad Device Presence Detection");
|
||||
pr_attr("Fingerprint Reader", "%s",
|
||||
data[0x09] & 0x01 ? "Present" : "No");
|
||||
break;
|
||||
|
||||
@ -390,9 +395,9 @@ static int dmi_decode_ibm_lenovo(const struct dmi_header *h)
|
||||
if (data[0x0A] != 0x0B || data[0x0B] != 0x07 || data[0x0C] != 0x01)
|
||||
return 0;
|
||||
|
||||
printf("ThinkPad Embedded Controller Program\n");
|
||||
printf("\tVersion ID: %s\n", dmi_string(h, 1));
|
||||
printf("\tRelease Date: %s\n", dmi_string(h, 2));
|
||||
pr_handle_name("ThinkPad Embedded Controller Program");
|
||||
pr_attr("Version ID", "%s", dmi_string(h, 1));
|
||||
pr_attr("Release Date", "%s", dmi_string(h, 2));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
3
dmiopt.c
3
dmiopt.c
@ -151,11 +151,14 @@ static const struct string_keyword opt_string_keyword[] = {
|
||||
{ "bios-vendor", 0, 0x04 },
|
||||
{ "bios-version", 0, 0x05 },
|
||||
{ "bios-release-date", 0, 0x08 },
|
||||
{ "bios-revision", 0, 0x15 }, /* 0x14 and 0x15 */
|
||||
{ "firmware-revision", 0, 0x17 }, /* 0x16 and 0x17 */
|
||||
{ "system-manufacturer", 1, 0x04 },
|
||||
{ "system-product-name", 1, 0x05 },
|
||||
{ "system-version", 1, 0x06 },
|
||||
{ "system-serial-number", 1, 0x07 },
|
||||
{ "system-uuid", 1, 0x08 }, /* dmi_system_uuid() */
|
||||
{ "system-sku-number", 1, 0x19 },
|
||||
{ "system-family", 1, 0x1a },
|
||||
{ "baseboard-manufacturer", 2, 0x04 },
|
||||
{ "baseboard-product-name", 2, 0x05 },
|
||||
|
||||
137
dmioutput.c
Normal file
137
dmioutput.c
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Generic output functions
|
||||
* This file is part of the dmidecode project.
|
||||
*
|
||||
* Copyright (C) 2020 Jean Delvare <jdelvare@suse.de>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include "dmioutput.h"
|
||||
|
||||
void pr_comment(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
printf("# ");
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
va_end(args);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void pr_info(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
va_end(args);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void pr_handle(const struct dmi_header *h)
|
||||
{
|
||||
printf("Handle 0x%04X, DMI type %d, %d bytes\n",
|
||||
h->handle, h->type, h->length);
|
||||
}
|
||||
|
||||
void pr_handle_name(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
va_end(args);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void pr_attr(const char *name, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
printf("\t%s: ", name);
|
||||
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
va_end(args);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void pr_subattr(const char *name, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
printf("\t\t%s: ", name);
|
||||
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
va_end(args);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void pr_list_start(const char *name, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
printf("\t%s:", name);
|
||||
|
||||
/* format is optional, skip value if not provided */
|
||||
if (format)
|
||||
{
|
||||
printf(" ");
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
va_end(args);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
}
|
||||
|
||||
void pr_list_item(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
printf("\t\t");
|
||||
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
va_end(args);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void pr_list_end(void)
|
||||
{
|
||||
/* a no-op for text output */
|
||||
}
|
||||
|
||||
void pr_sep(void)
|
||||
{
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void pr_struct_err(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
printf("\t");
|
||||
|
||||
va_start(args, format);
|
||||
vprintf(format, args);
|
||||
va_end(args);
|
||||
printf("\n");
|
||||
}
|
||||
34
dmioutput.h
Normal file
34
dmioutput.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Generic output functions
|
||||
* This file is part of the dmidecode project.
|
||||
*
|
||||
* Copyright (C) 2020 Jean Delvare <jdelvare@suse.de>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "dmidecode.h"
|
||||
|
||||
void pr_comment(const char *format, ...);
|
||||
void pr_info(const char *format, ...);
|
||||
void pr_handle(const struct dmi_header *h);
|
||||
void pr_handle_name(const char *format, ...);
|
||||
void pr_attr(const char *name, const char *format, ...);
|
||||
void pr_subattr(const char *name, const char *format, ...);
|
||||
void pr_list_start(const char *name, const char *format, ...);
|
||||
void pr_list_item(const char *format, ...);
|
||||
void pr_list_end(void);
|
||||
void pr_sep(void);
|
||||
void pr_struct_err(const char *format, ...);
|
||||
@ -1,10 +1,12 @@
|
||||
.TH BIOSDECODE 8 "February 2007" "dmidecode"
|
||||
.\"
|
||||
.SH NAME
|
||||
biosdecode \- \s-1BIOS\s0 information decoder
|
||||
.\"
|
||||
.SH SYNOPSIS
|
||||
.B biosdecode
|
||||
.RB [ OPTIONS ]
|
||||
|
||||
.\"
|
||||
.SH DESCRIPTION
|
||||
.B biosdecode
|
||||
parses the \s-1BIOS\s0 memory and prints information about all structures (or
|
||||
@ -54,7 +56,7 @@ started its life as a part of
|
||||
.B dmidecode
|
||||
but as more entry point types were added, it was moved to a different
|
||||
program.
|
||||
|
||||
.\"
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BR "-d" ", " "--dev-mem FILE"
|
||||
@ -68,17 +70,20 @@ Display usage information and exit
|
||||
.TP
|
||||
.BR "-V" ", " "--version"
|
||||
Display the version and exit
|
||||
|
||||
.\"
|
||||
.SH FILES
|
||||
.I /dev/mem
|
||||
.\"
|
||||
.SH BUGS
|
||||
Most of the time,
|
||||
.B biosdecode
|
||||
prints too much information (you don't really care about addresses)
|
||||
or not enough (because it doesn't follow pointers and has no lookup
|
||||
tables).
|
||||
.\"
|
||||
.SH AUTHORS
|
||||
Alan Cox, Jean Delvare
|
||||
.\"
|
||||
.SH "SEE ALSO"
|
||||
.BR dmidecode (8),
|
||||
.BR mem (4),
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
.TH DMIDECODE 8 "March 2012" "dmidecode"
|
||||
.TH DMIDECODE 8 "January 2019" "dmidecode"
|
||||
.\"
|
||||
.SH NAME
|
||||
dmidecode \- \s-1DMI\s0 table decoder
|
||||
.\"
|
||||
.SH SYNOPSIS
|
||||
.B dmidecode
|
||||
.RB [ OPTIONS ]
|
||||
|
||||
.\"
|
||||
.SH DESCRIPTION
|
||||
.B dmidecode
|
||||
is a tool for dumping a computer's \s-1DMI\s0 (some say \s-1SMBIOS\s0) table
|
||||
@ -58,7 +60,7 @@ displayed value.
|
||||
Decoded values. The information presented of course depends on the type
|
||||
of record. Here, we learn about the board's manufacturer, model, version
|
||||
and serial number.
|
||||
|
||||
.\"
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BR "-d" ", " "--dev-mem FILE"
|
||||
@ -72,9 +74,10 @@ displayed. Meta-data and handle references are hidden.
|
||||
Only display the value of the \s-1DMI\s0 string identified by \fBKEYWORD\fR.
|
||||
\fBKEYWORD\fR must be a keyword from the following list: \fBbios-vendor\fR,
|
||||
\fBbios-version\fR, \fBbios-release-date\fR,
|
||||
\fBbios-revision\fR, \fBfirmware-revision\fR,
|
||||
\fBsystem-manufacturer\fR, \fBsystem-product-name\fR,
|
||||
\fBsystem-version\fR, \fBsystem-serial-number\fR,
|
||||
\fBsystem-uuid\fR, \fBsystem-family\fR,
|
||||
\fBsystem-uuid\fR, \fBsystem-sku-number\fR, \fBsystem-family\fR,
|
||||
\fBbaseboard-manufacturer\fR, \fBbaseboard-product-name\fR,
|
||||
\fBbaseboard-version\fR, \fBbaseboard-serial-number\fR,
|
||||
\fBbaseboard-asset-tag\fR, \fBchassis-manufacturer\fR,
|
||||
@ -158,10 +161,9 @@ is run on a system with BIOS that boasts new SMBIOS specification, which
|
||||
is not supported by the tool yet, it will print out relevant message in
|
||||
addition to requested data on the very top of the output. Thus informs the
|
||||
output data is not reliable.
|
||||
|
||||
.\"
|
||||
.SH "DMI TYPES"
|
||||
The \s-1SMBIOS\s0 specification defines the following \s-1DMI\s0 types:
|
||||
|
||||
.TS
|
||||
r l
|
||||
__
|
||||
@ -246,7 +248,7 @@ dmidecode --type 0,13
|
||||
dmidecode --type bios
|
||||
.IP \(bu
|
||||
dmidecode --type BIOS
|
||||
|
||||
.\"
|
||||
.SH BINARY DUMP FILE FORMAT
|
||||
The binary dump files generated by --dump-bin and read using --from-dump
|
||||
are formatted as follows:
|
||||
@ -255,16 +257,37 @@ The SMBIOS or DMI entry point is located at offset 0x00.
|
||||
It is crafted to hard-code the table address at offset 0x20.
|
||||
.IP \(bu "\w'\(bu'u+1n"
|
||||
The DMI table is located at offset 0x20.
|
||||
|
||||
.\"
|
||||
.SH UUID FORMAT
|
||||
There is some ambiguity about how to interpret the UUID fields prior to SMBIOS
|
||||
specification version 2.6. There was no mention of byte swapping, and RFC 4122
|
||||
says that no byte swapping should be applied by default. However, SMBIOS
|
||||
specification version 2.6 (and later) explicitly states that the first 3 fields
|
||||
of the UUID should be read as little-endian numbers (byte-swapped).
|
||||
Furthermore, it implies that the same was already true for older versions of
|
||||
the specification, even though it was not mentioned. In practice, many hardware
|
||||
vendors were not byte-swapping the UUID. So, in order to preserve
|
||||
compatibility, it was decided to interpret the UUID fields according to RFC
|
||||
4122 (no byte swapping) when the SMBIOS version is older than 2.6, and to
|
||||
interpret the first 3 fields as little-endian (byte-swapped) when the SMBIOS
|
||||
version is 2.6 or later. The Linux kernel follows the same logic.
|
||||
.\"
|
||||
.SH FILES
|
||||
.I /dev/mem
|
||||
.I /sys/firmware/dmi/tables/smbios_entry_point (Linux only)
|
||||
.I /sys/firmware/dmi/tables/DMI (Linux only)
|
||||
.br
|
||||
.I /sys/firmware/dmi/tables/smbios_entry_point
|
||||
(Linux only)
|
||||
.br
|
||||
.I /sys/firmware/dmi/tables/DMI
|
||||
(Linux only)
|
||||
.\"
|
||||
.SH BUGS
|
||||
More often than not, information contained in the \s-1DMI\s0 tables is inaccurate,
|
||||
incomplete or simply wrong.
|
||||
.\"
|
||||
.SH AUTHORS
|
||||
Alan Cox, Jean Delvare
|
||||
.\"
|
||||
.SH "SEE ALSO"
|
||||
.BR biosdecode (8),
|
||||
.BR mem (4),
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
.TH OWNERSHIP 8 "February 2005" "dmidecode"
|
||||
.\"
|
||||
.SH NAME
|
||||
ownership \- Compaq ownership tag retriever
|
||||
.\"
|
||||
.SH SYNOPSIS
|
||||
.B ownership
|
||||
.RB [ OPTIONS ]
|
||||
|
||||
.\"
|
||||
.SH DESCRIPTION
|
||||
.B ownership
|
||||
retrieves and prints the "ownership tag" that can be set on Compaq
|
||||
@ -14,7 +16,7 @@ package,
|
||||
.B ownership
|
||||
doesn't print any version information, nor labels, but only the raw
|
||||
ownership tag. This should help its integration in scripts.
|
||||
|
||||
.\"
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BR "-d" ", " "--dev-mem FILE"
|
||||
@ -25,11 +27,13 @@ Display usage information and exit
|
||||
.TP
|
||||
.BR "-V" ", " "--version"
|
||||
Display the version and exit
|
||||
|
||||
.\"
|
||||
.SH FILES
|
||||
.I /dev/mem
|
||||
.\"
|
||||
.SH AUTHOR
|
||||
Jean Delvare
|
||||
.\"
|
||||
.SH "SEE ALSO"
|
||||
.BR biosdecode (8),
|
||||
.BR dmidecode (8),
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
.TH VPDDECODE 8 "February 2007" "dmidecode"
|
||||
.\"
|
||||
.SH NAME
|
||||
vpddecode \- \s-1VPD\s0 structure decoder
|
||||
.\"
|
||||
.SH SYNOPSIS
|
||||
.B vpddecode
|
||||
.RB [ OPTIONS ]
|
||||
|
||||
.\"
|
||||
.SH DESCRIPTION
|
||||
.B vpddecode
|
||||
prints the "vital product data" information that can be found in almost
|
||||
@ -17,19 +19,17 @@ Box Serial Number
|
||||
Motherboard Serial Number
|
||||
.IP \(bu
|
||||
Machine Type/Model
|
||||
|
||||
.PP
|
||||
Some systems have these additional items:
|
||||
.IP \(bu "\w'\(bu'u+1n"
|
||||
BIOS Release Date
|
||||
.IP \(bu
|
||||
Default Flash Image File Name
|
||||
|
||||
.PP
|
||||
Note that these additional items are not documented by IBM, so this is
|
||||
guess work, and as such should not be blindly trusted. Feedback about
|
||||
the accuracy of these labels is welcome.
|
||||
|
||||
.\"
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BR "-d" ", " "--dev-mem FILE"
|
||||
@ -62,11 +62,13 @@ Display usage information and exit
|
||||
.TP
|
||||
.BR "-V" ", " "--version"
|
||||
Display the version and exit
|
||||
|
||||
.\"
|
||||
.SH FILES
|
||||
.I /dev/mem
|
||||
.\"
|
||||
.SH AUTHOR
|
||||
Jean Delvare
|
||||
.\"
|
||||
.SH "SEE ALSO"
|
||||
.BR biosdecode (8),
|
||||
.BR dmidecode (8),
|
||||
|
||||
14
util.c
14
util.c
@ -155,6 +155,18 @@ out:
|
||||
return p;
|
||||
}
|
||||
|
||||
static void safe_memcpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
#ifdef USE_SLOW_MEMCPY
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
*((u8 *)dest + i) = *((const u8 *)src + i);
|
||||
#else
|
||||
memcpy(dest, src, n);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy a physical memory chunk into a memory buffer.
|
||||
* This function allocates memory.
|
||||
@ -214,7 +226,7 @@ void *mem_chunk(off_t base, size_t len, const char *devmem)
|
||||
if (mmp == MAP_FAILED)
|
||||
goto try_read;
|
||||
|
||||
memcpy(p, (u8 *)mmp + mmoffset, len);
|
||||
safe_memcpy(p, (u8 *)mmp + mmoffset, len);
|
||||
|
||||
if (munmap(mmp, mmoffset + len) == -1)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user