Skip to contentSkip to conversation

x86: WIP: Enable debug UART for Minnowmax

PATCH Superseded Simon Glass 2 participants 2 messages Jun 3, 2015 – Jun 8, 2015 x86

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: WIP: Enable debug UART for Minnowmax

Enable the debug UART and emit a single 'a' early in the init sequence to show that it is working.

Unfortunately the debug UART implementation needs a stack to work. I cannot seem to remove this limitation as the absolute 'jmp %eax' instruction goes off into the weeds.

So this means that the character output cannot be any earlier than car_init_ret, where memory is available for a stack.

---

 arch/x86/cpu/start.S        |  4 ++++
 configs/minnowmax_defconfig |  4 ++++
 include/debug_uart.h        | 20 ++++++++++----------
 3 files changed, 18 insertions(+), 10 deletions(-)
arch/x86/cpu/start.S +4 -0
index 2e5f9da..c6965b2 100644
@@ -109,6 +109,10 @@ car_init_ret:
 	andl	$0xfffffff0, %esp
 	post_code(POST_START_STACK)
 
+	call	debug_uart_init
+	mov	$'a', %eax
+	call	printch
+
 	/* Zero the global data since it won't happen later */
 	xorl	%eax, %eax
 	movl	$GENERATED_GBL_DATA_SIZE, %ecx
configs/minnowmax_defconfig +4 -0
index 744aca3..14e21fa 100644
@@ -12,3 +12,7 @@ CONFIG_CMD_CPU=y
 CONFIG_CMD_NET=y
 CONFIG_OF_CONTROL=y
 CONFIG_CPU=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_NS16550=y
+CONFIG_DEBUG_UART_BASE=0x3f8
+CONFIG_DEBUG_UART_CLOCK=1843200
include/debug_uart.h +10 -10
index f56797b..0acc91c 100644
@@ -64,46 +64,46 @@ void debug_uart_init(void);
  *
  * @ch:		Character to output
  */
-asmlinkage void printch(int ch);
+void printch(int ch);
 
 /**
  * printascii() - Output an ASCII string to the debug UART
  *
  * @str:	String to output
  */
-asmlinkage void printascii(const char *str);
+void printascii(const char *str);
 
 /**
  * printhex2() - Output a 2-digit hex value
  *
  * @value:	Value to output
  */
-asmlinkage void printhex2(uint value);
+void printhex2(uint value);
 
 /**
  * printhex4() - Output a 4-digit hex value
  *
  * @value:	Value to output
  */
-asmlinkage void printhex4(uint value);
+void printhex4(uint value);
 
 /**
  * printhex8() - Output a 8-digit hex value
  *
  * @value:	Value to output
  */
-asmlinkage void printhex8(uint value);
+void printhex8(uint value);
 
 /*
  * Now define some functions - this should be inserted into the serial driver
  */
 #define DEBUG_UART_FUNCS \
-	asmlinkage void printch(int ch) \
+	void printch(int ch) \
 	{ \
 		_debug_uart_putc(ch); \
 	} \
 \
-	asmlinkage void printascii(const char *str) \
+	void printascii(const char *str) \
 	{ \
 		while (*str) \
 			_debug_uart_putc(*str++); \
@@ -121,17 +121,17 @@ asmlinkage void printhex8(uint value);
 			printhex1(value >> (4 * digits)); \
 	} \
 \
-	asmlinkage void printhex2(uint value) \
+	void printhex2(uint value) \
 	{ \
 		printhex(value, 2); \
 	} \
 \
-	asmlinkage void printhex4(uint value) \
+	void printhex4(uint value) \
 	{ \
 		printhex(value, 4); \
 	} \
 \
-	asmlinkage void printhex8(uint value) \
+	void printhex8(uint value) \
 	{ \
 		printhex(value, 8); \
 	}
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#1 lore raw

PATCH 1/1 x86: WIP: Enable debug UART for Minnowmax

