Changeset 6bf44a5 in rtems


Ignore:
Timestamp:
Jan 26, 2016, 8:28:11 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
8ca372e
Parents:
ca4602e
git-author:
Sebastian Huber <sebastian.huber@…> (01/26/16 08:28:11)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/03/16 09:00:57)
Message:

Use linker set for driver manager initialization

Update #2408.

Location:
cpukit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libdrvmgr/drvmgr.c

    rca4602e r6bf44a5  
    1414#include <drvmgr/drvmgr.h>
    1515#include <drvmgr/drvmgr_confdefs.h>
     16
     17#include <rtems/sysinit.h>
    1618
    1719#include "drvmgr_internal.h"
     
    643645        bus->reslist = bres;
    644646}
     647
     648#ifdef RTEMS_DRVMGR_STARTUP
     649
     650RTEMS_SYSINIT_ITEM(
     651  _DRV_Manager_initialization,
     652  RTEMS_SYSINIT_DRVMGR,
     653  RTEMS_SYSINIT_ORDER_MIDDLE
     654);
     655
     656/* BSPs has already registered their "root bus" driver in the
     657 * bsp_predriver hook or so.
     658 *
     659 * Init Drivers to Level 1, constraints:
     660 *   - Interrupts and system clock timer does not work.
     661 *   - malloc() work, however other memory services may not
     662 *     have been initialized yet.
     663 *   - initializes most basic stuff
     664 *
     665 * Typical setup in Level 1:
     666 *   - Find most devices in system, do PCI scan and configuration.
     667 *   - Reset hardware if needed.
     668 *   - Install IRQ driver
     669 *   - Install Timer driver
     670 *   - Install console driver and debug printk()
     671 *   - Install extra memory.
     672 */
     673static void _DRV_Manager_init_level_1(void)
     674{
     675  _DRV_Manager_init_level(1);
     676}
     677
     678RTEMS_SYSINIT_ITEM(
     679  _DRV_Manager_init_level_1,
     680  RTEMS_SYSINIT_DRVMGR_LEVEL_1,
     681  RTEMS_SYSINIT_ORDER_MIDDLE
     682);
     683
     684/* Init Drivers to Level 2, constraints:
     685 *  - Interrupts can be registered and enabled.
     686 *  - System Clock is running
     687 *  - Console may be used.
     688 *
     689 * This is typically where drivers are initialized
     690 * for the first time.
     691 */
     692static void _DRV_Manager_init_level_2(void)
     693{
     694  _DRV_Manager_init_level(2);
     695}
     696
     697RTEMS_SYSINIT_ITEM(
     698  _DRV_Manager_init_level_2,
     699  RTEMS_SYSINIT_DRVMGR_LEVEL_2,
     700  RTEMS_SYSINIT_ORDER_MIDDLE
     701);
     702
     703/* Init Drivers to Level 3
     704 *
     705 * This is typically where normal drivers are initialized
     706 * for the second time, they may depend on other drivers
     707 * API inited in level 2
     708 */
     709static void _DRV_Manager_init_level_3(void)
     710{
     711  _DRV_Manager_init_level(3);
     712}
     713
     714RTEMS_SYSINIT_ITEM(
     715  _DRV_Manager_init_level_3,
     716  RTEMS_SYSINIT_DRVMGR_LEVEL_3,
     717  RTEMS_SYSINIT_ORDER_MIDDLE
     718);
     719
     720/* Init Drivers to Level 4,
     721 * Init drivers that depend on services initialized in Level 3
     722 */
     723static void _DRV_Manager_init_level_4(void)
     724{
     725  _DRV_Manager_init_level(4);
     726}
     727
     728RTEMS_SYSINIT_ITEM(
     729  _DRV_Manager_init_level_4,
     730  RTEMS_SYSINIT_DRVMGR_LEVEL_4,
     731  RTEMS_SYSINIT_ORDER_MIDDLE
     732);
     733
     734#endif /* RTEMS_DRVMGR_STARTUP */
  • cpukit/sapi/src/exinit.c

    rca4602e r6bf44a5  
    5252#include <rtems/sptables.h>
    5353
    54 #ifdef RTEMS_DRVMGR_STARTUP
    55   #include <drvmgr/drvmgr.h>
    56 #endif
    57 
    5854static Objects_Information *
    5955_Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ];
     
    130126static void rtems_initialize_before_drivers(void)
    131127{
    132   #ifdef RTEMS_DRVMGR_STARTUP
    133   _DRV_Manager_initialization();
    134   #endif
    135 
    136128  #if defined(RTEMS_MULTIPROCESSING)
    137129    _MPCI_Create_server();
     
    146138   *  NOTE:  The MPCI may be build upon a device driver.
    147139   */
    148 
    149   #ifdef RTEMS_DRVMGR_STARTUP
    150   /* BSPs has already registered their "root bus" driver in the
    151    * bsp_predriver hook or so.
    152    *
    153    * Init Drivers to Level 1, constraints:
    154    *   - Interrupts and system clock timer does not work.
    155    *   - malloc() work, however other memory services may not
    156    *     have been initialized yet.
    157    *   - initializes most basic stuff
    158    *
    159    * Typical setup in Level 1:
    160    *   - Find most devices in system, do PCI scan and configuration.
    161    *   - Reset hardware if needed.
    162    *   - Install IRQ driver
    163    *   - Install Timer driver
    164    *   - Install console driver and debug printk()
    165    *   - Install extra memory.
    166    */
    167   _DRV_Manager_init_level(1);
    168   bsp_driver_level_hook(1);
    169   #endif
    170140
    171141  /* Initialize I/O drivers.
     
    176146   */
    177147  _IO_Initialize_all_drivers();
    178 
    179   #ifdef RTEMS_DRVMGR_STARTUP
    180   /* Init Drivers to Level 2, constraints:
    181    *  - Interrupts can be registered and enabled.
    182    *  - System Clock is running
    183    *  - Console may be used.
    184    *
    185    * This is typically where drivers are initialized
    186    * for the first time.
    187    */
    188   _DRV_Manager_init_level(2);
    189   bsp_driver_level_hook(2);
    190 
    191   /* Init Drivers to Level 3
    192    *
    193    * This is typically where normal drivers are initialized
    194    * for the second time, they may depend on other drivers
    195    * API inited in level 2
    196    */
    197   _DRV_Manager_init_level(3);
    198   bsp_driver_level_hook(3);
    199 
    200   /* Init Drivers to Level 4,
    201    * Init drivers that depend on services initialized in Level 3
    202    */
    203   _DRV_Manager_init_level(4);
    204   bsp_driver_level_hook(4);
    205   #endif
    206148
    207149  #if defined(RTEMS_MULTIPROCESSING)
  • cpukit/score/include/rtems/sysinit.h

    rca4602e r6bf44a5  
    5959#define RTEMS_SYSINIT_LIBIO                      000400
    6060#define RTEMS_SYSINIT_ROOT_FILESYSTEM            000401
    61 #define RTEMS_SYSINIT_BEFORE_DRIVERS             000500
     61#define RTEMS_SYSINIT_DRVMGR                     000500
     62#define RTEMS_SYSINIT_BEFORE_DRIVERS             000501
    6263#define RTEMS_SYSINIT_BSP_PRE_DRIVERS            000600
    63 #define RTEMS_SYSINIT_DEVICE_DRIVERS             000700
     64#define RTEMS_SYSINIT_DRVMGR_LEVEL_1             000700
     65#define RTEMS_SYSINIT_DEVICE_DRIVERS             000701
     66#define RTEMS_SYSINIT_DRVMGR_LEVEL_2             000702
     67#define RTEMS_SYSINIT_DRVMGR_LEVEL_3             000703
     68#define RTEMS_SYSINIT_DRVMGR_LEVEL_4             000704
    6469#define RTEMS_SYSINIT_STD_FILE_DESCRIPTORS       000800
    6570
Note: See TracChangeset for help on using the changeset viewer.