Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/evbarm/odroid Redo the magic of console selection



details:   https://anonhg.NetBSD.org/src/rev/400d5d18add7
branches:  trunk
changeset: 802677:400d5d18add7
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Fri Sep 26 18:59:29 2014 +0000

description:
Redo the magic of console selection

diffstat:

 sys/arch/evbarm/odroid/odroid_machdep.c |  52 +++++---------------------------
 sys/arch/evbarm/odroid/odroid_start.S   |  29 +++++++++++++++---
 2 files changed, 33 insertions(+), 48 deletions(-)

diffs (160 lines):

diff -r 17d6d1930a6e -r 400d5d18add7 sys/arch/evbarm/odroid/odroid_machdep.c
--- a/sys/arch/evbarm/odroid/odroid_machdep.c   Fri Sep 26 18:26:24 2014 +0000
+++ b/sys/arch/evbarm/odroid/odroid_machdep.c   Fri Sep 26 18:59:29 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: odroid_machdep.c,v 1.35 2014/09/24 20:38:33 reinoud Exp $ */
+/*     $NetBSD: odroid_machdep.c,v 1.36 2014/09/26 18:59:29 reinoud Exp $ */
 
 /*
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.35 2014/09/24 20:38:33 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.36 2014/09/26 18:59:29 reinoud Exp $");
 
 #include "opt_evbarm_boardtype.h"
 #include "opt_exynos.h"
@@ -108,44 +108,9 @@
 #include <arm/samsung/sscom_var.h>
 #include <arm/samsung/sscom_reg.h>
 
-static const struct sscom_uart_info exynos_uarts[] = {
-#ifdef EXYNOS5
-       {
-               .unit    = 0,
-               .iobase = EXYNOS5_UART0_OFFSET
-       },
-       {
-               .unit    = 1,
-               .iobase = EXYNOS5_UART1_OFFSET
-       },
-       {
-               .unit    = 2,
-               .iobase = EXYNOS5_UART2_OFFSET
-       },
-       {
-               .unit    = 3,
-               .iobase = EXYNOS5_UART3_OFFSET
-       },
-#endif
-#ifdef EXYNOS4
-       {
-               .unit    = 0,
-               .iobase = EXYNOS4_UART0_OFFSET
-       },
-       {
-               .unit    = 1,
-               .iobase = EXYNOS4_UART1_OFFSET
-       },
-       {
-               .unit    = 2,
-               .iobase = EXYNOS4_UART2_OFFSET
-       },
-       {
-               .unit    = 3,
-               .iobase = EXYNOS4_UART3_OFFSET
-       },
-#endif
-};
+extern const int num_exynos_uarts_entries;
+extern const struct sscom_uart_info exynos_uarts[];
+KASSERT(sizeof(struct sscom_uart_info) == 8);
 
 /* sanity checks for serial console */
 #ifndef CONSPEED
@@ -161,7 +126,7 @@
 //static const bus_addr_t conaddr = CONADDR;
 static const int conspeed = CONSPEED;
 static const int conmode = CONMODE;
-#endif /*defined(KGDB) || defined(SSCOM0CONSOLE) || defined(SSCOM1CONSOLE) */
+#endif /*defined(KGDB) || defined(SSCOM*CONSOLE) */
 
 /*
  * uboot passes 4 arguments to us.
@@ -458,12 +423,13 @@
        freq = (freq + conspeed / 2) / 1000;
        freq *= 1000;
 
-       for (i = 0; i < __arraycount(exynos_uarts); i++) {
+       /* go trough all entries */
+       for (i = 0; i < num_exynos_uarts_entries; i++) {
                /* attach console */
                if (exynos_uarts[i].iobase + EXYNOS_CORE_PBASE == iobase)
                        break;
        }
-       KASSERT(i < __arraycount(exynos_uarts));
+       KASSERT(i < num_exynos_uarts_entries);
        printf("%s: attaching console @ %#"PRIxPTR" (%u HZ, %u bps)\n",
            __func__, iobase, freq, conspeed);
        if (sscom_cnattach(bst, exynos_core_bsh, &exynos_uarts[i],
diff -r 17d6d1930a6e -r 400d5d18add7 sys/arch/evbarm/odroid/odroid_start.S
--- a/sys/arch/evbarm/odroid/odroid_start.S     Fri Sep 26 18:26:24 2014 +0000
+++ b/sys/arch/evbarm/odroid/odroid_start.S     Fri Sep 26 18:59:29 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: odroid_start.S,v 1.4 2014/09/26 18:26:24 reinoud Exp $ */
+/*     $NetBSD: odroid_start.S,v 1.5 2014/09/26 18:59:29 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
 
 #include <evbarm/odroid/platform.h>
 
-RCSID("$NetBSD: odroid_start.S,v 1.4 2014/09/26 18:26:24 reinoud Exp $")
+RCSID("$NetBSD: odroid_start.S,v 1.5 2014/09/26 18:59:29 reinoud Exp $")
 
 
 #if defined(VERBOSE_INIT_ARM)
@@ -186,10 +186,16 @@
        adr     r1, .Lsscom_exynos5_table
 #endif
 #ifdef SSCOM0CONSOLE
-       ldr     r2, [r1, #0]
+       ldr     r2, [r1, #0*8+4]
 #endif
 #ifdef SSCOM1CONSOLE
-       ldr     r2, [r1, #4]
+       ldr     r2, [r1, #1*8+4]
+#endif
+#ifdef SSCOM2CONSOLE
+       ldr     r2, [r1, #2*8+4]
+#endif
+#ifdef SSCOM3CONSOLE
+       ldr     r2, [r1, #3*8+4]
 #endif
        add     r2, r2, #EXYNOS_CORE_PBASE
        mcr     p15, 0, r2, c13, c0, 3          // TPIDRURO set (uart address)
@@ -244,17 +250,30 @@
 
        /* NOTREACHED */
 
-
+       .align 0
+       .global _C_LABEL(num_exynos_uarts_entries)
+_C_LABEL(num_exynos_uarts_entries):
+       .word   8                               // update number of entries!!!
+       .global _C_LABEL(exynos_uarts)
+_C_LABEL(exynos_uarts):
 .Lsscom_exynos4_table:
+       .word   0
        .word   EXYNOS4_UART0_OFFSET
+       .word   1
        .word   EXYNOS4_UART1_OFFSET
+       .word   2
        .word   EXYNOS4_UART2_OFFSET
+       .word   3
        .word   EXYNOS4_UART3_OFFSET
 
 .Lsscom_exynos5_table:
+       .word   0
        .word   EXYNOS5_UART0_OFFSET
+       .word   1
        .word   EXYNOS5_UART1_OFFSET
+       .word   2
        .word   EXYNOS5_UART2_OFFSET
+       .word   3
        .word   EXYNOS5_UART3_OFFSET
 
 



Home | Main Index | Thread Index | Old Index