openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

appl_ref_init_deinit.h (7008B)


      1 /** \file appl_ref_init_deinit.h
      2  *
      3  * init and deinit functions to be used by the INIT_DNX command.
      4  *
      5  * need to make minimal amount of steps before we are able to use call bcm_init
      6  */
      7 
      8 /*
      9  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
     10  * 
     11  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
     12  */
     13 
     14 #ifndef FILE_APPL_REF_DNXC_INIT_DEINIT_H_INCLUDED
     15 /* { */
     16 #define FILE_APPL_REF_DNXC_INIT_DEINIT_H_INCLUDED
     17 
     18 #if !defined(BCM_DNX_SUPPORT) && !defined(BCM_DNXF_SUPPORT)
     19 #error "This file is for use by DNXC family only!"
     20 #endif
     21 
     22 #include <appl/diag/diag.h>
     23 #include <shared/utilex/utilex_seq.h>
     24 #include <appl/reference/dnxc/appl_ref_init_utils.h>
     25 
     26 #ifndef AGGRESSIVE_ALLOC_DEBUG_TESTING
     27   #define AGGRESSIVE_ALLOC_DEBUG_TESTING 0
     28 #endif
     29 
     30 /*
     31 * MACROs:
     32 * {
     33 */
     34 /**
     35  * brief - Default flags for applications steps. 
     36  * By default each application should have the following behaviour: 
     37  * 1. Can be run as standalone (useful for running steps from diag command shell) 
     38  * 2. Is enabled during init. 
     39  */
     40 #define DEF_PROP_EN (UTILEX_SEQ_STEP_F_STANDALONE_EN | UTILEX_SEQ_STEP_F_SOC_PROP_EN)
     41 
     42 #define WB_SKIP     (UTILEX_SEQ_STEP_F_WB_SKIP)
     43 
     44 #define STANDALONE  (UTILEX_SEQ_STEP_F_STANDALONE_EN)
     45 
     46 #define ACCESS      (UTILEX_SEQ_STEP_F_REQUIRED_FOR_ACCESS_ONLY | UTILEX_SEQ_STEP_F_REQUIRED_FOR_HEAT_UP)
     47 #define ACCESS_ONLY (UTILEX_SEQ_STEP_F_REQUIRED_FOR_ACCESS_ONLY)
     48 
     49 #define PARALLEL    (UTILEX_SEQ_STEP_F_RUN_ON_THREAD)
     50 
     51 #define JOIN        (UTILEX_SEQ_STEP_F_JOIN_ALL_THREADS)
     52 
     53 #define SKIP_NO_PRINT (UTILEX_SEQ_STEP_F_MEM_TEST_SKIP | UTILEX_SEQ_STEP_F_VERBOSE)
     54 
     55 
     56 /**
     57  * brief - Default flags for applications steps. 
     58  * By default each application should have the following behaviour: 
     59  * 1. Can be run as standalone (useful for running steps from diag command shell) 
     60  * 2. Is disabled during init. 
     61  */
     62 #define DEF_PROP_DIS (UTILEX_SEQ_STEP_F_STANDALONE_EN | UTILEX_SEQ_STEP_F_SOC_PROP_DIS)
     63 
     64 /**
     65  * \brief
     66  * Time threshold flag EXPLICIT - used for testing how much time each step in the Init takes.
     67  * If EXPLICIT flag is specified, the value will be taken from a user-defined array(appl_init_time_thresh_expl).
     68  * If no flag is specified, default value (APPL_INIT_STEP_TIME_THRESH_DEFAULT, defined at appl_ref_init_utils.h) will be assumed.
     69  * If flag is set to PER_DEVICE the value will be taken from device specific data.
     70  */
     71 #define TIME_EXPL      UTILEX_SEQ_STEP_F_TIME_THRESH_EXPLICIT
     72 #define TIME_PER_DEV   UTILEX_SEQ_STEP_F_TIME_THRESH_PER_DEVICE
     73 
     74 /**
     75  * \brief step should be skipped in memory test
     76  */
     77 #define MEM_TEST_SKIP     UTILEX_SEQ_STEP_F_MEM_TEST_SKIP
     78 
     79 /*
     80  * }
     81  */
     82 
     83 /*
     84  * Structs and Enums:
     85  * {
     86  */
     87 
     88 /**
     89  * \brief dnxc init parameters
     90  */
     91 typedef struct
     92 {
     93     int no_init;
     94     int no_deinit;
     95     int no_dump;
     96     int no_clean_up;
     97     int warmboot;
     98     int is_ctrl_c_check;
     99 #if AGGRESSIVE_ALLOC_DEBUG_TESTING
    100     int is_resources_check;
    101     uint32 aggressive_num_to_test;
    102     uint32 aggressive_alloc_debug_testing_keep_order;
    103     uint32 aggressive_long_free_search;
    104     int loop_id;
    105 #endif
    106 } appl_dnxc_init_param_t;
    107 
    108 
    109 /*
    110  * }
    111  */
    112 
    113 
    114 
    115 /*
    116 * Function Declarations:
    117 * {
    118 */
    119 
    120 
    121 /**
    122  * \brief - This function parses init params and starts the init and deinit sequence according to init params. 
    123  * 
    124  * \param [in] unit - Unit ID  
    125  * \param [in] params - Explict init params
    126  *   
    127  * \return
    128  *   shr_error_e 
    129  *   
    130  * \remark
    131  *   * None
    132  * \see
    133  *   * None
    134  */
    135 shr_error_e
    136 appl_dnxc_init_step_list_run(
    137     int unit,
    138     appl_dnxc_init_param_t *params);
    139 
    140 
    141 /**
    142  * \brief - Run a certain step (step_id) within the list of steps
    143  * 
    144  * \param [in] unit - Unit ID
    145  * \param [in] appl_id - step id to run 
    146  * \param [in] appl_steps - list of application steps 
    147  * \param [in] is_forward - Run forward or backward  
    148  *   
    149  * \return
    150  *   shr_error_e 
    151  *   
    152  * \remark
    153  *   * None
    154  * \see
    155  *   * None
    156  */
    157 shr_error_e
    158 appl_dnxc_step_list_id_run(
    159     int unit, 
    160     int appl_id, 
    161     const appl_dnxc_init_step_t *appl_steps,
    162     int is_forward);
    163 
    164 /**
    165  * \brief - Run a certain step (step_name) within the list of steps
    166  * 
    167  * \param [in] unit - Unit ID
    168  * \param [in] step_name - step id to run 
    169  * \param [in] appl_steps - list of application steps 
    170  * \param [in] is_forward - Run forward or backward  
    171  *   
    172  * \return
    173  *   shr_error_e 
    174  *   
    175  * \remark
    176  *   * None
    177  * \see
    178  *   * None
    179  */
    180 shr_error_e
    181 appl_dnxc_step_list_name_run(
    182     int unit, 
    183     char *appl_name, 
    184     const appl_dnxc_init_step_t *appl_steps,
    185     int is_forward);
    186 
    187 /**
    188  * \brief - Main BCM SDK init function. perfroms the following operation: 
    189  *          1. Attach and create unit. 
    190  *          2. Init BCM module (bcm_init()) 
    191  * 
    192  * \param [in] unit - Unit ID 
    193  * \param [in] init_param - Init application parameters 
    194  *   
    195  * \return
    196  *   shr_error_e    
    197  *   
    198  * \remark
    199  *   * This function is shared both for DNX and DNXF as the same init procedures should be invoked by both.
    200  * \see
    201  *   * None
    202  */
    203 shr_error_e
    204 appl_dnxc_sdk_init(
    205     int unit);
    206 
    207 /**
    208  * \brief - Main BCM SDK deinit function. perfroms the following operation: 
    209  *          1. Deinit BCM module (bcm_detach())
    210  *          2. Destroy unit.
    211  * 
    212  * \param [in] unit - Unit ID  
    213  *   
    214  * \return
    215  *   shr_error_e    
    216  *   
    217  * \remark
    218  *   * This function is shared both for DNX and DNXF as the same init procedures should be invoked by both.
    219  * \see
    220  *   * None
    221  */
    222 shr_error_e
    223 appl_dnxc_sdk_deinit(
    224     int unit);
    225 
    226 /**
    227  * \brief - Get the list of application steps
    228  * 
    229  * \param [in] unit - Unit ID
    230  * \param [Out] appl_steps - list of application steps
    231  *   
    232  * \return
    233  *   shr_error_e 
    234  *   
    235  * \remark
    236  *   * None
    237  * \see
    238  *   * None
    239  */
    240 shr_error_e
    241 appl_dnxc_step_list_get(
    242     int unit, 
    243     const appl_dnxc_init_step_t **appl_steps);
    244 
    245 /**
    246  * \brief - Get the list of application steps' time thresholds
    247  *
    248  * \param [in] unit - Unit ID
    249  * \param [Out] appl_steps - list of application steps' time thresholds
    250  *
    251  * \return
    252  *   shr_error_e
    253  *
    254  * \remark
    255  *   * None
    256  * \see
    257  *   * None
    258  */
    259 shr_error_e
    260 appl_dnxc_step_time_thresh_list_get(
    261     int unit,
    262     const appl_init_time_thresh_info_t ** time_thresh_list);
    263 
    264 /**
    265  * \brief - Get the time threshold of DNXC application step in microseconds
    266  *
    267  * \param [in] unit - Unit ID
    268  * \param [in] step_id - Application step ID
    269  * \param [Out] time_thresh - Device specific time thresholds
    270  *  for the step
    271  *
    272  * \return
    273  *   shr_error_e
    274  *
    275  * \remark
    276  *   * None
    277  * \see
    278  *   * None
    279  */
    280 shr_error_e
    281 appl_dnxc_per_dev_step_time_threshold_get(
    282     int unit,
    283     int step_id,
    284     sal_usecs_t * time_thresh);
    285 
    286 /**
    287  * \brief - Get the time threshold of DNXC full Application init in microseconds
    288  *
    289  * \param [in] unit - Unit ID
    290  * \param [Out] time_thresh - Device specific time thresholds
    291  *  for the step
    292  *
    293  * \return
    294  *   shr_error_e
    295  *
    296  * \remark
    297  *   * None
    298  * \see
    299  *   * None
    300  */
    301 shr_error_e
    302 appl_dnxc_per_dev_full_time_threshold_get(
    303     int unit,
    304     sal_usecs_t * time_thresh);
    305 
    306 /*
    307  * }
    308  */
    309 
    310 /* } */
    311 #endif