mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 13/16] efi: guid: move static GUIDs out of drivers
Date: Thu, 11 Dec 2025 21:30:04 +0100	[thread overview]
Message-ID: <20251211203056.2014710-14-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20251211203056.2014710-1-a.fatoum@pengutronix.de>

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@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




  parent reply	other threads:[~2025-12-11 20:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-11 20:29 [PATCH 00/16] efi: restructure for reuse from loader code Ahmad Fatoum
2025-12-11 20:29 ` [PATCH 01/16] efi: payload: restructure Kconfig Ahmad Fatoum
2025-12-11 20:29 ` [PATCH 02/16] efi: payload: populate $global.efi.payload variable Ahmad Fatoum
2025-12-11 20:29 ` [PATCH 03/16] efi: mode: add efi_get_runtime_services helper Ahmad Fatoum
2025-12-11 20:29 ` [PATCH 04/16] efi: payload: make EFI variable helpers usable for loader as well Ahmad Fatoum
2025-12-11 20:29 ` [PATCH 05/16] fs: efivarfs: prepare for use with barebox as EFI loader Ahmad Fatoum
2025-12-11 20:29 ` [PATCH 06/16] efi: handle: build for both EFI payload and loader Ahmad Fatoum
2025-12-11 20:29 ` [PATCH 07/16] efi: provide populate $efi.payload_default_path depending on arch Ahmad Fatoum
2025-12-11 20:29 ` [PATCH 08/16] efi: tidy up header includes for reuse Ahmad Fatoum
2025-12-11 20:30 ` [PATCH 09/16] efi: types: add efi_intn_t/efi_uintn_t definition Ahmad Fatoum
2025-12-11 20:30 ` [PATCH 10/16] efi: devicepath: make fully usable for loader Ahmad Fatoum
2025-12-11 20:30 ` [PATCH 11/16] efi: guid: don't interleave protocol and event GUIDs Ahmad Fatoum
2025-12-11 20:30 ` [PATCH 12/16] efi: guid: add some more GUIDs Ahmad Fatoum
2025-12-15  8:30   ` [PATCH] fixup! " Ahmad Fatoum
2025-12-15  9:03     ` Sascha Hauer
2025-12-11 20:30 ` Ahmad Fatoum [this message]
2025-12-11 20:30 ` [PATCH 14/16] efi: gop: flesh out efi_graphics_output_protocol::blt definition Ahmad Fatoum
2025-12-11 20:30 ` [PATCH 15/16] efi: payload: initrd: move into common efi code Ahmad Fatoum
2025-12-11 20:30 ` [PATCH 16/16] efi: add missing EFIAPI to functions Ahmad Fatoum
2025-12-13 10:42 ` [PATCH] fixup! efi: payload: restructure Kconfig Ahmad Fatoum
2025-12-15  9:03   ` (subset) " Sascha Hauer
2025-12-15  9:03 ` [PATCH 00/16] efi: restructure for reuse from loader code Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251211203056.2014710-14-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox