aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_dbg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_dbg.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_dbg.c1846
1 files changed, 573 insertions, 1273 deletions
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index c6680348b648..eaa04dabcdf6 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -38,7 +38,7 @@ qla2xxx_copy_queues(scsi_qla_host_t *ha, void *ptr)
38} 38}
39 39
40static int 40static int
41qla2xxx_dump_memory(scsi_qla_host_t *ha, uint32_t *code_ram, 41qla24xx_dump_memory(scsi_qla_host_t *ha, uint32_t *code_ram,
42 uint32_t cram_size, uint32_t *ext_mem, void **nxt) 42 uint32_t cram_size, uint32_t *ext_mem, void **nxt)
43{ 43{
44 int rval; 44 int rval;
@@ -152,6 +152,103 @@ qla2xxx_dump_memory(scsi_qla_host_t *ha, uint32_t *code_ram,
152 return rval; 152 return rval;
153} 153}
154 154
155static uint32_t *
156qla24xx_read_window(struct device_reg_24xx __iomem *reg, uint32_t iobase,
157 uint32_t count, uint32_t *buf)
158{
159 uint32_t __iomem *dmp_reg;
160
161 WRT_REG_DWORD(&reg->iobase_addr, iobase);
162 dmp_reg = &reg->iobase_window;
163 while (count--)
164 *buf++ = htonl(RD_REG_DWORD(dmp_reg++));
165
166 return buf;
167}
168
169static inline int
170qla24xx_pause_risc(struct device_reg_24xx __iomem *reg)
171{
172 int rval = QLA_SUCCESS;
173 uint32_t cnt;
174
175 if (RD_REG_DWORD(&reg->hccr) & HCCRX_RISC_PAUSE)
176 return rval;
177
178 WRT_REG_DWORD(&reg->hccr, HCCRX_SET_RISC_PAUSE);
179 for (cnt = 30000; (RD_REG_DWORD(&reg->hccr) & HCCRX_RISC_PAUSE) == 0 &&
180 rval == QLA_SUCCESS; cnt--) {
181 if (cnt)
182 udelay(100);
183 else
184 rval = QLA_FUNCTION_TIMEOUT;
185 }
186
187 return rval;
188}
189
190static int
191qla24xx_soft_reset(scsi_qla_host_t *ha)
192{
193 int rval = QLA_SUCCESS;
194 uint32_t cnt;
195 uint16_t mb0, wd;
196 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
197
198 /* Reset RISC. */
199 WRT_REG_DWORD(&reg->ctrl_status, CSRX_DMA_SHUTDOWN|MWB_4096_BYTES);
200 for (cnt = 0; cnt < 30000; cnt++) {
201 if ((RD_REG_DWORD(&reg->ctrl_status) & CSRX_DMA_ACTIVE) == 0)
202 break;
203
204 udelay(10);
205 }
206
207 WRT_REG_DWORD(&reg->ctrl_status,
208 CSRX_ISP_SOFT_RESET|CSRX_DMA_SHUTDOWN|MWB_4096_BYTES);
209 pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
210
211 udelay(100);
212 /* Wait for firmware to complete NVRAM accesses. */
213 mb0 = (uint32_t) RD_REG_WORD(&reg->mailbox0);
214 for (cnt = 10000 ; cnt && mb0; cnt--) {
215 udelay(5);
216 mb0 = (uint32_t) RD_REG_WORD(&reg->mailbox0);
217 barrier();
218 }
219
220 /* Wait for soft-reset to complete. */
221 for (cnt = 0; cnt < 30000; cnt++) {
222 if ((RD_REG_DWORD(&reg->ctrl_status) &
223 CSRX_ISP_SOFT_RESET) == 0)
224 break;
225
226 udelay(10);
227 }
228 WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_RESET);
229 RD_REG_DWORD(&reg->hccr); /* PCI Posting. */
230
231 for (cnt = 30000; RD_REG_WORD(&reg->mailbox0) != 0 &&
232 rval == QLA_SUCCESS; cnt--) {
233 if (cnt)
234 udelay(100);
235 else
236 rval = QLA_FUNCTION_TIMEOUT;
237 }
238
239 return rval;
240}
241
242static inline void
243qla2xxx_read_window(struct device_reg_2xxx __iomem *reg, uint32_t count,
244 uint16_t *buf)
245{
246 uint16_t __iomem *dmp_reg = &reg->u.isp2300.fb_cmd;
247
248 while (count--)
249 *buf++ = htons(RD_REG_WORD(dmp_reg++));
250}
251
155/** 252/**
156 * qla2300_fw_dump() - Dumps binary data from the 2300 firmware. 253 * qla2300_fw_dump() - Dumps binary data from the 2300 firmware.
157 * @ha: HA context 254 * @ha: HA context
@@ -214,88 +311,61 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
214 } 311 }
215 312
216 if (rval == QLA_SUCCESS) { 313 if (rval == QLA_SUCCESS) {
217 dmp_reg = (uint16_t __iomem *)(reg + 0); 314 dmp_reg = &reg->flash_address;
218 for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++) 315 for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++)
219 fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg++)); 316 fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
220 317
221 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x10); 318 dmp_reg = &reg->u.isp2300.req_q_in;
222 for (cnt = 0; cnt < sizeof(fw->risc_host_reg) / 2; cnt++) 319 for (cnt = 0; cnt < sizeof(fw->risc_host_reg) / 2; cnt++)
223 fw->risc_host_reg[cnt] = htons(RD_REG_WORD(dmp_reg++)); 320 fw->risc_host_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
224 321
225 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x40); 322 dmp_reg = &reg->u.isp2300.mailbox0;
226 for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++) 323 for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++)
227 fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg++)); 324 fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
228 325
229 WRT_REG_WORD(&reg->ctrl_status, 0x40); 326 WRT_REG_WORD(&reg->ctrl_status, 0x40);
230 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 327 qla2xxx_read_window(reg, 32, fw->resp_dma_reg);
231 for (cnt = 0; cnt < sizeof(fw->resp_dma_reg) / 2; cnt++)
232 fw->resp_dma_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
233 328
234 WRT_REG_WORD(&reg->ctrl_status, 0x50); 329 WRT_REG_WORD(&reg->ctrl_status, 0x50);
235 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 330 qla2xxx_read_window(reg, 48, fw->dma_reg);
236 for (cnt = 0; cnt < sizeof(fw->dma_reg) / 2; cnt++)
237 fw->dma_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
238 331
239 WRT_REG_WORD(&reg->ctrl_status, 0x00); 332 WRT_REG_WORD(&reg->ctrl_status, 0x00);
240 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0xA0); 333 dmp_reg = &reg->risc_hw;
241 for (cnt = 0; cnt < sizeof(fw->risc_hdw_reg) / 2; cnt++) 334 for (cnt = 0; cnt < sizeof(fw->risc_hdw_reg) / 2; cnt++)
242 fw->risc_hdw_reg[cnt] = htons(RD_REG_WORD(dmp_reg++)); 335 fw->risc_hdw_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
243 336
244 WRT_REG_WORD(&reg->pcr, 0x2000); 337 WRT_REG_WORD(&reg->pcr, 0x2000);
245 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 338 qla2xxx_read_window(reg, 16, fw->risc_gp0_reg);
246 for (cnt = 0; cnt < sizeof(fw->risc_gp0_reg) / 2; cnt++)
247 fw->risc_gp0_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
248 339
249 WRT_REG_WORD(&reg->pcr, 0x2200); 340 WRT_REG_WORD(&reg->pcr, 0x2200);
250 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 341 qla2xxx_read_window(reg, 16, fw->risc_gp1_reg);
251 for (cnt = 0; cnt < sizeof(fw->risc_gp1_reg) / 2; cnt++)
252 fw->risc_gp1_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
253 342
254 WRT_REG_WORD(&reg->pcr, 0x2400); 343 WRT_REG_WORD(&reg->pcr, 0x2400);
255 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 344 qla2xxx_read_window(reg, 16, fw->risc_gp2_reg);
256 for (cnt = 0; cnt < sizeof(fw->risc_gp2_reg) / 2; cnt++)
257 fw->risc_gp2_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
258 345
259 WRT_REG_WORD(&reg->pcr, 0x2600); 346 WRT_REG_WORD(&reg->pcr, 0x2600);
260 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 347 qla2xxx_read_window(reg, 16, fw->risc_gp3_reg);
261 for (cnt = 0; cnt < sizeof(fw->risc_gp3_reg) / 2; cnt++)
262 fw->risc_gp3_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
263 348
264 WRT_REG_WORD(&reg->pcr, 0x2800); 349 WRT_REG_WORD(&reg->pcr, 0x2800);
265 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 350 qla2xxx_read_window(reg, 16, fw->risc_gp4_reg);
266 for (cnt = 0; cnt < sizeof(fw->risc_gp4_reg) / 2; cnt++)
267 fw->risc_gp4_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
268 351
269 WRT_REG_WORD(&reg->pcr, 0x2A00); 352 WRT_REG_WORD(&reg->pcr, 0x2A00);
270 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 353 qla2xxx_read_window(reg, 16, fw->risc_gp5_reg);
271 for (cnt = 0; cnt < sizeof(fw->risc_gp5_reg) / 2; cnt++)
272 fw->risc_gp5_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
273 354
274 WRT_REG_WORD(&reg->pcr, 0x2C00); 355 WRT_REG_WORD(&reg->pcr, 0x2C00);
275 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 356 qla2xxx_read_window(reg, 16, fw->risc_gp6_reg);
276 for (cnt = 0; cnt < sizeof(fw->risc_gp6_reg) / 2; cnt++)
277 fw->risc_gp6_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
278 357
279 WRT_REG_WORD(&reg->pcr, 0x2E00); 358 WRT_REG_WORD(&reg->pcr, 0x2E00);
280 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 359 qla2xxx_read_window(reg, 16, fw->risc_gp7_reg);
281 for (cnt = 0; cnt < sizeof(fw->risc_gp7_reg) / 2; cnt++)
282 fw->risc_gp7_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
283 360
284 WRT_REG_WORD(&reg->ctrl_status, 0x10); 361 WRT_REG_WORD(&reg->ctrl_status, 0x10);
285 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 362 qla2xxx_read_window(reg, 64, fw->frame_buf_hdw_reg);
286 for (cnt = 0; cnt < sizeof(fw->frame_buf_hdw_reg) / 2; cnt++)
287 fw->frame_buf_hdw_reg[cnt] =
288 htons(RD_REG_WORD(dmp_reg++));
289 363
290 WRT_REG_WORD(&reg->ctrl_status, 0x20); 364 WRT_REG_WORD(&reg->ctrl_status, 0x20);
291 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 365 qla2xxx_read_window(reg, 64, fw->fpm_b0_reg);
292 for (cnt = 0; cnt < sizeof(fw->fpm_b0_reg) / 2; cnt++)
293 fw->fpm_b0_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
294 366
295 WRT_REG_WORD(&reg->ctrl_status, 0x30); 367 WRT_REG_WORD(&reg->ctrl_status, 0x30);
296 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 368 qla2xxx_read_window(reg, 64, fw->fpm_b1_reg);
297 for (cnt = 0; cnt < sizeof(fw->fpm_b1_reg) / 2; cnt++)
298 fw->fpm_b1_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
299 369
300 /* Reset RISC. */ 370 /* Reset RISC. */
301 WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET); 371 WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET);
@@ -567,83 +637,59 @@ qla2100_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
567 rval = QLA_FUNCTION_TIMEOUT; 637 rval = QLA_FUNCTION_TIMEOUT;
568 } 638 }
569 if (rval == QLA_SUCCESS) { 639 if (rval == QLA_SUCCESS) {
570 dmp_reg = (uint16_t __iomem *)(reg + 0); 640 dmp_reg = &reg->flash_address;
571 for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++) 641 for (cnt = 0; cnt < sizeof(fw->pbiu_reg) / 2; cnt++)
572 fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg++)); 642 fw->pbiu_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
573 643
574 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x10); 644 dmp_reg = &reg->u.isp2100.mailbox0;
575 for (cnt = 0; cnt < ha->mbx_count; cnt++) { 645 for (cnt = 0; cnt < ha->mbx_count; cnt++) {
576 if (cnt == 8) { 646 if (cnt == 8)
577 dmp_reg = (uint16_t __iomem *) 647 dmp_reg = &reg->u_end.isp2200.mailbox8;
578 ((uint8_t __iomem *)reg + 0xe0); 648
579 }
580 fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg++)); 649 fw->mailbox_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
581 } 650 }
582 651
583 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x20); 652 dmp_reg = &reg->u.isp2100.unused_2[0];
584 for (cnt = 0; cnt < sizeof(fw->dma_reg) / 2; cnt++) 653 for (cnt = 0; cnt < sizeof(fw->dma_reg) / 2; cnt++)
585 fw->dma_reg[cnt] = htons(RD_REG_WORD(dmp_reg++)); 654 fw->dma_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
586 655
587 WRT_REG_WORD(&reg->ctrl_status, 0x00); 656 WRT_REG_WORD(&reg->ctrl_status, 0x00);
588 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0xA0); 657 dmp_reg = &reg->risc_hw;
589 for (cnt = 0; cnt < sizeof(fw->risc_hdw_reg) / 2; cnt++) 658 for (cnt = 0; cnt < sizeof(fw->risc_hdw_reg) / 2; cnt++)
590 fw->risc_hdw_reg[cnt] = htons(RD_REG_WORD(dmp_reg++)); 659 fw->risc_hdw_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
591 660
592 WRT_REG_WORD(&reg->pcr, 0x2000); 661 WRT_REG_WORD(&reg->pcr, 0x2000);
593 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 662 qla2xxx_read_window(reg, 16, fw->risc_gp0_reg);
594 for (cnt = 0; cnt < sizeof(fw->risc_gp0_reg) / 2; cnt++)
595 fw->risc_gp0_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
596 663
597 WRT_REG_WORD(&reg->pcr, 0x2100); 664 WRT_REG_WORD(&reg->pcr, 0x2100);
598 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 665 qla2xxx_read_window(reg, 16, fw->risc_gp1_reg);
599 for (cnt = 0; cnt < sizeof(fw->risc_gp1_reg) / 2; cnt++)
600 fw->risc_gp1_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
601 666
602 WRT_REG_WORD(&reg->pcr, 0x2200); 667 WRT_REG_WORD(&reg->pcr, 0x2200);
603 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 668 qla2xxx_read_window(reg, 16, fw->risc_gp2_reg);
604 for (cnt = 0; cnt < sizeof(fw->risc_gp2_reg) / 2; cnt++)
605 fw->risc_gp2_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
606 669
607 WRT_REG_WORD(&reg->pcr, 0x2300); 670 WRT_REG_WORD(&reg->pcr, 0x2300);
608 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 671 qla2xxx_read_window(reg, 16, fw->risc_gp3_reg);
609 for (cnt = 0; cnt < sizeof(fw->risc_gp3_reg) / 2; cnt++)
610 fw->risc_gp3_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
611 672
612 WRT_REG_WORD(&reg->pcr, 0x2400); 673 WRT_REG_WORD(&reg->pcr, 0x2400);
613 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 674 qla2xxx_read_window(reg, 16, fw->risc_gp4_reg);
614 for (cnt = 0; cnt < sizeof(fw->risc_gp4_reg) / 2; cnt++)
615 fw->risc_gp4_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
616 675
617 WRT_REG_WORD(&reg->pcr, 0x2500); 676 WRT_REG_WORD(&reg->pcr, 0x2500);
618 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 677 qla2xxx_read_window(reg, 16, fw->risc_gp5_reg);
619 for (cnt = 0; cnt < sizeof(fw->risc_gp5_reg) / 2; cnt++)
620 fw->risc_gp5_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
621 678
622 WRT_REG_WORD(&reg->pcr, 0x2600); 679 WRT_REG_WORD(&reg->pcr, 0x2600);
623 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 680 qla2xxx_read_window(reg, 16, fw->risc_gp6_reg);
624 for (cnt = 0; cnt < sizeof(fw->risc_gp6_reg) / 2; cnt++)
625 fw->risc_gp6_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
626 681
627 WRT_REG_WORD(&reg->pcr, 0x2700); 682 WRT_REG_WORD(&reg->pcr, 0x2700);
628 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 683 qla2xxx_read_window(reg, 16, fw->risc_gp7_reg);
629 for (cnt = 0; cnt < sizeof(fw->risc_gp7_reg) / 2; cnt++)
630 fw->risc_gp7_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
631 684
632 WRT_REG_WORD(&reg->ctrl_status, 0x10); 685 WRT_REG_WORD(&reg->ctrl_status, 0x10);
633 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 686 qla2xxx_read_window(reg, 16, fw->frame_buf_hdw_reg);
634 for (cnt = 0; cnt < sizeof(fw->frame_buf_hdw_reg) / 2; cnt++)
635 fw->frame_buf_hdw_reg[cnt] =
636 htons(RD_REG_WORD(dmp_reg++));
637 687
638 WRT_REG_WORD(&reg->ctrl_status, 0x20); 688 WRT_REG_WORD(&reg->ctrl_status, 0x20);
639 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 689 qla2xxx_read_window(reg, 64, fw->fpm_b0_reg);
640 for (cnt = 0; cnt < sizeof(fw->fpm_b0_reg) / 2; cnt++)
641 fw->fpm_b0_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
642 690
643 WRT_REG_WORD(&reg->ctrl_status, 0x30); 691 WRT_REG_WORD(&reg->ctrl_status, 0x30);
644 dmp_reg = (uint16_t __iomem *)((uint8_t __iomem *)reg + 0x80); 692 qla2xxx_read_window(reg, 64, fw->fpm_b1_reg);
645 for (cnt = 0; cnt < sizeof(fw->fpm_b1_reg) / 2; cnt++)
646 fw->fpm_b1_reg[cnt] = htons(RD_REG_WORD(dmp_reg++));
647 693
648 /* Reset the ISP. */ 694 /* Reset the ISP. */
649 WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET); 695 WRT_REG_WORD(&reg->ctrl_status, CSR_ISP_SOFT_RESET);
@@ -750,7 +796,6 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
750 int rval; 796 int rval;
751 uint32_t cnt; 797 uint32_t cnt;
752 uint32_t risc_address; 798 uint32_t risc_address;
753 uint16_t mb0, wd;
754 799
755 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; 800 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
756 uint32_t __iomem *dmp_reg; 801 uint32_t __iomem *dmp_reg;
@@ -782,547 +827,198 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
782 fw = &ha->fw_dump->isp.isp24; 827 fw = &ha->fw_dump->isp.isp24;
783 qla2xxx_prep_dump(ha, ha->fw_dump); 828 qla2xxx_prep_dump(ha, ha->fw_dump);
784 829
785 rval = QLA_SUCCESS;
786 fw->host_status = htonl(RD_REG_DWORD(&reg->host_status)); 830 fw->host_status = htonl(RD_REG_DWORD(&reg->host_status));
787 831
788 /* Pause RISC. */ 832 /* Pause RISC. */
789 if ((RD_REG_DWORD(&reg->hccr) & HCCRX_RISC_PAUSE) == 0) { 833 rval = qla24xx_pause_risc(reg);
790 WRT_REG_DWORD(&reg->hccr, HCCRX_SET_RISC_RESET | 834 if (rval != QLA_SUCCESS)
791 HCCRX_CLR_HOST_INT); 835 goto qla24xx_fw_dump_failed_0;
792 RD_REG_DWORD(&reg->hccr); /* PCI Posting. */ 836
793 WRT_REG_DWORD(&reg->hccr, HCCRX_SET_RISC_PAUSE); 837 /* Host interface registers. */
794 for (cnt = 30000; 838 dmp_reg = &reg->flash_addr;
795 (RD_REG_DWORD(&reg->hccr) & HCCRX_RISC_PAUSE) == 0 && 839 for (cnt = 0; cnt < sizeof(fw->host_reg) / 4; cnt++)
796 rval == QLA_SUCCESS; cnt--) { 840 fw->host_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
797 if (cnt) 841
798 udelay(100); 842 /* Disable interrupts. */
799 else 843 WRT_REG_DWORD(&reg->ictrl, 0);
800 rval = QLA_FUNCTION_TIMEOUT; 844 RD_REG_DWORD(&reg->ictrl);
801 } 845
802 } 846 /* Shadow registers. */
803 847 WRT_REG_DWORD(&reg->iobase_addr, 0x0F70);
804 if (rval == QLA_SUCCESS) { 848 RD_REG_DWORD(&reg->iobase_addr);
805 /* Host interface registers. */ 849 WRT_REG_DWORD(&reg->iobase_select, 0xB0000000);
806 dmp_reg = (uint32_t __iomem *)(reg + 0); 850 fw->shadow_reg[0] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
807 for (cnt = 0; cnt < sizeof(fw->host_reg) / 4; cnt++) 851
808 fw->host_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++)); 852 WRT_REG_DWORD(&reg->iobase_select, 0xB0100000);
809 853 fw->shadow_reg[1] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
810 /* Disable interrupts. */ 854
811 WRT_REG_DWORD(&reg->ictrl, 0); 855 WRT_REG_DWORD(&reg->iobase_select, 0xB0200000);
812 RD_REG_DWORD(&reg->ictrl); 856 fw->shadow_reg[2] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
813 857
814 /* Shadow registers. */ 858 WRT_REG_DWORD(&reg->iobase_select, 0xB0300000);
815 WRT_REG_DWORD(&reg->iobase_addr, 0x0F70); 859 fw->shadow_reg[3] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
816 RD_REG_DWORD(&reg->iobase_addr); 860
817 WRT_REG_DWORD(&reg->iobase_select, 0xB0000000); 861 WRT_REG_DWORD(&reg->iobase_select, 0xB0400000);
818 fw->shadow_reg[0] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 862 fw->shadow_reg[4] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
819 863
820 WRT_REG_DWORD(&reg->iobase_select, 0xB0100000); 864 WRT_REG_DWORD(&reg->iobase_select, 0xB0500000);
821 fw->shadow_reg[1] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 865 fw->shadow_reg[5] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
822 866
823 WRT_REG_DWORD(&reg->iobase_select, 0xB0200000); 867 WRT_REG_DWORD(&reg->iobase_select, 0xB0600000);
824 fw->shadow_reg[2] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 868 fw->shadow_reg[6] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
825 869
826 WRT_REG_DWORD(&reg->iobase_select, 0xB0300000); 870 /* Mailbox registers. */
827 fw->shadow_reg[3] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 871 mbx_reg = &reg->mailbox0;
828 872 for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++)
829 WRT_REG_DWORD(&reg->iobase_select, 0xB0400000); 873 fw->mailbox_reg[cnt] = htons(RD_REG_WORD(mbx_reg++));
830 fw->shadow_reg[4] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 874
831 875 /* Transfer sequence registers. */
832 WRT_REG_DWORD(&reg->iobase_select, 0xB0500000); 876 iter_reg = fw->xseq_gp_reg;
833 fw->shadow_reg[5] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 877 iter_reg = qla24xx_read_window(reg, 0xBF00, 16, iter_reg);
834 878 iter_reg = qla24xx_read_window(reg, 0xBF10, 16, iter_reg);
835 WRT_REG_DWORD(&reg->iobase_select, 0xB0600000); 879 iter_reg = qla24xx_read_window(reg, 0xBF20, 16, iter_reg);
836 fw->shadow_reg[6] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 880 iter_reg = qla24xx_read_window(reg, 0xBF30, 16, iter_reg);
837 881 iter_reg = qla24xx_read_window(reg, 0xBF40, 16, iter_reg);
838 /* Mailbox registers. */ 882 iter_reg = qla24xx_read_window(reg, 0xBF50, 16, iter_reg);
839 mbx_reg = &reg->mailbox0; 883 iter_reg = qla24xx_read_window(reg, 0xBF60, 16, iter_reg);
840 for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++) 884 qla24xx_read_window(reg, 0xBF70, 16, iter_reg);
841 fw->mailbox_reg[cnt] = htons(RD_REG_WORD(mbx_reg++)); 885
842 886 qla24xx_read_window(reg, 0xBFE0, 16, fw->xseq_0_reg);
843 /* Transfer sequence registers. */ 887 qla24xx_read_window(reg, 0xBFF0, 16, fw->xseq_1_reg);
844 iter_reg = fw->xseq_gp_reg; 888
845 WRT_REG_DWORD(&reg->iobase_addr, 0xBF00); 889 /* Receive sequence registers. */
846 dmp_reg = &reg->iobase_window; 890 iter_reg = fw->rseq_gp_reg;
847 for (cnt = 0; cnt < 16; cnt++) 891 iter_reg = qla24xx_read_window(reg, 0xFF00, 16, iter_reg);
848 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 892 iter_reg = qla24xx_read_window(reg, 0xFF10, 16, iter_reg);
849 893 iter_reg = qla24xx_read_window(reg, 0xFF20, 16, iter_reg);
850 WRT_REG_DWORD(&reg->iobase_addr, 0xBF10); 894 iter_reg = qla24xx_read_window(reg, 0xFF30, 16, iter_reg);
851 dmp_reg = &reg->iobase_window; 895 iter_reg = qla24xx_read_window(reg, 0xFF40, 16, iter_reg);
852 for (cnt = 0; cnt < 16; cnt++) 896 iter_reg = qla24xx_read_window(reg, 0xFF50, 16, iter_reg);
853 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 897 iter_reg = qla24xx_read_window(reg, 0xFF60, 16, iter_reg);
854 898 qla24xx_read_window(reg, 0xFF70, 16, iter_reg);
855 WRT_REG_DWORD(&reg->iobase_addr, 0xBF20); 899
856 dmp_reg = &reg->iobase_window; 900 qla24xx_read_window(reg, 0xFFD0, 16, fw->rseq_0_reg);
857 for (cnt = 0; cnt < 16; cnt++) 901 qla24xx_read_window(reg, 0xFFE0, 16, fw->rseq_1_reg);
858 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 902 qla24xx_read_window(reg, 0xFFF0, 16, fw->rseq_2_reg);
859 903
860 WRT_REG_DWORD(&reg->iobase_addr, 0xBF30); 904 /* Command DMA registers. */
861 dmp_reg = &reg->iobase_window; 905 qla24xx_read_window(reg, 0x7100, 16, fw->cmd_dma_reg);
862 for (cnt = 0; cnt < 16; cnt++) 906
863 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 907 /* Queues. */
864 908 iter_reg = fw->req0_dma_reg;
865 WRT_REG_DWORD(&reg->iobase_addr, 0xBF40); 909 iter_reg = qla24xx_read_window(reg, 0x7200, 8, iter_reg);
866 dmp_reg = &reg->iobase_window; 910 dmp_reg = &reg->iobase_q;
867 for (cnt = 0; cnt < 16; cnt++) 911 for (cnt = 0; cnt < 7; cnt++)
868 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 912 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
869 913
870 WRT_REG_DWORD(&reg->iobase_addr, 0xBF50); 914 iter_reg = fw->resp0_dma_reg;
871 dmp_reg = &reg->iobase_window; 915 iter_reg = qla24xx_read_window(reg, 0x7300, 8, iter_reg);
872 for (cnt = 0; cnt < 16; cnt++) 916 dmp_reg = &reg->iobase_q;
873 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 917 for (cnt = 0; cnt < 7; cnt++)
874 918 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
875 WRT_REG_DWORD(&reg->iobase_addr, 0xBF60); 919
876 dmp_reg = &reg->iobase_window; 920 iter_reg = fw->req1_dma_reg;
877 for (cnt = 0; cnt < 16; cnt++) 921 iter_reg = qla24xx_read_window(reg, 0x7400, 8, iter_reg);
878 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 922 dmp_reg = &reg->iobase_q;
879 923 for (cnt = 0; cnt < 7; cnt++)
880 WRT_REG_DWORD(&reg->iobase_addr, 0xBF70); 924 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
881 dmp_reg = &reg->iobase_window; 925
882 for (cnt = 0; cnt < 16; cnt++) 926 /* Transmit DMA registers. */
883 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 927 iter_reg = fw->xmt0_dma_reg;
884 928 iter_reg = qla24xx_read_window(reg, 0x7600, 16, iter_reg);
885 WRT_REG_DWORD(&reg->iobase_addr, 0xBFE0); 929 qla24xx_read_window(reg, 0x7610, 16, iter_reg);
886 dmp_reg = &reg->iobase_window; 930
887 for (cnt = 0; cnt < sizeof(fw->xseq_0_reg) / 4; cnt++) 931 iter_reg = fw->xmt1_dma_reg;
888 fw->xseq_0_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++)); 932 iter_reg = qla24xx_read_window(reg, 0x7620, 16, iter_reg);
889 933 qla24xx_read_window(reg, 0x7630, 16, iter_reg);
890 WRT_REG_DWORD(&reg->iobase_addr, 0xBFF0); 934
891 dmp_reg = &reg->iobase_window; 935 iter_reg = fw->xmt2_dma_reg;
892 for (cnt = 0; cnt < sizeof(fw->xseq_1_reg) / 4; cnt++) 936 iter_reg = qla24xx_read_window(reg, 0x7640, 16, iter_reg);
893 fw->xseq_1_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++)); 937 qla24xx_read_window(reg, 0x7650, 16, iter_reg);
894 938
895 /* Receive sequence registers. */ 939 iter_reg = fw->xmt3_dma_reg;
896 iter_reg = fw->rseq_gp_reg; 940 iter_reg = qla24xx_read_window(reg, 0x7660, 16, iter_reg);
897 WRT_REG_DWORD(&reg->iobase_addr, 0xFF00); 941 qla24xx_read_window(reg, 0x7670, 16, iter_reg);
898 dmp_reg = &reg->iobase_window; 942
899 for (cnt = 0; cnt < 16; cnt++) 943 iter_reg = fw->xmt4_dma_reg;
900 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 944 iter_reg = qla24xx_read_window(reg, 0x7680, 16, iter_reg);
901 945 qla24xx_read_window(reg, 0x7690, 16, iter_reg);
902 WRT_REG_DWORD(&reg->iobase_addr, 0xFF10); 946
903 dmp_reg = &reg->iobase_window; 947 qla24xx_read_window(reg, 0x76A0, 16, fw->xmt_data_dma_reg);
904 for (cnt = 0; cnt < 16; cnt++) 948
905 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 949 /* Receive DMA registers. */
906 950 iter_reg = fw->rcvt0_data_dma_reg;
907 WRT_REG_DWORD(&reg->iobase_addr, 0xFF20); 951 iter_reg = qla24xx_read_window(reg, 0x7700, 16, iter_reg);
908 dmp_reg = &reg->iobase_window; 952 qla24xx_read_window(reg, 0x7710, 16, iter_reg);
909 for (cnt = 0; cnt < 16; cnt++) 953
910 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 954 iter_reg = fw->rcvt1_data_dma_reg;
911 955 iter_reg = qla24xx_read_window(reg, 0x7720, 16, iter_reg);
912 WRT_REG_DWORD(&reg->iobase_addr, 0xFF30); 956 qla24xx_read_window(reg, 0x7730, 16, iter_reg);
913 dmp_reg = &reg->iobase_window; 957
914 for (cnt = 0; cnt < 16; cnt++) 958 /* RISC registers. */
915 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 959 iter_reg = fw->risc_gp_reg;
916 960 iter_reg = qla24xx_read_window(reg, 0x0F00, 16, iter_reg);
917 WRT_REG_DWORD(&reg->iobase_addr, 0xFF40); 961 iter_reg = qla24xx_read_window(reg, 0x0F10, 16, iter_reg);
918 dmp_reg = &reg->iobase_window; 962 iter_reg = qla24xx_read_window(reg, 0x0F20, 16, iter_reg);
919 for (cnt = 0; cnt < 16; cnt++) 963 iter_reg = qla24xx_read_window(reg, 0x0F30, 16, iter_reg);
920 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 964 iter_reg = qla24xx_read_window(reg, 0x0F40, 16, iter_reg);
921 965 iter_reg = qla24xx_read_window(reg, 0x0F50, 16, iter_reg);
922 WRT_REG_DWORD(&reg->iobase_addr, 0xFF50); 966 iter_reg = qla24xx_read_window(reg, 0x0F60, 16, iter_reg);
923 dmp_reg = &reg->iobase_window; 967 qla24xx_read_window(reg, 0x0F70, 16, iter_reg);
924 for (cnt = 0; cnt < 16; cnt++) 968
925 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 969 /* Local memory controller registers. */
926 970 iter_reg = fw->lmc_reg;
927 WRT_REG_DWORD(&reg->iobase_addr, 0xFF60); 971 iter_reg = qla24xx_read_window(reg, 0x3000, 16, iter_reg);
928 dmp_reg = &reg->iobase_window; 972 iter_reg = qla24xx_read_window(reg, 0x3010, 16, iter_reg);
929 for (cnt = 0; cnt < 16; cnt++) 973 iter_reg = qla24xx_read_window(reg, 0x3020, 16, iter_reg);
930 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 974 iter_reg = qla24xx_read_window(reg, 0x3030, 16, iter_reg);
931 975 iter_reg = qla24xx_read_window(reg, 0x3040, 16, iter_reg);
932 WRT_REG_DWORD(&reg->iobase_addr, 0xFF70); 976 iter_reg = qla24xx_read_window(reg, 0x3050, 16, iter_reg);
933 dmp_reg = &reg->iobase_window; 977 qla24xx_read_window(reg, 0x3060, 16, iter_reg);
934 for (cnt = 0; cnt < 16; cnt++) 978
935 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 979 /* Fibre Protocol Module registers. */
936 980 iter_reg = fw->fpm_hdw_reg;
937 WRT_REG_DWORD(&reg->iobase_addr, 0xFFD0); 981 iter_reg = qla24xx_read_window(reg, 0x4000, 16, iter_reg);
938 dmp_reg = &reg->iobase_window; 982 iter_reg = qla24xx_read_window(reg, 0x4010, 16, iter_reg);
939 for (cnt = 0; cnt < sizeof(fw->rseq_0_reg) / 4; cnt++) 983 iter_reg = qla24xx_read_window(reg, 0x4020, 16, iter_reg);
940 fw->rseq_0_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++)); 984 iter_reg = qla24xx_read_window(reg, 0x4030, 16, iter_reg);
941 985 iter_reg = qla24xx_read_window(reg, 0x4040, 16, iter_reg);
942 WRT_REG_DWORD(&reg->iobase_addr, 0xFFE0); 986 iter_reg = qla24xx_read_window(reg, 0x4050, 16, iter_reg);
943 dmp_reg = &reg->iobase_window; 987 iter_reg = qla24xx_read_window(reg, 0x4060, 16, iter_reg);
944 for (cnt = 0; cnt < sizeof(fw->rseq_1_reg) / 4; cnt++) 988 iter_reg = qla24xx_read_window(reg, 0x4070, 16, iter_reg);
945 fw->rseq_1_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++)); 989 iter_reg = qla24xx_read_window(reg, 0x4080, 16, iter_reg);
946 990 iter_reg = qla24xx_read_window(reg, 0x4090, 16, iter_reg);
947 WRT_REG_DWORD(&reg->iobase_addr, 0xFFF0); 991 iter_reg = qla24xx_read_window(reg, 0x40A0, 16, iter_reg);
948 dmp_reg = &reg->iobase_window; 992 qla24xx_read_window(reg, 0x40B0, 16, iter_reg);
949 for (cnt = 0; cnt < sizeof(fw->rseq_2_reg) / 4; cnt++) 993
950 fw->rseq_2_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++)); 994 /* Frame Buffer registers. */
951 995 iter_reg = fw->fb_hdw_reg;
952 /* Command DMA registers. */ 996 iter_reg = qla24xx_read_window(reg, 0x6000, 16, iter_reg);
953 WRT_REG_DWORD(&reg->iobase_addr, 0x7100); 997 iter_reg = qla24xx_read_window(reg, 0x6010, 16, iter_reg);
954 dmp_reg = &reg->iobase_window; 998 iter_reg = qla24xx_read_window(reg, 0x6020, 16, iter_reg);
955 for (cnt = 0; cnt < sizeof(fw->cmd_dma_reg) / 4; cnt++) 999 iter_reg = qla24xx_read_window(reg, 0x6030, 16, iter_reg);
956 fw->cmd_dma_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++)); 1000 iter_reg = qla24xx_read_window(reg, 0x6040, 16, iter_reg);
957 1001 iter_reg = qla24xx_read_window(reg, 0x6100, 16, iter_reg);
958 /* Queues. */ 1002 iter_reg = qla24xx_read_window(reg, 0x6130, 16, iter_reg);
959 iter_reg = fw->req0_dma_reg; 1003 iter_reg = qla24xx_read_window(reg, 0x6150, 16, iter_reg);
960 WRT_REG_DWORD(&reg->iobase_addr, 0x7200); 1004 iter_reg = qla24xx_read_window(reg, 0x6170, 16, iter_reg);
961 dmp_reg = &reg->iobase_window; 1005 iter_reg = qla24xx_read_window(reg, 0x6190, 16, iter_reg);
962 for (cnt = 0; cnt < 8; cnt++) 1006 qla24xx_read_window(reg, 0x61B0, 16, iter_reg);
963 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1007
964 1008 rval = qla24xx_soft_reset(ha);
965 dmp_reg = &reg->iobase_q; 1009 if (rval != QLA_SUCCESS)
966 for (cnt = 0; cnt < 7; cnt++) 1010 goto qla24xx_fw_dump_failed_0;
967 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1011
968 1012 rval = qla24xx_dump_memory(ha, fw->code_ram, sizeof(fw->code_ram),
969 iter_reg = fw->resp0_dma_reg; 1013 fw->ext_mem, &nxt);
970 WRT_REG_DWORD(&reg->iobase_addr, 0x7300); 1014 if (rval != QLA_SUCCESS)
971 dmp_reg = &reg->iobase_window; 1015 goto qla24xx_fw_dump_failed_0;
972 for (cnt = 0; cnt < 8; cnt++) 1016
973 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1017 nxt = qla2xxx_copy_queues(ha, nxt);
974 1018 if (ha->eft)
975 dmp_reg = &reg->iobase_q; 1019 memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size));
976 for (cnt = 0; cnt < 7; cnt++) 1020
977 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1021qla24xx_fw_dump_failed_0:
978
979 iter_reg = fw->req1_dma_reg;
980 WRT_REG_DWORD(&reg->iobase_addr, 0x7400);
981 dmp_reg = &reg->iobase_window;
982 for (cnt = 0; cnt < 8; cnt++)
983 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
984
985 dmp_reg = &reg->iobase_q;
986 for (cnt = 0; cnt < 7; cnt++)
987 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
988
989 /* Transmit DMA registers. */
990 iter_reg = fw->xmt0_dma_reg;
991 WRT_REG_DWORD(&reg->iobase_addr, 0x7600);
992 dmp_reg = &reg->iobase_window;
993 for (cnt = 0; cnt < 16; cnt++)
994 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
995
996 WRT_REG_DWORD(&reg->iobase_addr, 0x7610);
997 dmp_reg = &reg->iobase_window;
998 for (cnt = 0; cnt < 16; cnt++)
999 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1000
1001 iter_reg = fw->xmt1_dma_reg;
1002 WRT_REG_DWORD(&reg->iobase_addr, 0x7620);
1003 dmp_reg = &reg->iobase_window;
1004 for (cnt = 0; cnt < 16; cnt++)
1005 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1006
1007 WRT_REG_DWORD(&reg->iobase_addr, 0x7630);
1008 dmp_reg = &reg->iobase_window;
1009 for (cnt = 0; cnt < 16; cnt++)
1010 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1011
1012 iter_reg = fw->xmt2_dma_reg;
1013 WRT_REG_DWORD(&reg->iobase_addr, 0x7640);
1014 dmp_reg = &reg->iobase_window;
1015 for (cnt = 0; cnt < 16; cnt++)
1016 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1017
1018 WRT_REG_DWORD(&reg->iobase_addr, 0x7650);
1019 dmp_reg = &reg->iobase_window;
1020 for (cnt = 0; cnt < 16; cnt++)
1021 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1022
1023 iter_reg = fw->xmt3_dma_reg;
1024 WRT_REG_DWORD(&reg->iobase_addr, 0x7660);
1025 dmp_reg = &reg->iobase_window;
1026 for (cnt = 0; cnt < 16; cnt++)
1027 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1028
1029 WRT_REG_DWORD(&reg->iobase_addr, 0x7670);
1030 dmp_reg = &reg->iobase_window;
1031 for (cnt = 0; cnt < 16; cnt++)
1032 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1033
1034 iter_reg = fw->xmt4_dma_reg;
1035 WRT_REG_DWORD(&reg->iobase_addr, 0x7680);
1036 dmp_reg = &reg->iobase_window;
1037 for (cnt = 0; cnt < 16; cnt++)
1038 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1039
1040 WRT_REG_DWORD(&reg->iobase_addr, 0x7690);
1041 dmp_reg = &reg->iobase_window;
1042 for (cnt = 0; cnt < 16; cnt++)
1043 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1044
1045 WRT_REG_DWORD(&reg->iobase_addr, 0x76A0);
1046 dmp_reg = &reg->iobase_window;
1047 for (cnt = 0; cnt < sizeof(fw->xmt_data_dma_reg) / 4; cnt++)
1048 fw->xmt_data_dma_reg[cnt] =
1049 htonl(RD_REG_DWORD(dmp_reg++));
1050
1051 /* Receive DMA registers. */
1052 iter_reg = fw->rcvt0_data_dma_reg;
1053 WRT_REG_DWORD(&reg->iobase_addr, 0x7700);
1054 dmp_reg = &reg->iobase_window;
1055 for (cnt = 0; cnt < 16; cnt++)
1056 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1057
1058 WRT_REG_DWORD(&reg->iobase_addr, 0x7710);
1059 dmp_reg = &reg->iobase_window;
1060 for (cnt = 0; cnt < 16; cnt++)
1061 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1062
1063 iter_reg = fw->rcvt1_data_dma_reg;
1064 WRT_REG_DWORD(&reg->iobase_addr, 0x7720);
1065 dmp_reg = &reg->iobase_window;
1066 for (cnt = 0; cnt < 16; cnt++)
1067 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1068
1069 WRT_REG_DWORD(&reg->iobase_addr, 0x7730);
1070 dmp_reg = &reg->iobase_window;
1071 for (cnt = 0; cnt < 16; cnt++)
1072 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1073
1074 /* RISC registers. */
1075 iter_reg = fw->risc_gp_reg;
1076 WRT_REG_DWORD(&reg->iobase_addr, 0x0F00);
1077 dmp_reg = &reg->iobase_window;
1078 for (cnt = 0; cnt < 16; cnt++)
1079 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1080
1081 WRT_REG_DWORD(&reg->iobase_addr, 0x0F10);
1082 dmp_reg = &reg->iobase_window;
1083 for (cnt = 0; cnt < 16; cnt++)
1084 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1085
1086 WRT_REG_DWORD(&reg->iobase_addr, 0x0F20);
1087 dmp_reg = &reg->iobase_window;
1088 for (cnt = 0; cnt < 16; cnt++)
1089 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1090
1091 WRT_REG_DWORD(&reg->iobase_addr, 0x0F30);
1092 dmp_reg = &reg->iobase_window;
1093 for (cnt = 0; cnt < 16; cnt++)
1094 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1095
1096 WRT_REG_DWORD(&reg->iobase_addr, 0x0F40);
1097 dmp_reg = &reg->iobase_window;
1098 for (cnt = 0; cnt < 16; cnt++)
1099 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1100
1101 WRT_REG_DWORD(&reg->iobase_addr, 0x0F50);
1102 dmp_reg = &reg->iobase_window;
1103 for (cnt = 0; cnt < 16; cnt++)
1104 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1105
1106 WRT_REG_DWORD(&reg->iobase_addr, 0x0F60);
1107 dmp_reg = &reg->iobase_window;
1108 for (cnt = 0; cnt < 16; cnt++)
1109 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1110
1111 WRT_REG_DWORD(&reg->iobase_addr, 0x0F70);
1112 dmp_reg = &reg->iobase_window;
1113 for (cnt = 0; cnt < 16; cnt++)
1114 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1115
1116 /* Local memory controller registers. */
1117 iter_reg = fw->lmc_reg;
1118 WRT_REG_DWORD(&reg->iobase_addr, 0x3000);
1119 dmp_reg = &reg->iobase_window;
1120 for (cnt = 0; cnt < 16; cnt++)
1121 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1122
1123 WRT_REG_DWORD(&reg->iobase_addr, 0x3010);
1124 dmp_reg = &reg->iobase_window;
1125 for (cnt = 0; cnt < 16; cnt++)
1126 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1127
1128 WRT_REG_DWORD(&reg->iobase_addr, 0x3020);
1129 dmp_reg = &reg->iobase_window;
1130 for (cnt = 0; cnt < 16; cnt++)
1131 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1132
1133 WRT_REG_DWORD(&reg->iobase_addr, 0x3030);
1134 dmp_reg = &reg->iobase_window;
1135 for (cnt = 0; cnt < 16; cnt++)
1136 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1137
1138 WRT_REG_DWORD(&reg->iobase_addr, 0x3040);
1139 dmp_reg = &reg->iobase_window;
1140 for (cnt = 0; cnt < 16; cnt++)
1141 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1142
1143 WRT_REG_DWORD(&reg->iobase_addr, 0x3050);
1144 dmp_reg = &reg->iobase_window;
1145 for (cnt = 0; cnt < 16; cnt++)
1146 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1147
1148 WRT_REG_DWORD(&reg->iobase_addr, 0x3060);
1149 dmp_reg = &reg->iobase_window;
1150 for (cnt = 0; cnt < 16; cnt++)
1151 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1152
1153 /* Fibre Protocol Module registers. */
1154 iter_reg = fw->fpm_hdw_reg;
1155 WRT_REG_DWORD(&reg->iobase_addr, 0x4000);
1156 dmp_reg = &reg->iobase_window;
1157 for (cnt = 0; cnt < 16; cnt++)
1158 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1159
1160 WRT_REG_DWORD(&reg->iobase_addr, 0x4010);
1161 dmp_reg = &reg->iobase_window;
1162 for (cnt = 0; cnt < 16; cnt++)
1163 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1164
1165 WRT_REG_DWORD(&reg->iobase_addr, 0x4020);
1166 dmp_reg = &reg->iobase_window;
1167 for (cnt = 0; cnt < 16; cnt++)
1168 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1169
1170 WRT_REG_DWORD(&reg->iobase_addr, 0x4030);
1171 dmp_reg = &reg->iobase_window;
1172 for (cnt = 0; cnt < 16; cnt++)
1173 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1174
1175 WRT_REG_DWORD(&reg->iobase_addr, 0x4040);
1176 dmp_reg = &reg->iobase_window;
1177 for (cnt = 0; cnt < 16; cnt++)
1178 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1179
1180 WRT_REG_DWORD(&reg->iobase_addr, 0x4050);
1181 dmp_reg = &reg->iobase_window;
1182 for (cnt = 0; cnt < 16; cnt++)
1183 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1184
1185 WRT_REG_DWORD(&reg->iobase_addr, 0x4060);
1186 dmp_reg = &reg->iobase_window;
1187 for (cnt = 0; cnt < 16; cnt++)
1188 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1189
1190 WRT_REG_DWORD(&reg->iobase_addr, 0x4070);
1191 dmp_reg = &reg->iobase_window;
1192 for (cnt = 0; cnt < 16; cnt++)
1193 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1194
1195 WRT_REG_DWORD(&reg->iobase_addr, 0x4080);
1196 dmp_reg = &reg->iobase_window;
1197 for (cnt = 0; cnt < 16; cnt++)
1198 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1199
1200 WRT_REG_DWORD(&reg->iobase_addr, 0x4090);
1201 dmp_reg = &reg->iobase_window;
1202 for (cnt = 0; cnt < 16; cnt++)
1203 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1204
1205 WRT_REG_DWORD(&reg->iobase_addr, 0x40A0);
1206 dmp_reg = &reg->iobase_window;
1207 for (cnt = 0; cnt < 16; cnt++)
1208 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1209
1210 WRT_REG_DWORD(&reg->iobase_addr, 0x40B0);
1211 dmp_reg = &reg->iobase_window;
1212 for (cnt = 0; cnt < 16; cnt++)
1213 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1214
1215 /* Frame Buffer registers. */
1216 iter_reg = fw->fb_hdw_reg;
1217 WRT_REG_DWORD(&reg->iobase_addr, 0x6000);
1218 dmp_reg = &reg->iobase_window;
1219 for (cnt = 0; cnt < 16; cnt++)
1220 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1221
1222 WRT_REG_DWORD(&reg->iobase_addr, 0x6010);
1223 dmp_reg = &reg->iobase_window;
1224 for (cnt = 0; cnt < 16; cnt++)
1225 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1226
1227 WRT_REG_DWORD(&reg->iobase_addr, 0x6020);
1228 dmp_reg = &reg->iobase_window;
1229 for (cnt = 0; cnt < 16; cnt++)
1230 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1231
1232 WRT_REG_DWORD(&reg->iobase_addr, 0x6030);
1233 dmp_reg = &reg->iobase_window;
1234 for (cnt = 0; cnt < 16; cnt++)
1235 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1236
1237 WRT_REG_DWORD(&reg->iobase_addr, 0x6040);
1238 dmp_reg = &reg->iobase_window;
1239 for (cnt = 0; cnt < 16; cnt++)
1240 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1241
1242 WRT_REG_DWORD(&reg->iobase_addr, 0x6100);
1243 dmp_reg = &reg->iobase_window;
1244 for (cnt = 0; cnt < 16; cnt++)
1245 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1246
1247 WRT_REG_DWORD(&reg->iobase_addr, 0x6130);
1248 dmp_reg = &reg->iobase_window;
1249 for (cnt = 0; cnt < 16; cnt++)
1250 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1251
1252 WRT_REG_DWORD(&reg->iobase_addr, 0x6150);
1253 dmp_reg = &reg->iobase_window;
1254 for (cnt = 0; cnt < 16; cnt++)
1255 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1256
1257 WRT_REG_DWORD(&reg->iobase_addr, 0x6170);
1258 dmp_reg = &reg->iobase_window;
1259 for (cnt = 0; cnt < 16; cnt++)
1260 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1261
1262 WRT_REG_DWORD(&reg->iobase_addr, 0x6190);
1263 dmp_reg = &reg->iobase_window;
1264 for (cnt = 0; cnt < 16; cnt++)
1265 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1266
1267 WRT_REG_DWORD(&reg->iobase_addr, 0x61B0);
1268 dmp_reg = &reg->iobase_window;
1269 for (cnt = 0; cnt < 16; cnt++)
1270 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1271
1272 /* Reset RISC. */
1273 WRT_REG_DWORD(&reg->ctrl_status,
1274 CSRX_DMA_SHUTDOWN|MWB_4096_BYTES);
1275 for (cnt = 0; cnt < 30000; cnt++) {
1276 if ((RD_REG_DWORD(&reg->ctrl_status) &
1277 CSRX_DMA_ACTIVE) == 0)
1278 break;
1279
1280 udelay(10);
1281 }
1282
1283 WRT_REG_DWORD(&reg->ctrl_status,
1284 CSRX_ISP_SOFT_RESET|CSRX_DMA_SHUTDOWN|MWB_4096_BYTES);
1285 pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
1286
1287 udelay(100);
1288 /* Wait for firmware to complete NVRAM accesses. */
1289 mb0 = (uint32_t) RD_REG_WORD(&reg->mailbox0);
1290 for (cnt = 10000 ; cnt && mb0; cnt--) {
1291 udelay(5);
1292 mb0 = (uint32_t) RD_REG_WORD(&reg->mailbox0);
1293 barrier();
1294 }
1295
1296 /* Wait for soft-reset to complete. */
1297 for (cnt = 0; cnt < 30000; cnt++) {
1298 if ((RD_REG_DWORD(&reg->ctrl_status) &
1299 CSRX_ISP_SOFT_RESET) == 0)
1300 break;
1301
1302 udelay(10);
1303 }
1304 WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_RESET);
1305 RD_REG_DWORD(&reg->hccr); /* PCI Posting. */
1306 }
1307
1308 for (cnt = 30000; RD_REG_WORD(&reg->mailbox0) != 0 &&
1309 rval == QLA_SUCCESS; cnt--) {
1310 if (cnt)
1311 udelay(100);
1312 else
1313 rval = QLA_FUNCTION_TIMEOUT;
1314 }
1315
1316 if (rval == QLA_SUCCESS)
1317 rval = qla2xxx_dump_memory(ha, fw->code_ram,
1318 sizeof(fw->code_ram), fw->ext_mem, &nxt);
1319
1320 if (rval == QLA_SUCCESS) {
1321 nxt = qla2xxx_copy_queues(ha, nxt);
1322 if (ha->eft)
1323 memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size));
1324 }
1325
1326 if (rval != QLA_SUCCESS) { 1022 if (rval != QLA_SUCCESS) {
1327 qla_printk(KERN_WARNING, ha, 1023 qla_printk(KERN_WARNING, ha,
1328 "Failed to dump firmware (%x)!!!\n", rval); 1024 "Failed to dump firmware (%x)!!!\n", rval);
@@ -1346,7 +1042,6 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
1346 int rval; 1042 int rval;
1347 uint32_t cnt; 1043 uint32_t cnt;
1348 uint32_t risc_address; 1044 uint32_t risc_address;
1349 uint16_t mb0, wd;
1350 1045
1351 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; 1046 struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
1352 uint32_t __iomem *dmp_reg; 1047 uint32_t __iomem *dmp_reg;
@@ -1377,655 +1072,260 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
1377 } 1072 }
1378 fw = &ha->fw_dump->isp.isp25; 1073 fw = &ha->fw_dump->isp.isp25;
1379 qla2xxx_prep_dump(ha, ha->fw_dump); 1074 qla2xxx_prep_dump(ha, ha->fw_dump);
1075 ha->fw_dump->version = __constant_htonl(2);
1380 1076
1381 rval = QLA_SUCCESS;
1382 fw->host_status = htonl(RD_REG_DWORD(&reg->host_status)); 1077 fw->host_status = htonl(RD_REG_DWORD(&reg->host_status));
1383 1078
1384 /* Pause RISC. */ 1079 /* Pause RISC. */
1385 if ((RD_REG_DWORD(&reg->hccr) & HCCRX_RISC_PAUSE) == 0) { 1080 rval = qla24xx_pause_risc(reg);
1386 WRT_REG_DWORD(&reg->hccr, HCCRX_SET_RISC_RESET | 1081 if (rval != QLA_SUCCESS)
1387 HCCRX_CLR_HOST_INT); 1082 goto qla25xx_fw_dump_failed_0;
1388 RD_REG_DWORD(&reg->hccr); /* PCI Posting. */ 1083
1389 WRT_REG_DWORD(&reg->hccr, HCCRX_SET_RISC_PAUSE); 1084 /* Host/Risc registers. */
1390 for (cnt = 30000; 1085 iter_reg = fw->host_risc_reg;
1391 (RD_REG_DWORD(&reg->hccr) & HCCRX_RISC_PAUSE) == 0 && 1086 iter_reg = qla24xx_read_window(reg, 0x7000, 16, iter_reg);
1392 rval == QLA_SUCCESS; cnt--) { 1087 qla24xx_read_window(reg, 0x7010, 16, iter_reg);
1393 if (cnt) 1088
1394 udelay(100); 1089 /* PCIe registers. */
1395 else 1090 WRT_REG_DWORD(&reg->iobase_addr, 0x7C00);
1396 rval = QLA_FUNCTION_TIMEOUT; 1091 RD_REG_DWORD(&reg->iobase_addr);
1397 } 1092 WRT_REG_DWORD(&reg->iobase_window, 0x01);
1398 } 1093 dmp_reg = &reg->iobase_c4;
1399 1094 fw->pcie_regs[0] = htonl(RD_REG_DWORD(dmp_reg++));
1400 if (rval == QLA_SUCCESS) { 1095 fw->pcie_regs[1] = htonl(RD_REG_DWORD(dmp_reg++));
1401 /* Host interface registers. */ 1096 fw->pcie_regs[2] = htonl(RD_REG_DWORD(dmp_reg));
1402 dmp_reg = (uint32_t __iomem *)(reg + 0); 1097 fw->pcie_regs[3] = htonl(RD_REG_DWORD(&reg->iobase_window));
1403 for (cnt = 0; cnt < sizeof(fw->host_reg) / 4; cnt++) 1098 WRT_REG_DWORD(&reg->iobase_window, 0x00);
1404 fw->host_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++)); 1099 RD_REG_DWORD(&reg->iobase_window);
1405 1100
1406 /* Disable interrupts. */ 1101 /* Host interface registers. */
1407 WRT_REG_DWORD(&reg->ictrl, 0); 1102 dmp_reg = &reg->flash_addr;
1408 RD_REG_DWORD(&reg->ictrl); 1103 for (cnt = 0; cnt < sizeof(fw->host_reg) / 4; cnt++)
1409 1104 fw->host_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
1410 /* Shadow registers. */ 1105
1411 WRT_REG_DWORD(&reg->iobase_addr, 0x0F70); 1106 /* Disable interrupts. */
1412 RD_REG_DWORD(&reg->iobase_addr); 1107 WRT_REG_DWORD(&reg->ictrl, 0);
1413 WRT_REG_DWORD(&reg->iobase_select, 0xB0000000); 1108 RD_REG_DWORD(&reg->ictrl);
1414 fw->shadow_reg[0] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 1109
1415 1110 /* Shadow registers. */
1416 WRT_REG_DWORD(&reg->iobase_select, 0xB0100000); 1111 WRT_REG_DWORD(&reg->iobase_addr, 0x0F70);
1417 fw->shadow_reg[1] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 1112 RD_REG_DWORD(&reg->iobase_addr);
1418 1113 WRT_REG_DWORD(&reg->iobase_select, 0xB0000000);
1419 WRT_REG_DWORD(&reg->iobase_select, 0xB0200000); 1114 fw->shadow_reg[0] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
1420 fw->shadow_reg[2] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 1115
1421 1116 WRT_REG_DWORD(&reg->iobase_select, 0xB0100000);
1422 WRT_REG_DWORD(&reg->iobase_select, 0xB0300000); 1117 fw->shadow_reg[1] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
1423 fw->shadow_reg[3] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 1118
1424 1119 WRT_REG_DWORD(&reg->iobase_select, 0xB0200000);
1425 WRT_REG_DWORD(&reg->iobase_select, 0xB0400000); 1120 fw->shadow_reg[2] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
1426 fw->shadow_reg[4] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 1121
1427 1122 WRT_REG_DWORD(&reg->iobase_select, 0xB0300000);
1428 WRT_REG_DWORD(&reg->iobase_select, 0xB0500000); 1123 fw->shadow_reg[3] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
1429 fw->shadow_reg[5] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 1124
1430 1125 WRT_REG_DWORD(&reg->iobase_select, 0xB0400000);
1431 WRT_REG_DWORD(&reg->iobase_select, 0xB0600000); 1126 fw->shadow_reg[4] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
1432 fw->shadow_reg[6] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 1127
1433 1128 WRT_REG_DWORD(&reg->iobase_select, 0xB0500000);
1434 WRT_REG_DWORD(&reg->iobase_select, 0xB0700000); 1129 fw->shadow_reg[5] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
1435 fw->shadow_reg[7] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 1130
1436 1131 WRT_REG_DWORD(&reg->iobase_select, 0xB0600000);
1437 WRT_REG_DWORD(&reg->iobase_select, 0xB0800000); 1132 fw->shadow_reg[6] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
1438 fw->shadow_reg[8] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 1133
1439 1134 WRT_REG_DWORD(&reg->iobase_select, 0xB0700000);
1440 WRT_REG_DWORD(&reg->iobase_select, 0xB0900000); 1135 fw->shadow_reg[7] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
1441 fw->shadow_reg[9] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 1136
1442 1137 WRT_REG_DWORD(&reg->iobase_select, 0xB0800000);
1443 WRT_REG_DWORD(&reg->iobase_select, 0xB0A00000); 1138 fw->shadow_reg[8] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
1444 fw->shadow_reg[10] = htonl(RD_REG_DWORD(&reg->iobase_sdata)); 1139
1445 1140 WRT_REG_DWORD(&reg->iobase_select, 0xB0900000);
1446 /* RISC I/O register. */ 1141 fw->shadow_reg[9] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
1447 WRT_REG_DWORD(&reg->iobase_addr, 0x0010); 1142
1448 RD_REG_DWORD(&reg->iobase_addr); 1143 WRT_REG_DWORD(&reg->iobase_select, 0xB0A00000);
1449 fw->risc_io_reg = htonl(RD_REG_DWORD(&reg->iobase_window)); 1144 fw->shadow_reg[10] = htonl(RD_REG_DWORD(&reg->iobase_sdata));
1450 1145
1451 /* Mailbox registers. */ 1146 /* RISC I/O register. */
1452 mbx_reg = &reg->mailbox0; 1147 WRT_REG_DWORD(&reg->iobase_addr, 0x0010);
1453 for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++) 1148 fw->risc_io_reg = htonl(RD_REG_DWORD(&reg->iobase_window));
1454 fw->mailbox_reg[cnt] = htons(RD_REG_WORD(mbx_reg++)); 1149
1455 1150 /* Mailbox registers. */
1456 /* Transfer sequence registers. */ 1151 mbx_reg = &reg->mailbox0;
1457 iter_reg = fw->xseq_gp_reg; 1152 for (cnt = 0; cnt < sizeof(fw->mailbox_reg) / 2; cnt++)
1458 WRT_REG_DWORD(&reg->iobase_addr, 0xBF00); 1153 fw->mailbox_reg[cnt] = htons(RD_REG_WORD(mbx_reg++));
1459 dmp_reg = &reg->iobase_window; 1154
1460 for (cnt = 0; cnt < 16; cnt++) 1155 /* Transfer sequence registers. */
1461 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1156 iter_reg = fw->xseq_gp_reg;
1462 1157 iter_reg = qla24xx_read_window(reg, 0xBF00, 16, iter_reg);
1463 WRT_REG_DWORD(&reg->iobase_addr, 0xBF10); 1158 iter_reg = qla24xx_read_window(reg, 0xBF10, 16, iter_reg);
1464 dmp_reg = &reg->iobase_window; 1159 iter_reg = qla24xx_read_window(reg, 0xBF20, 16, iter_reg);
1465 for (cnt = 0; cnt < 16; cnt++) 1160 iter_reg = qla24xx_read_window(reg, 0xBF30, 16, iter_reg);
1466 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1161 iter_reg = qla24xx_read_window(reg, 0xBF40, 16, iter_reg);
1467 1162 iter_reg = qla24xx_read_window(reg, 0xBF50, 16, iter_reg);
1468 WRT_REG_DWORD(&reg->iobase_addr, 0xBF20); 1163 iter_reg = qla24xx_read_window(reg, 0xBF60, 16, iter_reg);
1469 dmp_reg = &reg->iobase_window; 1164 qla24xx_read_window(reg, 0xBF70, 16, iter_reg);
1470 for (cnt = 0; cnt < 16; cnt++) 1165
1471 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1166 iter_reg = fw->xseq_0_reg;
1472 1167 iter_reg = qla24xx_read_window(reg, 0xBFC0, 16, iter_reg);
1473 WRT_REG_DWORD(&reg->iobase_addr, 0xBF30); 1168 iter_reg = qla24xx_read_window(reg, 0xBFD0, 16, iter_reg);
1474 dmp_reg = &reg->iobase_window; 1169 qla24xx_read_window(reg, 0xBFE0, 16, iter_reg);
1475 for (cnt = 0; cnt < 16; cnt++) 1170
1476 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1171 qla24xx_read_window(reg, 0xBFF0, 16, fw->xseq_1_reg);
1477 1172
1478 WRT_REG_DWORD(&reg->iobase_addr, 0xBF40); 1173 /* Receive sequence registers. */
1479 dmp_reg = &reg->iobase_window; 1174 iter_reg = fw->rseq_gp_reg;
1480 for (cnt = 0; cnt < 16; cnt++) 1175 iter_reg = qla24xx_read_window(reg, 0xFF00, 16, iter_reg);
1481 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1176 iter_reg = qla24xx_read_window(reg, 0xFF10, 16, iter_reg);
1482 1177 iter_reg = qla24xx_read_window(reg, 0xFF20, 16, iter_reg);
1483 WRT_REG_DWORD(&reg->iobase_addr, 0xBF50); 1178 iter_reg = qla24xx_read_window(reg, 0xFF30, 16, iter_reg);
1484 dmp_reg = &reg->iobase_window; 1179 iter_reg = qla24xx_read_window(reg, 0xFF40, 16, iter_reg);
1485 for (cnt = 0; cnt < 16; cnt++) 1180 iter_reg = qla24xx_read_window(reg, 0xFF50, 16, iter_reg);
1486 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1181 iter_reg = qla24xx_read_window(reg, 0xFF60, 16, iter_reg);
1487 1182 qla24xx_read_window(reg, 0xFF70, 16, iter_reg);
1488 WRT_REG_DWORD(&reg->iobase_addr, 0xBF60); 1183
1489 dmp_reg = &reg->iobase_window; 1184 iter_reg = fw->rseq_0_reg;
1490 for (cnt = 0; cnt < 16; cnt++) 1185 iter_reg = qla24xx_read_window(reg, 0xFFC0, 16, iter_reg);
1491 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1186 qla24xx_read_window(reg, 0xFFD0, 16, iter_reg);
1492 1187
1493 WRT_REG_DWORD(&reg->iobase_addr, 0xBF70); 1188 qla24xx_read_window(reg, 0xFFE0, 16, fw->rseq_1_reg);
1494 dmp_reg = &reg->iobase_window; 1189 qla24xx_read_window(reg, 0xFFF0, 16, fw->rseq_2_reg);
1495 for (cnt = 0; cnt < 16; cnt++) 1190
1496 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1191 /* Auxiliary sequence registers. */
1497 1192 iter_reg = fw->aseq_gp_reg;
1498 iter_reg = fw->xseq_0_reg; 1193 iter_reg = qla24xx_read_window(reg, 0xB000, 16, iter_reg);
1499 WRT_REG_DWORD(&reg->iobase_addr, 0xBFC0); 1194 iter_reg = qla24xx_read_window(reg, 0xB010, 16, iter_reg);
1500 dmp_reg = &reg->iobase_window; 1195 iter_reg = qla24xx_read_window(reg, 0xB020, 16, iter_reg);
1501 for (cnt = 0; cnt < 16; cnt++) 1196 iter_reg = qla24xx_read_window(reg, 0xB030, 16, iter_reg);
1502 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1197 iter_reg = qla24xx_read_window(reg, 0xB040, 16, iter_reg);
1503 1198 iter_reg = qla24xx_read_window(reg, 0xB050, 16, iter_reg);
1504 WRT_REG_DWORD(&reg->iobase_addr, 0xBFD0); 1199 iter_reg = qla24xx_read_window(reg, 0xB060, 16, iter_reg);
1505 dmp_reg = &reg->iobase_window; 1200 qla24xx_read_window(reg, 0xB070, 16, iter_reg);
1506 for (cnt = 0; cnt < 16; cnt++) 1201
1507 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1202 iter_reg = fw->aseq_0_reg;
1508 1203 iter_reg = qla24xx_read_window(reg, 0xB0C0, 16, iter_reg);
1509 WRT_REG_DWORD(&reg->iobase_addr, 0xBFE0); 1204 qla24xx_read_window(reg, 0xB0D0, 16, iter_reg);
1510 dmp_reg = &reg->iobase_window; 1205
1511 for (cnt = 0; cnt < 16; cnt++) 1206 qla24xx_read_window(reg, 0xB0E0, 16, fw->aseq_1_reg);
1512 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1207 qla24xx_read_window(reg, 0xB0F0, 16, fw->aseq_2_reg);
1513 1208
1514 WRT_REG_DWORD(&reg->iobase_addr, 0xBFF0); 1209 /* Command DMA registers. */
1515 dmp_reg = &reg->iobase_window; 1210 qla24xx_read_window(reg, 0x7100, 16, fw->cmd_dma_reg);
1516 for (cnt = 0; cnt < sizeof(fw->xseq_1_reg) / 4; cnt++) 1211
1517 fw->xseq_1_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++)); 1212 /* Queues. */
1518 1213 iter_reg = fw->req0_dma_reg;
1519 /* Receive sequence registers. */ 1214 iter_reg = qla24xx_read_window(reg, 0x7200, 8, iter_reg);
1520 iter_reg = fw->rseq_gp_reg; 1215 dmp_reg = &reg->iobase_q;
1521 WRT_REG_DWORD(&reg->iobase_addr, 0xFF00); 1216 for (cnt = 0; cnt < 7; cnt++)
1522 dmp_reg = &reg->iobase_window; 1217 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1523 for (cnt = 0; cnt < 16; cnt++) 1218
1524 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1219 iter_reg = fw->resp0_dma_reg;
1525 1220 iter_reg = qla24xx_read_window(reg, 0x7300, 8, iter_reg);
1526 WRT_REG_DWORD(&reg->iobase_addr, 0xFF10); 1221 dmp_reg = &reg->iobase_q;
1527 dmp_reg = &reg->iobase_window; 1222 for (cnt = 0; cnt < 7; cnt++)
1528 for (cnt = 0; cnt < 16; cnt++) 1223 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1529 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1224
1530 1225 iter_reg = fw->req1_dma_reg;
1531 WRT_REG_DWORD(&reg->iobase_addr, 0xFF20); 1226 iter_reg = qla24xx_read_window(reg, 0x7400, 8, iter_reg);
1532 dmp_reg = &reg->iobase_window; 1227 dmp_reg = &reg->iobase_q;
1533 for (cnt = 0; cnt < 16; cnt++) 1228 for (cnt = 0; cnt < 7; cnt++)
1534 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1229 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1535 1230
1536 WRT_REG_DWORD(&reg->iobase_addr, 0xFF30); 1231 /* Transmit DMA registers. */
1537 dmp_reg = &reg->iobase_window; 1232 iter_reg = fw->xmt0_dma_reg;
1538 for (cnt = 0; cnt < 16; cnt++) 1233 iter_reg = qla24xx_read_window(reg, 0x7600, 16, iter_reg);
1539 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1234 qla24xx_read_window(reg, 0x7610, 16, iter_reg);
1540 1235
1541 WRT_REG_DWORD(&reg->iobase_addr, 0xFF40); 1236 iter_reg = fw->xmt1_dma_reg;
1542 dmp_reg = &reg->iobase_window; 1237 iter_reg = qla24xx_read_window(reg, 0x7620, 16, iter_reg);
1543 for (cnt = 0; cnt < 16; cnt++) 1238 qla24xx_read_window(reg, 0x7630, 16, iter_reg);
1544 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1239
1545 1240 iter_reg = fw->xmt2_dma_reg;
1546 WRT_REG_DWORD(&reg->iobase_addr, 0xFF50); 1241 iter_reg = qla24xx_read_window(reg, 0x7640, 16, iter_reg);
1547 dmp_reg = &reg->iobase_window; 1242 qla24xx_read_window(reg, 0x7650, 16, iter_reg);
1548 for (cnt = 0; cnt < 16; cnt++) 1243
1549 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1244 iter_reg = fw->xmt3_dma_reg;
1550 1245 iter_reg = qla24xx_read_window(reg, 0x7660, 16, iter_reg);
1551 WRT_REG_DWORD(&reg->iobase_addr, 0xFF60); 1246 qla24xx_read_window(reg, 0x7670, 16, iter_reg);
1552 dmp_reg = &reg->iobase_window; 1247
1553 for (cnt = 0; cnt < 16; cnt++) 1248 iter_reg = fw->xmt4_dma_reg;
1554 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1249 iter_reg = qla24xx_read_window(reg, 0x7680, 16, iter_reg);
1555 1250 qla24xx_read_window(reg, 0x7690, 16, iter_reg);
1556 WRT_REG_DWORD(&reg->iobase_addr, 0xFF70); 1251
1557 dmp_reg = &reg->iobase_window; 1252 qla24xx_read_window(reg, 0x76A0, 16, fw->xmt_data_dma_reg);
1558 for (cnt = 0; cnt < 16; cnt++) 1253
1559 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1254 /* Receive DMA registers. */
1560 1255 iter_reg = fw->rcvt0_data_dma_reg;
1561 iter_reg = fw->rseq_0_reg; 1256 iter_reg = qla24xx_read_window(reg, 0x7700, 16, iter_reg);
1562 WRT_REG_DWORD(&reg->iobase_addr, 0xFFC0); 1257 qla24xx_read_window(reg, 0x7710, 16, iter_reg);
1563 dmp_reg = &reg->iobase_window; 1258
1564 for (cnt = 0; cnt < 16; cnt++) 1259 iter_reg = fw->rcvt1_data_dma_reg;
1565 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1260 iter_reg = qla24xx_read_window(reg, 0x7720, 16, iter_reg);
1566 1261 qla24xx_read_window(reg, 0x7730, 16, iter_reg);
1567 WRT_REG_DWORD(&reg->iobase_addr, 0xFFD0); 1262
1568 dmp_reg = &reg->iobase_window; 1263 /* RISC registers. */
1569 for (cnt = 0; cnt < 16; cnt++) 1264 iter_reg = fw->risc_gp_reg;
1570 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1265 iter_reg = qla24xx_read_window(reg, 0x0F00, 16, iter_reg);
1571 1266 iter_reg = qla24xx_read_window(reg, 0x0F10, 16, iter_reg);
1572 WRT_REG_DWORD(&reg->iobase_addr, 0xFFE0); 1267 iter_reg = qla24xx_read_window(reg, 0x0F20, 16, iter_reg);
1573 dmp_reg = &reg->iobase_window; 1268 iter_reg = qla24xx_read_window(reg, 0x0F30, 16, iter_reg);
1574 for (cnt = 0; cnt < sizeof(fw->rseq_1_reg) / 4; cnt++) 1269 iter_reg = qla24xx_read_window(reg, 0x0F40, 16, iter_reg);
1575 fw->rseq_1_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++)); 1270 iter_reg = qla24xx_read_window(reg, 0x0F50, 16, iter_reg);
1576 1271 iter_reg = qla24xx_read_window(reg, 0x0F60, 16, iter_reg);
1577 WRT_REG_DWORD(&reg->iobase_addr, 0xFFF0); 1272 qla24xx_read_window(reg, 0x0F70, 16, iter_reg);
1578 dmp_reg = &reg->iobase_window; 1273
1579 for (cnt = 0; cnt < sizeof(fw->rseq_2_reg) / 4; cnt++) 1274 /* Local memory controller registers. */
1580 fw->rseq_2_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++)); 1275 iter_reg = fw->lmc_reg;
1581 1276 iter_reg = qla24xx_read_window(reg, 0x3000, 16, iter_reg);
1582 /* Auxiliary sequence registers. */ 1277 iter_reg = qla24xx_read_window(reg, 0x3010, 16, iter_reg);
1583 iter_reg = fw->aseq_gp_reg; 1278 iter_reg = qla24xx_read_window(reg, 0x3020, 16, iter_reg);
1584 WRT_REG_DWORD(&reg->iobase_addr, 0xB000); 1279 iter_reg = qla24xx_read_window(reg, 0x3030, 16, iter_reg);
1585 dmp_reg = &reg->iobase_window; 1280 iter_reg = qla24xx_read_window(reg, 0x3040, 16, iter_reg);
1586 for (cnt = 0; cnt < 16; cnt++) 1281 iter_reg = qla24xx_read_window(reg, 0x3050, 16, iter_reg);
1587 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1282 iter_reg = qla24xx_read_window(reg, 0x3060, 16, iter_reg);
1588 1283 qla24xx_read_window(reg, 0x3070, 16, iter_reg);
1589 WRT_REG_DWORD(&reg->iobase_addr, 0xB010); 1284
1590 dmp_reg = &reg->iobase_window; 1285 /* Fibre Protocol Module registers. */
1591 for (cnt = 0; cnt < 16; cnt++) 1286 iter_reg = fw->fpm_hdw_reg;
1592 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1287 iter_reg = qla24xx_read_window(reg, 0x4000, 16, iter_reg);
1593 1288 iter_reg = qla24xx_read_window(reg, 0x4010, 16, iter_reg);
1594 WRT_REG_DWORD(&reg->iobase_addr, 0xB020); 1289 iter_reg = qla24xx_read_window(reg, 0x4020, 16, iter_reg);
1595 dmp_reg = &reg->iobase_window; 1290 iter_reg = qla24xx_read_window(reg, 0x4030, 16, iter_reg);
1596 for (cnt = 0; cnt < 16; cnt++) 1291 iter_reg = qla24xx_read_window(reg, 0x4040, 16, iter_reg);
1597 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1292 iter_reg = qla24xx_read_window(reg, 0x4050, 16, iter_reg);
1598 1293 iter_reg = qla24xx_read_window(reg, 0x4060, 16, iter_reg);
1599 WRT_REG_DWORD(&reg->iobase_addr, 0xB030); 1294 iter_reg = qla24xx_read_window(reg, 0x4070, 16, iter_reg);
1600 dmp_reg = &reg->iobase_window; 1295 iter_reg = qla24xx_read_window(reg, 0x4080, 16, iter_reg);
1601 for (cnt = 0; cnt < 16; cnt++) 1296 iter_reg = qla24xx_read_window(reg, 0x4090, 16, iter_reg);
1602 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1297 iter_reg = qla24xx_read_window(reg, 0x40A0, 16, iter_reg);
1603 1298 qla24xx_read_window(reg, 0x40B0, 16, iter_reg);
1604 WRT_REG_DWORD(&reg->iobase_addr, 0xB040); 1299
1605 dmp_reg = &reg->iobase_window; 1300 /* Frame Buffer registers. */
1606 for (cnt = 0; cnt < 16; cnt++) 1301 iter_reg = fw->fb_hdw_reg;
1607 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1302 iter_reg = qla24xx_read_window(reg, 0x6000, 16, iter_reg);
1608 1303 iter_reg = qla24xx_read_window(reg, 0x6010, 16, iter_reg);
1609 WRT_REG_DWORD(&reg->iobase_addr, 0xB050); 1304 iter_reg = qla24xx_read_window(reg, 0x6020, 16, iter_reg);
1610 dmp_reg = &reg->iobase_window; 1305 iter_reg = qla24xx_read_window(reg, 0x6030, 16, iter_reg);
1611 for (cnt = 0; cnt < 16; cnt++) 1306 iter_reg = qla24xx_read_window(reg, 0x6040, 16, iter_reg);
1612 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1307 iter_reg = qla24xx_read_window(reg, 0x6100, 16, iter_reg);
1613 1308 iter_reg = qla24xx_read_window(reg, 0x6130, 16, iter_reg);
1614 WRT_REG_DWORD(&reg->iobase_addr, 0xB060); 1309 iter_reg = qla24xx_read_window(reg, 0x6150, 16, iter_reg);
1615 dmp_reg = &reg->iobase_window; 1310 iter_reg = qla24xx_read_window(reg, 0x6170, 16, iter_reg);
1616 for (cnt = 0; cnt < 16; cnt++) 1311 iter_reg = qla24xx_read_window(reg, 0x6190, 16, iter_reg);
1617 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1312 iter_reg = qla24xx_read_window(reg, 0x61B0, 16, iter_reg);
1618 1313 qla24xx_read_window(reg, 0x6F00, 16, iter_reg);
1619 WRT_REG_DWORD(&reg->iobase_addr, 0xB070); 1314
1620 dmp_reg = &reg->iobase_window; 1315 rval = qla24xx_soft_reset(ha);
1621 for (cnt = 0; cnt < 16; cnt++) 1316 if (rval != QLA_SUCCESS)
1622 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1317 goto qla25xx_fw_dump_failed_0;
1623 1318
1624 iter_reg = fw->aseq_0_reg; 1319 rval = qla24xx_dump_memory(ha, fw->code_ram, sizeof(fw->code_ram),
1625 WRT_REG_DWORD(&reg->iobase_addr, 0xB0C0); 1320 fw->ext_mem, &nxt);
1626 dmp_reg = &reg->iobase_window; 1321 if (rval != QLA_SUCCESS)
1627 for (cnt = 0; cnt < 16; cnt++) 1322 goto qla25xx_fw_dump_failed_0;
1628 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1323
1629 1324 nxt = qla2xxx_copy_queues(ha, nxt);
1630 WRT_REG_DWORD(&reg->iobase_addr, 0xB0D0); 1325 if (ha->eft)
1631 dmp_reg = &reg->iobase_window; 1326 memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size));
1632 for (cnt = 0; cnt < 16; cnt++) 1327
1633 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++)); 1328qla25xx_fw_dump_failed_0:
1634
1635 WRT_REG_DWORD(&reg->iobase_addr, 0xB0E0);
1636 dmp_reg = &reg->iobase_window;
1637 for (cnt = 0; cnt < sizeof(fw->aseq_1_reg) / 4; cnt++)
1638 fw->aseq_1_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
1639
1640 WRT_REG_DWORD(&reg->iobase_addr, 0xB0F0);
1641 dmp_reg = &reg->iobase_window;
1642 for (cnt = 0; cnt < sizeof(fw->aseq_2_reg) / 4; cnt++)
1643 fw->aseq_2_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
1644
1645 /* Command DMA registers. */
1646 WRT_REG_DWORD(&reg->iobase_addr, 0x7100);
1647 dmp_reg = &reg->iobase_window;
1648 for (cnt = 0; cnt < sizeof(fw->cmd_dma_reg) / 4; cnt++)
1649 fw->cmd_dma_reg[cnt] = htonl(RD_REG_DWORD(dmp_reg++));
1650
1651 /* Queues. */
1652 iter_reg = fw->req0_dma_reg;
1653 WRT_REG_DWORD(&reg->iobase_addr, 0x7200);
1654 dmp_reg = &reg->iobase_window;
1655 for (cnt = 0; cnt < 8; cnt++)
1656 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1657
1658 dmp_reg = &reg->iobase_q;
1659 for (cnt = 0; cnt < 7; cnt++)
1660 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1661
1662 iter_reg = fw->resp0_dma_reg;
1663 WRT_REG_DWORD(&reg->iobase_addr, 0x7300);
1664 dmp_reg = &reg->iobase_window;
1665 for (cnt = 0; cnt < 8; cnt++)
1666 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1667
1668 dmp_reg = &reg->iobase_q;
1669 for (cnt = 0; cnt < 7; cnt++)
1670 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1671
1672 iter_reg = fw->req1_dma_reg;
1673 WRT_REG_DWORD(&reg->iobase_addr, 0x7400);
1674 dmp_reg = &reg->iobase_window;
1675 for (cnt = 0; cnt < 8; cnt++)
1676 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1677
1678 dmp_reg = &reg->iobase_q;
1679 for (cnt = 0; cnt < 7; cnt++)
1680 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1681
1682 /* Transmit DMA registers. */
1683 iter_reg = fw->xmt0_dma_reg;
1684 WRT_REG_DWORD(&reg->iobase_addr, 0x7600);
1685 dmp_reg = &reg->iobase_window;
1686 for (cnt = 0; cnt < 16; cnt++)
1687 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1688
1689 WRT_REG_DWORD(&reg->iobase_addr, 0x7610);
1690 dmp_reg = &reg->iobase_window;
1691 for (cnt = 0; cnt < 16; cnt++)
1692 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1693
1694 iter_reg = fw->xmt1_dma_reg;
1695 WRT_REG_DWORD(&reg->iobase_addr, 0x7620);
1696 dmp_reg = &reg->iobase_window;
1697 for (cnt = 0; cnt < 16; cnt++)
1698 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1699
1700 WRT_REG_DWORD(&reg->iobase_addr, 0x7630);
1701 dmp_reg = &reg->iobase_window;
1702 for (cnt = 0; cnt < 16; cnt++)
1703 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1704
1705 iter_reg = fw->xmt2_dma_reg;
1706 WRT_REG_DWORD(&reg->iobase_addr, 0x7640);
1707 dmp_reg = &reg->iobase_window;
1708 for (cnt = 0; cnt < 16; cnt++)
1709 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1710
1711 WRT_REG_DWORD(&reg->iobase_addr, 0x7650);
1712 dmp_reg = &reg->iobase_window;
1713 for (cnt = 0; cnt < 16; cnt++)
1714 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1715
1716 iter_reg = fw->xmt3_dma_reg;
1717 WRT_REG_DWORD(&reg->iobase_addr, 0x7660);
1718 dmp_reg = &reg->iobase_window;
1719 for (cnt = 0; cnt < 16; cnt++)
1720 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1721
1722 WRT_REG_DWORD(&reg->iobase_addr, 0x7670);
1723 dmp_reg = &reg->iobase_window;
1724 for (cnt = 0; cnt < 16; cnt++)
1725 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1726
1727 iter_reg = fw->xmt4_dma_reg;
1728 WRT_REG_DWORD(&reg->iobase_addr, 0x7680);
1729 dmp_reg = &reg->iobase_window;
1730 for (cnt = 0; cnt < 16; cnt++)
1731 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1732
1733 WRT_REG_DWORD(&reg->iobase_addr, 0x7690);
1734 dmp_reg = &reg->iobase_window;
1735 for (cnt = 0; cnt < 16; cnt++)
1736 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1737
1738 WRT_REG_DWORD(&reg->iobase_addr, 0x76A0);
1739 dmp_reg = &reg->iobase_window;
1740 for (cnt = 0; cnt < sizeof(fw->xmt_data_dma_reg) / 4; cnt++)
1741 fw->xmt_data_dma_reg[cnt] =
1742 htonl(RD_REG_DWORD(dmp_reg++));
1743
1744 /* Receive DMA registers. */
1745 iter_reg = fw->rcvt0_data_dma_reg;
1746 WRT_REG_DWORD(&reg->iobase_addr, 0x7700);
1747 dmp_reg = &reg->iobase_window;
1748 for (cnt = 0; cnt < 16; cnt++)
1749 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1750
1751 WRT_REG_DWORD(&reg->iobase_addr, 0x7710);
1752 dmp_reg = &reg->iobase_window;
1753 for (cnt = 0; cnt < 16; cnt++)
1754 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1755
1756 iter_reg = fw->rcvt1_data_dma_reg;
1757 WRT_REG_DWORD(&reg->iobase_addr, 0x7720);
1758 dmp_reg = &reg->iobase_window;
1759 for (cnt = 0; cnt < 16; cnt++)
1760 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1761
1762 WRT_REG_DWORD(&reg->iobase_addr, 0x7730);
1763 dmp_reg = &reg->iobase_window;
1764 for (cnt = 0; cnt < 16; cnt++)
1765 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1766
1767 /* RISC registers. */
1768 iter_reg = fw->risc_gp_reg;
1769 WRT_REG_DWORD(&reg->iobase_addr, 0x0F00);
1770 dmp_reg = &reg->iobase_window;
1771 for (cnt = 0; cnt < 16; cnt++)
1772 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1773
1774 WRT_REG_DWORD(&reg->iobase_addr, 0x0F10);
1775 dmp_reg = &reg->iobase_window;
1776 for (cnt = 0; cnt < 16; cnt++)
1777 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1778
1779 WRT_REG_DWORD(&reg->iobase_addr, 0x0F20);
1780 dmp_reg = &reg->iobase_window;
1781 for (cnt = 0; cnt < 16; cnt++)
1782 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1783
1784 WRT_REG_DWORD(&reg->iobase_addr, 0x0F30);
1785 dmp_reg = &reg->iobase_window;
1786 for (cnt = 0; cnt < 16; cnt++)
1787 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1788
1789 WRT_REG_DWORD(&reg->iobase_addr, 0x0F40);
1790 dmp_reg = &reg->iobase_window;
1791 for (cnt = 0; cnt < 16; cnt++)
1792 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1793
1794 WRT_REG_DWORD(&reg->iobase_addr, 0x0F50);
1795 dmp_reg = &reg->iobase_window;
1796 for (cnt = 0; cnt < 16; cnt++)
1797 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1798
1799 WRT_REG_DWORD(&reg->iobase_addr, 0x0F60);
1800 dmp_reg = &reg->iobase_window;
1801 for (cnt = 0; cnt < 16; cnt++)
1802 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1803
1804 WRT_REG_DWORD(&reg->iobase_addr, 0x0F70);
1805 dmp_reg = &reg->iobase_window;
1806 for (cnt = 0; cnt < 16; cnt++)
1807 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1808
1809 /* Local memory controller registers. */
1810 iter_reg = fw->lmc_reg;
1811 WRT_REG_DWORD(&reg->iobase_addr, 0x3000);
1812 dmp_reg = &reg->iobase_window;
1813 for (cnt = 0; cnt < 16; cnt++)
1814 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1815
1816 WRT_REG_DWORD(&reg->iobase_addr, 0x3010);
1817 dmp_reg = &reg->iobase_window;
1818 for (cnt = 0; cnt < 16; cnt++)
1819 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1820
1821 WRT_REG_DWORD(&reg->iobase_addr, 0x3020);
1822 dmp_reg = &reg->iobase_window;
1823 for (cnt = 0; cnt < 16; cnt++)
1824 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1825
1826 WRT_REG_DWORD(&reg->iobase_addr, 0x3030);
1827 dmp_reg = &reg->iobase_window;
1828 for (cnt = 0; cnt < 16; cnt++)
1829 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1830
1831 WRT_REG_DWORD(&reg->iobase_addr, 0x3040);
1832 dmp_reg = &reg->iobase_window;
1833 for (cnt = 0; cnt < 16; cnt++)
1834 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1835
1836 WRT_REG_DWORD(&reg->iobase_addr, 0x3050);
1837 dmp_reg = &reg->iobase_window;
1838 for (cnt = 0; cnt < 16; cnt++)
1839 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1840
1841 WRT_REG_DWORD(&reg->iobase_addr, 0x3060);
1842 dmp_reg = &reg->iobase_window;
1843 for (cnt = 0; cnt < 16; cnt++)
1844 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1845
1846 WRT_REG_DWORD(&reg->iobase_addr, 0x3070);
1847 dmp_reg = &reg->iobase_window;
1848 for (cnt = 0; cnt < 16; cnt++)
1849 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1850
1851 /* Fibre Protocol Module registers. */
1852 iter_reg = fw->fpm_hdw_reg;
1853 WRT_REG_DWORD(&reg->iobase_addr, 0x4000);
1854 dmp_reg = &reg->iobase_window;
1855 for (cnt = 0; cnt < 16; cnt++)
1856 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1857
1858 WRT_REG_DWORD(&reg->iobase_addr, 0x4010);
1859 dmp_reg = &reg->iobase_window;
1860 for (cnt = 0; cnt < 16; cnt++)
1861 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1862
1863 WRT_REG_DWORD(&reg->iobase_addr, 0x4020);
1864 dmp_reg = &reg->iobase_window;
1865 for (cnt = 0; cnt < 16; cnt++)
1866 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1867
1868 WRT_REG_DWORD(&reg->iobase_addr, 0x4030);
1869 dmp_reg = &reg->iobase_window;
1870 for (cnt = 0; cnt < 16; cnt++)
1871 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1872
1873 WRT_REG_DWORD(&reg->iobase_addr, 0x4040);
1874 dmp_reg = &reg->iobase_window;
1875 for (cnt = 0; cnt < 16; cnt++)
1876 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1877
1878 WRT_REG_DWORD(&reg->iobase_addr, 0x4050);
1879 dmp_reg = &reg->iobase_window;
1880 for (cnt = 0; cnt < 16; cnt++)
1881 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1882
1883 WRT_REG_DWORD(&reg->iobase_addr, 0x4060);
1884 dmp_reg = &reg->iobase_window;
1885 for (cnt = 0; cnt < 16; cnt++)
1886 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1887
1888 WRT_REG_DWORD(&reg->iobase_addr, 0x4070);
1889 dmp_reg = &reg->iobase_window;
1890 for (cnt = 0; cnt < 16; cnt++)
1891 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1892
1893 WRT_REG_DWORD(&reg->iobase_addr, 0x4080);
1894 dmp_reg = &reg->iobase_window;
1895 for (cnt = 0; cnt < 16; cnt++)
1896 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1897
1898 WRT_REG_DWORD(&reg->iobase_addr, 0x4090);
1899 dmp_reg = &reg->iobase_window;
1900 for (cnt = 0; cnt < 16; cnt++)
1901 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1902
1903 WRT_REG_DWORD(&reg->iobase_addr, 0x40A0);
1904 dmp_reg = &reg->iobase_window;
1905 for (cnt = 0; cnt < 16; cnt++)
1906 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1907
1908 WRT_REG_DWORD(&reg->iobase_addr, 0x40B0);
1909 dmp_reg = &reg->iobase_window;
1910 for (cnt = 0; cnt < 16; cnt++)
1911 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1912
1913 /* Frame Buffer registers. */
1914 iter_reg = fw->fb_hdw_reg;
1915 WRT_REG_DWORD(&reg->iobase_addr, 0x6000);
1916 dmp_reg = &reg->iobase_window;
1917 for (cnt = 0; cnt < 16; cnt++)
1918 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1919
1920 WRT_REG_DWORD(&reg->iobase_addr, 0x6010);
1921 dmp_reg = &reg->iobase_window;
1922 for (cnt = 0; cnt < 16; cnt++)
1923 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1924
1925 WRT_REG_DWORD(&reg->iobase_addr, 0x6020);
1926 dmp_reg = &reg->iobase_window;
1927 for (cnt = 0; cnt < 16; cnt++)
1928 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1929
1930 WRT_REG_DWORD(&reg->iobase_addr, 0x6030);
1931 dmp_reg = &reg->iobase_window;
1932 for (cnt = 0; cnt < 16; cnt++)
1933 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1934
1935 WRT_REG_DWORD(&reg->iobase_addr, 0x6040);
1936 dmp_reg = &reg->iobase_window;
1937 for (cnt = 0; cnt < 16; cnt++)
1938 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1939
1940 WRT_REG_DWORD(&reg->iobase_addr, 0x6100);
1941 dmp_reg = &reg->iobase_window;
1942 for (cnt = 0; cnt < 16; cnt++)
1943 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1944
1945 WRT_REG_DWORD(&reg->iobase_addr, 0x6130);
1946 dmp_reg = &reg->iobase_window;
1947 for (cnt = 0; cnt < 16; cnt++)
1948 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1949
1950 WRT_REG_DWORD(&reg->iobase_addr, 0x6150);
1951 dmp_reg = &reg->iobase_window;
1952 for (cnt = 0; cnt < 16; cnt++)
1953 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1954
1955 WRT_REG_DWORD(&reg->iobase_addr, 0x6170);
1956 dmp_reg = &reg->iobase_window;
1957 for (cnt = 0; cnt < 16; cnt++)
1958 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1959
1960 WRT_REG_DWORD(&reg->iobase_addr, 0x6190);
1961 dmp_reg = &reg->iobase_window;
1962 for (cnt = 0; cnt < 16; cnt++)
1963 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1964
1965 WRT_REG_DWORD(&reg->iobase_addr, 0x61B0);
1966 dmp_reg = &reg->iobase_window;
1967 for (cnt = 0; cnt < 16; cnt++)
1968 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1969
1970 WRT_REG_DWORD(&reg->iobase_addr, 0x6F00);
1971 dmp_reg = &reg->iobase_window;
1972 for (cnt = 0; cnt < 16; cnt++)
1973 *iter_reg++ = htonl(RD_REG_DWORD(dmp_reg++));
1974
1975 /* Reset RISC. */
1976 WRT_REG_DWORD(&reg->ctrl_status,
1977 CSRX_DMA_SHUTDOWN|MWB_4096_BYTES);
1978 for (cnt = 0; cnt < 30000; cnt++) {
1979 if ((RD_REG_DWORD(&reg->ctrl_status) &
1980 CSRX_DMA_ACTIVE) == 0)
1981 break;
1982
1983 udelay(10);
1984 }
1985
1986 WRT_REG_DWORD(&reg->ctrl_status,
1987 CSRX_ISP_SOFT_RESET|CSRX_DMA_SHUTDOWN|MWB_4096_BYTES);
1988 pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
1989
1990 udelay(100);
1991 /* Wait for firmware to complete NVRAM accesses. */
1992 mb0 = (uint32_t) RD_REG_WORD(&reg->mailbox0);
1993 for (cnt = 10000 ; cnt && mb0; cnt--) {
1994 udelay(5);
1995 mb0 = (uint32_t) RD_REG_WORD(&reg->mailbox0);
1996 barrier();
1997 }
1998
1999 /* Wait for soft-reset to complete. */
2000 for (cnt = 0; cnt < 30000; cnt++) {
2001 if ((RD_REG_DWORD(&reg->ctrl_status) &
2002 CSRX_ISP_SOFT_RESET) == 0)
2003 break;
2004
2005 udelay(10);
2006 }
2007 WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_RESET);
2008 RD_REG_DWORD(&reg->hccr); /* PCI Posting. */
2009 }
2010
2011 for (cnt = 30000; RD_REG_WORD(&reg->mailbox0) != 0 &&
2012 rval == QLA_SUCCESS; cnt--) {
2013 if (cnt)
2014 udelay(100);
2015 else
2016 rval = QLA_FUNCTION_TIMEOUT;
2017 }
2018
2019 if (rval == QLA_SUCCESS)
2020 rval = qla2xxx_dump_memory(ha, fw->code_ram,
2021 sizeof(fw->code_ram), fw->ext_mem, &nxt);
2022
2023 if (rval == QLA_SUCCESS) {
2024 nxt = qla2xxx_copy_queues(ha, nxt);
2025 if (ha->eft)
2026 memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size));
2027 }
2028
2029 if (rval != QLA_SUCCESS) { 1329 if (rval != QLA_SUCCESS) {
2030 qla_printk(KERN_WARNING, ha, 1330 qla_printk(KERN_WARNING, ha,
2031 "Failed to dump firmware (%x)!!!\n", rval); 1331 "Failed to dump firmware (%x)!!!\n", rval);
@@ -2102,7 +1402,7 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd)
2102 struct scsi_qla_host *ha; 1402 struct scsi_qla_host *ha;
2103 srb_t *sp; 1403 srb_t *sp;
2104 1404
2105 ha = (struct scsi_qla_host *)cmd->device->host->hostdata; 1405 ha = shost_priv(cmd->device->host);
2106 1406
2107 sp = (srb_t *) cmd->SCp.ptr; 1407 sp = (srb_t *) cmd->SCp.ptr;
2108 printk("SCSI Command @=0x%p, Handle=0x%p\n", cmd, cmd->host_scribble); 1408 printk("SCSI Command @=0x%p, Handle=0x%p\n", cmd, cmd->host_scribble);