summaryrefslogtreecommitdiffstats
path: root/sys/arm/at91/at91_machdep.c
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-02-08 23:54:16 +0000
committerian <ian@FreeBSD.org>2014-02-08 23:54:16 +0000
commit30d95028f0a5b80653b6cba27633bbdca56f156b (patch)
treead73d00c7878919bd17f9c0c2fec2a7ee3a6add2 /sys/arm/at91/at91_machdep.c
parent5da54698fa93663e708069fcb779720291895435 (diff)
downloadFreeBSD-src-30d95028f0a5b80653b6cba27633bbdca56f156b.zip
FreeBSD-src-30d95028f0a5b80653b6cba27633bbdca56f156b.tar.gz
Consolidate code related to setting up physical memory configuration into
a new physmem.c file. The new code provides helper routines that can be used by legacy SoCs and newer FDT-based systems. There are routines to add one or more regions of physically contiguous ram, and exclude one or more physically contiguous regions of ram. Ram can be excluded from crash dumps, from being given over to the vm system for allocation management, or both. After all the included and excluded regions have been added, arm_physmem_init_kernel_globals() processes the regions into the global dump_avail and phys_avail arrays and realmem and physmem variables that communicate memory configuration to the rest of the kernel. Convert all existing SoCs to use the new helper code.
Diffstat (limited to 'sys/arm/at91/at91_machdep.c')
-rw-r--r--sys/arm/at91/at91_machdep.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/sys/arm/at91/at91_machdep.c b/sys/arm/at91/at91_machdep.c
index 9e73d0c..d9d26d8 100644
--- a/sys/arm/at91/at91_machdep.c
+++ b/sys/arm/at91/at91_machdep.c
@@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$");
#include <sys/exec.h>
#include <sys/kdb.h>
#include <sys/msgbuf.h>
+#include <machine/physmem.h>
#include <machine/reg.h>
#include <machine/cpu.h>
#include <machine/board.h>
@@ -199,9 +200,6 @@ const struct arm_devmap_entry at91_devmap[] = {
/* Physical and virtual addresses for some global pages */
-vm_paddr_t phys_avail[10];
-vm_paddr_t dump_avail[4];
-
struct pv_addr systempage;
struct pv_addr msgbufpv;
struct pv_addr irqstack;
@@ -630,8 +628,6 @@ initarm(struct arm_boot_params *abp)
arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
pmap_curmaxkvaddr = afterkern + L1_S_SIZE * (KERNEL_PT_KERN_NUM - 1);
- arm_dump_avail_init(abp->abp_physaddr, memsize,
- sizeof(dump_avail)/sizeof(dump_avail[0]));
/* Always use the 256MB of KVA we have available between the kernel and devices */
vm_max_kernel_address = KERNVIRTADDR + (256 << 20);
pmap_bootstrap(freemempos, &kernel_l1pt);
@@ -639,15 +635,21 @@ initarm(struct arm_boot_params *abp)
msgbufinit(msgbufp, msgbufsize);
mutex_init();
- i = 0;
-#if PHYSADDR != KERNPHYSADDR
- phys_avail[i++] = PHYSADDR;
- phys_avail[i++] = KERNPHYSADDR;
-#endif
- phys_avail[i++] = virtual_avail - KERNVIRTADDR + KERNPHYSADDR;
- phys_avail[i++] = PHYSADDR + memsize;
- phys_avail[i++] = 0;
- phys_avail[i++] = 0;
+ /*
+ * Add the physical ram we have available.
+ *
+ * Exclude the kernel, and all the things we allocated which immediately
+ * follow the kernel, from the VM allocation pool but not from crash
+ * dumps. virtual_avail is a global variable which tracks the kva we've
+ * "allocated" while setting up pmaps.
+ *
+ * Prepare the list of physical memory available to the vm subsystem.
+ */
+ arm_physmem_hardware_region(PHYSADDR, memsize);
+ arm_physmem_exclude_region(abp->abp_physaddr,
+ virtual_avail - KERNVIRTADDR, EXFLAG_NOALLOC);
+ arm_physmem_init_kernel_globals();
+
init_param2(physmem);
kdb_init();
return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP -
OpenPOWER on IntegriCloud