Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Add a few small changes so that the CUBIEBOARDs can...



details:   https://anonhg.NetBSD.org/src/rev/8a348017f0e2
branches:  trunk
changeset: 793001:8a348017f0e2
user:      matt <matt%NetBSD.org@localhost>
date:      Thu Jan 23 19:26:55 2014 +0000

description:
Add a few small changes so that the CUBIEBOARDs can run big endian.

diffstat:

 sys/arch/arm/allwinner/awin_space.c   |  60 +++++++++++++++++++---------------
 sys/arch/evbarm/cubie/cubie_machdep.c |  11 ++++-
 sys/arch/evbarm/cubie/cubie_start.S   |  11 +++++-
 3 files changed, 51 insertions(+), 31 deletions(-)

diffs (212 lines):

diff -r 830e2f81e494 -r 8a348017f0e2 sys/arch/arm/allwinner/awin_space.c
--- a/sys/arch/arm/allwinner/awin_space.c       Thu Jan 23 19:18:08 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_space.c       Thu Jan 23 19:26:55 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: awin_space.c,v 1.1 2013/09/04 02:39:01 matt Exp $      */
+/*     $NetBSD: awin_space.c,v 1.2 2014/01/23 19:26:55 matt Exp $      */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_space.c,v 1.1 2013/09/04 02:39:01 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_space.c,v 1.2 2014/01/23 19:26:55 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -48,6 +48,12 @@
 bs_protos(generic);
 bs_protos(generic_armv4);
 
+#if __ARMEB__
+#define NSWAP(n)       n ## _swap
+#else
+#define NSWAP(n)       n
+#endif
+
 struct bus_space awin_bs_tag = {
        /* cookie */
        (void *) 0,
@@ -72,38 +78,38 @@
 
        /* read (single) */
        generic_bs_r_1,
-       generic_armv4_bs_r_2,
-       generic_bs_r_4,
+       NSWAP(generic_armv4_bs_r_2),
+       NSWAP(generic_bs_r_4),
        bs_notimpl_bs_r_8,
 
        /* read multiple */
        generic_bs_rm_1,
-       generic_armv4_bs_rm_2,
-       generic_bs_rm_4,
+       NSWAP(generic_armv4_bs_rm_2),
+       NSWAP(generic_bs_rm_4),
        bs_notimpl_bs_rm_8,
 
        /* read region */
        generic_bs_rr_1,
-       generic_armv4_bs_rr_2,
-       generic_bs_rr_4,
+       NSWAP(generic_armv4_bs_rr_2),
+       NSWAP(generic_bs_rr_4),
        bs_notimpl_bs_rr_8,
 
        /* write (single) */
        generic_bs_w_1,
-       generic_armv4_bs_w_2,
-       generic_bs_w_4,
+       NSWAP(generic_armv4_bs_w_2),
+       NSWAP(generic_bs_w_4),
        bs_notimpl_bs_w_8,
 
        /* write multiple */
        generic_bs_wm_1,
-       generic_armv4_bs_wm_2,
-       generic_bs_wm_4,
+       NSWAP(generic_armv4_bs_wm_2),
+       NSWAP(generic_bs_wm_4),
        bs_notimpl_bs_wm_8,
 
        /* write region */
        generic_bs_wr_1,
-       generic_armv4_bs_wr_2,
-       generic_bs_wr_4,
+       NSWAP(generic_armv4_bs_wr_2),
+       NSWAP(generic_bs_wr_4),
        bs_notimpl_bs_wr_8,
 
        /* set multiple */
@@ -114,7 +120,7 @@
 
        /* set region */
        generic_bs_sr_1,
-       generic_armv4_bs_sr_2,
+       NSWAP(generic_armv4_bs_sr_2),
        bs_notimpl_bs_sr_4,
        bs_notimpl_bs_sr_8,
 
@@ -127,38 +133,38 @@
 #ifdef __BUS_SPACE_HAS_STREAM_METHODS
        /* read (single) */
        generic_bs_r_1,
-       generic_armv4_bs_r_2,
-       generic_bs_r_4,
+       NSWAP(generic_armv4_bs_r_2),
+       NSWAP(generic_bs_r_4),
        bs_notimpl_bs_r_8,
 
        /* read multiple */
        generic_bs_rm_1,
-       generic_armv4_bs_rm_2,
-       generic_bs_rm_4,
+       NSWAP(generic_armv4_bs_rm_2),
+       NSWAP(generic_bs_rm_4),
        bs_notimpl_bs_rm_8,
 
        /* read region */
        generic_bs_rr_1,
-       generic_armv4_bs_rr_2,
-       generic_bs_rr_4,
+       NSWAP(generic_armv4_bs_rr_2),
+       NSWAP(generic_bs_rr_4),
        bs_notimpl_bs_rr_8,
 
        /* write (single) */
        generic_bs_w_1,
-       generic_armv4_bs_w_2,
-       generic_bs_w_4,
+       NSWAP(generic_armv4_bs_w_2),
+       NSWAP(generic_bs_w_4),
        bs_notimpl_bs_w_8,
 
        /* write multiple */
        generic_bs_wm_1,
-       generic_armv4_bs_wm_2,
-       generic_bs_wm_4,
+       NSWAP(generic_armv4_bs_wm_2),
+       NSWAP(generic_bs_wm_4),
        bs_notimpl_bs_wm_8,
 
        /* write region */
        generic_bs_wr_1,
-       generic_armv4_bs_wr_2,
-       generic_bs_wr_4,
+       NSWAP(generic_armv4_bs_wr_2),
+       NSWAP(generic_bs_wr_4),
        bs_notimpl_bs_wr_8,
 #endif
 };
