ql4_dbg.c 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * QLogic iSCSI HBA Driver
  3. * Copyright (c) 2003-2012 QLogic Corporation
  4. *
  5. * See LICENSE.qla4xxx for copyright and licensing details.
  6. */
  7. #include "ql4_def.h"
  8. #include "ql4_glbl.h"
  9. #include "ql4_dbg.h"
  10. #include "ql4_inline.h"
  11. void qla4xxx_dump_buffer(void *b, uint32_t size)
  12. {
  13. uint32_t cnt;
  14. uint8_t *c = b;
  15. printk(" 0 1 2 3 4 5 6 7 8 9 Ah Bh Ch Dh Eh "
  16. "Fh\n");
  17. printk("------------------------------------------------------------"
  18. "--\n");
  19. for (cnt = 0; cnt < size; c++) {
  20. printk("%02x", *c);
  21. if (!(++cnt % 16))
  22. printk("\n");
  23. else
  24. printk(" ");
  25. }
  26. printk(KERN_INFO "\n");
  27. }
  28. void qla4xxx_dump_registers(struct scsi_qla_host *ha)
  29. {
  30. uint8_t i;
  31. if (is_qla8022(ha)) {
  32. for (i = 1; i < MBOX_REG_COUNT; i++)
  33. printk(KERN_INFO "mailbox[%d] = 0x%08X\n",
  34. i, readl(&ha->qla4_82xx_reg->mailbox_in[i]));
  35. return;
  36. }
  37. for (i = 0; i < MBOX_REG_COUNT; i++) {
  38. printk(KERN_INFO "0x%02X mailbox[%d] = 0x%08X\n",
  39. (uint8_t) offsetof(struct isp_reg, mailbox[i]), i,
  40. readw(&ha->reg->mailbox[i]));
  41. }
  42. printk(KERN_INFO "0x%02X flash_address = 0x%08X\n",
  43. (uint8_t) offsetof(struct isp_reg, flash_address),
  44. readw(&ha->reg->flash_address));
  45. printk(KERN_INFO "0x%02X flash_data = 0x%08X\n",
  46. (uint8_t) offsetof(struct isp_reg, flash_data),
  47. readw(&ha->reg->flash_data));
  48. printk(KERN_INFO "0x%02X ctrl_status = 0x%08X\n",
  49. (uint8_t) offsetof(struct isp_reg, ctrl_status),
  50. readw(&ha->reg->ctrl_status));
  51. if (is_qla4010(ha)) {
  52. printk(KERN_INFO "0x%02X nvram = 0x%08X\n",
  53. (uint8_t) offsetof(struct isp_reg, u1.isp4010.nvram),
  54. readw(&ha->reg->u1.isp4010.nvram));
  55. } else if (is_qla4022(ha) | is_qla4032(ha)) {
  56. printk(KERN_INFO "0x%02X intr_mask = 0x%08X\n",
  57. (uint8_t) offsetof(struct isp_reg, u1.isp4022.intr_mask),
  58. readw(&ha->reg->u1.isp4022.intr_mask));
  59. printk(KERN_INFO "0x%02X nvram = 0x%08X\n",
  60. (uint8_t) offsetof(struct isp_reg, u1.isp4022.nvram),
  61. readw(&ha->reg->u1.isp4022.nvram));
  62. printk(KERN_INFO "0x%02X semaphore = 0x%08X\n",
  63. (uint8_t) offsetof(struct isp_reg, u1.isp4022.semaphore),
  64. readw(&ha->reg->u1.isp4022.semaphore));
  65. }
  66. printk(KERN_INFO "0x%02X req_q_in = 0x%08X\n",
  67. (uint8_t) offsetof(struct isp_reg, req_q_in),
  68. readw(&ha->reg->req_q_in));
  69. printk(KERN_INFO "0x%02X rsp_q_out = 0x%08X\n",
  70. (uint8_t) offsetof(struct isp_reg, rsp_q_out),
  71. readw(&ha->reg->rsp_q_out));
  72. if (is_qla4010(ha)) {
  73. printk(KERN_INFO "0x%02X ext_hw_conf = 0x%08X\n",
  74. (uint8_t) offsetof(struct isp_reg, u2.isp4010.ext_hw_conf),
  75. readw(&ha->reg->u2.isp4010.ext_hw_conf));
  76. printk(KERN_INFO "0x%02X port_ctrl = 0x%08X\n",
  77. (uint8_t) offsetof(struct isp_reg, u2.isp4010.port_ctrl),
  78. readw(&ha->reg->u2.isp4010.port_ctrl));
  79. printk(KERN_INFO "0x%02X port_status = 0x%08X\n",
  80. (uint8_t) offsetof(struct isp_reg, u2.isp4010.port_status),
  81. readw(&ha->reg->u2.isp4010.port_status));
  82. printk(KERN_INFO "0x%02X req_q_out = 0x%08X\n",
  83. (uint8_t) offsetof(struct isp_reg, u2.isp4010.req_q_out),
  84. readw(&ha->reg->u2.isp4010.req_q_out));
  85. printk(KERN_INFO "0x%02X gp_out = 0x%08X\n",
  86. (uint8_t) offsetof(struct isp_reg, u2.isp4010.gp_out),
  87. readw(&ha->reg->u2.isp4010.gp_out));
  88. printk(KERN_INFO "0x%02X gp_in = 0x%08X\n",
  89. (uint8_t) offsetof(struct isp_reg, u2.isp4010.gp_in),
  90. readw(&ha->reg->u2.isp4010.gp_in));
  91. printk(KERN_INFO "0x%02X port_err_status = 0x%08X\n", (uint8_t)
  92. offsetof(struct isp_reg, u2.isp4010.port_err_status),
  93. readw(&ha->reg->u2.isp4010.port_err_status));
  94. } else if (is_qla4022(ha) | is_qla4032(ha)) {
  95. printk(KERN_INFO "Page 0 Registers:\n");
  96. printk(KERN_INFO "0x%02X ext_hw_conf = 0x%08X\n", (uint8_t)
  97. offsetof(struct isp_reg, u2.isp4022.p0.ext_hw_conf),
  98. readw(&ha->reg->u2.isp4022.p0.ext_hw_conf));
  99. printk(KERN_INFO "0x%02X port_ctrl = 0x%08X\n", (uint8_t)
  100. offsetof(struct isp_reg, u2.isp4022.p0.port_ctrl),
  101. readw(&ha->reg->u2.isp4022.p0.port_ctrl));
  102. printk(KERN_INFO "0x%02X port_status = 0x%08X\n", (uint8_t)
  103. offsetof(struct isp_reg, u2.isp4022.p0.port_status),
  104. readw(&ha->reg->u2.isp4022.p0.port_status));
  105. printk(KERN_INFO "0x%02X gp_out = 0x%08X\n",
  106. (uint8_t) offsetof(struct isp_reg, u2.isp4022.p0.gp_out),
  107. readw(&ha->reg->u2.isp4022.p0.gp_out));
  108. printk(KERN_INFO "0x%02X gp_in = 0x%08X\n",
  109. (uint8_t) offsetof(struct isp_reg, u2.isp4022.p0.gp_in),
  110. readw(&ha->reg->u2.isp4022.p0.gp_in));
  111. printk(KERN_INFO "0x%02X port_err_status = 0x%08X\n", (uint8_t)
  112. offsetof(struct isp_reg, u2.isp4022.p0.port_err_status),
  113. readw(&ha->reg->u2.isp4022.p0.port_err_status));
  114. printk(KERN_INFO "Page 1 Registers:\n");
  115. writel(HOST_MEM_CFG_PAGE & set_rmask(CSR_SCSI_PAGE_SELECT),
  116. &ha->reg->ctrl_status);
  117. printk(KERN_INFO "0x%02X req_q_out = 0x%08X\n",
  118. (uint8_t) offsetof(struct isp_reg, u2.isp4022.p1.req_q_out),
  119. readw(&ha->reg->u2.isp4022.p1.req_q_out));
  120. writel(PORT_CTRL_STAT_PAGE & set_rmask(CSR_SCSI_PAGE_SELECT),
  121. &ha->reg->ctrl_status);
  122. }
  123. }
  124. void qla4_8xxx_dump_peg_reg(struct scsi_qla_host *ha)
  125. {
  126. uint32_t halt_status1, halt_status2;
  127. halt_status1 = qla4_8xxx_rd_direct(ha, QLA8XXX_PEG_HALT_STATUS1);
  128. halt_status2 = qla4_8xxx_rd_direct(ha, QLA8XXX_PEG_HALT_STATUS2);
  129. if (is_qla8022(ha)) {
  130. ql4_printk(KERN_INFO, ha,
  131. "scsi(%ld): %s, ISP%04x Dumping hw/fw registers:\n"
  132. " PEG_HALT_STATUS1: 0x%x, PEG_HALT_STATUS2: 0x%x,\n"
  133. " PEG_NET_0_PC: 0x%x, PEG_NET_1_PC: 0x%x,\n"
  134. " PEG_NET_2_PC: 0x%x, PEG_NET_3_PC: 0x%x,\n"
  135. " PEG_NET_4_PC: 0x%x\n", ha->host_no, __func__,
  136. ha->pdev->device, halt_status1, halt_status2,
  137. qla4_82xx_rd_32(ha, QLA82XX_CRB_PEG_NET_0 + 0x3c),
  138. qla4_82xx_rd_32(ha, QLA82XX_CRB_PEG_NET_1 + 0x3c),
  139. qla4_82xx_rd_32(ha, QLA82XX_CRB_PEG_NET_2 + 0x3c),
  140. qla4_82xx_rd_32(ha, QLA82XX_CRB_PEG_NET_3 + 0x3c),
  141. qla4_82xx_rd_32(ha, QLA82XX_CRB_PEG_NET_4 + 0x3c));
  142. } else if (is_qla8032(ha) || is_qla8042(ha)) {
  143. ql4_printk(KERN_INFO, ha,
  144. "scsi(%ld): %s, ISP%04x Dumping hw/fw registers:\n"
  145. " PEG_HALT_STATUS1: 0x%x, PEG_HALT_STATUS2: 0x%x,\n",
  146. ha->host_no, __func__, ha->pdev->device,
  147. halt_status1, halt_status2);
  148. }
  149. }