Tue Jun 11 22:59:54 2013 UTC ()
Make sure there is enough KVA to map all of memory if
__HAVE_MM_MD_DIRECT_MAPPED_PHYS is defined.


(matt)
diff -r1.42 -r1.43 src/sys/arch/evbarm/beagle/beagle_machdep.c

cvs diff -r1.42 -r1.43 src/sys/arch/evbarm/beagle/Attic/beagle_machdep.c (expand / switch to unified diff)

--- src/sys/arch/evbarm/beagle/Attic/beagle_machdep.c 2013/05/12 02:55:54 1.42
+++ src/sys/arch/evbarm/beagle/Attic/beagle_machdep.c 2013/06/11 22:59:54 1.43
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: beagle_machdep.c,v 1.42 2013/05/12 02:55:54 matt Exp $ */ 1/* $NetBSD: beagle_machdep.c,v 1.43 2013/06/11 22:59:54 matt Exp $ */
2 2
3/* 3/*
4 * Machine dependent functions for kernel setup for TI OSK5912 board. 4 * Machine dependent functions for kernel setup for TI OSK5912 board.
5 * Based on lubbock_machdep.c which in turn was based on iq80310_machhdep.c 5 * Based on lubbock_machdep.c which in turn was based on iq80310_machhdep.c
6 * 6 *
7 * Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved. 7 * Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved.
8 * Written by Hiroyuki Bessho for Genetec Corporation. 8 * Written by Hiroyuki Bessho for Genetec Corporation.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -115,27 +115,27 @@ @@ -115,27 +115,27 @@
115 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 115 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
116 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 116 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
117 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTERS BE LIABLE FOR ANY DIRECT, 117 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTERS BE LIABLE FOR ANY DIRECT,
118 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 118 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
119 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 119 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
120 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 120 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
121 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 121 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
122 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 122 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
123 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 123 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
124 * SUCH DAMAGE. 124 * SUCH DAMAGE.
125 */ 125 */
126 126
127#include <sys/cdefs.h> 127#include <sys/cdefs.h>
128__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.42 2013/05/12 02:55:54 matt Exp $"); 128__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.43 2013/06/11 22:59:54 matt Exp $");
129 129
130#include "opt_machdep.h" 130#include "opt_machdep.h"
131#include "opt_ddb.h" 131#include "opt_ddb.h"
132#include "opt_kgdb.h" 132#include "opt_kgdb.h"
133#include "opt_ipkdb.h" 133#include "opt_ipkdb.h"
134#include "opt_md.h" 134#include "opt_md.h"
135#include "opt_com.h" 135#include "opt_com.h"
136#include "opt_omap.h" 136#include "opt_omap.h"
137#include "prcm.h" 137#include "prcm.h"
138#include "com.h" 138#include "com.h"
139 139
140#include <sys/param.h> 140#include <sys/param.h>
141#include <sys/systm.h> 141#include <sys/systm.h>
@@ -483,29 +483,37 @@ initarm(void *arg) @@ -483,29 +483,37 @@ initarm(void *arg)
483 */ 483 */
484#ifdef MEMSIZE 484#ifdef MEMSIZE
485 if (ram_size == 0 || ram_size > MEMSIZE * 1024 * 1024) 485 if (ram_size == 0 || ram_size > MEMSIZE * 1024 * 1024)
486 ram_size = MEMSIZE * 1024 * 1024; 486 ram_size = MEMSIZE * 1024 * 1024;
487#else 487#else
488 KASSERTMSG(ram_size > 0, "RAM size unknown and MEMSIZE undefined"); 488 KASSERTMSG(ram_size > 0, "RAM size unknown and MEMSIZE undefined");
489#endif 489#endif
490 490
491 /* Fake bootconfig structure for the benefit of pmap.c. */ 491 /* Fake bootconfig structure for the benefit of pmap.c. */
492 bootconfig.dramblocks = 1; 492 bootconfig.dramblocks = 1;
493 bootconfig.dram[0].address = KERNEL_BASE_PHYS & -0x400000; 493 bootconfig.dram[0].address = KERNEL_BASE_PHYS & -0x400000;
494 bootconfig.dram[0].pages = ram_size / PAGE_SIZE; 494 bootconfig.dram[0].pages = ram_size / PAGE_SIZE;
495 495
 496#ifdef __HAVE_MM_MD_DIRECT_MAPPED_PHYS
 497 const bool mapallmem_p = true;
 498 KASSERT(ram_size <= KERNEL_VM_BASE - KERNEL_BASE);
 499#else
 500 const bool mapallmem_p = false;
 501#endif
 502
496 arm32_bootmem_init(bootconfig.dram[0].address, ram_size, 503 arm32_bootmem_init(bootconfig.dram[0].address, ram_size,
497 KERNEL_BASE_PHYS); 504 KERNEL_BASE_PHYS);
498 arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, devmap, true); 505 arm32_kernel_vm_init(KERNEL_VM_BASE, ARM_VECTORS_HIGH, 0, devmap,
 506 mapallmem_p);
499 507
500 /* "bootargs" env variable is passed as 4th argument to kernel */ 508 /* "bootargs" env variable is passed as 4th argument to kernel */
501 if ((uboot_args[3] & 0xf0000000) == 0x80000000) { 509 if ((uboot_args[3] & 0xf0000000) == 0x80000000) {
502 strlcpy(bootargs, (char *)uboot_args[3], sizeof(bootargs)); 510 strlcpy(bootargs, (char *)uboot_args[3], sizeof(bootargs));
503 } 511 }
504 boot_args = bootargs; 512 boot_args = bootargs;
505 parse_mi_bootargs(boot_args); 513 parse_mi_bootargs(boot_args);
506 514
507 /* we've a specific device_register routine */ 515 /* we've a specific device_register routine */
508 evbarm_device_register = beagle_device_register; 516 evbarm_device_register = beagle_device_register;
509 517
510 db_trap_callback = beagle_db_trap; 518 db_trap_callback = beagle_db_trap;
511 519