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

test.h (7572B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        test.h
      8  * Purpose:     Defines and types required for building test lists.
      9  */
     10 
     11 #ifndef _DIAG_TEST_H
     12 #define _DIAG_TEST_H
     13 
     14 #include <soc/types.h>
     15 
     16 #include <appl/diag/parse.h>
     17 
     18 /* File loaded when RC initialization required */
     19 
     20 typedef int     (*test_ifunc_t)(int, args_t *, void **);
     21 typedef int     (*test_dfunc_t)(int, void *);
     22 typedef int     (*test_func_t)(int, args_t *, void *);
     23 
     24 typedef struct test_s {
     25     char        *t_name;                 /* Test Name */
     26     uint32      t_flags;                 /* Flags for test */
     27 #   define      T_F_SEL_ALL     (1 << 0) /* Test selected for any chip */
     28 #   define      T_F_SEL_CHIP    (1 << 1) /* Test selected for supported chip */
     29 #   define      T_F_SELECT      (T_F_SEL_ALL | T_F_SEL_CHIP)
     30 #   define      T_F_ACTIVE      (1 << 2) /* Currently Active */
     31 #   define      T_F_STOP        (1 << 3) /* Stop-on-error processed */
     32 #   define      T_F_ERROR       (1 << 4) /* Error reported this run */
     33 #   define      T_F_RC          (1 << 5) /* Std init script should be run */
     34 
     35 /* Following flags are used in testlist, but are part of flags */
     36 
     37 #   define      TSEL            T_F_SEL_CHIP
     38 
     39 /*#if defined (BCM_DFE_SUPPORT)|| defined (BCM_PETRA_SUPPORT)*/
     40 #   define      T88650            (1 << 20)
     41 #   define      T88675            (T88650) /* Jericho */ 
     42 #   define      T88750            (1 << 1)
     43 #   define      DPP_ALL           (T88650 | T88675)
     44 #   define      DFE_ALL           (T88750)
     45 #   define      DPP_DFE           (DPP_ALL | DFE_ALL)
     46 /*#endif*/
     47 
     48 #   define      T56850          (1 << 18)
     49 #   define      T5675           (1 << 19)
     50 #   define      T56960          (1 << 20)
     51 #   define      T56504          (1 << 24)
     52 #   define      T56218          (1 << 25)
     53 #   define      T56624          (1 << 26)
     54 #   define      T56634          (T56624)
     55 #   define      T56334          (T56624)
     56 #   define      T56142          (T56624)
     57 #   define      T56150          (T56142)
     58 #   define      T56160          (T56142)
     59 #   define      T53400          (T56142)
     60 #   define      T53570          (T56142)
     61 #   define      T56840          (T56624)
     62 #   define      T56640          (1 << 21) /* reusing a depricated device id */
     63 #   define      T56340          (T56640)  /* Helix4 - replicate TR3 case for now */
     64 #   define      T56224          (1 << 27)
     65 #   define      T56700          (1 << 28)
     66 #   define      T56820          (1 << 29)
     67 #   define      T88732          (T56820)
     68 #   define      T53314          (1 << 30)
     69 #   define      T56440          (T56624)
     70 #   define      T56450          (1 << 31)
     71 #   define      T56860          (T56850)
     72 #   define      T56560          (T56860)
     73 #   define      T56670          (T56860)
     74 #   define      T56260          (T56440 | T56450)
     75 #   define      T56870          (T56960)
     76 #   define      T56770          (T56870)
     77 #   define      T56370          (T56870)
     78 #   define      T56270          (T56624)
     79 #   define      T56970          (T56960)
     80 #   define      T56980          (T56960)
     81 #   define      TXGS3SW         (T56504 | T56218 | T56224 | T56624 | \
     82                                  T56700 | T53314 | T56820 | T56640 | \
     83                                  T56850 | T56960 | T56450 | T56870 | \
     84                                  T56970 | T56770 | T56370 | T56970 | \
     85                                  T56980 )
     86 #   define      TXGS12SW        (T5675)
     87 #   define      TXGSSW          (TXGS12SW | TXGS3SW)
     88 #   define      TALL            (TXGSSW)
     89 
     90 #   define      TRC             (T_F_RC)
     91 
     92 /*
     93  * Major problems are lack of bits for additional devices and code complexity due to multiple ifdefs.
     94  * So we introduce new sand_testlist and new TR Flags serving sand_testlist[],
     95  * where all above are serving common_testlist,
     96  * First 6 bits [0-5] are general ones and used by both by common_testlist and sand_testlist
     97  * We are assigning bits for previous families as well. although they will not be in use until we change
     98  * list assignment in get_test_list(appl/diag/test.c)
     99  * All TS bits will be used by sand_testlist only and these list will use only these bits
    100  */
    101 #   define      TS88650            (1 << 6)
    102 #   define      TS_DPP             TS88650  /* Effectively used by all devices under BCM_PETRA_SUPPORT */
    103 #   define      TS88750            (1 << 7)
    104 #   define      TS_DFE             TS88750  /* Effectively used by all devices under BCM_PETRA_SUPPORT */
    105 #   define      TS88690            (1 << 8) /* Jericho 2 only, */
    106 #   define      TS_DNX             TS88690  /* Effectively used by all devices under BCM_DNX_SUPPORT */
    107 #   define      TS88790            (1 << 9) /* Ramon only */
    108 #   define      TS_DNXF            TS88790  /* Effectively used by all devices under BCM_DNXF_SUPPORT */
    109 #   define      TS_SAND            TS_DPP | TS_DFE | TS_DNX | TS_DNXF /* All Dune chip families */
    110 #   define      TS_DNXC            TS_DNX | TS_DNXF /* jericho 2 / Ramon */
    111 
    112     int         t_test;                 /* Test Number */
    113     int         t_loops;                /* Default # iterations */
    114     test_ifunc_t t_init_f;              /* Initialization routine */
    115     test_dfunc_t t_done_f;              /* Completion cleanup */
    116     test_func_t t_test_f;               /* Test function */
    117 
    118     char        *t_default_string;      /* Possible init string */
    119     char        *t_override_string;     /* Possible override init string */
    120 
    121     /* Counters of run statistics */
    122 
    123     int         t_runs;                 /* Total Number of runs */
    124     int         t_success;              /* # Successful completions */
    125     int         t_fail;                 /* # failures */
    126 } test_t;
    127 
    128 /*
    129  * Macro:       TEST
    130  * Purpose:     Macro to help build a test entry.
    131  * Parameters:  _nu - (integer) Test Number
    132  *                      If negative, test is not selected by default
    133  *              _na - (string) Test Name
    134  *              _f  - (integer) Test Flags (chips and RC)
    135  *              _fi - (function) Initialization function.
    136  *              _fd - (function) Termination function.
    137  *              _ft - (function) Actual test Function
    138  *              _l  - (integer) loop count, # times test
    139  *                      function called in one run.
    140  *              _arg- (string) Default argument string.
    141  */
    142 #define TEST_DECL(_nu, _na, _flg, _fi, _fd, _ft, _l, _arg)      \
    143     {(_na), (_flg), (_nu), (_l), (_fi), \
    144      (_fd), (_ft), (_arg), 0, 0, 0, 0}
    145 
    146 #define TEST(_nu, _na, _f, _fi, _fd, _ft, _l, _arg)     \
    147     TEST_DECL((_nu), (_na) , (_f), (_fi), (_fd), (_ft), (_l), (_arg)),
    148 
    149 # define TUNIMP(_nu, _na, _f, _fi, _fd, _ft, _l, _arg)
    150 
    151 
    152 extern void     test_exit(int u, int status);
    153 extern void     test_error(int u, const char *fmt, ...)  /* May not return */
    154      COMPILER_ATTRIBUTE ((format (printf, 2, 3)));
    155 extern void     test_msg(const char *fmt, ...)
    156      COMPILER_ATTRIBUTE ((format (printf, 1, 2)));
    157 extern int      test_get_last_test_status(int unit);
    158 extern int      test_is_no_reinit_mode(int unit);
    159 
    160 /* testlist.c */
    161 
    162 extern  test_t  common_test_list[];
    163 extern  int     common_test_cnt;
    164 
    165 #if defined(BCM_SAND_SUPPORT)
    166 /* sand_test_list is defined for ALL dune chip families but used currently only for
    167  * devices under BCM_DNX_SUPPORT and BCM_DNXF_SUPPORT
    168  * We may consider to switch to this list for all
    169  * see get_test_list(appl/diag/test.c)
    170  */
    171 extern  test_t  sand_test_list[];
    172 extern  int     sand_test_cnt;
    173 #endif
    174 
    175 #endif /* _DIAG_TEST_H */