Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbarm/rockchip Copy cmdline from U-Boot to bootargs.



details:   https://anonhg.NetBSD.org/src/rev/48096517bfa4
branches:  trunk
changeset: 335171:48096517bfa4
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Dec 28 21:34:33 2014 +0000

description:
Copy cmdline from U-Boot to bootargs.

diffstat:

 sys/arch/evbarm/rockchip/rockchip_machdep.c |  58 +++++++++++++++++++++++++---
 sys/arch/evbarm/rockchip/rockchip_start.S   |   6 +-
 2 files changed, 54 insertions(+), 10 deletions(-)

diffs (117 lines):

diff -r ed9a96c744a7 -r 48096517bfa4 sys/arch/evbarm/rockchip/rockchip_machdep.c
--- a/sys/arch/evbarm/rockchip/rockchip_machdep.c       Sun Dec 28 16:29:21 2014 +0000
+++ b/sys/arch/evbarm/rockchip/rockchip_machdep.c       Sun Dec 28 21:34:33 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rockchip_machdep.c,v 1.9 2014/12/28 16:03:51 jmcneill Exp $ */
+/*     $NetBSD: rockchip_machdep.c,v 1.10 2014/12/28 21:34:33 jmcneill Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rockchip_machdep.c,v 1.9 2014/12/28 16:03:51 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rockchip_machdep.c,v 1.10 2014/12/28 21:34:33 jmcneill Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -395,6 +395,49 @@
        return memsize;
 }
 
+#define ATAG_NONE      0x00000000
+#define ATAG_CORE      0x54410001
+#define ATAG_CMDLINE   0x54410009
+
+static void
+rockchip_parse_atag(u_int atag_base)
+{
+       uint32_t *p = (uint32_t *)atag_base;
+       int count;
+
+       /* List must start with ATAG_CORE */
+       if (p[0] != 5 || p[1] != ATAG_CORE) {
+               return;
+       }
+
+       for (count = 0; count < 100; count++) {
+               uint32_t size = p[0];
+               uint32_t tag = p[1];
+
+#ifdef VERBOSE_INIT_ARM
+               printf("ATAG: #%d - tag %#x size %d\n",
+                   count, tag, size);
+#endif
+
+               if (tag == ATAG_NONE)
+                       break;
+
+               switch (tag) {
+               case ATAG_CMDLINE:
+                       strlcpy(bootargs, (char *)&p[2], sizeof(bootargs));
+#ifdef VERBOSE_INIT_ARM
+                       printf("ATAG_CMDLINE: \"%s\"\n", bootargs);
+#endif
+                       break;
+               }
+
+               p += size;
+
+               if (++count == 100)
+                       break;
+       }
+}
+
 /*
  * u_int initarm(...)
  *
@@ -525,12 +568,13 @@
        arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_LOW, 0, devmap,
            mapallmem_p);
 
-#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
-       /* "bootargs" env variable is passed as 4th argument to kernel */
-       if (uboot_args[3] - 0x80000000 < ram_size) {
-               strlcpy(bootargs, (char *)uboot_args[3], sizeof(bootargs));
+       if (mapallmem_p) {
+               /* "bootargs" atag start is passed as 3rd argument to kernel */
+               if (uboot_args[2] - 0x60000000 < ram_size) {
+                       rockchip_parse_atag(uboot_args[2] + KERNEL_BASE_VOFFSET);
+               }
        }
-#endif
+
        boot_args = bootargs;
        parse_mi_bootargs(boot_args);
 
diff -r ed9a96c744a7 -r 48096517bfa4 sys/arch/evbarm/rockchip/rockchip_start.S
--- a/sys/arch/evbarm/rockchip/rockchip_start.S Sun Dec 28 16:29:21 2014 +0000
+++ b/sys/arch/evbarm/rockchip/rockchip_start.S Sun Dec 28 21:34:33 2014 +0000
@@ -43,7 +43,7 @@
 
 #include <arm/cortex/scu_reg.h>
 
-RCSID("$NetBSD: rockchip_start.S,v 1.2 2014/12/28 16:03:51 jmcneill Exp $")
+RCSID("$NetBSD: rockchip_start.S,v 1.3 2014/12/28 21:34:33 jmcneill Exp $")
 
 #if defined(VERBOSE_INIT_ARM)
 #define        XPUTC(n)        mov r0, n; bl xputc
@@ -87,7 +87,7 @@
 
        /* Move into supervisor mode and disable IRQs/FIQs. */
        cpsid   if, #PSR_SVC32_MODE
-#if 0
+
        /*
         * Save any arguments passed to us.
         */
@@ -104,7 +104,7 @@
 #endif
 
        stmia   r4, {r0-r3}             // Save the arguments
-#endif
+
        /*
         * Turn on the SMP bit
         */



Home | Main Index | Thread Index | Old Index