diff options
author | Karen Higgins <karen.higgins@qlogic.com> | 2009-07-15 16:02:58 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-07-30 09:50:00 -0400 |
commit | 94bced3c1b371014cbd187f2df5539b13a0e3b90 (patch) | |
tree | d99c75b2738f3629bd835e36f70fa611b1f8655a /drivers/scsi | |
parent | 6187c242089d334102be76427a5a020240e6c19a (diff) |
[SCSI] qla4xxx: Correct Extended Sense Data Errors
Fixed sense data errors occurring above the first 32 bytes,
as required by some third party applications. Sense data
in the first 32 bytes has always been correct.
Patch updated to use srb data variables instead of scsi command
scratchpad data area, as scratchpad area is already used.
Also, corrected debug print alignment bug in dump_buffer routine.
Changed KERN_DEBUG to KERN_INFO in printk statements in this routine.
Changed version number to 5.01.00-k9
Signed-off-by: Karen Higgins <karen.higgins@qlogic.com>
[michaelc: fixed checkpath.pl errors]
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_dbg.c | 15 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_def.h | 7 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_fw.h | 7 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_isr.c | 145 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_version.h | 2 |
5 files changed, 122 insertions, 54 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_dbg.c b/drivers/scsi/qla4xxx/ql4_dbg.c index fcc184cd066d..cbceb0ebabf7 100644 --- a/drivers/scsi/qla4xxx/ql4_dbg.c +++ b/drivers/scsi/qla4xxx/ql4_dbg.c | |||
@@ -15,19 +15,18 @@ void qla4xxx_dump_buffer(void *b, uint32_t size) | |||
15 | uint32_t cnt; | 15 | uint32_t cnt; |
16 | uint8_t *c = b; | 16 | uint8_t *c = b; |
17 | 17 | ||
18 | printk(" 0 1 2 3 4 5 6 7 8 9 Ah Bh Ch Dh Eh " | 18 | printk(" 0 1 2 3 4 5 6 7 8 9 Ah Bh Ch Dh Eh " |
19 | "Fh\n"); | 19 | "Fh\n"); |
20 | printk("------------------------------------------------------------" | 20 | printk("------------------------------------------------------------" |
21 | "--\n"); | 21 | "--\n"); |
22 | for (cnt = 0; cnt < size; cnt++, c++) { | 22 | for (cnt = 0; cnt < size; c++) { |
23 | printk(KERN_DEBUG "%02x", *c); | 23 | printk(KERN_INFO "%02x", *c); |
24 | if (!(cnt % 16)) | 24 | if (!(++cnt % 16)) |
25 | printk(KERN_DEBUG "\n"); | 25 | printk(KERN_INFO "\n"); |
26 | 26 | ||
27 | else | 27 | else |
28 | printk(KERN_DEBUG " "); | 28 | printk(KERN_INFO " "); |
29 | } | 29 | } |
30 | if (cnt % 16) | 30 | printk(KERN_INFO "\n"); |
31 | printk(KERN_DEBUG "\n"); | ||
32 | } | 31 | } |
33 | 32 | ||
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h index b586f27c3bd4..963e8553d210 100644 --- a/drivers/scsi/qla4xxx/ql4_def.h +++ b/drivers/scsi/qla4xxx/ql4_def.h | |||
@@ -184,6 +184,11 @@ struct srb { | |||
184 | uint16_t cc_stat; | 184 | uint16_t cc_stat; |
185 | u_long r_start; /* Time we recieve a cmd from OS */ | 185 | u_long r_start; /* Time we recieve a cmd from OS */ |
186 | u_long u_start; /* Time when we handed the cmd to F/W */ | 186 | u_long u_start; /* Time when we handed the cmd to F/W */ |
187 | |||
188 | /* Used for extended sense / status continuation */ | ||
189 | uint8_t *req_sense_ptr; | ||
190 | uint16_t req_sense_len; | ||
191 | uint16_t reserved2; | ||
187 | }; | 192 | }; |
188 | 193 | ||
189 | /* | 194 | /* |
@@ -436,6 +441,8 @@ struct scsi_qla_host { | |||
436 | /* Map ddb_list entry by FW ddb index */ | 441 | /* Map ddb_list entry by FW ddb index */ |
437 | struct ddb_entry *fw_ddb_index_map[MAX_DDB_ENTRIES]; | 442 | struct ddb_entry *fw_ddb_index_map[MAX_DDB_ENTRIES]; |
438 | 443 | ||
444 | /* Saved srb for status continuation entry processing */ | ||
445 | struct srb *status_srb; | ||
439 | }; | 446 | }; |
440 | 447 | ||
441 | static inline int is_qla4010(struct scsi_qla_host *ha) | 448 | static inline int is_qla4010(struct scsi_qla_host *ha) |
diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h index 1b667a70cffa..9cd7a608df38 100644 --- a/drivers/scsi/qla4xxx/ql4_fw.h +++ b/drivers/scsi/qla4xxx/ql4_fw.h | |||
@@ -572,6 +572,7 @@ struct conn_event_log_entry { | |||
572 | *************************************************************************/ | 572 | *************************************************************************/ |
573 | #define IOCB_MAX_CDB_LEN 16 /* Bytes in a CBD */ | 573 | #define IOCB_MAX_CDB_LEN 16 /* Bytes in a CBD */ |
574 | #define IOCB_MAX_SENSEDATA_LEN 32 /* Bytes of sense data */ | 574 | #define IOCB_MAX_SENSEDATA_LEN 32 /* Bytes of sense data */ |
575 | #define IOCB_MAX_EXT_SENSEDATA_LEN 60 /* Bytes of extended sense data */ | ||
575 | 576 | ||
576 | /* IOCB header structure */ | 577 | /* IOCB header structure */ |
577 | struct qla4_header { | 578 | struct qla4_header { |
@@ -733,6 +734,12 @@ struct status_entry { | |||
733 | 734 | ||
734 | }; | 735 | }; |
735 | 736 | ||
737 | /* Status Continuation entry */ | ||
738 | struct status_cont_entry { | ||
739 | struct qla4_header hdr; /* 00-03 */ | ||
740 | uint8_t ext_sense_data[IOCB_MAX_EXT_SENSEDATA_LEN]; /* 04-63 */ | ||
741 | }; | ||
742 | |||
736 | struct passthru0 { | 743 | struct passthru0 { |
737 | struct qla4_header hdr; /* 00-03 */ | 744 | struct qla4_header hdr; /* 00-03 */ |
738 | uint32_t handle; /* 04-07 */ | 745 | uint32_t handle; /* 04-07 */ |
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c index 799120fcb9be..8025ee16588e 100644 --- a/drivers/scsi/qla4xxx/ql4_isr.c +++ b/drivers/scsi/qla4xxx/ql4_isr.c | |||
@@ -11,6 +11,98 @@ | |||
11 | #include "ql4_inline.h" | 11 | #include "ql4_inline.h" |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * qla4xxx_copy_sense - copy sense data into cmd sense buffer | ||
15 | * @ha: Pointer to host adapter structure. | ||
16 | * @sts_entry: Pointer to status entry structure. | ||
17 | * @srb: Pointer to srb structure. | ||
18 | **/ | ||
19 | static void qla4xxx_copy_sense(struct scsi_qla_host *ha, | ||
20 | struct status_entry *sts_entry, | ||
21 | struct srb *srb) | ||
22 | { | ||
23 | struct scsi_cmnd *cmd = srb->cmd; | ||
24 | uint16_t sense_len; | ||
25 | |||
26 | memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); | ||
27 | sense_len = le16_to_cpu(sts_entry->senseDataByteCnt); | ||
28 | if (sense_len == 0) | ||
29 | return; | ||
30 | |||
31 | /* Save total available sense length, | ||
32 | * not to exceed cmd's sense buffer size */ | ||
33 | sense_len = min_t(uint16_t, sense_len, SCSI_SENSE_BUFFERSIZE); | ||
34 | srb->req_sense_ptr = cmd->sense_buffer; | ||
35 | srb->req_sense_len = sense_len; | ||
36 | |||
37 | /* Copy sense from sts_entry pkt */ | ||
38 | sense_len = min_t(uint16_t, sense_len, IOCB_MAX_SENSEDATA_LEN); | ||
39 | memcpy(cmd->sense_buffer, sts_entry->senseData, sense_len); | ||
40 | |||
41 | DEBUG2(printk(KERN_INFO "scsi%ld:%d:%d:%d: %s: sense key = %x, " | ||
42 | "ASL= %02x, ASC/ASCQ = %02x/%02x\n", ha->host_no, | ||
43 | cmd->device->channel, cmd->device->id, | ||
44 | cmd->device->lun, __func__, | ||
45 | sts_entry->senseData[2] & 0x0f, | ||
46 | sts_entry->senseData[7], | ||
47 | sts_entry->senseData[12], | ||
48 | sts_entry->senseData[13])); | ||
49 | |||
50 | DEBUG5(qla4xxx_dump_buffer(cmd->sense_buffer, sense_len)); | ||
51 | srb->flags |= SRB_GOT_SENSE; | ||
52 | |||
53 | /* Update srb, in case a sts_cont pkt follows */ | ||
54 | srb->req_sense_ptr += sense_len; | ||
55 | srb->req_sense_len -= sense_len; | ||
56 | if (srb->req_sense_len != 0) | ||
57 | ha->status_srb = srb; | ||
58 | else | ||
59 | ha->status_srb = NULL; | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * qla4xxx_status_cont_entry - Process a Status Continuations entry. | ||
64 | * @ha: SCSI driver HA context | ||
65 | * @sts_cont: Entry pointer | ||
66 | * | ||
67 | * Extended sense data. | ||
68 | */ | ||
69 | static void | ||
70 | qla4xxx_status_cont_entry(struct scsi_qla_host *ha, | ||
71 | struct status_cont_entry *sts_cont) | ||
72 | { | ||
73 | struct srb *srb = ha->status_srb; | ||
74 | struct scsi_cmnd *cmd; | ||
75 | uint8_t sense_len; | ||
76 | |||
77 | if (srb == NULL) | ||
78 | return; | ||
79 | |||
80 | cmd = srb->cmd; | ||
81 | if (cmd == NULL) { | ||
82 | DEBUG2(printk(KERN_INFO "scsi%ld: %s: Cmd already returned " | ||
83 | "back to OS srb=%p srb->state:%d\n", ha->host_no, | ||
84 | __func__, srb, srb->state)); | ||
85 | ha->status_srb = NULL; | ||
86 | return; | ||
87 | } | ||
88 | |||
89 | /* Copy sense data. */ | ||
90 | sense_len = min_t(uint16_t, srb->req_sense_len, | ||
91 | IOCB_MAX_EXT_SENSEDATA_LEN); | ||
92 | memcpy(srb->req_sense_ptr, sts_cont->ext_sense_data, sense_len); | ||
93 | DEBUG5(qla4xxx_dump_buffer(srb->req_sense_ptr, sense_len)); | ||
94 | |||
95 | srb->req_sense_ptr += sense_len; | ||
96 | srb->req_sense_len -= sense_len; | ||
97 | |||
98 | /* Place command on done queue. */ | ||
99 | if (srb->req_sense_len == 0) { | ||
100 | qla4xxx_srb_compl(ha, srb); | ||
101 | ha->status_srb = NULL; | ||
102 | } | ||
103 | } | ||
104 | |||
105 | /** | ||
14 | * qla4xxx_status_entry - processes status IOCBs | 106 | * qla4xxx_status_entry - processes status IOCBs |
15 | * @ha: Pointer to host adapter structure. | 107 | * @ha: Pointer to host adapter structure. |
16 | * @sts_entry: Pointer to status entry structure. | 108 | * @sts_entry: Pointer to status entry structure. |
@@ -23,7 +115,6 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, | |||
23 | struct srb *srb; | 115 | struct srb *srb; |
24 | struct ddb_entry *ddb_entry; | 116 | struct ddb_entry *ddb_entry; |
25 | uint32_t residual; | 117 | uint32_t residual; |
26 | uint16_t sensebytecnt; | ||
27 | 118 | ||
28 | srb = qla4xxx_del_from_active_array(ha, le32_to_cpu(sts_entry->handle)); | 119 | srb = qla4xxx_del_from_active_array(ha, le32_to_cpu(sts_entry->handle)); |
29 | if (!srb) { | 120 | if (!srb) { |
@@ -92,24 +183,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, | |||
92 | break; | 183 | break; |
93 | 184 | ||
94 | /* Copy Sense Data into sense buffer. */ | 185 | /* Copy Sense Data into sense buffer. */ |
95 | memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); | 186 | qla4xxx_copy_sense(ha, sts_entry, srb); |
96 | |||
97 | sensebytecnt = le16_to_cpu(sts_entry->senseDataByteCnt); | ||
98 | if (sensebytecnt == 0) | ||
99 | break; | ||
100 | |||
101 | memcpy(cmd->sense_buffer, sts_entry->senseData, | ||
102 | min_t(uint16_t, sensebytecnt, SCSI_SENSE_BUFFERSIZE)); | ||
103 | |||
104 | DEBUG2(printk("scsi%ld:%d:%d:%d: %s: sense key = %x, " | ||
105 | "ASC/ASCQ = %02x/%02x\n", ha->host_no, | ||
106 | cmd->device->channel, cmd->device->id, | ||
107 | cmd->device->lun, __func__, | ||
108 | sts_entry->senseData[2] & 0x0f, | ||
109 | sts_entry->senseData[12], | ||
110 | sts_entry->senseData[13])); | ||
111 | |||
112 | srb->flags |= SRB_GOT_SENSE; | ||
113 | break; | 187 | break; |
114 | 188 | ||
115 | case SCS_INCOMPLETE: | 189 | case SCS_INCOMPLETE: |
@@ -176,23 +250,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, | |||
176 | break; | 250 | break; |
177 | 251 | ||
178 | /* Copy Sense Data into sense buffer. */ | 252 | /* Copy Sense Data into sense buffer. */ |
179 | memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); | 253 | qla4xxx_copy_sense(ha, sts_entry, srb); |
180 | |||
181 | sensebytecnt = | ||
182 | le16_to_cpu(sts_entry->senseDataByteCnt); | ||
183 | if (sensebytecnt == 0) | ||
184 | break; | ||
185 | |||
186 | memcpy(cmd->sense_buffer, sts_entry->senseData, | ||
187 | min_t(uint16_t, sensebytecnt, SCSI_SENSE_BUFFERSIZE)); | ||
188 | |||
189 | DEBUG2(printk("scsi%ld:%d:%d:%d: %s: sense key = %x, " | ||
190 | "ASC/ASCQ = %02x/%02x\n", ha->host_no, | ||
191 | cmd->device->channel, cmd->device->id, | ||
192 | cmd->device->lun, __func__, | ||
193 | sts_entry->senseData[2] & 0x0f, | ||
194 | sts_entry->senseData[12], | ||
195 | sts_entry->senseData[13])); | ||
196 | } else { | 254 | } else { |
197 | /* | 255 | /* |
198 | * If RISC reports underrun and target does not | 256 | * If RISC reports underrun and target does not |
@@ -268,9 +326,10 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, | |||
268 | 326 | ||
269 | status_entry_exit: | 327 | status_entry_exit: |
270 | 328 | ||
271 | /* complete the request */ | 329 | /* complete the request, if not waiting for status_continuation pkt */ |
272 | srb->cc_stat = sts_entry->completionStatus; | 330 | srb->cc_stat = sts_entry->completionStatus; |
273 | qla4xxx_srb_compl(ha, srb); | 331 | if (ha->status_srb == NULL) |
332 | qla4xxx_srb_compl(ha, srb); | ||
274 | } | 333 | } |
275 | 334 | ||
276 | /** | 335 | /** |
@@ -305,10 +364,7 @@ static void qla4xxx_process_response_queue(struct scsi_qla_host * ha) | |||
305 | /* process entry */ | 364 | /* process entry */ |
306 | switch (sts_entry->hdr.entryType) { | 365 | switch (sts_entry->hdr.entryType) { |
307 | case ET_STATUS: | 366 | case ET_STATUS: |
308 | /* | 367 | /* Common status */ |
309 | * Common status - Single completion posted in single | ||
310 | * IOSB. | ||
311 | */ | ||
312 | qla4xxx_status_entry(ha, sts_entry); | 368 | qla4xxx_status_entry(ha, sts_entry); |
313 | break; | 369 | break; |
314 | 370 | ||
@@ -316,9 +372,8 @@ static void qla4xxx_process_response_queue(struct scsi_qla_host * ha) | |||
316 | break; | 372 | break; |
317 | 373 | ||
318 | case ET_STATUS_CONTINUATION: | 374 | case ET_STATUS_CONTINUATION: |
319 | /* Just throw away the status continuation entries */ | 375 | qla4xxx_status_cont_entry(ha, |
320 | DEBUG2(printk("scsi%ld: %s: Status Continuation entry " | 376 | (struct status_cont_entry *) sts_entry); |
321 | "- ignoring\n", ha->host_no, __func__)); | ||
322 | break; | 377 | break; |
323 | 378 | ||
324 | case ET_COMMAND: | 379 | case ET_COMMAND: |
diff --git a/drivers/scsi/qla4xxx/ql4_version.h b/drivers/scsi/qla4xxx/ql4_version.h index ab984cb89cea..6980cb279c81 100644 --- a/drivers/scsi/qla4xxx/ql4_version.h +++ b/drivers/scsi/qla4xxx/ql4_version.h | |||
@@ -5,5 +5,5 @@ | |||
5 | * See LICENSE.qla4xxx for copyright and licensing details. | 5 | * See LICENSE.qla4xxx for copyright and licensing details. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #define QLA4XXX_DRIVER_VERSION "5.01.00-k8" | 8 | #define QLA4XXX_DRIVER_VERSION "5.01.00-k9" |
9 | 9 | ||