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 small cleanup of odroid_start.S



details:   https://anonhg.NetBSD.org/src/rev/766416c748bd
branches:  trunk
changeset: 811680:766416c748bd
user:      marty <marty%NetBSD.org@localhost>
date:      Tue Nov 10 23:47:08 2015 +0000

description:
small cleanup of odroid_start.S

removed attempt to 'rescue bootargs' that was causing a hang and isn't needed
anyway.

changed calls to XPUTC to use text constants rather than ascii decimal
equivalents.

adopted some of the techniques used in awin_start.s for reducing code and
improving performance.

polluted the namespace with _XPUTC so that xputc can be used from C code
before early console is enabled.  (Due to tracking a bug in early console
initialization.)

replaced a hardwired constant with the proper mannifest in the definition
of TEMP_L1_TABLE

This still needs MP support added but it should continue to work for XU3
while starting to work for XU4

diffstat:

 sys/arch/evbarm/odroid/odroid_start.S |  119 ++++++++++-----------------------
 1 files changed, 36 insertions(+), 83 deletions(-)

diffs (212 lines):

diff -r ad1dcfd13480 -r 766416c748bd sys/arch/evbarm/odroid/odroid_start.S
--- a/sys/arch/evbarm/odroid/odroid_start.S     Tue Nov 10 23:09:13 2015 +0000
+++ b/sys/arch/evbarm/odroid/odroid_start.S     Tue Nov 10 23:47:08 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: odroid_start.S,v 1.6 2014/10/02 12:12:55 skrll Exp $   */
+/*     $NetBSD: odroid_start.S,v 1.7 2015/11/10 23:47:08 marty Exp $   */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -46,13 +46,16 @@
 
 #include <evbarm/odroid/platform.h>
 
-RCSID("$NetBSD: odroid_start.S,v 1.6 2014/10/02 12:12:55 skrll Exp $")
+RCSID("$NetBSD: odroid_start.S,v 1.7 2015/11/10 23:47:08 marty Exp $")
 
 
 #if defined(VERBOSE_INIT_ARM)
-
 #define        XPUTC(n)        mov r0, n; bl xputc
+#if KERNEL_BASE_VOFFSET == 0
+#define        XPUTC2(n)       mov r0, n; bl xputc
+#else
 #define        XPUTC2(n)       mov r0, n; blx r11
+#endif
 #ifdef __ARMEB__
 #define COM_BSWAP
 #endif
@@ -62,8 +65,7 @@
 #endif
 
 #define INIT_MEMSIZE   128
-
-#define        TEMP_L1_TABLE   (KERNEL_BASE - KERNEL_BASE_VOFFSET + INIT_MEMSIZE * 0x100000 - L1_TABLE_SIZE)
+#define        TEMP_L1_TABLE   (KERNEL_BASE - KERNEL_BASE_VOFFSET + INIT_MEMSIZE * L1_S_SIZE - L1_TABLE_SIZE)
 
 #define        MD_CPU_HATCH    _C_LABEL(exynos_cpu_hatch)
 
@@ -72,8 +74,12 @@
  * At this point, this code has been loaded into SDRAM
  * and the MMU is off
  */
+#ifdef KERNEL_BASES_EQUAL
+       .text
+#else
        .section .start,"ax",%progbits
-
+#endif
+       
        .global _C_LABEL(odroid_start)
 _C_LABEL(odroid_start):
 #ifdef __ARMEB__
@@ -91,75 +97,16 @@
         */
        movw    r4, #:lower16:uboot_args
        movt    r4, #:upper16:uboot_args
-       sub     r4, r4, #KERNEL_BASE_VOFFSET
-       stmia   r4, {r0-r3}                     // Save the arguments
-
-       /*
-        * Rescue passed "bootargs" env variable. This is not trivial
-        * since we can be booted using either `go' or trough `bootm'.
-        *
-        * 'go' passes R0 = argc, R1 = argv
-        * 'bootm' passes R0 = uboot_bootinfo, R3 = bootargs
-        */
-
-       movw    r4, #:lower16:bootargs
-       movt    r4, #:upper16:bootargs
+#if KERNEL_BASE_VOFFSET != 0
        sub     r4, r4, #KERNEL_BASE_VOFFSET
