bloggerads

2015年7月26日 星期日

SMBios (System Management Bios)

使用者可以透過SMBios知道這台電腦的詳細規格,RW everything / RW這些tool都有提供SMBios data查詢。

SMBios是一份軟體的spec, 他定義了兩個table, 即EPS ( Entry Point structure) 和 Structure Table

EPS位於記憶體1MB以下64K之間,也就是0xF0000 ~ 0xFFFFF之間。透過程式搜尋搜尋_SM_和_DMI_這兩個Keyword可以找到這個table。

以下是 SMBIOS 2.1 (32-bit) Entry Point structure,這邊列出比較重要的部分


Offset
Name
Length
Description
00h
Anchor String
4 BYTEs
_SM_, specified as four ASCII characters (5F 53 4D 5F).
10h
Intermediate Anchor String
5 BYTEs
_DMI_, specified as five ASCII characters (5F 44 4D 49 5F)
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
1Ch
Number of SMBIOS Structures
WORD
Handle的數量


透過18H這個offset可以找到一塊記憶體:Structure Table,這裡面有一堆handle, 每個handle都代表一個type(有些type不只一個handle)。任何 type 的 Structure都有定義以下這幾個共通的欄位



Offset
Name
Length
Description
00h
Type
Byte
which type
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
這是第幾個handle

下兩圖是Structure的兩種格式,一種是含有string, 一種是沒有(注意他的Length不含string), 如果是含有string的,最後須再加個 '0' 代表結束


最後列出有哪些Type,細部的Type欄位定義請參考spec
Type
Description
0
BIOS Information
1
System Information
2
Baseboard (or Module) Information
3
System Enclosure or Chassis
4
Processor Information
5
Memory Controller Information (Obsolete)
6
Memory Module Information (Obsolete)
7
Cache Information
8
Port Connector Information
9
System Slots
10
On Board Devices Information
11
OEM Strings
12
System Configuration Options
13
BIOS Language Information
14
Group Associations
15
System Event Log
16
Physical Memory Array
17
Memory Device
18
32-Bit Memory Error Information
19
Memory Array Mapped Address
20
Memory Device Mapped Address
21
Built-in Pointing Device
22
Portable Battery
23
System Reset
24
Hardware Security
25
System Power Controls
26
Voltage Probe
27
Cooling Device
28
Temperature Probe
29
Electrical Current Probe
30
Out-of-Band Remote Access
31
Boot Integrity Services (BIS) Entry Point
32
System Boot Information
33
64-Bit Memory Error Information
34
Management Device
35
Management Device Component
36
Management Device Threshold Data
37
Memory Channel
38
IPMI Device Information
39
System Power Supply
40
Additional Information
41
Onboard Devices Extended Information
42
Management Controller Host Interface
126
Inactive
127
End-of-Table
128–255
Available for system- and OEM- specific information

特別介紹Type 9 (System Slot) 看到一個有趣的現象, 基本上主機板有幾個PCIe插槽就要有幾個handle是Type 9的,但是一般PCIe的lane除了一條x16的以外大部分都是共享的,如某家主機板的規格:

>>  1*PCI-E 3.0 x16 + 1*PCI-E 3.0 x8 + 2*PCI-E x4
>>  PCI-E x4 插槽與PCI-E x8 插槽共享頻寬。

但SMBios對Type 9定義了Bus/Dev/Func的號碼的欄位, 這樣不是很怪? 我提供我的看法:



若所有slot都沒有插裝置,除了x16會有固定的Bus號碼以外,因為系統未決定怎麼分配共享的lane(且通常沒插裝置時這些對外延伸bus的P2P bridge會被關閉), 所以共享lane的slot其Bus號碼應該應為0xFF, 也就是unknown。



沒有留言:

張貼留言