SMBIOS

最近花時間把之前學過的SMBIOS複習了一遍,做點筆記,以後若是記不清了還可以找回來看看。

首先,SMBIOS的基本概念

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.

Remaining data in the formatted section is determined by the structure type, as is the overall length of the formatted section.

The unformed section of the structure is used for passing variable data, such as text strings.

Each structure shall be terminated by a double-null(0000h).

每個字符串以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)









發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章