diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/charset.h | 14 | ||||
-rw-r--r-- | include/efi_default_filename.h | 45 | ||||
-rw-r--r-- | include/efi_loader.h | 4 |
3 files changed, 63 insertions, 0 deletions
diff --git a/include/charset.h b/include/charset.h index 38908e08f0..20abfbe752 100644 --- a/include/charset.h +++ b/include/charset.h @@ -262,6 +262,20 @@ u16 *u16_strcpy(u16 *dest, const u16 *src); u16 *u16_strdup(const void *src); /** + * u16_strlcat() - Append a length-limited, %NUL-terminated string to another + * + * Append the source string @src to the destination string @dest, overwriting + * null word at the end of @dest adding a terminating null word. + * + * @dest: zero terminated u16 destination string + * @src: zero terminated u16 source string + * @count: size of buffer in u16 words including taling 0x0000 + * Return: required size including trailing 0x0000 in u16 words + * If return value >= count, truncation occurred. + */ +size_t u16_strlcat(u16 *dest, const u16 *src, size_t size); + +/** * utf16_to_utf8() - Convert an utf16 string to utf8 * * Converts 'size' characters of the utf16 string 'src' to utf8 diff --git a/include/efi_default_filename.h b/include/efi_default_filename.h new file mode 100644 index 0000000000..13b9de8754 --- /dev/null +++ b/include/efi_default_filename.h @@ -0,0 +1,45 @@ +/* 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> + */ + +#ifndef _EFI_DEFAULT_FILENAME_H +#define _EFI_DEFAULT_FILENAME_H + +#include <host_arch.h> + +#undef BOOTEFI_NAME + +#if HOST_ARCH == HOST_ARCH_X86_64 +#define BOOTEFI_NAME "BOOTX64.EFI" +#endif + +#if HOST_ARCH == HOST_ARCH_X86 +#define BOOTEFI_NAME "BOOTIA32.EFI" +#endif + +#if HOST_ARCH == HOST_ARCH_AARCH64 +#define BOOTEFI_NAME "BOOTAA64.EFI" +#endif + +#if HOST_ARCH == HOST_ARCH_ARM +#define BOOTEFI_NAME "BOOTARM.EFI" +#endif + +#if HOST_ARCH == HOST_ARCH_RISCV32 +#define BOOTEFI_NAME "BOOTRISCV32.EFI" +#endif + +#if HOST_ARCH == HOST_ARCH_RISCV64 +#define BOOTEFI_NAME "BOOTRISCV64.EFI" +#endif + +#ifndef BOOTEFI_NAME +#error Unsupported UEFI architecture +#endif + +#endif diff --git a/include/efi_loader.h b/include/efi_loader.h index ba79a9afb4..effb43369d 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -595,6 +595,10 @@ efi_status_t efi_create_handle(efi_handle_t *handle); void efi_delete_handle(efi_handle_t obj); /* Call this to validate a handle and find the EFI object for it */ struct efi_object *efi_search_obj(const efi_handle_t handle); +/* Locate device_path handle */ +efi_status_t EFIAPI efi_locate_device_path(const efi_guid_t *protocol, + struct efi_device_path **device_path, + efi_handle_t *device); /* Load image */ efi_status_t EFIAPI efi_load_image(bool boot_policy, efi_handle_t parent_image, |