[PATCH 13/16] efi: guid: move static GUIDs out of drivers
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu Dec 11 12:30:04 PST 2025
The GUIDs for SNP, STDIO and GOP drivers are compiled statically into
the drivers using them. The same GUIDs will be used for barebox acting
as EFI loader as well, so move them to the common efi/guid.c to allow
reuse.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/net/efi-snp.c | 6 ++----
drivers/serial/efi-stdio.c | 3 +--
drivers/video/efi_gop.c | 3 +--
efi/guid.c | 3 +++
include/efi/guid.h | 3 +++
5 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/net/efi-snp.c b/drivers/net/efi-snp.c
index 5dffe3793426..3927ebbb8be9 100644
--- a/drivers/net/efi-snp.c
+++ b/drivers/net/efi-snp.c
@@ -75,8 +75,6 @@ static void efi_snp_eth_rx(struct eth_device *edev)
net_receive(edev, priv->rx_buf, bufsize);
}
-static efi_guid_t snp_guid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
-
static int efi_snp_open_exclusive(struct efi_device *efidev)
{
void *interface;
@@ -86,7 +84,7 @@ static int efi_snp_open_exclusive(struct efi_device *efidev)
* Try to re-open SNP exlusively to close any active MNP protocol instance
* that may compete for packet polling
*/
- efiret = BS->open_protocol(efidev->handle, &snp_guid,
+ efiret = BS->open_protocol(efidev->handle, &efi_snp_guid,
&interface, efi_parent_image, NULL, EFI_OPEN_PROTOCOL_EXCLUSIVE);
if (EFI_ERROR(efiret)) {
dev_err(&efidev->dev, "failed to open exclusively: %s\n", efi_strerror(efiret));
@@ -98,7 +96,7 @@ static int efi_snp_open_exclusive(struct efi_device *efidev)
static void efi_snp_close_exclusive(struct efi_device *efidev)
{
- BS->close_protocol(efidev->handle, &snp_guid, efi_parent_image, NULL);
+ BS->close_protocol(efidev->handle, &efi_snp_guid, efi_parent_image, NULL);
}
static int efi_snp_eth_open(struct eth_device *edev)
diff --git a/drivers/serial/efi-stdio.c b/drivers/serial/efi-stdio.c
index 3390600be389..cbeda6f3bb8b 100644
--- a/drivers/serial/efi-stdio.c
+++ b/drivers/serial/efi-stdio.c
@@ -423,7 +423,6 @@ static void efi_set_mode(struct efi_console_priv *priv)
static int efi_console_probe(struct device *dev)
{
- efi_guid_t inex_guid = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID;
struct efi_simple_text_input_ex_protocol *inex;
struct console_device *cdev;
struct efi_console_priv *priv;
@@ -440,7 +439,7 @@ static int efi_console_probe(struct device *dev)
return -ENOMEM;
efiret = BS->open_protocol(efi_sys_table->con_in_handle,
- &inex_guid,
+ &efi_text_input_ex_guid,
(void **)&inex,
efi_parent_image,
0,
diff --git a/drivers/video/efi_gop.c b/drivers/video/efi_gop.c
index 00ebd2fcbd55..aff1e45b28a2 100644
--- a/drivers/video/efi_gop.c
+++ b/drivers/video/efi_gop.c
@@ -163,10 +163,9 @@ static int efi_gop_probe(struct efi_device *efidev)
struct efi_gop_priv *priv;
int ret = 0;
efi_status_t efiret;
- efi_guid_t got_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
void *protocol;
- efiret = BS->handle_protocol(efidev->handle, &got_guid, &protocol);
+ efiret = BS->handle_protocol(efidev->handle, &efi_gop_guid, &protocol);
if (EFI_ERROR(efiret))
return -efi_errno(efiret);
diff --git a/efi/guid.c b/efi/guid.c
index 8d4618df5730..8b29ba52fbe6 100644
--- a/efi/guid.c
+++ b/efi/guid.c
@@ -45,6 +45,9 @@ const efi_guid_t shim_lock_guid = SHIM_LOCK_GUID;
const efi_guid_t efi_rt_properties_table_guid = EFI_RT_PROPERTIES_TABLE_GUID;
const efi_guid_t efi_guid_firmware_management_protocol = EFI_FIRMWARE_MANAGEMENT_PROTOCOL_GUID;
const efi_guid_t efi_debug_image_info_table_guid = EFI_DEBUG_IMAGE_INFO_TABLE_GUID;
+const efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
+const efi_guid_t efi_snp_guid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
+const efi_guid_t efi_text_input_ex_guid = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID;
const efi_guid_t efi_text_input_guid = EFI_SIMPLE_TEXT_IN_PROTOCOL_GUID;
const efi_guid_t efi_text_output_guid = EFI_SIMPLE_TEXT_OUT_PROTOCOL_GUID;
diff --git a/include/efi/guid.h b/include/efi/guid.h
index 44fbe9f428ae..c36faaf72350 100644
--- a/include/efi/guid.h
+++ b/include/efi/guid.h
@@ -41,6 +41,9 @@ extern const efi_guid_t efi_load_file2_protocol_guid;
extern const efi_guid_t efi_device_path_utilities_protocol_guid;
extern const efi_guid_t efi_linux_initrd_media_guid;
extern const efi_guid_t efi_smbios_guid;
+extern const efi_guid_t efi_gop_guid;
+extern const efi_guid_t efi_snp_guid;
+extern const efi_guid_t efi_text_input_ex_guid;
extern const efi_guid_t efi_text_input_guid;
extern const efi_guid_t efi_text_output_guid;
extern const efi_guid_t efi_guid_unicode_collation_protocol2;
--
2.47.3
More information about the barebox
mailing list