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 1/3] efi: Wrap screen_info in efi_screen_info so edid_info can be added later
Date: Wed, 19 Nov 2025 13:30:13 +0100 [thread overview]
Message-ID: <20251119123011.1187249-6-ardb+git@google.com> (raw)
In-Reply-To: <20251119123011.1187249-5-ardb+git@google.com>
From: Ard Biesheuvel <ardb@kernel.org>
Prepare for adding support to the EFI stub to pass edid_info discovered
using EFI boot services to the kernel proper via a EFI configuration
table. Instead of passing struct screen_info directly, define a new
struct efi_screen_info that encapsulates it. struct edid_info will be
added there later.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
drivers/firmware/efi/earlycon.c | 1 -
drivers/firmware/efi/efi-init.c | 11 ++++++-----
drivers/firmware/efi/libstub/efi-stub-entry.c | 3 +--
drivers/firmware/efi/libstub/efi-stub.c | 9 ++++-----
drivers/firmware/efi/libstub/efistub.h | 6 +++---
drivers/firmware/efi/libstub/gop.c | 1 -
drivers/firmware/efi/libstub/screen_info.c | 7 +++----
drivers/firmware/efi/libstub/zboot.c | 2 +-
drivers/firmware/efi/sysfb_efi.c | 1 -
include/linux/efi.h | 6 +++++-
10 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/drivers/firmware/efi/earlycon.c b/drivers/firmware/efi/earlycon.c
index d18a1a5de144..23fb23867b56 100644
--- a/drivers/firmware/efi/earlycon.c
+++ b/drivers/firmware/efi/earlycon.c
@@ -9,7 +9,6 @@
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/serial_core.h>
-#include <linux/screen_info.h>
#include <linux/string.h>
#include <asm/early_ioremap.h>
diff --git a/drivers/firmware/efi/efi-init.c b/drivers/firmware/efi/efi-init.c
index a65c2d5b9e7b..5896f4e699a1 100644
--- a/drivers/firmware/efi/efi-init.c
+++ b/drivers/firmware/efi/efi-init.c
@@ -19,7 +19,6 @@
#include <linux/of_address.h>
#include <linux/of_fdt.h>
#include <linux/platform_device.h>
-#include <linux/screen_info.h>
#include <asm/efi.h>
@@ -61,13 +60,15 @@ extern __weak const efi_config_table_type_t efi_arch_tables[];
* everything else can get it from here.
*/
#if !defined(CONFIG_X86) && (defined(CONFIG_SYSFB) || defined(CONFIG_EFI_EARLYCON))
-struct screen_info screen_info __section(".data");
+struct efi_screen_info efi_screen_info __section(".data");
+
+extern struct screen_info screen_info __alias(efi_screen_info);
EXPORT_SYMBOL_GPL(screen_info);
#endif
static void __init init_screen_info(void)
{
- struct screen_info *si;
+ struct efi_screen_info *si;
if (screen_info_table != EFI_INVALID_TABLE_ADDR) {
si = early_memremap(screen_info_table, sizeof(*si));
@@ -75,8 +76,8 @@ static void __init init_screen_info(void)
pr_err("Could not map screen_info config table\n");
return;
}
- screen_info = *si;
- memset(si, 0, sizeof(*si));
+ efi_screen_info = *si;
+ si->screen_info = (struct screen_info){};
early_memunmap(si, sizeof(*si));
if (memblock_is_map_memory(screen_info.lfb_base))
diff --git a/drivers/firmware/efi/libstub/efi-stub-entry.c b/drivers/firmware/efi/libstub/efi-stub-entry.c
index a6c049835190..520f5ea31cfd 100644
--- a/drivers/firmware/efi/libstub/efi-stub-entry.c
+++ b/drivers/firmware/efi/libstub/efi-stub-entry.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/efi.h>
-#include <linux/screen_info.h>
#include <asm/efi.h>
@@ -9,7 +8,7 @@
static unsigned long screen_info_offset;
-struct screen_info *alloc_screen_info(void)
+struct efi_screen_info *alloc_screen_info(void)
{
if (IS_ENABLED(CONFIG_ARM))
return __alloc_screen_info();
diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c
index 9cb814c5ba1b..fe77c285a547 100644
--- a/drivers/firmware/efi/libstub/efi-stub.c
+++ b/drivers/firmware/efi/libstub/efi-stub.c
@@ -10,7 +10,6 @@
*/
#include <linux/efi.h>
-#include <linux/screen_info.h>
#include <asm/efi.h>
#include "efistub.h"
@@ -48,13 +47,13 @@
static u64 virtmap_base = EFI_RT_VIRTUAL_BASE;
static bool flat_va_mapping = (EFI_RT_VIRTUAL_OFFSET != 0);
-void __weak free_screen_info(struct screen_info *si)
+void __weak free_screen_info(struct efi_screen_info *si)
{
}
-static struct screen_info *setup_graphics(void)
+static struct efi_screen_info *setup_graphics(void)
{
- struct screen_info *si, tmp = {};
+ struct efi_screen_info *si, tmp = {};
if (efi_setup_graphics(&tmp, NULL) != EFI_SUCCESS)
return NULL;
@@ -145,7 +144,7 @@ efi_status_t efi_stub_common(efi_handle_t handle,
unsigned long image_addr,
char *cmdline_ptr)
{
- struct screen_info *si;
+ struct efi_screen_info *si;
efi_status_t status;
status = check_platform_features();
diff --git a/drivers/firmware/efi/libstub/efistub.h b/drivers/firmware/efi/libstub/efistub.h
index b2fb0c3fa721..bdeb28d42a1a 100644
--- a/drivers/firmware/efi/libstub/efistub.h
+++ b/drivers/firmware/efi/libstub/efistub.h
@@ -1175,9 +1175,9 @@ efi_enable_reset_attack_mitigation(void) { }
void efi_retrieve_eventlog(void);
-struct screen_info *alloc_screen_info(void);
-struct screen_info *__alloc_screen_info(void);
-void free_screen_info(struct screen_info *si);
+struct efi_screen_info *alloc_screen_info(void);
+struct efi_screen_info *__alloc_screen_info(void);
+void free_screen_info(struct efi_screen_info *si);
void efi_cache_sync_image(unsigned long image_base,
unsigned long alloc_size);
diff --git a/drivers/firmware/efi/libstub/gop.c b/drivers/firmware/efi/libstub/gop.c
index 72d74436a7a4..db80f2ad2871 100644
--- a/drivers/firmware/efi/libstub/gop.c
+++ b/drivers/firmware/efi/libstub/gop.c
@@ -8,7 +8,6 @@
#include <linux/bitops.h>
#include <linux/ctype.h>
#include <linux/efi.h>
-#include <linux/screen_info.h>
#include <linux/string.h>
#include <asm/efi.h>
#include <asm/setup.h>
diff --git a/drivers/firmware/efi/libstub/screen_info.c b/drivers/firmware/efi/libstub/screen_info.c
index 5d3a1e32d177..189da1efb7b2 100644
--- a/drivers/firmware/efi/libstub/screen_info.c
+++ b/drivers/firmware/efi/libstub/screen_info.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/efi.h>
-#include <linux/screen_info.h>
#include <asm/efi.h>
@@ -21,9 +20,9 @@
static efi_guid_t screen_info_guid = LINUX_EFI_SCREEN_INFO_TABLE_GUID;
-struct screen_info *__alloc_screen_info(void)
+struct efi_screen_info *__alloc_screen_info(void)
{
- struct screen_info *si;
+ struct efi_screen_info *si;
efi_status_t status;
status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY,
@@ -43,7 +42,7 @@ struct screen_info *__alloc_screen_info(void)
return NULL;
}
-void free_screen_info(struct screen_info *si)
+void free_screen_info(struct efi_screen_info *si)
{
if (!si)
return;
diff --git a/drivers/firmware/efi/libstub/zboot.c b/drivers/firmware/efi/libstub/zboot.c
index c47ace06f010..86f4814cfd47 100644
--- a/drivers/firmware/efi/libstub/zboot.c
+++ b/drivers/firmware/efi/libstub/zboot.c
@@ -26,7 +26,7 @@ void __weak efi_cache_sync_image(unsigned long image_base,
// executable code loaded into memory to be safe for execution.
}
-struct screen_info *alloc_screen_info(void)
+struct efi_screen_info *alloc_screen_info(void)
{
return __alloc_screen_info();
}
diff --git a/drivers/firmware/efi/sysfb_efi.c b/drivers/firmware/efi/sysfb_efi.c
index 1e509595ac03..092c19771e17 100644
--- a/drivers/firmware/efi/sysfb_efi.c
+++ b/drivers/firmware/efi/sysfb_efi.c
@@ -22,7 +22,6 @@
#include <linux/of_address.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
-#include <linux/screen_info.h>
#include <linux/sysfb.h>
#include <video/vga.h>
diff --git a/include/linux/efi.h b/include/linux/efi.h
index a01f3fe20dab..75d05dc1b4ee 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -27,7 +27,7 @@
#include <asm/page.h>
-struct screen_info;
+#include <linux/screen_info.h>
#define EFI_SUCCESS 0
#define EFI_LOAD_ERROR ( 1 | (1UL << (BITS_PER_LONG-1)))
@@ -1361,4 +1361,8 @@ extern struct blocking_notifier_head efivar_ops_nh;
void efivars_generic_ops_register(void);
void efivars_generic_ops_unregister(void);
+struct efi_screen_info {
+ struct screen_info screen_info;
+};
+
#endif /* _LINUX_EFI_H */
--
2.52.0.rc1.455.g30608eb744-goog
next prev parent reply other threads:[~2025-11-19 12:30 UTC|newest]
Thread overview: 10+ 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 ` Ard Biesheuvel [this message]
2025-11-19 12:30 ` [PATCH 2/3] video/edid: Use getter function for edid_info Ard Biesheuvel
2025-11-19 12:30 ` [PATCH 3/3] efi: Add FIRMWARE_EDID support Ard Biesheuvel
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
-- strict thread matches above, loose matches on Subject: below --
2025-11-19 15:30 [PATCH 1/3] efi: Wrap screen_info in efi_screen_info so edid_info can be added later kernel test robot
2025-11-21 0:01 kernel test robot
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-6-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.