Hi Simon,

Quoted 114 lines

Enable the debug UART and emit a single 'a' early in the init sequence to show that it is working.

Unfortunately the debug UART implementation needs a stack to work. I cannot seem to remove this limitation as the absolute 'jmp %eax' instruction goes off into the weeds.

So this means that the character output cannot be any earlier than car_init_ret, where memory is available for a stack.

---

 arch/x86/cpu/start.S        |  4 ++++
 configs/minnowmax_defconfig |  4 ++++
 include/debug_uart.h        | 20 ++++++++++----------
 3 files changed, 18 insertions(+), 10 deletions(-)
arch/x86/cpu/start.S +4 -0
index 2e5f9da..c6965b2 100644
@@ -109,6 +109,10 @@ car_init_ret:
 	andl	$0xfffffff0, %esp
 	post_code(POST_START_STACK)
 
+	call	debug_uart_init
+	mov	$'a', %eax
+	call	printch
+
 	/* Zero the global data since it won't happen later */
 	xorl	%eax, %eax
 	movl	$GENERATED_GBL_DATA_SIZE, %ecx
configs/minnowmax_defconfig +4 -0
index 744aca3..14e21fa 100644
@@ -12,3 +12,7 @@ CONFIG_CMD_CPU=y
 CONFIG_CMD_NET=y
 CONFIG_OF_CONTROL=y
 CONFIG_CPU=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_NS16550=y
+CONFIG_DEBUG_UART_BASE=0x3f8
+CONFIG_DEBUG_UART_CLOCK=1843200
include/debug_uart.h +5 -5
index f56797b..0acc91c 100644
@@ -64,46 +64,46 @@ void debug_uart_init(void);
  *
  * @ch:		Character to output
  */
-asmlinkage void printch(int ch);
+void printch(int ch);
 
 /**
  * printascii() - Output an ASCII string to the debug UART
  *
  * @str:	String to output
  */
-asmlinkage void printascii(const char *str);
+void printascii(const char *str);
 
 /**
  * printhex2() - Output a 2-digit hex value
  *
  * @value:	Value to output
  */
-asmlinkage void printhex2(uint value);
+void printhex2(uint value);
 
 /**
  * printhex4() - Output a 4-digit hex value
  *
  * @value:	Value to output
  */
-asmlinkage void printhex4(uint value);
+void printhex4(uint value);
 
 /**
  * printhex8() - Output a 8-digit hex value
  *
  * @value:	Value to output
  */
-asmlinkage void printhex8(uint value);
+void printhex8(uint value);
 
 /*
  * Now define some functions - this should be inserted into the

serial driver */
#define DEBUG_UART_FUNCS \

include/debug_uart.h +3 -4
-	asmlinkage void printch(int ch) \
+	void printch(int ch) \
 	{ \
 		_debug_uart_putc(ch); \
 	} \
 \
-	asmlinkage void printascii(const char *str) \
+	void printascii(const char *str) \
 	{ \
 		while (*str) \
 			_debug_uart_putc(*str++); \
@@ -121,17 +121,17 @@ asmlinkage void printhex8(uint value);
 			printhex1(value >> (4 * digits)); \
 	} \
 \
-	asmlinkage void printhex2(uint value) \
+	void printhex2(uint value) \
 	{ \
 		printhex(value, 2); \
 	} \
 \
-	asmlinkage void printhex4(uint value) \

include/debug_uart.h asmlinkage void printhex8(uint value); · line 137

Quoted 10 lines
include/debug_uart.h +2 -1
+	void printhex4(uint value) \
 	{ \
 		printhex(value, 4); \
 	} \
 \
-	asmlinkage void printhex8(uint value) \
+	void printhex8(uint value) \
 	{ \
 		printhex(value, 8); \
 	}

This is not quite my domain :-) (Although, I'd like to have a Minnowmax for testing).

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group