public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb+git@google.com>
To: linux-efi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Ard Biesheuvel <ardb@kernel.org>,
	 Thomas Zimmermann <tzimmermann@suse.de>,
	Javier Martinez Canillas <javierm@redhat.com>
Subject: [PATCH 3/3] efi: Add FIRMWARE_EDID support
Date: Wed, 19 Nov 2025 13:30:15 +0100	[thread overview]
Message-ID: <20251119123011.1187249-8-ardb+git@google.com> (raw)
In-Reply-To: <20251119123011.1187249-5-ardb+git@google.com>

From: Ard Biesheuvel <ardb@kernel.org>

Add support to non-x86 EFI systems for passing the EDID information
discovered by the EFI stub to the kernel proper.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/efi-init.c         | 8 ++++++++
 drivers/firmware/efi/libstub/efi-stub.c | 7 ++++++-
 drivers/firmware/efi/libstub/efistub.h  | 3 ---
 drivers/video/Kconfig                   | 2 +-
 include/linux/efi.h                     | 4 ++++
 5 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c
index 5896f4e699a1..d70bd0ec154f 100644
--- a/drivers/firmware/efi/efi-init.c
+++ b/drivers/firmware/efi/efi-init.c
@@ -64,6 +64,14 @@ struct efi_screen_info efi_screen_info __section(".data");
 
 extern struct screen_info screen_info __alias(efi_screen_info);
 EXPORT_SYMBOL_GPL(screen_info);
+
+#ifdef CONFIG_FIRMWARE_EDID
+const u8 *get_edid_info(void)
+{
+       return efi_screen_info.edid_info.dummy;
+}
+EXPORT_SYMBOL_GPL(get_edid_info);
+#endif
 #endif
 
 static void __init init_screen_info(void)
diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c
index fe77c285a547..20b606d1cbf0 100644
--- a/drivers/firmware/efi/libstub/efi-stub.c
+++ b/drivers/firmware/efi/libstub/efi-stub.c
@@ -54,8 +54,13 @@ void __weak free_screen_info(struct efi_screen_info *si)
 static struct efi_screen_info *setup_graphics(void)
 {
 	struct efi_screen_info *si, tmp = {};
+	struct edid_info *edid_info = NULL;
 
-	if (efi_setup_graphics(&tmp, NULL) != EFI_SUCCESS)
+#ifdef CONFIG_FIRMWARE_EDID
+	edid_info = &tmp.edid_info;
+#endif
+
+	if (efi_setup_graphics(&tmp.screen_info, edid_info) != EFI_SUCCESS)
 		return NULL;
 
 	si = alloc_screen_info();
diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h
index bdeb28d42a1a..93940592e88e 100644
--- a/drivers/firmware/efi/libstub/efistub.h
+++ b/drivers/firmware/efi/libstub/efistub.h
@@ -34,9 +34,6 @@
 #define EFI_ALLOC_LIMIT		ULONG_MAX
 #endif
 
-struct edid_info;
-struct screen_info;
-
 extern bool efi_no5lvl;
 extern bool efi_nochunk;
 extern bool efi_nokaslr;
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index d51777df12d1..6526827fbc55 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -63,7 +63,7 @@ endif # HAS_IOMEM
 
 config FIRMWARE_EDID
 	bool "Enable firmware EDID"
-	depends on X86
+	depends on X86 || EFI_GENERIC_STUB
 	help
 	  This enables access to the EDID transferred from the firmware.
 	  On x86, this is from the VESA BIOS. DRM display drivers will
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 75d05dc1b4ee..8d8228d73585 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -28,6 +28,7 @@
 #include <asm/page.h>
 
 #include <linux/screen_info.h>
+#include <video/edid.h>
 
 #define EFI_SUCCESS		0
 #define EFI_LOAD_ERROR		( 1 | (1UL << (BITS_PER_LONG-1)))
@@ -1363,6 +1364,9 @@ void efivars_generic_ops_unregister(void);
 
 struct efi_screen_info {
 	struct screen_info	screen_info;
+#ifdef CONFIG_FIRMWARE_EDID
+	struct edid_info	edid_info;
+#endif
 };
 
 #endif /* _LINUX_EFI_H */
-- 
2.52.0.rc1.455.g30608eb744-goog


  parent reply	other threads:[~2025-11-19 12:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-19 12:30 [PATCH 0/3] video/efi: Support FIRMWARE_EDID on non-x86 Ard Biesheuvel
2025-11-19 12:30 ` [PATCH 1/3] efi: Wrap screen_info in efi_screen_info so edid_info can be added later Ard Biesheuvel
2025-11-19 12:30 ` [PATCH 2/3] video/edid: Use getter function for edid_info Ard Biesheuvel
2025-11-19 12:30 ` Ard Biesheuvel [this message]
2025-11-20  7:56 ` [PATCH 0/3] video/efi: Support FIRMWARE_EDID on non-x86 Thomas Zimmermann
2025-11-20  8:19   ` Thomas Zimmermann
2025-11-20  8:25     ` Ard Biesheuvel
2025-11-21 14:03       ` Thomas Zimmermann

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=20251119123011.1187249-8-ardb+git@google.com \
    --to=ardb+git@google.com \
    --cc=ardb@kernel.org \
    --cc=javierm@redhat.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tzimmermann@suse.de \
    /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