summaryrefslogtreecommitdiffstats
path: root/sys/arm/s3c2xx0
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/s3c2xx0
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/s3c2xx0')
-rw-r--r--sys/arm/s3c2xx0/s3c24x0_machdep.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/sys/arm/s3c2xx0/s3c24x0_machdep.c b/sys/arm/s3c2xx0/s3c24x0_machdep.c
index 84776e8..b306355 100644
--- a/sys/arm/s3c2xx0/s3c24x0_machdep.c
+++ b/sys/arm/s3c2xx0/s3c24x0_machdep.c
@@ -70,6 +70,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>
@@ -113,9 +114,6 @@ struct pv_addr kernel_pt_table[NUM_KERNEL_PTS];
/* 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;
@@ -384,20 +382,26 @@ initarm(struct arm_boot_params *abp)
arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
pmap_curmaxkvaddr = afterkern + 0x100000 * (KERNEL_PT_KERN_NUM - 1);
- arm_dump_avail_init(abp->abp_physaddr, memsize,
- sizeof(dump_avail) / sizeof(dump_avail[0]));
vm_max_kernel_address = KERNVIRTADDR + 3 * memsize;
pmap_bootstrap(freemempos, &kernel_l1pt);
msgbufp = (void*)msgbufpv.pv_va;
msgbufinit(msgbufp, msgbufsize);
mutex_init();
- physmem = memsize / PAGE_SIZE;
-
- phys_avail[0] = virtual_avail - KERNVIRTADDR + KERNPHYSADDR;
- phys_avail[1] = PHYSADDR + memsize;
- phys_avail[2] = 0;
- phys_avail[3] = 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();
OpenPOWER on IntegriCloud