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 snapshot: Does NOT boot



details:   https://anonhg.NetBSD.org/src/rev/0dc5dc5f0aab
branches:  trunk
changeset: 341833:0dc5dc5f0aab
user:      marty <marty%NetBSD.org@localhost>
date:      Wed Nov 25 04:04:13 2015 +0000

description:
snapshot: Does NOT boot

diffstat:

 sys/arch/evbarm/odroid/odroid_machdep.c |  55 +++++++++++++++++++++++---------
 sys/arch/evbarm/odroid/odroid_start.S   |  34 ++++++++++---------
 sys/arch/evbarm/odroid/platform.h       |  26 +++------------
 3 files changed, 63 insertions(+), 52 deletions(-)

diffs (truncated from 312 to 300 lines):

diff -r 8becfcc1d14d -r 0dc5dc5f0aab sys/arch/evbarm/odroid/odroid_machdep.c
--- a/sys/arch/evbarm/odroid/odroid_machdep.c   Wed Nov 25 04:03:34 2015 +0000
+++ b/sys/arch/evbarm/odroid/odroid_machdep.c   Wed Nov 25 04:04:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: odroid_machdep.c,v 1.39 2014/09/30 14:24:26 reinoud Exp $ */
+/*     $NetBSD: odroid_machdep.c,v 1.40 2015/11/25 04:04:13 marty 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.39 2014/09/30 14:24:26 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: odroid_machdep.c,v 1.40 2015/11/25 04:04:13 marty Exp $");
 
 #include "opt_evbarm_boardtype.h"
 #include "opt_exynos.h"
@@ -128,10 +128,6 @@
 #define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB | HUPCL)) | CS8) /* 8N1 */
 #endif /* CONMODE */
 
-// __CTASSERT(EXYNOS_CORE_PBASE + EXYNOS_UART0_OFFSET <= CONADDR);
-// __CTASSERT(CONADDR <= EXYNOS_CORE_PBASE + EXYNOS_UART4_OFFSET);
-// __CTASSERT(CONADDR % EXYNOS_BLOCK_SIZE == 0);
-//static const bus_addr_t conaddr = CONADDR;
 static const int conspeed = CONSPEED;
 static const int conmode = CONMODE;
 #endif /*defined(KGDB) || defined(SSCOM*CONSOLE) */
@@ -152,7 +148,7 @@
  * argument and boot configure storage
  */
 BootConfig bootconfig;                         /* for pmap's sake */
-char bootargs[MAX_BOOT_STRING] = "";           /* copied string from uboot */
+char bootargs[MAX_BOOT_STRING];                        /* copied string from uboot */
 char *boot_args = NULL;                                /* MI bootargs */
 char *boot_file = NULL;                                /* MI bootfile */
 uint8_t uboot_enaddr[ETHER_ADDR_LEN] = {};
@@ -181,6 +177,9 @@
 static void exynos_extract_mac_adress(void);
 void odroid_device_register(device_t self, void *aux);
 void odroid_device_register_post_config(device_t self, void *aux);
+#ifdef MULTIPROCESSOR
+extern void exynos_cpu_hatch(struct cpu_info *ci);
+#endif
 
 
 /*
@@ -238,12 +237,21 @@
 
 #ifdef PMAP_NEED_ALLOC_POOLPAGE
 static struct boot_physmem bp_highgig = {
+       .bp_start = EXYNOS5_SDRAM_PBASE / NBPG,
        .bp_pages = (KERNEL_VM_BASE - KERNEL_BASE) / NBPG,
-       .bp_freelist = VM_FREELIST_ISADMA,
+       .bp_freelist = VM_FREELIST_DEFAULT,
        .bp_flags = 0,
 };
 #endif
 
+#ifdef MULTIPROCESSOR
+void
+exynos_cpu_hatch(struct cpu_info *ci)
+{
+       /* MJF: WRITE ME */
+}
+#endif
+
 /*
  * u_int initarm(...)
  *
@@ -252,6 +260,7 @@
  * - init the physical console
  * - setting up page tables for the kernel
  */
+extern void xputc(int);
 
 u_int
 initarm(void *arg)
@@ -261,6 +270,7 @@
        const psize_t ram_reserve = 0x200000;
        psize_t ram_size;
 
+#if 0
        /* allocate/map our basic memory mapping */
        switch (EXYNOS_PRODUCT_FAMILY(exynos_soc_id)) {
 #if defined(EXYNOS4)
@@ -280,12 +290,24 @@
                panic("Unknown product family %llx",
                   EXYNOS_PRODUCT_FAMILY(exynos_soc_id));
        }
