From c4ccf26cb7808786e15312b41c3055b2da75203b Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 17 Apr 2018 06:57:46 +0200 Subject: bsps: Convert all bsp_predriver_hook() Use RTEMS_SYSINIT_ITEM() instead. Update #2408. --- c/src/lib/libbsp/sparc/erc32/Makefile.am | 3 +- .../lib/libbsp/sparc/erc32/startup/bsppredriver.c | 30 -------- c/src/lib/libbsp/sparc/leon2/Makefile.am | 1 - .../lib/libbsp/sparc/leon2/startup/bsppredriver.c | 88 ---------------------- c/src/lib/libbsp/sparc/leon2/startup/bspstart.c | 77 +++++++++++++++++++ c/src/lib/libbsp/sparc/leon3/Makefile.am | 1 - .../lib/libbsp/sparc/leon3/startup/bsppredriver.c | 56 -------------- c/src/lib/libbsp/sparc/leon3/startup/bspstart.c | 43 +++++++++++ 8 files changed, 121 insertions(+), 178 deletions(-) delete mode 100644 c/src/lib/libbsp/sparc/erc32/startup/bsppredriver.c delete mode 100644 c/src/lib/libbsp/sparc/leon2/startup/bsppredriver.c delete mode 100644 c/src/lib/libbsp/sparc/leon3/startup/bsppredriver.c (limited to 'c/src/lib/libbsp/sparc') diff --git a/c/src/lib/libbsp/sparc/erc32/Makefile.am b/c/src/lib/libbsp/sparc/erc32/Makefile.am index 616da2bde2..526cf3fb4d 100644 --- a/c/src/lib/libbsp/sparc/erc32/Makefile.am +++ b/c/src/lib/libbsp/sparc/erc32/Makefile.am @@ -21,10 +21,9 @@ librtemsbsp_a_SOURCES = # startup librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c -librtemsbsp_a_SOURCES += startup/bsppredriver.c librtemsbsp_a_SOURCES += ../shared/startup/bspgetworkarea.c librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspreset-empty.c -librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspstart-empty.c +librtemsbsp_a_SOURCES += ../../../../../../bsps/sparc/erc32/start/bspstart.c librtemsbsp_a_SOURCES += ../../shared/getentropy-cpucounter.c librtemsbsp_a_SOURCES += ../../shared/sbrk.c librtemsbsp_a_SOURCES += startup/setvec.c diff --git a/c/src/lib/libbsp/sparc/erc32/startup/bsppredriver.c b/c/src/lib/libbsp/sparc/erc32/startup/bsppredriver.c deleted file mode 100644 index 6c6ea1e634..0000000000 --- a/c/src/lib/libbsp/sparc/erc32/startup/bsppredriver.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Installs the BSP pre-driver hook - */ - -/* - * COPYRIGHT (c) 2011 - * Aeroflex Gaisler - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#include -#include - -/* - * bsp_predriver_hook - * - * BSP predriver hook. Called just before drivers are initialized. - * Is used to initialize shared interrupt handling. - */ -void bsp_predriver_hook( void ) -{ - bsp_spurious_initialize(); - - /* Initialize shared interrupt handling, must be done after IRQ - * controller has been found and initialized. - */ - BSP_shared_interrupt_init(); -} diff --git a/c/src/lib/libbsp/sparc/leon2/Makefile.am b/c/src/lib/libbsp/sparc/leon2/Makefile.am index a6d5d48564..edbe4ce025 100644 --- a/c/src/lib/libbsp/sparc/leon2/Makefile.am +++ b/c/src/lib/libbsp/sparc/leon2/Makefile.am @@ -23,7 +23,6 @@ librtemsbsp_a_SOURCES = # startup librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspfatal-default.c -librtemsbsp_a_SOURCES += startup/bsppredriver.c librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/start/bspreset-empty.c librtemsbsp_a_SOURCES += startup/bspstart.c librtemsbsp_a_SOURCES += ../shared/startup/bspgetworkarea.c diff --git a/c/src/lib/libbsp/sparc/leon2/startup/bsppredriver.c b/c/src/lib/libbsp/sparc/leon2/startup/bsppredriver.c deleted file mode 100644 index b11ad4cb59..0000000000 --- a/c/src/lib/libbsp/sparc/leon2/startup/bsppredriver.c +++ /dev/null @@ -1,88 +0,0 @@ -/** - * @file - * @ingroup sparc_leon2 - * @brief Installs BSP pre-driver hook - */ - -/* Installs the BSP pre-driver hook - * - * COPYRIGHT (c) 2011 - * Aeroflex Gaisler - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#include -#include - -/* If RTEMS_DRVMGR_STARTUP is defined extra code is added that - * registers the LEON2 AMBA bus driver as root driver into the - * driver manager. - * - * The structues here are declared weak so that the user can override - * the configuration and add custom cores in the RTEMS project. - */ -#ifdef RTEMS_DRVMGR_STARTUP -#include -#include - -/* All drivers included by BSP, this is overridden by the user by including - * the devmgr_confdefs.h. No specifc drivers needed by BSP since IRQ/TIMER/UART - * is not drvmgr drivers. - */ -drvmgr_drv_reg_func drvmgr_drivers[] __attribute__((weak)) = -{ - NULL /* End array with NULL */ -}; - -/* Defines what cores are avilable on the bus in addition to the standard - * LEON2 peripherals. - */ -struct leon2_core leon2_amba_custom_cores[] __attribute__((weak)) = -{ - EMPTY_LEON2_CORE -}; - -/* Configure LEON2 Root bus driver */ -struct leon2_bus leon2_bus_config __attribute__((weak)) = -{ - &leon2_std_cores[0], /* The standard cores, defined by driver */ - &leon2_amba_custom_cores[0], /* custom cores, defined by us */ - DRVMGR_TRANSLATE_ONE2ONE, - DRVMGR_TRANSLATE_ONE2ONE, -}; - -/* Driver resources on LEON2 AMBA bus. Used to set options for particular - * LEON2 cores, it is up to the driver to look at the configuration paramters - * once started. - */ -struct drvmgr_bus_res leon2_amba_res __attribute__((weak)) = -{ - .next = NULL, - .resource = { - DRVMGR_RES_EMPTY - }, -}; -#endif /* RTEMS_DRVMGR_STARTUP */ - -/* - * bsp_predriver_hook - * - * BSP predriver hook. Called just before drivers are initialized. - * Is used to initialize shared interrupt handling. - */ -void bsp_predriver_hook( void ) -{ - bsp_spurious_initialize(); - - /* Initialize shared interrupt handling, must be done after IRQ - * controller has been found and initialized. - */ - BSP_shared_interrupt_init(); - -#ifdef RTEMS_DRVMGR_STARTUP - leon2_root_register(&leon2_bus_config, &leon2_amba_res); -#endif -} diff --git a/c/src/lib/libbsp/sparc/leon2/startup/bspstart.c b/c/src/lib/libbsp/sparc/leon2/startup/bspstart.c index b3da955410..f2ed8ae16c 100644 --- a/c/src/lib/libbsp/sparc/leon2/startup/bspstart.c +++ b/c/src/lib/libbsp/sparc/leon2/startup/bspstart.c @@ -7,6 +7,8 @@ /* * LEON2 Cache Snooping Support * + * COPYRIGHT (c) 2011 + * Aeroflex Gaisler * * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). @@ -25,6 +27,7 @@ #include #include +#include /* * Tells us if data cache snooping is available @@ -48,3 +51,77 @@ void bsp_start( void ) { CPU_SPARC_HAS_SNOOPING = set_snooping(); } + +/* If RTEMS_DRVMGR_STARTUP is defined extra code is added that + * registers the LEON2 AMBA bus driver as root driver into the + * driver manager. + * + * The structues here are declared weak so that the user can override + * the configuration and add custom cores in the RTEMS project. + */ +#ifdef RTEMS_DRVMGR_STARTUP +#include +#include + +/* All drivers included by BSP, this is overridden by the user by including + * the devmgr_confdefs.h. No specifc drivers needed by BSP since IRQ/TIMER/UART + * is not drvmgr drivers. + */ +drvmgr_drv_reg_func drvmgr_drivers[] __attribute__((weak)) = +{ + NULL /* End array with NULL */ +}; + +/* Defines what cores are avilable on the bus in addition to the standard + * LEON2 peripherals. + */ +struct leon2_core leon2_amba_custom_cores[] __attribute__((weak)) = +{ + EMPTY_LEON2_CORE +}; + +/* Configure LEON2 Root bus driver */ +struct leon2_bus leon2_bus_config __attribute__((weak)) = +{ + &leon2_std_cores[0], /* The standard cores, defined by driver */ + &leon2_amba_custom_cores[0], /* custom cores, defined by us */ + DRVMGR_TRANSLATE_ONE2ONE, + DRVMGR_TRANSLATE_ONE2ONE, +}; + +/* Driver resources on LEON2 AMBA bus. Used to set options for particular + * LEON2 cores, it is up to the driver to look at the configuration paramters + * once started. + */ +struct drvmgr_bus_res leon2_amba_res __attribute__((weak)) = +{ + .next = NULL, + .resource = { + DRVMGR_RES_EMPTY + }, +}; +#endif /* RTEMS_DRVMGR_STARTUP */ + +/* + * Called just before drivers are initialized. Is used to initialize shared + * interrupt handling. + */ +static void leon2_pre_driver_hook( void ) +{ + bsp_spurious_initialize(); + + /* Initialize shared interrupt handling, must be done after IRQ + * controller has been found and initialized. + */ + BSP_shared_interrupt_init(); + +#ifdef RTEMS_DRVMGR_STARTUP + leon2_root_register(&leon2_bus_config, &leon2_amba_res); +#endif +} + +RTEMS_SYSINIT_ITEM( + leon2_pre_driver_hook, + RTEMS_SYSINIT_BSP_PRE_DRIVERS, + RTEMS_SYSINIT_ORDER_MIDDLE +); diff --git a/c/src/lib/libbsp/sparc/leon3/Makefile.am b/c/src/lib/libbsp/sparc/leon3/Makefile.am index 2f8c294b57..27c1a96144 100644 --- a/c/src/lib/libbsp/sparc/leon3/Makefile.am +++ b/c/src/lib/libbsp/sparc/leon3/Makefile.am @@ -28,7 +28,6 @@ librtemsbsp_a_SOURCES = librtemsbsp_a_SOURCES += startup/bspclean.c librtemsbsp_a_SOURCES += startup/bspstart.c librtemsbsp_a_SOURCES += ../../shared/getentropy-cpucounter.c -librtemsbsp_a_SOURCES += startup/bsppredriver.c librtemsbsp_a_SOURCES += ../shared/startup/bspgetworkarea.c librtemsbsp_a_SOURCES += ../../shared/sbrk.c librtemsbsp_a_SOURCES += startup/setvec.c diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bsppredriver.c b/c/src/lib/libbsp/sparc/leon3/startup/bsppredriver.c deleted file mode 100644 index ba35624d33..0000000000 --- a/c/src/lib/libbsp/sparc/leon3/startup/bsppredriver.c +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @file - * @ingroup sparc_leon3 - * @brief Installs the BSP pre-driver hook - */ - -/* - * COPYRIGHT (c) 2011 - * Aeroflex Gaisler - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#include -#include - -#include - -#include - -static void leon3_interrupt_common_init( void ) -{ - /* Initialize shared interrupt handling, must be done after IRQ - * controller has been found and initialized. - */ - BSP_shared_interrupt_init(); -} - -/* - * bsp_predriver_hook - * - * BSP predriver hook. Called just before drivers are initialized. - * Is used to initialize shared interrupt handling. - */ -void bsp_predriver_hook( void ) -{ - bsp_spurious_initialize(); - -#ifndef RTEMS_DRVMGR_STARTUP - leon3_interrupt_common_init(); -#endif -} - -#ifdef RTEMS_DRVMGR_STARTUP -/* - * Initialize shared interrupt handling, must be done after IRQ controller has - * been found and initialized. - */ -RTEMS_SYSINIT_ITEM( - leon3_interrupt_common_init, - RTEMS_SYSINIT_DRVMGR_LEVEL_1, - RTEMS_SYSINIT_ORDER_LAST -); -#endif diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c b/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c index 6353ca3772..58fc7d0907 100644 --- a/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c +++ b/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c @@ -4,6 +4,9 @@ * The generic CPU dependent initialization has been performed * before any of these are invoked. * + * COPYRIGHT (c) 2011 + * Aeroflex Gaisler + * * COPYRIGHT (c) 1989-2013. * On-Line Applications Research Corporation (OAR). * @@ -19,6 +22,7 @@ #include #include #include +#include #include #if defined(RTEMS_SMP) || defined(RTEMS_MULTIPROCESSING) @@ -80,3 +84,42 @@ RTEMS_SYSINIT_ITEM( RTEMS_SYSINIT_BSP_START, RTEMS_SYSINIT_ORDER_FIRST ); + +static void leon3_interrupt_common_init( void ) +{ + /* Initialize shared interrupt handling, must be done after IRQ + * controller has been found and initialized. + */ + BSP_shared_interrupt_init(); +} + +/* + * Called just before drivers are initialized. Is used to initialize shared + * interrupt handling. + */ +static void leon3_pre_driver_hook( void ) +{ + bsp_spurious_initialize(); + +#ifndef RTEMS_DRVMGR_STARTUP + leon3_interrupt_common_init(); +#endif +} + +RTEMS_SYSINIT_ITEM( + leon3_pre_driver_hook, + RTEMS_SYSINIT_BSP_PRE_DRIVERS, + RTEMS_SYSINIT_ORDER_MIDDLE +); + +#ifdef RTEMS_DRVMGR_STARTUP +/* + * Initialize shared interrupt handling, must be done after IRQ controller has + * been found and initialized. + */ +RTEMS_SYSINIT_ITEM( + leon3_interrupt_common_init, + RTEMS_SYSINIT_DRVMGR_LEVEL_1, + RTEMS_SYSINIT_ORDER_LAST +); +#endif -- cgit v1.2.3