summaryrefslogtreecommitdiffstats
path: root/sys/arm
diff options
context:
space:
mode:
authorandrew <andrew@FreeBSD.org>2012-09-23 03:46:03 +0000
committerandrew <andrew@FreeBSD.org>2012-09-23 03:46:03 +0000
commitdd6a23c4f5fa55e20c9f42dccf0148a82c3210ac (patch)
tree104d5a982f719dbec7477f1544fda5ad02444006 /sys/arm
parentd9ebf06192583d13a8f9b61c12451be1e98c3984 (diff)
downloadFreeBSD-src-dd6a23c4f5fa55e20c9f42dccf0148a82c3210ac.zip
FreeBSD-src-dd6a23c4f5fa55e20c9f42dccf0148a82c3210ac.tar.gz
Pull out the SoC specific parts of initarm into separate functions
Diffstat (limited to 'sys/arm')
-rw-r--r--sys/arm/broadcom/bcm2835/bcm2835_machdep.c23
-rw-r--r--sys/arm/include/machdep.h5
-rw-r--r--sys/arm/mv/mv_machdep.c63
-rw-r--r--sys/arm/tegra/tegra2_machdep.c30
-rw-r--r--sys/arm/ti/ti_machdep.c25
5 files changed, 118 insertions, 28 deletions
diff --git a/sys/arm/broadcom/bcm2835/bcm2835_machdep.c b/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
index 0865dcc..6726265 100644
--- a/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
+++ b/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
@@ -344,7 +344,7 @@ initarm(struct arm_boot_params *abp)
while(1);
/* Platform-specific initialisation */
- pmap_bootstrap_lastaddr = DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE;
+ pmap_bootstrap_lastaddr = initarm_lastaddr();
pcpu0_init();
@@ -484,6 +484,8 @@ initarm(struct arm_boot_params *abp)
*/
OF_interpret("perform-fixup", 0);
+ initarm_gpio_init();
+
cninit();
physmem = memsize / PAGE_SIZE;
@@ -495,6 +497,8 @@ initarm(struct arm_boot_params *abp)
print_kernel_section_addr();
print_kenv();
+ initarm_late_init();
+
/*
* Pages were allocated during the secondary bootstrap for the
* stacks for different CPU modes.
@@ -547,6 +551,23 @@ initarm(struct arm_boot_params *abp)
sizeof(struct pcb)));
}
+vm_offset_t
+initarm_lastaddr(void)
+{
+
+ return (DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE);
+}
+
+void
+initarm_gpio_init(void)
+{
+}
+
+void
+initarm_late_init(void)
+{
+}
+
#define FDT_DEVMAP_MAX (2) // FIXME
static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = {
{ 0, 0, 0, 0, 0, }
diff --git a/sys/arm/include/machdep.h b/sys/arm/include/machdep.h
index af6b1fc..c4ae3a8 100644
--- a/sys/arm/include/machdep.h
+++ b/sys/arm/include/machdep.h
@@ -31,6 +31,11 @@ vm_offset_t linux_parse_boot_param(struct arm_boot_params *abp);
vm_offset_t fake_preload_metadata(struct arm_boot_params *abp);
vm_offset_t parse_boot_param(struct arm_boot_params *abp);
+/* Called by initarm */
+vm_offset_t initarm_lastaddr(void);
+void initarm_gpio_init(void);
+void initarm_late_init(void);
+
/* Setup standard arrays */
void arm_dump_avail_init( vm_offset_t memsize, size_t max);
diff --git a/sys/arm/mv/mv_machdep.c b/sys/arm/mv/mv_machdep.c
index 80d841b..19d66c0 100644
--- a/sys/arm/mv/mv_machdep.c
+++ b/sys/arm/mv/mv_machdep.c
@@ -334,11 +334,8 @@ initarm(struct arm_boot_params *abp)
&memsize) != 0)
while(1);
- if (fdt_immr_addr(MV_BASE) != 0)
- while (1);
-
/* Platform-specific initialisation */
- pmap_bootstrap_lastaddr = fdt_immr_va - ARM_NOCACHE_KVA_SIZE;
+ pmap_bootstrap_lastaddr = initarm_lastaddr();
pcpu0_init();
@@ -472,12 +469,7 @@ initarm(struct arm_boot_params *abp)
*/
OF_interpret("perform-fixup", 0);
- /*
- * Re-initialise MPP. It is important to call this prior to using
- * console as the physical connection can be routed via MPP.
- */
- if (platform_mpp_init() != 0)
- while (1);
+ initarm_gpio_init();
cninit();
@@ -494,17 +486,7 @@ initarm(struct arm_boot_params *abp)
printf("WARNING: could not fully configure devmap, error=%d\n",
err_devmap);
- /*
- * Re-initialise decode windows
- */
-#if !defined(SOC_MV_FREY)
- if (soc_decode_win() != 0)
- printf("WARNING: could not re-initialise decode windows! "
- "Running with existing settings...\n");
-#else
- /* Disable watchdog and timers */
- write_cpu_ctrl(CPU_TIMERS_BASE + CPU_TIMER_CONTROL, 0);
-#endif
+ initarm_late_init();
/*
* Pages were allocated during the secondary bootstrap for the
@@ -692,6 +674,45 @@ moveon:
return (0);
}
+vm_offset_t
+initarm_lastaddr(void)
+{
+
+ if (fdt_immr_addr(MV_BASE) != 0)
+ while (1);
+
+ /* Platform-specific initialisation */
+ return (fdt_immr_va - ARM_NOCACHE_KVA_SIZE);
+}
+
+void
+initarm_gpio_init(void)
+{
+
+ /*
+ * Re-initialise MPP. It is important to call this prior to using
+ * console as the physical connection can be routed via MPP.
+ */
+ if (platform_mpp_init() != 0)
+ while (1);
+}
+
+void
+initarm_late_init(void)
+{
+ /*
+ * Re-initialise decode windows
+ */
+#if !defined(SOC_MV_FREY)
+ if (soc_decode_win() != 0)
+ printf("WARNING: could not re-initialise decode windows! "
+ "Running with existing settings...\n");
+#else
+ /* Disable watchdog and timers */
+ write_cpu_ctrl(CPU_TIMERS_BASE + CPU_TIMER_CONTROL, 0);
+#endif
+}
+
#define FDT_DEVMAP_MAX (MV_WIN_CPU_MAX + 2)
static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = {
{ 0, 0, 0, 0, 0, }
diff --git a/sys/arm/tegra/tegra2_machdep.c b/sys/arm/tegra/tegra2_machdep.c
index 73d2ccf..a1880b8 100644
--- a/sys/arm/tegra/tegra2_machdep.c
+++ b/sys/arm/tegra/tegra2_machdep.c
@@ -383,10 +383,8 @@ initarm(struct arm_boot_params *abp)
&memsize) != 0)
while(1);
- if (fdt_immr_addr(TEGRA2_BASE) != 0) /* FIXME ???? */
- while (1);
-
- pmap_bootstrap_lastaddr = fdt_immr_va - ARM_NOCACHE_KVA_SIZE;
+ /* Platform-specific initialisation */
+ pmap_bootstrap_lastaddr = initarm_lastaddr();
pcpu0_init();
@@ -520,6 +518,8 @@ initarm(struct arm_boot_params *abp)
*/
OF_interpret("perform-fixup", 0);
+ initarm_gpio_init();
+
cninit();
physmem = memsize / PAGE_SIZE;
@@ -535,6 +535,8 @@ initarm(struct arm_boot_params *abp)
printf("WARNING: could not fully configure devmap, error=%d\n",
err_devmap);
+ initarm_late_init();
+
/*
* Pages were allocated during the secondary bootstrap for the
* stacks for different CPU modes.
@@ -587,6 +589,26 @@ initarm(struct arm_boot_params *abp)
sizeof(struct pcb)));
}
+vm_offset_t
+initarm_lastaddr(void)
+{
+
+ if (fdt_immr_addr(TEGRA2_BASE) != 0) /* FIXME ???? */
+ while (1);
+
+ return (fdt_immr_va - ARM_NOCACHE_KVA_SIZE);
+}
+
+void
+initarm_gpio_init(void)
+{
+}
+
+void
+initarm_late_init(void)
+{
+}
+
#define FDT_DEVMAP_MAX (1 + 2 + 1 + 1) /* FIXME */
static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = {
{ 0, 0, 0, 0, 0, }
diff --git a/sys/arm/ti/ti_machdep.c b/sys/arm/ti/ti_machdep.c
index 0a2413c..e6d3382 100644
--- a/sys/arm/ti/ti_machdep.c
+++ b/sys/arm/ti/ti_machdep.c
@@ -344,8 +344,7 @@ initarm(struct arm_boot_params *abp)
while(1);
/* Platform-specific initialisation */
- pmap_bootstrap_lastaddr = DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE;
- ti_cpu_reset = NULL;
+ pmap_bootstrap_lastaddr = initarm_lastaddr();
pcpu0_init();
@@ -479,6 +478,8 @@ initarm(struct arm_boot_params *abp)
*/
OF_interpret("perform-fixup", 0);
+ initarm_gpio_init();
+
cninit();
physmem = memsize / PAGE_SIZE;
@@ -494,6 +495,8 @@ initarm(struct arm_boot_params *abp)
printf("WARNING: could not fully configure devmap, error=%d\n",
err_devmap);
+ initarm_late_init();
+
/*
* Pages were allocated during the secondary bootstrap for the
* stacks for different CPU modes.
@@ -546,6 +549,24 @@ initarm(struct arm_boot_params *abp)
sizeof(struct pcb)));
}
+vm_offset_t
+initarm_lastaddr(void)
+{
+
+ ti_cpu_reset = NULL;
+ return (DEVMAP_BOOTSTRAP_MAP_START - ARM_NOCACHE_KVA_SIZE);
+}
+
+void
+initarm_gpio_init(void)
+{
+}
+
+void
+initarm_late_init(void)
+{
+}
+
#define FDT_DEVMAP_MAX (2) // FIXME
static struct pmap_devmap fdt_devmap[FDT_DEVMAP_MAX] = {
{ 0, 0, 0, 0, 0, }
OpenPOWER on IntegriCloud