Commit 555624c0 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Greg Kroah-Hartman

vgacon: clean up global screen_info instances

To prepare for completely separating the VGA console screen_info from
the one used in EFI/sysfb, rename the vgacon instances and make them
local as much as possible.

ia64 and arm both have confurations with vgacon and efi, but the contents
never overlaps because ia64 has no EFI framebuffer, and arm only has
vga console on legacy platforms without EFI. Renaming these is required
before the EFI screen_info can be moved into drivers/firmware.

The ia64 vga console is actually registered in two places from
setup_arch(), but one of them is wrong, so drop the one in pcdp.c and
fix the one in setup.c to use the correct conditional.

x86 has to keep them together, as the boot protocol is used to switch
between VGA text console and framebuffer through the screen_info data.
Acked-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Acked-by: default avatarKhalid Aziz <khalid@gonehiking.org>
Acked-by: default avatarHelge Deller <deller@gmx.de>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20231009211845.3136536-7-arnd@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent acfc7882
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/screen_info.h>
#include <linux/io.h> #include <linux/io.h>
/* Prototypes of functions used across modules here in this directory. */ /* Prototypes of functions used across modules here in this directory. */
...@@ -113,6 +114,7 @@ extern int boot_cpuid; ...@@ -113,6 +114,7 @@ extern int boot_cpuid;
#ifdef CONFIG_VERBOSE_MCHECK #ifdef CONFIG_VERBOSE_MCHECK
extern unsigned long alpha_verbose_mcheck; extern unsigned long alpha_verbose_mcheck;
#endif #endif
extern struct screen_info vgacon_screen_info;
/* srmcons.c */ /* srmcons.c */
#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM) #if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM)
......
...@@ -138,7 +138,7 @@ static char __initdata command_line[COMMAND_LINE_SIZE]; ...@@ -138,7 +138,7 @@ static char __initdata command_line[COMMAND_LINE_SIZE];
* code think we're on a VGA color display. * code think we're on a VGA color display.
*/ */
struct screen_info screen_info = { struct screen_info vgacon_screen_info = {
.orig_x = 0, .orig_x = 0,
.orig_y = 25, .orig_y = 25,
.orig_video_cols = 80, .orig_video_cols = 80,
...@@ -146,8 +146,6 @@ struct screen_info screen_info = { ...@@ -146,8 +146,6 @@ struct screen_info screen_info = {
.orig_video_isVGA = 1, .orig_video_isVGA = 1,
.orig_video_points = 16 .orig_video_points = 16
}; };
EXPORT_SYMBOL(screen_info);
#endif #endif
/* /*
...@@ -654,7 +652,7 @@ setup_arch(char **cmdline_p) ...@@ -654,7 +652,7 @@ setup_arch(char **cmdline_p)
#ifdef CONFIG_VT #ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE) #if defined(CONFIG_VGA_CONSOLE)
vgacon_register_screen(&screen_info); vgacon_register_screen(&vgacon_screen_info);
#endif #endif
#endif #endif
......
...@@ -60,9 +60,9 @@ alphabook1_init_arch(void) ...@@ -60,9 +60,9 @@ alphabook1_init_arch(void)
#ifdef CONFIG_VGA_CONSOLE #ifdef CONFIG_VGA_CONSOLE
/* The AlphaBook1 has LCD video fixed at 800x600, /* The AlphaBook1 has LCD video fixed at 800x600,
37 rows and 100 cols. */ 37 rows and 100 cols. */
screen_info.orig_y = 37; vgacon_screen_info.orig_y = 37;
screen_info.orig_video_cols = 100; vgacon_screen_info.orig_video_cols = 100;
screen_info.orig_video_lines = 37; vgacon_screen_info.orig_video_lines = 37;
#endif #endif
lca_init_arch(); lca_init_arch();
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#ifndef __ASMARM_SETUP_H #ifndef __ASMARM_SETUP_H
#define __ASMARM_SETUP_H #define __ASMARM_SETUP_H
#include <linux/screen_info.h>
#include <uapi/asm/setup.h> #include <uapi/asm/setup.h>
...@@ -35,4 +36,8 @@ void early_mm_init(const struct machine_desc *); ...@@ -35,4 +36,8 @@ void early_mm_init(const struct machine_desc *);
void adjust_lowmem_bounds(void); void adjust_lowmem_bounds(void);
void setup_dma_zone(const struct machine_desc *desc); void setup_dma_zone(const struct machine_desc *desc);
#ifdef CONFIG_VGA_CONSOLE
extern struct screen_info vgacon_screen_info;
#endif
#endif #endif
...@@ -72,15 +72,15 @@ __tagtable(ATAG_MEM, parse_tag_mem32); ...@@ -72,15 +72,15 @@ __tagtable(ATAG_MEM, parse_tag_mem32);
#if defined(CONFIG_ARCH_FOOTBRIDGE) && defined(CONFIG_VGA_CONSOLE) #if defined(CONFIG_ARCH_FOOTBRIDGE) && defined(CONFIG_VGA_CONSOLE)
static int __init parse_tag_videotext(const struct tag *tag) static int __init parse_tag_videotext(const struct tag *tag)
{ {
screen_info.orig_x = tag->u.videotext.x; vgacon_screen_info.orig_x = tag->u.videotext.x;
screen_info.orig_y = tag->u.videotext.y; vgacon_screen_info.orig_y = tag->u.videotext.y;
screen_info.orig_video_page = tag->u.videotext.video_page; vgacon_screen_info.orig_video_page = tag->u.videotext.video_page;
screen_info.orig_video_mode = tag->u.videotext.video_mode; vgacon_screen_info.orig_video_mode = tag->u.videotext.video_mode;
screen_info.orig_video_cols = tag->u.videotext.video_cols; vgacon_screen_info.orig_video_cols = tag->u.videotext.video_cols;
screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx; vgacon_screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx;
screen_info.orig_video_lines = tag->u.videotext.video_lines; vgacon_screen_info.orig_video_lines = tag->u.videotext.video_lines;
screen_info.orig_video_isVGA = tag->u.videotext.video_isvga; vgacon_screen_info.orig_video_isVGA = tag->u.videotext.video_isvga;
screen_info.orig_video_points = tag->u.videotext.video_points; vgacon_screen_info.orig_video_points = tag->u.videotext.video_points;
return 0; return 0;
} }
......
...@@ -123,12 +123,6 @@ void __init arm_efi_init(void) ...@@ -123,12 +123,6 @@ void __init arm_efi_init(void)
{ {
efi_init(); efi_init();
if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI) {
/* dummycon on ARM needs non-zero values for columns/lines */
screen_info.orig_video_cols = 80;
screen_info.orig_video_lines = 25;
}
/* ARM does not permit early mappings to persist across paging_init() */ /* ARM does not permit early mappings to persist across paging_init() */
efi_memmap_unmap(); efi_memmap_unmap();
......
...@@ -928,8 +928,8 @@ static void __init request_standard_resources(const struct machine_desc *mdesc) ...@@ -928,8 +928,8 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
request_resource(&ioport_resource, &lp2); request_resource(&ioport_resource, &lp2);
} }
#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_EFI) #if defined(CONFIG_VGA_CONSOLE)
struct screen_info screen_info = { static struct screen_info vgacon_screen_info = {
.orig_video_lines = 30, .orig_video_lines = 30,
.orig_video_cols = 80, .orig_video_cols = 80,
.orig_video_mode = 0, .orig_video_mode = 0,
...@@ -1192,7 +1192,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -1192,7 +1192,7 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_VT #ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE) #if defined(CONFIG_VGA_CONSOLE)
vgacon_register_screen(&screen_info); vgacon_register_screen(&vgacon_screen_info);
#endif #endif
#endif #endif
......
...@@ -86,7 +86,8 @@ EXPORT_SYMBOL(local_per_cpu_offset); ...@@ -86,7 +86,8 @@ EXPORT_SYMBOL(local_per_cpu_offset);
#endif #endif
unsigned long ia64_cycles_per_usec; unsigned long ia64_cycles_per_usec;
struct ia64_boot_param *ia64_boot_param; struct ia64_boot_param *ia64_boot_param;
#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_EFI) #if defined(CONFIG_EFI)
/* No longer used on ia64, but needed for linking */
struct screen_info screen_info; struct screen_info screen_info;
#endif #endif
#ifdef CONFIG_VGA_CONSOLE #ifdef CONFIG_VGA_CONSOLE
...@@ -503,8 +504,9 @@ screen_info_setup(void) ...@@ -503,8 +504,9 @@ screen_info_setup(void)
{ {
#ifdef CONFIG_VGA_CONSOLE #ifdef CONFIG_VGA_CONSOLE
unsigned int orig_x, orig_y, num_cols, num_rows, font_height; unsigned int orig_x, orig_y, num_cols, num_rows, font_height;
static struct screen_info si;
memset(&screen_info, 0, sizeof(screen_info)); memset(&si, 0, sizeof(si));
if (!ia64_boot_param->console_info.num_rows || if (!ia64_boot_param->console_info.num_rows ||
!ia64_boot_param->console_info.num_cols) { !ia64_boot_param->console_info.num_cols) {
...@@ -522,14 +524,26 @@ screen_info_setup(void) ...@@ -522,14 +524,26 @@ screen_info_setup(void)
font_height = 400 / num_rows; font_height = 400 / num_rows;
} }
screen_info.orig_x = orig_x; si.orig_x = orig_x;
screen_info.orig_y = orig_y; si.orig_y = orig_y;
screen_info.orig_video_cols = num_cols; si.orig_video_cols = num_cols;
screen_info.orig_video_lines = num_rows; si.orig_video_lines = num_rows;
screen_info.orig_video_points = font_height; si.orig_video_points = font_height;
screen_info.orig_video_mode = 3; /* XXX fake */ si.orig_video_mode = 3; /* XXX fake */
screen_info.orig_video_isVGA = 1; /* XXX fake */ si.orig_video_isVGA = 1; /* XXX fake */
screen_info.orig_video_ega_bx = 3; /* XXX fake */ si.orig_video_ega_bx = 3; /* XXX fake */
if (!conswitchp) {
/*
* Non-legacy systems may route legacy VGA MMIO range to system
* memory. vga_con probes the MMIO hole, so memory looks like
* a VGA device to it. The EFI memory map can tell us if it's
* memory so we can avoid this problem.
*/
if (efi_mem_type(vga_console_membase + 0xA0000) !=
EFI_CONVENTIONAL_MEMORY) {
vgacon_register_screen(&si);
}
#endif #endif
} }
...@@ -609,21 +623,6 @@ setup_arch (char **cmdline_p) ...@@ -609,21 +623,6 @@ setup_arch (char **cmdline_p)
cpu_init(); /* initialize the bootstrap CPU */ cpu_init(); /* initialize the bootstrap CPU */
mmu_context_init(); /* initialize context_id bitmap */ mmu_context_init(); /* initialize context_id bitmap */
#ifdef CONFIG_VT
if (!conswitchp) {
# if defined(CONFIG_VGA_CONSOLE)
/*
* Non-legacy systems may route legacy VGA MMIO range to system
* memory. vga_con probes the MMIO hole, so memory looks like
* a VGA device to it. The EFI memory map can tell us if it's
* memory so we can avoid this problem.
*/
if (efi_mem_type(0xA0000) != EFI_CONVENTIONAL_MEMORY)
vgacon_register_screen(&screen_info);
# endif
}
#endif
/* enable IA-64 Machine Check Abort Handling unless disabled */ /* enable IA-64 Machine Check Abort Handling unless disabled */
if (!nomca) if (!nomca)
ia64_mca_init(); ia64_mca_init();
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/screen_info.h>
#include <linux/memblock.h> #include <linux/memblock.h>
#include <linux/initrd.h> #include <linux/initrd.h>
#include <linux/root_dev.h> #include <linux/root_dev.h>
...@@ -54,10 +53,6 @@ struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly; ...@@ -54,10 +53,6 @@ struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
EXPORT_SYMBOL(cpu_data); EXPORT_SYMBOL(cpu_data);
#ifdef CONFIG_VGA_CONSOLE
struct screen_info screen_info;
#endif
/* /*
* Setup information * Setup information
* *
...@@ -792,12 +787,6 @@ void __init setup_arch(char **cmdline_p) ...@@ -792,12 +787,6 @@ void __init setup_arch(char **cmdline_p)
if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64)) if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
check_bugs64_early(); check_bugs64_early();
#if defined(CONFIG_VT)
#if defined(CONFIG_VGA_CONSOLE)
vgacon_register_screen(&screen_info);
#endif
#endif
arch_mem_init(cmdline_p); arch_mem_init(cmdline_p);
dmi_setup(); dmi_setup();
......
...@@ -161,7 +161,7 @@ static void __init pci_clock_check(void) ...@@ -161,7 +161,7 @@ static void __init pci_clock_check(void)
#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE) #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
static void __init screen_info_setup(void) static void __init screen_info_setup(void)
{ {
screen_info = (struct screen_info) { static struct screen_info si = {
.orig_x = 0, .orig_x = 0,
.orig_y = 25, .orig_y = 25,
.ext_mem_k = 0, .ext_mem_k = 0,
...@@ -175,6 +175,8 @@ static void __init screen_info_setup(void) ...@@ -175,6 +175,8 @@ static void __init screen_info_setup(void)
.orig_video_isVGA = VIDEO_TYPE_VGAC, .orig_video_isVGA = VIDEO_TYPE_VGAC,
.orig_video_points = 16 .orig_video_points = 16
}; };
vgacon_register_screen(&si);
} }
#endif #endif
......
...@@ -112,6 +112,19 @@ int update_persistent_clock64(struct timespec64 now) ...@@ -112,6 +112,19 @@ int update_persistent_clock64(struct timespec64 now)
} }
} }
#ifdef CONFIG_VGA_CONSOLE
static struct screen_info vgacon_screen_info = {
.orig_video_page = 52,
.orig_video_mode = 3,
.orig_video_cols = 80,
.flags = 12,
.orig_video_ega_bx = 3,
.orig_video_lines = 25,
.orig_video_isVGA = 0x22,
.orig_video_points = 16,
};
#endif
void __init plat_mem_setup(void) void __init plat_mem_setup(void)
{ {
#ifdef CONFIG_SIBYTE_BCM1x80 #ifdef CONFIG_SIBYTE_BCM1x80
...@@ -130,16 +143,7 @@ void __init plat_mem_setup(void) ...@@ -130,16 +143,7 @@ void __init plat_mem_setup(void)
swarm_rtc_type = RTC_M41T81; swarm_rtc_type = RTC_M41T81;
#ifdef CONFIG_VGA_CONSOLE #ifdef CONFIG_VGA_CONSOLE
screen_info = (struct screen_info) { vgacon_register_screen(&vgacon_screen_info);
.orig_video_page = 52,
.orig_video_mode = 3,
.orig_video_cols = 80,
.flags = 12,
.orig_video_ega_bx = 3,
.orig_video_lines = 25,
.orig_video_isVGA = 0x22,
.orig_video_points = 16,
};
/* XXXKW for CFE, get lines/cols from environment */ /* XXXKW for CFE, get lines/cols from environment */
#endif #endif
} }
......
...@@ -39,18 +39,20 @@ extern void sni_machine_power_off(void); ...@@ -39,18 +39,20 @@ extern void sni_machine_power_off(void);
static void __init sni_display_setup(void) static void __init sni_display_setup(void)
{ {
#if defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_FW_ARC) #if defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_FW_ARC)
struct screen_info *si = &screen_info; static struct screen_info si;
DISPLAY_STATUS *di; DISPLAY_STATUS *di;
di = ArcGetDisplayStatus(1); di = ArcGetDisplayStatus(1);
if (di) { if (di) {
si->orig_x = di->CursorXPosition; si.orig_x = di->CursorXPosition;
si->orig_y = di->CursorYPosition; si.orig_y = di->CursorYPosition;
si->orig_video_cols = di->CursorMaxXPosition; si.orig_video_cols = di->CursorMaxXPosition;
si->orig_video_lines = di->CursorMaxYPosition; si.orig_video_lines = di->CursorMaxYPosition;
si->orig_video_isVGA = VIDEO_TYPE_VGAC; si.orig_video_isVGA = VIDEO_TYPE_VGAC;
si->orig_video_points = 16; si.orig_video_points = 16;
vgacon_register_screen(&si);
} }
#endif #endif
} }
......
...@@ -72,7 +72,6 @@ setup_vga_console(struct pcdp_device *dev) ...@@ -72,7 +72,6 @@ setup_vga_console(struct pcdp_device *dev)
return -ENODEV; return -ENODEV;
} }
vgacon_register_screen(&screen_info);
printk(KERN_INFO "PCDP: VGA console\n"); printk(KERN_INFO "PCDP: VGA console\n");
return 0; return 0;
#else #else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment