diff options
author | Anirban Chakraborty <anirban.chakraborty@qlogic.com> | 2008-11-06 13:40:19 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-12-29 12:24:15 -0500 |
commit | 7b867cf76fbcc8d77867cbec6f509f71dce8a98f (patch) | |
tree | ef5fcc1e21701ed1baa1b131c7c29f29cd41d5d6 /drivers/scsi/qla2xxx/qla_dbg.c | |
parent | a9b589d90e3d7748dae459031c2d912cd9e83c88 (diff) |
[SCSI] qla2xxx: Refactor qla data structures
Following changes have been made to the qla2xxx FC driver in
preparation for the multi- queue and future SR IOV hardware.
1. scsi_qla_host structure has been changed to contain scsi host
specific data only.
2. A new structure, qla_hw_data is created to contain HBA specific
hardware data.
3. Request and response IO specific data strucures are created.
4. The global list of fcports for the hba is not maintained anymore,
instead a fcport list is construted on per scsi_qla_host.
Signed-of-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_dbg.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_dbg.c | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c index 510ba64bc286..f15f903aec55 100644 --- a/drivers/scsi/qla2xxx/qla_dbg.c +++ b/drivers/scsi/qla2xxx/qla_dbg.c | |||
@@ -9,7 +9,7 @@ | |||
9 | #include <linux/delay.h> | 9 | #include <linux/delay.h> |
10 | 10 | ||
11 | static inline void | 11 | static inline void |
12 | qla2xxx_prep_dump(scsi_qla_host_t *ha, struct qla2xxx_fw_dump *fw_dump) | 12 | qla2xxx_prep_dump(struct qla_hw_data *ha, struct qla2xxx_fw_dump *fw_dump) |
13 | { | 13 | { |
14 | fw_dump->fw_major_version = htonl(ha->fw_major_version); | 14 | fw_dump->fw_major_version = htonl(ha->fw_major_version); |
15 | fw_dump->fw_minor_version = htonl(ha->fw_minor_version); | 15 | fw_dump->fw_minor_version = htonl(ha->fw_minor_version); |
@@ -23,22 +23,25 @@ qla2xxx_prep_dump(scsi_qla_host_t *ha, struct qla2xxx_fw_dump *fw_dump) | |||
23 | } | 23 | } |
24 | 24 | ||
25 | static inline void * | 25 | static inline void * |
26 | qla2xxx_copy_queues(scsi_qla_host_t *ha, void *ptr) | 26 | qla2xxx_copy_queues(scsi_qla_host_t *vha, void *ptr) |
27 | { | 27 | { |
28 | struct req_que *req = vha->hw->req; | ||
29 | struct rsp_que *rsp = vha->hw->rsp; | ||
30 | |||
28 | /* Request queue. */ | 31 | /* Request queue. */ |
29 | memcpy(ptr, ha->request_ring, ha->request_q_length * | 32 | memcpy(ptr, req->ring, req->length * |
30 | sizeof(request_t)); | 33 | sizeof(request_t)); |
31 | 34 | ||
32 | /* Response queue. */ | 35 | /* Response queue. */ |
33 | ptr += ha->request_q_length * sizeof(request_t); | 36 | ptr += req->length * sizeof(request_t); |
34 | memcpy(ptr, ha->response_ring, ha->response_q_length * | 37 | memcpy(ptr, rsp->ring, rsp->length * |
35 | sizeof(response_t)); | 38 | sizeof(response_t)); |
36 | 39 | ||
37 | return ptr + (ha->response_q_length * sizeof(response_t)); | 40 | return ptr + (rsp->length * sizeof(response_t)); |
38 | } | 41 | } |
39 | 42 | ||
40 | static int | 43 | static int |
41 | qla24xx_dump_ram(scsi_qla_host_t *ha, uint32_t addr, uint32_t *ram, | 44 | qla24xx_dump_ram(struct qla_hw_data *ha, uint32_t addr, uint32_t *ram, |
42 | uint32_t ram_dwords, void **nxt) | 45 | uint32_t ram_dwords, void **nxt) |
43 | { | 46 | { |
44 | int rval; | 47 | int rval; |
@@ -112,7 +115,7 @@ qla24xx_dump_ram(scsi_qla_host_t *ha, uint32_t addr, uint32_t *ram, | |||
112 | } | 115 | } |
113 | 116 | ||
114 | static int | 117 | static int |
115 | qla24xx_dump_memory(scsi_qla_host_t *ha, uint32_t *code_ram, | 118 | qla24xx_dump_memory(struct qla_hw_data *ha, uint32_t *code_ram, |
116 | uint32_t cram_size, void **nxt) | 119 | uint32_t cram_size, void **nxt) |
117 | { | 120 | { |
118 | int rval; | 121 | int rval; |
@@ -163,7 +166,7 @@ qla24xx_pause_risc(struct device_reg_24xx __iomem *reg) | |||
163 | } | 166 | } |
164 | 167 | ||
165 | static int | 168 | static int |
166 | qla24xx_soft_reset(scsi_qla_host_t *ha) | 169 | qla24xx_soft_reset(struct qla_hw_data *ha) |
167 | { | 170 | { |
168 | int rval = QLA_SUCCESS; | 171 | int rval = QLA_SUCCESS; |
169 | uint32_t cnt; | 172 | uint32_t cnt; |
@@ -215,8 +218,8 @@ qla24xx_soft_reset(scsi_qla_host_t *ha) | |||
215 | } | 218 | } |
216 | 219 | ||
217 | static int | 220 | static int |
218 | qla2xxx_dump_ram(scsi_qla_host_t *ha, uint32_t addr, uint16_t *ram, | 221 | qla2xxx_dump_ram(struct qla_hw_data *ha, uint32_t addr, uint16_t *ram, |
219 | uint32_t ram_words, void **nxt) | 222 | uint16_t ram_words, void **nxt) |
220 | { | 223 | { |
221 | int rval; | 224 | int rval; |
222 | uint32_t cnt, stat, timer, words, idx; | 225 | uint32_t cnt, stat, timer, words, idx; |
@@ -314,11 +317,11 @@ qla2xxx_read_window(struct device_reg_2xxx __iomem *reg, uint32_t count, | |||
314 | * @hardware_locked: Called with the hardware_lock | 317 | * @hardware_locked: Called with the hardware_lock |
315 | */ | 318 | */ |
316 | void | 319 | void |
317 | qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | 320 | qla2300_fw_dump(scsi_qla_host_t *vha, int hardware_locked) |
318 | { | 321 | { |
319 | int rval; | 322 | int rval; |
320 | uint32_t cnt; | 323 | uint32_t cnt; |
321 | 324 | struct qla_hw_data *ha = vha->hw; | |
322 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | 325 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; |
323 | uint16_t __iomem *dmp_reg; | 326 | uint16_t __iomem *dmp_reg; |
324 | unsigned long flags; | 327 | unsigned long flags; |
@@ -458,7 +461,7 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
458 | ha->fw_memory_size - 0x11000 + 1, &nxt); | 461 | ha->fw_memory_size - 0x11000 + 1, &nxt); |
459 | 462 | ||
460 | if (rval == QLA_SUCCESS) | 463 | if (rval == QLA_SUCCESS) |
461 | qla2xxx_copy_queues(ha, nxt); | 464 | qla2xxx_copy_queues(vha, nxt); |
462 | 465 | ||
463 | if (rval != QLA_SUCCESS) { | 466 | if (rval != QLA_SUCCESS) { |
464 | qla_printk(KERN_WARNING, ha, | 467 | qla_printk(KERN_WARNING, ha, |
@@ -468,7 +471,7 @@ qla2300_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
468 | } else { | 471 | } else { |
469 | qla_printk(KERN_INFO, ha, | 472 | qla_printk(KERN_INFO, ha, |
470 | "Firmware dump saved to temp buffer (%ld/%p).\n", | 473 | "Firmware dump saved to temp buffer (%ld/%p).\n", |
471 | ha->host_no, ha->fw_dump); | 474 | vha->host_no, ha->fw_dump); |
472 | ha->fw_dumped = 1; | 475 | ha->fw_dumped = 1; |
473 | } | 476 | } |
474 | 477 | ||
@@ -483,12 +486,13 @@ qla2300_fw_dump_failed: | |||
483 | * @hardware_locked: Called with the hardware_lock | 486 | * @hardware_locked: Called with the hardware_lock |
484 | */ | 487 | */ |
485 | void | 488 | void |
486 | qla2100_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | 489 | qla2100_fw_dump(scsi_qla_host_t *vha, int hardware_locked) |
487 | { | 490 | { |
488 | int rval; | 491 | int rval; |
489 | uint32_t cnt, timer; | 492 | uint32_t cnt, timer; |
490 | uint16_t risc_address; | 493 | uint16_t risc_address; |
491 | uint16_t mb0, mb2; | 494 | uint16_t mb0, mb2; |
495 | struct qla_hw_data *ha = vha->hw; | ||
492 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | 496 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; |
493 | uint16_t __iomem *dmp_reg; | 497 | uint16_t __iomem *dmp_reg; |
494 | unsigned long flags; | 498 | unsigned long flags; |
@@ -663,7 +667,7 @@ qla2100_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
663 | } | 667 | } |
664 | 668 | ||
665 | if (rval == QLA_SUCCESS) | 669 | if (rval == QLA_SUCCESS) |
666 | qla2xxx_copy_queues(ha, &fw->risc_ram[cnt]); | 670 | qla2xxx_copy_queues(vha, &fw->risc_ram[cnt]); |
667 | 671 | ||
668 | if (rval != QLA_SUCCESS) { | 672 | if (rval != QLA_SUCCESS) { |
669 | qla_printk(KERN_WARNING, ha, | 673 | qla_printk(KERN_WARNING, ha, |
@@ -673,7 +677,7 @@ qla2100_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
673 | } else { | 677 | } else { |
674 | qla_printk(KERN_INFO, ha, | 678 | qla_printk(KERN_INFO, ha, |
675 | "Firmware dump saved to temp buffer (%ld/%p).\n", | 679 | "Firmware dump saved to temp buffer (%ld/%p).\n", |
676 | ha->host_no, ha->fw_dump); | 680 | vha->host_no, ha->fw_dump); |
677 | ha->fw_dumped = 1; | 681 | ha->fw_dumped = 1; |
678 | } | 682 | } |
679 | 683 | ||
@@ -683,12 +687,12 @@ qla2100_fw_dump_failed: | |||
683 | } | 687 | } |
684 | 688 | ||
685 | void | 689 | void |
686 | qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | 690 | qla24xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked) |
687 | { | 691 | { |
688 | int rval; | 692 | int rval; |
689 | uint32_t cnt; | 693 | uint32_t cnt; |
690 | uint32_t risc_address; | 694 | uint32_t risc_address; |
691 | 695 | struct qla_hw_data *ha = vha->hw; | |
692 | struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; | 696 | struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; |
693 | uint32_t __iomem *dmp_reg; | 697 | uint32_t __iomem *dmp_reg; |
694 | uint32_t *iter_reg; | 698 | uint32_t *iter_reg; |
@@ -906,7 +910,7 @@ qla24xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
906 | if (rval != QLA_SUCCESS) | 910 | if (rval != QLA_SUCCESS) |
907 | goto qla24xx_fw_dump_failed_0; | 911 | goto qla24xx_fw_dump_failed_0; |
908 | 912 | ||
909 | nxt = qla2xxx_copy_queues(ha, nxt); | 913 | nxt = qla2xxx_copy_queues(vha, nxt); |
910 | if (ha->eft) | 914 | if (ha->eft) |
911 | memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size)); | 915 | memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size)); |
912 | 916 | ||
@@ -919,7 +923,7 @@ qla24xx_fw_dump_failed_0: | |||
919 | } else { | 923 | } else { |
920 | qla_printk(KERN_INFO, ha, | 924 | qla_printk(KERN_INFO, ha, |
921 | "Firmware dump saved to temp buffer (%ld/%p).\n", | 925 | "Firmware dump saved to temp buffer (%ld/%p).\n", |
922 | ha->host_no, ha->fw_dump); | 926 | vha->host_no, ha->fw_dump); |
923 | ha->fw_dumped = 1; | 927 | ha->fw_dumped = 1; |
924 | } | 928 | } |
925 | 929 | ||
@@ -929,12 +933,12 @@ qla24xx_fw_dump_failed: | |||
929 | } | 933 | } |
930 | 934 | ||
931 | void | 935 | void |
932 | qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | 936 | qla25xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked) |
933 | { | 937 | { |
934 | int rval; | 938 | int rval; |
935 | uint32_t cnt; | 939 | uint32_t cnt; |
936 | uint32_t risc_address; | 940 | uint32_t risc_address; |
937 | 941 | struct qla_hw_data *ha = vha->hw; | |
938 | struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; | 942 | struct device_reg_24xx __iomem *reg = &ha->iobase->isp24; |
939 | uint32_t __iomem *dmp_reg; | 943 | uint32_t __iomem *dmp_reg; |
940 | uint32_t *iter_reg; | 944 | uint32_t *iter_reg; |
@@ -1215,7 +1219,7 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked) | |||
1215 | goto qla25xx_fw_dump_failed_0; | 1219 | goto qla25xx_fw_dump_failed_0; |
1216 | 1220 | ||
1217 | /* Fibre Channel Trace Buffer. */ | 1221 | /* Fibre Channel Trace Buffer. */ |
1218 | nxt = qla2xxx_copy_queues(ha, nxt); | 1222 | nxt = qla2xxx_copy_queues(vha, nxt); |
1219 | if (ha->eft) | 1223 | if (ha->eft) |
1220 | memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size)); | 1224 | memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size)); |
1221 | 1225 | ||
@@ -1248,7 +1252,7 @@ qla25xx_fw_dump_failed_0: | |||
1248 | } else { | 1252 | } else { |
1249 | qla_printk(KERN_INFO, ha, | 1253 | qla_printk(KERN_INFO, ha, |
1250 | "Firmware dump saved to temp buffer (%ld/%p).\n", | 1254 | "Firmware dump saved to temp buffer (%ld/%p).\n", |
1251 | ha->host_no, ha->fw_dump); | 1255 | vha->host_no, ha->fw_dump); |
1252 | ha->fw_dumped = 1; | 1256 | ha->fw_dumped = 1; |
1253 | } | 1257 | } |
1254 | 1258 | ||
@@ -1262,9 +1266,10 @@ qla25xx_fw_dump_failed: | |||
1262 | /****************************************************************************/ | 1266 | /****************************************************************************/ |
1263 | 1267 | ||
1264 | void | 1268 | void |
1265 | qla2x00_dump_regs(scsi_qla_host_t *ha) | 1269 | qla2x00_dump_regs(scsi_qla_host_t *vha) |
1266 | { | 1270 | { |
1267 | int i; | 1271 | int i; |
1272 | struct qla_hw_data *ha = vha->hw; | ||
1268 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; | 1273 | struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; |
1269 | struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; | 1274 | struct device_reg_24xx __iomem *reg24 = &ha->iobase->isp24; |
1270 | uint16_t __iomem *mbx_reg; | 1275 | uint16_t __iomem *mbx_reg; |
@@ -1274,7 +1279,7 @@ qla2x00_dump_regs(scsi_qla_host_t *ha) | |||
1274 | 1279 | ||
1275 | printk("Mailbox registers:\n"); | 1280 | printk("Mailbox registers:\n"); |
1276 | for (i = 0; i < 6; i++) | 1281 | for (i = 0; i < 6; i++) |
1277 | printk("scsi(%ld): mbox %d 0x%04x \n", ha->host_no, i, | 1282 | printk("scsi(%ld): mbox %d 0x%04x \n", vha->host_no, i, |
1278 | RD_REG_WORD(mbx_reg++)); | 1283 | RD_REG_WORD(mbx_reg++)); |
1279 | } | 1284 | } |
1280 | 1285 | ||