Skip to content

Commit 69c1f39

Browse files
Ard BiesheuvelIngo Molnar
authored andcommitted
efi/x86: Convert x86 EFI earlyprintk into generic earlycon implementation
Move the x86 EFI earlyprintk implementation to a shared location under drivers/firmware and tweak it slightly so we can expose it as an earlycon implementation (which is generic) rather than earlyprintk (which is only implemented for a few architectures) This also involves switching to write-combine mappings by default (which is required on ARM since device mappings lack memory semantics, and so memcpy/memset may not be used on them), and adding support for shared memory framebuffers on cache coherent non-x86 systems (which do not tolerate mismatched attributes). Note that 32-bit ARM does not populate its struct screen_info early enough for earlycon=efifb to work, so it is disabled there. Signed-off-by: Ard Biesheuvel <[email protected]> Reviewed-by: Alexander Graf <[email protected]> Cc: AKASHI Takahiro <[email protected]> Cc: Bjorn Andersson <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Heinrich Schuchardt <[email protected]> Cc: Jeffrey Hugo <[email protected]> Cc: Lee Jones <[email protected]> Cc: Leif Lindholm <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Matt Fleming <[email protected]> Cc: Peter Jones <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Sai Praneeth Prakhya <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent ce9084b commit 69c1f39

File tree

9 files changed

+220
-257
lines changed

9 files changed

+220
-257
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,9 +1073,15 @@
10731073
specified address. The serial port must already be
10741074
setup and configured. Options are not yet supported.
10751075

1076+
efifb,[options]
1077+
Start an early, unaccelerated console on the EFI
1078+
memory mapped framebuffer (if available). On cache
1079+
coherent non-x86 systems that use system memory for
1080+
the framebuffer, pass the 'ram' option so that it is
1081+
mapped with the correct attributes.
1082+
10761083
earlyprintk= [X86,SH,ARM,M68k,S390]
10771084
earlyprintk=vga
1078-
earlyprintk=efi
10791085
earlyprintk=sclp
10801086
earlyprintk=xen
10811087
earlyprintk=serial[,ttySn[,baudrate]]

arch/x86/Kconfig.debug

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@ config EARLY_PRINTK_DBGP
4040
with klogd/syslogd or the X server. You should normally say N here,
4141
unless you want to debug such a crash. You need usb debug device.
4242

43-
config EARLY_PRINTK_EFI
44-
bool "Early printk via the EFI framebuffer"
45-
depends on EFI && EARLY_PRINTK
46-
select FONT_SUPPORT
47-
---help---
48-
Write kernel log output directly into the EFI framebuffer.
49-
50-
This is useful for kernel debugging when your machine crashes very
51-
early before the console code is initialized.
52-
5343
config EARLY_PRINTK_USB_XDBC
5444
bool "Early printk via the xHCI debug port"
5545
depends on EARLY_PRINTK && PCI

arch/x86/include/asm/efi.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ static inline bool efi_runtime_supported(void)
170170
return false;
171171
}
172172

173-
extern struct console early_efi_console;
174173
extern void parse_efi_setup(u64 phys_addr, u32 data_len);
175174

176175
extern void efifb_setup_from_dmi(struct screen_info *si, const char *opt);

arch/x86/kernel/early_printk.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,6 @@ static int __init setup_early_printk(char *buf)
388388
if (!strncmp(buf, "xen", 3))
389389
early_console_register(&xenboot_console, keep);
390390
#endif
391-
#ifdef CONFIG_EARLY_PRINTK_EFI
392-
if (!strncmp(buf, "efi", 3))
393-
early_console_register(&early_efi_console, keep);
394-
#endif
395391
#ifdef CONFIG_EARLY_PRINTK_USB_XDBC
396392
if (!strncmp(buf, "xdbc", 4))
397393
early_xdbc_parse_parameter(buf + 4);

arch/x86/platform/efi/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ OBJECT_FILES_NON_STANDARD_efi_thunk_$(BITS).o := y
33
OBJECT_FILES_NON_STANDARD_efi_stub_$(BITS).o := y
44

55
obj-$(CONFIG_EFI) += quirks.o efi.o efi_$(BITS).o efi_stub_$(BITS).o
6-
obj-$(CONFIG_EARLY_PRINTK_EFI) += early_printk.o
76
obj-$(CONFIG_EFI_MIXED) += efi_thunk_$(BITS).o

arch/x86/platform/efi/early_printk.c

Lines changed: 0 additions & 240 deletions
This file was deleted.

drivers/firmware/efi/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,9 @@ config EFI_DEV_PATH_PARSER
198198
bool
199199
depends on ACPI
200200
default n
201+
202+
config EFI_EARLYCON
203+
def_bool y
204+
depends on SERIAL_EARLYCON && !ARM && !IA64
205+
select FONT_SUPPORT
206+
select ARCH_USE_MEMREMAP_PROT

drivers/firmware/efi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ arm-obj-$(CONFIG_EFI) := arm-init.o arm-runtime.o
3030
obj-$(CONFIG_ARM) += $(arm-obj-y)
3131
obj-$(CONFIG_ARM64) += $(arm-obj-y)
3232
obj-$(CONFIG_EFI_CAPSULE_LOADER) += capsule-loader.o
33+
obj-$(CONFIG_EFI_EARLYCON) += earlycon.o
3334
obj-$(CONFIG_UEFI_CPER_ARM) += cper-arm.o
3435
obj-$(CONFIG_UEFI_CPER_X86) += cper-x86.o

0 commit comments

Comments
 (0)