summaryrefslogtreecommitdiff
path: root/include/efi_api.h
AgeCommit message (Collapse)Author
2025-11-06efi: Use struct efi_gop_mode_info in struct efi_entry_gopmodeHeinrich Schuchardt
Since C99 flexible array members are allowed at the end of structures. We require C11. Use struct efi_gop_mode_info in the definition of struct efi_entry_gopmode to avoid code duplication and unnecessary conversions. Reviewed-by: Bin Meng <[email protected]> Signed-off-by: Heinrich Schuchardt <[email protected]>
2025-07-03efi: add EFI_DEBUG_IMAGE_INFO for debugYing-Chun Liu (PaulLiu)
This commit adds the functionality of generate EFI_DEBUG_IMAGE_INFO while loading the image. This feature is described in UEFI Spec 2.10. Section 18.4.3. The implementation ensures support for hardware-assisted debugging and provides a standardized mechanism for debuggers to discover the load address of an EFI application. Cc: Ilias Apalodimas <[email protected]> Cc: Peter Robinson <[email protected]> Cc: Simon Glass <[email protected]> Signed-off-by: Ying-Chun Liu (PaulLiu) <[email protected]> Tested-by: Heinrich Schuchardt <[email protected]> Acked-by: Ilias Apalodimas <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
2025-07-03efi: add EFI_DEBUG_IMAGE_INFO_TABLE for debugYing-Chun Liu (PaulLiu)
EFI_DEBUG_IMAGE_INFO_TABLE is used to store EFI_LOADED_IMAGE for debug purpose. This commit adds the table to the EFI_CONFIGURATION_TABLE. This feature is described in UEFI Spec version 2.10. Section 18.4. The implementation ensures support for hardware-assisted debugging and provides a standardized mechanism for debuggers to discover and interact with system-level debug resources. Cc: Heinrich Schuchardt <[email protected]> Cc: Peter Robinson <[email protected]> Cc: Simon Glass <[email protected]> Signed-off-by: Ying-Chun Liu (PaulLiu) <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
2025-07-03efi: add EFI_SYSTEM_TABLE_POINTER for debugYing-Chun Liu (PaulLiu)
Add EFI_SYSTEM_TABLE_POINTER structure for remote debugger to locate the address of EFI_SYSTEM_TABLE. This feature is described in UEFI SPEC version 2.10. Section 18.4.2. The implementation ensures support for hardware-assisted debugging and provides a standardized mechanism for debuggers to discover the EFI system table. Cc: Peter Robinson <[email protected]> Cc: Simon Glass <[email protected]> Signed-off-by: Ying-Chun Liu (PaulLiu) <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Tested-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]> # change memset(systab_pointer, 0 ...) -> systab_pointer->crc32 = 0; Signed-off-by: Ilias Apalodimas <[email protected]>
2025-01-05efi: Correct ECPT table GUIDYang Gang
Refer to UEFI specification 2.10: #define EFI_CONFORMANCE_PROFILES_TABLE_GUID \ { 0x36122546, 0xf7e7, 0x4c8f, \ { 0xbd, 0x9b, 0xeb, 0x85, 0x25, 0xb5, 0x0c, 0x0b }} Signed-off-by: Yang Gang <[email protected]> Fixes: 6b92c1735205 ("efi: Create ECPT table") Reviewed-by: Heinrich Schuchardt <[email protected]>
2025-01-05efi_loader: update EFI specification versionHeinrich Schuchardt
UEFI specification 2.11 has been published. There are no changes relevant for the U-Boot scope. So let us update the supported specification version. Change the comment for the constant to Sphinx style. Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Heinrich Schuchardt <[email protected]>
2024-12-04efi_api: add definitions for HTTP and IP4_CONFIG2 protocolsAdriano Cordova
Add EFI definitions for EFI_IP4_CONFIG2_PROTOCOL, EFI_HTTP_SERVICE_BINDING_PROTOCOL, and EFI_HTTP_PROTOCOL. According to UEFI spec 2.10. Signed-off-by: Adriano Cordova <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Acked-by: Ilias Apalodimas <[email protected]>
2024-12-04efi_loader: device_path: add definition of DEVICE_PATH_SUB_TYPE_MSG_IPV4Adriano Cordova
Add definition for DEVICE_PATH_SUB_TYPE_MSG_IPV4 device path subtype. Signed-off-by: Adriano Cordova <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2024-07-29include: Remove duplicate newlinesMarek Vasut
Drop all duplicate newlines. No functional change. Signed-off-by: Marek Vasut <[email protected]>
2024-01-07efi: Use the correct GUID for the SMBIOS tableSimon Glass
EFI does not use the 'anchor string' to determine the SMBIOS table version, instead preferring to have two separate GUIDs. Use the correct one, depending on the table version. Call unmap_system() to balance to the use of map_sysmem() Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2023-11-18efi_loader: add return to efibootmgr event groupMasahisa Kojima
When the image loaded by efibootmgr returns, efibootmgr needs to clean the resources. Adding the event of returning to efibootmgr is useful to simplify the implementation. Signed-off-by: Masahisa Kojima <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
2023-11-18efi_loader: add missing const classifier for event serviceMasahisa Kojima
const classifier is missing in EventGroup parameter of CreateEventEx(). Fix it to remove the compiler warning. NotifyContext parameter of CreateEventEx() is also defined with const in UEFI specification, but NotifyContext parameter of CreateEvent() is defined without const. Since current implementation calls the common efi_create_event() function from both CreateEventEx() and CreateEvent() services, NotifyContext parameter leaves as is. Signed-off-by: Masahisa Kojima <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]>
2023-07-20efi_loader: support all uclasses in device pathHeinrich Schuchardt
On devices with multiple USB mass storage devices errors like Path /../USB(0x0,0x0)/USB(0x1,0x0)/Ctrl(0x0) already installed. are seen. This is due to creating non-unique device paths. To uniquely identify devices we must provide path nodes for all devices on the path from the root device. Add support for generating device path nodes for all uclasses. Reported-by: Suniel Mahesh <[email protected]> Signed-off-by: Heinrich Schuchardt <[email protected]>
2023-05-13efi_loader: Fix warnings for unaligned accessesIlias Apalodimas
Tom reports that when building with clang we see this warning: field guid within 'struct efi_hii_keyboard_layout' is less aligned than 'efi_guid_t' and is usually due to 'struct efi_hii_keyboard_layout' being packed, which can lead to unaligned accesses [-Wunaligned-access] This happens because 'struct efi_hii_keyboard_layout' is defined as packed and thus has 1-byte alignment but efi_guid_t is a type that requires greater alignment than that. However the EFI spec describes the EFI_GUID as "128-bit buffer containing a unique identifier value. Unless otherwise specified" So convert the efi_guid_t -> u8 b[16] here and skip the alignment requirements. Since the struct is packed to begin with, it makes no difference on the final memory layout. Suggested-by: Heinrich Schuchardt <[email protected]> Reported-by: Tom Rini <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2023-04-21efi_loader: Fix flexible array member definitionsIlias Apalodimas
When a structure contains a flexible array member, it is not supposed to be included in arrays or other structs. Quoting the C spec [0] "Such a structure (and any union containing, possibly recursively, a member that is such a structure) shall not be a member of a structure or an element of an array." IOW efi_hii_keyboard_layout should not include struct efi_key_descriptor descriptors[]; since we use it at the declaration of struct efi_hii_keyboard_package. [0] https://www.dii.uchile.cl/~daespino/files/Iso_C_1999_definition.pdf chapter 6.7.2.1 Signed-off-by: Ilias Apalodimas <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2023-04-03Merge branch 'next'Tom Rini
Signed-off-by: Tom Rini <[email protected]>
2023-04-01efi_loader: correct shortening of device-pathsHeinrich Schuchardt
We use short device-paths in boot options so that a file on a block device can be found independent of the port into which the device is plugged. Usb() device-path nodes only contain port and interface information and therefore cannot identify a block device. UsbWwi() device-path nodes contain the serial number of USB devices. Signed-off-by: Heinrich Schuchardt <[email protected]>
2023-03-25efi: Add another tranch of GUIDsSimon Glass
Provide information about the GUIDs supplied by QEMU, so far as it is known. These values are used in the 'efi table' command as well as the printf format string %sU Signed-off-by: Simon Glass <[email protected]>
2023-03-25efi_loader: move struct efi_device_path to efi.hHeinrich Schuchardt
Avoid forward declaration of struct efi_device_path. Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2023-03-25efi_loader: support for Ctrl() device path nodeHeinrich Schuchardt
* Add the definitions for Ctrl() device path nodes. * Implement Ctrl() nodes in the device path to text protocol. Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2023-03-25efi_loader: support for Ctrl() device path nodeHeinrich Schuchardt
* Add the definitions for Ctrl() device path nodes. * Implement Ctrl() nodes in the device path to text protocol. Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2023-02-10efi_loader: add definition for efi_main()Heinrich Schuchardt
U-Boot provides multiple EFI applications. The entry point is called efi_main(). Provide a definition for this function. This avoids build warnings like lib/efi_loader/initrddump.c:468:21: warning: no previous prototype for ‘efi_main’ [-Wmissing-prototypes] 468 | efi_status_t EFIAPI efi_main(efi_handle_t image_handle, | ^~~~~~~~ Signed-off-by: Heinrich Schuchardt <[email protected]>
2023-02-10efi_loader: fix struct efi_input_keyHeinrich Schuchardt
The UEFI specification defines filed UnicodeChar as CHAR16. We use u16 for CHAR16 throughout our code. The change fixes the following errors: lib/efi_loader/initrddump.c: In function ‘efi_input’: lib/efi_loader/initrddump.c:218:38: warning: comparison is always false due to limited range of data type [-Wtype-limits] 218 | if (key.unicode_char >= 0xD800 && key.unicode_char <= 0xDBFF) | ^~ lib/efi_loader/initrddump.c:218:68: warning: comparison is always true due to limited range of data type [-Wtype-limits] 218 | if (key.unicode_char >= 0xD800 && key.unicode_char <= 0xDBFF) | ^~ Fixes: 867a6ac86dd8 ("efi: Add start-up library code") Reported-by: Marek Vasut <[email protected]> Signed-off-by: Heinrich Schuchardt <[email protected]>
2022-12-29efi_loader: set UEFI specification version to 2.10Heinrich Schuchardt
Claim to implement UEFI 2.10 setting EFI_SPECIFICATION_VERSION accordingly. Signed-off-by: Heinrich Schuchardt <[email protected]> Reviewed-by: Ilias Apalodimas <[email protected]>
2022-12-17efi: adjust ebbr to v2.1 in conformance profileVincent Stehlé
The EFI Conformance Profile Table entry for EBBR appears in v2.1.0 of the EBBR specification[1]. Update naming accordingly. While at it, update the EBBR version referenced in the documentation. [1]: https://github.com/ARM-software/ebbr/releases/tag/v2.1.0 Signed-off-by: Vincent Stehlé <[email protected]> Cc: Heinrich Schuchardt <[email protected]> Cc: Ilias Apalodimas <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2022-09-03efi: ECPT add EBBRv2.0 conformance profileJose Marinho
Display the EBBRv2.0 conformance in the ECPT table. The EBBRv2.0 conformance profile is set in the ECPT if CONFIG_EFI_EBBR_2_0_CONFORMANCE=y. Signed-off-by: Jose Marinho <[email protected]> Add dependencies for CONFIG_EFI_EBBR_2_0_CONFORMANCE. Enable the setting by default. Reviewed-by: Heinrich Schuchardt <[email protected]>
2022-09-03efi: Create ECPT tableJose Marinho
The ECPT table will be included in the UEFI specification 2.9+. The ECPT table was introduced in UEFI following the code-first path. The acceptance ticket can be viewed at: https://bugzilla.tianocore.org/show_bug.cgi?id=3591 The Conformance Profiles table is a UEFI configuration table that contains GUID of the UEFI profiles that the UEFI implementation conforms with. The ECPT table is created when CONFIG_EFI_ECPT=y. The config is set by default. Signed-off-by: Jose Marinho <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2022-05-07efi_loader: add sha384/512 on certificate revocationIlias Apalodimas
Currently we don't support sha384/512 for the X.509 certificate in dbx. Moreover if we come across such a hash we skip the check and approve the image, although the image might needs to be rejected. Rework the code a bit and fix it by adding an array of structs with the supported GUIDs, len and literal used in the U-Boot crypto APIs instead of hardcoding the GUID types. It's worth noting here that efi_hash_regions() can now be reused from efi_signature_lookup_digest() and add sha348/512 support there as well Signed-off-by: Ilias Apalodimas <[email protected]>
2022-04-15FMP: Remove GUIDs for FIT and raw imagesSughosh Ganu
The capsule update code has been modified for getting the image GUID values from the platform code. With this, each image now has a unique GUID value. With this change, there is no longer a need for defining GUIDs for FIT and raw images. Remove these GUID values. Signed-off-by: Sughosh Ganu <[email protected]>
2022-01-29efi_loader: correctly handle mixed hashes and signatures in dbIlias Apalodimas
A mix of signatures and hashes in db doesn't always work as intended. Currently if the digest algorithm is not explicitly set to sha256 we stop walking the security database and reject the image. That's problematic in case we find and try to check a signature before inspecting the sha256 hash. If the image is unsigned we will reject it even if the digest matches. Since we no longer reject the image on unknown algorithms add an explicit check and reject the image if any other hash algorithm apart from sha256 is detected on dbx. Suggested-by: Heinrich Schuchardt <[email protected]> Signed-off-by: Ilias Apalodimas <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2022-01-29efi_loader: Enable RISCV_EFI_BOOT_PROTOCOL supportSunil V L
This adds support for new RISCV_EFI_BOOT_PROTOCOL to communicate the boot hart ID to bootloader/kernel on RISC-V UEFI platforms. The specification of the protocol is hosted at: https://github.com/riscv-non-isa/riscv-uefi Signed-off-by: Sunil V L <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2022-01-19efi_loader: printing TCG2 protocol GUIDHeinrich Schuchardt
We support the TCG2 protocol. Allow command efidebug to print it. Signed-off-by: Heinrich Schuchardt <[email protected]>
2022-01-19cmd: efidebug: simplify printing GUIDsHeinrich Schuchardt
Use "%pS" to print text representations of GUIDs. Signed-off-by: Heinrich Schuchardt <[email protected]>
2021-12-31efi: Locate all block devices in the appSimon Glass
When starting the app, locate all block devices and make them available to U-Boot. This allows listing partitions and accessing files in filesystems. EFI also has the concept of 'disks', meaning boot media. For now, this is not obviously useful in U-Boot, but add code to at least locate these. This can be expanded later as needed. We cannot use printf() in the early stub or app since it is not compiled in Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2021-11-20efi_loader: bump EFI_SPECIFICATION_VERSION to 2.9Heinrich Schuchardt
We have implemented all what is new in UEFI specification 2.9 and relevant for U-Boot. Signed-off-by: Heinrich Schuchardt <[email protected]>
2021-11-20efi_loader: EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICESHeinrich Schuchardt
Implement the EFI_EVENT_GROUP_BEFORE_EXIT_BOOT_SERVICES event group handling. Add the definition of EFI_EVENT_GROUP_AFTER_READY_TO_BOOT. Signed-off-by: Heinrich Schuchardt <[email protected]>
2021-11-20efi_loader: Sphinx comments in efi_api.hHeinrich Schuchardt
Fix incorrect Sphinx comments in efi_api.h: * add missing 'struct' * correct indentation Signed-off-by: Heinrich Schuchardt <[email protected]>
2021-11-20efi: add comment for efi_system_table and efi_configuration_tableMasahisa Kojima
This commit adds the comment for efi_system_table and efi_configuration_table structure. Signed-off-by: Masahisa Kojima <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2021-10-25efi_loader: add missing const qualifierMasahisa Kojima
This commit fixes the following compilation warning of boottime->install_configuration_table() function. lib/efi_selftest/efi_selftest_tcg2.c:475:46: warning: passing argument 1 of ‘boottime->install_configuration_table’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] ret = boottime->install_configuration_table(&smbios_guid, dmi); Signed-off-by: Masahisa Kojima <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2021-08-17efi_loader rename enum efi_mem_type to efi_memory_typeHeinrich Schuchardt
Use the same name as in the UEFI specification to avoid confusion. Signed-off-by: Heinrich Schuchardt <[email protected]>
2021-08-14efi_loader: Uri() device path nodeHeinrich Schuchardt
iPXE used Uri() device path nodes. So we should support them in the device path to text protocol. Signed-off-by: Heinrich Schuchardt <[email protected]>
2021-07-24efi_loader: remove asm/setjmp.h from efi_api.hAKASHI Takahiro
In the commit c982874e930d ("efi_loader: refactor efi_setup_loaded_image()"), setjmp-related definitions were moved to efi_loaded_image_obj in efi_loader.h. So setjmp.h is no longer refererenced in efi_api.h. This also fixes some error when efi_api.h will be included in mkeficapsule.c. Fixes: c982874e930d ("efi_loader: refactor efi_setup_loaded_image()") Signed-off-by: AKASHI Takahiro <[email protected]> Reviewed-by: Heinrich Schuchardt <[email protected]>
2021-03-25efi: Add ESRT to the EFI system tableJose Marinho
The ESRT is initialised during efi_init_objlist after efi_initialize_system_table(). The ESRT is recreated from scratch at the following events: - successful UpdateCapsule; - FMP instance install. The code ensures that every ESRT entry has a unique fw_class value. Limitations: - The ESRT is not updated if an FMP instance is uninstalled; - the fields image_type and flags are in the current implementation left undefined. Setting these values will require a per-platform function that returns the image_type/flags as a function of the image fw_class. CC: Heinrich Schuchardt <[email protected]> CC: Sughosh Ganu <[email protected]> CC: AKASHI Takahiro <[email protected]> CC: Ilias Apalodimas <[email protected]> CC: Andre Przywara <[email protected]> CC: Alexander Graf <[email protected]> CC: [email protected] Signed-off-by: Jose Marinho <[email protected]> Remove two EFI_CALL() indirections. Move ESRT GUID in efidebug's list of GUIDs. Reviewed-by: Heinrich Schuchardt <[email protected]>
2021-03-25efi_loader: Uart device pathHeinrich Schuchardt
When uploading an EFI binary via the UART we need to assign a device path. * Provide devicepath node to text conversion for Uart() node. * Provide function to create Uart() device path. * Add UART support to efi_dp_from_name(). Signed-off-by: Heinrich Schuchardt <[email protected]>
2021-01-20efi_loader: remove EFI_UNICODE_COLLATION_PROTOCOLHeinrich Schuchardt
In EFI 1.10 a version of the Unicode collation protocol using ISO 639-2 language codes existed. This protocol is not part of the UEFI specification any longer. It was however required to run the UEFI Self Certification Test (SCT) II, version 2.6, 2017. So we implemented it for the sole purpose of running the SCT. As the SCT does not need the protocol anymore it is time for removal. Signed-off-by: Heinrich Schuchardt <[email protected]>
2021-01-13efi_loader: typedef efi_string_t text output protocolHeinrich Schuchardt
We do not want to use typedefs in U-Boot. Do not use efi_string_t in the EFI_TEXT_OUTPUT_PROTOCOL. Signed-off-by: Heinrich Schuchardt <[email protected]>
2021-01-13efi_loader: move efi_(u)intn_t to efi.hHeinrich Schuchardt
Move efi_intn_t and efi_uintn_t to include/efi.h to allow usage without efi_api.h Signed-off-by: Heinrich Schuchardt <[email protected]>
2021-01-13efi_loader: implement non-blocking file servicesHeinrich Schuchardt
Implement services OpenEx(), ReadEx(), WriteEx(), FlushEx() of the EFI_FILE_PROTOCOL. Signed-off-by: Heinrich Schuchardt <[email protected]>
2020-12-31efi: capsule: Add support for uefi capsule authenticationSughosh Ganu
Add support for authenticating uefi capsules. Most of the signature verification functionality is shared with the uefi secure boot feature. The root certificate containing the public key used for the signature verification is stored as part of the device tree blob. The root certificate is stored as an efi signature list(esl) file -- this file contains the x509 certificate which is the root certificate. Signed-off-by: Sughosh Ganu <[email protected]>
2020-12-03efi_loader: add firmware management protocol for raw imageAKASHI Takahiro
In this commit, a very simple firmware management protocol driver is implemented. It will take a binary image in a capsule file and apply the data using dfu backend storage drivers via dfu_write_by_alt() interface. So "dfu_alt_info" variable should be properly set to specify a device and location to be updated. Please read README.dfu. Signed-off-by: AKASHI Takahiro <[email protected]>