From owner-svn-src-all@FreeBSD.ORG Sun Sep 23 03:46:04 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 76DCA106566C; Sun, 23 Sep 2012 03:46:04 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 614558FC0C; Sun, 23 Sep 2012 03:46:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8N3k4GZ007527; Sun, 23 Sep 2012 03:46:04 GMT (envelope-from andrew@svn.freebsd.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8N3k4WO007520; Sun, 23 Sep 2012 03:46:04 GMT (envelope-from andrew@svn.freebsd.org) Message-Id: <201209230346.q8N3k4WO007520@svn.freebsd.org> From: Andrew Turner Date: Sun, 23 Sep 2012 03:46:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r240846 - in head/sys/arm: broadcom/bcm2835 include mv tegra ti X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2012 03:46:04 -0000 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, }