Module Name:    src
Committed By:   matt
Date:           Sat Mar 29 15:00:07 UTC 2014

Modified Files:
        src/sys/arch/evbarm/armadaxp: armadaxp_machdep.c

Log Message:
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).


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/armadaxp/armadaxp_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/armadaxp/armadaxp_machdep.c
diff -u src/sys/arch/evbarm/armadaxp/armadaxp_machdep.c:1.7 src/sys/arch/evbarm/armadaxp/armadaxp_machdep.c:1.8
--- src/sys/arch/evbarm/armadaxp/armadaxp_machdep.c:1.7	Tue Mar 18 06:17:55 2014
+++ src/sys/arch/evbarm/armadaxp/armadaxp_machdep.c	Sat Mar 29 15:00:07 2014
@@ -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 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI
 *******************************************************************************/
 
 #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 @@ __KERNEL_RCSID(0, "$NetBSD: armadaxp_mac
  * 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 @@ extern char _end[];
 /* 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 @@ static const struct pmap_devmap devmap[]
 #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 @@ initarm(void *arg)
 	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;

Reply via email to