aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/advansys.c131
1 files changed, 39 insertions, 92 deletions
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 737c0e4b3190..3dd785617602 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -11331,80 +11331,26 @@ static int AdvExeScsiQueue(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq)
11331 */ 11331 */
11332static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp) 11332static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
11333{ 11333{
11334 asc_board_t *boardp; 11334 int ret, err_code;
11335 ASC_DVC_VAR *asc_dvc_varp; 11335 asc_board_t *boardp = ASC_BOARDP(scp->device->host);
11336 ADV_DVC_VAR *adv_dvc_varp;
11337 ADV_SCSI_REQ_Q *adv_scsiqp;
11338 int ret;
11339 11336
11340 ASC_DBG2(1, "asc_execute_scsi_cmnd: scp 0x%lx, done 0x%lx\n", 11337 ASC_DBG1(1, "asc_execute_scsi_cmnd: scp 0x%p\n", scp);
11341 (ulong)scp, (ulong)scp->scsi_done);
11342
11343 boardp = ASC_BOARDP(scp->device->host);
11344 11338
11345 if (ASC_NARROW_BOARD(boardp)) { 11339 if (ASC_NARROW_BOARD(boardp)) {
11346 /* 11340 ASC_DVC_VAR *asc_dvc = &boardp->dvc_var.asc_dvc_var;
11347 * Build and execute Narrow Board request.
11348 */
11349
11350 asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
11351 11341
11352 /* 11342 /* asc_build_req() can not return ASC_BUSY. */
11353 * Build Asc Library request structure using the
11354 * global structures 'asc_scsi_req' and 'asc_sg_head'.
11355 *
11356 * If an error is returned, then the request has been
11357 * queued on the board done queue. It will be completed
11358 * by the caller.
11359 *
11360 * asc_build_req() can not return ASC_BUSY.
11361 */
11362 if (asc_build_req(boardp, scp) == ASC_ERROR) { 11343 if (asc_build_req(boardp, scp) == ASC_ERROR) {
11363 ASC_STATS(scp->device->host, build_error); 11344 ASC_STATS(scp->device->host, build_error);
11364 return ASC_ERROR; 11345 return ASC_ERROR;
11365 } 11346 }
11366 11347
11367 switch (ret = AscExeScsiQueue(asc_dvc_varp, &asc_scsi_q)) { 11348 ret = AscExeScsiQueue(asc_dvc, &asc_scsi_q);
11368 case ASC_NOERROR: 11349 err_code = asc_dvc->err_code;
11369 ASC_STATS(scp->device->host, exe_noerror);
11370 /*
11371 * Increment monotonically increasing per device
11372 * successful request counter. Wrapping doesn't matter.
11373 */
11374 boardp->reqcnt[scp->device->id]++;
11375 ASC_DBG(1, "asc_execute_scsi_cmnd: AscExeScsiQueue(), "
11376 "ASC_NOERROR\n");
11377 break;
11378 case ASC_BUSY:
11379 ASC_STATS(scp->device->host, exe_busy);
11380 break;
11381 case ASC_ERROR:
11382 ASC_PRINT2("asc_execute_scsi_cmnd: board %d: "
11383 "AscExeScsiQueue() ASC_ERROR, err_code 0x%x\n",
11384 boardp->id, asc_dvc_varp->err_code);
11385 ASC_STATS(scp->device->host, exe_error);
11386 scp->result = HOST_BYTE(DID_ERROR);
11387 break;
11388 default:
11389 ASC_PRINT2("asc_execute_scsi_cmnd: board %d: "
11390 "AscExeScsiQueue() unknown, err_code 0x%x\n",
11391 boardp->id, asc_dvc_varp->err_code);
11392 ASC_STATS(scp->device->host, exe_unknown);
11393 scp->result = HOST_BYTE(DID_ERROR);
11394 break;
11395 }
11396 } else { 11350 } else {
11397 /* 11351 ADV_DVC_VAR *adv_dvc = &boardp->dvc_var.adv_dvc_var;
11398 * Build and execute Wide Board request. 11352 ADV_SCSI_REQ_Q *adv_scsiqp;
11399 */
11400 adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
11401 11353
11402 /*
11403 * Build and get a pointer to an Adv Library request structure.
11404 *
11405 * If the request is successfully built then send it below,
11406 * otherwise return with an error.
11407 */
11408 switch (adv_build_req(boardp, scp, &adv_scsiqp)) { 11354 switch (adv_build_req(boardp, scp, &adv_scsiqp)) {
11409 case ASC_NOERROR: 11355 case ASC_NOERROR:
11410 ASC_DBG(3, "asc_execute_scsi_cmnd: adv_build_req " 11356 ASC_DBG(3, "asc_execute_scsi_cmnd: adv_build_req "
@@ -11428,35 +11374,36 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
11428 return ASC_ERROR; 11374 return ASC_ERROR;
11429 } 11375 }
11430 11376
11431 switch (ret = AdvExeScsiQueue(adv_dvc_varp, adv_scsiqp)) { 11377 ret = AdvExeScsiQueue(adv_dvc, adv_scsiqp);
11432 case ASC_NOERROR: 11378 err_code = adv_dvc->err_code;
11433 ASC_STATS(scp->device->host, exe_noerror); 11379 }
11434 /* 11380
11435 * Increment monotonically increasing per device 11381 switch (ret) {
11436 * successful request counter. Wrapping doesn't matter. 11382 case ASC_NOERROR:
11437 */ 11383 ASC_STATS(scp->device->host, exe_noerror);
11438 boardp->reqcnt[scp->device->id]++; 11384 /*
11439 ASC_DBG(1, "asc_execute_scsi_cmnd: AdvExeScsiQueue(), " 11385 * Increment monotonically increasing per device
11440 "ASC_NOERROR\n"); 11386 * successful request counter. Wrapping doesn't matter.
11441 break; 11387 */
11442 case ASC_BUSY: 11388 boardp->reqcnt[scp->device->id]++;
11443 ASC_STATS(scp->device->host, exe_busy); 11389 ASC_DBG(1, "asc_execute_scsi_cmnd: ExeScsiQueue(), "
11444 break; 11390 "ASC_NOERROR\n");
11445 case ASC_ERROR: 11391 break;
11446 ASC_PRINT2("asc_execute_scsi_cmnd: board %d: " 11392 case ASC_BUSY:
11447 "AdvExeScsiQueue() ASC_ERROR, err_code 0x%x\n", 11393 ASC_STATS(scp->device->host, exe_busy);
11448 boardp->id, adv_dvc_varp->err_code); 11394 break;
11449 ASC_STATS(scp->device->host, exe_error); 11395 case ASC_ERROR:
11450 scp->result = HOST_BYTE(DID_ERROR); 11396 ASC_PRINT2("asc_execute_scsi_cmnd: board %d: ExeScsiQueue() "
11451 break; 11397 "ASC_ERROR, err_code 0x%x\n", boardp->id, err_code);
11452 default: 11398 ASC_STATS(scp->device->host, exe_error);
11453 ASC_PRINT2("asc_execute_scsi_cmnd: board %d: " 11399 scp->result = HOST_BYTE(DID_ERROR);
11454 "AdvExeScsiQueue() unknown, err_code 0x%x\n", 11400 break;
11455 boardp->id, adv_dvc_varp->err_code); 11401 default:
11456 ASC_STATS(scp->device->host, exe_unknown); 11402 ASC_PRINT2("asc_execute_scsi_cmnd: board %d: ExeScsiQueue() "
11457 scp->result = HOST_BYTE(DID_ERROR); 11403 "unknown, err_code 0x%x\n", boardp->id, err_code);
11458 break; 11404 ASC_STATS(scp->device->host, exe_unknown);
11459 } 11405 scp->result = HOST_BYTE(DID_ERROR);
11406 break;
11460 } 11407 }
11461 11408
11462 ASC_DBG(1, "asc_execute_scsi_cmnd: end\n"); 11409 ASC_DBG(1, "asc_execute_scsi_cmnd: end\n");