test.h (7818B)
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-2020 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 (1U << 0) /* Test selected for any chip */ 28 # define T_F_SEL_CHIP (1U << 1) /* Test selected for supported chip */ 29 # define T_F_SELECT (T_F_SEL_ALL | T_F_SEL_CHIP) 30 # define T_F_ACTIVE (1U << 2) /* Currently Active */ 31 # define T_F_STOP (1U << 3) /* Stop-on-error processed */ 32 # define T_F_ERROR (1U << 4) /* Error reported this run */ 33 # define T_F_RC (1U << 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 (1U << 20) 41 # define T88675 (T88650) /* Jericho */ 42 # define T88750 (1U << 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 (1U << 18) 49 # define T5675 (1U << 19) 50 # define T56960 (1U << 20) 51 # define T56504 (1U << 24) 52 # define T56218 (1U << 25) 53 # define T56624 (1U << 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 T56070 (T56142) 62 # define T56840 (T56624) 63 # define T56640 (1U << 21) /* reusing a depricated device id */ 64 # define T56340 (T56640) /* Helix4 - replicate TR3 case for now */ 65 # define T56224 (1U << 27) 66 # define T56700 (1U << 28) 67 # define T56820 (1U << 29) 68 # define T88732 (T56820) 69 # define T53314 (1U << 30) 70 # define T56440 (T56624) 71 # define T56450 (1U << 31) 72 # define T56860 (T56850) 73 # define T56560 (T56860) 74 # define T56670 (T56860) 75 # define T56260 (T56440 | T56450) 76 # define T56870 (T56960) 77 # define T56873 (T56960) 78 # define T56770 (T56870) 79 # define T56771 (T56870) 80 # define T56370 (T56870) 81 # define T56275 (T56370) 82 # define T56470 (T56370) 83 # define T56270 (T56624) 84 # define T56970 (T56960) 85 # define T56980 (T56960) 86 # define TXGS3SW (T56504 | T56218 | T56224 | T56624 | \ 87 T56700 | T53314 | T56820 | T56640 | \ 88 T56850 | T56960 | T56450 | T56870 | \ 89 T56970 | T56770 | T56370 | T56970 | \ 90 T56275 | T56980 | T56470) 91 # define TXGS12SW (T5675) 92 # define TXGSSW (TXGS12SW | TXGS3SW) 93 # define TALL (TXGSSW) 94 95 # define TRC (T_F_RC) 96 97 /* 98 * Major problems are lack of bits for additional devices and code complexity due to multiple ifdefs. 99 * So we introduce new sand_testlist and new TR Flags serving sand_testlist[], 100 * where all above are serving common_testlist, 101 * First 6 bits [0-5] are general ones and used by both by common_testlist and sand_testlist 102 * We are assigning bits for previous families as well. although they will not be in use until we change 103 * list assignment in get_test_list(appl/diag/test.c) 104 * All TS bits will be used by sand_testlist only and these list will use only these bits 105 */ 106 # define TS88650 (1U << 6) 107 # define TS_DPP TS88650 /* Effectively used by all devices under BCM_PETRA_SUPPORT */ 108 # define TS88750 (1U << 7) 109 # define TS_DFE TS88750 /* Effectively used by all devices under BCM_PETRA_SUPPORT */ 110 # define TS88690 (1U << 8) /* Jericho 2 only, */ 111 # define TS_DNX TS88690 /* Effectively used by all devices under BCM_DNX_SUPPORT */ 112 # define TS88790 (1U << 9) /* Ramon only */ 113 # define TS_DNXF TS88790 /* Effectively used by all devices under BCM_DNXF_SUPPORT */ 114 # define TS_SAND TS_DPP | TS_DFE | TS_DNX | TS_DNXF /* All Dune chip families */ 115 # define TS_DNXC TS_DNX | TS_DNXF /* jericho 2 / Ramon */ 116 117 int t_test; /* Test Number */ 118 int t_loops; /* Default # iterations */ 119 test_ifunc_t t_init_f; /* Initialization routine */ 120 test_dfunc_t t_done_f; /* Completion cleanup */ 121 test_func_t t_test_f; /* Test function */ 122 123 char *t_default_string; /* Possible init string */ 124 char *t_override_string; /* Possible override init string */ 125 126 /* Counters of run statistics */ 127 128 int t_runs; /* Total Number of runs */ 129 int t_success; /* # Successful completions */ 130 int t_fail; /* # failures */ 131 } test_t; 132 133 /* 134 * Macro: TEST 135 * Purpose: Macro to help build a test entry. 136 * Parameters: _nu - (integer) Test Number 137 * If negative, test is not selected by default 138 * _na - (string) Test Name 139 * _f - (integer) Test Flags (chips and RC) 140 * _fi - (function) Initialization function. 141 * _fd - (function) Termination function. 142 * _ft - (function) Actual test Function 143 * _l - (integer) loop count, # times test 144 * function called in one run. 145 * _arg- (string) Default argument string. 146 */ 147 #define TEST_DECL(_nu, _na, _flg, _fi, _fd, _ft, _l, _arg) \ 148 {(_na), (_flg), (_nu), (_l), (_fi), \ 149 (_fd), (_ft), (_arg), 0, 0, 0, 0} 150 151 #define TEST(_nu, _na, _f, _fi, _fd, _ft, _l, _arg) \ 152 TEST_DECL((_nu), (_na) , (_f), (_fi), (_fd), (_ft), (_l), (_arg)), 153 154 # define TUNIMP(_nu, _na, _f, _fi, _fd, _ft, _l, _arg) 155 156 157 extern void test_exit(int u, int status); 158 extern void test_error(int u, const char *fmt, ...) /* May not return */ 159 COMPILER_ATTRIBUTE ((format (printf, 2, 3))); 160 extern void test_msg(const char *fmt, ...) 161 COMPILER_ATTRIBUTE ((format (printf, 1, 2))); 162 extern int test_get_last_test_status(int unit); 163 extern int test_is_no_reinit_mode(int unit); 164 165 /* testlist.c */ 166 167 extern test_t common_test_list[]; 168 extern int common_test_cnt; 169 170 #if defined(BCM_SAND_SUPPORT) 171 /* sand_test_list is defined for ALL dune chip families but used currently only for 172 * devices under BCM_DNX_SUPPORT and BCM_DNXF_SUPPORT 173 * We may consider to switch to this list for all 174 * see get_test_list(appl/diag/test.c) 175 */ 176 extern test_t sand_test_list[]; 177 extern int sand_test_cnt; 178 #endif 179 180 #endif /* _DIAG_TEST_H */