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
© 2016 - 2025 Red Hat, Inc.