mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH] efi: loader: gop: install device path to make GOP discoverable
Date: Sun,  3 May 2026 10:24:05 +0200	[thread overview]
Message-ID: <20260503082408.2757822-1-a.fatoum@barebox.org> (raw)

The EFI GOP protocol handle was missing a device path, which meant
barebox running as EFI payload couldn't discover it during handle
enumeration. Use efi_install_multiple_protocol_interfaces() to install
both the device path and GOP protocol together.

Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 efi/loader/protocols/gop.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/efi/loader/protocols/gop.c b/efi/loader/protocols/gop.c
index 5bceb3f68f0f..9ada8a2da290 100644
--- a/efi/loader/protocols/gop.c
+++ b/efi/loader/protocols/gop.c
@@ -11,6 +11,7 @@
 #include <efi/guid.h>
 #include <efi/loader.h>
 #include <efi/error.h>
+#include <efi/loader/devicepath.h>
 #include <efi/loader/object.h>
 #include <efi/loader/trace.h>
 #include <efi/protocol/gop.h>
@@ -481,6 +482,8 @@ static char *fbdev = "/dev/fb0";
 static efi_status_t efi_gop_register(void *data)
 {
 	struct efi_gop_obj *gopobj;
+	struct efi_device_path *dp;
+	efi_handle_t handle;
 	u32 col, row;
 	efi_status_t ret;
 	struct fb_info *fbi;
@@ -513,14 +516,20 @@ static efi_status_t efi_gop_register(void *data)
 		return EFI_OUT_OF_RESOURCES;
 	}
 
-	/* Hook up to the device list */
+	dp = efi_dp_from_cdev(&fbi->cdev, true);
+	if (!dp)
+		return EFI_OUT_OF_RESOURCES;
+
 	efi_add_handle(&gopobj->header);
 
-	/* Fill in object data */
-	ret = efi_add_protocol(&gopobj->header, &efi_gop_guid,
-			       &gopobj->ops);
+	handle = &gopobj->header;
+
+	ret = efi_install_multiple_protocol_interfaces(&handle,
+			&efi_device_path_protocol_guid, dp,
+			&efi_gop_guid, &gopobj->ops,
+			NULL);
 	if (ret != EFI_SUCCESS) {
-		pr_err("Failure adding GOP protocol\n");
+		pr_err("Failure installing GOP protocol\n");
 		return ret;
 	}
 	gopobj->ops.query_mode = gop_query_mode;
-- 
2.47.3




             reply	other threads:[~2026-05-03  8:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-03  8:24 Ahmad Fatoum [this message]
2026-05-07 11:20 ` 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=20260503082408.2757822-1-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --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