efi: Move default filename to a function

Use a function to obtain the device EFI filename, so that we can control
how sandbox behaves.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2024-11-07 14:31:43 -07:00
committed by Heinrich Schuchardt
parent efe9bd4a08
commit 9fd623afed
6 changed files with 67 additions and 64 deletions

View File

@@ -669,4 +669,13 @@ int efi_get_mmap(struct efi_mem_desc **descp, int *sizep, uint *keyp,
*/
void efi_show_tables(struct efi_system_table *systab);
/**
* efi_get_basename() - Get the default filename to use when loading
*
* E.g. this function returns BOOTAA64.EFI for an aarch target
*
* Return: Default EFI filename
*/
const char *efi_get_basename(void);
#endif /* _LINUX_EFI_H */

View File

@@ -1,56 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* When a boot option does not provide a file path the EFI file to be
* booted is \EFI\BOOT\$(BOOTEFI_NAME).EFI. The architecture specific
* file name is defined in this include.
*
* Copyright (c) 2022, Heinrich Schuchardt <xypron.glpk@gmx.de>
* Copyright (c) 2022, Linaro Limited
*/
#ifndef _EFI_DEFAULT_FILENAME_H
#define _EFI_DEFAULT_FILENAME_H
#include <host_arch.h>
#undef BOOTEFI_NAME
#ifdef CONFIG_SANDBOX
#if HOST_ARCH == HOST_ARCH_X86_64
#define BOOTEFI_NAME "BOOTX64.EFI"
#elif HOST_ARCH == HOST_ARCH_X86
#define BOOTEFI_NAME "BOOTIA32.EFI"
#elif HOST_ARCH == HOST_ARCH_AARCH64
#define BOOTEFI_NAME "BOOTAA64.EFI"
#elif HOST_ARCH == HOST_ARCH_ARM
#define BOOTEFI_NAME "BOOTARM.EFI"
#elif HOST_ARCH == HOST_ARCH_RISCV32
#define BOOTEFI_NAME "BOOTRISCV32.EFI"
#elif HOST_ARCH == HOST_ARCH_RISCV64
#define BOOTEFI_NAME "BOOTRISCV64.EFI"
#else
#error Unsupported UEFI architecture
#endif
#else
#if defined(CONFIG_ARM64)
#define BOOTEFI_NAME "BOOTAA64.EFI"
#elif defined(CONFIG_ARM)
#define BOOTEFI_NAME "BOOTARM.EFI"
#elif defined(CONFIG_X86_64)
#define BOOTEFI_NAME "BOOTX64.EFI"
#elif defined(CONFIG_X86)
#define BOOTEFI_NAME "BOOTIA32.EFI"
#elif defined(CONFIG_ARCH_RV32I)
#define BOOTEFI_NAME "BOOTRISCV32.EFI"
#elif defined(CONFIG_ARCH_RV64I)
#define BOOTEFI_NAME "BOOTRISCV64.EFI"
#else
#error Unsupported UEFI architecture
#endif
#endif
#endif