Changeset View
Changeset View
Standalone View
Standalone View
stand/efi/loader/main.c
Show First 20 Lines • Show All 1,155 Lines • ▼ Show 20 Lines | if (find_currdev(uefi_boot_mgr, is_last, boot_info, bisz) != 0) | ||||
if (uefi_boot_mgr && | if (uefi_boot_mgr && | ||||
!interactive_interrupt("Failed to find bootable partition")) | !interactive_interrupt("Failed to find bootable partition")) | ||||
return (EFI_NOT_FOUND); | return (EFI_NOT_FOUND); | ||||
autoload_font(false); /* Set up the font list for console. */ | autoload_font(false); /* Set up the font list for console. */ | ||||
efi_init_environment(); | efi_init_environment(); | ||||
#if !defined(__arm__) | #if !defined(__arm__) | ||||
int found = 0; | |||||
for (k = 0; k < ST->NumberOfTableEntries; k++) { | for (k = 0; k < ST->NumberOfTableEntries; k++) { | ||||
guid = &ST->ConfigurationTable[k].VendorGuid; | guid = &ST->ConfigurationTable[k].VendorGuid; | ||||
if (!memcmp(guid, &smbios3, sizeof(EFI_GUID))) { | |||||
found = 3; | |||||
break; | |||||
} | |||||
} | |||||
for (k = 0; found == 0 && k < ST->NumberOfTableEntries; k++) { | |||||
guid = &ST->ConfigurationTable[k].VendorGuid; | |||||
if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) { | if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) { | ||||
found = 2; | |||||
break; | |||||
} | |||||
} | |||||
if (found > 0) { | |||||
char buf[40]; | char buf[40]; | ||||
snprintf(buf, sizeof(buf), "%p", | snprintf(buf, sizeof(buf), "%p", | ||||
ST->ConfigurationTable[k].VendorTable); | ST->ConfigurationTable[k].VendorTable); | ||||
if (found == 3) { | |||||
manu: Why is another loop needed ?
Also this drop the guid assignment. | |||||
Done Inline ActionsThe new loop checks &smbios3, and the existing loop checks &smbios (v2). Although it does look like a mistake that it doesn't refresh guid in the 2nd loop. @scottph allanjude: The new loop checks &smbios3, and the existing loop checks &smbios (v2).
Although it does look… | |||||
Done Inline ActionsThe idea is to look through the whole list for smbios3 first, and then look for smbios after that. You're right Allan, the second loop got broken in this patch. scottph: The idea is to look through the whole list for smbios3 first, and then look for smbios after… | |||||
Done Inline ActionsBut we don't need to loop twice. manu: But we don't need to loop twice. | |||||
Done Inline ActionsLooping twice is the easiest way to search for two entries as this code is doing. Alternatively we could set a variable to signal when each is found to only set the variables once. andrew: Looping twice is the easiest way to search for two entries as this code is doing. Alternatively… | |||||
Done Inline ActionsThat's what I'm suggesting, both the snprintf and smbios_detect should only appear once here. manu: That's what I'm suggesting, both the snprintf and smbios_detect should only appear once here. | |||||
Done Inline Actionsthis way it should skip the 2nd loop if it found something in the first loop allanjude: this way it should skip the 2nd loop if it found something in the first loop | |||||
setenv("hint.smbios3.0.mem", buf, 1); | |||||
} else { | |||||
setenv("hint.smbios.0.mem", buf, 1); | setenv("hint.smbios.0.mem", buf, 1); | ||||
smbios_detect(ST->ConfigurationTable[k].VendorTable); | |||||
break; | |||||
} | } | ||||
smbios_detect(ST->ConfigurationTable[k].VendorTable); | |||||
} | } | ||||
#endif | #endif | ||||
interact(); /* doesn't return */ | interact(); /* doesn't return */ | ||||
return (EFI_SUCCESS); /* keep compiler happy */ | return (EFI_SUCCESS); /* keep compiler happy */ | ||||
} | } | ||||
▲ Show 20 Lines • Show All 452 Lines • Show Last 20 Lines |
Why is another loop needed ?
Also this drop the guid assignment.