+#else
+       devmap = e5_devmap;
+       rambase = EXYNOS5_SDRAM_PBASE;
+#endif
+       xputc('<');
        pmap_devmap_register(devmap);
+       xputc('>');
 
+#if 0
        /* bootstrap soc. uart_address is determined in odroid_start */
        paddr_t uart_address = armreg_tpidruro_read();
        exynos_bootstrap(EXYNOS_CORE_VBASE, EXYNOS_IOPHYSTOVIRT(uart_address));
-
+#else
+       xputc('[');
+       exynos_bootstrap(EXYNOS_CORE_VBASE,
+               EXYNOS_CORE_VBASE + EXYNOS5_UART2_OFFSET);
+       xputc(']');
+#endif
        /* set up CPU / MMU / TLB functions */
        if (set_cpufuncs())
                panic("cpu not recognized!");
@@ -301,7 +323,6 @@
        printf("\nuboot arg = %#"PRIxPTR", %#"PRIxPTR", %#"PRIxPTR", %#"PRIxPTR"\n",
            uboot_args[0], uboot_args[1], uboot_args[2], uboot_args[3]);
        printf("Exynos SoC ID %08x\n", exynos_soc_id);
-
        printf("initarm: cbar=%#x\n", armreg_cbar_read());
 #endif
 
@@ -418,14 +439,15 @@
 #if NSSCOM > 0
        bus_space_tag_t bst = &exynos_bs_tag;
        bus_addr_t iobase = armreg_tpidruro_read();
-       bus_space_handle_t bsh = EXYNOS_IOPHYSTOVIRT(iobase);
        u_int i;
+
        /*      
         * No need to guess at the UART frequency since we can calculate it.
         */
-       uint32_t freq = conspeed
-          * (16 * (bus_space_read_4(bst, bsh, SSCOM_UBRDIV) + 1)
-                + bus_space_read_4(bst, bsh, SSCOM_UFRACVAL));
+       bus_space_handle_t bsh = EXYNOS_IOPHYSTOVIRT(iobase);
+       uint32_t br0 = bus_space_read_4(bst, bsh, SSCOM_UBRDIV);
+       uint32_t br1 = bus_space_read_4(bst, bsh, SSCOM_UFRACVAL);
+       uint32_t freq = conspeed * (16 * (br0 + 1) + br1);
        freq = (freq + conspeed / 2) / 1000;
        freq *= 1000;
 
@@ -436,11 +458,12 @@
                        break;
        }
        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],
                           conspeed, freq, conmode))
                panic("Serial console can not be initialized");
+       printf("%s: attached console @ %#"PRIxPTR" (%u HZ, %u bps)\n",
+           __func__, iobase, freq, conspeed);
 #ifdef VERBOSE_INIT_ARM
        printf("Console initialized\n");
 #endif
diff -r 8becfcc1d14d -r 0dc5dc5f0aab sys/arch/evbarm/odroid/odroid_start.S
--- a/sys/arch/evbarm/odroid/odroid_start.S     Wed Nov 25 04:03:34 2015 +0000
+++ b/sys/arch/evbarm/odroid/odroid_start.S     Wed Nov 25 04:04:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: odroid_start.S,v 1.7 2015/11/10 23:47:08 marty Exp $   */
+/*     $NetBSD: odroid_start.S,v 1.8 2015/11/25 04:04:13 marty Exp $   */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
 
 #include <evbarm/odroid/platform.h>
 
-RCSID("$NetBSD: odroid_start.S,v 1.7 2015/11/10 23:47:08 marty Exp $")
+RCSID("$NetBSD: odroid_start.S,v 1.8 2015/11/25 04:04:13 marty Exp $")
 
 
 #if defined(VERBOSE_INIT_ARM)
@@ -90,9 +90,9 @@
        cpsid   if, #PSR_SVC32_MODE
 
        /*
-        * Save any arguments passed to us.  But since .start is not at
-        * 0x80000000 * but .text is, we can't directly use the address that
-        * the linker gave us directly.  Convert the virtual address to the
+        * Save any arguments passed to us.  If .start is not at
+        * 0x80000000 but .text is, we can't directly use the address that
+        * the linker gave us.  Convert the virtual address to the
         * physical address by using KERNEL_BASE_VOFFSET.
         */
        movw    r4, #:lower16:uboot_args
