efi/libstub: Drop sys_table_arg from printk routines
As a first step towards getting rid of the need to pass around a function parameter 'sys_table_arg' pointing to the EFI system table, remove the references to it in the printing code, which is represents the majority of the use cases. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Cc: Arvind Sankar <nivedita@alum.mit.edu> Cc: Borislav Petkov <bp@alien8.de> Cc: James Morse <james.morse@arm.com> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Link: https://lkml.kernel.org/r/20191224151025.32482-19-ardb@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
committed by
Ingo Molnar
parent
c3710de506
commit
8173ec7905
@@ -57,7 +57,7 @@ preserve_pci_rom_image(efi_pci_io_protocol_t *pci, struct pci_setup_rom **__rom)
|
|||||||
status = efi_call_early(allocate_pool, EFI_LOADER_DATA, size,
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA, size,
|
||||||
(void **)&rom);
|
(void **)&rom);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to allocate memory for 'rom'\n");
|
efi_printk("Failed to allocate memory for 'rom'\n");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ preserve_pci_rom_image(efi_pci_io_protocol_t *pci, struct pci_setup_rom **__rom)
|
|||||||
&rom->vendor);
|
&rom->vendor);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to read rom->vendor\n");
|
efi_printk("Failed to read rom->vendor\n");
|
||||||
goto free_struct;
|
goto free_struct;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ preserve_pci_rom_image(efi_pci_io_protocol_t *pci, struct pci_setup_rom **__rom)
|
|||||||
&rom->devid);
|
&rom->devid);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to read rom->devid\n");
|
efi_printk("Failed to read rom->devid\n");
|
||||||
goto free_struct;
|
goto free_struct;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ static void setup_efi_pci(struct boot_params *params)
|
|||||||
size, (void **)&pci_handle);
|
size, (void **)&pci_handle);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to allocate memory for 'pci_handle'\n");
|
efi_printk("Failed to allocate memory for 'pci_handle'\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ static void retrieve_apple_device_properties(struct boot_params *boot_params)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (efi_table_attr(apple_properties_protocol, version, p) != 0x10000) {
|
if (efi_table_attr(apple_properties_protocol, version, p) != 0x10000) {
|
||||||
efi_printk(sys_table, "Unsupported properties proto version\n");
|
efi_printk("Unsupported properties proto version\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ static void retrieve_apple_device_properties(struct boot_params *boot_params)
|
|||||||
size + sizeof(struct setup_data),
|
size + sizeof(struct setup_data),
|
||||||
(void **)&new);
|
(void **)&new);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to allocate memory for 'properties'\n");
|
efi_printk("Failed to allocate memory for 'properties'\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,14 +386,14 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
|
|||||||
status = efi_call_early(handle_protocol, handle,
|
status = efi_call_early(handle_protocol, handle,
|
||||||
&proto, (void *)&image);
|
&proto, (void *)&image);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to get handle for LOADED_IMAGE_PROTOCOL\n");
|
efi_printk("Failed to get handle for LOADED_IMAGE_PROTOCOL\n");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = efi_low_alloc(sys_table, 0x4000, 1,
|
status = efi_low_alloc(sys_table, 0x4000, 1,
|
||||||
(unsigned long *)&boot_params);
|
(unsigned long *)&boot_params);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to allocate lowmem for boot params\n");
|
efi_printk("Failed to allocate lowmem for boot params\n");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +441,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
|
|||||||
|
|
||||||
if (status != EFI_SUCCESS &&
|
if (status != EFI_SUCCESS &&
|
||||||
hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G) {
|
hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G) {
|
||||||
efi_printk(sys_table, "Trying to load files to higher address\n");
|
efi_printk("Trying to load files to higher address\n");
|
||||||
status = handle_cmdline_files(sys_table, image,
|
status = handle_cmdline_files(sys_table, image,
|
||||||
(char *)(unsigned long)hdr->cmd_line_ptr,
|
(char *)(unsigned long)hdr->cmd_line_ptr,
|
||||||
"initrd=", -1UL,
|
"initrd=", -1UL,
|
||||||
@@ -773,7 +773,7 @@ struct boot_params *efi_main(efi_handle_t handle,
|
|||||||
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
||||||
sizeof(*gdt), (void **)&gdt);
|
sizeof(*gdt), (void **)&gdt);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to allocate memory for 'gdt' structure\n");
|
efi_printk("Failed to allocate memory for 'gdt' structure\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -781,7 +781,7 @@ struct boot_params *efi_main(efi_handle_t handle,
|
|||||||
status = efi_low_alloc(sys_table, gdt->size, 8,
|
status = efi_low_alloc(sys_table, gdt->size, 8,
|
||||||
(unsigned long *)&gdt->address);
|
(unsigned long *)&gdt->address);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "Failed to allocate memory for 'gdt'\n");
|
efi_printk("Failed to allocate memory for 'gdt'\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -797,7 +797,7 @@ struct boot_params *efi_main(efi_handle_t handle,
|
|||||||
hdr->kernel_alignment,
|
hdr->kernel_alignment,
|
||||||
LOAD_PHYSICAL_ADDR);
|
LOAD_PHYSICAL_ADDR);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "efi_relocate_kernel() failed!\n");
|
efi_printk("efi_relocate_kernel() failed!\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -807,7 +807,7 @@ struct boot_params *efi_main(efi_handle_t handle,
|
|||||||
|
|
||||||
status = exit_boot(boot_params, handle);
|
status = exit_boot(boot_params, handle);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table, "exit_boot() failed!\n");
|
efi_printk("exit_boot() failed!\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -900,7 +900,7 @@ struct boot_params *efi_main(efi_handle_t handle,
|
|||||||
|
|
||||||
return boot_params;
|
return boot_params;
|
||||||
fail:
|
fail:
|
||||||
efi_printk(sys_table, "efi_main() failed!\n");
|
efi_printk("efi_main() failed!\n");
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
asm("hlt");
|
asm("hlt");
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ void install_memreserve_table(efi_system_table_t *sys_table_arg)
|
|||||||
status = efi_call_early(allocate_pool, EFI_LOADER_DATA, sizeof(*rsv),
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA, sizeof(*rsv),
|
||||||
(void **)&rsv);
|
(void **)&rsv);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table_arg, "Failed to allocate memreserve entry!\n");
|
pr_efi_err("Failed to allocate memreserve entry!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ void install_memreserve_table(efi_system_table_t *sys_table_arg)
|
|||||||
&memreserve_table_guid,
|
&memreserve_table_guid,
|
||||||
rsv);
|
rsv);
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
pr_efi_err(sys_table_arg, "Failed to install memreserve config table!\n");
|
pr_efi_err("Failed to install memreserve config table!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -147,13 +147,13 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table_arg,
|
|||||||
status = sys_table->boottime->handle_protocol(handle,
|
status = sys_table->boottime->handle_protocol(handle,
|
||||||
&loaded_image_proto, (void *)&image);
|
&loaded_image_proto, (void *)&image);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table, "Failed to get loaded image protocol\n");
|
pr_efi_err("Failed to get loaded image protocol\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
dram_base = get_dram_base(sys_table);
|
dram_base = get_dram_base(sys_table);
|
||||||
if (dram_base == EFI_ERROR) {
|
if (dram_base == EFI_ERROR) {
|
||||||
pr_efi_err(sys_table, "Failed to find DRAM base\n");
|
pr_efi_err("Failed to find DRAM base\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table_arg,
|
|||||||
*/
|
*/
|
||||||
cmdline_ptr = efi_convert_cmdline(sys_table, image, &cmdline_size);
|
cmdline_ptr = efi_convert_cmdline(sys_table, image, &cmdline_size);
|
||||||
if (!cmdline_ptr) {
|
if (!cmdline_ptr) {
|
||||||
pr_efi_err(sys_table, "getting command line via LOADED_IMAGE_PROTOCOL\n");
|
pr_efi_err("getting command line via LOADED_IMAGE_PROTOCOL\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table_arg,
|
|||||||
if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && cmdline_size > 0)
|
if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && cmdline_size > 0)
|
||||||
efi_parse_options(cmdline_ptr);
|
efi_parse_options(cmdline_ptr);
|
||||||
|
|
||||||
pr_efi(sys_table, "Booting Linux Kernel...\n");
|
pr_efi("Booting Linux Kernel...\n");
|
||||||
|
|
||||||
si = setup_graphics(sys_table);
|
si = setup_graphics(sys_table);
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table_arg,
|
|||||||
&reserve_size,
|
&reserve_size,
|
||||||
dram_base, image);
|
dram_base, image);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table, "Failed to relocate kernel\n");
|
pr_efi_err("Failed to relocate kernel\n");
|
||||||
goto fail_free_cmdline;
|
goto fail_free_cmdline;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,29 +204,29 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table_arg,
|
|||||||
if (!IS_ENABLED(CONFIG_EFI_ARMSTUB_DTB_LOADER) ||
|
if (!IS_ENABLED(CONFIG_EFI_ARMSTUB_DTB_LOADER) ||
|
||||||
secure_boot != efi_secureboot_mode_disabled) {
|
secure_boot != efi_secureboot_mode_disabled) {
|
||||||
if (strstr(cmdline_ptr, "dtb="))
|
if (strstr(cmdline_ptr, "dtb="))
|
||||||
pr_efi(sys_table, "Ignoring DTB from command line.\n");
|
pr_efi("Ignoring DTB from command line.\n");
|
||||||
} else {
|
} else {
|
||||||
status = handle_cmdline_files(sys_table, image, cmdline_ptr,
|
status = handle_cmdline_files(sys_table, image, cmdline_ptr,
|
||||||
"dtb=",
|
"dtb=",
|
||||||
~0UL, &fdt_addr, &fdt_size);
|
~0UL, &fdt_addr, &fdt_size);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table, "Failed to load device tree!\n");
|
pr_efi_err("Failed to load device tree!\n");
|
||||||
goto fail_free_image;
|
goto fail_free_image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fdt_addr) {
|
if (fdt_addr) {
|
||||||
pr_efi(sys_table, "Using DTB from command line\n");
|
pr_efi("Using DTB from command line\n");
|
||||||
} else {
|
} else {
|
||||||
/* Look for a device tree configuration table entry. */
|
/* Look for a device tree configuration table entry. */
|
||||||
fdt_addr = (uintptr_t)get_fdt(sys_table, &fdt_size);
|
fdt_addr = (uintptr_t)get_fdt(sys_table, &fdt_size);
|
||||||
if (fdt_addr)
|
if (fdt_addr)
|
||||||
pr_efi(sys_table, "Using DTB from configuration table\n");
|
pr_efi("Using DTB from configuration table\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fdt_addr)
|
if (!fdt_addr)
|
||||||
pr_efi(sys_table, "Generating empty DTB\n");
|
pr_efi("Generating empty DTB\n");
|
||||||
|
|
||||||
status = handle_cmdline_files(sys_table, image, cmdline_ptr, "initrd=",
|
status = handle_cmdline_files(sys_table, image, cmdline_ptr, "initrd=",
|
||||||
efi_get_max_initrd_addr(dram_base,
|
efi_get_max_initrd_addr(dram_base,
|
||||||
@@ -234,7 +234,7 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table_arg,
|
|||||||
(unsigned long *)&initrd_addr,
|
(unsigned long *)&initrd_addr,
|
||||||
(unsigned long *)&initrd_size);
|
(unsigned long *)&initrd_size);
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
pr_efi_err(sys_table, "Failed initrd from command line!\n");
|
pr_efi_err("Failed initrd from command line!\n");
|
||||||
|
|
||||||
efi_random_get_seed(sys_table);
|
efi_random_get_seed(sys_table);
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table_arg,
|
|||||||
if (status == EFI_SUCCESS)
|
if (status == EFI_SUCCESS)
|
||||||
return new_fdt_addr;
|
return new_fdt_addr;
|
||||||
|
|
||||||
pr_efi_err(sys_table, "Failed to update FDT and exit boot services\n");
|
pr_efi_err("Failed to update FDT and exit boot services\n");
|
||||||
|
|
||||||
efi_free(sys_table, initrd_size, initrd_addr);
|
efi_free(sys_table, initrd_size, initrd_addr);
|
||||||
efi_free(sys_table, fdt_size, fdt_addr);
|
efi_free(sys_table, fdt_size, fdt_addr);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ efi_status_t check_platform_features(efi_system_table_t *sys_table_arg)
|
|||||||
/* LPAE kernels need compatible hardware */
|
/* LPAE kernels need compatible hardware */
|
||||||
block = cpuid_feature_extract(CPUID_EXT_MMFR0, 0);
|
block = cpuid_feature_extract(CPUID_EXT_MMFR0, 0);
|
||||||
if (block < 5) {
|
if (block < 5) {
|
||||||
pr_efi_err(sys_table_arg, "This LPAE kernel is not supported by your CPU\n");
|
pr_efi_err("This LPAE kernel is not supported by your CPU\n");
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@@ -121,8 +121,7 @@ static efi_status_t reserve_kernel_base(efi_system_table_t *sys_table_arg,
|
|||||||
*/
|
*/
|
||||||
status = efi_get_memory_map(sys_table_arg, &map);
|
status = efi_get_memory_map(sys_table_arg, &map);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table_arg,
|
pr_efi_err("reserve_kernel_base(): Unable to retrieve memory map.\n");
|
||||||
"reserve_kernel_base(): Unable to retrieve memory map.\n");
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,8 +163,7 @@ static efi_status_t reserve_kernel_base(efi_system_table_t *sys_table_arg,
|
|||||||
(end - start) / EFI_PAGE_SIZE,
|
(end - start) / EFI_PAGE_SIZE,
|
||||||
&start);
|
&start);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table_arg,
|
pr_efi_err("reserve_kernel_base(): alloc failed.\n");
|
||||||
"reserve_kernel_base(): alloc failed.\n");
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -224,7 +222,7 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table,
|
|||||||
status = reserve_kernel_base(sys_table, kernel_base, reserve_addr,
|
status = reserve_kernel_base(sys_table, kernel_base, reserve_addr,
|
||||||
reserve_size);
|
reserve_size);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table, "Unable to allocate memory for uncompressed kernel.\n");
|
pr_efi_err("Unable to allocate memory for uncompressed kernel.\n");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,7 +235,7 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table,
|
|||||||
*image_size,
|
*image_size,
|
||||||
kernel_base + MAX_UNCOMP_KERNEL_SIZE, 0, 0);
|
kernel_base + MAX_UNCOMP_KERNEL_SIZE, 0, 0);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table, "Failed to relocate kernel.\n");
|
pr_efi_err("Failed to relocate kernel.\n");
|
||||||
efi_free(sys_table, *reserve_size, *reserve_addr);
|
efi_free(sys_table, *reserve_size, *reserve_addr);
|
||||||
*reserve_size = 0;
|
*reserve_size = 0;
|
||||||
return status;
|
return status;
|
||||||
@@ -249,7 +247,7 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table,
|
|||||||
* address at which the zImage is loaded.
|
* address at which the zImage is loaded.
|
||||||
*/
|
*/
|
||||||
if (*image_addr + *image_size > dram_base + ZIMAGE_OFFSET_LIMIT) {
|
if (*image_addr + *image_size > dram_base + ZIMAGE_OFFSET_LIMIT) {
|
||||||
pr_efi_err(sys_table, "Failed to relocate kernel, no low memory available.\n");
|
pr_efi_err("Failed to relocate kernel, no low memory available.\n");
|
||||||
efi_free(sys_table, *reserve_size, *reserve_addr);
|
efi_free(sys_table, *reserve_size, *reserve_addr);
|
||||||
*reserve_size = 0;
|
*reserve_size = 0;
|
||||||
efi_free(sys_table, *image_size, *image_addr);
|
efi_free(sys_table, *image_size, *image_addr);
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ efi_status_t check_platform_features(efi_system_table_t *sys_table_arg)
|
|||||||
tg = (read_cpuid(ID_AA64MMFR0_EL1) >> ID_AA64MMFR0_TGRAN_SHIFT) & 0xf;
|
tg = (read_cpuid(ID_AA64MMFR0_EL1) >> ID_AA64MMFR0_TGRAN_SHIFT) & 0xf;
|
||||||
if (tg != ID_AA64MMFR0_TGRAN_SUPPORTED) {
|
if (tg != ID_AA64MMFR0_TGRAN_SUPPORTED) {
|
||||||
if (IS_ENABLED(CONFIG_ARM64_64K_PAGES))
|
if (IS_ENABLED(CONFIG_ARM64_64K_PAGES))
|
||||||
pr_efi_err(sys_table_arg, "This 64 KB granular kernel is not supported by your CPU\n");
|
pr_efi_err("This 64 KB granular kernel is not supported by your CPU\n");
|
||||||
else
|
else
|
||||||
pr_efi_err(sys_table_arg, "This 16 KB granular kernel is not supported by your CPU\n");
|
pr_efi_err("This 16 KB granular kernel is not supported by your CPU\n");
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@@ -60,13 +60,13 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table_arg,
|
|||||||
sizeof(phys_seed),
|
sizeof(phys_seed),
|
||||||
(u8 *)&phys_seed);
|
(u8 *)&phys_seed);
|
||||||
if (status == EFI_NOT_FOUND) {
|
if (status == EFI_NOT_FOUND) {
|
||||||
pr_efi(sys_table_arg, "EFI_RNG_PROTOCOL unavailable, no randomness supplied\n");
|
pr_efi("EFI_RNG_PROTOCOL unavailable, no randomness supplied\n");
|
||||||
} else if (status != EFI_SUCCESS) {
|
} else if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table_arg, "efi_get_random_bytes() failed\n");
|
pr_efi_err("efi_get_random_bytes() failed\n");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pr_efi(sys_table_arg, "KASLR disabled on kernel command line\n");
|
pr_efi("KASLR disabled on kernel command line\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ efi_status_t handle_kernel_image(efi_system_table_t *sys_table_arg,
|
|||||||
MIN_KIMG_ALIGN, reserve_addr);
|
MIN_KIMG_ALIGN, reserve_addr);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table_arg, "Failed to relocate kernel\n");
|
pr_efi_err("Failed to relocate kernel\n");
|
||||||
*reserve_size = 0;
|
*reserve_size = 0;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ struct file_info {
|
|||||||
u64 size;
|
u64 size;
|
||||||
};
|
};
|
||||||
|
|
||||||
void efi_printk(efi_system_table_t *sys_table_arg, char *str)
|
void efi_printk(char *str)
|
||||||
{
|
{
|
||||||
char *s8;
|
char *s8;
|
||||||
|
|
||||||
@@ -68,10 +68,10 @@ void efi_printk(efi_system_table_t *sys_table_arg, char *str)
|
|||||||
ch[0] = *s8;
|
ch[0] = *s8;
|
||||||
if (*s8 == '\n') {
|
if (*s8 == '\n') {
|
||||||
efi_char16_t nl[2] = { '\r', 0 };
|
efi_char16_t nl[2] = { '\r', 0 };
|
||||||
efi_char16_printk(sys_table_arg, nl);
|
efi_char16_printk(nl);
|
||||||
}
|
}
|
||||||
|
|
||||||
efi_char16_printk(sys_table_arg, ch);
|
efi_char16_printk(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,9 +372,9 @@ static efi_status_t efi_file_size(efi_system_table_t *sys_table_arg, void *__fh,
|
|||||||
|
|
||||||
status = fh->open(fh, &h, filename_16, EFI_FILE_MODE_READ, 0);
|
status = fh->open(fh, &h, filename_16, EFI_FILE_MODE_READ, 0);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table_arg, "Failed to open file: ");
|
efi_printk("Failed to open file: ");
|
||||||
efi_char16_printk(sys_table_arg, filename_16);
|
efi_char16_printk(filename_16);
|
||||||
efi_printk(sys_table_arg, "\n");
|
efi_printk("\n");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -383,7 +383,7 @@ static efi_status_t efi_file_size(efi_system_table_t *sys_table_arg, void *__fh,
|
|||||||
info_sz = 0;
|
info_sz = 0;
|
||||||
status = h->get_info(h, &info_guid, &info_sz, NULL);
|
status = h->get_info(h, &info_guid, &info_sz, NULL);
|
||||||
if (status != EFI_BUFFER_TOO_SMALL) {
|
if (status != EFI_BUFFER_TOO_SMALL) {
|
||||||
efi_printk(sys_table_arg, "Failed to get file info size\n");
|
efi_printk("Failed to get file info size\n");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,7 +391,7 @@ grow:
|
|||||||
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
||||||
info_sz, (void **)&info);
|
info_sz, (void **)&info);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table_arg, "Failed to alloc mem for file info\n");
|
efi_printk("Failed to alloc mem for file info\n");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -405,7 +405,7 @@ grow:
|
|||||||
efi_call_early(free_pool, info);
|
efi_call_early(free_pool, info);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
efi_printk(sys_table_arg, "Failed to get initrd info\n");
|
efi_printk("Failed to get initrd info\n");
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -434,13 +434,13 @@ static efi_status_t efi_open_volume(efi_system_table_t *sys_table_arg,
|
|||||||
status = efi_call_early(handle_protocol, handle,
|
status = efi_call_early(handle_protocol, handle,
|
||||||
&fs_proto, (void **)&io);
|
&fs_proto, (void **)&io);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table_arg, "Failed to handle fs_proto\n");
|
efi_printk("Failed to handle fs_proto\n");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = io->open_volume(io, &fh);
|
status = io->open_volume(io, &fh);
|
||||||
if (status != EFI_SUCCESS)
|
if (status != EFI_SUCCESS)
|
||||||
efi_printk(sys_table_arg, "Failed to open volume\n");
|
efi_printk("Failed to open volume\n");
|
||||||
else
|
else
|
||||||
*__fh = fh;
|
*__fh = fh;
|
||||||
|
|
||||||
@@ -569,7 +569,7 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
|
|||||||
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
|
||||||
nr_files * sizeof(*files), (void **)&files);
|
nr_files * sizeof(*files), (void **)&files);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table_arg, "Failed to alloc mem for file handle list\n");
|
pr_efi_err("Failed to alloc mem for file handle list\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,13 +632,13 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
|
|||||||
status = efi_high_alloc(sys_table_arg, file_size_total, 0x1000,
|
status = efi_high_alloc(sys_table_arg, file_size_total, 0x1000,
|
||||||
&file_addr, max_addr);
|
&file_addr, max_addr);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table_arg, "Failed to alloc highmem for files\n");
|
pr_efi_err("Failed to alloc highmem for files\n");
|
||||||
goto close_handles;
|
goto close_handles;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We've run out of free low memory. */
|
/* We've run out of free low memory. */
|
||||||
if (file_addr > max_addr) {
|
if (file_addr > max_addr) {
|
||||||
pr_efi_err(sys_table_arg, "We've run out of free low memory\n");
|
pr_efi_err("We've run out of free low memory\n");
|
||||||
status = EFI_INVALID_PARAMETER;
|
status = EFI_INVALID_PARAMETER;
|
||||||
goto free_file_total;
|
goto free_file_total;
|
||||||
}
|
}
|
||||||
@@ -660,7 +660,7 @@ efi_status_t handle_cmdline_files(efi_system_table_t *sys_table_arg,
|
|||||||
&chunksize,
|
&chunksize,
|
||||||
(void *)addr);
|
(void *)addr);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table_arg, "Failed to read file\n");
|
pr_efi_err("Failed to read file\n");
|
||||||
goto free_file_total;
|
goto free_file_total;
|
||||||
}
|
}
|
||||||
addr += chunksize;
|
addr += chunksize;
|
||||||
@@ -746,7 +746,7 @@ efi_status_t efi_relocate_kernel(efi_system_table_t *sys_table_arg,
|
|||||||
alignment, &new_addr, min_addr);
|
alignment, &new_addr, min_addr);
|
||||||
}
|
}
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table_arg, "Failed to allocate usable memory for kernel.\n");
|
pr_efi_err("Failed to allocate usable memory for kernel.\n");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -956,7 +956,7 @@ void *get_efi_config_table(efi_system_table_t *sys_table, efi_guid_t guid)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str)
|
void efi_char16_printk(efi_char16_t *str)
|
||||||
{
|
{
|
||||||
efi_call_proto(efi_simple_text_output_protocol,
|
efi_call_proto(efi_simple_text_output_protocol,
|
||||||
output_string,
|
output_string,
|
||||||
|
|||||||
@@ -31,13 +31,14 @@ extern int __pure novamap(void);
|
|||||||
|
|
||||||
extern __pure efi_system_table_t *efi_system_table(void);
|
extern __pure efi_system_table_t *efi_system_table(void);
|
||||||
|
|
||||||
#define pr_efi(sys_table, msg) do { \
|
#define pr_efi(msg) do { \
|
||||||
if (!is_quiet()) efi_printk(sys_table, "EFI stub: "msg); \
|
if (!is_quiet()) efi_printk("EFI stub: "msg); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define pr_efi_err(sys_table, msg) efi_printk(sys_table, "EFI stub: ERROR: "msg)
|
#define pr_efi_err(msg) efi_printk("EFI stub: ERROR: "msg)
|
||||||
|
|
||||||
void efi_char16_printk(efi_system_table_t *, efi_char16_t *);
|
void efi_char16_printk(efi_char16_t *);
|
||||||
|
void efi_char16_printk(efi_char16_t *);
|
||||||
|
|
||||||
unsigned long get_dram_base(efi_system_table_t *sys_table_arg);
|
unsigned long get_dram_base(efi_system_table_t *sys_table_arg);
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt,
|
|||||||
/* Do some checks on provided FDT, if it exists: */
|
/* Do some checks on provided FDT, if it exists: */
|
||||||
if (orig_fdt) {
|
if (orig_fdt) {
|
||||||
if (fdt_check_header(orig_fdt)) {
|
if (fdt_check_header(orig_fdt)) {
|
||||||
pr_efi_err(sys_table, "Device Tree header not valid!\n");
|
pr_efi_err("Device Tree header not valid!\n");
|
||||||
return EFI_LOAD_ERROR;
|
return EFI_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -48,7 +48,7 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt,
|
|||||||
* configuration table:
|
* configuration table:
|
||||||
*/
|
*/
|
||||||
if (orig_fdt_size && fdt_totalsize(orig_fdt) > orig_fdt_size) {
|
if (orig_fdt_size && fdt_totalsize(orig_fdt) > orig_fdt_size) {
|
||||||
pr_efi_err(sys_table, "Truncated device tree! foo!\n");
|
pr_efi_err("Truncated device tree! foo!\n");
|
||||||
return EFI_LOAD_ERROR;
|
return EFI_LOAD_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -277,17 +277,17 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table,
|
|||||||
*/
|
*/
|
||||||
status = efi_get_memory_map(sys_table, &map);
|
status = efi_get_memory_map(sys_table, &map);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table, "Unable to retrieve UEFI memory map.\n");
|
pr_efi_err("Unable to retrieve UEFI memory map.\n");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_efi(sys_table, "Exiting boot services and installing virtual address map...\n");
|
pr_efi("Exiting boot services and installing virtual address map...\n");
|
||||||
|
|
||||||
map.map = &memory_map;
|
map.map = &memory_map;
|
||||||
status = efi_high_alloc(sys_table, MAX_FDT_SIZE, EFI_FDT_ALIGN,
|
status = efi_high_alloc(sys_table, MAX_FDT_SIZE, EFI_FDT_ALIGN,
|
||||||
new_fdt_addr, max_addr);
|
new_fdt_addr, max_addr);
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table, "Unable to allocate memory for new device tree.\n");
|
pr_efi_err("Unable to allocate memory for new device tree.\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,7 +304,7 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table,
|
|||||||
initrd_addr, initrd_size);
|
initrd_addr, initrd_size);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
pr_efi_err(sys_table, "Unable to construct new device tree.\n");
|
pr_efi_err("Unable to construct new device tree.\n");
|
||||||
goto fail_free_new_fdt;
|
goto fail_free_new_fdt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -350,7 +350,7 @@ efi_status_t allocate_new_fdt_and_exit_boot(efi_system_table_t *sys_table,
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_efi_err(sys_table, "Exit boot services failed.\n");
|
pr_efi_err("Exit boot services failed.\n");
|
||||||
|
|
||||||
fail_free_new_fdt:
|
fail_free_new_fdt:
|
||||||
efi_free(sys_table, MAX_FDT_SIZE, *new_fdt_addr);
|
efi_free(sys_table, MAX_FDT_SIZE, *new_fdt_addr);
|
||||||
@@ -371,7 +371,7 @@ void *get_fdt(efi_system_table_t *sys_table, unsigned long *fdt_size)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (fdt_check_header(fdt) != 0) {
|
if (fdt_check_header(fdt) != 0) {
|
||||||
pr_efi_err(sys_table, "Invalid header detected on UEFI supplied FDT, ignoring ...\n");
|
pr_efi_err("Invalid header detected on UEFI supplied FDT, ignoring ...\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
*fdt_size = fdt_totalsize(fdt);
|
*fdt_size = fdt_totalsize(fdt);
|
||||||
|
|||||||
@@ -72,10 +72,10 @@ enum efi_secureboot_mode efi_get_secureboot(efi_system_table_t *sys_table_arg)
|
|||||||
return efi_secureboot_mode_disabled;
|
return efi_secureboot_mode_disabled;
|
||||||
|
|
||||||
secure_boot_enabled:
|
secure_boot_enabled:
|
||||||
pr_efi(sys_table_arg, "UEFI Secure Boot is enabled.\n");
|
pr_efi("UEFI Secure Boot is enabled.\n");
|
||||||
return efi_secureboot_mode_enabled;
|
return efi_secureboot_mode_enabled;
|
||||||
|
|
||||||
out_efi_err:
|
out_efi_err:
|
||||||
pr_efi_err(sys_table_arg, "Could not determine UEFI Secure Boot status.\n");
|
pr_efi_err("Could not determine UEFI Secure Boot status.\n");
|
||||||
return efi_secureboot_mode_unknown;
|
return efi_secureboot_mode_unknown;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,8 +131,7 @@ void efi_retrieve_tpm2_eventlog(efi_system_table_t *sys_table_arg)
|
|||||||
(void **) &log_tbl);
|
(void **) &log_tbl);
|
||||||
|
|
||||||
if (status != EFI_SUCCESS) {
|
if (status != EFI_SUCCESS) {
|
||||||
efi_printk(sys_table_arg,
|
efi_printk("Unable to allocate memory for event log\n");
|
||||||
"Unable to allocate memory for event log\n");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1493,7 +1493,7 @@ static inline int efi_runtime_map_copy(void *buf, size_t bufsz)
|
|||||||
|
|
||||||
/* prototypes shared between arch specific and generic stub code */
|
/* prototypes shared between arch specific and generic stub code */
|
||||||
|
|
||||||
void efi_printk(efi_system_table_t *sys_table_arg, char *str);
|
void efi_printk(char *str);
|
||||||
|
|
||||||
void efi_free(efi_system_table_t *sys_table_arg, unsigned long size,
|
void efi_free(efi_system_table_t *sys_table_arg, unsigned long size,
|
||||||
unsigned long addr);
|
unsigned long addr);
|
||||||
|
|||||||
Reference in New Issue
Block a user