Author: andrew Date: Sun Sep 23 03:46:03 2012 New Revision: 240846 URL: http://svn.freebsd.org/changeset/base/240846
Log: Pull out the SoC specific parts of initarm into separate functions Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c head/sys/arm/include/machdep.h head/sys/arm/mv/mv_machdep.c head/sys/arm/tegra/tegra2_machdep.c head/sys/arm/ti/ti_machdep.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sun Sep 23 02:01:59 2012 (r240845) +++ head/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sun Sep 23 03:46:03 2012 (r240846) @@ -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, } Modified: head/sys/arm/include/machdep.h ============================================================================== --- head/sys/arm/include/machdep.h Sun Sep 23 02:01:59 2012 (r240845) +++ head/sys/arm/include/machdep.h Sun Sep 23 03:46:03 2012 (r240846) @@ -31,6 +31,11 @@ vm_offset_t linux_parse_boot_param(struc 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); Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Sun Sep 23 02:01:59 2012 (r240845) +++ head/sys/arm/mv/mv_machdep.c Sun Sep 23 03:46:03 2012 (r240846) @@ -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, } Modified: head/sys/arm/tegra/tegra2_machdep.c ============================================================================== --- head/sys/arm/tegra/tegra2_machdep.c Sun Sep 23 02:01:59 2012 (r240845) +++ head/sys/arm/tegra/tegra2_machdep.c Sun Sep 23 03:46:03 2012 (r240846) @@ -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, } Modified: head/sys/arm/ti/ti_machdep.c ============================================================================== --- head/sys/arm/ti/ti_machdep.c Sun Sep 23 02:01:59 2012 (r240845) +++ head/sys/arm/ti/ti_machdep.c Sun Sep 23 03:46:03 2012 (r240846) @@ -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, } _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"