Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does dmidecode get the SMBIOS table?

Tags:

linux

x86

bios

I always have this question and didn't get an answer after reading man-page and searching online. Anyone who has knowledge about this please comment.

I understand that SMBIOS table or DMI table is what dmidecode locates and parses. But where does it get it from? Is it in the format of a file in Linux?

like image 615
iglory Avatar asked Dec 30 '15 21:12

iglory


People also ask

Where does dmidecode get its information?

DmiDmiThe Desktop Management Interface (DMI) generates a standard framework for managing and tracking components in a desktop, notebook or server computer, by abstracting these components from the software that manages them.https://en.wikipedia.org › Desktop_Management_InterfaceDesktop Management Interface - Wikipediadecode reads the data from DMI (Desktop Management Interface) table, which holds information for the system's hardware components like BIOS Revision, Serial Number, RAM, CPU, manufacturer information, etc.

Where is SMBIOS stored?

The SMBIOS Entry Point Table is located somewhere between the addresses 0xF0000 and 0xFFFFF, and must be on a 16-byte boundary.

What does DMI stand for in dmidecode?

Dmidecode stands for DMI (Desktop Management Interface) table decoder, as the name suggests it reads the data from DMI table and represents to us in human readable format.

What is the handle in dmidecode?

Handle - This is a unique identifier, which allows records to reference each other. For example, processor records usually reference cache memory records using their handles.


2 Answers

Looks like it comes from /dev/mem

root@aw42e ~]# strace -F -e open dmidecode -t 17
   <snip>
    open("/sys/firmware/efi/systab", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/proc/efi/systab", O_RDONLY)      = -1 ENOENT (No such file or directory)
    open("/dev/mem", O_RDONLY)              = 3
    SMBIOS 2.5 present.

    open("/dev/mem", O_RDONLY)              = 3
    Handle 0x0016, DMI type 17, 27 bytes
    Memory Device
<snip>

/dev/mem is described as

mem is a character device file that is an image of the main memory of the computer. It may be used, for example, to examine (and even patch) the system. Byte addresses in mem are interpreted as physical memory addresses.

So to answer, it is contained in /dev/mem

I'm searching for more info, but I assume that the kernel inserts the DMI table into memory at boot time - from man dmidecode

As you run it, dmidecode will try to locate the DMI table. If it succeeds, it will then parse this table and display a list of records like this one:

like image 129
Party Time Avatar answered Dec 04 '22 21:12

Party Time


The data defined in the DMI table is an industry standard; implemented for both Linux and Windows (among other PC OSs):

https://en.wikipedia.org/wiki/System_Management_BIOS

the System Management BIOS (SMBIOS) specification defines data structures (and access methods) that can be used to read information stored in the BIOS of a computer. Circa 1999, it became part of the domain of the Distributed Management Task Force (DMTF)...

At approximately the same time Microsoft started to require that OEMs and BIOS vendors support the interface/data-set in order to have Microsoft certification...

You can read more about the Linux implementation - and the driver used to export the actual, raw data to userspace ("/sys/class/dmi/", "/dev/mem", and friends) - here:

https://web.archive.org/web/20160318010215/http://www.linux.org/threads/the-linux-kernel-configuring-the-kernel-part-19.4929/

The actual kernel code for accessing DMI info is here (your distro/version might differ):

https://elixir.bootlin.com/linux/latest/source/drivers/firmware/dmi-sysfs.c

like image 33
paulsm4 Avatar answered Dec 04 '22 21:12

paulsm4