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/xscale/ixp425 | |
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/xscale/ixp425')
-rw-r--r-- | sys/arm/xscale/ixp425/avila_machdep.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/sys/arm/xscale/ixp425/avila_machdep.c b/sys/arm/xscale/ixp425/avila_machdep.c index 3abdf22..b4ac7a7 100644 --- a/sys/arm/xscale/ixp425/avila_machdep.c +++ b/sys/arm/xscale/ixp425/avila_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> @@ -91,11 +92,6 @@ __FBSDID("$FreeBSD$"); #include <arm/xscale/ixp425/ixp425reg.h> #include <arm/xscale/ixp425/ixp425var.h> -/* kernel text starts where we were loaded at boot */ -#define KERNEL_TEXT_OFF (KERNPHYSADDR - PHYSADDR) -#define KERNEL_TEXT_BASE (KERNBASE + KERNEL_TEXT_OFF) -#define KERNEL_TEXT_PHYS (PHYSADDR + KERNEL_TEXT_OFF) - #define KERNEL_PT_SYS 0 /* Page table for mapping proc0 zero page */ #define KERNEL_PT_IO 1 #define KERNEL_PT_IO_NUM 3 @@ -114,9 +110,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; @@ -223,7 +216,13 @@ initarm(struct arm_boot_params *abp) vm_offset_t lastaddr; uint32_t memsize; + /* kernel text starts where we were loaded at boot */ +#define KERNEL_TEXT_OFF (abp->abp_physaddr - PHYSADDR) +#define KERNEL_TEXT_BASE (KERNBASE + KERNEL_TEXT_OFF) +#define KERNEL_TEXT_PHYS (PHYSADDR + KERNEL_TEXT_OFF) + lastaddr = parse_boot_param(abp); + arm_physmem_kernaddr = abp->abp_physaddr; set_cpufuncs(); /* NB: sets cputype */ pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); @@ -242,7 +241,7 @@ initarm(struct arm_boot_params *abp) * write-through). Note this leaves a gap for expansion * (or might be repurposed). */ - freemempos = KERNPHYSADDR; + freemempos = abp->abp_physaddr; /* macros to simplify initial memory allocation */ #define alloc_pages(var, np) do { \ @@ -253,7 +252,7 @@ initarm(struct arm_boot_params *abp) } while (0) #define valloc_pages(var, np) do { \ alloc_pages((var).pv_pa, (np)); \ - (var).pv_va = (var).pv_pa + (KERNVIRTADDR - KERNPHYSADDR); \ + (var).pv_va = (var).pv_pa + (KERNVIRTADDR - abp->abp_physaddr); \ } while (0) /* force L1 page table alignment */ @@ -272,7 +271,7 @@ initarm(struct arm_boot_params *abp) L2_TABLE_SIZE_REAL; kernel_pt_table[loop].pv_va = kernel_pt_table[loop].pv_pa + - (KERNVIRTADDR - KERNPHYSADDR); + (KERNVIRTADDR - abp->abp_physaddr); } } freemem_pt = freemempos; /* base of allocated pt's */ @@ -393,7 +392,6 @@ initarm(struct arm_boot_params *abp) memsize = ixp435_ddram_size(); else memsize = ixp425_sdram_size(); - physmem = memsize / PAGE_SIZE; /* Set stack for exception handlers */ @@ -407,19 +405,26 @@ initarm(struct arm_boot_params *abp) arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); pmap_curmaxkvaddr = afterkern + PAGE_SIZE; - arm_dump_avail_init(abp->abp_physaddr, memsize, - sizeof(dump_avail) / sizeof(dump_avail[0])); vm_max_kernel_address = 0xd0000000; pmap_bootstrap(pmap_curmaxkvaddr, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); mutex_init(); - i = 0; - phys_avail[i++] = round_page(virtual_avail - KERNBASE + PHYSADDR); - phys_avail[i++] = trunc_page(PHYSADDR + memsize - 1); - 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(); |