Bharat Gooty | b48ee74 | 2021-11-08 14:46:10 -0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright 2019-2021 Broadcom. |
| 4 | */ |
| 5 | |
| 6 | #ifndef _BXNT_DBG_H_ |
| 7 | #define _BXNT_DBG_H_ |
| 8 | |
| 9 | /* Adjust commented out lines below to enable debug. */ |
| 10 | /* #define DEBUG_PCI */ |
| 11 | /* #define DEBUG_MEMORY */ |
| 12 | /* #define DEBUG_LINK */ |
| 13 | /* #define DEBUG_CHIP */ |
| 14 | /* #define DEBUG_FAIL */ |
| 15 | /* #define DEBUG_HWRM_CMDS */ |
| 16 | /* #define DEBUG_HWRM_DUMP */ |
| 17 | /* #define DEBUG_CQ */ |
| 18 | /* #define DEBUG_CQ_DUMP */ |
| 19 | /* #define DEBUG_TX */ |
| 20 | /* #define DEBUG_TX_DUMP */ |
| 21 | /* #define DEBUG_RX */ |
| 22 | /* #define DEBUG_RX_DUMP */ |
| 23 | |
| 24 | #if \ |
| 25 | defined(DEBUG_PCI) || \ |
| 26 | defined(DEBUG_MEMORY) || \ |
| 27 | defined(DEBUG_LINK) || \ |
| 28 | defined(DEBUG_CHIP) || \ |
| 29 | defined(DEBUG_FAIL) || \ |
| 30 | defined(DEBUG_HWRM_CMDS) || \ |
| 31 | defined(DEBUG_HWRM_DUMP) || \ |
| 32 | defined(DEBUG_CQ) || \ |
| 33 | defined(DEBUG_CQ_DUMP) || \ |
| 34 | defined(DEBUG_TX) || \ |
| 35 | defined(DEBUG_TX_DUMP) || \ |
| 36 | defined(DEBUG_RX) || \ |
| 37 | defined(DEBUG_RX_DUMP) |
| 38 | #define DEBUG_DEFAULT |
| 39 | #endif |
| 40 | |
| 41 | #if defined(DEBUG_DEFAULT) |
| 42 | #define dbg_prn printf |
| 43 | #define MAX_CHAR_SIZE(a) (u32)((1 << (a)) - 1) |
| 44 | #define DISP_U8 0x00 |
| 45 | #define DISP_U16 0x01 |
| 46 | #define DISP_U32 0x02 |
| 47 | #define DISP_U64 0x03 |
| 48 | |
| 49 | void dumpmemory1(u8 *buffer, u32 length, u8 flag) |
| 50 | { |
| 51 | u32 jj = 0; |
| 52 | u8 i, c; |
| 53 | |
| 54 | printf("\n %p:", buffer); |
| 55 | for (jj = 0; jj < 16; jj++) { |
| 56 | if (!(jj & MAX_CHAR_SIZE(flag))) |
| 57 | printf(" "); |
| 58 | if (jj < length) |
| 59 | printf("%02x", buffer[jj]); |
| 60 | else |
| 61 | printf(" "); |
| 62 | if ((jj & 0xF) == 0xF) { |
| 63 | printf(" "); |
| 64 | for (i = 0; i < 16; i++) { |
| 65 | if (i < length) { |
| 66 | c = buffer[jj + i - 15]; |
| 67 | if (c >= 0x20 && c < 0x7F) |
| 68 | ; |
| 69 | else |
| 70 | c = '.'; |
| 71 | printf("%c", c); |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | void dump_mem(u8 *buffer, u32 length, u8 flag) |
| 79 | { |
| 80 | u32 length16, remlen, jj; |
| 81 | |
| 82 | length16 = length & 0xFFFFFFF0; |
| 83 | remlen = length & 0xF; |
| 84 | for (jj = 0; jj < length16; jj += 16) |
| 85 | dumpmemory1((u8 *)&buffer[jj], 16, flag); |
| 86 | if (remlen) |
| 87 | dumpmemory1((u8 *)&buffer[length16], remlen, flag); |
| 88 | if (length16 || remlen) |
| 89 | printf("\n"); |
| 90 | } |
| 91 | #endif |
| 92 | |
| 93 | #if defined(DEBUG_PCI) |
| 94 | void dbg_pci(struct bnxt *bp, const char *func, u16 cmd_reg) |
| 95 | { |
| 96 | printf("- %s()\n", func); |
| 97 | printf(" Vendor id : %04X\n", bp->vendor_id); |
| 98 | printf(" Device id : %04X\n", bp->device_id); |
| 99 | printf(" Irq : %d\n", bp->irq); |
| 100 | printf(" PCI Command Reg : %04X %04X\n", bp->cmd_reg, cmd_reg); |
| 101 | printf(" Sub Vendor id : %04X\n", bp->subsystem_vendor); |
| 102 | printf(" Sub Device id : %04X\n", bp->subsystem_device); |
| 103 | printf(" BAR (0) : %p\n", bp->bar0); |
| 104 | printf(" BAR (1) : %p\n", bp->bar1); |
| 105 | printf(" BAR (2) : %p\n", bp->bar2); |
| 106 | } |
| 107 | #else |
| 108 | #define dbg_pci(bp, func, creg) |
| 109 | #endif |
| 110 | |
| 111 | #if defined(DEBUG_MEMORY) |
| 112 | void dbg_mem(struct bnxt *bp, const char *func) |
| 113 | { |
| 114 | printf("- %s()\n", func); |
| 115 | printf(" bp Addr : %p", bp); |
| 116 | printf(" Len %4d", (u16)sizeof(struct bnxt)); |
| 117 | printf(" phy %llx\n", virt_to_bus(bp)); |
| 118 | printf(" bp->hwrm_req_addr : %p", bp->hwrm_addr_req); |
| 119 | printf(" Len %4d", (u16)REQ_BUFFER_SIZE); |
| 120 | printf(" phy %llx\n", bp->req_addr_mapping); |
| 121 | printf(" bp->hwrm_resp_addr : %p", bp->hwrm_addr_resp); |
| 122 | printf(" Len %4d", (u16)RESP_BUFFER_SIZE); |
| 123 | printf(" phy %llx\n", bp->resp_addr_mapping); |
| 124 | printf(" bp->tx.bd_virt : %p", bp->tx.bd_virt); |
| 125 | printf(" Len %4d", (u16)TX_RING_DMA_BUFFER_SIZE); |
| 126 | printf(" phy %llx\n", virt_to_bus(bp->tx.bd_virt)); |
| 127 | printf(" bp->rx.bd_virt : %p", bp->rx.bd_virt); |
| 128 | printf(" Len %4d", (u16)RX_RING_DMA_BUFFER_SIZE); |
| 129 | printf(" phy %llx\n", virt_to_bus(bp->rx.bd_virt)); |
| 130 | printf(" bp->cq.bd_virt : %p", bp->cq.bd_virt); |
| 131 | printf(" Len %4d", (u16)CQ_RING_DMA_BUFFER_SIZE); |
| 132 | printf(" phy %llx\n", virt_to_bus(bp->cq.bd_virt)); |
| 133 | } |
| 134 | #else |
| 135 | #define dbg_mem(bp, func) |
| 136 | #endif |
| 137 | |
| 138 | #if defined(DEBUG_CHIP) |
| 139 | void print_fw_ver(struct hwrm_ver_get_output *resp, u32 tmo) |
| 140 | { |
| 141 | if (resp->hwrm_intf_maj_8b < 1) { |
| 142 | dbg_prn(" HWRM interface %d.%d.%d is older than 1.0.0.\n", |
| 143 | resp->hwrm_intf_maj_8b, resp->hwrm_intf_min_8b, |
| 144 | resp->hwrm_intf_upd_8b); |
| 145 | dbg_prn(" Update FW with HWRM interface 1.0.0 or newer.\n"); |
| 146 | } |
| 147 | dbg_prn(" FW Version : %d.%d.%d.%d\n", |
| 148 | resp->hwrm_fw_maj_8b, resp->hwrm_fw_min_8b, |
| 149 | resp->hwrm_fw_bld_8b, resp->hwrm_fw_rsvd_8b); |
| 150 | printf(" cmd timeout : %d\n", tmo); |
| 151 | } |
| 152 | |
| 153 | void dbg_func_resource_qcaps(struct bnxt *bp) |
| 154 | { |
| 155 | /* Ring Groups */ |
| 156 | printf(" min_hw_ring_grps : %d\n", bp->min_hw_ring_grps); |
| 157 | printf(" max_hw_ring_grps : %d\n", bp->max_hw_ring_grps); |
| 158 | /* TX Rings */ |
| 159 | printf(" min_tx_rings : %d\n", bp->min_tx_rings); |
| 160 | printf(" max_tx_rings : %d\n", bp->max_tx_rings); |
| 161 | /* RX Rings */ |
| 162 | printf(" min_rx_rings : %d\n", bp->min_rx_rings); |
| 163 | printf(" max_rx_rings : %d\n", bp->max_rx_rings); |
| 164 | /* Completion Rings */ |
| 165 | printf(" min_cq_rings : %d\n", bp->min_cp_rings); |
| 166 | printf(" max_cq_rings : %d\n", bp->max_cp_rings); |
| 167 | /* Statistic Contexts */ |
| 168 | printf(" min_stat_ctxs : %d\n", bp->min_stat_ctxs); |
| 169 | printf(" max_stat_ctxs : %d\n", bp->max_stat_ctxs); |
| 170 | } |
| 171 | |
| 172 | void print_func_qcaps(struct bnxt *bp) |
| 173 | { |
| 174 | printf(" Port Number : %d\n", bp->port_idx); |
| 175 | printf(" fid : 0x%04x\n", bp->fid); |
| 176 | dbg_prn(" PF MAC : %02x:%02x:%02x:%02x:%02x:%02x\n", |
| 177 | bp->mac_addr[0], |
| 178 | bp->mac_addr[1], |
| 179 | bp->mac_addr[2], |
| 180 | bp->mac_addr[3], |
| 181 | bp->mac_addr[4], |
| 182 | bp->mac_addr[5]); |
| 183 | } |
| 184 | |
| 185 | void print_func_qcfg(struct bnxt *bp) |
| 186 | { |
| 187 | printf(" ordinal_value : %d\n", bp->ordinal_value); |
| 188 | printf(" stat_ctx_id : %x\n", bp->stat_ctx_id); |
| 189 | dbg_prn(" FW MAC : %02x:%02x:%02x:%02x:%02x:%02x\n", |
| 190 | bp->mac_addr[0], |
| 191 | bp->mac_addr[1], |
| 192 | bp->mac_addr[2], |
| 193 | bp->mac_addr[3], |
| 194 | bp->mac_addr[4], |
| 195 | bp->mac_addr[5]); |
| 196 | } |
| 197 | |
| 198 | void dbg_set_speed(u32 speed) |
| 199 | { |
| 200 | u32 speed1 = ((speed & LINK_SPEED_DRV_MASK) >> LINK_SPEED_DRV_SHIFT); |
| 201 | |
| 202 | printf(" Set Link Speed : "); |
| 203 | switch (speed & LINK_SPEED_DRV_MASK) { |
| 204 | case LINK_SPEED_DRV_1G: |
| 205 | printf("1 GBPS"); |
| 206 | break; |
| 207 | case LINK_SPEED_DRV_10G: |
| 208 | printf("10 GBPS"); |
| 209 | break; |
| 210 | case LINK_SPEED_DRV_25G: |
| 211 | printf("25 GBPS"); |
| 212 | break; |
| 213 | case LINK_SPEED_DRV_40G: |
| 214 | printf("40 GBPS"); |
| 215 | break; |
| 216 | case LINK_SPEED_DRV_50G: |
| 217 | printf("50 GBPS"); |
| 218 | break; |
| 219 | case LINK_SPEED_DRV_100G: |
| 220 | printf("100 GBPS"); |
| 221 | break; |
| 222 | case LINK_SPEED_DRV_AUTONEG: |
| 223 | printf("AUTONEG"); |
| 224 | break; |
| 225 | default: |
| 226 | printf("%x", speed1); |
| 227 | break; |
| 228 | } |
| 229 | printf("\n"); |
| 230 | } |
| 231 | |
| 232 | void dbg_chip_info(struct bnxt *bp) |
| 233 | { |
| 234 | printf(" Stat Ctx ID : %d\n", bp->stat_ctx_id); |
| 235 | printf(" Grp ID : %d\n", bp->ring_grp_id); |
| 236 | printf(" CQ Ring Id : %d\n", bp->cq_ring_id); |
| 237 | printf(" Tx Ring Id : %d\n", bp->tx_ring_id); |
| 238 | printf(" Rx ring Id : %d\n", bp->rx_ring_id); |
| 239 | } |
| 240 | |
| 241 | void print_num_rings(struct bnxt *bp) |
| 242 | { |
| 243 | printf(" num_cmpl_rings : %d\n", bp->num_cmpl_rings); |
| 244 | printf(" num_tx_rings : %d\n", bp->num_tx_rings); |
| 245 | printf(" num_rx_rings : %d\n", bp->num_rx_rings); |
| 246 | printf(" num_ring_grps : %d\n", bp->num_hw_ring_grps); |
| 247 | printf(" num_stat_ctxs : %d\n", bp->num_stat_ctxs); |
| 248 | } |
| 249 | |
| 250 | void dbg_flags(const char *func, u32 flags) |
| 251 | { |
| 252 | printf("- %s()\n", func); |
| 253 | printf(" bp->flags : 0x%04x\n", flags); |
| 254 | } |
| 255 | #else |
| 256 | #define print_fw_ver(resp, tmo) |
| 257 | #define dbg_func_resource_qcaps(bp) |
| 258 | #define print_func_qcaps(bp) |
| 259 | #define print_func_qcfg(bp) |
| 260 | #define dbg_set_speed(speed) |
| 261 | #define dbg_chip_info(bp) |
| 262 | #define print_num_rings(bp) |
| 263 | #define dbg_flags(func, flags) |
| 264 | #endif |
| 265 | |
| 266 | #if defined(DEBUG_HWRM_CMDS) || defined(DEBUG_FAIL) |
| 267 | void dump_hwrm_req(struct bnxt *bp, const char *func, u32 len, u32 tmo) |
| 268 | { |
| 269 | dbg_prn("- %s(0x%04x) cmd_len %d cmd_tmo %d", |
| 270 | func, (u16)((struct input *)bp->hwrm_addr_req)->req_type, |
| 271 | len, tmo); |
| 272 | #if defined(DEBUG_HWRM_DUMP) |
| 273 | dump_mem((u8 *)bp->hwrm_addr_req, len, DISP_U8); |
| 274 | #else |
| 275 | printf("\n"); |
| 276 | #endif |
| 277 | } |
| 278 | |
| 279 | void debug_resp(struct bnxt *bp, const char *func, u32 resp_len, u16 err) |
| 280 | { |
| 281 | dbg_prn("- %s(0x%04x) - ", |
| 282 | func, (u16)((struct input *)bp->hwrm_addr_req)->req_type); |
| 283 | if (err == STATUS_SUCCESS) |
| 284 | printf("Done"); |
| 285 | else if (err != STATUS_TIMEOUT) |
| 286 | printf("Fail err 0x%04x", err); |
| 287 | else |
| 288 | printf("timedout"); |
| 289 | #if defined(DEBUG_HWRM_DUMP) |
| 290 | if (err != STATUS_TIMEOUT) |
| 291 | dump_mem((u8 *)bp->hwrm_addr_resp, resp_len, DISP_U8); |
| 292 | else |
| 293 | printf("\n"); |
| 294 | #else |
| 295 | printf("\n"); |
| 296 | #endif |
| 297 | } |
| 298 | |
| 299 | void dbg_hw_cmd(struct bnxt *bp, |
| 300 | const char *func, u16 cmd_len, |
| 301 | u16 resp_len, u32 cmd_tmo, u16 err) |
| 302 | { |
| 303 | #if !defined(DEBUG_HWRM_CMDS) |
| 304 | if (err && err != STATUS_TIMEOUT) |
| 305 | #endif |
| 306 | { |
| 307 | dump_hwrm_req(bp, func, cmd_len, cmd_tmo); |
| 308 | debug_resp(bp, func, resp_len, err); |
| 309 | } |
| 310 | } |
| 311 | #else |
| 312 | #define dbg_hw_cmd(bp, func, cmd_len, resp_len, cmd_tmo, err) |
| 313 | #endif |
| 314 | |
| 315 | #if defined(DEBUG_HWRM_CMDS) |
| 316 | void dbg_short_cmd(u8 *req, const char *func, u32 len) |
| 317 | { |
| 318 | struct hwrm_short_input *sreq; |
| 319 | |
| 320 | sreq = (struct hwrm_short_input *)req; |
| 321 | dbg_prn("- %s(0x%04x) short_cmd_len %d", |
| 322 | func, |
| 323 | sreq->req_type, |
| 324 | (int)len); |
| 325 | #if defined(DEBUG_HWRM_DUMP) |
| 326 | dump_mem((u8 *)sreq, len, DISP_U8); |
| 327 | #else |
| 328 | printf("\n"); |
| 329 | #endif |
| 330 | } |
| 331 | #else |
| 332 | #define dbg_short_cmd(sreq, func, len) |
| 333 | #endif |
| 334 | |
| 335 | #if defined(DEBUG_RX) |
| 336 | void dump_rx_bd(struct rx_pkt_cmpl *rx_cmp, |
| 337 | struct rx_pkt_cmpl_hi *rx_cmp_hi, |
| 338 | u32 desc_idx) |
| 339 | { |
| 340 | printf(" RX desc_idx %d\n", desc_idx); |
| 341 | printf("- rx_cmp %llx", virt_to_bus(rx_cmp)); |
| 342 | #if defined(DEBUG_RX_DUMP) |
| 343 | dump_mem((u8 *)rx_cmp, (u32)sizeof(struct rx_pkt_cmpl), DISP_U8); |
| 344 | #else |
| 345 | printf("\n"); |
| 346 | #endif |
| 347 | printf("- rx_cmp_hi %llx", virt_to_bus(rx_cmp_hi)); |
| 348 | #if defined(DEBUG_RX_DUMP) |
| 349 | dump_mem((u8 *)rx_cmp_hi, (u32)sizeof(struct rx_pkt_cmpl_hi), DISP_U8); |
| 350 | #else |
| 351 | printf("\n"); |
| 352 | #endif |
| 353 | } |
| 354 | |
| 355 | void dbg_rxp(u8 *iob, u16 rx_len, u16 flag) |
| 356 | { |
| 357 | printf("- RX iob %llx Len %d ", virt_to_bus(iob), rx_len); |
| 358 | if (flag == PKT_RECEIVED) |
| 359 | printf(" PKT RECEIVED"); |
| 360 | else if (flag == PKT_DROPPED) |
| 361 | printf(" PKT DROPPED"); |
| 362 | #if defined(DEBUG_RX_DUMP) |
| 363 | dump_mem(iob, (u32)rx_len, DISP_U8); |
| 364 | #else |
| 365 | printf("\n"); |
| 366 | #endif |
| 367 | } |
| 368 | |
| 369 | void dbg_rx_cid(u16 idx, u16 cid) |
| 370 | { |
| 371 | dbg_prn("- RX old cid %d new cid %d\n", idx, cid); |
| 372 | } |
| 373 | |
| 374 | void dbg_rx_alloc_iob_fail(u16 idx, u16 cid) |
| 375 | { |
| 376 | dbg_prn(" Rx alloc_iob (%d) failed", idx); |
| 377 | dbg_prn(" for cons_id %d\n", cid); |
| 378 | } |
| 379 | |
| 380 | void dbg_rx_iob(void *iob, u16 idx, u16 cid) |
| 381 | { |
| 382 | dbg_prn(" Rx alloc_iob (%d) %p bd_virt (%d)\n", |
| 383 | idx, iob, cid); |
| 384 | } |
| 385 | |
| 386 | void dbg_rx_pkt(struct bnxt *bp, const char *func, uchar *pkt, int len) |
| 387 | { |
| 388 | if (bp->rx.iob_recv == PKT_RECEIVED) { |
| 389 | dbg_prn("- %s: %llx %d\n", func, |
| 390 | virt_to_bus(pkt), len); |
| 391 | } |
| 392 | } |
| 393 | #else |
| 394 | #define dump_rx_bd(rx_cmp, rx_cmp_hi, desc_idx) |
| 395 | #define dbg_rxp(iob, rx_len, flag) |
| 396 | #define dbg_rx_cid(idx, cid) |
| 397 | #define dbg_rx_alloc_iob_fail(idx, cid) |
| 398 | #define dbg_rx_iob(iob, idx, cid) |
| 399 | #define dbg_rx_pkt(bp, func, pkt, len) |
| 400 | #endif |
| 401 | |
| 402 | #if defined(DEBUG_CQ) |
| 403 | void dump_CQ(struct cmpl_base *cmp, u16 cons_idx) |
| 404 | { |
| 405 | printf("- CQ Type "); |
| 406 | |
| 407 | switch (cmp->type & CMPL_BASE_TYPE_MASK) { |
| 408 | case CMPL_BASE_TYPE_STAT_EJECT: |
| 409 | printf("(se)"); |
| 410 | break; |
| 411 | case CMPL_BASE_TYPE_HWRM_ASYNC_EVENT: |
| 412 | printf("(ae)"); |
| 413 | break; |
| 414 | case CMPL_BASE_TYPE_TX_L2: |
| 415 | printf("(tx)"); |
| 416 | break; |
| 417 | case CMPL_BASE_TYPE_RX_L2: |
| 418 | printf("(rx)"); |
| 419 | break; |
| 420 | default: |
| 421 | printf("%04x", (u16)(cmp->type & CMPL_BASE_TYPE_MASK)); |
| 422 | break; |
| 423 | } |
| 424 | printf(" cid %d", cons_idx); |
| 425 | #if defined(DEBUG_CQ_DUMP) |
| 426 | dump_mem((u8 *)cmp, (u32)sizeof(struct cmpl_base), DISP_U8); |
| 427 | #else |
| 428 | printf("\n"); |
| 429 | #endif |
| 430 | } |
| 431 | #else |
| 432 | #define dump_CQ(cq, id) |
| 433 | #endif |
| 434 | |
| 435 | #if defined(DEBUG_TX) |
| 436 | void dump_tx_stat(struct bnxt *bp) |
| 437 | { |
| 438 | printf(" TX stats cnt %d req_cnt %d", bp->tx.cnt, bp->tx.cnt_req); |
| 439 | printf(" prod_id %d cons_id %d\n", bp->tx.prod_id, bp->tx.cons_id); |
| 440 | } |
| 441 | |
| 442 | void dump_tx_pkt(void *packet, dma_addr_t mapping, int len) |
| 443 | { |
| 444 | printf(" TX Addr %llx Size %d", mapping, len); |
| 445 | #if defined(DEBUG_TX_DUMP) |
| 446 | dump_mem((u8 *)packet, len, DISP_U8); |
| 447 | #else |
| 448 | printf("\n"); |
| 449 | #endif |
| 450 | } |
| 451 | |
| 452 | void dump_tx_bd(struct tx_bd_short *tx_bd, u16 len) |
| 453 | { |
| 454 | printf(" Tx BD Addr %llx Size %d", virt_to_bus(tx_bd), len); |
| 455 | #if defined(DEBUG_TX_DUMP) |
| 456 | dump_mem((u8 *)tx_bd, (u32)len, DISP_U8); |
| 457 | #else |
| 458 | printf("\n"); |
| 459 | #endif |
| 460 | } |
| 461 | |
| 462 | void dbg_no_tx_bd(void) |
| 463 | { |
| 464 | printf(" Tx ring full\n"); |
| 465 | } |
| 466 | #else |
| 467 | #define dump_tx_stat(bp) |
| 468 | #define dump_tx_pkt(packet, mapping, len) |
| 469 | #define dump_tx_bd(prod_bd, len) |
| 470 | #define dbg_no_tx_bd() |
| 471 | #endif |
| 472 | |
| 473 | #if defined(DEBUG_MEMORY) |
| 474 | void dbg_mem_free_done(const char *func) |
| 475 | { |
| 476 | printf("- %s - Done\n", func); |
| 477 | } |
| 478 | #else |
| 479 | #define dbg_mem_free_done(func) |
| 480 | #endif |
| 481 | |
| 482 | #if defined(DEBUG_FAIL) |
| 483 | void dbg_mem_alloc_fail(const char *func) |
| 484 | { |
| 485 | printf("- %s() Fail\n", func); |
| 486 | } |
| 487 | #else |
| 488 | #define dbg_mem_alloc_fail(func) |
| 489 | #endif |
| 490 | |
| 491 | #if defined(DEBUG_LINK) |
| 492 | static void dump_evt(u8 *cmp, u32 type, u16 cid) |
| 493 | { |
| 494 | u32 size = sizeof(struct cmpl_base); |
| 495 | u8 c = 'C'; |
| 496 | |
| 497 | switch (type) { |
| 498 | case CMPL_BASE_TYPE_HWRM_ASYNC_EVENT: |
| 499 | break; |
| 500 | default: |
| 501 | return; |
| 502 | } |
| 503 | dbg_prn("- %cQ Type (ae) cid %d", c, cid); |
| 504 | dump_mem(cmp, size, DISP_U8); |
| 505 | } |
| 506 | |
| 507 | void dbg_link_status(struct bnxt *bp) |
| 508 | { |
| 509 | dbg_prn(" Port(%d) : Link", bp->port_idx); |
| 510 | if (bp->link_status == STATUS_LINK_ACTIVE) { |
| 511 | dbg_prn("Up"); |
| 512 | } else { |
| 513 | dbg_prn("Down\n"); |
| 514 | dbg_prn(" media_detect : %x", bp->media_detect); |
| 515 | } |
| 516 | dbg_prn("\n"); |
| 517 | } |
| 518 | |
| 519 | void dbg_link_state(struct bnxt *bp, u32 tmo) |
| 520 | { |
| 521 | if (bp->link_status == STATUS_LINK_ACTIVE) |
| 522 | printf(" Link wait time : %d ms\n", tmo); |
| 523 | } |
| 524 | |
| 525 | void dbg_phy_speed(struct bnxt *bp, char *name) |
| 526 | { |
| 527 | printf(" Current Speed : %s\n", name); |
| 528 | } |
| 529 | #else |
| 530 | #define dump_evt(cmp, ty, cid) |
| 531 | #define dbg_link_status(bp) |
| 532 | #define dbg_link_state(bp, tmo) |
| 533 | #define dbg_phy_speed(bp, name) |
| 534 | #endif |
| 535 | |
| 536 | #endif /* _BXNT_DBG_H_ */ |