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