@@ -47,41 +47,42 @@ static void *find_table(uint32_t signature, uint8_t *csm_bin_base, size_t size)
4747
4848int set_smbios_table ()
4949{
50- UINTN i ;
5150 EFI_GUID smbiosGuid = SMBIOS_TABLE_GUID ;
5251 EFI_GUID smbios3Guid = SMBIOS3_TABLE_GUID ;
53- bool found = FALSE;
5452 uintptr_t table_addr = 0 ;
5553
56- for (i = 0 ; i < gST -> NumberOfTableEntries ; i ++ ) {
57- EFI_CONFIGURATION_TABLE * table ;
58- table = gST -> ConfigurationTable + i ;
54+ for (size_t i = 0 ; i < gST -> NumberOfTableEntries ; i ++ ) {
55+ EFI_CONFIGURATION_TABLE * table = gST -> ConfigurationTable + i ;
5956
6057 if (!efi_guidcmp (table -> VendorGuid , smbiosGuid )) {
6158 printf ("Found SMBIOS Table at %x\n" , (uintptr_t )table -> VendorTable );
62- table_addr = (uintptr_t )table -> VendorTable ;
63- found = TRUE;
59+ if (table_addr < 0x100000000 ) {
60+ table_addr = (uintptr_t )table -> VendorTable ;
61+ }
6462 break ;
6563 }
64+ }
6665
67- if (!efi_guidcmp (table -> VendorGuid , smbios3Guid )) {
68- printf ("Found SMBIOS 3.0 Table at %x\n" , (uintptr_t )table -> VendorTable );
69- table_addr = (uintptr_t )table -> VendorTable ;
70- found = TRUE;
71- break ;
66+ if (table_addr == 0 ) {
67+ for (size_t i = 0 ; i < gST -> NumberOfTableEntries ; i ++ ) {
68+ EFI_CONFIGURATION_TABLE * table = gST -> ConfigurationTable + i ;
69+
70+ if (!efi_guidcmp (table -> VendorGuid , smbios3Guid )) {
71+ printf ("Found SMBIOS 3.0 Table at %x\n" , (uintptr_t )table -> VendorTable );
72+ if (table_addr < 0x100000000 ) {
73+ table_addr = (uintptr_t )table -> VendorTable ;
74+ }
75+ break ;
76+ }
7277 }
7378 }
7479
75- if (found ) {
76- if (table_addr > 0xffffffff ) {
77- printf ("SMBIOS table address too high\n" );
78- return -1 ;
79- }
80+ if (table_addr != 0 ) {
8081 priv .low_stub -> boot_table .SmbiosTable = table_addr ;
8182 return 0 ;
8283 }
8384
84- printf ("No SMBIOS table found\n" );
85+ printf ("No usable SMBIOS table found\n" );
8586
8687 return -1 ;
8788}
0 commit comments