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

Commit daea1175 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt
Browse files

powerpc/powernv: Support for OPAL console



This adds a udbg and an hvc console backend for supporting a console
using the OPAL console interfaces.

On OPAL v1 we have hvc0 mapped to whatever console the system was
configured for (network or hvsi serial port) via the service
processor.

On OPAL v2 we have hvcN mapped to the Nth console provided by OPAL
which generally corresponds to:

	hvc0 : network console (raw protocol)
	hvc1 : serial port S1 (hvsi)
	hvc2 : serial port S2 (hvsi)

Note: At this point, early debug console only works with OPAL v1
and shouldn't be enabled in a normal kernel.

Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 6e35d5da
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -265,8 +265,27 @@ config PPC_EARLY_DEBUG_PS3GELIC
	  Select this to enable early debugging for the PlayStation3 via
	  UDP broadcasts sent out through the Ethernet port.

config PPC_EARLY_DEBUG_OPAL_RAW
	bool "OPAL raw console"
	depends on HVC_OPAL
	help
	  Select this to enable early debugging for the PowerNV platform
	  using a "raw" console

config PPC_EARLY_DEBUG_OPAL_HVSI
	bool "OPAL hvsi console"
	depends on HVC_OPAL
	help
	  Select this to enable early debugging for the PowerNV platform
	  using an "hvsi" console

endchoice

config PPC_EARLY_DEBUG_OPAL
	def_bool y
	depends on PPC_EARLY_DEBUG_OPAL_RAW || PPC_EARLY_DEBUG_OPAL_HVSI


config PPC_EARLY_DEBUG_HVSI_VTERMNO
	hex "vterm number to use with early debug HVSI"
	depends on PPC_EARLY_DEBUG_LPAR_HVSI
@@ -275,6 +294,18 @@ config PPC_EARLY_DEBUG_HVSI_VTERMNO
	  You probably want 0x30000000 for your first serial port and
	  0x30000001 for your second one

config PPC_EARLY_DEBUG_OPAL_VTERMNO
	hex "vterm number to use with OPAL early debug"
	depends on PPC_EARLY_DEBUG_OPAL
	default "0"
	help
	  This correspond to which /dev/hvcN you want to use for early
	  debug.

	  On OPAL v1 (takeover) this should always be 0
	  On OPAL v2, this will be 0 for network console and 1 or 2 for
	  the machine built-in serial ports.

config PPC_EARLY_DEBUG_44x_PHYSLOW
	hex "Low 32 bits of early debug UART physical address"
	depends on PPC_EARLY_DEBUG_44x
+5 −0
Original line number Diff line number Diff line
@@ -425,6 +425,11 @@ extern void hvc_opal_init_early(void);
extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
				   int depth, void *data);

extern int opal_get_chars(uint32_t vtermno, char *buf, int count);
extern int opal_put_chars(uint32_t vtermno, const char *buf, int total_len);

extern void hvc_opal_init_early(void);

#endif /* __ASSEMBLY__ */

#endif /* __OPAL_H */
+2 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@ extern void __init udbg_init_cpm(void);
extern void __init udbg_init_usbgecko(void);
extern void __init udbg_init_wsp(void);
extern void __init udbg_init_ps3gelic(void);
extern void __init udbg_init_debug_opal_raw(void);
extern void __init udbg_init_debug_opal_hvsi(void);

#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_UDBG_H */
+13 −1
Original line number Diff line number Diff line
@@ -53,7 +53,8 @@
 *   2. The kernel is entered at __start
 * -or- For OPAL entry:
 *   1. The MMU is off, processor in HV mode, primary CPU enters at 0
 *      with device-tree in gpr3
 *      with device-tree in gpr3. We also get OPAL base in r8 and
 *	entry in r9 for debugging purposes
 *   2. Secondary processors enter at 0x60 with PIR in gpr3
 *
 *  For iSeries:
@@ -335,6 +336,11 @@ _GLOBAL(__start_initialization_multiplatform)
	/* Save parameters */
	mr	r31,r3
	mr	r30,r4
#ifdef CONFIG_PPC_EARLY_DEBUG_OPAL
	/* Save OPAL entry */
	mr	r28,r8
	mr	r29,r9
#endif

#ifdef CONFIG_PPC_BOOK3E
	bl	.start_initialization_book3e
@@ -711,6 +717,12 @@ _INIT_STATIC(start_here_multiplatform)
	bdnz	3b
4:

#ifdef CONFIG_PPC_EARLY_DEBUG_OPAL
	/* Setup OPAL entry */
	std	r28,0(r11);
	std	r29,8(r11);
#endif

#ifndef CONFIG_PPC_BOOK3E
	mfmsr	r6
	ori	r6,r6,MSR_RI
+4 −0
Original line number Diff line number Diff line
@@ -69,6 +69,10 @@ void __init udbg_early_init(void)
	udbg_init_wsp();
#elif defined(CONFIG_PPC_EARLY_DEBUG_PS3GELIC)
	udbg_init_ps3gelic();
#elif defined(CONFIG_PPC_EARLY_DEBUG_OPAL_RAW)
	udbg_init_debug_opal_raw();
#elif defined(CONFIG_PPC_EARLY_DEBUG_OPAL_HVSI)
	udbg_init_debug_opal_hvsi();
#endif

#ifdef CONFIG_PPC_EARLY_DEBUG
Loading