summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-10-07 18:51:05 +0300
committerTom Rini <trini@konsulko.com>2022-10-07 18:51:05 +0300
commit11ef7f07ce60b60fb78c330b3ae35fd1037e50c1 (patch)
treefbbc12ec51fc3651d5fce002ebf38c76621dac8e /include
parentf5717231abad983b4d8f87db612ae60dec86cb1b (diff)
parenta75e8355eaa561ebd6128c92a90288d5d7c1f060 (diff)
downloadu-boot-11ef7f07ce60b60fb78c330b3ae35fd1037e50c1.tar.xz
Merge tag 'efi-2023-01-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2023-01-rc1 UEFI: * Provide driver binding protocol to registered events for block devices * Code simplification and refactoring * Fix pylint errors in test_efi_secboot Other: * Improve checks for register ranges
Diffstat (limited to 'include')
-rw-r--r--include/efi.h2
-rw-r--r--include/efi_driver.h39
-rw-r--r--include/efi_loader.h17
3 files changed, 38 insertions, 20 deletions
diff --git a/include/efi.h b/include/efi.h
index 6159f34ad2..42f4e58a91 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -37,12 +37,14 @@
#define EFIAPI __attribute__((ms_abi))
#define efi_va_list __builtin_ms_va_list
#define efi_va_start __builtin_ms_va_start
+#define efi_va_copy __builtin_ms_va_copy
#define efi_va_arg __builtin_va_arg
#define efi_va_end __builtin_ms_va_end
#else
#define EFIAPI asmlinkage
#define efi_va_list va_list
#define efi_va_start va_start
+#define efi_va_copy va_copy
#define efi_va_arg va_arg
#define efi_va_end va_end
#endif /* __x86_64__ */
diff --git a/include/efi_driver.h b/include/efi_driver.h
index 2b62219c5b..63a95e4cf8 100644
--- a/include/efi_driver.h
+++ b/include/efi_driver.h
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
- * EFI application loader
+ * Internal structures for the EFI driver binding protocol
*
* Copyright (c) 2017 Heinrich Schuchardt
*/
@@ -10,30 +10,39 @@
#include <efi_loader.h>
-/*
- * Operations supported by an EFI driver with respect to the EFI uclass
+/**
+ * struct efi_driver_binding_extended_protocol - extended driver binding protocol
+ *
+ * This structure adds internal fields to the driver binding protocol.
+ *
+ * @bp: driver binding protocol
+ * @ops: operations supported by the driver
+ */
+struct efi_driver_binding_extended_protocol {
+ struct efi_driver_binding_protocol bp;
+ const struct efi_driver_ops *ops;
+};
+
+/**
+ * struct efi_driver_ops - operations support by an EFI driver
*
- * @protocol The GUID of the protocol which is consumed by the
+ * @protocol: The GUID of the protocol which is consumed by the
* driver. This GUID is used by the EFI uclass in the
* supports() and start() methods of the
* EFI_DRIVER_BINDING_PROTOCOL.
- * @child_protocol Protocol supported by the child handles generated by
+ * @child_protocol: Protocol supported by the child handles generated by
* the EFI driver.
- * @bind Function called by the EFI uclass to attach the
+ * @init: Function called by the EFI uclass after installing the
+ * driver binding protocol.
+ * @bind: Function called by the EFI uclass to attach the
* driver to EFI driver to a handle.
*/
struct efi_driver_ops {
const efi_guid_t *protocol;
const efi_guid_t *child_protocol;
- int (*bind)(efi_handle_t handle, void *interface);
-};
-
-/*
- * This structure adds internal fields to the driver binding protocol.
- */
-struct efi_driver_binding_extended_protocol {
- struct efi_driver_binding_protocol bp;
- const struct efi_driver_ops *ops;
+ efi_status_t (*init)(struct efi_driver_binding_extended_protocol *this);
+ efi_status_t (*bind)(struct efi_driver_binding_extended_protocol *this,
+ efi_handle_t handle, void *interface);
};
#endif /* _EFI_DRIVER_H */
diff --git a/include/efi_loader.h b/include/efi_loader.h
index ad01395b39..69d6d004f4 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -10,6 +10,7 @@
#include <common.h>
#include <blk.h>
+#include <event.h>
#include <log.h>
#include <part_efi.h>
#include <efi_api.h>
@@ -544,8 +545,6 @@ void efi_carve_out_dt_rsv(void *fdt);
void efi_try_purge_kaslr_seed(void *fdt);
/* Called by bootefi to make console interface available */
efi_status_t efi_console_register(void);
-/* Called by efi_init_early() to add block devices when probed */
-efi_status_t efi_disk_init(void);
/* Called by efi_init_obj_list() to proble all block devices */
efi_status_t efi_disks_register(void);
/* Called by efi_init_obj_list() to install EFI_RNG_PROTOCOL */
@@ -655,8 +654,10 @@ efi_status_t efi_remove_protocol(const efi_handle_t handle,
/* Delete all protocols from a handle */
efi_status_t efi_remove_all_protocols(const efi_handle_t handle);
/* Install multiple protocol interfaces */
-efi_status_t EFIAPI efi_install_multiple_protocol_interfaces
- (efi_handle_t *handle, ...);
+efi_status_t EFIAPI
+efi_install_multiple_protocol_interfaces(efi_handle_t *handle, ...);
+efi_status_t EFIAPI
+efi_uninstall_multiple_protocol_interfaces(efi_handle_t handle, ...);
/* Get handles that support a given protocol */
efi_status_t EFIAPI efi_locate_handle_buffer(
enum efi_locate_search_type search_type,
@@ -708,6 +709,7 @@ const char *guid_to_sha_str(const efi_guid_t *guid);
int algo_to_len(const char *algo);
int efi_link_dev(efi_handle_t handle, struct udevice *dev);
+int efi_unlink_dev(efi_handle_t handle);
/**
* efi_size_in_pages() - convert size in bytes to size in pages
@@ -748,6 +750,10 @@ efi_status_t efi_add_conventional_memory_map(u64 ram_start, u64 ram_end,
/* Called by board init to initialize the EFI drivers */
efi_status_t efi_driver_init(void);
+/* Called when a block device is added */
+int efi_disk_probe(void *ctx, struct event *event);
+/* Called when a block device is removed */
+int efi_disk_remove(void *ctx, struct event *event);
/* Called by board init to initialize the EFI memory map */
int efi_memory_init(void);
/* Adds new or overrides configuration table entry to the system table */
@@ -1014,9 +1020,10 @@ struct pkcs7_message *efi_parse_pkcs7_header(const void *buf,
/* runtime implementation of memcpy() */
void efi_memcpy_runtime(void *dest, const void *src, size_t n);
-/* commonly used helper function */
+/* commonly used helper functions */
u16 *efi_create_indexed_name(u16 *buffer, size_t buffer_size, const char *name,
unsigned int index);
+efi_string_t efi_convert_string(const char *str);
extern const struct efi_firmware_management_protocol efi_fmp_fit;
extern const struct efi_firmware_management_protocol efi_fmp_raw;