Commit a41e0ab3 authored by Thomas Zimmermann's avatar Thomas Zimmermann Committed by Ard Biesheuvel
Browse files

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: default avatarThomas Zimmermann <tzimmermann@suse.de>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarArd Biesheuvel <ardb@kernel.org>
Acked-by: Bjorn Helgaas <bhelgaas@google.com> # drivers/pci/
Reviewed-by: default avatarRichard Lyu <richard.lyu@suse.com>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
parent b9459226
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ PROVIDE(__efistub__end = _end);
PROVIDE(__efistub___inittext_end       	= __inittext_end);
PROVIDE(__efistub__edata		= _edata);
#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
PROVIDE(__efistub_screen_info		= screen_info);
PROVIDE(__efistub_sysfb_primary_display	= sysfb_primary_display);
#endif
PROVIDE(__efistub__ctype		= _ctype);

+8 −7
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
#include <linux/kobject.h>
#include <linux/memblock.h>
#include <linux/reboot.h>
#include <linux/screen_info.h>
#include <linux/sysfb.h>
#include <linux/uaccess.h>

#include <asm/early_ioremap.h>
@@ -75,11 +75,11 @@ bool efi_poweroff_required(void)
unsigned long __initdata screen_info_table = EFI_INVALID_TABLE_ADDR;

#if defined(CONFIG_SYSFB) || defined(CONFIG_EFI_EARLYCON)
struct screen_info screen_info __section(".data");
EXPORT_SYMBOL_GPL(screen_info);
struct sysfb_display_info sysfb_primary_display __section(".data");
EXPORT_SYMBOL_GPL(sysfb_primary_display);
#endif

static void __init init_screen_info(void)
static void __init init_primary_display(void)
{
	struct screen_info *si;

@@ -91,11 +91,12 @@ static void __init init_screen_info(void)
		pr_err("Could not map screen_info config table\n");
		return;
	}
	screen_info = *si;
	sysfb_primary_display.screen = *si;
	memset(si, 0, sizeof(*si));
	early_memunmap(si, sizeof(*si));

	memblock_reserve(__screen_info_lfb_base(&screen_info), screen_info.lfb_size);
	memblock_reserve(__screen_info_lfb_base(&sysfb_primary_display.screen),
			 sysfb_primary_display.screen.lfb_size);
}

void __init efi_init(void)
@@ -129,7 +130,7 @@ void __init efi_init(void)
	set_bit(EFI_CONFIG_TABLES, &efi.flags);

	if (IS_ENABLED(CONFIG_EFI_EARLYCON) || IS_ENABLED(CONFIG_SYSFB))
		init_screen_info();
		init_primary_display();

	if (boot_memmap == EFI_INVALID_TABLE_ADDR)
		return;
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ __efistub_kernel_entry = kernel_entry;
__efistub_kernel_asize		= kernel_asize;
__efistub_kernel_fsize		= kernel_fsize;
#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
__efistub_screen_info		= screen_info;
__efistub_sysfb_primary_display	= sysfb_primary_display;
#endif

#endif
+1 −1
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ __efistub__end = _end;
__efistub__edata		= _edata;
__efistub___init_text_end	= __init_text_end;
#if defined(CONFIG_EFI_EARLYCON) || defined(CONFIG_SYSFB)
__efistub_screen_info		= screen_info;
__efistub_sysfb_primary_display	= sysfb_primary_display;
#endif

#endif
+3 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/of_fdt.h>
#include <linux/efi.h>
#include <linux/random.h>
#include <linux/sysfb.h>

#include <asm/bootparam.h>
#include <asm/setup.h>
@@ -303,7 +304,8 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,
	params->hdr.hardware_subarch = boot_params.hdr.hardware_subarch;

	/* Copying screen_info will do? */
	memcpy(&params->screen_info, &screen_info, sizeof(struct screen_info));
	memcpy(&params->screen_info, &sysfb_primary_display.screen,
	       sizeof(sysfb_primary_display.screen));

	/* Fill in memsize later */
	params->screen_info.ext_mem_k = 0;
Loading