summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Bottomley <jejb@raven.il.steeleye.com>2003-01-27 23:01:23 -0600
committerJames Bottomley <jejb@raven.il.steeleye.com>2003-01-27 23:01:23 -0600
commit54a7ee17488d9dc71e2e182d613303df7fe21aa8 (patch)
tree339e69d399d8c36270d3e7e79da1e9d1cc7e5876
parentd0b8bb9f2d2a0931ca0cb1f0ef18cc131a73d42d (diff)
parent199662cab0f75773cfd3cce0a2d78dac6b78bb84 (diff)
Merge by hand
-rw-r--r--drivers/ieee1394/sbp2.c16
-rw-r--r--drivers/message/fusion/mptscsih.c38
-rw-r--r--drivers/scsi/3w-xxxx.c24
-rw-r--r--drivers/scsi/53c7,8xx.c156
-rw-r--r--drivers/scsi/53c700.c88
-rw-r--r--drivers/scsi/AM53C974.c90
-rw-r--r--drivers/scsi/BusLogic.c29
-rw-r--r--drivers/scsi/NCR5380.c66
-rw-r--r--drivers/scsi/aacraid/aachba.c60
-rw-r--r--drivers/scsi/advansys.c106
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c7
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c4
-rw-r--r--drivers/scsi/aic7xxx_old.c48
-rw-r--r--drivers/scsi/atp870u.c18
-rw-r--r--drivers/scsi/constants.c6
-rw-r--r--drivers/scsi/cpqfcTSinit.c26
-rw-r--r--drivers/scsi/dpt_i2o.c28
-rw-r--r--drivers/scsi/eata.c44
-rw-r--r--drivers/scsi/eata_dma.c40
-rw-r--r--drivers/scsi/eata_generic.h2
-rw-r--r--drivers/scsi/eata_pio.c30
-rw-r--r--drivers/scsi/fdomain.c26
-rw-r--r--drivers/scsi/g_NCR5380.c2
-rw-r--r--drivers/scsi/gdth.c70
-rw-r--r--drivers/scsi/gdth_proc.c26
-rw-r--r--drivers/scsi/hosts.c20
-rw-r--r--drivers/scsi/hosts.h3
-rw-r--r--drivers/scsi/ide-scsi.c14
-rw-r--r--drivers/scsi/in2000.c90
-rw-r--r--drivers/scsi/ini9100u.c16
-rw-r--r--drivers/scsi/inia100.c16
-rw-r--r--drivers/scsi/ips.c46
-rw-r--r--drivers/scsi/megaraid.c66
-rw-r--r--drivers/scsi/ncr53c8xx.c62
-rw-r--r--drivers/scsi/nsp32.c34
-rw-r--r--drivers/scsi/pci2000.c21
-rw-r--r--drivers/scsi/pci2000.h8
-rw-r--r--drivers/scsi/pci2220i.c22
-rw-r--r--drivers/scsi/qla1280.c16
-rw-r--r--drivers/scsi/qlogicfc.c24
-rw-r--r--drivers/scsi/qlogicisp.c12
-rw-r--r--drivers/scsi/scsi.c94
-rw-r--r--drivers/scsi/scsi.h58
-rw-r--r--drivers/scsi/scsi_debug.c22
-rw-r--r--drivers/scsi/scsi_error.c98
-rw-r--r--drivers/scsi/scsi_lib.c157
-rw-r--r--drivers/scsi/scsi_proc.c8
-rw-r--r--drivers/scsi/scsi_scan.c3
-rw-r--r--drivers/scsi/scsi_syms.c7
-rw-r--r--drivers/scsi/scsiiom.c12
-rw-r--r--drivers/scsi/sym53c8xx.c30
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c26
-rw-r--r--drivers/scsi/tmscsim.c60
-rw-r--r--drivers/scsi/u14-34f.c40
-rw-r--r--drivers/usb/storage/dpcm.c10
-rw-r--r--drivers/usb/storage/scsiglue.c20
-rw-r--r--drivers/usb/storage/transport.c4
-rw-r--r--drivers/usb/storage/usb.c10
58 files changed, 1205 insertions, 974 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 1ec7fc84aef8..3bfe3cca4f4e 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -829,7 +829,7 @@ static void sbp2util_free_command_dma(struct sbp2_command_info *command)
{
struct sbp2scsi_host_info *hi;
- hi = (struct sbp2scsi_host_info *) command->Current_SCpnt->host->hostdata[0];
+ hi = (struct sbp2scsi_host_info *) command->Current_SCpnt->device->host->hostdata[0];
if (hi == NULL) {
printk(KERN_ERR "%s: hi == NULL\n", __FUNCTION__);
@@ -2659,7 +2659,7 @@ static int sbp2scsi_queuecommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
/*
* Pull our host info and scsi id instance data from the scsi command
*/
- hi = (struct sbp2scsi_host_info *) SCpnt->host->hostdata[0];
+ hi = (struct sbp2scsi_host_info *) SCpnt->device->host->hostdata[0];
if (!hi) {
SBP2_ERR("sbp2scsi_host_info is NULL - this is bad!");
@@ -2668,7 +2668,7 @@ static int sbp2scsi_queuecommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
return(0);
}
- scsi_id = hi->scsi_id[SCpnt->target];
+ scsi_id = hi->scsi_id[SCpnt->device->id];
/*
* If scsi_id is null, it means there is no device in this slot,
@@ -2684,7 +2684,7 @@ static int sbp2scsi_queuecommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
* Until we handle multiple luns, just return selection time-out
* to any IO directed at non-zero LUNs
*/
- if (SCpnt->lun) {
+ if (SCpnt->device->lun) {
SCpnt->result = DID_NO_CONNECT << 16;
done (SCpnt);
return(0);
@@ -2882,8 +2882,8 @@ static void sbp2scsi_complete_command(struct sbp2scsi_host_info *hi, struct scsi
*/
static int sbp2scsi_abort (Scsi_Cmnd *SCpnt)
{
- struct sbp2scsi_host_info *hi = (struct sbp2scsi_host_info *) SCpnt->host->hostdata[0];
- struct scsi_id_instance_data *scsi_id = hi->scsi_id[SCpnt->target];
+ struct sbp2scsi_host_info *hi = (struct sbp2scsi_host_info *) SCpnt->device->host->hostdata[0];
+ struct scsi_id_instance_data *scsi_id = hi->scsi_id[SCpnt->device->id];
struct sbp2_command_info *command;
unsigned long flags;
@@ -2932,8 +2932,8 @@ static int sbp2scsi_abort (Scsi_Cmnd *SCpnt)
*/
static int sbp2scsi_reset (Scsi_Cmnd *SCpnt)
{
- struct sbp2scsi_host_info *hi = (struct sbp2scsi_host_info *) SCpnt->host->hostdata[0];
- struct scsi_id_instance_data *scsi_id = hi->scsi_id[SCpnt->target];
+ struct sbp2scsi_host_info *hi = (struct sbp2scsi_host_info *) SCpnt->device->host->hostdata[0];
+ struct scsi_id_instance_data *scsi_id = hi->scsi_id[SCpnt->device->id];
SBP2_ERR("reset requested");
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 965c1bb9636d..9234e9266485 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -775,7 +775,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
if (dlen >= SCSI_STD_INQUIRY_BYTES) {
mptscsih_initTarget(hd,
hd->port,
- sc->target,
+ sc->device->id,
pScsiReq->LUN[1],
sc->buffer,
dlen);
@@ -845,7 +845,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
/* GEM Workaround. */
if (hd->is_spi)
- mptscsih_no_negotiate(hd, sc->target);
+ mptscsih_no_negotiate(hd, sc->device->id);
break;
case MPI_IOCSTATUS_SCSI_IOC_TERMINATED: /* 0x004B */
@@ -857,7 +857,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
/* GEM Workaround. */
if (hd->is_spi)
- mptscsih_no_negotiate(hd, sc->target);
+ mptscsih_no_negotiate(hd, sc->device->id);
break;
case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: /* 0x0049 */
@@ -916,7 +916,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
) {
mptscsih_initTarget(hd,
hd->port,
- sc->target,
+ sc->device->id,
pScsiReq->LUN[1],
sc->buffer,
xfer_cnt);
@@ -1000,7 +1000,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
) {
mptscsih_initTarget(hd,
hd->port,
- sc->target,
+ sc->device->id,
pScsiReq->LUN[1],
sc->buffer,
xfer_cnt);
@@ -1594,10 +1594,10 @@ mptscsih_report_queue_full(Scsi_Cmnd *sc, SCSIIOReply_t *pScsiReply, SCSIIOReque
if (time - last_queue_full > 10 * HZ) {
char *ioc_str = "ioc?";
- if (sc->host != NULL && sc->host->hostdata != NULL)
- ioc_str = ((MPT_SCSI_HOST *)sc->host->hostdata)->ioc->name;
+ if (sc->device && sc->device->host != NULL && sc->device->host->hostdata != NULL)
+ ioc_str = ((MPT_SCSI_HOST *)sc->device->host->hostdata)->ioc->name;
printk(MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n",
- ioc_str, 0, sc->target, sc->lun);
+ ioc_str, 0, sc->device->id, sc->device->lun);
last_queue_full = time;
}
}
@@ -2576,9 +2576,9 @@ mptscsih_qcmd(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
int issueCmd;
did_errcode = 0;
- hd = (MPT_SCSI_HOST *) SCpnt->host->hostdata;
- target = SCpnt->target;
- lun = SCpnt->lun;
+ hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata;
+ target = SCpnt->device->id;
+ lun = SCpnt->device->lun;
SCpnt->scsi_done = done;
pTarget = hd->Targets[target];
@@ -3159,7 +3159,7 @@ mptscsih_abort(Scsi_Cmnd * SCpnt)
/* If we can't locate our host adapter structure, return FAILED status.
*/
- if ((hd = (MPT_SCSI_HOST *) SCpnt->host->hostdata) == NULL) {
+ if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL) {
SCpnt->result = DID_RESET << 16;
SCpnt->scsi_done(SCpnt);
nehprintk((KERN_WARNING MYNAM ": mptscsih_abort: "
@@ -3227,7 +3227,7 @@ mptscsih_abort(Scsi_Cmnd * SCpnt)
hd->abortSCpnt = SCpnt;
if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
- SCpnt->target, SCpnt->lun, ctx2abort, NO_SLEEP)
+ SCpnt->device->id, SCpnt->device->lun, ctx2abort, NO_SLEEP)
< 0) {
/* The TM request failed and the subsequent FW-reload failed!
@@ -3263,7 +3263,7 @@ mptscsih_dev_reset(Scsi_Cmnd * SCpnt)
/* If we can't locate our host adapter structure, return FAILED status.
*/
- if ((hd = (MPT_SCSI_HOST *) SCpnt->host->hostdata) == NULL){
+ if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
nehprintk((KERN_WARNING MYNAM ": mptscsih_dev_reset: "
"Can't locate host! (sc=%p)\n",
SCpnt));
@@ -3292,7 +3292,7 @@ mptscsih_dev_reset(Scsi_Cmnd * SCpnt)
}
if (mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
- SCpnt->target, 0, 0, NO_SLEEP)
+ SCpnt->device->id, 0, 0, NO_SLEEP)
< 0){
/* The TM request failed and the subsequent FW-reload failed!
* Fatal error case.
@@ -3323,7 +3323,7 @@ mptscsih_bus_reset(Scsi_Cmnd * SCpnt)
/* If we can't locate our host adapter structure, return FAILED status.
*/
- if ((hd = (MPT_SCSI_HOST *) SCpnt->host->hostdata) == NULL){
+ if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
nehprintk((KERN_WARNING MYNAM ": mptscsih_bus_reset: "
"Can't locate host! (sc=%p)\n",
SCpnt ) );
@@ -3385,7 +3385,7 @@ mptscsih_host_reset(Scsi_Cmnd *SCpnt)
int status = SUCCESS;
/* If we can't locate the host to reset, then we failed. */
- if ((hd = (MPT_SCSI_HOST *) SCpnt->host->hostdata) == NULL){
+ if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
nehprintk( ( KERN_WARNING MYNAM ": mptscsih_host_reset: "
"Can't locate host! (sc=%p)\n",
SCpnt ) );
@@ -4237,7 +4237,7 @@ copy_sense_data(Scsi_Cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply
pReq->LUN[1],
target->dev_vol_name);
else
- sprintf(devFoo, "%d:%d:%d", hd->ioc->id, sc->target, sc->lun);
+ sprintf(devFoo, "%d:%d:%d", hd->ioc->id, sc->device->id, sc->device->lun);
thisIo.DevIDStr = devFoo;
/* fubar */
thisIo.dataPtr = NULL;
@@ -4261,7 +4261,7 @@ SCPNT_TO_LOOKUP_IDX(Scsi_Cmnd *sc)
MPT_SCSI_HOST *hd;
int i;
- hd = (MPT_SCSI_HOST *) sc->host->hostdata;
+ hd = (MPT_SCSI_HOST *) sc->device->host->hostdata;
for (i = 0; i < hd->ioc->req_depth; i++) {
if (hd->ScsiLookup[i] == sc) {
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index faf4ddf39caf..7d3a468798a8 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -2187,7 +2187,7 @@ int tw_scsi_eh_abort(Scsi_Cmnd *SCpnt)
return (FAILED);
}
- tw_dev = (TW_Device_Extension *)SCpnt->host->hostdata;
+ tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata;
if (tw_dev == NULL) {
printk(KERN_WARNING "3w-xxxx: tw_scsi_eh_abort(): Invalid device extension.\n");
return (FAILED);
@@ -2200,14 +2200,14 @@ int tw_scsi_eh_abort(Scsi_Cmnd *SCpnt)
for (i=0;i<TW_Q_LENGTH;i++) {
if (tw_dev->srb[i] == SCpnt) {
if (tw_dev->state[i] == TW_S_STARTED) {
- printk(KERN_WARNING "3w-xxxx: scsi%d: Unit #%d: Command (%p) timed out.\n", tw_dev->host->host_no, tw_dev->srb[i]==0 ? 0 : tw_dev->srb[i]->target, SCpnt);
+ printk(KERN_WARNING "3w-xxxx: scsi%d: Unit #%d: Command (%p) timed out.\n", tw_dev->host->host_no, tw_dev->srb[i]==0 ? 0 : tw_dev->srb[i]->device->id, SCpnt);
tw_dev->state[i] = TW_S_COMPLETED;
tw_state_request_finish(tw_dev, i);
spin_unlock(&tw_dev->tw_lock);
return (SUCCESS);
}
if (tw_dev->state[i] == TW_S_PENDING) {
- printk(KERN_WARNING "3w-xxxx: scsi%d: Unit #%d: Command (%p) timed out.\n", tw_dev->host->host_no, tw_dev->srb[i]==0 ? 0 : tw_dev->srb[i]->target, SCpnt);
+ printk(KERN_WARNING "3w-xxxx: scsi%d: Unit #%d: Command (%p) timed out.\n", tw_dev->host->host_no, tw_dev->srb[i]==0 ? 0 : tw_dev->srb[i]->device->id, SCpnt);
if (tw_dev->pending_head == TW_Q_LENGTH-1) {
tw_dev->pending_head = TW_Q_START;
} else {
@@ -2221,7 +2221,7 @@ int tw_scsi_eh_abort(Scsi_Cmnd *SCpnt)
}
if (tw_dev->state[i] == TW_S_POSTED) {
/* If the command has already been posted, we have to reset the card */
- printk(KERN_WARNING "3w-xxxx: scsi%d: Unit #%d: Command (%p) timed out, resetting card.\n", tw_dev->host->host_no, tw_dev->srb[i]==0 ? 0 : tw_dev->srb[i]->target, SCpnt);
+ printk(KERN_WARNING "3w-xxxx: scsi%d: Unit #%d: Command (%p) timed out, resetting card.\n", tw_dev->host->host_no, tw_dev->srb[i]==0 ? 0 : tw_dev->srb[i]->device->id, SCpnt);
/* We have to let AEN requests through before the reset */
spin_unlock(&tw_dev->tw_lock);
spin_unlock_irq(tw_dev->host->host_lock);
@@ -2254,7 +2254,7 @@ int tw_scsi_eh_reset(Scsi_Cmnd *SCpnt)
return (FAILED);
}
- tw_dev = (TW_Device_Extension *)SCpnt->host->hostdata;
+ tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata;
if (tw_dev == NULL) {
printk(KERN_WARNING "3w-xxxx: tw_scsi_eh_reset(): Invalid device extension.\n");
return (FAILED);
@@ -2356,7 +2356,7 @@ int tw_scsi_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
int request_id = 0;
int error = 0;
unsigned long flags = 0;
- TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->host->hostdata;
+ TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata;
if (tw_dev == NULL) {
printk(KERN_WARNING "3w-xxxx: tw_scsi_queue(): Invalid device extension.\n");
@@ -2369,7 +2369,7 @@ int tw_scsi_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
dprintk(KERN_NOTICE "3w-xxxx: tw_scsi_queue()\n");
/* Skip scsi command if it isn't for us */
- if ((tw_dev->is_unit_present[SCpnt->target] == FALSE) || (SCpnt->lun != 0)) {
+ if ((tw_dev->is_unit_present[SCpnt->device->id] == FALSE) || (SCpnt->device->lun != 0)) {
SCpnt->result = (DID_BAD_TARGET << 16);
done(SCpnt);
spin_unlock_irqrestore(&tw_dev->tw_lock, flags);
@@ -2618,7 +2618,7 @@ int tw_scsiop_mode_sense(TW_Device_Extension *tw_dev, int request_id)
param = (TW_Param *)tw_dev->alignment_virtual_address[request_id];
memset(param, 0, sizeof(TW_Sector));
- param->table_id = TW_UNIT_INFORMATION_TABLE_BASE + tw_dev->srb[request_id]->target;
+ param->table_id = TW_UNIT_INFORMATION_TABLE_BASE + tw_dev->srb[request_id]->device->id;
param->parameter_id = 7; /* unit flags */
param->parameter_size_bytes = 1;
param_value = tw_dev->alignment_physical_address[request_id];
@@ -2697,7 +2697,7 @@ int tw_scsiop_read_capacity(TW_Device_Extension *tw_dev, int request_id)
command_packet->byte0.sgl_offset = 2;
command_packet->size = 4;
command_packet->request_id = request_id;
- command_packet->byte3.unit = tw_dev->srb[request_id]->target;
+ command_packet->byte3.unit = tw_dev->srb[request_id]->device->id;
command_packet->byte3.host_id = 0;
command_packet->status = 0;
command_packet->flags = 0;
@@ -2711,7 +2711,7 @@ int tw_scsiop_read_capacity(TW_Device_Extension *tw_dev, int request_id)
param = (TW_Param *)tw_dev->alignment_virtual_address[request_id];
memset(param, 0, sizeof(TW_Sector));
param->table_id = TW_UNIT_INFORMATION_TABLE_BASE +
- tw_dev->srb[request_id]->target;
+ tw_dev->srb[request_id]->device->id;
param->parameter_id = 4; /* unitcapacity parameter */
param->parameter_size_bytes = 4;
param_value = tw_dev->alignment_physical_address[request_id];
@@ -2817,7 +2817,7 @@ int tw_scsiop_read_write(TW_Device_Extension *tw_dev, int request_id)
command_packet->byte0.sgl_offset = 3;
command_packet->size = 3;
command_packet->request_id = request_id;
- command_packet->byte3.unit = srb->target;
+ command_packet->byte3.unit = srb->device->id;
command_packet->byte3.host_id = 0;
command_packet->status = 0;
command_packet->flags = 0;
@@ -2924,7 +2924,7 @@ int tw_scsiop_synchronize_cache(TW_Device_Extension *tw_dev, int request_id)
command_packet->byte0.sgl_offset = 0;
command_packet->size = 2;
command_packet->request_id = request_id;
- command_packet->byte3.unit = tw_dev->srb[request_id]->target;
+ command_packet->byte3.unit = tw_dev->srb[request_id]->device->id;
command_packet->byte3.host_id = 0;
command_packet->status = 0;
command_packet->flags = 0;
diff --git a/drivers/scsi/53c7,8xx.c b/drivers/scsi/53c7,8xx.c
index c020bcb039d9..42083940194d 100644
--- a/drivers/scsi/53c7,8xx.c
+++ b/drivers/scsi/53c7,8xx.c
@@ -1996,7 +1996,7 @@ NCR53c8xx_run_tests (struct Scsi_Host *host) {
static void
NCR53c8xx_dsa_fixup (struct NCR53c7x0_cmd *cmd) {
Scsi_Cmnd *c = cmd->cmd;
- struct Scsi_Host *host = c->host;
+ struct Scsi_Host *host = c->device->host;
struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *)
host->hostdata;
int i;
@@ -2034,16 +2034,16 @@ NCR53c8xx_dsa_fixup (struct NCR53c7x0_cmd *cmd) {
*/
patch_abs_tci_data (cmd->dsa, Ent_dsa_code_template / sizeof(u32),
- dsa_temp_lun, c->lun);
+ dsa_temp_lun, c->device->lun);
patch_abs_32 (cmd->dsa, Ent_dsa_code_template / sizeof(u32),
dsa_temp_addr_next, virt_to_bus(&cmd->dsa_next_addr));
patch_abs_32 (cmd->dsa, Ent_dsa_code_template / sizeof(u32),
dsa_temp_next, virt_to_bus(cmd->dsa) + Ent_dsa_zero -
Ent_dsa_code_template + A_dsa_next);
patch_abs_32 (cmd->dsa, Ent_dsa_code_template / sizeof(u32),
- dsa_temp_sync, virt_to_bus((void *)hostdata->sync[c->target].script));
+ dsa_temp_sync, virt_to_bus((void *)hostdata->sync[c->device->id].script));
patch_abs_tci_data (cmd->dsa, Ent_dsa_code_template / sizeof(u32),
- dsa_temp_target, c->target);
+ dsa_temp_target, c->device->id);
/* XXX - new pointer stuff */
patch_abs_32 (cmd->dsa, Ent_dsa_code_template / sizeof(u32),
dsa_temp_addr_saved_pointer, virt_to_bus(&cmd->saved_data_pointer));
@@ -2113,7 +2113,7 @@ run_process_issue_queue(void) {
static void
abnormal_finished (struct NCR53c7x0_cmd *cmd, int result) {
Scsi_Cmnd *c = cmd->cmd;
- struct Scsi_Host *host = c->host;
+ struct Scsi_Host *host = c->device->host;
struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *)
host->hostdata;
unsigned long flags;
@@ -2198,7 +2198,7 @@ abnormal_finished (struct NCR53c7x0_cmd *cmd, int result) {
host->host_no, c->pid);
else if (linux_search) {
*linux_prev = linux_search->next;
- --hostdata->busy[c->target][c->lun];
+ --hostdata->busy[c->device->id][c->device->lun];
}
/* Return the NCR command structure to the free list */
@@ -2526,9 +2526,9 @@ NCR53c8x0_dstat_sir_intr (struct Scsi_Host *host, struct
hostdata->dsp_changed = 1;
if (cmd && (cmd->flags & CMD_FLAG_SDTR)) {
printk ("scsi%d : target %d rejected SDTR\n", host->host_no,
- c->target);
+ c->device->id);
cmd->flags &= ~CMD_FLAG_SDTR;
- asynchronous (host, c->target);
+ asynchronous (host, c->device->id);
print = 0;
}
break;
@@ -2550,7 +2550,7 @@ NCR53c8x0_dstat_sir_intr (struct Scsi_Host *host, struct
if (print) {
printk ("scsi%d : received message", host->host_no);
if (c)
- printk (" from target %d lun %d ", c->target, c->lun);
+ printk (" from target %d lun %d ", c->device->id, c->device->lun);
print_msg ((unsigned char *) hostdata->msg_buf);
printk("\n");
}
@@ -2570,7 +2570,7 @@ NCR53c8x0_dstat_sir_intr (struct Scsi_Host *host, struct
if (cmd) {
char buf[80];
- sprintf (buf, "scsi%d : target %d %s ", host->host_no, c->target,
+ sprintf (buf, "scsi%d : target %d %s ", host->host_no, c->device->id,
(cmd->flags & CMD_FLAG_SDTR) ? "accepting" : "requesting");
print_synchronous (buf, (unsigned char *) hostdata->msg_buf);
@@ -2585,10 +2585,10 @@ NCR53c8x0_dstat_sir_intr (struct Scsi_Host *host, struct
if (cmd->flags & CMD_FLAG_SDTR) {
cmd->flags &= ~CMD_FLAG_SDTR;
if (hostdata->msg_buf[4])
- synchronous (host, c->target, (unsigned char *)
+ synchronous (host, c->device->id, (unsigned char *)
hostdata->msg_buf);
else
- asynchronous (host, c->target);
+ asynchronous (host, c->device->id);
hostdata->dsp = hostdata->script + hostdata->E_accept_message /
sizeof(u32);
hostdata->dsp_changed = 1;
@@ -2596,11 +2596,11 @@ NCR53c8x0_dstat_sir_intr (struct Scsi_Host *host, struct
} else {
if (hostdata->options & OPTION_SYNCHRONOUS) {
cmd->flags |= CMD_FLAG_DID_SDTR;
- synchronous (host, c->target, (unsigned char *)
+ synchronous (host, c->device->id, (unsigned char *)
hostdata->msg_buf);
} else {
hostdata->msg_buf[4] = 0; /* 0 offset = async */
- asynchronous (host, c->target);
+ asynchronous (host, c->device->id);
}
patch_dsa_32 (cmd->dsa, dsa_msgout_other, 0, le32_to_cpu(5));
patch_dsa_32 (cmd->dsa, dsa_msgout_other, 1, (u32)
@@ -2758,9 +2758,9 @@ NCR53c8x0_dstat_sir_intr (struct Scsi_Host *host, struct
NCR53c7x0_read8(SCNTL3_REG_800));
if (c) {
print_insn (host, (u32 *)
- hostdata->sync[c->target].script, "", 1);
+ hostdata->sync[c->device->id].script, "", 1);
print_insn (host, (u32 *)
- hostdata->sync[c->target].script + 2, "", 1);
+ hostdata->sync[c->device->id].script + 2, "", 1);
}
}
return SPECIFIC_INT_RESTART;
@@ -2866,7 +2866,7 @@ NCR53c8x0_dstat_sir_intr (struct Scsi_Host *host, struct
if (hostdata->options & (OPTION_DEBUG_SCRIPT|OPTION_DEBUG_INTR)) {
if (c)
printk("scsi%d : target %d lun %d disconnecting\n",
- host->host_no, c->target, c->lun);
+ host->host_no, c->device->id, c->device->lun);
else
printk("scsi%d : unknown target disconnecting\n",
host->host_no);
@@ -2887,9 +2887,9 @@ NCR53c8x0_dstat_sir_intr (struct Scsi_Host *host, struct
#endif
if (c) {
print_insn (host, (u32 *)
- hostdata->sync[c->target].script, "", 1);
+ hostdata->sync[c->device->id].script, "", 1);
print_insn (host, (u32 *)
- hostdata->sync[c->target].script + 2, "", 1);
+ hostdata->sync[c->device->id].script + 2, "", 1);
}
}
return SPECIFIC_INT_RESTART;
@@ -2940,8 +2940,8 @@ NCR53c8x0_dstat_sir_intr (struct Scsi_Host *host, struct
unsigned char sxfer = NCR53c7x0_read8 (SXFER_REG),
scntl3 = NCR53c7x0_read8 (SCNTL3_REG_800);
if (c) {
- if (sxfer != hostdata->sync[c->target].sxfer_sanity ||
- scntl3 != hostdata->sync[c->target].scntl3_sanity) {
+ if (sxfer != hostdata->sync[c->device->id].sxfer_sanity ||
+ scntl3 != hostdata->sync[c->device->id].scntl3_sanity) {
printk ("scsi%d : sync sanity check failed sxfer=0x%x, scntl3=0x%x",
host->host_no, sxfer, scntl3);
NCR53c7x0_write8 (SXFER_REG, sxfer);
@@ -2982,9 +2982,9 @@ NCR53c8x0_dstat_sir_intr (struct Scsi_Host *host, struct
(DCMD_REG)) == hostdata->script +
Ent_select_check_dsa / sizeof(u32) ?
"selection" : "reselection";
- if (c && sdid != c->target) {
+ if (c && sdid != c->device->id) {
printk ("scsi%d : SDID target %d != DSA target %d at %s\n",
- host->host_no, sdid, c->target, where);
+ host->host_no, sdid, c->device->id, where);
print_lots(host);
dump_events (host, 20);
return SPECIFIC_INT_PANIC;
@@ -3016,7 +3016,7 @@ NCR53c8x0_dstat_sir_intr (struct Scsi_Host *host, struct
if (event->event == EVENT_RESELECT)
event->lun = hostdata->reselected_identify & 0xf;
else if (c)
- event->lun = c->lun;
+ event->lun = c->device->lun;
else
event->lun = 255;
do_gettimeofday(&(event->time));
@@ -3430,7 +3430,7 @@ NCR53c8x0_soft_reset (struct Scsi_Host *host) {
static struct NCR53c7x0_cmd *
allocate_cmd (Scsi_Cmnd *cmd) {
- struct Scsi_Host *host = cmd->host;
+ struct Scsi_Host *host = cmd->device->host;
struct NCR53c7x0_hostdata *hostdata =
(struct NCR53c7x0_hostdata *) host->hostdata;
void *real; /* Real address */
@@ -3442,8 +3442,8 @@ allocate_cmd (Scsi_Cmnd *cmd) {
printk ("scsi%d : num_cmds = %d, can_queue = %d\n"
" target = %d, lun = %d, %s\n",
host->host_no, hostdata->num_cmds, host->can_queue,
- cmd->target, cmd->lun, (hostdata->cmd_allocated[cmd->target] &
- (1 << cmd->lun)) ? "already allocated" : "not allocated");
+ cmd->device->id, cmd->device->lun, (hostdata->cmd_allocated[cmd->device->id] &
+ (1 << cmd->device->lun)) ? "already allocated" : "not allocated");
/*
* If we have not yet reserved commands for this I_T_L nexus, and
@@ -3451,12 +3451,12 @@ allocate_cmd (Scsi_Cmnd *cmd) {
* being allocated under 1.3.x, or being outside of scan_scsis in
* 1.2.x), do so now.
*/
- if (!(hostdata->cmd_allocated[cmd->target] & (1 << cmd->lun)) &&
+ if (!(hostdata->cmd_allocated[cmd->device->id] & (1 << cmd->device->lun)) &&
cmd->device && cmd->device->has_cmdblocks
) {
if ((hostdata->extra_allocate + hostdata->num_cmds) < host->can_queue)
hostdata->extra_allocate += host->cmd_per_lun;
- hostdata->cmd_allocated[cmd->target] |= (1 << cmd->lun);
+ hostdata->cmd_allocated[cmd->device->id] |= (1 << cmd->device->lun);
}
for (; hostdata->extra_allocate > 0 ; --hostdata->extra_allocate,
@@ -3491,7 +3491,7 @@ allocate_cmd (Scsi_Cmnd *cmd) {
restore_flags(flags);
if (!tmp)
printk ("scsi%d : can't allocate command for target %d lun %d\n",
- host->host_no, cmd->target, cmd->lun);
+ host->host_no, cmd->device->id, cmd->device->lun);
return tmp;
}
@@ -3512,7 +3512,7 @@ allocate_cmd (Scsi_Cmnd *cmd) {
static struct NCR53c7x0_cmd *
create_cmd (Scsi_Cmnd *cmd) {
NCR53c7x0_local_declare();
- struct Scsi_Host *host = cmd->host;
+ struct Scsi_Host *host = cmd->device->host;
struct NCR53c7x0_hostdata *hostdata = (struct NCR53c7x0_hostdata *)
host->hostdata;
struct NCR53c7x0_cmd *tmp; /* NCR53c7x0_cmd structure for this command */
@@ -3527,7 +3527,7 @@ create_cmd (Scsi_Cmnd *cmd) {
int msglen; /* Length of whole select message */
#endif
unsigned long flags;
- NCR53c7x0_local_setup(cmd->host);
+ NCR53c7x0_local_setup(cmd->device->host);
if (!(tmp = allocate_cmd (cmd)))
return NULL;
@@ -3664,44 +3664,44 @@ create_cmd (Scsi_Cmnd *cmd) {
patch_dsa_32(tmp->dsa, dsa_cmnd, 0, le32_to_cpu(virt_to_bus(cmd)));
if (hostdata->options & OPTION_DEBUG_SYNCHRONOUS)
- if (hostdata->sync[cmd->target].select_indirect !=
- ((hostdata->sync[cmd->target].scntl3_sanity << 24) |
- (cmd->target << 16) |
- (hostdata->sync[cmd->target].sxfer_sanity << 8))) {
+ if (hostdata->sync[cmd->device->id].select_indirect !=
+ ((hostdata->sync[cmd->device->id].scntl3_sanity << 24) |
+ (cmd->device->id << 16) |
+ (hostdata->sync[cmd->device->id].sxfer_sanity << 8))) {
printk ("scsi%d : sanity check failed select_indirect=0x%x\n",
- host->host_no, hostdata->sync[cmd->target].select_indirect);
+ host->host_no, hostdata->sync[cmd->device->id].select_indirect);
FATAL(host);
}
- patch_dsa_32(tmp->dsa, dsa_select, 0, le32_to_cpu(hostdata->sync[cmd->target].
+ patch_dsa_32(tmp->dsa, dsa_select, 0, le32_to_cpu(hostdata->sync[cmd->device->id].
select_indirect));
/*
* Right now, we'll do the WIDE and SYNCHRONOUS negotiations on
* different commands; although it should be trivial to do them
* both at the same time.
*/
- if (hostdata->initiate_wdtr & (1 << cmd->target)) {
+ if (hostdata->initiate_wdtr & (1 << cmd->device->id)) {
memcpy ((void *) (tmp->select + 1), (void *) wdtr_message,
sizeof(wdtr_message));
patch_dsa_32(tmp->dsa, dsa_msgout, 0, le32_to_cpu(1 + sizeof(wdtr_message)));
save_flags(flags);
cli();
- hostdata->initiate_wdtr &= ~(1 << cmd->target);
+ hostdata->initiate_wdtr &= ~(1 << cmd->device->id);
restore_flags(flags);
- } else if (hostdata->initiate_sdtr & (1 << cmd->target)) {
+ } else if (hostdata->initiate_sdtr & (1 << cmd->device->id)) {
memcpy ((void *) (tmp->select + 1), (void *) sdtr_message,
sizeof(sdtr_message));
patch_dsa_32(tmp->dsa, dsa_msgout, 0, le32_to_cpu(1 + sizeof(sdtr_message)));
tmp->flags |= CMD_FLAG_SDTR;
save_flags(flags);
cli();
- hostdata->initiate_sdtr &= ~(1 << cmd->target);
+ hostdata->initiate_sdtr &= ~(1 << cmd->device->id);
restore_flags(flags);
}
#if 1
- else if (!(hostdata->talked_to & (1 << cmd->target)) &&
+ else if (!(hostdata->talked_to & (1 << cmd->device->id)) &&
!(hostdata->options & OPTION_NO_ASYNC)) {
memcpy ((void *) (tmp->select + 1), (void *) async_message,
sizeof(async_message));
@@ -3711,9 +3711,9 @@ create_cmd (Scsi_Cmnd *cmd) {
#endif
else
patch_dsa_32(tmp->dsa, dsa_msgout, 0, le32_to_cpu(1));
- hostdata->talked_to |= (1 << cmd->target);
+ hostdata->talked_to |= (1 << cmd->device->id);
tmp->select[0] = (hostdata->options & OPTION_DISCONNECT) ?
- IDENTIFY (1, cmd->lun) : IDENTIFY (0, cmd->lun);
+ IDENTIFY (1, cmd->device->lun) : IDENTIFY (0, cmd->device->lun);
patch_dsa_32(tmp->dsa, dsa_msgout, 1, le32_to_cpu(virt_to_bus(tmp->select)));
patch_dsa_32(tmp->dsa, dsa_cmdout, 0, le32_to_cpu(cmd->cmd_len));
patch_dsa_32(tmp->dsa, dsa_cmdout, 1, le32_to_cpu(virt_to_bus(cmd->cmnd)));
@@ -3879,7 +3879,7 @@ create_cmd (Scsi_Cmnd *cmd) {
int
NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) {
- struct Scsi_Host *host = cmd->host;
+ struct Scsi_Host *host = cmd->device->host;
struct NCR53c7x0_hostdata *hostdata =
(struct NCR53c7x0_hostdata *) host->hostdata;
unsigned long flags;
@@ -3894,12 +3894,12 @@ NCR53c7xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *)) {
cli();
if ((hostdata->options & (OPTION_DEBUG_INIT_ONLY|OPTION_DEBUG_PROBE_ONLY))
|| ((hostdata->options & OPTION_DEBUG_TARGET_LIMIT) &&
- !(hostdata->debug_lun_limit[cmd->target] & (1 << cmd->lun)))
- || cmd->target > host->max_id
- || cmd->target == host->this_id
+ !(hostdata->debug_lun_limit[cmd->device->id] & (1 << cmd->device->lun)))
+ || cmd->device->id > host->max_id
+ || cmd->device->id == host->this_id
|| hostdata->state == STATE_DISABLED) {
printk("scsi%d : disabled or bad target %d lun %d\n", host->host_no,
- cmd->target, cmd->lun);
+ cmd->device->id, cmd->device->lun);
cmd->result = DID_BAD_TARGET << 16;
} else if ((hostdata->options & OPTION_DEBUG_NCOMMANDS_LIMIT) &&
(hostdata->debug_count_limit == 0)) {
@@ -4000,7 +4000,7 @@ to_schedule_list (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata,
--i, curr += 2 /* JUMP instructions are two words */);
if (i > 0) {
- ++hostdata->busy[tmp->target][tmp->lun];
+ ++hostdata->busy[tmp->device->id][tmp->device->lun];
cmd->next = hostdata->running_list;
hostdata->running_list = cmd;
@@ -4057,7 +4057,7 @@ busyp (struct Scsi_Host *host, struct NCR53c7x0_hostdata *hostdata,
/* FIXME : in the future, this needs to accommodate SCSI-II tagged
queuing, and we may be able to play with fairness here a bit.
*/
- return hostdata->busy[cmd->target][cmd->lun];
+ return hostdata->busy[cmd->device->id][cmd->device->lun];
}
/*
@@ -4131,7 +4131,7 @@ process_issue_queue (unsigned long flags) {
if (tmp->host_scribble) {
if (hostdata->options & OPTION_DEBUG_QUEUES)
printk ("scsi%d : moving command for target %d lun %d to start list\n",
- host->host_no, tmp->target, tmp->lun);
+ host->host_no, tmp->device->id, tmp->device->lun);
to_schedule_list (host, hostdata,
@@ -4205,7 +4205,7 @@ intr_scsi (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) {
printk ("scsi%d : Selection Timeout\n", host->host_no);
if (cmd) {
printk("scsi%d : target %d, lun %d, command ",
- host->host_no, cmd->cmd->target, cmd->cmd->lun);
+ host->host_no, cmd->cmd->device->id, cmd->cmd->device->lun);
print_command (cmd->cmd->cmnd);
printk("scsi%d : dsp = 0x%x (virt 0x%p)\n", host->host_no,
NCR53c7x0_read32(DSP_REG),
@@ -4243,7 +4243,7 @@ intr_scsi (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) {
fatal = 1;
if (cmd) {
printk("scsi%d : target %d lun %d unexpected disconnect\n",
- host->host_no, cmd->cmd->target, cmd->cmd->lun);
+ host->host_no, cmd->cmd->device->id, cmd->cmd->device->lun);
print_lots (host);
abnormal_finished(cmd, DID_ERROR << 16);
} else
@@ -4259,7 +4259,7 @@ intr_scsi (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) {
fatal = 1;
if (cmd && cmd->cmd) {
printk("scsi%d : target %d lun %d parity error.\n",
- host->host_no, cmd->cmd->target, cmd->cmd->lun);
+ host->host_no, cmd->cmd->device->id, cmd->cmd->device->lun);
abnormal_finished (cmd, DID_PARITY << 16);
} else
printk("scsi%d : parity error\n", host->host_no);
@@ -4489,7 +4489,7 @@ restart:
if (cmd_prev_ptr)
*cmd_prev_ptr = (struct NCR53c7x0_cmd *) cmd->next;
- --hostdata->busy[tmp->target][tmp->lun];
+ --hostdata->busy[tmp->device->id][tmp->device->lun];
cmd->next = hostdata->free;
hostdata->free = cmd;
@@ -4497,7 +4497,7 @@ restart:
if (hostdata->options & OPTION_DEBUG_INTR) {
printk ("scsi%d : command complete : pid %lu, id %d,lun %d result 0x%x ",
- host->host_no, tmp->pid, tmp->target, tmp->lun, tmp->result);
+ host->host_no, tmp->pid, tmp->device->id, tmp->device->lun, tmp->result);
print_command (tmp->cmnd);
}
@@ -4559,8 +4559,8 @@ restart:
if (hostdata->options & OPTION_DEBUG_INTR) {
if (cmd) {
printk("scsi%d : interrupt for pid %lu, id %d, lun %d ",
- host->host_no, cmd->cmd->pid, (int) cmd->cmd->target,
- (int) cmd->cmd->lun);
+ host->host_no, cmd->cmd->pid, (int) cmd->cmd->device->id,
+ (int) cmd->cmd->device->lun);
print_command (cmd->cmd->cmnd);
} else {
printk("scsi%d : no active command\n", host->host_no);
@@ -4951,7 +4951,7 @@ intr_phase_mismatch (struct Scsi_Host *host, struct NCR53c7x0_cmd *cmd) {
hostdata->dsp = dsp + 2 /* two _words_ */;
hostdata->dsp_changed = 1;
printk ("scsi%d : target %d ignored SDTR and went into COMMAND OUT\n",
- host->host_no, cmd->cmd->target);
+ host->host_no, cmd->cmd->device->id);
cmd->flags &= ~CMD_FLAG_SDTR;
action = ACTION_CONTINUE;
break;
@@ -5465,7 +5465,7 @@ ncr_state (int state) {
int
NCR53c7xx_abort (Scsi_Cmnd *cmd) {
NCR53c7x0_local_declare();
- struct Scsi_Host *host = cmd->host;
+ struct Scsi_Host *host = cmd->device->host;
struct NCR53c7x0_hostdata *hostdata = host ? (struct NCR53c7x0_hostdata *)
host->hostdata : NULL;
unsigned long flags;
@@ -5575,7 +5575,7 @@ NCR53c7xx_abort (Scsi_Cmnd *cmd) {
return SCSI_ABORT_NOT_RUNNING;
} else {
printk ("scsi%d : DANGER : command running, can not abort.\n",
- cmd->host->host_no);
+ cmd->device->host->host_no);
restore_flags(flags);
return SCSI_ABORT_BUSY;
}
@@ -5606,7 +5606,7 @@ NCR53c7xx_abort (Scsi_Cmnd *cmd) {
* command was ever counted as BUSY, so if we end up here we can
* decrement the busy count if and only if it is necessary.
*/
- --hostdata->busy[cmd->target][cmd->lun];
+ --hostdata->busy[cmd->device->id][cmd->device->lun];
}
restore_flags(flags);
cmd->scsi_done(cmd);
@@ -5651,7 +5651,7 @@ NCR53c7xx_reset (Scsi_Cmnd *cmd, unsigned int reset_flags) {
* each command.
*/
Scsi_Cmnd *nuke_list = NULL;
- struct Scsi_Host *host = cmd->host;
+ struct Scsi_Host *host = cmd->device->host;
struct NCR53c7x0_hostdata *hostdata =
(struct NCR53c7x0_hostdata *) host->hostdata;
@@ -5722,7 +5722,7 @@ NCR53c7xx_reset (Scsi_Cmnd *cmd, unsigned int reset_flags) {
static int
insn_to_offset (Scsi_Cmnd *cmd, u32 *insn) {
struct NCR53c7x0_hostdata *hostdata =
- (struct NCR53c7x0_hostdata *) cmd->host->hostdata;
+ (struct NCR53c7x0_hostdata *) cmd->device->host->hostdata;
struct NCR53c7x0_cmd *ncmd =
(struct NCR53c7x0_cmd *) cmd->host_scribble;
int offset = 0, buffers;
@@ -5790,7 +5790,7 @@ print_progress (Scsi_Cmnd *cmd) {
int offset, i;
char *where;
u32 *ptr;
- NCR53c7x0_local_setup (cmd->host);
+ NCR53c7x0_local_setup (cmd->device->host);
for (i = 0; i < 2; ++i) {
if (check_address ((unsigned long) ncmd,
sizeof (struct NCR53c7x0_cmd)) == -1)
@@ -5808,15 +5808,15 @@ print_progress (Scsi_Cmnd *cmd) {
if (offset != -1)
printk ("scsi%d : %s data pointer at offset %d\n",
- cmd->host->host_no, where, offset);
+ cmd->device->host->host_no, where, offset);
else {
int size;
printk ("scsi%d : can't determine %s data pointer offset\n",
- cmd->host->host_no, where);
+ cmd->device->host->host_no, where);
if (ncmd) {
- size = print_insn (cmd->host,
+ size = print_insn (cmd->device->host,
bus_to_virt(le32_to_cpu(ncmd->saved_data_pointer)), "", 1);
- print_insn (cmd->host,
+ print_insn (cmd->device->host,
bus_to_virt(le32_to_cpu(ncmd->saved_data_pointer)) + size * sizeof(u32),
"", 1);
}
@@ -5872,7 +5872,7 @@ print_dsa (struct Scsi_Host *host, u32 *dsa, const char *prefix) {
(u32) virt_to_bus(cmd));
if (cmd) {
printk(" result = 0x%x, target = %d, lun = %d, cmd = ",
- cmd->result, cmd->target, cmd->lun);
+ cmd->result, cmd->device->id, cmd->device->lun);
print_command(cmd->cmnd);
} else
printk("\n");
@@ -5881,11 +5881,11 @@ print_dsa (struct Scsi_Host *host, u32 *dsa, const char *prefix) {
if (cmd) {
printk("scsi%d target %d : sxfer_sanity = 0x%x, scntl3_sanity = 0x%x\n"
" script : ",
- host->host_no, cmd->target,
- hostdata->sync[cmd->target].sxfer_sanity,
- hostdata->sync[cmd->target].scntl3_sanity);
- for (i = 0; i < (sizeof(hostdata->sync[cmd->target].script) / 4); ++i)
- printk ("0x%x ", hostdata->sync[cmd->target].script[i]);
+ host->host_no, cmd->device->id,
+ hostdata->sync[cmd->device->id].sxfer_sanity,
+ hostdata->sync[cmd->device->id].scntl3_sanity);
+ for (i = 0; i < (sizeof(hostdata->sync[cmd->device->id].script) / 4); ++i)
+ printk ("0x%x ", hostdata->sync[cmd->device->id].script[i]);
printk ("\n");
print_progress (cmd);
}
@@ -5927,7 +5927,7 @@ print_queues (struct Scsi_Host *host) {
print_dsa (host, bus_to_virt(le32_to_cpu(((struct NCR53c7x0_cmd *) cmd->host_scribble)-> dsa)), "");
} else
printk ("scsi%d : scsi pid %ld for target %d lun %d has no NCR53c7x0_cmd\n",
- host->host_no, cmd->pid, cmd->target, cmd->lun);
+ host->host_no, cmd->pid, cmd->device->id, cmd->device->lun);
restore_flags(flags);
}
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index ffe1f6704a9b..62f7f53f1448 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -765,8 +765,8 @@ process_extended_message(struct Scsi_Host *host,
__u8 pun = 0xff, lun = 0xff;
if(SCp != NULL) {
- pun = SCp->target;
- lun = SCp->lun;
+ pun = SCp->device->id;
+ lun = SCp->device->lun;
}
switch(hostdata->msgin[2]) {
@@ -846,8 +846,8 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata
__u8 pun = 0xff, lun = 0xff;
if(SCp != NULL) {
- pun = SCp->target;
- lun = SCp->lun;
+ pun = SCp->device->id;
+ lun = SCp->device->lun;
}
#ifdef NCR_700_DEBUG
@@ -874,7 +874,7 @@ process_message(struct Scsi_Host *host, struct NCR_700_Host_Parameters *hostdata
/* rejected our first simple tag message */
printk(KERN_WARNING "scsi%d (%d:%d) Rejected first tag queue attempt, turning off tag queueing\n", host->host_no, pun, lun);
NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING);
- hostdata->tag_negotiated &= ~(1<<SCp->target);
+ hostdata->tag_negotiated &= ~(1<<SCp->device->id);
SCp->device->tagged_supported = 0;
scsi_deactivate_tcq(SCp->device, host->cmd_per_lun);
} else {
@@ -928,8 +928,8 @@ process_script_interrupt(__u32 dsps, __u32 dsp, Scsi_Cmnd *SCp,
__u8 pun = 0xff, lun=0xff;
if(SCp != NULL) {
- pun = SCp->target;
- lun = SCp->lun;
+ pun = SCp->device->id;
+ lun = SCp->device->lun;
}
if(dsps == A_GOOD_STATUS_AFTER_STATUS) {
@@ -963,7 +963,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, Scsi_Cmnd *SCp,
NCR_700_unmap(hostdata, SCp, slot);
SCp->cmnd[0] = REQUEST_SENSE;
- SCp->cmnd[1] = (SCp->lun & 0x7) << 5;
+ SCp->cmnd[1] = (SCp->device->lun & 0x7) << 5;
SCp->cmnd[2] = 0;
SCp->cmnd[3] = 0;
SCp->cmnd[4] = sizeof(SCp->sense_buffer);
@@ -1010,11 +1010,11 @@ process_script_interrupt(__u32 dsps, __u32 dsp, Scsi_Cmnd *SCp,
// DMA_FROM_DEVICE);
// if(((char *)SCp->request_buffer)[7] & 0x02) {
// printk(KERN_INFO "scsi%d: (%d:%d) Enabling Tag Command Queuing\n", host->host_no, pun, lun);
- // hostdata->tag_negotiated |= (1<<SCp->target);
+ // hostdata->tag_negotiated |= (1<<SCp->device->id);
// NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING);
// } else {
// NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING);
- // hostdata->tag_negotiated &= ~(1<<SCp->target);
+ // hostdata->tag_negotiated &= ~(1<<SCp->device->id);
// }
//}
NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]);
@@ -1352,7 +1352,7 @@ NCR_700_start_command(Scsi_Cmnd *SCp)
struct NCR_700_command_slot *slot =
(struct NCR_700_command_slot *)SCp->host_scribble;
struct NCR_700_Host_Parameters *hostdata =
- (struct NCR_700_Host_Parameters *)SCp->host->hostdata[0];
+ (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0];
__u16 count = 1; /* for IDENTIFY message */
if(hostdata->state != NCR_700_HOST_FREE) {
@@ -1362,7 +1362,7 @@ NCR_700_start_command(Scsi_Cmnd *SCp)
slot->state = NCR_700_SLOT_QUEUED;
DEBUG(("scsi%d: host busy, queueing command %p, slot %p\n",
- SCp->host->host_no, slot->cmnd, slot));
+ SCp->device->host->host_no, slot->cmnd, slot));
return 0;
}
hostdata->state = NCR_700_HOST_BUSY;
@@ -1372,7 +1372,7 @@ NCR_700_start_command(Scsi_Cmnd *SCp)
* set up so we cannot take a selection interrupt */
hostdata->msgout[0] = NCR_700_identify(SCp->cmnd[0] != REQUEST_SENSE,
- SCp->lun);
+ SCp->device->lun);
/* for INQUIRY or REQUEST_SENSE commands, we cannot be sure
* if the negotiated transfer parameters still hold, so
* always renegotiate them */
@@ -1384,7 +1384,7 @@ NCR_700_start_command(Scsi_Cmnd *SCp)
* If a contingent allegiance condition exists, the device
* will refuse all tags, so send the request sense as untagged
* */
- if((hostdata->tag_negotiated & (1<<SCp->target))
+ if((hostdata->tag_negotiated & (1<<SCp->device->id))
&& (slot->tag != SCSI_NO_TAG && SCp->cmnd[0] != REQUEST_SENSE)) {
count += scsi_populate_tag_msg(SCp, &hostdata->msgout[count]);
}
@@ -1401,7 +1401,7 @@ NCR_700_start_command(Scsi_Cmnd *SCp)
script_patch_ID(hostdata->script,
- Device_ID, 1<<SCp->target);
+ Device_ID, 1<<SCp->device->id);
script_patch_32_abs(hostdata->script, CommandAddress,
slot->pCmd);
@@ -1410,7 +1410,7 @@ NCR_700_start_command(Scsi_Cmnd *SCp)
* */
script_patch_32_abs(hostdata->script, SGScriptStartAddress,
to32bit(&slot->pSG[0].ins));
- NCR_700_clear_fifo(SCp->host);
+ NCR_700_clear_fifo(SCp->device->host);
if(slot->resume_offset == 0)
slot->resume_offset = hostdata->pScript;
@@ -1423,9 +1423,9 @@ NCR_700_start_command(Scsi_Cmnd *SCp)
/* set the synchronous period/offset */
NCR_700_writeb(NCR_700_get_SXFER(SCp->device),
- SCp->host, SXFER_REG);
- NCR_700_writel(slot->temp, SCp->host, TEMP_REG);
- NCR_700_writel(slot->resume_offset, SCp->host, DSP_REG);
+ SCp->device->host, SXFER_REG);
+ NCR_700_writel(slot->temp, SCp->device->host, TEMP_REG);
+ NCR_700_writel(slot->resume_offset, SCp->device->host, DSP_REG);
return 1;
}
@@ -1479,8 +1479,8 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs)
dsp, dsps));
if(SCp != NULL) {
- pun = SCp->target;
- lun = SCp->lun;
+ pun = SCp->device->id;
+ lun = SCp->device->lun;
}
if(sstat0 & SCSI_RESET_DETECTED) {
@@ -1735,7 +1735,7 @@ STATIC int
NCR_700_queuecommand(Scsi_Cmnd *SCp, void (*done)(Scsi_Cmnd *))
{
struct NCR_700_Host_Parameters *hostdata =
- (struct NCR_700_Host_Parameters *)SCp->host->hostdata[0];
+ (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0];
__u32 move_ins;
enum dma_data_direction direction;
struct NCR_700_command_slot *slot;
@@ -1743,7 +1743,7 @@ NCR_700_queuecommand(Scsi_Cmnd *SCp, void (*done)(Scsi_Cmnd *))
if(hostdata->command_slot_count >= NCR_700_COMMAND_SLOTS_PER_HOST) {
/* We're over our allocation, this should never happen
* since we report the max allocation to the mid layer */
- printk(KERN_WARNING "scsi%d: Command depth has gone over queue depth\n", SCp->host->host_no);
+ printk(KERN_WARNING "scsi%d: Command depth has gone over queue depth\n", SCp->device->host->host_no);
return 1;
}
/* check for untagged commands. We cannot have any outstanding
@@ -1753,16 +1753,16 @@ NCR_700_queuecommand(Scsi_Cmnd *SCp, void (*done)(Scsi_Cmnd *))
* - The blk layer sent and untagged command
*/
if(NCR_700_get_depth(SCp->device) != 0
- && (!(hostdata->tag_negotiated & (1<<SCp->target))
+ && (!(hostdata->tag_negotiated & (1<<SCp->device->id))
|| !blk_rq_tagged(SCp->request))) {
DEBUG((KERN_ERR "scsi%d (%d:%d) has non zero depth %d\n",
- SCp->host->host_no, SCp->target, SCp->lun,
+ SCp->device->host->host_no, SCp->device->id, SCp->device->lun,
NCR_700_get_depth(SCp->device)));
return SCSI_MLQUEUE_DEVICE_BUSY;
}
if(NCR_700_get_depth(SCp->device) >= NCR_700_MAX_TAGS) {
DEBUG((KERN_ERR "scsi%d (%d:%d) has max tag depth %d\n",
- SCp->host->host_no, SCp->target, SCp->lun,
+ SCp->device->host->host_no, SCp->device->id, SCp->device->lun,
NCR_700_get_depth(SCp->device)));
return SCSI_MLQUEUE_DEVICE_BUSY;
}
@@ -1781,11 +1781,11 @@ NCR_700_queuecommand(Scsi_Cmnd *SCp, void (*done)(Scsi_Cmnd *))
SCp->SCp.buffer = NULL;
#ifdef NCR_700_DEBUG
- printk("53c700: scsi%d, command ", SCp->host->host_no);
+ printk("53c700: scsi%d, command ", SCp->device->host->host_no);
print_command(SCp->cmnd);
#endif
if(SCp->device->tagged_supported && !SCp->device->tagged_queue
- && (hostdata->tag_negotiated &(1<<SCp->target)) == 0
+ && (hostdata->tag_negotiated &(1<<SCp->device->id)) == 0
&& NCR_700_is_flag_clear(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING)) {
/* upper layer has indicated tags are supported. We don't
* necessarily believe it yet.
@@ -1797,9 +1797,9 @@ NCR_700_queuecommand(Scsi_Cmnd *SCp, void (*done)(Scsi_Cmnd *))
}
if(blk_rq_tagged(SCp->request)
- && (hostdata->tag_negotiated &(1<<SCp->target)) == 0) {
- printk(KERN_INFO "scsi%d: (%d:%d) Enabling Tag Command Queuing\n", SCp->device->host->host_no, SCp->target, SCp->lun);
- hostdata->tag_negotiated |= (1<<SCp->target);
+ && (hostdata->tag_negotiated &(1<<SCp->device->id)) == 0) {
+ printk(KERN_INFO "scsi%d: (%d:%d) Enabling Tag Command Queuing\n", SCp->device->host->host_no, SCp->device->id, SCp->device->lun);
+ hostdata->tag_negotiated |= (1<<SCp->device->id);
NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING);
}
@@ -1810,15 +1810,15 @@ NCR_700_queuecommand(Scsi_Cmnd *SCp, void (*done)(Scsi_Cmnd *))
* FIXME: This will royally screw up on multiple LUN devices
* */
if(!blk_rq_tagged(SCp->request)
- && (hostdata->tag_negotiated &(1<<SCp->target))) {
- printk(KERN_INFO "scsi%d: (%d:%d) Disabling Tag Command Queuing\n", SCp->device->host->host_no, SCp->target, SCp->lun);
- hostdata->tag_negotiated &= ~(1<<SCp->target);
+ && (hostdata->tag_negotiated &(1<<SCp->device->id))) {
+ printk(KERN_INFO "scsi%d: (%d:%d) Disabling Tag Command Queuing\n", SCp->device->host->host_no, SCp->device->id, SCp->device->lun);
+ hostdata->tag_negotiated &= ~(1<<SCp->device->id);
}
- if((hostdata->tag_negotiated &(1<<SCp->target))) {
+ if((hostdata->tag_negotiated &(1<<SCp->device->id))) {
slot->tag = SCp->request->tag;
DEBUG(("53c700 %d:%d:%d, sending out tag %d, slot %p\n",
- SCp->host->host_no, SCp->target, SCp->lun, slot->tag,
+ SCp->device->host->host_no, SCp->device->id, SCp->device->lun, slot->tag,
slot));
} else {
slot->tag = SCSI_NO_TAG;
@@ -1920,7 +1920,7 @@ NCR_700_abort(Scsi_Cmnd * SCp)
struct NCR_700_command_slot *slot;
printk(KERN_INFO "scsi%d (%d:%d) New error handler wants to abort command\n\t",
- SCp->host->host_no, SCp->target, SCp->lun);
+ SCp->device->host->host_no, SCp->device->id, SCp->device->lun);
print_command(SCp->cmnd);
slot = (struct NCR_700_command_slot *)SCp->host_scribble;
@@ -1939,7 +1939,7 @@ NCR_700_abort(Scsi_Cmnd * SCp)
* occupying a slot. Rather than allow this to
* happen, we issue a bus reset to force all
* outstanding commands to terminate here. */
- NCR_700_internal_bus_reset(SCp->host);
+ NCR_700_internal_bus_reset(SCp->device->host);
/* still drop through and return failed */
}
return FAILED;
@@ -1950,9 +1950,9 @@ STATIC int
NCR_700_bus_reset(Scsi_Cmnd * SCp)
{
printk(KERN_INFO "scsi%d (%d:%d) New error handler wants BUS reset, cmd %p\n\t",
- SCp->host->host_no, SCp->target, SCp->lun, SCp);
+ SCp->device->host->host_no, SCp->device->id, SCp->device->lun, SCp);
print_command(SCp->cmnd);
- NCR_700_internal_bus_reset(SCp->host);
+ NCR_700_internal_bus_reset(SCp->device->host);
return SUCCESS;
}
@@ -1960,7 +1960,7 @@ STATIC int
NCR_700_dev_reset(Scsi_Cmnd * SCp)
{
printk(KERN_INFO "scsi%d (%d:%d) New error handler wants device reset\n\t",
- SCp->host->host_no, SCp->target, SCp->lun);
+ SCp->device->host->host_no, SCp->device->id, SCp->device->lun);
print_command(SCp->cmnd);
return FAILED;
@@ -1970,11 +1970,11 @@ STATIC int
NCR_700_host_reset(Scsi_Cmnd * SCp)
{
printk(KERN_INFO "scsi%d (%d:%d) New error handler wants HOST reset\n\t",
- SCp->host->host_no, SCp->target, SCp->lun);
+ SCp->device->host->host_no, SCp->device->id, SCp->device->lun);
print_command(SCp->cmnd);
- NCR_700_internal_bus_reset(SCp->host);
- NCR_700_chip_reset(SCp->host);
+ NCR_700_internal_bus_reset(SCp->device->host);
+ NCR_700_chip_reset(SCp->device->host);
return SUCCESS;
}
diff --git a/drivers/scsi/AM53C974.c b/drivers/scsi/AM53C974.c
index 739be8db8b79..3015fa72b5c8 100644
--- a/drivers/scsi/AM53C974.c
+++ b/drivers/scsi/AM53C974.c
@@ -897,7 +897,7 @@ static __inline__ void run_main(void)
static int AM53C974_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
{
unsigned long flags;
- struct Scsi_Host *instance = cmd->host;
+ struct Scsi_Host *instance = cmd->device->host;
struct AM53C974_hostdata *hostdata = (struct AM53C974_hostdata *) instance->hostdata;
Scsi_Cmnd *tmp;
@@ -906,7 +906,7 @@ static int AM53C974_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
DEB_QUEUE(printk(SEPARATOR_LINE));
DEB_QUEUE(printk("scsi%d: AM53C974_queue_command called\n", instance->host_no));
DEB_QUEUE(printk("cmd=%02x target=%02x lun=%02x bufflen=%d use_sg = %02x\n",
- cmd->cmnd[0], cmd->target, cmd->lun, cmd->request_bufflen, cmd->use_sg));
+ cmd->cmnd[0], cmd->target, cmd->device->lun, cmd->request_bufflen, cmd->use_sg));
/* We use the host_scribble field as a pointer to the next command in a queue */
cmd->host_scribble = NULL;
@@ -978,7 +978,7 @@ static void AM53C974_main(void)
for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev = NULL; tmp;
prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble) {
/* When we find one, remove it from the issue queue. */
- if (!(hostdata->busy[tmp->target] & (1 << tmp->lun))) {
+ if (!(hostdata->busy[tmp->device->id] & (1 << tmp->device->lun))) {
if (prev) {
REMOVE(prev, (Scsi_Cmnd *) (prev->host_scribble), tmp,
(Scsi_Cmnd *) (tmp->host_scribble));
@@ -1127,7 +1127,7 @@ static void AM53C974_intr(int irq, void *dev_id, struct pt_regs *regs)
#endif
printk("scsi%d : PARITY error\n", instance->host_no);
if (hostdata->connected)
- hostdata->sync_off[hostdata->connected->target] = 0; /* setup asynchronous transfer */
+ hostdata->sync_off[hostdata->connected->device->id] = 0; /* setup asynchronous transfer */
hostdata->aborted = 1;
}
if (statreg & STATREG_IOE) {
@@ -1209,7 +1209,7 @@ static void AM53C974_intr(int irq, void *dev_id, struct pt_regs *regs)
(hostdata->sel_cmd->cmnd[0] == REQUEST_SENSE) ?
TAG_NONE : TAG_NEXT);
hostdata->selecting = 0;
- AM53C974_set_sync(instance, hostdata->sel_cmd->target);
+ AM53C974_set_sync(instance, hostdata->sel_cmd->device->id);
restore_flags(flags);
return;
}
@@ -1243,7 +1243,7 @@ static void AM53C974_intr(int irq, void *dev_id, struct pt_regs *regs)
#ifdef SCSI2
if (!hostdata->connected->device->tagged_queue)
#endif
- hostdata->busy[hostdata->connected->target] |= (1 << hostdata->connected->lun);
+ hostdata->busy[hostdata->connected->device->id] |= (1 << hostdata->connected->device->lun);
/* very strange -- use_sg is sometimes nonzero for request sense commands !! */
if ((hostdata->connected->cmnd[0] == REQUEST_SENSE) && hostdata->connected->use_sg) {
DEB(printk("scsi%d: REQUEST_SENSE command with nonzero use_sg\n", instance->host_no));
@@ -1318,9 +1318,9 @@ static void AM53C974_intr_disconnect(struct Scsi_Host *instance)
if (hostdata->disconnecting) {
/* target sent disconnect message, so we are prepared */
cmd = (Scsi_Cmnd *) hostdata->connected;
- AM53C974_set_async(instance, cmd->target);
+ AM53C974_set_async(instance, cmd->device->id);
DEB_INTR(printk("scsi%d : disc. from cmnd %d for ta %d, lun %d\n",
- instance->host_no, cmd->cmnd[0], cmd->target, cmd->lun));
+ instance->host_no, cmd->cmnd[0], cmd->target, cmd->device->lun));
if (cmd->device->disconnect) {
/* target wants to reselect later */
DEB_INTR(printk("ok, re-enabling selection\n"));
@@ -1329,7 +1329,7 @@ static void AM53C974_intr_disconnect(struct Scsi_Host *instance)
hostdata->disconnected_queue = cmd;
DEB_QUEUE(printk("scsi%d : command for target %d lun %d this %d was moved from connected to"
" the disconnected_queue\n", instance->host_no, cmd->target,
- cmd->lun, hostdata->disconnected_queue->SCp.this_residual));
+ cmd->device->lun, hostdata->disconnected_queue->SCp.this_residual));
DEB_QUEUE(AM53C974_print_queues(instance));
goto EXIT_UNFINISHED;
} else {
@@ -1355,9 +1355,9 @@ static void AM53C974_intr_disconnect(struct Scsi_Host *instance)
#ifdef AM53C974_DEBUG
deb_stop = 1;
#endif
- AM53C974_set_async(instance, cmd->target);
+ AM53C974_set_async(instance, cmd->device->id);
printk("scsi%d: Unexpected disconnect; phase: %d; target: %d; this_residual: %d; buffers_residual: %d; message: %d\n",
- instance->host_no, cmd->SCp.phase, cmd->target, cmd->SCp.this_residual, cmd->SCp.buffers_residual,
+ instance->host_no, cmd->SCp.phase, cmd->device->id, cmd->SCp.this_residual, cmd->SCp.buffers_residual,
cmd->SCp.Message);
printk("cmdreg: 0x%02x; statreg: 0x%02x; isreg: 0x%02x; cfifo: 0x%02x\n",
AM53C974_read_8(CMDREG), AM53C974_read_8(STATREG), AM53C974_read_8(ISREG),
@@ -1366,7 +1366,7 @@ static void AM53C974_intr_disconnect(struct Scsi_Host *instance)
if ((hostdata->last_message[0] == EXTENDED_MESSAGE) &&
(hostdata->last_message[2] == EXTENDED_SDTR)) {
/* sync. negotiation was aborted, setup asynchronous transfer with target */
- hostdata->sync_off[cmd->target] = 0;
+ hostdata->sync_off[cmd->device->id] = 0;
}
if (hostdata->aborted || hostdata->msgout[0] == ABORT)
cmd->result = DID_ABORT << 16;
@@ -1382,14 +1382,14 @@ static void AM53C974_intr_disconnect(struct Scsi_Host *instance)
hostdata->selecting = 0;
hostdata->disconnecting = 0;
hostdata->dma_busy = 0;
- hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
+ hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
AM53C974_write_8(CMDREG, CMDREG_CFIFO);
DEB(printk("disconnect; issue_queue: 0x%lx, disconnected_queue: 0x%lx\n",
(long) hostdata->issue_queue, (long) hostdata->disconnected_queue));
cmd->scsi_done(cmd);
if (!hostdata->selecting) {
- AM53C974_set_async(instance, cmd->target);
+ AM53C974_set_async(instance, cmd->device->id);
AM53C974_write_8(CMDREG, CMDREG_ESR);
} /* allow reselect */
return;
@@ -1405,7 +1405,7 @@ static void AM53C974_intr_disconnect(struct Scsi_Host *instance)
DEB(printk("disconnect; issue_queue: 0x%lx, disconnected_queue: 0x%lx\n",
(long) hostdata->issue_queue, (long) hostdata->disconnected_queue));
if (!hostdata->selecting) {
- AM53C974_set_async(instance, cmd->target);
+ AM53C974_set_async(instance, cmd->device->id);
AM53C974_write_8(CMDREG, CMDREG_ESR);
} /* allow reselect */
return;
@@ -1573,7 +1573,7 @@ static void AM53C974_information_transfer(struct Scsi_Host *instance,
case PHASE_MSGIN:
DEB_INFO(printk("Message-In phase; cmd=0x%lx, sel_cmd=0x%lx\n",
(long) hostdata->connected, (long) hostdata->sel_cmd));
- AM53C974_set_async(instance, cmd->target);
+ AM53C974_set_async(instance, cmd->device->id);
if (cmd->SCp.phase == PHASE_DATAIN)
AM53C974_dma_blast(instance, dmastatus, statreg);
if ((cmd->SCp.phase == PHASE_DATAOUT) && (AM53C974_read_8(DMACMD) & DMACMD_START)) {
@@ -1603,13 +1603,13 @@ static void AM53C974_information_transfer(struct Scsi_Host *instance,
ret = AM53C974_message(instance, cmd, cmd->SCp.Message);
}
cmd->SCp.phase = PHASE_MSGIN;
- AM53C974_set_sync(instance, cmd->target);
+ AM53C974_set_sync(instance, cmd->device->id);
break;
case PHASE_MSGOUT:
DEB_INFO(printk("Message-Out phase; cfifo=%d; msgout[0]=0x%02x\n",
AM53C974_read_8(CFIREG) & CFIREG_CF, hostdata->msgout[0]));
AM53C974_write_8(DMACMD, DMACMD_IDLE);
- AM53C974_set_async(instance, cmd->target);
+ AM53C974_set_async(instance, cmd->device->id);
for (i = 0; i < sizeof(hostdata->last_message); i++)
hostdata->last_message[i] = hostdata->msgout[i];
if ((hostdata->msgout[0] == 0) || INSIDE(hostdata->msgout[0], 0x02, 0x1F) ||
@@ -1635,24 +1635,24 @@ static void AM53C974_information_transfer(struct Scsi_Host *instance,
AM53C974_write_8(CMDREG, CMDREG_IT);
cmd->SCp.phase = PHASE_MSGOUT;
hostdata->msgout[0] = NOP;
- AM53C974_set_sync(instance, cmd->target);
+ AM53C974_set_sync(instance, cmd->device->id);
break;
case PHASE_CMDOUT:
DEB_INFO(printk("Command-Out phase\n"));
- AM53C974_set_async(instance, cmd->target);
+ AM53C974_set_async(instance, cmd->device->id);
for (i = 0; i < cmd->cmd_len; i++)
AM53C974_write_8(FFREG, cmd->cmnd[i]);
AM53C974_write_8(CMDREG, CMDREG_IT);
cmd->SCp.phase = PHASE_CMDOUT;
- AM53C974_set_sync(instance, cmd->target);
+ AM53C974_set_sync(instance, cmd->device->id);
break;
case PHASE_STATIN:
DEB_INFO(printk("Status phase\n"));
if (cmd->SCp.phase == PHASE_DATAIN)
AM53C974_dma_blast(instance, dmastatus, statreg);
- AM53C974_set_async(instance, cmd->target);
+ AM53C974_set_async(instance, cmd->device->id);
if (cmd->SCp.phase == PHASE_DATAOUT) {
unsigned long residual;
@@ -1724,12 +1724,12 @@ static int AM53C974_message(struct Scsi_Host *instance, Scsi_Cmnd * cmd,
case LINKED_FLG_CMD_COMPLETE:
/* Accept message by releasing ACK */
DEB_LINKED(printk("scsi%d : target %d lun %d linked command complete.\n",
- instance->host_no, cmd->target, cmd->lun));
+ instance->host_no, cmd->device->id, cmd->device->lun));
/* Sanity check : A linked command should only terminate with
* one of these messages if there are more linked commands available. */
if (!cmd->next_link) {
printk("scsi%d : target %d lun %d linked command complete, no next_link\n"
- instance->host_no, cmd->target, cmd->lun);
+ instance->host_no, cmd->device->id, cmd->device->lun);
hostdata->aborted = 1;
AM53C974_write_8(CMDREG, CMDREG_SATN);
AM53C974_write_8(CMDREG, CMDREG_MA);
@@ -1747,7 +1747,7 @@ static int AM53C974_message(struct Scsi_Host *instance, Scsi_Cmnd * cmd,
cmd->next_link->tag = cmd->tag;
cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
DEB_LINKED(printk("scsi%d : target %d lun %d linked request done, calling scsi_done().\n",
- instance->host_no, cmd->target, cmd->lun));
+ instance->host_no, cmd->device->id, cmd->device->lun));
cmd->scsi_done(cmd);
cmd = hostdata->connected;
break;
@@ -1757,7 +1757,7 @@ static int AM53C974_message(struct Scsi_Host *instance, Scsi_Cmnd * cmd,
case ABORT:
case COMMAND_COMPLETE:
DEB_MSG(printk("scsi%d: command complete message received; cmd %d for target %d, lun %d\n",
- instance->host_no, cmd->cmnd[0], cmd->target, cmd->lun));
+ instance->host_no, cmd->cmnd[0], cmd->device->id, cmd->device->lun));
hostdata->disconnecting = 1;
cmd->device->disconnect = 0;
@@ -1807,22 +1807,22 @@ static int AM53C974_message(struct Scsi_Host *instance, Scsi_Cmnd * cmd,
case MESSAGE_REJECT:
DEB_MSG(printk("scsi%d: reject message received; cmd %d for target %d, lun %d\n",
- instance->host_no, cmd->cmnd[0], cmd->target, cmd->lun));
+ instance->host_no, cmd->cmnd[0], cmd->device->id, cmd->device->lun));
switch (hostdata->last_message[0]) {
case EXTENDED_MESSAGE:
if (hostdata->last_message[2] == EXTENDED_SDTR) {
/* sync. negotiation was rejected, setup asynchronous transfer with target */
printk("\ntarget %d: rate=%d Mhz, asynchronous (sync. negotiation rejected)\n",
- cmd->target, DEF_CLK / DEF_STP);
- hostdata->sync_off[cmd->target] = 0;
- hostdata->sync_per[cmd->target] = DEF_STP;
+ cmd->device->id, DEF_CLK / DEF_STP);
+ hostdata->sync_off[cmd->device->id] = 0;
+ hostdata->sync_per[cmd->device->id] = DEF_STP;
}
break;
case HEAD_OF_QUEUE_TAG:
case ORDERED_QUEUE_TAG:
case SIMPLE_QUEUE_TAG:
cmd->device->tagged_queue = 0;
- hostdata->busy[cmd->target] |= (1 << cmd->lun);
+ hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
break;
default:
break;
@@ -1834,7 +1834,7 @@ static int AM53C974_message(struct Scsi_Host *instance, Scsi_Cmnd * cmd,
case DISCONNECT:
DEB_MSG(printk("scsi%d: disconnect message received; cmd %d for target %d, lun %d\n",
- instance->host_no, cmd->cmnd[0], cmd->target, cmd->lun));
+ instance->host_no, cmd->cmnd[0], cmd->device->id, cmd->device->lun));
cmd->device->disconnect = 1;
hostdata->disconnecting = 1;
AM53C974_write_8(CMDREG, CMDREG_MA); /* Accept message by clearing ACK */
@@ -1843,7 +1843,7 @@ static int AM53C974_message(struct Scsi_Host *instance, Scsi_Cmnd * cmd,
case SAVE_POINTERS:
case RESTORE_POINTERS:
DEB_MSG(printk("scsi%d: save/restore pointers message received; cmd %d for target %d, lun %d\n",
- instance->host_no, cmd->cmnd[0], cmd->target, cmd->lun));
+ instance->host_no, cmd->cmnd[0], cmd->device->id, cmd->device->lun));
/* The SCSI data pointer is *IMPLICITLY* saved on a disconnect
* operation, in violation of the SCSI spec so we can safely
* ignore SAVE/RESTORE pointers calls.
@@ -1862,7 +1862,7 @@ static int AM53C974_message(struct Scsi_Host *instance, Scsi_Cmnd * cmd,
case EXTENDED_MESSAGE:
DEB_MSG(printk("scsi%d: extended message received; cmd %d for target %d, lun %d\n",
- instance->host_no, cmd->cmnd[0], cmd->target, cmd->lun));
+ instance->host_no, cmd->cmnd[0], cmd->device->id, cmd->device->lun));
/* Extended messages are sent in the following format :
* Byte
* 0 EXTENDED_MESSAGE == 1
@@ -1907,7 +1907,7 @@ static int AM53C974_message(struct Scsi_Host *instance, Scsi_Cmnd * cmd,
/* check message */
if (extended_msg[2] == EXTENDED_SDTR)
- ret = AM53C974_sync_neg(instance, cmd->target, extended_msg);
+ ret = AM53C974_sync_neg(instance, cmd->device->id, extended_msg);
if (ret || hostdata->aborted)
AM53C974_write_8(CMDREG, CMDREG_SATN);
@@ -1962,9 +1962,9 @@ static void AM53C974_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag
AM53C974_write_8(CMDREG, CMDREG_CFIFO); /* clear FIFO */
}
#ifdef AM53C974_PROHIBIT_DISCONNECT
- tmp[0] = IDENTIFY(0, cmd->lun);
+ tmp[0] = IDENTIFY(0, cmd->device->lun);
#else
- tmp[0] = IDENTIFY(1, cmd->lun);
+ tmp[0] = IDENTIFY(1, cmd->device->lun);
#endif
#ifdef SCSI2
@@ -1995,16 +1995,16 @@ static void AM53C974_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag
/* in case of an inquiry or req. sense command with no sync. neg performed yet, we start
sync negotiation via start stops and transfer the command in cmdout phase */
if (((cmd->cmnd[0] == INQUIRY) || (cmd->cmnd[0] == REQUEST_SENSE)) &&
- !(hostdata->sync_neg[cmd->target]) && hostdata->sync_en[cmd->target]) {
- hostdata->sync_neg[cmd->target] = 1;
+ !(hostdata->sync_neg[cmd->device->id]) && hostdata->sync_en[cmd->device->id]) {
+ hostdata->sync_neg[cmd->device->id] = 1;
hostdata->msgout[0] = EXTENDED_MESSAGE;
hostdata->msgout[1] = 3;
hostdata->msgout[2] = EXTENDED_SDTR;
- hostdata->msgout[3] = 250 / (int) hostdata->max_rate[cmd->target];
- hostdata->msgout[4] = hostdata->max_offset[cmd->target];
+ hostdata->msgout[3] = 250 / (int) hostdata->max_rate[cmd->device->id];
+ hostdata->msgout[4] = hostdata->max_offset[cmd->device->id];
len += 5;
}
- AM53C974_write_8(SDIDREG, SDIREG_MASK & cmd->target); /* setup dest. id */
+ AM53C974_write_8(SDIDREG, SDIREG_MASK & cmd->device->id); /* setup dest. id */
AM53C974_write_8(STIMREG, DEF_SCSI_TIMEOUT); /* setup timeout reg */
switch (len) {
case 1:
@@ -2110,7 +2110,7 @@ static void AM53C974_intr_reselect(struct Scsi_Host *instance, unsigned char sta
* just reestablished, and remove it from the disconnected queue. */
for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL;
tmp; prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble)
- if ((target == tmp->target) && (lun == tmp->lun)
+ if ((target == tmp->device->id) && (lun == tmp->device->lun)
#ifdef SCSI2
&& (tag == tmp->tag)
#endif
@@ -2279,7 +2279,7 @@ static int AM53C974_abort(Scsi_Cmnd * cmd)
{
AM53C974_local_declare();
unsigned long flags;
- struct Scsi_Host *instance = cmd->host;
+ struct Scsi_Host *instance = cmd->device->host;
struct AM53C974_hostdata *hostdata = (struct AM53C974_hostdata *) instance->hostdata;
Scsi_Cmnd *tmp, **prev;
@@ -2388,7 +2388,7 @@ static int AM53C974_reset(Scsi_Cmnd * cmd, unsigned int reset_flags)
AM53C974_local_declare();
unsigned long flags;
int i;
- struct Scsi_Host *instance = cmd->host;
+ struct Scsi_Host *instance = cmd->device->host;
struct AM53C974_hostdata *hostdata = (struct AM53C974_hostdata *) instance->hostdata;
AM53C974_setio(instance);
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index bcf2643ece11..6c4951207ba4 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -3471,15 +3471,15 @@ int BusLogic_QueueCommand(SCSI_Command_T *Command,
void (*CompletionRoutine)(SCSI_Command_T *))
{
BusLogic_HostAdapter_T *HostAdapter =
- (BusLogic_HostAdapter_T *) Command->host->hostdata;
+ (BusLogic_HostAdapter_T *) Command->device->host->hostdata;
BusLogic_TargetFlags_T *TargetFlags =
- &HostAdapter->TargetFlags[Command->target];
+ &HostAdapter->TargetFlags[Command->device->id];
BusLogic_TargetStatistics_T *TargetStatistics =
HostAdapter->TargetStatistics;
unsigned char *CDB = Command->cmnd;
int CDB_Length = Command->cmd_len;
- int TargetID = Command->target;
- int LogicalUnit = Command->lun;
+ int TargetID = Command->device->id;
+ int LogicalUnit = Command->device->lun;
void *BufferPointer = Command->request_buffer;
int BufferLength = Command->request_bufflen;
int SegmentCount = Command->use_sg;
@@ -3708,8 +3708,9 @@ int BusLogic_QueueCommand(SCSI_Command_T *Command,
int BusLogic_AbortCommand(SCSI_Command_T *Command)
{
BusLogic_HostAdapter_T *HostAdapter =
- (BusLogic_HostAdapter_T *) Command->host->hostdata;
- int TargetID = Command->target;
+ (BusLogic_HostAdapter_T *) Command->device->host->hostdata;
+
+ int TargetID = Command->device->id;
BusLogic_CCB_T *CCB;
int Result;
BusLogic_IncrementErrorCounter(
@@ -3835,7 +3836,7 @@ static int BusLogic_ResetHostAdapter(BusLogic_HostAdapter_T *HostAdapter,
else
{
BusLogic_IncrementErrorCounter(
- &HostAdapter->TargetStatistics[Command->target]
+ &HostAdapter->TargetStatistics[Command->device->id]
.HostAdapterResetsRequested);
HardReset = true;
}
@@ -3845,7 +3846,7 @@ static int BusLogic_ResetHostAdapter(BusLogic_HostAdapter_T *HostAdapter,
*/
if (ResetFlags & SCSI_RESET_ASYNCHRONOUS)
{
- TargetID = Command->target;
+ TargetID = Command->device->id;
if (Command->serial_number != Command->serial_number_at_timeout)
{
BusLogic_Warning("Unable to Reset Command to Target %d - "
@@ -3890,9 +3891,9 @@ static int BusLogic_ResetHostAdapter(BusLogic_HostAdapter_T *HostAdapter,
else
{
BusLogic_Warning("Resetting %s due to Target %d\n", HostAdapter,
- HostAdapter->FullModelName, Command->target);
+ HostAdapter->FullModelName, Command->device->id);
BusLogic_IncrementErrorCounter(
- &HostAdapter->TargetStatistics[Command->target]
+ &HostAdapter->TargetStatistics[Command->device->id]
.HostAdapterResetsAttempted);
}
/*
@@ -3908,7 +3909,7 @@ static int BusLogic_ResetHostAdapter(BusLogic_HostAdapter_T *HostAdapter,
}
if (Command != NULL)
BusLogic_IncrementErrorCounter(
- &HostAdapter->TargetStatistics[Command->target]
+ &HostAdapter->TargetStatistics[Command->device->id]
.HostAdapterResetsCompleted);
/*
Mark all currently executing CCBs as having been Reset.
@@ -3975,7 +3976,7 @@ static int BusLogic_SendBusDeviceReset(BusLogic_HostAdapter_T *HostAdapter,
SCSI_Command_T *Command,
unsigned int ResetFlags)
{
- int TargetID = Command->target;
+ int TargetID = Command->device->id;
BusLogic_CCB_T *CCB, *XCCB;
int Result = -1;
BusLogic_IncrementErrorCounter(
@@ -4152,8 +4153,8 @@ Done:
int BusLogic_ResetCommand(SCSI_Command_T *Command, unsigned int ResetFlags)
{
BusLogic_HostAdapter_T *HostAdapter =
- (BusLogic_HostAdapter_T *) Command->host->hostdata;
- int TargetID = Command->target;
+ (BusLogic_HostAdapter_T *) Command->device->host->hostdata;
+ int TargetID = Command->device->id;
BusLogic_ErrorRecoveryStrategy_T
ErrorRecoveryStrategy = HostAdapter->ErrorRecoveryStrategy[TargetID];
/*
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 4499f1f6b3ae..2142d518584f 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -929,7 +929,7 @@ int NCR5380_proc_info(char *buffer, char **start, off_t offset, int length, int
static char *lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, char *pos, char *buffer, int length)
{
- SPRINTF("scsi%d : destination target %d, lun %d\n", cmd->host->host_no, cmd->target, cmd->lun);
+ SPRINTF("scsi%d : destination target %d, lun %d\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
SPRINTF(" command = ");
pos = lprint_command(cmd->cmnd, pos, buffer, length);
return (pos);
@@ -1106,7 +1106,7 @@ static int __init NCR5380_init(struct Scsi_Host *instance, int flags)
static int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
{
- struct Scsi_Host *instance = cmd->host;
+ struct Scsi_Host *instance = cmd->device->host;
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
Scsi_Cmnd *tmp;
@@ -1126,15 +1126,15 @@ static int NCR5380_queue_command(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
case WRITE:
case WRITE_6:
case WRITE_10:
- hostdata->time_write[cmd->target] -= (jiffies - hostdata->timebase);
- hostdata->bytes_write[cmd->target] += cmd->request_bufflen;
+ hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase);
+ hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;
hostdata->pendingw++;
break;
case READ:
case READ_6:
case READ_10:
- hostdata->time_read[cmd->target] -= (jiffies - hostdata->timebase);
- hostdata->bytes_read[cmd->target] += cmd->request_bufflen;
+ hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase);
+ hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;
hostdata->pendingr++;
break;
}
@@ -1224,7 +1224,7 @@ static void NCR5380_main(void *p)
if (prev != tmp)
dprintk(NDEBUG_LISTS, ("MAIN tmp=%p target=%d busy=%d lun=%d\n", tmp, tmp->target, hostdata->busy[tmp->target], tmp->lun));
/* When we find one, remove it from the issue queue. */
- if (!(hostdata->busy[tmp->target] & (1 << tmp->lun))) {
+ if (!(hostdata->busy[tmp->device->id] & (1 << tmp->device->lun))) {
if (prev) {
REMOVE(prev, prev->host_scribble, tmp, tmp->host_scribble);
prev->host_scribble = tmp->host_scribble;
@@ -1286,7 +1286,7 @@ static void NCR5380_main(void *p)
this is needed for Mustek scanners, that
do not respond to commands immediately
after a scan */
- printk(KERN_DEBUG "scsi%d: device %d did not respond in time\n", instance->host_no, tmp->target);
+ printk(KERN_DEBUG "scsi%d: device %d did not respond in time\n", instance->host_no, tmp->device->id);
LIST(tmp, hostdata->issue_queue);
tmp->host_scribble = (unsigned char *) hostdata->issue_queue;
hostdata->issue_queue = tmp;
@@ -1421,13 +1421,13 @@ static void collect_stats(struct NCR5380_hostdata *hostdata, Scsi_Cmnd * cmd)
case WRITE:
case WRITE_6:
case WRITE_10:
- hostdata->time_write[cmd->target] += (jiffies - hostdata->timebase);
+ hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase);
hostdata->pendingw--;
break;
case READ:
case READ_6:
case READ_10:
- hostdata->time_read[cmd->target] += (jiffies - hostdata->timebase);
+ hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase);
hostdata->pendingr--;
break;
}
@@ -1567,7 +1567,7 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
* the host and target ID's on the SCSI bus.
*/
- NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->target)));
+ NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->device->id)));
/*
* Raise ATN while SEL is true before BSY goes false from arbitration,
@@ -1612,7 +1612,7 @@ static int NCR5380_select(struct Scsi_Host *instance, Scsi_Cmnd * cmd, int tag)
udelay(1);
- dprintk(NDEBUG_SELECTION, ("scsi%d : selecting target %d\n", instance->host_no, cmd->target));
+ dprintk(NDEBUG_SELECTION, ("scsi%d : selecting target %d\n", instance->host_no, cmd->device->id));
/*
* The SCSI specification calls for a 250 ms timeout for the actual
@@ -1668,7 +1668,7 @@ part2:
if (!(NCR5380_read(STATUS_REG) & SR_BSY)) {
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
- if (hostdata->targets_present & (1 << cmd->target)) {
+ if (hostdata->targets_present & (1 << cmd->device->id)) {
printk(KERN_DEBUG "scsi%d : weirdness\n", instance->host_no);
if (hostdata->restart_select)
printk(KERN_DEBUG "\trestart select\n");
@@ -1686,7 +1686,7 @@ part2:
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
return 0;
}
- hostdata->targets_present |= (1 << cmd->target);
+ hostdata->targets_present |= (1 << cmd->device->id);
/*
* Since we followed the SCSI spec, and raised ATN while SEL
@@ -1713,8 +1713,8 @@ part2:
goto failed;
}
- dprintk(NDEBUG_SELECTION, ("scsi%d : target %d selected, going into MESSAGE OUT phase.\n", instance->host_no, cmd->target));
- tmp[0] = IDENTIFY(((instance->irq == IRQ_NONE) ? 0 : 1), cmd->lun);
+ dprintk(NDEBUG_SELECTION, ("scsi%d : target %d selected, going into MESSAGE OUT phase.\n", instance->host_no, cmd->device->id));
+ tmp[0] = IDENTIFY(((instance->irq == IRQ_NONE) ? 0 : 1), cmd->device->lun);
if(instance->irq != IRQ_NONE)
spin_lock_irq(instance->host_lock);
@@ -1729,7 +1729,7 @@ part2:
dprintk(NDEBUG_SELECTION, ("scsi%d : nexus established.\n", instance->host_no));
/* XXX need to handle errors here */
hostdata->connected = cmd;
- hostdata->busy[cmd->target] |= (1 << cmd->lun);
+ hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
initialize_SCp(cmd);
@@ -2380,7 +2380,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
* If the watchdog timer fires, all future accesses to this
* device will use the polled-IO.
*/
- printk("scsi%d : switching target %d lun %d to slow handshake\n", instance->host_no, cmd->target, cmd->lun);
+ printk("scsi%d : switching target %d lun %d to slow handshake\n", instance->host_no, cmd->device->id, cmd->device->lun);
cmd->device->borken = 1;
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
sink = 1;
@@ -2417,14 +2417,14 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
case LINKED_FLG_CMD_COMPLETE:
/* Accept message by clearing ACK */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
- dprintk(NDEBUG_LINKED, ("scsi%d : target %d lun %d linked command complete.\n", instance->host_no, cmd->target, cmd->lun));
+ dprintk(NDEBUG_LINKED, ("scsi%d : target %d lun %d linked command complete.\n", instance->host_no, cmd->device->id, cmd->device->lun));
/*
* Sanity check : A linked command should only terminate with
* one of these messages if there are more linked commands
* available.
*/
if (!cmd->next_link) {
- printk("scsi%d : target %d lun %d linked command complete, no next_link\n" instance->host_no, cmd->target, cmd->lun);
+ printk("scsi%d : target %d lun %d linked command complete, no next_link\n" instance->host_no, cmd->device->id, cmd->device->lun);
sink = 1;
do_abort(instance);
return;
@@ -2433,7 +2433,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
/* The next command is still part of this process */
cmd->next_link->tag = cmd->tag;
cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
- dprintk(NDEBUG_LINKED, ("scsi%d : target %d lun %d linked request done, calling scsi_done().\n", instance->host_no, cmd->target, cmd->lun));
+ dprintk(NDEBUG_LINKED, ("scsi%d : target %d lun %d linked request done, calling scsi_done().\n", instance->host_no, cmd->device->id, cmd->device->lun));
collect_stats(hostdata, cmd);
cmd->scsi_done(cmd);
cmd = hostdata->connected;
@@ -2445,8 +2445,8 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
sink = 1;
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
hostdata->connected = NULL;
- dprintk(NDEBUG_QUEUES, ("scsi%d : command for target %d, lun %d completed\n", instance->host_no, cmd->target, cmd->lun));
- hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
+ dprintk(NDEBUG_QUEUES, ("scsi%d : command for target %d, lun %d completed\n", instance->host_no, cmd->device->id, cmd->device->lun));
+ hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
/*
* I'm not sure what the correct thing to do here is :
@@ -2514,7 +2514,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
case ORDERED_QUEUE_TAG:
case SIMPLE_QUEUE_TAG:
cmd->device->tagged_queue = 0;
- hostdata->busy[cmd->target] |= (1 << cmd->lun);
+ hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
break;
default:
break;
@@ -2528,7 +2528,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
hostdata->disconnected_queue;
hostdata->connected = NULL;
hostdata->disconnected_queue = cmd;
- dprintk(NDEBUG_QUEUES, ("scsi%d : command for target %d lun %d was moved from connected to" " the disconnected_queue\n", instance->host_no, cmd->target, cmd->lun));
+ dprintk(NDEBUG_QUEUES, ("scsi%d : command for target %d lun %d was moved from connected to" " the disconnected_queue\n", instance->host_no, cmd->device->id, cmd->device->lun));
/*
* Restore phase bits to 0 so an interrupted selection,
* arbitration can resume.
@@ -2619,9 +2619,9 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
print_msg(extended_msg);
printk("\n");
} else if (tmp != EXTENDED_MESSAGE)
- printk("scsi%d: rejecting unknown message %02x from target %d, lun %d\n", instance->host_no, tmp, cmd->target, cmd->lun);
+ printk("scsi%d: rejecting unknown message %02x from target %d, lun %d\n", instance->host_no, tmp, cmd->device->id, cmd->device->lun);
else
- printk("scsi%d: rejecting unknown extended message code %02x, length %d from target %d, lun %d\n", instance->host_no, extended_msg[1], extended_msg[0], cmd->target, cmd->lun);
+ printk("scsi%d: rejecting unknown extended message code %02x, length %d from target %d, lun %d\n", instance->host_no, extended_msg[1], extended_msg[0], cmd->device->id, cmd->device->lun);
msgout = MESSAGE_REJECT;
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
@@ -2634,7 +2634,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
hostdata->last_message = msgout;
NCR5380_transfer_pio(instance, &phase, &len, &data);
if (msgout == ABORT) {
- hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
+ hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
hostdata->connected = NULL;
cmd->result = DID_ERROR << 16;
collect_stats(hostdata, cmd);
@@ -2772,7 +2772,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL; tmp; prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble)
- if ((target_mask == (1 << tmp->target)) && (lun == tmp->lun)
+ if ((target_mask == (1 << tmp->device->id)) && (lun == tmp->device->lun)
) {
if (prev) {
REMOVE(prev, prev->host_scribble, tmp, tmp->host_scribble);
@@ -2872,7 +2872,7 @@ static void NCR5380_dma_complete(NCR5380_instance * instance) {
static int NCR5380_abort(Scsi_Cmnd * cmd) {
NCR5380_local_declare();
- struct Scsi_Host *instance = cmd->host;
+ struct Scsi_Host *instance = cmd->device->host;
struct NCR5380_hostdata *hostdata = (struct NCR5380_hostdata *) instance->hostdata;
Scsi_Cmnd *tmp, **prev;
@@ -3031,10 +3031,10 @@ static int NCR5380_abort(Scsi_Cmnd * cmd) {
static int NCR5380_bus_reset(Scsi_Cmnd * cmd) {
NCR5380_local_declare();
- NCR5380_setup(cmd->host);
+ NCR5380_setup(cmd->device->host);
- NCR5380_print_status(cmd->host);
- do_reset(cmd->host);
+ NCR5380_print_status(cmd->device->host);
+ do_reset(cmd->device->host);
return SUCCESS;
}
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 985966e8c789..416cf07afb38 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -463,9 +463,9 @@ void set_sense(u8 *sense_buf, u8 sense_key, u8 sense_code,
static void aac_io_done(Scsi_Cmnd * scsicmd)
{
unsigned long cpu_flags;
- spin_lock_irqsave(scsicmd->host->host_lock, cpu_flags);
+ spin_lock_irqsave(scsicmd->device->host->host_lock, cpu_flags);
scsicmd->scsi_done(scsicmd);
- spin_unlock_irqrestore(scsicmd->host->host_lock, cpu_flags);
+ spin_unlock_irqrestore(scsicmd->device->host->host_lock, cpu_flags);
}
static void __aac_io_done(Scsi_Cmnd * scsicmd)
@@ -546,8 +546,8 @@ static void read_callback(void *context, struct fib * fibptr)
scsicmd = (Scsi_Cmnd *) context;
- dev = (struct aac_dev *)scsicmd->host->hostdata;
- cid =TARGET_LUN_TO_CONTAINER(scsicmd->target, scsicmd->lun);
+ dev = (struct aac_dev *)scsicmd->device->host->hostdata;
+ cid =TARGET_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun);
lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3];
dprintk((KERN_DEBUG "read_callback[cpu %d]: lba = %d, t = %ld.\n", smp_processor_id(), lba, jiffies));
@@ -591,8 +591,8 @@ static void write_callback(void *context, struct fib * fibptr)
u32 cid;
scsicmd = (Scsi_Cmnd *) context;
- dev = (struct aac_dev *)scsicmd->host->hostdata;
- cid = TARGET_LUN_TO_CONTAINER(scsicmd->target, scsicmd->lun);
+ dev = (struct aac_dev *)scsicmd->device->host->hostdata;
+ cid = TARGET_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun);
lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3];
dprintk((KERN_DEBUG "write_callback[cpu %d]: lba = %d, t = %ld.\n", smp_processor_id(), lba, jiffies));
@@ -637,7 +637,7 @@ int aac_read(Scsi_Cmnd * scsicmd, int cid)
struct aac_dev *dev;
struct fib * cmd_fibcontext;
- dev = (struct aac_dev *)scsicmd->host->hostdata;
+ dev = (struct aac_dev *)scsicmd->device->host->hostdata;
/*
* Get block address and transfer length
*/
@@ -746,7 +746,7 @@ static int aac_write(Scsi_Cmnd * scsicmd, int cid)
struct aac_dev *dev;
struct fib * cmd_fibcontext;
- dev = (struct aac_dev *)scsicmd->host->hostdata;
+ dev = (struct aac_dev *)scsicmd->device->host->hostdata;
/*
* Get block address and transfer length
*/
@@ -861,25 +861,25 @@ int aac_scsi_cmd(Scsi_Cmnd * scsicmd)
struct fsa_scsi_hba *fsa_dev_ptr;
int cardtype;
int ret;
- struct aac_dev *dev = (struct aac_dev *)scsicmd->host->hostdata;
+ struct aac_dev *dev = (struct aac_dev *)scsicmd->device->host->hostdata;
cardtype = dev->cardtype;
- fsa_dev_ptr = fsa_dev[scsicmd->host->unique_id];
+ fsa_dev_ptr = fsa_dev[scsicmd->device->host->unique_id];
/*
* If the bus, target or lun is out of range, return fail
* Test does not apply to ID 16, the pseudo id for the controller
* itself.
*/
- if (scsicmd->target != scsicmd->host->this_id) {
- if ((scsicmd->channel == 0) ){
- if( (scsicmd->target >= AAC_MAX_TARGET) || (scsicmd->lun != 0)){
+ if (scsicmd->device->id != scsicmd->device->host->this_id) {
+ if ((scsicmd->device->channel == 0) ){
+ if( (scsicmd->device->id >= AAC_MAX_TARGET) || (scsicmd->device->lun != 0)){
scsicmd->result = DID_NO_CONNECT << 16;
__aac_io_done(scsicmd);
return 0;
}
- cid = TARGET_LUN_TO_CONTAINER(scsicmd->target, scsicmd->lun);
+ cid = TARGET_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun);
/*
* If the target container doesn't exist, it may have
@@ -890,9 +890,9 @@ int aac_scsi_cmd(Scsi_Cmnd * scsicmd)
case SS_INQUIR:
case SS_RDCAP:
case SS_TEST:
- spin_unlock_irq(scsicmd->host->host_lock);
+ spin_unlock_irq(scsicmd->device->host->host_lock);
probe_container(dev, cid);
- spin_lock_irq(scsicmd->host->host_lock);
+ spin_lock_irq(scsicmd->device->host->host_lock);
if (fsa_dev_ptr->valid[cid] == 0) {
scsicmd->result = DID_NO_CONNECT << 16;
__aac_io_done(scsicmd);
@@ -944,7 +944,7 @@ int aac_scsi_cmd(Scsi_Cmnd * scsicmd)
{
struct inquiry_data *inq_data_ptr;
- dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", scsicmd->target));
+ dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", scsicmd->device->id));
inq_data_ptr = (struct inquiry_data *)scsicmd->request_buffer;
memset(inq_data_ptr, 0, sizeof (struct inquiry_data));
@@ -959,7 +959,7 @@ int aac_scsi_cmd(Scsi_Cmnd * scsicmd)
* see: <vendor>.c i.e. aac.c
*/
setinqstr(cardtype, (void *) (inq_data_ptr->inqd_vid), fsa_dev_ptr->type[cid]);
- if (scsicmd->target == scsicmd->host->this_id)
+ if (scsicmd->device->id == scsicmd->device->host->this_id)
inq_data_ptr->inqd_pdt = INQD_PDT_PROC; /* Processor device */
else
inq_data_ptr->inqd_pdt = INQD_PDT_DA; /* Direct/random access device */
@@ -1053,20 +1053,20 @@ int aac_scsi_cmd(Scsi_Cmnd * scsicmd)
* containers to /dev/sd device names
*/
- spin_unlock_irq(scsicmd->host->host_lock);
+ spin_unlock_irq(scsicmd->device->host->host_lock);
if (scsicmd->request->rq_disk)
memcpy(fsa_dev_ptr->devname[cid],
scsicmd->request->rq_disk->disk_name,
8);
ret = aac_read(scsicmd, cid);
- spin_lock_irq(scsicmd->host->host_lock);
+ spin_lock_irq(scsicmd->device->host->host_lock);
return ret;
case SS_WRITE:
case SM_WRITE:
- spin_unlock_irq(scsicmd->host->host_lock);
+ spin_unlock_irq(scsicmd->device->host->host_lock);
ret = aac_write(scsicmd, cid);
- spin_lock_irq(scsicmd->host->host_lock);
+ spin_lock_irq(scsicmd->device->host->host_lock);
return ret;
default:
/*
@@ -1202,7 +1202,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
Scsi_Cmnd *scsicmd;
scsicmd = (Scsi_Cmnd *) context;
- dev = (struct aac_dev *)scsicmd->host->hostdata;
+ dev = (struct aac_dev *)scsicmd->device->host->hostdata;
if (fibptr == NULL)
BUG();
@@ -1366,13 +1366,13 @@ static int aac_send_srb_fib(Scsi_Cmnd* scsicmd)
u16 fibsize;
u32 flag;
- if( scsicmd->target > 15 || scsicmd->lun > 7) {
+ if( scsicmd->device->id > 15 || scsicmd->device->lun > 7) {
scsicmd->result = DID_NO_CONNECT << 16;
__aac_io_done(scsicmd);
return 0;
}
- dev = (struct aac_dev *)scsicmd->host->hostdata;
+ dev = (struct aac_dev *)scsicmd->device->host->hostdata;
switch(scsicmd->sc_data_direction){
case SCSI_DATA_WRITE:
flag = SRB_DataOut;
@@ -1402,9 +1402,9 @@ static int aac_send_srb_fib(Scsi_Cmnd* scsicmd)
srbcmd = (struct aac_srb*) fib_data(cmd_fibcontext);
srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi);
- srbcmd->channel = cpu_to_le32(aac_logical_to_phys(scsicmd->channel));
- srbcmd->target = cpu_to_le32(scsicmd->target);
- srbcmd->lun = cpu_to_le32(scsicmd->lun);
+ srbcmd->channel = cpu_to_le32(aac_logical_to_phys(scsicmd->device->channel));
+ srbcmd->target = cpu_to_le32(scsicmd->device->id);
+ srbcmd->lun = cpu_to_le32(scsicmd->device->lun);
srbcmd->flags = cpu_to_le32(flag);
srbcmd->timeout = cpu_to_le32(0); // timeout not used
srbcmd->retry_limit =cpu_to_le32(0); // Obsolete parameter
@@ -1468,7 +1468,7 @@ static unsigned long aac_build_sg(Scsi_Cmnd* scsicmd, struct sgmap* psg)
struct aac_dev *dev;
unsigned long byte_count = 0;
- dev = (struct aac_dev *)scsicmd->host->hostdata;
+ dev = (struct aac_dev *)scsicmd->device->host->hostdata;
// Get rid of old data
psg->count = cpu_to_le32(0);
psg->sg[0].addr = cpu_to_le32(NULL);
@@ -1524,7 +1524,7 @@ static unsigned long aac_build_sg64(Scsi_Cmnd* scsicmd, struct sgmap64* psg)
unsigned long byte_count = 0;
u64 le_addr;
- dev = (struct aac_dev *)scsicmd->host->hostdata;
+ dev = (struct aac_dev *)scsicmd->device->host->hostdata;
// Get rid of old data
psg->count = cpu_to_le32(0);
psg->sg[0].addr[0] = cpu_to_le32(NULL);
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index f3b3a1a7bfa6..9b092e2de182 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -3641,7 +3641,7 @@ typedef struct {
typedef Scsi_Cmnd REQ, *REQP;
#define REQPNEXT(reqp) ((REQP) ((reqp)->host_scribble))
#define REQPNEXTP(reqp) ((REQP *) &((reqp)->host_scribble))
-#define REQPTID(reqp) ((reqp)->target)
+#define REQPTID(reqp) ((reqp)->device->id)
#define REQPTIME(reqp) ((reqp)->SCp.this_residual)
#define REQTIMESTAMP() (jiffies)
@@ -5845,7 +5845,7 @@ advansys_queuecommand(Scsi_Cmnd *scp, void (*done)(Scsi_Cmnd *))
ulong flags;
Scsi_Cmnd *done_scp;
- shp = scp->host;
+ shp = scp->device->host;
boardp = ASC_BOARDP(shp);
ASC_STATS(shp, queuecommand);
@@ -5941,12 +5941,12 @@ advansys_reset(Scsi_Cmnd *scp)
ASC_DBG1(1, "advansys_reset: 0x%lx\n", (ulong) scp);
#ifdef ADVANSYS_STATS
- if (scp->host != NULL) {
- ASC_STATS(scp->host, reset);
+ if (scp->device->host != NULL) {
+ ASC_STATS(scp->device->host, reset);
}
#endif /* ADVANSYS_STATS */
- if ((shp = scp->host) == NULL) {
+ if ((shp = scp->device->host) == NULL) {
scp->result = HOST_BYTE(DID_ERROR);
return FAILED;
}
@@ -6390,13 +6390,13 @@ asc_scsi_done_list(Scsi_Cmnd *scp, int from_isr)
ASC_DBG1(3, "asc_scsi_done_list: scp 0x%lx\n", (ulong) scp);
tscp = REQPNEXT(scp);
REQPNEXT(scp) = NULL;
- ASC_STATS(scp->host, done);
+ ASC_STATS(scp->device->host, done);
ASC_ASSERT(scp->scsi_done != NULL);
if (from_isr)
- spin_lock_irqsave(scp->host->host_lock, flags);
+ spin_lock_irqsave(scp->device->host->host_lock, flags);
scp->scsi_done(scp);
if (from_isr)
- spin_unlock_irqrestore(scp->host->host_lock, flags);
+ spin_unlock_irqrestore(scp->device->host->host_lock, flags);
scp = tscp;
}
ASC_DBG(2, "asc_scsi_done_list: done\n");
@@ -6462,8 +6462,8 @@ asc_execute_scsi_cmnd(Scsi_Cmnd *scp)
ASC_DBG2(1, "asc_execute_scsi_cmnd: scp 0x%lx, done 0x%lx\n",
(ulong) scp, (ulong) scp->scsi_done);
- boardp = ASC_BOARDP(scp->host);
- device = boardp->device[scp->target];
+ boardp = ASC_BOARDP(scp->device->host);
+ device = boardp->device[scp->device->id];
if (ASC_NARROW_BOARD(boardp)) {
/*
@@ -6483,7 +6483,7 @@ asc_execute_scsi_cmnd(Scsi_Cmnd *scp)
* asc_build_req() can not return ASC_BUSY.
*/
if (asc_build_req(boardp, scp) == ASC_ERROR) {
- ASC_STATS(scp->host, build_error);
+ ASC_STATS(scp->device->host, build_error);
return ASC_ERROR;
}
@@ -6493,12 +6493,12 @@ asc_execute_scsi_cmnd(Scsi_Cmnd *scp)
*/
switch (ret = AscExeScsiQueue(asc_dvc_varp, &asc_scsi_q)) {
case ASC_NOERROR:
- ASC_STATS(scp->host, exe_noerror);
+ ASC_STATS(scp->device->host, exe_noerror);
/*
* Increment monotonically increasing per device successful
* request counter. Wrapping doesn't matter.
*/
- boardp->reqcnt[scp->target]++;
+ boardp->reqcnt[scp->device->id]++;
asc_enqueue(&boardp->active, scp, ASC_BACK);
ASC_DBG(1,
"asc_execute_scsi_cmnd: AscExeScsiQueue(), ASC_NOERROR\n");
@@ -6508,13 +6508,13 @@ asc_execute_scsi_cmnd(Scsi_Cmnd *scp)
* Caller will enqueue request on the target's waiting queue
* and retry later.
*/
- ASC_STATS(scp->host, exe_busy);
+ ASC_STATS(scp->device->host, exe_busy);
break;
case ASC_ERROR:
ASC_PRINT2(
"asc_execute_scsi_cmnd: board %d: AscExeScsiQueue() ASC_ERROR, err_code 0x%x\n",
boardp->id, asc_dvc_varp->err_code);
- ASC_STATS(scp->host, exe_error);
+ ASC_STATS(scp->device->host, exe_error);
scp->result = HOST_BYTE(DID_ERROR);
asc_enqueue(&boardp->done, scp, ASC_BACK);
break;
@@ -6522,7 +6522,7 @@ asc_execute_scsi_cmnd(Scsi_Cmnd *scp)
ASC_PRINT2(
"asc_execute_scsi_cmnd: board %d: AscExeScsiQueue() unknown, err_code 0x%x\n",
boardp->id, asc_dvc_varp->err_code);
- ASC_STATS(scp->host, exe_unknown);
+ ASC_STATS(scp->device->host, exe_unknown);
scp->result = HOST_BYTE(DID_ERROR);
asc_enqueue(&boardp->done, scp, ASC_BACK);
break;
@@ -6563,7 +6563,7 @@ asc_execute_scsi_cmnd(Scsi_Cmnd *scp)
*/
default:
ASC_DBG(1, "asc_execute_scsi_cmnd: adv_build_req ASC_ERROR\n");
- ASC_STATS(scp->host, build_error);
+ ASC_STATS(scp->device->host, build_error);
return ASC_ERROR;
}
@@ -6573,12 +6573,12 @@ asc_execute_scsi_cmnd(Scsi_Cmnd *scp)
*/
switch (ret = AdvExeScsiQueue(adv_dvc_varp, adv_scsiqp)) {
case ASC_NOERROR:
- ASC_STATS(scp->host, exe_noerror);
+ ASC_STATS(scp->device->host, exe_noerror);
/*
* Increment monotonically increasing per device successful
* request counter. Wrapping doesn't matter.
*/
- boardp->reqcnt[scp->target]++;
+ boardp->reqcnt[scp->device->id]++;
asc_enqueue(&boardp->active, scp, ASC_BACK);
ASC_DBG(1,
"asc_execute_scsi_cmnd: AdvExeScsiQueue(), ASC_NOERROR\n");
@@ -6588,13 +6588,13 @@ asc_execute_scsi_cmnd(Scsi_Cmnd *scp)
* Caller will enqueue request on the target's waiting queue
* and retry later.
*/
- ASC_STATS(scp->host, exe_busy);
+ ASC_STATS(scp->device->host, exe_busy);
break;
case ASC_ERROR:
ASC_PRINT2(
"asc_execute_scsi_cmnd: board %d: AdvExeScsiQueue() ASC_ERROR, err_code 0x%x\n",
boardp->id, adv_dvc_varp->err_code);
- ASC_STATS(scp->host, exe_error);
+ ASC_STATS(scp->device->host, exe_error);
scp->result = HOST_BYTE(DID_ERROR);
asc_enqueue(&boardp->done, scp, ASC_BACK);
break;
@@ -6602,7 +6602,7 @@ asc_execute_scsi_cmnd(Scsi_Cmnd *scp)
ASC_PRINT2(
"asc_execute_scsi_cmnd: board %d: AdvExeScsiQueue() unknown, err_code 0x%x\n",
boardp->id, adv_dvc_varp->err_code);
- ASC_STATS(scp->host, exe_unknown);
+ ASC_STATS(scp->device->host, exe_unknown);
scp->result = HOST_BYTE(DID_ERROR);
asc_enqueue(&boardp->done, scp, ASC_BACK);
break;
@@ -6652,9 +6652,9 @@ asc_build_req(asc_board_t *boardp, Scsi_Cmnd *scp)
}
asc_scsi_q.cdbptr = &scp->cmnd[0];
asc_scsi_q.q2.cdb_len = scp->cmd_len;
- asc_scsi_q.q1.target_id = ASC_TID_TO_TARGET_ID(scp->target);
- asc_scsi_q.q1.target_lun = scp->lun;
- asc_scsi_q.q2.target_ix = ASC_TIDLUN_TO_IX(scp->target, scp->lun);
+ asc_scsi_q.q1.target_id = ASC_TID_TO_TARGET_ID(scp->device->id);
+ asc_scsi_q.q1.target_lun = scp->device->lun;
+ asc_scsi_q.q2.target_ix = ASC_TIDLUN_TO_IX(scp->device->id, scp->device->lun);
asc_scsi_q.q1.sense_addr = cpu_to_le32(virt_to_bus(&scp->sense_buffer[0]));
asc_scsi_q.q1.sense_len = sizeof(scp->sense_buffer);
@@ -6669,8 +6669,8 @@ asc_build_req(asc_board_t *boardp, Scsi_Cmnd *scp)
* started request.
*
*/
- if ((boardp->dvc_var.asc_dvc_var.cur_dvc_qng[scp->target] > 0) &&
- (boardp->reqcnt[scp->target] % 255) == 0) {
+ if ((boardp->dvc_var.asc_dvc_var.cur_dvc_qng[scp->device->id] > 0) &&
+ (boardp->reqcnt[scp->device->id] % 255) == 0) {
asc_scsi_q.q2.tag_code = M2_QTAG_MSG_ORDERED;
} else {
asc_scsi_q.q2.tag_code = M2_QTAG_MSG_SIMPLE;
@@ -6684,11 +6684,11 @@ asc_build_req(asc_board_t *boardp, Scsi_Cmnd *scp)
/*
* CDB request of single contiguous buffer.
*/
- ASC_STATS(scp->host, cont_cnt);
+ ASC_STATS(scp->device->host, cont_cnt);
asc_scsi_q.q1.data_addr =
cpu_to_le32(virt_to_bus(scp->request_buffer));
asc_scsi_q.q1.data_cnt = cpu_to_le32(scp->request_bufflen);
- ASC_STATS_ADD(scp->host, cont_xfer,
+ ASC_STATS_ADD(scp->device->host, cont_xfer,
ASC_CEILING(scp->request_bufflen, 512));
asc_scsi_q.q1.sg_queue_cnt = 0;
asc_scsi_q.sg_head = NULL;
@@ -6699,16 +6699,16 @@ asc_build_req(asc_board_t *boardp, Scsi_Cmnd *scp)
int sgcnt;
struct scatterlist *slp;
- if (scp->use_sg > scp->host->sg_tablesize) {
+ if (scp->use_sg > scp->device->host->sg_tablesize) {
ASC_PRINT3(
"asc_build_req: board %d: use_sg %d > sg_tablesize %d\n",
- boardp->id, scp->use_sg, scp->host->sg_tablesize);
+ boardp->id, scp->use_sg, scp->device->host->sg_tablesize);
scp->result = HOST_BYTE(DID_ERROR);
asc_enqueue(&boardp->done, scp, ASC_BACK);
return ASC_ERROR;
}
- ASC_STATS(scp->host, sg_cnt);
+ ASC_STATS(scp->device->host, sg_cnt);
/*
* Use global ASC_SG_HEAD structure and set the ASC_SCSI_Q
@@ -6722,7 +6722,7 @@ asc_build_req(asc_board_t *boardp, Scsi_Cmnd *scp)
asc_scsi_q.q1.data_addr = 0;
/* This is a byte value, otherwise it would need to be swapped. */
asc_sg_head.entry_cnt = asc_scsi_q.q1.sg_queue_cnt = scp->use_sg;
- ASC_STATS_ADD(scp->host, sg_elem, asc_sg_head.entry_cnt);
+ ASC_STATS_ADD(scp->device->host, sg_elem, asc_sg_head.entry_cnt);
/*
* Convert scatter-gather list into ASC_SG_HEAD list.
@@ -6733,7 +6733,7 @@ asc_build_req(asc_board_t *boardp, Scsi_Cmnd *scp)
cpu_to_le32(virt_to_bus(
(unsigned char *)page_address(slp->page) + slp->offset));
asc_sg_head.sg_list[sgcnt].bytes = cpu_to_le32(slp->length);
- ASC_STATS_ADD(scp->host, sg_xfer, ASC_CEILING(slp->length, 512));
+ ASC_STATS_ADD(scp->device->host, sg_xfer, ASC_CEILING(slp->length, 512));
}
}
@@ -6768,7 +6768,7 @@ adv_build_req(asc_board_t *boardp, Scsi_Cmnd *scp,
*/
if (boardp->adv_reqp == NULL) {
ASC_DBG(1, "adv_build_req: no free adv_req_t\n");
- ASC_STATS(scp->host, adv_build_noreq);
+ ASC_STATS(scp->device->host, adv_build_noreq);
return ASC_BUSY;
} else {
reqp = boardp->adv_reqp;
@@ -6823,8 +6823,8 @@ adv_build_req(asc_board_t *boardp, Scsi_Cmnd *scp,
scsiqp->cdb16[i - 12] = scp->cmnd[i];
}
- scsiqp->target_id = scp->target;
- scsiqp->target_lun = scp->lun;
+ scsiqp->target_id = scp->device->id;
+ scsiqp->target_lun = scp->device->lun;
scsiqp->sense_addr = cpu_to_le32(virt_to_bus(&scp->sense_buffer[0]));
scsiqp->sense_len = sizeof(scp->sense_buffer);
@@ -6844,8 +6844,8 @@ adv_build_req(asc_board_t *boardp, Scsi_Cmnd *scp,
reqp->sgblkp = NULL;
scsiqp->sg_list_ptr = NULL;
scsiqp->sg_real_addr = 0;
- ASC_STATS(scp->host, cont_cnt);
- ASC_STATS_ADD(scp->host, cont_xfer,
+ ASC_STATS(scp->device->host, cont_cnt);
+ ASC_STATS_ADD(scp->device->host, cont_xfer,
ASC_CEILING(scp->request_bufflen, 512));
} else {
/*
@@ -6854,7 +6854,7 @@ adv_build_req(asc_board_t *boardp, Scsi_Cmnd *scp,
if (scp->use_sg > ADV_MAX_SG_LIST) {
ASC_PRINT3(
"adv_build_req: board %d: use_sg %d > ADV_MAX_SG_LIST %d\n",
- boardp->id, scp->use_sg, scp->host->sg_tablesize);
+ boardp->id, scp->use_sg, scp->device->host->sg_tablesize);
scp->result = HOST_BYTE(DID_ERROR);
asc_enqueue(&boardp->done, scp, ASC_BACK);
@@ -6879,8 +6879,8 @@ adv_build_req(asc_board_t *boardp, Scsi_Cmnd *scp,
return ret;
}
- ASC_STATS(scp->host, sg_cnt);
- ASC_STATS_ADD(scp->host, sg_elem, scp->use_sg);
+ ASC_STATS(scp->device->host, sg_cnt);
+ ASC_STATS_ADD(scp->device->host, sg_elem, scp->use_sg);
}
ASC_DBG_PRT_ADV_SCSI_REQ_Q(2, scsiqp);
@@ -6929,7 +6929,7 @@ adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, Scsi_Cmnd *scp)
*/
if ((sgblkp = boardp->adv_sgblkp) == NULL) {
ASC_DBG(1, "adv_get_sglist: no free adv_sgblk_t\n");
- ASC_STATS(scp->host, adv_build_nosg);
+ ASC_STATS(scp->device->host, adv_build_nosg);
/*
* Allocation failed. Free 'adv_sgblk_t' structures already
@@ -6992,7 +6992,7 @@ adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, Scsi_Cmnd *scp)
cpu_to_le32(virt_to_bus(
(unsigned char *)page_address(slp->page) + slp->offset));
sg_block->sg_list[i].sg_count = cpu_to_le32(slp->length);
- ASC_STATS_ADD(scp->host, sg_xfer, ASC_CEILING(slp->length, 512));
+ ASC_STATS_ADD(scp->device->host, sg_xfer, ASC_CEILING(slp->length, 512));
if (--sg_elem_cnt == 0)
{ /* Last ADV_SG_BLOCK and scatter-gather entry. */
@@ -7043,7 +7043,7 @@ asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
* If the request's host pointer is not valid, display a
* message and return.
*/
- shp = scp->host;
+ shp = scp->device->host;
for (i = 0; i < asc_board_count; i++) {
if (asc_host[i] == shp) {
break;
@@ -7085,10 +7085,10 @@ asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
* If an INQUIRY command completed successfully, then call
* the AscInquiryHandling() function to set-up the device.
*/
- if (scp->cmnd[0] == SCSICMD_Inquiry && scp->lun == 0 &&
+ if (scp->cmnd[0] == SCSICMD_Inquiry && scp->device->lun == 0 &&
(scp->request_bufflen - qdonep->remain_bytes) >= 8)
{
- AscInquiryHandling(asc_dvc_varp, scp->target & 0x7,
+ AscInquiryHandling(asc_dvc_varp, scp->device->id & 0x7,
(ASC_SCSI_INQUIRY *) scp->request_buffer);
}
@@ -7160,10 +7160,10 @@ asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
* current request finished normally, then set the bit for the target
* to indicate that a device is present.
*/
- if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scp->target)) == 0 &&
+ if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scp->device->id)) == 0 &&
qdonep->d3.done_stat == QD_NO_ERROR &&
qdonep->d3.host_stat == QHSTA_NO_ERROR) {
- boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->target);
+ boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->device->id);
}
/*
@@ -7232,7 +7232,7 @@ adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
* If the request's host pointer is not valid, display a message
* and return.
*/
- shp = scp->host;
+ shp = scp->device->host;
for (i = 0; i < asc_board_count; i++) {
if (asc_host[i] == shp) {
break;
@@ -7343,10 +7343,10 @@ adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
* current request finished normally, then set the bit for the target
* to indicate that a device is present.
*/
- if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scp->target)) == 0 &&
+ if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scp->device->id)) == 0 &&
scsiqp->done_status == QD_NO_ERROR &&
scsiqp->host_status == QHSTA_NO_ERROR) {
- boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->target);
+ boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->device->id);
}
/*
@@ -7586,7 +7586,7 @@ asc_dequeue_list(asc_queue_t *ascq, REQP *lastpp, int tid)
{
REQP reqp;
for (reqp = firstp; reqp; reqp = REQPNEXT(reqp)) {
- REQTIMESTAT("asc_dequeue_list", ascq, reqp, reqp->target);
+ REQTIMESTAT("asc_dequeue_list", ascq, reqp, reqp->device->id);
}
}
#endif /* ADVANSYS_STATS */
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index fd5c8dc3513b..adf574bd313b 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -1645,7 +1645,7 @@ ahd_linux_bus_reset(Scsi_Cmnd *cmd)
ahd_name(ahd), cmd);
#endif
ahd_midlayer_entrypoint_lock(ahd, &s);
- found = ahd_reset_channel(ahd, cmd->channel + 'A',
+ found = ahd_reset_channel(ahd, cmd->device->channel + 'A',
/*initiate reset*/TRUE);
acmd = TAILQ_FIRST(&ahd->platform_data->completeq);
TAILQ_INIT(&ahd->platform_data->completeq);
@@ -3996,7 +3996,7 @@ ahd_linux_dv_timeout(struct scsi_cmnd *cmd)
ahd_set_transaction_status(scb, CAM_AUTOSENSE_FAIL);
else
ahd_set_transaction_status(scb, CAM_CMD_TIMEOUT);
- ahd_reset_channel(ahd, cmd->channel + 'A', /*initiate*/TRUE);
+ ahd_reset_channel(ahd, cmd->device->channel + 'A', /*initiate*/TRUE);
/*
* Add a minimal bus settle delay for devices that are slow to
@@ -4275,7 +4275,6 @@ ahd_linux_run_device_queue(struct ahd_softc *ahd, struct ahd_linux_device *dev)
*/
hscb->control = 0;
hscb->scsiid = BUILD_SCSIID(ahd, cmd);
- hscb->lun = cmd->lun;
scb->hscb->task_management = 0;
mask = SCB_GET_TARGET_MASK(ahd, scb);
@@ -4975,7 +4974,7 @@ ahd_linux_queue_cmd_complete(struct ahd_softc *ahd, Scsi_Cmnd *cmd)
uint32_t action;
u_int scsi_status;
- dev = ahd_linux_get_device(ahd, cmd->channel,
+ dev = ahd_linux_get_device(ahd, cmd->device->channel,
cmd->device->id,
cmd->device->lun,
/*alloc*/FALSE);
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index cd304a021bb8..8ddc984c5ed3 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -3774,7 +3774,7 @@ ahc_linux_run_device_queue(struct ahc_softc *ahc, struct ahc_linux_device *dev)
*/
hscb->control = 0;
hscb->scsiid = BUILD_SCSIID(ahc, cmd);
- hscb->lun = cmd->lun;
+ hscb->lun = cmd->device->lun;
mask = SCB_GET_TARGET_MASK(ahc, scb);
tinfo = ahc_fetch_transinfo(ahc, SCB_GET_CHANNEL(ahc, scb),
SCB_GET_OUR_ID(scb),
@@ -5090,7 +5090,7 @@ ahc_linux_queue_recovery_cmd(Scsi_Cmnd *cmd, scb_flag flag)
wait = TRUE;
} else {
printf("%s:%d:%d:%d: Unable to deliver message\n",
- ahc_name(ahc), cmd->channel, cmd->device->id,
+ ahc_name(ahc), cmd->device->channel, cmd->device->id,
cmd->device->lun);
retval = FAILED;
goto done;
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index 88e2de991ca5..827accc86a3e 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -1040,11 +1040,11 @@ static struct aic7xxx_syncrate {
(((scb->hscb)->target_channel_lun >> 4) & 0xf), \
((scb->hscb)->target_channel_lun & 0x07)
-#define CTL_OF_CMD(cmd) ((cmd->channel) & 0x01), \
- ((cmd->target) & 0x0f), \
- ((cmd->lun) & 0x07)
+#define CTL_OF_CMD(cmd) ((cmd->device->channel) & 0x01), \
+ ((cmd->device->id) & 0x0f), \
+ ((cmd->device->lun) & 0x07)
-#define TARGET_INDEX(cmd) ((cmd)->target | ((cmd)->channel << 3))
+#define TARGET_INDEX(cmd) ((cmd)->device->id | ((cmd)->device->channel << 3))
/*
* A nice little define to make doing our printks a little easier
@@ -4284,7 +4284,7 @@ aic7xxx_handle_seqint(struct aic7xxx_host *p, unsigned char intstat)
memcpy(scb->sense_cmd, &generic_sense[0],
sizeof(generic_sense));
- scb->sense_cmd[1] = (cmd->lun << 5);
+ scb->sense_cmd[1] = (cmd->device->lun << 5);
scb->sense_cmd[4] = sizeof(cmd->sense_buffer);
scb->sg_list[0].length =
@@ -4935,9 +4935,9 @@ aic7xxx_parse_msg(struct aic7xxx_host *p, struct aic7xxx_scb *scb)
struct aic7xxx_syncrate *syncrate;
struct aic_dev_data *aic_dev;
- target = scb->cmd->target;
- channel = scb->cmd->channel;
- lun = scb->cmd->lun;
+ target = scb->cmd->device->id;
+ channel = scb->cmd->device->channel;
+ lun = scb->cmd->device->lun;
reply = reject = done = FALSE;
tindex = TARGET_INDEX(scb->cmd);
aic_dev = AIC_DEV(scb->cmd);
@@ -6026,11 +6026,11 @@ aic7xxx_handle_scsiint(struct aic7xxx_host *p, unsigned char intstat)
*/
aic_dev = AIC_DEV(scb->cmd);
aic_dev->needppr = aic_dev->needppr_copy = 0;
- aic7xxx_set_width(p, scb->cmd->target, scb->cmd->channel, scb->cmd->lun,
+ aic7xxx_set_width(p, scb->cmd->device->id, scb->cmd->device->channel, scb->cmd->device->lun,
MSG_EXT_WDTR_BUS_8_BIT,
(AHC_TRANS_ACTIVE|AHC_TRANS_CUR|AHC_TRANS_QUITE),
aic_dev);
- aic7xxx_set_syncrate(p, NULL, scb->cmd->target, scb->cmd->channel, 0, 0,
+ aic7xxx_set_syncrate(p, NULL, scb->cmd->device->id, scb->cmd->device->channel, 0, 0,
0, AHC_TRANS_ACTIVE|AHC_TRANS_CUR|AHC_TRANS_QUITE,
aic_dev);
aic_dev->goal.options = 0;
@@ -6307,8 +6307,8 @@ aic7xxx_handle_command_completion_intr(struct aic7xxx_host *p)
unpause_sequencer(p, FALSE);
continue;
}
- aic7xxx_reset_device(p, scb->cmd->target, scb->cmd->channel,
- scb->cmd->lun, scb->hscb->tag);
+ aic7xxx_reset_device(p, scb->cmd->device->id, scb->cmd->device->channel,
+ scb->cmd->device->lun, scb->hscb->tag);
scb->flags &= ~(SCB_QUEUED_FOR_DONE | SCB_RESET | SCB_ABORT |
SCB_QUEUED_ABORT);
unpause_sequencer(p, FALSE);
@@ -10201,8 +10201,8 @@ aic7xxx_buildscb(struct aic7xxx_host *p, Scsi_Cmnd *cmd,
}
scb->flags |= SCB_DTR_SCB;
}
- hscb->target_channel_lun = ((cmd->target << 4) & 0xF0) |
- ((cmd->channel & 0x01) << 3) | (cmd->lun & 0x07);
+ hscb->target_channel_lun = ((cmd->device->id << 4) & 0xF0) |
+ ((cmd->device->channel & 0x01) << 3) | (cmd->device->lun & 0x07);
/*
* The interpretation of request_buffer and request_bufflen
@@ -10298,7 +10298,7 @@ aic7xxx_queue(Scsi_Cmnd *cmd, void (*fn)(Scsi_Cmnd *))
struct aic7xxx_scb *scb;
struct aic_dev_data *aic_dev;
- p = (struct aic7xxx_host *) cmd->host->hostdata;
+ p = (struct aic7xxx_host *) cmd->device->host->hostdata;
aic_dev = cmd->device->hostdata;
#ifdef AIC7XXX_VERBOSE_DEBUGGING
@@ -10379,7 +10379,7 @@ aic7xxx_bus_device_reset(Scsi_Cmnd *cmd)
printk(KERN_ERR "aic7xxx_bus_device_reset: called with NULL cmd!\n");
return FAILED;
}
- p = (struct aic7xxx_host *)cmd->host->hostdata;
+ p = (struct aic7xxx_host *)cmd->device->host->hostdata;
aic_dev = AIC_DEV(cmd);
if(aic7xxx_position(cmd) < p->scb_data->numscbs)
scb = (p->scb_data->scb_array[aic7xxx_position(cmd)]);
@@ -10441,7 +10441,7 @@ aic7xxx_bus_device_reset(Scsi_Cmnd *cmd)
aic_inb(p, STCNT));
}
- channel = cmd->channel;
+ channel = cmd->device->channel;
/*
* Send a Device Reset Message:
@@ -10508,7 +10508,7 @@ aic7xxx_bus_device_reset(Scsi_Cmnd *cmd)
* Check to see if the command is on the qinfifo. If it is, then we will
* not need to queue the command again since the card should start it soon
*/
- if (aic7xxx_search_qinfifo(p, cmd->channel, cmd->target, cmd->lun, hscb->tag,
+ if (aic7xxx_search_qinfifo(p, cmd->device->channel, cmd->device->id, cmd->device->lun, hscb->tag,
0, TRUE, NULL) == 0)
{
disconnected = TRUE;
@@ -10604,7 +10604,7 @@ aic7xxx_abort(Scsi_Cmnd *cmd)
printk(KERN_ERR "aic7xxx_abort: called with NULL cmd!\n");
return FAILED;
}
- p = (struct aic7xxx_host *)cmd->host->hostdata;
+ p = (struct aic7xxx_host *)cmd->device->host->hostdata;
aic_dev = AIC_DEV(cmd);
if(aic7xxx_position(cmd) < p->scb_data->numscbs)
scb = (p->scb_data->scb_array[aic7xxx_position(cmd)]);
@@ -10664,8 +10664,8 @@ aic7xxx_abort(Scsi_Cmnd *cmd)
/*
* We just checked the waiting_q, now for the QINFIFO
*/
- if ( ((found = aic7xxx_search_qinfifo(p, cmd->target, cmd->channel,
- cmd->lun, scb->hscb->tag, SCB_ABORT | SCB_QUEUED_FOR_DONE,
+ if ( ((found = aic7xxx_search_qinfifo(p, cmd->device->id, cmd->device->channel,
+ cmd->device->lun, scb->hscb->tag, SCB_ABORT | SCB_QUEUED_FOR_DONE,
FALSE, NULL)) != 0) &&
(aic7xxx_verbose & VERBOSE_ABORT_PROCESS))
{
@@ -10825,7 +10825,7 @@ aic7xxx_reset(Scsi_Cmnd *cmd)
struct aic7xxx_host *p;
struct aic_dev_data *aic_dev;
- p = (struct aic7xxx_host *) cmd->host->hostdata;
+ p = (struct aic7xxx_host *) cmd->device->host->hostdata;
aic_dev = AIC_DEV(cmd);
if(aic7xxx_position(cmd) < p->scb_data->numscbs)
{
@@ -10872,10 +10872,10 @@ aic7xxx_reset(Scsi_Cmnd *cmd)
* By this point, we want to already know what we are going to do and
* only have the following code implement our course of action.
*/
- aic7xxx_reset_channel(p, cmd->channel, TRUE);
+ aic7xxx_reset_channel(p, cmd->device->channel, TRUE);
if (p->features & AHC_TWIN)
{
- aic7xxx_reset_channel(p, cmd->channel ^ 0x01, TRUE);
+ aic7xxx_reset_channel(p, cmd->device->channel ^ 0x01, TRUE);
restart_sequencer(p);
}
aic_outb(p, aic_inb(p, SIMODE1) & ~(ENREQINIT|ENBUSFREE), SIMODE1);
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index 73538537f682..41418a55b9a5 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -492,17 +492,17 @@ static int atp870u_queuecommand(Scsi_Cmnd * req_p, void (*done) (Scsi_Cmnd *))
struct Scsi_Host *host;
struct atp_unit *dev;
- if (req_p->channel != 0) {
+ if (req_p->device->channel != 0) {
req_p->result = 0x00040000;
done(req_p);
return 0;
};
- host = req_p->host;
+ host = req_p->device->host;
dev = (struct atp_unit *)&host->hostdata;
m = 1;
- m = m << req_p->target;
+ m = m << req_p->device->id;
/*
* Fake a timeout for missing targets
@@ -600,9 +600,9 @@ static void send_s870(struct Scsi_Host *host)
dev->quhdu = 0;
}
workrequ = dev->querequ[dev->quhdu];
- if (dev->id[workrequ->target].curr_req == 0) {
- dev->id[workrequ->target].curr_req = workrequ;
- dev->last_cmd = workrequ->target;
+ if (dev->id[workrequ->device->id].curr_req == 0) {
+ dev->id[workrequ->device->id].curr_req = workrequ;
+ dev->last_cmd = workrequ->device->id;
goto cmd_subp;
}
dev->quhdu = j;
@@ -638,7 +638,7 @@ oktosend:
tmport = workportu + 0x1b;
j = 0;
- target_id = workrequ->target;
+ target_id = workrequ->device->id;
/*
* Wide ?
@@ -665,7 +665,7 @@ oktosend:
outb(dev->ata_cdbu[i], tmport++);
}
tmport = workportu + 0x0f;
- outb(workrequ->lun, tmport);
+ outb(workrequ->device->lun, tmport);
tmport += 0x02;
/*
* Write the target
@@ -2606,7 +2606,7 @@ int atp870u_abort(Scsi_Cmnd * SCpnt)
unsigned char j, k;
Scsi_Cmnd *workrequ;
unsigned int tmport;
- struct atp_unit *dev = (struct atp_unit *)&SCpnt->host->hostdata;
+ struct atp_unit *dev = (struct atp_unit *)&SCpnt->device->host->hostdata;
printk(KERN_DEBUG "working=%x last_cmd=%x ", dev->working, dev->last_cmd);
printk(" quhdu=%x quendu=%x ", dev->quhdu, dev->quendu);
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 558de6b0de5c..ae0d83fae3ed 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1118,9 +1118,9 @@ int print_msg (const unsigned char *msg) {
void print_Scsi_Cmnd (Scsi_Cmnd *cmd) {
printk("scsi%d : destination target %d, lun %d\n",
- cmd->host->host_no,
- cmd->target,
- cmd->lun);
+ cmd->device->host->host_no,
+ cmd->device->id,
+ cmd->device->lun);
printk(" command = ");
print_command (cmd->cmnd);
}
diff --git a/drivers/scsi/cpqfcTSinit.c b/drivers/scsi/cpqfcTSinit.c
index 2d5b2227e91b..843ead6b75cf 100644
--- a/drivers/scsi/cpqfcTSinit.c
+++ b/drivers/scsi/cpqfcTSinit.c
@@ -730,9 +730,12 @@ int cpqfcTS_ioctl( Scsi_Device *ScsiDev, int Cmnd, void *arg)
case CPQFC_IOCTL_FC_TARGET_ADDRESS:
// can we find an FC device mapping to this SCSI target?
- DumCmnd.channel = ScsiDev->channel; // For searching
- DumCmnd.target = ScsiDev->id;
- DumCmnd.lun = ScsiDev->lun;
+/* DumCmnd.channel = ScsiDev->channel; */ // For searching
+/* DumCmnd.target = ScsiDev->id; */
+/* DumCmnd.lun = ScsiDev->lun; */
+
+ DumCmnd.device = ScsiDev;
+
pLoggedInPort = fcFindLoggedInPort( fcChip,
&DumCmnd, // search Scsi Nexus
0, // DON'T search linked list for FC port id
@@ -1297,7 +1300,7 @@ static void QueBadTargetCmnd( CPQFCHBA *cpqfcHBAdata, Scsi_Cmnd *Cmnd)
int cpqfcTS_queuecommand(Scsi_Cmnd *Cmnd, void (* done)(Scsi_Cmnd *))
{
- struct Scsi_Host *HostAdapter = Cmnd->host;
+ struct Scsi_Host *HostAdapter = Cmnd->device->host;
CPQFCHBA *cpqfcHBAdata = (CPQFCHBA *)HostAdapter->hostdata;
PTACHYON fcChip = &cpqfcHBAdata->fcChip;
TachFCHDR_GCMND fchs; // only use for FC destination id field
@@ -1353,9 +1356,9 @@ int cpqfcTS_queuecommand(Scsi_Cmnd *Cmnd, void (* done)(Scsi_Cmnd *))
// printk(" @Q bad targ cmnd %p@ ", Cmnd);
QueBadTargetCmnd( cpqfcHBAdata, Cmnd);
}
- else if (Cmnd->lun >= CPQFCTS_MAX_LUN)
+ else if (Cmnd->device->lun >= CPQFCTS_MAX_LUN)
{
- printk(KERN_WARNING "cpqfc: Invalid LUN: %d\n", Cmnd->lun);
+ printk(KERN_WARNING "cpqfc: Invalid LUN: %d\n", Cmnd->device->lun);
QueBadTargetCmnd( cpqfcHBAdata, Cmnd);
}
@@ -1475,7 +1478,7 @@ int cpqfcTS_abort(Scsi_Cmnd *Cmnd)
int cpqfcTS_eh_abort(Scsi_Cmnd *Cmnd)
{
- struct Scsi_Host *HostAdapter = Cmnd->host;
+ struct Scsi_Host *HostAdapter = Cmnd->device->host;
// get the pointer to our Scsi layer HBA buffer
CPQFCHBA *cpqfcHBAdata = (CPQFCHBA *)HostAdapter->hostdata;
PTACHYON fcChip = &cpqfcHBAdata->fcChip;
@@ -1601,8 +1604,7 @@ return -ENOTSUPP;
scsi_cdb[0] = RELEASE;
- // allocate with wait = true, interruptible = false
- SCpnt = scsi_allocate_device(ScsiDev, 1);
+ SCpnt = scsi_getset_command(ScsiDev, GFP_KERNEL);
{
CPQFC_DECLARE_COMPLETION(wait);
@@ -1651,7 +1653,7 @@ return -ENOTSUPP;
result = SCpnt->result;
SDpnt = SCpnt->device;
- scsi_release_command(SCpnt);
+ scsi_put_command(SCpnt);
SCpnt = NULL;
// if (!SDpnt->was_reset && SDpnt->scsi_request_fn)
@@ -1668,9 +1670,9 @@ int cpqfcTS_eh_device_reset(Scsi_Cmnd *Cmnd)
int retval;
Scsi_Device *SDpnt = Cmnd->device;
// printk(" ENTERING cpqfcTS_eh_device_reset() \n");
- spin_unlock_irq(Cmnd->host->host_lock);
+ spin_unlock_irq(Cmnd->device->host->host_lock);
retval = cpqfcTS_TargetDeviceReset( SDpnt, 0);
- spin_lock_irq(Cmnd->host->host_lock);
+ spin_lock_irq(Cmnd->device->host->host_lock);
return retval;
}
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 1fb2d77cf0dd..31461b46fc22 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -391,7 +391,7 @@ static int adpt_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
return 0;
}
- pHba = (adpt_hba*)cmd->host->hostdata[0];
+ pHba = (adpt_hba*)cmd->device->host->hostdata[0];
if (!pHba) {
return FAILED;
}
@@ -424,7 +424,7 @@ static int adpt_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
* to the device structure. This should be a TEST_UNIT_READY
* command from scan_scsis_single.
*/
- if ((pDev = adpt_find_device(pHba, (u32)cmd->channel, (u32)cmd->target, (u32)cmd-> lun)) == NULL) {
+ if ((pDev = adpt_find_device(pHba, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun)) == NULL) {
// TODO: if any luns are at this bus, scsi id then fake a TEST_UNIT_READY and INQUIRY response
// with type 7F (for all luns less than the max for this bus,id) so the lun scan will continue.
cmd->result = (DID_NO_CONNECT << 16);
@@ -647,7 +647,7 @@ static int adpt_abort(Scsi_Cmnd * cmd)
if(cmd->serial_number == 0){
return FAILED;
}
- pHba = (adpt_hba*) cmd->host->hostdata[0];
+ pHba = (adpt_hba*) cmd->device->host->hostdata[0];
printk(KERN_INFO"%s: Trying to Abort cmd=%ld\n",pHba->name, cmd->serial_number);
if ((dptdevice = (void*) (cmd->device->hostdata)) == NULL) {
printk(KERN_ERR "%s: Unable to abort: No device in cmnd\n",pHba->name);
@@ -685,7 +685,7 @@ static int adpt_device_reset(Scsi_Cmnd* cmd)
int old_state;
struct adpt_device* d = (void*) cmd->device->hostdata;
- pHba = (void*) cmd->host->hostdata[0];
+ pHba = (void*) cmd->device->host->hostdata[0];
printk(KERN_INFO"%s: Trying to reset device\n",pHba->name);
if (!d) {
printk(KERN_INFO"%s: Reset Device: Device Not found\n",pHba->name);
@@ -722,11 +722,11 @@ static int adpt_bus_reset(Scsi_Cmnd* cmd)
adpt_hba* pHba;
u32 msg[4];
- pHba = (adpt_hba*)cmd->host->hostdata[0];
+ pHba = (adpt_hba*)cmd->device->host->hostdata[0];
memset(msg, 0, sizeof(msg));
- printk(KERN_WARNING"%s: Bus reset: SCSI Bus %d: tid: %d\n",pHba->name, cmd->channel,pHba->channel[cmd->channel].tid );
+ printk(KERN_WARNING"%s: Bus reset: SCSI Bus %d: tid: %d\n",pHba->name, cmd->device->channel,pHba->channel[cmd->device->channel].tid );
msg[0] = FOUR_WORD_MSG_SIZE|SGL_OFFSET_0;
- msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->channel].tid);
+ msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid);
msg[2] = 0;
msg[3] = 0;
if(adpt_i2o_post_wait(pHba, (void*)msg,sizeof(msg), FOREVER) ){
@@ -743,8 +743,8 @@ static int adpt_reset(Scsi_Cmnd* cmd)
{
adpt_hba* pHba;
int rcode;
- pHba = (adpt_hba*)cmd->host->hostdata[0];
- printk(KERN_WARNING"%s: Hba Reset: scsi id %d: tid: %d\n",pHba->name,cmd->channel,pHba->channel[cmd->channel].tid );
+ pHba = (adpt_hba*)cmd->device->host->hostdata[0];
+ printk(KERN_WARNING"%s: Hba Reset: scsi id %d: tid: %d\n",pHba->name,cmd->device->channel,pHba->channel[cmd->device->channel].tid );
rcode = adpt_hba_reset(pHba);
if(rcode == 0){
printk(KERN_WARNING"%s: HBA reset complete\n",pHba->name);
@@ -2216,7 +2216,7 @@ static s32 adpt_i2o_to_scsi(ulong reply, Scsi_Cmnd* cmd)
// calculate resid for sg
cmd->resid = cmd->request_bufflen - readl(reply+5);
- pHba = (adpt_hba*) cmd->host->hostdata[0];
+ pHba = (adpt_hba*) cmd->device->host->hostdata[0];
cmd->sense_buffer[0] = '\0'; // initialize sense valid flag to false
@@ -2240,7 +2240,7 @@ static s32 adpt_i2o_to_scsi(ulong reply, Scsi_Cmnd* cmd)
case I2O_SCSI_DSC_NO_ADAPTER:
case I2O_SCSI_DSC_RESOURCE_UNAVAILABLE:
printk(KERN_WARNING"%s: SCSI Timeout-Device (%d,%d,%d) hba status=0x%x, dev status=0x%x, cmd=0x%x\n",
- pHba->name, (u32)cmd->channel, (u32)cmd->target, (u32)cmd->lun, hba_status, dev_status, cmd->cmnd[0]);
+ pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun, hba_status, dev_status, cmd->cmnd[0]);
cmd->result = (DID_TIME_OUT << 16);
break;
case I2O_SCSI_DSC_ADAPTER_BUSY:
@@ -2280,7 +2280,7 @@ static s32 adpt_i2o_to_scsi(ulong reply, Scsi_Cmnd* cmd)
case I2O_SCSI_DSC_REQUEST_INVALID:
default:
printk(KERN_WARNING"%s: SCSI error %0x-Device(%d,%d,%d) hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n",
- pHba->name, detailed_status & I2O_SCSI_DSC_MASK, (u32)cmd->channel, (u32)cmd->target, (u32)cmd-> lun,
+ pHba->name, detailed_status & I2O_SCSI_DSC_MASK, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun,
hba_status, dev_status, cmd->cmnd[0]);
cmd->result = (DID_ERROR << 16);
break;
@@ -2298,7 +2298,7 @@ static s32 adpt_i2o_to_scsi(ulong reply, Scsi_Cmnd* cmd)
/* This is to handle an array failed */
cmd->result = (DID_TIME_OUT << 16);
printk(KERN_WARNING"%s: SCSI Data Protect-Device (%d,%d,%d) hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n",
- pHba->name, (u32)cmd->channel, (u32)cmd->target, (u32)cmd->lun,
+ pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun,
hba_status, dev_status, cmd->cmnd[0]);
}
@@ -2310,7 +2310,7 @@ static s32 adpt_i2o_to_scsi(ulong reply, Scsi_Cmnd* cmd)
*/
cmd->result = (DID_TIME_OUT << 16);
printk(KERN_WARNING"%s: I2O MSG_FAIL - Device (%d,%d,%d) tid=%d, cmd=0x%x\n",
- pHba->name, (u32)cmd->channel, (u32)cmd->target, (u32)cmd-> lun,
+ pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun,
((struct adpt_device*)(cmd->device->hostdata))->tid, cmd->cmnd[0]);
}
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index 7daddab686b9..4bba896bbebd 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -1640,7 +1640,7 @@ static int eata2x_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
struct mscp *cpp;
/* j is the board number */
- j = ((struct hostdata *) SCpnt->host->hostdata)->board_number;
+ j = ((struct hostdata *) SCpnt->device->host->hostdata)->board_number;
if (SCpnt->host_scribble)
panic("%s: qcomm, pid %ld, SCpnt %p already active.\n",
@@ -1678,8 +1678,8 @@ static int eata2x_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
SCpnt->host_scribble = (unsigned char *) &cpp->cpp_index;
if (do_trace) printk("%s: qcomm, mbox %d, target %d.%d:%d, pid %ld.\n",
- BN(j), i, SCpnt->channel, SCpnt->target,
- SCpnt->lun, SCpnt->pid);
+ BN(j), i, SCpnt->device->channel, SCpnt->device->id,
+ SCpnt->device->lun, SCpnt->pid);
cpp->reqsen = TRUE;
cpp->dispri = TRUE;
@@ -1687,9 +1687,9 @@ static int eata2x_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
if (SCpnt->device->type == TYPE_TAPE) cpp->hbaci = TRUE;
#endif
cpp->one = TRUE;
- cpp->channel = SCpnt->channel;
- cpp->target = SCpnt->target;
- cpp->lun = SCpnt->lun;
+ cpp->channel = SCpnt->device->channel;
+ cpp->target = SCpnt->device->id;
+ cpp->lun = SCpnt->device->lun;
cpp->SCpnt = SCpnt;
memcpy(cpp->cdb, SCpnt->cmnd, SCpnt->cmd_len);
@@ -1711,7 +1711,7 @@ static int eata2x_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
unmap_dma(i, j);
SCpnt->host_scribble = NULL;
printk("%s: qcomm, target %d.%d:%d, pid %ld, adapter busy.\n",
- BN(j), SCpnt->channel, SCpnt->target, SCpnt->lun, SCpnt->pid);
+ BN(j), SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun, SCpnt->pid);
return 1;
}
@@ -1722,17 +1722,17 @@ static int eata2x_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
static int eata2x_eh_abort(Scsi_Cmnd *SCarg) {
unsigned int i, j;
- j = ((struct hostdata *) SCarg->host->hostdata)->board_number;
+ j = ((struct hostdata *) SCarg->device->host->hostdata)->board_number;
if (SCarg->host_scribble == NULL) {
printk("%s: abort, target %d.%d:%d, pid %ld inactive.\n",
- BN(j), SCarg->channel, SCarg->target, SCarg->lun, SCarg->pid);
+ BN(j), SCarg->device->channel, SCarg->device->id, SCarg->device->lun, SCarg->pid);
return SUCCESS;
}
i = *(unsigned int *)SCarg->host_scribble;
printk("%s: abort, mbox %d, target %d.%d:%d, pid %ld.\n",
- BN(j), i, SCarg->channel, SCarg->target, SCarg->lun, SCarg->pid);
+ BN(j), i, SCarg->device->channel, SCarg->device->id, SCarg->device->lun, SCarg->pid);
if (i >= sh[j]->can_queue)
panic("%s: abort, invalid SCarg->host_scribble.\n", BN(j));
@@ -1798,9 +1798,9 @@ static int eata2x_eh_host_reset(Scsi_Cmnd *SCarg) {
int arg_done = FALSE;
Scsi_Cmnd *SCpnt;
- j = ((struct hostdata *) SCarg->host->hostdata)->board_number;
+ j = ((struct hostdata *) SCarg->device->host->hostdata)->board_number;
printk("%s: reset, enter, target %d.%d:%d, pid %ld.\n",
- BN(j), SCarg->channel, SCarg->target, SCarg->lun, SCarg->pid);
+ BN(j), SCarg->device->channel, SCarg->device->id, SCarg->device->lun, SCarg->pid);
if (SCarg->host_scribble == NULL)
printk("%s: reset, pid %ld inactive.\n", BN(j), SCarg->pid);
@@ -2056,8 +2056,8 @@ static int reorder(unsigned int j, unsigned long cursec,
k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt;
printk("%s %d.%d:%d pid %ld mb %d fc %d nr %d sec %ld ns %ld"\
" cur %ld s:%c r:%c rev:%c in:%c ov:%c xd %d.\n",
- (ihdlr ? "ihdlr" : "qcomm"), SCpnt->channel, SCpnt->target,
- SCpnt->lun, SCpnt->pid, k, flushcount, n_ready,
+ (ihdlr ? "ihdlr" : "qcomm"), SCpnt->device->channel, SCpnt->device->id,
+ SCpnt->device->lun, SCpnt->pid, k, flushcount, n_ready,
SCpnt->request->sector, SCpnt->request->nr_sectors, cursec,
YESNO(s), YESNO(r), YESNO(rev), YESNO(input_only),
YESNO(overlap), cpp->din);
@@ -2093,7 +2093,7 @@ static void flush_dev(Scsi_Device *dev, unsigned long cursec, unsigned int j,
if (do_dma(sh[j]->io_port, cpp->cp_dma_addr, SEND_CP_DMA)) {
printk("%s: %s, target %d.%d:%d, pid %ld, mbox %d, adapter"\
" busy, will abort.\n", BN(j), (ihdlr ? "ihdlr" : "qcomm"),
- SCpnt->channel, SCpnt->target, SCpnt->lun, SCpnt->pid, k);
+ SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun, SCpnt->pid, k);
HD(j)->cp_stat[k] = ABORTING;
continue;
}
@@ -2227,7 +2227,7 @@ static void ihdlr(int irq, unsigned int j) {
/* If there was a bus reset, redo operation on each target */
else if (tstatus != GOOD && SCpnt->device->type == TYPE_DISK
- && HD(j)->target_redo[SCpnt->target][SCpnt->channel])
+ && HD(j)->target_redo[SCpnt->device->id][SCpnt->device->channel])
status = DID_BUS_BUSY << 16;
/* Works around a flaw in scsi.c */
@@ -2240,18 +2240,18 @@ static void ihdlr(int irq, unsigned int j) {
status = DID_OK << 16;
if (tstatus == GOOD)
- HD(j)->target_redo[SCpnt->target][SCpnt->channel] = FALSE;
+ HD(j)->target_redo[SCpnt->device->id][SCpnt->device->channel] = FALSE;
if (spp->target_status && SCpnt->device->type == TYPE_DISK &&
(!(tstatus == CHECK_CONDITION && HD(j)->iocount <= 1000 &&
(SCpnt->sense_buffer[2] & 0xf) == NOT_READY)))
printk("%s: ihdlr, target %d.%d:%d, pid %ld, "\
"target_status 0x%x, sense key 0x%x.\n", BN(j),
- SCpnt->channel, SCpnt->target, SCpnt->lun,
+ SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun,
SCpnt->pid, spp->target_status,
SCpnt->sense_buffer[2]);
- HD(j)->target_to[SCpnt->target][SCpnt->channel] = 0;
+ HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel] = 0;
if (HD(j)->last_retried_pid == SCpnt->pid) HD(j)->retries = 0;
@@ -2259,11 +2259,11 @@ static void ihdlr(int irq, unsigned int j) {
case ASST: /* Selection Time Out */
case 0x02: /* Command Time Out */
- if (HD(j)->target_to[SCpnt->target][SCpnt->channel] > 1)
+ if (HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel] > 1)
status = DID_ERROR << 16;
else {
status = DID_TIME_OUT << 16;
- HD(j)->target_to[SCpnt->target][SCpnt->channel]++;
+ HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel]++;
}
break;
@@ -2318,7 +2318,7 @@ static void ihdlr(int irq, unsigned int j) {
printk("%s: ihdlr, mbox %2d, err 0x%x:%x,"\
" target %d.%d:%d, pid %ld, reg 0x%x, count %d.\n",
BN(j), i, spp->adapter_status, spp->target_status,
- SCpnt->channel, SCpnt->target, SCpnt->lun, SCpnt->pid,
+ SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun, SCpnt->pid,
reg, HD(j)->iocount);
unmap_dma(i, j);
diff --git a/drivers/scsi/eata_dma.c b/drivers/scsi/eata_dma.c
index 8c33463f35ed..c371da9e11d3 100644
--- a/drivers/scsi/eata_dma.c
+++ b/drivers/scsi/eata_dma.c
@@ -270,7 +270,7 @@ void eata_int_handler(int irq, void *dev_id, struct pt_regs * regs)
}
cmd = ccb->cmd;
- base = (uint) cmd->host->base;
+ base = (uint) cmd->device->host->base;
hba_stat = sp->hba_stat;
scsi_stat = (sp->scsi_stat >> 1) & 0x1f;
@@ -299,8 +299,8 @@ void eata_int_handler(int irq, void *dev_id, struct pt_regs * regs)
eata_stat = inb(base + HA_RSTATUS);
DBG(DBG_INTR, printk("IRQ %d received, base %#.4x, pid %ld, "
"target: %x, lun: %x, ea_s: %#.2x, hba_s: "
- "%#.2x \n", irq, base, cmd->pid, cmd->target,
- cmd->lun, eata_stat, hba_stat));
+ "%#.2x \n", irq, base, cmd->pid, cmd->device->id,
+ cmd->device->lun, eata_stat, hba_stat));
switch (hba_stat) {
case HA_NO_ERROR: /* NO Error */
@@ -337,7 +337,7 @@ void eata_int_handler(int irq, void *dev_id, struct pt_regs * regs)
break;
case HA_CP_RESET_NA:
case HA_CP_RESET:
- HD(cmd)->resetlevel[cmd->channel] = 0;
+ HD(cmd)->resetlevel[cmd->device->channel] = 0;
result = DID_RESET << 16;
DBG(DBG_STATUS, printk(KERN_WARNING "scsi%d: reseted cmd "
"pid %ldreturned\n",
@@ -478,7 +478,7 @@ int eata_queue(Scsi_Cmnd * cmd, void (* done) (Scsi_Cmnd *))
queue_counter++;
hd = HD(cmd);
- sh = cmd->host;
+ sh = cmd->device->host;
if (cmd->cmnd[0] == REQUEST_SENSE && cmd->sense_buffer[0] != 0) {
DBG(DBG_REQSENSE, printk(KERN_DEBUG "Tried to REQUEST SENSE\n"));
@@ -517,7 +517,7 @@ int eata_queue(Scsi_Cmnd * cmd, void (* done) (Scsi_Cmnd *))
restore_flags(flags);
DBG(DBG_QUEUE, printk("eata_queue pid %ld, target: %x, lun: %x, y %d\n",
- cmd->pid, cmd->target, cmd->lun, y));
+ cmd->pid, cmd->device->id, cmd->device->lun, y));
DBG(DBG_QUEUE && DBG_DELAY, DELAY(1));
if(hd->do_latency == TRUE)
@@ -547,7 +547,7 @@ int eata_queue(Scsi_Cmnd * cmd, void (* done) (Scsi_Cmnd *))
/* FIXME: This will will have to be changed once the midlevel driver
* allows different HBA IDs on every channel.
*/
- if (cmd->target == sh->this_id)
+ if (cmd->device->id == sh->this_id)
ccb->Interpret = TRUE; /* Interpret command */
if (cmd->use_sg) {
@@ -586,9 +586,9 @@ int eata_queue(Scsi_Cmnd * cmd, void (* done) (Scsi_Cmnd *))
ccb->cp_reqDMA = htonl(virt_to_bus(cmd->sense_buffer));
ccb->reqlen = sizeof(cmd->sense_buffer);
- ccb->cp_id = cmd->target;
- ccb->cp_channel = cmd->channel;
- ccb->cp_lun = cmd->lun;
+ ccb->cp_id = cmd->device->id;
+ ccb->cp_channel = cmd->device->channel;
+ ccb->cp_lun = cmd->device->lun;
ccb->cp_dispri = TRUE;
ccb->cp_identify = TRUE;
memcpy(ccb->cp_cdb, cmd->cmnd, cmd->cmd_len);
@@ -604,14 +604,14 @@ int eata_queue(Scsi_Cmnd * cmd, void (* done) (Scsi_Cmnd *))
cmd->result = DID_BUS_BUSY << 16;
DBG(DBG_QUEUE && DBG_ABNORM,
printk("eata_queue target %d, pid %ld, HBA busy, "
- "returning DID_BUS_BUSY\n",cmd->target, cmd->pid));
+ "returning DID_BUS_BUSY\n",cmd->device->id, cmd->pid));
ccb->status = FREE;
done(cmd);
return(0);
}
DBG(DBG_QUEUE, printk("Queued base %#.4x pid: %ld target: %x lun: %x "
"slot %d irq %d\n", (s32)sh->base, cmd->pid,
- cmd->target, cmd->lun, y, sh->irq));
+ cmd->device->id, cmd->device->lun, y, sh->irq));
DBG(DBG_QUEUE && DBG_DELAY, DELAY(1));
return(0);
@@ -629,7 +629,7 @@ int eata_abort(Scsi_Cmnd * cmd)
cli();
DBG(DBG_ABNORM, printk("eata_abort called pid: %ld target: %x lun: %x"
- " reason %x\n", cmd->pid, cmd->target, cmd->lun,
+ " reason %x\n", cmd->pid, cmd->device->id, cmd->device->lun,
cmd->abort_reason));
DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
@@ -642,7 +642,7 @@ int eata_abort(Scsi_Cmnd * cmd)
}
}
- while (inb((u32)(cmd->host->base) + HA_RAUXSTAT) & HA_ABUSY) {
+ while (inb((u32)(cmd->device->host->base) + HA_RAUXSTAT) & HA_ABUSY) {
if (--loop == 0) {
printk("eata_dma: abort, timeout error.\n");
DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
@@ -690,7 +690,7 @@ int eata_reset(Scsi_Cmnd * cmd, unsigned int resetflags)
cli();
DBG(DBG_ABNORM, printk("eata_reset called pid:%ld target: %x lun: %x"
- " reason %x\n", cmd->pid, cmd->target, cmd->lun,
+ " reason %x\n", cmd->pid, cmd->device->id, cmd->device->lun,
cmd->abort_reason));
for (x = 1, sh = first_HBA; x <= registered_HBAs; x++, sh = SD(sh)->next) {
@@ -708,7 +708,7 @@ int eata_reset(Scsi_Cmnd * cmd, unsigned int resetflags)
return (SCSI_RESET_ERROR);
}
- while (inb((u32)(cmd->host->base) + HA_RAUXSTAT) & HA_ABUSY)
+ while (inb((u32)(cmd->device->host->base) + HA_RAUXSTAT) & HA_ABUSY)
if (--loop == 0) {
printk("eata_reset: exit, timeout error.\n");
restore_flags(flags);
@@ -716,7 +716,7 @@ int eata_reset(Scsi_Cmnd * cmd, unsigned int resetflags)
return (SCSI_RESET_ERROR);
}
- for (x = 0; x < cmd->host->can_queue; x++) {
+ for (x = 0; x < cmd->device->host->can_queue; x++) {
if (HD(cmd)->ccb[x].status == FREE)
continue;
@@ -743,8 +743,8 @@ int eata_reset(Scsi_Cmnd * cmd, unsigned int resetflags)
}
/* hard reset the HBA */
- inb((u32) (cmd->host->base) + HA_RSTATUS); /* This might cause trouble */
- eata_send_command(0, (u32) cmd->host->base, EATA_CMD_RESET);
+ inb((u32) (cmd->device->host->base) + HA_RSTATUS); /* This might cause trouble */
+ eata_send_command(0, (u32) cmd->device->host->base, EATA_CMD_RESET);
HD(cmd)->state = RESET;
@@ -757,7 +757,7 @@ int eata_reset(Scsi_Cmnd * cmd, unsigned int resetflags)
DBG(DBG_ABNORM, printk("eata_reset: interrupts disabled again.\n"));
DBG(DBG_ABNORM && DBG_DELAY, DELAY(1));
- for (x = 0; x < cmd->host->can_queue; x++) {
+ for (x = 0; x < cmd->device->host->can_queue; x++) {
/* Skip slots already set free by interrupt and those that
* are still LOCKED from the last reset */
diff --git a/drivers/scsi/eata_generic.h b/drivers/scsi/eata_generic.h
index b4e7ba99e774..8bac58f821c7 100644
--- a/drivers/scsi/eata_generic.h
+++ b/drivers/scsi/eata_generic.h
@@ -90,7 +90,7 @@
#define WRITE 1
#define OTHER 2
-#define HD(cmd) ((hostdata *)&(cmd->host->hostdata))
+#define HD(cmd) ((hostdata *)&(cmd->device->host->hostdata))
#define CD(cmd) ((struct eata_ccb *)(cmd->host_scribble))
#define SD(host) ((hostdata *)&(host->hostdata))
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c
index 5607cdd572c9..fe6cc5af296d 100644
--- a/drivers/scsi/eata_pio.c
+++ b/drivers/scsi/eata_pio.c
@@ -157,7 +157,7 @@ static void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs *regs)
cp = &hd->ccb[0];
cmd = cp->cmd;
- base = (uint) cmd->host->base;
+ base = (uint) cmd->device->host->base;
do {
stat = inb(base + HA_RSTATUS);
@@ -286,7 +286,7 @@ static int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
queue_counter++;
hd = HD(cmd);
- sh = cmd->host;
+ sh = cmd->device->host;
base = (uint) sh->base;
/* use only slot 0, as 2001 can handle only one cmd at a time */
@@ -310,7 +310,7 @@ static int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
cp->status = USED; /* claim free slot */
- DBG(DBG_QUEUE, printk(KERN_DEBUG "eata_pio_queue pid %ld, target: %x, lun:" " %x, y %d\n", cmd->pid, cmd->target, cmd->lun, y));
+ DBG(DBG_QUEUE, printk(KERN_DEBUG "eata_pio_queue pid %ld, target: %x, lun:" " %x, y %d\n", cmd->pid, cmd->device->id, cmd->device->lun, y));
cmd->scsi_done = (void *) done;
@@ -319,14 +319,14 @@ static int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
else
cp->DataIn = TRUE; /* Input mode */
- cp->Interpret = (cmd->target == hd->hostid);
+ cp->Interpret = (cmd->device->id == hd->hostid);
cp->cp_datalen = htonl((unsigned long) cmd->request_bufflen);
cp->Auto_Req_Sen = FALSE;
cp->cp_reqDMA = htonl(0);
cp->reqlen = 0;
- cp->cp_id = cmd->target;
- cp->cp_lun = cmd->lun;
+ cp->cp_id = cmd->device->id;
+ cp->cp_lun = cmd->device->lun;
cp->cp_dispri = FALSE;
cp->cp_identify = TRUE;
memcpy(cp->cp_cdb, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd));
@@ -353,7 +353,7 @@ static int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
if (eata_pio_send_command(base, EATA_CMD_PIO_SEND_CP)) {
cmd->result = DID_BUS_BUSY << 16;
- printk(KERN_NOTICE "eata_pio_queue target %d, pid %ld, HBA busy, " "returning DID_BUS_BUSY, done.\n", cmd->target, cmd->pid);
+ printk(KERN_NOTICE "eata_pio_queue target %d, pid %ld, HBA busy, " "returning DID_BUS_BUSY, done.\n", cmd->device->id, cmd->pid);
done(cmd);
cp->status = FREE;
return (0);
@@ -366,7 +366,7 @@ static int eata_pio_queue(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
for (x = 0; x < hd->cppadlen; x++)
outw(0, base + HA_RDATA);
- DBG(DBG_QUEUE, printk(KERN_DEBUG "Queued base %#.4lx pid: %ld target: %x " "lun: %x slot %d irq %d\n", (long) sh->base, cmd->pid, cmd->target, cmd->lun, y, sh->irq));
+ DBG(DBG_QUEUE, printk(KERN_DEBUG "Queued base %#.4lx pid: %ld target: %x " "lun: %x slot %d irq %d\n", (long) sh->base, cmd->pid, cmd->device->id, cmd->device->lun, y, sh->irq));
return (0);
}
@@ -375,10 +375,10 @@ static int eata_pio_abort(Scsi_Cmnd * cmd)
{
uint loop = HZ;
- DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_abort called pid: %ld " "target: %x lun: %x reason %x\n", cmd->pid, cmd->target, cmd->lun, cmd->abort_reason));
+ DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_abort called pid: %ld " "target: %x lun: %x reason %x\n", cmd->pid, cmd->device->id, cmd->device->lun, cmd->abort_reason));
- while (inb(cmd->host->base + HA_RAUXSTAT) & HA_ABUSY)
+ while (inb(cmd->device->host->base + HA_RAUXSTAT) & HA_ABUSY)
if (--loop == 0) {
printk(KERN_WARNING "eata_pio: abort, timeout error.\n");
return FAILED;
@@ -408,9 +408,9 @@ static int eata_pio_host_reset(Scsi_Cmnd * cmd)
uint x, limit = 0;
unsigned char success = FALSE;
Scsi_Cmnd *sp;
- struct Scsi_Host *host = cmd->host;
+ struct Scsi_Host *host = cmd->device->host;
- DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset called pid:%ld target:" " %x lun: %x reason %x\n", cmd->pid, cmd->target, cmd->lun, cmd->abort_reason));
+ DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset called pid:%ld target:" " %x lun: %x reason %x\n", cmd->pid, cmd->device->id, cmd->device->lun, cmd->abort_reason));
if (HD(cmd)->state == RESET) {
printk(KERN_WARNING "eata_pio_reset: exit, already in reset.\n");
@@ -419,7 +419,7 @@ static int eata_pio_host_reset(Scsi_Cmnd * cmd)
/* force all slots to be free */
- for (x = 0; x < cmd->host->can_queue; x++) {
+ for (x = 0; x < cmd->device->host->can_queue; x++) {
if (HD(cmd)->ccb[x].status == FREE)
continue;
@@ -433,7 +433,7 @@ static int eata_pio_host_reset(Scsi_Cmnd * cmd)
}
/* hard reset the HBA */
- outb(EATA_CMD_RESET, (uint) cmd->host->base + HA_WCOMMAND);
+ outb(EATA_CMD_RESET, (uint) cmd->device->host->base + HA_WCOMMAND);
DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: board reset done.\n"));
HD(cmd)->state = RESET;
@@ -445,7 +445,7 @@ static int eata_pio_host_reset(Scsi_Cmnd * cmd)
DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset: interrupts disabled, " "loops %d.\n", limit));
- for (x = 0; x < cmd->host->can_queue; x++) {
+ for (x = 0; x < cmd->device->host->can_queue; x++) {
/* Skip slots already set free by interrupt */
if (HD(cmd)->ccb[x].status != RESET)
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index 8d821deac8c0..162bd05f59dd 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -1252,9 +1252,9 @@ static void do_fdomain_16x0_intr( int irq, void *dev_id, struct pt_regs * regs )
#if EVERY_ACCESS
printk( " AFAIL " );
#endif
- spin_lock_irqsave(current_SC->host->host_lock, flags);
+ spin_lock_irqsave(current_SC->device->host->host_lock, flags);
my_done( DID_BUS_BUSY << 16 );
- spin_unlock_irqrestore(current_SC->host->host_lock, flags);
+ spin_unlock_irqrestore(current_SC->device->host->host_lock, flags);
return;
}
current_SC->SCp.phase = in_selection;
@@ -1262,7 +1262,7 @@ static void do_fdomain_16x0_intr( int irq, void *dev_id, struct pt_regs * regs )
outb( 0x40 | FIFO_COUNT, Interrupt_Cntl_port );
outb( 0x82, SCSI_Cntl_port ); /* Bus Enable + Select */
- outb( adapter_mask | (1 << current_SC->target), SCSI_Data_NoACK_port );
+ outb( adapter_mask | (1 << current_SC->device->id), SCSI_Data_NoACK_port );
/* Stop arbitration and enable parity */
outb( 0x10 | PARITY_MASK, TMC_Cntl_port );
@@ -1274,13 +1274,13 @@ static void do_fdomain_16x0_intr( int irq, void *dev_id, struct pt_regs * regs )
status = inb( SCSI_Status_port );
if (!(status & 0x01)) {
/* Try again, for slow devices */
- if (fdomain_select( current_SC->target )) {
+ if (fdomain_select( current_SC->device->id )) {
#if EVERY_ACCESS
printk( " SFAIL " );
#endif
- spin_lock_irqsave(current_SC->host->host_lock, flags);
+ spin_lock_irqsave(current_SC->device->host->host_lock, flags);
my_done( DID_NO_CONNECT << 16 );
- spin_unlock_irqrestore(current_SC->host->host_lock, flags);
+ spin_unlock_irqrestore(current_SC->device->host->host_lock, flags);
return;
} else {
#if EVERY_ACCESS
@@ -1337,7 +1337,7 @@ static void do_fdomain_16x0_intr( int irq, void *dev_id, struct pt_regs * regs )
&& current_SC->SCp.Status != 2
&& current_SC->SCp.Status != 8) {
printk( "scsi: <fdomain> target = %d, command = %x, status = %x\n",
- current_SC->target,
+ current_SC->device->id,
current_SC->cmnd[0],
current_SC->SCp.Status );
}
@@ -1476,10 +1476,10 @@ static void do_fdomain_16x0_intr( int irq, void *dev_id, struct pt_regs * regs )
#if EVERY_ACCESS
printk( "BEFORE MY_DONE. . ." );
#endif
- spin_lock_irqsave(current_SC->host->host_lock, flags);
+ spin_lock_irqsave(current_SC->device->host->host_lock, flags);
my_done( (current_SC->SCp.Status & 0xff)
| ((current_SC->SCp.Message & 0xff) << 8) | (DID_OK << 16) );
- spin_unlock_irqrestore(current_SC->host->host_lock, flags);
+ spin_unlock_irqrestore(current_SC->device->host->host_lock, flags);
#if EVERY_ACCESS
printk( "RETURNING.\n" );
#endif
@@ -1580,13 +1580,13 @@ static void print_info(Scsi_Cmnd *SCpnt)
unsigned int irr;
unsigned int isr;
- if (!SCpnt || !SCpnt->host) {
+ if (!SCpnt || !SCpnt->device || !SCpnt->device->host) {
printk(KERN_WARNING "scsi: <fdomain> Cannot provide detailed information\n");
return;
}
- printk(KERN_INFO "%s\n", fdomain_16x0_info( SCpnt->host ) );
- print_banner(SCpnt->host);
+ printk(KERN_INFO "%s\n", fdomain_16x0_info( SCpnt->device->host ) );
+ print_banner(SCpnt->device->host);
switch (SCpnt->SCp.phase) {
case in_arbitration: printk("arbitration"); break;
case in_selection: printk("selection"); break;
@@ -1596,7 +1596,7 @@ static void print_info(Scsi_Cmnd *SCpnt)
printk( " (%d), target = %d cmnd = 0x%02x pieces = %d size = %u\n",
SCpnt->SCp.phase,
- SCpnt->target,
+ SCpnt->device->id,
*(unsigned char *)SCpnt->cmnd,
SCpnt->use_sg,
SCpnt->request_bufflen );
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index a5e2d27310c0..1b279782d0c9 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -746,7 +746,7 @@ static int sprint_command(char *buffer, int len, unsigned char *command)
static int sprint_Scsi_Cmnd(char *buffer, int len, Scsi_Cmnd * cmd)
{
int start = len;
- PRINTP("host number %d destination target %d, lun %d\n" ANDP cmd->host->host_no ANDP cmd->target ANDP cmd->lun);
+ PRINTP("host number %d destination target %d, lun %d\n" ANDP cmd->device->host->host_no ANDP cmd->device->id ANDP cmd->device->lun);
PRINTP(" command = ");
len += sprint_command(buffer, len, cmd->cmnd);
return len - start;
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 096204b5496a..3c3135c3bcdf 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -2313,8 +2313,8 @@ static void gdth_putq(int hanum,Scsi_Cmnd *scp,unchar priority)
GDTH_LOCK_HA(ha, flags);
scp->SCp.this_residual = (int)priority;
- b = virt_ctr ? NUMDATA(scp->host)->busnum : scp->channel;
- t = scp->target;
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
+ t = scp->device->id;
#if LINUX_VERSION_CODE >= 0x010300
if (priority >= DEFAULT_PRI) {
if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) ||
@@ -2375,8 +2375,8 @@ static void gdth_next(int hanum)
for (nscp = pscp = ha->req_first; nscp; nscp = (Scsi_Cmnd *)nscp->SCp.ptr) {
if (nscp != pscp && nscp != (Scsi_Cmnd *)pscp->SCp.ptr)
pscp = (Scsi_Cmnd *)pscp->SCp.ptr;
- b = virt_ctr ? NUMDATA(nscp->host)->busnum : nscp->channel;
- t = nscp->target;
+ b = virt_ctr ? NUMDATA(nscp->device->host)->busnum : nscp->device->channel;
+ t = nscp->device->id;
if (nscp->SCp.this_residual >= DEFAULT_PRI) {
if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) ||
(b == ha->virt_bus && t < MAX_HDRIVES && ha->hdr[t].lock))
@@ -2407,13 +2407,13 @@ static void gdth_next(int hanum)
b, t, nscp->lun));
/* TEST_UNIT_READY -> set scan mode */
if ((ha->scan_mode & 0x0f) == 0) {
- if (b == 0 && t == 0 && nscp->lun == 0) {
+ if (b == 0 && t == 0 && nscp->device->lun == 0) {
ha->scan_mode |= 1;
TRACE2(("Scan mode: 0x%x\n", ha->scan_mode));
}
} else if ((ha->scan_mode & 0x0f) == 1) {
- if (b == 0 && ((t == 0 && nscp->lun == 1) ||
- (t == 1 && nscp->lun == 0))) {
+ if (b == 0 && ((t == 0 && nscp->device->lun == 1) ||
+ (t == 1 && nscp->device->lun == 0))) {
nscp->SCp.sent_command = GDT_SCAN_START;
nscp->SCp.phase = ((ha->scan_mode & 0x10 ? 1:0) << 8)
| SCSIRAWSERVICE;
@@ -2483,7 +2483,7 @@ static void gdth_next(int hanum)
this_cmd = FALSE;
else
ha->raw[BUS_L2P(ha,b)].io_cnt[t]++;
- } else if (t >= MAX_HDRIVES || !ha->hdr[t].present || nscp->lun != 0) {
+ } else if (t >= MAX_HDRIVES || !ha->hdr[t].present || nscp->device->lun != 0) {
TRACE2(("Command 0x%x to bus %d id %d lun %d -> IGNORE\n",
nscp->cmnd[0], b, t, nscp->lun));
nscp->result = DID_BAD_TARGET << 16;
@@ -2682,7 +2682,7 @@ static int gdth_internal_cache_cmd(int hanum,Scsi_Cmnd *scp)
gdth_modep_data mpd;
ha = HADATA(gdth_ctr_tab[hanum]);
- t = scp->target;
+ t = scp->device->id;
TRACE(("gdth_internal_cache_cmd() cmd 0x%x hdrive %d\n",
scp->cmnd[0],t));
@@ -2900,8 +2900,8 @@ static int gdth_fill_raw_cmd(int hanum,Scsi_Cmnd *scp,unchar b)
unchar t,l;
ha = HADATA(gdth_ctr_tab[hanum]);
- t = scp->target;
- l = scp->lun;
+ t = scp->device->id;
+ l = scp->device->lun;
cmdp = ha->pccb;
TRACE(("gdth_fill_raw_cmd() cmd 0x%x bus %d ID %d LUN %d\n",
scp->cmnd[0],b,t,l));
@@ -3372,7 +3372,7 @@ static void gdth_interrupt(int irq,struct pt_regs *regs)
if (rval == 2) {
gdth_putq(hanum,scp,scp->SCp.this_residual);
} else if (rval == 1) {
- GDTH_LOCK_SCSI_DONE(scp->host, flags);
+ GDTH_LOCK_SCSI_DONE(scp->device->host, flags);
scp->scsi_done(scp);
GDTH_UNLOCK_SCSI_DONE(scp->host,flags);
}
@@ -3461,9 +3461,9 @@ static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp)
printk("\n");
} else {
- b = virt_ctr ? NUMDATA(scp->host)->busnum : scp->channel;
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
if (scp->SCp.sent_command == -1 && b != ha->virt_bus) {
- ha->raw[BUS_L2P(ha,b)].io_cnt[scp->target]--;
+ ha->raw[BUS_L2P(ha,b)].io_cnt[scp->device->id]--;
}
/* cache or raw service */
if (ha->status == S_OK) {
@@ -3474,12 +3474,12 @@ static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp)
scp->SCp.sent_command));
/* special commands GDT_CLUST_INFO/GDT_MOUNT ? */
if (scp->SCp.sent_command == GDT_CLUST_INFO) {
- ha->hdr[scp->target].cluster_type = (unchar)ha->info;
- if (!(ha->hdr[scp->target].cluster_type &
+ ha->hdr[scp->device->id].cluster_type = (unchar)ha->info;
+ if (!(ha->hdr[scp->device->id].cluster_type &
CLUSTER_MOUNTED)) {
/* NOT MOUNTED -> MOUNT */
scp->SCp.sent_command = GDT_MOUNT;
- if (ha->hdr[scp->target].cluster_type &
+ if (ha->hdr[scp->device->id].cluster_type &
CLUSTER_RESERVED) {
/* cluster drive RESERVED (on the other node) */
scp->SCp.phase = -2; /* reservation conflict */
@@ -3489,11 +3489,11 @@ static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp)
}
} else {
if (scp->SCp.sent_command == GDT_MOUNT) {
- ha->hdr[scp->target].cluster_type |= CLUSTER_MOUNTED;
- ha->hdr[scp->target].media_changed = TRUE;
+ ha->hdr[scp->device->id].cluster_type |= CLUSTER_MOUNTED;
+ ha->hdr[scp->device->id].media_changed = TRUE;
} else if (scp->SCp.sent_command == GDT_UNMOUNT) {
- ha->hdr[scp->target].cluster_type &= ~CLUSTER_MOUNTED;
- ha->hdr[scp->target].media_changed = TRUE;
+ ha->hdr[scp->device->id].cluster_type &= ~CLUSTER_MOUNTED;
+ ha->hdr[scp->device->id].media_changed = TRUE;
}
scp->SCp.sent_command = -1;
}
@@ -3503,9 +3503,9 @@ static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp)
} else {
/* RESERVE/RELEASE ? */
if (scp->cmnd[0] == RESERVE) {
- ha->hdr[scp->target].cluster_type |= CLUSTER_RESERVED;
+ ha->hdr[scp->device->id].cluster_type |= CLUSTER_RESERVED;
} else if (scp->cmnd[0] == RELEASE) {
- ha->hdr[scp->target].cluster_type &= ~CLUSTER_RESERVED;
+ ha->hdr[scp->device->id].cluster_type &= ~CLUSTER_RESERVED;
}
scp->result = DID_OK << 16;
scp->sense_buffer[0] = 0;
@@ -3538,10 +3538,10 @@ static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp)
scp->result = (DID_OK << 16) | (CHECK_CONDITION << 1);
} else if (service == CACHESERVICE) {
if (ha->status == S_CACHE_UNKNOWN &&
- (ha->hdr[scp->target].cluster_type &
+ (ha->hdr[scp->device->id].cluster_type &
CLUSTER_RESERVE_STATE) == CLUSTER_RESERVE_STATE) {
/* bus reset -> force GDT_CLUST_INFO */
- ha->hdr[scp->target].cluster_type &= ~CLUSTER_RESERVED;
+ ha->hdr[scp->device->id].cluster_type &= ~CLUSTER_RESERVED;
}
memset((char*)scp->sense_buffer,0,16);
if (ha->status == (ushort)S_CACHE_RESERV) {
@@ -3560,7 +3560,7 @@ static int gdth_sync_event(int hanum,int service,unchar index,Scsi_Cmnd *scp)
ha->dvr.eu.sync.service = service;
ha->dvr.eu.sync.status = ha->status;
ha->dvr.eu.sync.info = ha->info;
- ha->dvr.eu.sync.hostdrive = scp->target;
+ ha->dvr.eu.sync.hostdrive = scp->device->id;
if (ha->status >= 0x8000)
gdth_store_event(ha, ES_SYNC, 0, &ha->dvr);
else
@@ -4507,15 +4507,15 @@ int gdth_eh_bus_reset(Scsi_Cmnd *scp)
unchar b;
TRACE2(("gdth_eh_bus_reset()\n"));
- hanum = NUMDATA(scp->host)->hanum;
- b = virt_ctr ? NUMDATA(scp->host)->busnum : scp->channel;
+ hanum = NUMDATA(scp->device->host)->hanum;
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
ha = HADATA(gdth_ctr_tab[hanum]);
/* clear command tab */
GDTH_LOCK_HA(ha, flags);
for (i = 0; i < GDTH_MAXCMDS; ++i) {
cmnd = ha->cmd_tab[i].cmnd;
- if (!SPECIAL_SCP(cmnd) && cmnd->channel == b)
+ if (!SPECIAL_SCP(cmnd) && cmnd->device->channel == b)
ha->cmd_tab[i].cmnd = UNUSED_CMND;
}
GDTH_UNLOCK_HA(ha, flags);
@@ -4593,13 +4593,13 @@ int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *))
int priority;
TRACE(("gdth_queuecommand() cmd 0x%x id %d lun %d\n",
- scp->cmnd[0],scp->target,scp->lun));
+ scp->cmnd[0],scp->device->id,scp->lun));
scp->scsi_done = (void *)done;
scp->SCp.have_data_in = 1;
scp->SCp.phase = -1;
scp->SCp.sent_command = -1;
- hanum = NUMDATA(scp->host)->hanum;
+ hanum = NUMDATA(scp->device->host)->hanum;
#ifdef GDTH_STATISTICS
++act_ios;
#endif
@@ -4637,7 +4637,7 @@ static void gdth_flush(int hanum)
#if LINUX_VERSION_CODE >= 0x020322
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
- scp = scsi_allocate_device(sdev, 1);
+ scp = scsi_getset_command(sdev, GFP_KERNEL);
scp->cmd_len = 12;
scp->use_sg = 0;
#else
@@ -4665,7 +4665,7 @@ static void gdth_flush(int hanum)
}
}
#if LINUX_VERSION_CODE >= 0x020322
- scsi_release_command(scp);
+ scsi_put_command(scp);
scsi_free_host_dev(sdev);
#endif
}
@@ -4711,7 +4711,7 @@ void gdth_halt(void)
memset(cmnd, 0xff, MAX_COMMAND_SIZE);
#if LINUX_VERSION_CODE >= 0x020322
sdev = scsi_get_host_dev(gdth_ctr_tab[hanum]);
- scp = scsi_allocate_device(sdev, 1);
+ scp = scsi_getset_command(sdev, GFP_KERNEL);
scp->cmd_len = 12;
scp->use_sg = 0;
#else
@@ -4728,7 +4728,7 @@ void gdth_halt(void)
TRACE2(("gdth_halt(): reset controller %d\n", hanum));
#if LINUX_VERSION_CODE >= 0x020322
gdth_do_cmd(scp, &gdtcmd, cmnd, 10);
- scsi_release_command(scp);
+ scsi_put_command(scp);
scsi_free_host_dev(sdev);
#else
gdth_do_cmd(&scp, &gdtcmd, cmnd, 10);
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c
index a384e80f8e8b..9b943a37ce0e 100644
--- a/drivers/scsi/gdth_proc.c
+++ b/drivers/scsi/gdth_proc.c
@@ -48,7 +48,7 @@ static int gdth_set_info(char *buffer,int length,int vh,int hanum,int busnum)
#if LINUX_VERSION_CODE >= 0x020322
sdev = scsi_get_host_dev(gdth_ctr_vtab[vh]);
- scp = scsi_allocate_device(sdev, 1);
+ scp = scsi_getset_command(sdev, GFP_KERNEL);
if (!scp)
return -ENOMEM;
scp->cmd_len = 12;
@@ -81,7 +81,7 @@ static int gdth_set_info(char *buffer,int length,int vh,int hanum,int busnum)
ret_val = -EINVAL;
}
#if LINUX_VERSION_CODE >= 0x020322
- scsi_release_command(scp);
+ scsi_put_command(scp);
scsi_free_host_dev(sdev);
#endif
return ret_val;
@@ -447,8 +447,8 @@ static int gdth_set_bin_info(char *buffer,int length,int hanum,Scsi_Cmnd scp)
piord->size = sizeof(gdth_iord_str);
memcpy(cmnd, piowr->iu.scsi.cmd, 12);
#if LINUX_VERSION_CODE >= 0x020322
- scp->target = piowr->iu.scsi.target;
- scp->channel = virt_ctr ? 0 : piowr->iu.scsi.bus;
+ scp->device->id = piowr->iu.scsi.target;
+ scp->device->channel = virt_ctr ? 0 : piowr->iu.scsi.bus;
scp->cmd_len = piowr->iu.scsi.cmd_len;
gdth_do_cmd(scp, pcmd, cmnd, piowr->timeout);
piord->status = (scp->SCp.Message<<16)|scp->SCp.Status;
@@ -467,7 +467,7 @@ static int gdth_set_bin_info(char *buffer,int length,int hanum,Scsi_Cmnd scp)
piord = (gdth_iord_str *)ha->pscratch;
piord->size = sizeof(gdth_iord_str);
#if LINUX_VERSION_CODE >= 0x020322
- scp->channel = virt_ctr ? 0 : piowr->iu.scsi.bus;
+ scp->device->channel = virt_ctr ? 0 : piowr->iu.scsi.bus;
piord->status = (ulong32)gdth_eh_bus_reset( scp );
if (piord->status == SUCCESS)
piord->status = S_OK;
@@ -712,7 +712,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,
#if LINUX_VERSION_CODE >= 0x020322
sdev = scsi_get_host_dev(gdth_ctr_vtab[vh]);
- scp = scsi_allocate_device(sdev, 1);
+ scp = scsi_getset_command(sdev, GFP_KERNEL);
if (!scp)
return -ENOMEM;
scp->cmd_len = 12;
@@ -1234,7 +1234,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,
stop_output:
#if LINUX_VERSION_CODE >= 0x020322
- scsi_release_command(scp);
+ scsi_put_command(scp);
scsi_free_host_dev(sdev);
#endif
*start = buffer +(offset-begin);
@@ -1383,8 +1383,8 @@ static void gdth_wait_completion(int hanum, int busnum, int id)
for (i = 0; i < GDTH_MAXCMDS; ++i) {
scp = ha->cmd_tab[i].cmnd;
- b = virt_ctr ? NUMDATA(scp->host)->busnum : scp->channel;
- if (!SPECIAL_SCP(scp) && scp->target == (unchar)id &&
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
+ if (!SPECIAL_SCP(scp) && scp->device->id == (unchar)id &&
b == (unchar)busnum) {
scp->SCp.have_data_in = 0;
GDTH_UNLOCK_HA(ha, flags);
@@ -1410,8 +1410,8 @@ static void gdth_stop_timeout(int hanum, int busnum, int id)
GDTH_LOCK_HA(ha, flags);
for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) {
- b = virt_ctr ? NUMDATA(scp->host)->busnum : scp->channel;
- if (scp->target == (unchar)id && b == (unchar)busnum) {
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
+ if (scp->device->id == (unchar)id && b == (unchar)busnum) {
TRACE2(("gdth_stop_timeout(): update_timeout()\n"));
scp->SCp.buffers_residual = gdth_update_timeout(hanum, scp, 0);
}
@@ -1430,8 +1430,8 @@ static void gdth_start_timeout(int hanum, int busnum, int id)
GDTH_LOCK_HA(ha, flags);
for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) {
- b = virt_ctr ? NUMDATA(scp->host)->busnum : scp->channel;
- if (scp->target == (unchar)id && b == (unchar)busnum) {
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
+ if (scp->device->id == (unchar)id && b == (unchar)busnum) {
TRACE2(("gdth_start_timeout(): update_timeout()\n"));
gdth_update_timeout(hanum, scp, scp->SCp.buffers_residual);
}
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index faf1c6f4000b..6ca0adf6706d 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -229,7 +229,7 @@ static int scsi_check_device_busy(struct scsi_device *sdev)
active:
printk(KERN_ERR "SCSI device not inactive - rq_status=%d, target=%d, "
"pid=%ld, state=%d, owner=%d.\n",
- scmd->request->rq_status, scmd->target,
+ scmd->request->rq_status, scmd->device->id,
scmd->pid, scmd->state, scmd->owner);
list_for_each_entry(sdev, &shost->my_devices, siblings) {
@@ -350,6 +350,13 @@ void scsi_unregister(struct Scsi_Host *shost)
/* Cleanup proc */
scsi_proc_host_rm(shost);
+ while (!list_empty(&shost->free_list)) {
+ struct scsi_cmnd *cmd;
+ cmd = list_entry(shost->free_list.next,struct scsi_cmnd,list);
+ list_del_init(&cmd->list);
+ kmem_cache_free(scsi_core->scsi_cmd_cache, cmd);
+ }
+
kfree(shost);
}
@@ -370,6 +377,7 @@ extern int blk_nohighio;
struct Scsi_Host * scsi_register(Scsi_Host_Template *shost_tp, int xtr_bytes)
{
struct Scsi_Host *shost, *shost_scr;
+ struct scsi_cmnd *cmd = NULL;
int gfp_mask;
DECLARE_COMPLETION(sem);
@@ -459,6 +467,16 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template *shost_tp, int xtr_bytes)
found:
spin_unlock(&scsi_host_list_lock);
+ spin_lock_init(&shost->free_list_lock);
+ INIT_LIST_HEAD(&shost->free_list);
+
+ /* Get one backup command for this host. */
+ cmd = scsi_get_command(shost, GFP_KERNEL);
+ if (cmd)
+ list_add(&cmd->list, &shost->free_list);
+ else
+ printk(KERN_NOTICE "The system is running low in memory.\n");
+
scsi_proc_host_add(shost);
shost->eh_notify = &sem;
diff --git a/drivers/scsi/hosts.h b/drivers/scsi/hosts.h
index 9a57020256c7..d276316390ca 100644
--- a/drivers/scsi/hosts.h
+++ b/drivers/scsi/hosts.h
@@ -375,6 +375,9 @@ struct Scsi_Host
struct list_head sh_list;
struct list_head my_devices;
+ spinlock_t free_list_lock;
+ struct list_head free_list; /* backup store of cmd structs */
+
spinlock_t default_lock;
spinlock_t *host_lock;
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 5491d54685d2..515c5525af25 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -357,7 +357,7 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs)
} else printk("\n");
}
}
- host = pc->scsi_cmd->host;
+ host = pc->scsi_cmd->device->host;
spin_lock_irqsave(host->host_lock, flags);
pc->done(pc->scsi_cmd);
spin_unlock_irqrestore(host->host_lock, flags);
@@ -779,13 +779,13 @@ static inline int should_transform(ide_drive_t *drive, Scsi_Cmnd *cmd)
static int idescsi_queue (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
{
- idescsi_scsi_t *scsi = scsihost_to_idescsi(cmd->host);
+ idescsi_scsi_t *scsi = scsihost_to_idescsi(cmd->device->host);
ide_drive_t *drive = scsi->drive;
struct request *rq = NULL;
idescsi_pc_t *pc = NULL;
if (!drive) {
- printk (KERN_ERR "ide-scsi: drive id %d not present\n", cmd->target);
+ printk (KERN_ERR "ide-scsi: drive id %d not present\n", cmd->device->id);
goto abort;
}
scsi = drive_to_idescsi(drive);
@@ -830,9 +830,9 @@ static int idescsi_queue (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
rq->special = (char *) pc;
rq->bio = idescsi_dma_bio (drive, pc);
rq->flags = REQ_SPECIAL;
- spin_unlock_irq(cmd->host->host_lock);
+ spin_unlock_irq(cmd->device->host->host_lock);
(void) ide_do_drive_cmd (drive, rq, ide_end);
- spin_lock_irq(cmd->host->host_lock);
+ spin_lock_irq(cmd->device->host->host_lock);
return 0;
abort:
if (pc) kfree (pc);
@@ -846,7 +846,7 @@ static int idescsi_abort (Scsi_Cmnd *cmd)
{
int countdown = 8;
unsigned long flags;
- idescsi_scsi_t *scsi = scsihost_to_idescsi(cmd->host);
+ idescsi_scsi_t *scsi = scsihost_to_idescsi(cmd->device->host);
ide_drive_t *drive = scsi->drive;
printk (KERN_ERR "ide-scsi: abort called for %lu\n", cmd->serial_number);
@@ -877,7 +877,7 @@ static int idescsi_reset (Scsi_Cmnd *cmd)
{
unsigned long flags;
struct request *req;
- idescsi_scsi_t *idescsi = scsihost_to_idescsi(cmd->host);
+ idescsi_scsi_t *idescsi = scsihost_to_idescsi(cmd->device->host);
ide_drive_t *drive = idescsi->drive;
printk (KERN_ERR "ide-scsi: reset called for %lu\n", cmd->serial_number);
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
index c0f1d5675592..5649cdc113b9 100644
--- a/drivers/scsi/in2000.c
+++ b/drivers/scsi/in2000.c
@@ -343,10 +343,10 @@ static int in2000_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
struct IN2000_hostdata *hostdata;
Scsi_Cmnd *tmp;
- instance = cmd->host;
+ instance = cmd->device->host;
hostdata = (struct IN2000_hostdata *) instance->hostdata;
- DB(DB_QUEUE_COMMAND, printk("Q-%d-%02x-%ld(", cmd->target, cmd->cmnd[0], cmd->pid))
+ DB(DB_QUEUE_COMMAND, printk("Q-%d-%02x-%ld(", cmd->device->id, cmd->cmnd[0], cmd->pid))
/* Set up a few fields in the Scsi_Cmnd structure for our own use:
* - host_scribble is the pointer to the next cmd in the input queue
@@ -428,7 +428,7 @@ static int in2000_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
* Go see if any of them are runnable!
*/
- in2000_execute(cmd->host);
+ in2000_execute(cmd->device->host);
DB(DB_QUEUE_COMMAND, printk(")Q-%ld ", cmd->pid))
return 0;
@@ -473,7 +473,7 @@ static void in2000_execute(struct Scsi_Host *instance)
cmd = (Scsi_Cmnd *) hostdata->input_Q;
prev = 0;
while (cmd) {
- if (!(hostdata->busy[cmd->target] & (1 << cmd->lun)))
+ if (!(hostdata->busy[cmd->device->id] & (1 << cmd->device->lun)))
break;
prev = cmd;
cmd = (Scsi_Cmnd *) cmd->host_scribble;
@@ -496,7 +496,7 @@ static void in2000_execute(struct Scsi_Host *instance)
hostdata->input_Q = (Scsi_Cmnd *) cmd->host_scribble;
#ifdef PROC_STATISTICS
- hostdata->cmd_cnt[cmd->target]++;
+ hostdata->cmd_cnt[cmd->device->id]++;
#endif
/*
@@ -504,9 +504,9 @@ static void in2000_execute(struct Scsi_Host *instance)
*/
if (is_dir_out(cmd))
- write_3393(hostdata, WD_DESTINATION_ID, cmd->target);
+ write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id);
else
- write_3393(hostdata, WD_DESTINATION_ID, cmd->target | DSTID_DPD);
+ write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id | DSTID_DPD);
/* Now we need to figure out whether or not this command is a good
* candidate for disconnect/reselect. We guess to the best of our
@@ -543,7 +543,7 @@ static void in2000_execute(struct Scsi_Host *instance)
if (!(hostdata->input_Q)) /* input_Q empty? */
goto no;
for (prev = (Scsi_Cmnd *) hostdata->input_Q; prev; prev = (Scsi_Cmnd *) prev->host_scribble) {
- if ((prev->target != cmd->target) || (prev->lun != cmd->lun)) {
+ if ((prev->device->id != cmd->device->id) || (prev->device->lun != cmd->device->lun)) {
for (prev = (Scsi_Cmnd *) hostdata->input_Q; prev; prev = (Scsi_Cmnd *) prev->host_scribble)
prev->SCp.phase = 1;
goto yes;
@@ -555,17 +555,17 @@ static void in2000_execute(struct Scsi_Host *instance)
cmd->SCp.phase = 1;
#ifdef PROC_STATISTICS
- hostdata->disc_allowed_cnt[cmd->target]++;
+ hostdata->disc_allowed_cnt[cmd->device->id]++;
#endif
no:
write_3393(hostdata, WD_SOURCE_ID, ((cmd->SCp.phase) ? SRCID_ER : 0));
- write_3393(hostdata, WD_TARGET_LUN, cmd->lun);
- write_3393(hostdata, WD_SYNCHRONOUS_TRANSFER, hostdata->sync_xfer[cmd->target]);
- hostdata->busy[cmd->target] |= (1 << cmd->lun);
+ write_3393(hostdata, WD_TARGET_LUN, cmd->device->lun);
+ write_3393(hostdata, WD_SYNCHRONOUS_TRANSFER, hostdata->sync_xfer[cmd->device->id]);
+ hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
- if ((hostdata->level2 <= L2_NONE) || (hostdata->sync_stat[cmd->target] == SS_UNSET)) {
+ if ((hostdata->level2 <= L2_NONE) || (hostdata->sync_stat[cmd->device->id] == SS_UNSET)) {
/*
* Do a 'Select-With-ATN' command. This will end with
@@ -587,11 +587,11 @@ static void in2000_execute(struct Scsi_Host *instance)
* unless we don't want to even _try_ synchronous transfers: In this
* case we set SS_SET to make the defaults final.
*/
- if (hostdata->sync_stat[cmd->target] == SS_UNSET) {
- if (hostdata->sync_off & (1 << cmd->target))
- hostdata->sync_stat[cmd->target] = SS_SET;
+ if (hostdata->sync_stat[cmd->device->id] == SS_UNSET) {
+ if (hostdata->sync_off & (1 << cmd->device->id))
+ hostdata->sync_stat[cmd->device->id] = SS_SET;
else
- hostdata->sync_stat[cmd->target] = SS_FIRST;
+ hostdata->sync_stat[cmd->device->id] = SS_FIRST;
}
hostdata->state = S_SELECTING;
write_3393_count(hostdata, 0); /* this guarantees a DATA_PHASE interrupt */
@@ -753,7 +753,7 @@ static void transfer_bytes(Scsi_Cmnd * cmd, int data_in_dir)
unsigned short f;
int i;
- hostdata = (struct IN2000_hostdata *) cmd->host->hostdata;
+ hostdata = (struct IN2000_hostdata *) cmd->device->host->hostdata;
/* Normally, you'd expect 'this_residual' to be non-zero here.
* In a series of scatter-gather transfers, however, this
@@ -772,7 +772,7 @@ static void transfer_bytes(Scsi_Cmnd * cmd, int data_in_dir)
/* Set up hardware registers */
- write_3393(hostdata, WD_SYNCHRONOUS_TRANSFER, hostdata->sync_xfer[cmd->target]);
+ write_3393(hostdata, WD_SYNCHRONOUS_TRANSFER, hostdata->sync_xfer[cmd->device->id]);
write_3393_count(hostdata, cmd->SCp.this_residual);
write_3393(hostdata, WD_CONTROL, CTRL_IDI | CTRL_EDI | CTRL_BUS);
write1_io(0, IO_FIFO_WRITE); /* zero counter, assume write */
@@ -1077,7 +1077,7 @@ static void in2000_intr(int irqnum, void *dev_id, struct pt_regs *ptregs)
}
cmd->result = DID_NO_CONNECT << 16;
- hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
+ hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
hostdata->state = S_UNCONNECTED;
cmd->scsi_done(cmd);
@@ -1099,16 +1099,16 @@ static void in2000_intr(int irqnum, void *dev_id, struct pt_regs *ptregs)
/* construct an IDENTIFY message with correct disconnect bit */
- hostdata->outgoing_msg[0] = (0x80 | 0x00 | cmd->lun);
+ hostdata->outgoing_msg[0] = (0x80 | 0x00 | cmd->device->lun);
if (cmd->SCp.phase)
hostdata->outgoing_msg[0] |= 0x40;
- if (hostdata->sync_stat[cmd->target] == SS_FIRST) {
+ if (hostdata->sync_stat[cmd->device->id] == SS_FIRST) {
#ifdef SYNC_DEBUG
printk(" sending SDTR ");
#endif
- hostdata->sync_stat[cmd->target] = SS_WAITING;
+ hostdata->sync_stat[cmd->device->id] = SS_WAITING;
/* tack on a 2nd message to ask about synchronous transfers */
@@ -1227,8 +1227,8 @@ static void in2000_intr(int irqnum, void *dev_id, struct pt_regs *ptregs)
#ifdef SYNC_DEBUG
printk("-REJ-");
#endif
- if (hostdata->sync_stat[cmd->target] == SS_WAITING)
- hostdata->sync_stat[cmd->target] = SS_SET;
+ if (hostdata->sync_stat[cmd->device->id] == SS_WAITING)
+ hostdata->sync_stat[cmd->device->id] = SS_SET;
write_3393_cmd(hostdata, WD_CMD_NEGATE_ACK);
hostdata->state = S_CONNECTED;
break;
@@ -1248,7 +1248,7 @@ static void in2000_intr(int irqnum, void *dev_id, struct pt_regs *ptregs)
switch (ucp[2]) { /* what's the EXTENDED code? */
case EXTENDED_SDTR:
id = calc_sync_xfer(ucp[3], ucp[4]);
- if (hostdata->sync_stat[cmd->target] != SS_WAITING) {
+ if (hostdata->sync_stat[cmd->device->id] != SS_WAITING) {
/* A device has sent an unsolicited SDTR message; rather than go
* through the effort of decoding it and then figuring out what
@@ -1266,14 +1266,14 @@ static void in2000_intr(int irqnum, void *dev_id, struct pt_regs *ptregs)
hostdata->outgoing_msg[3] = hostdata->default_sx_per / 4;
hostdata->outgoing_msg[4] = 0;
hostdata->outgoing_len = 5;
- hostdata->sync_xfer[cmd->target] = calc_sync_xfer(hostdata->default_sx_per / 4, 0);
+ hostdata->sync_xfer[cmd->device->id] = calc_sync_xfer(hostdata->default_sx_per / 4, 0);
} else {
- hostdata->sync_xfer[cmd->target] = id;
+ hostdata->sync_xfer[cmd->device->id] = id;
}
#ifdef SYNC_DEBUG
- printk("sync_xfer=%02x", hostdata->sync_xfer[cmd->target]);
+ printk("sync_xfer=%02x", hostdata->sync_xfer[cmd->device->id]);
#endif
- hostdata->sync_stat[cmd->target] = SS_SET;
+ hostdata->sync_stat[cmd->device->id] = SS_SET;
write_3393_cmd(hostdata, WD_CMD_NEGATE_ACK);
hostdata->state = S_CONNECTED;
break;
@@ -1335,7 +1335,7 @@ static void in2000_intr(int irqnum, void *dev_id, struct pt_regs *ptregs)
lun = read_3393(hostdata, WD_TARGET_LUN);
DB(DB_INTR, printk(":%d.%d", cmd->SCp.Status, lun))
hostdata->connected = NULL;
- hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
+ hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
hostdata->state = S_UNCONNECTED;
if (cmd->SCp.Status == ILLEGAL_STATUS_BYTE)
cmd->SCp.Status = lun;
@@ -1420,7 +1420,7 @@ static void in2000_intr(int irqnum, void *dev_id, struct pt_regs *ptregs)
}
DB(DB_INTR, printk("UNEXP_DISC-%ld", cmd->pid))
hostdata->connected = NULL;
- hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
+ hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
hostdata->state = S_UNCONNECTED;
if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD)
cmd->result = (cmd->result & 0x00ffff) | (DID_ERROR << 16);
@@ -1451,7 +1451,7 @@ static void in2000_intr(int irqnum, void *dev_id, struct pt_regs *ptregs)
switch (hostdata->state) {
case S_PRE_CMP_DISC:
hostdata->connected = NULL;
- hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
+ hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
hostdata->state = S_UNCONNECTED;
DB(DB_INTR, printk(":%d", cmd->SCp.Status))
if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD)
@@ -1468,7 +1468,7 @@ static void in2000_intr(int irqnum, void *dev_id, struct pt_regs *ptregs)
hostdata->state = S_UNCONNECTED;
#ifdef PROC_STATISTICS
- hostdata->disc_done_cnt[cmd->target]++;
+ hostdata->disc_done_cnt[cmd->device->id]++;
#endif
break;
@@ -1496,7 +1496,7 @@ static void in2000_intr(int irqnum, void *dev_id, struct pt_regs *ptregs)
if (hostdata->selecting) {
cmd = (Scsi_Cmnd *) hostdata->selecting;
hostdata->selecting = NULL;
- hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
+ hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
cmd->host_scribble = (uchar *) hostdata->input_Q;
hostdata->input_Q = cmd;
}
@@ -1506,7 +1506,7 @@ static void in2000_intr(int irqnum, void *dev_id, struct pt_regs *ptregs)
if (cmd) {
if (phs == 0x00) {
- hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
+ hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
cmd->host_scribble = (uchar *) hostdata->input_Q;
hostdata->input_Q = cmd;
} else {
@@ -1538,7 +1538,7 @@ static void in2000_intr(int irqnum, void *dev_id, struct pt_regs *ptregs)
cmd = (Scsi_Cmnd *) hostdata->disconnected_Q;
patch = NULL;
while (cmd) {
- if (id == cmd->target && lun == cmd->lun)
+ if (id == cmd->device->id && lun == cmd->device->lun)
break;
patch = cmd;
cmd = (Scsi_Cmnd *) cmd->host_scribble;
@@ -1565,9 +1565,9 @@ static void in2000_intr(int irqnum, void *dev_id, struct pt_regs *ptregs)
*/
if (is_dir_out(cmd))
- write_3393(hostdata, WD_DESTINATION_ID, cmd->target);
+ write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id);
else
- write_3393(hostdata, WD_DESTINATION_ID, cmd->target | DSTID_DPD);
+ write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id | DSTID_DPD);
if (hostdata->level2 >= L2_RESELECT) {
write_3393_count(hostdata, 0); /* we want a DATA_PHASE interrupt */
write_3393(hostdata, WD_COMMAND_PHASE, 0x45);
@@ -1648,7 +1648,7 @@ static int in2000_bus_reset(Scsi_Cmnd * cmd)
struct IN2000_hostdata *hostdata;
int x;
- instance = cmd->host;
+ instance = cmd->device->host;
hostdata = (struct IN2000_hostdata *) instance->hostdata;
printk(KERN_WARNING "scsi%d: Reset. ", instance->host_no);
@@ -1693,7 +1693,7 @@ static int in2000_abort(Scsi_Cmnd * cmd)
uchar sr, asr;
unsigned long timeout;
- instance = cmd->host;
+ instance = cmd->device->host;
hostdata = (struct IN2000_hostdata *) instance->hostdata;
printk(KERN_DEBUG "scsi%d: Abort-", instance->host_no);
@@ -1767,7 +1767,7 @@ static int in2000_abort(Scsi_Cmnd * cmd)
sr = read_3393(hostdata, WD_SCSI_STATUS);
printk("asr=%02x, sr=%02x.", asr, sr);
- hostdata->busy[cmd->target] &= ~(1 << cmd->lun);
+ hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
hostdata->connected = NULL;
hostdata->state = S_UNCONNECTED;
cmd->result = DID_ABORT << 16;
@@ -2263,7 +2263,7 @@ static int in2000_proc_info(char *buf, char **start, off_t off, int len, int hn,
strcat(bp, "\nconnected: ");
if (hd->connected) {
cmd = (Scsi_Cmnd *) hd->connected;
- sprintf(tbuf, " %ld-%d:%d(%02x)", cmd->pid, cmd->target, cmd->lun, cmd->cmnd[0]);
+ sprintf(tbuf, " %ld-%d:%d(%02x)", cmd->pid, cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
strcat(bp, tbuf);
}
}
@@ -2271,7 +2271,7 @@ static int in2000_proc_info(char *buf, char **start, off_t off, int len, int hn,
strcat(bp, "\ninput_Q: ");
cmd = (Scsi_Cmnd *) hd->input_Q;
while (cmd) {
- sprintf(tbuf, " %ld-%d:%d(%02x)", cmd->pid, cmd->target, cmd->lun, cmd->cmnd[0]);
+ sprintf(tbuf, " %ld-%d:%d(%02x)", cmd->pid, cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
strcat(bp, tbuf);
cmd = (Scsi_Cmnd *) cmd->host_scribble;
}
@@ -2280,7 +2280,7 @@ static int in2000_proc_info(char *buf, char **start, off_t off, int len, int hn,
strcat(bp, "\ndisconnected_Q:");
cmd = (Scsi_Cmnd *) hd->disconnected_Q;
while (cmd) {
- sprintf(tbuf, " %ld-%d:%d(%02x)", cmd->pid, cmd->target, cmd->lun, cmd->cmnd[0]);
+ sprintf(tbuf, " %ld-%d:%d(%02x)", cmd->pid, cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
strcat(bp, tbuf);
cmd = (Scsi_Cmnd *) cmd->host_scribble;
}
diff --git a/drivers/scsi/ini9100u.c b/drivers/scsi/ini9100u.c
index 08e962b455f9..4c8863a748d3 100644
--- a/drivers/scsi/ini9100u.c
+++ b/drivers/scsi/ini9100u.c
@@ -466,9 +466,9 @@ static void i91uBuildSCB(HCS * pHCB, SCB * pSCB, Scsi_Cmnd * SCpnt)
pSCB->SCB_Srb = SCpnt;
pSCB->SCB_Opcode = ExecSCSI;
pSCB->SCB_Flags = SCF_POST; /* After SCSI done, call post routine */
- pSCB->SCB_Target = SCpnt->target;
- pSCB->SCB_Lun = SCpnt->lun;
- pSCB->SCB_Ident = SCpnt->lun | DISC_ALLOW;
+ pSCB->SCB_Target = SCpnt->device->id;
+ pSCB->SCB_Lun = SCpnt->device->lun;
+ pSCB->SCB_Ident = SCpnt->device->lun | DISC_ALLOW;
pSCB->SCB_Flags |= SCF_SENSE; /* Turn on auto request sense */
pSCB->SCB_SensePtr = (U32) VIRT_TO_BUS(SCpnt->sense_buffer);
@@ -522,13 +522,13 @@ int i91u_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
register SCB *pSCB;
HCS *pHCB; /* Point to Host adapter control block */
- if (SCpnt->lun > 16) { /* 07/22/98 */
+ if (SCpnt->device->lun > 16) { /* 07/22/98 */
SCpnt->result = (DID_TIME_OUT << 16);
done(SCpnt); /* Notify system DONE */
return (0);
}
- pHCB = (HCS *) SCpnt->host->base;
+ pHCB = (HCS *) SCpnt->device->host->base;
SCpnt->scsi_done = done;
/* Get free SCSI control block */
@@ -558,7 +558,7 @@ int i91u_abort(Scsi_Cmnd * SCpnt)
{
HCS *pHCB;
- pHCB = (HCS *) SCpnt->host->base;
+ pHCB = (HCS *) SCpnt->device->host->base;
return tul_abort_srb(pHCB, SCpnt);
}
@@ -570,12 +570,12 @@ int i91u_reset(Scsi_Cmnd * SCpnt, unsigned int reset_flags)
{ /* I need Host Control Block Information */
HCS *pHCB;
- pHCB = (HCS *) SCpnt->host->base;
+ pHCB = (HCS *) SCpnt->device->host->base;
if (reset_flags & (SCSI_RESET_SUGGEST_BUS_RESET | SCSI_RESET_SUGGEST_HOST_RESET))
return tul_reset_scsi_bus(pHCB);
else
- return tul_device_reset(pHCB, (ULONG) SCpnt, SCpnt->target, reset_flags);
+ return tul_device_reset(pHCB, (ULONG) SCpnt, SCpnt->device->id, reset_flags);
}
/*
diff --git a/drivers/scsi/inia100.c b/drivers/scsi/inia100.c
index da8f9484cea6..7583fd8dc622 100644
--- a/drivers/scsi/inia100.c
+++ b/drivers/scsi/inia100.c
@@ -459,8 +459,8 @@ static void inia100BuildSCB(ORC_HCS * pHCB, ORC_SCB * pSCB, Scsi_Cmnd * SCpnt)
pSCB->SCB_Opcode = ORC_EXECSCSI;
pSCB->SCB_Flags = SCF_NO_DCHK; /* Clear done bit */
- pSCB->SCB_Target = SCpnt->target;
- pSCB->SCB_Lun = SCpnt->lun;
+ pSCB->SCB_Target = SCpnt->device->id;
+ pSCB->SCB_Lun = SCpnt->device->lun;
pSCB->SCB_Reserved0 = 0;
pSCB->SCB_Reserved1 = 0;
pSCB->SCB_SGLen = 0;
@@ -501,7 +501,7 @@ static void inia100BuildSCB(ORC_HCS * pHCB, ORC_SCB * pSCB, Scsi_Cmnd * SCpnt)
printk("max cdb length= %x\b", SCpnt->cmd_len);
pSCB->SCB_CDBLen = IMAX_CDB;
}
- pSCB->SCB_Ident = SCpnt->lun | DISC_ALLOW;
+ pSCB->SCB_Ident = SCpnt->device->lun | DISC_ALLOW;
if (SCpnt->device->tagged_supported) { /* Tag Support */
pSCB->SCB_TagMsg = SIMPLE_QUEUE_TAG; /* Do simple tag only */
} else {
@@ -523,7 +523,7 @@ static int inia100_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
register ORC_SCB *pSCB;
ORC_HCS *pHCB; /* Point to Host adapter control block */
- pHCB = (ORC_HCS *) SCpnt->host->hostdata;
+ pHCB = (ORC_HCS *) SCpnt->device->host->hostdata;
SCpnt->scsi_done = done;
/* Get free SCSI control block */
if ((pSCB = orc_alloc_scb(pHCB)) == NULL) {
@@ -549,7 +549,7 @@ static int inia100_abort(Scsi_Cmnd * SCpnt)
{
ORC_HCS *hcsp;
- hcsp = (ORC_HCS *) SCpnt->host->hostdata;
+ hcsp = (ORC_HCS *) SCpnt->device->host->hostdata;
return orc_abort_srb(hcsp, SCpnt);
}
@@ -564,7 +564,7 @@ static int inia100_abort(Scsi_Cmnd * SCpnt)
static int inia100_bus_reset(Scsi_Cmnd * SCpnt)
{ /* I need Host Control Block Information */
ORC_HCS *pHCB;
- pHCB = (ORC_HCS *) SCpnt->host->hostdata;
+ pHCB = (ORC_HCS *) SCpnt->device->host->hostdata;
return orc_reset_scsi_bus(pHCB);
}
@@ -578,8 +578,8 @@ static int inia100_bus_reset(Scsi_Cmnd * SCpnt)
static int inia100_device_reset(Scsi_Cmnd * SCpnt)
{ /* I need Host Control Block Information */
ORC_HCS *pHCB;
- pHCB = (ORC_HCS *) SCpnt->host->hostdata;
- return orc_device_reset(pHCB, SCpnt, SCpnt->target);
+ pHCB = (ORC_HCS *) SCpnt->device->host->hostdata;
+ return orc_device_reset(pHCB, SCpnt, SCpnt->device->id);
}
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index b67e8ea6aa1c..f355f3d2bf0a 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -817,7 +817,7 @@ ips_eh_abort(Scsi_Cmnd *SC) {
if (!SC)
return (FAILED);
- ha = (ips_ha_t *) SC->host->hostdata;
+ ha = (ips_ha_t *) SC->device->host->hostdata;
if (!ha)
return (FAILED);
@@ -884,7 +884,7 @@ ips_eh_reset(Scsi_Cmnd *SC) {
return (FAILED);
}
- ha = (ips_ha_t *) SC->host->hostdata;
+ ha = (ips_ha_t *) SC->device->host->hostdata;
if (!ha) {
DEBUG(1, "Reset called with NULL ha struct");
@@ -1072,7 +1072,7 @@ ips_queue(Scsi_Cmnd *SC, void (*done) (Scsi_Cmnd *)) {
METHOD_TRACE("ips_queue", 1);
- ha = (ips_ha_t *) SC->host->hostdata;
+ ha = (ips_ha_t *) SC->device->host->hostdata;
if (!ha)
return (1);
@@ -1100,12 +1100,12 @@ ips_queue(Scsi_Cmnd *SC, void (*done) (Scsi_Cmnd *)) {
ips_name,
ha->host_num,
SC->cmnd[0],
- SC->channel,
- SC->target,
- SC->lun);
+ SC->device->channel,
+ SC->device->id,
+ SC->device->lun);
/* Check for command to initiator IDs */
- if ((SC->channel > 0) && (SC->target == ha->ha_id[SC->channel])) {
+ if ((SC->device->channel > 0) && (SC->device->id == ha->ha_id[SC->device->channel])) {
SC->result = DID_NO_CONNECT << 16;
done(SC);
@@ -1556,9 +1556,9 @@ ips_is_passthru(Scsi_Cmnd *SC) {
return (0);
if ((SC->cmnd[0] == IPS_IOCTL_COMMAND) &&
- (SC->channel == 0) &&
- (SC->target == IPS_ADAPTER_ID) &&
- (SC->lun == 0) &&
+ (SC->device->channel == 0) &&
+ (SC->device->id == IPS_ADAPTER_ID) &&
+ (SC->device->lun == 0) &&
SC->request_buffer){
if((!SC->use_sg) && SC->request_bufflen &&
(((char *) SC->request_buffer)[0] == 'C') &&
@@ -1857,9 +1857,9 @@ ips_flash_firmware(ips_ha_t * ha, ips_passthru_t *pt, ips_scb_t *scb){
/* FIX stuff that might be wrong */
scb->sg_list = sg_list;
scb->scb_busaddr = cmd_busaddr;
- scb->bus = scb->scsi_cmd->channel;
- scb->target_id = scb->scsi_cmd->target;
- scb->lun = scb->scsi_cmd->lun;
+ scb->bus = scb->scsi_cmd->device->channel;
+ scb->target_id = scb->scsi_cmd->device->id;
+ scb->lun = scb->scsi_cmd->device->lun;
scb->sg_len = 0;
scb->data_len = 0;
scb->flags = 0;
@@ -1922,9 +1922,9 @@ ips_usrcmd(ips_ha_t *ha, ips_passthru_t *pt, ips_scb_t *scb) {
/* FIX stuff that might be wrong */
scb->sg_list = sg_list;
scb->scb_busaddr = cmd_busaddr;
- scb->bus = scb->scsi_cmd->channel;
- scb->target_id = scb->scsi_cmd->target;
- scb->lun = scb->scsi_cmd->lun;
+ scb->bus = scb->scsi_cmd->device->channel;
+ scb->target_id = scb->scsi_cmd->device->id;
+ scb->lun = scb->scsi_cmd->device->lun;
scb->sg_len = 0;
scb->data_len = 0;
scb->flags = 0;
@@ -2666,7 +2666,7 @@ ips_next(ips_ha_t *ha, int intr) {
p = ha->scb_waitlist.head;
while ((p) && (scb = ips_getscb(ha))) {
- if ((p->channel > 0) && (ha->dcdb_active[p->channel-1] & (1 << p->target))) {
+ if ((p->device->channel > 0) && (ha->dcdb_active[p->device->channel-1] & (1 << p->device->id))) {
ips_freescb(ha, scb);
p = (Scsi_Cmnd *) p->host_scribble;
continue;
@@ -2683,9 +2683,9 @@ ips_next(ips_ha_t *ha, int intr) {
memset(SC->sense_buffer, 0, sizeof(SC->sense_buffer));
- scb->target_id = SC->target;
- scb->lun = SC->lun;
- scb->bus = SC->channel;
+ scb->target_id = SC->device->id;
+ scb->lun = SC->device->lun;
+ scb->bus = SC->device->channel;
scb->scsi_cmd = SC;
scb->breakup = 0;
scb->data_len = 0;
@@ -3499,9 +3499,9 @@ ips_map_status(ips_ha_t *ha, ips_scb_t *scb, ips_stat_t *sp) {
DEBUG_VAR(2, "(%s%d) Physical device error (%d %d %d): %x %x, Sense Key: %x, ASC: %x, ASCQ: %x",
ips_name,
ha->host_num,
- scb->scsi_cmd->channel,
- scb->scsi_cmd->target,
- scb->scsi_cmd->lun,
+ scb->scsi_cmd->device->channel,
+ scb->scsi_cmd->channel->id,
+ scb->scsi_cmd->channel->lun,
scb->basic_status,
scb->extended_status,
scb->extended_status == IPS_ERR_CKCOND ? scb->dcdb.sense_info[2] & 0xf : 0,
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index eb24cfde6960..88e808cb3ae1 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -863,8 +863,8 @@ static void callDone (Scsi_Cmnd * SCpnt)
{
if (SCpnt->result) {
TRACE (("*** %.08lx %.02x <%d.%d.%d> = %x\n",
- SCpnt->serial_number, SCpnt->cmnd[0], SCpnt->channel,
- SCpnt->target, SCpnt->lun, SCpnt->result));
+ SCpnt->serial_number, SCpnt->cmnd[0], SCpnt->device->channel,
+ SCpnt->device->id, SCpnt->device->lun, SCpnt->result));
}
SCpnt->scsi_done (SCpnt);
}
@@ -1077,10 +1077,10 @@ static void mega_cmd_done (mega_host_config * megaCfg, mega_scb * pScb, int stat
panic(KERN_ERR "megaraid:Problem...!\n");
}
- islogical = ( (SCpnt->channel >= megaCfg->productInfo.SCSIChanPresent) &&
- (SCpnt->channel <= megaCfg->host->max_channel) );
+ islogical = ( (SCpnt->device->channel >= megaCfg->productInfo.SCSIChanPresent) &&
+ (SCpnt->device->channel <= megaCfg->host->max_channel) );
#if 0
- islogical = (SCpnt->channel == megaCfg->host->max_channel);
+ islogical = (SCpnt->device->channel == megaCfg->host->max_channel);
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
@@ -1119,7 +1119,7 @@ static void mega_cmd_done (mega_host_config * megaCfg, mega_scb * pScb, int stat
status = 0xF0;
}
#endif
- if( IS_RAID_CH(SCpnt->channel) && ((c & 0x1F ) == TYPE_DISK) ) {
+ if( IS_RAID_CH(SCpnt->device->channel) && ((c & 0x1F ) == TYPE_DISK) ) {
status = 0xF0;
}
}
@@ -1206,7 +1206,7 @@ static mega_scb *mega_build_cmd (mega_host_config * megaCfg, Scsi_Cmnd * SCpnt)
mega_ext_passthru *epthru;
long seg;
char islogical;
- int lun = SCpnt->lun;
+ int lun = SCpnt->device->lun;
int max_lun;
if ((SCpnt->cmnd[0] == MEGADEVIOC))
@@ -1224,11 +1224,11 @@ static mega_scb *mega_build_cmd (mega_host_config * megaCfg, Scsi_Cmnd * SCpnt)
}
#endif
- islogical = ( (SCpnt->channel >= megaCfg->productInfo.SCSIChanPresent) &&
- (SCpnt->channel <= megaCfg->host->max_channel) );
+ islogical = ( (SCpnt->device->channel >= megaCfg->productInfo.SCSIChanPresent) &&
+ (SCpnt->device->channel <= megaCfg->host->max_channel) );
#if 0
- islogical = (IS_RAID_CH(SCpnt->channel) && /* virtual ch is raid - AM */
- (SCpnt->channel == megaCfg->host->max_channel));
+ islogical = (IS_RAID_CH(SCpnt->device->channel) && /* virtual ch is raid - AM */
+ (SCpnt->device->channel == megaCfg->host->max_channel));
#endif
if ( ! megaCfg->support_ext_cdb ) {
@@ -1239,7 +1239,7 @@ static mega_scb *mega_build_cmd (mega_host_config * megaCfg, Scsi_Cmnd * SCpnt)
}
}
- if (!islogical && SCpnt->target == skip_id) {
+ if (!islogical && SCpnt->device->id == skip_id) {
SCpnt->result = (DID_BAD_TARGET << 16);
callDone (SCpnt);
return NULL;
@@ -1248,7 +1248,7 @@ static mega_scb *mega_build_cmd (mega_host_config * megaCfg, Scsi_Cmnd * SCpnt)
if (islogical) {
/* have just LUN 0 for each target on virtual channels */
- if( SCpnt->lun != 0 ) {
+ if( SCpnt->device->lun != 0 ) {
SCpnt->result = (DID_BAD_TARGET << 16);
callDone (SCpnt);
return NULL;
@@ -1561,11 +1561,11 @@ mega_get_lun(mega_host_config *this_hba, Scsi_Cmnd *sc)
int lun;
int virt_chan;
- tgt = sc->target;
+ tgt = sc->device->id;
if ( tgt > 7 ) tgt--; /* we do not get inquires for tgt 7 */
- virt_chan = sc->channel - this_hba->productInfo.SCSIChanPresent;
+ virt_chan = sc->device->channel - this_hba->productInfo.SCSIChanPresent;
lun = (virt_chan * 15) + tgt;
/*
@@ -1610,11 +1610,11 @@ mega_prepare_passthru(mega_host_config *megacfg, mega_scb *scb, Scsi_Cmnd *sc)
pthru->ars = 1;
pthru->reqsenselen = 14;
pthru->islogical = 0;
- pthru->channel = (megacfg->flag & BOARD_40LD) ? 0 : sc->channel;
+ pthru->channel = (megacfg->flag & BOARD_40LD) ? 0 : sc->device->channel;
pthru->target = (megacfg->flag & BOARD_40LD) ?
- (sc->channel << 4) | sc->target : sc->target;
+ (sc->device->channel << 4) | sc->device->id : sc->device->id;
pthru->cdblen = sc->cmd_len;
- pthru->logdrv = sc->lun;
+ pthru->logdrv = sc->device->lun;
memcpy (pthru->cdb, sc->cmnd, sc->cmd_len);
@@ -1666,11 +1666,11 @@ mega_prepare_extpassthru(mega_host_config *megacfg, mega_scb *scb, Scsi_Cmnd *sc
epthru->ars = 1;
epthru->reqsenselen = 14;
epthru->islogical = 0;
- epthru->channel = (megacfg->flag & BOARD_40LD) ? 0 : sc->channel;
+ epthru->channel = (megacfg->flag & BOARD_40LD) ? 0 : sc->device->channel;
epthru->target = (megacfg->flag & BOARD_40LD) ?
- (sc->channel << 4) | sc->target : sc->target;
+ (sc->device->channel << 4) | sc->device->id : sc->device->id;
epthru->cdblen = sc->cmd_len;
- epthru->logdrv = sc->lun;
+ epthru->logdrv = sc->device->lun;
memcpy(epthru->cdb, sc->cmnd, sc->cmd_len);
@@ -3535,21 +3535,21 @@ int megaraid_queue (Scsi_Cmnd * SCpnt, void (*pktComp) (Scsi_Cmnd *))
mega_scb *pScb;
char *user_area = NULL;
- megaCfg = (mega_host_config *) SCpnt->host->hostdata;
+ megaCfg = (mega_host_config *) SCpnt->device->host->hostdata;
DRIVER_LOCK (megaCfg);
- if (!(megaCfg->flag & (1L << SCpnt->channel))) {
- if (SCpnt->channel < megaCfg->productInfo.SCSIChanPresent)
+ if (!(megaCfg->flag & (1L << SCpnt->device->channel))) {
+ if (SCpnt->device->channel < megaCfg->productInfo.SCSIChanPresent)
printk ( KERN_NOTICE
"scsi%d: scanning channel %d for devices.\n",
- megaCfg->host->host_no, SCpnt->channel);
+ megaCfg->host->host_no, SCpnt->device->channel);
else
printk ( KERN_NOTICE
"scsi%d: scanning virtual channel %d for logical drives.\n",
megaCfg->host->host_no,
- SCpnt->channel-megaCfg->productInfo.SCSIChanPresent+1);
+ SCpnt->device->channel-megaCfg->productInfo.SCSIChanPresent+1);
- megaCfg->flag |= (1L << SCpnt->channel);
+ megaCfg->flag |= (1L << SCpnt->device->channel);
}
SCpnt->scsi_done = pktComp;
@@ -3698,7 +3698,7 @@ int megaraid_abort (Scsi_Cmnd * SCpnt)
rc = SCSI_ABORT_NOT_RUNNING;
- megaCfg = (mega_host_config *) SCpnt->host->hostdata;
+ megaCfg = (mega_host_config *) SCpnt->device->host->hostdata;
megaCfg->flag |= IN_ABORT;
@@ -3796,18 +3796,18 @@ int megaraid_reset (Scsi_Cmnd * SCpnt, unsigned int rstflags)
mega_scb *pScb;
rc = SCSI_RESET_NOT_RUNNING;
- megaCfg = (mega_host_config *) SCpnt->host->hostdata;
+ megaCfg = (mega_host_config *) SCpnt->device->host->hostdata;
megaCfg->flag |= IN_RESET;
printk
("megaraid_RESET: %.08lx cmd=%.02x <c=%d.t=%d.l=%d>, flag = %x\n",
- SCpnt->serial_number, SCpnt->cmnd[0], SCpnt->channel,
- SCpnt->target, SCpnt->lun, rstflags);
+ SCpnt->serial_number, SCpnt->cmnd[0], SCpnt->device->channel,
+ SCpnt->device->id, SCpnt->device->lun, rstflags);
TRACE (("RESET: %.08lx %.02x <%d.%d.%d>\n",
- SCpnt->serial_number, SCpnt->cmnd[0], SCpnt->channel,
- SCpnt->target, SCpnt->lun));
+ SCpnt->serial_number, SCpnt->cmnd[0], SCpnt->device->channel,
+ SCpnt->device->id, SCpnt->device->lun));
/*
* Walk list of SCBs for any that are still outstanding
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index 9218621843b8..a2f23287c20c 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -3196,8 +3196,8 @@ static void PRINT_LUN(ncb_p np, int target, int lun)
static void PRINT_ADDR(Scsi_Cmnd *cmd)
{
- struct host_data *host_data = (struct host_data *) cmd->host->hostdata;
- PRINT_LUN(host_data->ncb, cmd->target, cmd->lun);
+ struct host_data *host_data = (struct host_data *) cmd->device->host->hostdata;
+ PRINT_LUN(host_data->ncb, cmd->device->id, cmd->device->lun);
}
/*==========================================================
@@ -4345,8 +4345,8 @@ static int ncr_prepare_nego(ncb_p np, ccb_p cp, u_char *msgptr)
static int ncr_queue_command (ncb_p np, Scsi_Cmnd *cmd)
{
/* Scsi_Device *device = cmd->device; */
- tcb_p tp = &np->target[cmd->target];
- lcb_p lp = tp->lp[cmd->lun];
+ tcb_p tp = &np->target[cmd->device->id];
+ lcb_p lp = tp->lp[cmd->device->lun];
ccb_p cp;
int segments;
@@ -4361,9 +4361,9 @@ static int ncr_queue_command (ncb_p np, Scsi_Cmnd *cmd)
**
**---------------------------------------------
*/
- if ((cmd->target == np->myaddr ) ||
- (cmd->target >= MAX_TARGET) ||
- (cmd->lun >= MAX_LUN )) {
+ if ((cmd->device->id == np->myaddr ) ||
+ (cmd->device->id >= MAX_TARGET) ||
+ (cmd->device->lun >= MAX_LUN )) {
return(DID_BAD_TARGET);
}
@@ -4403,7 +4403,7 @@ static int ncr_queue_command (ncb_p np, Scsi_Cmnd *cmd)
np->settle_time = tlimit;
}
- if (np->settle_time || !(cp=ncr_get_ccb (np, cmd->target, cmd->lun))) {
+ if (np->settle_time || !(cp=ncr_get_ccb (np, cmd->device->id, cmd->device->lun))) {
insert_into_waiting_list(np, cmd);
return(DID_OK);
}
@@ -4418,7 +4418,7 @@ static int ncr_queue_command (ncb_p np, Scsi_Cmnd *cmd)
#if 0 /* This stuff was only useful for linux-1.2.13 */
if (lp && !lp->numtags && cmd->device && cmd->device->tagged_queue) {
lp->numtags = tp->usrtags;
- ncr_setup_tags (np, cmd->target, cmd->lun);
+ ncr_setup_tags (np, cmd->device->id, cmd->device->lun);
}
#endif
@@ -4429,7 +4429,7 @@ static int ncr_queue_command (ncb_p np, Scsi_Cmnd *cmd)
**----------------------------------------------------
*/
- idmsg = M_IDENTIFY | cmd->lun;
+ idmsg = M_IDENTIFY | cmd->device->lun;
if (cp ->tag != NO_TAG ||
(cp != np->ccb && np->disc && !(tp->usrflag & UF_NODISC)))
@@ -4662,7 +4662,7 @@ static int ncr_queue_command (ncb_p np, Scsi_Cmnd *cmd)
/*
** select
*/
- cp->phys.select.sel_id = cmd->target;
+ cp->phys.select.sel_id = cmd->device->id;
cp->phys.select.sel_scntl3 = tp->wval;
cp->phys.select.sel_sxfer = tp->sval;
/*
@@ -5199,8 +5199,8 @@ void ncr_complete (ncb_p np, ccb_p cp)
cmd = cp->cmd;
cp->cmd = NULL;
- tp = &np->target[cmd->target];
- lp = tp->lp[cmd->lun];
+ tp = &np->target[cmd->device->id];
+ lp = tp->lp[cmd->device->lun];
/*
** We donnot queue more than 1 ccb per target
@@ -5296,7 +5296,7 @@ void ncr_complete (ncb_p np, ccb_p cp)
** Allocate the lcb if not yet.
*/
if (!lp)
- ncr_alloc_lcb (np, cmd->target, cmd->lun);
+ ncr_alloc_lcb (np, cmd->device->id, cmd->device->lun);
/*
** On standard INQUIRY response (EVPD and CmDt
@@ -5306,7 +5306,7 @@ void ncr_complete (ncb_p np, ccb_p cp)
if (cmd->cmnd[0] == 0x12 && !(cmd->cmnd[1] & 0x3) &&
cmd->cmnd[4] >= 7 && !cmd->use_sg) {
sync_scsi_data(np, cmd); /* SYNC the data */
- ncr_setup_lcb (np, cmd->target, cmd->lun,
+ ncr_setup_lcb (np, cmd->device->id, cmd->device->lun,
(char *) cmd->request_buffer);
}
@@ -5322,7 +5322,7 @@ void ncr_complete (ncb_p np, ccb_p cp)
if (lp->num_good >= 1000) {
lp->num_good = 0;
++lp->numtags;
- ncr_setup_tags (np, cmd->target, cmd->lun);
+ ncr_setup_tags (np, cmd->device->id, cmd->device->lun);
}
}
} else if ((cp->host_status == HS_COMPLETE)
@@ -5902,7 +5902,7 @@ static void ncr_set_sync_wide_status (ncb_p np, u_char target)
*/
for (cp = np->ccb; cp; cp = cp->link_ccb) {
if (!cp->cmd) continue;
- if (cp->cmd->target != target) continue;
+ if (cp->cmd->device->id != target) continue;
#if 0
cp->sync_status = tp->sval;
cp->wide_status = tp->wval;
@@ -5932,7 +5932,7 @@ static void ncr_setsync (ncb_p np, ccb_p cp, u_char scntl3, u_char sxfer)
cmd = cp->cmd;
if (!cmd) return;
- assert (target == (cmd->target & 0xf));
+ assert (target == (cmd->device->id & 0xf));
tp = &np->target[target];
@@ -6017,7 +6017,7 @@ static void ncr_setwide (ncb_p np, ccb_p cp, u_char wide, u_char ack)
cmd = cp->cmd;
if (!cmd) return;
- assert (target == (cmd->target & 0xf));
+ assert (target == (cmd->device->id & 0xf));
tp = &np->target[target];
tp->widedone = wide+1;
@@ -7057,8 +7057,8 @@ reset_all:
static void ncr_sir_to_redo(ncb_p np, int num, ccb_p cp)
{
Scsi_Cmnd *cmd = cp->cmd;
- tcb_p tp = &np->target[cmd->target];
- lcb_p lp = tp->lp[cmd->lun];
+ tcb_p tp = &np->target[cmd->device->id];
+ lcb_p lp = tp->lp[cmd->device->lun];
XPT_QUEHEAD *qp;
ccb_p cp2;
int disc_cnt = 0;
@@ -7104,7 +7104,7 @@ static void ncr_sir_to_redo(ncb_p np, int num, ccb_p cp)
if (disc_cnt < lp->numtags) {
lp->numtags = disc_cnt > 2 ? disc_cnt : 2;
lp->num_good = 0;
- ncr_setup_tags (np, cmd->target, cmd->lun);
+ ncr_setup_tags (np, cmd->device->id, cmd->device->lun);
}
/*
** Requeue the command to the start queue.
@@ -7136,7 +7136,7 @@ static void ncr_sir_to_redo(ncb_p np, int num, ccb_p cp)
**
** identify message
*/
- cp->scsi_smsg2[0] = M_IDENTIFY | cmd->lun;
+ cp->scsi_smsg2[0] = M_IDENTIFY | cmd->device->lun;
cp->phys.smsg.addr = cpu_to_scr(CCB_PHYS (cp, scsi_smsg2));
cp->phys.smsg.size = cpu_to_scr(1);
@@ -7150,7 +7150,7 @@ static void ncr_sir_to_redo(ncb_p np, int num, ccb_p cp)
** patch requested size into sense command
*/
cp->sensecmd[0] = 0x03;
- cp->sensecmd[1] = cmd->lun << 5;
+ cp->sensecmd[1] = cmd->device->lun << 5;
cp->sensecmd[4] = sizeof(cp->sense_buf);
/*
@@ -8731,7 +8731,7 @@ int ncr53c8xx_slave_configure(Scsi_Device *device)
int ncr53c8xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
{
- ncb_p np = ((struct host_data *) cmd->host->hostdata)->ncb;
+ ncb_p np = ((struct host_data *) cmd->device->host->hostdata)->ncb;
unsigned long flags;
int sts;
@@ -8798,9 +8798,9 @@ static void ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs)
if (DEBUG_FLAGS & DEBUG_TINY) printk ("]\n");
if (done_list) {
- NCR_LOCK_SCSI_DONE(done_list->host, flags);
+ NCR_LOCK_SCSI_DONE(done_list->device->host, flags);
ncr_flush_done_cmds(done_list);
- NCR_UNLOCK_SCSI_DONE(done_list->host, flags);
+ NCR_UNLOCK_SCSI_DONE(done_list->device->host, flags);
}
}
@@ -8821,9 +8821,9 @@ static void ncr53c8xx_timeout(unsigned long npref)
NCR_UNLOCK_NCB(np, flags);
if (done_list) {
- NCR_LOCK_SCSI_DONE(done_list->host, flags);
+ NCR_LOCK_SCSI_DONE(done_list->device->host, flags);
ncr_flush_done_cmds(done_list);
- NCR_UNLOCK_SCSI_DONE(done_list->host, flags);
+ NCR_UNLOCK_SCSI_DONE(done_list->device->host, flags);
}
}
@@ -8837,7 +8837,7 @@ int ncr53c8xx_reset(Scsi_Cmnd *cmd, unsigned int reset_flags)
int ncr53c8xx_reset(Scsi_Cmnd *cmd)
#endif
{
- ncb_p np = ((struct host_data *) cmd->host->hostdata)->ncb;
+ ncb_p np = ((struct host_data *) cmd->device->host->hostdata)->ncb;
int sts;
unsigned long flags;
Scsi_Cmnd *done_list;
@@ -8899,7 +8899,7 @@ out:
int ncr53c8xx_abort(Scsi_Cmnd *cmd)
{
- ncb_p np = ((struct host_data *) cmd->host->hostdata)->ncb;
+ ncb_p np = ((struct host_data *) cmd->device->host->hostdata)->ncb;
int sts;
unsigned long flags;
Scsi_Cmnd *done_list;
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 22a09ab3aee9..a6b1a1bd6e6b 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -458,7 +458,7 @@ static void nsp32_build_identify(nsp32_hw_data *data, Scsi_Cmnd *SCpnt)
/* XXX: Auto DiscPriv detection is progressing... */
0x40 | /* DiscPriv */
#endif
- SCpnt->lun; /* LUNTRN */
+ SCpnt->device->lun; /* LUNTRN */
data->msgoutlen = pos;
}
@@ -532,9 +532,9 @@ static void nsp32_start_timer(Scsi_Cmnd *SCpnt, int time)
*/
static int nsp32hw_start_selection(Scsi_Cmnd *SCpnt, nsp32_hw_data *data)
{
- unsigned int host_id = SCpnt->host->this_id;
- unsigned int base = SCpnt->host->io_port;
- unsigned char target = SCpnt->target;
+ unsigned int host_id = SCpnt->device->host->this_id;
+ unsigned int base = SCpnt->device->host->io_port;
+ unsigned char target = SCpnt->device->id;
unsigned char *param = data->autoparam;
unsigned char phase, arbit;
int i, time;
@@ -744,7 +744,7 @@ static int nsp32_selection_autoscsi(Scsi_Cmnd *SCpnt, nsp32_hw_data *data)
* set SCSIOUT LATCH(initiator)/TARGET(target) (ORed) ID
*/
nsp32_write1(base, SCSI_OUT_LATCH_TARGET_ID,
- ((1 << NSP32_HOST_SCSIID) | (1 << SCpnt->target)));
+ ((1 << NSP32_HOST_SCSIID) | (1 << SCpnt->device->id)));
/*
* set SCSI MSGOUT REG
@@ -1021,7 +1021,7 @@ static int nsp32hw_setup_sg_table(Scsi_Cmnd *SCpnt, nsp32_hw_data *data)
static int nsp32_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
{
- nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->host->hostdata;
+ nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
struct nsp32_target *target;
struct nsp32_lunt *curlunt;
int ret;
@@ -1029,7 +1029,7 @@ static int nsp32_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
nsp32_dbg(NSP32_DEBUG_QUEUECOMMAND,
"enter. target: 0x%x LUN: 0x%x cmnd: 0x%x cmndlen: 0x%x "
"use_sg: 0x%x reqbuf: 0x%lx reqlen: 0x%x",
- SCpnt->target, SCpnt->lun, SCpnt->cmnd[0], SCpnt->cmd_len,
+ SCpnt->device->id, SCpnt->device->lun, SCpnt->cmnd[0], SCpnt->cmd_len,
SCpnt->use_sg, SCpnt->request_buffer, SCpnt->request_bufflen);
if (data->CurrentSC != NULL ) {
@@ -1042,14 +1042,14 @@ static int nsp32_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
}
/* check target ID is not same as this initiator ID */
- if (SCpnt->target == NSP32_HOST_SCSIID) {
+ if (SCpnt->device->id == NSP32_HOST_SCSIID) {
SCpnt->result = DID_BAD_TARGET << 16;
done(SCpnt);
return 1;
}
/* check target LUN is allowable value */
- if (SCpnt->lun >= MAX_LUN) {
+ if (SCpnt->device->lun >= MAX_LUN) {
SCpnt->result = DID_BAD_TARGET << 16;
done(SCpnt);
return 1;
@@ -1071,13 +1071,13 @@ static int nsp32_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
/* initialize data */
data->msgoutlen = 0;
data->msginlen = 0;
- curlunt = data->lunt[SCpnt->target][SCpnt->lun];
+ curlunt = data->lunt[SCpnt->device->id][SCpnt->device->lun];
curlunt->SCpnt = SCpnt;
curlunt->save_datp = 0;
curlunt->msgin03 = FALSE;
data->curlunt = curlunt;
- data->pid = SCpnt->target;
- data->plun = SCpnt->lun;
+ data->pid = SCpnt->device->id;
+ data->plun = SCpnt->device->lun;
ret = nsp32hw_setup_sg_table(SCpnt, data);
if (ret == FALSE) {
@@ -1093,7 +1093,7 @@ static int nsp32_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
* (target don't have SDTR_DONE and SDTR_INITIATOR), sync
* message SDTR is needed to do synchronous transfer.
*/
- target = &data->target[SCpnt->target];
+ target = &data->target[SCpnt->device->id];
data->curtarget = target;
if (!(target->sync_flag & (SDTR_DONE | SDTR_INITIATOR | SDTR_TARGET))) {
@@ -1139,7 +1139,7 @@ static int nsp32_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
nsp32_dbg(NSP32_DEBUG_TARGETFLAG,
"target: %d sync_flag: 0x%x syncreg: 0x%x ackwidth: 0x%x",
- SCpnt->target, target->sync_flag, target->syncreg,
+ SCpnt->device->id, target->sync_flag, target->syncreg,
target->ackwidth);
/* Selection */
@@ -1920,7 +1920,7 @@ static int nsp32_reset(Scsi_Cmnd *SCpnt, unsigned int reset_flags)
static int nsp32_eh_abort(Scsi_Cmnd *SCpnt)
{
- nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->host->hostdata;
+ nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
unsigned int base = data->BaseAddress;
nsp32_msg(KERN_WARNING, "abort");
@@ -1942,7 +1942,7 @@ static int nsp32_eh_abort(Scsi_Cmnd *SCpnt)
static int nsp32_eh_bus_reset(Scsi_Cmnd *SCpnt)
{
- nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->host->hostdata;
+ nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
unsigned int base = data->BaseAddress;
nsp32_msg(KERN_INFO, "Bus Reset");
@@ -1997,7 +1997,7 @@ static void nsp32_do_bus_reset(nsp32_hw_data *data)
static int nsp32_eh_host_reset(Scsi_Cmnd *SCpnt)
{
- struct Scsi_Host *host = SCpnt->host;
+ struct Scsi_Host *host = SCpnt->device->host;
nsp32_hw_data *data = (nsp32_hw_data *)host->hostdata;
unsigned int base = data->BaseAddress;
diff --git a/drivers/scsi/pci2000.c b/drivers/scsi/pci2000.c
index 55ea2f6236f1..cb67ce11dec0 100644
--- a/drivers/scsi/pci2000.c
+++ b/drivers/scsi/pci2000.c
@@ -390,7 +390,7 @@ irqProceed:;
OpDone (SCpnt, DID_OK << 16);
irq_return:
- spin_unlock_irqrestore(&shost->host_lock, flags);
+ spin_unlock_irqrestore(shost->host_lock, flags);
out:;
}
/****************************************************************
@@ -407,11 +407,11 @@ out:;
int Pci2000_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
{
UCHAR *cdb = (UCHAR *)SCpnt->cmnd; // Pointer to SCSI CDB
- PADAPTER2000 padapter = HOSTDATA(SCpnt->host); // Pointer to adapter control structure
+ PADAPTER2000 padapter = HOSTDATA(SCpnt->device->host); // Pointer to adapter control structure
int rc = -1; // command return code
- UCHAR bus = SCpnt->channel;
- UCHAR pun = SCpnt->target;
- UCHAR lun = SCpnt->lun;
+ UCHAR bus = SCpnt->device->channel;
+ UCHAR pun = SCpnt->device->id;
+ UCHAR lun = SCpnt->device->lun;
UCHAR cmd;
PDEV2000 pdev = &padapter->dev[bus][pun];
@@ -506,13 +506,16 @@ int Pci2000_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
if ( SCpnt->use_sg )
{
- SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, ((struct scatterlist *)SCpnt->request_buffer)->address,
- SCpnt->request_bufflen, scsi_to_pci_dma_dir (SCpnt->sc_data_direction));
+ SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev,
+ ((struct scatterlist *)SCpnt->request_buffer)->address,
+ SCpnt->request_bufflen,
+ scsi_to_pci_dma_dir (SCpnt->sc_data_direction));
}
else
{
- SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, SCpnt->request_buffer,
- SCpnt->request_bufflen, scsi_to_pci_dma_dir (SCpnt->sc_data_direction));
+ SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, SCpnt->request_buffer,
+ SCpnt->request_bufflen,
+ scsi_to_pci_dma_dir (SCpnt->sc_data_direction));
}
outl (SCpnt->SCp.have_data_in, padapter->mb2);
outl (SCpnt->request_bufflen, padapter->mb3);
diff --git a/drivers/scsi/pci2000.h b/drivers/scsi/pci2000.h
index 28ab7b511662..09a52c8a9896 100644
--- a/drivers/scsi/pci2000.h
+++ b/drivers/scsi/pci2000.h
@@ -202,15 +202,15 @@ int Pci2000_BiosParam (struct scsi_device *sdev,
#endif
/* screen is 80 columns wide, damnit! */
-#define PCI2000 { \
+#define PCI2000 { \
.proc_name = "pci2000", \
.name = "PCI-2000 SCSI Intelligent Disk Controller", \
- .detect = Pci2000_Detect, \
+ .detect = Pci2000_Detect, \
.release = Pci2000_Release, \
.command = Pci2000_Command, \
.queuecommand = Pci2000_QueueCommand, \
- .abort = Pci2000_Abort, \
- .reset = Pci2000_Reset, \
+ .abort = Pci2000_Abort, \
+ .reset = Pci2000_Reset, \
.bios_param = Pci2000_BiosParam, \
.can_queue = 16, \
.this_id = -1, \
diff --git a/drivers/scsi/pci2220i.c b/drivers/scsi/pci2220i.c
index 2a918252c576..ac003fa8d7f0 100644
--- a/drivers/scsi/pci2220i.c
+++ b/drivers/scsi/pci2220i.c
@@ -1156,7 +1156,7 @@ static int InitFailover (PADAPTER2220I padapter, POUR_DEVICE pdev)
static void TimerExpiry (unsigned long data)
{
PADAPTER2220I padapter = (PADAPTER2220I)data;
- struct Scsi_Host *host = padapter->SCpnt->host;
+ struct Scsi_Host *host = padapter->SCpnt->device->host;
POUR_DEVICE pdev = padapter->pdev;
UCHAR status = IDE_STATUS_BUSY;
UCHAR temp, temp1;
@@ -1334,7 +1334,7 @@ static LONG SetReconstruct (POUR_DEVICE pdev, int index)
static void ReconTimerExpiry (unsigned long data)
{
PADAPTER2220I padapter = (PADAPTER2220I)data;
- struct Scsi_Host *host = padapter->SCpnt->host;
+ struct Scsi_Host *host = padapter->SCpnt->device->host;
POUR_DEVICE pdev;
ULONG testsize = 0;
PIDENTIFY_DATA pid;
@@ -2041,8 +2041,8 @@ out:;
int Pci2220i_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
{
UCHAR *cdb = (UCHAR *)SCpnt->cmnd; // Pointer to SCSI CDB
- PADAPTER2220I padapter = HOSTDATA(SCpnt->host); // Pointer to adapter control structure
- POUR_DEVICE pdev = &padapter->device[SCpnt->target];// Pointer to device information
+ PADAPTER2220I padapter = HOSTDATA(SCpnt->device->host); // Pointer to adapter control structure
+ POUR_DEVICE pdev = &padapter->device[SCpnt->device->id];// Pointer to device information
UCHAR rc; // command return code
int z;
PDEVICE_RAID1 pdr;
@@ -2073,9 +2073,9 @@ int Pci2220i_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
{
UCHAR zlo, zhi;
- DEB (printk ("\nPCI2242I: ID %d, LUN %d opcode %X ", SCpnt->target, SCpnt->lun, *cdb));
+ DEB (printk ("\nPCI2242I: ID %d, LUN %d opcode %X ", SCpnt->device->id, SCpnt->device->lun, *cdb));
padapter->pdev = pdev;
- if ( !pdev->byte6 || SCpnt->lun )
+ if ( !pdev->byte6 || SCpnt->device->lun )
{
OpDone (padapter, DID_BAD_TARGET << 16);
return 0;
@@ -2138,7 +2138,7 @@ int Pci2220i_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
padapter->reconTimer.data = 0;
}
- if ( (SCpnt->target >= padapter->numberOfDrives) || SCpnt->lun )
+ if ( (SCpnt->device->id >= padapter->numberOfDrives) || SCpnt->device->lun )
{
OpDone (padapter, DID_BAD_TARGET << 16);
return 0;
@@ -2791,8 +2791,8 @@ unregister1:;
****************************************************************/
int Pci2220i_Abort (Scsi_Cmnd *SCpnt)
{
- PADAPTER2220I padapter = HOSTDATA(SCpnt->host); // Pointer to adapter control structure
- POUR_DEVICE pdev = &padapter->device[SCpnt->target];// Pointer to device information
+ PADAPTER2220I padapter = HOSTDATA(SCpnt->device->host); // Pointer to adapter control structure
+ POUR_DEVICE pdev = &padapter->device[SCpnt->device->id];// Pointer to device information
if ( !padapter->SCpnt )
return SCSI_ABORT_NOT_RUNNING;
@@ -2823,8 +2823,8 @@ int Pci2220i_Abort (Scsi_Cmnd *SCpnt)
****************************************************************/
int Pci2220i_Reset (Scsi_Cmnd *SCpnt, unsigned int reset_flags)
{
- PADAPTER2220I padapter = HOSTDATA(SCpnt->host); // Pointer to adapter control structure
- POUR_DEVICE pdev = &padapter->device[SCpnt->target];// Pointer to device information
+ PADAPTER2220I padapter = HOSTDATA(SCpnt->device->host); // Pointer to adapter control structure
+ POUR_DEVICE pdev = &padapter->device[SCpnt->device->id];// Pointer to device information
if ( padapter->atapi )
{
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 5f1fbf37ed77..90c83fe5330b 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -588,9 +588,9 @@ static int ql_debug_level = 0;
#define ENTER_INTR(x) dprintk(3, "qla1280 : Entering %s()\n", x);
#define LEAVE_INTR(x) dprintk(3, "qla1280 : Leaving %s()\n", x);
-#define SCSI_BUS_32(scp) scp->channel
-#define SCSI_TCN_32(scp) scp->target
-#define SCSI_LUN_32(scp) scp->lun
+#define SCSI_BUS_32(scp) scp->device->channel
+#define SCSI_TCN_32(scp) scp->device->id
+#define SCSI_LUN_32(scp) scp->device->lun
/****************************************************************************/
/* LINUX - Loadable Module Functions. */
@@ -1157,7 +1157,7 @@ qla1280_queuecommand(Scsi_Cmnd * cmd, void (*fn) (Scsi_Cmnd *))
/*ENTER("qla1280_queuecommand");
*/
- host = cmd->host;
+ host = cmd->device->host;
ha = (struct scsi_qla_host *)host->hostdata;
/* send command to adapter */
@@ -1232,8 +1232,8 @@ qla1280_abort(Scsi_Cmnd * cmd)
u16 data;
ENTER("qla1280_abort");
- ha = (struct scsi_qla_host *)cmd->host->hostdata;
- host = cmd->host;
+ ha = (struct scsi_qla_host *)cmd->device->host->hostdata;
+ host = cmd->device->host;
/* Get the SCSI request ptr */
sp = (srb_t *)CMD_SP(cmd);
@@ -1365,7 +1365,7 @@ qla1280_new_abort(Scsi_Cmnd * cmd)
u16 data;
ENTER("qla1280_abort");
- host = cmd->host;
+ host = cmd->device->host;
ha = (struct scsi_qla_host *)host->hostdata;
/* Get the SCSI request ptr */
@@ -1523,7 +1523,7 @@ qla1280_reset(Scsi_Cmnd * cmd, unsigned int flags)
"pointer, failing.\n");
return SCSI_RESET_SNOOZE;
}
- ha = (struct scsi_qla_host *)cmd->host->hostdata;
+ ha = (struct scsi_qla_host *)cmd->device->host->hostdata;
sp = (srb_t *)CMD_SP(cmd);
#if STOP_ON_RESET
diff --git a/drivers/scsi/qlogicfc.c b/drivers/scsi/qlogicfc.c
index 9e1de94494f3..645dec43c6f9 100644
--- a/drivers/scsi/qlogicfc.c
+++ b/drivers/scsi/qlogicfc.c
@@ -1148,7 +1148,7 @@ int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *))
ENTER("isp2x00_queuecommand");
- host = Cmnd->host;
+ host = Cmnd->device->host;
hostdata = (struct isp2x00_hostdata *) host->hostdata;
Cmnd->scsi_done = done;
@@ -1233,10 +1233,10 @@ int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *))
cmd->hdr.entry_type = ENTRY_COMMAND;
cmd->hdr.entry_cnt = 1;
- cmd->target_lun = Cmnd->lun;
- cmd->expanded_lun = cpu_to_le16(Cmnd->lun);
+ cmd->target_lun = Cmnd->device->lun;
+ cmd->expanded_lun = cpu_to_le16(Cmnd->device->lun);
#if ISP2x00_PORTDB
- cmd->target_id = hostdata->port_db[Cmnd->target].loop_id;
+ cmd->target_id = hostdata->port_db[Cmnd->device->id].loop_id;
#else
cmd->target_id = Cmnd->target;
#endif
@@ -1312,9 +1312,9 @@ int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *))
cmd->control_flags = cpu_to_le16(CFLAG_READ);
if (Cmnd->device->tagged_supported) {
- if ((jiffies - hostdata->tag_ages[Cmnd->target]) > (2 * SCSI_TIMEOUT)) {
+ if ((jiffies - hostdata->tag_ages[Cmnd->device->id]) > (2 * SCSI_TIMEOUT)) {
cmd->control_flags |= cpu_to_le16(CFLAG_ORDERED_TAG);
- hostdata->tag_ages[Cmnd->target] = jiffies;
+ hostdata->tag_ages[Cmnd->device->id] = jiffies;
} else
switch (Cmnd->tag) {
case HEAD_OF_QUEUE_TAG:
@@ -1383,8 +1383,8 @@ static void redo_port_db(unsigned long arg)
}
for (i = 0; i < QLOGICFC_REQ_QUEUE_LEN; i++){
- if (hostdata->handle_ptrs[i] && (hostdata->port_db[hostdata->handle_ptrs[i]->target].loop_id > QLOGICFC_MAX_LOOP_ID || hostdata->adapter_state & AS_REDO_LOOP_PORTDB)){
- if (hostdata->port_db[hostdata->handle_ptrs[i]->target].loop_id != hostdata->port_db[0].loop_id){
+ if (hostdata->handle_ptrs[i] && (hostdata->port_db[hostdata->handle_ptrs[i]->device->id].loop_id > QLOGICFC_MAX_LOOP_ID || hostdata->adapter_state & AS_REDO_LOOP_PORTDB)){
+ if (hostdata->port_db[hostdata->handle_ptrs[i]->device->id].loop_id != hostdata->port_db[0].loop_id){
Scsi_Cmnd *Cmnd = hostdata->handle_ptrs[i];
if (Cmnd->use_sg)
@@ -1581,7 +1581,7 @@ void isp2x00_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
* the device may well be back in a couple of
* seconds.
*/
- if ((hostdata->adapter_state == AS_LOOP_DOWN || sts->completion_status == cpu_to_le16(CS_PORT_UNAVAILABLE) || sts->completion_status == cpu_to_le16(CS_PORT_LOGGED_OUT) || sts->completion_status == cpu_to_le16(CS_PORT_CONFIG_CHANGED)) && hostdata->port_db[Cmnd->target].wwn){
+ if ((hostdata->adapter_state == AS_LOOP_DOWN || sts->completion_status == cpu_to_le16(CS_PORT_UNAVAILABLE) || sts->completion_status == cpu_to_le16(CS_PORT_LOGGED_OUT) || sts->completion_status == cpu_to_le16(CS_PORT_CONFIG_CHANGED)) && hostdata->port_db[Cmnd->device->id].wwn){
outw(out_ptr, host->io_port + MBOX5);
continue;
}
@@ -1709,7 +1709,7 @@ int isp2x00_abort(Scsi_Cmnd * Cmnd)
ENTER("isp2x00_abort");
- host = Cmnd->host;
+ host = Cmnd->device->host;
hostdata = (struct isp2x00_hostdata *) host->hostdata;
for (i = 0; i < QLOGICFC_REQ_QUEUE_LEN; i++)
@@ -1724,7 +1724,7 @@ int isp2x00_abort(Scsi_Cmnd * Cmnd)
param[0] = MBOX_ABORT_IOCB;
#if ISP2x00_PORTDB
- param[1] = (((u_short) hostdata->port_db[Cmnd->target].loop_id) << 8) | Cmnd->lun;
+ param[1] = (((u_short) hostdata->port_db[Cmnd->device->id].loop_id) << 8) | Cmnd->device->lun;
#else
param[1] = (((u_short) Cmnd->target) << 8) | Cmnd->lun;
#endif
@@ -1766,7 +1766,7 @@ int isp2x00_reset(Scsi_Cmnd * Cmnd, unsigned int reset_flags)
ENTER("isp2x00_reset");
- host = Cmnd->host;
+ host = Cmnd->device->host;
hostdata = (struct isp2x00_hostdata *) host->hostdata;
param[0] = MBOX_BUS_RESET;
param[1] = 3;
diff --git a/drivers/scsi/qlogicisp.c b/drivers/scsi/qlogicisp.c
index 0c18d39515a4..f27e38e6eb1f 100644
--- a/drivers/scsi/qlogicisp.c
+++ b/drivers/scsi/qlogicisp.c
@@ -802,7 +802,7 @@ int isp1020_queuecommand(Scsi_Cmnd *Cmnd, void (*done)(Scsi_Cmnd *))
ENTER("isp1020_queuecommand");
- host = Cmnd->host;
+ host = Cmnd->device->host;
hostdata = (struct isp1020_hostdata *) host->hostdata;
Cmnd->scsi_done = done;
@@ -853,8 +853,8 @@ int isp1020_queuecommand(Scsi_Cmnd *Cmnd, void (*done)(Scsi_Cmnd *))
cmd->hdr.entry_type = ENTRY_COMMAND;
cmd->hdr.entry_cnt = 1;
- cmd->target_lun = Cmnd->lun;
- cmd->target_id = Cmnd->target;
+ cmd->target_lun = Cmnd->device->lun;
+ cmd->target_id = Cmnd->device->id;
cmd->cdb_length = cpu_to_le16(Cmnd->cmd_len);
cmd->control_flags = cpu_to_le16(CFLAG_READ | CFLAG_WRITE);
cmd->time_out = cpu_to_le16(30);
@@ -1175,7 +1175,7 @@ int isp1020_abort(Scsi_Cmnd *Cmnd)
ENTER("isp1020_abort");
- host = Cmnd->host;
+ host = Cmnd->device->host;
hostdata = (struct isp1020_hostdata *) host->hostdata;
for (i = 0; i < QLOGICISP_REQ_QUEUE_LEN + 1; i++)
@@ -1186,7 +1186,7 @@ int isp1020_abort(Scsi_Cmnd *Cmnd)
isp1020_disable_irqs(host);
param[0] = MBOX_ABORT;
- param[1] = (((u_short) Cmnd->target) << 8) | Cmnd->lun;
+ param[1] = (((u_short) Cmnd->device->id) << 8) | Cmnd->device->lun;
param[2] = cmd_cookie >> 16;
param[3] = cmd_cookie & 0xffff;
@@ -1214,7 +1214,7 @@ int isp1020_reset(Scsi_Cmnd *Cmnd, unsigned int reset_flags)
ENTER("isp1020_reset");
- host = Cmnd->host;
+ host = Cmnd->device->host;
hostdata = (struct isp1020_hostdata *) host->hostdata;
param[0] = MBOX_BUS_RESET;
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index d5a6094c9a20..ef553600e24f 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -265,7 +265,7 @@ void scsi_release_request(Scsi_Request * req)
{
if( req->sr_command != NULL )
{
- scsi_release_command(req->sr_command);
+ scsi_put_command(req->sr_command);
req->sr_command = NULL;
}
@@ -371,7 +371,7 @@ busy:
found:
scmnd->request = NULL;
- atomic_inc(&scmnd->host->host_active);
+ atomic_inc(&scmnd->device->host->host_active);
atomic_inc(&scmnd->device->device_active);
scmnd->buffer = NULL;
@@ -398,8 +398,8 @@ found:
spin_unlock_irqrestore(&device_request_lock, flags);
SCSI_LOG_MLQUEUE(5, printk("Activating command for device %d (%d)\n",
- scmnd->target,
- atomic_read(&scmnd->host->host_active)));
+ scmnd->device->id,
+ atomic_read(&scmnd->device->host->host_active)));
return scmnd;
@@ -421,13 +421,13 @@ inline void __scsi_release_command(Scsi_Cmnd * SCpnt)
SCpnt->request = NULL;
SCpnt->state = SCSI_STATE_UNUSED;
SCpnt->owner = SCSI_OWNER_NOBODY;
- atomic_dec(&SCpnt->host->host_active);
+ atomic_dec(&SCpnt->device->host->host_active);
atomic_dec(&SDpnt->device_active);
SCSI_LOG_MLQUEUE(5, printk("Deactivating command for device %d (active=%d, failed=%d)\n",
- SCpnt->target,
- atomic_read(&SCpnt->host->host_active),
- SCpnt->host->host_failed));
+ SCpnt->device->id,
+ atomic_read(&SCpnt->device->host->host_active),
+ SCpnt->device->host->host_failed));
if(SDpnt->current_queue_depth > SDpnt->new_queue_depth) {
Scsi_Cmnd *prev, *next;
@@ -471,11 +471,7 @@ inline void __scsi_release_command(Scsi_Cmnd * SCpnt)
if(newSCpnt) {
memset(newSCpnt, 0, sizeof(Scsi_Cmnd));
init_timer(&newSCpnt->eh_timeout);
- newSCpnt->host = SDpnt->host;
newSCpnt->device = SDpnt;
- newSCpnt->target = SDpnt->id;
- newSCpnt->lun = SDpnt->lun;
- newSCpnt->channel = SDpnt->channel;
newSCpnt->request = NULL;
newSCpnt->use_sg = 0;
newSCpnt->old_use_sg = 0;
@@ -522,7 +518,7 @@ inline void __scsi_release_command(Scsi_Cmnd * SCpnt)
*/
int scsi_mlqueue_insert(Scsi_Cmnd * cmd, int reason)
{
- struct Scsi_Host *host = cmd->host;
+ struct Scsi_Host *host = cmd->device->host;
struct scsi_device *device = cmd->device;
SCSI_LOG_MLQUEUE(1,
@@ -649,7 +645,7 @@ int scsi_dispatch_cmd(Scsi_Cmnd * SCpnt)
#endif
#endif
- host = SCpnt->host;
+ host = SCpnt->device->host;
ASSERT_LOCK(host->host_lock, 0);
@@ -663,7 +659,7 @@ int scsi_dispatch_cmd(Scsi_Cmnd * SCpnt)
*/
if (SCpnt->device->scsi_level <= SCSI_2)
SCpnt->cmnd[1] = (SCpnt->cmnd[1] & 0x1f) |
- (SCpnt->lun << 5 & 0xe0);
+ (SCpnt->device->lun << 5 & 0xe0);
/*
* We will wait MIN_RESET_DELAY clock ticks after the last reset so
@@ -695,7 +691,7 @@ int scsi_dispatch_cmd(Scsi_Cmnd * SCpnt)
*/
SCSI_LOG_MLQUEUE(3, printk("scsi_dispatch_cmnd (host = %d, channel = %d, target = %d, "
"command = %p, buffer = %p, \nbufflen = %d, done = %p)\n",
- SCpnt->host->host_no, SCpnt->channel, SCpnt->target, SCpnt->cmnd,
+ SCpnt->device->host->host_no, SCpnt->device->channel, SCpnt->device->id, SCpnt->cmnd,
SCpnt->buffer, SCpnt->bufflen, SCpnt->done));
SCpnt->state = SCSI_STATE_QUEUED;
@@ -707,7 +703,7 @@ int scsi_dispatch_cmd(Scsi_Cmnd * SCpnt)
* Before we queue this command, check if the command
* length exceeds what the host adapter can handle.
*/
- if (CDB_SIZE(SCpnt) <= SCpnt->host->max_cmd_len) {
+ if (CDB_SIZE(SCpnt) <= SCpnt->device->host->max_cmd_len) {
spin_lock_irqsave(host->host_lock, flags);
rtn = host->hostt->queuecommand(SCpnt, scsi_done);
spin_unlock_irqrestore(host->host_lock, flags);
@@ -772,7 +768,7 @@ void scsi_wait_req (Scsi_Request * SRpnt, const void *cmnd ,
SRpnt->sr_request->waiting = NULL;
if( SRpnt->sr_command != NULL )
{
- scsi_release_command(SRpnt->sr_command);
+ scsi_put_command(SRpnt->sr_command);
SRpnt->sr_command = NULL;
}
@@ -816,12 +812,11 @@ void scsi_do_req(Scsi_Request * SRpnt, const void *cmnd,
SCSI_LOG_MLQUEUE(4,
{
int i;
- int target = SDpnt->id;
int size = COMMAND_SIZE(((const unsigned char *)cmnd)[0]);
printk("scsi_do_req (host = %d, channel = %d target = %d, "
"buffer =%p, bufflen = %d, done = %p, timeout = %d, "
"retries = %d)\n"
- "command : ", host->host_no, SDpnt->channel, target, buffer,
+ "command : ", host->host_no, SDpnt->channel, SDpnt->id, buffer,
bufflen, done, timeout, retries);
for (i = 0; i < size; ++i)
printk("%02x ", ((unsigned char *) cmnd)[i]);
@@ -839,7 +834,7 @@ void scsi_do_req(Scsi_Request * SRpnt, const void *cmnd,
*/
if( SRpnt->sr_command != NULL )
{
- scsi_release_command(SRpnt->sr_command);
+ scsi_put_command(SRpnt->sr_command);
SRpnt->sr_command = NULL;
}
@@ -906,7 +901,7 @@ void scsi_do_req(Scsi_Request * SRpnt, const void *cmnd,
*/
void scsi_init_cmd_from_req(Scsi_Cmnd * SCpnt, Scsi_Request * SRpnt)
{
- struct Scsi_Host *host = SCpnt->host;
+ struct Scsi_Host *host = SCpnt->device->host;
ASSERT_LOCK(host->host_lock, 0);
@@ -995,7 +990,7 @@ void scsi_do_cmd(Scsi_Cmnd * SCpnt, const void *cmnd,
void *buffer, unsigned bufflen, void (*done) (Scsi_Cmnd *),
int timeout, int retries)
{
- struct Scsi_Host *host = SCpnt->host;
+ struct Scsi_Host *host = SCpnt->device->host;
ASSERT_LOCK(host->host_lock, 0);
@@ -1005,12 +1000,12 @@ void scsi_do_cmd(Scsi_Cmnd * SCpnt, const void *cmnd,
SCSI_LOG_MLQUEUE(4,
{
int i;
- int target = SCpnt->target;
int size = COMMAND_SIZE(((const unsigned char *)cmnd)[0]);
printk("scsi_do_cmd (host = %d, channel = %d target = %d, "
"buffer =%p, bufflen = %d, done = %p, timeout = %d, "
"retries = %d)\n"
- "command : ", host->host_no, SCpnt->channel, target, buffer,
+ "command : ", host->host_no, SCpnt->device->channel,
+ SCpnt->device->id, buffer,
bufflen, done, timeout, retries);
for (i = 0; i < size; ++i)
printk("%02x ", ((unsigned char *) cmnd)[i]);
@@ -1180,8 +1175,8 @@ static void scsi_softirq(struct softirq_action *h)
/*
* Add to BH queue.
*/
- SCSI_LOG_MLCOMPLETE(3, printk("Command finished %d %d 0x%x\n", SCpnt->host->host_busy,
- SCpnt->host->host_failed,
+ SCSI_LOG_MLCOMPLETE(3, printk("Command finished %d %d 0x%x\n", SCpnt->device->host->host_busy,
+ SCpnt->device->host->host_failed,
SCpnt->result));
scsi_finish_command(SCpnt);
@@ -1194,8 +1189,8 @@ static void scsi_softirq(struct softirq_action *h)
* track of the number of tries, so we don't
* end up looping, of course.
*/
- SCSI_LOG_MLCOMPLETE(3, printk("Command needs retry %d %d 0x%x\n", SCpnt->host->host_busy,
- SCpnt->host->host_failed, SCpnt->result));
+ SCSI_LOG_MLCOMPLETE(3, printk("Command needs retry %d %d 0x%x\n", SCpnt->device->host->host_busy,
+ SCpnt->device->host->host_failed, SCpnt->result));
scsi_retry_command(SCpnt);
break;
@@ -1221,9 +1216,9 @@ static void scsi_softirq(struct softirq_action *h)
*/
SCSI_LOG_MLCOMPLETE(3, printk("Command failed %p %x active=%d busy=%d failed=%d\n",
SCpnt, SCpnt->result,
- atomic_read(&SCpnt->host->host_active),
- SCpnt->host->host_busy,
- SCpnt->host->host_failed));
+ atomic_read(&SCpnt->device->host->host_active),
+ SCpnt->device->host->host_busy,
+ SCpnt->device->host->host_failed));
/*
* Dump the sense information too.
@@ -1231,12 +1226,12 @@ static void scsi_softirq(struct softirq_action *h)
if ((status_byte(SCpnt->result) & CHECK_CONDITION) != 0) {
SCSI_LOG_MLCOMPLETE(3, print_sense("bh", SCpnt));
}
- if (SCpnt->host->eh_wait != NULL) {
+ if (SCpnt->device->host->eh_wait != NULL) {
scsi_eh_eflags_set(SCpnt, SCSI_EH_CMD_FAILED | SCSI_EH_CMD_ERR);
SCpnt->owner = SCSI_OWNER_ERROR_HANDLER;
SCpnt->state = SCSI_STATE_FAILED;
- scsi_host_failed_inc_and_test(SCpnt->host);
+ scsi_host_failed_inc_and_test(SCpnt->device->host);
} else {
/*
* We only get here if the error
@@ -1288,7 +1283,7 @@ void scsi_finish_command(Scsi_Cmnd * SCpnt)
Scsi_Device *device;
Scsi_Request * SRpnt;
- host = SCpnt->host;
+ host = SCpnt->device->host;
device = SCpnt->device;
ASSERT_LOCK(host->host_lock, 0);
@@ -1409,11 +1404,7 @@ void scsi_build_commandblocks(Scsi_Device * SDpnt)
memset(SCpnt, 0, sizeof(Scsi_Cmnd));
init_timer(&SCpnt->eh_timeout);
- SCpnt->host = SDpnt->host;
SCpnt->device = SDpnt;
- SCpnt->target = SDpnt->id;
- SCpnt->lun = SDpnt->lun;
- SCpnt->channel = SDpnt->channel;
SCpnt->request = NULL;
SCpnt->use_sg = 0;
SCpnt->old_use_sg = 0;
@@ -1515,6 +1506,12 @@ void scsi_adjust_queue_depth(Scsi_Device *SDpnt, int tagged, int tags)
SDpnt->new_queue_depth = tags;
break;
}
+ /* TODO FIXME This is a hack and MUST go eventually.
+ This fixes a problem in scsi_scan.c::scsi_alloc_sdev()
+ else we cannot ever have ANY SCSI devices.
+ */
+ SDpnt->current_queue_depth = 1;
+
spin_unlock_irqrestore(&device_request_lock, flags);
}
@@ -1955,6 +1952,7 @@ int scsi_unregister_device(struct Scsi_Device_Template *tpnt)
{
Scsi_Device *SDpnt;
struct Scsi_Host *shpnt;
+ struct list_head spnt, *prev_spnt;
/*
@@ -2025,6 +2023,14 @@ static int __init init_scsi(void)
{
printk(KERN_INFO "SCSI subsystem driver " REVISION "\n");
+ scsi_core = kmalloc(sizeof(*scsi_core), GFP_KERNEL);
+ if (!scsi_core)
+ goto out_no_mem;
+ memset(scsi_core, 0, sizeof(*scsi_core));
+
+ if (scsi_create_cmdcache(scsi_core))
+ goto out_no_mem;
+
scsi_init_queue();
scsi_init_procfs();
devfs_mk_dir(NULL, "scsi", NULL);
@@ -2033,6 +2039,10 @@ static int __init init_scsi(void)
scsi_sysfs_register();
open_softirq(SCSI_SOFTIRQ, scsi_softirq, NULL);
return 0;
+
+out_no_mem:
+ printk(KERN_CRIT "Couldn't load SCSI Core -- out of memory!\n");
+ return -ENOMEM;
}
static void __exit exit_scsi(void)
@@ -2042,6 +2052,12 @@ static void __exit exit_scsi(void)
devfs_remove("scsi");
scsi_exit_procfs();
scsi_exit_queue();
+
+ scsi_destroy_cmdcache(scsi_core);
+
+ if (scsi_core)
+ kfree(scsi_core);
+ scsi_core = NULL;
}
subsys_initcall(init_scsi);
diff --git a/drivers/scsi/scsi.h b/drivers/scsi/scsi.h
index 64051a69c131..0e47f156821e 100644
--- a/drivers/scsi/scsi.h
+++ b/drivers/scsi/scsi.h
@@ -728,14 +728,14 @@ struct scsi_request {
struct scsi_cmnd {
int sc_magic;
- struct Scsi_Host *host;
+ struct scsi_device *device;
unsigned short state;
unsigned short owner;
- Scsi_Device *device;
Scsi_Request *sc_request;
struct scsi_cmnd *next;
struct scsi_cmnd *reset_chain;
- struct list_head list_entry; /* Used to place us on the cmd lists */
+
+ struct list_head list; /* scsi_cmnd participates in queue lists */
int eh_state; /* Used for state tracking in error handlr */
int eh_eflags; /* Used by error handlr */
@@ -771,9 +771,14 @@ struct scsi_cmnd {
struct scsi_cmnd *bh_next; /* To enumerate the commands waiting
to be processed. */
- unsigned int target;
- unsigned int lun;
- unsigned int channel;
+/* OBSOLETE, please do not use -- obosolete stuff. */
+/* Use cmd->device->{id, channel, lun} instead */
+/* unsigned int target; */
+/* unsigned int lun; */
+/* unsigned int channel; */
+/* OBSOLETE, use cmd->device->host instead */
+/* struct Scsi_Host *host; */
+
unsigned char cmd_len;
unsigned char old_cmd_len;
unsigned char sc_data_direction;
@@ -990,4 +995,45 @@ extern void scsi_device_unregister(struct scsi_device *);
extern int scsi_sysfs_register(void);
extern void scsi_sysfs_unregister(void);
+/* -------------------------------------------------- */
+/* data decl: */
+
+/* All the SCSI Core specific global data, etc,
+ should go in here.
+*/
+
+struct scsi_core_data {
+ kmem_cache_t *scsi_cmd_cache;
+ kmem_cache_t *scsi_cmd_dma_cache;
+};
+
+extern struct scsi_core_data *scsi_core;
+
+/* -------------------------------------------------- */
+/* fn decl: */
+
+int scsi_create_cmdcache(struct scsi_core_data *scsi_core);
+int scsi_destroy_cmdcache(struct scsi_core_data *scsi_core);
+
+struct scsi_cmnd * scsi_get_command(struct Scsi_Host *host, int alloc_flags);
+void scsi_put_command(struct scsi_cmnd *cmd);
+void scsi_setup_command(struct scsi_device *dev, struct scsi_cmnd *cmd);
+
+/* -------------------------------------------------- */
+/* inline funcs: */
+
+/* scsi_getset_command: allocate, set and return a command struct,
+ when the device is known.
+*/
+static inline struct scsi_cmnd *scsi_getset_command(struct scsi_device *dev,
+ int flags)
+{
+ struct scsi_cmnd *cmd;
+
+ if (!dev) return NULL;
+ if (!dev->host) return NULL;
+ scsi_setup_command(dev, (cmd = scsi_get_command(dev->host, flags)));
+ return cmd;
+}
+
#endif
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index c16ed84d9f81..e16e70bcad90 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -217,7 +217,7 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done)
int block, upper_blk, num;
unsigned char *buff;
int errsts = 0;
- int target = SCpnt->target;
+ int target = SCpnt->device->id;
int bufflen = SCpnt->request_bufflen;
unsigned long capac;
struct sdebug_dev_info * devip = NULL;
@@ -247,7 +247,7 @@ int scsi_debug_queuecommand(struct scsi_cmnd * SCpnt, done_funct_t done)
return schedule_resp(SCpnt, NULL, done, 0, 0);
}
- if (SCpnt->lun >= scsi_debug_max_luns)
+ if (SCpnt->device->lun >= scsi_debug_max_luns)
return schedule_resp(SCpnt, NULL, done,
DID_NO_CONNECT << 16, 0);
devip = devInfoReg(SCpnt);
@@ -868,19 +868,19 @@ static struct sdebug_dev_info * devInfoReg(struct scsi_cmnd *scmd)
return devip;
for (k = 0; k < scsi_debug_num_devs; ++k) {
devip = &devInfop[k];
- if ((devip->channel == scmd->channel) &&
- (devip->target == scmd->target) &&
- (devip->lun == scmd->lun) &&
- (devip->host == scmd->host))
+ if ((devip->channel == scmd->device->channel) &&
+ (devip->target == scmd->device->id) &&
+ (devip->lun == scmd->device->lun) &&
+ (devip->host == scmd->device->host))
return devip;
}
for (k = 0; k < scsi_debug_num_devs; ++k) {
devip = &devInfop[k];
if (!devip->used) {
- devip->channel = scmd->channel;
- devip->target = scmd->target;
- devip->lun = scmd->lun;
- devip->host = scmd->host;
+ devip->channel = scmd->device->channel;
+ devip->target = scmd->device->id;
+ devip->lun = scmd->device->lun;
+ devip->host = scmd->device->host;
devip->reset = 1;
devip->used = 1;
memset(devip->sense_buff, 0, SDEBUG_SENSE_LEN);
@@ -962,7 +962,7 @@ static int scsi_debug_bus_reset(struct scsi_cmnd * SCpnt)
if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
printk(KERN_INFO "scsi_debug: bus_reset\n");
++num_bus_resets;
- if (SCpnt && ((sdp = SCpnt->device)) && ((hp = SCpnt->host))) {
+ if (SCpnt && ((sdp = SCpnt->device)) && ((hp = SCpnt->device->host))) {
for (k = 0; k < scsi_debug_num_devs; ++k) {
if (hp == devInfop[k].host)
devInfop[k].reset = 1;
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index fb594344a7fd..bef0602ef98a 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -136,18 +136,18 @@ void scsi_times_out(Scsi_Cmnd *scmd)
scsi_eh_eflags_set(scmd, SCSI_EH_CMD_TIMEOUT | SCSI_EH_CMD_ERR);
- if( scmd->host->eh_wait == NULL ) {
+ if( scmd->device->host->eh_wait == NULL ) {
panic("Error handler thread not present at %p %p %s %d",
- scmd, scmd->host, __FILE__, __LINE__);
+ scmd, scmd->device->host, __FILE__, __LINE__);
}
- scsi_host_failed_inc_and_test(scmd->host);
+ scsi_host_failed_inc_and_test(scmd->device->host);
SCSI_LOG_TIMEOUT(3, printk("Command timed out active=%d busy=%d "
" failed=%d\n",
- atomic_read(&scmd->host->host_active),
- scmd->host->host_busy,
- scmd->host->host_failed));
+ atomic_read(&scmd->device->host->host_active),
+ scmd->device->host->host_busy,
+ scmd->device->host->host_failed));
}
/**
@@ -263,7 +263,7 @@ static void scsi_eh_get_failed(Scsi_Cmnd **sc_list, struct Scsi_Host *shost)
" cmds still active"
" (%p %x %d)\n",
scmd, scmd->state,
- scmd->target));
+ scmd->device->id));
}
}
}
@@ -426,8 +426,8 @@ static void scsi_eh_times_out(Scsi_Cmnd *scmd)
SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd:%p\n", __FUNCTION__,
scmd));
- if (scmd->host->eh_action != NULL)
- up(scmd->host->eh_action);
+ if (scmd->device->host->eh_action != NULL)
+ up(scmd->device->host->eh_action);
else
printk("%s: eh_action NULL\n", __FUNCTION__);
}
@@ -458,8 +458,8 @@ static void scsi_eh_done(Scsi_Cmnd *scmd)
SCSI_LOG_ERROR_RECOVERY(3, printk("%s scmd: %p result: %x\n",
__FUNCTION__, scmd, scmd->result));
- if (scmd->host->eh_action != NULL)
- up(scmd->host->eh_action);
+ if (scmd->device->host->eh_action != NULL)
+ up(scmd->device->host->eh_action);
}
/**
@@ -477,7 +477,7 @@ static void scsi_eh_done(Scsi_Cmnd *scmd)
static int scsi_send_eh_cmnd(Scsi_Cmnd *scmd, int timeout)
{
unsigned long flags;
- struct Scsi_Host *host = scmd->host;
+ struct Scsi_Host *host = scmd->device->host;
int rtn = SUCCESS;
ASSERT_LOCK(host->host_lock, 0);
@@ -490,7 +490,7 @@ static int scsi_send_eh_cmnd(Scsi_Cmnd *scmd, int timeout)
if (scmd->device->scsi_level <= SCSI_2)
scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) |
- (scmd->lun << 5 & 0xe0);
+ (scmd->device->lun << 5 & 0xe0);
if (host->can_queue) {
DECLARE_MUTEX_LOCKED(sem);
@@ -500,16 +500,16 @@ static int scsi_send_eh_cmnd(Scsi_Cmnd *scmd, int timeout)
/*
* set up the semaphore so we wait for the command to complete.
*/
- scmd->host->eh_action = &sem;
+ scmd->device->host->eh_action = &sem;
scmd->request->rq_status = RQ_SCSI_BUSY;
- spin_lock_irqsave(scmd->host->host_lock, flags);
+ spin_lock_irqsave(scmd->device->host->host_lock, flags);
host->hostt->queuecommand(scmd, scsi_eh_done);
- spin_unlock_irqrestore(scmd->host->host_lock, flags);
+ spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
down(&sem);
- scmd->host->eh_action = NULL;
+ scmd->device->host->eh_action = NULL;
/*
* see if timeout. if so, tell the host to forget about it.
@@ -529,10 +529,10 @@ static int scsi_send_eh_cmnd(Scsi_Cmnd *scmd, int timeout)
* abort a timed out command or not. not sure how
* we should treat them differently anyways.
*/
- spin_lock_irqsave(scmd->host->host_lock, flags);
- if (scmd->host->hostt->eh_abort_handler)
- scmd->host->hostt->eh_abort_handler(scmd);
- spin_unlock_irqrestore(scmd->host->host_lock, flags);
+ spin_lock_irqsave(scmd->device->host->host_lock, flags);
+ if (scmd->device->host->hostt->eh_abort_handler)
+ scmd->device->host->hostt->eh_abort_handler(scmd);
+ spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
scmd->request->rq_status = RQ_SCSI_DONE;
scmd->owner = SCSI_OWNER_ERROR_HANDLER;
@@ -600,7 +600,7 @@ static int scsi_request_sense(Scsi_Cmnd *scmd)
memcpy((void *) scmd->cmnd, (void *) generic_sense,
sizeof(generic_sense));
- scsi_result = (!scmd->host->hostt->unchecked_isa_dma)
+ scsi_result = (!scmd->device->host->hostt->unchecked_isa_dma)
? &scsi_result0[0] : kmalloc(512, GFP_ATOMIC | GFP_DMA);
if (scsi_result == NULL) {
@@ -732,7 +732,7 @@ static int scsi_eh_get_sense(Scsi_Cmnd *sc_todo, struct Scsi_Host *shost)
SCSI_LOG_ERROR_RECOVERY(2, printk("%s: requesting sense"
" for tgt: %d\n",
- __FUNCTION__, scmd->target));
+ __FUNCTION__, scmd->device->id));
rtn = scsi_request_sense(scmd);
if (rtn != SUCCESS)
continue;
@@ -790,7 +790,7 @@ static int scsi_try_to_abort_cmd(Scsi_Cmnd *scmd)
int rtn = FAILED;
unsigned long flags;
- if (scmd->host->hostt->eh_abort_handler == NULL) {
+ if (scmd->device->host->hostt->eh_abort_handler == NULL) {
return rtn;
}
/*
@@ -802,9 +802,9 @@ static int scsi_try_to_abort_cmd(Scsi_Cmnd *scmd)
scmd->owner = SCSI_OWNER_LOWLEVEL;
- spin_lock_irqsave(scmd->host->host_lock, flags);
- rtn = scmd->host->hostt->eh_abort_handler(scmd);
- spin_unlock_irqrestore(scmd->host->host_lock, flags);
+ spin_lock_irqsave(scmd->device->host->host_lock, flags);
+ rtn = scmd->device->host->hostt->eh_abort_handler(scmd);
+ spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
return rtn;
}
@@ -912,14 +912,14 @@ static int scsi_try_bus_device_reset(Scsi_Cmnd *scmd)
unsigned long flags;
int rtn = FAILED;
- if (scmd->host->hostt->eh_device_reset_handler == NULL) {
+ if (scmd->device->host->hostt->eh_device_reset_handler == NULL) {
return rtn;
}
scmd->owner = SCSI_OWNER_LOWLEVEL;
- spin_lock_irqsave(scmd->host->host_lock, flags);
- rtn = scmd->host->hostt->eh_device_reset_handler(scmd);
- spin_unlock_irqrestore(scmd->host->host_lock, flags);
+ spin_lock_irqsave(scmd->device->host->host_lock, flags);
+ rtn = scmd->device->host->hostt->eh_device_reset_handler(scmd);
+ spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
if (rtn == SUCCESS) {
scmd->device->was_reset = 1;
@@ -990,20 +990,20 @@ static int scsi_try_bus_reset(Scsi_Cmnd *scmd)
scmd->owner = SCSI_OWNER_LOWLEVEL;
scmd->serial_number_at_timeout = scmd->serial_number;
- if (scmd->host->hostt->eh_bus_reset_handler == NULL)
+ if (scmd->device->host->hostt->eh_bus_reset_handler == NULL)
return FAILED;
- spin_lock_irqsave(scmd->host->host_lock, flags);
- rtn = scmd->host->hostt->eh_bus_reset_handler(scmd);
- spin_unlock_irqrestore(scmd->host->host_lock, flags);
+ spin_lock_irqsave(scmd->device->host->host_lock, flags);
+ rtn = scmd->device->host->hostt->eh_bus_reset_handler(scmd);
+ spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
if (rtn == SUCCESS) {
scsi_sleep(BUS_RESET_SETTLE_TIME);
/*
* Mark all affected devices to expect a unit attention.
*/
- list_for_each_entry(sdev, &scmd->host->my_devices, siblings)
- if (scmd->channel == sdev->channel) {
+ list_for_each_entry(sdev, &scmd->device->host->my_devices, siblings)
+ if (scmd->device->channel == sdev->channel) {
sdev->was_reset = 1;
sdev->expecting_cc_ua = 1;
}
@@ -1026,20 +1026,20 @@ static int scsi_try_host_reset(Scsi_Cmnd *scmd)
scmd->owner = SCSI_OWNER_LOWLEVEL;
scmd->serial_number_at_timeout = scmd->serial_number;
- if (scmd->host->hostt->eh_host_reset_handler == NULL)
+ if (scmd->device->host->hostt->eh_host_reset_handler == NULL)
return FAILED;
- spin_lock_irqsave(scmd->host->host_lock, flags);
- rtn = scmd->host->hostt->eh_host_reset_handler(scmd);
- spin_unlock_irqrestore(scmd->host->host_lock, flags);
+ spin_lock_irqsave(scmd->device->host->host_lock, flags);
+ rtn = scmd->device->host->hostt->eh_host_reset_handler(scmd);
+ spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
if (rtn == SUCCESS) {
scsi_sleep(HOST_RESET_SETTLE_TIME);
/*
* Mark all affected devices to expect a unit attention.
*/
- list_for_each_entry(sdev, &scmd->host->my_devices, siblings)
- if (scmd->channel == sdev->channel) {
+ list_for_each_entry(sdev, &scmd->device->host->my_devices, siblings)
+ if (scmd->device->channel == sdev->channel) {
sdev->was_reset = 1;
sdev->expecting_cc_ua = 1;
}
@@ -1078,7 +1078,7 @@ static int scsi_eh_bus_host_reset(Scsi_Cmnd *sc_todo, struct Scsi_Host *shost)
for (scmd = sc_todo; scmd; scmd = scmd->bh_next) {
if (!scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_ERR))
continue;
- if (channel == scmd->channel) {
+ if (channel == scmd->device->channel) {
chan_scmd = scmd;
break;
/*
@@ -1102,7 +1102,7 @@ static int scsi_eh_bus_host_reset(Scsi_Cmnd *sc_todo, struct Scsi_Host *shost)
if (rtn == SUCCESS) {
for (scmd = sc_todo; scmd; scmd = scmd->bh_next) {
if (!scsi_eh_eflags_chk(scmd, SCSI_EH_CMD_ERR)
- || channel != scmd->channel)
+ || channel != scmd->device->channel)
continue;
if (!scsi_eh_tur(scmd)) {
rtn = scsi_eh_retry_cmd(scmd);
@@ -1335,7 +1335,7 @@ int scsi_decide_disposition(Scsi_Cmnd *scmd)
case RESERVATION_CONFLICT:
printk("scsi%d (%d,%d,%d) : reservation conflict\n",
- scmd->host->host_no, scmd->channel,
+ scmd->device->host->host_no, scmd->device->channel,
scmd->device->id, scmd->device->lun);
return SUCCESS; /* causes immediate i/o error */
default:
@@ -1371,7 +1371,7 @@ static void scsi_eh_lock_done(struct scsi_cmnd *scmd)
scmd->sc_request = NULL;
sreq->sr_command = NULL;
- scsi_release_command(scmd);
+ scsi_put_command(scmd);
scsi_release_request(sreq);
}
@@ -1745,11 +1745,7 @@ scsi_reset_provider(Scsi_Device *dev, int flag)
SCpnt->request = &req;
memset(&SCpnt->eh_timeout, 0, sizeof(SCpnt->eh_timeout));
- SCpnt->host = dev->host;
SCpnt->device = dev;
- SCpnt->target = dev->id;
- SCpnt->lun = dev->lun;
- SCpnt->channel = dev->channel;
SCpnt->request->rq_status = RQ_SCSI_BUSY;
SCpnt->request->waiting = NULL;
SCpnt->use_sg = 0;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index e1dccd6f0e53..7e2e6385d885 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -33,7 +33,9 @@ struct scsi_host_sg_pool {
struct scsi_host_sg_pool scsi_sg_pools[SG_MEMPOOL_NR] = {
SP(8), SP(16), SP(32), SP(64), SP(MAX_PHYS_SEGMENTS)
};
-#undef SP
+#undef SP
+
+struct scsi_core_data *scsi_core;
/*
* Function: scsi_insert_special_cmd()
@@ -357,7 +359,7 @@ static Scsi_Cmnd *scsi_end_request(Scsi_Cmnd * SCpnt,
* This will goose the queue request function at the end, so we don't
* need to worry about launching another command.
*/
- __scsi_release_command(SCpnt);
+ scsi_put_command(SCpnt);
scsi_queue_next_request(q, NULL);
return NULL;
}
@@ -428,7 +430,7 @@ static void scsi_release_buffers(Scsi_Cmnd * SCpnt)
{
struct request *req = SCpnt->request;
- ASSERT_LOCK(SCpnt->host->host_lock, 0);
+ ASSERT_LOCK(SCpnt->device->host->host_lock, 0);
/*
* Free up any indirection buffers we allocated for DMA purposes.
@@ -667,8 +669,8 @@ void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
case MEDIUM_ERROR:
case VOLUME_OVERFLOW:
printk("scsi%d: ERROR on channel %d, id %d, lun %d, CDB: ",
- SCpnt->host->host_no, (int) SCpnt->channel,
- (int) SCpnt->target, (int) SCpnt->lun);
+ SCpnt->device->host->host_no, (int) SCpnt->device->channel,
+ (int) SCpnt->device->id, (int) SCpnt->device->lun);
print_command(SCpnt->data_cmnd);
print_sense("sd", SCpnt);
SCpnt = scsi_end_request(SCpnt, 0, block_sectors, 1);
@@ -816,7 +818,8 @@ int scsi_prep_fn(struct request_queue *q, struct request *req)
SRpnt = (Scsi_Request *) req->special;
if( SRpnt->sr_magic == SCSI_REQ_MAGIC ) {
- SCpnt = scsi_allocate_device(SRpnt->sr_device, 0);
+ SCpnt = scsi_getset_command(SRpnt->sr_device,
+ GFP_ATOMIC);
if (!SCpnt)
return BLKPREP_DEFER;
scsi_init_cmd_from_req(SCpnt, SRpnt);
@@ -829,7 +832,7 @@ int scsi_prep_fn(struct request_queue *q, struct request *req)
if (req->special) {
SCpnt = (Scsi_Cmnd *) req->special;
} else {
- SCpnt = scsi_allocate_device(SDpnt, 0);
+ SCpnt = scsi_getset_command(SDpnt, GFP_ATOMIC);
}
/*
* if command allocation failure, wait a bit
@@ -1193,3 +1196,143 @@ void __exit scsi_exit_queue(void)
kmem_cache_destroy(sgp->slab);
}
}
+
+/* -------------------------------------------------- */
+
+int scsi_create_cmdcache(struct scsi_core_data *scsi_core)
+{
+ if (!scsi_core)
+ return -EFAULT;
+
+ scsi_core->scsi_cmd_cache
+ = kmem_cache_create("scsi_cmd_cache",
+ sizeof(struct scsi_cmnd), 0,
+ SLAB_NO_REAP|SLAB_HWCACHE_ALIGN,NULL,NULL);
+ if (!scsi_core->scsi_cmd_cache)
+ return -ENOMEM;
+
+ scsi_core->scsi_cmd_dma_cache
+ = kmem_cache_create("scsi_cmd_cache(DMA)",
+ sizeof(struct scsi_cmnd), 0,
+ SLAB_NO_REAP|SLAB_HWCACHE_ALIGN
+ |SLAB_CACHE_DMA,
+ NULL,NULL);
+ if (!scsi_core->scsi_cmd_dma_cache) {
+ scsi_destroy_cmdcache(scsi_core);
+ return -ENOMEM;
+ }
+ return 0;
+} /* end scsi_create_cmdcache() */
+
+/* -------------------------------------------------- */
+
+int scsi_destroy_cmdcache(struct scsi_core_data *scsi_core)
+{
+ if (!scsi_core)
+ return -EFAULT;
+
+ if (scsi_core->scsi_cmd_cache &&
+ kmem_cache_destroy(scsi_core->scsi_cmd_cache)) {
+ goto bail;
+ } else {
+ scsi_core->scsi_cmd_cache = NULL;
+ }
+
+ if (scsi_core->scsi_cmd_dma_cache &&
+ kmem_cache_destroy(scsi_core->scsi_cmd_dma_cache)) {
+ goto bail;
+ } else {
+ scsi_core->scsi_cmd_dma_cache = NULL;
+ }
+
+ return 0;
+bail:
+ printk(KERN_CRIT "Failed to free scsi command cache"
+ " -- memory leak\n");
+ return -EFAULT;
+} /* end scsi_destroy_cmdcache() */
+
+/* -------------------------------------------------- */
+
+struct scsi_cmnd * scsi_get_command(struct Scsi_Host *host, int alloc_flags)
+{
+ unsigned long flags;
+ struct scsi_cmnd *cmd = NULL;
+
+ if (!host)
+ return NULL;
+
+ if (host->unchecked_isa_dma) {
+ cmd = kmem_cache_alloc(scsi_core->scsi_cmd_dma_cache,
+ alloc_flags);
+ } else {
+ cmd = kmem_cache_alloc(scsi_core->scsi_cmd_cache, alloc_flags);
+ }
+
+ if (!cmd) {
+ spin_lock_irqsave(&host->free_list_lock, flags);
+ if (!list_empty(&host->free_list)) {
+ cmd = list_entry(host->free_list.next,
+ struct scsi_cmnd, list);
+ list_del_init(&cmd->list);
+ }
+ spin_unlock_irqrestore(&host->free_list_lock, flags);
+ }
+
+ return cmd;
+} /* end scsi_get_command() */
+
+/* -------------------------------------------------- */
+/* scsi_put_command: free a scsi_cmnd struct.
+ Note: the command must not belong to any lists!
+*/
+void scsi_put_command(struct scsi_cmnd *cmd)
+{
+ unsigned long flags;
+ struct Scsi_Host *host;
+
+ if (!cmd)
+ return;
+
+ if (!cmd->device || !cmd->device->host) {
+ printk(KERN_NOTICE "Trying to free a command which"
+ " doesn't belong to scsi core?!\n");
+ /* Memory leak, but let the system survive for now --
+ they'll get it eventually! */
+ return;
+ }
+
+ host = cmd->device->host;
+
+ spin_lock_irqsave(&host->free_list_lock, flags);
+ if (list_empty(&host->free_list)) {
+ list_add(&cmd->list, &host->free_list);
+ cmd = NULL;
+ }
+ spin_unlock_irqrestore(&host->free_list_lock, flags);
+
+ if (cmd) {
+ if (host->unchecked_isa_dma)
+ kmem_cache_free(scsi_core->scsi_cmd_dma_cache, cmd);
+ else
+ kmem_cache_free(scsi_core->scsi_cmd_cache, cmd);
+ }
+} /* end scsi_put_command() */
+
+/* -------------------------------------------------- */
+/* scsi_setup_command: This will do post-alloc init of the command.
+ We want to do as little as possible here.
+*/
+void scsi_setup_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
+{
+ if (!cmd)
+ return;
+ memset(cmd, 0, sizeof(*cmd));
+ cmd->device = dev;
+ cmd->state = SCSI_STATE_UNUSED;
+ cmd->owner = SCSI_OWNER_NOBODY;
+ init_timer(&cmd->eh_timeout);
+ INIT_LIST_HEAD(&cmd->list);
+} /* end scsi_setup_command() */
+
+/* -------------------------------------------------- */
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 32633ef06367..bbc31dcfe191 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -365,10 +365,10 @@ static void scsi_dump_status(int level)
printk(KERN_INFO "(%3d) %2d:%1d:%2d:%2d (%6s %4llu %4ld %4ld %4x %1d) (%1d %1d 0x%2x) (%4d %4d %4d) 0x%2.2x 0x%2.2x 0x%8.8x\n",
i++,
- SCpnt->host->host_no,
- SCpnt->channel,
- SCpnt->target,
- SCpnt->lun,
+ SCpnt->device->host->host_no,
+ SCpnt->device->channel,
+ SCpnt->device->id,
+ SCpnt->device->lun,
SCpnt->request->rq_disk ?
SCpnt->request->rq_disk->disk_name : "?",
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index bf7d388a0b3b..ea5ab1d4d900 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -471,7 +471,6 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
sdev->request_queue->queuedata = sdev;
scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
- scsi_build_commandblocks(sdev);
if (sdev->current_queue_depth == 0) {
goto out_bail;
}
@@ -515,7 +514,6 @@ out_bail:
} else if (sdev->request_queue)
scsi_free_queue(sdev->request_queue);
- scsi_release_commandblocks(sdev);
kfree(sdev);
return NULL;
}
@@ -535,7 +533,6 @@ static void scsi_free_sdev(struct scsi_device *sdev)
if (sdev->request_queue)
scsi_free_queue(sdev->request_queue);
- scsi_release_commandblocks(sdev);
if (sdev->host->hostt->slave_destroy)
sdev->host->hostt->slave_destroy(sdev);
if (sdev->inquiry)
diff --git a/drivers/scsi/scsi_syms.c b/drivers/scsi/scsi_syms.c
index c3f938e2a99c..1b2ee3cb436b 100644
--- a/drivers/scsi/scsi_syms.c
+++ b/drivers/scsi/scsi_syms.c
@@ -39,7 +39,6 @@ EXPORT_SYMBOL(scsi_unregister);
EXPORT_SYMBOL(scsicam_bios_param);
EXPORT_SYMBOL(scsi_partsize);
EXPORT_SYMBOL(scsi_bios_ptable);
-EXPORT_SYMBOL(scsi_allocate_device);
EXPORT_SYMBOL(scsi_do_cmd);
EXPORT_SYMBOL(scsi_ioctl);
EXPORT_SYMBOL(print_command);
@@ -50,7 +49,6 @@ EXPORT_SYMBOL(print_status);
EXPORT_SYMBOL(scsi_sense_key_string);
EXPORT_SYMBOL(scsi_extd_sense_format);
EXPORT_SYMBOL(kernel_scsi_ioctl);
-EXPORT_SYMBOL(scsi_release_command);
EXPORT_SYMBOL(print_Scsi_Cmnd);
EXPORT_SYMBOL(scsi_block_when_processing_errors);
EXPORT_SYMBOL(scsi_ioctl_send_command);
@@ -114,3 +112,8 @@ EXPORT_SYMBOL(scsi_delete_timer);
* sysfs support
*/
EXPORT_SYMBOL(shost_devclass);
+
+EXPORT_SYMBOL(scsi_get_command);
+EXPORT_SYMBOL(scsi_put_command);
+EXPORT_SYMBOL(scsi_setup_command);
+
diff --git a/drivers/scsi/scsiiom.c b/drivers/scsi/scsiiom.c
index 24a7e0c38017..1d5a16dc232e 100644
--- a/drivers/scsi/scsiiom.c
+++ b/drivers/scsi/scsiiom.c
@@ -1591,15 +1591,15 @@ ckc_e:
//dc390_Going_remove (pDCB, pSRB);
dc390_remove_dev (pACB, pDCB); DCB_removed = 1;
- if( (pcmd->target == pACB->pScsiHost->max_id - 1) &&
- ((pcmd->lun == 0) || (pcmd->lun == pACB->pScsiHost->max_lun - 1)) )
+ if( (pcmd->device->id == pACB->pScsiHost->max_id - 1) &&
+ ((pcmd->device->lun == 0) || (pcmd->device->lun == pACB->pScsiHost->max_lun - 1)) )
pACB->scan_devices = 0;
}
else
{
/* device present: add */
- if( (pcmd->target == pACB->pScsiHost->max_id - 1) &&
- (pcmd->lun == pACB->pScsiHost->max_lun - 1) )
+ if( (pcmd->device->id == pACB->pScsiHost->max_id - 1) &&
+ (pcmd->device->lun == pACB->pScsiHost->max_lun - 1) )
pACB->scan_devices = END_SCAN ;
/* pACB->DeviceCnt++; */ /* Dev is added on INQUIRY */
}
@@ -1624,8 +1624,8 @@ ckc_e:
dc390_add_dev (pACB, pDCB, ptr);
if (pACB->scan_devices) pACB->DeviceCnt++;
}
- if( (pcmd->target == pACB->pScsiHost->max_id - 1) &&
- (pcmd->lun == pACB->pScsiHost->max_lun - 1) )
+ if( (pcmd->device->id == pACB->pScsiHost->max_id - 1) &&
+ (pcmd->device->lun == pACB->pScsiHost->max_lun - 1) )
pACB->scan_devices = 0;
};
diff --git a/drivers/scsi/sym53c8xx.c b/drivers/scsi/sym53c8xx.c
index ddd1987d0d15..384812180bb4 100644
--- a/drivers/scsi/sym53c8xx.c
+++ b/drivers/scsi/sym53c8xx.c
@@ -4735,8 +4735,8 @@ static void PRINT_LUN(ncb_p np, int target, int lun)
static void PRINT_ADDR(Scsi_Cmnd *cmd)
{
- struct host_data *host_data = (struct host_data *) cmd->host->hostdata;
- PRINT_LUN(host_data->ncb, cmd->target, cmd->lun);
+ struct host_data *host_data = (struct host_data *) cmd->device->host->hostdata;
+ PRINT_LUN(host_data->ncb, cmd->device->id, cmd->device->lun);
}
/*==========================================================
@@ -6505,8 +6505,8 @@ static int ncr_prepare_nego(ncb_p np, ccb_p cp, u_char *msgptr)
static int ncr_queue_command (ncb_p np, Scsi_Cmnd *cmd)
{
/* Scsi_Device *device = cmd->device; */
- tcb_p tp = &np->target[cmd->target];
- lcb_p lp = ncr_lp(np, tp, cmd->lun);
+ tcb_p tp = &np->target[cmd->device->id];
+ lcb_p lp = ncr_lp(np, tp, cmd->device->lun);
ccb_p cp;
u_char idmsg, *msgptr;
@@ -6520,9 +6520,9 @@ static int ncr_queue_command (ncb_p np, Scsi_Cmnd *cmd)
**
**---------------------------------------------
*/
- if ((cmd->target == np->myaddr ) ||
- (cmd->target >= MAX_TARGET) ||
- (cmd->lun >= MAX_LUN )) {
+ if ((cmd->device->id == np->myaddr ) ||
+ (cmd->device->id >= MAX_TARGET) ||
+ (cmd->device->lun >= MAX_LUN )) {
return(DID_BAD_TARGET);
}
@@ -6562,7 +6562,7 @@ static int ncr_queue_command (ncb_p np, Scsi_Cmnd *cmd)
np->settle_time = tlimit;
}
- if (np->settle_time || !(cp=ncr_get_ccb (np, cmd->target, cmd->lun))) {
+ if (np->settle_time || !(cp=ncr_get_ccb (np, cmd->device->id, cmd->device->lun))) {
insert_into_waiting_list(np, cmd);
return(DID_OK);
}
@@ -13592,7 +13592,7 @@ const char *sym53c8xx_info (struct Scsi_Host *host)
int sym53c8xx_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
{
- ncb_p np = ((struct host_data *) cmd->host->hostdata)->ncb;
+ ncb_p np = ((struct host_data *) cmd->device->host->hostdata)->ncb;
unsigned long flags;
int sts;
@@ -13661,9 +13661,9 @@ static void sym53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs)
if (DEBUG_FLAGS & DEBUG_TINY) printk ("]\n");
if (done_list) {
- NCR_LOCK_SCSI_DONE(done_list->host, flags);
+ NCR_LOCK_SCSI_DONE(done_list->device->host, flags);
ncr_flush_done_cmds(done_list);
- NCR_UNLOCK_SCSI_DONE(done_list->host, flags);
+ NCR_UNLOCK_SCSI_DONE(done_list->device->host, flags);
}
}
@@ -13684,9 +13684,9 @@ static void sym53c8xx_timeout(unsigned long npref)
NCR_UNLOCK_NCB(np, flags);
if (done_list) {
- NCR_LOCK_SCSI_DONE(done_list->host, flags);
+ NCR_LOCK_SCSI_DONE(done_list->device->host, flags);
ncr_flush_done_cmds(done_list);
- NCR_UNLOCK_SCSI_DONE(done_list->host, flags);
+ NCR_UNLOCK_SCSI_DONE(done_list->device->host, flags);
}
}
@@ -13700,7 +13700,7 @@ int sym53c8xx_reset(Scsi_Cmnd *cmd, unsigned int reset_flags)
int sym53c8xx_reset(Scsi_Cmnd *cmd)
#endif
{
- ncb_p np = ((struct host_data *) cmd->host->hostdata)->ncb;
+ ncb_p np = ((struct host_data *) cmd->device->host->hostdata)->ncb;
int sts;
unsigned long flags;
Scsi_Cmnd *done_list;
@@ -13762,7 +13762,7 @@ out:
int sym53c8xx_abort(Scsi_Cmnd *cmd)
{
- ncb_p np = ((struct host_data *) cmd->host->hostdata)->ncb;
+ ncb_p np = ((struct host_data *) cmd->device->host->hostdata)->ncb;
int sts;
unsigned long flags;
Scsi_Cmnd *done_list;
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index c1bde6b10bd3..0356142db1aa 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -330,7 +330,7 @@ typedef struct sym_ucmd *ucmd_p;
#define SYM_UCMD_PTR(cmd) ((ucmd_p)(&(cmd)->SCp))
#define SYM_SCMD_PTR(ucmd) sym_que_entry(ucmd, Scsi_Cmnd, SCp)
-#define SYM_SOFTC_PTR(cmd) (((struct host_data *)cmd->host->hostdata)->ncb)
+#define SYM_SOFTC_PTR(cmd) (((struct host_data *)cmd->device->host->hostdata)->ncb)
/*
* Deal with DMA mapping/unmapping.
@@ -467,7 +467,7 @@ void sym_print_addr (ccb_p cp)
Scsi_Cmnd *cmd = cp->cam_ccb;
if (cmd)
printf("%s:%d:%d:", sym_name(SYM_SOFTC_PTR(cmd)),
- cmd->target,cmd->lun);
+ cmd->device->id,cmd->device->lun);
}
/*
@@ -603,13 +603,13 @@ void sym_sniff_inquiry(hcb_p np, Scsi_Cmnd *cmd, int resid)
return;
sync_scsi_data(np, cmd);
- retv = __sym_sniff_inquiry(np, cmd->target, cmd->lun,
+ retv = __sym_sniff_inquiry(np, cmd->device->id, cmd->device->lun,
(u_char *) cmd->request_buffer,
cmd->request_bufflen - resid);
if (retv < 0)
return;
else if (retv)
- sym_update_trans_settings(np, &np->target[cmd->target]);
+ sym_update_trans_settings(np, &np->target[cmd->device->id]);
}
/*
@@ -687,9 +687,9 @@ static int sym_queue_command(hcb_p np, Scsi_Cmnd *ccb)
* Minimal checkings, so that we will not
* go outside our tables.
*/
- if (ccb->target == np->myaddr ||
- ccb->target >= SYM_CONF_MAX_TARGET ||
- ccb->lun >= SYM_CONF_MAX_LUN) {
+ if (ccb->device->id == np->myaddr ||
+ ccb->device->id >= SYM_CONF_MAX_TARGET ||
+ ccb->device->lun >= SYM_CONF_MAX_LUN) {
sym_xpt_done2(np, ccb, CAM_DEV_NOT_THERE);
return 0;
}
@@ -697,7 +697,7 @@ static int sym_queue_command(hcb_p np, Scsi_Cmnd *ccb)
/*
* Retreive the target descriptor.
*/
- tp = &np->target[ccb->target];
+ tp = &np->target[ccb->device->id];
/*
* Complete the 1st INQUIRY command with error
@@ -714,7 +714,7 @@ static int sym_queue_command(hcb_p np, Scsi_Cmnd *ccb)
if (ccb->cmnd[0] == 0x12 || ccb->cmnd[0] == 0x0) {
if ((tp->usrflags & SYM_SCAN_BOOT_DISABLED) ||
((tp->usrflags & SYM_SCAN_LUNS_DISABLED) &&
- ccb->lun != 0)) {
+ ccb->device->lun != 0)) {
tp->usrflags &= ~SYM_SCAN_BOOT_DISABLED;
sym_xpt_done2(np, ccb, CAM_DEV_NOT_THERE);
return 0;
@@ -724,13 +724,13 @@ static int sym_queue_command(hcb_p np, Scsi_Cmnd *ccb)
/*
* Select tagged/untagged.
*/
- lp = sym_lp(np, tp, ccb->lun);
+ lp = sym_lp(np, tp, ccb->device->lun);
order = (lp && lp->s.reqtags) ? M_SIMPLE_TAG : 0;
/*
* Queue the SCSI IO.
*/
- cp = sym_get_ccb(np, ccb->target, ccb->lun, order);
+ cp = sym_get_ccb(np, ccb->device->id, ccb->device->lun, order);
if (!cp)
return 1; /* Means resource shortage */
(void) sym_queue_scsiio(np, ccb, cp);
@@ -1113,7 +1113,7 @@ static int sym_eh_handler(int op, char *opname, Scsi_Cmnd *cmd)
struct sym_eh_wait eh, *ep = &eh;
char devname[20];
- sprintf(devname, "%s:%d:%d", sym_name(np), cmd->target, cmd->lun);
+ sprintf(devname, "%s:%d:%d", sym_name(np), cmd->device->id, cmd->device->lun);
printf_warning("%s: %s operation started.\n", devname, opname);
@@ -1167,7 +1167,7 @@ prepare:
sts = sym_abort_scsiio(np, cmd, 1);
break;
case SYM_EH_DEVICE_RESET:
- sts = sym_reset_scsi_target(np, cmd->target);
+ sts = sym_reset_scsi_target(np, cmd->device->id);
break;
case SYM_EH_BUS_RESET:
sym_reset_scsi_bus(np, 1);
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index 5efaa7cab4b4..d63d2c0306a1 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -1184,7 +1184,7 @@ static void dc390_Query_to_Waiting (PACB pACB)
if (!pSRB) return;
pcmd = dc390_Query_get ( pACB );
if (!pcmd) { dc390_Free_insert (pACB, pSRB); return; }; /* should not happen */
- pDCB = dc390_findDCB (pACB, pcmd->target, pcmd->lun);
+ pDCB = dc390_findDCB (pACB, pcmd->device->id, pcmd->device->lun);
if (!pDCB)
{
dc390_Free_insert (pACB, pSRB);
@@ -1223,12 +1223,12 @@ int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
PDCB pDCB;
PSRB pSRB;
DC390_AFLAGS
- PACB pACB = (PACB) cmd->host->hostdata;
+ PACB pACB = (PACB) cmd->device->host->hostdata;
DEBUG0(/* if(pACB->scan_devices) */ \
printk(KERN_INFO "DC390: Queue Cmd=%02x,Tgt=%d,LUN=%d (pid=%li)\n",\
- cmd->cmnd[0],cmd->target,cmd->lun,cmd->pid);)
+ cmd->cmnd[0],cmd->device->id,cmd->device->lun,cmd->pid);)
DC390_LOCK_ACB;
@@ -1245,11 +1245,11 @@ int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
else if( (pACB->scan_devices) && (cmd->cmnd[0] == READ_6) )
pACB->scan_devices = 0;
- if ( ( cmd->target >= pACB->pScsiHost->max_id ) ||
- (cmd->lun >= pACB->pScsiHost->max_lun) )
+ if ( ( cmd->device->id >= pACB->pScsiHost->max_id ) ||
+ (cmd->device->lun >= pACB->pScsiHost->max_lun) )
{
/* printk ("DC390: Ignore target %d lun %d\n",
- cmd->target, cmd->lun); */
+ cmd->device->id, cmd->device->lun); */
DC390_UNLOCK_ACB;
//return (1);
done (cmd);
@@ -1257,15 +1257,15 @@ int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
}
if( (pACB->scan_devices || cmd->cmnd[0] == TEST_UNIT_READY || cmd->cmnd[0] == INQUIRY) &&
- !(pACB->DCBmap[cmd->target] & (1 << cmd->lun)) )
+ !(pACB->DCBmap[cmd->device->id] & (1 << cmd->device->lun)) )
{
pACB->scan_devices = 1;
- dc390_initDCB( pACB, &pDCB, cmd->target, cmd->lun );
+ dc390_initDCB( pACB, &pDCB, cmd->device->id, cmd->device->lun );
if (!pDCB)
{
printk (KERN_ERR "DC390: kmalloc for DCB failed, target %02x lun %02x\n",
- cmd->target, cmd->lun);
+ cmd->device->id, cmd->device->lun);
DC390_UNLOCK_ACB;
printk ("DC390: No DCB in queue_command!\n");
#ifdef USE_NEW_EH
@@ -1277,10 +1277,10 @@ int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
};
}
- else if( !(pACB->scan_devices) && !(pACB->DCBmap[cmd->target] & (1 << cmd->lun)) )
+ else if( !(pACB->scan_devices) && !(pACB->DCBmap[cmd->device->id] & (1 << cmd->device->lun)) )
{
printk(KERN_INFO "DC390: Ignore target %02x lun %02x\n",
- cmd->target, cmd->lun);
+ cmd->device->id, cmd->device->lun);
DC390_UNLOCK_ACB;
//return (1);
done (cmd);
@@ -1288,11 +1288,11 @@ int DC390_queue_command (Scsi_Cmnd *cmd, void (* done)(Scsi_Cmnd *))
}
else
{
- pDCB = dc390_findDCB (pACB, cmd->target, cmd->lun);
+ pDCB = dc390_findDCB (pACB, cmd->device->id, cmd->device->lun);
if (!pDCB)
{ /* should never happen */
printk (KERN_ERR "DC390: no DCB failed, target %02x lun %02x\n",
- cmd->target, cmd->lun);
+ cmd->device->id, cmd->device->lun);
DC390_UNLOCK_ACB;
printk ("DC390: No DCB in queuecommand (2)!\n");
#ifdef USE_NEW_EH
@@ -1547,12 +1547,12 @@ int DC390_abort (Scsi_Cmnd *cmd)
int status;
//ULONG sbac;
DC390_AFLAGS
- PACB pACB = (PACB) cmd->host->hostdata;
+ PACB pACB = (PACB) cmd->device->host->hostdata;
DC390_LOCK_ACB;
printk ("DC390: Abort command (pid %li, Device %02i-%02i)\n",
- cmd->pid, cmd->target, cmd->lun);
+ cmd->pid, cmd->device->id, cmd->device->lun);
/* First scan Query list */
if( pACB->QueryCnt )
@@ -1586,7 +1586,7 @@ int DC390_abort (Scsi_Cmnd *cmd)
}
}
- pDCB = dc390_findDCB (pACB, cmd->target, cmd->lun);
+ pDCB = dc390_findDCB (pACB, cmd->device->id, cmd->device->lun);
if( !pDCB ) goto NOT_RUN;
/* Added 98/07/02 KG */
@@ -1785,7 +1785,7 @@ int DC390_reset (Scsi_Cmnd *cmd, unsigned int resetFlags)
{
UCHAR bval;
DC390_AFLAGS
- PACB pACB = (PACB) cmd->host->hostdata;
+ PACB pACB = (PACB) cmd->device->host->hostdata;
printk(KERN_INFO "DC390: RESET ... ");
@@ -2358,11 +2358,11 @@ int __init DC390_detect (Scsi_Host_Template *psht)
static void dc390_inquiry_done (Scsi_Cmnd* cmd)
{
printk (KERN_INFO "DC390: INQUIRY (ID %02x LUN %02x) returned %08x\n",
- cmd->target, cmd->lun, cmd->result);
+ cmd->device->id, cmd->device->lun, cmd->result);
if (cmd->result)
{
- PACB pACB = (PACB)cmd->host->hostdata;
- PDCB pDCB = dc390_findDCB (pACB, cmd->target, cmd->lun);
+ PACB pACB = (PACB)cmd->device->host->hostdata;
+ PDCB pDCB = dc390_findDCB (pACB, cmd->device->id, cmd->device->lun);
printk ("DC390: Unsetting DsCn, Sync and TagQ!\n");
if (pDCB)
{
@@ -2387,9 +2387,10 @@ void dc390_inquiry (PACB pACB, PDCB pDCB)
cmd->cmnd[4] = 0xff;
cmd->cmd_len = 6; cmd->old_cmd_len = 6;
- cmd->host = pACB->pScsiHost;
- cmd->target = pDCB->TargetID;
- cmd->lun = pDCB->TargetLUN;
+/* TODO FIXME */
+/* cmd->host = pACB->pScsiHost; */
+ cmd->device->id = pDCB->TargetID;
+ cmd->device->lun = pDCB->TargetLUN;
cmd->serial_number = 1;
cmd->pid = 390;
cmd->bufflen = 128;
@@ -2419,7 +2420,7 @@ void dc390_inquiry (PACB pACB, PDCB pDCB)
static void dc390_sendstart_done (Scsi_Cmnd* cmd)
{
printk (KERN_INFO "DC390: SENDSTART (ID %02x LUN %02x) returned %08x\n",
- cmd->target, cmd->lun, cmd->result);
+ cmd->device->id, cmd->device->lun, cmd->result);
kfree (cmd);
};
@@ -2437,9 +2438,10 @@ void dc390_sendstart (PACB pACB, PDCB pDCB)
cmd->cmnd[4] = 0x01; /* START */
cmd->cmd_len = 6; cmd->old_cmd_len = 6;
- cmd->host = pACB->pScsiHost;
- cmd->target = pDCB->TargetID;
- cmd->lun = pDCB->TargetLUN;
+/* TODO FIXME */
+/* cmd->host = pACB->pScsiHost; */
+ cmd->device->id = pDCB->TargetID;
+ cmd->device->lun = pDCB->TargetLUN;
cmd->serial_number = 1;
cmd->pid = 310;
cmd->bufflen = 128;
@@ -2734,7 +2736,9 @@ int dc390_set_info (char *buffer, int length, PACB pACB)
reset:
{
- Scsi_Cmnd cmd; cmd.host = pACB->pScsiHost;
+ Scsi_Cmnd cmd;
+ /* TODO FIXME */
+ /* cmd.host = pACB->pScsiHost; */
printk (KERN_WARNING "DC390: Driver reset requested!\n");
DC390_UNLOCK_ACB;
DC390_reset (&cmd, 0);
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index 3fe176023d8a..f02555afeda7 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -1213,7 +1213,7 @@ static int u14_34f_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
struct mscp *cpp;
/* j is the board number */
- j = ((struct hostdata *) SCpnt->host->hostdata)->board_number;
+ j = ((struct hostdata *) SCpnt->device->host->hostdata)->board_number;
if (SCpnt->host_scribble)
panic("%s: qcomm, pid %ld, SCpnt %p already active.\n",
@@ -1247,13 +1247,13 @@ static int u14_34f_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
SCpnt->host_scribble = (unsigned char *) &cpp->cpp_index;
if (do_trace) printk("%s: qcomm, mbox %d, target %d.%d:%d, pid %ld.\n",
- BN(j), i, SCpnt->channel, SCpnt->target,
- SCpnt->lun, SCpnt->pid);
+ BN(j), i, SCpnt->device->channel, SCpnt->device->id,
+ SCpnt->device->lun, SCpnt->pid);
cpp->opcode = OP_SCSI;
- cpp->channel = SCpnt->channel;
- cpp->target = SCpnt->target;
- cpp->lun = SCpnt->lun;
+ cpp->channel = SCpnt->device->channel;
+ cpp->target = SCpnt->device->id;
+ cpp->lun = SCpnt->device->lun;
cpp->SCpnt = SCpnt;
cpp->cdb_len = SCpnt->cmd_len;
memcpy(cpp->cdb, SCpnt->cmnd, SCpnt->cmd_len);
@@ -1275,7 +1275,7 @@ static int u14_34f_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
unmap_dma(i, j);
SCpnt->host_scribble = NULL;
printk("%s: qcomm, target %d.%d:%d, pid %ld, adapter busy.\n",
- BN(j), SCpnt->channel, SCpnt->target, SCpnt->lun, SCpnt->pid);
+ BN(j), SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun, SCpnt->pid);
return 1;
}
@@ -1292,17 +1292,17 @@ static int u14_34f_queuecommand(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *)) {
static int u14_34f_eh_abort(Scsi_Cmnd *SCarg) {
unsigned int i, j;
- j = ((struct hostdata *) SCarg->host->hostdata)->board_number;
+ j = ((struct hostdata *) SCarg->device->host->hostdata)->board_number;
if (SCarg->host_scribble == NULL) {
printk("%s: abort, target %d.%d:%d, pid %ld inactive.\n",
- BN(j), SCarg->channel, SCarg->target, SCarg->lun, SCarg->pid);
+ BN(j), SCarg->device->channel, SCarg->device->id, SCarg->device->lun, SCarg->pid);
return SUCCESS;
}
i = *(unsigned int *)SCarg->host_scribble;
printk("%s: abort, mbox %d, target %d.%d:%d, pid %ld.\n",
- BN(j), i, SCarg->channel, SCarg->target, SCarg->lun, SCarg->pid);
+ BN(j), i, SCarg->device->channel, SCarg->device->id, SCarg->device->lun, SCarg->pid);
if (i >= sh[j]->can_queue)
panic("%s: abort, invalid SCarg->host_scribble.\n", BN(j));
@@ -1368,9 +1368,9 @@ static int u14_34f_eh_host_reset(Scsi_Cmnd *SCarg) {
int arg_done = FALSE;
Scsi_Cmnd *SCpnt;
- j = ((struct hostdata *) SCarg->host->hostdata)->board_number;
+ j = ((struct hostdata *) SCarg->device->host->hostdata)->board_number;
printk("%s: reset, enter, target %d.%d:%d, pid %ld.\n",
- BN(j), SCarg->channel, SCarg->target, SCarg->lun, SCarg->pid);
+ BN(j), SCarg->device->channel, SCarg->device->id, SCarg->device->lun, SCarg->pid);
if (SCarg->host_scribble == NULL)
printk("%s: reset, pid %ld inactive.\n", BN(j), SCarg->pid);
@@ -1669,7 +1669,7 @@ static void flush_dev(Scsi_Device *dev, unsigned long cursec, unsigned int j,
if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
printk("%s: %s, target %d.%d:%d, pid %ld, mbox %d, adapter"\
" busy, will abort.\n", BN(j), (ihdlr ? "ihdlr" : "qcomm"),
- SCpnt->channel, SCpnt->target, SCpnt->lun, SCpnt->pid, k);
+ SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun, SCpnt->pid, k);
HD(j)->cp_stat[k] = ABORTING;
continue;
}
@@ -1781,7 +1781,7 @@ static void ihdlr(int irq, unsigned int j) {
/* If there was a bus reset, redo operation on each target */
else if (tstatus != GOOD && SCpnt->device->type == TYPE_DISK
- && HD(j)->target_redo[SCpnt->target][SCpnt->channel])
+ && HD(j)->target_redo[SCpnt->device->id][SCpnt->device->channel])
status = DID_BUS_BUSY << 16;
/* Works around a flaw in scsi.c */
@@ -1794,29 +1794,29 @@ static void ihdlr(int irq, unsigned int j) {
status = DID_OK << 16;
if (tstatus == GOOD)
- HD(j)->target_redo[SCpnt->target][SCpnt->channel] = FALSE;
+ HD(j)->target_redo[SCpnt->device->id][SCpnt->device->channel] = FALSE;
if (spp->target_status && SCpnt->device->type == TYPE_DISK &&
(!(tstatus == CHECK_CONDITION && HD(j)->iocount <= 1000 &&
(SCpnt->sense_buffer[2] & 0xf) == NOT_READY)))
printk("%s: ihdlr, target %d.%d:%d, pid %ld, "\
"target_status 0x%x, sense key 0x%x.\n", BN(j),
- SCpnt->channel, SCpnt->target, SCpnt->lun,
+ SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun,
SCpnt->pid, spp->target_status,
SCpnt->sense_buffer[2]);
- HD(j)->target_to[SCpnt->target][SCpnt->channel] = 0;
+ HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel] = 0;
if (HD(j)->last_retried_pid == SCpnt->pid) HD(j)->retries = 0;
break;
case ASST: /* Selection Time Out */
- if (HD(j)->target_to[SCpnt->target][SCpnt->channel] > 1)
+ if (HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel] > 1)
status = DID_ERROR << 16;
else {
status = DID_TIME_OUT << 16;
- HD(j)->target_to[SCpnt->target][SCpnt->channel]++;
+ HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel]++;
}
break;
@@ -1875,7 +1875,7 @@ static void ihdlr(int irq, unsigned int j) {
printk("%s: ihdlr, mbox %2d, err 0x%x:%x,"\
" target %d.%d:%d, pid %ld, reg 0x%x, count %d.\n",
BN(j), i, spp->adapter_status, spp->target_status,
- SCpnt->channel, SCpnt->target, SCpnt->lun, SCpnt->pid,
+ SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun, SCpnt->pid,
reg, HD(j)->iocount);
unmap_dma(i, j);
diff --git a/drivers/usb/storage/dpcm.c b/drivers/usb/storage/dpcm.c
index 5f7e8d4673a6..a5596cac44e8 100644
--- a/drivers/usb/storage/dpcm.c
+++ b/drivers/usb/storage/dpcm.c
@@ -48,9 +48,9 @@ int dpcm_transport(Scsi_Cmnd *srb, struct us_data *us)
if(srb == NULL)
return USB_STOR_TRANSPORT_ERROR;
- US_DEBUGP("dpcm_transport: LUN=%d\n", srb->lun);
+ US_DEBUGP("dpcm_transport: LUN=%d\n", srb->device->lun);
- switch(srb->lun) {
+ switch(srb->device->lun) {
case 0:
/*
@@ -68,15 +68,15 @@ int dpcm_transport(Scsi_Cmnd *srb, struct us_data *us)
/*
* Set the LUN to 0 (just in case).
*/
- srb->lun = 0; us->srb->lun = 0;
+ srb->device->lun = 0; us->srb->device->lun = 0;
ret = sddr09_transport(srb, us);
- srb->lun = 1; us->srb->lun = 1;
+ srb->device->lun = 1; us->srb->device->lun = 1;
return ret;
#endif
default:
- US_DEBUGP("dpcm_transport: Invalid LUN %d\n", srb->lun);
+ US_DEBUGP("dpcm_transport: Invalid LUN %d\n", srb->device->lun);
return USB_STOR_TRANSPORT_ERROR;
}
}
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 3b0ee27a4564..f587f53295c0 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -145,7 +145,7 @@ static int command( Scsi_Cmnd *srb )
/* This is always called with scsi_lock(srb->host) held */
static int queuecommand( Scsi_Cmnd *srb , void (*done)(Scsi_Cmnd *))
{
- struct us_data *us = (struct us_data *)srb->host->hostdata[0];
+ struct us_data *us = (struct us_data *)srb->device->host->hostdata[0];
US_DEBUGP("queuecommand() called\n");
srb->host_scribble = (unsigned char *)us;
@@ -170,7 +170,7 @@ static int queuecommand( Scsi_Cmnd *srb , void (*done)(Scsi_Cmnd *))
/* This is always called with scsi_lock(srb->host) held */
static int command_abort( Scsi_Cmnd *srb )
{
- struct us_data *us = (struct us_data *)srb->host->hostdata[0];
+ struct us_data *us = (struct us_data *)srb->device->host->hostdata[0];
US_DEBUGP("command_abort() called\n");
@@ -189,7 +189,7 @@ static int command_abort( Scsi_Cmnd *srb )
/* This is always called with scsi_lock(srb->host) held */
static int device_reset( Scsi_Cmnd *srb )
{
- struct us_data *us = (struct us_data *)srb->host->hostdata[0];
+ struct us_data *us = (struct us_data *)srb->device->host->hostdata[0];
int result;
US_DEBUGP("device_reset() called\n" );
@@ -197,7 +197,7 @@ static int device_reset( Scsi_Cmnd *srb )
/* set the state and release the lock */
atomic_set(&us->sm_state, US_STATE_RESETTING);
- scsi_unlock(srb->host);
+ scsi_unlock(srb->device->host);
/* lock the device pointers */
down(&(us->dev_semaphore));
@@ -210,7 +210,7 @@ static int device_reset( Scsi_Cmnd *srb )
up(&(us->dev_semaphore));
/* lock access to the state and clear it */
- scsi_lock(srb->host);
+ scsi_lock(srb->device->host);
atomic_set(&us->sm_state, US_STATE_IDLE);
return result;
}
@@ -221,7 +221,7 @@ static int device_reset( Scsi_Cmnd *srb )
/* This is always called with scsi_lock(srb->host) held */
static int bus_reset( Scsi_Cmnd *srb )
{
- struct us_data *us = (struct us_data *)srb->host->hostdata[0];
+ struct us_data *us = (struct us_data *)srb->device->host->hostdata[0];
int i;
int result;
struct usb_device *pusb_dev_save;
@@ -229,14 +229,14 @@ static int bus_reset( Scsi_Cmnd *srb )
/* we use the usb_reset_device() function to handle this for us */
US_DEBUGP("bus_reset() called\n");
- scsi_unlock(srb->host);
+ scsi_unlock(srb->device->host);
/* if the device has been removed, this worked */
down(&us->dev_semaphore);
if (!(us->flags & US_FL_DEV_ATTACHED)) {
US_DEBUGP("-- device removed already\n");
up(&us->dev_semaphore);
- scsi_lock(srb->host);
+ scsi_lock(srb->device->host);
return SUCCESS;
}
pusb_dev_save = us->pusb_dev;
@@ -246,7 +246,7 @@ static int bus_reset( Scsi_Cmnd *srb )
result = usb_reset_device(pusb_dev_save);
US_DEBUGP("usb_reset_device returns %d\n", result);
if (result < 0) {
- scsi_lock(srb->host);
+ scsi_lock(srb->device->host);
return FAILED;
}
@@ -270,7 +270,7 @@ static int bus_reset( Scsi_Cmnd *srb )
usb_device_probe (&intf->dev);
}
US_DEBUGP("bus_reset() complete\n");
- scsi_lock(srb->host);
+ scsi_lock(srb->device->host);
return SUCCESS;
}
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index 1ff7a7a9bea7..528153c77e0b 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -697,7 +697,7 @@ void usb_stor_abort_transport(struct us_data *us)
/* set state to abort and release the lock */
atomic_set(&us->sm_state, US_STATE_ABORTING);
- host = us->srb->host;
+ host = us->srb->device->host;
scsi_unlock(host);
/* If the state machine is blocked waiting for an URB,
@@ -895,7 +895,7 @@ int usb_stor_Bulk_transport(Scsi_Cmnd *srb, struct us_data *us)
bcb.Tag = srb->serial_number;
bcb.Lun = srb->cmnd[1] >> 5;
if (us->flags & US_FL_SCM_MULT_TARG)
- bcb.Lun |= srb->target << 4;
+ bcb.Lun |= srb->device->id << 4;
bcb.Length = srb->cmd_len;
/* copy the command payload */
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index c61df0831c23..dc93ad389a56 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -342,7 +342,7 @@ static int usb_stor_control_thread(void * __us)
US_DEBUGP("-- exit command received\n");
break;
}
- host = us->srb->host;
+ host = us->srb->device->host;
/* lock access to the state */
scsi_lock(host);
@@ -371,16 +371,16 @@ static int usb_stor_control_thread(void * __us)
/* reject if target != 0 or if LUN is higher than
* the maximum known LUN
*/
- else if (us->srb->target &&
+ else if (us->srb->device->id &&
!(us->flags & US_FL_SCM_MULT_TARG)) {
US_DEBUGP("Bad target number (%d/%d)\n",
- us->srb->target, us->srb->lun);
+ us->srb->device->id, us->srb->device->lun);
us->srb->result = DID_BAD_TARGET << 16;
}
- else if (us->srb->lun > us->max_lun) {
+ else if (us->srb->device->lun > us->max_lun) {
US_DEBUGP("Bad LUN (%d/%d)\n",
- us->srb->target, us->srb->lun);
+ us->srb->device->id, us->srb->device->lun);
us->srb->result = DID_BAD_TARGET << 16;
}