/* QLogic (R)NIC Driver/Library * Copyright (c) 2015-2016 QLogic Corporation * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef _QED_USER_DBG_FW_FUNCS_H #define _QED_USER_DBG_FW_FUNCS_H #include #ifndef _USER_DBG_FW_FUNCS_H #define _USER_DBG_FW_FUNCS_H /******************************** Constants **********************************/ #define MAX_NAME_LEN 16 /***************************** Public Functions *******************************/ /** * @brief qed_dbg_user_set_bin_ptr - Sets a pointer to the binary data with * debug arrays. * * @param bin_ptr - a pointer to the binary data with debug arrays. */ enum dbg_status qed_dbg_user_set_bin_ptr(const u8 * const bin_ptr); /** * @brief qed_dbg_get_storm_id - Returns an ID for the specified storm name. * * @param storm_name - Storm name. * * @return an ID for the specified storm name, or NUM_OF_STORMS if not found. */ enum dbg_storms qed_dbg_get_storm_id(const char *storm_name); /** * @brief qed_dbg_get_block_id - Returns an ID for the specified block name. * * @param block_name - Block name. * * @return an ID for the specified block name, or NUM_OF_BLOCKS if not found. */ enum block_id qed_dbg_get_block_id(const char *block_name); /** * @brief qed_dbg_get_storm_mode_id - Returns an ID for the specified Storm * mode name. * * @param storm_mode_name - Storm mode name. * * @return an ID for the specified Storm mode name, or MAX_DBG_BUS_STORM_MODES * if not found. */ enum dbg_bus_storm_modes qed_dbg_get_storm_mode_id(const char *storm_mode_name); /** * @brief qed_dbg_get_constraint_op_id - Returns an ID for the specified * constraint operation name. * * @param op_name - operation name. * * @return an ID for the specified constraint operation name, or * MAX_DBG_BUS_CONSTRAINT_OPS if not found. */ enum dbg_bus_constraint_ops qed_dbg_get_constraint_op_id(const char *op_name); /** * @brief qed_dbg_get_status_str - Returns a string for the specified status. * * @param status - a debug status code. * * @return a string for the specified status */ const char *qed_dbg_get_status_str(enum dbg_status status); /** * @brief qed_dbg_get_grc_param_id - Returns an ID for the specified GRC * param name. * * @param param_name - GRC param name. * * @return an ID for the specified GRC param name, or NUM_OF_GRC_PARAMS if not * found. */ enum dbg_grc_params qed_dbg_get_grc_param_id(const char *param_name); /** * @brief qed_dbg_get_dbg_bus_line - Returns an ID for the specified Debug Bus * line. * * @param block_id - block ID * @param chip_id - chip ID * @param line - a string containing a debug line name that belongs to the * specified block/chip, or an 8-bit debug line number. * * @return an ID for the specified Debug Bus line name, or -1 if not found. */ int qed_dbg_get_dbg_bus_line(enum block_id block_id, enum chip_ids chip_id, const char *line); /** * @brief qed_get_idle_chk_results_buf_size - Returns the required buffer * size for idle check results (in bytes). * * @param p_hwfn - HW device data * @param dump_buf - idle check dump buffer. * @param num_dumped_dwords - number of dwords that were dumped. * @param results_buf_size - OUT: required buffer size (in bytes) for the * parsed results. * * @return error if the parsing fails, ok otherwise. */ enum dbg_status qed_get_idle_chk_results_buf_size(struct qed_hwfn *p_hwfn, u32 * dump_buf, u32 num_dumped_dwords, u32 * results_buf_size); /** * @brief qed_print_idle_chk_results - Prints idle check results * * @param p_hwfn - HW device data * @param dump_buf - idle check dump buffer. * @param num_dumped_dwords - number of dwords that were dumped. * @param results_buf - buffer for printing the idle check results. * @param num_errors - OUT: number of errors found in idle check. * @param num_warnings - OUT: number of warnings found in idle check. * * @return error if the parsing fails, ok otherwise. */ enum dbg_status qed_print_idle_chk_results(struct qed_hwfn *p_hwfn, u32 * dump_buf, u32 num_dumped_dwords, char *results_buf, u32 * num_errors, u32 * num_warnings); /** * @brief qed_dbg_mcp_trace_set_meta_data - Sets a pointer to the MCP Trace * meta data. * * Needed in case the MCP Trace dump doesn't contain the meta data (e.g. due to * no NVRAM access). * * @param data - pointer to MCP Trace meta data * @param size - size of MCP Trace meta data in dwords */ void qed_dbg_mcp_trace_set_meta_data(u32 * data, u32 size); /** * @brief qed_get_mcp_trace_results_buf_size - Returns the required buffer * size for MCP Trace results (in bytes). * * @param p_hwfn - HW device data * @param dump_buf - MCP Trace dump buffer. * @param num_dumped_dwords - number of dwords that were dumped. * @param results_buf_size - OUT: required buffer size (in bytes) for the * parsed results. * * @return error if the parsing fails, ok otherwise. */ enum dbg_status qed_get_mcp_trace_results_buf_size(struct qed_hwfn *p_hwfn, u32 * dump_buf, u32 num_dumped_dwords, u32 * results_buf_size); /** * @brief qed_print_mcp_trace_results - Prints MCP Trace results * * @param p_hwfn - HW device data * @param dump_buf - mcp trace dump buffer, starting from the header. * @param num_dumped_dwords - number of dwords that were dumped. * @param results_buf - buffer for printing the mcp trace results. * * @return error if the parsing fails, ok otherwise. */ enum dbg_status qed_print_mcp_trace_results(struct qed_hwfn *p_hwfn, u32 * dump_buf, u32 num_dumped_dwords, char *results_buf); /** * @brief print_mcp_trace_line - Prints MCP Trace results for a single line * * @param dump_buf - mcp trace dump buffer, starting from the header. * @param num_dumped_bytes - number of bytes that were dumped. * @param results_buf - buffer for printing the mcp trace results. * * @return error if the parsing fails, ok otherwise. */ enum dbg_status qed_print_mcp_trace_line(u8 * dump_buf, u32 num_dumped_bytes, char *results_buf); /** * @brief qed_get_reg_fifo_results_buf_size - Returns the required buffer * size for reg_fifo results (in bytes). * * @param p_hwfn - HW device data * @param dump_buf - reg fifo dump buffer. * @param num_dumped_dwords - number of dwords that were dumped. * @param results_buf_size - OUT: required buffer size (in bytes) for the * parsed results. * * @return error if the parsing fails, ok otherwise. */ enum dbg_status qed_get_reg_fifo_results_buf_size(struct qed_hwfn *p_hwfn, u32 * dump_buf, u32 num_dumped_dwords, u32 * results_buf_size); /** * @brief qed_print_reg_fifo_results - Prints reg fifo results * * @param p_hwfn - HW device data * @param dump_buf - reg fifo dump buffer, starting from the header. * @param num_dumped_dwords - number of dwords that were dumped. * @param results_buf - buffer for printing the reg fifo results. * * @return error if the parsing fails, ok otherwise. */ enum dbg_status qed_print_reg_fifo_results(struct qed_hwfn *p_hwfn, u32 * dump_buf, u32 num_dumped_dwords, char *results_buf); /** * @brief qed_get_igu_fifo_results_buf_size - Returns the required buffer size * for igu_fifo results (in bytes). * * @param p_hwfn - HW device data * @param dump_buf - IGU fifo dump buffer. * @param num_dumped_dwords - number of dwords that were dumped. * @param results_buf_size - OUT: required buffer size (in bytes) for the * parsed results. * * @return error if the parsing fails, ok otherwise. */ enum dbg_status qed_get_igu_fifo_results_buf_size(struct qed_hwfn *p_hwfn, u32 * dump_buf, u32 num_dumped_dwords, u32 * results_buf_size); /** * @brief qed_print_igu_fifo_results - Prints IGU fifo results * * @param p_hwfn - HW device data * @param dump_buf - IGU fifo dump buffer, starting from the header. * @param num_dumped_dwords - number of dwords that were dumped. * @param results_buf - buffer for printing the IGU fifo results. * * @return error if the parsing fails, ok otherwise. */ enum dbg_status qed_print_igu_fifo_results(struct qed_hwfn *p_hwfn, u32 * dump_buf, u32 num_dumped_dwords, char *results_buf); /** * @brief qed_get_protection_override_results_buf_size - Returns the required * buffer size for protection override results (in bytes). * * @param p_hwfn - HW device data * @param dump_buf - protection override dump buffer. * @param num_dumped_dwords - number of dwords that were dumped. * @param results_buf_size - OUT: required buffer size (in bytes) for the parsed results. * * @return error if the parsing fails, ok otherwise. */ enum dbg_status qed_get_protection_override_results_buf_size(struct qed_hwfn *p_hwfn, u32 * dump_buf, u32 num_dumped_dwords, u32 * results_buf_size); /* * @brief qed_print_protection_override_results - Prints protection override * results. * * @param p_hwfn - HW device data * @param dump_buf - protection override dump buffer, starting from * the header. * @param num_dumped_dwords - number of dwords that were dumped. * @param results_buf - buffer for printing the reg fifo results. * * @return error if the parsing fails, ok otherwise. */ enum dbg_status qed_print_protection_override_results(struct qed_hwfn *p_hwfn, u32 * dump_buf, u32 num_dumped_dwords, char *results_buf); /** * @brief qed_get_fw_asserts_results_buf_size - Returns the required buffer * size for FW Asserts results (in bytes). * * @param p_hwfn - HW device data * @param dump_buf - FW Asserts dump buffer. * @param num_dumped_dwords - number of dwords that were dumped. * @param results_buf_size - OUT: required buffer size (in bytes) for the * parsed results. * * @return error if the parsing fails, ok otherwise. */ enum dbg_status qed_get_fw_asserts_results_buf_size(struct qed_hwfn *p_hwfn, u32 * dump_buf, u32 num_dumped_dwords, u32 * results_buf_size); /** * @brief qed_print_fw_asserts_results - Prints FW Asserts results * * @param p_hwfn - HW device data * @param dump_buf - FW Asserts dump buffer, starting from the header. * @param num_dumped_dwords - number of dwords that were dumped. * @param results_buf - buffer for printing the FW Asserts results. * * @return error if the parsing fails, ok otherwise. */ enum dbg_status qed_print_fw_asserts_results(struct qed_hwfn *p_hwfn, u32 * dump_buf, u32 num_dumped_dwords, char *results_buf); /** * @brief qed_dbg_parse_attn - Parses and prints attention registers values in * the specified results struct. * * @param p_hwfn - HW device data * @param results - Pointer to the attention read results * * @return error if one of the following holds: * - the version wasn't set * Otherwise, returns ok. */ enum dbg_status qed_dbg_parse_attn(struct qed_hwfn *p_hwfn, struct dbg_attn_block_result *results); #endif #endif