diff options
Diffstat (limited to 'cpukit/sapi')
-rw-r--r-- | cpukit/sapi/include/confdefs.h | 11 | ||||
-rw-r--r-- | cpukit/sapi/src/exinit.c | 63 |
2 files changed, 73 insertions, 1 deletions
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index daeda0be3c..9f3640b4a6 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -161,6 +161,15 @@ const rtems_libio_helper rtems_fs_init_helper = */ #define CONFIGURE_LIBIO_POSIX_KEYS 1 +/** + * Driver Manager Configuration + */ +#ifdef RTEMS_DRVMGR_STARTUP + #define CONFIGURE_DRVMGR_SEMAPHORES 1 +#else + #define CONFIGURE_DRVMGR_SEMAPHORES 0 +#endif + #ifdef CONFIGURE_INIT rtems_libio_t rtems_libio_iops[CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS]; @@ -2170,7 +2179,7 @@ const rtems_libio_helper rtems_fs_init_helper = (CONFIGURE_MAXIMUM_SEMAPHORES + CONFIGURE_LIBIO_SEMAPHORES + \ CONFIGURE_TERMIOS_SEMAPHORES + CONFIGURE_LIBBLOCK_SEMAPHORES + \ CONFIGURE_SEMAPHORES_FOR_FILE_SYSTEMS + \ - CONFIGURE_NETWORKING_SEMAPHORES) + CONFIGURE_NETWORKING_SEMAPHORES + CONFIGURE_DRVMGR_SEMAPHORES) /** * This macro is calculated to specify the memory required for diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c index 235ba77c41..ba71ec465b 100644 --- a/cpukit/sapi/src/exinit.c +++ b/cpukit/sapi/src/exinit.c @@ -56,6 +56,10 @@ #include <rtems/rtems/rtemsapi.h> #include <rtems/posix/posixapi.h> +#ifdef RTEMS_DRVMGR_STARTUP + #include <drvmgr/drvmgr.h> +#endif + Objects_Information *_Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ]; void rtems_initialize_data_structures(void) @@ -161,6 +165,9 @@ void rtems_initialize_data_structures(void) void rtems_initialize_before_drivers(void) { + #ifdef RTEMS_DRVMGR_STARTUP + _DRV_Manager_initialization(); + #endif #if defined(RTEMS_MULTIPROCESSING) _MPCI_Create_server(); @@ -182,8 +189,64 @@ 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: + * All drivers may not be registered yet. Drivers will dynamically + * be initialized when registered in level 2,3 and 4. + */ _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(); |