-
-       cmp     r0, #0
-       beq     1f
-       cmp     r0, #MAX_BOOT_STRING
-       bge     1f
-
-       /* `go' method */
-       cmp     r0, #1                                  // extra argument?
-       beq     3f
-       ldr     r5, [r1, #4]                            // load argv[1]
-2:
-       ldrb    r0, [r5], #1
-       strb    r0, [r4], #1
-       teq     r0, #0
-       bne     2b
-
-       b       3f
-1:
-       /* `bootm' method */
-       mov     r6, r0                                  // save binfo pointer
-
-       cmp     r3, #0
-       beq     1f
-2:
-       ldrb    r0, [r3], #1
-       strb    r0, [r4], #1
-       teq     r0, #0
-       bne     2b
-
-1:
-       cmp     r6, #0                                  // binfo passed?
-       beq     3f
-
-       add     r6, r6, #0x250                          // to eth addr
-
-       movw    r4, #:lower16:uboot_enaddr
-       movt    r4, #:upper16:uboot_enaddr
-       mov     r2, #6
-2:
-       ldrb    r0, [r6], #1
-       strb    r0, [r4], #1
-       subs    r2, r2, #1
-       bne     2b
-       
-3:
+#endif
+       stmia   r4, {r0-r3}                     // Save the arguments
 
        /*
         * For easy and early SoC / PoP dependency, retrieve the IDs
         */
-#if 1
-       mov     r6, #EXYNOS_CORE_PBASE
-#else
        movw    r6, #:lower16:EXYNOS_CORE_PBASE
        movt    r6, #:upper16:EXYNOS_CORE_PBASE
-#endif
 
        ldr     r0, [r6, #EXYNOS_PROD_ID_OFFSET]        // load soc_id
 
@@ -205,49 +152,53 @@
         */
        bl      cortex_init
 
-       XPUTC(#67)
+       XPUTC(#'C')
 
        /*
         * Set up a preliminary mapping in the MMU to allow us to run
         * at KERNEL_BASE with caches on.
         */
-       adr     r1, .Lmmu_init_table
        movw    r0, #:lower16:TEMP_L1_TABLE
        movt    r0, #:upper16:TEMP_L1_TABLE
+       movw    r1, #:lower16:.Lmmu_init_table
+       movt    r1, #:upper16:.Lmmu_init_table
        bl      arm_boot_l1pt_init
 
-       XPUTC(#68)
+       XPUTC(#'D')
 
        /*
         * Turn on the MMU, Caches, etc.
         */
-#ifdef VERBOSE_INIT_ARM
-       adr     r11, xputc
+       movw    r0, #:lower16:TEMP_L1_TABLE
+       movt    r0, #:upper16:TEMP_L1_TABLE
+#if KERNEL_BASE_VOFFSET == 0
+       bl      arm_cpuinit
+#else
+#if defined(VERBOSE_INIT_ARM)
+       adr     r11, xputc              @ for XPUTC2
 #endif
        movw    lr, #:lower16:1f
        movt    lr, #:upper16:1f
-       movw    r0, #:lower16:TEMP_L1_TABLE
-       movt    r0, #:upper16:TEMP_L1_TABLE
        b       arm_cpuinit
-
-       .pushsection .text, "ax", %progbits
-       .align  0
+       .pushsection .text,"ax",%progbits
 1:
-       XPUTC2(#90)
+#endif
+       XPUTC2(#'Z')
 
 #if defined(MULTIPROCESSOR)
 #endif /* MULTIPROCESSOR */
 
-       XPUTC2(#13)
-       XPUTC2(#10)
+       XPUTC2(#13)             /* CR */
+       XPUTC2(#10)             /* LF */
 
        /*
         * Jump to start in locore.S, which in turn will call initarm and main.
         */
        b       start
 
+#ifndef KERNEL_BASES_EQUAL
        .popsection                             // back to .start
-
+#endif
        /* NOTREACHED */
 
        .align 0
@@ -280,9 +231,11 @@
 #if defined(VERBOSE_INIT_ARM)
        .align 0
        .global xputc
+       .global _xputc          // for C
        .type   xputc,%function
 
-#define TIMO           0x25000
+       #define TIMO            0x25000
+_xputc:
 xputc:
        mov     r2, #TIMO
        mrc     p15, 0, r3, c13, c0, 3          // TPIDRURO get (uart address)



Home | Main Index | Thread Index | Old Index