From 54bdafd7780850803385d6faf33034a0fa7cd4cc Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 26 Nov 2025 17:03:19 +0100 Subject: efi: sysfb_efi: Reduce number of references to global screen_info Replace usage of global screen_info with local pointers. This will later reduce churn when screen_info is being moved. Signed-off-by: Thomas Zimmermann Reviewed-by: Richard Lyu Acked-by: Arnd Bergmann Acked-by: Ard Biesheuvel Signed-off-by: Ard Biesheuvel --- include/linux/sysfb.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'include/linux') diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h index b449665c686a..8527a50a5290 100644 --- a/include/linux/sysfb.h +++ b/include/linux/sysfb.h @@ -82,16 +82,17 @@ static inline bool sysfb_handles_screen_info(void) #ifdef CONFIG_EFI extern struct efifb_dmi_info efifb_dmi_list[]; -void sysfb_apply_efi_quirks(void); -void sysfb_set_efifb_fwnode(struct platform_device *pd); +void sysfb_apply_efi_quirks(struct screen_info *si); +void sysfb_set_efifb_fwnode(const struct screen_info *si, struct platform_device *pd); #else /* CONFIG_EFI */ -static inline void sysfb_apply_efi_quirks(void) +static inline void sysfb_apply_efi_quirks(struct screen_info *si) { } -static inline void sysfb_set_efifb_fwnode(struct platform_device *pd) +static inline void sysfb_set_efifb_fwnode(const struct screen_info *si, + struct platform_device *pd) { } -- cgit v1.2.3 From b945922619b77b95a48f254582ed86f33d24f560 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 26 Nov 2025 17:03:20 +0100 Subject: sysfb: Add struct sysfb_display_info Add struct sysfb_display_info to wrap display-related state. For now it contains only the screen's video mode. Later EDID will be added as well. This struct will be helpful for passing display state to sysfb drivers or from the EFI stub library. Signed-off-by: Thomas Zimmermann Acked-by: Arnd Bergmann Acked-by: Ard Biesheuvel Reviewed-by: Richard Lyu Signed-off-by: Ard Biesheuvel --- include/linux/sysfb.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/linux') diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h index 8527a50a5290..8b37247528bf 100644 --- a/include/linux/sysfb.h +++ b/include/linux/sysfb.h @@ -8,6 +8,7 @@ */ #include +#include #include #include @@ -60,6 +61,10 @@ struct efifb_dmi_info { int flags; }; +struct sysfb_display_info { + struct screen_info screen; +}; + #ifdef CONFIG_SYSFB void sysfb_disable(struct device *dev); -- cgit v1.2.3 From a41e0ab394e42c7c09ddd8155d2cc3ca17bdce55 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 26 Nov 2025 17:03:21 +0100 Subject: sysfb: Replace screen_info with sysfb_primary_display Replace the global screen_info with sysfb_primary_display of type struct sysfb_display_info. Adapt all users of screen_info. Instances of screen_info are defined for x86, loongarch and EFI, with only one instance compiled into a specific build. Replace all of them with sysfb_primary_display. All existing users of screen_info are updated by pointing them to sysfb_primary_display.screen instead. This introduces some churn to the code, but has no impact on functionality. Boot parameters and EFI config tables are unchanged. They transfer screen_info as before. The logic in EFI's alloc_screen_info() changes slightly, as it now returns the screen field of sysfb_primary_display. Signed-off-by: Thomas Zimmermann Acked-by: Arnd Bergmann Acked-by: Ard Biesheuvel Acked-by: Bjorn Helgaas # drivers/pci/ Reviewed-by: Richard Lyu Signed-off-by: Ard Biesheuvel --- include/linux/screen_info.h | 2 -- include/linux/sysfb.h | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'include/linux') diff --git a/include/linux/screen_info.h b/include/linux/screen_info.h index 1690706206e8..c022403c599a 100644 --- a/include/linux/screen_info.h +++ b/include/linux/screen_info.h @@ -151,6 +151,4 @@ static inline struct pci_dev *screen_info_pci_dev(const struct screen_info *si) } #endif -extern struct screen_info screen_info; - #endif /* _SCREEN_INFO_H */ diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h index 8b37247528bf..e8bde392c690 100644 --- a/include/linux/sysfb.h +++ b/include/linux/sysfb.h @@ -8,11 +8,10 @@ */ #include +#include #include #include -#include - struct device; struct platform_device; struct screen_info; @@ -65,6 +64,8 @@ struct sysfb_display_info { struct screen_info screen; }; +extern struct sysfb_display_info sysfb_primary_display; + #ifdef CONFIG_SYSFB void sysfb_disable(struct device *dev); -- cgit v1.2.3 From 4fcae635887195d6ecc427d503d7671ca46bc11b Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Wed, 26 Nov 2025 17:03:23 +0100 Subject: sysfb: Move edid_info into sysfb_primary_display Move x86's edid_info into sysfb_primary_display as a new field named edid. Adapt all users. An instance of edid_info has only been defined on x86. With the move into sysfb_primary_display, it becomes available on all architectures. Therefore remove this contraint from CONFIG_FIRMWARE_EDID. x86 fills the EDID data from boot_params.edid_info. DRM drivers pick up the raw data and make it available to DRM clients. Replace the drivers' references to edid_info and instead use the sysfb_display_info as passed from sysfb. Signed-off-by: Thomas Zimmermann Acked-by: Arnd Bergmann Acked-by: Ard Biesheuvel Signed-off-by: Ard Biesheuvel --- include/linux/sysfb.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/linux') diff --git a/include/linux/sysfb.h b/include/linux/sysfb.h index e8bde392c690..5226efde9ad4 100644 --- a/include/linux/sysfb.h +++ b/include/linux/sysfb.h @@ -12,6 +12,8 @@ #include #include +#include