Use linker set for driver manager initialization

Update #2408.
This commit is contained in:
Sebastian Huber
2016-01-26 09:28:11 +01:00
parent ca4602e914
commit 6bf44a581b
3 changed files with 97 additions and 60 deletions

View File

@@ -14,6 +14,8 @@
#include <drvmgr/drvmgr.h>
#include <drvmgr/drvmgr_confdefs.h>
#include <rtems/sysinit.h>
#include "drvmgr_internal.h"
/* Enable debugging */
@@ -642,3 +644,91 @@ void drvmgr_bus_res_add(struct drvmgr_bus *bus,
bres->next = bus->reslist;
bus->reslist = bres;
}
#ifdef RTEMS_DRVMGR_STARTUP
RTEMS_SYSINIT_ITEM(
_DRV_Manager_initialization,
RTEMS_SYSINIT_DRVMGR,
RTEMS_SYSINIT_ORDER_MIDDLE
);
/* BSPs has already registered their "root bus" driver in the
* bsp_predriver hook or so.
*
* Init Drivers to Level 1, constraints:
* - Interrupts and system clock timer does not work.
* - malloc() work, however other memory services may not
* have been initialized yet.
* - initializes most basic stuff
*
* Typical setup in Level 1:
* - Find most devices in system, do PCI scan and configuration.
* - Reset hardware if needed.
* - Install IRQ driver
* - Install Timer driver
* - Install console driver and debug printk()
* - Install extra memory.
*/
static void _DRV_Manager_init_level_1(void)
{
_DRV_Manager_init_level(1);
}
RTEMS_SYSINIT_ITEM(
_DRV_Manager_init_level_1,
RTEMS_SYSINIT_DRVMGR_LEVEL_1,
RTEMS_SYSINIT_ORDER_MIDDLE
);
/* Init Drivers to Level 2, constraints:
* - Interrupts can be registered and enabled.
* - System Clock is running
* - Console may be used.
*
* This is typically where drivers are initialized
* for the first time.
*/
static void _DRV_Manager_init_level_2(void)
{
_DRV_Manager_init_level(2);
}
RTEMS_SYSINIT_ITEM(
_DRV_Manager_init_level_2,
RTEMS_SYSINIT_DRVMGR_LEVEL_2,
RTEMS_SYSINIT_ORDER_MIDDLE
);
/* Init Drivers to Level 3
*
* This is typically where normal drivers are initialized
* for the second time, they may depend on other drivers
* API inited in level 2
*/
static void _DRV_Manager_init_level_3(void)
{
_DRV_Manager_init_level(3);
}
RTEMS_SYSINIT_ITEM(
_DRV_Manager_init_level_3,
RTEMS_SYSINIT_DRVMGR_LEVEL_3,
RTEMS_SYSINIT_ORDER_MIDDLE
);
/* Init Drivers to Level 4,
* Init drivers that depend on services initialized in Level 3
*/
static void _DRV_Manager_init_level_4(void)
{
_DRV_Manager_init_level(4);
}
RTEMS_SYSINIT_ITEM(
_DRV_Manager_init_level_4,
RTEMS_SYSINIT_DRVMGR_LEVEL_4,
RTEMS_SYSINIT_ORDER_MIDDLE
);
#endif /* RTEMS_DRVMGR_STARTUP */

View File

@@ -51,10 +51,6 @@
#include <rtems/sptables.h>
#ifdef RTEMS_DRVMGR_STARTUP
#include <drvmgr/drvmgr.h>
#endif
static Objects_Information *
_Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ];
@@ -129,10 +125,6 @@ static void rtems_initialize_data_structures(void)
static void rtems_initialize_before_drivers(void)
{
#ifdef RTEMS_DRVMGR_STARTUP
_DRV_Manager_initialization();
#endif
#if defined(RTEMS_MULTIPROCESSING)
_MPCI_Create_server();
#endif
@@ -146,28 +138,6 @@ static void rtems_initialize_device_drivers(void)
* NOTE: The MPCI may be build upon a device driver.
*/
#ifdef RTEMS_DRVMGR_STARTUP
/* BSPs has already registered their "root bus" driver in the
* bsp_predriver hook or so.
*
* Init Drivers to Level 1, constraints:
* - Interrupts and system clock timer does not work.
* - malloc() work, however other memory services may not
* have been initialized yet.
* - initializes most basic stuff
*
* Typical setup in Level 1:
* - Find most devices in system, do PCI scan and configuration.
* - Reset hardware if needed.
* - Install IRQ driver
* - Install Timer driver
* - Install console driver and debug printk()
* - Install extra memory.
*/
_DRV_Manager_init_level(1);
bsp_driver_level_hook(1);
#endif
/* Initialize I/O drivers.
*
* Driver Manager note:
@@ -176,34 +146,6 @@ static void rtems_initialize_device_drivers(void)
*/
_IO_Initialize_all_drivers();
#ifdef RTEMS_DRVMGR_STARTUP
/* Init Drivers to Level 2, constraints:
* - Interrupts can be registered and enabled.
* - System Clock is running
* - Console may be used.
*
* This is typically where drivers are initialized
* for the first time.
*/
_DRV_Manager_init_level(2);
bsp_driver_level_hook(2);
/* Init Drivers to Level 3
*
* This is typically where normal drivers are initialized
* for the second time, they may depend on other drivers
* API inited in level 2
*/
_DRV_Manager_init_level(3);
bsp_driver_level_hook(3);
/* Init Drivers to Level 4,
* Init drivers that depend on services initialized in Level 3
*/
_DRV_Manager_init_level(4);
bsp_driver_level_hook(4);
#endif
#if defined(RTEMS_MULTIPROCESSING)
if ( _System_state_Is_multiprocessing ) {
_MPCI_Initialization();

View File

@@ -58,9 +58,14 @@ extern "C" {
#define RTEMS_SYSINIT_IDLE_THREADS 000380
#define RTEMS_SYSINIT_LIBIO 000400
#define RTEMS_SYSINIT_ROOT_FILESYSTEM 000401
#define RTEMS_SYSINIT_BEFORE_DRIVERS 000500
#define RTEMS_SYSINIT_DRVMGR 000500
#define RTEMS_SYSINIT_BEFORE_DRIVERS 000501
#define RTEMS_SYSINIT_BSP_PRE_DRIVERS 000600
#define RTEMS_SYSINIT_DEVICE_DRIVERS 000700
#define RTEMS_SYSINIT_DRVMGR_LEVEL_1 000700
#define RTEMS_SYSINIT_DEVICE_DRIVERS 000701
#define RTEMS_SYSINIT_DRVMGR_LEVEL_2 000702
#define RTEMS_SYSINIT_DRVMGR_LEVEL_3 000703
#define RTEMS_SYSINIT_DRVMGR_LEVEL_4 000704
#define RTEMS_SYSINIT_STD_FILE_DESCRIPTORS 000800
/*