1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, v.1, (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://opensource.org/licenses/CDDL-1.0. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2014-2017 Cavium, Inc. 24 * The contents of this file are subject to the terms of the Common Development 25 * and Distribution License, v.1, (the "License"). 26 27 * You may not use this file except in compliance with the License. 28 29 * You can obtain a copy of the License at available 30 * at http://opensource.org/licenses/CDDL-1.0 31 32 * See the License for the specific language governing permissions and 33 * limitations under the License. 34 */ 35 36 #ifndef _USER_DBG_FW_FUNCS_H 37 #define _USER_DBG_FW_FUNCS_H 38 /******************************** Constants **********************************/ 39 40 #define MAX_NAME_LEN 16 41 42 43 /***************************** Public Functions *******************************/ 44 45 /** 46 * @brief ecore_dbg_user_set_bin_ptr - Sets a pointer to the binary data with 47 * debug arrays. 48 * 49 * @param bin_ptr - a pointer to the binary data with debug arrays. 50 */ 51 enum dbg_status ecore_dbg_user_set_bin_ptr(const u8 * const bin_ptr); 52 53 /** 54 * @brief ecore_dbg_get_storm_id - Returns an ID for the specified storm name. 55 * 56 * @param storm_name - Storm name. 57 * 58 * @return an ID for the specified storm name, or NUM_OF_STORMS if not found. 59 */ 60 enum dbg_storms ecore_dbg_get_storm_id(const char *storm_name); 61 62 /** 63 * @brief ecore_dbg_get_block_id - Returns an ID for the specified block name. 64 * 65 * @param block_name - Block name. 66 * 67 * @return an ID for the specified block name, or NUM_OF_BLOCKS if not found. 68 */ 69 enum block_id ecore_dbg_get_block_id(const char *block_name); 70 71 /** 72 * @brief ecore_dbg_get_storm_mode_id - Returns an ID for the specified Storm 73 * mode name. 74 * 75 * @param storm_mode_name - Storm mode name. 76 * 77 * @return an ID for the specified Storm mode name, or MAX_DBG_BUS_STORM_MODES 78 * if not found. 79 */ 80 enum dbg_bus_storm_modes ecore_dbg_get_storm_mode_id(const char *storm_mode_name); 81 82 /** 83 * @brief ecore_dbg_get_constraint_op_id - Returns an ID for the specified 84 * constraint operation name. 85 * 86 * @param op_name - operation name. 87 * 88 * @return an ID for the specified constraint operation name, or 89 * MAX_DBG_BUS_CONSTRAINT_OPS if not found. 90 */ 91 enum dbg_bus_constraint_ops ecore_dbg_get_constraint_op_id(const char *op_name); 92 93 /** 94 * @brief ecore_dbg_get_status_str - Returns a string for the specified status. 95 * 96 * @param status - a debug status code. 97 * 98 * @return a string for the specified status 99 */ 100 const char* ecore_dbg_get_status_str(enum dbg_status status); 101 102 /** 103 * @brief ecore_dbg_get_grc_param_id - Returns an ID for the specified GRC 104 * param name. 105 * 106 * @param param_name - GRC param name. 107 * 108 * @return an ID for the specified GRC param name, or NUM_OF_GRC_PARAMS if not 109 * found. 110 */ 111 enum dbg_grc_params ecore_dbg_get_grc_param_id(const char *param_name); 112 113 /** 114 * @brief ecore_dbg_get_dbg_bus_line - Returns an ID for the specified Debug Bus 115 * line. 116 * 117 * @param block_id - block ID 118 * @param chip_id - chip ID 119 * @param line - a string containing a debug line name that belongs to the 120 * specified block/chip, or an 8-bit debug line number. 121 * 122 * @return an ID for the specified Debug Bus line name, or -1 if not found. 123 */ 124 int ecore_dbg_get_dbg_bus_line(enum block_id block_id, enum chip_ids chip_id, const char *line); 125 126 /** 127 * @brief ecore_get_idle_chk_results_buf_size - Returns the required buffer 128 * size for idle check results (in bytes). 129 * 130 * @param p_hwfn - HW device data 131 * @param dump_buf - idle check dump buffer. 132 * @param num_dumped_dwords - number of dwords that were dumped. 133 * @param results_buf_size - OUT: required buffer size (in bytes) for the 134 * parsed results. 135 * 136 * @return error if the parsing fails, ok otherwise. 137 */ 138 enum dbg_status ecore_get_idle_chk_results_buf_size(struct ecore_hwfn *p_hwfn, 139 u32 *dump_buf, 140 u32 num_dumped_dwords, 141 u32 *results_buf_size); 142 143 /** 144 * @brief ecore_print_idle_chk_results - Prints idle check results 145 * 146 * @param p_hwfn - HW device data 147 * @param dump_buf - idle check dump buffer. 148 * @param num_dumped_dwords - number of dwords that were dumped. 149 * @param results_buf - buffer for printing the idle check results. 150 * @param num_errors - OUT: number of errors found in idle check. 151 * @param num_warnings - OUT: number of warnings found in idle check. 152 * 153 * @return error if the parsing fails, ok otherwise. 154 */ 155 enum dbg_status ecore_print_idle_chk_results(struct ecore_hwfn *p_hwfn, 156 u32 *dump_buf, 157 u32 num_dumped_dwords, 158 char *results_buf, 159 u32 *num_errors, 160 u32 *num_warnings); 161 162 /** 163 * @brief ecore_dbg_mcp_trace_set_meta_data - Sets a pointer to the MCP Trace 164 * meta data. 165 * 166 * Needed in case the MCP Trace dump doesn't contain the meta data (e.g. due to 167 * no NVRAM access). 168 * 169 * @param data - pointer to MCP Trace meta data 170 * @param size - size of MCP Trace meta data in dwords 171 */ 172 void ecore_dbg_mcp_trace_set_meta_data(u32 *data, 173 u32 size); 174 175 /** 176 * @brief ecore_get_mcp_trace_results_buf_size - Returns the required buffer 177 * size for MCP Trace results (in bytes). 178 * 179 * @param p_hwfn - HW device data 180 * @param dump_buf - MCP Trace dump buffer. 181 * @param num_dumped_dwords - number of dwords that were dumped. 182 * @param results_buf_size - OUT: required buffer size (in bytes) for the 183 * parsed results. 184 * 185 * @return error if the parsing fails, ok otherwise. 186 */ 187 enum dbg_status ecore_get_mcp_trace_results_buf_size(struct ecore_hwfn *p_hwfn, 188 u32 *dump_buf, 189 u32 num_dumped_dwords, 190 u32 *results_buf_size); 191 192 193 /** 194 * @brief ecore_print_mcp_trace_results - Prints MCP Trace results 195 * 196 * @param p_hwfn - HW device data 197 * @param dump_buf - mcp trace dump buffer, starting from the header. 198 * @param num_dumped_dwords - number of dwords that were dumped. 199 * @param results_buf - buffer for printing the mcp trace results. 200 * 201 * @return error if the parsing fails, ok otherwise. 202 */ 203 enum dbg_status ecore_print_mcp_trace_results(struct ecore_hwfn *p_hwfn, 204 u32 *dump_buf, 205 u32 num_dumped_dwords, 206 char *results_buf); 207 208 /** 209 * @brief ecore_get_reg_fifo_results_buf_size - Returns the required buffer 210 * size for reg_fifo results (in bytes). 211 * 212 * @param p_hwfn - HW device data 213 * @param dump_buf - reg fifo dump buffer. 214 * @param num_dumped_dwords - number of dwords that were dumped. 215 * @param results_buf_size - OUT: required buffer size (in bytes) for the 216 * parsed results. 217 * 218 * @return error if the parsing fails, ok otherwise. 219 */ 220 enum dbg_status ecore_get_reg_fifo_results_buf_size(struct ecore_hwfn *p_hwfn, 221 u32 *dump_buf, 222 u32 num_dumped_dwords, 223 u32 *results_buf_size); 224 225 /** 226 * @brief ecore_print_reg_fifo_results - Prints reg fifo results 227 * 228 * @param p_hwfn - HW device data 229 * @param dump_buf - reg fifo dump buffer, starting from the header. 230 * @param num_dumped_dwords - number of dwords that were dumped. 231 * @param results_buf - buffer for printing the reg fifo results. 232 * 233 * @return error if the parsing fails, ok otherwise. 234 */ 235 enum dbg_status ecore_print_reg_fifo_results(struct ecore_hwfn *p_hwfn, 236 u32 *dump_buf, 237 u32 num_dumped_dwords, 238 char *results_buf); 239 240 /** 241 * @brief ecore_get_igu_fifo_results_buf_size - Returns the required buffer size 242 * for igu_fifo results (in bytes). 243 * 244 * @param p_hwfn - HW device data 245 * @param dump_buf - IGU fifo dump buffer. 246 * @param num_dumped_dwords - number of dwords that were dumped. 247 * @param results_buf_size - OUT: required buffer size (in bytes) for the 248 * parsed results. 249 * 250 * @return error if the parsing fails, ok otherwise. 251 */ 252 enum dbg_status ecore_get_igu_fifo_results_buf_size(struct ecore_hwfn *p_hwfn, 253 u32 *dump_buf, 254 u32 num_dumped_dwords, 255 u32 *results_buf_size); 256 257 /** 258 * @brief ecore_print_igu_fifo_results - Prints IGU fifo results 259 * 260 * @param p_hwfn - HW device data 261 * @param dump_buf - IGU fifo dump buffer, starting from the header. 262 * @param num_dumped_dwords - number of dwords that were dumped. 263 * @param results_buf - buffer for printing the IGU fifo results. 264 * 265 * @return error if the parsing fails, ok otherwise. 266 */ 267 enum dbg_status ecore_print_igu_fifo_results(struct ecore_hwfn *p_hwfn, 268 u32 *dump_buf, 269 u32 num_dumped_dwords, 270 char *results_buf); 271 272 /** 273 * @brief ecore_get_protection_override_results_buf_size - Returns the required 274 * buffer size for protection override results (in bytes). 275 * 276 * @param p_hwfn - HW device data 277 * @param dump_buf - protection override dump buffer. 278 * @param num_dumped_dwords - number of dwords that were dumped. 279 * @param results_buf_size - OUT: required buffer size (in bytes) for the parsed results. 280 * 281 * @return error if the parsing fails, ok otherwise. 282 */ 283 enum dbg_status ecore_get_protection_override_results_buf_size(struct ecore_hwfn *p_hwfn, 284 u32 *dump_buf, 285 u32 num_dumped_dwords, 286 u32 *results_buf_size); 287 288 /* 289 * @brief ecore_print_protection_override_results - Prints protection override 290 * results. 291 * 292 * @param p_hwfn - HW device data 293 * @param dump_buf - protection override dump buffer, starting from 294 * the header. 295 * @param num_dumped_dwords - number of dwords that were dumped. 296 * @param results_buf - buffer for printing the reg fifo results. 297 * 298 * @return error if the parsing fails, ok otherwise. 299 */ 300 enum dbg_status ecore_print_protection_override_results(struct ecore_hwfn *p_hwfn, 301 u32 *dump_buf, 302 u32 num_dumped_dwords, 303 char *results_buf); 304 305 /** 306 * @brief ecore_get_fw_asserts_results_buf_size - Returns the required buffer 307 * size for FW Asserts results (in bytes). 308 * 309 * @param p_hwfn - HW device data 310 * @param dump_buf - FW Asserts dump buffer. 311 * @param num_dumped_dwords - number of dwords that were dumped. 312 * @param results_buf_size - OUT: required buffer size (in bytes) for the 313 * parsed results. 314 * 315 * @return error if the parsing fails, ok otherwise. 316 */ 317 enum dbg_status ecore_get_fw_asserts_results_buf_size(struct ecore_hwfn *p_hwfn, 318 u32 *dump_buf, 319 u32 num_dumped_dwords, 320 u32 *results_buf_size); 321 322 /** 323 * @brief ecore_print_fw_asserts_results - Prints FW Asserts results 324 * 325 * @param p_hwfn - HW device data 326 * @param dump_buf - FW Asserts dump buffer, starting from the header. 327 * @param num_dumped_dwords - number of dwords that were dumped. 328 * @param results_buf - buffer for printing the FW Asserts results. 329 * 330 * @return error if the parsing fails, ok otherwise. 331 */ 332 enum dbg_status ecore_print_fw_asserts_results(struct ecore_hwfn *p_hwfn, 333 u32 *dump_buf, 334 u32 num_dumped_dwords, 335 char *results_buf); 336 337 /** 338 * @brief ecore_dbg_parse_attn - Parses and prints attention registers values in 339 * the specified results struct. 340 * 341 * @param p_hwfn - HW device data 342 * @param results - Pointer to the attention read results 343 * 344 * @return error if one of the following holds: 345 * - the version wasn't set 346 * Otherwise, returns ok. 347 */ 348 enum dbg_status ecore_dbg_parse_attn(struct ecore_hwfn *p_hwfn, 349 struct dbg_attn_block_result *results); 350 351 352 #endif 353