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

Commit 2475ff9d authored by Catalin Marinas's avatar Catalin Marinas
Browse files

arm64: Add simple earlyprintk support



This patch adds support for "earlyprintk=" parameter on the kernel
command line. The format is:

  earlyprintk=<name>[,<addr>][,<options>]

where <name> is the name of the (UART) device, e.g. "pl011", <addr> is
the I/O address. The <options> aren't currently used.

The mapping of the earlyprintk device is done very early during kernel
boot and there are restrictions on which functions it can call. A
special early_io_map() function is added which creates the mapping from
the pre-defined EARLY_IOBASE to the device I/O address passed via the
kernel parameter. The pgd entry corresponding to EARLY_IOBASE is
pre-populated in head.S during kernel boot.

Only PL011 is currently supported and it is assumed that the interface
is already initialised by the boot loader before the kernel is started.

Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
parent d6bafb9b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ ffffffbc00000000 ffffffbdffffffff 8GB vmemmap

ffffffbe00000000	ffffffbffbbfffff	  ~8GB		[guard, future vmmemap]

ffffffbffbc00000	ffffffbffbdfffff	   2MB		earlyprintk device

ffffffbffbe00000	ffffffbffbe0ffff	  64KB		PCI I/O space

ffffffbbffff0000	ffffffbcffffffff	  ~2MB		[guard]
+9 −0
Original line number Diff line number Diff line
@@ -24,4 +24,13 @@ config DEBUG_STACK_USAGE
	  Enables the display of the minimum amount of free stack which each
	  task has ever had available in the sysrq-T output.

config EARLY_PRINTK
	bool "Early printk support"
	default y
	help
	  Say Y here if you want to have an early console using the
	  earlyprintk=<name>[,<addr>][,<options>] kernel parameter. It
	  is assumed that the early console device has been initialised
	  by the boot loader prior to starting the Linux kernel.

endmenu
+3 −0
Original line number Diff line number Diff line
@@ -230,6 +230,9 @@ extern void __iounmap(volatile void __iomem *addr);
#define ioremap_wc(addr, size)		__ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
#define iounmap				__iounmap

#define PROT_SECT_DEFAULT	(PMD_TYPE_SECT | PMD_SECT_AF)
#define PROT_SECT_DEVICE_nGnRE	(PROT_SECT_DEFAULT | PTE_PXN | PTE_UXN | PMD_ATTRINDX(MT_DEVICE_nGnRE))

#define ARCH_HAS_IOREMAP_WC
#include <asm-generic/iomap.h>

+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
#define PAGE_OFFSET		UL(0xffffffc000000000)
#define MODULES_END		(PAGE_OFFSET)
#define MODULES_VADDR		(MODULES_END - SZ_64M)
#define EARLYCON_IOBASE		(MODULES_VADDR - SZ_4M)
#define VA_BITS			(39)
#define TASK_SIZE_64		(UL(1) << VA_BITS)

+1 −0
Original line number Diff line number Diff line
@@ -26,5 +26,6 @@ typedef struct {

extern void paging_init(void);
extern void setup_mm_for_reboot(void);
extern void __iomem *early_io_map(phys_addr_t phys, unsigned long virt);

#endif
Loading