1/* 2 * Copyright (c) 2017-2018 Cavium, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * POSSIBILITY OF SUCH DAMAGE. 26 * 27 * $FreeBSD$ 28 * 29 */ 30 31#ifndef _DBG_FW_FUNCS_H 32#define _DBG_FW_FUNCS_H 33/**************************** Public Functions *******************************/ 34 35/** 36 * @brief ecore_dbg_set_bin_ptr - Sets a pointer to the binary data with debug 37 * arrays. 38 * 39 * @param bin_ptr - a pointer to the binary data with debug arrays. 40 */ 41enum dbg_status ecore_dbg_set_bin_ptr(const u8 * const bin_ptr); 42 43/** 44 * @brief ecore_dbg_set_app_ver - Sets the version of the calling app. 45 * 46 * The application should call this function with the TOOLS_VERSION 47 * it compiles with. Must be called before all other debug functions. 48 * 49 * @return error if one of the following holds: 50 * - the specified app version is not supported 51 * Otherwise, returns ok. 52 */ 53enum dbg_status ecore_dbg_set_app_ver(u32 ver); 54 55/** 56 * @brief ecore_dbg_get_fw_func_ver - Returns the FW func version. 57 * 58 * @return the FW func version. 59 */ 60u32 ecore_dbg_get_fw_func_ver(void); 61 62/** 63* @brief ecore_dbg_get_chip_id - Returns the FW func version. 64* 65* @param p_hwfn - HW device data 66* 67* @return the chip ID. 68*/ 69enum chip_ids ecore_dbg_get_chip_id(struct ecore_hwfn *p_hwfn); 70 71/** 72* @brief ecore_read_regs - Reads registers into a buffer (using GRC). 73* 74* @param p_hwfn - HW device data 75* @param p_ptt - Ptt window used for writing the registers. 76* @param buf - Destination buffer. 77* @param addr - Source GRC address in dwords. 78* @param len - Number of registers to read. 79*/ 80void ecore_read_regs(struct ecore_hwfn *p_hwfn, 81 struct ecore_ptt *p_ptt, 82 u32 *buf, 83 u32 addr, 84 u32 len); 85 86/** 87 * @brief ecore_dbg_bus_reset - Resets the Debug block. 88 * 89 * After reset: 90 * - The last recording is erased. 91 * - Recording is directed to the internal buffer. 92 * - Wrap-around recording is selected. 93 * - All HW blocks are disabled. 94 * - All Storms are disabled and all SEM filters are cleared. 95 * 96 * @param p_hwfn - HW device data 97 * @param p_ptt - Ptt window used for writing the registers. 98 * @param one_shot_en - Enable/Disable one-shot recording. If disabled, 99 * wrap-around recording is used instead. 100 * @param force_hw_dwords - If set to 0, no. of HW/Storm dwords per cycle is 101 * chosen automatically based on the enabled inputs. 102 * Otherwise, no. of HW dwords per cycle is forced to 103 * the specified value. Valid values: 0/2/4/8. 104 * @param unify_inputs - If true, all recorded data is associated with a 105 * single input, as if all data was received from the 106 * same block. Otherwise, each data unit is associated 107 * with its original input. 108 * @param grc_input_en - Enable/Disable recording GRC input. If enabled, the 109 * GRC input is recorded to the lsb dword of a cycle. 110 * 111 * @return error if one of the following holds: 112 * - the version wasn't set 113 * - force_hw_dwords is invalid. 114 * Otherwise, returns ok. 115 */ 116enum dbg_status ecore_dbg_bus_reset(struct ecore_hwfn *p_hwfn, 117 struct ecore_ptt *p_ptt, 118 bool one_shot_en, 119 u8 force_hw_dwords, 120 bool unify_inputs, 121 bool grc_input_en); 122 123/** 124 * @brief ecore_dbg_bus_set_pci_output - Directs debug output to a PCI buffer. 125 * 126 * @param p_hwfn - HW device data 127 * @param p_ptt - Ptt window used for writing the registers. 128 * @param buf_size_kb - Size of PCI buffer to allocate (in KB). Must be aligned 129 * to PCI request size. 130 * 131 * @return error if one of the following holds: 132 * - the Debug block wasn't reset since last recording 133 * - the version wasn't set 134 * - the output was already set 135 * - the PCI buffer size is not aligned to PCI packet size 136 * - the PCI buffer allocation failed 137 * Otherwise, returns ok. 138 */ 139enum dbg_status ecore_dbg_bus_set_pci_output(struct ecore_hwfn *p_hwfn, 140 struct ecore_ptt *p_ptt, 141 u16 buf_size_kb); 142 143/** 144 * @brief ecore_dbg_bus_set_nw_output - Directs debug output to the network. 145 * 146 * @param p_hwfn - HW device data 147 * @param p_ptt - Ptt window used for writing the registers. 148 * @param port_id - Port ID to transmit the debug data on 149 * @param dest_addr_lo32 - Destination MAC address (for Eth header) 150 * @param dest_addr_hi16 151 * @param data_limit_size_kb - Data limit size in KB (valid only for one-shot) 152 * If set to 0, data limit won't be configured. 153 * @param send_to_other_engine -If true: 154 * 1) The NW output will be sent to the DBG block 155 * of the other engine. 156 * 2) port_id argument is ignored. 157 * 3) rcv_from_other_engine should be set to false 158 * The other engine DBG block should call this 159 * function with rcv_from_other_engine set to 160 * true. 161 * @param rcv_from_other_engine-If true: 162 * 1) the DBG block receives the NW output sent 163 * from the other engine DBG block, and sends 164 * it to a NW port in the current engine 165 * (according to port_id). 166 * 2) The src/dest addresses and eth_type 167 * arguments are ignored. 168 * 3) send_to_other_engine should be set to false. 169 * The other engine DBG block should call this 170 * function with send_to_other_engine set to 171 * true. 172 * 173 * @return error if one of the following holds: 174 * - the Debug block wasn't reset since last recording 175 * - the version wasn't set 176 * - the output was already set 177 * Otherwise, returns ok. 178 */ 179enum dbg_status ecore_dbg_bus_set_nw_output(struct ecore_hwfn *p_hwfn, 180 struct ecore_ptt *p_ptt, 181 u8 port_id, 182 u32 dest_addr_lo32, 183 u16 dest_addr_hi16, 184 u16 data_limit_size_kb, 185 bool send_to_other_engine, 186 bool rcv_from_other_engine); 187 188/** 189 * @brief ecore_dbg_bus_enable_block - Enables recording of the specified block 190 * 191 * Each recording cycle contains 4 "units". If the recorded HW data requires up 192 * to 4 dwords per cycle, each unit is one dword (32 bits). Otherwise, each 193 * unit is 2 dwords (64 bits). 194 * 195 * @param p_hwfn - HW device data 196 * @param block - block to be enabled. 197 * @param line_num - debug line number to select. 198 * @param cycle_en - 4-bit value. If bit i is set, unit i is enabled. 199 * @param right_shift - number of units to right the debug data (0-3). 200 * @param force_valid - 4-bit value. If bit i is set, unit i is forced valid. 201 * @param force_frame - 4-bit value. If bit i is set, the frame bit of unit i 202 * is forced. 203 * 204 * @return error if one of the following holds: 205 * - the Debug block wasn't reset since last recording 206 * - the version wasn't set 207 * - block is not valid 208 * - block was already enabled 209 * - cycle_en, force_valid or force_frame are wider than 4 bits 210 * - right_shift is larger than 3 211 * - cycle unit 0 is enabled, but GRC or timestamp were also enabled. 212 * - Too many inputs were enabled. 213 * Otherwise, returns ok. 214 */ 215enum dbg_status ecore_dbg_bus_enable_block(struct ecore_hwfn *p_hwfn, 216 enum block_id block, 217 u8 line_num, 218 u8 cycle_en, 219 u8 right_shift, 220 u8 force_valid, 221 u8 force_frame); 222 223/** 224 * @brief ecore_dbg_bus_enable_storm - Enables recording of the specified Storm 225 * 226 * @param p_hwfn - HW device data 227 * @param storm - Storm to be enabled. 228 * @param storm_mode- Storm mode 229 * 230 * @return error if one of the following holds: 231 * - the Debug block wasn't reset since last recording 232 * - the version wasn't set 233 * - the specified storm or mode is invalid 234 * - Storm was already enabled 235 * - only HW data can be recorded 236 * - Too many inputs were enabled. 237 * Otherwise, returns ok. 238 */ 239enum dbg_status ecore_dbg_bus_enable_storm(struct ecore_hwfn *p_hwfn, 240 enum dbg_storms storm, 241 enum dbg_bus_storm_modes storm_mode); 242 243/** 244 * @brief ecore_dbg_bus_enable_timestamp - Enables timestamp recording. 245 * 246 * When enabled, the timestamp input is always recorded to the lsb dword of 247 * a cycle, with HW ID 0. 248 * 249 * @param p_hwfn - HW device data 250 * @param p_ptt - Ptt window used for writing the registers. 251 * @param valid_en - 3-bit value. The Timestamp will be recorded in a cycle if 252 * bit i is set and unit i+1 is valid. 253 * @param frame_en - 3-bit value. The Timestamp will be recorded in a cycle if 254 * bit i is set and unit i+1 has frame bit set. 255 * @param tick_len - timestamp tick length in cycles, minus 1. A value of 0 256 * means one cycle. 257 * 258 * @return error if one of the following holds: 259 * - the Debug block wasn't reset since last recording 260 * - the version wasn't set 261 * - valid_en or frame_en are wider than 4 bits 262 * - Both timestamp and GRC are enabled. 263 * Otherwise, returns ok. 264 */ 265enum dbg_status ecore_dbg_bus_enable_timestamp(struct ecore_hwfn *p_hwfn, 266 struct ecore_ptt *p_ptt, 267 u8 valid_en, 268 u8 frame_en, 269 u32 tick_len); 270 271/** 272 * @brief ecore_dbg_bus_add_eid_range_sem_filter- Add Event ID range SEM filter 273 * 274 * @param p_hwfn - HW device data 275 * @param storm - Storm to be filtered. 276 * @param min_eid - minimal Event ID to filter on. 277 * @param max_eid - maximal Event ID to filter on. 278 * 279 * @return error if one of the following holds: 280 * - the specified Storm is invalid 281 * - the specified Storm wasn't enabled 282 * - the EID range is not valid 283 * Otherwise, returns ok. 284 */ 285enum dbg_status ecore_dbg_bus_add_eid_range_sem_filter(struct ecore_hwfn *p_hwfn, 286 enum dbg_storms storm, 287 u8 min_eid, 288 u8 max_eid); 289 290/** 291 * @brief ecore_dbg_bus_add_eid_mask_sem_filter - Add Event ID mask SEM filter 292 * 293 * @param p_hwfn - HW device data 294 * @param storm - Storm to be filtered. 295 * @param eid_val - Event ID value. 296 * @param eid_mask - Event ID mask. 0's in the mask = don't care bits. 297 * 298 * @return error if one of the following holds: 299 * - the specified Storm is invalid 300 * - the specified Storm wasn't enabled 301 * Otherwise, returns ok. 302 */ 303enum dbg_status ecore_dbg_bus_add_eid_mask_sem_filter(struct ecore_hwfn *p_hwfn, 304 enum dbg_storms storm, 305 u8 eid_val, 306 u8 eid_mask); 307 308/** 309 * @brief ecore_dbg_bus_add_cid_sem_filter - Adds a CID SEM filter. 310 * 311 * @param p_hwfn - HW device data 312 * @param storm - Storm to be filtered. 313 * @param cid - CID to filter on. 314 * 315 * @return error if one of the following holds: 316 * - the specified Storm is invalid 317 * - the specified Storm wasn't enabled 318 * Otherwise, returns ok. 319 */ 320enum dbg_status ecore_dbg_bus_add_cid_sem_filter(struct ecore_hwfn *p_hwfn, 321 enum dbg_storms storm, 322 u32 cid); 323 324/** 325 * @brief ecore_dbg_bus_enable_filter - Enables the recording filter. 326 * 327 * A filter contains up to 4 constraints. The data is "filtered in" when the 328 * added constraints hold. 329 * 330 * @param p_hwfn - HW device data 331 * @param p_ptt - Ptt window used for writing the registers. 332 * @param block - block to filter on. 333 * @param const_msg_len - Constant message length (in cycles) to be used for 334 * message-based filter constraints. If set to 0, 335 * message length is based only on frame bit received 336 * from HW (no constant message length). 337 * 338 * @return error if one of the following holds: 339 * - the Debug block wasn't reset since last recording 340 * - the version wasn't set 341 * - the filter was already enabled 342 * - block is not valid or not enabled 343 * - more than 4 dwords are recorded per-cycle (forbids filters) 344 * Otherwise, returns ok. 345 */ 346enum dbg_status ecore_dbg_bus_enable_filter(struct ecore_hwfn *p_hwfn, 347 struct ecore_ptt *p_ptt, 348 enum block_id block, 349 u8 const_msg_len); 350 351/** 352 * @brief ecore_dbg_bus_enable_trigger - Enables the recording trigger. 353 * 354 * A trigger contains up to 3 states, where each state contains up to 355 * 4 constraints. After the constraints of a state hold for a specified number 356 * of times, the DBG block moves to the next state. If there's no next state, 357 * the DBG block triggers. 358 * 359 * @param p_hwfn - HW device data 360 * @param p_ptt - Ptt window used for writing the registers. 361 * @param rec_pre_trigger - if true, recording starts before the trigger. 362 * if false, recording starts at the trigger. 363 * @param pre_chunks - max number of chunks to record before the 364 * trigger (1-47). If set to 0, recording starts 365 * from time 0. Ignored if rec_pre_trigger is 366 * false. 367 * @param rec_post_trigger - if true, recording ends after the trigger. 368 * if false, recording ends at the trigger. 369 * @param post_cycles - max number of cycles to record after the 370 * trigger (0x1-0xffffffff). If set to 0, 371 * recording ends only when stopped by the user. 372 * Ignored if rec_post_trigger is false. 373 * @param filter_pre_trigger - if true, data is filtered before the trigger. 374 * Ignored if the filter wasn't enabled. 375 * @param filter_post_trigger - if true, data is filtered after the trigger. 376 * Ignored if the filter wasn't enabled. 377 * 378 * @return error if one of the following holds: 379 * - the Debug block wasn't reset since last recording 380 * - the version wasn't set 381 * - the trigger was already enabled 382 * - more than 4 dwords are recorded per-cycle (forbids triggers) 383 * - pre_chunks is not in the range 0-47. 384 * Otherwise, returns ok. 385 */ 386enum dbg_status ecore_dbg_bus_enable_trigger(struct ecore_hwfn *p_hwfn, 387 struct ecore_ptt *p_ptt, 388 bool rec_pre_trigger, 389 u8 pre_chunks, 390 bool rec_post_trigger, 391 u32 post_cycles, 392 bool filter_pre_trigger, 393 bool filter_post_trigger); 394 395/** 396 * @brief ecore_dbg_bus_add_trigger_state - Adds a trigger state. 397 * 398 * Up to 3 trigger states can be added, where each state contains up to 399 * 4 constraints. After the constraints of a state hold for the specified 400 * number of times, the DBG block moves to the next state. If there's no next 401 * state, the DBG block triggers. 402 * 403 * @param p_hwfn - HW device data 404 * @param p_ptt - Ptt window used for writing the registers. 405 * @param block - block to trigger on. 406 * @param const_msg_len - Constant message length (in cycles) to be used for 407 * message-based filter constraints. If set to 0, 408 * message length is based only on frame bit received 409 * from HW (no constant message length). 410 * @param count_to_next - The number of times the constraints of the state 411 * should hold before moving to the next state. Must be 412 * non-zero. 413 * 414 * @return error if one of the following holds: 415 * - The trigger wasn't enabled. 416 * - more than 3 trigger states were added 417 * - block is not valid or not enabled 418 * - count_to_next is 0 419 * Otherwise, returns ok. 420 */ 421enum dbg_status ecore_dbg_bus_add_trigger_state(struct ecore_hwfn *p_hwfn, 422 struct ecore_ptt *p_ptt, 423 enum block_id block, 424 u8 const_msg_len, 425 u16 count_to_next); 426 427/** 428 * @brief ecore_dbg_bus_add_constraint - Adds a filter/trigger constraint. 429 * 430 * The constraint is added to a filter or trigger state, which ever was added 431 * last. The filter/trigger happens if both of the following hold: 432 * 1. All mandatory constraints are true. 433 * 2. At least one optional (non-mandatory) constraints is true. 434 * 435 * @param p_hwfn - HW device data 436 * @param p_ptt - Ptt window used for writing the registers. 437 * @param op - constraint operation 438 * @param data - 32-bit data to compare with the recorded 439 * data. 440 * @param data_mask - 32-bit mask for data comparison. If mask bit 441 * i is 1, data bit i is compared, otherwise 442 * it's ignored. 443 * For eq/ne operations: any mask can be used. 444 * For other operations: the mask must be 445 * non-zero, and the 1's in the mask must be 446 * continuous. 447 * @param compare_frame - indicates if the frame bit should be 448 * compared. Must be false for all operations 449 * other than eq/ne. 450 * @param frame_bit - frame bit to compare with the recorded data 451 * (0/1). ignored if compare_frame is false. 452 * @param cycle_offset - offset in cycles from the beginning of the 453 * message, where cycle = 4 dwords. 454 * @param dword_offset_in_cycle - offset in dwords from the beginning of the 455 * cycle (0-3). 456 * @param is_mandatory - indicates if this constraint is mandatory 457 * (true) or optional (false). The data is 458 * filtered-in if all mandatory constraints hold 459 * AND at least one optional constraint (if 460 * added) holds. 461 * 462 * @return error if one of the following holds: 463 * - a filter or trigger state weren't enabled 464 * - all 4 filter constraints were added already 465 * - the op string is invalid 466 * - the data mask is invalid. 467 * - frame bit is not 0/1. 468 * - cycle_offset and dword_offset are not in the range 0-3. 469 * - compare_frame is true and operation is not eq/ne. 470 * Otherwise, returns ok. 471 */ 472enum dbg_status ecore_dbg_bus_add_constraint(struct ecore_hwfn *p_hwfn, 473 struct ecore_ptt *p_ptt, 474 enum dbg_bus_constraint_ops constraint_op, 475 u32 data, 476 u32 data_mask, 477 bool compare_frame, 478 u8 frame_bit, 479 u8 cycle_offset, 480 u8 dword_offset_in_cycle, 481 bool is_mandatory); 482 483/** 484 * @brief ecore_dbg_bus_start - Starts the recording. 485 * 486 * @param p_hwfn - HW device data 487 * @param p_ptt - Ptt window used for writing the registers. 488 * 489 * @return error if one of the following holds: 490 * - the Debug block wasn't reset since last recording 491 * - the version wasn't set 492 * Otherwise, returns ok. 493 */ 494enum dbg_status ecore_dbg_bus_start(struct ecore_hwfn *p_hwfn, 495 struct ecore_ptt *p_ptt); 496 497/** 498 * @brief ecore_dbg_bus_stop - Stops the recording and flushes the internal 499 * buffer. 500 * 501 * @param p_hwfn - HW device data 502 * @param p_ptt - Ptt window used for writing the registers. 503 * 504 * @return error if a recording is not in progress, ok otherwise. 505 */ 506enum dbg_status ecore_dbg_bus_stop(struct ecore_hwfn *p_hwfn, 507 struct ecore_ptt *p_ptt); 508 509/** 510 * @brief ecore_dbg_bus_get_dump_buf_size - Returns the required buffer size 511 * for Debug Bus recording. 512 * 513 * @param p_hwfn - HW device data 514 * @param p_ptt - Ptt window used for writing the registers. 515 * @param buf_size - OUT: the required size (in dwords) of the buffer for 516 * dumping the recorded Debug Bus data. If recording to the 517 * internal buffer, the size of the internal buffer is 518 * returned. If recording to PCI, the size of the PCI buffer 519 * is returned. Otherwise, 0 is returned. 520 * 521 * @return error if one of the following holds: 522 * - the version wasn't set 523 * Otherwise, returns ok. 524 */ 525enum dbg_status ecore_dbg_bus_get_dump_buf_size(struct ecore_hwfn *p_hwfn, 526 struct ecore_ptt *p_ptt, 527 u32 *buf_size); 528 529/** 530 * @brief ecore_dbg_bus_dump - Dumps the recorded Debug Bus data into the 531 * specified buffer. 532 * 533 * The dumped data starts with a header. If recording to NW, only a header is 534 * dumped. The dumped size is assigned to num_dumped_dwords. 535 * 536 * @param p_hwfn - HW device data 537 * @param p_ptt - Ptt window used for writing the registers. 538 * @param dump_buf - Pointer to copy the recorded data into. 539 * @param buf_size_in_dwords - Size of the specified buffer in dwords. 540 * @param num_dumped_dwords - OUT: number of dumped dwords. 541 * 542 * @return error if one of the following holds: 543 * - a recording wasn't started/stopped 544 * - the specified dump buffer is too small 545 * Otherwise, returns ok. 546 */ 547enum dbg_status ecore_dbg_bus_dump(struct ecore_hwfn *p_hwfn, 548 struct ecore_ptt *p_ptt, 549 u32 *dump_buf, 550 u32 buf_size_in_dwords, 551 u32 *num_dumped_dwords); 552 553/** 554 * @brief ecore_dbg_grc_config - Sets the value of a GRC parameter. 555 * 556 * @param p_hwfn - HW device data 557 * @param grc_param - GRC parameter 558 * @param val - Value to set. 559 560 * @return error if one of the following holds: 561 * - the version wasn't set 562 * - grc_param is invalid 563 * - val is outside the allowed boundaries 564 */ 565enum dbg_status ecore_dbg_grc_config(struct ecore_hwfn *p_hwfn, 566 enum dbg_grc_params grc_param, 567 u32 val); 568 569/** 570* @brief ecore_dbg_grc_set_params_default - Reverts all GRC parameters to their 571* default value. 572* 573* @param p_hwfn - HW device data 574*/ 575void ecore_dbg_grc_set_params_default(struct ecore_hwfn *p_hwfn); 576 577/** 578 * @brief ecore_dbg_grc_get_dump_buf_size - Returns the required buffer size 579 * for GRC Dump. 580 * 581 * @param p_hwfn - HW device data 582 * @param p_ptt - Ptt window used for writing the registers. 583 * @param buf_size - OUT: required buffer size (in dwords) for GRC Dump data. 584 * 585 * @return error if one of the following holds: 586 * - the version wasn't set 587 * Otherwise, returns ok. 588 */ 589enum dbg_status ecore_dbg_grc_get_dump_buf_size(struct ecore_hwfn *p_hwfn, 590 struct ecore_ptt *p_ptt, 591 u32 *buf_size); 592 593/** 594 * @brief ecore_dbg_grc_dump - Dumps GRC data into the specified buffer. 595 * 596 * @param p_hwfn - HW device data 597 * @param p_ptt - Ptt window used for writing the registers. 598 * @param dump_buf - Pointer to write the collected GRC data into. 599 * @param buf_size_in_dwords - Size of the specified buffer in dwords. 600 * @param num_dumped_dwords - OUT: number of dumped dwords. 601 * 602 * @return error if one of the following holds: 603 * - the version wasn't set 604 * - the specified dump buffer is too small 605 * Otherwise, returns ok. 606 */ 607enum dbg_status ecore_dbg_grc_dump(struct ecore_hwfn *p_hwfn, 608 struct ecore_ptt *p_ptt, 609 u32 *dump_buf, 610 u32 buf_size_in_dwords, 611 u32 *num_dumped_dwords); 612 613/** 614 * @brief ecore_dbg_idle_chk_get_dump_buf_size - Returns the required buffer 615 * size for idle check results. 616 * 617 * @param p_hwfn - HW device data 618 * @param p_ptt - Ptt window used for writing the registers. 619 * @param buf_size - OUT: required buffer size (in dwords) for idle check data. 620 * 621 * @return error if one of the following holds: 622 * - the version wasn't set 623 * Otherwise, returns ok. 624 */ 625enum dbg_status ecore_dbg_idle_chk_get_dump_buf_size(struct ecore_hwfn *p_hwfn, 626 struct ecore_ptt *p_ptt, 627 u32 *buf_size); 628 629/** 630 * @brief ecore_dbg_idle_chk_dump - Performs idle check and writes the results 631 * into the specified buffer. 632 * 633 * @param p_hwfn - HW device data 634 * @param p_ptt - Ptt window used for writing the registers. 635 * @param dump_buf - Pointer to write the idle check data into. 636 * @param buf_size_in_dwords - Size of the specified buffer in dwords. 637 * @param num_dumped_dwords - OUT: number of dumped dwords. 638 * 639 * @return error if one of the following holds: 640 * - the version wasn't set 641 * - the specified buffer is too small 642 * Otherwise, returns ok. 643 */ 644enum dbg_status ecore_dbg_idle_chk_dump(struct ecore_hwfn *p_hwfn, 645 struct ecore_ptt *p_ptt, 646 u32 *dump_buf, 647 u32 buf_size_in_dwords, 648 u32 *num_dumped_dwords); 649 650/** 651 * @brief ecore_dbg_mcp_trace_get_dump_buf_size - Returns the required buffer 652 * size for mcp trace results. 653 * 654 * @param p_hwfn - HW device data 655 * @param p_ptt - Ptt window used for writing the registers. 656 * @param buf_size - OUT: required buffer size (in dwords) for mcp trace data. 657 * 658 * @return error if one of the following holds: 659 * - the version wasn't set 660 * - the trace data in MCP scratchpad contain an invalid signature 661 * - the bundle ID in NVRAM is invalid 662 * - the trace meta data cannot be found (in NVRAM or image file) 663 * Otherwise, returns ok. 664 */ 665enum dbg_status ecore_dbg_mcp_trace_get_dump_buf_size(struct ecore_hwfn *p_hwfn, 666 struct ecore_ptt *p_ptt, 667 u32 *buf_size); 668 669/** 670 * @brief ecore_dbg_mcp_trace_dump - Performs mcp trace and writes the results 671 * into the specified buffer. 672 * 673 * @param p_hwfn - HW device data 674 * @param p_ptt - Ptt window used for writing the registers. 675 * @param dump_buf - Pointer to write the mcp trace data into. 676 * @param buf_size_in_dwords - Size of the specified buffer in dwords. 677 * @param num_dumped_dwords - OUT: number of dumped dwords. 678 * 679 * @return error if one of the following holds: 680 * - the version wasn't set 681 * - the specified buffer is too small 682 * - the trace data in MCP scratchpad contain an invalid signature 683 * - the bundle ID in NVRAM is invalid 684 * - the trace meta data cannot be found (in NVRAM or image file) 685 * - the trace meta data cannot be read (from NVRAM or image file) 686 * Otherwise, returns ok. 687 */ 688enum dbg_status ecore_dbg_mcp_trace_dump(struct ecore_hwfn *p_hwfn, 689 struct ecore_ptt *p_ptt, 690 u32 *dump_buf, 691 u32 buf_size_in_dwords, 692 u32 *num_dumped_dwords); 693 694/** 695 * @brief ecore_dbg_reg_fifo_get_dump_buf_size - Returns the required buffer 696 * size for grc trace fifo results. 697 * 698 * @param p_hwfn - HW device data 699 * @param p_ptt - Ptt window used for writing the registers. 700 * @param buf_size - OUT: required buffer size (in dwords) for reg fifo data. 701 * 702 * @return error if one of the following holds: 703 * - the version wasn't set 704 * Otherwise, returns ok. 705 */ 706enum dbg_status ecore_dbg_reg_fifo_get_dump_buf_size(struct ecore_hwfn *p_hwfn, 707 struct ecore_ptt *p_ptt, 708 u32 *buf_size); 709 710/** 711 * @brief ecore_dbg_reg_fifo_dump - Reads the reg fifo and writes the results 712 * into the specified buffer. 713 * 714 * @param p_hwfn - HW device data 715 * @param p_ptt - Ptt window used for writing the registers. 716 * @param dump_buf - Pointer to write the reg fifo data into. 717 * @param buf_size_in_dwords - Size of the specified buffer in dwords. 718 * @param num_dumped_dwords - OUT: number of dumped dwords. 719 * 720 * @return error if one of the following holds: 721 * - the version wasn't set 722 * - the specified buffer is too small 723 * - DMAE transaction failed 724 * Otherwise, returns ok. 725 */ 726enum dbg_status ecore_dbg_reg_fifo_dump(struct ecore_hwfn *p_hwfn, 727 struct ecore_ptt *p_ptt, 728 u32 *dump_buf, 729 u32 buf_size_in_dwords, 730 u32 *num_dumped_dwords); 731 732/** 733* @brief ecore_dbg_igu_fifo_get_dump_buf_size - Returns the required buffer 734* size for the IGU fifo results. 735* 736* @param p_hwfn - HW device data 737* @param p_ptt - Ptt window used for writing the registers. 738* @param buf_size - OUT: required buffer size (in dwords) for IGU fifo data. 739* 740* @return error if one of the following holds: 741* - the version wasn't set 742* Otherwise, returns ok. 743*/ 744enum dbg_status ecore_dbg_igu_fifo_get_dump_buf_size(struct ecore_hwfn *p_hwfn, 745 struct ecore_ptt *p_ptt, 746 u32 *buf_size); 747 748/** 749* @brief ecore_dbg_igu_fifo_dump - Reads the IGU fifo and writes the results 750* into the specified buffer. 751* 752* @param p_hwfn - HW device data 753* @param p_ptt - Ptt window used for writing the registers. 754* @param dump_buf - Pointer to write the IGU fifo data into. 755* @param buf_size_in_dwords - Size of the specified buffer in dwords. 756* @param num_dumped_dwords - OUT: number of dumped dwords. 757* 758* @return error if one of the following holds: 759* - the version wasn't set 760* - the specified buffer is too small 761* - DMAE transaction failed 762* Otherwise, returns ok. 763*/ 764enum dbg_status ecore_dbg_igu_fifo_dump(struct ecore_hwfn *p_hwfn, 765 struct ecore_ptt *p_ptt, 766 u32 *dump_buf, 767 u32 buf_size_in_dwords, 768 u32 *num_dumped_dwords); 769 770/** 771 * @brief ecore_dbg_protection_override_get_dump_buf_size - Return the required 772 * buffer size for protection override window results. 773 * 774 * @param p_hwfn - HW device data 775 * @param p_ptt - Ptt window used for writing the registers. 776 * @param buf_size - OUT: required buffer size (in dwords) for protection 777 * override data. 778 * 779 * @return error if one of the following holds: 780 * - the version wasn't set 781 * Otherwise, returns ok. 782 */ 783enum dbg_status ecore_dbg_protection_override_get_dump_buf_size(struct ecore_hwfn *p_hwfn, 784 struct ecore_ptt *p_ptt, 785 u32 *buf_size); 786/** 787 * @brief ecore_dbg_protection_override_dump - Reads protection override window 788 * entries and writes the results into the specified buffer. 789 * 790 * @param p_hwfn - HW device data 791 * @param p_ptt - Ptt window used for writing the registers. 792 * @param dump_buf - Pointer to write the protection override data 793 * into. 794 * @param buf_size_in_dwords - Size of the specified buffer in dwords. 795 * @param num_dumped_dwords - OUT: number of dumped dwords. 796 * 797 * @return error if one of the following holds: 798 * - the version wasn't set 799 * - the specified buffer is too small 800 * - DMAE transaction failed 801 * Otherwise, returns ok. 802 */ 803enum dbg_status ecore_dbg_protection_override_dump(struct ecore_hwfn *p_hwfn, 804 struct ecore_ptt *p_ptt, 805 u32 *dump_buf, 806 u32 buf_size_in_dwords, 807 u32 *num_dumped_dwords); 808 809/** 810* @brief ecore_dbg_fw_asserts_get_dump_buf_size - Returns the required buffer 811* size for FW Asserts results. 812* 813* @param p_hwfn - HW device data 814* @param p_ptt - Ptt window used for writing the registers. 815* @param buf_size - OUT: required buffer size (in dwords) for FW Asserts data. 816* 817* @return error if one of the following holds: 818* - the version wasn't set 819* Otherwise, returns ok. 820*/ 821enum dbg_status ecore_dbg_fw_asserts_get_dump_buf_size(struct ecore_hwfn *p_hwfn, 822 struct ecore_ptt *p_ptt, 823 u32 *buf_size); 824 825/** 826* @brief ecore_dbg_fw_asserts_dump - Reads the FW Asserts and writes the 827* results into the specified buffer. 828* 829* @param p_hwfn - HW device data 830* @param p_ptt - Ptt window used for writing the registers. 831* @param dump_buf - Pointer to write the FW Asserts data into. 832* @param buf_size_in_dwords - Size of the specified buffer in dwords. 833* @param num_dumped_dwords - OUT: number of dumped dwords. 834* 835* @return error if one of the following holds: 836* - the version wasn't set 837* - the specified buffer is too small 838* Otherwise, returns ok. 839*/ 840enum dbg_status ecore_dbg_fw_asserts_dump(struct ecore_hwfn *p_hwfn, 841 struct ecore_ptt *p_ptt, 842 u32 *dump_buf, 843 u32 buf_size_in_dwords, 844 u32 *num_dumped_dwords); 845 846/** 847* @brief ecore_dbg_read_attn - Reads the attention registers of the specified 848* block and type, and writes the results into the specified buffer. 849* 850* @param p_hwfn - HW device data 851* @param p_ptt - Ptt window used for writing the registers. 852* @param block - Block ID. 853* @param attn_type - Attention type. 854* @param clear_status - Indicates if the attention status should be cleared. 855* @param results - OUT: Pointer to write the read results into 856* 857* @return error if one of the following holds: 858* - the version wasn't set 859* Otherwise, returns ok. 860*/ 861enum dbg_status ecore_dbg_read_attn(struct ecore_hwfn *p_hwfn, 862 struct ecore_ptt *p_ptt, 863 enum block_id block, 864 enum dbg_attn_type attn_type, 865 bool clear_status, 866 struct dbg_attn_block_result *results); 867 868/** 869* @brief ecore_dbg_print_attn - Prints attention registers values in the 870* specified results struct. 871* 872* @param p_hwfn - HW device data 873* @param results - Pointer to the attention read results 874* 875* @return error if one of the following holds: 876* - the version wasn't set 877* Otherwise, returns ok. 878*/ 879enum dbg_status ecore_dbg_print_attn(struct ecore_hwfn *p_hwfn, 880 struct dbg_attn_block_result *results); 881 882/** 883* @brief ecore_is_block_in_reset - Returns true if the specified block is in 884* reset, false otherwise. 885* 886* @param p_hwfn - HW device data 887* @param p_ptt - Ptt window used for writing the registers. 888* @param block - Block ID. 889* 890* @return true if the specified block is in reset, false otherwise. 891*/ 892bool ecore_is_block_in_reset(struct ecore_hwfn *p_hwfn, 893 struct ecore_ptt *p_ptt, 894 enum block_id block); 895 896#endif 897