Skip to content

Commit f2d1da4

Browse files
committed
更新smbios
1 parent a35c723 commit f2d1da4

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/driver/smbios.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ static __volatile__ struct limine_smbios_request smbios_request = {
1515
int smbios_major_version(void) {
1616
struct EntryPoint64 *entry = (struct EntryPoint64 *) smbios_request.response->entry_64;
1717
if(entry == NULL){
18-
return -1;
18+
struct EntryPoint32 *entry32 = (struct EntryPoint32 *) smbios_request.response->entry_32;
19+
return entry32 == NULL ? -1 : entry32->SMBIOSMajorVersion;
1920
}
2021
return entry->SMBIOSMajorVersion;
2122
}
@@ -24,7 +25,8 @@ int smbios_major_version(void) {
2425
int smbios_minor_version(void) {
2526
struct EntryPoint64 *entry = (struct EntryPoint64 *) smbios_request.response->entry_64;
2627
if(entry == NULL){
27-
return -1;
28+
struct EntryPoint32 *entry32 = (struct EntryPoint32 *)smbios_request.response->entry_32;
29+
return entry32 == NULL ? -1 : entry32->SMBIOSMinorVersion;
2830
}
2931
return entry->SMBIOSMinorVersion;
3032
}

src/include/smbios.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,23 @@ struct EntryPoint64 {
2020
uint64_t StructureTableAddress; // 结构表地址
2121
};
2222

23+
struct EntryPoint32 {
24+
char AnchorString[4];
25+
uint8_t EntryPointChecksum; // 入口点校验和
26+
uint8_t EntryPointLength; // 入口点结构长度
27+
uint8_t SMBIOSMajorVersion; // SMBIOS主版本
28+
uint8_t SMBIOSMinorVersion; // SMBIOS次版本
29+
uint8_t SMBIOSDocrev; // 文档修订版
30+
uint8_t EntryPointRevision; // 入口点修订版
31+
uint8_t FormattedArea[5]; // 保留
32+
uint8_t IntermediateAnchorString[5];
33+
uint8_t IntermediateChecksum;
34+
uint16_t StructureTableMaxSize; // 结构表最大大小
35+
uint32_t StructureTableAddress; // 结构表地址
36+
uint16_t NumberOfStructures; // 结构数量
37+
uint8_t BCDRevision; // BCD修订
38+
};
39+
2340
/* 结构表头部 */
2441
struct Header {
2542
uint8_t type; // 结构类型

0 commit comments

Comments
 (0)