diff -r 830e2f81e494 -r 8a348017f0e2 sys/arch/evbarm/cubie/cubie_machdep.c
--- a/sys/arch/evbarm/cubie/cubie_machdep.c     Thu Jan 23 19:18:08 2014 +0000
+++ b/sys/arch/evbarm/cubie/cubie_machdep.c     Thu Jan 23 19:26:55 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cubie_machdep.c,v 1.8 2013/09/09 17:54:38 matt Exp $ */
+/*     $NetBSD: cubie_machdep.c,v 1.9 2014/01/23 19:26:55 matt Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cubie_machdep.c,v 1.8 2013/09/09 17:54:38 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cubie_machdep.c,v 1.9 2014/01/23 19:26:55 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -358,7 +358,12 @@
 
 #ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
        const bool mapallmem_p = true;
-       KASSERT(ram_size <= KERNEL_VM_BASE - KERNEL_BASE);
+       if (ram_size > KERNEL_VM_BASE - KERNEL_BASE) {
+               printf("%s: dropping RAM size from %luMB to %uMB\n",
+                  __func__, (unsigned long) (ram_size >> 20),
+                  (KERNEL_VM_BASE - KERNEL_BASE) >> 20);
+               ram_size = KERNEL_VM_BASE - KERNEL_BASE;
+       }
 #else
        const bool mapallmem_p = false;
 #endif
diff -r 830e2f81e494 -r 8a348017f0e2 sys/arch/evbarm/cubie/cubie_start.S
--- a/sys/arch/evbarm/cubie/cubie_start.S       Thu Jan 23 19:18:08 2014 +0000
+++ b/sys/arch/evbarm/cubie/cubie_start.S       Thu Jan 23 19:26:55 2014 +0000
@@ -95,10 +95,14 @@
 #include <arm/allwinner/awin_reg.h>
 #include <evbarm/cubie/platform.h>  
 
-RCSID("$NetBSD: cubie_start.S,v 1.2 2013/09/07 00:30:17 matt Exp $")
+RCSID("$NetBSD: cubie_start.S,v 1.3 2014/01/23 19:26:55 matt Exp $")
 
 #if defined(VERBOSE_INIT_ARM)
+#ifdef __ARMEB__
+#define        XPUTC(n)        mov r0, n << 24; bl xputc
+#else
 #define        XPUTC(n)        mov r0, n; bl xputc
+#endif
 #define COM_MULT       4
 #define XPUTC_COM      1
 #else
@@ -117,6 +121,10 @@
 
        .global _C_LABEL(cubie_start)
 _C_LABEL(cubie_start):
+#ifdef __ARMEB__
+       setend  be                      /* force big endian */
+#endif
+
        /* Move into supervisor mode and disable IRQs/FIQs. */
        cpsid   if, #PSR_SVC32_MODE
 
@@ -189,6 +197,7 @@
        MMU_INIT(AWIN_CORE_PBASE, AWIN_CORE_PBASE,
                (AWIN_CORE_SIZE + L1_S_SIZE - 1) / L1_S_SIZE,
                L1_S_PROTO | L1_S_APv7_KRW)
+
        /* end of table */
        MMU_INIT(0, 0, 0, 0)
 



Home | Main Index | Thread Index | Old Index