[Concept,09/14] efi: Add the component-name2 protocol to efidebug dh

Message ID 20250820144621.1073679-10-sjg@u-boot.org
State New
Headers
Series efi: app: Support booting an OS |

Commit Message

Simon Glass Aug. 20, 2025, 2:46 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Add the GUID and API for this protocol so that we can use it in the
'efidebug dh' command.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 include/efi.h         |  1 +
 include/efi_api.h     | 15 +++++++++++++++
 lib/efi/device_path.c |  1 +
 lib/uuid.c            |  1 +
 4 files changed, 18 insertions(+)
  

Patch

diff --git a/include/efi.h b/include/efi.h
index 60afb18784d..5e15a87ed3b 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -156,6 +156,7 @@  extern const efi_guid_t efi_global_variable_guid;
 extern const efi_guid_t efi_guid_fdt;
 /* GUID of the EFI_DRIVER_BINDING_PROTOCOL */
 extern const efi_guid_t efi_guid_driver_binding_protocol;
+extern const efi_guid_t efi_guid_component_name2;
 
 /* Generic EFI table header */
 struct efi_table_hdr {
diff --git a/include/efi_api.h b/include/efi_api.h
index dfc13588213..876c1ac2bbe 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -483,6 +483,10 @@  struct efi_runtime_services {
 	EFI_GUID(0xd719b2cb, 0x3d3a, 0x4596, \
 		 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f)
 
+#define EFI_COMPONENT_NAME2_PROTOCOL_GUID \
+	EFI_GUID(0x6a7a5cff, 0xe8d9, 0x4f70, \
+		 0xba, 0xda, 0x75, 0xab, 0x30, 0x25, 0xce, 0x14)
+
 /**
  * struct efi_configuration_table - EFI Configuration Table
  *
@@ -2426,4 +2430,15 @@  struct efi_disk {
 					  void *buffer);
 };
 
+struct efi_component_name2_protocol {
+	efi_status_t (EFIAPI *get_driver_name)
+		(struct efi_component_name2_protocol *this,
+		 char *language, u16 **driver_name);
+	efi_status_t (EFIAPI *get_controller_name)
+		(struct efi_component_name2_protocol *this,
+		 efi_handle_t controller_handle, efi_handle_t child_handle,
+		 char *language, u16 **controller_name);
+	char *supported_langs;
+};
+
 #endif
diff --git a/lib/efi/device_path.c b/lib/efi/device_path.c
index 3fd5c75aeee..0b2eb7561b1 100644
--- a/lib/efi/device_path.c
+++ b/lib/efi/device_path.c
@@ -37,6 +37,7 @@  const efi_guid_t efi_guid_fdt = EFI_FDT_GUID;
 /* GUID of the EFI_DRIVER_BINDING_PROTOCOL */
 const efi_guid_t efi_guid_driver_binding_protocol =
 			EFI_DRIVER_BINDING_PROTOCOL_GUID;
+const efi_guid_t efi_guid_component_name2 = EFI_COMPONENT_NAME2_PROTOCOL_GUID;
 
 /* template EFI_DP_END node: */
 const struct efi_device_path EFI_DP_END = {
diff --git a/lib/uuid.c b/lib/uuid.c
index b5f486182f4..3f7885d0877 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -279,6 +279,7 @@  static const struct {
 	{ "Debug Image Info", EFI_DEBUG_IMAGE_INFO_TABLE },
 	{ "Memory Attribute", EFI_ACPI_MCFG_TABLE_GUID },
 	{ "Random-number-generator Algorithms", EFI_RNG_ALGORITHM_GUID },
+	{ "Component-name2 Protocol", EFI_COMPONENT_NAME2_PROTOCOL_GUID },
 #endif
 #endif /* !USE_HOSTCC */
 };