@@ -68,41 +68,42 @@ int test_bios_region_rw()
6868
6969int set_smbios_table ()
7070{
71- UINTN i ;
7271 EFI_GUID smbiosGuid = SMBIOS_TABLE_GUID ;
7372 EFI_GUID smbios3Guid = SMBIOS3_TABLE_GUID ;
74- bool found = FALSE;
7573 uintptr_t table_addr = 0 ;
7674
77- for (i = 0 ; i < gST -> NumberOfTableEntries ; i ++ ) {
78- EFI_CONFIGURATION_TABLE * table ;
79- table = gST -> ConfigurationTable + i ;
80-
81- if (!efi_guidcmp (table -> VendorGuid , smbiosGuid )) {
82- printf ("Found SMBIOS Table at %x\n" , (uintptr_t )table -> VendorTable );
83- table_addr = (uintptr_t )table -> VendorTable ;
84- found = TRUE;
85- break ;
86- }
75+ for (size_t i = 0 ; i < gST -> NumberOfTableEntries ; i ++ ) {
76+ EFI_CONFIGURATION_TABLE * table = gST -> ConfigurationTable + i ;
8777
8878 if (!efi_guidcmp (table -> VendorGuid , smbios3Guid )) {
8979 printf ("Found SMBIOS 3.0 Table at %x\n" , (uintptr_t )table -> VendorTable );
90- table_addr = (uintptr_t )table -> VendorTable ;
91- found = TRUE;
80+ if (table_addr < 0x100000000 ) {
81+ table_addr = (uintptr_t )table -> VendorTable ;
82+ }
9283 break ;
9384 }
9485 }
9586
96- if (found ) {
97- if (table_addr > 0xffffffff ) {
98- printf ("SMBIOS table address too high\n" );
99- return -1 ;
87+ if (table_addr == 0 ) {
88+ for (size_t i = 0 ; i < gST -> NumberOfTableEntries ; i ++ ) {
89+ EFI_CONFIGURATION_TABLE * table = gST -> ConfigurationTable + i ;
90+
91+ if (!efi_guidcmp (table -> VendorGuid , smbiosGuid )) {
92+ printf ("Found SMBIOS Table at %x\n" , (uintptr_t )table -> VendorTable );
93+ if (table_addr < 0x100000000 ) {
94+ table_addr = (uintptr_t )table -> VendorTable ;
95+ }
96+ break ;
97+ }
10098 }
99+ }
100+
101+ if (table_addr != 0 ) {
101102 priv .low_stub -> boot_table .SmbiosTable = table_addr ;
102103 return 0 ;
103104 }
104105
105- printf ("No SMBIOS table found\n" );
106+ printf ("No usable SMBIOS table found\n" );
106107
107108 return -1 ;
108109}
0 commit comments