Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72548e83 authored by Matt Fleming's avatar Matt Fleming
Browse files

x86/efi: Add EFI framebuffer earlyprintk support



It's incredibly difficult to diagnose early EFI boot issues without
special hardware because earlyprintk=vga doesn't work on EFI systems.

Add support for writing to the EFI framebuffer, via earlyprintk=efi,
which will actually give users a chance of providing debug output.

Cc: H. Peter Anvin <hpa@zytor.com>
Acked-by: default avatarIngo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Jones <pjones@redhat.com>
Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
parent c158c3bf
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -792,6 +792,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.

	earlyprintk=	[X86,SH,BLACKFIN,ARM]
			earlyprintk=vga
			earlyprintk=efi
			earlyprintk=xen
			earlyprintk=serial[,ttySn[,baudrate]]
			earlyprintk=serial[,0x...[,baudrate]]
@@ -805,7 +806,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
			Append ",keep" to not disable it when the real console
			takes over.

			Only vga or serial or usb debug port at a time.
			Only one of vga, efi, serial, or usb debug port can
			be used at a time.

			Currently only ttyS0 and ttyS1 may be specified by
			name.  Other I/O ports may be explicitly specified
@@ -819,8 +821,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
			Interaction with the standard serial driver is not
			very good.

			The VGA output is eventually overwritten by the real
			console.
			The VGA and EFI output is eventually overwritten by
			the real console.

			The xen output can only be used by Xen PV guests.

+10 −0
Original line number Diff line number Diff line
@@ -59,6 +59,16 @@ config EARLY_PRINTK_DBGP
	  with klogd/syslogd or the X server. You should normally N here,
	  unless you want to debug such a crash. You need usb debug device.

config EARLY_PRINTK_EFI
	bool "Early printk via the EFI framebuffer"
	depends on EFI && EARLY_PRINTK
	select FONT_SUPPORT
	---help---
	  Write kernel log output directly into the EFI framebuffer.

	  This is useful for kernel debugging when your machine crashes very
	  early before the console code is initialized.

config X86_PTDUMP
	bool "Export kernel pagetable layout to userspace via debugfs"
	depends on DEBUG_KERNEL
+2 −0
Original line number Diff line number Diff line
@@ -109,6 +109,8 @@ static inline bool efi_is_native(void)
	return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT);
}

extern struct console early_efi_console;

#else
/*
 * IF EFI is not configured, have the EFI calls return -ENOSYS.
+7 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
#include <asm/mrst.h>
#include <asm/pgtable.h>
#include <linux/usb/ehci_def.h>
#include <linux/efi.h>
#include <asm/efi.h>

/* Simple VGA output */
#define VGABASE		(__ISA_IO_base + 0xb8000)
@@ -234,6 +236,11 @@ static int __init setup_early_printk(char *buf)
			early_console_register(&early_hsu_console, keep);
		}
#endif
#ifdef CONFIG_EARLY_PRINTK_EFI
		if (!strncmp(buf, "efi", 3))
			early_console_register(&early_efi_console, keep);
#endif

		buf++;
	}
	return 0;
+1 −0
Original line number Diff line number Diff line
obj-$(CONFIG_EFI) 		+= efi.o efi_$(BITS).o efi_stub_$(BITS).o
obj-$(CONFIG_ACPI_BGRT) += efi-bgrt.o
obj-$(CONFIG_EARLY_PRINTK_EFI)	+= early_printk.o
Loading