aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-12-14 21:40:02 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-12-14 21:40:02 -0500
commita50e2cc7c8e2b9b38f5972bc19daea4c98878d01 (patch)
treede134372fa3982479962b384495064d38ea2bede
parentc7868048a7314bb4a2973097d605f00acd3b70bd (diff)
parentc9526497cf03ee775c3a6f8ba62335735f98de7a (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
-rw-r--r--drivers/scsi/ibmvscsi/ibmvscsi.h2
-rw-r--r--drivers/scsi/ibmvscsi/iseries_vscsi.c3
-rw-r--r--drivers/scsi/ibmvscsi/rpa_vscsi.c8
-rw-r--r--drivers/scsi/megaraid.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h10
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c6
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c15
-rw-r--r--drivers/scsi/scsi_error.c7
-rw-r--r--drivers/scsi/scsi_lib.c33
-rw-r--r--drivers/scsi/sd.c16
-rw-r--r--drivers/scsi/sr.c20
-rw-r--r--drivers/scsi/st.c19
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c4
-rw-r--r--include/scsi/scsi_cmnd.h1
14 files changed, 65 insertions, 81 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.h b/drivers/scsi/ibmvscsi/ibmvscsi.h
index 8bec0438dc8a..5b0edd1f1921 100644
--- a/drivers/scsi/ibmvscsi/ibmvscsi.h
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.h
@@ -100,7 +100,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
100void ibmvscsi_release_crq_queue(struct crq_queue *queue, 100void ibmvscsi_release_crq_queue(struct crq_queue *queue,
101 struct ibmvscsi_host_data *hostdata, 101 struct ibmvscsi_host_data *hostdata,
102 int max_requests); 102 int max_requests);
103void ibmvscsi_reset_crq_queue(struct crq_queue *queue, 103int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
104 struct ibmvscsi_host_data *hostdata); 104 struct ibmvscsi_host_data *hostdata);
105 105
106void ibmvscsi_handle_crq(struct viosrp_crq *crq, 106void ibmvscsi_handle_crq(struct viosrp_crq *crq,
diff --git a/drivers/scsi/ibmvscsi/iseries_vscsi.c b/drivers/scsi/ibmvscsi/iseries_vscsi.c
index 1045872b0175..ce15d9e39621 100644
--- a/drivers/scsi/ibmvscsi/iseries_vscsi.c
+++ b/drivers/scsi/ibmvscsi/iseries_vscsi.c
@@ -117,9 +117,10 @@ void ibmvscsi_release_crq_queue(struct crq_queue *queue,
117 * 117 *
118 * no-op for iSeries 118 * no-op for iSeries
119 */ 119 */
120void ibmvscsi_reset_crq_queue(struct crq_queue *queue, 120int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
121 struct ibmvscsi_host_data *hostdata) 121 struct ibmvscsi_host_data *hostdata)
122{ 122{
123 return 0;
123} 124}
124 125
125/** 126/**
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c
index 8bf5652f1060..75db2f5c545e 100644
--- a/drivers/scsi/ibmvscsi/rpa_vscsi.c
+++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c
@@ -230,6 +230,11 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
230 rc = plpar_hcall_norets(H_REG_CRQ, 230 rc = plpar_hcall_norets(H_REG_CRQ,
231 vdev->unit_address, 231 vdev->unit_address,
232 queue->msg_token, PAGE_SIZE); 232 queue->msg_token, PAGE_SIZE);
233 if (rc == H_Resource)
234 /* maybe kexecing and resource is busy. try a reset */
235 rc = ibmvscsi_reset_crq_queue(queue,
236 hostdata);
237
233 if (rc == 2) { 238 if (rc == 2) {
234 /* Adapter is good, but other end is not ready */ 239 /* Adapter is good, but other end is not ready */
235 printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n"); 240 printk(KERN_WARNING "ibmvscsi: Partner adapter not ready\n");
@@ -281,7 +286,7 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
281 * @hostdata: ibmvscsi_host_data of host 286 * @hostdata: ibmvscsi_host_data of host
282 * 287 *
283 */ 288 */
284void ibmvscsi_reset_crq_queue(struct crq_queue *queue, 289int ibmvscsi_reset_crq_queue(struct crq_queue *queue,
285 struct ibmvscsi_host_data *hostdata) 290 struct ibmvscsi_host_data *hostdata)
286{ 291{
287 int rc; 292 int rc;
@@ -309,4 +314,5 @@ void ibmvscsi_reset_crq_queue(struct crq_queue *queue,
309 printk(KERN_WARNING 314 printk(KERN_WARNING
310 "ibmvscsi: couldn't register crq--rc 0x%x\n", rc); 315 "ibmvscsi: couldn't register crq--rc 0x%x\n", rc);
311 } 316 }
317 return rc;
312} 318}
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index f9792528e33f..578143e93a6f 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -664,7 +664,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy)
664 sg->offset; 664 sg->offset;
665 } else 665 } else
666 buf = cmd->request_buffer; 666 buf = cmd->request_buffer;
667 memset(cmd->request_buffer, 0, cmd->cmnd[4]); 667 memset(buf, 0, cmd->cmnd[4]);
668 if (cmd->use_sg) { 668 if (cmd->use_sg) {
669 struct scatterlist *sg; 669 struct scatterlist *sg;
670 670
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 7096945ea234..7b3efd531297 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2476,17 +2476,9 @@ typedef struct scsi_qla_host {
2476 */ 2476 */
2477#define LOOP_TRANSITION(ha) \ 2477#define LOOP_TRANSITION(ha) \
2478 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \ 2478 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
2479 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags)) 2479 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
2480
2481#define LOOP_NOT_READY(ha) \
2482 ((test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \
2483 test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) || \
2484 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \
2485 test_bit(LOOP_RESYNC_ACTIVE, &ha->dpc_flags)) || \
2486 atomic_read(&ha->loop_state) == LOOP_DOWN) 2480 atomic_read(&ha->loop_state) == LOOP_DOWN)
2487 2481
2488#define LOOP_RDY(ha) (!LOOP_NOT_READY(ha))
2489
2490#define TGT_Q(ha, t) (ha->otgt[t]) 2482#define TGT_Q(ha, t) (ha->otgt[t])
2491 2483
2492#define to_qla_host(x) ((scsi_qla_host_t *) (x)->hostdata) 2484#define to_qla_host(x) ((scsi_qla_host_t *) (x)->hostdata)
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 2d720121a0d3..c46d2469b85f 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1259,7 +1259,7 @@ qla2x00_configure_hba(scsi_qla_host_t *ha)
1259 rval = qla2x00_get_adapter_id(ha, 1259 rval = qla2x00_get_adapter_id(ha,
1260 &loop_id, &al_pa, &area, &domain, &topo); 1260 &loop_id, &al_pa, &area, &domain, &topo);
1261 if (rval != QLA_SUCCESS) { 1261 if (rval != QLA_SUCCESS) {
1262 if (LOOP_NOT_READY(ha) || atomic_read(&ha->loop_down_timer) || 1262 if (LOOP_TRANSITION(ha) || atomic_read(&ha->loop_down_timer) ||
1263 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) { 1263 (rval == QLA_COMMAND_ERROR && loop_id == 0x7)) {
1264 DEBUG2(printk("%s(%ld) Loop is in a transition state\n", 1264 DEBUG2(printk("%s(%ld) Loop is in a transition state\n",
1265 __func__, ha->host_no)); 1265 __func__, ha->host_no));
@@ -1796,7 +1796,7 @@ qla2x00_configure_loop(scsi_qla_host_t *ha)
1796 } 1796 }
1797 1797
1798 if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) { 1798 if (rval == QLA_SUCCESS && test_bit(RSCN_UPDATE, &flags)) {
1799 if (LOOP_NOT_READY(ha)) { 1799 if (LOOP_TRANSITION(ha)) {
1800 rval = QLA_FUNCTION_FAILED; 1800 rval = QLA_FUNCTION_FAILED;
1801 } else { 1801 } else {
1802 rval = qla2x00_configure_fabric(ha); 1802 rval = qla2x00_configure_fabric(ha);
@@ -2369,7 +2369,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports)
2369 if (qla2x00_is_reserved_id(ha, loop_id)) 2369 if (qla2x00_is_reserved_id(ha, loop_id))
2370 continue; 2370 continue;
2371 2371
2372 if (atomic_read(&ha->loop_down_timer) || LOOP_NOT_READY(ha)) 2372 if (atomic_read(&ha->loop_down_timer) || LOOP_TRANSITION(ha))
2373 break; 2373 break;
2374 2374
2375 if (swl != NULL) { 2375 if (swl != NULL) {
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 09afc0f06bd4..5181d966fecb 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -909,6 +909,21 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
909 resid = resid_len; 909 resid = resid_len;
910 cp->resid = resid; 910 cp->resid = resid;
911 CMD_RESID_LEN(cp) = resid; 911 CMD_RESID_LEN(cp) = resid;
912
913 if (!lscsi_status &&
914 ((unsigned)(cp->request_bufflen - resid) <
915 cp->underflow)) {
916 qla_printk(KERN_INFO, ha,
917 "scsi(%ld:%d:%d:%d): Mid-layer underflow "
918 "detected (%x of %x bytes)...returning "
919 "error status.\n", ha->host_no,
920 cp->device->channel, cp->device->id,
921 cp->device->lun, resid,
922 cp->request_bufflen);
923
924 cp->result = DID_ERROR << 16;
925 break;
926 }
912 } 927 }
913 cp->result = DID_OK << 16 | lscsi_status; 928 cp->result = DID_OK << 16 | lscsi_status;
914 929
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 18c5d2523014..c0ae9e965f6f 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -422,10 +422,15 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
422 **/ 422 **/
423static void scsi_eh_done(struct scsi_cmnd *scmd) 423static void scsi_eh_done(struct scsi_cmnd *scmd)
424{ 424{
425 struct completion *eh_action;
426
425 SCSI_LOG_ERROR_RECOVERY(3, 427 SCSI_LOG_ERROR_RECOVERY(3,
426 printk("%s scmd: %p result: %x\n", 428 printk("%s scmd: %p result: %x\n",
427 __FUNCTION__, scmd, scmd->result)); 429 __FUNCTION__, scmd, scmd->result));
428 complete(scmd->device->host->eh_action); 430
431 eh_action = scmd->device->host->eh_action;
432 if (eh_action)
433 complete(eh_action);
429} 434}
430 435
431/** 436/**
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index ce9d73a292e2..dc249cb970ea 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1085,6 +1085,26 @@ static void scsi_generic_done(struct scsi_cmnd *cmd)
1085 scsi_io_completion(cmd, cmd->result == 0 ? cmd->bufflen : 0, 0); 1085 scsi_io_completion(cmd, cmd->result == 0 ? cmd->bufflen : 0, 0);
1086} 1086}
1087 1087
1088void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd, int retries)
1089{
1090 struct request *req = cmd->request;
1091
1092 BUG_ON(sizeof(req->cmd) > sizeof(cmd->cmnd));
1093 memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd));
1094 cmd->cmd_len = req->cmd_len;
1095 if (!req->data_len)
1096 cmd->sc_data_direction = DMA_NONE;
1097 else if (rq_data_dir(req) == WRITE)
1098 cmd->sc_data_direction = DMA_TO_DEVICE;
1099 else
1100 cmd->sc_data_direction = DMA_FROM_DEVICE;
1101
1102 cmd->transfersize = req->data_len;
1103 cmd->allowed = retries;
1104 cmd->timeout_per_command = req->timeout;
1105}
1106EXPORT_SYMBOL_GPL(scsi_setup_blk_pc_cmnd);
1107
1088static int scsi_prep_fn(struct request_queue *q, struct request *req) 1108static int scsi_prep_fn(struct request_queue *q, struct request *req)
1089{ 1109{
1090 struct scsi_device *sdev = q->queuedata; 1110 struct scsi_device *sdev = q->queuedata;
@@ -1220,18 +1240,7 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
1220 goto kill; 1240 goto kill;
1221 } 1241 }
1222 } else { 1242 } else {
1223 memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd)); 1243 scsi_setup_blk_pc_cmnd(cmd, 3);
1224 cmd->cmd_len = req->cmd_len;
1225 if (rq_data_dir(req) == WRITE)
1226 cmd->sc_data_direction = DMA_TO_DEVICE;
1227 else if (req->data_len)
1228 cmd->sc_data_direction = DMA_FROM_DEVICE;
1229 else
1230 cmd->sc_data_direction = DMA_NONE;
1231
1232 cmd->transfersize = req->data_len;
1233 cmd->allowed = 3;
1234 cmd->timeout_per_command = req->timeout;
1235 cmd->done = scsi_generic_done; 1244 cmd->done = scsi_generic_done;
1236 } 1245 }
1237 } 1246 }
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 8613a1317712..03fcbab30033 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -245,24 +245,10 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
245 * SG_IO from block layer already setup, just copy cdb basically 245 * SG_IO from block layer already setup, just copy cdb basically
246 */ 246 */
247 if (blk_pc_request(rq)) { 247 if (blk_pc_request(rq)) {
248 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd)) 248 scsi_setup_blk_pc_cmnd(SCpnt, SD_PASSTHROUGH_RETRIES);
249 return 0;
250
251 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
252 SCpnt->cmd_len = rq->cmd_len;
253 if (rq_data_dir(rq) == WRITE)
254 SCpnt->sc_data_direction = DMA_TO_DEVICE;
255 else if (rq->data_len)
256 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
257 else
258 SCpnt->sc_data_direction = DMA_NONE;
259
260 this_count = rq->data_len;
261 if (rq->timeout) 249 if (rq->timeout)
262 timeout = rq->timeout; 250 timeout = rq->timeout;
263 251
264 SCpnt->transfersize = rq->data_len;
265 SCpnt->allowed = SD_PASSTHROUGH_RETRIES;
266 goto queue; 252 goto queue;
267 } 253 }
268 254
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index d68cea753bb2..fb4012b5c188 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -320,25 +320,11 @@ static int sr_init_command(struct scsi_cmnd * SCpnt)
320 * these are already setup, just copy cdb basically 320 * these are already setup, just copy cdb basically
321 */ 321 */
322 if (SCpnt->request->flags & REQ_BLOCK_PC) { 322 if (SCpnt->request->flags & REQ_BLOCK_PC) {
323 struct request *rq = SCpnt->request; 323 scsi_setup_blk_pc_cmnd(SCpnt, MAX_RETRIES);
324 324
325 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd)) 325 if (SCpnt->timeout_per_command)
326 return 0; 326 timeout = SCpnt->timeout_per_command;
327
328 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
329 SCpnt->cmd_len = rq->cmd_len;
330 if (!rq->data_len)
331 SCpnt->sc_data_direction = DMA_NONE;
332 else if (rq_data_dir(rq) == WRITE)
333 SCpnt->sc_data_direction = DMA_TO_DEVICE;
334 else
335 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
336
337 this_count = rq->data_len;
338 if (rq->timeout)
339 timeout = rq->timeout;
340 327
341 SCpnt->transfersize = rq->data_len;
342 goto queue; 328 goto queue;
343 } 329 }
344 330
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 7ac6ea141fff..dd592f6a2529 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4194,27 +4194,10 @@ static void st_intr(struct scsi_cmnd *SCpnt)
4194 */ 4194 */
4195static int st_init_command(struct scsi_cmnd *SCpnt) 4195static int st_init_command(struct scsi_cmnd *SCpnt)
4196{ 4196{
4197 struct request *rq;
4198
4199 if (!(SCpnt->request->flags & REQ_BLOCK_PC)) 4197 if (!(SCpnt->request->flags & REQ_BLOCK_PC))
4200 return 0; 4198 return 0;
4201 4199
4202 rq = SCpnt->request; 4200 scsi_setup_blk_pc_cmnd(SCpnt, 0);
4203 if (sizeof(rq->cmd) > sizeof(SCpnt->cmnd))
4204 return 0;
4205
4206 memcpy(SCpnt->cmnd, rq->cmd, sizeof(SCpnt->cmnd));
4207 SCpnt->cmd_len = rq->cmd_len;
4208
4209 if (rq_data_dir(rq) == WRITE)
4210 SCpnt->sc_data_direction = DMA_TO_DEVICE;
4211 else if (rq->data_len)
4212 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
4213 else
4214 SCpnt->sc_data_direction = DMA_NONE;
4215
4216 SCpnt->timeout_per_command = rq->timeout;
4217 SCpnt->transfersize = rq->data_len;
4218 SCpnt->done = st_intr; 4201 SCpnt->done = st_intr;
4219 return 1; 4202 return 1;
4220} 4203}
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index a7420cad4547..1564ca203a3e 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -1405,7 +1405,6 @@ static void sym_check_goals(struct sym_hcb *np, struct scsi_target *starget,
1405 goal->iu = 0; 1405 goal->iu = 0;
1406 goal->dt = 0; 1406 goal->dt = 0;
1407 goal->qas = 0; 1407 goal->qas = 0;
1408 goal->period = 0;
1409 goal->offset = 0; 1408 goal->offset = 0;
1410 return; 1409 return;
1411 } 1410 }
@@ -1465,7 +1464,8 @@ static int sym_prepare_nego(struct sym_hcb *np, struct sym_ccb *cp, u_char *msgp
1465 * Many devices implement PPR in a buggy way, so only use it if we 1464 * Many devices implement PPR in a buggy way, so only use it if we
1466 * really want to. 1465 * really want to.
1467 */ 1466 */
1468 if (goal->iu || goal->dt || goal->qas || (goal->period < 0xa)) { 1467 if (goal->offset &&
1468 (goal->iu || goal->dt || goal->qas || (goal->period < 0xa))) {
1469 nego = NS_PPR; 1469 nego = NS_PPR;
1470 } else if (spi_width(starget) != goal->width) { 1470 } else if (spi_width(starget) != goal->width) {
1471 nego = NS_WIDE; 1471 nego = NS_WIDE;
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 7529f4388bb4..20da282d4abb 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -151,5 +151,6 @@ extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
151extern void scsi_put_command(struct scsi_cmnd *); 151extern void scsi_put_command(struct scsi_cmnd *);
152extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int); 152extern void scsi_io_completion(struct scsi_cmnd *, unsigned int, unsigned int);
153extern void scsi_finish_command(struct scsi_cmnd *cmd); 153extern void scsi_finish_command(struct scsi_cmnd *cmd);
154extern void scsi_setup_blk_pc_cmnd(struct scsi_cmnd *cmd, int retries);
154 155
155#endif /* _SCSI_SCSI_CMND_H */ 156#endif /* _SCSI_SCSI_CMND_H */