efi: Merge EFI system table revision and vendor checks
We have three different versions of the code that checks the EFI system table revision and copies the firmware vendor string, and they are mostly equivalent, with the exception of the use of early_memremap_ro vs. __va() and the lowest major revision to warn about. Let's move this into common code and factor out the commonalities. Tested-by: Tony Luck <tony.luck@intel.com> # arch/ia64 Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
@@ -479,10 +479,8 @@ void __init
|
||||
efi_init (void)
|
||||
{
|
||||
void *efi_map_start, *efi_map_end;
|
||||
efi_char16_t *c16;
|
||||
u64 efi_desc_size;
|
||||
char *cp, vendor[100] = "unknown";
|
||||
int i;
|
||||
char *cp;
|
||||
|
||||
set_bit(EFI_BOOT, &efi.flags);
|
||||
set_bit(EFI_64BIT, &efi.flags);
|
||||
@@ -519,25 +517,10 @@ efi_init (void)
|
||||
*/
|
||||
if (efi.systab == NULL)
|
||||
panic("Whoa! Can't find EFI system table.\n");
|
||||
if (efi.systab->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
|
||||
if (efi_systab_check_header(&efi.systab->hdr, 1))
|
||||
panic("Whoa! EFI system table signature incorrect\n");
|
||||
if ((efi.systab->hdr.revision >> 16) == 0)
|
||||
printk(KERN_WARNING "Warning: EFI system table version "
|
||||
"%d.%02d, expected 1.00 or greater\n",
|
||||
efi.systab->hdr.revision >> 16,
|
||||
efi.systab->hdr.revision & 0xffff);
|
||||
|
||||
/* Show what we know for posterity */
|
||||
c16 = __va(efi.systab->fw_vendor);
|
||||
if (c16) {
|
||||
for (i = 0;i < (int) sizeof(vendor) - 1 && *c16; ++i)
|
||||
vendor[i] = *c16++;
|
||||
vendor[i] = '\0';
|
||||
}
|
||||
|
||||
printk(KERN_INFO "EFI v%u.%.02u by %s:",
|
||||
efi.systab->hdr.revision >> 16,
|
||||
efi.systab->hdr.revision & 0xffff, vendor);
|
||||
efi_systab_report_header(&efi.systab->hdr, efi.systab->fw_vendor);
|
||||
|
||||
palo_phys = EFI_INVALID_TABLE_ADDR;
|
||||
|
||||
|
Reference in New Issue
Block a user