xen/arm: UART addresses are not always aligned to a page.
authorJon Fraser <jfraser@broadcom.com>
Thu, 31 Oct 2013 19:37:38 +0000 (15:37 -0400)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 1 Nov 2013 13:09:14 +0000 (13:09 +0000)
When calculating the virtual address of the UART,
add the page offset of the UART to the mapped address.

Create define EARLY_UART_VIRTUAL_ADDRESS and use instead
of FIXMAP_ADDR(FIXMAP_CONSOLE)

Signed-off-by: Jon Fraser <jfraser@broadcom.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/arm32/debug.S
xen/arch/arm/arm32/head.S
xen/arch/arm/arm64/debug.S
xen/arch/arm/arm64/head.S
xen/include/asm-arm/early_printk.h

index ec774cddadbe67e9e859d957a51bbdbf382b9680..a95d9dadfbfdaef32511da658c89403c3cae2e06 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <asm/config.h>
+#include <asm/early_printk.h>
 
 #ifdef EARLY_PRINTK_INC
 #include EARLY_PRINTK_INC
 /* Print a character on the UART - this function is called by C
  * r0: character to print */
 GLOBAL(early_putch)
-        ldr   r1, =FIXMAP_ADDR(FIXMAP_CONSOLE)  /* r1 := VA UART base address */
+        ldr   r1, =EARLY_UART_VIRTUAL_ADDRESS  /* r1 := VA UART base address */
         early_uart_ready r1, r2
         early_uart_transmit r1, r0
         mov   pc, lr
 
 /* Flush the UART - this function is called by C */
 GLOBAL(early_flush)
-        ldr   r1, =FIXMAP_ADDR(FIXMAP_CONSOLE)  /* r1 := VA UART base address */
+        ldr   r1, =EARLY_UART_VIRTUAL_ADDRESS  /* r1 := VA UART base address */
         early_uart_ready r1, r2
         mov   pc, lr
 
index ce1d21a8e380adcaa5d862a4281c67231eade5f2..96230ac891e27aa23cbfc96b040578c0c00a1a12 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/processor-ca15.h>
 #include <asm/processor-ca7.h>
 #include <asm/asm_defns.h>
+#include <asm/early_printk.h>
 
 #define ZIMAGE_MAGIC_NUMBER 0x016f2818
 
@@ -356,7 +357,7 @@ paging:
         strd  r2, r3, [r1, r4]       /* Map it in the fixmap's slot */
 
         /* Use a virtual address to access the UART. */
-        ldr   r11, =FIXMAP_ADDR(FIXMAP_CONSOLE)
+        ldr   r11, =EARLY_UART_VIRTUAL_ADDRESS
 #endif
         /* Map the DTB in the boot misc slot */
         teq   r12, #0                /* Only on boot CPU */
index 472c15716004d17786f4d7771147c015b01ab8c8..a855358ac46d475358cd8b6bcde4169faf5d1803 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <asm/config.h>
+#include <asm/early_printk.h>
 
 #ifdef EARLY_PRINTK_INC
 #include EARLY_PRINTK_INC
 /* Print a character on the UART - this function is called by C
  * x0: character to print */
 GLOBAL(early_putch)
-        ldr   x15, =FIXMAP_ADDR(FIXMAP_CONSOLE)
+        ldr   x15, =EARLY_UART_VIRTUAL_ADDRESS
         early_uart_ready x15, 1
         early_uart_transmit x15, w0
         ret
 
 /* Flush the UART - this function is called by C */
 GLOBAL(early_flush)
-        ldr   x15, =FIXMAP_ADDR(FIXMAP_CONSOLE)  /* x15 := VA UART base address */
+        ldr   x15, =EARLY_UART_VIRTUAL_ADDRESS  /* x15 := VA UART base address */
         early_uart_ready x15, 1
         ret
 
index b8b5902b5830138a73f4b575e41504fac613ed9f..31afdd06f2826c647ff5109f07e228307fbb548a 100644 (file)
@@ -23,6 +23,7 @@
 #include <asm/config.h>
 #include <asm/page.h>
 #include <asm/asm_defns.h>
+#include <asm/early_printk.h>
 
 #define PT_PT     0xe7f /* nG=1 AF=1 SH=10 AP=01 NS=1 ATTR=111 T=1 P=1 */
 #define PT_MEM    0xe7d /* nG=1 AF=1 SH=10 AP=01 NS=1 ATTR=111 T=0 P=1 */
@@ -368,7 +369,7 @@ paging:
         str   x2, [x4, x1]           /* Map it in the fixmap's slot */
 
         /* Use a virtual address to access the UART. */
-        ldr   x23, =FIXMAP_ADDR(FIXMAP_CONSOLE)
+        ldr   x23, =EARLY_UART_VIRTUAL_ADDRESS
 #endif
 
         /* Map the DTB in the boot misc slot */
index 5f7c52956e91988baaa3d2b2f68ee898ea52c800..707bbf7890ed98db5650d3c49d5755ff512d86af 100644 (file)
 
 #ifdef EARLY_PRINTK
 
+/* need to add the uart address offset in page to the fixmap address */
+#define EARLY_UART_VIRTUAL_ADDRESS \
+    (FIXMAP_ADDR(FIXMAP_CONSOLE) +(EARLY_UART_BASE_ADDRESS & ~PAGE_MASK))
+
+#endif
+
+#ifndef __ASSEMBLY__
+
+#ifdef EARLY_PRINTK
+
 void early_printk(const char *fmt, ...)
     __attribute__((format (printf, 1, 2)));
 void early_panic(const char *fmt, ...) __attribute__((noreturn))
@@ -31,4 +41,6 @@ __attribute__((format (printf, 1, 2))) early_panic(const char *fmt, ...)
 
 #endif
 
+#endif /* __ASSEMBLY__ */
+
 #endif