@@ -112,7 +112,9 @@
 
        movw    r4, #:lower16:exynos_soc_id
        movt    r4, #:upper16:exynos_soc_id
+#if KERNEL_BASE_VOFFSET != 0
        sub     r4, r4, #KERNEL_BASE_VOFFSET
+#endif
        str     r0, [r4]                                // save soc_id
        mov     r5, r0                                  // save soc_id
 
@@ -152,7 +154,7 @@
         */
        bl      cortex_init
 
-       XPUTC(#'C')
+       XPUTC(#'@')
 
        /*
         * Set up a preliminary mapping in the MMU to allow us to run
@@ -186,6 +188,7 @@
        XPUTC2(#'Z')
 
 #if defined(MULTIPROCESSOR)
+       /* MJF: HA HA (There's no there here) */
 #endif /* MULTIPROCESSOR */
 
        XPUTC2(#13)             /* CR */
@@ -208,23 +211,23 @@
        .global _C_LABEL(exynos_uarts)
 _C_LABEL(exynos_uarts):
 .Lsscom_exynos4_table:
-       .word   0
+       .word   0
        .word   EXYNOS4_UART0_OFFSET
-       .word   1
+       .word   1
        .word   EXYNOS4_UART1_OFFSET
-       .word   2
+       .word   2
        .word   EXYNOS4_UART2_OFFSET
-       .word   3
+       .word   3
        .word   EXYNOS4_UART3_OFFSET
 
 .Lsscom_exynos5_table:
-       .word   0
+       .word   0
        .word   EXYNOS5_UART0_OFFSET
-       .word   1
+       .word   1
        .word   EXYNOS5_UART1_OFFSET
-       .word   2
+       .word   2
        .word   EXYNOS5_UART2_OFFSET
-       .word   3
+       .word   3
        .word   EXYNOS5_UART3_OFFSET
 
 
@@ -268,7 +271,7 @@
        bx      lr
 #endif
 
-#include <arm/cortex/a9_mpsubr.S>
+#include <arm/cortex/cortex_init.S>
 
 #if EXYNOS_CORE_SIZE < EXYNOS4_CORE_SIZE
 #error EXYNOS_CORE_SIZE smaller than EXYNOS4_CORE_SIZE
@@ -295,7 +298,6 @@
                EXYNOS_CORE_SIZE / L1_S_SIZE,
                L1_S_PROTO_armv7 | L1_S_APv7_KRW | L1_S_V6_XN)
 
-       /* Map EXYNOS CORE (so console will work) */
        MMU_INIT(EXYNOS_CORE_PBASE, EXYNOS_CORE_PBASE,
                EXYNOS_CORE_SIZE / L1_S_SIZE,
                L1_S_PROTO_armv7 | L1_S_APv7_KRW | L1_S_V6_XN)
diff -r 8becfcc1d14d -r 0dc5dc5f0aab sys/arch/evbarm/odroid/platform.h
--- a/sys/arch/evbarm/odroid/platform.h Wed Nov 25 04:03:34 2015 +0000
+++ b/sys/arch/evbarm/odroid/platform.h Wed Nov 25 04:04:13 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: platform.h,v 1.3 2015/11/11 00:58:21 marty Exp $       */
+/*     $NetBSD: platform.h,v 1.4 2015/11/25 04:04:13 marty Exp $       */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -32,34 +32,20 @@
 #ifndef _ARM_ODROID_PLATFORM_H
 #define _ARM_ODROID_PLATFORM_H
 
-#include "opt_exynos.h"
-
 /*
  * Kernel VM space 16Mb behind KERNEL_BASE upto 0xeff00000
  */
 #define KERNEL_VM_BASE         0xc0000000
-#define KERNEL_VM_SIZE         (EXYNOS_CORE_VBASE - KERNEL_VM_BASE)
+#define KERNEL_VM_SIZE         0x24000000
 
 /*
  * IO space
  */
 
-#define EXYNOS_CORE_VBASE      0xf0000000
-
-/*
- * Serial consoles
+/* MJF:  This should be 0xF0000000 --- why doesn't that work? */
+/*       With this set to 0x10000000 we boot to the point where
+ *       uvm_init is called and die during it.
  */
-#define CONADDR_VA             ((CONADDR - EXYNOS_CORE_PBASE) + EXYNOS_CORE_VBASE)
-
-#ifdef SSCOM2CONSOLE



Home | Main Index | Thread Index | Old Index