2 * QLogic Fibre Channel HBA Driver
3 * Copyright (c) 2003-2005 QLogic Corporation
5 * See LICENSE.qla2xxx for copyright and licensing details.
9 #include <linux/delay.h>
11 static int qla_uprintf(char **, char *, ...);
14 * qla2300_fw_dump() - Dumps binary data from the 2300 firmware.
16 * @hardware_locked: Called with the hardware_lock
19 qla2300_fw_dump(scsi_qla_host_t
*ha
, int hardware_locked
)
23 uint32_t risc_address
;
27 struct device_reg_2xxx __iomem
*reg
= &ha
->iobase
->isp
;
28 uint16_t __iomem
*dmp_reg
;
30 struct qla2300_fw_dump
*fw
;
31 uint32_t dump_size
, data_ram_cnt
;
33 risc_address
= data_ram_cnt
= 0;
38 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
40 if (ha
->fw_dump
!= NULL
) {
41 qla_printk(KERN_WARNING
, ha
,
42 "Firmware has been previously dumped (%p) -- ignoring "
43 "request...\n", ha
->fw_dump
);
44 goto qla2300_fw_dump_failed
;
47 /* Allocate (large) dump buffer. */
48 dump_size
= sizeof(struct qla2300_fw_dump
);
49 dump_size
+= (ha
->fw_memory_size
- 0x11000) * sizeof(uint16_t);
50 ha
->fw_dump_order
= get_order(dump_size
);
51 ha
->fw_dump
= (struct qla2300_fw_dump
*) __get_free_pages(GFP_ATOMIC
,
53 if (ha
->fw_dump
== NULL
) {
54 qla_printk(KERN_WARNING
, ha
,
55 "Unable to allocated memory for firmware dump (%d/%d).\n",
56 ha
->fw_dump_order
, dump_size
);
57 goto qla2300_fw_dump_failed
;
62 fw
->hccr
= RD_REG_WORD(®
->hccr
);
65 WRT_REG_WORD(®
->hccr
, HCCR_PAUSE_RISC
);
68 (RD_REG_WORD(®
->hccr
) & HCCR_RISC_PAUSE
) == 0 &&
69 rval
== QLA_SUCCESS
; cnt
--) {
73 rval
= QLA_FUNCTION_TIMEOUT
;
76 RD_REG_WORD(®
->hccr
); /* PCI Posting. */
80 if (rval
== QLA_SUCCESS
) {
81 dmp_reg
= (uint16_t __iomem
*)(reg
+ 0);
82 for (cnt
= 0; cnt
< sizeof(fw
->pbiu_reg
) / 2; cnt
++)
83 fw
->pbiu_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
85 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x10);
86 for (cnt
= 0; cnt
< sizeof(fw
->risc_host_reg
) / 2; cnt
++)
87 fw
->risc_host_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
89 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x40);
90 for (cnt
= 0; cnt
< sizeof(fw
->mailbox_reg
) / 2; cnt
++)
91 fw
->mailbox_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
93 WRT_REG_WORD(®
->ctrl_status
, 0x40);
94 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
95 for (cnt
= 0; cnt
< sizeof(fw
->resp_dma_reg
) / 2; cnt
++)
96 fw
->resp_dma_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
98 WRT_REG_WORD(®
->ctrl_status
, 0x50);
99 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
100 for (cnt
= 0; cnt
< sizeof(fw
->dma_reg
) / 2; cnt
++)
101 fw
->dma_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
103 WRT_REG_WORD(®
->ctrl_status
, 0x00);
104 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xA0);
105 for (cnt
= 0; cnt
< sizeof(fw
->risc_hdw_reg
) / 2; cnt
++)
106 fw
->risc_hdw_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
108 WRT_REG_WORD(®
->pcr
, 0x2000);
109 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
110 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp0_reg
) / 2; cnt
++)
111 fw
->risc_gp0_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
113 WRT_REG_WORD(®
->pcr
, 0x2200);
114 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
115 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp1_reg
) / 2; cnt
++)
116 fw
->risc_gp1_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
118 WRT_REG_WORD(®
->pcr
, 0x2400);
119 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
120 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp2_reg
) / 2; cnt
++)
121 fw
->risc_gp2_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
123 WRT_REG_WORD(®
->pcr
, 0x2600);
124 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
125 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp3_reg
) / 2; cnt
++)
126 fw
->risc_gp3_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
128 WRT_REG_WORD(®
->pcr
, 0x2800);
129 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
130 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp4_reg
) / 2; cnt
++)
131 fw
->risc_gp4_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
133 WRT_REG_WORD(®
->pcr
, 0x2A00);
134 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
135 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp5_reg
) / 2; cnt
++)
136 fw
->risc_gp5_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
138 WRT_REG_WORD(®
->pcr
, 0x2C00);
139 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
140 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp6_reg
) / 2; cnt
++)
141 fw
->risc_gp6_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
143 WRT_REG_WORD(®
->pcr
, 0x2E00);
144 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
145 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp7_reg
) / 2; cnt
++)
146 fw
->risc_gp7_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
148 WRT_REG_WORD(®
->ctrl_status
, 0x10);
149 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
150 for (cnt
= 0; cnt
< sizeof(fw
->frame_buf_hdw_reg
) / 2; cnt
++)
151 fw
->frame_buf_hdw_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
153 WRT_REG_WORD(®
->ctrl_status
, 0x20);
154 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
155 for (cnt
= 0; cnt
< sizeof(fw
->fpm_b0_reg
) / 2; cnt
++)
156 fw
->fpm_b0_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
158 WRT_REG_WORD(®
->ctrl_status
, 0x30);
159 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
160 for (cnt
= 0; cnt
< sizeof(fw
->fpm_b1_reg
) / 2; cnt
++)
161 fw
->fpm_b1_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
164 WRT_REG_WORD(®
->ctrl_status
, CSR_ISP_SOFT_RESET
);
165 for (cnt
= 0; cnt
< 30000; cnt
++) {
166 if ((RD_REG_WORD(®
->ctrl_status
) &
167 CSR_ISP_SOFT_RESET
) == 0)
174 if (!IS_QLA2300(ha
)) {
175 for (cnt
= 30000; RD_MAILBOX_REG(ha
, reg
, 0) != 0 &&
176 rval
== QLA_SUCCESS
; cnt
--) {
180 rval
= QLA_FUNCTION_TIMEOUT
;
184 if (rval
== QLA_SUCCESS
) {
186 risc_address
= 0x800;
187 WRT_MAILBOX_REG(ha
, reg
, 0, MBC_READ_RAM_WORD
);
188 clear_bit(MBX_INTERRUPT
, &ha
->mbx_cmd_flags
);
190 for (cnt
= 0; cnt
< sizeof(fw
->risc_ram
) / 2 && rval
== QLA_SUCCESS
;
191 cnt
++, risc_address
++) {
192 WRT_MAILBOX_REG(ha
, reg
, 1, (uint16_t)risc_address
);
193 WRT_REG_WORD(®
->hccr
, HCCR_SET_HOST_INT
);
195 for (timer
= 6000000; timer
; timer
--) {
196 /* Check for pending interrupts. */
197 stat
= RD_REG_DWORD(®
->u
.isp2300
.host_status
);
198 if (stat
& HSR_RISC_INT
) {
201 if (stat
== 0x1 || stat
== 0x2) {
202 set_bit(MBX_INTERRUPT
,
205 mb0
= RD_MAILBOX_REG(ha
, reg
, 0);
206 mb2
= RD_MAILBOX_REG(ha
, reg
, 2);
208 /* Release mailbox registers. */
209 WRT_REG_WORD(®
->semaphore
, 0);
210 WRT_REG_WORD(®
->hccr
,
212 RD_REG_WORD(®
->hccr
);
214 } else if (stat
== 0x10 || stat
== 0x11) {
215 set_bit(MBX_INTERRUPT
,
218 mb0
= RD_MAILBOX_REG(ha
, reg
, 0);
219 mb2
= RD_MAILBOX_REG(ha
, reg
, 2);
221 WRT_REG_WORD(®
->hccr
,
223 RD_REG_WORD(®
->hccr
);
227 /* clear this intr; it wasn't a mailbox intr */
228 WRT_REG_WORD(®
->hccr
, HCCR_CLR_RISC_INT
);
229 RD_REG_WORD(®
->hccr
);
234 if (test_and_clear_bit(MBX_INTERRUPT
, &ha
->mbx_cmd_flags
)) {
235 rval
= mb0
& MBS_MASK
;
236 fw
->risc_ram
[cnt
] = mb2
;
238 rval
= QLA_FUNCTION_FAILED
;
242 if (rval
== QLA_SUCCESS
) {
243 /* Get stack SRAM. */
244 risc_address
= 0x10000;
245 WRT_MAILBOX_REG(ha
, reg
, 0, MBC_READ_RAM_EXTENDED
);
246 clear_bit(MBX_INTERRUPT
, &ha
->mbx_cmd_flags
);
248 for (cnt
= 0; cnt
< sizeof(fw
->stack_ram
) / 2 && rval
== QLA_SUCCESS
;
249 cnt
++, risc_address
++) {
250 WRT_MAILBOX_REG(ha
, reg
, 1, LSW(risc_address
));
251 WRT_MAILBOX_REG(ha
, reg
, 8, MSW(risc_address
));
252 WRT_REG_WORD(®
->hccr
, HCCR_SET_HOST_INT
);
254 for (timer
= 6000000; timer
; timer
--) {
255 /* Check for pending interrupts. */
256 stat
= RD_REG_DWORD(®
->u
.isp2300
.host_status
);
257 if (stat
& HSR_RISC_INT
) {
260 if (stat
== 0x1 || stat
== 0x2) {
261 set_bit(MBX_INTERRUPT
,
264 mb0
= RD_MAILBOX_REG(ha
, reg
, 0);
265 mb2
= RD_MAILBOX_REG(ha
, reg
, 2);
267 /* Release mailbox registers. */
268 WRT_REG_WORD(®
->semaphore
, 0);
269 WRT_REG_WORD(®
->hccr
,
271 RD_REG_WORD(®
->hccr
);
273 } else if (stat
== 0x10 || stat
== 0x11) {
274 set_bit(MBX_INTERRUPT
,
277 mb0
= RD_MAILBOX_REG(ha
, reg
, 0);
278 mb2
= RD_MAILBOX_REG(ha
, reg
, 2);
280 WRT_REG_WORD(®
->hccr
,
282 RD_REG_WORD(®
->hccr
);
286 /* clear this intr; it wasn't a mailbox intr */
287 WRT_REG_WORD(®
->hccr
, HCCR_CLR_RISC_INT
);
288 RD_REG_WORD(®
->hccr
);
293 if (test_and_clear_bit(MBX_INTERRUPT
, &ha
->mbx_cmd_flags
)) {
294 rval
= mb0
& MBS_MASK
;
295 fw
->stack_ram
[cnt
] = mb2
;
297 rval
= QLA_FUNCTION_FAILED
;
301 if (rval
== QLA_SUCCESS
) {
303 risc_address
= 0x11000;
304 data_ram_cnt
= ha
->fw_memory_size
- risc_address
+ 1;
305 WRT_MAILBOX_REG(ha
, reg
, 0, MBC_READ_RAM_EXTENDED
);
306 clear_bit(MBX_INTERRUPT
, &ha
->mbx_cmd_flags
);
308 for (cnt
= 0; cnt
< data_ram_cnt
&& rval
== QLA_SUCCESS
;
309 cnt
++, risc_address
++) {
310 WRT_MAILBOX_REG(ha
, reg
, 1, LSW(risc_address
));
311 WRT_MAILBOX_REG(ha
, reg
, 8, MSW(risc_address
));
312 WRT_REG_WORD(®
->hccr
, HCCR_SET_HOST_INT
);
314 for (timer
= 6000000; timer
; timer
--) {
315 /* Check for pending interrupts. */
316 stat
= RD_REG_DWORD(®
->u
.isp2300
.host_status
);
317 if (stat
& HSR_RISC_INT
) {
320 if (stat
== 0x1 || stat
== 0x2) {
321 set_bit(MBX_INTERRUPT
,
324 mb0
= RD_MAILBOX_REG(ha
, reg
, 0);
325 mb2
= RD_MAILBOX_REG(ha
, reg
, 2);
327 /* Release mailbox registers. */
328 WRT_REG_WORD(®
->semaphore
, 0);
329 WRT_REG_WORD(®
->hccr
,
331 RD_REG_WORD(®
->hccr
);
333 } else if (stat
== 0x10 || stat
== 0x11) {
334 set_bit(MBX_INTERRUPT
,
337 mb0
= RD_MAILBOX_REG(ha
, reg
, 0);
338 mb2
= RD_MAILBOX_REG(ha
, reg
, 2);
340 WRT_REG_WORD(®
->hccr
,
342 RD_REG_WORD(®
->hccr
);
346 /* clear this intr; it wasn't a mailbox intr */
347 WRT_REG_WORD(®
->hccr
, HCCR_CLR_RISC_INT
);
348 RD_REG_WORD(®
->hccr
);
353 if (test_and_clear_bit(MBX_INTERRUPT
, &ha
->mbx_cmd_flags
)) {
354 rval
= mb0
& MBS_MASK
;
355 fw
->data_ram
[cnt
] = mb2
;
357 rval
= QLA_FUNCTION_FAILED
;
362 if (rval
!= QLA_SUCCESS
) {
363 qla_printk(KERN_WARNING
, ha
,
364 "Failed to dump firmware (%x)!!!\n", rval
);
366 free_pages((unsigned long)ha
->fw_dump
, ha
->fw_dump_order
);
369 qla_printk(KERN_INFO
, ha
,
370 "Firmware dump saved to temp buffer (%ld/%p).\n",
371 ha
->host_no
, ha
->fw_dump
);
374 qla2300_fw_dump_failed
:
375 if (!hardware_locked
)
376 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
380 * qla2300_ascii_fw_dump() - Converts a binary firmware dump to ASCII.
384 qla2300_ascii_fw_dump(scsi_qla_host_t
*ha
)
389 struct qla2300_fw_dump
*fw
;
390 uint32_t data_ram_cnt
;
392 uiter
= ha
->fw_dump_buffer
;
395 qla_uprintf(&uiter
, "%s Firmware Version %s\n", ha
->model_number
,
396 ha
->isp_ops
.fw_version_str(ha
, fw_info
));
398 qla_uprintf(&uiter
, "\n[==>BEG]\n");
400 qla_uprintf(&uiter
, "HCCR Register:\n%04x\n\n", fw
->hccr
);
402 qla_uprintf(&uiter
, "PBIU Registers:");
403 for (cnt
= 0; cnt
< sizeof (fw
->pbiu_reg
) / 2; cnt
++) {
405 qla_uprintf(&uiter
, "\n");
407 qla_uprintf(&uiter
, "%04x ", fw
->pbiu_reg
[cnt
]);
410 qla_uprintf(&uiter
, "\n\nReqQ-RspQ-Risc2Host Status registers:");
411 for (cnt
= 0; cnt
< sizeof (fw
->risc_host_reg
) / 2; cnt
++) {
413 qla_uprintf(&uiter
, "\n");
415 qla_uprintf(&uiter
, "%04x ", fw
->risc_host_reg
[cnt
]);
418 qla_uprintf(&uiter
, "\n\nMailbox Registers:");
419 for (cnt
= 0; cnt
< sizeof (fw
->mailbox_reg
) / 2; cnt
++) {
421 qla_uprintf(&uiter
, "\n");
423 qla_uprintf(&uiter
, "%04x ", fw
->mailbox_reg
[cnt
]);
426 qla_uprintf(&uiter
, "\n\nAuto Request Response DMA Registers:");
427 for (cnt
= 0; cnt
< sizeof (fw
->resp_dma_reg
) / 2; cnt
++) {
429 qla_uprintf(&uiter
, "\n");
431 qla_uprintf(&uiter
, "%04x ", fw
->resp_dma_reg
[cnt
]);
434 qla_uprintf(&uiter
, "\n\nDMA Registers:");
435 for (cnt
= 0; cnt
< sizeof (fw
->dma_reg
) / 2; cnt
++) {
437 qla_uprintf(&uiter
, "\n");
439 qla_uprintf(&uiter
, "%04x ", fw
->dma_reg
[cnt
]);
442 qla_uprintf(&uiter
, "\n\nRISC Hardware Registers:");
443 for (cnt
= 0; cnt
< sizeof (fw
->risc_hdw_reg
) / 2; cnt
++) {
445 qla_uprintf(&uiter
, "\n");
447 qla_uprintf(&uiter
, "%04x ", fw
->risc_hdw_reg
[cnt
]);
450 qla_uprintf(&uiter
, "\n\nRISC GP0 Registers:");
451 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp0_reg
) / 2; cnt
++) {
453 qla_uprintf(&uiter
, "\n");
455 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp0_reg
[cnt
]);
458 qla_uprintf(&uiter
, "\n\nRISC GP1 Registers:");
459 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp1_reg
) / 2; cnt
++) {
461 qla_uprintf(&uiter
, "\n");
463 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp1_reg
[cnt
]);
466 qla_uprintf(&uiter
, "\n\nRISC GP2 Registers:");
467 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp2_reg
) / 2; cnt
++) {
469 qla_uprintf(&uiter
, "\n");
471 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp2_reg
[cnt
]);
474 qla_uprintf(&uiter
, "\n\nRISC GP3 Registers:");
475 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp3_reg
) / 2; cnt
++) {
477 qla_uprintf(&uiter
, "\n");
479 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp3_reg
[cnt
]);
482 qla_uprintf(&uiter
, "\n\nRISC GP4 Registers:");
483 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp4_reg
) / 2; cnt
++) {
485 qla_uprintf(&uiter
, "\n");
487 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp4_reg
[cnt
]);
490 qla_uprintf(&uiter
, "\n\nRISC GP5 Registers:");
491 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp5_reg
) / 2; cnt
++) {
493 qla_uprintf(&uiter
, "\n");
495 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp5_reg
[cnt
]);
498 qla_uprintf(&uiter
, "\n\nRISC GP6 Registers:");
499 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp6_reg
) / 2; cnt
++) {
501 qla_uprintf(&uiter
, "\n");
503 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp6_reg
[cnt
]);
506 qla_uprintf(&uiter
, "\n\nRISC GP7 Registers:");
507 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp7_reg
) / 2; cnt
++) {
509 qla_uprintf(&uiter
, "\n");
511 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp7_reg
[cnt
]);
514 qla_uprintf(&uiter
, "\n\nFrame Buffer Hardware Registers:");
515 for (cnt
= 0; cnt
< sizeof (fw
->frame_buf_hdw_reg
) / 2; cnt
++) {
517 qla_uprintf(&uiter
, "\n");
519 qla_uprintf(&uiter
, "%04x ", fw
->frame_buf_hdw_reg
[cnt
]);
522 qla_uprintf(&uiter
, "\n\nFPM B0 Registers:");
523 for (cnt
= 0; cnt
< sizeof (fw
->fpm_b0_reg
) / 2; cnt
++) {
525 qla_uprintf(&uiter
, "\n");
527 qla_uprintf(&uiter
, "%04x ", fw
->fpm_b0_reg
[cnt
]);
530 qla_uprintf(&uiter
, "\n\nFPM B1 Registers:");
531 for (cnt
= 0; cnt
< sizeof (fw
->fpm_b1_reg
) / 2; cnt
++) {
533 qla_uprintf(&uiter
, "\n");
535 qla_uprintf(&uiter
, "%04x ", fw
->fpm_b1_reg
[cnt
]);
538 qla_uprintf(&uiter
, "\n\nCode RAM Dump:");
539 for (cnt
= 0; cnt
< sizeof (fw
->risc_ram
) / 2; cnt
++) {
541 qla_uprintf(&uiter
, "\n%04x: ", cnt
+ 0x0800);
543 qla_uprintf(&uiter
, "%04x ", fw
->risc_ram
[cnt
]);
546 qla_uprintf(&uiter
, "\n\nStack RAM Dump:");
547 for (cnt
= 0; cnt
< sizeof (fw
->stack_ram
) / 2; cnt
++) {
549 qla_uprintf(&uiter
, "\n%05x: ", cnt
+ 0x10000);
551 qla_uprintf(&uiter
, "%04x ", fw
->stack_ram
[cnt
]);
554 qla_uprintf(&uiter
, "\n\nData RAM Dump:");
555 data_ram_cnt
= ha
->fw_memory_size
- 0x11000 + 1;
556 for (cnt
= 0; cnt
< data_ram_cnt
; cnt
++) {
558 qla_uprintf(&uiter
, "\n%05x: ", cnt
+ 0x11000);
560 qla_uprintf(&uiter
, "%04x ", fw
->data_ram
[cnt
]);
563 qla_uprintf(&uiter
, "\n\n[<==END] ISP Debug Dump.");
567 * qla2100_fw_dump() - Dumps binary data from the 2100/2200 firmware.
569 * @hardware_locked: Called with the hardware_lock
572 qla2100_fw_dump(scsi_qla_host_t
*ha
, int hardware_locked
)
576 uint16_t risc_address
;
578 struct device_reg_2xxx __iomem
*reg
= &ha
->iobase
->isp
;
579 uint16_t __iomem
*dmp_reg
;
581 struct qla2100_fw_dump
*fw
;
587 if (!hardware_locked
)
588 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
590 if (ha
->fw_dump
!= NULL
) {
591 qla_printk(KERN_WARNING
, ha
,
592 "Firmware has been previously dumped (%p) -- ignoring "
593 "request...\n", ha
->fw_dump
);
594 goto qla2100_fw_dump_failed
;
597 /* Allocate (large) dump buffer. */
598 ha
->fw_dump_order
= get_order(sizeof(struct qla2100_fw_dump
));
599 ha
->fw_dump
= (struct qla2100_fw_dump
*) __get_free_pages(GFP_ATOMIC
,
601 if (ha
->fw_dump
== NULL
) {
602 qla_printk(KERN_WARNING
, ha
,
603 "Unable to allocated memory for firmware dump (%d/%Zd).\n",
604 ha
->fw_dump_order
, sizeof(struct qla2100_fw_dump
));
605 goto qla2100_fw_dump_failed
;
610 fw
->hccr
= RD_REG_WORD(®
->hccr
);
613 WRT_REG_WORD(®
->hccr
, HCCR_PAUSE_RISC
);
614 for (cnt
= 30000; (RD_REG_WORD(®
->hccr
) & HCCR_RISC_PAUSE
) == 0 &&
615 rval
== QLA_SUCCESS
; cnt
--) {
619 rval
= QLA_FUNCTION_TIMEOUT
;
621 if (rval
== QLA_SUCCESS
) {
622 dmp_reg
= (uint16_t __iomem
*)(reg
+ 0);
623 for (cnt
= 0; cnt
< sizeof(fw
->pbiu_reg
) / 2; cnt
++)
624 fw
->pbiu_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
626 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x10);
627 for (cnt
= 0; cnt
< ha
->mbx_count
; cnt
++) {
629 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xe0);
631 fw
->mailbox_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
634 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x20);
635 for (cnt
= 0; cnt
< sizeof(fw
->dma_reg
) / 2; cnt
++)
636 fw
->dma_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
638 WRT_REG_WORD(®
->ctrl_status
, 0x00);
639 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xA0);
640 for (cnt
= 0; cnt
< sizeof(fw
->risc_hdw_reg
) / 2; cnt
++)
641 fw
->risc_hdw_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
643 WRT_REG_WORD(®
->pcr
, 0x2000);
644 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
645 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp0_reg
) / 2; cnt
++)
646 fw
->risc_gp0_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
648 WRT_REG_WORD(®
->pcr
, 0x2100);
649 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
650 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp1_reg
) / 2; cnt
++)
651 fw
->risc_gp1_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
653 WRT_REG_WORD(®
->pcr
, 0x2200);
654 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
655 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp2_reg
) / 2; cnt
++)
656 fw
->risc_gp2_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
658 WRT_REG_WORD(®
->pcr
, 0x2300);
659 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
660 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp3_reg
) / 2; cnt
++)
661 fw
->risc_gp3_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
663 WRT_REG_WORD(®
->pcr
, 0x2400);
664 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
665 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp4_reg
) / 2; cnt
++)
666 fw
->risc_gp4_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
668 WRT_REG_WORD(®
->pcr
, 0x2500);
669 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
670 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp5_reg
) / 2; cnt
++)
671 fw
->risc_gp5_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
673 WRT_REG_WORD(®
->pcr
, 0x2600);
674 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
675 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp6_reg
) / 2; cnt
++)
676 fw
->risc_gp6_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
678 WRT_REG_WORD(®
->pcr
, 0x2700);
679 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
680 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp7_reg
) / 2; cnt
++)
681 fw
->risc_gp7_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
683 WRT_REG_WORD(®
->ctrl_status
, 0x10);
684 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
685 for (cnt
= 0; cnt
< sizeof(fw
->frame_buf_hdw_reg
) / 2; cnt
++)
686 fw
->frame_buf_hdw_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
688 WRT_REG_WORD(®
->ctrl_status
, 0x20);
689 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
690 for (cnt
= 0; cnt
< sizeof(fw
->fpm_b0_reg
) / 2; cnt
++)
691 fw
->fpm_b0_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
693 WRT_REG_WORD(®
->ctrl_status
, 0x30);
694 dmp_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
695 for (cnt
= 0; cnt
< sizeof(fw
->fpm_b1_reg
) / 2; cnt
++)
696 fw
->fpm_b1_reg
[cnt
] = RD_REG_WORD(dmp_reg
++);
699 WRT_REG_WORD(®
->ctrl_status
, CSR_ISP_SOFT_RESET
);
702 for (cnt
= 30000; RD_MAILBOX_REG(ha
, reg
, 0) != 0 &&
703 rval
== QLA_SUCCESS
; cnt
--) {
707 rval
= QLA_FUNCTION_TIMEOUT
;
711 if (rval
== QLA_SUCCESS
&& (IS_QLA2200(ha
) || (IS_QLA2100(ha
) &&
712 (RD_REG_WORD(®
->mctr
) & (BIT_1
| BIT_0
)) != 0))) {
714 WRT_REG_WORD(®
->hccr
, HCCR_PAUSE_RISC
);
716 (RD_REG_WORD(®
->hccr
) & HCCR_RISC_PAUSE
) == 0 &&
717 rval
== QLA_SUCCESS
; cnt
--) {
721 rval
= QLA_FUNCTION_TIMEOUT
;
723 if (rval
== QLA_SUCCESS
) {
724 /* Set memory configuration and timing. */
726 WRT_REG_WORD(®
->mctr
, 0xf1);
728 WRT_REG_WORD(®
->mctr
, 0xf2);
729 RD_REG_WORD(®
->mctr
); /* PCI Posting. */
732 WRT_REG_WORD(®
->hccr
, HCCR_RELEASE_RISC
);
736 if (rval
== QLA_SUCCESS
) {
738 risc_address
= 0x1000;
739 WRT_MAILBOX_REG(ha
, reg
, 0, MBC_READ_RAM_WORD
);
740 clear_bit(MBX_INTERRUPT
, &ha
->mbx_cmd_flags
);
742 for (cnt
= 0; cnt
< sizeof(fw
->risc_ram
) / 2 && rval
== QLA_SUCCESS
;
743 cnt
++, risc_address
++) {
744 WRT_MAILBOX_REG(ha
, reg
, 1, risc_address
);
745 WRT_REG_WORD(®
->hccr
, HCCR_SET_HOST_INT
);
747 for (timer
= 6000000; timer
!= 0; timer
--) {
748 /* Check for pending interrupts. */
749 if (RD_REG_WORD(®
->istatus
) & ISR_RISC_INT
) {
750 if (RD_REG_WORD(®
->semaphore
) & BIT_0
) {
751 set_bit(MBX_INTERRUPT
,
754 mb0
= RD_MAILBOX_REG(ha
, reg
, 0);
755 mb2
= RD_MAILBOX_REG(ha
, reg
, 2);
757 WRT_REG_WORD(®
->semaphore
, 0);
758 WRT_REG_WORD(®
->hccr
,
760 RD_REG_WORD(®
->hccr
);
763 WRT_REG_WORD(®
->hccr
, HCCR_CLR_RISC_INT
);
764 RD_REG_WORD(®
->hccr
);
769 if (test_and_clear_bit(MBX_INTERRUPT
, &ha
->mbx_cmd_flags
)) {
770 rval
= mb0
& MBS_MASK
;
771 fw
->risc_ram
[cnt
] = mb2
;
773 rval
= QLA_FUNCTION_FAILED
;
777 if (rval
!= QLA_SUCCESS
) {
778 qla_printk(KERN_WARNING
, ha
,
779 "Failed to dump firmware (%x)!!!\n", rval
);
781 free_pages((unsigned long)ha
->fw_dump
, ha
->fw_dump_order
);
784 qla_printk(KERN_INFO
, ha
,
785 "Firmware dump saved to temp buffer (%ld/%p).\n",
786 ha
->host_no
, ha
->fw_dump
);
789 qla2100_fw_dump_failed
:
790 if (!hardware_locked
)
791 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
795 * qla2100_ascii_fw_dump() - Converts a binary firmware dump to ASCII.
799 qla2100_ascii_fw_dump(scsi_qla_host_t
*ha
)
804 struct qla2100_fw_dump
*fw
;
806 uiter
= ha
->fw_dump_buffer
;
809 qla_uprintf(&uiter
, "%s Firmware Version %s\n", ha
->model_number
,
810 ha
->isp_ops
.fw_version_str(ha
, fw_info
));
812 qla_uprintf(&uiter
, "\n[==>BEG]\n");
814 qla_uprintf(&uiter
, "HCCR Register:\n%04x\n\n", fw
->hccr
);
816 qla_uprintf(&uiter
, "PBIU Registers:");
817 for (cnt
= 0; cnt
< sizeof (fw
->pbiu_reg
) / 2; cnt
++) {
819 qla_uprintf(&uiter
, "\n");
821 qla_uprintf(&uiter
, "%04x ", fw
->pbiu_reg
[cnt
]);
824 qla_uprintf(&uiter
, "\n\nMailbox Registers:");
825 for (cnt
= 0; cnt
< sizeof (fw
->mailbox_reg
) / 2; cnt
++) {
827 qla_uprintf(&uiter
, "\n");
829 qla_uprintf(&uiter
, "%04x ", fw
->mailbox_reg
[cnt
]);
832 qla_uprintf(&uiter
, "\n\nDMA Registers:");
833 for (cnt
= 0; cnt
< sizeof (fw
->dma_reg
) / 2; cnt
++) {
835 qla_uprintf(&uiter
, "\n");
837 qla_uprintf(&uiter
, "%04x ", fw
->dma_reg
[cnt
]);
840 qla_uprintf(&uiter
, "\n\nRISC Hardware Registers:");
841 for (cnt
= 0; cnt
< sizeof (fw
->risc_hdw_reg
) / 2; cnt
++) {
843 qla_uprintf(&uiter
, "\n");
845 qla_uprintf(&uiter
, "%04x ", fw
->risc_hdw_reg
[cnt
]);
848 qla_uprintf(&uiter
, "\n\nRISC GP0 Registers:");
849 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp0_reg
) / 2; cnt
++) {
851 qla_uprintf(&uiter
, "\n");
853 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp0_reg
[cnt
]);
856 qla_uprintf(&uiter
, "\n\nRISC GP1 Registers:");
857 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp1_reg
) / 2; cnt
++) {
859 qla_uprintf(&uiter
, "\n");
861 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp1_reg
[cnt
]);
864 qla_uprintf(&uiter
, "\n\nRISC GP2 Registers:");
865 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp2_reg
) / 2; cnt
++) {
867 qla_uprintf(&uiter
, "\n");
869 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp2_reg
[cnt
]);
872 qla_uprintf(&uiter
, "\n\nRISC GP3 Registers:");
873 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp3_reg
) / 2; cnt
++) {
875 qla_uprintf(&uiter
, "\n");
877 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp3_reg
[cnt
]);
880 qla_uprintf(&uiter
, "\n\nRISC GP4 Registers:");
881 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp4_reg
) / 2; cnt
++) {
883 qla_uprintf(&uiter
, "\n");
885 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp4_reg
[cnt
]);
888 qla_uprintf(&uiter
, "\n\nRISC GP5 Registers:");
889 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp5_reg
) / 2; cnt
++) {
891 qla_uprintf(&uiter
, "\n");
893 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp5_reg
[cnt
]);
896 qla_uprintf(&uiter
, "\n\nRISC GP6 Registers:");
897 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp6_reg
) / 2; cnt
++) {
899 qla_uprintf(&uiter
, "\n");
901 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp6_reg
[cnt
]);
904 qla_uprintf(&uiter
, "\n\nRISC GP7 Registers:");
905 for (cnt
= 0; cnt
< sizeof (fw
->risc_gp7_reg
) / 2; cnt
++) {
907 qla_uprintf(&uiter
, "\n");
909 qla_uprintf(&uiter
, "%04x ", fw
->risc_gp7_reg
[cnt
]);
912 qla_uprintf(&uiter
, "\n\nFrame Buffer Hardware Registers:");
913 for (cnt
= 0; cnt
< sizeof (fw
->frame_buf_hdw_reg
) / 2; cnt
++) {
915 qla_uprintf(&uiter
, "\n");
917 qla_uprintf(&uiter
, "%04x ", fw
->frame_buf_hdw_reg
[cnt
]);
920 qla_uprintf(&uiter
, "\n\nFPM B0 Registers:");
921 for (cnt
= 0; cnt
< sizeof (fw
->fpm_b0_reg
) / 2; cnt
++) {
923 qla_uprintf(&uiter
, "\n");
925 qla_uprintf(&uiter
, "%04x ", fw
->fpm_b0_reg
[cnt
]);
928 qla_uprintf(&uiter
, "\n\nFPM B1 Registers:");
929 for (cnt
= 0; cnt
< sizeof (fw
->fpm_b1_reg
) / 2; cnt
++) {
931 qla_uprintf(&uiter
, "\n");
933 qla_uprintf(&uiter
, "%04x ", fw
->fpm_b1_reg
[cnt
]);
936 qla_uprintf(&uiter
, "\n\nRISC SRAM:");
937 for (cnt
= 0; cnt
< sizeof (fw
->risc_ram
) / 2; cnt
++) {
939 qla_uprintf(&uiter
, "\n%04x: ", cnt
+ 0x1000);
941 qla_uprintf(&uiter
, "%04x ", fw
->risc_ram
[cnt
]);
944 qla_uprintf(&uiter
, "\n\n[<==END] ISP Debug Dump.");
950 qla_uprintf(char **uiter
, char *fmt
, ...)
957 len
= vsprintf(buf
, fmt
, args
);
960 for (iter
= 0; iter
< len
; iter
++, *uiter
+= 1)
961 *uiter
[0] = buf
[iter
];
968 qla24xx_fw_dump(scsi_qla_host_t
*ha
, int hardware_locked
)
972 uint32_t risc_address
;
976 struct device_reg_24xx __iomem
*reg
= &ha
->iobase
->isp24
;
977 uint32_t __iomem
*dmp_reg
;
979 uint16_t __iomem
*mbx_reg
;
981 struct qla24xx_fw_dump
*fw
;
982 uint32_t ext_mem_cnt
;
984 risc_address
= ext_mem_cnt
= 0;
985 memset(mb
, 0, sizeof(mb
));
988 if (!hardware_locked
)
989 spin_lock_irqsave(&ha
->hardware_lock
, flags
);
991 if (!ha
->fw_dump24
) {
992 qla_printk(KERN_WARNING
, ha
,
993 "No buffer available for dump!!!\n");
994 goto qla24xx_fw_dump_failed
;
998 qla_printk(KERN_WARNING
, ha
,
999 "Firmware has been previously dumped (%p) -- ignoring "
1000 "request...\n", ha
->fw_dump24
);
1001 goto qla24xx_fw_dump_failed
;
1003 fw
= (struct qla24xx_fw_dump
*) ha
->fw_dump24
;
1006 fw
->hccr
= RD_REG_DWORD(®
->hccr
);
1009 if ((fw
->hccr
& HCCRX_RISC_PAUSE
) == 0) {
1010 WRT_REG_DWORD(®
->hccr
, HCCRX_SET_RISC_RESET
|
1011 HCCRX_CLR_HOST_INT
);
1012 RD_REG_DWORD(®
->hccr
); /* PCI Posting. */
1013 WRT_REG_DWORD(®
->hccr
, HCCRX_SET_RISC_PAUSE
);
1015 (RD_REG_DWORD(®
->hccr
) & HCCRX_RISC_PAUSE
) == 0 &&
1016 rval
== QLA_SUCCESS
; cnt
--) {
1020 rval
= QLA_FUNCTION_TIMEOUT
;
1024 /* Disable interrupts. */
1025 WRT_REG_DWORD(®
->ictrl
, 0);
1026 RD_REG_DWORD(®
->ictrl
);
1028 if (rval
== QLA_SUCCESS
) {
1029 /* Host interface registers. */
1030 dmp_reg
= (uint32_t __iomem
*)(reg
+ 0);
1031 for (cnt
= 0; cnt
< sizeof(fw
->host_reg
) / 4; cnt
++)
1032 fw
->host_reg
[cnt
] = RD_REG_DWORD(dmp_reg
++);
1034 /* Mailbox registers. */
1035 mbx_reg
= (uint16_t __iomem
*)((uint8_t __iomem
*)reg
+ 0x80);
1036 for (cnt
= 0; cnt
< sizeof(fw
->mailbox_reg
) / 2; cnt
++)
1037 fw
->mailbox_reg
[cnt
] = RD_REG_WORD(mbx_reg
++);
1039 /* Transfer sequence registers. */
1040 iter_reg
= fw
->xseq_gp_reg
;
1041 WRT_REG_DWORD(®
->iobase_addr
, 0xBF00);
1042 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1043 for (cnt
= 0; cnt
< 16; cnt
++)
1044 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1046 WRT_REG_DWORD(®
->iobase_addr
, 0xBF10);
1047 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1048 for (cnt
= 0; cnt
< 16; cnt
++)
1049 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1051 WRT_REG_DWORD(®
->iobase_addr
, 0xBF20);
1052 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1053 for (cnt
= 0; cnt
< 16; cnt
++)
1054 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1056 WRT_REG_DWORD(®
->iobase_addr
, 0xBF30);
1057 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1058 for (cnt
= 0; cnt
< 16; cnt
++)
1059 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1061 WRT_REG_DWORD(®
->iobase_addr
, 0xBF40);
1062 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1063 for (cnt
= 0; cnt
< 16; cnt
++)
1064 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1066 WRT_REG_DWORD(®
->iobase_addr
, 0xBF50);
1067 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1068 for (cnt
= 0; cnt
< 16; cnt
++)
1069 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1071 WRT_REG_DWORD(®
->iobase_addr
, 0xBF60);
1072 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1073 for (cnt
= 0; cnt
< 16; cnt
++)
1074 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1076 WRT_REG_DWORD(®
->iobase_addr
, 0xBF70);
1077 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1078 for (cnt
= 0; cnt
< 16; cnt
++)
1079 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1081 WRT_REG_DWORD(®
->iobase_addr
, 0xBFE0);
1082 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1083 for (cnt
= 0; cnt
< sizeof(fw
->xseq_0_reg
) / 4; cnt
++)
1084 fw
->xseq_0_reg
[cnt
] = RD_REG_DWORD(dmp_reg
++);
1086 WRT_REG_DWORD(®
->iobase_addr
, 0xBFF0);
1087 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1088 for (cnt
= 0; cnt
< sizeof(fw
->xseq_1_reg
) / 4; cnt
++)
1089 fw
->xseq_1_reg
[cnt
] = RD_REG_DWORD(dmp_reg
++);
1091 /* Receive sequence registers. */
1092 iter_reg
= fw
->rseq_gp_reg
;
1093 WRT_REG_DWORD(®
->iobase_addr
, 0xFF00);
1094 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1095 for (cnt
= 0; cnt
< 16; cnt
++)
1096 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1098 WRT_REG_DWORD(®
->iobase_addr
, 0xFF10);
1099 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1100 for (cnt
= 0; cnt
< 16; cnt
++)
1101 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1103 WRT_REG_DWORD(®
->iobase_addr
, 0xFF20);
1104 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1105 for (cnt
= 0; cnt
< 16; cnt
++)
1106 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1108 WRT_REG_DWORD(®
->iobase_addr
, 0xFF30);
1109 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1110 for (cnt
= 0; cnt
< 16; cnt
++)
1111 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1113 WRT_REG_DWORD(®
->iobase_addr
, 0xFF40);
1114 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1115 for (cnt
= 0; cnt
< 16; cnt
++)
1116 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1118 WRT_REG_DWORD(®
->iobase_addr
, 0xFF50);
1119 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1120 for (cnt
= 0; cnt
< 16; cnt
++)
1121 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1123 WRT_REG_DWORD(®
->iobase_addr
, 0xFF60);
1124 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1125 for (cnt
= 0; cnt
< 16; cnt
++)
1126 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1128 WRT_REG_DWORD(®
->iobase_addr
, 0xFF70);
1129 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1130 for (cnt
= 0; cnt
< 16; cnt
++)
1131 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1133 WRT_REG_DWORD(®
->iobase_addr
, 0xFFD0);
1134 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1135 for (cnt
= 0; cnt
< sizeof(fw
->rseq_0_reg
) / 4; cnt
++)
1136 fw
->rseq_0_reg
[cnt
] = RD_REG_DWORD(dmp_reg
++);
1138 WRT_REG_DWORD(®
->iobase_addr
, 0xFFE0);
1139 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1140 for (cnt
= 0; cnt
< sizeof(fw
->rseq_1_reg
) / 4; cnt
++)
1141 fw
->rseq_1_reg
[cnt
] = RD_REG_DWORD(dmp_reg
++);
1143 WRT_REG_DWORD(®
->iobase_addr
, 0xFFF0);
1144 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1145 for (cnt
= 0; cnt
< sizeof(fw
->rseq_2_reg
) / 4; cnt
++)
1146 fw
->rseq_2_reg
[cnt
] = RD_REG_DWORD(dmp_reg
++);
1148 /* Command DMA registers. */
1149 WRT_REG_DWORD(®
->iobase_addr
, 0x7100);
1150 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1151 for (cnt
= 0; cnt
< sizeof(fw
->cmd_dma_reg
) / 4; cnt
++)
1152 fw
->cmd_dma_reg
[cnt
] = RD_REG_DWORD(dmp_reg
++);
1155 iter_reg
= fw
->req0_dma_reg
;
1156 WRT_REG_DWORD(®
->iobase_addr
, 0x7200);
1157 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1158 for (cnt
= 0; cnt
< 8; cnt
++)
1159 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1161 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xE4);
1162 for (cnt
= 0; cnt
< 7; cnt
++)
1163 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1165 iter_reg
= fw
->resp0_dma_reg
;
1166 WRT_REG_DWORD(®
->iobase_addr
, 0x7300);
1167 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1168 for (cnt
= 0; cnt
< 8; cnt
++)
1169 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1171 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xE4);
1172 for (cnt
= 0; cnt
< 7; cnt
++)
1173 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1175 iter_reg
= fw
->req1_dma_reg
;
1176 WRT_REG_DWORD(®
->iobase_addr
, 0x7400);
1177 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1178 for (cnt
= 0; cnt
< 8; cnt
++)
1179 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1181 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xE4);
1182 for (cnt
= 0; cnt
< 7; cnt
++)
1183 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1185 /* Transmit DMA registers. */
1186 iter_reg
= fw
->xmt0_dma_reg
;
1187 WRT_REG_DWORD(®
->iobase_addr
, 0x7600);
1188 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1189 for (cnt
= 0; cnt
< 16; cnt
++)
1190 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1192 WRT_REG_DWORD(®
->iobase_addr
, 0x7610);
1193 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1194 for (cnt
= 0; cnt
< 16; cnt
++)
1195 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1197 iter_reg
= fw
->xmt1_dma_reg
;
1198 WRT_REG_DWORD(®
->iobase_addr
, 0x7620);
1199 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1200 for (cnt
= 0; cnt
< 16; cnt
++)
1201 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1203 WRT_REG_DWORD(®
->iobase_addr
, 0x7630);
1204 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1205 for (cnt
= 0; cnt
< 16; cnt
++)
1206 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1208 iter_reg
= fw
->xmt2_dma_reg
;
1209 WRT_REG_DWORD(®
->iobase_addr
, 0x7640);
1210 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1211 for (cnt
= 0; cnt
< 16; cnt
++)
1212 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1214 WRT_REG_DWORD(®
->iobase_addr
, 0x7650);
1215 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1216 for (cnt
= 0; cnt
< 16; cnt
++)
1217 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1219 iter_reg
= fw
->xmt3_dma_reg
;
1220 WRT_REG_DWORD(®
->iobase_addr
, 0x7660);
1221 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1222 for (cnt
= 0; cnt
< 16; cnt
++)
1223 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1225 WRT_REG_DWORD(®
->iobase_addr
, 0x7670);
1226 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1227 for (cnt
= 0; cnt
< 16; cnt
++)
1228 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1230 iter_reg
= fw
->xmt4_dma_reg
;
1231 WRT_REG_DWORD(®
->iobase_addr
, 0x7680);
1232 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1233 for (cnt
= 0; cnt
< 16; cnt
++)
1234 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1236 WRT_REG_DWORD(®
->iobase_addr
, 0x7690);
1237 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1238 for (cnt
= 0; cnt
< 16; cnt
++)
1239 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1241 WRT_REG_DWORD(®
->iobase_addr
, 0x76A0);
1242 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1243 for (cnt
= 0; cnt
< sizeof(fw
->xmt_data_dma_reg
) / 4; cnt
++)
1244 fw
->xmt_data_dma_reg
[cnt
] = RD_REG_DWORD(dmp_reg
++);
1246 /* Receive DMA registers. */
1247 iter_reg
= fw
->rcvt0_data_dma_reg
;
1248 WRT_REG_DWORD(®
->iobase_addr
, 0x7700);
1249 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1250 for (cnt
= 0; cnt
< 16; cnt
++)
1251 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1253 WRT_REG_DWORD(®
->iobase_addr
, 0x7710);
1254 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1255 for (cnt
= 0; cnt
< 16; cnt
++)
1256 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1258 iter_reg
= fw
->rcvt1_data_dma_reg
;
1259 WRT_REG_DWORD(®
->iobase_addr
, 0x7720);
1260 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1261 for (cnt
= 0; cnt
< 16; cnt
++)
1262 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1264 WRT_REG_DWORD(®
->iobase_addr
, 0x7730);
1265 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1266 for (cnt
= 0; cnt
< 16; cnt
++)
1267 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1269 /* RISC registers. */
1270 iter_reg
= fw
->risc_gp_reg
;
1271 WRT_REG_DWORD(®
->iobase_addr
, 0x0F00);
1272 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1273 for (cnt
= 0; cnt
< 16; cnt
++)
1274 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1276 WRT_REG_DWORD(®
->iobase_addr
, 0x0F10);
1277 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1278 for (cnt
= 0; cnt
< 16; cnt
++)
1279 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1281 WRT_REG_DWORD(®
->iobase_addr
, 0x0F20);
1282 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1283 for (cnt
= 0; cnt
< 16; cnt
++)
1284 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1286 WRT_REG_DWORD(®
->iobase_addr
, 0x0F30);
1287 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1288 for (cnt
= 0; cnt
< 16; cnt
++)
1289 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1291 WRT_REG_DWORD(®
->iobase_addr
, 0x0F40);
1292 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1293 for (cnt
= 0; cnt
< 16; cnt
++)
1294 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1296 WRT_REG_DWORD(®
->iobase_addr
, 0x0F50);
1297 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1298 for (cnt
= 0; cnt
< 16; cnt
++)
1299 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1301 WRT_REG_DWORD(®
->iobase_addr
, 0x0F60);
1302 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1303 for (cnt
= 0; cnt
< 16; cnt
++)
1304 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1306 WRT_REG_DWORD(®
->iobase_addr
, 0x0F70);
1307 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1308 for (cnt
= 0; cnt
< 16; cnt
++)
1309 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1311 WRT_REG_DWORD(®
->iobase_addr
, 0x0F70);
1312 RD_REG_DWORD(®
->iobase_addr
);
1313 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xF0);
1314 WRT_REG_DWORD(dmp_reg
, 0xB0000000);
1315 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xFC);
1316 fw
->shadow_reg
[0] = RD_REG_DWORD(dmp_reg
);
1318 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xF0);
1319 WRT_REG_DWORD(dmp_reg
, 0xB0100000);
1320 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xFC);
1321 fw
->shadow_reg
[1] = RD_REG_DWORD(dmp_reg
);
1323 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xF0);
1324 WRT_REG_DWORD(dmp_reg
, 0xB0200000);
1325 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xFC);
1326 fw
->shadow_reg
[2] = RD_REG_DWORD(dmp_reg
);
1328 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xF0);
1329 WRT_REG_DWORD(dmp_reg
, 0xB0300000);
1330 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xFC);
1331 fw
->shadow_reg
[3] = RD_REG_DWORD(dmp_reg
);
1333 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xF0);
1334 WRT_REG_DWORD(dmp_reg
, 0xB0400000);
1335 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xFC);
1336 fw
->shadow_reg
[4] = RD_REG_DWORD(dmp_reg
);
1338 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xF0);
1339 WRT_REG_DWORD(dmp_reg
, 0xB0500000);
1340 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xFC);
1341 fw
->shadow_reg
[5] = RD_REG_DWORD(dmp_reg
);
1343 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xF0);
1344 WRT_REG_DWORD(dmp_reg
, 0xB0600000);
1345 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xFC);
1346 fw
->shadow_reg
[6] = RD_REG_DWORD(dmp_reg
);
1348 /* Local memory controller registers. */
1349 iter_reg
= fw
->lmc_reg
;
1350 WRT_REG_DWORD(®
->iobase_addr
, 0x3000);
1351 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1352 for (cnt
= 0; cnt
< 16; cnt
++)
1353 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1355 WRT_REG_DWORD(®
->iobase_addr
, 0x3010);
1356 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1357 for (cnt
= 0; cnt
< 16; cnt
++)
1358 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1360 WRT_REG_DWORD(®
->iobase_addr
, 0x3020);
1361 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1362 for (cnt
= 0; cnt
< 16; cnt
++)
1363 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1365 WRT_REG_DWORD(®
->iobase_addr
, 0x3030);
1366 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1367 for (cnt
= 0; cnt
< 16; cnt
++)
1368 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1370 WRT_REG_DWORD(®
->iobase_addr
, 0x3040);
1371 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1372 for (cnt
= 0; cnt
< 16; cnt
++)
1373 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1375 WRT_REG_DWORD(®
->iobase_addr
, 0x3050);
1376 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1377 for (cnt
= 0; cnt
< 16; cnt
++)
1378 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1380 WRT_REG_DWORD(®
->iobase_addr
, 0x3060);
1381 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1382 for (cnt
= 0; cnt
< 16; cnt
++)
1383 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1385 /* Fibre Protocol Module registers. */
1386 iter_reg
= fw
->fpm_hdw_reg
;
1387 WRT_REG_DWORD(®
->iobase_addr
, 0x4000);
1388 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1389 for (cnt
= 0; cnt
< 16; cnt
++)
1390 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1392 WRT_REG_DWORD(®
->iobase_addr
, 0x4010);
1393 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1394 for (cnt
= 0; cnt
< 16; cnt
++)
1395 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1397 WRT_REG_DWORD(®
->iobase_addr
, 0x4020);
1398 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1399 for (cnt
= 0; cnt
< 16; cnt
++)
1400 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1402 WRT_REG_DWORD(®
->iobase_addr
, 0x4030);
1403 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1404 for (cnt
= 0; cnt
< 16; cnt
++)
1405 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1407 WRT_REG_DWORD(®
->iobase_addr
, 0x4040);
1408 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1409 for (cnt
= 0; cnt
< 16; cnt
++)
1410 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1412 WRT_REG_DWORD(®
->iobase_addr
, 0x4050);
1413 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1414 for (cnt
= 0; cnt
< 16; cnt
++)
1415 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1417 WRT_REG_DWORD(®
->iobase_addr
, 0x4060);
1418 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1419 for (cnt
= 0; cnt
< 16; cnt
++)
1420 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1422 WRT_REG_DWORD(®
->iobase_addr
, 0x4070);
1423 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1424 for (cnt
= 0; cnt
< 16; cnt
++)
1425 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1427 WRT_REG_DWORD(®
->iobase_addr
, 0x4080);
1428 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1429 for (cnt
= 0; cnt
< 16; cnt
++)
1430 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1432 WRT_REG_DWORD(®
->iobase_addr
, 0x4090);
1433 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1434 for (cnt
= 0; cnt
< 16; cnt
++)
1435 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1437 WRT_REG_DWORD(®
->iobase_addr
, 0x40A0);
1438 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1439 for (cnt
= 0; cnt
< 16; cnt
++)
1440 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1442 WRT_REG_DWORD(®
->iobase_addr
, 0x40B0);
1443 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1444 for (cnt
= 0; cnt
< 16; cnt
++)
1445 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1447 /* Frame Buffer registers. */
1448 iter_reg
= fw
->fb_hdw_reg
;
1449 WRT_REG_DWORD(®
->iobase_addr
, 0x6000);
1450 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1451 for (cnt
= 0; cnt
< 16; cnt
++)
1452 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1454 WRT_REG_DWORD(®
->iobase_addr
, 0x6010);
1455 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1456 for (cnt
= 0; cnt
< 16; cnt
++)
1457 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1459 WRT_REG_DWORD(®
->iobase_addr
, 0x6020);
1460 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1461 for (cnt
= 0; cnt
< 16; cnt
++)
1462 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1464 WRT_REG_DWORD(®
->iobase_addr
, 0x6030);
1465 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1466 for (cnt
= 0; cnt
< 16; cnt
++)
1467 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1469 WRT_REG_DWORD(®
->iobase_addr
, 0x6040);
1470 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1471 for (cnt
= 0; cnt
< 16; cnt
++)
1472 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1474 WRT_REG_DWORD(®
->iobase_addr
, 0x6100);
1475 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1476 for (cnt
= 0; cnt
< 16; cnt
++)
1477 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1479 WRT_REG_DWORD(®
->iobase_addr
, 0x6130);
1480 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1481 for (cnt
= 0; cnt
< 16; cnt
++)
1482 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1484 WRT_REG_DWORD(®
->iobase_addr
, 0x6150);
1485 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1486 for (cnt
= 0; cnt
< 16; cnt
++)
1487 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1489 WRT_REG_DWORD(®
->iobase_addr
, 0x6170);
1490 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1491 for (cnt
= 0; cnt
< 16; cnt
++)
1492 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1494 WRT_REG_DWORD(®
->iobase_addr
, 0x6190);
1495 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1496 for (cnt
= 0; cnt
< 16; cnt
++)
1497 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1499 WRT_REG_DWORD(®
->iobase_addr
, 0x61B0);
1500 dmp_reg
= (uint32_t __iomem
*)((uint8_t __iomem
*)reg
+ 0xC0);
1501 for (cnt
= 0; cnt
< 16; cnt
++)
1502 *iter_reg
++ = RD_REG_DWORD(dmp_reg
++);
1505 WRT_REG_DWORD(®
->ctrl_status
,
1506 CSRX_DMA_SHUTDOWN
|MWB_4096_BYTES
);
1507 for (cnt
= 0; cnt
< 30000; cnt
++) {
1508 if ((RD_REG_DWORD(®
->ctrl_status
) &
1509 CSRX_DMA_ACTIVE
) == 0)
1515 WRT_REG_DWORD(®
->ctrl_status
,
1516 CSRX_ISP_SOFT_RESET
|CSRX_DMA_SHUTDOWN
|MWB_4096_BYTES
);
1517 RD_REG_DWORD(®
->ctrl_status
);
1519 /* Wait for firmware to complete NVRAM accesses. */
1521 mb
[0] = (uint32_t) RD_REG_WORD(®
->mailbox0
);
1522 for (cnt
= 10000 ; cnt
&& mb
[0]; cnt
--) {
1524 mb
[0] = (uint32_t) RD_REG_WORD(®
->mailbox0
);
1529 for (cnt
= 0; cnt
< 30000; cnt
++) {
1530 if ((RD_REG_DWORD(®
->ctrl_status
) &
1531 CSRX_ISP_SOFT_RESET
) == 0)
1536 WRT_REG_DWORD(®
->hccr
, HCCRX_CLR_RISC_RESET
);
1537 RD_REG_DWORD(®
->hccr
); /* PCI Posting. */
1540 for (cnt
= 30000; RD_REG_WORD(®
->mailbox0
) != 0 &&
1541 rval
== QLA_SUCCESS
; cnt
--) {
1545 rval
= QLA_FUNCTION_TIMEOUT
;
1549 if (rval
== QLA_SUCCESS
) {
1551 risc_address
= 0x20000;
1552 WRT_REG_WORD(®
->mailbox0
, MBC_READ_RAM_EXTENDED
);
1553 clear_bit(MBX_INTERRUPT
, &ha
->mbx_cmd_flags
);
1555 for (cnt
= 0; cnt
< sizeof(fw
->code_ram
) / 4 && rval
== QLA_SUCCESS
;
1556 cnt
++, risc_address
++) {
1557 WRT_REG_WORD(®
->mailbox1
, LSW(risc_address
));
1558 WRT_REG_WORD(®
->mailbox8
, MSW(risc_address
));
1559 RD_REG_WORD(®
->mailbox8
);
1560 WRT_REG_DWORD(®
->hccr
, HCCRX_SET_HOST_INT
);
1562 for (timer
= 6000000; timer
; timer
--) {
1563 /* Check for pending interrupts. */
1564 stat
= RD_REG_DWORD(®
->host_status
);
1565 if (stat
& HSRX_RISC_INT
) {
1568 if (stat
== 0x1 || stat
== 0x2 ||
1569 stat
== 0x10 || stat
== 0x11) {
1570 set_bit(MBX_INTERRUPT
,
1571 &ha
->mbx_cmd_flags
);
1573 mb
[0] = RD_REG_WORD(®
->mailbox0
);
1574 mb
[2] = RD_REG_WORD(®
->mailbox2
);
1575 mb
[3] = RD_REG_WORD(®
->mailbox3
);
1577 WRT_REG_DWORD(®
->hccr
,
1578 HCCRX_CLR_RISC_INT
);
1579 RD_REG_DWORD(®
->hccr
);
1583 /* Clear this intr; it wasn't a mailbox intr */
1584 WRT_REG_DWORD(®
->hccr
, HCCRX_CLR_RISC_INT
);
1585 RD_REG_DWORD(®
->hccr
);
1590 if (test_and_clear_bit(MBX_INTERRUPT
, &ha
->mbx_cmd_flags
)) {
1591 rval
= mb
[0] & MBS_MASK
;
1592 fw
->code_ram
[cnt
] = (mb
[3] << 16) | mb
[2];
1594 rval
= QLA_FUNCTION_FAILED
;
1598 if (rval
== QLA_SUCCESS
) {
1599 /* External Memory. */
1600 risc_address
= 0x100000;
1601 ext_mem_cnt
= ha
->fw_memory_size
- 0x100000 + 1;
1602 WRT_REG_WORD(®
->mailbox0
, MBC_READ_RAM_EXTENDED
);
1603 clear_bit(MBX_INTERRUPT
, &ha
->mbx_cmd_flags
);
1605 for (cnt
= 0; cnt
< ext_mem_cnt
&& rval
== QLA_SUCCESS
;
1606 cnt
++, risc_address
++) {
1607 WRT_REG_WORD(®
->mailbox1
, LSW(risc_address
));
1608 WRT_REG_WORD(®
->mailbox8
, MSW(risc_address
));
1609 RD_REG_WORD(®
->mailbox8
);
1610 WRT_REG_DWORD(®
->hccr
, HCCRX_SET_HOST_INT
);
1612 for (timer
= 6000000; timer
; timer
--) {
1613 /* Check for pending interrupts. */
1614 stat
= RD_REG_DWORD(®
->host_status
);
1615 if (stat
& HSRX_RISC_INT
) {
1618 if (stat
== 0x1 || stat
== 0x2 ||
1619 stat
== 0x10 || stat
== 0x11) {
1620 set_bit(MBX_INTERRUPT
,
1621 &ha
->mbx_cmd_flags
);
1623 mb
[0] = RD_REG_WORD(®
->mailbox0
);
1624 mb
[2] = RD_REG_WORD(®
->mailbox2
);
1625 mb
[3] = RD_REG_WORD(®
->mailbox3
);
1627 WRT_REG_DWORD(®
->hccr
,
1628 HCCRX_CLR_RISC_INT
);
1629 RD_REG_DWORD(®
->hccr
);
1633 /* Clear this intr; it wasn't a mailbox intr */
1634 WRT_REG_DWORD(®
->hccr
, HCCRX_CLR_RISC_INT
);
1635 RD_REG_DWORD(®
->hccr
);
1640 if (test_and_clear_bit(MBX_INTERRUPT
, &ha
->mbx_cmd_flags
)) {
1641 rval
= mb
[0] & MBS_MASK
;
1642 fw
->ext_mem
[cnt
] = (mb
[3] << 16) | mb
[2];
1644 rval
= QLA_FUNCTION_FAILED
;
1648 if (rval
!= QLA_SUCCESS
) {
1649 qla_printk(KERN_WARNING
, ha
,
1650 "Failed to dump firmware (%x)!!!\n", rval
);
1654 qla_printk(KERN_INFO
, ha
,
1655 "Firmware dump saved to temp buffer (%ld/%p).\n",
1656 ha
->host_no
, ha
->fw_dump24
);
1660 qla24xx_fw_dump_failed
:
1661 if (!hardware_locked
)
1662 spin_unlock_irqrestore(&ha
->hardware_lock
, flags
);
1666 qla24xx_ascii_fw_dump(scsi_qla_host_t
*ha
)
1670 struct qla24xx_fw_dump
*fw
;
1671 uint32_t ext_mem_cnt
;
1673 uiter
= ha
->fw_dump_buffer
;
1676 qla_uprintf(&uiter
, "ISP FW Version %d.%02d.%02d Attributes %04x\n",
1677 ha
->fw_major_version
, ha
->fw_minor_version
,
1678 ha
->fw_subminor_version
, ha
->fw_attributes
);
1680 qla_uprintf(&uiter
, "\nHCCR Register\n%04x\n", fw
->hccr
);
1682 qla_uprintf(&uiter
, "\nHost Interface Registers");
1683 for (cnt
= 0; cnt
< sizeof(fw
->host_reg
) / 4; cnt
++) {
1685 qla_uprintf(&uiter
, "\n");
1687 qla_uprintf(&uiter
, "%08x ", fw
->host_reg
[cnt
]);
1690 qla_uprintf(&uiter
, "\n\nMailbox Registers");
1691 for (cnt
= 0; cnt
< sizeof(fw
->mailbox_reg
) / 2; cnt
++) {
1693 qla_uprintf(&uiter
, "\n");
1695 qla_uprintf(&uiter
, "%08x ", fw
->mailbox_reg
[cnt
]);
1698 qla_uprintf(&uiter
, "\n\nXSEQ GP Registers");
1699 for (cnt
= 0; cnt
< sizeof(fw
->xseq_gp_reg
) / 4; cnt
++) {
1701 qla_uprintf(&uiter
, "\n");
1703 qla_uprintf(&uiter
, "%08x ", fw
->xseq_gp_reg
[cnt
]);
1706 qla_uprintf(&uiter
, "\n\nXSEQ-0 Registers");
1707 for (cnt
= 0; cnt
< sizeof(fw
->xseq_0_reg
) / 4; cnt
++) {
1709 qla_uprintf(&uiter
, "\n");
1711 qla_uprintf(&uiter
, "%08x ", fw
->xseq_0_reg
[cnt
]);
1714 qla_uprintf(&uiter
, "\n\nXSEQ-1 Registers");
1715 for (cnt
= 0; cnt
< sizeof(fw
->xseq_1_reg
) / 4; cnt
++) {
1717 qla_uprintf(&uiter
, "\n");
1719 qla_uprintf(&uiter
, "%08x ", fw
->xseq_1_reg
[cnt
]);
1722 qla_uprintf(&uiter
, "\n\nRSEQ GP Registers");
1723 for (cnt
= 0; cnt
< sizeof(fw
->rseq_gp_reg
) / 4; cnt
++) {
1725 qla_uprintf(&uiter
, "\n");
1727 qla_uprintf(&uiter
, "%08x ", fw
->rseq_gp_reg
[cnt
]);
1730 qla_uprintf(&uiter
, "\n\nRSEQ-0 Registers");
1731 for (cnt
= 0; cnt
< sizeof(fw
->rseq_0_reg
) / 4; cnt
++) {
1733 qla_uprintf(&uiter
, "\n");
1735 qla_uprintf(&uiter
, "%08x ", fw
->rseq_0_reg
[cnt
]);
1738 qla_uprintf(&uiter
, "\n\nRSEQ-1 Registers");
1739 for (cnt
= 0; cnt
< sizeof(fw
->rseq_1_reg
) / 4; cnt
++) {
1741 qla_uprintf(&uiter
, "\n");
1743 qla_uprintf(&uiter
, "%08x ", fw
->rseq_1_reg
[cnt
]);
1746 qla_uprintf(&uiter
, "\n\nRSEQ-2 Registers");
1747 for (cnt
= 0; cnt
< sizeof(fw
->rseq_2_reg
) / 4; cnt
++) {
1749 qla_uprintf(&uiter
, "\n");
1751 qla_uprintf(&uiter
, "%08x ", fw
->rseq_2_reg
[cnt
]);
1754 qla_uprintf(&uiter
, "\n\nCommand DMA Registers");
1755 for (cnt
= 0; cnt
< sizeof(fw
->cmd_dma_reg
) / 4; cnt
++) {
1757 qla_uprintf(&uiter
, "\n");
1759 qla_uprintf(&uiter
, "%08x ", fw
->cmd_dma_reg
[cnt
]);
1762 qla_uprintf(&uiter
, "\n\nRequest0 Queue DMA Channel Registers");
1763 for (cnt
= 0; cnt
< sizeof(fw
->req0_dma_reg
) / 4; cnt
++) {
1765 qla_uprintf(&uiter
, "\n");
1767 qla_uprintf(&uiter
, "%08x ", fw
->req0_dma_reg
[cnt
]);
1770 qla_uprintf(&uiter
, "\n\nResponse0 Queue DMA Channel Registers");
1771 for (cnt
= 0; cnt
< sizeof(fw
->resp0_dma_reg
) / 4; cnt
++) {
1773 qla_uprintf(&uiter
, "\n");
1775 qla_uprintf(&uiter
, "%08x ", fw
->resp0_dma_reg
[cnt
]);
1778 qla_uprintf(&uiter
, "\n\nRequest1 Queue DMA Channel Registers");
1779 for (cnt
= 0; cnt
< sizeof(fw
->req1_dma_reg
) / 4; cnt
++) {
1781 qla_uprintf(&uiter
, "\n");
1783 qla_uprintf(&uiter
, "%08x ", fw
->req1_dma_reg
[cnt
]);
1786 qla_uprintf(&uiter
, "\n\nXMT0 Data DMA Registers");
1787 for (cnt
= 0; cnt
< sizeof(fw
->xmt0_dma_reg
) / 4; cnt
++) {
1789 qla_uprintf(&uiter
, "\n");
1791 qla_uprintf(&uiter
, "%08x ", fw
->xmt0_dma_reg
[cnt
]);
1794 qla_uprintf(&uiter
, "\n\nXMT1 Data DMA Registers");
1795 for (cnt
= 0; cnt
< sizeof(fw
->xmt1_dma_reg
) / 4; cnt
++) {
1797 qla_uprintf(&uiter
, "\n");
1799 qla_uprintf(&uiter
, "%08x ", fw
->xmt1_dma_reg
[cnt
]);
1802 qla_uprintf(&uiter
, "\n\nXMT2 Data DMA Registers");
1803 for (cnt
= 0; cnt
< sizeof(fw
->xmt2_dma_reg
) / 4; cnt
++) {
1805 qla_uprintf(&uiter
, "\n");
1807 qla_uprintf(&uiter
, "%08x ", fw
->xmt2_dma_reg
[cnt
]);
1810 qla_uprintf(&uiter
, "\n\nXMT3 Data DMA Registers");
1811 for (cnt
= 0; cnt
< sizeof(fw
->xmt3_dma_reg
) / 4; cnt
++) {
1813 qla_uprintf(&uiter
, "\n");
1815 qla_uprintf(&uiter
, "%08x ", fw
->xmt3_dma_reg
[cnt
]);
1818 qla_uprintf(&uiter
, "\n\nXMT4 Data DMA Registers");
1819 for (cnt
= 0; cnt
< sizeof(fw
->xmt4_dma_reg
) / 4; cnt
++) {
1821 qla_uprintf(&uiter
, "\n");
1823 qla_uprintf(&uiter
, "%08x ", fw
->xmt4_dma_reg
[cnt
]);
1826 qla_uprintf(&uiter
, "\n\nXMT Data DMA Common Registers");
1827 for (cnt
= 0; cnt
< sizeof(fw
->xmt_data_dma_reg
) / 4; cnt
++) {
1829 qla_uprintf(&uiter
, "\n");
1831 qla_uprintf(&uiter
, "%08x ", fw
->xmt_data_dma_reg
[cnt
]);
1834 qla_uprintf(&uiter
, "\n\nRCV Thread 0 Data DMA Registers");
1835 for (cnt
= 0; cnt
< sizeof(fw
->rcvt0_data_dma_reg
) / 4; cnt
++) {
1837 qla_uprintf(&uiter
, "\n");
1839 qla_uprintf(&uiter
, "%08x ", fw
->rcvt0_data_dma_reg
[cnt
]);
1842 qla_uprintf(&uiter
, "\n\nRCV Thread 1 Data DMA Registers");
1843 for (cnt
= 0; cnt
< sizeof(fw
->rcvt1_data_dma_reg
) / 4; cnt
++) {
1845 qla_uprintf(&uiter
, "\n");
1847 qla_uprintf(&uiter
, "%08x ", fw
->rcvt1_data_dma_reg
[cnt
]);
1850 qla_uprintf(&uiter
, "\n\nRISC GP Registers");
1851 for (cnt
= 0; cnt
< sizeof(fw
->risc_gp_reg
) / 4; cnt
++) {
1853 qla_uprintf(&uiter
, "\n");
1855 qla_uprintf(&uiter
, "%08x ", fw
->risc_gp_reg
[cnt
]);
1858 qla_uprintf(&uiter
, "\n\nShadow Registers");
1859 for (cnt
= 0; cnt
< sizeof(fw
->shadow_reg
) / 4; cnt
++) {
1861 qla_uprintf(&uiter
, "\n");
1863 qla_uprintf(&uiter
, "%08x ", fw
->shadow_reg
[cnt
]);
1866 qla_uprintf(&uiter
, "\n\nLMC Registers");
1867 for (cnt
= 0; cnt
< sizeof(fw
->lmc_reg
) / 4; cnt
++) {
1869 qla_uprintf(&uiter
, "\n");
1871 qla_uprintf(&uiter
, "%08x ", fw
->lmc_reg
[cnt
]);
1874 qla_uprintf(&uiter
, "\n\nFPM Hardware Registers");
1875 for (cnt
= 0; cnt
< sizeof(fw
->fpm_hdw_reg
) / 4; cnt
++) {
1877 qla_uprintf(&uiter
, "\n");
1879 qla_uprintf(&uiter
, "%08x ", fw
->fpm_hdw_reg
[cnt
]);
1882 qla_uprintf(&uiter
, "\n\nFB Hardware Registers");
1883 for (cnt
= 0; cnt
< sizeof(fw
->fb_hdw_reg
) / 4; cnt
++) {
1885 qla_uprintf(&uiter
, "\n");
1887 qla_uprintf(&uiter
, "%08x ", fw
->fb_hdw_reg
[cnt
]);
1890 qla_uprintf(&uiter
, "\n\nCode RAM");
1891 for (cnt
= 0; cnt
< sizeof (fw
->code_ram
) / 4; cnt
++) {
1893 qla_uprintf(&uiter
, "\n%08x: ", cnt
+ 0x20000);
1895 qla_uprintf(&uiter
, "%08x ", fw
->code_ram
[cnt
]);
1898 qla_uprintf(&uiter
, "\n\nExternal Memory");
1899 ext_mem_cnt
= ha
->fw_memory_size
- 0x100000 + 1;
1900 for (cnt
= 0; cnt
< ext_mem_cnt
; cnt
++) {
1902 qla_uprintf(&uiter
, "\n%08x: ", cnt
+ 0x100000);
1904 qla_uprintf(&uiter
, "%08x ", fw
->ext_mem
[cnt
]);
1907 qla_uprintf(&uiter
, "\n[<==END] ISP Debug Dump");
1911 /****************************************************************************/
1912 /* Driver Debug Functions. */
1913 /****************************************************************************/
1916 qla2x00_dump_regs(scsi_qla_host_t
*ha
)
1918 struct device_reg_2xxx __iomem
*reg
= &ha
->iobase
->isp
;
1920 printk("Mailbox registers:\n");
1921 printk("scsi(%ld): mbox 0 0x%04x \n",
1922 ha
->host_no
, RD_MAILBOX_REG(ha
, reg
, 0));
1923 printk("scsi(%ld): mbox 1 0x%04x \n",
1924 ha
->host_no
, RD_MAILBOX_REG(ha
, reg
, 1));
1925 printk("scsi(%ld): mbox 2 0x%04x \n",
1926 ha
->host_no
, RD_MAILBOX_REG(ha
, reg
, 2));
1927 printk("scsi(%ld): mbox 3 0x%04x \n",
1928 ha
->host_no
, RD_MAILBOX_REG(ha
, reg
, 3));
1929 printk("scsi(%ld): mbox 4 0x%04x \n",
1930 ha
->host_no
, RD_MAILBOX_REG(ha
, reg
, 4));
1931 printk("scsi(%ld): mbox 5 0x%04x \n",
1932 ha
->host_no
, RD_MAILBOX_REG(ha
, reg
, 5));
1937 qla2x00_dump_buffer(uint8_t * b
, uint32_t size
)
1942 printk(" 0 1 2 3 4 5 6 7 8 9 "
1943 "Ah Bh Ch Dh Eh Fh\n");
1944 printk("----------------------------------------"
1945 "----------------------\n");
1947 for (cnt
= 0; cnt
< size
;) {
1949 printk("%02x",(uint32_t) c
);
1960 /**************************************************************************
1961 * qla2x00_print_scsi_cmd
1962 * Dumps out info about the scsi cmd and srb.
1964 * cmd : struct scsi_cmnd
1965 **************************************************************************/
1967 qla2x00_print_scsi_cmd(struct scsi_cmnd
* cmd
)
1970 struct scsi_qla_host
*ha
;
1973 ha
= (struct scsi_qla_host
*)cmd
->device
->host
->hostdata
;
1975 sp
= (srb_t
*) cmd
->SCp
.ptr
;
1976 printk("SCSI Command @=0x%p, Handle=0x%p\n", cmd
, cmd
->host_scribble
);
1977 printk(" chan=0x%02x, target=0x%02x, lun=0x%02x, cmd_len=0x%02x\n",
1978 cmd
->device
->channel
, cmd
->device
->id
, cmd
->device
->lun
,
1981 for (i
= 0; i
< cmd
->cmd_len
; i
++) {
1982 printk("0x%02x ", cmd
->cmnd
[i
]);
1984 printk("\n seg_cnt=%d, allowed=%d, retries=%d\n",
1985 cmd
->use_sg
, cmd
->allowed
, cmd
->retries
);
1986 printk(" request buffer=0x%p, request buffer len=0x%x\n",
1987 cmd
->request_buffer
, cmd
->request_bufflen
);
1988 printk(" tag=%d, transfersize=0x%x\n",
1989 cmd
->tag
, cmd
->transfersize
);
1990 printk(" serial_number=%lx, SP=%p\n", cmd
->serial_number
, sp
);
1991 printk(" data direction=%d\n", cmd
->sc_data_direction
);
1996 printk(" sp flags=0x%x\n", sp
->flags
);
1997 printk(" state=%d\n", sp
->state
);
2001 qla2x00_dump_pkt(void *pkt
)
2004 uint8_t *data
= (uint8_t *) pkt
;
2006 for (i
= 0; i
< 64; i
++) {
2008 printk("\n%02x: ", i
);
2010 printk("%02x ", data
[i
]);
2015 #if defined(QL_DEBUG_ROUTINES)
2017 * qla2x00_formatted_dump_buffer
2018 * Prints string plus buffer.
2021 * string = Null terminated string (no newline at end).
2022 * buffer = buffer address.
2023 * wd_size = word size 8, 16, 32 or 64 bits
2024 * count = number of words.
2027 qla2x00_formatted_dump_buffer(char *string
, uint8_t * buffer
,
2028 uint8_t wd_size
, uint32_t count
)
2034 if (strcmp(string
, "") != 0)
2035 printk("%s\n",string
);
2039 printk(" 0 1 2 3 4 5 6 7 "
2040 "8 9 Ah Bh Ch Dh Eh Fh\n");
2041 printk("-----------------------------------------"
2042 "-------------------------------------\n");
2044 for (cnt
= 1; cnt
<= count
; cnt
++, buffer
++) {
2045 printk("%02x",*buffer
);
2055 printk(" 0 2 4 6 8 Ah "
2057 printk("-----------------------------------------"
2060 buf16
= (uint16_t *) buffer
;
2061 for (cnt
= 1; cnt
<= count
; cnt
++, buf16
++) {
2062 printk("%4x",*buf16
);
2066 else if (*buf16
< 10)
2075 printk(" 0 4 8 Ch\n");
2076 printk("------------------------------------------\n");
2078 buf32
= (uint32_t *) buffer
;
2079 for (cnt
= 1; cnt
<= count
; cnt
++, buf32
++) {
2080 printk("%8x", *buf32
);
2084 else if (*buf32
< 10)