MBIOS (System Management BIOS)是主板或系统制造者以标准格式显示产品管理信息所需遵循的统一规范。
目的在于提供足够的信息给BIOS开发人员去实现必要的扩充,让他们产品的硬件和其他系统相关的信息能够正确地被用户定义的接口所判定。
SMBIOS也能提供足够的信息给管理设备的开发人员去开发通用的程序,能将SMBIOS的格式转换到他们选择的管理技术的格式。
然后,怎样访问SMBIOS information?
spec里边是这样说的:A table-based method, it provides the SMBIOS structures as a packed list of data referenced by a table entry point.
基于表结构的方法,表的内容是table entry point的数据,这个访问方法从SMBIOS2.1以后开始被推荐使用。要访问SMBIOS的内容,先要找到SMBIOS 的table entry point。
32位的entry point容许SMBIOS structure table位于4GB以下的物理空间。
在non-UEFI系统中要定位entry point structure可以通过在地址空间F000:0000 ~ F000:FFFF搜寻“_SM_” (5F 53 4D 5F), 找到后再确认其后16 byte的位置是不是“_DMI_”(5F 44 4D 49 5F).
在UEFI-based系统中,在EFI_CONFIGURATION_TABLE中找到SMBIOS_TABLE_GUID, 然后其关联的指针就是指向entry point structure。
下面来看看32位的entry point structure:
Offset | Name | Length | Description |
00h | Anchor String | 4 BYTEs | _SM_ , specified as four ASCII characters (5F 53 4D 5F). |
04h | Entry Point Structure Checksum | BYTE | Checksum of the Entry Point Structure (EPS). |
05h | Entry Point Length | BYTE | Length of the Entry Point Structure, starting with the Anchor String field, in bytes, currently 1Fh. |
06h | SMBIOS Major Version | BYTE | Major version of this specification implemented in the table structures. |
07h | SMBIOS Minor Version | BYTE | Minor version of this specification implemented in the table structures. |
08h | Maximum Structure Size | WORD | Size of the largest SMBIOS structure, in bytes, and encompasses the structure’s formatted area and text strings. |
0Ah | Entry Point Revision | BYTE | EPS revision implemented in this structure and identifies the formatting of offsets 0Bh to 0Fh as follows: 00h Entry Point is based on SMBIOS 2.1 definition; formatted area is reserved and set to all 00h. 01h-FFh Reserved for assignment by this specification. |
0Bh – 0Fh | Formatted Area | 5 BYTEs | Value present in the Entry Point Revision field defines the interpretation to be placed upon these 5 bytes. |
10h | Intermediate Anchor String | 5 BYTEs | _DMI_, specified as five ASCII characters (5F 44 4D 49 5F). |
15h | Intermediate Checksum | BYTE | Checksum of Intermediate Entry Point Structure (IEPS). |
16h | Structure Table Length | WORD | Total length of SMBIOS Structure Table, pointed to by the Structure Table Address, in bytes. |
18h | Structure Table Address | DWORD | 32-bit physical starting address of the read-only SMBIOS Structure Table, which can start at any 32-bit address This area contains all of the SMBIOS structures fully packed together. |
1Ch | Number of SMBIOS Structures | WORD | Total number of structures present in the SMBIOS Structure Table. |
1Eh | SMBIOS BCD Revision | BYTE | Indicates compliance with a revision of this specification. |
根据entry point structure就可以知道SMBIOS的 structure table length, structure table address, number of SMBIOS structures等, 进而去访问address指定的各个SMBIOS structures(Types)
64位的entry point与32位的大同小异,具体情况请参考spec.
最后就是各个SMBIOS structure 的定义了,总体来说会有一些共同点。
每个SMBIOS structure分为a formatted section和an optional unformed section.
The formatted section of each structures begins with a four-byte header.
每个字符串以null(00h)结束,单个string并没有长度的限制,但它会被计入structure table length
但是整个structure table的长度必须在Structure Table Length 规定范围内
以下是four-byte header的format:
Offset | Name | Length | Description |
00h | Type | BYTE | Specifies the type of structure. Types 0 through 127 (7Fh) are reserved for and defined by this specification. Types 128 through 256 (80h to FFh) are available for system- and OEM-specific information. |
01h | Length | BYTE | Specifies the length of the formatted area of the structure, starting at the Type field. The length of the structure’s string-set is not included. |
02h | Handle | WORD | Specifies the structure’s handle, a unique 16-bit number in the range 0 to 0FFFEh (for version 2.0) or 0 to 0FEFFh (for version 2.1 and later). The handle can be used with the Get SMBIOS Structure function to retrieve a specific structure; the handle numbers are not required to be contiguous. For version 2.1 and later, handle values in the range 0FF00h to 0FFFFh are reserved for use by this specification. If the system configuration changes, a previously assigned handle might no longer exist. However, after a handle has been assigned by the BIOS, the BIOS cannot re-assign that handle number to another structure. |
从SMBIOS version 2.3以来,兼容SMBIOS的应用被要求包含这些types:
BIOS Information (Type 0)
System Information (Type 1)
System Enclosure (Type 3)
Processor Information (Type 4)
Cache Information (Type 7)
System Slots (Type 9)
Physical Memory Array (Type 16)
Memory Device (Type 17)
Memory Array Mapped Address (Type 19)
System Boot Information (Type 32)