Skip to content

Commit 555624c

Browse files
arndbgregkh
authored andcommitted
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: Javier Martinez Canillas <[email protected]> Acked-by: Khalid Aziz <[email protected]> Acked-by: Helge Deller <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent acfc788 commit 555624c

File tree

13 files changed

+74
-80
lines changed

13 files changed

+74
-80
lines changed

arch/alpha/kernel/proto.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22
#include <linux/interrupt.h>
3+
#include <linux/screen_info.h>
34
#include <linux/io.h>
45

56
/* Prototypes of functions used across modules here in this directory. */
@@ -113,6 +114,7 @@ extern int boot_cpuid;
113114
#ifdef CONFIG_VERBOSE_MCHECK
114115
extern unsigned long alpha_verbose_mcheck;
115116
#endif
117+
extern struct screen_info vgacon_screen_info;
116118

117119
/* srmcons.c */
118120
#if defined(CONFIG_ALPHA_GENERIC) || defined(CONFIG_ALPHA_SRM)

arch/alpha/kernel/setup.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,14 @@ static char __initdata command_line[COMMAND_LINE_SIZE];
138138
* code think we're on a VGA color display.
139139
*/
140140

141-
struct screen_info screen_info = {
141+
struct screen_info vgacon_screen_info = {
142142
.orig_x = 0,
143143
.orig_y = 25,
144144
.orig_video_cols = 80,
145145
.orig_video_lines = 25,
146146
.orig_video_isVGA = 1,
147147
.orig_video_points = 16
148148
};
149-
150-
EXPORT_SYMBOL(screen_info);
151149
#endif
152150

153151
/*
@@ -654,7 +652,7 @@ setup_arch(char **cmdline_p)
654652

655653
#ifdef CONFIG_VT
656654
#if defined(CONFIG_VGA_CONSOLE)
657-
vgacon_register_screen(&screen_info);
655+
vgacon_register_screen(&vgacon_screen_info);
658656
#endif
659657
#endif
660658

arch/alpha/kernel/sys_sio.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ alphabook1_init_arch(void)
6060
#ifdef CONFIG_VGA_CONSOLE
6161
/* The AlphaBook1 has LCD video fixed at 800x600,
6262
37 rows and 100 cols. */
63-
screen_info.orig_y = 37;
64-
screen_info.orig_video_cols = 100;
65-
screen_info.orig_video_lines = 37;
63+
vgacon_screen_info.orig_y = 37;
64+
vgacon_screen_info.orig_video_cols = 100;
65+
vgacon_screen_info.orig_video_lines = 37;
6666
#endif
6767

6868
lca_init_arch();

arch/arm/include/asm/setup.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#ifndef __ASMARM_SETUP_H
1212
#define __ASMARM_SETUP_H
1313

14+
#include <linux/screen_info.h>
1415
#include <uapi/asm/setup.h>
1516

1617

@@ -35,4 +36,8 @@ void early_mm_init(const struct machine_desc *);
3536
void adjust_lowmem_bounds(void);
3637
void setup_dma_zone(const struct machine_desc *desc);
3738

39+
#ifdef CONFIG_VGA_CONSOLE
40+
extern struct screen_info vgacon_screen_info;
41+
#endif
42+
3843
#endif

arch/arm/kernel/atags_parse.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ __tagtable(ATAG_MEM, parse_tag_mem32);
7272
#if defined(CONFIG_ARCH_FOOTBRIDGE) && defined(CONFIG_VGA_CONSOLE)
7373
static int __init parse_tag_videotext(const struct tag *tag)
7474
{
75-
screen_info.orig_x = tag->u.videotext.x;
76-
screen_info.orig_y = tag->u.videotext.y;
77-
screen_info.orig_video_page = tag->u.videotext.video_page;
78-
screen_info.orig_video_mode = tag->u.videotext.video_mode;
79-
screen_info.orig_video_cols = tag->u.videotext.video_cols;
80-
screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx;
81-
screen_info.orig_video_lines = tag->u.videotext.video_lines;
82-
screen_info.orig_video_isVGA = tag->u.videotext.video_isvga;
83-
screen_info.orig_video_points = tag->u.videotext.video_points;
75+
vgacon_screen_info.orig_x = tag->u.videotext.x;
76+
vgacon_screen_info.orig_y = tag->u.videotext.y;
77+
vgacon_screen_info.orig_video_page = tag->u.videotext.video_page;
78+
vgacon_screen_info.orig_video_mode = tag->u.videotext.video_mode;
79+
vgacon_screen_info.orig_video_cols = tag->u.videotext.video_cols;
80+
vgacon_screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx;
81+
vgacon_screen_info.orig_video_lines = tag->u.videotext.video_lines;
82+
vgacon_screen_info.orig_video_isVGA = tag->u.videotext.video_isvga;
83+
vgacon_screen_info.orig_video_points = tag->u.videotext.video_points;
8484
return 0;
8585
}
8686

arch/arm/kernel/efi.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,6 @@ void __init arm_efi_init(void)
123123
{
124124
efi_init();
125125

126-
if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI) {
127-
/* dummycon on ARM needs non-zero values for columns/lines */
128-
screen_info.orig_video_cols = 80;
129-
screen_info.orig_video_lines = 25;
130-
}
131-
132126
/* ARM does not permit early mappings to persist across paging_init() */
133127
efi_memmap_unmap();
134128

arch/arm/kernel/setup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,8 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
928928
request_resource(&ioport_resource, &lp2);
929929
}
930930

