Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbarm/armadaxp support mapping all of memory.



details:   https://anonhg.NetBSD.org/src/rev/da8b74bfeb14
branches:  trunk
changeset: 328212:da8b74bfeb14
user:      matt <matt%NetBSD.org@localhost>
date:      Sat Mar 29 15:00:07 2014 +0000

description:
support mapping all of memory.
Map memory starting at 0x80000000 and leave 1GB until kernel VM
Make kernel VM size 320MB (avoid loading kernel and i/o section into same
tlb index).

diffstat:

 sys/arch/evbarm/armadaxp/armadaxp_machdep.c |  50 ++++++++++++----------------
 1 files changed, 21 insertions(+), 29 deletions(-)

diffs (119 lines):

diff -r 26aa6f3e7edb -r da8b74bfeb14 sys/arch/evbarm/armadaxp/armadaxp_machdep.c
--- a/sys/arch/evbarm/armadaxp/armadaxp_machdep.c       Sat Mar 29 14:53:57 2014 +0000
+++ b/sys/arch/evbarm/armadaxp/armadaxp_machdep.c       Sat Mar 29 15:00:07 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: armadaxp_machdep.c,v 1.7 2014/03/18 06:17:55 matt Exp $        */
+/*     $NetBSD: armadaxp_machdep.c,v 1.8 2014/03/29 15:00:07 matt Exp $        */
 /*******************************************************************************
 Copyright (C) Marvell International Ltd. and its affiliates
 
@@ -37,7 +37,7 @@
 *******************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: armadaxp_machdep.c,v 1.7 2014/03/18 06:17:55 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: armadaxp_machdep.c,v 1.8 2014/03/29 15:00:07 matt Exp $");
 
 #include "opt_machdep.h"
 #include "opt_mvsoc.h"
@@ -106,26 +106,12 @@
  * on where the ROM appears when you turn the MMU off.
  */
 
-
-/* Define various stack sizes in pages */
-#define IRQ_STACK_SIZE 1
-#define ABT_STACK_SIZE 1
-#ifdef IPKDB
-#define UND_STACK_SIZE 2
-#else
-#define UND_STACK_SIZE 1
-#endif
-
 BootConfig bootconfig;         /* Boot config storage */
 char *boot_args = NULL;
 char *boot_file = NULL;
 
 extern int KERNEL_BASE_phys[];
 
-/*extern char KERNEL_BASE_phys[];*/
-extern char etext[], __data_start[], _edata[], __bss_start[], __bss_end__[];
-extern char _end[];
-
 /*
  * Put some bogus settings of the MEMSTART and MEMSIZE
  * if they are not defined in kernel configuration file.
@@ -146,8 +132,8 @@
 /* Kernel base virtual address */
 #define        KERNEL_TEXT_BASE        (KERNEL_BASE + KERNEL_OFFSET)
 
-#define        KERNEL_VM_BASE          (KERNEL_BASE + 0x01000000)
-#define KERNEL_VM_SIZE         0x10000000
+#define        KERNEL_VM_BASE          (KERNEL_BASE + 0x40000000)
+#define KERNEL_VM_SIZE         0x14000000
 
 /* Prototypes */
 extern int armadaxp_l2_init(bus_addr_t);
@@ -211,23 +197,17 @@
 #undef _A
 #undef _S
 
-static inline
-pd_entry_t *
+static inline pd_entry_t *
 read_ttb(void)
 {
-       long ttb;
-
-       __asm volatile("mrc     p15, 0, %0, c2, c0, 0" : "=r" (ttb));
-
-       return (pd_entry_t *)(ttb & ~((1<<14)-1));
+       return (pd_entry_t *)(armreg_ttbr_read() & ~((1<<14)-1));
 }
 
 static int
 axp_pcie_free_win(void)
 {
-       int i;
        /* Find first disabled window */
-       for (i = 0; i < ARMADAXP_MLMB_NWINDOW; i++) {
+       for (size_t i = 0; i < ARMADAXP_MLMB_NWINDOW; i++) {
                if ((read_mlmbreg(MVSOC_MLMB_WCR(i)) &
                    MVSOC_MLMB_WCR_WINEN) == 0) {
                        return i;
@@ -382,21 +362,33 @@
        printf("\nNetBSD/evbarm (" BDSTR(EVBARM_BOARDTYPE) ") booting ...\n");
 #endif
 
+#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
+       const bool mapallmem_p = true;
+#else
+       const bool mapallmem_p = false;
+#endif
 
 #ifdef VERBOSE_INIT_ARM
        printf("initarm: Configuring system ...\n");
 #endif
+       psize_t memsize = MEMSIZE;
+       if (mapallmem_p && memsize > KERNEL_VM_BASE - KERNEL_BASE) {
+               printf("%s: dropping RAM size from %luMB to %uMB\n",
+                   __func__, (unsigned long) (memsize >> 20),
+                   (KERNEL_VM_BASE - KERNEL_BASE) >> 20);
+               memsize = KERNEL_VM_BASE - KERNEL_BASE;
+       }
        /* Fake bootconfig structure for the benefit of pmap.c. */
        bootconfig.dramblocks = 1;
        bootconfig.dram[0].address = MEMSTART;
-       bootconfig.dram[0].pages = MEMSIZE / PAGE_SIZE;
+       bootconfig.dram[0].pages = memsize / PAGE_SIZE;
 
         physical_start = bootconfig.dram[0].address;
         physical_end = physical_start + (bootconfig.dram[0].pages * PAGE_SIZE);
 
        arm32_bootmem_init(0, physical_end, (uintptr_t) KERNEL_BASE_phys);
        arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_LOW, 0,
-           devmap, false);
+           devmap, mapallmem_p);
 
        /* we've a specific device_register routine */
        evbarm_device_register = axp_device_register;



Home | Main Index | Thread Index | Old Index