summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-02-09 02:39:00 +0000
committerian <ian@FreeBSD.org>2014-02-09 02:39:00 +0000
commit0a3cc34ebf8a1addd43696f8b6d67b2cac66f4ef (patch)
tree266f29fe769a24ec0a2d14b68ffda3be4d51f89b
parent968d73cfcfb42ebbae51433827c6cc01429139fe (diff)
downloadFreeBSD-src-0a3cc34ebf8a1addd43696f8b6d67b2cac66f4ef.zip
FreeBSD-src-0a3cc34ebf8a1addd43696f8b6d67b2cac66f4ef.tar.gz
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. This adds the global variable and ensures that all the various copies of initarm() set it. It uses the variable in cpu_mp_start(), eliminating the last uses of KERNPHYSADDR outside of locore.S (where we can now calculate it instead of relying on the constant).
-rw-r--r--sys/arm/arm/machdep.c2
-rw-r--r--sys/arm/arm/mp_machdep.c9
-rw-r--r--sys/arm/arm/physmem.c3
-rw-r--r--sys/arm/at91/at91_machdep.c1
-rw-r--r--sys/arm/econa/econa_machdep.c1
-rw-r--r--sys/arm/include/physmem.h5
-rw-r--r--sys/arm/s3c2xx0/s3c24x0_machdep.c1
-rw-r--r--sys/arm/sa11x0/assabet_machdep.c3
-rw-r--r--sys/arm/xscale/i80321/ep80219_machdep.c2
-rw-r--r--sys/arm/xscale/i80321/iq31244_machdep.c2
-rw-r--r--sys/arm/xscale/i8134x/crb_machdep.c2
-rw-r--r--sys/arm/xscale/ixp425/avila_machdep.c1
-rw-r--r--sys/arm/xscale/pxa/pxa_machdep.c2
13 files changed, 30 insertions, 4 deletions
diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c
index eacdec1..9706a17 100644
--- a/sys/arm/arm/machdep.c
+++ b/sys/arm/arm/machdep.c
@@ -1032,6 +1032,8 @@ initarm(struct arm_boot_params *abp)
int i, j, err_devmap, mem_regions_sz;
lastaddr = parse_boot_param(abp);
+ arm_physmem_kernaddr = abp->abp_physaddr;
+
memsize = 0;
set_cpufuncs();
diff --git a/sys/arm/arm/mp_machdep.c b/sys/arm/arm/mp_machdep.c
index e8e6eee..0c70aca 100644
--- a/sys/arm/arm/mp_machdep.c
+++ b/sys/arm/arm/mp_machdep.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <machine/smp.h>
#include <machine/pcb.h>
#include <machine/pte.h>
+#include <machine/physmem.h>
#include <machine/intr.h>
#include <machine/vmparam.h>
#ifdef VFP
@@ -120,16 +121,16 @@ cpu_mp_start(void)
M_WAITOK | M_ZERO);
temp_pagetable_va = (vm_offset_t)contigmalloc(L1_TABLE_SIZE,
M_TEMP, 0, 0x0, 0xffffffff, L1_TABLE_SIZE, 0);
- addr = KERNPHYSADDR;
- addr_end = (vm_offset_t)&_end - KERNVIRTADDR + KERNPHYSADDR;
+ addr = arm_physmem_kernaddr;
+ addr_end = (vm_offset_t)&_end - KERNVIRTADDR + arm_physmem_kernaddr;
addr_end &= ~L1_S_OFFSET;
addr_end += L1_S_SIZE;
bzero((void *)temp_pagetable_va, L1_TABLE_SIZE);
- for (addr = KERNPHYSADDR; addr <= addr_end; addr += L1_S_SIZE) {
+ for (addr = arm_physmem_kernaddr; addr <= addr_end; addr += L1_S_SIZE) {
((int *)(temp_pagetable_va))[addr >> L1_S_SHIFT] =
L1_TYPE_S|L1_SHARED|L1_S_C|L1_S_AP(AP_KRW)|L1_S_DOM(PMAP_DOMAIN_KERNEL)|addr;
((int *)(temp_pagetable_va))[(addr -
- KERNPHYSADDR + KERNVIRTADDR) >> L1_S_SHIFT] =
+ arm_physmem_kernaddr + KERNVIRTADDR) >> L1_S_SHIFT] =
L1_TYPE_S|L1_SHARED|L1_S_C|L1_S_AP(AP_KRW)|L1_S_DOM(PMAP_DOMAIN_KERNEL)|addr;
}
diff --git a/sys/arm/arm/physmem.c b/sys/arm/arm/physmem.c
index db322fa..f06831b 100644
--- a/sys/arm/arm/physmem.c
+++ b/sys/arm/arm/physmem.c
@@ -89,6 +89,9 @@ vm_paddr_t dump_avail[MAX_AVAIL_ENTRIES + 2]; /* of zeroes to terminate. */
/* This is the total number of hardware pages, excluded or not. */
long realmem;
+/* The address at which the kernel was loaded. Set early in initarm(). */
+vm_offset_t arm_physmem_kernaddr;
+
/*
* Print the contents of the physical and excluded region tables using the
* provided printf-like output function (which will be either printf or
diff --git a/sys/arm/at91/at91_machdep.c b/sys/arm/at91/at91_machdep.c
index a6fef8b..c25e1ab 100644
--- a/sys/arm/at91/at91_machdep.c
+++ b/sys/arm/at91/at91_machdep.c
@@ -461,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();
diff --git a/sys/arm/econa/econa_machdep.c b/sys/arm/econa/econa_machdep.c
index eca7eb2..656e262 100644
--- a/sys/arm/econa/econa_machdep.c
+++ b/sys/arm/econa/econa_machdep.c
@@ -178,6 +178,7 @@ initarm(struct arm_boot_params *abp)
boothowto = RB_VERBOSE;
lastaddr = parse_boot_param(abp);
+ arm_physmem_kernaddr = abp->abp_physaddr;
set_cpufuncs();
pcpu0_init();
diff --git a/sys/arm/include/physmem.h b/sys/arm/include/physmem.h
index 1779d28..3fc0ea4 100644
--- a/sys/arm/include/physmem.h
+++ b/sys/arm/include/physmem.h
@@ -30,6 +30,11 @@
#define _MACHINE_PHYSMEM_H_
/*
+ * The physical address at which the kernel was loaded.
+ */
+extern vm_offset_t arm_physmem_kernaddr;
+
+/*
* Routines to help configure physical ram.
*
* Multiple regions of contiguous physical ram can be added (in any order).
diff --git a/sys/arm/s3c2xx0/s3c24x0_machdep.c b/sys/arm/s3c2xx0/s3c24x0_machdep.c
index ecbf5aa..2572bfa 100644
--- a/sys/arm/s3c2xx0/s3c24x0_machdep.c
+++ b/sys/arm/s3c2xx0/s3c24x0_machdep.c
@@ -225,6 +225,7 @@ initarm(struct arm_boot_params *abp)
boothowto = 0; /* Likely not needed */
lastaddr = parse_boot_param(abp);
+ arm_physmem_kernaddr = abp->abp_physaddr;
i = 0;
set_cpufuncs();
cpufuncs.cf_sleep = s3c24x0_sleep;
diff --git a/sys/arm/sa11x0/assabet_machdep.c b/sys/arm/sa11x0/assabet_machdep.c
index 220db17..473e8f0 100644
--- a/sys/arm/sa11x0/assabet_machdep.c
+++ b/sys/arm/sa11x0/assabet_machdep.c
@@ -87,6 +87,8 @@ __FBSDID("$FreeBSD$");
#include <machine/machdep.h>
#include <machine/metadata.h>
#include <machine/armreg.h>
+#include <machine/physmem.h>
+
#include <machine/bus.h>
#include <sys/reboot.h>
@@ -200,6 +202,7 @@ initarm(struct arm_boot_params *abp)
boothowto = RB_VERBOSE | RB_SINGLE; /* Default value */
lastaddr = parse_boot_param(abp);
+ arm_physmem_kernaddr = abp->abp_physaddr;
cninit();
set_cpufuncs();
physmem = memsize / PAGE_SIZE;
diff --git a/sys/arm/xscale/i80321/ep80219_machdep.c b/sys/arm/xscale/i80321/ep80219_machdep.c
index cf2e35e..4a58f37 100644
--- a/sys/arm/xscale/i80321/ep80219_machdep.c
+++ b/sys/arm/xscale/i80321/ep80219_machdep.c
@@ -86,6 +86,7 @@ __FBSDID("$FreeBSD$");
#include <machine/metadata.h>
#include <machine/armreg.h>
#include <machine/bus.h>
+#include <machine/physmem.h>
#include <sys/reboot.h>
#include <arm/xscale/i80321/i80321reg.h>
@@ -175,6 +176,7 @@ initarm(struct arm_boot_params *abp)
uint32_t memsize, memstart;
lastaddr = parse_boot_param(abp);
+ arm_physmem_kernaddr = abp->abp_physaddr;
set_cpufuncs();
pcpu_init(pcpup, 0, sizeof(struct pcpu));
PCPU_SET(curthread, &thread0);
diff --git a/sys/arm/xscale/i80321/iq31244_machdep.c b/sys/arm/xscale/i80321/iq31244_machdep.c
index 8b1de79..d82f2e3 100644
--- a/sys/arm/xscale/i80321/iq31244_machdep.c
+++ b/sys/arm/xscale/i80321/iq31244_machdep.c
@@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$");
#include <sys/msgbuf.h>
#include <machine/reg.h>
#include <machine/cpu.h>
+#include <machine/physmem.h>
#include <vm/vm.h>
#include <vm/pmap.h>
@@ -176,6 +177,7 @@ initarm(struct arm_boot_params *abp)
uint32_t memsize, memstart;
lastaddr = parse_boot_param(abp);
+ arm_physmem_kernaddr = abp->abp_physaddr;
set_cpufuncs();
pcpu_init(pcpup, 0, sizeof(struct pcpu));
PCPU_SET(curthread, &thread0);
diff --git a/sys/arm/xscale/i8134x/crb_machdep.c b/sys/arm/xscale/i8134x/crb_machdep.c
index b411635..6ec7a14 100644
--- a/sys/arm/xscale/i8134x/crb_machdep.c
+++ b/sys/arm/xscale/i8134x/crb_machdep.c
@@ -86,6 +86,7 @@ __FBSDID("$FreeBSD$");
#include <machine/metadata.h>
#include <machine/armreg.h>
#include <machine/bus.h>
+#include <machine/physmem.h>
#include <sys/reboot.h>
@@ -175,6 +176,7 @@ initarm(struct arm_boot_params *abp)
uint32_t memsize, memstart;
lastaddr = parse_boot_param(abp);
+ arm_physmem_kernaddr = abp->abp_physaddr;
set_cpufuncs();
pcpu_init(pcpup, 0, sizeof(struct pcpu));
PCPU_SET(curthread, &thread0);
diff --git a/sys/arm/xscale/ixp425/avila_machdep.c b/sys/arm/xscale/ixp425/avila_machdep.c
index e79e430..c1ae201 100644
--- a/sys/arm/xscale/ixp425/avila_machdep.c
+++ b/sys/arm/xscale/ixp425/avila_machdep.c
@@ -222,6 +222,7 @@ initarm(struct arm_boot_params *abp)
#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);
diff --git a/sys/arm/xscale/pxa/pxa_machdep.c b/sys/arm/xscale/pxa/pxa_machdep.c
index dfaccef..2058aa7 100644
--- a/sys/arm/xscale/pxa/pxa_machdep.c
+++ b/sys/arm/xscale/pxa/pxa_machdep.c
@@ -88,6 +88,7 @@ __FBSDID("$FreeBSD$");
#include <machine/metadata.h>
#include <machine/armreg.h>
#include <machine/bus.h>
+#include <machine/physmem.h>
#include <sys/reboot.h>
#include <arm/xscale/pxa/pxareg.h>
@@ -157,6 +158,7 @@ initarm(struct arm_boot_params *abp)
uint32_t memsize[PXA2X0_SDRAM_BANKS], memstart[PXA2X0_SDRAM_BANKS];
lastaddr = parse_boot_param(abp);
+ arm_physmem_kernaddr = abp->abp_physaddr;
set_cpufuncs();
pcpu_init(pcpup, 0, sizeof(struct pcpu));
PCPU_SET(curthread, &thread0);
OpenPOWER on IntegriCloud