Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions src/csmwrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,41 +68,42 @@ int test_bios_region_rw()

int set_smbios_table()
{
UINTN i;
EFI_GUID smbiosGuid = SMBIOS_TABLE_GUID;
EFI_GUID smbios3Guid = SMBIOS3_TABLE_GUID;
bool found = FALSE;
uintptr_t table_addr = 0;

for (i = 0; i < gST->NumberOfTableEntries; i++) {
EFI_CONFIGURATION_TABLE *table;
table = gST->ConfigurationTable + i;
for (size_t i = 0; i < gST->NumberOfTableEntries; i++) {
EFI_CONFIGURATION_TABLE *table = gST->ConfigurationTable + i;

if (!efi_guidcmp(table->VendorGuid, smbiosGuid)) {
printf("Found SMBIOS Table at %x\n", (uintptr_t)table->VendorTable);
table_addr = (uintptr_t)table->VendorTable;
found = TRUE;
if (table_addr < 0x100000000) {
table_addr = (uintptr_t)table->VendorTable;
}
break;
}
}

if (!efi_guidcmp(table->VendorGuid, smbios3Guid)) {
printf("Found SMBIOS 3.0 Table at %x\n", (uintptr_t)table->VendorTable);
table_addr = (uintptr_t)table->VendorTable;
found = TRUE;
break;
if (table_addr == 0) {
for (size_t i = 0; i < gST->NumberOfTableEntries; i++) {
EFI_CONFIGURATION_TABLE *table = gST->ConfigurationTable + i;

if (!efi_guidcmp(table->VendorGuid, smbios3Guid)) {
printf("Found SMBIOS 3.0 Table at %x\n", (uintptr_t)table->VendorTable);
if (table_addr < 0x100000000) {
table_addr = (uintptr_t)table->VendorTable;
}
break;
}
}
}

if (found) {
if (table_addr > 0xffffffff) {
printf("SMBIOS table address too high\n");
return -1;
}
if (table_addr != 0) {
priv.low_stub->boot_table.SmbiosTable = table_addr;
return 0;
}

printf("No SMBIOS table found\n");
printf("No usable SMBIOS table found\n");

return -1;
}
Expand Down