diff options
author | ian <ian@FreeBSD.org> | 2014-05-15 20:58:23 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2014-05-15 20:58:23 +0000 |
commit | 1cfdd472969d9837ad42869895e71bff52d05811 (patch) | |
tree | a15ea62cc51e67b4eeebf39fcbd95cf0b8c6c835 /sys/arm/at91 | |
parent | 92d71aad7021b4ed31bde6c5ebd0729f936c2a7b (diff) | |
download | FreeBSD-src-1cfdd472969d9837ad42869895e71bff52d05811.zip FreeBSD-src-1cfdd472969d9837ad42869895e71bff52d05811.tar.gz |
MFC r261643, r261646, r261648, r261649, r261651, r261656, r261657, r261663,
r261676, r261677, r261698, r261778
Consolidate code related to setting up physical memory configuration into
a new physmem.c file.
Replace compile-time constant KERNPHYSADDR with abp_physaddr
Calculate the kernel's load address from the PC in the elf / gzip
trampoline instead of relying on KERNPHYSADDR as a compile-time constant.
It turns out a global variable is the only straightforward way to
communicate the kernel's physical load address from where it's known in
initarm() into cpu_mp_start() which is called from non-arm code and
takes no parameters.
Remove the now unused MMU_INIT macro.
Use vm_paddr_t, not vm_offset_t, when dealing with physical addresses.
No need to set physmem in each initarm() instance anymore, it's handled
in common code now.
Pass the pagetable used from locore.S to initarm to allow it to map data
in as required.
Fix the physmem exclude-region clipping logic for the edge-trim case.
Add some extra debugging output when DEBUG is defined.
Update legacy platforms to use new arm_physmem helper routines.
Diffstat (limited to 'sys/arm/at91')
-rw-r--r-- | sys/arm/at91/at91_machdep.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/sys/arm/at91/at91_machdep.c b/sys/arm/at91/at91_machdep.c index 9e73d0c..a6600b0 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; @@ -463,6 +461,7 @@ initarm(struct arm_boot_params *abp) vm_offset_t lastaddr; lastaddr = parse_boot_param(abp); + arm_physmem_kernaddr = abp->abp_physaddr; set_cpufuncs(); pcpu0_init(); @@ -473,7 +472,7 @@ initarm(struct arm_boot_params *abp) /* Define a macro to simplify memory allocation */ #define valloc_pages(var, np) \ alloc_pages((var).pv_va, (np)); \ - (var).pv_pa = (var).pv_va + (KERNPHYSADDR - KERNVIRTADDR); + (var).pv_pa = (var).pv_va + (abp->abp_physaddr - KERNVIRTADDR); #define alloc_pages(var, np) \ (var) = freemempos; \ @@ -493,7 +492,7 @@ initarm(struct arm_boot_params *abp) L2_TABLE_SIZE_REAL; kernel_pt_table[i].pv_pa = kernel_pt_table[i].pv_va - KERNVIRTADDR + - KERNPHYSADDR; + abp->abp_physaddr; } } /* @@ -591,7 +590,6 @@ initarm(struct arm_boot_params *abp) printf("Warning: No soc support for %s found.\n", soc_info.name); memsize = board_init(); - physmem = memsize / PAGE_SIZE; /* * Pages were allocated during the secondary bootstrap for the @@ -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 - |