931-
#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_EFI)
932-
struct screen_info screen_info = {
931+
#if defined(CONFIG_VGA_CONSOLE)
932+
static struct screen_info vgacon_screen_info = {
933933
.orig_video_lines = 30,
934934
.orig_video_cols = 80,
935935
.orig_video_mode = 0,
@@ -1192,7 +1192,7 @@ void __init setup_arch(char **cmdline_p)
11921192

11931193
#ifdef CONFIG_VT
11941194
#if defined(CONFIG_VGA_CONSOLE)
1195-
vgacon_register_screen(&screen_info);
1195+
vgacon_register_screen(&vgacon_screen_info);
11961196
#endif
11971197
#endif
11981198

arch/ia64/kernel/setup.c

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ EXPORT_SYMBOL(local_per_cpu_offset);
8686
#endif
8787
unsigned long ia64_cycles_per_usec;
8888
struct ia64_boot_param *ia64_boot_param;
89-
#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_EFI)
89+
#if defined(CONFIG_EFI)
90+
/* No longer used on ia64, but needed for linking */
9091
struct screen_info screen_info;
9192
#endif
9293
#ifdef CONFIG_VGA_CONSOLE
@@ -503,8 +504,9 @@ screen_info_setup(void)
503504
{
504505
#ifdef CONFIG_VGA_CONSOLE
505506
unsigned int orig_x, orig_y, num_cols, num_rows, font_height;
507+
static struct screen_info si;
506508

507-
memset(&screen_info, 0, sizeof(screen_info));
509+
memset(&si, 0, sizeof(si));
508510

509511
if (!ia64_boot_param->console_info.num_rows ||
510512
!ia64_boot_param->console_info.num_cols) {
@@ -522,14 +524,26 @@ screen_info_setup(void)
522524
font_height = 400 / num_rows;
523525
}
524526

525-
screen_info.orig_x = orig_x;
526-
screen_info.orig_y = orig_y;
527-
screen_info.orig_video_cols = num_cols;
528-
screen_info.orig_video_lines = num_rows;
529-
screen_info.orig_video_points = font_height;
530-
screen_info.orig_video_mode = 3; /* XXX fake */
531-
screen_info.orig_video_isVGA = 1; /* XXX fake */
532-
screen_info.orig_video_ega_bx = 3; /* XXX fake */
527+
si.orig_x = orig_x;
528+
si.orig_y = orig_y;
529+
si.orig_video_cols = num_cols;
530+
si.orig_video_lines = num_rows;
531+
si.orig_video_points = font_height;
532+
si.orig_video_mode = 3; /* XXX fake */
533+
si.orig_video_isVGA = 1; /* XXX fake */
534+
si.orig_video_ega_bx = 3; /* XXX fake */
535+
536+
if (!conswitchp) {
537+
/*
538+
* Non-legacy systems may route legacy VGA MMIO range to system
539+
* memory. vga_con probes the MMIO hole, so memory looks like
540+
* a VGA device to it. The EFI memory map can tell us if it's
541+
* memory so we can avoid this problem.
542+
*/
543+
if (efi_mem_type(vga_console_membase + 0xA0000) !=
544+
EFI_CONVENTIONAL_MEMORY) {
545+
vgacon_register_screen(&si);
546+
}
533547
#endif
534548
}
535549

@@ -609,21 +623,6 @@ setup_arch (char **cmdline_p)
609623
cpu_init(); /* initialize the bootstrap CPU */
610624
mmu_context_init(); /* initialize context_id bitmap */
611625

612-
#ifdef CONFIG_VT
613-
if (!conswitchp) {
614-
# if defined(CONFIG_VGA_CONSOLE)
615-
/*
616-
* Non-legacy systems may route legacy VGA MMIO range to system
617-
* memory. vga_con probes the MMIO hole, so memory looks like
618-
* a VGA device to it. The EFI memory map can tell us if it's
619-
* memory so we can avoid this problem.
620-
*/
621-
if (efi_mem_type(0xA0000) != EFI_CONVENTIONAL_MEMORY)
622-
vgacon_register_screen(&screen_info);
623-
# endif
624-
}
625-
#endif
626-
627626
/* enable IA-64 Machine Check Abort Handling unless disabled */
628627
if (!nomca)
629628
ia64_mca_init();

arch/mips/kernel/setup.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <linux/delay.h>
1616
#include <linux/ioport.h>
1717
#include <linux/export.h>
18-
#include <linux/screen_info.h>
1918
#include <linux/memblock.h>
2019
#include <linux/initrd.h>
2120
#include <linux/root_dev.h>
@@ -54,10 +53,6 @@ struct cpuinfo_mips cpu_data[NR_CPUS] __read_mostly;
5453

5554
EXPORT_SYMBOL(cpu_data);
5655

57-
#ifdef CONFIG_VGA_CONSOLE
58-
struct screen_info screen_info;
59-
#endif
60-
6156
/*
6257
* Setup information
6358
*
@@ -792,12 +787,6 @@ void __init setup_arch(char **cmdline_p)
792787
if (IS_ENABLED(CONFIG_CPU_R4X00_BUGS64))
793788
check_bugs64_early();
794789

795-
#if defined(CONFIG_VT)
796-
#if defined(CONFIG_VGA_CONSOLE)
797-
vgacon_register_screen(&screen_info);
798-
#endif
799-
#endif
800-
801790
arch_mem_init(cmdline_p);
802791
dmi_setup();
803792

arch/mips/mti-malta/malta-setup.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static void __init pci_clock_check(void)
161161
#if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
162162
static void __init screen_info_setup(void)
163163
{
164-
screen_info = (struct screen_info) {
164+
static struct screen_info si = {
165165
.orig_x = 0,
166166
.orig_y = 25,
167167
.ext_mem_k = 0,
@@ -175,6 +175,8 @@ static void __init screen_info_setup(void)
175175
.orig_video_isVGA = VIDEO_TYPE_VGAC,
176176
.orig_video_points = 16
177177
};
178+
179+
vgacon_register_screen(&si);
178180
}
179181
#endif
180182

arch/mips/sibyte/swarm/setup.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,19 @@ int update_persistent_clock64(struct timespec64 now)
112112
}
113113
}
114114

115+
#ifdef CONFIG_VGA_CONSOLE
116+
static struct screen_info vgacon_screen_info = {
117+
.orig_video_page = 52,
118+
.orig_video_mode = 3,
119+
.orig_video_cols = 80,
120+
.flags = 12,
121+
.orig_video_ega_bx = 3,
122+
.orig_video_lines = 25,
123+
.orig_video_isVGA = 0x22,
124+
.orig_video_points = 16,
125+
};
126+
#endif
127+
115128
void __init plat_mem_setup(void)
116129
{
117130
#ifdef CONFIG_SIBYTE_BCM1x80
@@ -130,16 +143,7 @@ void __init plat_mem_setup(void)
130143
swarm_rtc_type = RTC_M41T81;
131144

132145
#ifdef CONFIG_VGA_CONSOLE
133-
screen_info = (struct screen_info) {
134-
.orig_video_page = 52,
135-
.orig_video_mode = 3,
136-
.orig_video_cols = 80,
137-
.flags = 12,
138-
.orig_video_ega_bx = 3,
139-
.orig_video_lines = 25,
140-
.orig_video_isVGA = 0x22,
141-
.orig_video_points = 16,
142-
};
146+
vgacon_register_screen(&vgacon_screen_info);
143147
/* XXXKW for CFE, get lines/cols from environment */
144148
#endif
145149
}

arch/mips/sni/setup.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,20 @@ extern void sni_machine_power_off(void);
3939
static void __init sni_display_setup(void)
4040
{
4141
#if defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_FW_ARC)
42-
struct screen_info *si = &screen_info;
42+
static struct screen_info si;
4343
DISPLAY_STATUS *di;
4444

4545
di = ArcGetDisplayStatus(1);
4646

4747
if (di) {
48-
si->orig_x = di->CursorXPosition;
49-
si->orig_y = di->CursorYPosition;
50-
si->orig_video_cols = di->CursorMaxXPosition;
51-
si->orig_video_lines = di->CursorMaxYPosition;
52-
si->orig_video_isVGA = VIDEO_TYPE_VGAC;
53-
si->orig_video_points = 16;
48+
si.orig_x = di->CursorXPosition;
49+
si.orig_y = di->CursorYPosition;
50+
si.orig_video_cols = di->CursorMaxXPosition;
51+
si.orig_video_lines = di->CursorMaxYPosition;
52+
si.orig_video_isVGA = VIDEO_TYPE_VGAC;
53+
si.orig_video_points = 16;
54+
55+
vgacon_register_screen(&si);
5456
}
5557
#endif
5658
}

drivers/firmware/pcdp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ setup_vga_console(struct pcdp_device *dev)
7272
return -ENODEV;
7373
}
7474

75-
vgacon_register_screen(&screen_info);
7675
printk(KERN_INFO "PCDP: VGA console\n");
7776
return 0;
7877
#else

0 commit comments

Comments
 (0)