* [PATCH RFC] kill scsi_device::{channel,id} in generic code
@ 2005-10-23 2:41 Jeff Garzik
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
0 siblings, 1 reply; 19+ messages in thread
From: Jeff Garzik @ 2005-10-23 2:41 UTC (permalink / raw)
To: linux-scsi
As a thought experiment, I deleted 'channel' and 'id' members from
struct scsi_device, and took a look at what broke. This patch is the
result.
DO NOT APPLY. For discussion only.
Changes:
* it appears that a bunch of messages could be converted to
calling dev_printk(), completely eliminating references to
sdev->{id,channel}
* for references that could not be eliminated by dev_printk(),
wrapped them using new wrappers sdev_id(), sdev_channel()
for easy grepping later on.
* Defined sdev_id() as referring to sdev->sdev_target->id
* Defined sdev_channel() as referring to sdev->sdev_target->channel
* I converted all drivers/scsi/scsi*.c code that broke,
but didn't touch any drivers (another likely heap o breakage).
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index f6be2c1..553fb00 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1389,11 +1389,7 @@ EXPORT_SYMBOL(scsi_print_msg);
void scsi_print_command(struct scsi_cmnd *cmd)
{
/* Assume appended output (i.e. not at start of line) */
- printk("scsi%d : destination target %d, lun %d\n",
- cmd->device->host->host_no,
- cmd->device->id,
- cmd->device->lun);
- printk(KERN_INFO " command: ");
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev, "command: ");
scsi_print_cdb(cmd->cmnd, cmd->cmd_len, 0);
}
EXPORT_SYMBOL(scsi_print_command);
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 1f0ebab..0cb69a5 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -410,9 +410,8 @@ void scsi_log_send(struct scsi_cmnd *cmd
SCSI_LOG_MLQUEUE_BITS);
if (level > 1) {
sdev = cmd->device;
- printk(KERN_INFO "scsi <%d:%d:%d:%d> send ",
- sdev->host->host_no, sdev->channel, sdev->id,
- sdev->lun);
+ dev_printk(KERN_INFO, &sdev->sdev_gendev,
+ "scsi send ");
if (level > 2)
printk("0x%p ", cmd);
/*
@@ -456,9 +455,8 @@ void scsi_log_completion(struct scsi_cmn
if (((level > 0) && (cmd->result || disposition != SUCCESS)) ||
(level > 1)) {
sdev = cmd->device;
- printk(KERN_INFO "scsi <%d:%d:%d:%d> done ",
- sdev->host->host_no, sdev->channel, sdev->id,
- sdev->lun);
+ dev_printk(KERN_INFO, &sdev->sdev_gendev,
+ "scsi done ");
if (level > 2)
printk("0x%p ", cmd);
/*
@@ -893,8 +891,9 @@ void scsi_finish_command(struct scsi_cmn
if (SCSI_SENSE_VALID(cmd))
cmd->result |= (DRIVER_SENSE << 24);
- SCSI_LOG_MLCOMPLETE(4, printk("Notifying upper driver of completion "
- "for device %d %x\n", sdev->id, cmd->result));
+ SCSI_LOG_MLCOMPLETE(4, dev_printk(KERN_INFO, &sdev->sdev_gendev,
+ "Notifying upper driver of completion "
+ "(result %x)\n", cmd->result));
/*
* We can get here with use_sg=0, causing a panic in the upper level
@@ -970,10 +969,9 @@ void scsi_adjust_queue_depth(struct scsi
sdev->simple_tags = 1;
break;
default:
- printk(KERN_WARNING "(scsi%d:%d:%d:%d) "
+ dev_printk(KERN_WARNING, &sdev->sdev_gendev,
"scsi_adjust_queue_depth, bad queue type, "
- "disabled\n", sdev->host->host_no,
- sdev->channel, sdev->id, sdev->lun);
+ "disabled\n");
case 0:
sdev->ordered_tags = sdev->simple_tags = 0;
sdev->queue_depth = tags;
@@ -1112,8 +1110,8 @@ void starget_for_each_device(struct scsi
struct scsi_device *sdev;
shost_for_each_device(sdev, shost) {
- if ((sdev->channel == starget->channel) &&
- (sdev->id == starget->id))
+ if ((sdev_channel(sdev) == starget->channel) &&
+ (sdev_id(sdev) == starget->id))
fn(sdev, data);
}
}
@@ -1195,8 +1193,9 @@ struct scsi_device *__scsi_device_lookup
struct scsi_device *sdev;
list_for_each_entry(sdev, &shost->__devices, siblings) {
- if (sdev->channel == channel && sdev->id == id &&
- sdev->lun ==lun)
+ if (sdev_channel(sdev) == channel &&
+ sdev_id(sdev) == id &&
+ sdev->lun ==lun)
return sdev;
}
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 52b348c..fe5b9b9 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -241,11 +241,10 @@ static inline void scsi_eh_prt_fail_stat
if (cmd_cancel || cmd_failed) {
SCSI_LOG_ERROR_RECOVERY(3,
- printk("%s: %d:%d:%d:%d cmds failed: %d,"
+ dev_printk(KERN_INFO, &sdev->sdev_gendev,
+ "%s: cmds failed: %d,"
" cancel: %d\n",
- __FUNCTION__, shost->host_no,
- sdev->channel, sdev->id, sdev->lun,
- cmd_failed, cmd_cancel));
+ __FUNCTION__, cmd_failed, cmd_cancel));
cmd_cancel = 0;
cmd_failed = 0;
++devices_failed;
@@ -674,10 +673,10 @@ static int scsi_eh_get_sense(struct list
SCSI_SENSE_VALID(scmd))
continue;
- SCSI_LOG_ERROR_RECOVERY(2, printk("%s: requesting sense"
- " for id: %d\n",
- current->comm,
- scmd->device->id));
+ SCSI_LOG_ERROR_RECOVERY(2, dev_printk(KERN_INFO,
+ &scmd->device->sdev_gendev,
+ "%s: requesting sense\n",
+ current->comm));
rtn = scsi_request_sense(scmd);
if (rtn != SUCCESS)
continue;
@@ -1035,7 +1034,8 @@ static int scsi_try_bus_reset(struct scs
if (!scmd->device->host->hostt->skip_settle_delay)
ssleep(BUS_RESET_SETTLE_TIME);
spin_lock_irqsave(scmd->device->host->host_lock, flags);
- scsi_report_bus_reset(scmd->device->host, scmd->device->channel);
+ scsi_report_bus_reset(scmd->device->host,
+ sdev_channel(scmd->device));
spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
}
@@ -1063,7 +1063,8 @@ static int scsi_try_host_reset(struct sc
if (!scmd->device->host->hostt->skip_settle_delay)
ssleep(HOST_RESET_SETTLE_TIME);
spin_lock_irqsave(scmd->device->host->host_lock, flags);
- scsi_report_bus_reset(scmd->device->host, scmd->device->channel);
+ scsi_report_bus_reset(scmd->device->host,
+ sdev_channel(scmd->device));
spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
}
@@ -1093,7 +1094,7 @@ static int scsi_eh_bus_reset(struct Scsi
for (channel = 0; channel <= shost->max_channel; channel++) {
chan_scmd = NULL;
list_for_each_entry(scmd, work_q, eh_entry) {
- if (channel == scmd->device->channel) {
+ if (channel == sdev_channel(scmd->device)) {
chan_scmd = scmd;
break;
/*
@@ -1111,7 +1112,7 @@ static int scsi_eh_bus_reset(struct Scsi
rtn = scsi_try_bus_reset(chan_scmd);
if (rtn == SUCCESS) {
list_for_each_entry_safe(scmd, next, work_q, eh_entry) {
- if (channel == scmd->device->channel)
+ if (channel == sdev_channel(scmd->device))
if (!scsi_device_online(scmd->device) ||
!scsi_eh_tur(scmd))
scsi_eh_finish_cmd(scmd,
@@ -1174,13 +1175,9 @@ static void scsi_eh_offline_sdevs(struct
struct scsi_cmnd *scmd, *next;
list_for_each_entry_safe(scmd, next, work_q, eh_entry) {
- printk(KERN_INFO "scsi: Device offlined - not"
- " ready after error recovery: host"
- " %d channel %d id %d lun %d\n",
- scmd->device->host->host_no,
- scmd->device->channel,
- scmd->device->id,
- scmd->device->lun);
+ dev_printk(KERN_INFO, &scmd->device->sdev_gendev,
+ "Device offlined - not"
+ " ready after error recovery\n");
scsi_device_set_state(scmd->device, SDEV_OFFLINE);
if (scmd->eh_eflags & SCSI_EH_CANCEL_CMD) {
/*
@@ -1342,10 +1339,8 @@ int scsi_decide_disposition(struct scsi_
return SUCCESS;
case RESERVATION_CONFLICT:
- printk(KERN_INFO "scsi: reservation conflict: host"
- " %d channel %d id %d lun %d\n",
- scmd->device->host->host_no, scmd->device->channel,
- scmd->device->id, scmd->device->lun);
+ dev_printk(KERN_INFO, &scmd->device->sdev_gendev,
+ "reservation conflict\n");
return SUCCESS; /* causes immediate i/o error */
default:
return FAILED;
@@ -1683,7 +1678,7 @@ void scsi_report_bus_reset(struct Scsi_H
struct scsi_device *sdev;
__shost_for_each_device(sdev, shost) {
- if (channel == sdev->channel) {
+ if (channel == sdev_channel(sdev)) {
sdev->was_reset = 1;
sdev->expecting_cc_ua = 1;
}
@@ -1718,8 +1713,8 @@ void scsi_report_device_reset(struct Scs
struct scsi_device *sdev;
__shost_for_each_device(sdev, shost) {
- if (channel == sdev->channel &&
- target == sdev->id) {
+ if (channel == sdev_channel(sdev) &&
+ target == sdev_id(sdev)) {
sdev->was_reset = 1;
sdev->expecting_cc_ua = 1;
}
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
index de7f98c..43cb1f1 100644
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -122,12 +122,8 @@ static int ioctl_internal_command(struct
break;
}
default: /* Fall through for non-removable media */
- printk(KERN_INFO "ioctl_internal_command: <%d %d %d "
- "%d> return code = %x\n",
- sdev->host->host_no,
- sdev->channel,
- sdev->id,
- sdev->lun,
+ dev_printk(KERN_INFO, &sdev->sdev_gendev,
+ "ioctl_internal_command: return code = %x\n",
result);
scsi_print_sense_hdr(" ", &sshdr);
break;
@@ -398,9 +394,9 @@ int scsi_ioctl(struct scsi_device *sdev,
if (!access_ok(VERIFY_WRITE, arg, sizeof(struct scsi_idlun)))
return -EFAULT;
- __put_user((sdev->id & 0xff)
+ __put_user((sdev_id(sdev) & 0xff)
+ ((sdev->lun & 0xff) << 8)
- + ((sdev->channel & 0xff) << 16)
+ + ((sdev_channel(sdev) & 0xff) << 16)
+ ((sdev->host->host_no & 0xff) << 24),
&((struct scsi_idlun __user *)arg)->dev_id);
__put_user(sdev->host->unique_id,
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index dc9c772..5a38708 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1140,8 +1140,8 @@ static int scsi_prep_fn(struct request_q
* online before trying any recovery commands
*/
if (unlikely(!scsi_device_online(sdev))) {
- printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to offline device\n",
- sdev->host->host_no, sdev->id, sdev->lun);
+ dev_printk(KERN_ERR, &sdev->sdev_gendev,
+ "rejecting I/O to offline device\n");
goto kill;
}
if (unlikely(sdev->sdev_state != SDEV_RUNNING)) {
@@ -1150,8 +1150,8 @@ static int scsi_prep_fn(struct request_q
if (sdev->sdev_state == SDEV_DEL) {
/* Device is fully deleted, no commands
* at all allowed down */
- printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to dead device\n",
- sdev->host->host_no, sdev->id, sdev->lun);
+ dev_printk(KERN_ERR, &sdev->sdev_gendev,
+ "rejecting I/O to dead device\n");
goto kill;
}
/* OK, we only allow special commands (i.e. not
@@ -1186,8 +1186,8 @@ static int scsi_prep_fn(struct request_q
specials_only == SDEV_BLOCK)
goto defer;
- printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to device being removed\n",
- sdev->host->host_no, sdev->id, sdev->lun);
+ dev_printk(KERN_ERR, &sdev->sdev_gendev,
+ "rejecting I/O to device being removed\n");
goto kill;
}
@@ -1314,9 +1314,8 @@ static inline int scsi_dev_queue_ready(s
*/
if (--sdev->device_blocked == 0) {
SCSI_LOG_MLQUEUE(3,
- printk("scsi%d (%d:%d) unblocking device at"
- " zero depth\n", sdev->host->host_no,
- sdev->id, sdev->lun));
+ dev_printk(KERN_INFO, &sdev->sdev_gendev,
+ "unblocking device at zero depth\n"));
} else {
blk_plug_device(q);
return 0;
@@ -1435,8 +1434,8 @@ static void scsi_request_fn(struct reque
break;
if (unlikely(!scsi_device_online(sdev))) {
- printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to offline device\n",
- sdev->host->host_no, sdev->id, sdev->lun);
+ dev_printk(KERN_ERR, &sdev->sdev_gendev,
+ "rejecting I/O to offline device\n");
scsi_kill_request(req, q);
continue;
}
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index a50958b..43a9ec2 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -150,7 +150,9 @@ static int proc_print_scsidevice(struct
seq_printf(s,
"Host: scsi%d Channel: %02d Id: %02d Lun: %02d\n Vendor: ",
- sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
+ sdev->host->host_no, sdev_channel(sdev), sdev_id(sdev),
+ sdev->lun);
+
for (i = 0; i < 8; i++) {
if (sdev->vendor[i] >= 0x20)
seq_printf(s, "%c", sdev->vendor[i]);
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 327c5d7..cf6f8bc 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -215,9 +215,7 @@ static struct scsi_device *scsi_alloc_sd
sdev->model = scsi_null_device_strs;
sdev->rev = scsi_null_device_strs;
sdev->host = shost;
- sdev->id = starget->id;
sdev->lun = lun;
- sdev->channel = starget->channel;
sdev->sdev_state = SDEV_CREATED;
INIT_LIST_HEAD(&sdev->siblings);
INIT_LIST_HEAD(&sdev->same_target_siblings);
@@ -462,10 +460,9 @@ static int scsi_probe_lun(struct scsi_de
pass = 1;
next_pass:
- SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: INQUIRY pass %d "
- "to host %d channel %d id %d lun %d, length %d\n",
- pass, sdev->host->host_no, sdev->channel,
- sdev->id, sdev->lun, try_inquiry_len));
+ SCSI_LOG_SCAN_BUS(3, dev_printk(KERN_INFO, &sdev->sdev_gendev,
+ "scsi scan: INQUIRY pass %d, length %d\n",
+ pass, try_inquiry_len));
/* Each pass gets up to three chances to ignore Unit Attention */
for (count = 0; count < 3; ++count) {
@@ -696,8 +693,8 @@ static int scsi_add_lun(struct scsi_devi
sdev->sdtr = 1;
sprintf(sdev->devfs_name, "scsi/host%d/bus%d/target%d/lun%d",
- sdev->host->host_no, sdev->channel,
- sdev->id, sdev->lun);
+ sdev->host->host_no, sdev_channel(sdev),
+ sdev_id(sdev), sdev->lun);
/*
* End driverfs/devfs code.
@@ -1098,7 +1095,7 @@ static int scsi_report_lun_scan(struct s
}
sprintf(devname, "host %d channel %d id %d",
- shost->host_no, sdev->channel, sdev->id);
+ shost->host_no, sdev_channel(sdev), sdev_id(sdev));
/*
* Allocate enough to hold the header (the same size as one scsi_lun)
@@ -1190,9 +1187,8 @@ static int scsi_report_lun_scan(struct s
num_luns = max_scsi_report_luns;
}
- SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "scsi scan: REPORT LUN scan of"
- " host %d channel %d id %d\n", sdev->host->host_no,
- sdev->channel, sdev->id));
+ SCSI_LOG_SCAN_BUS(3, dev_printk (KERN_INFO, &sdev->sdev_gendev,
+ "scsi scan: REPORT LUN scan\n"));
/*
* Scan the luns in lun_data. The entry at offset 0 is really
@@ -1541,7 +1537,7 @@ EXPORT_SYMBOL(scsi_get_host_dev);
*/
void scsi_free_host_dev(struct scsi_device *sdev)
{
- BUG_ON(sdev->id != sdev->host->this_id);
+ BUG_ON(sdev_id(sdev) != sdev->host->this_id);
scsi_destroy_sdev(sdev);
}
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 72a6550..3a914cf 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -727,9 +727,7 @@ void __scsi_remove_target(struct scsi_ta
starget->reap_ref++;
restart:
list_for_each_entry(sdev, &shost->__devices, siblings) {
- if (sdev->channel != starget->channel ||
- sdev->id != starget->id ||
- sdev->sdev_state == SDEV_DEL)
+ if (sdev->sdev_state == SDEV_DEL)
continue;
spin_unlock_irqrestore(shost->host_lock, flags);
scsi_remove_device(sdev);
@@ -866,7 +864,7 @@ void scsi_sysfs_device_initialize(struct
sdev->sdev_gendev.bus = &scsi_bus_type;
sdev->sdev_gendev.release = scsi_device_dev_release;
sprintf(sdev->sdev_gendev.bus_id,"%d:%d:%d:%d",
- sdev->host->host_no, sdev->channel, sdev->id,
+ sdev->host->host_no, sdev_channel(sdev), sdev_id(sdev),
sdev->lun);
class_device_initialize(&sdev->sdev_classdev);
@@ -874,7 +872,7 @@ void scsi_sysfs_device_initialize(struct
sdev->sdev_classdev.class = &sdev_class;
snprintf(sdev->sdev_classdev.class_id, BUS_ID_SIZE,
"%d:%d:%d:%d", sdev->host->host_no,
- sdev->channel, sdev->id, sdev->lun);
+ sdev_channel(sdev), sdev_id(sdev), sdev->lun);
sdev->scsi_level = SCSI_2;
transport_setup_device(&sdev->sdev_gendev);
spin_lock_irqsave(shost->host_lock, flags);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 9a1dc0c..b6cbb4f 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1535,8 +1535,8 @@ static int sd_probe(struct device *dev)
if (sdp->type != TYPE_DISK && sdp->type != TYPE_MOD && sdp->type != TYPE_RBC)
goto out;
- SCSI_LOG_HLQUEUE(3, printk("sd_attach: scsi device: <%d,%d,%d,%d>\n",
- sdp->host->host_no, sdp->channel, sdp->id, sdp->lun));
+ SCSI_LOG_HLQUEUE(3, dev_printk(KERN_INFO, &sdp->sdev_gendev,
+ "sd_attach\n"));
error = -ENOMEM;
sdkp = kmalloc(sizeof(*sdkp), GFP_KERNEL);
@@ -1608,10 +1608,10 @@ static int sd_probe(struct device *dev)
dev_set_drvdata(dev, sdkp);
add_disk(gd);
- printk(KERN_NOTICE "Attached scsi %sdisk %s at scsi%d, channel %d, "
- "id %d, lun %d\n", sdp->removable ? "removable " : "",
- gd->disk_name, sdp->host->host_no, sdp->channel,
- sdp->id, sdp->lun);
+ dev_printk(KERN_NOTICE, &sdp->sdev_gendev,
+ "Attached scsi %sdisk %s\n",
+ sdp->removable ? "removable " : "",
+ gd->disk_name);
return 0;
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index ad94367..b03e2fd 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -885,9 +885,9 @@ sg_ioctl(struct inode *inode, struct fil
return -ENODEV;
__put_user((int) sdp->device->host->host_no,
&sg_idp->host_no);
- __put_user((int) sdp->device->channel,
+ __put_user((int) sdev_channel(sdp->device),
&sg_idp->channel);
- __put_user((int) sdp->device->id, &sg_idp->scsi_id);
+ __put_user((int) sdev_id(sdp->device), &sg_idp->scsi_id);
__put_user((int) sdp->device->lun, &sg_idp->lun);
__put_user((int) sdp->device->type, &sg_idp->scsi_type);
__put_user((short) sdp->device->host->cmd_per_lun,
@@ -1497,10 +1497,9 @@ static int sg_alloc(struct gendisk *disk
overflow:
write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
- printk(KERN_WARNING
- "Unable to attach sg device <%d, %d, %d, %d> type=%d, minor "
- "number exceeds %d\n", scsidp->host->host_no, scsidp->channel,
- scsidp->id, scsidp->lun, scsidp->type, SG_MAX_DEVS - 1);
+ dev_printk(KERN_WARNING, &scsidp->sdev_gendev,
+ "Unable to attach sg device type=%d, minor "
+ "number exceeds %d\n", scsidp->type, SG_MAX_DEVS - 1);
error = -ENODEV;
goto out;
}
@@ -1566,11 +1565,8 @@ sg_add(struct class_device *cl_dev)
} else
printk(KERN_WARNING "sg_add: sg_sys INvalid\n");
- printk(KERN_NOTICE
- "Attached scsi generic sg%d at scsi%d, channel"
- " %d, id %d, lun %d, type %d\n", k,
- scsidp->host->host_no, scsidp->channel, scsidp->id,
- scsidp->lun, scsidp->type);
+ dev_printk(KERN_NOTICE, &scsidp->sdev_gendev,
+ "Attached scsi generic sg%d, type %d\n", k, scsidp->type);
return 0;
@@ -3009,8 +3005,8 @@ static int sg_proc_seq_show_dev(struct s
sdp = it ? sg_get_dev(it->index) : NULL;
if (sdp && (scsidp = sdp->device) && (!sdp->detached))
seq_printf(s, "%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n",
- scsidp->host->host_no, scsidp->channel,
- scsidp->id, scsidp->lun, (int) scsidp->type,
+ scsidp->host->host_no, sdev_channel(scsidp),
+ sdev_id(scsidp), scsidp->lun, (int) scsidp->type,
1,
(int) scsidp->queue_depth,
(int) scsidp->device_busy,
@@ -3135,7 +3131,7 @@ static int sg_proc_seq_show_debug(struct
seq_printf
(s, "scsi%d chan=%d id=%d lun=%d em=%d",
scsidp->host->host_no,
- scsidp->channel, scsidp->id,
+ sdev_channel(scsidp), sdev_id(scsidp),
scsidp->lun,
scsidp->host->hostt->emulated);
seq_printf(s, " sg_tablesize=%d excl=%d\n",
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 561901b..b5bd5cf 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -622,10 +622,8 @@ static int sr_probe(struct device *dev)
disk->flags |= GENHD_FL_REMOVABLE;
add_disk(disk);
- printk(KERN_DEBUG
- "Attached scsi CD-ROM %s at scsi%d, channel %d, id %d, lun %d\n",
- cd->cdi.name, sdev->host->host_no, sdev->channel,
- sdev->id, sdev->lun);
+ dev_printk(KERN_DEBUG, &sdev->sdev_gendev,
+ "Attached scsi CD-ROM %s\n", cd->cdi.name);
return 0;
fail_put:
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 7ece056..8fdd70b 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -66,7 +66,7 @@ struct scsi_device {
jiffie count on our counter, they
could all be from the same event. */
- unsigned int id, lun, channel;
+ unsigned int lun;
unsigned int manufacturer; /* Manufacturer of device, for using
* vendor-specific cmd's */
@@ -266,6 +266,16 @@ extern int scsi_execute_req(struct scsi_
int data_direction, void *buffer, unsigned bufflen,
struct scsi_sense_hdr *, int timeout, int retries);
+static inline unsigned int sdev_channel(struct scsi_device *sdev)
+{
+ return sdev->sdev_target->channel;
+}
+
+static inline unsigned int sdev_id(struct scsi_device *sdev)
+{
+ return sdev->sdev_target->id;
+}
+
static inline int scsi_device_online(struct scsi_device *sdev)
{
return sdev->sdev_state != SDEV_OFFLINE;
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 1/2] HCIL drivers update
2005-10-23 2:41 [PATCH RFC] kill scsi_device::{channel,id} in generic code Jeff Garzik
@ 2005-10-23 19:51 ` Jeff Garzik
2005-10-23 19:52 ` [PATCH RFC 2/2] " Jeff Garzik
` (13 more replies)
0 siblings, 14 replies; 19+ messages in thread
From: Jeff Garzik @ 2005-10-23 19:51 UTC (permalink / raw)
To: linux-scsi
Hacking on drivers, to see where the death of sdev->{channel,id}
and sdev->lun type change leads. DO NOT APPLY.
drivers/scsi/53c700.c | 111 +++++++++++++++++-------------------
drivers/scsi/53c700.h | 6 -
drivers/scsi/BusLogic.c | 12 +--
drivers/scsi/aacraid/aachba.c | 32 +++++-----
drivers/scsi/aacraid/aacraid.h | 1
drivers/scsi/advansys.c | 43 +++++++-------
drivers/scsi/aha152x.c | 5 -
drivers/scsi/aic7xxx/aic79xx_osm.c | 96 +++++++++++++++----------------
drivers/scsi/aic7xxx/aic7xxx_osm.c | 113 +++++++++++++++++--------------------
drivers/scsi/dpt_i2o.c | 31 ++++++----
drivers/scsi/fdomain.c | 4 -
11 files changed, 225 insertions(+), 229 deletions(-)
iff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index a7620fc..51f9422 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -796,12 +796,6 @@ process_extended_message(struct Scsi_Hos
struct scsi_cmnd *SCp, __u32 dsp, __u32 dsps)
{
__u32 resume_offset = dsp, temp = dsp + 8;
- __u8 pun = 0xff, lun = 0xff;
-
- if(SCp != NULL) {
- pun = SCp->device->id;
- lun = SCp->device->lun;
- }
switch(hostdata->msgin[2]) {
case A_SDTR_MSG:
@@ -843,8 +837,8 @@ process_extended_message(struct Scsi_Hos
break;
case A_WDTR_MSG:
- printk(KERN_INFO "scsi%d: (%d:%d), Unsolicited WDTR after CMD, Rejecting\n",
- host->host_no, pun, lun);
+ dev_printk(KERN_INFO, &SCp->device->sdev_gendev,
+ "Unsolicited WDTR after CMD, Rejecting\n");
hostdata->msgout[0] = A_REJECT_MSG;
dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE);
script_patch_16(hostdata->script, MessageCount, 1);
@@ -853,8 +847,8 @@ process_extended_message(struct Scsi_Hos
break;
default:
- printk(KERN_INFO "scsi%d (%d:%d): Unexpected message %s: ",
- host->host_no, pun, lun,
+ dev_printk(KERN_INFO, &SCp->device->sdev_gendev,
+ "Unexpected message %s: ",
NCR_700_phase[(dsps & 0xf00) >> 8]);
scsi_print_msg(hostdata->msgin);
printk("\n");
@@ -876,15 +870,10 @@ process_message(struct Scsi_Host *host,
{
/* work out where to return to */
__u32 temp = dsp + 8, resume_offset = dsp;
- __u8 pun = 0xff, lun = 0xff;
-
- if(SCp != NULL) {
- pun = SCp->device->id;
- lun = SCp->device->lun;
- }
#ifdef NCR_700_DEBUG
- printk("scsi%d (%d:%d): message %s: ", host->host_no, pun, lun,
+ dev_printk(KERN_INFO, &SCp->device->sdev_gendev,
+ "message %s: ",
NCR_700_phase[(dsps & 0xf00) >> 8]);
scsi_print_msg(hostdata->msgin);
printk("\n");
@@ -906,34 +895,36 @@ process_message(struct Scsi_Host *host,
NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION);
} else if(SCp != NULL && NCR_700_get_tag_neg_state(SCp->device) == NCR_700_DURING_TAG_NEGOTIATION) {
/* 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);
+ dev_printk(KERN_WARNING, &SCp->device->sdev_gendev,
+ "Rejected first tag queue attempt, turning off tag queueing\n");
/* we're done negotiating */
NCR_700_set_tag_neg_state(SCp->device, NCR_700_FINISHED_TAG_NEGOTIATION);
- hostdata->tag_negotiated &= ~(1<<SCp->device->id);
+ hostdata->tag_negotiated &= ~(1<<sdev_id(SCp->device));
SCp->device->tagged_supported = 0;
scsi_deactivate_tcq(SCp->device, host->cmd_per_lun);
} else {
- printk(KERN_WARNING "scsi%d (%d:%d) Unexpected REJECT Message %s\n",
- host->host_no, pun, lun,
+ dev_printk(KERN_WARNING, &SCp->device->sdev_gendev,
+ "Unexpected REJECT Message %s\n",
NCR_700_phase[(dsps & 0xf00) >> 8]);
/* however, just ignore it */
}
break;
case A_PARITY_ERROR_MSG:
- printk(KERN_ERR "scsi%d (%d:%d) Parity Error!\n", host->host_no,
- pun, lun);
+ dev_printk(KERN_ERR, &SCp->device->sdev_gendev,
+ "Parity Error!\n");
NCR_700_internal_bus_reset(host);
break;
case A_SIMPLE_TAG_MSG:
- printk(KERN_INFO "scsi%d (%d:%d) SIMPLE TAG %d %s\n", host->host_no,
- pun, lun, hostdata->msgin[1],
+ dev_printk(KERN_INFO, &SCp->device->sdev_gendev,
+ "SIMPLE TAG %d %s\n",
+ hostdata->msgin[1],
NCR_700_phase[(dsps & 0xf00) >> 8]);
/* just ignore it */
break;
default:
- printk(KERN_INFO "scsi%d (%d:%d): Unexpected message %s: ",
- host->host_no, pun, lun,
+ dev_printk(KERN_INFO, &SCp->device->sdev_gendev,
+ "Unexpected message %s: ",
NCR_700_phase[(dsps & 0xf00) >> 8]);
scsi_print_msg(hostdata->msgin);
@@ -960,12 +951,6 @@ process_script_interrupt(__u32 dsps, __u
struct NCR_700_Host_Parameters *hostdata)
{
__u32 resume_offset = 0;
- __u8 pun = 0xff, lun=0xff;
-
- if(SCp != NULL) {
- pun = SCp->device->id;
- lun = SCp->device->lun;
- }
if(dsps == A_GOOD_STATUS_AFTER_STATUS) {
DEBUG((" COMMAND COMPLETE, status=%02x\n",
@@ -983,7 +968,8 @@ process_script_interrupt(__u32 dsps, __u
if(SCp->cmnd[0] == REQUEST_SENSE) {
/* OOPS: bad device, returning another
* contingent allegiance condition */
- printk(KERN_ERR "scsi%d (%d:%d) broken device is looping in contingent allegiance: ignoring\n", host->host_no, pun, lun);
+ dev_printk(KERN_ERR, &SCp->device->sdev_gendev,
+ "broken device is looping in contingent allegiance: ignoring\n");
NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]);
} else {
#ifdef NCR_DEBUG
@@ -1001,7 +987,7 @@ process_script_interrupt(__u32 dsps, __u
NCR_700_unmap(hostdata, SCp, slot);
SCp->cmnd[0] = REQUEST_SENSE;
- SCp->cmnd[1] = (SCp->device->lun & 0x7) << 5;
+ SCp->cmnd[1] = (scsilun_to_int(&SCp->device->lun) & 0x7) << 5;
SCp->cmnd[2] = 0;
SCp->cmnd[3] = 0;
SCp->cmnd[4] = sizeof(SCp->sense_buffer);
@@ -1047,12 +1033,13 @@ process_script_interrupt(__u32 dsps, __u
// SCp->request_bufflen,
// 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->device->id);
+ // dev_printk(KERN_INFO, &SCp->device->sdev_gendev,
+ // "Enabling Tag Command Queuing\n");
+ // hostdata->tag_negotiated |= (1 << sdev_id(SCp->device));
// 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->device->id);
+ // hostdata->tag_negotiated &= ~(1 << sdev_id(SCp->device));
// }
//}
NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]);
@@ -1060,8 +1047,8 @@ process_script_interrupt(__u32 dsps, __u
} else if((dsps & 0xfffff0f0) == A_UNEXPECTED_PHASE) {
__u8 i = (dsps & 0xf00) >> 8;
- printk(KERN_ERR "scsi%d: (%d:%d), UNEXPECTED PHASE %s (%s)\n",
- host->host_no, pun, lun,
+ dev_printk(KERN_ERR, &SCp->device->sdev_gendev,
+ "UNEXPECTED PHASE %s (%s)\n",
NCR_700_phase[i],
sbcl_to_string(NCR_700_readb(host, SBCL_REG)));
printk(KERN_ERR " len = %d, cmd =", SCp->cmd_len);
@@ -1071,8 +1058,9 @@ process_script_interrupt(__u32 dsps, __u
} else if((dsps & 0xfffff000) == A_FATAL) {
int i = (dsps & 0xfff);
- printk(KERN_ERR "scsi%d: (%d:%d) FATAL ERROR: %s\n",
- host->host_no, pun, lun, NCR_700_fatal_messages[i]);
+ dev_printk(KERN_ERR, &SCp->device->sdev_gendev,
+ "FATAL ERROR: %s\n",
+ NCR_700_fatal_messages[i]);
if(dsps == A_FATAL_ILLEGAL_MSG_LENGTH) {
printk(KERN_ERR " msg begins %02x %02x\n",
hostdata->msgin[0], hostdata->msgin[1]);
@@ -1082,8 +1070,8 @@ process_script_interrupt(__u32 dsps, __u
#ifdef NCR_700_DEBUG
__u8 i = (dsps & 0xf00) >> 8;
- printk("scsi%d: (%d:%d), DISCONNECTED (%d) %s\n",
- host->host_no, pun, lun,
+ dev_printk(KERN_DEBUG, &SCp->device->sdev_gendev,
+ "DISCONNECTED (%d) %s\n",
i, NCR_700_phase[i]);
#endif
save_for_reselection(hostdata, SCp, dsp);
@@ -1093,14 +1081,16 @@ process_script_interrupt(__u32 dsps, __u
struct NCR_700_command_slot *slot;
__u8 reselection_id = hostdata->reselection_id;
struct scsi_device *SDp;
+ struct scsi_lun __lun;
lun = hostdata->msgin[0] & 0x1f;
+ int_to_scsilun(lun, &__lun);
hostdata->reselection_id = 0xff;
DEBUG(("scsi%d: (%d:%d) RESELECTED!\n",
host->host_no, reselection_id, lun));
/* clear the reselection indicator */
- SDp = __scsi_device_lookup(host, 0, reselection_id, lun);
+ SDp = __scsi_device_lookup(host, 0, reselection_id, &__lun);
if(unlikely(SDp == NULL)) {
printk(KERN_ERR "scsi%d: (%d:%d) HAS NO device\n",
host->host_no, reselection_id, lun);
@@ -1242,8 +1232,9 @@ process_script_interrupt(__u32 dsps, __u
dsp, dsps);
} else if((dsps & 0xfffff000) == 0) {
__u8 i = (dsps & 0xf0) >> 4, j = (dsps & 0xf00) >> 8;
- printk(KERN_ERR "scsi%d: (%d:%d), unhandled script condition %s %s at %04x\n",
- host->host_no, pun, lun, NCR_700_condition[i],
+ dev_printk(KERN_ERR, &SCp->device->sdev_gendev,
+ "unhandled script condition %s %s at %04x\n",
+ NCR_700_condition[i],
NCR_700_phase[j], dsp - hostdata->pScript);
if(SCp != NULL) {
scsi_print_command(SCp);
@@ -1256,12 +1247,14 @@ process_script_interrupt(__u32 dsps, __u
}
NCR_700_internal_bus_reset(host);
} else if((dsps & 0xfffff000) == A_DEBUG_INTERRUPT) {
- printk(KERN_NOTICE "scsi%d (%d:%d) DEBUG INTERRUPT %d AT %08x[%04x], continuing\n",
- host->host_no, pun, lun, dsps & 0xfff, dsp, dsp - hostdata->pScript);
+ dev_printk(KERN_NOTICE, &SCp->device->sdev_gendev,
+ "DEBUG INTERRUPT %d AT %08x[%04x], continuing\n",
+ dsps & 0xfff, dsp, dsp - hostdata->pScript);
resume_offset = dsp;
} else {
- printk(KERN_ERR "scsi%d: (%d:%d), unidentified script interrupt 0x%x at %04x\n",
- host->host_no, pun, lun, dsps, dsp - hostdata->pScript);
+ dev_printk(KERN_ERR, &SCp->device->sdev_gendev,
+ "unidentified script interrupt 0x%x at %04x\n",
+ dsps, dsp - hostdata->pScript);
NCR_700_internal_bus_reset(host);
}
return resume_offset;
@@ -1422,7 +1415,7 @@ NCR_700_start_command(struct scsi_cmnd *
* 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->device->id))
+ if((hostdata->tag_negotiated & (1 << sdev_id(SCp->device)))
&& (slot->tag != SCSI_NO_TAG && SCp->cmnd[0] != REQUEST_SENSE)) {
count += scsi_populate_tag_msg(SCp, &hostdata->msgout[count]);
}
@@ -1441,7 +1434,7 @@ NCR_700_start_command(struct scsi_cmnd *
script_patch_ID(hostdata->script,
- Device_ID, 1<<SCp->device->id);
+ Device_ID, 1 << sdev_id(SCp->device));
script_patch_32_abs(hostdata->script, CommandAddress,
slot->pCmd);
@@ -1764,7 +1757,7 @@ NCR_700_queuecommand(struct scsi_cmnd *S
* - The blk layer sent and untagged command
*/
if(NCR_700_get_depth(SCp->device) != 0
- && (!(hostdata->tag_negotiated & (1<<SCp->device->id))
+ && (!(hostdata->tag_negotiated & (1 << sdev_id(SCp->device)))
|| !blk_rq_tagged(SCp->request))) {
DEBUG((KERN_ERR "scsi%d (%d:%d) has non zero depth %d\n",
SCp->device->host->host_no, SCp->device->id, SCp->device->lun,
@@ -1796,10 +1789,10 @@ NCR_700_queuecommand(struct scsi_cmnd *S
scsi_print_command(SCp);
#endif
if(blk_rq_tagged(SCp->request)
- && (hostdata->tag_negotiated &(1<<SCp->device->id)) == 0
+ && (hostdata->tag_negotiated &(1 << sdev_id(SCp->device))) == 0
&& NCR_700_get_tag_neg_state(SCp->device) == NCR_700_START_TAG_NEGOTIATION) {
printk(KERN_ERR "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);
+ hostdata->tag_negotiated |= (1 << sdev_id(SCp->device));
NCR_700_set_tag_neg_state(SCp->device, NCR_700_DURING_TAG_NEGOTIATION);
}
@@ -1810,12 +1803,12 @@ NCR_700_queuecommand(struct scsi_cmnd *S
* FIXME: This will royally screw up on multiple LUN devices
* */
if(!blk_rq_tagged(SCp->request)
- && (hostdata->tag_negotiated &(1<<SCp->device->id))) {
+ && (hostdata->tag_negotiated &(1 << sdev_id(SCp->device)))) {
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);
+ hostdata->tag_negotiated &= ~(1 << sdev_id(SCp->device));
}
- if((hostdata->tag_negotiated &(1<<SCp->device->id))
+ if((hostdata->tag_negotiated &(1 << sdev_id(SCp->device)))
&& scsi_get_tag_type(SCp->device)) {
slot->tag = SCp->request->tag;
DEBUG(("53c700 %d:%d:%d, sending out tag %d, slot %p\n",
diff --git a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h
index e86012c..07a1ec3 100644
--- a/drivers/scsi/53c700.h
+++ b/drivers/scsi/53c700.h
@@ -15,15 +15,15 @@
/* Turn on for general debugging---too verbose for normal use */
-#undef NCR_700_DEBUG
+#define NCR_700_DEBUG
/* Debug the tag queues, checking hash queue allocation and deallocation
* and search for duplicate tags */
#undef NCR_700_TAG_DEBUG
#ifdef NCR_700_DEBUG
-#define DEBUG(x) printk x
+#define DEBUG(dev,args...) dev_printk(KERN_DEBUG, (dev), ## args)
#else
-#define DEBUG(x)
+#define DEBUG(dev,args...)
#endif
/* The number of available command slots */
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 9d6040b..84c05c7 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -2139,7 +2139,7 @@ static void __init BusLogic_InitializeHo
static int BusLogic_SlaveConfigure(struct scsi_device *Device)
{
struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Device->host->hostdata;
- int TargetID = Device->id;
+ int TargetID = sdev_id(Device);
int QueueDepth = HostAdapter->QueueDepth[TargetID];
if (HostAdapter->TargetFlags[TargetID].TaggedQueuingSupported && (HostAdapter->TaggedQueuingPermitted & (1 << TargetID))) {
@@ -2744,7 +2744,7 @@ static int BusLogic_host_reset(struct sc
{
struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) SCpnt->device->host->hostdata;
- unsigned int id = SCpnt->device->id;
+ unsigned int id = sdev_id(SCpnt->device);
struct BusLogic_TargetStatistics *stats = &HostAdapter->TargetStatistics[id];
int rc;
@@ -2765,12 +2765,12 @@ static int BusLogic_host_reset(struct sc
static int BusLogic_QueueCommand(struct scsi_cmnd *Command, void (*CompletionRoutine) (struct scsi_cmnd *))
{
struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Command->device->host->hostdata;
- struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[Command->device->id];
+ struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[sdev_id(Command->device)];
struct BusLogic_TargetStatistics *TargetStatistics = HostAdapter->TargetStatistics;
unsigned char *CDB = Command->cmnd;
int CDB_Length = Command->cmd_len;
- int TargetID = Command->device->id;
- int LogicalUnit = Command->device->lun;
+ int TargetID = sdev_id(Command->device);
+ int LogicalUnit = scsilun_to_int(&Command->device->lun);
void *BufferPointer = Command->request_buffer;
int BufferLength = Command->request_bufflen;
int SegmentCount = Command->use_sg;
@@ -2960,7 +2960,7 @@ static int BusLogic_AbortCommand(struct
{
struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) Command->device->host->hostdata;
- int TargetID = Command->device->id;
+ int TargetID = sdev_id(Command->device);
struct BusLogic_CCB *CCB;
BusLogic_IncrementErrorCounter(&HostAdapter->TargetStatistics[TargetID].CommandAbortsRequested);
/*
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 93416f7..8528931 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -889,7 +889,7 @@ static void io_callback(void *context, s
scsicmd = (struct scsi_cmnd *) context;
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
- cid = ID_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun);
+ cid = sdev_id(scsicmd->device);
if (nblank(dprintk(x))) {
u64 lba;
@@ -1334,7 +1334,7 @@ static void synchronize_callback(void *c
else {
struct scsi_device *sdev = cmd->device;
struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata;
- u32 cid = ID_LUN_TO_CONTAINER(sdev->id, sdev->lun);
+ u32 cid = sdev_id(sdev);
printk(KERN_WARNING
"synchronize_callback: synchronize failed, status = %d\n",
le32_to_cpu(synchronizereply->status));
@@ -1446,14 +1446,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsi
* Test does not apply to ID 16, the pseudo id for the controller
* itself.
*/
- if (scsicmd->device->id != host->this_id) {
- if ((scsicmd->device->channel == 0) ){
- if( (scsicmd->device->id >= dev->maximum_num_containers) || (scsicmd->device->lun != 0)){
+ if (sdev_id(scsicmd->device) != host->this_id) {
+ if ((sdev_channel(scsicmd->device) == 0) ){
+ if( (sdev_id(scsicmd->device) >= dev->maximum_num_containers) || (!scsilun_zero(&scsicmd->device->lun))){
scsicmd->result = DID_NO_CONNECT << 16;
scsicmd->scsi_done(scsicmd);
return 0;
}
- cid = ID_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun);
+ cid = sdev_id(scsicmd->device);
/*
* If the target container doesn't exist, it may have
@@ -1529,7 +1529,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsi
{
struct inquiry_data inq_data;
- dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", scsicmd->device->id));
+ dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", sdev_id(scsicmd->device)));
memset(&inq_data, 0, sizeof (struct inquiry_data));
inq_data.inqd_ver = 2; /* claim compliance to SCSI-2 */
@@ -1541,7 +1541,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsi
* Set the Vendor, Product, and Revision Level
* see: <vendor>.c i.e. aac.c
*/
- if (scsicmd->device->id == host->this_id) {
+ if (sdev_id(scsicmd->device) == host->this_id) {
setinqstr(cardtype, (void *) (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *)));
inq_data.inqd_pdt = INQD_PDT_PROC; /* Processor device */
aac_internal_transfer(scsicmd, &inq_data, 0, sizeof(inq_data));
@@ -1756,7 +1756,7 @@ static int query_disk(struct aac_dev *de
if (copy_from_user(&qd, arg, sizeof (struct aac_query_disk)))
return -EFAULT;
if (qd.cnum == -1)
- qd.cnum = ID_LUN_TO_CONTAINER(qd.id, qd.lun);
+ qd.cnum = qd.id;
else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1))
{
if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers)
@@ -1931,7 +1931,7 @@ static void aac_srb_callback(void *conte
* the channel is 2
*/
} else if ((dev->raid_scsi_mode) &&
- (scsicmd->device->channel == 2)) {
+ (sdev_channel(scsicmd->device) == 2)) {
scsicmd->result = DID_OK << 16 |
COMMAND_COMPLETE << 8;
} else {
@@ -1975,7 +1975,7 @@ static void aac_srb_callback(void *conte
* the channel is 2
*/
} else if ((dev->raid_scsi_mode) &&
- (scsicmd->device->channel == 2)) {
+ (sdev_channel(scsicmd->device) == 2)) {
scsicmd->result = DID_OK << 16 |
COMMAND_COMPLETE << 8;
} else {
@@ -2093,8 +2093,8 @@ static int aac_send_srb_fib(struct scsi_
u32 timeout;
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
- if (scsicmd->device->id >= dev->maximum_num_physicals ||
- scsicmd->device->lun > 7) {
+ if (sdev_id(scsicmd->device) >= dev->maximum_num_physicals ||
+ scsilun_to_int(&scsicmd->device->lun) > 7) {
scsicmd->result = DID_NO_CONNECT << 16;
scsicmd->scsi_done(scsicmd);
return 0;
@@ -2128,9 +2128,9 @@ static int aac_send_srb_fib(struct scsi_
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->device->channel));
- srbcmd->id = cpu_to_le32(scsicmd->device->id);
- srbcmd->lun = cpu_to_le32(scsicmd->device->lun);
+ srbcmd->channel = cpu_to_le32(aac_logical_to_phys(sdev_channel(scsicmd->device)));
+ srbcmd->id = cpu_to_le32(sdev_id(scsicmd->device));
+ srbcmd->lun = cpu_to_le32(scsilun_to_int(&scsicmd->device->lun));
srbcmd->flags = cpu_to_le32(flag);
timeout = scsicmd->timeout_per_command/HZ;
if(timeout == 0){
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 4a99d2f..92fd4a3 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -25,7 +25,6 @@
* These macros convert from physical channels to virtual channels
*/
#define CONTAINER_CHANNEL (0)
-#define ID_LUN_TO_CONTAINER(id, lun) (id)
#define CONTAINER_TO_CHANNEL(cont) (CONTAINER_CHANNEL)
#define CONTAINER_TO_ID(cont) (cont)
#define CONTAINER_TO_LUN(cont) (0)
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 37ec541..f31e293 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -3523,7 +3523,7 @@ typedef struct {
typedef struct scsi_cmnd REQ, *REQP;
#define REQPNEXT(reqp) ((REQP) ((reqp)->host_scribble))
#define REQPNEXTP(reqp) ((REQP *) &((reqp)->host_scribble))
-#define REQPTID(reqp) ((reqp)->device->id)
+#define REQPTID(reqp) (sdev_id((reqp)->device))
#define REQPTIME(reqp) ((reqp)->SCp.this_residual)
#define REQTIMESTAMP() (jiffies)
@@ -6120,12 +6120,12 @@ advansys_slave_configure(struct scsi_dev
* Save a pointer to the device and set its initial/maximum
* queue depth. Only save the pointer for a lun0 dev though.
*/
- if(device->lun == 0)
- boardp->device[device->id] = device;
+ if(scsilun_zero(&device->lun))
+ boardp->device[sdev_id(device)] = device;
if(device->tagged_supported) {
if (ASC_NARROW_BOARD(boardp)) {
scsi_adjust_queue_depth(device, MSG_ORDERED_TAG,
- boardp->dvc_var.asc_dvc_var.max_dvc_qng[device->id]);
+ boardp->dvc_var.asc_dvc_var.max_dvc_qng[sdev_id(device)]);
} else {
scsi_adjust_queue_depth(device, MSG_ORDERED_TAG,
boardp->dvc_var.adv_dvc_var.max_dvc_qng);
@@ -6243,7 +6243,7 @@ asc_execute_scsi_cmnd(struct scsi_cmnd *
(ulong) scp, (ulong) scp->scsi_done);
boardp = ASC_BOARDP(scp->device->host);
- device = boardp->device[scp->device->id];
+ device = boardp->device[sdev_id(scp->device)];
if (ASC_NARROW_BOARD(boardp)) {
/*
@@ -6278,7 +6278,7 @@ asc_execute_scsi_cmnd(struct scsi_cmnd *
* Increment monotonically increasing per device successful
* request counter. Wrapping doesn't matter.
*/
- boardp->reqcnt[scp->device->id]++;
+ boardp->reqcnt[sdev_id(scp->device)]++;
asc_enqueue(&boardp->active, scp, ASC_BACK);
ASC_DBG(1,
"asc_execute_scsi_cmnd: AscExeScsiQueue(), ASC_NOERROR\n");
@@ -6358,7 +6358,7 @@ asc_execute_scsi_cmnd(struct scsi_cmnd *
* Increment monotonically increasing per device successful
* request counter. Wrapping doesn't matter.
*/
- boardp->reqcnt[scp->device->id]++;
+ boardp->reqcnt[sdev_id(scp->device)]++;
asc_enqueue(&boardp->active, scp, ASC_BACK);
ASC_DBG(1,
"asc_execute_scsi_cmnd: AdvExeScsiQueue(), ASC_NOERROR\n");
@@ -6434,9 +6434,9 @@ asc_build_req(asc_board_t *boardp, struc
}
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->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.target_id = ASC_TID_TO_TARGET_ID(sdev_id(scp->device));
+ asc_scsi_q.q1.target_lun = scsilun_to_int(&scp->device->lun);
+ asc_scsi_q.q2.target_ix = ASC_TIDLUN_TO_IX(sdev_id(scp->device), scsilun_to_int(&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);
@@ -6451,8 +6451,8 @@ asc_build_req(asc_board_t *boardp, struc
* started request.
*
*/
- if ((boardp->dvc_var.asc_dvc_var.cur_dvc_qng[scp->device->id] > 0) &&
- (boardp->reqcnt[scp->device->id] % 255) == 0) {
+ if ((boardp->dvc_var.asc_dvc_var.cur_dvc_qng[sdev_id(scp->device)] > 0) &&
+ (boardp->reqcnt[sdev_id(scp->device)] % 255) == 0) {
asc_scsi_q.q2.tag_code = MSG_ORDERED_TAG;
} else {
asc_scsi_q.q2.tag_code = MSG_SIMPLE_TAG;
@@ -6610,8 +6610,8 @@ adv_build_req(asc_board_t *boardp, struc
scsiqp->cdb16[i - 12] = scp->cmnd[i];
}
- scsiqp->target_id = scp->device->id;
- scsiqp->target_lun = scp->device->lun;
+ scsiqp->target_id = sdev_id(scp->device);
+ scsiqp->target_lun = scsilun_to_int(&scp->device->lun);
scsiqp->sense_addr = cpu_to_le32(virt_to_bus(&scp->sense_buffer[0]));
scsiqp->sense_len = sizeof(scp->sense_buffer);
@@ -6889,10 +6889,10 @@ asc_isr_callback(ASC_DVC_VAR *asc_dvc_va
* If an INQUIRY command completed successfully, then call
* the AscInquiryHandling() function to set-up the device.
*/
- if (scp->cmnd[0] == INQUIRY && scp->device->lun == 0 &&
+ if (scp->cmnd[0] == INQUIRY && scsilun_zero(&scp->device->lun) &&
(scp->request_bufflen - qdonep->remain_bytes) >= 8)
{
- AscInquiryHandling(asc_dvc_varp, scp->device->id & 0x7,
+ AscInquiryHandling(asc_dvc_varp, sdev_id(scp->device) & 0x7,
(ASC_SCSI_INQUIRY *) scp->request_buffer);
}
@@ -6962,10 +6962,10 @@ asc_isr_callback(ASC_DVC_VAR *asc_dvc_va
* 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->device->id)) == 0 &&
+ if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(sdev_id(scp->device))) == 0 &&
qdonep->d3.done_stat == QD_NO_ERROR &&
qdonep->d3.host_stat == QHSTA_NO_ERROR) {
- boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->device->id);
+ boardp->init_tidmask |= ADV_TID_TO_TIDMASK(sdev_id(scp->device));
}
/*
@@ -7141,10 +7141,10 @@ adv_isr_callback(ADV_DVC_VAR *adv_dvc_va
* 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->device->id)) == 0 &&
+ if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(sdev_id(scp->device))) == 0 &&
scsiqp->done_status == QD_NO_ERROR &&
scsiqp->host_status == QHSTA_NO_ERROR) {
- boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->device->id);
+ boardp->init_tidmask |= ADV_TID_TO_TIDMASK(sdev_id(scp->device));
}
/*
@@ -7384,7 +7384,8 @@ asc_dequeue_list(asc_queue_t *ascq, REQP
{
REQP reqp;
for (reqp = firstp; reqp; reqp = REQPNEXT(reqp)) {
- REQTIMESTAT("asc_dequeue_list", ascq, reqp, reqp->device->id);
+ REQTIMESTAT("asc_dequeue_list", ascq, reqp,
+ sdev_id(reqp->device));
}
}
#endif /* ADVANSYS_STATS */
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 630b115..dda5706 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -2921,8 +2921,9 @@ static void disp_enintr(struct Scsi_Host
*/
static void show_command(Scsi_Cmnd *ptr)
{
- printk(KERN_DEBUG "0x%08x: target=%d; lun=%d; cmnd=(",
- (unsigned int) ptr, ptr->device->id, ptr->device->lun);
+ dev_printk(KERN_DEBUG, &ptr->device->sdev_gendev,
+ "0x%08x: cmnd=(",
+ (unsigned int) ptr);
__scsi_print_command(ptr->cmnd);
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 95c285c..24a4040 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -52,6 +52,7 @@ static struct scsi_transport_template *a
#include <linux/mm.h> /* For fetching system memory size */
#include <linux/blkdev.h> /* For block_size() */
#include <linux/delay.h> /* For ssleep/msleep */
+#include <linux/device.h>
/*
* Bucket size for counting good commands in between bad ones.
@@ -397,7 +398,7 @@ ahd_linux_unmap_scb(struct ahd_softc *ah
/******************************** Macros **************************************/
#define BUILD_SCSIID(ahd, cmd) \
- ((((cmd)->device->id << TID_SHIFT) & TID) | (ahd)->our_id)
+ (((sdev_id((cmd)->device) << TID_SHIFT) & TID) | (ahd)->our_id)
/*
* Return a string describing the driver.
@@ -526,16 +527,14 @@ ahd_linux_target_destroy(struct scsi_tar
static int
ahd_linux_slave_alloc(struct scsi_device *sdev)
{
- struct ahd_softc *ahd =
- *((struct ahd_softc **)sdev->host->hostdata);
struct scsi_target *starget = sdev->sdev_target;
struct ahd_linux_target *targ = scsi_transport_target_data(starget);
struct ahd_linux_device *dev;
if (bootverbose)
- printf("%s: Slave Alloc %d\n", ahd_name(ahd), sdev->id);
+ dev_printk(KERN_INFO, &sdev->sdev_gendev, "Slave Alloc\n");
- BUG_ON(targ->sdev[sdev->lun] != NULL);
+ BUG_ON(targ->sdev[scsilun_to_int(&sdev->lun)] != NULL);
dev = scsi_transport_device_data(sdev);
memset(dev, 0, sizeof(*dev));
@@ -553,7 +552,7 @@ ahd_linux_slave_alloc(struct scsi_device
*/
dev->maxtags = 0;
- targ->sdev[sdev->lun] = sdev;
+ targ->sdev[scsilun_to_int(&sdev->lun)] = sdev;
return (0);
}
@@ -565,7 +564,7 @@ ahd_linux_slave_configure(struct scsi_de
ahd = *((struct ahd_softc **)sdev->host->hostdata);
if (bootverbose)
- printf("%s: Slave Configure %d\n", ahd_name(ahd), sdev->id);
+ dev_printk(KERN_INFO, &sdev->sdev_gendev, "Slave Configure\n");
ahd_linux_device_queue_depth(sdev);
@@ -585,11 +584,11 @@ ahd_linux_slave_destroy(struct scsi_devi
ahd = *((struct ahd_softc **)sdev->host->hostdata);
if (bootverbose)
- printf("%s: Slave Destroy %d\n", ahd_name(ahd), sdev->id);
+ dev_printk(KERN_INFO, &sdev->sdev_gendev, "Slave Destroy\n");
BUG_ON(dev->active);
- targ->sdev[sdev->lun] = NULL;
+ targ->sdev[scsilun_to_int(&sdev->lun)] = NULL;
}
@@ -684,7 +683,7 @@ ahd_linux_bus_reset(struct scsi_cmnd *cm
ahd_name(ahd), cmd);
#endif
ahd_lock(ahd, &s);
- found = ahd_reset_channel(ahd, cmd->device->channel + 'A',
+ found = ahd_reset_channel(ahd, sdev_channel(cmd->device) + 'A',
/*initiate reset*/TRUE);
ahd_unlock(ahd, &s);
@@ -1405,7 +1404,8 @@ ahd_linux_device_queue_depth(struct scsi
ahd_compile_devinfo(&devinfo,
ahd->our_id,
- sdev->sdev_target->id, sdev->lun,
+ sdev->sdev_target->id,
+ scsilun_to_int(&sdev->lun),
sdev->sdev_target->channel == 0 ? 'A' : 'B',
ROLE_INITIATOR);
tags = ahd_linux_user_tagdepth(ahd, &devinfo);
@@ -1434,13 +1434,13 @@ ahd_linux_run_command(struct ahd_softc *
* Get an scb to use.
*/
tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
- cmd->device->id, &tstate);
+ sdev_id(cmd->device), &tstate);
if ((dev->flags & (AHD_DEV_Q_TAGGED|AHD_DEV_Q_BASIC)) == 0
|| (tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ) != 0) {
col_idx = AHD_NEVER_COL_IDX;
} else {
- col_idx = AHD_BUILD_COL_IDX(cmd->device->id,
- cmd->device->lun);
+ col_idx = AHD_BUILD_COL_IDX(sdev_id(cmd->device),
+ scsilun_to_int(&cmd->device->lun));
}
if ((scb = ahd_get_scb(ahd, col_idx)) == NULL) {
ahd->flags |= AHD_RESOURCE_SHORTAGE;
@@ -1457,7 +1457,7 @@ ahd_linux_run_command(struct ahd_softc *
*/
hscb->control = 0;
hscb->scsiid = BUILD_SCSIID(ahd, cmd);
- hscb->lun = cmd->device->lun;
+ hscb->lun = scsilun_to_int(&cmd->device->lun);
scb->hscb->task_management = 0;
mask = SCB_GET_TARGET_MASK(ahd, scb);
@@ -1784,7 +1784,8 @@ ahd_linux_handle_scsi_status(struct ahd_
ahd_compile_devinfo(&devinfo,
ahd->our_id,
- sdev->sdev_target->id, sdev->lun,
+ sdev->sdev_target->id,
+ scsilun_to_int(&sdev->lun),
sdev->sdev_target->channel == 0 ? 'A' : 'B',
ROLE_INITIATOR);
@@ -2067,9 +2068,8 @@ ahd_linux_queue_recovery_cmd(struct scsi
wait = FALSE;
ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
- printf("%s:%d:%d:%d: Attempting to queue a%s message:",
- ahd_name(ahd), cmd->device->channel,
- cmd->device->id, cmd->device->lun,
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Attempting to queue a%s message:",
flag == SCB_ABORT ? "n ABORT" : " TARGET RESET");
printf("CDB:");
@@ -2093,9 +2093,8 @@ ahd_linux_queue_recovery_cmd(struct scsi
* No target device for this command exists,
* so we must not still own the command.
*/
- printf("%s:%d:%d:%d: Is not an active device\n",
- ahd_name(ahd), cmd->device->channel, cmd->device->id,
- cmd->device->lun);
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Is not an active device\n");
retval = SUCCESS;
goto no_cmd;
}
@@ -2112,8 +2111,9 @@ ahd_linux_queue_recovery_cmd(struct scsi
/* Any SCB for this device will do for a target reset */
LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) {
- if (ahd_match_scb(ahd, pending_scb, cmd->device->id,
- cmd->device->channel + 'A',
+ if (ahd_match_scb(ahd, pending_scb,
+ sdev_id(cmd->device),
+ sdev_channel(cmd->device) + 'A',
CAM_LUN_WILDCARD,
SCB_LIST_NULL, ROLE_INITIATOR) == 0)
break;
@@ -2121,9 +2121,8 @@ ahd_linux_queue_recovery_cmd(struct scsi
}
if (pending_scb == NULL) {
- printf("%s:%d:%d:%d: Command not found\n",
- ahd_name(ahd), cmd->device->channel, cmd->device->id,
- cmd->device->lun);
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Command not found\n");
goto no_cmd;
}
@@ -2146,9 +2145,8 @@ ahd_linux_queue_recovery_cmd(struct scsi
paused = TRUE;
if ((pending_scb->flags & SCB_ACTIVE) == 0) {
- printf("%s:%d:%d:%d: Command already completed\n",
- ahd_name(ahd), cmd->device->channel, cmd->device->id,
- cmd->device->lun);
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Command already completed\n");
goto no_cmd;
}
@@ -2158,21 +2156,23 @@ ahd_linux_queue_recovery_cmd(struct scsi
disconnected = TRUE;
if (flag == SCB_ABORT) {
- if (ahd_search_qinfifo(ahd, cmd->device->id,
- cmd->device->channel + 'A',
- cmd->device->lun,
+ if (ahd_search_qinfifo(ahd,
+ sdev_id(cmd->device),
+ sdev_channel(cmd->device) + 'A',
+ scsilun_to_int(&cmd->device->lun),
pending_scb->hscb->tag,
ROLE_INITIATOR, CAM_REQ_ABORTED,
SEARCH_COMPLETE) > 0) {
- printf("%s:%d:%d:%d: Cmd aborted from QINFIFO\n",
- ahd_name(ahd), cmd->device->channel,
- cmd->device->id, cmd->device->lun);
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Cmd aborted from QINFIFO\n");
retval = SUCCESS;
goto done;
}
- } else if (ahd_search_qinfifo(ahd, cmd->device->id,
- cmd->device->channel + 'A',
- cmd->device->lun, pending_scb->hscb->tag,
+ } else if (ahd_search_qinfifo(ahd,
+ sdev_id(cmd->device),
+ sdev_channel(cmd->device) + 'A',
+ scsilun_to_int(&cmd->device->lun),
+ pending_scb->hscb->tag,
ROLE_INITIATOR, /*status*/0,
SEARCH_COUNT) > 0) {
disconnected = FALSE;
@@ -2204,7 +2204,7 @@ ahd_linux_queue_recovery_cmd(struct scsi
if (last_phase != P_BUSFREE
&& (SCB_GET_TAG(pending_scb) == active_scbptr
|| (flag == SCB_DEVICE_RESET
- && SCSIID_TARGET(ahd, saved_scsiid) == cmd->device->id))) {
+ && SCSIID_TARGET(ahd, saved_scsiid) == sdev_id(cmd->device)))) {
/*
* We're active on the bus, so assert ATN
@@ -2214,9 +2214,8 @@ ahd_linux_queue_recovery_cmd(struct scsi
pending_scb->flags |= SCB_RECOVERY_SCB|flag;
ahd_outb(ahd, MSG_OUT, HOST_MSG);
ahd_outb(ahd, SCSISIGO, last_phase|ATNO);
- printf("%s:%d:%d:%d: Device is active, asserting ATN\n",
- ahd_name(ahd), cmd->device->channel,
- cmd->device->id, cmd->device->lun);
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Device is active, asserting ATN\n");
wait = TRUE;
} else if (disconnected) {
@@ -2267,8 +2266,10 @@ ahd_linux_queue_recovery_cmd(struct scsi
* so we are the next SCB for this target
* to run.
*/
- ahd_search_qinfifo(ahd, cmd->device->id,
- cmd->device->channel + 'A', cmd->device->lun,
+ ahd_search_qinfifo(ahd,
+ sdev_id(cmd->device),
+ sdev_channel(cmd->device) + 'A',
+ scsilun_to_int(&cmd->device->lun),
SCB_LIST_NULL, ROLE_INITIATOR,
CAM_REQUEUE_REQ, SEARCH_COMPLETE);
ahd_qinfifo_requeue_tail(ahd, pending_scb);
@@ -2277,9 +2278,8 @@ ahd_linux_queue_recovery_cmd(struct scsi
printf("Device is disconnected, re-queuing SCB\n");
wait = TRUE;
} else {
- printf("%s:%d:%d:%d: Unable to deliver message\n",
- ahd_name(ahd), cmd->device->channel,
- cmd->device->id, cmd->device->lun);
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Unable to deliver message\n");
retval = FAILED;
goto done;
}
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 6ee1435..1632db6 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -599,16 +599,14 @@ ahc_linux_target_destroy(struct scsi_tar
static int
ahc_linux_slave_alloc(struct scsi_device *sdev)
{
- struct ahc_softc *ahc =
- *((struct ahc_softc **)sdev->host->hostdata);
struct scsi_target *starget = sdev->sdev_target;
struct ahc_linux_target *targ = scsi_transport_target_data(starget);
struct ahc_linux_device *dev;
if (bootverbose)
- printf("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id);
+ dev_printk(KERN_INFO, &sdev->sdev_gendev, "Slave Alloc\n");
- BUG_ON(targ->sdev[sdev->lun] != NULL);
+ BUG_ON(targ->sdev[scsilun_to_int(&sdev->lun)] != NULL);
dev = scsi_transport_device_data(sdev);
memset(dev, 0, sizeof(*dev));
@@ -626,7 +624,7 @@ ahc_linux_slave_alloc(struct scsi_device
*/
dev->maxtags = 0;
- targ->sdev[sdev->lun] = sdev;
+ targ->sdev[scsilun_to_int(&sdev->lun)] = sdev;
spi_period(starget) = 0;
@@ -641,7 +639,7 @@ ahc_linux_slave_configure(struct scsi_de
ahc = *((struct ahc_softc **)sdev->host->hostdata);
if (bootverbose)
- printf("%s: Slave Configure %d\n", ahc_name(ahc), sdev->id);
+ dev_printk(KERN_INFO, &sdev->sdev_gendev, "Slave Configure\n");
ahc_linux_device_queue_depth(sdev);
@@ -661,11 +659,11 @@ ahc_linux_slave_destroy(struct scsi_devi
ahc = *((struct ahc_softc **)sdev->host->hostdata);
if (bootverbose)
- printf("%s: Slave Destroy %d\n", ahc_name(ahc), sdev->id);
+ dev_printk(KERN_INFO, &sdev->sdev_gendev, "Slave Destroy\n");
BUG_ON(dev->active);
- targ->sdev[sdev->lun] = NULL;
+ targ->sdev[scsilun_to_int(&sdev->lun)] = NULL;
}
#if defined(__i386__)
@@ -686,7 +684,7 @@ ahc_linux_biosparam(struct scsi_device *
u_int channel;
ahc = *((struct ahc_softc **)sdev->host->hostdata);
- channel = sdev->channel;
+ channel = sdev_channel(sdev);
bh = scsi_bios_ptable(bdev);
if (bh) {
@@ -759,7 +757,7 @@ ahc_linux_bus_reset(struct scsi_cmnd *cm
ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
ahc_lock(ahc, &flags);
- found = ahc_reset_channel(ahc, cmd->device->channel + 'A',
+ found = ahc_reset_channel(ahc, sdev_channel(cmd->device) + 'A',
/*initiate reset*/TRUE);
ahc_unlock(ahc, &flags);
@@ -798,9 +796,9 @@ struct scsi_host_template aic7xxx_driver
/******************************** Macros **************************************/
#define BUILD_SCSIID(ahc, cmd) \
- ((((cmd)->device->id << TID_SHIFT) & TID) \
- | (((cmd)->device->channel == 0) ? (ahc)->our_id : (ahc)->our_id_b) \
- | (((cmd)->device->channel == 0) ? 0 : TWIN_CHNLB))
+ (((sdev_id((cmd)->device) << TID_SHIFT) & TID) \
+ | ((sdev_channel((cmd)->device) == 0) ? (ahc)->our_id : (ahc)->our_id_b) \
+ | ((sdev_channel((cmd)->device) == 0) ? 0 : TWIN_CHNLB))
/******************************** Bus DMA *************************************/
int
@@ -1398,7 +1396,8 @@ ahc_linux_device_queue_depth(struct scsi
ahc_compile_devinfo(&devinfo,
sdev->sdev_target->channel == 0
? ahc->our_id : ahc->our_id_b,
- sdev->sdev_target->id, sdev->lun,
+ sdev->sdev_target->id,
+ scsilun_to_int(&sdev->lun),
sdev->sdev_target->channel == 0 ? 'A' : 'B',
ROLE_INITIATOR);
tags = ahc_linux_user_tagdepth(ahc, &devinfo);
@@ -1440,7 +1439,7 @@ ahc_linux_run_command(struct ahc_softc *
&& (ahc->features & AHC_SCB_BTT) == 0) {
int target_offset;
- target_offset = cmd->device->id + cmd->device->channel * 8;
+ target_offset = sdev_id(cmd->device) + sdev_channel(cmd->device) * 8;
untagged_q = &(ahc->untagged_queues[target_offset]);
if (!TAILQ_EMPTY(untagged_q))
/* if we're already executing an untagged command
@@ -1465,7 +1464,7 @@ ahc_linux_run_command(struct ahc_softc *
*/
hscb->control = 0;
hscb->scsiid = BUILD_SCSIID(ahc, cmd);
- hscb->lun = cmd->device->lun;
+ hscb->lun = scsilun_to_int(&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),
@@ -1849,7 +1848,8 @@ ahc_linux_handle_scsi_status(struct ahc_
ahc_compile_devinfo(&devinfo,
ahc->our_id,
- sdev->sdev_target->id, sdev->lun,
+ sdev->sdev_target->id,
+ scsilun_to_int(&sdev->lun),
sdev->sdev_target->channel == 0 ? 'A' : 'B',
ROLE_INITIATOR);
@@ -2117,9 +2117,8 @@ ahc_linux_queue_recovery_cmd(struct scsi
wait = FALSE;
ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
- printf("%s:%d:%d:%d: Attempting to queue a%s message\n",
- ahc_name(ahc), cmd->device->channel,
- cmd->device->id, cmd->device->lun,
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Attempting to queue a%s message\n",
flag == SCB_ABORT ? "n ABORT" : " TARGET RESET");
printf("CDB:");
@@ -2143,21 +2142,19 @@ ahc_linux_queue_recovery_cmd(struct scsi
* No target device for this command exists,
* so we must not still own the command.
*/
- printf("%s:%d:%d:%d: Is not an active device\n",
- ahc_name(ahc), cmd->device->channel, cmd->device->id,
- cmd->device->lun);
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Is not an active device\n");
retval = SUCCESS;
goto no_cmd;
}
if ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED)) == 0
- && ahc_search_untagged_queues(ahc, cmd, cmd->device->id,
- cmd->device->channel + 'A',
- cmd->device->lun,
+ && ahc_search_untagged_queues(ahc, cmd, sdev_id(cmd->device),
+ sdev_channel(cmd->device) + 'A',
+ scsilun_to_int(&cmd->device->lun),
CAM_REQ_ABORTED, SEARCH_COMPLETE) != 0) {
- printf("%s:%d:%d:%d: Command found on untagged queue\n",
- ahc_name(ahc), cmd->device->channel, cmd->device->id,
- cmd->device->lun);
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Command found on untagged queue\n");
retval = SUCCESS;
goto done;
}
@@ -2174,8 +2171,8 @@ ahc_linux_queue_recovery_cmd(struct scsi
/* Any SCB for this device will do for a target reset */
LIST_FOREACH(pending_scb, &ahc->pending_scbs, pending_links) {
- if (ahc_match_scb(ahc, pending_scb, cmd->device->id,
- cmd->device->channel + 'A',
+ if (ahc_match_scb(ahc, pending_scb, sdev_id(cmd->device),
+ sdev_channel(cmd->device) + 'A',
CAM_LUN_WILDCARD,
SCB_LIST_NULL, ROLE_INITIATOR) == 0)
break;
@@ -2183,9 +2180,8 @@ ahc_linux_queue_recovery_cmd(struct scsi
}
if (pending_scb == NULL) {
- printf("%s:%d:%d:%d: Command not found\n",
- ahc_name(ahc), cmd->device->channel, cmd->device->id,
- cmd->device->lun);
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Command not found\n");
goto no_cmd;
}
@@ -2207,9 +2203,8 @@ ahc_linux_queue_recovery_cmd(struct scsi
paused = TRUE;
if ((pending_scb->flags & SCB_ACTIVE) == 0) {
- printf("%s:%d:%d:%d: Command already completed\n",
- ahc_name(ahc), cmd->device->channel, cmd->device->id,
- cmd->device->lun);
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Command already completed\n");
goto no_cmd;
}
@@ -2219,21 +2214,21 @@ ahc_linux_queue_recovery_cmd(struct scsi
disconnected = TRUE;
if (flag == SCB_ABORT) {
- if (ahc_search_qinfifo(ahc, cmd->device->id,
- cmd->device->channel + 'A',
- cmd->device->lun,
+ if (ahc_search_qinfifo(ahc, sdev_id(cmd->device),
+ sdev_channel(cmd->device) + 'A',
+ scsilun_to_int(&cmd->device->lun),
pending_scb->hscb->tag,
ROLE_INITIATOR, CAM_REQ_ABORTED,
SEARCH_COMPLETE) > 0) {
- printf("%s:%d:%d:%d: Cmd aborted from QINFIFO\n",
- ahc_name(ahc), cmd->device->channel,
- cmd->device->id, cmd->device->lun);
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Cmd aborted from QINFIFO\n");
retval = SUCCESS;
goto done;
}
- } else if (ahc_search_qinfifo(ahc, cmd->device->id,
- cmd->device->channel + 'A',
- cmd->device->lun, pending_scb->hscb->tag,
+ } else if (ahc_search_qinfifo(ahc, sdev_id(cmd->device),
+ sdev_channel(cmd->device) + 'A',
+ scsilun_to_int(&cmd->device->lun),
+ pending_scb->hscb->tag,
ROLE_INITIATOR, /*status*/0,
SEARCH_COUNT) > 0) {
disconnected = FALSE;
@@ -2266,7 +2261,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
if (last_phase != P_BUSFREE
&& (pending_scb->hscb->tag == active_scb_index
|| (flag == SCB_DEVICE_RESET
- && SCSIID_TARGET(ahc, saved_scsiid) == cmd->device->id))) {
+ && SCSIID_TARGET(ahc, saved_scsiid) == sdev_id(cmd->device)))) {
/*
* We're active on the bus, so assert ATN
@@ -2276,9 +2271,8 @@ ahc_linux_queue_recovery_cmd(struct scsi
pending_scb->flags |= SCB_RECOVERY_SCB|flag;
ahc_outb(ahc, MSG_OUT, HOST_MSG);
ahc_outb(ahc, SCSISIGO, last_phase|ATNO);
- printf("%s:%d:%d:%d: Device is active, asserting ATN\n",
- ahc_name(ahc), cmd->device->channel, cmd->device->id,
- cmd->device->lun);
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Device is active, asserting ATN\n");
wait = TRUE;
} else if (disconnected) {
@@ -2308,9 +2302,10 @@ ahc_linux_queue_recovery_cmd(struct scsi
* same element in the SCB, SCB_NEXT, for
* both the qinfifo and the disconnected list.
*/
- ahc_search_disc_list(ahc, cmd->device->id,
- cmd->device->channel + 'A',
- cmd->device->lun, pending_scb->hscb->tag,
+ ahc_search_disc_list(ahc, sdev_id(cmd->device),
+ sdev_channel(cmd->device) + 'A',
+ scsilun_to_int(&cmd->device->lun),
+ pending_scb->hscb->tag,
/*stop_on_first*/TRUE,
/*remove*/TRUE,
/*save_state*/FALSE);
@@ -2333,9 +2328,10 @@ ahc_linux_queue_recovery_cmd(struct scsi
* so we are the next SCB for this target
* to run.
*/
- ahc_search_qinfifo(ahc, cmd->device->id,
- cmd->device->channel + 'A',
- cmd->device->lun, SCB_LIST_NULL,
+ ahc_search_qinfifo(ahc, sdev_id(cmd->device),
+ sdev_channel(cmd->device) + 'A',
+ scsilun_to_int(&cmd->device->lun),
+ SCB_LIST_NULL,
ROLE_INITIATOR, CAM_REQUEUE_REQ,
SEARCH_COMPLETE);
ahc_qinfifo_requeue_tail(ahc, pending_scb);
@@ -2344,9 +2340,8 @@ ahc_linux_queue_recovery_cmd(struct scsi
printf("Device is disconnected, re-queuing SCB\n");
wait = TRUE;
} else {
- printf("%s:%d:%d:%d: Unable to deliver message\n",
- ahc_name(ahc), cmd->device->channel, cmd->device->id,
- cmd->device->lun);
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "Unable to deliver message\n");
retval = FAILED;
goto done;
}
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 7235f94..c3a13e0 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -425,7 +425,10 @@ static int adpt_queue(struct 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->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun)) == NULL) {
+ if ((pDev = adpt_find_device(pHba,
+ sdev_channel(cmd->device),
+ sdev_id(cmd->device),
+ scsilun_to_int(&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);
@@ -724,9 +727,10 @@ static int adpt_bus_reset(struct scsi_cm
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->device->channel,pHba->channel[cmd->device->channel].tid );
+ dev_printk(KERN_WARNING, &cmd->device->sdev_gendev,
+ "Bus reset: tid: %d\n", pHba->channel[sdev_channel(cmd->device)].tid );
msg[0] = FOUR_WORD_MSG_SIZE|SGL_OFFSET_0;
- msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[cmd->device->channel].tid);
+ msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[sdev_channel(cmd->device)].tid);
msg[2] = 0;
msg[3] = 0;
if(adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER) ){
@@ -744,7 +748,8 @@ static int __adpt_reset(struct scsi_cmnd
adpt_hba* pHba;
int rcode;
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 );
+ dev_printk(KERN_WARNING, &cmd->device->sdev_gendev,
+ "Hba Reset: tid: %d\n", pHba->channel[sdev_channel(cmd->device)].tid );
rcode = adpt_hba_reset(pHba);
if(rcode == 0){
printk(KERN_WARNING"%s: HBA reset complete\n",pHba->name);
@@ -2256,8 +2261,9 @@ static s32 adpt_i2o_to_scsi(void __iomem
case I2O_SCSI_DSC_COMMAND_TIMEOUT:
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->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun, hba_status, dev_status, cmd->cmnd[0]);
+ dev_printk(KERN_WARNING, &cmd->device->sdev_gendev,
+ "SCSI Timeout-Device hba status=0x%x, dev status=0x%x, cmd=0x%x\n",
+ hba_status, dev_status, cmd->cmnd[0]);
cmd->result = (DID_TIME_OUT << 16);
break;
case I2O_SCSI_DSC_ADAPTER_BUSY:
@@ -2296,8 +2302,9 @@ static s32 adpt_i2o_to_scsi(void __iomem
case I2O_SCSI_DSC_QUEUE_FROZEN:
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->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun,
+ dev_printk(KERN_WARNING, &cmd->device->sdev_gendev,
+ "SCSI error %0x-Device hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n",
+ detailed_status & I2O_SCSI_DSC_MASK,
hba_status, dev_status, cmd->cmnd[0]);
cmd->result = (DID_ERROR << 16);
break;
@@ -2314,8 +2321,8 @@ static s32 adpt_i2o_to_scsi(void __iomem
cmd->sense_buffer[2] == DATA_PROTECT ){
/* 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->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun,
+ dev_printk(KERN_WARNING, &cmd->device->sdev_gendev,
+ "SCSI Data Protect-Device hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n",
hba_status, dev_status, cmd->cmnd[0]);
}
@@ -2326,8 +2333,8 @@ static s32 adpt_i2o_to_scsi(void __iomem
* for a limitted number of retries.
*/
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->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun,
+ dev_printk(KERN_WARNING, &cmd->device->sdev_gendev,
+ "I2O MSG_FAIL - Device tid=%d, cmd=0x%x\n",
((struct adpt_device*)(cmd->device->hostdata))->tid, cmd->cmnd[0]);
}
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c
index 3b2a5bf..9353598 100644
--- a/drivers/scsi/fdomain.c
+++ b/drivers/scsi/fdomain.c
@@ -1154,7 +1154,7 @@ static irqreturn_t do_fdomain_16x0_intr(
outb(0x40 | FIFO_COUNT, port_base + Interrupt_Cntl);
outb(0x82, port_base + SCSI_Cntl); /* Bus Enable + Select */
- outb(adapter_mask | (1 << current_SC->device->id), port_base + SCSI_Data_NoACK);
+ outb(adapter_mask | (1 << sdev_id(current_SC->device)), port_base + SCSI_Data_NoACK);
/* Stop arbitration and enable parity */
outb(0x10 | PARITY_MASK, port_base + TMC_Cntl);
@@ -1166,7 +1166,7 @@ static irqreturn_t do_fdomain_16x0_intr(
status = inb(port_base + SCSI_Status);
if (!(status & 0x01)) {
/* Try again, for slow devices */
- if (fdomain_select( current_SC->device->id )) {
+ if (fdomain_select( sdev_id(current_SC->device) )) {
#if EVERY_ACCESS
printk( " SFAIL " );
#endif
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 2/2] HCIL drivers update
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
@ 2005-10-23 19:52 ` Jeff Garzik
2005-10-23 20:12 ` [PATCH RFC 3/2] HCIL driver update: lpfc Jeff Garzik
` (12 subsequent siblings)
13 siblings, 0 replies; 19+ messages in thread
From: Jeff Garzik @ 2005-10-23 19:52 UTC (permalink / raw)
To: linux-scsi
See patch 1/2 for description. DO NOT APPLY.
drivers/scsi/lpfc/lpfc_scsi.c | 80 ++++++++++++++++++----------
drivers/scsi/lpfc/lpfc_sli.c | 7 +-
drivers/scsi/megaraid/mega_common.h | 8 +-
drivers/scsi/megaraid/megaraid_mbox.c | 8 +-
drivers/scsi/megaraid/megaraid_sas.c | 14 ++---
drivers/scsi/megaraid/megaraid_sas.h | 6 +-
drivers/scsi/pcmcia/nsp_cs.c | 14 ++---
drivers/scsi/pcmcia/sym53c500_cs.c | 2
drivers/scsi/psi240i.c | 4 -
drivers/scsi/qla2xxx/qla_dbg.c | 7 +-
drivers/scsi/qla2xxx/qla_iocb.c | 6 +-
drivers/scsi/qla2xxx/qla_isr.c | 7 +-
drivers/scsi/qla2xxx/qla_mbx.c | 2
drivers/scsi/qla2xxx/qla_os.c | 43 ++++++---------
drivers/scsi/scsi_scan.c | 2
drivers/scsi/sym53c8xx_2/sym_glue.c | 44 +++++++++------
drivers/scsi/sym53c8xx_2/sym_hipd.c | 94 ++++++++++++++++++----------------
drivers/scsi/sym53c8xx_2/sym_hipd.h | 13 +++-
drivers/scsi/sym53c8xx_2/sym_misc.h | 10 ++-
drivers/usb/storage/dpcm.c | 17 ++++--
drivers/usb/storage/transport.c | 4 -
drivers/usb/storage/usb.c | 22 +++++--
include/scsi/scsi.h | 2
include/scsi/scsi_device.h | 11 +++
24 files changed, 250 insertions(+), 177 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index b5ad187..a162174 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -370,6 +370,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba
struct lpfc_nodelist *pnode = rdata->pnode;
struct scsi_cmnd *cmd = lpfc_cmd->pCmd;
unsigned long iflag;
+ char lunstr[SCSILUN_STR_LEN];
lpfc_cmd->result = pIocbOut->iocb.un.ulpWord[4];
lpfc_cmd->status = pIocbOut->iocb.ulpStatus;
@@ -382,10 +383,11 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba
lpfc_cmd->status = IOSTAT_DEFAULT;
lpfc_printf_log(phba, KERN_WARNING, LOG_FCP,
- "%d:0729 FCP cmd x%x failed <%d/%d> status: "
+ "%d:0729 FCP cmd x%x failed <%d/%s> status: "
"x%x result: x%x Data: x%x x%x\n",
- phba->brd_no, cmd->cmnd[0], cmd->device->id,
- cmd->device->lun, lpfc_cmd->status,
+ phba->brd_no, cmd->cmnd[0], sdev_id(cmd->device),
+ scsilun_to_str(&cmd->device->lun, lunstr),
+ lpfc_cmd->status,
lpfc_cmd->result, pIocbOut->iocb.ulpContext,
lpfc_cmd->cur_iocbq.iocb.ulpIoTag);
@@ -419,10 +421,11 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba
uint32_t *lp = (uint32_t *)cmd->sense_buffer;
lpfc_printf_log(phba, KERN_INFO, LOG_FCP,
- "%d:0710 Iodone <%d/%d> cmd %p, error x%x "
+ "%d:0710 Iodone <%d/%s> cmd %p, error x%x "
"SNS x%x x%x Data: x%x x%x\n",
- phba->brd_no, cmd->device->id,
- cmd->device->lun, cmd, cmd->result,
+ phba->brd_no, sdev_id(cmd->device),
+ scsilun_to_str(&cmd->device->lun, lunstr),
+ cmd, cmd->result,
*lp, *(lp + 3), cmd->retries, cmd->resid);
}
@@ -448,8 +451,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_hba * ph
/* clear task management bits */
lpfc_cmd->fcp_cmnd->fcpCntl2 = 0;
- int_to_scsilun(lpfc_cmd->pCmd->device->lun,
- &lpfc_cmd->fcp_cmnd->fcp_lun);
+ scsilun_cp(&lpfc_cmd->fcp_cmnd->fcp_lun, &lpfc_cmd->pCmd->device->lun);
memcpy(&fcp_cmnd->fcpCdb[0], scsi_cmnd->cmnd, 16);
@@ -538,6 +540,7 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc
struct scsi_device *scsi_dev = lpfc_cmd->pCmd->device;
struct lpfc_rport_data *rdata = scsi_dev->hostdata;
struct lpfc_nodelist *ndlp = rdata->pnode;
+ char lunstr[SCSILUN_STR_LEN];
if ((ndlp == 0) || (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) {
return 0;
@@ -548,8 +551,7 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc
piocb = &piocbq->iocb;
fcp_cmnd = lpfc_cmd->fcp_cmnd;
- int_to_scsilun(lpfc_cmd->pCmd->device->lun,
- &lpfc_cmd->fcp_cmnd->fcp_lun);
+ scsilun_cp(&lpfc_cmd->fcp_cmnd->fcp_lun, &lpfc_cmd->pCmd->device->lun);
fcp_cmnd->fcpCntl2 = task_mgmt_cmd;
piocb->ulpCommand = CMD_FCP_ICMND64_CR;
@@ -579,10 +581,11 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc
lpfc_printf_log(phba,
KERN_INFO,
LOG_FCP,
- "%d:0703 Issue LUN Reset to TGT %d LUN %d "
+ "%d:0703 Issue LUN Reset to TGT %d LUN %s "
"Data: x%x x%x\n",
phba->brd_no,
- scsi_dev->id, scsi_dev->lun,
+ sdev_id(scsi_dev),
+ scsilun_to_str(&scsi_dev->lun, lunstr),
ndlp->nlp_rpi, ndlp->nlp_flag);
break;
@@ -591,10 +594,11 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc
lpfc_printf_log(phba,
KERN_INFO,
LOG_FCP,
- "%d:0701 Issue Abort Task Set to TGT %d LUN %d "
+ "%d:0701 Issue Abort Task Set to TGT %d LUN %s "
"Data: x%x x%x\n",
phba->brd_no,
- scsi_dev->id, scsi_dev->lun,
+ sdev_id(scsi_dev),
+ scsilun_to_str(&scsi_dev->lun, lunstr),
ndlp->nlp_rpi, ndlp->nlp_flag);
break;
@@ -606,7 +610,8 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc
"%d:0702 Issue Target Reset to TGT %d "
"Data: x%x x%x\n",
phba->brd_no,
- scsi_dev->id, ndlp->nlp_rpi,
+ sdev_id(scsi_dev),
+ ndlp->nlp_rpi,
ndlp->nlp_flag);
break;
}
@@ -657,8 +662,9 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf
* to double check.
*/
lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring],
- lpfc_cmd->pCmd->device->id,
- lpfc_cmd->pCmd->device->lun, 0, LPFC_CTX_TGT);
+ sdev_id(lpfc_cmd->pCmd->device),
+ scsilun_to_int(&lpfc_cmd->pCmd->device->lun),
+ 0, LPFC_CTX_TGT);
/* Return response IOCB to free list. */
list_add_tail(&iocbqrsp->list, lpfc_iocb_list);
@@ -828,8 +834,8 @@ __lpfc_abort_handler(struct scsi_cmnd *c
return SUCCESS;
/* save these now since lpfc_cmd can be freed */
- id = lpfc_cmd->pCmd->device->id;
- lun = lpfc_cmd->pCmd->device->lun;
+ id = sdev_id(lpfc_cmd->pCmd->device);
+ lun = scsilun_to_int(&lpfc_cmd->pCmd->device->lun);
snum = lpfc_cmd->pCmd->serial_number;
list_for_each_entry_safe(iocb, next_iocb, &pring->txq, list) {
@@ -947,6 +953,7 @@ __lpfc_reset_lun_handler(struct scsi_cmn
struct lpfc_nodelist *pnode = rdata->pnode;
int ret = FAILED;
int cnt, loopcnt;
+ char lunstr[SCSILUN_STR_LEN];
/*
* If target is not in a MAPPED state, delay the reset until
@@ -1008,13 +1015,15 @@ __lpfc_reset_lun_handler(struct scsi_cmn
* to double check.
*/
lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring],
- cmnd->device->id, cmnd->device->lun, 0,
+ sdev_id(cmnd->device),
+ scsilun_to_int(&cmnd->device->lun), 0,
LPFC_CTX_LUN);
loopcnt = 0;
while((cnt = lpfc_sli_sum_iocb(phba,
&phba->sli.ring[phba->sli.fcp_ring],
- cmnd->device->id, cmnd->device->lun,
+ sdev_id(cmnd->device),
+ scsilun_to_int(&cmnd->device->lun),
LPFC_CTX_LUN))) {
spin_unlock_irq(phba->host->host_lock);
set_current_state(TASK_UNINTERRUPTIBLE);
@@ -1036,10 +1045,12 @@ __lpfc_reset_lun_handler(struct scsi_cmn
out_free_scsi_buf:
lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
- "%d:0713 SCSI layer issued LUN reset (%d, %d) "
+ "%d:0713 SCSI layer issued LUN reset (%d, %s) "
"Data: x%x x%x x%x\n",
- phba->brd_no, lpfc_cmd->pCmd->device->id,
- lpfc_cmd->pCmd->device->lun, ret, lpfc_cmd->status,
+ phba->brd_no,
+ sdev_id(lpfc_cmd->pCmd->device),
+ scsilun_to_str(&lpfc_cmd->pCmd->device->lun, lunstr),
+ ret, lpfc_cmd->status,
lpfc_cmd->result);
lpfc_free_scsi_buf(lpfc_cmd);
out:
@@ -1086,7 +1097,7 @@ __lpfc_reset_bus_handler(struct scsi_cmn
* targets known to the driver. Should any target reset
* fail, this routine returns failure to the midlayer.
*/
- midlayer_id = cmnd->device->id;
+ midlayer_id = sdev_id(cmnd->device);
for (i = 0; i < MAX_FCP_TARGET; i++) {
/* Search the mapped list for this target ID */
match = 0;
@@ -1099,7 +1110,14 @@ __lpfc_reset_bus_handler(struct scsi_cmn
if (!match)
continue;
- lpfc_cmd->pCmd->device->id = i;
+ /* FIXME: what is this doing? presumably,
+ * sdev->id == sdev->sdev_target->id, but the following
+ * code breaks that assumption. We guess at a fix,
+ * for now.
+ */
+ /* PREV: lpfc_cmd->pCmd->device->id = i; */
+ lpfc_cmd->pCmd->device->sdev_target->id = i;
+
lpfc_cmd->pCmd->device->hostdata = ndlp->rport->dd_data;
ret = lpfc_scsi_tgt_reset(lpfc_cmd, phba);
if (ret != SUCCESS) {
@@ -1110,7 +1128,13 @@ __lpfc_reset_bus_handler(struct scsi_cmn
}
}
- cmnd->device->id = midlayer_id;
+ /* FIXME: what is this doing? presumably,
+ * sdev->id == sdev->sdev_target->id, but the following
+ * code breaks that assumption. We guess at a fix,
+ * for now.
+ */
+ /* PREV: cmnd->device->id = midlayer_id; */
+ cmnd->device->sdev_target->id = midlayer_id;
loopcnt = 0;
while((cnt = lpfc_sli_sum_iocb(phba,
&phba->sli.ring[phba->sli.fcp_ring],
@@ -1190,7 +1214,7 @@ lpfc_slave_alloc(struct scsi_device *sde
if (list_empty(listp))
continue;
list_for_each_entry(ndlp, listp, nlp_listp) {
- if ((sdev->id == ndlp->nlp_sid) && ndlp->rport) {
+ if ((sdev_id(sdev) == ndlp->nlp_sid) && ndlp->rport) {
match = 1;
break;
}
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index e74e224..153c69a 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -2504,12 +2504,13 @@ lpfc_sli_validate_iocb_cmd(struct lpfc_s
switch (ctx_cmd) {
case LPFC_CTX_LUN:
- if ((lpfc_cmd->pCmd->device->id == tgt_id) &&
- (lpfc_cmd->pCmd->device->lun == lun_id))
+ /* FIXME: use scsilun_eq() */
+ if ((sdev_id(lpfc_cmd->pCmd->device) == tgt_id) &&
+ (scsilun_to_int(&lpfc_cmd->pCmd->device->lun) == lun_id))
rc = 0;
break;
case LPFC_CTX_TGT:
- if (lpfc_cmd->pCmd->device->id == tgt_id)
+ if (sdev_id(lpfc_cmd->pCmd->device) == tgt_id)
rc = 0;
break;
case LPFC_CTX_CTX:
diff --git a/drivers/scsi/megaraid/mega_common.h b/drivers/scsi/megaraid/mega_common.h
index 69df1a9..87b3ec7 100644
--- a/drivers/scsi/megaraid/mega_common.h
+++ b/drivers/scsi/megaraid/mega_common.h
@@ -199,9 +199,9 @@ typedef struct {
// conversion from scsi command
#define SCP2HOST(scp) (scp)->device->host // to host
#define SCP2HOSTDATA(scp) SCP2HOST(scp)->hostdata // to soft state
-#define SCP2CHANNEL(scp) (scp)->device->channel // to channel
-#define SCP2TARGET(scp) (scp)->device->id // to target
-#define SCP2LUN(scp) (scp)->device->lun // to LUN
+#define SCP2CHANNEL(scp) sdev_channel((scp)->device) // to channel
+#define SCP2TARGET(scp) sdev_id((scp)->device) // to target
+#define SCP2LUN(scp) scsilun_to_int(&(scp)->device->lun) // to LUN
// generic macro to convert scsi command and host to controller's soft state
#define SCSIHOST2ADAP(host) (((caddr_t *)(host->hostdata))[0])
@@ -223,7 +223,7 @@ typedef struct {
(SCP2CHANNEL(scp) == (adp)->max_channel) ? 1 : 0
#define MRAID_IS_LOGICAL_SDEV(adp, sdev) \
- (sdev->channel == (adp)->max_channel) ? 1 : 0
+ (sdev_channel(sdev) == (adp)->max_channel) ? 1 : 0
#define MRAID_GET_DEVICE_MAP(adp, scp, p_chan, target, islogical) \
/* \
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
index d47be8e..6749b34 100644
--- a/drivers/scsi/megaraid/megaraid_mbox.c
+++ b/drivers/scsi/megaraid/megaraid_mbox.c
@@ -1712,7 +1712,7 @@ megaraid_mbox_build_cmd(adapter_t *adapt
* Do not allow LUN > 0 for logical drives and
* requests for more than 40 logical drives
*/
- if (SCP2LUN(scp)) {
+ if (!scsilun_zero(&scp->device->lun)) {
scp->result = (DID_BAD_TARGET << 16);
return NULL;
}
@@ -4165,15 +4165,15 @@ megaraid_sysfs_show_ldnum(struct device
for (i = 0; i < MAX_LOGICAL_DRIVES_40LD; i++) {
- mapped_sdev_id = sdev->id;
+ mapped_sdev_id = sdev_id(sdev);
- if (sdev->id > adapter->init_id) {
+ if (sdev_id(sdev) > adapter->init_id) {
mapped_sdev_id -= 1;
}
if (raid_dev->curr_ldmap[i] == mapped_sdev_id) {
- scsi_id = sdev->id;
+ scsi_id = sdev_id(sdev);
logical_drv = i;
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index c3f6373..8dcec7c 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -389,7 +389,7 @@ megasas_build_dcdb(struct megasas_instan
pthru->cmd_status = 0x0;
pthru->scsi_status = 0x0;
pthru->target_id = device_id;
- pthru->lun = scp->device->lun;
+ pthru->lun = scsilun_to_int(&scp->device->lun);
pthru->cdb_len = scp->cmd_len;
pthru->timeout = 0;
pthru->flags = flags;
@@ -581,7 +581,7 @@ static inline struct megasas_cmd *megasa
*/
if (logical_cmd) {
- if (scp->device->id >= MEGASAS_MAX_LD) {
+ if (sdev_id(scp->device) >= MEGASAS_MAX_LD) {
scp->result = DID_BAD_TARGET << 16;
return NULL;
}
@@ -599,7 +599,7 @@ static inline struct megasas_cmd *megasa
/*
* Fail for LUN > 0
*/
- if (scp->device->lun) {
+ if (!scsilun_zero(&scp->device->lun)) {
scp->result = DID_BAD_TARGET << 16;
return NULL;
}
@@ -624,7 +624,7 @@ static inline struct megasas_cmd *megasa
/*
* Fail for LUN > 0
*/
- if (scp->device->lun) {
+ if (!scsilun_zero(&scp->device->lun)) {
scp->result = DID_BAD_TARGET << 16;
return NULL;
}
@@ -758,9 +758,9 @@ static int megasas_generic_reset(struct
instance = (struct megasas_instance *)scmd->device->host->hostdata;
- printk(KERN_NOTICE "megasas: RESET -%ld cmd=%x <c=%d t=%d l=%d>\n",
- scmd->serial_number, scmd->cmnd[0], scmd->device->channel,
- scmd->device->id, scmd->device->lun);
+ dev_printk(KERN_NOTICE, &scmd->device->sdev_gendev,
+ "megasas: RESET -%ld cmd=%x\n",
+ scmd->serial_number, scmd->cmnd[0]);
if (instance->hw_crit_error) {
printk(KERN_ERR "megasas: cannot recover from previous reset "
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index eaec9d5..f86a80d 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -1059,11 +1059,11 @@ struct megasas_instance {
};
#define MEGASAS_IS_LOGICAL(scp) \
- (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1
+ (sdev_channel(scp->device) < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1
#define MEGASAS_DEV_INDEX(inst, scp) \
- ((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \
- scp->device->id
+ ((sdev_channel(scp->device) % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \
+ sdev_id(scp->device)
struct megasas_cmd {
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 3cd3b40..b5fb13d 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -201,7 +201,7 @@ static int nsp_queuecommand(Scsi_Cmnd *S
#ifdef NSP_DEBUG
/*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 target = sdev_id(SCpnt->device);
#endif
nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
@@ -373,7 +373,7 @@ static int nsphw_start_selection(Scsi_Cm
{
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 target = sdev_id(SCpnt->device);
nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
int time_out;
unsigned char phase, arbit;
@@ -452,7 +452,7 @@ static struct nsp_sync_table nsp_sync_ta
*/
static int nsp_analyze_sdtr(Scsi_Cmnd *SCpnt)
{
- unsigned char target = SCpnt->device->id;
+ unsigned char target = sdev_id(SCpnt->device);
// unsigned char lun = SCpnt->device->lun;
nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
sync_data *sync = &(data->Sync[target]);
@@ -677,7 +677,7 @@ static int nsp_reselected(Scsi_Cmnd *SCp
target++;
}
- if (SCpnt->device->id != target) {
+ if (sdev_id(SCpnt->device) != target) {
nsp_msg(KERN_ERR, "XXX: reselect ID must be %d in this implementation.", target);
}
@@ -912,7 +912,7 @@ static void nsp_pio_write(Scsi_Cmnd *SCp
static int nsp_nexus(Scsi_Cmnd *SCpnt)
{
unsigned int base = SCpnt->device->host->io_port;
- unsigned char target = SCpnt->device->id;
+ unsigned char target = sdev_id(SCpnt->device);
// unsigned char lun = SCpnt->device->lun;
nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
sync_data *sync = &(data->Sync[target]);
@@ -1051,8 +1051,8 @@ static irqreturn_t nspintr(int irq, void
}
tmpSC = data->CurrentSC;
- target = tmpSC->device->id;
- lun = tmpSC->device->lun;
+ target = sdev_id(tmpSC->device);
+ lun = scsilun_to_int(&tmpSC->device->lun);
sync_neg = &(data->Sync[target].SyncNegotiation);
/*
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index b4b3a1a..11ee73e 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -610,7 +610,7 @@ SYM53C500_queue(struct scsi_cmnd *SCpnt,
/* We are locked here already by the mid layer */
REG0(port_base);
- outb(SCpnt->device->id, port_base + DEST_ID); /* set destination */
+ outb(sdev_id(SCpnt->device), port_base + DEST_ID); /* set destination */
outb(FLUSH_FIFO, port_base + CMD_REG); /* reset the fifos */
for (i = 0; i < SCpnt->cmd_len; i++) {
diff --git a/drivers/scsi/psi240i.c b/drivers/scsi/psi240i.c
index 0f576d4..2a673de 100644
--- a/drivers/scsi/psi240i.c
+++ b/drivers/scsi/psi240i.c
@@ -394,7 +394,7 @@ static int Psi240i_QueueCommand (Scsi_Cm
{
UCHAR *cdb = (UCHAR *)SCpnt->cmnd; // Pointer to SCSI CDB
PADAPTER240I padapter = HOSTDATA (SCpnt->device->host); // Pointer to adapter control structure
- POUR_DEVICE pdev = &padapter->device [SCpnt->device->id];// Pointer to device information
+ POUR_DEVICE pdev = &padapter->device [sdev_id(SCpnt->device)];// Pointer to device information
UCHAR rc; // command return code
SCpnt->scsi_done = done;
@@ -659,7 +659,7 @@ static int Psi240i_BiosParam (struct scs
{
POUR_DEVICE pdev;
- pdev = &(HOSTDATA(sdev->host)->device[sdev->id]);
+ pdev = &(HOSTDATA(sdev->host)->device[sdev_id(sdev)]);
geom[0] = pdev->heads;
geom[1] = pdev->sectors;
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 9791496..3590a46 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -1985,9 +1985,10 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd
ha = (struct scsi_qla_host *)cmd->device->host->hostdata;
sp = (srb_t *) cmd->SCp.ptr;
- printk("SCSI Command @=0x%p, Handle=0x%p\n", cmd, cmd->host_scribble);
- printk(" chan=0x%02x, target=0x%02x, lun=0x%02x, cmd_len=0x%02x\n",
- cmd->device->channel, cmd->device->id, cmd->device->lun,
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ "SCSI Command @=0x%p, Handle=0x%p\n", cmd, cmd->host_scribble);
+ dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ " cmd_len=0x%02x\n",
cmd->cmd_len);
printk(" CDB: ");
for (i = 0; i < cmd->cmd_len; i++) {
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 37f82e2..307c7da 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -397,7 +397,7 @@ qla2x00_start_scsi(srb_t *sp)
/* Set target ID and LUN number*/
SET_TARGET_ID(ha, cmd_pkt->target, sp->fcport->loop_id);
- cmd_pkt->lun = cpu_to_le16(sp->cmd->device->lun);
+ cmd_pkt->lun = cpu_to_le16(scsilun_to_int(&sp->cmd->device->lun));
/* Update tagged queuing modifier */
cmd_pkt->control_flags = __constant_cpu_to_le16(CF_SIMPLE_TAG);
@@ -834,8 +834,8 @@ qla24xx_start_scsi(srb_t *sp)
cmd_pkt->port_id[1] = sp->fcport->d_id.b.area;
cmd_pkt->port_id[2] = sp->fcport->d_id.b.domain;
- cmd_pkt->lun[1] = LSB(sp->cmd->device->lun);
- cmd_pkt->lun[2] = MSB(sp->cmd->device->lun);
+ cmd_pkt->lun[1] = LSB(scsilun_to_int(&sp->cmd->device->lun));
+ cmd_pkt->lun[2] = MSB(scsilun_to_int(&sp->cmd->device->lun));
/* Update tagged queuing modifier -- default is TSK_SIMPLE (0). */
if (scsi_populate_tag_msg(cmd, tag)) {
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index c255bb0..a51235d 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1034,11 +1034,10 @@ qla2x00_status_entry(scsi_qla_host_t *ha
if ((unsigned)(cp->request_bufflen - resid) <
cp->underflow) {
qla_printk(KERN_INFO, ha,
- "scsi(%ld:%d:%d:%d): Mid-layer underflow "
+ "Mid-layer underflow "
"detected (%x of %x bytes)...returning "
- "error status.\n", ha->host_no,
- cp->device->channel, cp->device->id,
- cp->device->lun, resid,
+ "error status.\n",
+ resid,
cp->request_bufflen);
cp->result = DID_ERROR << 16;
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 13e1c90..6e511b8 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -904,7 +904,7 @@ qla2x00_abort_command(scsi_qla_host_t *h
mcp->mb[1] = fcport->loop_id << 8;
mcp->mb[2] = (uint16_t)handle;
mcp->mb[3] = (uint16_t)(handle >> 16);
- mcp->mb[6] = (uint16_t)sp->cmd->device->lun;
+ mcp->mb[6] = (uint16_t)scsilun_to_int(&sp->cmd->device->lun);
mcp->out_mb = MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
mcp->in_mb = MBX_0;
mcp->tov = 30;
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 8982978..588aa08 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -617,7 +617,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
scsi_qla_host_t *ha = to_qla_host(cmd->device->host);
srb_t *sp;
int ret, i;
- unsigned int id, lun;
+ unsigned int id;
unsigned long serial;
unsigned long flags;
@@ -626,8 +626,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
ret = FAILED;
- id = cmd->device->id;
- lun = cmd->device->lun;
+ id = sdev_id(cmd->device);
serial = cmd->serial_number;
/* Check active list for command command. */
@@ -665,14 +664,13 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
if (ret == SUCCESS) {
if (qla2x00_eh_wait_on_command(ha, cmd) != QLA_SUCCESS) {
qla_printk(KERN_ERR, ha,
- "scsi(%ld:%d:%d): Abort handler timed out -- %lx "
- "%x.\n", ha->host_no, id, lun, serial, ret);
+ "Abort handler timed out -- %lx "
+ "%x.\n", serial, ret);
}
}
- qla_printk(KERN_INFO, ha,
- "scsi(%ld:%d:%d): Abort command issued -- %lx %x.\n", ha->host_no,
- id, lun, serial, ret);
+ qla_printk(KERN_INFO, ha, "Abort command issued -- %lx %x.\n",
+ serial, ret);
return ret;
}
@@ -712,7 +710,7 @@ qla2x00_eh_wait_for_pending_target_comma
if (sp) {
cmd = sp->cmd;
spin_unlock_irqrestore(&ha->hardware_lock, flags);
- if (cmd->device->id == t) {
+ if (sdev_id(cmd->device) == t) {
if (!qla2x00_eh_wait_on_command(ha, cmd)) {
status = 1;
break;
@@ -752,21 +750,19 @@ qla2xxx_eh_device_reset(struct scsi_cmnd
fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
srb_t *sp;
int ret;
- unsigned int id, lun;
+ unsigned int id;
unsigned long serial;
ret = FAILED;
- id = cmd->device->id;
- lun = cmd->device->lun;
+ id = sdev_id(cmd->device);
serial = cmd->serial_number;
sp = (srb_t *) CMD_SP(cmd);
if (!sp || !fcport)
return ret;
- qla_printk(KERN_INFO, ha,
- "scsi(%ld:%d:%d): DEVICE RESET ISSUED.\n", ha->host_no, id, lun);
+ qla_printk(KERN_INFO, ha, "DEVICE RESET ISSUED.\n");
if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS)
goto eh_dev_reset_done;
@@ -816,8 +812,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd
}
}
- qla_printk(KERN_INFO, ha,
- "scsi(%ld:%d:%d): DEVICE RESET SUCCEEDED.\n", ha->host_no, id, lun);
+ qla_printk(KERN_INFO, ha, "DEVICE RESET SUCCEEDED.\n");
eh_dev_reset_done:
return ret;
@@ -893,21 +888,19 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *c
fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
srb_t *sp;
int ret;
- unsigned int id, lun;
+ unsigned int id;
unsigned long serial;
ret = FAILED;
- id = cmd->device->id;
- lun = cmd->device->lun;
+ id = sdev_id(cmd->device);
serial = cmd->serial_number;
sp = (srb_t *) CMD_SP(cmd);
if (!sp || !fcport)
return ret;
- qla_printk(KERN_INFO, ha,
- "scsi(%ld:%d:%d): LOOP RESET ISSUED.\n", ha->host_no, id, lun);
+ qla_printk(KERN_INFO, ha, "LOOP RESET ISSUED.\n");
if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS) {
DEBUG2(printk("%s failed:board disabled\n",__func__));
@@ -955,21 +948,19 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *
fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
srb_t *sp;
int ret;
- unsigned int id, lun;
+ unsigned int id;
unsigned long serial;
ret = FAILED;
- id = cmd->device->id;
- lun = cmd->device->lun;
+ id = sdev_id(cmd->device);
serial = cmd->serial_number;
sp = (srb_t *) CMD_SP(cmd);
if (!sp || !fcport)
return ret;
- qla_printk(KERN_INFO, ha,
- "scsi(%ld:%d:%d): ADAPTER RESET ISSUED.\n", ha->host_no, id, lun);
+ qla_printk(KERN_INFO, ha, "ADAPTER RESET ISSUED.\n");
if (qla2x00_wait_for_hba_online(ha) != QLA_SUCCESS)
goto eh_host_reset_lock;
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 2edf967..df9fa91 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -215,7 +215,7 @@ static struct scsi_device *scsi_alloc_sd
sdev->model = scsi_null_device_strs;
sdev->rev = scsi_null_device_strs;
sdev->host = shost;
- memcpy(&sdev->lun, lun, sizeof(*lun));
+ scsilun_cp(&sdev->lun, lun);
sdev->sdev_state = SDEV_CREATED;
INIT_LIST_HEAD(&sdev->siblings);
INIT_LIST_HEAD(&sdev->same_target_siblings);
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index d76766c..2ce0f7f 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -357,7 +357,7 @@ void sym_set_cam_result_error(struct sym
* condition otherwise the device will always return
* BUSY. Use a big stick.
*/
- sym_reset_scsi_target(np, cmd->device->id);
+ sym_reset_scsi_target(np, sdev_id(cmd->device));
cam_status = DID_ERROR;
}
} else if (cp->host_status == HS_COMPLETE) /* Bad SCSI status */
@@ -470,7 +470,7 @@ static int sym_queue_command(struct sym_
* Minimal checkings, so that we will not
* go outside our tables.
*/
- if (sdev->id == np->myaddr) {
+ if (sdev_id(sdev) == np->myaddr) {
sym_xpt_done2(np, cmd, DID_NO_CONNECT);
return 0;
}
@@ -478,12 +478,12 @@ static int sym_queue_command(struct sym_
/*
* Retrieve the target descriptor.
*/
- tp = &np->target[sdev->id];
+ tp = &np->target[sdev_id(sdev)];
/*
* Select tagged/untagged.
*/
- lp = sym_lp(tp, sdev->lun);
+ lp = sym_lp(tp, &sdev->lun);
order = (lp && lp->s.reqtags) ? M_SIMPLE_TAG : 0;
/*
@@ -516,7 +516,7 @@ int sym_setup_data_and_start(struct sym_
{
int dir;
struct sym_tcb *tp = &np->target[cp->target];
- struct sym_lcb *lp = sym_lp(tp, cp->lun);
+ struct sym_lcb *lp = sym_lp(tp, &cp->lun);
/*
* Build the CDB.
@@ -804,7 +804,7 @@ prepare:
sts = sym_abort_scsiio(np, cmd, 1);
break;
case SYM_EH_DEVICE_RESET:
- sts = sym_reset_scsi_target(np, cmd->device->id);
+ sts = sym_reset_scsi_target(np, sdev_id(cmd->device));
break;
case SYM_EH_BUS_RESET:
sym_reset_scsi_bus(np, 1);
@@ -901,7 +901,8 @@ static int sym53c8xx_eh_host_reset_handl
/*
* Tune device queuing depth, according to various limits.
*/
-static void sym_tune_dev_queuing(struct sym_tcb *tp, int lun, u_short reqtags)
+static void sym_tune_dev_queuing(struct sym_tcb *tp,
+ const struct scsi_lun *lun, u_short reqtags)
{
struct sym_lcb *lp = sym_lp(tp, lun);
u_short oldtags;
@@ -984,11 +985,12 @@ static int sym53c8xx_slave_alloc(struct
struct sym_hcb *np;
struct sym_tcb *tp;
- if (sdev->id >= SYM_CONF_MAX_TARGET || sdev->lun >= SYM_CONF_MAX_LUN)
+ if (sdev_id(sdev) >= SYM_CONF_MAX_TARGET ||
+ scsilun_to_int(&sdev->lun) >= SYM_CONF_MAX_LUN)
return -ENXIO;
np = sym_get_hcb(sdev->host);
- tp = &np->target[sdev->id];
+ tp = &np->target[sdev_id(sdev)];
/*
* Fail the device init if the device is flagged NOSCAN at BOOT in
@@ -1000,7 +1002,7 @@ static int sym53c8xx_slave_alloc(struct
*/
if ((tp->usrflags & SYM_SCAN_BOOT_DISABLED) ||
- ((tp->usrflags & SYM_SCAN_LUNS_DISABLED) && sdev->lun != 0)) {
+ ((tp->usrflags & SYM_SCAN_LUNS_DISABLED) && !scsilun_zero(&sdev->lun))) {
tp->usrflags &= ~SYM_SCAN_BOOT_DISABLED;
return -ENXIO;
}
@@ -1015,7 +1017,7 @@ static int sym53c8xx_slave_alloc(struct
static int sym53c8xx_slave_configure(struct scsi_device *device)
{
struct sym_hcb *np = sym_get_hcb(device->host);
- struct sym_tcb *tp = &np->target[device->id];
+ struct sym_tcb *tp = &np->target[sdev_id(device)];
struct sym_lcb *lp;
int reqtags, depth_to_use;
@@ -1023,7 +1025,7 @@ static int sym53c8xx_slave_configure(str
* Allocate the LCB if not yet.
* If it fail, we may well be in the sh*t. :)
*/
- lp = sym_alloc_lcb(np, device->id, device->lun);
+ lp = sym_alloc_lcb(np, sdev_id(device), &device->lun);
if (!lp)
return -ENOMEM;
@@ -1038,7 +1040,8 @@ static int sym53c8xx_slave_configure(str
* Use at least 2.
* Donnot use more than our maximum.
*/
- reqtags = device_queue_depth(np, device->id, device->lun);
+ reqtags = device_queue_depth(np, sdev_id(device),
+ scsilun_to_int(&device->lun));
if (reqtags > tp->usrtags)
reqtags = tp->usrtags;
if (!device->tagged_supported)
@@ -1055,7 +1058,7 @@ static int sym53c8xx_slave_configure(str
MSG_SIMPLE_TAG : 0),
depth_to_use);
lp->s.scdev_depth = depth_to_use;
- sym_tune_dev_queuing(tp, device->lun, reqtags);
+ sym_tune_dev_queuing(tp, &device->lun, reqtags);
if (!spi_initial_dv(device->sdev_target))
spi_dv_device(device);
@@ -1157,8 +1160,11 @@ static void sym_exec_user_command (struc
tp->tgoal.check_nego = 1;
break;
case UC_SETTAGS:
- for (l = 0; l < SYM_CONF_MAX_LUN; l++)
- sym_tune_dev_queuing(tp, l, uc->data);
+ for (l = 0; l < SYM_CONF_MAX_LUN; l++) {
+ struct scsi_lun __l;
+ int_to_scsilun(l, &__l);
+ sym_tune_dev_queuing(tp, &__l,uc->data);
+ }
break;
case UC_RESETDEV:
tp->to_reset = 1;
@@ -1167,7 +1173,11 @@ static void sym_exec_user_command (struc
break;
case UC_CLEARDEV:
for (l = 0; l < SYM_CONF_MAX_LUN; l++) {
- struct sym_lcb *lp = sym_lp(tp, l);
+ struct scsi_lun __l;
+ struct sym_lcb *lp;
+
+ int_to_scsilun(l, &__l);
+ lp = sym_lp(tp, &__l);
if (lp) lp->to_clear = 1;
}
np->istat_sem = SEM;
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index e753ba2..68f7b97 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -51,7 +51,7 @@ static void sym_int_ma (struct sym_hcb *
static void sym_int_sir (struct sym_hcb *np);
static struct sym_ccb *sym_alloc_ccb(struct sym_hcb *np);
static struct sym_ccb *sym_ccb_from_dsa(struct sym_hcb *np, u32 dsa);
-static void sym_alloc_lcb_tags (struct sym_hcb *np, u_char tn, u_char ln);
+static void sym_alloc_lcb_tags (struct sym_hcb *np, u_char tn, const struct scsi_lun *ln);
static void sym_complete_error (struct sym_hcb *np, struct sym_ccb *cp);
static void sym_complete_ok (struct sym_hcb *np, struct sym_ccb *cp);
static int sym_compute_residual(struct sym_hcb *np, struct sym_ccb *cp);
@@ -1697,7 +1697,7 @@ static void sym_flush_comp_queue(struct
#ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING
if (sym_get_cam_status(cmd) == DID_SOFT_ERROR) {
struct sym_tcb *tp = &np->target[cp->target];
- struct sym_lcb *lp = sym_lp(tp, cp->lun);
+ struct sym_lcb *lp = sym_lp(tp, &cp->lun);
if (lp) {
sym_remque(&cp->link2_ccbq);
sym_insque_tail(&cp->link2_ccbq,
@@ -2706,7 +2706,7 @@ unexpected_phase:
if (dsp == SCRIPTA_BA(np, send_ident)) {
if (cp->tag != NO_TAG && olen - rest <= 3) {
cp->host_status = HS_BUSY;
- np->msgout[0] = IDENTIFY(0, cp->lun);
+ np->msgout[0] = IDENTIFY(0, &cp->lun);
nxtdsp = SCRIPTB_BA(np, ident_break_atn);
}
else
@@ -2956,7 +2956,8 @@ unknown_int:
* It is called with SCRIPTS not running.
*/
static int
-sym_dequeue_from_squeue(struct sym_hcb *np, int i, int target, int lun, int task)
+sym_dequeue_from_squeue(struct sym_hcb *np, int i, int target,
+ const struct scsi_lun *lun, int task)
{
int j;
struct sym_ccb *cp;
@@ -2979,7 +2980,7 @@ sym_dequeue_from_squeue(struct sym_hcb *
cp->host_flags &= ~HF_HINT_IARB;
#endif
if ((target == -1 || cp->target == target) &&
- (lun == -1 || cp->lun == lun) &&
+ (lun == NULL || scsilun_eq(&cp->lun, lun)) &&
(task == -1 || cp->tag == task)) {
sym_set_cam_status(cp->cmd, DID_SOFT_ERROR);
sym_remque(&cp->link_ccbq);
@@ -3066,7 +3067,7 @@ static void sym_sir_bad_scsi_status(stru
* Dequeue all queued CCBs for that device not yet started,
* and restart the SCRIPTS processor immediately.
*/
- sym_dequeue_from_squeue(np, i, cp->target, cp->lun, -1);
+ sym_dequeue_from_squeue(np, i, cp->target, &cp->lun, -1);
OUTL_DSP(np, SCRIPTA_BA(np, start));
/*
@@ -3082,7 +3083,7 @@ static void sym_sir_bad_scsi_status(stru
* requesting sense data.
*/
- cp->scsi_smsg2[0] = IDENTIFY(0, cp->lun);
+ cp->scsi_smsg2[0] = IDENTIFY(0, &cp->lun);
msglen = 1;
/*
@@ -3114,8 +3115,9 @@ static void sym_sir_bad_scsi_status(stru
*/
cp->sensecmd[0] = REQUEST_SENSE;
cp->sensecmd[1] = 0;
- if (cp->cmd->device->scsi_level <= SCSI_2 && cp->lun <= 7)
- cp->sensecmd[1] = cp->lun << 5;
+ if (cp->cmd->device->scsi_level <= SCSI_2 &&
+ scsilun_to_int(&cp->lun) <= 7)
+ cp->sensecmd[1] = scsilun_to_int(&cp->lun) << 5;
cp->sensecmd[4] = SYM_SNS_BBUF_LEN;
cp->data_len = SYM_SNS_BBUF_LEN;
@@ -3172,7 +3174,8 @@ static void sym_sir_bad_scsi_status(stru
* - lun=-1 means any logical UNIT otherwise a given one.
* - task=-1 means any task, otherwise a given one.
*/
-int sym_clear_tasks(struct sym_hcb *np, int cam_status, int target, int lun, int task)
+int sym_clear_tasks(struct sym_hcb *np, int cam_status, int target,
+ const struct scsi_lun *lun, int task)
{
SYM_QUEHEAD qtmp, *qp;
int i = 0;
@@ -3196,7 +3199,7 @@ int sym_clear_tasks(struct sym_hcb *np,
cmd = cp->cmd;
if (cp->host_status != HS_DISCONNECT ||
cp->target != target ||
- (lun != -1 && cp->lun != lun) ||
+ (lun != NULL && !scsilun_eq(&cp->lun, lun)) ||
(task != -1 &&
(cp->tag != NO_TAG && cp->scsi_smsg[2] != task))) {
sym_insque_tail(&cp->link_ccbq, &np->busy_ccbq);
@@ -3261,7 +3264,9 @@ static void sym_sir_task_recovery(struct
struct sym_ccb *cp;
struct sym_tcb *tp = NULL; /* gcc isn't quite smart enough yet */
struct scsi_target *starget;
- int target=-1, lun=-1, task;
+ int target=-1, task;
+ struct scsi_lun lunv;
+ struct scsi_lun *lunp = NULL;
int i, k;
switch(num) {
@@ -3367,7 +3372,7 @@ static void sym_sir_task_recovery(struct
* all CCBs for that device that haven't been started.
*/
i = (INL(np, nc_scratcha) - np->squeue_ba) / 4;
- i = sym_dequeue_from_squeue(np, i, cp->target, cp->lun, -1);
+ i = sym_dequeue_from_squeue(np, i, cp->target, &cp->lun, -1);
/*
* Make sure at least our IO to abort has been dequeued.
@@ -3416,12 +3421,14 @@ static void sym_sir_task_recovery(struct
/*
* Otherwise, look for some logical unit to be cleared.
*/
- if (tp->lun0p && tp->lun0p->to_clear)
- lun = 0;
- else if (tp->lunmp) {
+ if (tp->lun0p && tp->lun0p->to_clear) {
+ lunp = &lunv;
+ int_to_scsilun(0, lunp);
+ } else if (tp->lunmp) {
for (k = 1 ; k < SYM_CONF_MAX_LUN ; k++) {
if (tp->lunmp[k] && tp->lunmp[k]->to_clear) {
- lun = k;
+ lunp = &lunv;
+ int_to_scsilun(k, lunp);
break;
}
}
@@ -3431,10 +3438,10 @@ static void sym_sir_task_recovery(struct
* If a logical unit is to be cleared, prepare
* an IDENTIFY(lun) + ABORT MESSAGE.
*/
- if (lun != -1) {
- struct sym_lcb *lp = sym_lp(tp, lun);
+ if (lunp != NULL) {
+ struct sym_lcb *lp = sym_lp(tp, lunp);
lp->to_clear = 0; /* We don't expect to fail here */
- np->abrt_msg[0] = IDENTIFY(0, lun);
+ np->abrt_msg[0] = IDENTIFY(0, lunp);
np->abrt_msg[1] = M_ABORT;
np->abrt_tbl.size = 2;
break;
@@ -3475,7 +3482,7 @@ static void sym_sir_task_recovery(struct
* We have some task to abort.
* Set the IDENTIFY(lun)
*/
- np->abrt_msg[0] = IDENTIFY(0, cp->lun);
+ np->abrt_msg[0] = IDENTIFY(0, &cp->lun);
/*
* If we want to abort an untagged command, we
@@ -3525,7 +3532,7 @@ static void sym_sir_task_recovery(struct
* - Prepare to clear all disconnected CCBs for
* this target from our task list (lun=task=-1)
*/
- lun = -1;
+ lunp = NULL;
task = -1;
if (np->abrt_msg[0] == M_RESET) {
tp->head.sval = 0;
@@ -3547,7 +3554,8 @@ static void sym_sir_task_recovery(struct
* or an ABORT message :-)
*/
else {
- lun = np->abrt_msg[0] & 0x3f;
+ lunp = &lunv;
+ int_to_scsilun(np->abrt_msg[0] & 0x3f, lunp);
if (np->abrt_msg[1] == M_ABORT_TAG)
task = np->abrt_msg[2];
}
@@ -3557,8 +3565,8 @@ static void sym_sir_task_recovery(struct
* aborted due to our 'kiss of death' message.
*/
i = (INL(np, nc_scratcha) - np->squeue_ba) / 4;
- sym_dequeue_from_squeue(np, i, target, lun, -1);
- sym_clear_tasks(np, DID_ABORT, target, lun, task);
+ sym_dequeue_from_squeue(np, i, target, lunp, -1);
+ sym_clear_tasks(np, DID_ABORT, target, lunp, task);
sym_flush_comp_queue(np, 0);
/*
@@ -4642,8 +4650,8 @@ out_stuck:
*/
struct sym_ccb *sym_get_ccb (struct sym_hcb *np, struct scsi_cmnd *cmd, u_char tag_order)
{
- u_char tn = cmd->device->id;
- u_char ln = cmd->device->lun;
+ u_char tn = sdev_id(cmd->device);
+ const struct scsi_lun *ln = &cmd->device->lun;
struct sym_tcb *tp = &np->target[tn];
struct sym_lcb *lp = sym_lp(tp, ln);
u_short tag = NO_TAG;
@@ -4772,7 +4780,7 @@ struct sym_ccb *sym_get_ccb (struct sym_
cp->tag = tag;
cp->order = tag_order;
cp->target = tn;
- cp->lun = ln;
+ scsilun_cp(&cp->lun, ln);
if (DEBUG_FLAGS & DEBUG_TAGS) {
sym_print_addr(cmd, "ccb @%p using tag %d.\n", cp, tag);
@@ -4791,7 +4799,7 @@ out_free:
void sym_free_ccb (struct sym_hcb *np, struct sym_ccb *cp)
{
struct sym_tcb *tp = &np->target[cp->target];
- struct sym_lcb *lp = sym_lp(tp, cp->lun);
+ struct sym_lcb *lp = sym_lp(tp, &cp->lun);
if (DEBUG_FLAGS & DEBUG_TAGS) {
sym_print_addr(cp->cmd, "ccb @%p freeing tag %d.\n",
@@ -4841,7 +4849,7 @@ void sym_free_ccb (struct sym_hcb *np, s
* Clear the bit that keeps track of this IO.
*/
else
- sym_clr_bit(tp->busy0_map, cp->lun);
+ sym_clr_bit(tp->busy0_map, &cp->lun);
/*
* We donnot queue more than 1 ccb per target
@@ -4990,7 +4998,7 @@ static void sym_init_tcb (struct sym_hcb
/*
* Lun control block allocation and initialization.
*/
-struct sym_lcb *sym_alloc_lcb (struct sym_hcb *np, u_char tn, u_char ln)
+struct sym_lcb *sym_alloc_lcb (struct sym_hcb *np, u_char tn, const struct scsi_lun *ln)
{
struct sym_tcb *tp = &np->target[tn];
struct sym_lcb *lp = sym_lp(tp, ln);
@@ -5045,9 +5053,9 @@ struct sym_lcb *sym_alloc_lcb (struct sy
lp = sym_calloc_dma(sizeof(struct sym_lcb), "LCB");
if (!lp)
goto fail;
- if (ln) {
- tp->lunmp[ln] = lp;
- tp->luntbl[ln] = cpu_to_scr(vtobus(lp));
+ if (!scsilun_zero(ln)) {
+ tp->lunmp[scsilun_to_int(ln)] = lp;
+ tp->luntbl[scsilun_to_int(ln)] = cpu_to_scr(vtobus(lp));
}
else {
tp->lun0p = lp;
@@ -5092,7 +5100,7 @@ fail:
/*
* Allocate LCB resources for tagged command queuing.
*/
-static void sym_alloc_lcb_tags (struct sym_hcb *np, u_char tn, u_char ln)
+static void sym_alloc_lcb_tags (struct sym_hcb *np, u_char tn, const struct scsi_lun *ln)
{
struct sym_tcb *tp = &np->target[tn];
struct sym_lcb *lp = sym_lp(tp, ln);
@@ -5166,14 +5174,14 @@ int sym_queue_scsiio(struct sym_hcb *np,
/*
* Retrieve the lun descriptor.
*/
- lp = sym_lp(tp, sdev->lun);
+ lp = sym_lp(tp, &sdev->lun);
can_disconnect = (cp->tag != NO_TAG) ||
(lp && (lp->curr_flags & SYM_DISC_ENABLED));
msgptr = cp->scsi_smsg;
msglen = 0;
- msgptr[msglen++] = IDENTIFY(can_disconnect, sdev->lun);
+ msgptr[msglen++] = IDENTIFY(can_disconnect, &sdev->lun);
/*
* Build the tag message if present.
@@ -5385,7 +5393,7 @@ void sym_complete_error(struct sym_hcb *
* Get target and lun pointers.
*/
tp = &np->target[cp->target];
- lp = sym_lp(tp, sdev->lun);
+ lp = sym_lp(tp, &sdev->lun);
/*
* Check for extended errors.
@@ -5416,7 +5424,7 @@ if (resid)
* not yet started by SCRIPTS.
*/
i = (INL(np, nc_scratcha) - np->squeue_ba) / 4;
- i = sym_dequeue_from_squeue(np, i, cp->target, sdev->lun, -1);
+ i = sym_dequeue_from_squeue(np, i, cp->target, &sdev->lun, -1);
/*
* Restart the SCRIPTS processor.
@@ -5514,13 +5522,13 @@ void sym_complete_ok (struct sym_hcb *np
* Get target and lun pointers.
*/
tp = &np->target[cp->target];
- lp = sym_lp(tp, cp->lun);
+ lp = sym_lp(tp, &cp->lun);
/*
* Assume device discovered on first success.
*/
if (!lp)
- sym_set_bit(tp->lun_map, cp->lun);
+ sym_set_bit(tp->lun_map, &cp->lun);
/*
* If all data have been transferred, given than no
@@ -5854,7 +5862,9 @@ void sym_hcb_free(struct sym_hcb *np)
for (target = 0; target < SYM_CONF_MAX_TARGET ; target++) {
tp = &np->target[target];
for (lun = 0 ; lun < SYM_CONF_MAX_LUN ; lun++) {
- lp = sym_lp(tp, lun);
+ struct scsi_lun __lun;
+ int_to_scsilun(lun, &__lun);
+ lp = sym_lp(tp, &__lun);
if (!lp)
continue;
if (lp->itlq_tbl)
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h
index 3131a6b..adb105d 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.h
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h
@@ -589,10 +589,11 @@ struct sym_pmc {
* LUN(s) > 0.
*/
#if SYM_CONF_MAX_LUN <= 1
-#define sym_lp(tp, lun) (!lun) ? (tp)->lun0p : NULL
+#define sym_lp(tp, lun) (scsilun_zero(lun)) ? (tp)->lun0p : NULL
#else
#define sym_lp(tp, lun) \
- (!lun) ? (tp)->lun0p : (tp)->lunmp ? (tp)->lunmp[(lun)] : NULL
+ (scsilun_zero(lun)) ? \
+ (tp)->lun0p : (tp)->lunmp ? (tp)->lunmp[scsilun_to_int(lun)] : NULL
#endif
/*
@@ -797,7 +798,11 @@ struct sym_ccb {
u_short tag; /* Tag for this transfer */
/* NO_TAG means no tag */
u_char target;
+#if 0
u_char lun;
+#else
+ struct scsi_lun lun;
+#endif
struct sym_ccb *link_ccbh; /* Host adapter CCB hash chain */
SYM_QUEHEAD link_ccbq; /* Link to free/busy CCB queue */
u32 startp; /* Initial data pointer */
@@ -1081,10 +1086,10 @@ void sym_start_next_ccbs(struct sym_hcb
#endif
void sym_start_up(struct sym_hcb *np, int reason);
void sym_interrupt(struct sym_hcb *np);
-int sym_clear_tasks(struct sym_hcb *np, int cam_status, int target, int lun, int task);
+int sym_clear_tasks(struct sym_hcb *np, int cam_status, int target, const struct scsi_lun *lun, int task);
struct sym_ccb *sym_get_ccb(struct sym_hcb *np, struct scsi_cmnd *cmd, u_char tag_order);
void sym_free_ccb(struct sym_hcb *np, struct sym_ccb *cp);
-struct sym_lcb *sym_alloc_lcb(struct sym_hcb *np, u_char tn, u_char ln);
+struct sym_lcb *sym_alloc_lcb(struct sym_hcb *np, u_char tn, const struct scsi_lun *ln);
int sym_queue_scsiio(struct sym_hcb *np, struct scsi_cmnd *csio, struct sym_ccb *cp);
int sym_abort_scsiio(struct sym_hcb *np, struct scsi_cmnd *ccb, int timed_out);
int sym_reset_scsi_target(struct sym_hcb *np, int target);
diff --git a/drivers/scsi/sym53c8xx_2/sym_misc.h b/drivers/scsi/sym53c8xx_2/sym_misc.h
index 0433d5d..344e732 100644
--- a/drivers/scsi/sym53c8xx_2/sym_misc.h
+++ b/drivers/scsi/sym53c8xx_2/sym_misc.h
@@ -169,9 +169,13 @@ static __inline struct sym_quehead *sym_
/*
* Simple bitmap operations.
*/
-#define sym_set_bit(p, n) (((u32 *)(p))[(n)>>5] |= (1<<((n)&0x1f)))
-#define sym_clr_bit(p, n) (((u32 *)(p))[(n)>>5] &= ~(1<<((n)&0x1f)))
-#define sym_is_bit(p, n) (((u32 *)(p))[(n)>>5] & (1<<((n)&0x1f)))
+#define __sym_set_bit(p, n) (((u32 *)(p))[(n)>>5] |= (1<<((n)&0x1f)))
+#define __sym_clr_bit(p, n) (((u32 *)(p))[(n)>>5] &= ~(1<<((n)&0x1f)))
+#define __sym_is_bit(p, n) (((u32 *)(p))[(n)>>5] & (1<<((n)&0x1f)))
+
+#define sym_set_bit(p, lun) __sym_set_bit((p), scsilun_to_int(lun))
+#define sym_clr_bit(p, lun) __sym_clr_bit((p), scsilun_to_int(lun))
+#define sym_is_bit(p, lun) __sym_is_bit((p), scsilun_to_int(lun))
/*
* The below round up/down macros are to be used with a constant
diff --git a/drivers/usb/storage/dpcm.c b/drivers/usb/storage/dpcm.c
index 92b69e4..3ce376a 100644
--- a/drivers/usb/storage/dpcm.c
+++ b/drivers/usb/storage/dpcm.c
@@ -48,13 +48,16 @@
int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us)
{
int ret;
+ unsigned int tmp_lun;
+
+ tmp_lun = scsilun_to_int(&srb->device->lun);
if(srb == NULL)
return USB_STOR_TRANSPORT_ERROR;
- US_DEBUGP("dpcm_transport: LUN=%d\n", srb->device->lun);
+ US_DEBUGP("dpcm_transport: LUN=%u\n", tmp_lun);
- switch(srb->device->lun) {
+ switch(tmp_lun) {
case 0:
/*
@@ -73,15 +76,19 @@ int dpcm_transport(struct scsi_cmnd *srb
/*
* Set the LUN to 0 (just in case).
*/
- srb->device->lun = 0; us->srb->device->lun = 0;
+ int_to_scsilun(0, &srb->device->lun);
+ int_to_scsilun(0, &us->srb->device->lun);
+
ret = sddr09_transport(srb, us);
- srb->device->lun = 1; us->srb->device->lun = 1;
+
+ int_to_scsilun(1, &srb->device->lun);
+ int_to_scsilun(1, &us->srb->device->lun);
break;
#endif
default:
- US_DEBUGP("dpcm_transport: Invalid LUN %d\n", srb->device->lun);
+ US_DEBUGP("dpcm_transport: Invalid LUN %d\n", tmp_lun);
ret = USB_STOR_TRANSPORT_ERROR;
break;
}
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index c1ba530..42edb19 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -979,9 +979,9 @@ int usb_stor_Bulk_transport(struct scsi_
bcb->DataTransferLength = cpu_to_le32(transfer_length);
bcb->Flags = srb->sc_data_direction == DMA_FROM_DEVICE ? 1 << 7 : 0;
bcb->Tag = ++us->tag;
- bcb->Lun = srb->device->lun;
+ bcb->Lun = scsilun_to_int(&srb->device->lun);
if (us->flags & US_FL_SCM_MULT_TARG)
- bcb->Lun |= srb->device->id << 4;
+ bcb->Lun |= sdev_id(srb->device) << 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 f9a9bfa..0b484a9 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -344,17 +344,27 @@ static int usb_stor_control_thread(void
/* reject if target != 0 or if LUN is higher than
* the maximum known LUN
*/
- else if (us->srb->device->id &&
+ else if (sdev_id(us->srb->device) &&
!(us->flags & US_FL_SCM_MULT_TARG)) {
- US_DEBUGP("Bad target number (%d:%d)\n",
- us->srb->device->id, us->srb->device->lun);
+ char lunstr[SCSILUN_STR_LEN];
+
+ US_DEBUGP("Bad target number (%d:%s)\n",
+ sdev_id(us->srb->device),
+ scsilun_to_str(&us->srb->device->lun, lunstr));
us->srb->result = DID_BAD_TARGET << 16;
+
+ (void) lunstr; /* avoid warn, if debug disabled */
}
- else if (us->srb->device->lun > us->max_lun) {
- US_DEBUGP("Bad LUN (%d:%d)\n",
- us->srb->device->id, us->srb->device->lun);
+ else if (scsilun_to_int(&us->srb->device->lun) > us->max_lun) {
+ char lunstr[SCSILUN_STR_LEN];
+
+ US_DEBUGP("Bad LUN (%d:%s)\n",
+ sdev_id(us->srb->device),
+ scsilun_to_str(&us->srb->device->lun, lunstr));
us->srb->result = DID_BAD_TARGET << 16;
+
+ (void) lunstr; /* avoid warn, if debug disabled */
}
/* Handle those devices which need us to fake
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index deb1a27..9d5ba34 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -380,7 +380,7 @@ struct scsi_lun {
#define IDENTIFY_BASE 0x80
#define IDENTIFY(can_disconnect, lun) (IDENTIFY_BASE |\
((can_disconnect) ? 0x40 : 0) |\
- ((lun) & 0x07))
+ (scsilun_to_int(lun) & 0x07))
/*
* struct scsi_device::scsi_level values. For SCSI devices other than those
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 769469c..9e22d3b 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -289,6 +289,17 @@ static inline int scsilun_eq(const struc
return (memcmp(a, b, sizeof(struct scsi_lun)) == 0);
}
+static inline int scsilun_zero(const struct scsi_lun *lun)
+{
+ return (memcmp(lun, "\0\0\0\0\0\0\0\0", 8) == 0);
+}
+
+static inline void scsilun_cp(struct scsi_lun *dest_lun,
+ const struct scsi_lun *src_lun)
+{
+ memcpy(dest_lun, src_lun, sizeof(struct scsi_lun));
+}
+
static inline int scsi_device_online(struct scsi_device *sdev)
{
return sdev->sdev_state != SDEV_OFFLINE;
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 3/2] HCIL driver update: lpfc
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
2005-10-23 19:52 ` [PATCH RFC 2/2] " Jeff Garzik
@ 2005-10-23 20:12 ` Jeff Garzik
2005-10-23 21:40 ` [PATCH RFC 4/2] HCIL drivers update; sdev_printk Jeff Garzik
` (11 subsequent siblings)
13 siblings, 0 replies; 19+ messages in thread
From: Jeff Garzik @ 2005-10-23 20:12 UTC (permalink / raw)
To: linux-scsi
Applied on top of the previous two driver update patches.
Since lpfc already uses dev_printk, we can simply drop references to
sdev->lun and sdev->id altogether.
DO NOT APPLY.
drivers/scsi/lpfc/lpfc_scsi.c | 31 +++++++------------------------
1 files changed, 7 insertions(+), 24 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index a162174..b1202a6 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -370,7 +370,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba
struct lpfc_nodelist *pnode = rdata->pnode;
struct scsi_cmnd *cmd = lpfc_cmd->pCmd;
unsigned long iflag;
- char lunstr[SCSILUN_STR_LEN];
lpfc_cmd->result = pIocbOut->iocb.un.ulpWord[4];
lpfc_cmd->status = pIocbOut->iocb.ulpStatus;
@@ -383,10 +382,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba
lpfc_cmd->status = IOSTAT_DEFAULT;
lpfc_printf_log(phba, KERN_WARNING, LOG_FCP,
- "%d:0729 FCP cmd x%x failed <%d/%s> status: "
+ "0729 FCP cmd x%x failed status: "
"x%x result: x%x Data: x%x x%x\n",
- phba->brd_no, cmd->cmnd[0], sdev_id(cmd->device),
- scsilun_to_str(&cmd->device->lun, lunstr),
+ cmd->cmnd[0],
lpfc_cmd->status,
lpfc_cmd->result, pIocbOut->iocb.ulpContext,
lpfc_cmd->cur_iocbq.iocb.ulpIoTag);
@@ -421,10 +419,8 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba
uint32_t *lp = (uint32_t *)cmd->sense_buffer;
lpfc_printf_log(phba, KERN_INFO, LOG_FCP,
- "%d:0710 Iodone <%d/%s> cmd %p, error x%x "
+ "0710 Iodone cmd %p, error x%x "
"SNS x%x x%x Data: x%x x%x\n",
- phba->brd_no, sdev_id(cmd->device),
- scsilun_to_str(&cmd->device->lun, lunstr),
cmd, cmd->result,
*lp, *(lp + 3), cmd->retries, cmd->resid);
}
@@ -540,7 +536,6 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc
struct scsi_device *scsi_dev = lpfc_cmd->pCmd->device;
struct lpfc_rport_data *rdata = scsi_dev->hostdata;
struct lpfc_nodelist *ndlp = rdata->pnode;
- char lunstr[SCSILUN_STR_LEN];
if ((ndlp == 0) || (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) {
return 0;
@@ -581,11 +576,8 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc
lpfc_printf_log(phba,
KERN_INFO,
LOG_FCP,
- "%d:0703 Issue LUN Reset to TGT %d LUN %s "
+ "0703 Issue LUN Reset "
"Data: x%x x%x\n",
- phba->brd_no,
- sdev_id(scsi_dev),
- scsilun_to_str(&scsi_dev->lun, lunstr),
ndlp->nlp_rpi, ndlp->nlp_flag);
break;
@@ -594,11 +586,8 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc
lpfc_printf_log(phba,
KERN_INFO,
LOG_FCP,
- "%d:0701 Issue Abort Task Set to TGT %d LUN %s "
+ "0701 Issue Abort Task Set "
"Data: x%x x%x\n",
- phba->brd_no,
- sdev_id(scsi_dev),
- scsilun_to_str(&scsi_dev->lun, lunstr),
ndlp->nlp_rpi, ndlp->nlp_flag);
break;
@@ -607,10 +596,8 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc
lpfc_printf_log(phba,
KERN_INFO,
LOG_FCP,
- "%d:0702 Issue Target Reset to TGT %d "
+ "0702 Issue Target Reset "
"Data: x%x x%x\n",
- phba->brd_no,
- sdev_id(scsi_dev),
ndlp->nlp_rpi,
ndlp->nlp_flag);
break;
@@ -953,7 +940,6 @@ __lpfc_reset_lun_handler(struct scsi_cmn
struct lpfc_nodelist *pnode = rdata->pnode;
int ret = FAILED;
int cnt, loopcnt;
- char lunstr[SCSILUN_STR_LEN];
/*
* If target is not in a MAPPED state, delay the reset until
@@ -1045,11 +1031,8 @@ __lpfc_reset_lun_handler(struct scsi_cmn
out_free_scsi_buf:
lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
- "%d:0713 SCSI layer issued LUN reset (%d, %s) "
+ "0713 SCSI layer issued LUN reset "
"Data: x%x x%x x%x\n",
- phba->brd_no,
- sdev_id(lpfc_cmd->pCmd->device),
- scsilun_to_str(&lpfc_cmd->pCmd->device->lun, lunstr),
ret, lpfc_cmd->status,
lpfc_cmd->result);
lpfc_free_scsi_buf(lpfc_cmd);
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 4/2] HCIL drivers update; sdev_printk
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
2005-10-23 19:52 ` [PATCH RFC 2/2] " Jeff Garzik
2005-10-23 20:12 ` [PATCH RFC 3/2] HCIL driver update: lpfc Jeff Garzik
@ 2005-10-23 21:40 ` Jeff Garzik
2005-10-24 3:36 ` James Bottomley
2005-10-24 0:13 ` [PATCH RFC 5/n] HCIL drivers update Jeff Garzik
` (10 subsequent siblings)
13 siblings, 1 reply; 19+ messages in thread
From: Jeff Garzik @ 2005-10-23 21:40 UTC (permalink / raw)
To: linux-scsi
Yet more driver work. Some bugs added (and noted).
Added sdev_printk() to save typing.
drivers/scsi/aic7xxx_old.c | 232 ++++++++++++++++----------------
drivers/scsi/aic7xxx_old/aic7xxx_proc.c | 8 -
drivers/scsi/fd_mcs.c | 4
drivers/scsi/in2000.c | 91 +++++++-----
drivers/scsi/ips.c | 34 ++--
drivers/scsi/pcmcia/nsp_cs.c | 5
drivers/scsi/u14-34f.c | 60 ++++----
drivers/scsi/ultrastor.c | 4
include/scsi/scsi_device.h | 3
9 files changed, 234 insertions(+), 207 deletions(-)
3223e9b240cb8927b528c0f75566a752aa26ea06
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index 52b72d7..694a557 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -255,7 +255,7 @@
#define ALL_TARGETS -1
#define ALL_CHANNELS -1
-#define ALL_LUNS -1
+#define ALL_LUNS NULL
#define MAX_TARGETS 16
#define MAX_LUNS 8
#ifndef TRUE
@@ -1035,11 +1035,12 @@ static struct aic7xxx_syncrate {
(((scb->hscb)->target_channel_lun >> 4) & 0xf), \
((scb->hscb)->target_channel_lun & 0x07)
-#define CTL_OF_CMD(cmd) ((cmd->device->channel) & 0x01), \
- ((cmd->device->id) & 0x0f), \
- ((cmd->device->lun) & 0x07)
+#define CTL_OF_CMD(cmd) ((sdev_channel(cmd->device)) & 0x01), \
+ ((sdev_id(cmd->device)) & 0x0f), \
+ ((scsilun_to_int(&cmd->device->lun)) & 0x07)
-#define TARGET_INDEX(cmd) ((cmd)->device->id | ((cmd)->device->channel << 3))
+#define TARGET_INDEX(cmd) \
+ (sdev_id((cmd)->device) | (sdev_channel((cmd)->device) << 3))
/*
* A nice little define to make doing our printks a little easier
@@ -1271,7 +1272,7 @@ static void aic7xxx_set_syncrate(struct
unsigned int period, unsigned int offset, unsigned char options,
unsigned int type, struct aic_dev_data *aic_dev);
static void aic7xxx_set_width(struct aic7xxx_host *p, int target, int channel,
- int lun, unsigned int width, unsigned int type,
+ const struct scsi_lun *lun, unsigned int width, unsigned int type,
struct aic_dev_data *aic_dev);
static void aic7xxx_panic_abort(struct aic7xxx_host *p, Scsi_Cmnd *cmd);
static void aic7xxx_print_card(struct aic7xxx_host *p);
@@ -2072,6 +2073,7 @@ aic7xxx_set_syncrate(struct aic7xxx_host
unsigned short target_mask;
unsigned char lun, old_options;
unsigned int old_period, old_offset;
+ struct scsi_device *sd = aic_dev->SDptr;
tindex = target | (channel << 3);
target_mask = 0x01 << tindex;
@@ -2159,14 +2161,13 @@ aic7xxx_set_syncrate(struct aic7xxx_host
{
int rate_mod = (scsirate & WIDEXFER) ? 1 : 0;
- printk(INFO_LEAD "Synchronous at %s Mbyte/sec, "
- "offset %d.\n", p->host_no, channel, target, lun,
+ sdev_printk(KERN_INFO, sd, "Synchronous at %s Mbyte/sec, "
+ "offset %d.\n",
syncrate->rate[rate_mod], offset);
}
else
{
- printk(INFO_LEAD "Using asynchronous transfers.\n",
- p->host_no, channel, target, lun);
+ sdev_printk(KERN_INFO, sd, "Using asynchronous transfers.\n");
}
aic_dev->flags &= ~DEVICE_PRINT_DTR;
}
@@ -2195,12 +2196,14 @@ aic7xxx_set_syncrate(struct aic7xxx_host
* Set the actual width down in the card and in our host structs
*-F*************************************************************************/
static void
-aic7xxx_set_width(struct aic7xxx_host *p, int target, int channel, int lun,
- unsigned int width, unsigned int type, struct aic_dev_data *aic_dev)
+aic7xxx_set_width(struct aic7xxx_host *p, int target, int channel,
+ const struct scsi_lun *lun, unsigned int width, unsigned int type,
+ struct aic_dev_data *aic_dev)
{
unsigned char tindex;
unsigned short target_mask;
unsigned int old_width;
+ struct scsi_device *sd = aic_dev->SDptr;
tindex = target | (channel << 3);
target_mask = 1 << tindex;
@@ -2228,8 +2231,8 @@ aic7xxx_set_width(struct aic7xxx_host *p
(aic7xxx_verbose & VERBOSE_NEGOTIATION2) &&
(aic_dev->flags & DEVICE_PRINT_DTR) )
{
- printk(INFO_LEAD "Using %s transfers\n", p->host_no, channel, target,
- lun, (scsirate & WIDEXFER) ? "Wide(16bit)" : "Narrow(8bit)" );
+ sdev_printk(KERN_INFO, sd, "Using %s transfers\n",
+ (scsirate & WIDEXFER) ? "Wide(16bit)" : "Narrow(8bit)" );
}
}
@@ -2380,18 +2383,21 @@ scbq_insert_tail(volatile scb_queue_type
*-F*************************************************************************/
static int
aic7xxx_match_scb(struct aic7xxx_host *p, struct aic7xxx_scb *scb,
- int target, int channel, int lun, unsigned char tag)
+ int target, int channel, const struct scsi_lun *lun, unsigned char tag)
{
int targ = (scb->hscb->target_channel_lun >> 4) & 0x0F;
int chan = (scb->hscb->target_channel_lun >> 3) & 0x01;
int slun = scb->hscb->target_channel_lun & 0x07;
int match;
+ struct scsi_lun __slun;
+
+ int_to_scsilun(slun, &__slun);
match = ((chan == channel) || (channel == ALL_CHANNELS));
if (match != 0)
match = ((targ == target) || (target == ALL_TARGETS));
if (match != 0)
- match = ((lun == slun) || (lun == ALL_LUNS));
+ match = (scsilun_eq(lun, &__slun) || (lun == ALL_LUNS));
if (match != 0)
match = ((tag == scb->hscb->tag) || (tag == SCB_LIST_NULL));
@@ -3000,7 +3006,7 @@ aic7xxx_abort_waiting_scb(struct aic7xxx
*-F*************************************************************************/
static int
aic7xxx_search_qinfifo(struct aic7xxx_host *p, int target, int channel,
- int lun, unsigned char tag, int flags, int requeue,
+ const struct scsi_lun *lun, unsigned char tag, int flags, int requeue,
volatile scb_queue_type *queue)
{
int found;
@@ -3127,10 +3133,10 @@ aic7xxx_scb_on_qoutfifo(struct aic7xxx_h
*-F*************************************************************************/
static void
aic7xxx_reset_device(struct aic7xxx_host *p, int target, int channel,
- int lun, unsigned char tag)
+ const struct scsi_lun *lun, unsigned char tag)
{
struct aic7xxx_scb *scbp, *prev_scbp;
- struct scsi_device *sd;
+ struct scsi_device *sd = NULL; /* FIXME: initializer very wrong!!! */
unsigned char active_scb, tcl, scb_tag;
int i = 0, init_lists = FALSE;
struct aic_dev_data *aic_dev;
@@ -3143,19 +3149,21 @@ aic7xxx_reset_device(struct aic7xxx_host
if (aic7xxx_verbose & (VERBOSE_RESET_PROCESS | VERBOSE_ABORT_PROCESS))
{
+ unsigned int lunv = scsilun_to_int(lun);
+
printk(INFO_LEAD "Reset device, hardware_scb %d,\n",
- p->host_no, channel, target, lun, active_scb);
+ p->host_no, channel, target, lunv, active_scb);
printk(INFO_LEAD "Current scb %d, SEQADDR 0x%x, LASTPHASE "
"0x%x\n",
- p->host_no, channel, target, lun, scb_tag,
+ p->host_no, channel, target, lunv, scb_tag,
aic_inb(p, SEQADDR0) | (aic_inb(p, SEQADDR1) << 8),
aic_inb(p, LASTPHASE));
printk(INFO_LEAD "SG_CACHEPTR 0x%x, SG_COUNT %d, SCSISIGI 0x%x\n",
- p->host_no, channel, target, lun,
+ p->host_no, channel, target, lunv,
(p->features & AHC_ULTRA2) ? aic_inb(p, SG_CACHEPTR) : 0,
aic_inb(p, SG_COUNT), aic_inb(p, SCSISIGI));
printk(INFO_LEAD "SSTAT0 0x%x, SSTAT1 0x%x, SSTAT2 0x%x\n",
- p->host_no, channel, target, lun, aic_inb(p, SSTAT0),
+ p->host_no, channel, target, lunv, aic_inb(p, SSTAT0),
aic_inb(p, SSTAT1), aic_inb(p, SSTAT2));
}
@@ -3165,16 +3173,15 @@ aic7xxx_reset_device(struct aic7xxx_host
list_for_each_entry(aic_dev, &p->aic_devs, list)
{
if (aic7xxx_verbose & (VERBOSE_RESET_PROCESS | VERBOSE_ABORT_PROCESS))
- printk(INFO_LEAD "processing aic_dev %p\n", p->host_no, channel, target,
- lun, aic_dev);
+ sdev_printk(KERN_INFO, sd, "processing aic_dev %p\n", aic_dev);
sd = aic_dev->SDptr;
- if((target != ALL_TARGETS && target != sd->id) ||
- (channel != ALL_CHANNELS && channel != sd->channel))
+ if((target != ALL_TARGETS && target != sdev_id(sd)) ||
+ (channel != ALL_CHANNELS && channel != sdev_channel(sd)))
continue;
if (aic7xxx_verbose & (VERBOSE_ABORT_PROCESS | VERBOSE_RESET_PROCESS))
- printk(INFO_LEAD "Cleaning up status information "
- "and delayed_scbs.\n", p->host_no, sd->channel, sd->id, sd->lun);
+ sdev_printk(KERN_INFO, sd, "Cleaning up status information "
+ "and delayed_scbs.\n");
aic_dev->flags &= ~BUS_DEVICE_RESET_PENDING;
if ( tag == SCB_LIST_NULL )
{
@@ -3185,7 +3192,8 @@ aic7xxx_reset_device(struct aic7xxx_host
aic_dev->flags = DEVICE_PRINT_DTR;
aic_dev->temp_q_depth = aic_dev->max_q_depth;
}
- tcl = (sd->id << 4) | (sd->channel << 3) | sd->lun;
+ tcl = (sdev_id(sd) << 4) | (sdev_channel(sd) << 3) |
+ scsilun_to_int(&sd->lun);
if ( (aic7xxx_index_busy_target(p, tcl, FALSE) == tag) ||
(tag == SCB_LIST_NULL) )
aic7xxx_index_busy_target(p, tcl, /* unbusy */ TRUE);
@@ -3210,7 +3218,8 @@ aic7xxx_reset_device(struct aic7xxx_host
}
if (aic7xxx_verbose & (VERBOSE_ABORT_PROCESS | VERBOSE_RESET_PROCESS))
- printk(INFO_LEAD "Cleaning QINFIFO.\n", p->host_no, channel, target, lun );
+ sdev_printk(KERN_INFO, sd, "Cleaning QINFIFO.\n");
+
aic7xxx_search_qinfifo(p, target, channel, lun, tag,
SCB_RESET | SCB_QUEUED_FOR_DONE, /* requeue */ FALSE, NULL);
@@ -3219,8 +3228,7 @@ aic7xxx_reset_device(struct aic7xxx_host
* ABORT/RESET commands.
*/
if (aic7xxx_verbose & (VERBOSE_ABORT_PROCESS | VERBOSE_RESET_PROCESS))
- printk(INFO_LEAD "Cleaning waiting_scbs.\n", p->host_no, channel,
- target, lun );
+ sdev_printk(KERN_INFO, sd, "Cleaning waiting_scbs.\n");
{
struct aic7xxx_scb *scbp, *prev_scbp;
@@ -3249,8 +3257,7 @@ aic7xxx_reset_device(struct aic7xxx_host
* Search waiting for selection list.
*/
if (aic7xxx_verbose & (VERBOSE_ABORT_PROCESS | VERBOSE_RESET_PROCESS))
- printk(INFO_LEAD "Cleaning waiting for selection "
- "list.\n", p->host_no, channel, target, lun);
+ sdev_printk(KERN_INFO, sd, "Cleaning waiting for selection list.\n");
{
unsigned char next, prev, scb_index;
@@ -3266,9 +3273,8 @@ aic7xxx_reset_device(struct aic7xxx_host
* No aic7xxx_verbose check here.....we want to see this since it
* means either the kernel driver or the sequencer screwed things up
*/
- printk(WARN_LEAD "Waiting List inconsistency; SCB index=%d, "
- "numscbs=%d\n", p->host_no, channel, target, lun, scb_index,
- p->scb_data->numscbs);
+ sdev_printk(KERN_WARNING, sd, "Waiting List inconsistency; SCB index=%d, "
+ "numscbs=%d\n", scb_index, p->scb_data->numscbs);
next = aic_inb(p, SCB_NEXT);
aic7xxx_add_curscb_to_free_list(p);
}
@@ -3311,8 +3317,7 @@ aic7xxx_reset_device(struct aic7xxx_host
* for completion, zeroing their control byte too.
*/
if (aic7xxx_verbose & (VERBOSE_ABORT_PROCESS | VERBOSE_RESET_PROCESS))
- printk(INFO_LEAD "Cleaning disconnected scbs "
- "list.\n", p->host_no, channel, target, lun);
+ sdev_printk(KERN_INFO, sd, "Cleaning disconnected scbs list.\n");
if (p->flags & AHC_PAGESCBS)
{
unsigned char next, prev, scb_index;
@@ -3325,8 +3330,8 @@ aic7xxx_reset_device(struct aic7xxx_host
scb_index = aic_inb(p, SCB_TAG);
if (scb_index > p->scb_data->numscbs)
{
- printk(WARN_LEAD "Disconnected List inconsistency; SCB index=%d, "
- "numscbs=%d\n", p->host_no, channel, target, lun, scb_index,
+ sdev_printk(KERN_WARNING, sd, "Disconnected List inconsistency; SCB index=%d, "
+ "numscbs=%d\n", scb_index,
p->scb_data->numscbs);
next = aic7xxx_rem_scb_from_disc_list(p, next, prev);
}
@@ -3368,8 +3373,7 @@ aic7xxx_reset_device(struct aic7xxx_host
aic_outb(p, next, SCBPTR);
if (aic_inb(p, SCB_TAG) < p->scb_data->numscbs)
{
- printk(WARN_LEAD "Free list inconsistency!.\n", p->host_no, channel,
- target, lun);
+ sdev_printk(KERN_WARNING, sd, "Free list inconsistency!.\n");
init_lists = TRUE;
next = SCB_LIST_NULL;
}
@@ -3929,10 +3933,12 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
struct aic7xxx_scb *scb;
struct aic_dev_data *aic_dev;
unsigned short target_mask;
- unsigned char target, lun, tindex;
+ unsigned char target, tindex;
+ const struct scsi_lun *lun;
unsigned char queue_flag = FALSE;
char channel;
int result;
+ struct scsi_device *sd = NULL; /* FIXME: initializer very wrong!!! */
target = ((aic_inb(p, SAVED_TCL) >> 4) & 0x0f);
if ( (p->chip & AHC_CHIPID_MASK) == AHC_AIC7770 )
@@ -3954,10 +3960,9 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
{
aic_outb(p, aic_inb(p, SCSISEQ) & (ENSELI|ENRSELI|ENAUTOATNP),
SCSISEQ);
- printk(WARN_LEAD "No active SCB for reconnecting target - Issuing "
- "BUS DEVICE RESET.\n", p->host_no, channel, target, lun);
- printk(WARN_LEAD " SAVED_TCL=0x%x, ARG_1=0x%x, SEQADDR=0x%x\n",
- p->host_no, channel, target, lun,
+ sdev_printk(KERN_WARNING, sd, "No active SCB for reconnecting target - Issuing "
+ "BUS DEVICE RESET.\n");
+ sdev_printk(KERN_WARNING, sd, " SAVED_TCL=0x%x, ARG_1=0x%x, SEQADDR=0x%x\n",
aic_inb(p, SAVED_TCL), aic_inb(p, ARG_1),
(aic_inb(p, SEQADDR1) << 8) | aic_inb(p, SEQADDR0));
if (aic7xxx_panic_on_abort)
@@ -3968,8 +3973,8 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
case SEND_REJECT:
{
if (aic7xxx_verbose & VERBOSE_MINOR_ERROR)
- printk(INFO_LEAD "Rejecting unknown message (0x%x) received from "
- "target, SEQ_FLAGS=0x%x\n", p->host_no, channel, target, lun,
+ sdev_printk(KERN_INFO, sd, "Rejecting unknown message (0x%x) received from "
+ "target, SEQ_FLAGS=0x%x\n",
aic_inb(p, ACCUM), aic_inb(p, SEQ_FLAGS));
}
break;
@@ -3984,9 +3989,9 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
* reset.
*/
if (aic7xxx_verbose & (VERBOSE_SEQINT | VERBOSE_RESET_MID))
- printk(INFO_LEAD "Target did not send an IDENTIFY message; "
- "LASTPHASE 0x%x, SAVED_TCL 0x%x\n", p->host_no, channel, target,
- lun, aic_inb(p, LASTPHASE), aic_inb(p, SAVED_TCL));
+ sdev_printk(KERN_INFO, sd, "Target did not send an IDENTIFY message; "
+ "LASTPHASE 0x%x, SAVED_TCL 0x%x\n",
+ aic_inb(p, LASTPHASE), aic_inb(p, SAVED_TCL));
aic7xxx_reset_channel(p, channel, /*initiate reset*/ TRUE);
aic7xxx_run_done_queue(p, TRUE);
@@ -3998,15 +4003,13 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
if (aic_inb(p, LASTPHASE) == P_BUSFREE)
{
if (aic7xxx_verbose & VERBOSE_SEQINT)
- printk(INFO_LEAD "Missed busfree.\n", p->host_no, channel,
- target, lun);
+ sdev_printk(KERN_INFO, sd, "Missed busfree.\n");
restart_sequencer(p);
}
else
{
if (aic7xxx_verbose & VERBOSE_SEQINT)
- printk(INFO_LEAD "Unknown scsi bus phase, continuing\n", p->host_no,
- channel, target, lun);
+ sdev_printk(KERN_INFO, sd, "Unknown scsi bus phase, continuing\n");
}
break;
@@ -4018,8 +4021,7 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
#ifdef AIC7XXX_VERBOSE_DEBUGGING
if (aic7xxx_verbose > 0xffff)
- printk(INFO_LEAD "Enabling REQINITs for MSG_IN\n", p->host_no,
- channel, target, lun);
+ sdev_printk(KERN_INFO, sd, "Enabling REQINITs for MSG_IN\n");
#endif
/*
@@ -4124,8 +4126,8 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
* operation.
*/
aic7xxx_busy_target(p, scb);
- printk(INFO_LEAD "Device is refusing tagged commands, using "
- "untagged I/O.\n", p->host_no, channel, target, lun);
+ sdev_printk(KERN_INFO, sd, "Device is refusing tagged commands, using "
+ "untagged I/O.\n");
aic_outb(p, MSG_IDENTIFYFLAG, MSG_OUT);
aic_outb(p, aic_inb(p, SCSISIGI) | ATNO, SCSISIGO);
}
@@ -4150,8 +4152,8 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
scb->flags &= ~SCB_MSGOUT_BITS;
if(aic7xxx_verbose & VERBOSE_NEGOTIATION2)
{
- printk(INFO_LEAD "Device is rejecting PPR messages, falling "
- "back.\n", p->host_no, channel, target, lun);
+ sdev_printk(KERN_INFO, sd, "Device is rejecting PPR messages, falling "
+ "back.\n");
}
if ( aic_dev->goal.width )
{
@@ -4188,8 +4190,8 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
aic_dev);
if(aic7xxx_verbose & VERBOSE_NEGOTIATION2)
{
- printk(INFO_LEAD "Device is rejecting WDTR messages, using "
- "narrow transfers.\n", p->host_no, channel, target, lun);
+ sdev_printk(KERN_INFO, sd, "Device is rejecting WDTR messages, using "
+ "narrow transfers.\n");
}
aic_dev->needsdtr = aic_dev->needsdtr_copy;
}
@@ -4204,8 +4206,8 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
(AHC_TRANS_CUR|AHC_TRANS_ACTIVE|AHC_TRANS_GOAL), aic_dev);
if(aic7xxx_verbose & VERBOSE_NEGOTIATION2)
{
- printk(INFO_LEAD "Device is rejecting SDTR messages, using "
- "async transfers.\n", p->host_no, channel, target, lun);
+ sdev_printk(KERN_INFO, sd, "Device is rejecting SDTR messages, using "
+ "async transfers.\n");
}
}
else if (aic7xxx_verbose & VERBOSE_SEQINT)
@@ -4213,8 +4215,8 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
/*
* Otherwise, we ignore it.
*/
- printk(INFO_LEAD "Received MESSAGE_REJECT for unknown cause. "
- "Ignoring.\n", p->host_no, channel, target, lun);
+ sdev_printk(KERN_INFO, sd, "Received MESSAGE_REJECT for unknown cause. "
+ "Ignoring.\n");
}
}
break;
@@ -4239,8 +4241,8 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
scb_index = aic_inb(p, SCB_TAG);
if (scb_index > p->scb_data->numscbs)
{
- printk(WARN_LEAD "Invalid SCB during SEQINT 0x%02x, SCB_TAG %d.\n",
- p->host_no, channel, target, lun, intstat, scb_index);
+ sdev_printk(KERN_WARNING, sd, "Invalid SCB during SEQINT 0x%02x, SCB_TAG %d.\n",
+ intstat, scb_index);
break;
}
scb = p->scb_data->scb_array[scb_index];
@@ -4248,8 +4250,8 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
if (!(scb->flags & SCB_ACTIVE) || (scb->cmd == NULL))
{
- printk(WARN_LEAD "Invalid SCB during SEQINT 0x%x, scb %d, flags 0x%x,"
- " cmd 0x%lx.\n", p->host_no, channel, target, lun, intstat,
+ sdev_printk(KERN_WARNING, sd, "Invalid SCB during SEQINT 0x%x, scb %d, flags 0x%x,"
+ " cmd 0x%lx.\n", intstat,
scb_index, scb->flags, (unsigned long) scb->cmd);
}
else
@@ -4280,7 +4282,7 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
memcpy(scb->sense_cmd, &generic_sense[0],
sizeof(generic_sense));
- scb->sense_cmd[1] = (cmd->device->lun << 5);
+ scb->sense_cmd[1] = (scsilun_to_int(&cmd->device->lun) << 5);
scb->sense_cmd[4] = sizeof(cmd->sense_buffer);
scb->sg_list[0].length =
@@ -4898,9 +4900,8 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
#endif
default: /* unknown */
- printk(WARN_LEAD "Unknown SEQINT, INTSTAT 0x%x, SCSISIGI 0x%x.\n",
- p->host_no, channel, target, lun, intstat,
- aic_inb(p, SCSISIGI));
+ sdev_printk(KERN_WARNING, sd, "Unknown SEQINT, INTSTAT 0x%x, SCSISIGI 0x%x.\n",
+ intstat, aic_inb(p, SCSISIGI));
break;
}
@@ -4924,16 +4925,17 @@ aic7xxx_parse_msg(struct aic7xxx_host *p
int reject, reply, done;
unsigned char target_scsirate, tindex;
unsigned short target_mask;
- unsigned char target, channel, lun;
+ unsigned char target, channel;
+ const struct scsi_lun *lun;
unsigned char bus_width, new_bus_width;
unsigned char trans_options, new_trans_options;
unsigned int period, new_period, offset, new_offset, maxsync;
struct aic7xxx_syncrate *syncrate;
struct aic_dev_data *aic_dev;
- target = scb->cmd->device->id;
- channel = scb->cmd->device->channel;
- lun = scb->cmd->device->lun;
+ target = sdev_id(scb->cmd->device);
+ channel = sdev_channel(scb->cmd->device);
+ lun = &scb->cmd->device->lun;
reply = reject = done = FALSE;
tindex = TARGET_INDEX(scb->cmd);
aic_dev = AIC_DEV(scb->cmd);
@@ -5666,6 +5668,7 @@ aic7xxx_handle_scsiint(struct aic7xxx_ho
unsigned char status;
struct aic7xxx_scb *scb;
struct aic_dev_data *aic_dev;
+ struct scsi_device *sd;
scb_index = aic_inb(p, SCB_TAG);
status = aic_inb(p, SSTAT1);
@@ -6021,20 +6024,25 @@ aic7xxx_handle_scsiint(struct aic7xxx_ho
* like our settings.
*/
aic_dev = AIC_DEV(scb->cmd);
+ sd = aic_dev->SDptr;
aic_dev->needppr = aic_dev->needppr_copy = 0;
- aic7xxx_set_width(p, scb->cmd->device->id, scb->cmd->device->channel, scb->cmd->device->lun,
+ aic7xxx_set_width(p, sdev_id(scb->cmd->device),
+ sdev_channel(scb->cmd->device),
+ &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->device->id, scb->cmd->device->channel, 0, 0,
+ aic7xxx_set_syncrate(p, NULL,
+ sdev_id(scb->cmd->device),
+ sdev_channel(scb->cmd->device), 0, 0,
0, AHC_TRANS_ACTIVE|AHC_TRANS_CUR|AHC_TRANS_QUITE,
aic_dev);
aic_dev->goal.options = 0;
scb->flags &= ~SCB_MSGOUT_BITS;
if(aic7xxx_verbose & VERBOSE_NEGOTIATION2)
{
- printk(INFO_LEAD "parity error during PPR message, reverting "
- "to WDTR/SDTR\n", p->host_no, CTL_OF_SCB(scb));
+ sdev_printk(KERN_INFO, sd, "parity error during PPR message, reverting "
+ "to WDTR/SDTR\n");
}
if ( aic_dev->goal.width )
{
@@ -6303,8 +6311,10 @@ aic7xxx_handle_command_completion_intr(s
unpause_sequencer(p, FALSE);
continue;
}
- aic7xxx_reset_device(p, scb->cmd->device->id, scb->cmd->device->channel,
- scb->cmd->device->lun, scb->hscb->tag);
+ aic7xxx_reset_device(p,
+ sdev_id(scb->cmd->device),
+ sdev_channel(scb->cmd->device),
+ &scb->cmd->device->lun, scb->hscb->tag);
scb->flags &= ~(SCB_QUEUED_FOR_DONE | SCB_RESET | SCB_ABORT |
SCB_QUEUED_ABORT);
unpause_sequencer(p, FALSE);
@@ -6517,7 +6527,7 @@ aic7xxx_init_transinfo(struct aic7xxx_ho
Scsi_Device *sdpnt = aic_dev->SDptr;
unsigned char tindex;
- tindex = sdpnt->id | (sdpnt->channel << 3);
+ tindex = sdev_id(sdpnt) | (sdev_channel(sdpnt) << 3);
if (!(aic_dev->flags & DEVICE_DTR_SCANNED))
{
aic_dev->flags |= DEVICE_DTR_SCANNED;
@@ -6531,7 +6541,7 @@ aic7xxx_init_transinfo(struct aic7xxx_ho
{
aic_dev->needwdtr = aic_dev->needwdtr_copy = 0;
pause_sequencer(p);
- aic7xxx_set_width(p, sdpnt->id, sdpnt->channel, sdpnt->lun,
+ aic7xxx_set_width(p, sdev_id(sdpnt), sdev_channel(sdpnt), &sdpnt->lun,
MSG_EXT_WDTR_BUS_8_BIT, (AHC_TRANS_ACTIVE |
AHC_TRANS_GOAL |
AHC_TRANS_CUR), aic_dev );
@@ -6593,7 +6603,7 @@ aic7xxx_slave_alloc(Scsi_Device *SDptr)
* Check to see if channel was scanned.
*/
- if (!(p->flags & AHC_A_SCANNED) && (SDptr->channel == 0))
+ if (!(p->flags & AHC_A_SCANNED) && (sdev_channel(SDptr) == 0))
{
if (aic7xxx_verbose & VERBOSE_PROBE2)
printk(INFO_LEAD "Scanning channel for devices.\n",
@@ -6602,7 +6612,7 @@ aic7xxx_slave_alloc(Scsi_Device *SDptr)
}
else
{
- if (!(p->flags & AHC_B_SCANNED) && (SDptr->channel == 1))
+ if (!(p->flags & AHC_B_SCANNED) && (sdev_channel(SDptr) == 1))
{
if (aic7xxx_verbose & VERBOSE_PROBE2)
printk(INFO_LEAD "Scanning channel for devices.\n",
@@ -6650,7 +6660,7 @@ aic7xxx_device_queue_depth(struct aic7xx
struct aic_dev_data *aic_dev = device->hostdata;
unsigned char tindex;
- tindex = device->id | (device->channel << 3);
+ tindex = sdev_id(device) | (sdev_channel(device) << 3);
if (device->simple_tags)
return; // We've already enabled this device
@@ -6662,9 +6672,8 @@ aic7xxx_device_queue_depth(struct aic7xx
if (!(p->discenable & (1 << tindex)))
{
if (aic7xxx_verbose & VERBOSE_NEGOTIATION2)
- printk(INFO_LEAD "Disconnection disabled, unable to "
- "enable tagged queueing.\n",
- p->host_no, device->channel, device->id, device->lun);
+ sdev_printk(KERN_INFO, device, "Disconnection disabled, unable to "
+ "enable tagged queueing.\n");
tag_enabled = FALSE;
}
else
@@ -6707,9 +6716,9 @@ aic7xxx_device_queue_depth(struct aic7xx
{
if (aic7xxx_verbose & VERBOSE_NEGOTIATION2)
{
- printk(INFO_LEAD "Tagged queuing enabled, queue depth %d.\n",
- p->host_no, device->channel, device->id,
- device->lun, aic_dev->max_q_depth);
+ sdev_printk(KERN_INFO, device,
+ "Tagged queuing enabled, queue depth %d.\n",
+ aic_dev->max_q_depth);
}
scsi_adjust_queue_depth(device, MSG_ORDERED_TAG, aic_dev->max_q_depth);
}
@@ -6717,9 +6726,9 @@ aic7xxx_device_queue_depth(struct aic7xx
{
if (aic7xxx_verbose & VERBOSE_NEGOTIATION2)
{
- printk(INFO_LEAD "Tagged queuing disabled, queue depth %d.\n",
- p->host_no, device->channel, device->id,
- device->lun, device->host->cmd_per_lun);
+ sdev_printk(KERN_INFO, device,
+ "Tagged queuing disabled, queue depth %d.\n",
+ device->host->cmd_per_lun);
}
scsi_adjust_queue_depth(device, 0, device->host->cmd_per_lun);
}
@@ -10195,8 +10204,9 @@ aic7xxx_buildscb(struct aic7xxx_host *p,
}
scb->flags |= SCB_DTR_SCB;
}
- hscb->target_channel_lun = ((cmd->device->id << 4) & 0xF0) |
- ((cmd->device->channel & 0x01) << 3) | (cmd->device->lun & 0x07);
+ hscb->target_channel_lun = ((sdev_id(cmd->device) << 4) & 0xF0) |
+ ((sdev_channel(cmd->device) & 0x01) << 3) |
+ (scsilun_to_int(&cmd->device->lun) & 0x07);
/*
* The interpretation of request_buffer and request_bufflen
@@ -10435,7 +10445,7 @@ __aic7xxx_bus_device_reset(Scsi_Cmnd *cm
aic_inb(p, STCNT));
}
- channel = cmd->device->channel;
+ channel = sdev_channel(cmd->device);
/*
* Send a Device Reset Message:
@@ -10502,7 +10512,8 @@ __aic7xxx_bus_device_reset(Scsi_Cmnd *cm
* 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->device->channel, cmd->device->id, cmd->device->lun, hscb->tag,
+ if (aic7xxx_search_qinfifo(p, sdev_channel(cmd->device),
+ sdev_id(cmd->device), &cmd->device->lun, hscb->tag,
0, TRUE, NULL) == 0)
{
disconnected = TRUE;
@@ -10669,8 +10680,9 @@ __aic7xxx_abort(Scsi_Cmnd *cmd)
/*
* We just checked the waiting_q, now for the QINFIFO
*/
- if ( ((found = aic7xxx_search_qinfifo(p, cmd->device->id, cmd->device->channel,
- cmd->device->lun, scb->hscb->tag, SCB_ABORT | SCB_QUEUED_FOR_DONE,
+ if ( ((found = aic7xxx_search_qinfifo(p, sdev_id(cmd->device),
+ sdev_channel(cmd->device),
+ &cmd->device->lun, scb->hscb->tag, SCB_ABORT | SCB_QUEUED_FOR_DONE,
FALSE, NULL)) != 0) &&
(aic7xxx_verbose & VERBOSE_ABORT_PROCESS))
{
@@ -10893,10 +10905,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->device->channel, TRUE);
+ aic7xxx_reset_channel(p, sdev_channel(cmd->device), TRUE);
if (p->features & AHC_TWIN)
{
- aic7xxx_reset_channel(p, cmd->device->channel ^ 0x01, TRUE);
+ aic7xxx_reset_channel(p, sdev_channel(cmd->device) ^ 0x01, TRUE);
restart_sequencer(p);
}
aic_outb(p, aic_inb(p, SIMODE1) & ~(ENREQINIT|ENBUSFREE), SIMODE1);
diff --git a/drivers/scsi/aic7xxx_old/aic7xxx_proc.c b/drivers/scsi/aic7xxx_old/aic7xxx_proc.c
index 3bf3349..af4f7fe 100644
--- a/drivers/scsi/aic7xxx_old/aic7xxx_proc.c
+++ b/drivers/scsi/aic7xxx_old/aic7xxx_proc.c
@@ -89,6 +89,7 @@ aic7xxx_proc_info ( struct Scsi_Host *HB
int size = 0;
unsigned char i;
unsigned char tindex;
+ char lunstr[SCSILUN_STR_LEN];
for(p=first_aic7xxx; p && p->host != HBAptr; p=p->next)
;
@@ -261,9 +262,10 @@ aic7xxx_proc_info ( struct Scsi_Host *HB
list_for_each_entry(aic_dev, &p->aic_devs, list)
{
sdptr = aic_dev->SDptr;
- tindex = sdptr->channel << 3 | sdptr->id;
- size += sprintf(BLS, "(scsi%d:%d:%d:%d)\n",
- p->host_no, sdptr->channel, sdptr->id, sdptr->lun);
+ tindex = sdev_channel(sdptr) << 3 | sdev_id(sdptr);
+ size += sprintf(BLS, "(scsi%d:%d:%d:%s)\n",
+ p->host_no, sdev_channel(sdptr), sdev_id(sdptr),
+ scsilun_to_str(&sdptr->lun, lunstr));
size += sprintf(BLS, " Device using %s/%s",
(aic_dev->cur.width == MSG_EXT_WDTR_BUS_16_BIT) ?
"Wide" : "Narrow",
diff --git a/drivers/scsi/fd_mcs.c b/drivers/scsi/fd_mcs.c
index d59d449..80c202e 100644
--- a/drivers/scsi/fd_mcs.c
+++ b/drivers/scsi/fd_mcs.c
@@ -671,7 +671,7 @@ static irqreturn_t fd_mcs_intr(int irq,
outb(0x40 | FIFO_COUNT, Interrupt_Cntl_port);
outb(0x82, SCSI_Cntl_port); /* Bus Enable + Select */
- outb(adapter_mask | (1 << current_SC->device->id), SCSI_Data_NoACK_port);
+ outb(adapter_mask | (1 << sdev_id(current_SC->device)), SCSI_Data_NoACK_port);
/* Stop arbitration and enable parity */
outb(0x10 | PARITY_MASK, TMC_Cntl_port);
@@ -683,7 +683,7 @@ static irqreturn_t fd_mcs_intr(int irq,
status = inb(SCSI_Status_port);
if (!(status & 0x01)) {
/* Try again, for slow devices */
- if (fd_mcs_select(shpnt, current_SC->device->id)) {
+ if (fd_mcs_select(shpnt, sdev_id(current_SC->device))) {
#if EVERY_ACCESS
printk(" SFAIL ");
#endif
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
index aed7e64..1f03112 100644
--- a/drivers/scsi/in2000.c
+++ b/drivers/scsi/in2000.c
@@ -343,7 +343,7 @@ static int in2000_queuecommand(Scsi_Cmnd
instance = cmd->device->host;
hostdata = (struct IN2000_hostdata *) instance->hostdata;
- DB(DB_QUEUE_COMMAND, printk("Q-%d-%02x-%ld(", cmd->device->id, cmd->cmnd[0], cmd->pid))
+ DB(DB_QUEUE_COMMAND, sdev_printk(KERN_DEBUG, cmd->device, "Q-%02x-%ld(", 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
@@ -470,7 +470,7 @@ static void in2000_execute(struct Scsi_H
cmd = (Scsi_Cmnd *) hostdata->input_Q;
prev = NULL;
while (cmd) {
- if (!(hostdata->busy[cmd->device->id] & (1 << cmd->device->lun)))
+ if (!(hostdata->busy[sdev_id(cmd->device)] & (1 << scsilun_to_int(&cmd->device->lun))))
break;
prev = cmd;
cmd = (Scsi_Cmnd *) cmd->host_scribble;
@@ -493,7 +493,7 @@ static void in2000_execute(struct Scsi_H
hostdata->input_Q = (Scsi_Cmnd *) cmd->host_scribble;
#ifdef PROC_STATISTICS
- hostdata->cmd_cnt[cmd->device->id]++;
+ hostdata->cmd_cnt[sdev_id(cmd->device)]++;
#endif
/*
@@ -501,9 +501,9 @@ static void in2000_execute(struct Scsi_H
*/
if (is_dir_out(cmd))
- write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id);
+ write_3393(hostdata, WD_DESTINATION_ID, sdev_id(cmd->device));
else
- write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id | DSTID_DPD);
+ write_3393(hostdata, WD_DESTINATION_ID, sdev_id(cmd->device) | 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
@@ -540,7 +540,8 @@ static void in2000_execute(struct Scsi_H
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->device->id != cmd->device->id) || (prev->device->lun != cmd->device->lun)) {
+ if ((sdev_id(prev->device) != sdev_id(cmd->device)) ||
+ (!scsilun_eq(&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;
@@ -552,17 +553,17 @@ static void in2000_execute(struct Scsi_H
cmd->SCp.phase = 1;
#ifdef PROC_STATISTICS
- hostdata->disc_allowed_cnt[cmd->device->id]++;
+ hostdata->disc_allowed_cnt[sdev_id(cmd->device)]++;
#endif
no:
write_3393(hostdata, WD_SOURCE_ID, ((cmd->SCp.phase) ? SRCID_ER : 0));
- 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);
+ write_3393(hostdata, WD_TARGET_LUN, scsilun_to_int(&cmd->device->lun));
+ write_3393(hostdata, WD_SYNCHRONOUS_TRANSFER, hostdata->sync_xfer[sdev_id(cmd->device)]);
+ hostdata->busy[sdev_id(cmd->device)] |= (1 << scsilun_to_int(&cmd->device->lun));
- if ((hostdata->level2 <= L2_NONE) || (hostdata->sync_stat[cmd->device->id] == SS_UNSET)) {
+ if ((hostdata->level2 <= L2_NONE) || (hostdata->sync_stat[sdev_id(cmd->device)] == SS_UNSET)) {
/*
* Do a 'Select-With-ATN' command. This will end with
@@ -584,11 +585,11 @@ static void in2000_execute(struct Scsi_H
* 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->device->id] == SS_UNSET) {
- if (hostdata->sync_off & (1 << cmd->device->id))
- hostdata->sync_stat[cmd->device->id] = SS_SET;
+ if (hostdata->sync_stat[sdev_id(cmd->device)] == SS_UNSET) {
+ if (hostdata->sync_off & (1 << sdev_id(cmd->device)))
+ hostdata->sync_stat[sdev_id(cmd->device)] = SS_SET;
else
- hostdata->sync_stat[cmd->device->id] = SS_FIRST;
+ hostdata->sync_stat[sdev_id(cmd->device)] = SS_FIRST;
}
hostdata->state = S_SELECTING;
write_3393_count(hostdata, 0); /* this guarantees a DATA_PHASE interrupt */
@@ -769,7 +770,7 @@ static void transfer_bytes(Scsi_Cmnd * c
/* Set up hardware registers */
- write_3393(hostdata, WD_SYNCHRONOUS_TRANSFER, hostdata->sync_xfer[cmd->device->id]);
+ write_3393(hostdata, WD_SYNCHRONOUS_TRANSFER, hostdata->sync_xfer[sdev_id(cmd->device)]);
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 */
@@ -1074,7 +1075,7 @@ static irqreturn_t in2000_intr(int irqnu
}
cmd->result = DID_NO_CONNECT << 16;
- hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+ hostdata->busy[sdev_id(cmd->device)] &= ~(1 << scsilun_to_int(&cmd->device->lun));
hostdata->state = S_UNCONNECTED;
cmd->scsi_done(cmd);
@@ -1096,16 +1097,16 @@ static irqreturn_t in2000_intr(int irqnu
/* construct an IDENTIFY message with correct disconnect bit */
- hostdata->outgoing_msg[0] = (0x80 | 0x00 | cmd->device->lun);
+ hostdata->outgoing_msg[0] = (0x80 | 0x00 | scsilun_to_int(&cmd->device->lun));
if (cmd->SCp.phase)
hostdata->outgoing_msg[0] |= 0x40;
- if (hostdata->sync_stat[cmd->device->id] == SS_FIRST) {
+ if (hostdata->sync_stat[sdev_id(cmd->device)] == SS_FIRST) {
#ifdef SYNC_DEBUG
printk(" sending SDTR ");
#endif
- hostdata->sync_stat[cmd->device->id] = SS_WAITING;
+ hostdata->sync_stat[sdev_id(cmd->device)] = SS_WAITING;
/* tack on a 2nd message to ask about synchronous transfers */
@@ -1224,8 +1225,8 @@ static irqreturn_t in2000_intr(int irqnu
#ifdef SYNC_DEBUG
printk("-REJ-");
#endif
- if (hostdata->sync_stat[cmd->device->id] == SS_WAITING)
- hostdata->sync_stat[cmd->device->id] = SS_SET;
+ if (hostdata->sync_stat[sdev_id(cmd->device)] == SS_WAITING)
+ hostdata->sync_stat[sdev_id(cmd->device)] = SS_SET;
write_3393_cmd(hostdata, WD_CMD_NEGATE_ACK);
hostdata->state = S_CONNECTED;
break;
@@ -1245,7 +1246,7 @@ static irqreturn_t in2000_intr(int irqnu
switch (ucp[2]) { /* what's the EXTENDED code? */
case EXTENDED_SDTR:
id = calc_sync_xfer(ucp[3], ucp[4]);
- if (hostdata->sync_stat[cmd->device->id] != SS_WAITING) {
+ if (hostdata->sync_stat[sdev_id(cmd->device)] != SS_WAITING) {
/* A device has sent an unsolicited SDTR message; rather than go
* through the effort of decoding it and then figuring out what
@@ -1263,14 +1264,14 @@ static irqreturn_t in2000_intr(int irqnu
hostdata->outgoing_msg[3] = hostdata->default_sx_per / 4;
hostdata->outgoing_msg[4] = 0;
hostdata->outgoing_len = 5;
- hostdata->sync_xfer[cmd->device->id] = calc_sync_xfer(hostdata->default_sx_per / 4, 0);
+ hostdata->sync_xfer[sdev_id(cmd->device)] = calc_sync_xfer(hostdata->default_sx_per / 4, 0);
} else {
- hostdata->sync_xfer[cmd->device->id] = id;
+ hostdata->sync_xfer[sdev_id(cmd->device)] = id;
}
#ifdef SYNC_DEBUG
- printk("sync_xfer=%02x", hostdata->sync_xfer[cmd->device->id]);
+ printk("sync_xfer=%02x", hostdata->sync_xfer[sdev_id(cmd->device)]);
#endif
- hostdata->sync_stat[cmd->device->id] = SS_SET;
+ hostdata->sync_stat[sdev_id(cmd->device)] = SS_SET;
write_3393_cmd(hostdata, WD_CMD_NEGATE_ACK);
hostdata->state = S_CONNECTED;
break;
@@ -1332,7 +1333,7 @@ static irqreturn_t in2000_intr(int irqnu
lun = read_3393(hostdata, WD_TARGET_LUN);
DB(DB_INTR, printk(":%d.%d", cmd->SCp.Status, lun))
hostdata->connected = NULL;
- hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+ hostdata->busy[sdev_id(cmd->device)] &= ~(1 << scsilun_to_int(&cmd->device->lun));
hostdata->state = S_UNCONNECTED;
if (cmd->SCp.Status == ILLEGAL_STATUS_BYTE)
cmd->SCp.Status = lun;
@@ -1417,7 +1418,7 @@ static irqreturn_t in2000_intr(int irqnu
}
DB(DB_INTR, printk("UNEXP_DISC-%ld", cmd->pid))
hostdata->connected = NULL;
- hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+ hostdata->busy[sdev_id(cmd->device)] &= ~(1 << scsilun_to_int(&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);
@@ -1448,7 +1449,7 @@ static irqreturn_t in2000_intr(int irqnu
switch (hostdata->state) {
case S_PRE_CMP_DISC:
hostdata->connected = NULL;
- hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+ hostdata->busy[sdev_id(cmd->device)] &= ~(1 << scsilun_to_int(&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)
@@ -1465,7 +1466,7 @@ static irqreturn_t in2000_intr(int irqnu
hostdata->state = S_UNCONNECTED;
#ifdef PROC_STATISTICS
- hostdata->disc_done_cnt[cmd->device->id]++;
+ hostdata->disc_done_cnt[sdev_id(cmd->device)]++;
#endif
break;
@@ -1493,7 +1494,7 @@ static irqreturn_t in2000_intr(int irqnu
if (hostdata->selecting) {
cmd = (Scsi_Cmnd *) hostdata->selecting;
hostdata->selecting = NULL;
- hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+ hostdata->busy[sdev_id(cmd->device)] &= ~(1 << scsilun_to_int(&cmd->device->lun));
cmd->host_scribble = (uchar *) hostdata->input_Q;
hostdata->input_Q = cmd;
}
@@ -1503,7 +1504,7 @@ static irqreturn_t in2000_intr(int irqnu
if (cmd) {
if (phs == 0x00) {
- hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+ hostdata->busy[sdev_id(cmd->device)] &= ~(1 << scsilun_to_int(&cmd->device->lun));
cmd->host_scribble = (uchar *) hostdata->input_Q;
hostdata->input_Q = cmd;
} else {
@@ -1535,7 +1536,7 @@ static irqreturn_t in2000_intr(int irqnu
cmd = (Scsi_Cmnd *) hostdata->disconnected_Q;
patch = NULL;
while (cmd) {
- if (id == cmd->device->id && lun == cmd->device->lun)
+ if (id == sdev_id(cmd->device) && lun == scsilun_to_int(&cmd->device->lun))
break;
patch = cmd;
cmd = (Scsi_Cmnd *) cmd->host_scribble;
@@ -1562,9 +1563,9 @@ static irqreturn_t in2000_intr(int irqnu
*/
if (is_dir_out(cmd))
- write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id);
+ write_3393(hostdata, WD_DESTINATION_ID, sdev_id(cmd->device));
else
- write_3393(hostdata, WD_DESTINATION_ID, cmd->device->id | DSTID_DPD);
+ write_3393(hostdata, WD_DESTINATION_ID, sdev_id(cmd->device) | 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);
@@ -1757,7 +1758,7 @@ static int __in2000_abort(Scsi_Cmnd * cm
sr = read_3393(hostdata, WD_SCSI_STATUS);
printk("asr=%02x, sr=%02x.", asr, sr);
- hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+ hostdata->busy[sdev_id(cmd->device)] &= ~(1 << scsilun_to_int(&cmd->device->lun));
hostdata->connected = NULL;
hostdata->state = S_UNCONNECTED;
cmd->result = DID_ABORT << 16;
@@ -2166,6 +2167,7 @@ static int in2000_proc_info(struct Scsi_
Scsi_Cmnd *cmd;
int x, i;
static int stop = 0;
+ char lunstr[SCSILUN_STR_LEN];
hd = (struct IN2000_hostdata *) instance->hostdata;
@@ -2256,7 +2258,10 @@ static int in2000_proc_info(struct Scsi_
strcat(bp, "\nconnected: ");
if (hd->connected) {
cmd = (Scsi_Cmnd *) hd->connected;
- sprintf(tbuf, " %ld-%d:%d(%02x)", cmd->pid, cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
+ sprintf(tbuf, " %ld-%d:%s(%02x)", cmd->pid,
+ sdev_id(cmd->device),
+ scsilun_to_str(&cmd->device->lun, lunstr),
+ cmd->cmnd[0]);
strcat(bp, tbuf);
}
}
@@ -2264,7 +2269,10 @@ static int in2000_proc_info(struct Scsi_
strcat(bp, "\ninput_Q: ");
cmd = (Scsi_Cmnd *) hd->input_Q;
while (cmd) {
- sprintf(tbuf, " %ld-%d:%d(%02x)", cmd->pid, cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
+ sprintf(tbuf, " %ld-%d:%s(%02x)", cmd->pid,
+ sdev_id(cmd->device),
+ scsilun_to_str(&cmd->device->lun, lunstr),
+ cmd->cmnd[0]);
strcat(bp, tbuf);
cmd = (Scsi_Cmnd *) cmd->host_scribble;
}
@@ -2273,7 +2281,10 @@ static int in2000_proc_info(struct Scsi_
strcat(bp, "\ndisconnected_Q:");
cmd = (Scsi_Cmnd *) hd->disconnected_Q;
while (cmd) {
- sprintf(tbuf, " %ld-%d:%d(%02x)", cmd->pid, cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
+ sprintf(tbuf, " %ld-%d:%s(%02x)", cmd->pid,
+ sdev_id(cmd->device),
+ scsilun_to_str(&cmd->device->lun, lunstr),
+ cmd->cmnd[0]);
strcat(bp, tbuf);
cmd = (Scsi_Cmnd *) cmd->host_scribble;
}
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 4cdd891..10d9981 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -1125,8 +1125,8 @@ ips_queue(Scsi_Cmnd * SC, void (*done) (
SC->device->channel, SC->device->id, SC->device->lun);
/* Check for command to initiator IDs */
- if ((SC->device->channel > 0)
- && (SC->device->id == ha->ha_id[SC->device->channel])) {
+ if ((sdev_channel(SC->device) > 0)
+ && (sdev_id(SC->device) == ha->ha_id[sdev_channel(SC->device)])) {
SC->result = DID_NO_CONNECT << 16;
done(SC);
@@ -1611,9 +1611,9 @@ ips_is_passthru(Scsi_Cmnd * SC)
return (0);
if ((SC->cmnd[0] == IPS_IOCTL_COMMAND) &&
- (SC->device->channel == 0) &&
- (SC->device->id == IPS_ADAPTER_ID) &&
- (SC->device->lun == 0) && SC->request_buffer) {
+ (sdev_channel(SC->device) == 0) &&
+ (sdev_id(SC->device) == IPS_ADAPTER_ID) &&
+ (scsilun_zero(&SC->device->lun) == 0) && SC->request_buffer) {
if ((!SC->use_sg) && SC->request_bufflen &&
(((char *) SC->request_buffer)[0] == 'C') &&
(((char *) SC->request_buffer)[1] == 'O') &&
@@ -1969,9 +1969,9 @@ ips_flash_firmware(ips_ha_t * ha, ips_pa
/* FIX stuff that might be wrong */
scb->sg_list.list = sg_list.list;
scb->scb_busaddr = cmd_busaddr;
- scb->bus = scb->scsi_cmd->device->channel;
- scb->target_id = scb->scsi_cmd->device->id;
- scb->lun = scb->scsi_cmd->device->lun;
+ scb->bus = sdev_channel(scb->scsi_cmd->device);
+ scb->target_id = sdev_id(scb->scsi_cmd->device);
+ scb->lun = scsilun_to_int(&scb->scsi_cmd->device->lun);
scb->sg_len = 0;
scb->data_len = 0;
scb->flags = 0;
@@ -2038,9 +2038,9 @@ ips_usrcmd(ips_ha_t * ha, ips_passthru_t
/* FIX stuff that might be wrong */
scb->sg_list.list = sg_list.list;
scb->scb_busaddr = cmd_busaddr;
- scb->bus = scb->scsi_cmd->device->channel;
- scb->target_id = scb->scsi_cmd->device->id;
- scb->lun = scb->scsi_cmd->device->lun;
+ scb->bus = sdev_channel(scb->scsi_cmd->device);
+ scb->target_id = sdev_id(scb->scsi_cmd->device);
+ scb->lun = scsilun_to_int(&scb->scsi_cmd->device->lun);
scb->sg_len = 0;
scb->data_len = 0;
scb->flags = 0;
@@ -2830,10 +2830,10 @@ ips_next(ips_ha_t * ha, int intr)
p = ha->scb_waitlist.head;
while ((p) && (scb = ips_getscb(ha))) {
- if ((p->device->channel > 0)
+ if ((sdev_channel(p->device) > 0)
&& (ha->
- dcdb_active[p->device->channel -
- 1] & (1 << p->device->id))) {
+ dcdb_active[sdev_channel(p->device) -
+ 1] & (1 << sdev_id(p->device)))) {
ips_freescb(ha, scb);
p = (Scsi_Cmnd *) p->host_scribble;
continue;
@@ -2850,9 +2850,9 @@ ips_next(ips_ha_t * ha, int intr)
memset(SC->sense_buffer, 0, sizeof (SC->sense_buffer));
- scb->target_id = SC->device->id;
- scb->lun = SC->device->lun;
- scb->bus = SC->device->channel;
+ scb->target_id = sdev_id(SC->device);
+ scb->lun = scsilun_to_int(&SC->device->lun);
+ scb->bus = sdev_channel(SC->device);
scb->scsi_cmd = SC;
scb->breakup = 0;
scb->data_len = 0;
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index b5fb13d..1a8bf14 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -957,7 +957,8 @@ static irqreturn_t nspintr(int irq, void
unsigned int base;
unsigned char irq_status, irq_phase, phase;
Scsi_Cmnd *tmpSC;
- unsigned char target, lun;
+ unsigned char target;
+ const struct scsi_lun *lun;
unsigned int *sync_neg;
int i, tmp;
nsp_hw_data *data;
@@ -1052,7 +1053,7 @@ static irqreturn_t nspintr(int irq, void
tmpSC = data->CurrentSC;
target = sdev_id(tmpSC->device);
- lun = scsilun_to_int(&tmpSC->device->lun);
+ lun = &tmpSC->device->lun;
sync_neg = &(data->Sync[target].SyncNegotiation);
/*
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index b0b6cdf..38f562c 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -726,8 +726,7 @@ static int u14_34f_slave_configure(struc
else
link_suffix = "";
- printk("%s: scsi%d, channel %d, id %d, lun %d, cmds/lun %d%s%s.\n",
- BN(j), host->host_no, dev->channel, dev->id, dev->lun,
+ sdev_printk(KERN_INFO, dev, "cmds/lun %d%s%s.\n",
dev->queue_depth, link_suffix, tag_suffix);
return FALSE;
@@ -1291,14 +1290,14 @@ static int u14_34f_queuecommand(struct s
cpp->cpp_index = i;
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->device->channel, SCpnt->device->id,
- SCpnt->device->lun, SCpnt->pid);
+ if (do_trace)
+ sdev_printk(KERN_INFO, SCpnt->device,
+ "qcomm, mbox %d, pid %ld.\n", i, SCpnt->pid);
cpp->opcode = OP_SCSI;
- cpp->channel = SCpnt->device->channel;
- cpp->target = SCpnt->device->id;
- cpp->lun = SCpnt->device->lun;
+ cpp->channel = sdev_channel(SCpnt->device);
+ cpp->target = sdev_id(SCpnt->device);
+ cpp->lun = scsilun_to_int(&SCpnt->device->lun);
cpp->SCpnt = SCpnt;
cpp->cdb_len = SCpnt->cmd_len;
memcpy(cpp->cdb, SCpnt->cmnd, SCpnt->cmd_len);
@@ -1319,8 +1318,8 @@ static int u14_34f_queuecommand(struct s
if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
unmap_dma(i, j);
SCpnt->host_scribble = NULL;
- printk("%s: qcomm, target %d.%d:%d, pid %ld, adapter busy.\n",
- BN(j), SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun, SCpnt->pid);
+ sdev_printk(KERN_INFO, SCpnt->device,
+ "qcomm, pid %ld, adapter busy.\n", SCpnt->pid);
return 1;
}
@@ -1340,14 +1339,14 @@ static int u14_34f_eh_abort(struct scsi_
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->device->channel, SCarg->device->id, SCarg->device->lun, SCarg->pid);
+ sdev_printk(KERN_INFO, SCarg->device, "abort, pid %ld inactive.\n",
+ 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->device->channel, SCarg->device->id, SCarg->device->lun, SCarg->pid);
+ sdev_printk(KERN_INFO, SCarg->device, "abort, mbox %d, pid %ld.\n",
+ i, SCarg->pid);
if (i >= sh[j]->can_queue)
panic("%s: abort, invalid SCarg->host_scribble.\n", BN(j));
@@ -1405,8 +1404,8 @@ static int u14_34f_eh_host_reset(struct
struct scsi_cmnd *SCpnt;
j = ((struct hostdata *) SCarg->device->host->hostdata)->board_number;
- printk("%s: reset, enter, target %d.%d:%d, pid %ld.\n",
- BN(j), SCarg->device->channel, SCarg->device->id, SCarg->device->lun, SCarg->pid);
+ sdev_printk(KERN_INFO, SCarg->device,
+ "reset, enter, pid %ld.\n", SCarg->pid);
spin_lock_irq(sh[j]->host_lock);
@@ -1709,9 +1708,10 @@ static void flush_dev(struct scsi_device
k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt;
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->device->channel, SCpnt->device->id, SCpnt->device->lun, SCpnt->pid, k);
+ sdev_printk(KERN_INFO, SCpnt->device,
+ "%s, pid %ld, mbox %d, adapter"\
+ " busy, will abort.\n", (ihdlr ? "ihdlr" : "qcomm"),
+ SCpnt->pid, k);
HD(j)->cp_stat[k] = ABORTING;
continue;
}
@@ -1823,7 +1823,7 @@ static irqreturn_t ihdlr(int irq, unsign
/* 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->device->id][SCpnt->device->channel])
+ && HD(j)->target_redo[sdev_id(SCpnt->device)][sdev_channel(SCpnt->device)])
status = DID_BUS_BUSY << 16;
/* Works around a flaw in scsi.c */
@@ -1836,29 +1836,28 @@ static irqreturn_t ihdlr(int irq, unsign
status = DID_OK << 16;
if (tstatus == GOOD)
- HD(j)->target_redo[SCpnt->device->id][SCpnt->device->channel] = FALSE;
+ HD(j)->target_redo[sdev_id(SCpnt->device)][sdev_channel(SCpnt->device)] = 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->device->channel, SCpnt->device->id, SCpnt->device->lun,
+ sdev_printk(KERN_INFO, SCpnt->device,
+ "ihdlr, pid %ld, target_status 0x%x, sense key 0x%x.\n",
SCpnt->pid, spp->target_status,
SCpnt->sense_buffer[2]);
- HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel] = 0;
+ HD(j)->target_to[sdev_id(SCpnt->device)][sdev_channel(SCpnt->device)] = 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->device->id][SCpnt->device->channel] > 1)
+ if (HD(j)->target_to[sdev_id(SCpnt->device)][sdev_channel(SCpnt->device)] > 1)
status = DID_ERROR << 16;
else {
status = DID_TIME_OUT << 16;
- HD(j)->target_to[SCpnt->device->id][SCpnt->device->channel]++;
+ HD(j)->target_to[sdev_id(SCpnt->device)][sdev_channel(SCpnt->device)]++;
}
break;
@@ -1914,10 +1913,9 @@ static irqreturn_t ihdlr(int irq, unsign
spp->adapter_status != ASST && HD(j)->iocount <= 1000) ||
do_trace || msg_byte(spp->target_status))
#endif
- 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->device->channel, SCpnt->device->id, SCpnt->device->lun, SCpnt->pid,
+ sdev_printk(KERN_INFO, SCpnt->device, "ihdlr, mbox %2d, err 0x%x:%x,"\
+ " pid %ld, reg 0x%x, count %d.\n",
+ i, spp->adapter_status, spp->target_status, SCpnt->pid,
reg, HD(j)->iocount);
unmap_dma(i, j);
diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c
index 486551b..eb1ed30 100644
--- a/drivers/scsi/ultrastor.c
+++ b/drivers/scsi/ultrastor.c
@@ -726,9 +726,9 @@ static int ultrastor_queuecommand(Scsi_C
??? Which other device types should never use the cache? */
my_mscp->ca = SCpnt->device->type != TYPE_TAPE;
- my_mscp->target_id = SCpnt->device->id;
+ my_mscp->target_id = sdev_id(SCpnt->device);
my_mscp->ch_no = 0;
- my_mscp->lun = SCpnt->device->lun;
+ my_mscp->lun = scsilun_to_int(&SCpnt->device->lun);
if (SCpnt->use_sg) {
/* Set scatter/gather flag in SCSI command packet */
my_mscp->sg = TRUE;
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 9e22d3b..986a59d 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -268,6 +268,9 @@ extern int scsi_execute_req(struct scsi_
int data_direction, void *buffer, unsigned bufflen,
struct scsi_sense_hdr *, int timeout, int retries);
+#define sdev_printk(loglevel, scsidev, fmt, args...) \
+ dev_printk(loglevel, &(scsidev)->sdev_gendev, fmt, ## args)
+
static inline unsigned int sdev_channel(struct scsi_device *sdev)
{
return sdev->sdev_target->channel;
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 5/n] HCIL drivers update
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
` (2 preceding siblings ...)
2005-10-23 21:40 ` [PATCH RFC 4/2] HCIL drivers update; sdev_printk Jeff Garzik
@ 2005-10-24 0:13 ` Jeff Garzik
2005-10-24 0:14 ` [PATCH RFC 6/n] " Jeff Garzik
` (9 subsequent siblings)
13 siblings, 0 replies; 19+ messages in thread
From: Jeff Garzik @ 2005-10-24 0:13 UTC (permalink / raw)
To: linux-scsi
Use sdev_printk() in generic scsi code.
DO NOT APPLY.
drivers/scsi/scsi.c | 12 +++++-------
drivers/scsi/scsi_error.c | 10 +++++-----
drivers/scsi/scsi_ioctl.c | 2 +-
drivers/scsi/scsi_lib.c | 20 +++++++++-----------
drivers/scsi/scsi_scan.c | 8 ++++----
drivers/scsi/scsi_transport_spi.c | 2 +-
drivers/scsi/sd.c | 6 ++----
drivers/scsi/sg.c | 4 ++--
drivers/scsi/sr.c | 2 +-
9 files changed, 30 insertions(+), 36 deletions(-)
4c4fae1f2630faf898f844143ac7c33718a37d4a
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index e6269f0..f710de0 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -410,8 +410,7 @@ void scsi_log_send(struct scsi_cmnd *cmd
SCSI_LOG_MLQUEUE_BITS);
if (level > 1) {
sdev = cmd->device;
- dev_printk(KERN_INFO, &sdev->sdev_gendev,
- "scsi send ");
+ sdev_printk(KERN_INFO, sdev, "scsi send ");
if (level > 2)
printk("0x%p ", cmd);
/*
@@ -455,8 +454,7 @@ void scsi_log_completion(struct scsi_cmn
if (((level > 0) && (cmd->result || disposition != SUCCESS)) ||
(level > 1)) {
sdev = cmd->device;
- dev_printk(KERN_INFO, &sdev->sdev_gendev,
- "scsi done ");
+ sdev_printk(KERN_INFO, sdev, "scsi done ");
if (level > 2)
printk("0x%p ", cmd);
/*
@@ -810,7 +808,7 @@ static void scsi_softirq(struct softirq_
disposition = scsi_decide_disposition(cmd);
if (disposition != SUCCESS &&
time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) {
- dev_printk(KERN_ERR, &cmd->device->sdev_gendev,
+ sdev_printk(KERN_ERR, cmd->device,
"timing out command, waited %lus\n",
wait_for/HZ);
disposition = SUCCESS;
@@ -893,7 +891,7 @@ void scsi_finish_command(struct scsi_cmn
if (SCSI_SENSE_VALID(cmd))
cmd->result |= (DRIVER_SENSE << 24);
- SCSI_LOG_MLCOMPLETE(4, dev_printk(KERN_INFO, &sdev->sdev_gendev,
+ SCSI_LOG_MLCOMPLETE(4, sdev_printk(KERN_INFO, sdev,
"Notifying upper driver of completion "
"(result %x)\n", cmd->result));
@@ -971,7 +969,7 @@ void scsi_adjust_queue_depth(struct scsi
sdev->simple_tags = 1;
break;
default:
- dev_printk(KERN_WARNING, &sdev->sdev_gendev,
+ sdev_printk(KERN_WARNING, sdev,
"scsi_adjust_queue_depth, bad queue type, "
"disabled\n");
case 0:
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 29b0e2b..867cc84 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -241,7 +241,7 @@ static inline void scsi_eh_prt_fail_stat
if (cmd_cancel || cmd_failed) {
SCSI_LOG_ERROR_RECOVERY(3,
- dev_printk(KERN_INFO, &sdev->sdev_gendev,
+ sdev_printk(KERN_INFO, sdev,
"%s: cmds failed: %d,"
" cancel: %d\n",
__FUNCTION__, cmd_failed, cmd_cancel));
@@ -675,8 +675,8 @@ static int scsi_eh_get_sense(struct list
SCSI_SENSE_VALID(scmd))
continue;
- SCSI_LOG_ERROR_RECOVERY(2, dev_printk(KERN_INFO,
- &scmd->device->sdev_gendev,
+ SCSI_LOG_ERROR_RECOVERY(2, sdev_printk(KERN_INFO,
+ scmd->device,
"%s: requesting sense\n",
current->comm));
rtn = scsi_request_sense(scmd);
@@ -1177,7 +1177,7 @@ static void scsi_eh_offline_sdevs(struct
struct scsi_cmnd *scmd, *next;
list_for_each_entry_safe(scmd, next, work_q, eh_entry) {
- dev_printk(KERN_INFO, &scmd->device->sdev_gendev,
+ sdev_printk(KERN_INFO, scmd->device,
"Device offlined - not"
" ready after error recovery\n");
scsi_device_set_state(scmd->device, SDEV_OFFLINE);
@@ -1341,7 +1341,7 @@ int scsi_decide_disposition(struct scsi_
return SUCCESS;
case RESERVATION_CONFLICT:
- dev_printk(KERN_INFO, &scmd->device->sdev_gendev,
+ sdev_printk(KERN_INFO, scmd->device,
"reservation conflict\n");
return SUCCESS; /* causes immediate i/o error */
default:
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
index 884cb06..0bdb2ec 100644
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -122,7 +122,7 @@ static int ioctl_internal_command(struct
break;
}
default: /* Fall through for non-removable media */
- dev_printk(KERN_INFO, &sdev->sdev_gendev,
+ sdev_printk(KERN_INFO, sdev,
"ioctl_internal_command: return code = %x\n",
result);
scsi_print_sense_hdr(" ", &sshdr);
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 5a38708..0559449 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -952,15 +952,13 @@ void scsi_io_completion(struct scsi_cmnd
return;
}
if (!(req->flags & REQ_QUIET))
- dev_printk(KERN_INFO,
- &cmd->device->sdev_gendev,
+ sdev_printk(KERN_INFO, cmd->device,
"Device not ready.\n");
scsi_end_request(cmd, 0, this_count, 1);
return;
case VOLUME_OVERFLOW:
if (!(req->flags & REQ_QUIET)) {
- dev_printk(KERN_INFO,
- &cmd->device->sdev_gendev,
+ sdev_printk(KERN_INFO, cmd->device,
"Volume overflow, CDB: ");
__scsi_print_command(cmd->data_cmnd);
scsi_print_sense("", cmd);
@@ -982,7 +980,7 @@ void scsi_io_completion(struct scsi_cmnd
}
if (result) {
if (!(req->flags & REQ_QUIET)) {
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ sdev_printk(KERN_INFO, cmd->device,
"SCSI error: return code = 0x%x\n", result);
if (driver_byte(result) & DRIVER_SENSE)
@@ -1140,7 +1138,7 @@ static int scsi_prep_fn(struct request_q
* online before trying any recovery commands
*/
if (unlikely(!scsi_device_online(sdev))) {
- dev_printk(KERN_ERR, &sdev->sdev_gendev,
+ sdev_printk(KERN_ERR, sdev,
"rejecting I/O to offline device\n");
goto kill;
}
@@ -1150,7 +1148,7 @@ static int scsi_prep_fn(struct request_q
if (sdev->sdev_state == SDEV_DEL) {
/* Device is fully deleted, no commands
* at all allowed down */
- dev_printk(KERN_ERR, &sdev->sdev_gendev,
+ sdev_printk(KERN_ERR, sdev,
"rejecting I/O to dead device\n");
goto kill;
}
@@ -1186,7 +1184,7 @@ static int scsi_prep_fn(struct request_q
specials_only == SDEV_BLOCK)
goto defer;
- dev_printk(KERN_ERR, &sdev->sdev_gendev,
+ sdev_printk(KERN_ERR, sdev,
"rejecting I/O to device being removed\n");
goto kill;
}
@@ -1314,7 +1312,7 @@ static inline int scsi_dev_queue_ready(s
*/
if (--sdev->device_blocked == 0) {
SCSI_LOG_MLQUEUE(3,
- dev_printk(KERN_INFO, &sdev->sdev_gendev,
+ sdev_printk(KERN_INFO, sdev,
"unblocking device at zero depth\n"));
} else {
blk_plug_device(q);
@@ -1434,7 +1432,7 @@ static void scsi_request_fn(struct reque
break;
if (unlikely(!scsi_device_online(sdev))) {
- dev_printk(KERN_ERR, &sdev->sdev_gendev,
+ sdev_printk(KERN_ERR, sdev,
"rejecting I/O to offline device\n");
scsi_kill_request(req, q);
continue;
@@ -1891,7 +1889,7 @@ scsi_device_set_state(struct scsi_device
illegal:
SCSI_LOG_ERROR_RECOVERY(1,
- dev_printk(KERN_ERR, &sdev->sdev_gendev,
+ sdev_printk(KERN_ERR, sdev,
"Illegal state transition %s->%s\n",
scsi_device_state_name(oldstate),
scsi_device_state_name(state))
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index df9fa91..a3c546a 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -460,7 +460,7 @@ static int scsi_probe_lun(struct scsi_de
pass = 1;
next_pass:
- SCSI_LOG_SCAN_BUS(3, dev_printk(KERN_INFO, &sdev->sdev_gendev,
+ SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev,
"scsi scan: INQUIRY pass %d, length %d\n",
pass, try_inquiry_len));
@@ -1193,7 +1193,7 @@ static int scsi_report_lun_scan(struct s
num_luns = max_scsi_report_luns;
}
- SCSI_LOG_SCAN_BUS(3, dev_printk (KERN_INFO, &sdev->sdev_gendev,
+ SCSI_LOG_SCAN_BUS(3, sdev_printk (KERN_INFO, sdev,
"scsi scan: REPORT LUN scan\n"));
/*
@@ -1207,7 +1207,7 @@ static int scsi_report_lun_scan(struct s
lun = scsilun_to_int(lunp);
if ((!shost->unlimited_luns) && (lun > sdev->host->max_lun)) {
- dev_printk(KERN_WARNING, &sdev->sdev_gendev,
+ sdev_printk(KERN_WARNING, sdev,
"lun %s larger"
" than allowed by the host adapter\n",
scsilun_to_str(lunp, lunstr));
@@ -1220,7 +1220,7 @@ static int scsi_report_lun_scan(struct s
/*
* Got some results, but now none, abort.
*/
- dev_printk(KERN_ERR, &sdev->sdev_gendev,
+ sdev_printk(KERN_ERR, sdev,
"Unexpected response"
" from lun %s while scanning, scan"
" aborted\n",
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index ef577c8..2d83310 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -618,7 +618,7 @@ spi_dv_device_echo_buffer(struct scsi_de
return SPI_COMPARE_SKIP_TEST;
- SPI_PRINTK(sdev->sdev_target, KERN_ERR, "Write Buffer failure %x\n", result);
+ sdev_printk(KERN_ERR, sdev, "Write Buffer failure %x\n", result);
return SPI_COMPARE_FAILURE;
}
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index b6cbb4f..7c83923 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1535,8 +1535,7 @@ static int sd_probe(struct device *dev)
if (sdp->type != TYPE_DISK && sdp->type != TYPE_MOD && sdp->type != TYPE_RBC)
goto out;
- SCSI_LOG_HLQUEUE(3, dev_printk(KERN_INFO, &sdp->sdev_gendev,
- "sd_attach\n"));
+ SCSI_LOG_HLQUEUE(3, sdev_printk(KERN_INFO, sdp, "sd_attach\n"));
error = -ENOMEM;
sdkp = kmalloc(sizeof(*sdkp), GFP_KERNEL);
@@ -1608,8 +1607,7 @@ static int sd_probe(struct device *dev)
dev_set_drvdata(dev, sdkp);
add_disk(gd);
- dev_printk(KERN_NOTICE, &sdp->sdev_gendev,
- "Attached scsi %sdisk %s\n",
+ sdev_printk(KERN_NOTICE, sdp, "Attached scsi %sdisk %s\n",
sdp->removable ? "removable " : "",
gd->disk_name);
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 1c2ca07..04c383e 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1499,7 +1499,7 @@ static int sg_alloc(struct gendisk *disk
overflow:
write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
- dev_printk(KERN_WARNING, &scsidp->sdev_gendev,
+ sdev_printk(KERN_WARNING, scsidp,
"Unable to attach sg device type=%d, minor "
"number exceeds %d\n", scsidp->type, SG_MAX_DEVS - 1);
error = -ENODEV;
@@ -1567,7 +1567,7 @@ sg_add(struct class_device *cl_dev)
} else
printk(KERN_WARNING "sg_add: sg_sys INvalid\n");
- dev_printk(KERN_NOTICE, &scsidp->sdev_gendev,
+ sdev_printk(KERN_NOTICE, scsidp,
"Attached scsi generic sg%d, type %d\n", k, scsidp->type);
return 0;
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index b5bd5cf..eb56d79 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -622,7 +622,7 @@ static int sr_probe(struct device *dev)
disk->flags |= GENHD_FL_REMOVABLE;
add_disk(disk);
- dev_printk(KERN_DEBUG, &sdev->sdev_gendev,
+ sdev_printk(KERN_DEBUG, sdev,
"Attached scsi CD-ROM %s\n", cd->cdi.name);
return 0;
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 6/n] HCIL drivers update
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
` (3 preceding siblings ...)
2005-10-24 0:13 ` [PATCH RFC 5/n] HCIL drivers update Jeff Garzik
@ 2005-10-24 0:14 ` Jeff Garzik
2005-10-24 3:49 ` [PATCH RFC 7/n] " Jeff Garzik
` (8 subsequent siblings)
13 siblings, 0 replies; 19+ messages in thread
From: Jeff Garzik @ 2005-10-24 0:14 UTC (permalink / raw)
To: linux-scsi
More driver work, cleaning up after sdev->{channel,id,lun} changes.
DO NOT APPLY.
drivers/scsi/NCR5380.c | 70 ++++++++++++++++++------------
drivers/scsi/NCR53C9x.c | 100 +++++++++++++++++++++++++-------------------
drivers/scsi/NCR53c406a.c | 2
drivers/scsi/cpqfcTSinit.c | 12 +++--
drivers/scsi/eata.c | 88 +++++++++++++++++---------------------
drivers/scsi/eata_pio.c | 27 +++++++----
drivers/scsi/g_NCR5380.c | 14 +++---
drivers/scsi/libata-scsi.c | 12 ++---
drivers/scsi/ncr53c8xx.c | 75 ++++++++++++++++-----------------
drivers/scsi/qla1280.c | 16 +++----
drivers/scsi/qlogicfas408.c | 4 -
drivers/scsi/qlogicfc.c | 21 ++++-----
drivers/scsi/qlogicisp.c | 4 -
drivers/scsi/seagate.c | 24 ++++++----
drivers/scsi/sym53c416.c | 2
drivers/scsi/wd7000.c | 3 -
16 files changed, 258 insertions(+), 216 deletions(-)
3b284cfbe9301b4d19620bd613acb99945cdf7d4
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index d40ba0b..2de04d6 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -777,7 +777,9 @@ int NCR5380_proc_info(struct Scsi_Host *
static char *lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, char *pos, char *buffer, int length)
{
- SPRINTF("scsi%d : destination target %d, lun %d\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
+ char lunstr[SCSILUN_STR_LEN];
+
+ SPRINTF("scsi%d : destination target %d, lun %s\n", cmd->device->host->host_no, sdev_id(cmd->device), scsilun_to_str(&cmd->device->lun, lunstr));
SPRINTF(" command = ");
pos = lprint_command(cmd->cmnd, pos, buffer, length);
return (pos);
@@ -976,15 +978,15 @@ static int NCR5380_queue_command(Scsi_Cm
case WRITE:
case WRITE_6:
case WRITE_10:
- hostdata->time_write[cmd->device->id] -= (jiffies - hostdata->timebase);
- hostdata->bytes_write[cmd->device->id] += cmd->request_bufflen;
+ hostdata->time_write[sdev_id(cmd->device)] -= (jiffies - hostdata->timebase);
+ hostdata->bytes_write[sdev_id(cmd->device)] += cmd->request_bufflen;
hostdata->pendingw++;
break;
case READ:
case READ_6:
case READ_10:
- hostdata->time_read[cmd->device->id] -= (jiffies - hostdata->timebase);
- hostdata->bytes_read[cmd->device->id] += cmd->request_bufflen;
+ hostdata->time_read[sdev_id(cmd->device)] -= (jiffies - hostdata->timebase);
+ hostdata->bytes_read[sdev_id(cmd->device)] += cmd->request_bufflen;
hostdata->pendingr++;
break;
}
@@ -1058,7 +1060,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->device->id] & (1 << tmp->device->lun))) {
+ if (!(hostdata->busy[sdev_id(tmp->device)] & (1 << scsilun_to_int(&tmp->device->lun)))) {
if (prev) {
REMOVE(prev, prev->host_scribble, tmp, tmp->host_scribble);
prev->host_scribble = tmp->host_scribble;
@@ -1120,7 +1122,8 @@ 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->device->id);
+ sdev_printk(KERN_DEBUG, tmp->device,
+ "device did not respond in time\n");
LIST(tmp, hostdata->issue_queue);
tmp->host_scribble = (unsigned char *) hostdata->issue_queue;
hostdata->issue_queue = tmp;
@@ -1247,13 +1250,13 @@ static void collect_stats(struct NCR5380
case WRITE:
case WRITE_6:
case WRITE_10:
- hostdata->time_write[cmd->device->id] += (jiffies - hostdata->timebase);
+ hostdata->time_write[sdev_id(cmd->device)] += (jiffies - hostdata->timebase);
hostdata->pendingw--;
break;
case READ:
case READ_6:
case READ_10:
- hostdata->time_read[cmd->device->id] += (jiffies - hostdata->timebase);
+ hostdata->time_read[sdev_id(cmd->device)] += (jiffies - hostdata->timebase);
hostdata->pendingr--;
break;
}
@@ -1385,7 +1388,7 @@ static int NCR5380_select(struct Scsi_Ho
* the host and target ID's on the SCSI bus.
*/
- NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << cmd->device->id)));
+ NCR5380_write(OUTPUT_DATA_REG, (hostdata->id_mask | (1 << sdev_id(cmd->device))));
/*
* Raise ATN while SEL is true before BSY goes false from arbitration,
@@ -1430,7 +1433,7 @@ static int NCR5380_select(struct Scsi_Ho
udelay(1);
- dprintk(NDEBUG_SELECTION, ("scsi%d : selecting target %d\n", instance->host_no, cmd->device->id));
+ dprintk(NDEBUG_SELECTION, ("scsi%d : selecting target %d\n", instance->host_no, sdev_id(cmd->device)));
/*
* The SCSI specification calls for a 250 ms timeout for the actual
@@ -1483,7 +1486,7 @@ part2:
if (!(NCR5380_read(STATUS_REG) & SR_BSY)) {
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
- if (hostdata->targets_present & (1 << cmd->device->id)) {
+ if (hostdata->targets_present & (1 << sdev_id(cmd->device))) {
printk(KERN_DEBUG "scsi%d : weirdness\n", instance->host_no);
if (hostdata->restart_select)
printk(KERN_DEBUG "\trestart select\n");
@@ -1499,7 +1502,7 @@ part2:
NCR5380_write(SELECT_ENABLE_REG, hostdata->id_mask);
return 0;
}
- hostdata->targets_present |= (1 << cmd->device->id);
+ hostdata->targets_present |= (1 << sdev_id(cmd->device));
/*
* Since we followed the SCSI spec, and raised ATN while SEL
@@ -1528,8 +1531,8 @@ part2:
goto failed;
}
- 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 == SCSI_IRQ_NONE) ? 0 : 1), cmd->device->lun);
+ dprintk(NDEBUG_SELECTION, ("scsi%d : target %d selected, going into MESSAGE OUT phase.\n", instance->host_no, sdev_id(cmd->device)));
+ tmp[0] = IDENTIFY(((instance->irq == SCSI_IRQ_NONE) ? 0 : 1), &cmd->device->lun);
len = 1;
cmd->tag = 0;
@@ -1541,7 +1544,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->device->id] |= (1 << cmd->device->lun);
+ hostdata->busy[sdev_id(cmd->device)] |= (1 << scsilun_to_int(&cmd->device->lun));
if (cmd->SCp.ptr != (char *)cmd->sense_buffer) {
initialize_SCp(cmd);
@@ -2105,6 +2108,9 @@ static void NCR5380_information_transfer
Scsi_Cmnd *cmd = (Scsi_Cmnd *) hostdata->connected;
/* RvC: we need to set the end of the polling time */
unsigned long poll_time = jiffies + USLEEP_POLL;
+ char lunstr[SCSILUN_STR_LEN];
+
+ (void) lunstr; /* kill unused-var warning, if debug disabled */
NCR5380_setup(instance);
@@ -2190,7 +2196,9 @@ static void NCR5380_information_transfer
* 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->device->id, cmd->device->lun);
+ sdev_printk(KERN_INFO,
+ cmd->device,
+ "switching to slow handshake\n");
cmd->device->borken = 1;
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
sink = 1;
@@ -2227,14 +2235,16 @@ static void NCR5380_information_transfer
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->device->id, cmd->device->lun));
+ dprintk(NDEBUG_LINKED, ("scsi%d : target %d lun %d linked command complete.\n", instance->host_no, sdev_id(cmd->device), 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->device->id, cmd->device->lun);
+ sdev_printk(KERN_INFO,
+ cmd->device,
+ "linked command complete, no next_link\n");
sink = 1;
do_abort(instance);
return;
@@ -2243,7 +2253,7 @@ static void NCR5380_information_transfer
/* 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->device->id, cmd->device->lun));
+ dprintk(NDEBUG_LINKED, ("scsi%d : target %d lun %d linked request done, calling scsi_done().\n", instance->host_no, sdev_id(cmd->device), cmd->device->lun));
collect_stats(hostdata, cmd);
cmd->scsi_done(cmd);
cmd = hostdata->connected;
@@ -2255,8 +2265,8 @@ static void NCR5380_information_transfer
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->device->id, cmd->device->lun));
- hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+ dprintk(NDEBUG_QUEUES, ("scsi%d : command for target %d, lun %s completed\n", instance->host_no, sdev_id(cmd->device), scsilun_to_str(&cmd->device->lun, lunstr)));
+ hostdata->busy[sdev_id(cmd->device)] &= ~(1 << scsilun_to_int(&cmd->device->lun));
/*
* I'm not sure what the correct thing to do here is :
@@ -2324,7 +2334,7 @@ static void NCR5380_information_transfer
case ORDERED_QUEUE_TAG:
case SIMPLE_QUEUE_TAG:
cmd->device->simple_tags = 0;
- hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
+ hostdata->busy[sdev_id(cmd->device)] |= (1 << scsilun_to_int(&cmd->device->lun));
break;
default:
break;
@@ -2338,7 +2348,7 @@ static void NCR5380_information_transfer
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->device->id, cmd->device->lun));
+ dprintk(NDEBUG_QUEUES, ("scsi%d : command for target %d lun %d was moved from connected to" " the disconnected_queue\n", instance->host_no, sdev_id(cmd->device), cmd->device->lun));
/*
* Restore phase bits to 0 so an interrupted selection,
* arbitration can resume.
@@ -2429,9 +2439,13 @@ static void NCR5380_information_transfer
scsi_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->device->id, cmd->device->lun);
+ sdev_printk(KERN_INFO,
+ cmd->device,
+ "rejecting unknown message %02x\n",tmp);
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->device->id, cmd->device->lun);
+ sdev_printk(KERN_INFO,
+ cmd->device,
+ "rejecting unknown extended message code %02x, length %d\n", extended_msg[1], extended_msg[0]);
msgout = MESSAGE_REJECT;
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
@@ -2444,7 +2458,7 @@ static void NCR5380_information_transfer
hostdata->last_message = msgout;
NCR5380_transfer_pio(instance, &phase, &len, &data);
if (msgout == ABORT) {
- hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun);
+ hostdata->busy[sdev_id(cmd->device)] &= ~(1 << scsilun_to_int(&cmd->device->lun));
hostdata->connected = NULL;
cmd->result = DID_ERROR << 16;
collect_stats(hostdata, cmd);
@@ -2580,7 +2594,7 @@ static void NCR5380_reselect(struct Scsi
for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL; tmp; prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble)
- if ((target_mask == (1 << tmp->device->id)) && (lun == tmp->device->lun)
+ if ((target_mask == (1 << sdev_id(tmp->device))) && (lun == scsilun_to_int(&tmp->device->lun))
) {
if (prev) {
REMOVE(prev, prev->host_scribble, tmp, tmp->host_scribble);
diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c
index 6ceabbd..63b02f2 100644
--- a/drivers/scsi/NCR53C9x.c
+++ b/drivers/scsi/NCR53C9x.c
@@ -352,12 +352,14 @@ static inline Scsi_Cmnd *remove_first_SC
return ptr;
}
-static inline Scsi_Cmnd *remove_SC(Scsi_Cmnd **SC, int target, int lun)
+static inline Scsi_Cmnd *remove_SC(Scsi_Cmnd **SC, int target,
+ const struct scsi_lun *lun)
{
Scsi_Cmnd *ptr, *prev;
for(ptr = *SC, prev = NULL;
- ptr && ((ptr->device->id != target) || (ptr->device->lun != lun));
+ ptr && ((sdev_id(ptr->device) != target) ||
+ (!scsilun_eq(&ptr->device->lun, lun)));
prev = ptr, ptr = (Scsi_Cmnd *) ptr->host_scribble)
;
if(ptr) {
@@ -871,7 +873,7 @@ static int esp_host_info(struct NCR_ESP
shost_for_each_device(sdev, esp->ehost) {
struct esp_device *esp_dev = sdev->hostdata;
- uint id = sdev->id;
+ uint id = sdev_id(sdev);
if (!(esp->targets_present & (1 << id)))
continue;
@@ -936,7 +938,7 @@ static void esp_release_dmabufs(struct N
static void esp_restore_pointers(struct NCR_ESP *esp, Scsi_Cmnd *sp)
{
- struct esp_pointers *ep = &esp->data_pointers[sp->device->id];
+ struct esp_pointers *ep = &esp->data_pointers[sdev_id(sp->device)];
sp->SCp.ptr = ep->saved_ptr;
sp->SCp.buffer = ep->saved_buffer;
@@ -946,7 +948,7 @@ static void esp_restore_pointers(struct
static void esp_save_pointers(struct NCR_ESP *esp, Scsi_Cmnd *sp)
{
- struct esp_pointers *ep = &esp->data_pointers[sp->device->id];
+ struct esp_pointers *ep = &esp->data_pointers[sdev_id(sp->device)];
ep->saved_ptr = sp->SCp.ptr;
ep->saved_buffer = sp->SCp.buffer;
@@ -1009,7 +1011,8 @@ static void esp_exec_cmd(struct NCR_ESP
Scsi_Device *SDptr;
volatile unchar *cmdp = esp->esp_command;
unsigned char the_esp_command;
- int lun, target;
+ int target;
+ const struct scsi_lun *lun;
int i;
/* Hold off if we have disconnected commands and
@@ -1027,8 +1030,8 @@ static void esp_exec_cmd(struct NCR_ESP
SDptr = SCptr->device;
esp_dev = SDptr->hostdata;
- lun = SCptr->device->lun;
- target = SCptr->device->id;
+ lun = &SCptr->device->lun;
+ target = sdev_id(SCptr->device);
esp->snip = 0;
esp->msgout_len = 0;
@@ -1163,7 +1166,7 @@ do_sync_known:
if(((SDptr->scsi_level < 3) && (SDptr->type != TYPE_TAPE)) ||
toshiba_cdrom_hwbug_wkaround || SDptr->borken) {
ESPMISC((KERN_INFO "esp%d: Disabling DISCONNECT for target %d "
- "lun %d\n", esp->esp_id, SCptr->device->id, SCptr->device->lun));
+ "lun %d\n", esp->esp_id, sdev_id(SCptr->device), SCptr->device->lun));
esp_dev->disconnect = 0;
*cmdp++ = IDENTIFY(0, lun);
} else {
@@ -1245,8 +1248,8 @@ int esp_queue(Scsi_Cmnd *SCpnt, void (*d
esp->dma_led_on(esp);
/* We use the scratch area. */
- ESPQUEUE(("esp_queue: target=%d lun=%d ", SCpnt->device->id, SCpnt->lun));
- ESPDISC(("N<%02x,%02x>", SCpnt->device->id, SCpnt->lun));
+ ESPQUEUE(("esp_queue: target=%d lun=%d ", sdev_id(SCpnt->device), SCpnt->lun));
+ ESPDISC(("N<%02x,%02x>", sdev_id(SCpnt->device), SCpnt->lun));
esp_get_dmabufs(esp, SCpnt);
esp_save_pointers(esp, SCpnt); /* FIXME for tag queueing */
@@ -1274,9 +1277,12 @@ int esp_queue(Scsi_Cmnd *SCpnt, void (*d
/* Dump driver state. */
static void esp_dump_cmd(Scsi_Cmnd *SCptr)
{
- ESPLOG(("[tgt<%02x> lun<%02x> "
+ char lunstr[SCSILUN_STR_LEN];
+
+ ESPLOG(("[tgt<%02x> lun<%s> "
"pphase<%s> cphase<%s>]",
- SCptr->device->id, SCptr->device->lun,
+ sdev_id(SCptr->device),
+ scsilun_to_str(&SCptr->device->lun, lunstr),
phase_string(SCptr->SCp.sent_command),
phase_string(SCptr->SCp.phase)));
}
@@ -1693,13 +1699,13 @@ static inline void esp_connect(struct NC
if(esp->prev_soff != esp_dev->sync_max_offset ||
esp->prev_stp != esp_dev->sync_min_period ||
(esp->erev > esp100a &&
- esp->prev_cfg3 != esp->config3[sp->device->id])) {
+ esp->prev_cfg3 != esp->config3[sdev_id(sp->device)])) {
esp->prev_soff = esp_dev->sync_max_offset;
esp_write(eregs->esp_soff, esp->prev_soff);
esp->prev_stp = esp_dev->sync_min_period;
esp_write(eregs->esp_stp, esp->prev_stp);
if(esp->erev > esp100a) {
- esp->prev_cfg3 = esp->config3[sp->device->id];
+ esp->prev_cfg3 = esp->config3[sdev_id(sp->device)];
esp_write(eregs->esp_cfg3, esp->prev_cfg3);
}
}
@@ -2097,7 +2103,7 @@ static int esp_do_data_finale(struct NCR
esp->esp_id,
SCptr->use_sg, SCptr->SCp.ptr, SCptr->SCp.this_residual));
ESPLOG(("esp%d: Forcing async for target %d\n", esp->esp_id,
- SCptr->device->id));
+ sdev_id(SCptr->device)));
SCptr->device->borken = 1;
esp_dev->sync = 0;
bytes_sent = 0;
@@ -2205,7 +2211,7 @@ static int esp_do_freebus(struct NCR_ESP
if(SCptr->SCp.Status != GOOD &&
SCptr->SCp.Status != CONDITION_GOOD &&
- ((1<<SCptr->device->id) & esp->targets_present) &&
+ ((1<<sdev_id(SCptr->device)) & esp->targets_present) &&
esp_dev->sync && esp_dev->sync_max_offset) {
/* SCSI standard says that the synchronous capabilities
* should be renegotiated at this point. Most likely
@@ -2215,7 +2221,7 @@ static int esp_do_freebus(struct NCR_ESP
* state.
*/
ESPMISC(("esp: Status <%d> for target %d lun %d\n",
- SCptr->SCp.Status, SCptr->device->id, SCptr->device->lun));
+ SCptr->SCp.Status, sdev_id(SCptr->device), SCptr->device->lun));
/* But don't do this when spinning up a disk at
* boot time while we poll for completion as it
@@ -2226,14 +2232,14 @@ static int esp_do_freebus(struct NCR_ESP
if(esp_should_clear_sync(SCptr) != 0)
esp_dev->sync = 0;
}
- ESPDISC(("F<%02x,%02x>", SCptr->device->id, SCptr->device->lun));
+ ESPDISC(("F<%02x,%02x>", sdev_id(SCptr->device), SCptr->device->lun));
esp_done(esp, ((SCptr->SCp.Status & 0xff) |
((SCptr->SCp.Message & 0xff)<<8) |
(DID_OK << 16)));
} else if(esp->prevmsgin == DISCONNECT) {
/* Normal disconnect. */
esp_cmd(esp, eregs, ESP_CMD_ESEL);
- ESPDISC(("D<%02x,%02x>", SCptr->device->id, SCptr->device->lun));
+ ESPDISC(("D<%02x,%02x>", sdev_id(SCptr->device), SCptr->device->lun));
append_SC(&esp->disconnected_SC, SCptr);
esp->current_SC = NULL;
if(esp->issue_SC)
@@ -2256,6 +2262,7 @@ static int esp_do_freebus(struct NCR_ESP
static int esp_bad_reconnect(struct NCR_ESP *esp)
{
Scsi_Cmnd *sp;
+ char lunstr[SCSILUN_STR_LEN];
ESPLOG(("esp%d: Eieeee, reconnecting unknown command!\n",
esp->esp_id));
@@ -2263,21 +2270,24 @@ static int esp_bad_reconnect(struct NCR_
sp = esp->issue_SC;
ESPLOG(("esp%d: issue_SC[", esp->esp_id));
while(sp) {
- ESPLOG(("<%02x,%02x>", sp->device->id, sp->device->lun));
+ ESPLOG(("<%02x,%s>", sdev_id(sp->device),
+ scsilun_to_str(&sp->device->lun, lunstr)));
sp = (Scsi_Cmnd *) sp->host_scribble;
}
ESPLOG(("]\n"));
sp = esp->current_SC;
ESPLOG(("esp%d: current_SC[", esp->esp_id));
while(sp) {
- ESPLOG(("<%02x,%02x>", sp->device->id, sp->device->lun));
+ ESPLOG(("<%02x,%s>", sdev_id(sp->device),
+ scsilun_to_str(&sp->device->lun, lunstr)));
sp = (Scsi_Cmnd *) sp->host_scribble;
}
ESPLOG(("]\n"));
sp = esp->disconnected_SC;
ESPLOG(("esp%d: disconnected_SC[", esp->esp_id));
while(sp) {
- ESPLOG(("<%02x,%02x>", sp->device->id, sp->device->lun));
+ ESPLOG(("<%02x,%s>", sdev_id(sp->device),
+ scsilun_to_str(&sp->device->lun, lunstr)));
sp = (Scsi_Cmnd *) sp->host_scribble;
}
ESPLOG(("]\n"));
@@ -2290,6 +2300,7 @@ static int esp_do_reconnect(struct NCR_E
{
int lun, target;
Scsi_Cmnd *SCptr;
+ struct scsi_lun __lun;
/* Check for all bogus conditions first. */
target = reconnect_target(esp, eregs);
@@ -2311,7 +2322,8 @@ static int esp_do_reconnect(struct NCR_E
return do_reset_bus;
esp_cmd(esp, eregs, ESP_CMD_NULL);
- SCptr = remove_SC(&esp->disconnected_SC, (unchar) target, (unchar) lun);
+ int_to_scsilun(lun, &__lun);
+ SCptr = remove_SC(&esp->disconnected_SC, (unchar) target, &__lun);
if(!SCptr)
return esp_bad_reconnect(esp);
@@ -2597,7 +2609,7 @@ static int esp_select_complete(struct NC
*/
if(esp->ireg == (ESP_INTR_FDONE | ESP_INTR_BSERV)) {
/* target speaks... */
- esp->targets_present |= (1<<SCptr->device->id);
+ esp->targets_present |= (1<<sdev_id(SCptr->device));
/* What if the target ignores the sdtr? */
if(esp->snip)
@@ -2626,7 +2638,7 @@ static int esp_select_complete(struct NC
* XXX for synchronous transfers.
*/
ESPLOG(("esp%d: STEP_ASEL for tgt %d\n",
- esp->esp_id, SCptr->device->id));
+ esp->esp_id, sdev_id(SCptr->device)));
case ESP_STEP_SID:
/* Arbitration won, target selected, went
@@ -2732,6 +2744,8 @@ static int esp_select_complete(struct NC
/* Did the target even make it? */
if(esp->ireg == ESP_INTR_DC) {
+ char lunstr[SCSILUN_STR_LEN];
+
/* wheee... nobody there or they didn't like
* what we told it to do, clean up.
*/
@@ -2743,14 +2757,16 @@ static int esp_select_complete(struct NC
if(esp->disconnected_SC)
esp_cmd(esp, eregs, ESP_CMD_ESEL);
- if(((1<<SCptr->device->id) & esp->targets_present) &&
+ if(((1<<sdev_id(SCptr->device)) & esp->targets_present) &&
esp->seqreg && esp->cur_msgout[0] == EXTENDED_MESSAGE &&
(SCptr->SCp.phase == in_slct_msg ||
SCptr->SCp.phase == in_slct_stop)) {
/* shit */
esp->snip = 0;
ESPLOG(("esp%d: Failed synchronous negotiation for target %d "
- "lun %d\n", esp->esp_id, SCptr->device->id, SCptr->device->lun));
+ "lun %s\n", esp->esp_id,
+ sdev_id(SCptr->device),
+ scsilun_to_str(&SCptr->device->lun, lunstr)));
esp_dev->sync_max_offset = 0;
esp_dev->sync_min_period = 0;
esp_dev->sync = 1; /* so we don't negotiate again */
@@ -2776,9 +2792,9 @@ static int esp_select_complete(struct NC
* or whenever when we are scanning the bus for targets.
* But first make sure that is really what is happening.
*/
- if(((1<<SCptr->device->id) & esp->targets_present)) {
+ if(((1<<sdev_id(SCptr->device)) & esp->targets_present)) {
ESPLOG(("esp%d: Warning, live target %d not responding to "
- "selection.\n", esp->esp_id, SCptr->device->id));
+ "selection.\n", esp->esp_id, sdev_id(SCptr->device)));
/* This _CAN_ happen. The SCSI standard states that
* the target is to _not_ respond to selection if
@@ -2791,7 +2807,7 @@ static int esp_select_complete(struct NC
/* Else, there really isn't anyone there. */
ESPMISC(("esp: selection failure, maybe nobody there?\n"));
ESPMISC(("esp: target %d lun %d\n",
- SCptr->device->id, SCptr->device->lun));
+ sdev_id(SCptr->device), SCptr->device->lun));
esp_done(esp, (DID_BAD_TARGET << 16));
}
return do_intr_end;
@@ -2872,7 +2888,7 @@ static int check_singlebyte_msg(struct N
case NOP:
ESPLOG(("esp%d: target %d sends a nop\n", esp->esp_id,
- esp->current_SC->device->id));
+ sdev_id(esp->current_SC->device)));
return 0;
case RESTORE_POINTERS:
@@ -2965,7 +2981,7 @@ static void sync_report(struct NCR_ESP *
* sibling call optimization. -DaveM
*/
ESPLOG((KERN_INFO "esp%d: target %d ",
- esp->esp_id, esp->current_SC->device->id));
+ esp->esp_id, sdev_id(esp->current_SC->device)));
ESPLOG(("[period %dns offset %d %d.%02dMHz ",
(int) msg3 * 4, (int) msg4,
integer, fraction));
@@ -2973,7 +2989,7 @@ static void sync_report(struct NCR_ESP *
(((msg3 * 4) < 200) ? "-II" : "")));
} else {
ESPLOG((KERN_INFO "esp%d: target %d asynchronous\n",
- esp->esp_id, esp->current_SC->device->id));
+ esp->esp_id, sdev_id(esp->current_SC->device)));
}
}
@@ -3050,10 +3066,10 @@ static int check_multibyte_msg(struct NC
else
bit = ESP_CONFIG3_FSCSI;
if(period < 50)
- esp->config3[SCptr->device->id] |= bit;
+ esp->config3[sdev_id(SCptr->device)] |= bit;
else
- esp->config3[SCptr->device->id] &= ~bit;
- esp->prev_cfg3 = esp->config3[SCptr->device->id];
+ esp->config3[sdev_id(SCptr->device)] &= ~bit;
+ esp->prev_cfg3 = esp->config3[sdev_id(SCptr->device)];
esp_write(eregs->esp_cfg3, esp->prev_cfg3);
}
esp->prev_soff = esp_dev->sync_min_period;
@@ -3064,7 +3080,7 @@ static int check_multibyte_msg(struct NC
ESPSDTR(("soff=%2x stp=%2x cfg3=%2x\n",
esp_dev->sync_max_offset,
esp_dev->sync_min_period,
- esp->config3[SCptr->device->id]));
+ esp->config3[sdev_id(SCptr->device)]));
esp->snip = 0;
} else if(esp_dev->sync_max_offset) {
@@ -3083,8 +3099,8 @@ static int check_multibyte_msg(struct NC
bit = ESP_CONFIG3_FAST;
else
bit = ESP_CONFIG3_FSCSI;
- esp->config3[SCptr->device->id] &= ~bit;
- esp->prev_cfg3 = esp->config3[SCptr->device->id];
+ esp->config3[sdev_id(SCptr->device)] &= ~bit;
+ esp->prev_cfg3 = esp->config3[sdev_id(SCptr->device)];
esp_write(eregs->esp_cfg3, esp->prev_cfg3);
}
}
@@ -3473,7 +3489,7 @@ void esp_handle(struct NCR_ESP *esp)
* a nexus is alive on the bus.
*/
ESPLOG(("esp%d: Forcing async and disabling disconnect for "
- "target %d\n", esp->esp_id, SCptr->device->id));
+ "target %d\n", esp->esp_id, sdev_id(SCptr->device)));
SCptr->device->borken = 1; /* foo on you */
}
@@ -3621,7 +3637,7 @@ void esp_slave_destroy(Scsi_Device *SDpt
{
struct NCR_ESP *esp = (struct NCR_ESP *) SDptr->host->hostdata;
- esp->targets_present &= ~(1 << SDptr->id);
+ esp->targets_present &= ~(1 << sdev_id(SDptr));
kfree(SDptr->hostdata);
SDptr->hostdata = NULL;
}
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c
index e1f2246..dc44e85 100644
--- a/drivers/scsi/NCR53c406a.c
+++ b/drivers/scsi/NCR53c406a.c
@@ -710,7 +710,7 @@ static int NCR53c406a_queue(Scsi_Cmnd *
/* We are locked here already by the mid layer */
REG0;
- outb(SCpnt->device->id, DEST_ID); /* set destination */
+ outb(sdev_id(SCpnt->device), DEST_ID); /* set destination */
outb(FLUSH_FIFO, CMD_REG); /* reset the fifos */
for (i = 0; i < SCpnt->cmd_len; i++) {
diff --git a/drivers/scsi/cpqfcTSinit.c b/drivers/scsi/cpqfcTSinit.c
index 3fda8d4..7ec54d1 100644
--- a/drivers/scsi/cpqfcTSinit.c
+++ b/drivers/scsi/cpqfcTSinit.c
@@ -974,9 +974,11 @@ int cpqfcTS_proc_info (struct Scsi_Host
}
copy_info(&info, "WWN database: (\"port_id: 000000\" means disconnected)\n");
for ( Chan=0; Chan <= host->max_channel; Chan++) {
- DumCmnd->device->channel = Chan;
+ /* FIXME XXX is this right? */
+ DumCmnd->device->sdev_target->channel = Chan;
for (Targ=0; Targ <= host->max_id; Targ++) {
- DumCmnd->device->id = Targ;
+ /* FIXME XXX is this right? */
+ DumCmnd->device->sdev_target->id = Targ;
if ((pLoggedInPort = fcFindLoggedInPort( fcChip,
DumCmnd, // search Scsi Nexus
0, // DON'T search list for FC port id
@@ -1368,9 +1370,11 @@ int cpqfcTS_queuecommand(Scsi_Cmnd *Cmnd
// printk(" @Q bad targ cmnd %p@ ", Cmnd);
QueBadTargetCmnd( cpqfcHBAdata, Cmnd);
}
- else if (Cmnd->device->lun >= CPQFCTS_MAX_LUN)
+ else if (scsilun_to_int(&Cmnd->device->lun) >= CPQFCTS_MAX_LUN)
{
- printk(KERN_WARNING "cpqfc: Invalid LUN: %d\n", Cmnd->device->lun);
+ char lunstr[SCSILUN_STR_LEN];
+ printk(KERN_WARNING "cpqfc: Invalid LUN: %s\n",
+ scsilun_to_str(&Cmnd->device->lun, lunstr));
QueBadTargetCmnd( cpqfcHBAdata, Cmnd);
}
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index c10e45b..c76a9f0 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -941,8 +941,6 @@ static int eata2x_slave_configure(struct
{
int tqd, utqd;
char *tag_suffix, *link_suffix;
- struct Scsi_Host *shost = dev->host;
- struct hostdata *ha = (struct hostdata *)shost->hostdata;
utqd = MAX_CMD_PER_LUN;
tqd = max_queue_depth;
@@ -973,8 +971,8 @@ static int eata2x_slave_configure(struct
else
link_suffix = "";
- printk("%s: scsi%d, channel %d, id %d, lun %d, cmds/lun %d%s%s.\n",
- ha->board_name, shost->host_no, dev->channel, dev->id, dev->lun,
+ sdev_printk(KERN_INFO, dev,
+ "cmds/lun %d%s%s.\n",
dev->queue_depth, link_suffix, tag_suffix);
return 0;
@@ -1813,9 +1811,9 @@ static int eata2x_queuecommand(struct sc
SCpnt->host_scribble = (unsigned char *)&cpp->cpp_index;
if (do_trace)
- printk("%s: qcomm, mbox %d, target %d.%d:%d, pid %ld.\n",
- ha->board_name, i, SCpnt->device->channel, SCpnt->device->id,
- SCpnt->device->lun, SCpnt->pid);
+ sdev_printk(KERN_INFO, SCpnt->device,
+ "qcomm, mbox %d, pid %ld.\n",
+ i, SCpnt->pid);
cpp->reqsen = 1;
cpp->dispri = 1;
@@ -1824,9 +1822,9 @@ static int eata2x_queuecommand(struct sc
cpp->hbaci = 1;
#endif
cpp->one = 1;
- cpp->channel = SCpnt->device->channel;
- cpp->target = SCpnt->device->id;
- cpp->lun = SCpnt->device->lun;
+ cpp->channel = sdev_channel(SCpnt->device);
+ cpp->target = sdev_id(SCpnt->device);
+ cpp->lun = scsilun_to_int(&SCpnt->device->lun);
cpp->SCpnt = SCpnt;
memcpy(cpp->cdb, SCpnt->cmnd, SCpnt->cmd_len);
@@ -1847,9 +1845,9 @@ static int eata2x_queuecommand(struct sc
if (do_dma(shost->io_port, cpp->cp_dma_addr, SEND_CP_DMA)) {
unmap_dma(i, ha);
SCpnt->host_scribble = NULL;
- printk("%s: qcomm, target %d.%d:%d, pid %ld, adapter busy.\n",
- ha->board_name, SCpnt->device->channel, SCpnt->device->id,
- SCpnt->device->lun, SCpnt->pid);
+ sdev_printk(KERN_INFO, SCpnt->device,
+ "qcomm, pid %ld, adapter busy.\n",
+ SCpnt->pid);
return 1;
}
@@ -1864,16 +1862,16 @@ static int eata2x_eh_abort(struct scsi_c
unsigned int i;
if (SCarg->host_scribble == NULL) {
- printk("%s: abort, target %d.%d:%d, pid %ld inactive.\n",
- ha->board_name, SCarg->device->channel, SCarg->device->id,
- SCarg->device->lun, SCarg->pid);
+ sdev_printk(KERN_INFO, SCarg->device,
+ "abort, pid %ld inactive.\n",
+ SCarg->pid);
return SUCCESS;
}
i = *(unsigned int *)SCarg->host_scribble;
- printk("%s: abort, mbox %d, target %d.%d:%d, pid %ld.\n",
- ha->board_name, i, SCarg->device->channel, SCarg->device->id,
- SCarg->device->lun, SCarg->pid);
+ sdev_printk(KERN_WARNING, SCarg->device,
+ "abort, mbox %d, pid %ld.\n",
+ i, SCarg->pid);
if (i >= shost->can_queue)
panic("%s: abort, invalid SCarg->host_scribble.\n", ha->board_name);
@@ -1934,9 +1932,9 @@ static int eata2x_eh_host_reset(struct s
struct Scsi_Host *shost = SCarg->device->host;
struct hostdata *ha = (struct hostdata *)shost->hostdata;
- printk("%s: reset, enter, target %d.%d:%d, pid %ld.\n",
- ha->board_name, SCarg->device->channel, SCarg->device->id,
- SCarg->device->lun, SCarg->pid);
+ sdev_printk(KERN_INFO, SCarg->device,
+ "reset, enter, pid %ld.\n",
+ SCarg->pid);
spin_lock_irq(shost->host_lock);
@@ -2253,12 +2251,11 @@ static int reorder(struct hostdata *ha,
k = il[n];
cpp = &ha->cp[k];
SCpnt = cpp->SCpnt;
- printk
- ("%s %d.%d:%d pid %ld mb %d fc %d nr %d sec %ld ns %ld"
+ sdev_printk(KERN_INFO, SCpnt->device,
+ "%s 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->device->channel, SCpnt->device->id,
- SCpnt->device->lun, SCpnt->pid, k, flushcount,
+ SCpnt->pid, k, flushcount,
n_ready, SCpnt->request->sector,
SCpnt->request->nr_sectors, cursec, YESNO(s),
YESNO(r), YESNO(rev), YESNO(input_only),
@@ -2301,12 +2298,11 @@ static void flush_dev(struct scsi_device
SCpnt = cpp->SCpnt;
if (do_dma(dev->host->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", ha->board_name,
+ sdev_printk(KERN_INFO, SCpnt->device,
+ "%s, pid %ld, mbox %d, adapter"
+ " busy, will abort.\n",
(ihdlr ? "ihdlr" : "qcomm"),
- SCpnt->device->channel, SCpnt->device->id,
- SCpnt->device->lun, SCpnt->pid, k);
+ SCpnt->pid, k);
ha->cp_stat[k] = ABORTING;
continue;
}
@@ -2449,9 +2445,7 @@ static irqreturn_t ihdlr(int irq, struct
/* If there was a bus reset, redo operation on each target */
else if (tstatus != GOOD && SCpnt->device->type == TYPE_DISK
- && ha->target_redo[SCpnt->device->id][SCpnt->
- device->
- channel])
+ && ha->target_redo[sdev_id(SCpnt->device)][sdev_channel(SCpnt->device)])
status = DID_BUS_BUSY << 16;
/* Works around a flaw in scsi.c */
@@ -2464,20 +2458,18 @@ static irqreturn_t ihdlr(int irq, struct
status = DID_OK << 16;
if (tstatus == GOOD)
- ha->target_redo[SCpnt->device->id][SCpnt->device->
- channel] = 0;
+ ha->target_redo[sdev_id(SCpnt->device)][sdev_channel(SCpnt->device)] = 0;
if (spp->target_status && SCpnt->device->type == TYPE_DISK &&
(!(tstatus == CHECK_CONDITION && ha->iocount <= 1000 &&
(SCpnt->sense_buffer[2] & 0xf) == NOT_READY)))
- printk("%s: ihdlr, target %d.%d:%d, pid %ld, "
+ sdev_printk(KERN_INFO, SCpnt->device,
+ "ihdlr, pid %ld, "
"target_status 0x%x, sense key 0x%x.\n",
- ha->board_name,
- SCpnt->device->channel, SCpnt->device->id,
- SCpnt->device->lun, SCpnt->pid,
+ SCpnt->pid,
spp->target_status, SCpnt->sense_buffer[2]);
- ha->target_to[SCpnt->device->id][SCpnt->device->channel] = 0;
+ ha->target_to[sdev_id(SCpnt->device)][sdev_channel(SCpnt->device)] = 0;
if (ha->last_retried_pid == SCpnt->pid)
ha->retries = 0;
@@ -2486,12 +2478,11 @@ static irqreturn_t ihdlr(int irq, struct
case ASST: /* Selection Time Out */
case 0x02: /* Command Time Out */
- if (ha->target_to[SCpnt->device->id][SCpnt->device->channel] > 1)
+ if (ha->target_to[sdev_id(SCpnt->device)][sdev_channel(SCpnt->device)] > 1)
status = DID_ERROR << 16;
else {
status = DID_TIME_OUT << 16;
- ha->target_to[SCpnt->device->id][SCpnt->device->
- channel]++;
+ ha->target_to[sdev_id(SCpnt->device)][sdev_channel(SCpnt->device)]++;
}
break;
@@ -2542,11 +2533,10 @@ static irqreturn_t ihdlr(int irq, struct
spp->adapter_status != ASST && ha->iocount <= 1000) ||
do_trace || msg_byte(spp->target_status))
#endif
- printk("%s: ihdlr, mbox %2d, err 0x%x:%x,"
- " target %d.%d:%d, pid %ld, reg 0x%x, count %d.\n",
- ha->board_name, i, spp->adapter_status, spp->target_status,
- SCpnt->device->channel, SCpnt->device->id,
- SCpnt->device->lun, SCpnt->pid, reg, ha->iocount);
+ sdev_printk(KERN_INFO, SCpnt->device, "ihdlr, mbox %2d, err 0x%x:%x,"
+ " pid %ld, reg 0x%x, count %d.\n",
+ i, spp->adapter_status, spp->target_status,
+ SCpnt->pid, reg, ha->iocount);
unmap_dma(i, ha);
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c
index 42c6e35..ed92f6a 100644
--- a/drivers/scsi/eata_pio.c
+++ b/drivers/scsi/eata_pio.c
@@ -384,7 +384,9 @@ static int eata_pio_queue(struct scsi_cm
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->device->id, cmd->device->lun, y));
+ DBG(DBG_QUEUE, sdev_printk(KERN_DEBUG, cmd->device,
+ "eata_pio_queue pid %ld, y %d\n",
+ cmd->pid, y));
cmd->scsi_done = (void *) done;
@@ -393,14 +395,14 @@ static int eata_pio_queue(struct scsi_cm
else
cp->DataIn = 0; /* Input mode */
- cp->Interpret = (cmd->device->id == hd->hostid);
+ cp->Interpret = (sdev_id(cmd->device) == hd->hostid);
cp->cp_datalen = htonl((unsigned long) cmd->request_bufflen);
cp->Auto_Req_Sen = 0;
cp->cp_reqDMA = htonl(0);
cp->reqlen = 0;
- cp->cp_id = cmd->device->id;
- cp->cp_lun = cmd->device->lun;
+ cp->cp_id = sdev_id(cmd->device);
+ cp->cp_lun = scsilun_to_int(&cmd->device->lun);
cp->cp_dispri = 0;
cp->cp_identify = 1;
memcpy(cp->cp_cdb, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd));
@@ -427,7 +429,9 @@ static int eata_pio_queue(struct scsi_cm
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->device->id, cmd->pid);
+ sdev_printk(KERN_NOTICE, cmd->device,
+ "eata_pio_queue pid %ld, HBA busy, "
+ "returning DID_BUS_BUSY, done.\n", cmd->pid);
done(cmd);
cp->status = FREE;
return (0);
@@ -440,7 +444,9 @@ static int eata_pio_queue(struct scsi_cm
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->device->id, cmd->device->lun, y, sh->irq));
+ DBG(DBG_QUEUE, sdev_printk(KERN_DEBUG, cmd->device,
+ "Queued base %#.4lx pid: %ld "
+ "slot %d irq %d\n", (long) sh->base, cmd->pid, y, sh->irq));
return (0);
}
@@ -449,8 +455,9 @@ static int eata_pio_abort(struct scsi_cm
{
uint loop = HZ;
- DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_abort called pid: %ld " "target: %x lun: %x\n", cmd->pid, cmd->device->id, cmd->device->lun));
-
+ DBG(DBG_ABNORM, sdev_printk(KERN_WARNING, cmd->device,
+ "eata_pio_abort called pid: %ld\n",
+ cmd->pid));
while (inb(cmd->device->host->base + HA_RAUXSTAT) & HA_ABUSY)
if (--loop == 0) {
@@ -484,7 +491,9 @@ static int eata_pio_host_reset(struct sc
struct scsi_cmnd *sp;
struct Scsi_Host *host = cmd->device->host;
- DBG(DBG_ABNORM, printk(KERN_WARNING "eata_pio_reset called pid:%ld target:" " %x lun: %x\n", cmd->pid, cmd->device->id, cmd->device->lun));
+ DBG(DBG_ABNORM, sdev_printk(KERN_WARNING, cmd->device,
+ "eata_pio_reset called pid:%ld\n",
+ cmd->pid));
spin_lock_irq(host->host_lock);
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index a3aa729..38186b5 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -765,7 +765,9 @@ static int sprint_command(char *buffer,
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->device->host->host_no ANDP cmd->device->id ANDP cmd->device->lun);
+ char lunstr[SCSILUN_STR_LEN];
+
+ PRINTP("host number %d destination target %d, lun %s\n" ANDP cmd->device->host->host_no ANDP sdev_id(cmd->device) ANDP scsilun_to_str(&cmd->device->lun, lunstr));
PRINTP(" command = ");
len += sprint_command(buffer, len, cmd->cmnd);
return len - start;
@@ -834,12 +836,12 @@ static int generic_NCR5380_proc_info(str
if (hostdata->pendingr || hostdata->pendingw)
PRINTP("\n");
shost_for_each_device(dev, scsi_ptr) {
- unsigned long br = hostdata->bytes_read[dev->id];
- unsigned long bw = hostdata->bytes_write[dev->id];
- long tr = hostdata->time_read[dev->id] / HZ;
- long tw = hostdata->time_write[dev->id] / HZ;
+ unsigned long br = hostdata->bytes_read[sdev_id(dev)];
+ unsigned long bw = hostdata->bytes_write[sdev_id(dev)];
+ long tr = hostdata->time_read[sdev_id(dev)] / HZ;
+ long tw = hostdata->time_write[sdev_id(dev)] / HZ;
- PRINTP(" T:%d %s " ANDP dev->id ANDP(dev->type < MAX_SCSI_DEVICE_CODE) ? scsi_device_types[(int) dev->type] : "Unknown");
+ PRINTP(" T:%d %s " ANDP sdev_id(dev) ANDP(dev->type < MAX_SCSI_DEVICE_CODE) ? scsi_device_types[(int) dev->type] : "Unknown");
for (i = 0; i < 8; i++)
if (dev->vendor[i] >= 0x20)
*(buffer + (len++)) = dev->vendor[i];
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 104fd9a..1f75860 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -344,12 +344,12 @@ int ata_scsi_slave_config(struct scsi_de
blk_queue_max_phys_segments(sdev->request_queue, LIBATA_MAX_PRD);
- if (sdev->id < ATA_MAX_DEVICES) {
+ if (sdev_id(sdev) < ATA_MAX_DEVICES) {
struct ata_port *ap;
struct ata_device *dev;
ap = (struct ata_port *) &sdev->host->hostdata[0];
- dev = &ap->device[sdev->id];
+ dev = &ap->device[sdev_id(sdev)];
/* TODO: 1024 is an arbitrary number, not the
* hardware maximum. This should be increased to
@@ -1458,13 +1458,13 @@ ata_scsi_find_dev(struct ata_port *ap, s
struct ata_device *dev;
/* skip commands not addressed to targets we simulate */
- if (likely(scsidev->id < ATA_MAX_DEVICES))
- dev = &ap->device[scsidev->id];
+ if (likely(sdev_id(scsidev) < ATA_MAX_DEVICES))
+ dev = &ap->device[sdev_id(scsidev)];
else
return NULL;
- if (unlikely((scsidev->channel != 0) ||
- (scsidev->lun != 0)))
+ if (unlikely((sdev_channel(scsidev) != 0) ||
+ (!scsilun_zero(&scsidev->lun))))
return NULL;
if (unlikely(!ata_dev_present(dev)))
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index 519486d..68c41e0 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -1209,13 +1209,13 @@ struct scripth {
**==========================================================
*/
-static void ncr_alloc_ccb (struct ncb *np, u_char tn, u_char ln);
+static void ncr_alloc_ccb (struct ncb *np, u_char tn, const struct scsi_lun *ln);
static void ncr_complete (struct ncb *np, struct ccb *cp);
static void ncr_exception (struct ncb *np);
static void ncr_free_ccb (struct ncb *np, struct ccb *cp);
static void ncr_init_ccb (struct ncb *np, struct ccb *cp);
static void ncr_init_tcb (struct ncb *np, u_char tn);
-static struct lcb * ncr_alloc_lcb (struct ncb *np, u_char tn, u_char ln);
+static struct lcb * ncr_alloc_lcb (struct ncb *np, u_char tn, const struct scsi_lun *ln);
static struct lcb * ncr_setup_lcb (struct ncb *np, struct scsi_device *sdev);
static void ncr_getclock (struct ncb *np, int mult);
static void ncr_selectclock (struct ncb *np, u_char scntl3);
@@ -3429,8 +3429,8 @@ static int ncr_prepare_nego(struct ncb *
static int ncr_queue_command (struct ncb *np, struct scsi_cmnd *cmd)
{
struct scsi_device *sdev = cmd->device;
- struct tcb *tp = &np->target[sdev->id];
- struct lcb *lp = tp->lp[sdev->lun];
+ struct tcb *tp = &np->target[sdev_id(sdev)];
+ struct lcb *lp = tp->lp[scsilun_to_int(&sdev->lun)];
struct ccb *cp;
int segments;
@@ -3445,9 +3445,9 @@ static int ncr_queue_command (struct ncb
**
**---------------------------------------------
*/
- if ((sdev->id == np->myaddr ) ||
- (sdev->id >= MAX_TARGET) ||
- (sdev->lun >= MAX_LUN )) {
+ if ((sdev_id(sdev) == np->myaddr ) ||
+ (sdev_id(sdev) >= MAX_TARGET) ||
+ (scsilun_to_int(&sdev->lun) >= MAX_LUN )) {
return(DID_BAD_TARGET);
}
@@ -3499,7 +3499,7 @@ static int ncr_queue_command (struct ncb
**----------------------------------------------------
*/
- idmsg = M_IDENTIFY | sdev->lun;
+ idmsg = M_IDENTIFY | scsilun_to_int(&sdev->lun);
if (cp ->tag != NO_TAG ||
(cp != np->ccb && np->disc && !(tp->usrflag & UF_NODISC)))
@@ -3669,7 +3669,7 @@ static int ncr_queue_command (struct ncb
/*
** select
*/
- cp->phys.select.sel_id = sdev->id;
+ cp->phys.select.sel_id = sdev_id(sdev);
cp->phys.select.sel_scntl3 = tp->wval;
cp->phys.select.sel_sxfer = tp->sval;
/*
@@ -4150,8 +4150,8 @@ void ncr_complete (struct ncb *np, struc
cmd = cp->cmd;
cp->cmd = NULL;
- tp = &np->target[cmd->device->id];
- lp = tp->lp[cmd->device->lun];
+ tp = &np->target[sdev_id(cmd->device)];
+ lp = tp->lp[scsilun_to_int(&cmd->device->lun)];
/*
** We donnot queue more than 1 ccb per target
@@ -4245,7 +4245,7 @@ void ncr_complete (struct ncb *np, struc
** Allocate the lcb if not yet.
*/
if (!lp)
- ncr_alloc_lcb (np, cmd->device->id, cmd->device->lun);
+ ncr_alloc_lcb (np, sdev_id(cmd->device), &cmd->device->lun);
tp->bytes += cp->data_len;
tp->transfers ++;
@@ -4820,7 +4820,7 @@ static void ncr_set_sync_wide_status (st
*/
for (cp = np->ccb; cp; cp = cp->link_ccb) {
if (!cp->cmd) continue;
- if (cp->cmd->device->id != target) continue;
+ if (sdev_id(cp->cmd->device) != target) continue;
#if 0
cp->sync_status = tp->sval;
cp->wide_status = tp->wval;
@@ -4844,7 +4844,7 @@ static void ncr_setsync (struct ncb *np,
u_char target = INB (nc_sdid) & 0x0f;
u_char idiv;
- BUG_ON(target != (cmd->device->id & 0xf));
+ BUG_ON(target != (sdev_id(cmd->device) & 0xf));
tp = &np->target[target];
@@ -4902,7 +4902,7 @@ static void ncr_setwide (struct ncb *np,
u_char scntl3;
u_char sxfer;
- BUG_ON(target != (cmd->device->id & 0xf));
+ BUG_ON(target != (sdev_id(cmd->device) & 0xf));
tp = &np->target[target];
tp->widedone = wide+1;
@@ -4941,7 +4941,7 @@ static void ncr_setwide (struct ncb *np,
static void ncr_setup_tags (struct ncb *np, struct scsi_device *sdev)
{
- unsigned char tn = sdev->id, ln = sdev->lun;
+ unsigned char tn = sdev_id(sdev), ln = scsilun_to_int(&sdev->lun);
struct tcb *tp = &np->target[tn];
struct lcb *lp = tp->lp[ln];
u_char reqtags, maxdepth;
@@ -5851,8 +5851,8 @@ reset_all:
static void ncr_sir_to_redo(struct ncb *np, int num, struct ccb *cp)
{
struct scsi_cmnd *cmd = cp->cmd;
- struct tcb *tp = &np->target[cmd->device->id];
- struct lcb *lp = tp->lp[cmd->device->lun];
+ struct tcb *tp = &np->target[sdev_id(cmd->device)];
+ struct lcb *lp = tp->lp[scsilun_to_int(&cmd->device->lun)];
struct list_head *qp;
struct ccb * cp2;
int disc_cnt = 0;
@@ -5929,7 +5929,7 @@ static void ncr_sir_to_redo(struct ncb *
**
** identify message
*/
- cp->scsi_smsg2[0] = IDENTIFY(0, cmd->device->lun);
+ cp->scsi_smsg2[0] = IDENTIFY(0, &cmd->device->lun);
cp->phys.smsg.addr = cpu_to_scr(CCB_PHYS (cp, scsi_smsg2));
cp->phys.smsg.size = cpu_to_scr(1);
@@ -5943,7 +5943,7 @@ static void ncr_sir_to_redo(struct ncb *
** patch requested size into sense command
*/
cp->sensecmd[0] = 0x03;
- cp->sensecmd[1] = cmd->device->lun << 5;
+ cp->sensecmd[1] = scsilun_to_int(&cmd->device->lun) << 5;
cp->sensecmd[4] = sizeof(cp->sense_buf);
/*
@@ -6459,10 +6459,10 @@ out:
static struct ccb *ncr_get_ccb(struct ncb *np, struct scsi_cmnd *cmd)
{
- u_char tn = cmd->device->id;
- u_char ln = cmd->device->lun;
+ u_char tn = sdev_id(cmd->device);
+ const struct scsi_lun *ln = &cmd->device->lun;
struct tcb *tp = &np->target[tn];
- struct lcb *lp = tp->lp[ln];
+ struct lcb *lp = tp->lp[scsilun_to_int(ln)];
u_char tag = NO_TAG;
struct ccb *cp = NULL;
@@ -6550,7 +6550,7 @@ static struct ccb *ncr_get_ccb(struct nc
*/
cp->tag = tag;
cp->target = tn;
- cp->lun = ln;
+ cp->lun = scsilun_to_int(ln);
if (DEBUG_FLAGS & DEBUG_TAGS) {
PRINT_ADDR(cmd, "ccb @%p using tag %d.\n", cp, tag);
@@ -6669,10 +6669,10 @@ static void ncr_init_ccb(struct ncb *np,
**------------------------------------------------------------------------
**------------------------------------------------------------------------
*/
-static void ncr_alloc_ccb(struct ncb *np, u_char tn, u_char ln)
+static void ncr_alloc_ccb(struct ncb *np, u_char tn, const struct scsi_lun *ln)
{
struct tcb *tp = &np->target[tn];
- struct lcb *lp = tp->lp[ln];
+ struct lcb *lp = tp->lp[scsilun_to_int(ln)];
struct ccb *cp = NULL;
/*
@@ -6805,12 +6805,12 @@ static void ncr_init_tcb (struct ncb *np
** command has been successfully completed for this target/lun.
**------------------------------------------------------------------------
*/
-static struct lcb *ncr_alloc_lcb (struct ncb *np, u_char tn, u_char ln)
+static struct lcb *ncr_alloc_lcb (struct ncb *np, u_char tn, const struct scsi_lun *ln)
{
struct tcb *tp = &np->target[tn];
- struct lcb *lp = tp->lp[ln];
+ struct lcb *lp = tp->lp[scsilun_to_int(ln)];
ncrcmd copy_4 = np->features & FE_PFEN ? SCR_COPY(4) : SCR_COPY_F(4);
- int lh = ln & 3;
+ int lh = scsilun_to_int(ln) & 3;
/*
** Already done, return.
@@ -6825,7 +6825,7 @@ static struct lcb *ncr_alloc_lcb (struct
if (!lp)
goto fail;
memset(lp, 0, sizeof(*lp));
- tp->lp[ln] = lp;
+ tp->lp[scsilun_to_int(ln)] = lp;
/*
** Initialize the target control block if not yet.
@@ -6861,7 +6861,7 @@ static struct lcb *ncr_alloc_lcb (struct
** JUMP @script(resel_notag)
*/
lp->jump_lcb.l_cmd =
- cpu_to_scr((SCR_JUMP ^ IFFALSE (MASK (0x80+ln, 0xff))));
+ cpu_to_scr((SCR_JUMP ^ IFFALSE (MASK (0x80+scsilun_to_int(ln), 0xff))));
lp->jump_lcb.l_paddr = tp->jump_lcb[lh].l_paddr;
lp->load_jump_ccb[0] = cpu_to_scr(copy_4);
@@ -6897,9 +6897,10 @@ fail:
*/
static struct lcb *ncr_setup_lcb (struct ncb *np, struct scsi_device *sdev)
{
- unsigned char tn = sdev->id, ln = sdev->lun;
+ unsigned char tn = sdev_id(sdev);
+ const struct scsi_lun *ln = &sdev->lun;
struct tcb *tp = &np->target[tn];
- struct lcb *lp = tp->lp[ln];
+ struct lcb *lp = tp->lp[scsilun_to_int(ln)];
/* If no lcb, try to allocate it. */
if (!lp && !(lp = ncr_alloc_lcb(np, tn, ln)))
@@ -7305,7 +7306,7 @@ static int ncr53c8xx_slave_alloc(struct
{
struct Scsi_Host *host = device->host;
struct ncb *np = ((struct host_data *) host->hostdata)->ncb;
- struct tcb *tp = &np->target[device->id];
+ struct tcb *tp = &np->target[sdev_id(device)];
tp->starget = device->sdev_target;
return 0;
@@ -7315,8 +7316,8 @@ static int ncr53c8xx_slave_configure(str
{
struct Scsi_Host *host = device->host;
struct ncb *np = ((struct host_data *) host->hostdata)->ncb;
- struct tcb *tp = &np->target[device->id];
- struct lcb *lp = tp->lp[device->lun];
+ struct tcb *tp = &np->target[sdev_id(device)];
+ struct lcb *lp = tp->lp[scsilun_to_int(&device->lun)];
int numtags, depth_to_use;
ncr_setup_lcb(np, device);
@@ -7327,7 +7328,7 @@ static int ncr53c8xx_slave_configure(str
** Use at least 2.
** Donnot use more than our maximum.
*/
- numtags = device_queue_depth(np->unit, device->id, device->lun);
+ numtags = device_queue_depth(np->unit, sdev_id(device), scsilun_to_int(&device->lun));
if (numtags > tp->usrtags)
numtags = tp->usrtags;
if (!device->tagged_supported)
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 637fb65..0a91866 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -617,9 +617,9 @@ __setup("qla1280=", qla1280_setup);
#endif
#define CMD_HOST(Cmnd) Cmnd->device->host
-#define SCSI_BUS_32(Cmnd) Cmnd->device->channel
-#define SCSI_TCN_32(Cmnd) Cmnd->device->id
-#define SCSI_LUN_32(Cmnd) Cmnd->device->lun
+#define SCSI_BUS_32(Cmnd) sdev_channel(Cmnd->device)
+#define SCSI_TCN_32(Cmnd) sdev_id(Cmnd->device)
+#define SCSI_LUN_32(Cmnd) scsilun_to_int(&Cmnd->device->lun)
/*****************************************/
@@ -1393,8 +1393,8 @@ qla1280_slave_configure(struct scsi_devi
{
struct scsi_qla_host *ha;
int default_depth = 3;
- int bus = device->channel;
- int target = device->id;
+ int bus = sdev_channel(device);
+ int target = sdev_id(device);
int status = 0;
struct nvram *nv;
unsigned long flags;
@@ -4250,9 +4250,9 @@ qla1280_get_target_parameters(struct scs
uint16_t mb[MAILBOX_REGISTER_COUNT];
int bus, target, lun;
- bus = device->channel;
- target = device->id;
- lun = device->lun;
+ bus = sdev_channel(device);
+ target = sdev_id(device);
+ lun = scsilun_to_int(&device->lun);
mb[0] = MBC_GET_TARGET_PARAMETERS;
diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c
index cb75e0b..12ddc76 100644
--- a/drivers/scsi/qlogicfas408.c
+++ b/drivers/scsi/qlogicfas408.c
@@ -243,7 +243,7 @@ static void ql_icmd(Scsi_Cmnd * cmd)
/**/ outb(qlcfg5, qbase + 5); /* select timer */
outb(qlcfg9 & 7, qbase + 9); /* prescaler */
/* outb(0x99, qbase + 5); */
- outb(cmd->device->id, qbase + 4);
+ outb(sdev_id(cmd->device), qbase + 4);
for (i = 0; i < cmd->cmd_len; i++)
outb(cmd->cmnd[i], qbase + 2);
@@ -450,7 +450,7 @@ irqreturn_t qlogicfas408_ihandl(int irq,
int qlogicfas408_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
{
struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
- if (cmd->device->id == priv->qinitid) {
+ if (sdev_id(cmd->device) == priv->qinitid) {
cmd->result = DID_BAD_TARGET << 16;
done(cmd);
return 0;
diff --git a/drivers/scsi/qlogicfc.c b/drivers/scsi/qlogicfc.c
index a4b3b3f..a4e9603 100644
--- a/drivers/scsi/qlogicfc.c
+++ b/drivers/scsi/qlogicfc.c
@@ -1247,10 +1247,10 @@ static int isp2x00_queuecommand(Scsi_Cmn
cmd->hdr.entry_type = ENTRY_COMMAND;
cmd->hdr.entry_cnt = 1;
- cmd->target_lun = Cmnd->device->lun;
- cmd->expanded_lun = cpu_to_le16(Cmnd->device->lun);
+ cmd->target_lun = scsilun_to_int(&Cmnd->device->lun);
+ cmd->expanded_lun = cpu_to_le16(scsilun_to_int(&Cmnd->device->lun));
#if ISP2x00_PORTDB
- cmd->target_id = hostdata->port_db[Cmnd->device->id].loop_id;
+ cmd->target_id = hostdata->port_db[sdev_id(Cmnd->device)].loop_id;
#else
cmd->target_id = Cmnd->target;
#endif
@@ -1325,9 +1325,9 @@ static int isp2x00_queuecommand(Scsi_Cmn
cmd->control_flags = cpu_to_le16(CFLAG_READ);
if (Cmnd->device->tagged_supported) {
- if ((jiffies - hostdata->tag_ages[Cmnd->device->id]) > (2 * ISP_TIMEOUT)) {
+ if ((jiffies - hostdata->tag_ages[sdev_id(Cmnd->device)]) > (2 * ISP_TIMEOUT)) {
cmd->control_flags |= cpu_to_le16(CFLAG_ORDERED_TAG);
- hostdata->tag_ages[Cmnd->device->id] = jiffies;
+ hostdata->tag_ages[sdev_id(Cmnd->device)] = jiffies;
} else
switch (Cmnd->tag) {
case HEAD_OF_QUEUE_TAG:
@@ -1396,8 +1396,9 @@ static void redo_port_db(unsigned long a
}
for (i = 0; i < QLOGICFC_REQ_QUEUE_LEN; i++){
- 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){
+ if (hostdata->handle_ptrs[i] &&
+ (hostdata->port_db[sdev_id(hostdata->handle_ptrs[i]->device)].loop_id > QLOGICFC_MAX_LOOP_ID || hostdata->adapter_state & AS_REDO_LOOP_PORTDB)){
+ if (hostdata->port_db[sdev_id(hostdata->handle_ptrs[i]->device)].loop_id != hostdata->port_db[0].loop_id){
Scsi_Cmnd *Cmnd = hostdata->handle_ptrs[i];
if (Cmnd->use_sg)
@@ -1596,7 +1597,7 @@ void isp2x00_intr_handler(int irq, void
* 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->device->id].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[sdev_id(Cmnd->device)].wwn){
outw(out_ptr, host->io_port + MBOX5);
continue;
}
@@ -1739,9 +1740,9 @@ static int isp2x00_abort(Scsi_Cmnd * Cmn
param[0] = MBOX_ABORT_IOCB;
#if ISP2x00_PORTDB
- param[1] = (((u_short) hostdata->port_db[Cmnd->device->id].loop_id) << 8) | Cmnd->device->lun;
+ param[1] = (((u_short) hostdata->port_db[sdev_id(Cmnd->device)].loop_id) << 8) | scsilun_to_int(&Cmnd->device->lun);
#else
- param[1] = (((u_short) Cmnd->target) << 8) | Cmnd->lun;
+ param[1] = (((u_short) Cmnd->target) << 8) | scsilun_to_int(&Cmnd->device->lun);
#endif
param[2] = i & 0xffff;
param[3] = i >> 16;
diff --git a/drivers/scsi/qlogicisp.c b/drivers/scsi/qlogicisp.c
index 6c9266b..8f48859 100644
--- a/drivers/scsi/qlogicisp.c
+++ b/drivers/scsi/qlogicisp.c
@@ -861,8 +861,8 @@ static int isp1020_queuecommand(Scsi_Cmn
cmd->hdr.entry_type = ENTRY_COMMAND;
cmd->hdr.entry_cnt = 1;
- cmd->target_lun = Cmnd->device->lun;
- cmd->target_id = Cmnd->device->id;
+ cmd->target_lun = scsilun_to_int(&Cmnd->device->lun);
+ cmd->target_id = sdev_id(Cmnd->device);
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);
diff --git a/drivers/scsi/seagate.c b/drivers/scsi/seagate.c
index a0cace9..d5ad93e 100644
--- a/drivers/scsi/seagate.c
+++ b/drivers/scsi/seagate.c
@@ -228,7 +228,7 @@ extern volatile int seagate_st0x_timeout
#define ST0X_ID_STR "Seagate ST-01/ST-02"
#define FD_ID_STR "TMC-8XX/TMC-950"
-static int internal_command (unsigned char target, unsigned char lun,
+static int internal_command (unsigned char target, const struct scsi_lun *lun,
const void *cmnd,
void *buff, int bufflen, int reselect);
@@ -568,7 +568,8 @@ static const char *seagate_st0x_info (st
* waiting for a reconnect
*/
-static unsigned char current_target, current_lun;
+static unsigned char current_target;
+static struct scsi_lun current_lun;
static unsigned char *current_cmnd, *current_data;
static int current_nobuffs;
static struct scatterlist *current_buffer;
@@ -582,7 +583,8 @@ static int current_bufflen;
*/
static int linked_connected = 0;
-static unsigned char linked_target, linked_lun;
+static unsigned char linked_target;
+static strict scsi_lun linked_lun;
#endif
static void (*done_fn) (Scsi_Cmnd *) = NULL;
@@ -645,7 +647,7 @@ static void seagate_reconnect_intr (int
DPRINTK (PHASE_RESELECT, "scsi%d : internal_command(%d, %08x, %08x, RECONNECT_NOW\n",
hostno, current_target, current_data, current_bufflen);
- temp = internal_command (current_target, current_lun, current_cmnd, current_data, current_bufflen, RECONNECT_NOW);
+ temp = internal_command (current_target, ¤t_lun, current_cmnd, current_data, current_bufflen, RECONNECT_NOW);
if (msg_byte(temp) != DISCONNECT) {
if (done_fn) {
@@ -682,8 +684,8 @@ static int seagate_st0x_queue_command (S
DANY ("seagate: que_command");
done_fn = done;
- current_target = SCpnt->device->id;
- current_lun = SCpnt->device->lun;
+ current_target = sdev_id(SCpnt->device);
+ scsilun_cp(¤t_lun, &SCpnt->device->lun);
current_cmnd = SCpnt->cmnd;
current_data = (unsigned char *) SCpnt->request_buffer;
current_bufflen = SCpnt->request_bufflen;
@@ -700,7 +702,8 @@ static int seagate_st0x_queue_command (S
current_cmnd[SCpnt->cmd_len] |= 0x01;
if (linked_connected) {
DPRINTK (DEBUG_LINKED, "scsi%d : using linked commands, current I_T_L nexus is ", hostno);
- if (linked_target == current_target && linked_lun == current_lun)
+ if (linked_target == current_target &&
+ scsilun_eq(&linked_lun, ¤t_lun))
{
DPRINTK(DEBUG_LINKED, "correct\n");
reconnect = LINKED_RIGHT;
@@ -712,8 +715,9 @@ static int seagate_st0x_queue_command (S
#endif /* LINKED */
reconnect = CAN_RECONNECT;
- result = internal_command(SCint->device->id, SCint->device->lun, SCint->cmnd,
- SCint->request_buffer, SCint->request_bufflen, reconnect);
+ result = internal_command(sdev_id(SCint->device),
+ &SCint->device->lun, SCint->cmnd,
+ SCint->request_buffer, SCint->request_bufflen, reconnect);
if (msg_byte(result) == DISCONNECT)
break;
SCtmp = SCint;
@@ -726,7 +730,7 @@ static int seagate_st0x_queue_command (S
return 0;
}
-static int internal_command (unsigned char target, unsigned char lun,
+static int internal_command (unsigned char target, const struct scsi_lun *lun,
const void *cmnd, void *buff, int bufflen, int reselect)
{
unsigned char *data = NULL;
diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c
index ef19adc..b515d77 100644
--- a/drivers/scsi/sym53c416.c
+++ b/drivers/scsi/sym53c416.c
@@ -773,7 +773,7 @@ int sym53c416_queuecommand(Scsi_Cmnd *SC
current_command->SCp.Message = 0;
spin_lock_irqsave(&sym53c416_lock, flags);
- outb(SCpnt->device->id, base + DEST_BUS_ID); /* Set scsi id target */
+ outb(sdev_id(SCpnt->device), base + DEST_BUS_ID); /* Set scsi id target */
outb(FLUSH_FIFO, base + COMMAND_REG); /* Flush SCSI and PIO FIFO's */
/* Write SCSI command into the SCSI fifo */
for(i = 0; i < SCpnt->cmd_len; i++)
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c
index fb54a87..0becb6d 100644
--- a/drivers/scsi/wd7000.c
+++ b/drivers/scsi/wd7000.c
@@ -1094,7 +1094,8 @@ static int wd7000_queuecommand(struct sc
Adapter *host = (Adapter *) SCpnt->device->host->hostdata;
cdblen = SCpnt->cmd_len;
- idlun = ((SCpnt->device->id << 5) & 0xe0) | (SCpnt->device->lun & 7);
+ idlun = ((sdev_id(SCpnt->device) << 5) & 0xe0) |
+ (scsilun_to_int(&SCpnt->device->lun) & 7);
SCpnt->scsi_done = done;
SCpnt->SCp.phase = 1;
scb = alloc_scbs(SCpnt->device->host, 1);
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH RFC 4/2] HCIL drivers update; sdev_printk
2005-10-23 21:40 ` [PATCH RFC 4/2] HCIL drivers update; sdev_printk Jeff Garzik
@ 2005-10-24 3:36 ` James Bottomley
2005-10-24 4:01 ` Jeff Garzik
0 siblings, 1 reply; 19+ messages in thread
From: James Bottomley @ 2005-10-24 3:36 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-scsi
On Sun, 2005-10-23 at 17:40 -0400, Jeff Garzik wrote:
> Yet more driver work. Some bugs added (and noted).
>
> Added sdev_printk() to save typing.
If you can unify this with the sdev_prink work here
http://marc.theaimsgroup.com/?l=linux-scsi&m=112827155625203
This can probably be applied independently
James
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH RFC 7/n] HCIL drivers update
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
` (4 preceding siblings ...)
2005-10-24 0:14 ` [PATCH RFC 6/n] " Jeff Garzik
@ 2005-10-24 3:49 ` Jeff Garzik
2005-10-24 6:43 ` Stefan Richter
2005-10-24 3:52 ` [PATCH RFC 8/n] " Jeff Garzik
` (7 subsequent siblings)
13 siblings, 1 reply; 19+ messages in thread
From: Jeff Garzik @ 2005-10-24 3:49 UTC (permalink / raw)
To: linux-scsi
More sdev->{command,id,lun} work. DO NOT APPLY.
drivers/block/cciss_scsi.c | 51 ++++++++-----
drivers/block/cciss_scsi.h | 3
drivers/ieee1394/sbp2.c | 2
drivers/message/fusion/mptsas.c | 4 -
drivers/message/fusion/mptscsih.c | 100 +++++++++++++++-----------
drivers/scsi/53c700.c | 144 ++++++++++++++++++++------------------
drivers/scsi/53c700.h | 6 -
drivers/scsi/a100u2w.c | 8 +-
drivers/scsi/aha152x.c | 25 +++---
drivers/scsi/aha1542.c | 11 +-
drivers/scsi/aha1740.c | 4 -
drivers/scsi/atp870u.c | 24 +++---
drivers/scsi/dc395x.c | 96 +++++++++++++------------
drivers/scsi/gdth.c | 31 ++++----
drivers/scsi/gdth_proc.c | 12 +--
drivers/scsi/ibmmca.c | 54 ++++++++------
drivers/scsi/ide-scsi.c | 3
drivers/scsi/initio.c | 8 +-
drivers/scsi/tmscsim.c | 12 +--
drivers/usb/image/microtek.c | 14 ++-
20 files changed, 347 insertions(+), 265 deletions(-)
7ead5490dde9e4d85151077566e9f28518d535bf
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index e183a3e..e7a6190 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -330,7 +330,7 @@ print_cmd(CommandList_struct *cp)
#endif
static int
-find_bus_target_lun(int ctlr, int *bus, int *target, int *lun)
+find_bus_target_lun(int ctlr, int *bus, int *target, struct scsi_lun *lun)
{
/* finds an unused bus, target, lun for a new device */
/* assumes hba[ctlr]->scsi_ctlr->lock is held */
@@ -345,7 +345,10 @@ find_bus_target_lun(int ctlr, int *bus,
for (i=0;i<CCISS_MAX_SCSI_DEVS_PER_HBA;i++) {
if (!target_taken[i]) {
- *bus = 0; *target=i; *lun = 0; found=1;
+ *bus = 0;
+ *target=i;
+ int_to_scsilun(0, lun);
+ found=1;
break;
}
}
@@ -375,10 +378,14 @@ cciss_scsi_add_entry(int ctlr, int hostn
/* initially, (before registering with scsi layer) we don't
know our hostno and we don't want to print anything first
time anyway (the scsi layer's inquiries will show that info) */
- if (hostno != -1)
- printk("cciss%d: %s device c%db%dt%dl%d added.\n",
+ if (hostno != -1) {
+ char lunstr[SCSILUN_STR_LEN];
+
+ printk("cciss%d: %s device c%db%dt%dl%s added.\n",
ctlr, DEVICETYPE(sd->devtype), hostno,
- sd->bus, sd->target, sd->lun);
+ sd->bus, sd->target,
+ scsilun_to_str(&sd->lun, lunstr));
+ }
return 0;
}
@@ -388,15 +395,17 @@ cciss_scsi_remove_entry(int ctlr, int ho
/* assumes hba[ctlr]->scsi_ctlr->lock is held */
int i;
struct cciss_scsi_dev_t sd;
+ char lunstr[SCSILUN_STR_LEN];
if (entry < 0 || entry >= CCISS_MAX_SCSI_DEVS_PER_HBA) return;
sd = ccissscsi[ctlr].dev[entry];
for (i=entry;i<ccissscsi[ctlr].ndevices-1;i++)
ccissscsi[ctlr].dev[i] = ccissscsi[ctlr].dev[i+1];
ccissscsi[ctlr].ndevices--;
- printk("cciss%d: %s device c%db%dt%dl%d removed.\n",
+ printk("cciss%d: %s device c%db%dt%dl%s removed.\n",
ctlr, DEVICETYPE(sd.devtype), hostno,
- sd.bus, sd.target, sd.lun);
+ sd.bus, sd.target,
+ scsilun_to_str(&sd.lun, lunstr));
}
@@ -452,11 +461,14 @@ adjust_cciss_scsi_table(int ctlr, int ho
/* note, i not incremented */
}
else if (found == 1) { /* device is different kind */
+ char lunstr[SCSILUN_STR_LEN];
+
changes++;
- printk("cciss%d: device c%db%dt%dl%d type changed "
+ printk("cciss%d: device c%db%dt%dl%s type changed "
"(device type now %s).\n",
- ctlr, hostno, csd->bus, csd->target, csd->lun,
- DEVICETYPE(csd->devtype));
+ ctlr, hostno, csd->bus, csd->target,
+ scsilun_to_str(&csd->lun, lunstr),
+ DEVICETYPE(csd->devtype));
csd->devtype = sd[j].devtype;
i++; /* so just move along. */
} else /* device is same as it ever was, */
@@ -501,7 +513,8 @@ adjust_cciss_scsi_table(int ctlr, int ho
}
static int
-lookup_scsi3addr(int ctlr, int bus, int target, int lun, char *scsi3addr)
+lookup_scsi3addr(int ctlr, int bus, int target, const struct scsi_lun *lun,
+ char *scsi3addr)
{
int i;
struct cciss_scsi_dev_t *sd;
@@ -512,7 +525,7 @@ lookup_scsi3addr(int ctlr, int bus, int
sd = &ccissscsi[ctlr].dev[i];
if (sd->bus == bus &&
sd->target == target &&
- sd->lun == lun) {
+ scsilun_eq(&sd->lun, lun)) {
memcpy(scsi3addr, &sd->scsi3addr[0], 8);
CPQ_TAPE_UNLOCK(ctlr, flags);
return 0;
@@ -1095,7 +1108,7 @@ cciss_update_non_disk_devices(int cntl_n
currentsd[ncurrent].devtype = devtype;
currentsd[ncurrent].bus = -1;
currentsd[ncurrent].target = -1;
- currentsd[ncurrent].lun = -1;
+ int_to_scsilun(0xffffffff, ¤tsd[ncurrent].lun);
ncurrent++;
break;
default:
@@ -1167,10 +1180,13 @@ cciss_scsi_proc_info(struct Scsi_Host *s
get them back in sync. */
for (i=0;i<ccissscsi[cntl_num].ndevices;i++) {
+ char lunstr[SCSILUN_STR_LEN];
+
struct cciss_scsi_dev_t *sd = &ccissscsi[cntl_num].dev[i];
- buflen += sprintf(&buffer[buflen], "c%db%dt%dl%d %02d "
+ buflen += sprintf(&buffer[buflen], "c%db%dt%dl%s %02d "
"0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
- sh->host_no, sd->bus, sd->target, sd->lun,
+ sh->host_no, sd->bus, sd->target,
+ scsilun_to_str(&sd->lun, lunstr),
sd->devtype,
sd->scsi3addr[0], sd->scsi3addr[1],
sd->scsi3addr[2], sd->scsi3addr[3],
@@ -1256,8 +1272,9 @@ cciss_scsi_queue_command (struct scsi_cm
c = (ctlr_info_t **) &cmd->device->host->hostdata[0];
ctlr = (*c)->ctlr;
- rc = lookup_scsi3addr(ctlr, cmd->device->channel, cmd->device->id,
- cmd->device->lun, scsi3addr);
+ rc = lookup_scsi3addr(ctlr, sdev_channel(cmd->device),
+ sdev_id(cmd->device),
+ &cmd->device->lun, scsi3addr);
if (rc != 0) {
/* the scsi nexus does not match any that we presented... */
/* pretend to mid layer that we got selection timeout */
diff --git a/drivers/block/cciss_scsi.h b/drivers/block/cciss_scsi.h
index 5e7e06c..783217e 100644
--- a/drivers/block/cciss_scsi.h
+++ b/drivers/block/cciss_scsi.h
@@ -64,7 +64,8 @@ driver, I suppose.
struct cciss_scsi_dev_t {
int devtype;
- int bus, target, lun; /* as presented to the OS */
+ int bus, target; /* as presented to the OS */
+ struct scsi_lun lun;
unsigned char scsi3addr[8]; /* as presented to the HW */
};
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 12cec7c..87d381d 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -2513,7 +2513,7 @@ static int sbp2scsi_queuecommand(struct
* Until we handle multiple luns, just return selection time-out
* to any IO directed at non-zero LUNs
*/
- if (SCpnt->device->lun)
+ if (!scsilun_zero(&SCpnt->device->lun))
goto done;
/*
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index 7de19a8..7b45b4c 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -136,7 +136,7 @@ mptsas_slave_alloc(struct scsi_device *d
struct sas_rphy *rphy;
struct mptsas_portinfo *p;
VirtDevice *vdev;
- uint target = device->id;
+ uint target = sdev_id(device);
int i;
if ((vdev = hd->Targets[target]) != NULL)
@@ -161,7 +161,7 @@ mptsas_slave_alloc(struct scsi_device *d
vdev->target_id =
p->phy_info[i].attached.target;
vdev->bus_id = p->phy_info[i].attached.bus;
- hd->Targets[device->id] = vdev;
+ hd->Targets[sdev_id(device)] = vdev;
goto out;
}
}
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 5cb07eb..d1918ed 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -107,7 +107,7 @@ typedef struct _internal_cmd {
u8 cmd; /* SCSI Op Code */
u8 bus; /* bus number */
u8 id; /* SCSI ID (virtual) */
- u8 lun;
+ struct scsi_lun lun;
u8 flags; /* Bit Field - See above */
u8 physDiskNum; /* Phys disk number, -1 else */
u8 rsvd2;
@@ -144,13 +144,13 @@ static int mptscsih_tm_pending_wait(MPT_
static int mptscsih_tm_wait_for_completion(MPT_SCSI_HOST * hd, ulong timeout );
static u32 SCPNT_TO_LOOKUP_IDX(struct scsi_cmnd *sc);
-static int mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout);
-static int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout);
+static int mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, const struct scsi_lun *lun, int ctx2abort, ulong timeout);
+static int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, const struct scsi_lun *lun, int ctx2abort, ulong timeout);
int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
-static void mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *data, int dlen);
+static void mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, const struct scsi_lun *lun, char *data, int dlen);
static void mptscsih_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtDevice *target, char byte56);
static void mptscsih_set_dvflags(MPT_SCSI_HOST *hd, SCSIIORequest_t *pReq);
static void mptscsih_setDevicePage1Flags (u8 width, u8 factor, u8 offset, int *requestedPtr, int *configurationPtr, u8 flags);
@@ -678,7 +678,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_F
/* GEM Workaround. */
if (ioc->bus_type == SCSI)
- mptscsih_no_negotiate(hd, sc->device->id);
+ mptscsih_no_negotiate(hd, sdev_id(sc->device));
break;
case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: /* 0x0049 */
@@ -901,12 +901,13 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOS
* Called from slave_destroy.
*/
static void
-mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, uint target, uint lun)
+mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, uint target, const struct scsi_lun *slun)
{
SCSIIORequest_t *mf = NULL;
int ii;
int max = hd->ioc->req_depth;
struct scsi_cmnd *sc;
+ unsigned int lun = scsilun_to_int(slun);
dsprintk((KERN_INFO MYNAM ": search_running target %d lun %d max %d\n",
target, lun, max));
@@ -974,8 +975,13 @@ mptscsih_report_queue_full(struct scsi_c
return;
if (time - hd->last_queue_full > 10 * HZ) {
- dprintk((MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n",
- hd->ioc->name, 0, sc->device->id, sc->device->lun));
+ char lunstr[SCSILUN_STR_LEN];
+
+ (void) lunstr; /* kill unused-var warning, if debug disabled */
+
+ dprintk((MYIOC_s_WARN_FMT "Device (%d:%d:%s) reported QUEUE_FULL!\n",
+ hd->ioc->name, 0, sdev_id(sc->device),
+ scsilun_to_str(&sc->device->lun, lunstr)));
hd->last_queue_full = time;
}
}
@@ -1289,7 +1295,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, v
MPT_FRAME_HDR *mf;
SCSIIORequest_t *pScsiReq;
VirtDevice *pTarget = SCpnt->device->hostdata;
- int lun;
+ const struct scsi_lun *lun;
u32 datalen;
u32 scsictl;
u32 scsidir;
@@ -1298,7 +1304,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, v
int ii;
hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata;
- lun = SCpnt->device->lun;
+ lun = &SCpnt->device->lun;
SCpnt->scsi_done = done;
dmfprintk((MYIOC_s_INFO_FMT "qcmd: SCpnt=%p, done()=%p\n",
@@ -1362,7 +1368,7 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, v
pScsiReq->Reserved = 0;
pScsiReq->MsgFlags = mpt_msg_flags();
pScsiReq->LUN[0] = 0;
- pScsiReq->LUN[1] = lun;
+ pScsiReq->LUN[1] = scsilun_to_int(lun);
pScsiReq->LUN[2] = 0;
pScsiReq->LUN[3] = 0;
pScsiReq->LUN[4] = 0;
@@ -1535,7 +1541,8 @@ mptscsih_freeChainBuffers(MPT_ADAPTER *i
* Returns 0 for SUCCESS or -1 if FAILED.
*/
static int
-mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout)
+mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target,
+ const struct scsi_lun *lun, int ctx2abort, ulong timeout)
{
MPT_ADAPTER *ioc;
int rc = -1;
@@ -1656,7 +1663,8 @@ mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8
* else other non-zero value returned.
*/
static int
-mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target, u8 lun, int ctx2abort, ulong timeout)
+mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 target,
+ const struct scsi_lun *lun, int ctx2abort, ulong timeout)
{
MPT_FRAME_HDR *mf;
SCSITaskMgmt_t *pScsiTm;
@@ -1690,7 +1698,7 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd
for (ii= 0; ii < 8; ii++) {
pScsiTm->LUN[ii] = 0;
}
- pScsiTm->LUN[1] = lun;
+ pScsiTm->LUN[1] = scsilun_to_int(lun);
for (ii=0; ii < 7; ii++)
pScsiTm->Reserved2[ii] = 0;
@@ -1793,7 +1801,9 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
hd->abortSCpnt = SCpnt;
retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
- SCpnt->device->channel, SCpnt->device->id, SCpnt->device->lun,
+ sdev_channel(SCpnt->device),
+ sdev_id(SCpnt->device),
+ &SCpnt->device->lun,
ctx2abort, 2 /* 2 second timeout */);
printk (KERN_WARNING MYNAM ": %s: task abort: %s (sc=%p)\n",
@@ -1824,6 +1834,7 @@ mptscsih_dev_reset(struct scsi_cmnd * SC
{
MPT_SCSI_HOST *hd;
int retval;
+ struct scsi_lun lun0;
/* If we can't locate our host adapter structure, return FAILED status.
*/
@@ -1841,9 +1852,10 @@ mptscsih_dev_reset(struct scsi_cmnd * SC
hd->ioc->name, SCpnt);
scsi_print_command(SCpnt);
+ int_to_scsilun(0, &lun0);
retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
- SCpnt->device->channel, SCpnt->device->id,
- 0, 0, 5 /* 5 second timeout */);
+ sdev_channel(SCpnt->device), sdev_id(SCpnt->device),
+ &lun0, 0, 5 /* 5 second timeout */);
printk (KERN_WARNING MYNAM ": %s: target reset: %s (sc=%p)\n",
hd->ioc->name,
@@ -1873,6 +1885,7 @@ mptscsih_bus_reset(struct scsi_cmnd * SC
{
MPT_SCSI_HOST *hd;
int retval;
+ struct scsi_lun lun0;
/* If we can't locate our host adapter structure, return FAILED status.
*/
@@ -1890,8 +1903,10 @@ mptscsih_bus_reset(struct scsi_cmnd * SC
if (hd->timeouts < -1)
hd->timeouts++;
+ int_to_scsilun(0, &lun0);
retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS,
- SCpnt->device->channel, 0, 0, 0, 5 /* 5 second timeout */);
+ sdev_channel(SCpnt->device), 0, &lun0,
+ 0, 5 /* 5 second timeout */);
printk (KERN_WARNING MYNAM ": %s: bus reset: %s (sc=%p)\n",
hd->ioc->name,
@@ -2163,7 +2178,7 @@ mptscsih_slave_alloc(struct scsi_device
struct Scsi_Host *host = device->host;
MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
VirtDevice *vdev;
- uint target = device->id;
+ uint target = sdev_id(device);
if (hd == NULL)
return -ENODEV;
@@ -2181,15 +2196,15 @@ mptscsih_slave_alloc(struct scsi_device
memset(vdev, 0, sizeof(VirtDevice));
vdev->tflags = MPT_TARGET_FLAGS_Q_YES;
vdev->ioc_id = hd->ioc->id;
- vdev->target_id = device->id;
- vdev->bus_id = device->channel;
+ vdev->target_id = sdev_id(device);
+ vdev->bus_id = sdev_channel(device);
vdev->raidVolume = 0;
- hd->Targets[device->id] = vdev;
+ hd->Targets[sdev_id(device)] = vdev;
if (hd->ioc->bus_type == SCSI) {
- if (hd->ioc->raid_data.isRaid & (1 << device->id)) {
+ if (hd->ioc->raid_data.isRaid & (1 << sdev_id(device))) {
vdev->raidVolume = 1;
ddvtprintk((KERN_INFO
- "RAID Volume @ id %d\n", device->id));
+ "RAID Volume @ id %d\n", sdev_id(device)));
}
} else {
vdev->tflags |= MPT_TARGET_FLAGS_VALID_INQUIRY;
@@ -2211,8 +2226,8 @@ mptscsih_slave_destroy(struct scsi_devic
struct Scsi_Host *host = device->host;
MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
VirtDevice *vdev;
- uint target = device->id;
- uint lun = device->lun;
+ uint target = sdev_id(device);
+ const struct scsi_lun *lun = &device->lun;
if (hd == NULL)
return;
@@ -2220,7 +2235,7 @@ mptscsih_slave_destroy(struct scsi_devic
mptscsih_search_running_cmds(hd, target, lun);
vdev = hd->Targets[target];
- vdev->luns[0] &= ~(1 << lun);
+ vdev->luns[0] &= ~(1 << scsilun_to_int(lun));
if (--vdev->num_luns)
return;
@@ -2260,7 +2275,7 @@ mptscsih_change_queue_depth(struct scsi_
if (hd == NULL)
return 0;
- if (!(pTarget = hd->Targets[sdev->id]))
+ if (!(pTarget = hd->Targets[sdev_id(sdev)]))
return 0;
if (hd->ioc->bus_type == SCSI) {
@@ -2315,13 +2330,13 @@ mptscsih_slave_configure(struct scsi_dev
hd->ioc->name, device->sdtr, device->wdtr,
device->ppr, device->inquiry_len));
- if (device->id > sh->max_id) {
+ if (sdev_id(device) > sh->max_id) {
/* error case, should never happen */
scsi_adjust_queue_depth(device, 0, 1);
goto slave_configure_exit;
}
- pTarget = hd->Targets[device->id];
+ pTarget = hd->Targets[sdev_id(device)];
if (pTarget == NULL) {
/* Driver doesn't know about this device.
@@ -2337,7 +2352,8 @@ mptscsih_slave_configure(struct scsi_dev
goto slave_configure_exit;
}
- mptscsih_initTarget(hd, device->channel, device->id, device->lun,
+ mptscsih_initTarget(hd, sdev_channel(device), sdev_id(device),
+ &device->lun,
device->inquiry, device->inquiry_len );
mptscsih_change_queue_depth(device, MPT_SCSI_CMD_PER_DEV_HIGH);
@@ -2648,12 +2664,14 @@ mptscsih_event_process(MPT_ADAPTER *ioc,
*
*/
static void
-mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id, u8 lun, char *data, int dlen)
+mptscsih_initTarget(MPT_SCSI_HOST *hd, int bus_id, int target_id,
+ const struct scsi_lun *slun, char *data, int dlen)
{
int indexed_lun, lun_index;
VirtDevice *vdev;
SpiCfgData *pSpi;
char data_56;
+ unsigned int lun = scsilun_to_int(slun);
dinitprintk((MYIOC_s_INFO_FMT "initTarget bus=%d id=%d lun=%d hd=%p\n",
hd->ioc->name, bus_id, target_id, lun, hd));
@@ -3825,7 +3843,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTER
for (ii=0; ii < 8; ii++)
pScsiReq->LUN[ii] = 0;
- pScsiReq->LUN[1] = io->lun;
+ pScsiReq->LUN[1] = scsilun_to_int(&io->lun);
if (io->flags & MPT_ICFLAG_TAGGED_CMD)
pScsiReq->Control = cpu_to_le32(dir | MPI_SCSIIO_CONTROL_SIMPLEQ);
@@ -3927,7 +3945,6 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST
ConfigPageHeader_t header1;
int bus = 0;
int id = 0;
- int lun;
int indexed_lun, lun_index;
int hostId = ioc->pfacts[portnum].PortSCSIID;
int max_id;
@@ -4023,13 +4040,15 @@ mptscsih_synchronize_cache(MPT_SCSI_HOST
/* If target Ptr NULL or if this target is NOT a disk, skip.
*/
if ((pTarget) && (pTarget->inq_data[0] == TYPE_DISK)){
+ unsigned int lun;
+
for (lun=0; lun <= MPT_LAST_LUN; lun++) {
/* If LUN present, issue the command
*/
lun_index = (lun >> 5); /* 32 luns per lun_index */
indexed_lun = (lun % 32);
if (pTarget->luns[lun_index] & (1<<indexed_lun)) {
- iocmd.lun = lun;
+ int_to_scsilun(lun, &iocmd.lun);
(void) mptscsih_do_cmd(hd, &iocmd);
}
}
@@ -4308,8 +4327,9 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus
char firstPass = 1;
char doFallback = 0;
char readPage0;
- char bus, lun;
+ char bus;
char inq0 = 0;
+ struct scsi_lun lun;
if (ioc->spi_data.sdp1length == 0)
return 0;
@@ -4323,7 +4343,7 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus
if (id == ioc->pfacts[0].PortSCSIID)
return 0;
- lun = 0;
+ int_to_scsilun(0, &lun);
bus = (u8) bus_number;
ddvtprintk((MYIOC_s_NOTE_FMT
"DV started: bus=%d, id=%d dv @ %p\n",
@@ -4345,7 +4365,7 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus
*/
iocmd.id = id;
iocmd.bus = bus;
- iocmd.lun = lun;
+ scsilun_cp(&iocmd.lun, &lun);
iocmd.flags = 0;
iocmd.physDiskNum = -1;
iocmd.rsvd = iocmd.rsvd2 = 0;
@@ -4583,7 +4603,7 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus
mptscsih_initTarget(hd,
bus,
id,
- lun,
+ &lun,
pbuf1,
sz);
goto target_done;
@@ -4696,7 +4716,7 @@ mptscsih_doDv(MPT_SCSI_HOST *hd, int bus
mptscsih_initTarget(hd,
bus,
id,
- lun,
+ &lun,
pbuf1,
sz);
break; /* test complete */
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 51f9422..34ba8b1 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -128,6 +128,7 @@
#include <linux/blkdev.h>
#include <linux/module.h>
#include <linux/interrupt.h>
+#include <linux/device.h>
#include <asm/dma.h>
#include <asm/system.h>
#include <asm/io.h>
@@ -433,11 +434,11 @@ NCR_700_release(struct Scsi_Host *host)
}
static inline __u8
-NCR_700_identify(int can_disconnect, __u8 lun)
+NCR_700_identify(int can_disconnect, const struct scsi_lun *lun)
{
return IDENTIFY_BASE |
((can_disconnect) ? 0x40 : 0) |
- (lun & NCR_700_LUN_MASK);
+ (scsilun_to_int(lun) & NCR_700_LUN_MASK);
}
/*
@@ -796,6 +797,12 @@ process_extended_message(struct Scsi_Hos
struct scsi_cmnd *SCp, __u32 dsp, __u32 dsps)
{
__u32 resume_offset = dsp, temp = dsp + 8;
+ __u8 pun = 0xff, lun = 0xff;
+
+ if(SCp != NULL) {
+ pun = sdev_id(SCp->device);
+ lun = scsilun_to_int(&SCp->device->lun);
+ }
switch(hostdata->msgin[2]) {
case A_SDTR_MSG:
@@ -837,8 +844,8 @@ process_extended_message(struct Scsi_Hos
break;
case A_WDTR_MSG:
- dev_printk(KERN_INFO, &SCp->device->sdev_gendev,
- "Unsolicited WDTR after CMD, Rejecting\n");
+ printk(KERN_INFO "scsi%d: (%d:%d), Unsolicited WDTR after CMD, Rejecting\n",
+ host->host_no, pun, lun);
hostdata->msgout[0] = A_REJECT_MSG;
dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE);
script_patch_16(hostdata->script, MessageCount, 1);
@@ -847,8 +854,8 @@ process_extended_message(struct Scsi_Hos
break;
default:
- dev_printk(KERN_INFO, &SCp->device->sdev_gendev,
- "Unexpected message %s: ",
+ printk(KERN_INFO "scsi%d (%d:%d): Unexpected message %s: ",
+ host->host_no, pun, lun,
NCR_700_phase[(dsps & 0xf00) >> 8]);
scsi_print_msg(hostdata->msgin);
printk("\n");
@@ -870,10 +877,15 @@ process_message(struct Scsi_Host *host,
{
/* work out where to return to */
__u32 temp = dsp + 8, resume_offset = dsp;
+ __u8 pun = 0xff, lun = 0xff;
+
+ if(SCp != NULL) {
+ pun = sdev_id(SCp->device);
+ lun = scsilun_to_int(&SCp->device->lun);
+ }
#ifdef NCR_700_DEBUG
- dev_printk(KERN_INFO, &SCp->device->sdev_gendev,
- "message %s: ",
+ printk("scsi%d (%d:%d): message %s: ", host->host_no, pun, lun,
NCR_700_phase[(dsps & 0xf00) >> 8]);
scsi_print_msg(hostdata->msgin);
printk("\n");
@@ -895,36 +907,34 @@ process_message(struct Scsi_Host *host,
NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION);
} else if(SCp != NULL && NCR_700_get_tag_neg_state(SCp->device) == NCR_700_DURING_TAG_NEGOTIATION) {
/* rejected our first simple tag message */
- dev_printk(KERN_WARNING, &SCp->device->sdev_gendev,
- "Rejected first tag queue attempt, turning off tag queueing\n");
+ printk(KERN_WARNING "scsi%d (%d:%d) Rejected first tag queue attempt, turning off tag queueing\n", host->host_no, pun, lun);
/* we're done negotiating */
NCR_700_set_tag_neg_state(SCp->device, NCR_700_FINISHED_TAG_NEGOTIATION);
hostdata->tag_negotiated &= ~(1<<sdev_id(SCp->device));
SCp->device->tagged_supported = 0;
scsi_deactivate_tcq(SCp->device, host->cmd_per_lun);
} else {
- dev_printk(KERN_WARNING, &SCp->device->sdev_gendev,
- "Unexpected REJECT Message %s\n",
+ printk(KERN_WARNING "scsi%d (%d:%d) Unexpected REJECT Message %s\n",
+ host->host_no, pun, lun,
NCR_700_phase[(dsps & 0xf00) >> 8]);
/* however, just ignore it */
}
break;
case A_PARITY_ERROR_MSG:
- dev_printk(KERN_ERR, &SCp->device->sdev_gendev,
- "Parity Error!\n");
+ printk(KERN_ERR "scsi%d (%d:%d) Parity Error!\n", host->host_no,
+ pun, lun);
NCR_700_internal_bus_reset(host);
break;
case A_SIMPLE_TAG_MSG:
- dev_printk(KERN_INFO, &SCp->device->sdev_gendev,
- "SIMPLE TAG %d %s\n",
- hostdata->msgin[1],
+ printk(KERN_INFO "scsi%d (%d:%d) SIMPLE TAG %d %s\n", host->host_no,
+ pun, lun, hostdata->msgin[1],
NCR_700_phase[(dsps & 0xf00) >> 8]);
/* just ignore it */
break;
default:
- dev_printk(KERN_INFO, &SCp->device->sdev_gendev,
- "Unexpected message %s: ",
+ printk(KERN_INFO "scsi%d (%d:%d): Unexpected message %s: ",
+ host->host_no, pun, lun,
NCR_700_phase[(dsps & 0xf00) >> 8]);
scsi_print_msg(hostdata->msgin);
@@ -951,6 +961,12 @@ process_script_interrupt(__u32 dsps, __u
struct NCR_700_Host_Parameters *hostdata)
{
__u32 resume_offset = 0;
+ __u8 pun = 0xff, lun=0xff;
+
+ if(SCp != NULL) {
+ pun = sdev_id(SCp->device);
+ lun = scsilun_to_int(&SCp->device->lun);
+ }
if(dsps == A_GOOD_STATUS_AFTER_STATUS) {
DEBUG((" COMMAND COMPLETE, status=%02x\n",
@@ -968,8 +984,7 @@ process_script_interrupt(__u32 dsps, __u
if(SCp->cmnd[0] == REQUEST_SENSE) {
/* OOPS: bad device, returning another
* contingent allegiance condition */
- dev_printk(KERN_ERR, &SCp->device->sdev_gendev,
- "broken device is looping in contingent allegiance: ignoring\n");
+ printk(KERN_ERR "scsi%d (%d:%d) broken device is looping in contingent allegiance: ignoring\n", host->host_no, pun, lun);
NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]);
} else {
#ifdef NCR_DEBUG
@@ -1033,13 +1048,12 @@ process_script_interrupt(__u32 dsps, __u
// SCp->request_bufflen,
// DMA_FROM_DEVICE);
// if(((char *)SCp->request_buffer)[7] & 0x02) {
- // dev_printk(KERN_INFO, &SCp->device->sdev_gendev,
- // "Enabling Tag Command Queuing\n");
- // hostdata->tag_negotiated |= (1 << sdev_id(SCp->device));
+ // printk(KERN_INFO "scsi%d: (%d:%d) Enabling Tag Command Queuing\n", host->host_no, pun, lun);
+ // hostdata->tag_negotiated |= (1<<sdev_id(SCp->device));
// 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 << sdev_id(SCp->device));
+ // hostdata->tag_negotiated &= ~(1<<sdev_id(SCp->device));
// }
//}
NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]);
@@ -1047,8 +1061,8 @@ process_script_interrupt(__u32 dsps, __u
} else if((dsps & 0xfffff0f0) == A_UNEXPECTED_PHASE) {
__u8 i = (dsps & 0xf00) >> 8;
- dev_printk(KERN_ERR, &SCp->device->sdev_gendev,
- "UNEXPECTED PHASE %s (%s)\n",
+ printk(KERN_ERR "scsi%d: (%d:%d), UNEXPECTED PHASE %s (%s)\n",
+ host->host_no, pun, lun,
NCR_700_phase[i],
sbcl_to_string(NCR_700_readb(host, SBCL_REG)));
printk(KERN_ERR " len = %d, cmd =", SCp->cmd_len);
@@ -1058,9 +1072,8 @@ process_script_interrupt(__u32 dsps, __u
} else if((dsps & 0xfffff000) == A_FATAL) {
int i = (dsps & 0xfff);
- dev_printk(KERN_ERR, &SCp->device->sdev_gendev,
- "FATAL ERROR: %s\n",
- NCR_700_fatal_messages[i]);
+ printk(KERN_ERR "scsi%d: (%d:%d) FATAL ERROR: %s\n",
+ host->host_no, pun, lun, NCR_700_fatal_messages[i]);
if(dsps == A_FATAL_ILLEGAL_MSG_LENGTH) {
printk(KERN_ERR " msg begins %02x %02x\n",
hostdata->msgin[0], hostdata->msgin[1]);
@@ -1070,26 +1083,26 @@ process_script_interrupt(__u32 dsps, __u
#ifdef NCR_700_DEBUG
__u8 i = (dsps & 0xf00) >> 8;
- dev_printk(KERN_DEBUG, &SCp->device->sdev_gendev,
- "DISCONNECTED (%d) %s\n",
+ printk("scsi%d: (%d:%d), DISCONNECTED (%d) %s\n",
+ host->host_no, pun, lun,
i, NCR_700_phase[i]);
#endif
save_for_reselection(hostdata, SCp, dsp);
} else if(dsps == A_RESELECTION_IDENTIFIED) {
+ struct scsi_lun __lun;
__u8 lun;
struct NCR_700_command_slot *slot;
__u8 reselection_id = hostdata->reselection_id;
struct scsi_device *SDp;
- struct scsi_lun __lun;
lun = hostdata->msgin[0] & 0x1f;
- int_to_scsilun(lun, &__lun);
hostdata->reselection_id = 0xff;
DEBUG(("scsi%d: (%d:%d) RESELECTED!\n",
host->host_no, reselection_id, lun));
/* clear the reselection indicator */
+ int_to_scsilun(lun, &__lun);
SDp = __scsi_device_lookup(host, 0, reselection_id, &__lun);
if(unlikely(SDp == NULL)) {
printk(KERN_ERR "scsi%d: (%d:%d) HAS NO device\n",
@@ -1232,9 +1245,8 @@ process_script_interrupt(__u32 dsps, __u
dsp, dsps);
} else if((dsps & 0xfffff000) == 0) {
__u8 i = (dsps & 0xf0) >> 4, j = (dsps & 0xf00) >> 8;
- dev_printk(KERN_ERR, &SCp->device->sdev_gendev,
- "unhandled script condition %s %s at %04x\n",
- NCR_700_condition[i],
+ printk(KERN_ERR "scsi%d: (%d:%d), unhandled script condition %s %s at %04x\n",
+ host->host_no, pun, lun, NCR_700_condition[i],
NCR_700_phase[j], dsp - hostdata->pScript);
if(SCp != NULL) {
scsi_print_command(SCp);
@@ -1247,14 +1259,12 @@ process_script_interrupt(__u32 dsps, __u
}
NCR_700_internal_bus_reset(host);
} else if((dsps & 0xfffff000) == A_DEBUG_INTERRUPT) {
- dev_printk(KERN_NOTICE, &SCp->device->sdev_gendev,
- "DEBUG INTERRUPT %d AT %08x[%04x], continuing\n",
- dsps & 0xfff, dsp, dsp - hostdata->pScript);
+ printk(KERN_NOTICE "scsi%d (%d:%d) DEBUG INTERRUPT %d AT %08x[%04x], continuing\n",
+ host->host_no, pun, lun, dsps & 0xfff, dsp, dsp - hostdata->pScript);
resume_offset = dsp;
} else {
- dev_printk(KERN_ERR, &SCp->device->sdev_gendev,
- "unidentified script interrupt 0x%x at %04x\n",
- dsps, dsp - hostdata->pScript);
+ printk(KERN_ERR "scsi%d: (%d:%d), unidentified script interrupt 0x%x at %04x\n",
+ host->host_no, pun, lun, dsps, dsp - hostdata->pScript);
NCR_700_internal_bus_reset(host);
}
return resume_offset;
@@ -1403,7 +1413,7 @@ NCR_700_start_command(struct scsi_cmnd *
* set up so we cannot take a selection interrupt */
hostdata->msgout[0] = NCR_700_identify(SCp->cmnd[0] != REQUEST_SENSE,
- SCp->device->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 */
@@ -1415,7 +1425,7 @@ NCR_700_start_command(struct scsi_cmnd *
* If a contingent allegiance condition exists, the device
* will refuse all tags, so send the request sense as untagged
* */
- if((hostdata->tag_negotiated & (1 << sdev_id(SCp->device)))
+ if((hostdata->tag_negotiated & (1<<sdev_id(SCp->device)))
&& (slot->tag != SCSI_NO_TAG && SCp->cmnd[0] != REQUEST_SENSE)) {
count += scsi_populate_tag_msg(SCp, &hostdata->msgout[count]);
}
@@ -1434,7 +1444,7 @@ NCR_700_start_command(struct scsi_cmnd *
script_patch_ID(hostdata->script,
- Device_ID, 1 << sdev_id(SCp->device));
+ Device_ID, 1<<sdev_id(SCp->device));
script_patch_32_abs(hostdata->script, CommandAddress,
slot->pCmd);
@@ -1514,8 +1524,8 @@ NCR_700_intr(int irq, void *dev_id, stru
dsp, dsps));
if(SCp != NULL) {
- pun = SCp->device->id;
- lun = SCp->device->lun;
+ pun = sdev_id(SCp->device);
+ lun = scsilun_to_int(&SCp->device->lun);
}
if(sstat0 & SCSI_RESET_DETECTED) {
@@ -1757,16 +1767,16 @@ NCR_700_queuecommand(struct scsi_cmnd *S
* - The blk layer sent and untagged command
*/
if(NCR_700_get_depth(SCp->device) != 0
- && (!(hostdata->tag_negotiated & (1 << sdev_id(SCp->device)))
+ && (!(hostdata->tag_negotiated & (1<<sdev_id(SCp->device)))
|| !blk_rq_tagged(SCp->request))) {
DEBUG((KERN_ERR "scsi%d (%d:%d) has non zero depth %d\n",
- SCp->device->host->host_no, SCp->device->id, SCp->device->lun,
+ SCp->device->host->host_no, sdev_id(SCp->device), SCp->device->lun,
NCR_700_get_depth(SCp->device)));
return SCSI_MLQUEUE_DEVICE_BUSY;
}
if(NCR_700_get_depth(SCp->device) >= SCp->device->queue_depth) {
DEBUG((KERN_ERR "scsi%d (%d:%d) has max tag depth %d\n",
- SCp->device->host->host_no, SCp->device->id, SCp->device->lun,
+ SCp->device->host->host_no, sdev_id(SCp->device), SCp->device->lun,
NCR_700_get_depth(SCp->device)));
return SCSI_MLQUEUE_DEVICE_BUSY;
}
@@ -1789,10 +1799,11 @@ NCR_700_queuecommand(struct scsi_cmnd *S
scsi_print_command(SCp);
#endif
if(blk_rq_tagged(SCp->request)
- && (hostdata->tag_negotiated &(1 << sdev_id(SCp->device))) == 0
+ && (hostdata->tag_negotiated &(1<<sdev_id(SCp->device))) == 0
&& NCR_700_get_tag_neg_state(SCp->device) == NCR_700_START_TAG_NEGOTIATION) {
- printk(KERN_ERR "scsi%d: (%d:%d) Enabling Tag Command Queuing\n", SCp->device->host->host_no, SCp->device->id, SCp->device->lun);
- hostdata->tag_negotiated |= (1 << sdev_id(SCp->device));
+ sdev_printk(KERN_ERR, SCp->device,
+ "Enabling Tag Command Queuing\n");
+ hostdata->tag_negotiated |= (1<<sdev_id(SCp->device));
NCR_700_set_tag_neg_state(SCp->device, NCR_700_DURING_TAG_NEGOTIATION);
}
@@ -1803,16 +1814,17 @@ NCR_700_queuecommand(struct scsi_cmnd *S
* FIXME: This will royally screw up on multiple LUN devices
* */
if(!blk_rq_tagged(SCp->request)
- && (hostdata->tag_negotiated &(1 << sdev_id(SCp->device)))) {
- 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 << sdev_id(SCp->device));
+ && (hostdata->tag_negotiated &(1<<sdev_id(SCp->device)))) {
+ sdev_printk(KERN_INFO, SCp->device,
+ "Disabling Tag Command Queuing\n");
+ hostdata->tag_negotiated &= ~(1<<sdev_id(SCp->device));
}
- if((hostdata->tag_negotiated &(1 << sdev_id(SCp->device)))
+ if((hostdata->tag_negotiated &(1<<sdev_id(SCp->device)))
&& scsi_get_tag_type(SCp->device)) {
slot->tag = SCp->request->tag;
DEBUG(("53c700 %d:%d:%d, sending out tag %d, slot %p\n",
- SCp->device->host->host_no, SCp->device->id, SCp->device->lun, slot->tag,
+ SCp->device->host->host_no, sdev_id(SCp->device), SCp->device->lun, slot->tag,
slot));
} else {
slot->tag = SCSI_NO_TAG;
@@ -1913,8 +1925,8 @@ NCR_700_abort(struct 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->device->host->host_no, SCp->device->id, SCp->device->lun);
+ sdev_printk(KERN_INFO, SCp->device,
+ "New error handler wants to abort command\n\t");
scsi_print_command(SCp);
slot = (struct NCR_700_command_slot *)SCp->host_scribble;
@@ -1947,8 +1959,8 @@ NCR_700_bus_reset(struct scsi_cmnd * SCp
struct NCR_700_Host_Parameters *hostdata =
(struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0];
- printk(KERN_INFO "scsi%d (%d:%d) New error handler wants BUS reset, cmd %p\n\t",
- SCp->device->host->host_no, SCp->device->id, SCp->device->lun, SCp);
+ sdev_printk(KERN_INFO, SCp->device,
+ "New error handler wants BUS reset, cmd %p\n\t", SCp);
scsi_print_command(SCp);
/* In theory, eh_complete should always be null because the
@@ -1980,8 +1992,8 @@ NCR_700_bus_reset(struct scsi_cmnd * SCp
STATIC int
NCR_700_host_reset(struct scsi_cmnd * SCp)
{
- printk(KERN_INFO "scsi%d (%d:%d) New error handler wants HOST reset\n\t",
- SCp->device->host->host_no, SCp->device->id, SCp->device->lun);
+ sdev_printk(KERN_INFO, SCp->device,
+ "New error handler wants HOST reset\n\t");
scsi_print_command(SCp);
spin_lock_irq(SCp->device->host->host_lock);
@@ -2103,7 +2115,7 @@ static int NCR_700_change_queue_type(str
/* shift back to the default unqueued number of commands
* (the user can still raise this) */
scsi_deactivate_tcq(SDp, SDp->host->cmd_per_lun);
- hostdata->tag_negotiated &= ~(1 << SDp->id);
+ hostdata->tag_negotiated &= ~(1 << sdev_id(SDp));
} else {
/* Here, we cleared the negotiation flag above, so this
* will force the driver to renegotiate */
diff --git a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h
index 07a1ec3..e86012c 100644
--- a/drivers/scsi/53c700.h
+++ b/drivers/scsi/53c700.h
@@ -15,15 +15,15 @@
/* Turn on for general debugging---too verbose for normal use */
-#define NCR_700_DEBUG
+#undef NCR_700_DEBUG
/* Debug the tag queues, checking hash queue allocation and deallocation
* and search for duplicate tags */
#undef NCR_700_TAG_DEBUG
#ifdef NCR_700_DEBUG
-#define DEBUG(dev,args...) dev_printk(KERN_DEBUG, (dev), ## args)
+#define DEBUG(x) printk x
#else
-#define DEBUG(dev,args...)
+#define DEBUG(x)
#endif
/* The number of available command slots */
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index c34403c..b24dd8b 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -806,8 +806,8 @@ static void inia100BuildSCB(ORC_HCS * pH
pSCB->SCB_Opcode = ORC_EXECSCSI;
pSCB->SCB_Flags = SCF_NO_DCHK; /* Clear done bit */
- pSCB->SCB_Target = SCpnt->device->id;
- pSCB->SCB_Lun = SCpnt->device->lun;
+ pSCB->SCB_Target = sdev_id(SCpnt->device);
+ pSCB->SCB_Lun = scsilun_to_int(&SCpnt->device->lun);
pSCB->SCB_Reserved0 = 0;
pSCB->SCB_Reserved1 = 0;
pSCB->SCB_SGLen = 0;
@@ -847,7 +847,7 @@ static void inia100BuildSCB(ORC_HCS * pH
printk("max cdb length= %x\b", SCpnt->cmd_len);
pSCB->SCB_CDBLen = IMAX_CDB;
}
- pSCB->SCB_Ident = SCpnt->device->lun | DISC_ALLOW;
+ pSCB->SCB_Ident = scsilun_to_int(&SCpnt->device->lun) | DISC_ALLOW;
if (SCpnt->device->tagged_supported) { /* Tag Support */
pSCB->SCB_TagMsg = SIMPLE_QUEUE_TAG; /* Do simple tag only */
} else {
@@ -923,7 +923,7 @@ static int inia100_device_reset(struct s
{ /* I need Host Control Block Information */
ORC_HCS *pHCB;
pHCB = (ORC_HCS *) SCpnt->device->host->hostdata;
- return orc_device_reset(pHCB, SCpnt, SCpnt->device->id);
+ return orc_device_reset(pHCB, SCpnt, sdev_id(SCpnt->device));
}
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index dda5706..3839cf3 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -315,9 +315,9 @@
#define ERR_LEAD KERN_ERR LEAD
#define DEBUG_LEAD KERN_DEBUG LEAD
#define CMDINFO(cmd) \
- (cmd) ? ((cmd)->device->host->host_no) : -1, \
- (cmd) ? ((cmd)->device->id & 0x0f) : -1, \
- (cmd) ? ((cmd)->device->lun & 0x07) : -1
+ (cmd) ? ((cmd)->device->host->host_no) : -1, \
+ (cmd) ? (sdev_id((cmd)->device) & 0x0f) : -1, \
+ (cmd) ? (scsilun_to_int(&(cmd)->device->lun) & 0x07) : -1
#define DELAY_DEFAULT 1000
@@ -586,8 +586,8 @@ struct aha152x_scdata {
#define DATA_LEN (HOSTDATA(shpnt)->data_len)
-#define SYNCRATE (HOSTDATA(shpnt)->syncrate[CURRENT_SC->device->id])
-#define SYNCNEG (HOSTDATA(shpnt)->syncneg[CURRENT_SC->device->id])
+#define SYNCRATE (HOSTDATA(shpnt)->syncrate[sdev_id(CURRENT_SC->device)])
+#define SYNCNEG (HOSTDATA(shpnt)->syncneg[sdev_id(CURRENT_SC->device)])
#define DELAY (HOSTDATA(shpnt)->delay)
#define EXT_TRANS (HOSTDATA(shpnt)->ext_trans)
@@ -712,7 +712,8 @@ static inline Scsi_Cmnd *remove_lun_SC(S
Scsi_Cmnd *ptr, *prev;
for (ptr = *SC, prev = NULL;
- ptr && ((ptr->device->id != target) || (ptr->device->lun != lun));
+ ptr && ((sdev_id(ptr->device) != target) ||
+ (scsilun_to_int(&ptr->device->lun) != lun));
prev = ptr, ptr = SCNEXT(ptr))
;
@@ -1660,7 +1661,7 @@ static void busfree_run(struct Scsi_Host
/* clear selection timeout */
SETPORT(SSTAT1, SELTO);
- SETPORT(SCSIID, (shpnt->this_id << OID_) | CURRENT_SC->device->id);
+ SETPORT(SCSIID, (shpnt->this_id << OID_) | sdev_id(CURRENT_SC->device));
SETPORT(SXFRCTL1, (PARITY ? ENSPCHK : 0 ) | ENSTIMER);
SETPORT(SCSISEQ, ENSELO | ENAUTOATNO | (DISCONNECTED_SC ? ENRESELI : 0));
} else {
@@ -1699,7 +1700,7 @@ static void seldo_run(struct Scsi_Host *
SETPORT(SSTAT0, CLRSELDO);
- ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->device->lun));
+ ADDMSGO(IDENTIFY(RECONNECT, &CURRENT_SC->device->lun));
if (CURRENT_SC->SCp.phase & aborting) {
ADDMSGO(ABORT);
@@ -2019,7 +2020,7 @@ static void msgo_init(struct Scsi_Host *
{
if(MSGOLEN==0) {
if((CURRENT_SC->SCp.phase & syncneg) && SYNCNEG==2 && SYNCRATE==0) {
- ADDMSGO(IDENTIFY(RECONNECT, CURRENT_SC->device->lun));
+ ADDMSGO(IDENTIFY(RECONNECT, &CURRENT_SC->device->lun));
} else {
printk(INFO_LEAD "unexpected MESSAGE OUT phase; rejecting\n", CMDINFO(CURRENT_SC));
ADDMSGO(MESSAGE_REJECT);
@@ -2990,9 +2991,11 @@ static int get_command(char *pos, Scsi_C
{
char *start = pos;
int i;
+ char lunstr[SCSILUN_STR_LEN];
- SPRINTF("0x%08x: target=%d; lun=%d; cmnd=( ",
- (unsigned int) ptr, ptr->device->id, ptr->device->lun);
+ SPRINTF("0x%08x: target=%d; lun=%s; cmnd=( ",
+ (unsigned int) ptr, sdev_id(ptr->device),
+ scsilun_to_str(&ptr->device->lun, lunstr));
for (i = 0; i < COMMAND_SIZE(ptr->cmnd[0]); i++)
SPRINTF("0x%02x ", ptr->cmnd[i]);
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 9ec4641..1826d6e 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -601,8 +601,8 @@ static int aha1542_queuecommand(Scsi_Cmn
unchar ahacmd = CMD_START_SCSI;
unchar direction;
unchar *cmd = (unchar *) SCpnt->cmnd;
- unchar target = SCpnt->device->id;
- unchar lun = SCpnt->device->lun;
+ unchar target = sdev_id(SCpnt->device);
+ unchar lun = scsilun_to_int(&SCpnt->device->lun);
unsigned long flags;
void *buff = SCpnt->request_buffer;
int bufflen = SCpnt->request_bufflen;
@@ -1356,8 +1356,8 @@ static int aha1542_dev_reset(Scsi_Cmnd *
{
unsigned long flags;
struct mailbox *mb;
- unchar target = SCpnt->device->id;
- unchar lun = SCpnt->device->lun;
+ unchar target = sdev_id(SCpnt->device);
+ unchar lun = scsilun_to_int(&SCpnt->device->lun);
int mbo;
struct ccb *ccb;
unchar ahacmd = CMD_START_SCSI;
@@ -1405,7 +1405,8 @@ static int aha1542_dev_reset(Scsi_Cmnd *
*/
aha1542_out(SCpnt->device->host->io_port, &ahacmd, 1);
- printk(KERN_WARNING "aha1542.c: Trying device reset for target %d\n", SCpnt->device->id);
+ sdev_printk(KERN_WARNING, SCpnt->device,
+ "aha1542.c: Trying device reset for target\n");
return SUCCESS;
diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c
index 73f33e7..21f355c 100644
--- a/drivers/scsi/aha1740.c
+++ b/drivers/scsi/aha1740.c
@@ -347,7 +347,7 @@ static int aha1740_queuecommand(Scsi_Cmn
{
unchar direction;
unchar *cmd = (unchar *) SCpnt->cmnd;
- unchar target = SCpnt->device->id;
+ unchar target = sdev_id(SCpnt->device);
struct aha1740_hostdata *host = HOSTDATA(SCpnt->device->host);
unsigned long flags;
void *buff = SCpnt->request_buffer;
@@ -455,7 +455,7 @@ static int aha1740_queuecommand(Scsi_Cmn
DMA_BIDIRECTIONAL);
host->ecb[ecbno].dataptr = sgptr->buf_dma_addr;
}
- host->ecb[ecbno].lun = SCpnt->device->lun;
+ host->ecb[ecbno].lun = scsilun_to_int(&SCpnt->device->lun);
host->ecb[ecbno].ses = 1; /* Suppress underrun errors */
host->ecb[ecbno].dir = direction;
host->ecb[ecbno].ars = 1; /* Yes, get the sense on an error */
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index a8cfbef..5206771 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -297,7 +297,7 @@ stop_dma:
}
workreq = dev->id[c][target_id].curr_req;
#ifdef ED_DBGP
- printk(KERN_DEBUG "Channel = %d ID = %d LUN = %d CDB",c,workreq->device->id,workreq->device->lun);
+ printk(KERN_DEBUG "Channel = %d ID = %d LUN = %d CDB",c,sdev_id(workreq->device),workreq->device->lun);
for(l=0;l<workreq->cmd_len;l++)
{
printk(KERN_DEBUG " %x",workreq->cmnd[l]);
@@ -622,10 +622,10 @@ static int atp870u_queuecommand(struct s
struct atp_unit *dev;
struct Scsi_Host *host;
- c = req_p->device->channel;
+ c = sdev_channel(req_p->device);
req_p->sense_buffer[0]=0;
req_p->resid = 0;
- if (req_p->device->channel > 1) {
+ if (sdev_channel(req_p->device) > 1) {
req_p->result = 0x00040000;
done(req_p);
#ifdef ED_DBGP
@@ -640,7 +640,7 @@ static int atp870u_queuecommand(struct s
m = 1;
- m = m << req_p->device->id;
+ m = m << sdev_id(req_p->device);
/*
* Fake a timeout for missing targets
@@ -758,9 +758,9 @@ static void send_s870(struct atp_unit *d
dev->quhd[c] = 0;
}
workreq = dev->quereq[c][dev->quhd[c]];
- if (dev->id[c][workreq->device->id].curr_req == 0) {
- dev->id[c][workreq->device->id].curr_req = workreq;
- dev->last_cmd[c] = workreq->device->id;
+ if (dev->id[c][sdev_id(workreq->device)].curr_req == 0) {
+ dev->id[c][sdev_id(workreq->device)].curr_req = workreq;
+ dev->last_cmd[c] = sdev_id(workreq->device);
goto cmd_subp;
}
dev->quhd[c] = j;
@@ -791,12 +791,12 @@ oktosend:
for(i=0;i<workreq->cmd_len;i++) {
printk(" %x",workreq->cmnd[i]);
}
- printk("\nChannel = %d ID = %d LUN = %d\n",c,workreq->device->id,workreq->device->lun);
+ printk("\nChannel = %d ID = %d LUN = %d\n",c,sdev_id(workreq->device),workreq->device->lun);
#endif
if (dev->dev_id == ATP885_DEVID) {
j = inb(dev->baseport + 0x29) & 0xfe;
outb(j, dev->baseport + 0x29);
- dev->r1f[c][workreq->device->id] = 0;
+ dev->r1f[c][sdev_id(workreq->device)] = 0;
}
if (workreq->cmnd[0] == READ_CAPACITY) {
@@ -810,7 +810,7 @@ oktosend:
tmport = workport + 0x1b;
j = 0;
- target_id = workreq->device->id;
+ target_id = sdev_id(workreq->device);
/*
* Wide ?
@@ -843,7 +843,7 @@ oktosend:
outb(workreq->cmnd[i], tmport++);
}
tmport = workport + 0x0f;
- outb(workreq->device->lun, tmport);
+ outb(scsilun_to_int(&workreq->device->lun), tmport);
tmport += 0x02;
/*
* Write the target
@@ -3109,7 +3109,7 @@ static int atp870u_abort(struct scsi_cmn
host = SCpnt->device->host;
dev = (struct atp_unit *)&host->hostdata;
- c=SCpnt->device->channel;
+ c = sdev_channel(SCpnt->device);
printk(" atp870u: abort Channel = %x \n", c);
printk("working=%x last_cmd=%x ", dev->working[c], dev->last_cmd[c]);
printk(" quhdu=%x quendu=%x ", dev->quhd[c], dev->quend[c]);
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 600ba12..412881a 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -949,9 +949,10 @@ static void waiting_timeout(unsigned lon
/* Get the DCB for a given ID/LUN combination */
-static struct DeviceCtlBlk *find_dcb(struct AdapterCtlBlk *acb, u8 id, u8 lun)
+static inline struct DeviceCtlBlk *find_dcb(struct AdapterCtlBlk *acb, u8 id,
+ const struct scsi_lun *lun)
{
- return acb->children[id][lun];
+ return acb->children[id][scsilun_to_int(lun)];
}
@@ -1100,32 +1101,32 @@ static int dc395x_queue_command(struct s
struct ScsiReqBlk *srb;
struct AdapterCtlBlk *acb =
(struct AdapterCtlBlk *)cmd->device->host->hostdata;
+ unsigned int lun = scsilun_to_int(&cmd->device->lun);
dprintkdbg(DBG_0, "queue_command: (pid#%li) <%02i-%i> cmnd=0x%02x\n",
- cmd->pid, cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
+ cmd->pid, sdev_id(cmd->device), lun, cmd->cmnd[0]);
/* Assume BAD_TARGET; will be cleared later */
cmd->result = DID_BAD_TARGET << 16;
/* ignore invalid targets */
- if (cmd->device->id >= acb->scsi_host->max_id ||
- cmd->device->lun >= acb->scsi_host->max_lun ||
- cmd->device->lun >31) {
+ if (sdev_id(cmd->device) >= acb->scsi_host->max_id ||
+ lun >= acb->scsi_host->max_lun || lun > 31) {
goto complete;
}
/* does the specified lun on the specified device exist */
- if (!(acb->dcb_map[cmd->device->id] & (1 << cmd->device->lun))) {
- dprintkl(KERN_INFO, "queue_command: Ignore target <%02i-%i>\n",
- cmd->device->id, cmd->device->lun);
+ if (!(acb->dcb_map[sdev_id(cmd->device)] & (1 << lun))) {
+ sdev_printk(KERN_INFO, cmd->device,
+ "queue_command: Ignore target\n");
goto complete;
}
/* do we have a DCB for the device */
- dcb = find_dcb(acb, cmd->device->id, cmd->device->lun);
+ dcb = find_dcb(acb, sdev_id(cmd->device), &cmd->device->lun);
if (!dcb) {
/* should never happen */
- dprintkl(KERN_ERR, "queue_command: No such device <%02i-%i>",
- cmd->device->id, cmd->device->lun);
+ sdev_printk(KERN_INFO, cmd->device,
+ "queue_command: No such device\n");
goto complete;
}
@@ -1216,11 +1217,11 @@ static void dump_register_info(struct Ad
dprintkl(KERN_INFO, "dump: srb=%p cmd=%p OOOPS!\n",
srb, srb->cmd);
else
- dprintkl(KERN_INFO, "dump: srb=%p cmd=%p (pid#%li) "
- "cmnd=0x%02x <%02i-%i>\n",
+ sdev_printk(KERN_INFO, srb->cmd->device,
+ "dump: srb=%p cmd=%p (pid#%li) "
+ "cmnd=0x%02x\n",
srb, srb->cmd, srb->cmd->pid,
- srb->cmd->cmnd[0], srb->cmd->device->id,
- srb->cmd->device->lun);
+ srb->cmd->cmnd[0]);
printk(" sglist=%p cnt=%i idx=%i len=%i\n",
srb->segment_x, srb->sg_count, srb->sg_index,
srb->total_xfer_length);
@@ -1313,9 +1314,8 @@ static int __dc395x_eh_bus_reset(struct
{
struct AdapterCtlBlk *acb =
(struct AdapterCtlBlk *)cmd->device->host->hostdata;
- dprintkl(KERN_INFO,
- "eh_bus_reset: (pid#%li) target=<%02i-%i> cmd=%p\n",
- cmd->pid, cmd->device->id, cmd->device->lun, cmd);
+ sdev_printk(KERN_INFO, cmd->device,
+ "eh_bus_reset: (pid#%li) cmd=%p\n", cmd->pid, cmd);
if (timer_pending(&acb->waiting_timer))
del_timer(&acb->waiting_timer);
@@ -1381,10 +1381,10 @@ static int dc395x_eh_abort(struct scsi_c
(struct AdapterCtlBlk *)cmd->device->host->hostdata;
struct DeviceCtlBlk *dcb;
struct ScsiReqBlk *srb;
- dprintkl(KERN_INFO, "eh_abort: (pid#%li) target=<%02i-%i> cmd=%p\n",
- cmd->pid, cmd->device->id, cmd->device->lun, cmd);
+ sdev_printk(KERN_INFO, cmd->device,
+ "eh_abort: (pid#%li) cmd=%p\n", cmd->pid, cmd);
- dcb = find_dcb(acb, cmd->device->id, cmd->device->lun);
+ dcb = find_dcb(acb, sdev_id(cmd->device), &cmd->device->lun);
if (!dcb) {
dprintkl(KERN_DEBUG, "eh_abort: No such device\n");
return FAILED;
@@ -1616,10 +1616,9 @@ static u8 start_scsi(struct AdapterCtlBl
tag_number++;
}
if (tag_number >= dcb->max_command) {
- dprintkl(KERN_WARNING, "start_scsi: (pid#%li) "
- "Out of tags target=<%02i-%i>)\n",
- srb->cmd->pid, srb->cmd->device->id,
- srb->cmd->device->lun);
+ sdev_printk(KERN_WARNING, srb->cmd->device,
+ "start_scsi: (pid#%li) "
+ "Out of tags)\n", srb->cmd->pid);
srb->state = SRB_READY;
DC395x_write16(acb, TRM_S1040_SCSI_CONTROL,
DO_HWRESELECT);
@@ -1637,7 +1636,7 @@ static u8 start_scsi(struct AdapterCtlBl
/*polling:*/
/* Send CDB ..command block ......... */
dprintkdbg(DBG_KG, "start_scsi: (pid#%li) <%02i-%i> cmnd=0x%02x tag=%i\n",
- srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun,
+ srb->cmd->pid, sdev_id(srb->cmd->device), srb->cmd->device->lun,
srb->cmd->cmnd[0], srb->tag_number);
if (srb->flag & AUTO_REQSENSE) {
DC395x_write8(acb, TRM_S1040_SCSI_FIFO, REQUEST_SENSE);
@@ -2092,7 +2091,7 @@ static void data_out_phase0(struct Adapt
u16 scsi_status = *pscsi_status;
u32 d_left_counter = 0;
dprintkdbg(DBG_0, "data_out_phase0: (pid#%li) <%02i-%i>\n",
- srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun);
+ srb->cmd->pid, sdev_id(srb->cmd->device), srb->cmd->device->lun);
/*
* KG: We need to drain the buffers before we draw any conclusions!
@@ -2222,7 +2221,7 @@ static void data_out_phase1(struct Adapt
u16 *pscsi_status)
{
dprintkdbg(DBG_0, "data_out_phase1: (pid#%li) <%02i-%i>\n",
- srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun);
+ srb->cmd->pid, sdev_id(srb->cmd->device), srb->cmd->device->lun);
clear_fifo(acb, "data_out_phase1");
/* do prepare before transfer when data out phase */
data_io_transfer(acb, srb, XFERDATAOUT);
@@ -2235,7 +2234,7 @@ static void data_in_phase0(struct Adapte
u16 scsi_status = *pscsi_status;
u32 d_left_counter = 0;
dprintkdbg(DBG_0, "data_in_phase0: (pid#%li) <%02i-%i>\n",
- srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun);
+ srb->cmd->pid, sdev_id(srb->cmd->device), srb->cmd->device->lun);
/*
* KG: DataIn is much more tricky than DataOut. When the device is finished
@@ -2407,7 +2406,7 @@ static void data_in_phase1(struct Adapte
u16 *pscsi_status)
{
dprintkdbg(DBG_0, "data_in_phase1: (pid#%li) <%02i-%i>\n",
- srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun);
+ srb->cmd->pid, sdev_id(srb->cmd->device), srb->cmd->device->lun);
data_io_transfer(acb, srb, XFERDATAIN);
}
@@ -2419,7 +2418,7 @@ static void data_io_transfer(struct Adap
u8 bval;
dprintkdbg(DBG_0,
"data_io_transfer: (pid#%li) <%02i-%i> %c len=%i, sg=(%i/%i)\n",
- srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun,
+ srb->cmd->pid, sdev_id(srb->cmd->device), srb->cmd->device->lun,
((io_dir & DMACMD_DIR) ? 'r' : 'w'),
srb->total_xfer_length, srb->sg_index, srb->sg_count);
if (srb == acb->tmp_srb)
@@ -2576,7 +2575,7 @@ static void status_phase0(struct Adapter
u16 *pscsi_status)
{
dprintkdbg(DBG_0, "status_phase0: (pid#%li) <%02i-%i>\n",
- srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun);
+ srb->cmd->pid, sdev_id(srb->cmd->device), srb->cmd->device->lun);
srb->target_status = DC395x_read8(acb, TRM_S1040_SCSI_FIFO);
srb->end_message = DC395x_read8(acb, TRM_S1040_SCSI_FIFO); /* get message */
srb->state = SRB_COMPLETED;
@@ -2590,7 +2589,7 @@ static void status_phase1(struct Adapter
u16 *pscsi_status)
{
dprintkdbg(DBG_0, "status_phase1: (pid#%li) <%02i-%i>\n",
- srb->cmd->pid, srb->cmd->device->id, srb->cmd->device->lun);
+ srb->cmd->pid, sdev_id(srb->cmd->device), srb->cmd->device->lun);
srb->state = SRB_STATUS;
DC395x_write16(acb, TRM_S1040_SCSI_CONTROL, DO_DATALATCH); /* it's important for atn stop */
DC395x_write8(acb, TRM_S1040_SCSI_COMMAND, SCMD_COMP);
@@ -3122,6 +3121,7 @@ static void reselect(struct AdapterCtlBl
u16 rsel_tar_lun_id;
u8 id, lun;
u8 arblostflag = 0;
+ struct scsi_lun slun;
dprintkdbg(DBG_0, "reselect: acb=%p\n", acb);
clear_fifo(acb, "reselect");
@@ -3160,7 +3160,9 @@ static void reselect(struct AdapterCtlBl
"Got %i!\n", rsel_tar_lun_id);
id = rsel_tar_lun_id & 0xff;
lun = (rsel_tar_lun_id >> 8) & 7;
- dcb = find_dcb(acb, id, lun);
+ int_to_scsilun(lun, &slun);
+
+ dcb = find_dcb(acb, id, &slun);
if (!dcb) {
dprintkl(KERN_ERR, "reselect: From non existent device "
"<%02i-%i>\n", id, lun);
@@ -3328,7 +3330,7 @@ static void srb_done(struct AdapterCtlBl
}
dprintkdbg(DBG_1, "srb_done: (pid#%li) <%02i-%i>\n", srb->cmd->pid,
- srb->cmd->device->id, srb->cmd->device->lun);
+ sdev_id(srb->cmd->device), srb->cmd->device->lun);
dprintkdbg(DBG_SG, "srb_done: srb=%p sg=%i(%i/%i) buf=%p addr=%p\n",
srb, cmd->use_sg, srb->sg_index, srb->sg_count,
cmd->request_buffer, ptr);
@@ -3502,7 +3504,7 @@ static void srb_done(struct AdapterCtlBl
if (srb->total_xfer_length)
dprintkdbg(DBG_KG, "srb_done: (pid#%li) <%02i-%i> "
"cmnd=0x%02x Missed %i bytes\n",
- cmd->pid, cmd->device->id, cmd->device->lun,
+ cmd->pid, sdev_id(cmd->device), cmd->device->lun,
cmd->cmnd[0], srb->total_xfer_length);
}
@@ -3527,6 +3529,7 @@ static void doing_srb_done(struct Adapte
struct scsi_cmnd *cmd, u8 force)
{
struct DeviceCtlBlk *dcb;
+ char lunstr[SCSILUN_STR_LEN];
dprintkl(KERN_INFO, "doing_srb_done: pids ");
list_for_each_entry(dcb, &acb->dcb_list, list) {
@@ -3541,8 +3544,9 @@ static void doing_srb_done(struct Adapte
p = srb->cmd;
dir = p->sc_data_direction;
result = MK_RES(0, did_flag, 0, 0);
- printk("G:%li(%02i-%i) ", p->pid,
- p->device->id, p->device->lun);
+ printk("G:%li(%02i-%s) ", p->pid,
+ sdev_id(p->device),
+ scsilun_to_str(&p->device->lun, lunstr));
srb_going_remove(dcb, srb);
free_tag(dcb, srb);
srb_free_insert(acb, srb);
@@ -3571,8 +3575,8 @@ static void doing_srb_done(struct Adapte
p = srb->cmd;
result = MK_RES(0, did_flag, 0, 0);
- printk("W:%li<%02i-%i>", p->pid, p->device->id,
- p->device->lun);
+ printk("W:%li<%02i-%s>", p->pid, sdev_id(p->device),
+ scsilun_to_str(&p->device->lun, lunstr));
srb_waiting_remove(dcb, srb);
srb_free_insert(acb, srb);
p->result = result;
@@ -3681,7 +3685,7 @@ static void request_sense(struct Adapter
{
struct scsi_cmnd *cmd = srb->cmd;
dprintkdbg(DBG_1, "request_sense: (pid#%li) <%02i-%i>\n",
- cmd->pid, cmd->device->id, cmd->device->lun);
+ cmd->pid, sdev_id(cmd->device), cmd->device->lun);
srb->flag |= AUTO_REQSENSE;
srb->adapter_status = 0;
@@ -3733,7 +3737,7 @@ static void request_sense(struct Adapter
* Return the new device if succesfull or NULL on failure.
**/
static struct DeviceCtlBlk *device_alloc(struct AdapterCtlBlk *acb,
- u8 target, u8 lun)
+ u8 target, const struct scsi_lun *lun)
{
struct NvRamType *eeprom = &acb->eeprom;
u8 period_index = eeprom->target[target].period & 0x07;
@@ -3750,7 +3754,7 @@ static struct DeviceCtlBlk *device_alloc
dcb->tag_mask = 0;
dcb->max_command = 1;
dcb->target_id = target;
- dcb->target_lun = lun;
+ dcb->target_lun = scsilun_to_int(lun);
#ifndef DC395x_NO_DISCONNECT
dcb->identify_msg =
IDENTIFY(dcb->dev_mode & NTC_DO_DISCONNECT, lun);
@@ -3909,7 +3913,7 @@ static int dc395x_slave_alloc(struct scs
struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)scsi_device->host->hostdata;
struct DeviceCtlBlk *dcb;
- dcb = device_alloc(acb, scsi_device->id, scsi_device->lun);
+ dcb = device_alloc(acb, sdev_id(scsi_device), &scsi_device->lun);
if (!dcb)
return -ENOMEM;
adapter_add_device(acb, dcb);
@@ -3927,7 +3931,7 @@ static int dc395x_slave_alloc(struct scs
static void dc395x_slave_destroy(struct scsi_device *scsi_device)
{
struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)scsi_device->host->hostdata;
- struct DeviceCtlBlk *dcb = find_dcb(acb, scsi_device->id, scsi_device->lun);
+ struct DeviceCtlBlk *dcb = find_dcb(acb, sdev_id(scsi_device), &scsi_device->lun);
if (dcb)
adapter_remove_and_free_device(acb, dcb);
}
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index af68230..f7d3218 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -2248,8 +2248,8 @@ static void gdth_putq(int hanum,Scsi_Cmn
spin_lock_irqsave(&ha->smp_lock, flags);
scp->SCp.this_residual = (int)priority;
- b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
- t = scp->device->id;
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : sdev_channel(scp->device);
+ t = sdev_id(scp->device);
if (priority >= 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)) {
@@ -2308,9 +2308,9 @@ 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->device->host)->busnum : nscp->device->channel;
- t = nscp->device->id;
- l = nscp->device->lun;
+ b = virt_ctr ? NUMDATA(nscp->device->host)->busnum : sdev_channel(nscp->device);
+ t = sdev_id(nscp->device);
+ l = scsilun_to_int(&nscp->device->lun);
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))
@@ -2585,7 +2585,7 @@ static int gdth_internal_cache_cmd(int h
gdth_modep_data mpd;
ha = HADATA(gdth_ctr_tab[hanum]);
- t = scp->device->id;
+ t = sdev_id(scp->device);
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,S
ulong offset;
ha = HADATA(gdth_ctr_tab[hanum]);
- t = scp->device->id;
- l = scp->device->lun;
+ t = sdev_id(scp->device);
+ l = scsilun_to_int(&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));
@@ -3620,8 +3620,8 @@ static int gdth_sync_event(int hanum,int
printk("\n");
} else {
- b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
- t = scp->device->id;
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : sdev_channel(scp->device);
+ t = sdev_id(scp->device);
if (scp->SCp.sent_command == -1 && b != ha->virt_bus) {
ha->raw[BUS_L2P(ha,b)].io_cnt[t]--;
}
@@ -4712,14 +4712,14 @@ static int gdth_eh_bus_reset(Scsi_Cmnd *
TRACE2(("gdth_eh_bus_reset()\n"));
hanum = NUMDATA(scp->device->host)->hanum;
- b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : sdev_channel(scp->device);
ha = HADATA(gdth_ctr_tab[hanum]);
/* clear command tab */
spin_lock_irqsave(&ha->smp_lock, flags);
for (i = 0; i < GDTH_MAXCMDS; ++i) {
cmnd = ha->cmd_tab[i].cmnd;
- if (!SPECIAL_SCP(cmnd) && cmnd->device->channel == b)
+ if (!SPECIAL_SCP(cmnd) && sdev_channel(cmnd->device) == b)
ha->cmd_tab[i].cmnd = UNUSED_CMND;
}
spin_unlock_irqrestore(&ha->smp_lock, flags);
@@ -4775,8 +4775,8 @@ static int gdth_bios_param(Disk *disk,kd
capacity = disk->capacity;
#endif
hanum = NUMDATA(sd->host)->hanum;
- b = virt_ctr ? NUMDATA(sd->host)->busnum : sd->channel;
- t = sd->id;
+ b = virt_ctr ? NUMDATA(sd->host)->busnum : sdev_channel(sd);
+ t = sdev_id(sd);
TRACE2(("gdth_bios_param() ha %d bus %d target %d\n", hanum, b, t));
ha = HADATA(gdth_ctr_tab[hanum]);
@@ -5521,7 +5521,8 @@ static int gdth_ioctl(struct inode *inod
return -ENOMEM;
scp->cmd_len = 12;
scp->use_sg = 0;
- scp->device->channel = virt_ctr ? 0 : res.number;
+ /* FIXME XXX is this right? */
+ scp->device->sdev_target->channel = virt_ctr ? 0 : res.number;
rval = gdth_eh_bus_reset(scp);
res.status = (rval == SUCCESS ? S_OK : S_GENERR);
scsi_put_command(scp);
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c
index 1bd02f8..91de4b6 100644
--- a/drivers/scsi/gdth_proc.c
+++ b/drivers/scsi/gdth_proc.c
@@ -951,8 +951,8 @@ static void gdth_wait_completion(int han
for (i = 0; i < GDTH_MAXCMDS; ++i) {
scp = ha->cmd_tab[i].cmnd;
- b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
- t = scp->device->id;
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : sdev_channel(scp->device);
+ t = sdev_id(scp->device);
if (!SPECIAL_SCP(scp) && t == (unchar)id &&
b == (unchar)busnum) {
scp->SCp.have_data_in = 0;
@@ -976,8 +976,8 @@ static void gdth_stop_timeout(int hanum,
spin_lock_irqsave(&ha->smp_lock, flags);
for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) {
- b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
- t = scp->device->id;
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : sdev_channel(scp->device);
+ t = sdev_id(scp->device);
if (t == (unchar)id && b == (unchar)busnum) {
TRACE2(("gdth_stop_timeout(): update_timeout()\n"));
scp->SCp.buffers_residual = gdth_update_timeout(hanum, scp, 0);
@@ -997,8 +997,8 @@ static void gdth_start_timeout(int hanum
spin_lock_irqsave(&ha->smp_lock, flags);
for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) {
- b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scp->device->channel;
- t = scp->device->id;
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : sdev_channel(scp->device);
+ t = sdev_id(scp->device);
if (t == (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/ibmmca.c b/drivers/scsi/ibmmca.c
index 19392f6..d8a5aae 100644
--- a/drivers/scsi/ibmmca.c
+++ b/drivers/scsi/ibmmca.c
@@ -673,8 +673,9 @@ static irqreturn_t interrupt_handler(int
ld(ihost_index)[ldn].cmd = NULL;
#ifdef IM_DEBUG_TIMEOUT
if (cmd) {
- if ((cmd->target == TIMEOUT_PUN) && (cmd->device->lun == TIMEOUT_LUN)) {
- printk("IBM MCA SCSI: Ignoring interrupt from pun=%x, lun=%x.\n", cmd->target, cmd->device->lun);
+ if ((cmd->target == TIMEOUT_PUN) && (scsilun_to_int(&cmd->device->lun) == TIMEOUT_LUN)) {
+ sdev_printk(KERN_INFO, cmd->device,
+ "IBM MCA SCSI: Ignoring interrupt\n");
return IRQ_HANDLED;
}
}
@@ -1832,16 +1833,16 @@ static int ibmmca_queuecommand(Scsi_Cmnd
}
max_pun = subsystem_maxid(host_index);
if (ibm_ansi_order) {
- target = max_pun - 1 - cmd->device->id;
- if ((target <= subsystem_pun(host_index)) && (cmd->device->id <= subsystem_pun(host_index)))
+ target = max_pun - 1 - sdev_id(cmd->device);
+ if ((target <= subsystem_pun(host_index)) && (sdev_id(cmd->device) <= subsystem_pun(host_index)))
target--;
- else if ((target >= subsystem_pun(host_index)) && (cmd->device->id >= subsystem_pun(host_index)))
+ else if ((target >= subsystem_pun(host_index)) && (sdev_id(cmd->device) >= subsystem_pun(host_index)))
target++;
} else
- target = cmd->device->id;
+ target = sdev_id(cmd->device);
/* if (target,lun) is NO LUN or not existing at all, return error */
- if ((get_scsi(host_index)[target][cmd->device->lun] == TYPE_NO_LUN) || (get_scsi(host_index)[target][cmd->device->lun] == TYPE_NO_DEVICE)) {
+ if ((get_scsi(host_index)[target][scsilun_to_int(&cmd->device->lun)] == TYPE_NO_LUN) || (get_scsi(host_index)[target][scsilun_to_int(&cmd->device->lun)] == TYPE_NO_DEVICE)) {
cmd->result = DID_NO_CONNECT << 16;
if (done)
done(cmd);
@@ -1849,7 +1850,7 @@ static int ibmmca_queuecommand(Scsi_Cmnd
}
/*if (target,lun) unassigned, do further checks... */
- ldn = get_ldn(host_index)[target][cmd->device->lun];
+ ldn = get_ldn(host_index)[target][scsilun_to_int(&cmd->device->lun)];
if (ldn >= MAX_LOG_DEV) { /* on invalid ldn do special stuff */
if (ldn > MAX_LOG_DEV) { /* dynamical remapping if ldn unassigned */
current_ldn = next_ldn(host_index); /* stop-value for one circle */
@@ -1860,7 +1861,10 @@ static int ibmmca_queuecommand(Scsi_Cmnd
next_ldn(host_index) = 7;
if (current_ldn == next_ldn(host_index)) { /* One circle done ? */
/* no non-processing ldn found */
- printk("IBM MCA SCSI: Cannot assign SCSI-device dynamically!\n" " On ldn 7-14 SCSI-commands everywhere in progress.\n" " Reporting DID_NO_CONNECT for device (%d,%d).\n", target, cmd->device->lun);
+ sdev_printk(KERN_WARNING, cmd->device,
+ "IBM MCA SCSI: Cannot assign SCSI-device dynamically!\n"
+ " On ldn 7-14 SCSI-commands everywhere in progress.\n"
+ " Reporting DID_NO_CONNECT for device.\n");
cmd->result = DID_NO_CONNECT << 16; /* return no connect */
if (done)
done(cmd);
@@ -1880,26 +1884,32 @@ static int ibmmca_queuecommand(Scsi_Cmnd
/* set reduced interrupt_handler-mode for checking */
local_checking_phase_flag(host_index) = 1;
/* map found ldn to pun,lun */
- get_ldn(host_index)[target][cmd->device->lun] = next_ldn(host_index);
+ get_ldn(host_index)[target][scsilun_to_int(&cmd->device->lun)] = next_ldn(host_index);
/* change ldn to the right value, that is now next_ldn */
ldn = next_ldn(host_index);
/* unassign all ldns (pun,lun,ldn does not matter for remove) */
immediate_assign(host_index, 0, 0, 0, REMOVE_LDN);
/* set only LDN for remapped device */
- immediate_assign(host_index, target, cmd->device->lun, ldn, SET_LDN);
+ immediate_assign(host_index, target, scsilun_to_int(&cmd->device->lun), ldn, SET_LDN);
/* get device information for ld[ldn] */
if (device_exists(host_index, ldn, &ld(host_index)[ldn].block_length, &ld(host_index)[ldn].device_type)) {
ld(host_index)[ldn].cmd = NULL; /* To prevent panic set 0, because
devices that were not assigned,
should have nothing in progress. */
- get_scsi(host_index)[target][cmd->device->lun] = ld(host_index)[ldn].device_type;
+ get_scsi(host_index)[target][scsilun_to_int(&cmd->device->lun)] = ld(host_index)[ldn].device_type;
/* increase assignment counters for statistics in /proc */
IBM_DS(host_index).dynamical_assignments++;
IBM_DS(host_index).ldn_assignments[ldn]++;
- } else
+ } else {
+ char lunstr[SCSILUN_STR_LEN];
+
/* panic here, because a device, found at boottime has
vanished */
- panic("IBM MCA SCSI: ldn=0x%x, SCSI-device on (%d,%d) vanished!\n", ldn, target, cmd->device->lun);
+ panic("IBM MCA SCSI: ldn=0x%x, SCSI-device on (%d,%s) vanished!\n",
+ ldn, target,
+ scsilun_to_str(&cmd->device->lun, lunstr));
+ }
+
/* unassign again all ldns (pun,lun,ldn does not matter for remove) */
immediate_assign(host_index, 0, 0, 0, REMOVE_LDN);
/* remap all ldns, as written in the pun/lun table */
@@ -1915,7 +1925,8 @@ static int ibmmca_queuecommand(Scsi_Cmnd
local_checking_phase_flag(host_index) = 0;
#ifdef IM_DEBUG_PROBE
/* Information on syslog terminal */
- printk("IBM MCA SCSI: ldn=0x%x dynamically reassigned to (%d,%d).\n", ldn, target, cmd->device->lun);
+ sdev_printk(KERN_INFO, cmd->device,
+ "IBM MCA SCSI: ldn=0x%x dynamically reassigned to device.\n", ldn);
#endif
/* increase next_ldn for next dynamical assignment */
next_ldn(host_index)++;
@@ -2153,17 +2164,18 @@ static int __ibmmca_abort(Scsi_Cmnd * cm
}
max_pun = subsystem_maxid(host_index);
if (ibm_ansi_order) {
- target = max_pun - 1 - cmd->device->id;
- if ((target <= subsystem_pun(host_index)) && (cmd->device->id <= subsystem_pun(host_index)))
+ target = max_pun - 1 - sdev_id(cmd->device);
+ if ((target <= subsystem_pun(host_index)) && (sdev_id(cmd->device) <= subsystem_pun(host_index)))
target--;
- else if ((target >= subsystem_pun(host_index)) && (cmd->device->id >= subsystem_pun(host_index)))
+ else if ((target >= subsystem_pun(host_index)) && (sdev_id(cmd->device) >= subsystem_pun(host_index)))
target++;
} else
- target = cmd->device->id;
+ target = sdev_id(cmd->device);
/* get logical device number, and disable system interrupts */
- printk(KERN_WARNING "IBM MCA SCSI: Sending abort to device pun=%d, lun=%d.\n", target, cmd->device->lun);
- ldn = get_ldn(host_index)[target][cmd->device->lun];
+ sdev_printk(KERN_WARNING, cmd->device,
+ "IBM MCA SCSI: Sending abort to device.\n");
+ ldn = get_ldn(host_index)[target][scsilun_to_int(&cmd->device->lun)];
/*if cmd for this ldn has already finished, no need to abort */
if (!ld(host_index)[ldn].cmd) {
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 3d62c9b..269cfbe 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -893,7 +893,8 @@ static int idescsi_queue (struct scsi_cm
idescsi_pc_t *pc = NULL;
if (!drive) {
- printk (KERN_ERR "ide-scsi: drive id %d not present\n", cmd->device->id);
+ sdev_printk (KERN_ERR, cmd->device,
+ "ide-scsi: drive not present\n");
goto abort;
}
scsi = drive_to_idescsi(drive);
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index ea6f3c0..3e8e1e1 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -2893,9 +2893,9 @@ static void i91uBuildSCB(HCS * pHCB, SCB
pSCB->SCB_Srb = SCpnt;
pSCB->SCB_Opcode = ExecSCSI;
pSCB->SCB_Flags = SCF_POST; /* After SCSI done, call post routine */
- pSCB->SCB_Target = SCpnt->device->id;
- pSCB->SCB_Lun = SCpnt->device->lun;
- pSCB->SCB_Ident = SCpnt->device->lun | DISC_ALLOW;
+ pSCB->SCB_Target = sdev_id(SCpnt->device);
+ pSCB->SCB_Lun = scsilun_to_int(&SCpnt->device->lun);
+ pSCB->SCB_Ident = scsilun_to_int(&SCpnt->device->lun) | DISC_ALLOW;
pSCB->SCB_Flags |= SCF_SENSE; /* Turn on auto request sense */
dma_addr = dma_map_single(&pHCB->pci_dev->dev, SCpnt->sense_buffer,
@@ -3019,7 +3019,7 @@ static int i91u_biosparam(struct scsi_de
TCS *pTcb;
pHcb = (HCS *) sdev->host->base;
- pTcb = &pHcb->HCS_Tcs[sdev->id];
+ pTcb = &pHcb->HCS_Tcs[sdev_id(sdev)];
if (pTcb->TCS_DrvHead) {
info_array[0] = pTcb->TCS_DrvHead;
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index 9589c67..a624127 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -497,6 +497,7 @@ dc390_StartSCSI( struct dc390_acb* pACB,
struct scsi_device *sdev = scmd->device;
u8 cmd, disc_allowed, try_sync_nego;
char tag[2];
+ struct scsi_lun slun;
pSRB->ScsiPhase = SCSI_NOP0;
@@ -546,7 +547,8 @@ dc390_StartSCSI( struct dc390_acb* pACB,
pSRB->MsgCnt = 0;
cmd = SEL_W_ATN;
- DC390_write8 (ScsiFifo, IDENTIFY(disc_allowed, pDCB->TargetLUN));
+ int_to_scsilun(pDCB->TargetLUN, &slun);
+ DC390_write8 (ScsiFifo, IDENTIFY(disc_allowed, &slun));
/* Change 99/05/31: Don't use tags when not disconnecting (BUSY) */
if ((pDCB->SyncMode & EN_TAG_QUEUEING) && disc_allowed && scsi_populate_tag_msg(scmd, tag)) {
DC390_write8(ScsiFifo, tag[0]);
@@ -2077,8 +2079,8 @@ static int DC390_abort(struct scsi_cmnd
struct dc390_acb *pACB = (struct dc390_acb*) cmd->device->host->hostdata;
struct dc390_dcb *pDCB = (struct dc390_dcb*) cmd->device->hostdata;
- printk("DC390: Abort command (pid %li, Device %02i-%02i)\n",
- cmd->pid, cmd->device->id, cmd->device->lun);
+ sdev_printk(KERN_WARNING, cmd->device,
+ "DC390: Abort command (pid %li)\n", cmd->pid);
/* abort() is too stupid for already sent commands at the moment.
* If it's called we are in trouble anyway, so let's dump some info
@@ -2159,8 +2161,8 @@ static int dc390_slave_alloc(struct scsi
{
struct dc390_acb *pACB = (struct dc390_acb*) scsi_device->host->hostdata;
struct dc390_dcb *pDCB, *pDCB2 = NULL;
- uint id = scsi_device->id;
- uint lun = scsi_device->lun;
+ uint id = sdev_id(scsi_device);
+ uint lun = scsilun_to_int(&scsi_device->lun);
pDCB = kmalloc(sizeof(struct dc390_dcb), GFP_KERNEL);
if (!pDCB)
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index c84e148..31e27eb 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -583,14 +583,22 @@ int mts_scsi_queuecommand( Scsi_Cmnd *sr
struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]);
int err = 0;
int res;
+ char lunstr[SCSILUN_STR_LEN];
+
+ (void) lunstr; /* kill unused-var warning, when debug disabled */
MTS_DEBUG_GOT_HERE();
mts_show_command(srb);
mts_debug_dump(desc);
- if ( srb->device->lun || srb->device->id || srb->device->channel ) {
-
- MTS_DEBUG("Command to LUN=%d ID=%d CHANNEL=%d from SCSI layer\n",(int)srb->device->lun,(int)srb->device->id, (int)srb->device->channel );
+ if ( !scsilun_zero(&srb->device->lun) ||
+ sdev_id(srb->device) ||
+ sdev_channel(srb->device) ) {
+
+ MTS_DEBUG("Command to LUN=%s ID=%d CHANNEL=%d from SCSI layer\n",
+ scsilun_to_str(&srb->device->lun, lunstr),
+ sdev_id(srb->device),
+ sdev_channel(srb->device) );
MTS_DEBUG("this device doesn't exist\n");
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 8/n] HCIL drivers update
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
` (5 preceding siblings ...)
2005-10-24 3:49 ` [PATCH RFC 7/n] " Jeff Garzik
@ 2005-10-24 3:52 ` Jeff Garzik
2005-10-24 5:14 ` [PATCH RFC 9/n] sfoo_printk stuff merges Jeff Garzik
` (6 subsequent siblings)
13 siblings, 0 replies; 19+ messages in thread
From: Jeff Garzik @ 2005-10-24 3:52 UTC (permalink / raw)
To: linux-scsi
more sdev->{command,id,lun} work. 'make allmodconfig' succeeds now.
stuff remaining:
* drivers that aren't built anywhere (why are the they in the tree??)
* drivers not built on x86
* debug code that's disabled at compile time by default
drivers/scsi/3w-9xxx.c | 16 ++++++++++------
drivers/scsi/3w-xxxx.c | 32 +++++++++++++++++++-------------
drivers/scsi/aic7xxx_old.c | 20 +++++++++++---------
drivers/scsi/ch.c | 30 ++++++++++++++++--------------
drivers/scsi/imm.c | 2 +-
drivers/scsi/ipr.c | 29 +++++++++++++++++++++--------
drivers/scsi/ipr.h | 5 ++---
drivers/scsi/nsp32.c | 22 +++++++++++-----------
drivers/scsi/osst.c | 6 +++---
drivers/scsi/ppa.c | 2 +-
drivers/scsi/scsi_debug.c | 32 +++++++++++++++-----------------
drivers/scsi/st.c | 11 +++++------
12 files changed, 115 insertions(+), 92 deletions(-)
e3f9d8729c63bd05ec9c342dcb357b1097791912
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index a748fbf..f80becd 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -1732,7 +1732,9 @@ static int twa_scsi_eh_reset(struct scsi
tw_dev->num_resets++;
- printk(KERN_WARNING "3w-9xxx: scsi%d: WARNING: (0x%02X:0x%04X): Unit #%d: Command (0x%x) timed out, resetting card.\n", tw_dev->host->host_no, TW_DRIVER, 0x2c, SCpnt->device->id, SCpnt->cmnd[0]);
+ sdev_printk(KERN_WARNING, SCpnt->device,
+ "WARNING: (0x%02X:0x%04X): Command (0x%x) timed out, resetting card.\n",
+ TW_DRIVER, 0x2c, SCpnt->cmnd[0]);
/* Now reset the card and some of the device extension data */
if (twa_reset_device_extension(tw_dev, 0)) {
@@ -1752,7 +1754,7 @@ static int twa_scsi_queue(struct scsi_cm
TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->device->host->hostdata;
/* Check if this FW supports luns */
- if ((SCpnt->device->lun != 0) && (tw_dev->working_srl < TW_FW_SRL_LUNS_SUPPORTED)) {
+ if ((!scsilun_zero(&SCpnt->device->lun)) && (tw_dev->working_srl < TW_FW_SRL_LUNS_SUPPORTED)) {
SCpnt->result = (DID_BAD_TARGET << 16);
done(SCpnt);
retval = 0;
@@ -1823,9 +1825,9 @@ static int twa_scsiop_execute_scsi(TW_De
memcpy(command_packet->cdb, cdb, TW_MAX_CDB_LEN);
if (srb) {
- command_packet->unit = srb->device->id;
+ command_packet->unit = sdev_id(srb->device);
command_packet->request_id__lunl =
- TW_REQ_LUN_IN(srb->device->lun, request_id);
+ TW_REQ_LUN_IN(scsilun_to_int(&srb->device->lun), request_id);
} else {
command_packet->request_id__lunl =
TW_REQ_LUN_IN(0, request_id);
@@ -1850,7 +1852,8 @@ static int twa_scsiop_execute_scsi(TW_De
command_packet->sg_list[0].address = buffaddr;
command_packet->sg_list[0].length = tw_dev->srb[request_id]->request_bufflen;
}
- command_packet->sgl_entries__lunh = TW_REQ_LUN_IN((srb->device->lun >> 4), 1);
+ command_packet->sgl_entries__lunh =
+ TW_REQ_LUN_IN((scsilun_to_int(&srb->device->lun) >> 4), 1);
if (command_packet->sg_list[0].address & TW_ALIGNMENT_9000_SGL) {
TW_PRINTK(tw_dev->host, TW_DRIVER, 0x2d, "Found unaligned address during execute scsi");
@@ -1882,7 +1885,8 @@ static int twa_scsiop_execute_scsi(TW_De
}
}
}
- command_packet->sgl_entries__lunh = TW_REQ_LUN_IN((srb->device->lun >> 4), tw_dev->srb[request_id]->use_sg);
+ command_packet->sgl_entries__lunh =
+ TW_REQ_LUN_IN((scsilun_to_int(&srb->device->lun) >> 4), tw_dev->srb[request_id]->use_sg);
}
} else {
/* Internal cdb post */
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
index ae9e020..ba78f75 100644
--- a/drivers/scsi/3w-xxxx.c
+++ b/drivers/scsi/3w-xxxx.c
@@ -1432,7 +1432,9 @@ static int tw_scsi_eh_reset(struct scsi_
tw_dev->num_resets++;
- printk(KERN_WARNING "3w-xxxx: scsi%d: WARNING: Unit #%d: Command (0x%x) timed out, resetting card.\n", tw_dev->host->host_no, SCpnt->device->id, SCpnt->cmnd[0]);
+ sdev_printk(KERN_WARNING, SCpnt->device,
+ "WARNING: Command (0x%x) timed out, resetting card.\n",
+ SCpnt->cmnd[0]);
/* Now reset the card and some of the device extension data */
if (tw_reset_device_extension(tw_dev, 0)) {
@@ -1541,7 +1543,8 @@ static int tw_scsiop_inquiry_complete(TW
request_buffer[2] = 0; /* No ansi/iso compliance */
request_buffer[4] = 31; /* Additional length */
memcpy(&request_buffer[8], "3ware ", 8); /* Vendor ID */
- sprintf(&request_buffer[16], "Logical Disk %-2d ", tw_dev->srb[request_id]->device->id);
+ sprintf(&request_buffer[16], "Logical Disk %-2d ",
+ sdev_id(tw_dev->srb[request_id]->device));
memcpy(&request_buffer[32], TW_DRIVER_VERSION, 3);
tw_transfer_internal(tw_dev, request_id, request_buffer,
sizeof(request_buffer));
@@ -1553,10 +1556,10 @@ static int tw_scsiop_inquiry_complete(TW
}
is_unit_present = &(param->data[0]);
- if (is_unit_present[tw_dev->srb[request_id]->device->id] & TW_UNIT_ONLINE) {
- tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 1;
+ if (is_unit_present[sdev_id(tw_dev->srb[request_id]->device)] & TW_UNIT_ONLINE) {
+ tw_dev->is_unit_present[sdev_id(tw_dev->srb[request_id]->device)] = 1;
} else {
- tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 0;
+ tw_dev->is_unit_present[sdev_id(tw_dev->srb[request_id]->device)] = 0;
tw_dev->srb[request_id]->result = (DID_BAD_TARGET << 16);
return TW_ISR_DONT_RESULT;
}
@@ -1607,7 +1610,8 @@ static int tw_scsiop_mode_sense(TW_Devic
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]->device->id;
+ param->table_id = TW_UNIT_INFORMATION_TABLE_BASE +
+ sdev_id(tw_dev->srb[request_id]->device);
param->parameter_id = 7; /* unit flags */
param->parameter_size_bytes = 1;
param_value = tw_dev->alignment_physical_address[request_id];
@@ -1684,7 +1688,8 @@ static int tw_scsiop_read_capacity(TW_De
command_packet->opcode__sgloffset = TW_OPSGL_IN(2, TW_OP_GET_PARAM);
command_packet->size = 4;
command_packet->request_id = request_id;
- command_packet->unit__hostid = TW_UNITHOST_IN(0, tw_dev->srb[request_id]->device->id);
+ command_packet->unit__hostid =
+ TW_UNITHOST_IN(0, sdev_id(tw_dev->srb[request_id]->device));
command_packet->status = 0;
command_packet->flags = 0;
command_packet->byte6.block_count = 1;
@@ -1697,7 +1702,7 @@ static int tw_scsiop_read_capacity(TW_De
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]->device->id;
+ sdev_id(tw_dev->srb[request_id]->device);
param->parameter_id = 4; /* unitcapacity parameter */
param->parameter_size_bytes = 4;
param_value = tw_dev->alignment_physical_address[request_id];
@@ -1797,7 +1802,7 @@ static int tw_scsiop_read_write(TW_Devic
command_packet->size = 3;
command_packet->request_id = request_id;
- command_packet->unit__hostid = TW_UNITHOST_IN(0, srb->device->id);
+ command_packet->unit__hostid = TW_UNITHOST_IN(0, sdev_id(srb->device));
command_packet->status = 0;
command_packet->flags = 0;
@@ -1902,7 +1907,8 @@ static int tw_scsiop_synchronize_cache(T
command_packet->opcode__sgloffset = TW_OPSGL_IN(0, TW_OP_FLUSH_CACHE);
command_packet->size = 2;
command_packet->request_id = request_id;
- command_packet->unit__hostid = TW_UNITHOST_IN(0, tw_dev->srb[request_id]->device->id);
+ command_packet->unit__hostid =
+ TW_UNITHOST_IN(0, sdev_id(tw_dev->srb[request_id]->device));
command_packet->status = 0;
command_packet->flags = 0;
command_packet->byte6.parameter_count = 1;
@@ -1987,10 +1993,10 @@ static int tw_scsiop_test_unit_ready_com
}
is_unit_present = &(param->data[0]);
- if (is_unit_present[tw_dev->srb[request_id]->device->id] & TW_UNIT_ONLINE) {
- tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 1;
+ if (is_unit_present[sdev_id(tw_dev->srb[request_id]->device)] & TW_UNIT_ONLINE) {
+ tw_dev->is_unit_present[sdev_id(tw_dev->srb[request_id]->device)] = 1;
} else {
- tw_dev->is_unit_present[tw_dev->srb[request_id]->device->id] = 0;
+ tw_dev->is_unit_present[sdev_id(tw_dev->srb[request_id]->device)] = 0;
tw_dev->srb[request_id]->result = (DID_BAD_TARGET << 16);
return TW_ISR_DONT_RESULT;
}
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index 694a557..19240d1 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -3934,10 +3934,11 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
struct aic_dev_data *aic_dev;
unsigned short target_mask;
unsigned char target, tindex;
- const struct scsi_lun *lun;
+ struct scsi_lun slun;
unsigned char queue_flag = FALSE;
char channel;
int result;
+ unsigned int tmp_lun;
struct scsi_device *sd = NULL; /* FIXME: initializer very wrong!!! */
target = ((aic_inb(p, SAVED_TCL) >> 4) & 0x0f);
@@ -3946,7 +3947,8 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
else
channel = 0;
tindex = target + (channel << 3);
- lun = aic_inb(p, SAVED_TCL) & 0x07;
+ tmp_lun = aic_inb(p, SAVED_TCL) & 0x07;
+ int_to_scsilun(tmp_lun, &slun);
target_mask = (0x01 << tindex);
/*
@@ -4112,9 +4114,9 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
scbp = p->scb_data->scb_array[i];
if ((scbp->flags & SCB_ACTIVE) && (scbp != scb))
{
- if (aic7xxx_match_scb(p, scbp, target, channel, lun, i))
+ if (aic7xxx_match_scb(p, scbp, target, channel, &slun, i))
{
- aic7xxx_reset_device(p, target, channel, lun, i);
+ aic7xxx_reset_device(p, target, channel, &slun, i);
}
}
}
@@ -4143,7 +4145,7 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
* like our settings.
*/
aic_dev->needppr = aic_dev->needppr_copy = 0;
- aic7xxx_set_width(p, target, channel, lun, MSG_EXT_WDTR_BUS_8_BIT,
+ aic7xxx_set_width(p, target, channel, &slun, MSG_EXT_WDTR_BUS_8_BIT,
(AHC_TRANS_ACTIVE|AHC_TRANS_CUR|AHC_TRANS_QUITE), aic_dev);
aic7xxx_set_syncrate(p, NULL, target, channel, 0, 0, 0,
AHC_TRANS_ACTIVE|AHC_TRANS_CUR|AHC_TRANS_QUITE,
@@ -4183,7 +4185,7 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
*/
aic_dev->needwdtr = aic_dev->needwdtr_copy = 0;
scb->flags &= ~SCB_MSGOUT_BITS;
- aic7xxx_set_width(p, target, channel, lun, MSG_EXT_WDTR_BUS_8_BIT,
+ aic7xxx_set_width(p, target, channel, &slun, MSG_EXT_WDTR_BUS_8_BIT,
(AHC_TRANS_ACTIVE|AHC_TRANS_GOAL|AHC_TRANS_CUR), aic_dev);
aic7xxx_set_syncrate(p, NULL, target, channel, 0, 0, 0,
AHC_TRANS_ACTIVE|AHC_TRANS_CUR|AHC_TRANS_QUITE,
@@ -4366,7 +4368,7 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
{
prev_scbp = next_scbp;
next_scbp = next_scbp->q_next;
- if ( aic7xxx_match_scb(p, prev_scbp, target, channel, lun,
+ if ( aic7xxx_match_scb(p, prev_scbp, target, channel, &slun,
SCB_LIST_NULL) )
{
scbq_remove(&p->waiting_scbs, prev_scbp);
@@ -4375,7 +4377,7 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
aic_dev->active_cmds++;
}
}
- aic7xxx_search_qinfifo(p, target, channel, lun,
+ aic7xxx_search_qinfifo(p, target, channel, &slun,
SCB_LIST_NULL, SCB_QUEUED_FOR_DONE | SCB_QUEUE_FULL,
FALSE, NULL);
next_scbp = NULL;
@@ -4389,7 +4391,7 @@ aic7xxx_handle_seqint(struct aic7xxx_hos
if (scb_index < p->scb_data->numscbs)
{
next_scbp = p->scb_data->scb_array[scb_index];
- if (aic7xxx_match_scb(p, next_scbp, target, channel, lun,
+ if (aic7xxx_match_scb(p, next_scbp, target, channel, &slun,
SCB_LIST_NULL) )
{
next_scbp->flags = SCB_QUEUED_FOR_DONE | SCB_QUEUE_FULL;
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index da6e51c..4a9618a 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -270,7 +270,7 @@ ch_read_element_status(scsi_changer *ch,
retry:
memset(cmd,0,sizeof(cmd));
cmd[0] = READ_ELEMENT_STATUS;
- cmd[1] = (ch->device->lun << 5) |
+ cmd[1] = (scsilun_to_int(&ch->device->lun) << 5) |
(ch->voltags ? 0x10 : 0) |
ch_elem_to_typecode(ch,elem);
cmd[2] = (elem >> 8) & 0xff;
@@ -306,7 +306,7 @@ ch_init_elem(scsi_changer *ch)
vprintk("INITIALIZE ELEMENT STATUS, may take some time ...\n");
memset(cmd,0,sizeof(cmd));
cmd[0] = INITIALIZE_ELEMENT_STATUS;
- cmd[1] = ch->device->lun << 5;
+ cmd[1] = scsilun_to_int(&ch->device->lun) << 5;
err = ch_do_scsi(ch, cmd, NULL, 0, DMA_NONE);
vprintk("... finished\n");
return err;
@@ -327,7 +327,7 @@ ch_readconfig(scsi_changer *ch)
memset(cmd,0,sizeof(cmd));
cmd[0] = MODE_SENSE;
- cmd[1] = ch->device->lun << 5;
+ cmd[1] = scsilun_to_int(&ch->device->lun) << 5;
cmd[2] = 0x1d;
cmd[4] = 255;
result = ch_do_scsi(ch, cmd, buffer, 255, DMA_FROM_DEVICE);
@@ -407,19 +407,23 @@ ch_readconfig(scsi_changer *ch)
printk("ID/LUN unknown\n");
ch->dt[elem] = NULL;
} else {
- id = ch->device->id;
+ id = sdev_id(ch->device);
lun = 0;
if (data[6] & 0x20) id = data[7];
if (data[6] & 0x10) lun = data[6] & 7;
}
}
if (-1 != id) {
+ struct scsi_lun slun;
+
+ int_to_scsilun(lun, &slun);
+
if (verbose)
printk("ID %i, LUN %i, ",id,lun);
ch->dt[elem] =
scsi_device_lookup(ch->device->host,
- ch->device->channel,
- id,lun);
+ sdev_channel(ch->device),
+ id, &slun);
if (!ch->dt[elem]) {
/* should not happen */
if (verbose)
@@ -451,7 +455,7 @@ ch_position(scsi_changer *ch, u_int tran
trans = ch->firsts[CHET_MT];
memset(cmd,0,sizeof(cmd));
cmd[0] = POSITION_TO_ELEMENT;
- cmd[1] = ch->device->lun << 5;
+ cmd[1] = scsilun_to_int(&ch->device->lun) << 5;
cmd[2] = (trans >> 8) & 0xff;
cmd[3] = trans & 0xff;
cmd[4] = (elem >> 8) & 0xff;
@@ -470,7 +474,7 @@ ch_move(scsi_changer *ch, u_int trans, u
trans = ch->firsts[CHET_MT];
memset(cmd,0,sizeof(cmd));
cmd[0] = MOVE_MEDIUM;
- cmd[1] = ch->device->lun << 5;
+ cmd[1] = scsilun_to_int(&ch->device->lun) << 5;
cmd[2] = (trans >> 8) & 0xff;
cmd[3] = trans & 0xff;
cmd[4] = (src >> 8) & 0xff;
@@ -493,7 +497,7 @@ ch_exchange(scsi_changer *ch, u_int tran
trans = ch->firsts[CHET_MT];
memset(cmd,0,sizeof(cmd));
cmd[0] = EXCHANGE_MEDIUM;
- cmd[1] = ch->device->lun << 5;
+ cmd[1] = scsilun_to_int(&ch->device->lun) << 5;
cmd[2] = (trans >> 8) & 0xff;
cmd[3] = trans & 0xff;
cmd[4] = (src >> 8) & 0xff;
@@ -542,7 +546,7 @@ ch_set_voltag(scsi_changer *ch, u_int el
elem, tag);
memset(cmd,0,sizeof(cmd));
cmd[0] = SEND_VOLUME_TAG;
- cmd[1] = (ch->device->lun << 5) |
+ cmd[1] = (scsilun_to_int(&ch->device->lun) << 5) |
ch_elem_to_typecode(ch,elem);
cmd[2] = (elem >> 8) & 0xff;
cmd[3] = elem & 0xff;
@@ -778,7 +782,7 @@ static int ch_ioctl(struct inode * inode
voltag_retry:
memset(cmd,0,sizeof(cmd));
cmd[0] = READ_ELEMENT_STATUS;
- cmd[1] = (ch->device->lun << 5) |
+ cmd[1] = (scsilun_to_int(&ch->device->lun) << 5) |
(ch->voltags ? 0x10 : 0) |
ch_elem_to_typecode(ch,elem);
cmd[2] = (elem >> 8) & 0xff;
@@ -940,9 +944,7 @@ static int ch_probe(struct device *dev)
MKDEV(SCSI_CHANGER_MAJOR,ch->minor),
dev, "s%s", ch->name);
- printk(KERN_INFO "Attached scsi changer %s "
- "at scsi%d, channel %d, id %d, lun %d\n",
- ch->name, sd->host->host_no, sd->channel, sd->id, sd->lun);
+ sdev_printk(KERN_INFO, sd, "Attached scsi changer %s\n", ch->name);
spin_lock(&ch_devlist_lock);
list_add_tail(&ch->list,&ch_devlist);
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c
index 65e8456..8b3f1ae 100644
--- a/drivers/scsi/imm.c
+++ b/drivers/scsi/imm.c
@@ -830,7 +830,7 @@ static int imm_engine(imm_struct *dev, s
/* Phase 2 - We are now talking to the scsi bus */
case 2:
- if (!imm_select(dev, cmd->device->id)) {
+ if (!imm_select(dev, sdev_id(cmd->device))) {
imm_fail(dev, DID_NO_CONNECT);
return 0;
}
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index babd483..fdfbbeb 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -1913,11 +1913,14 @@ restart:
list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
if (res->add_to_ml) {
+ struct scsi_lun __lun;
bus = res->cfgte.res_addr.bus;
target = res->cfgte.res_addr.target;
lun = res->cfgte.res_addr.lun;
+ int_to_scsilun(lun, &__lun);
+
spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
- scsi_add_device(ioa_cfg->host, bus, target, lun);
+ scsi_add_device(ioa_cfg->host, bus, target, &__lun);
spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
goto restart;
}
@@ -2861,9 +2864,9 @@ static int ipr_slave_alloc(struct scsi_d
spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
list_for_each_entry(res, &ioa_cfg->used_res_q, queue) {
- if ((res->cfgte.res_addr.bus == sdev->channel) &&
- (res->cfgte.res_addr.target == sdev->id) &&
- (res->cfgte.res_addr.lun == sdev->lun)) {
+ if ((res->cfgte.res_addr.bus == sdev_channel(sdev)) &&
+ (res->cfgte.res_addr.target == sdev_id(sdev)) &&
+ (res->cfgte.res_addr.lun == scsilun_to_int(&sdev->lun))) {
res->sdev = sdev;
res->add_to_ml = 0;
res->in_erp = 0;
@@ -3758,7 +3761,8 @@ static void ipr_erp_start(struct ipr_ioa
* will give CC/UA the next command.
*/
if (!res->resetting_device)
- scsi_report_bus_reset(ioa_cfg->host, scsi_cmd->device->channel);
+ scsi_report_bus_reset(ioa_cfg->host,
+ sdev_channel(scsi_cmd->device));
scsi_cmd->result |= (DID_ERROR << 16);
res->needs_sync_complete = 1;
break;
@@ -5856,10 +5860,15 @@ out_disable:
static void ipr_scan_vsets(struct ipr_ioa_cfg *ioa_cfg)
{
int target, lun;
+ struct scsi_lun __lun;
for (target = 0; target < IPR_MAX_NUM_TARGETS_PER_BUS; target++)
- for (lun = 0; lun < IPR_MAX_NUM_VSET_LUNS_PER_TARGET; lun++ )
- scsi_add_device(ioa_cfg->host, IPR_VSET_BUS, target, lun);
+ for (lun = 0; lun < IPR_MAX_NUM_VSET_LUNS_PER_TARGET; lun++) {
+ int_to_scsilun(lun, &__lun);
+
+ scsi_add_device(ioa_cfg->host, IPR_VSET_BUS,
+ target, &__lun);
+ }
}
/**
@@ -5961,6 +5970,7 @@ static int __devinit ipr_probe(struct pc
{
struct ipr_ioa_cfg *ioa_cfg;
int rc;
+ struct scsi_lun lun;
rc = ipr_probe_ioa(pdev, dev_id);
@@ -6004,7 +6014,10 @@ static int __devinit ipr_probe(struct pc
scsi_scan_host(ioa_cfg->host);
ipr_scan_vsets(ioa_cfg);
- scsi_add_device(ioa_cfg->host, IPR_IOA_BUS, IPR_IOA_TARGET, IPR_IOA_LUN);
+
+ int_to_scsilun(IPR_IOA_LUN, &lun);
+ scsi_add_device(ioa_cfg->host, IPR_IOA_BUS, IPR_IOA_TARGET, &lun);
+
ioa_cfg->allow_ml_add_del = 1;
schedule_work(&ioa_cfg->work_q);
return 0;
diff --git a/drivers/scsi/ipr.h b/drivers/scsi/ipr.h
index cbff3ea..8cf9671 100644
--- a/drivers/scsi/ipr.h
+++ b/drivers/scsi/ipr.h
@@ -1114,9 +1114,8 @@ struct ipr_ucode_image_header {
#define ipr_warn(...) printk(KERN_WARNING IPR_NAME": "__VA_ARGS__)
#define ipr_dbg(...) IPR_DBG_CMD(printk(KERN_INFO IPR_NAME ": "__VA_ARGS__))
-#define ipr_sdev_printk(level, sdev, fmt, ...) \
- printk(level IPR_NAME ": %d:%d:%d:%d: " fmt, sdev->host->host_no, \
- sdev->channel, sdev->id, sdev->lun, ##__VA_ARGS__)
+#define ipr_sdev_printk(level, sdev, fmt, args...) \
+ sdev_printk(level, sdev, fmt, ## args)
#define ipr_sdev_err(sdev, fmt, ...) \
ipr_sdev_printk(KERN_ERR, sdev, fmt, ##__VA_ARGS__)
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 6367f00..c359882 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -400,7 +400,7 @@ static void nsp32_build_identify(struct
/* mode = TRUE; */
}
- data->msgoutbuf[pos] = IDENTIFY(mode, SCpnt->device->lun); pos++;
+ data->msgoutbuf[pos] = IDENTIFY(mode, &SCpnt->device->lun); pos++;
data->msgout_len = pos;
}
@@ -481,7 +481,7 @@ static int nsp32_selection_autopara(stru
nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
unsigned int base = SCpnt->device->host->io_port;
unsigned int host_id = SCpnt->device->host->this_id;
- unsigned char target = SCpnt->device->id;
+ unsigned char target = sdev_id(SCpnt->device);
nsp32_autoparam *param = data->autoparam;
unsigned char phase;
int i, ret;
@@ -612,7 +612,7 @@ static int nsp32_selection_autoscsi(stru
nsp32_hw_data *data = (nsp32_hw_data *)SCpnt->device->host->hostdata;
unsigned int base = SCpnt->device->host->io_port;
unsigned int host_id = SCpnt->device->host->this_id;
- unsigned char target = SCpnt->device->id;
+ unsigned char target = sdev_id(SCpnt->device);
unsigned char phase;
int status;
unsigned short command = 0;
@@ -961,7 +961,7 @@ static int nsp32_queuecommand(struct scs
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->device->id, SCpnt->device->lun, SCpnt->cmnd[0], SCpnt->cmd_len,
+ sdev_id(SCpnt->device), SCpnt->device->lun, SCpnt->cmnd[0], SCpnt->cmd_len,
SCpnt->use_sg, SCpnt->request_buffer, SCpnt->request_bufflen);
if (data->CurrentSC != NULL) {
@@ -973,7 +973,7 @@ static int nsp32_queuecommand(struct scs
}
/* check target ID is not same as this initiator ID */
- if (SCpnt->device->id == SCpnt->device->host->this_id) {
+ if (sdev_id(SCpnt->device) == SCpnt->device->host->this_id) {
nsp32_dbg(NSP32_DEBUG_QUEUECOMMAND, "terget==host???");
SCpnt->result = DID_BAD_TARGET << 16;
done(SCpnt);
@@ -981,7 +981,7 @@ static int nsp32_queuecommand(struct scs
}
/* check target LUN is allowable value */
- if (SCpnt->device->lun >= MAX_LUN) {
+ if (scsilun_to_int(&SCpnt->device->lun) >= MAX_LUN) {
nsp32_dbg(NSP32_DEBUG_QUEUECOMMAND, "no more lun");
SCpnt->result = DID_BAD_TARGET << 16;
done(SCpnt);
@@ -1004,13 +1004,13 @@ static int nsp32_queuecommand(struct scs
/* initialize data */
data->msgout_len = 0;
data->msgin_len = 0;
- cur_lunt = &(data->lunt[SCpnt->device->id][SCpnt->device->lun]);
+ cur_lunt = &(data->lunt[sdev_id(SCpnt->device)][scsilun_to_int(&SCpnt->device->lun)]);
cur_lunt->SCpnt = SCpnt;
cur_lunt->save_datp = 0;
cur_lunt->msgin03 = FALSE;
data->cur_lunt = cur_lunt;
- data->cur_id = SCpnt->device->id;
- data->cur_lun = SCpnt->device->lun;
+ data->cur_id = sdev_id(SCpnt->device);
+ data->cur_lun = scsilun_to_int(&SCpnt->device->lun);
ret = nsp32_setup_sg_table(SCpnt);
if (ret == FALSE) {
@@ -1028,7 +1028,7 @@ static int nsp32_queuecommand(struct scs
* (target don't have SDTR_DONE and SDTR_INITIATOR), sync
* message SDTR is needed to do synchronous transfer.
*/
- target = &data->target[SCpnt->device->id];
+ target = &data->target[sdev_id(SCpnt->device)];
data->cur_target = target;
if (!(target->sync_flag & (SDTR_DONE | SDTR_INITIATOR | SDTR_TARGET))) {
@@ -1074,7 +1074,7 @@ static int nsp32_queuecommand(struct scs
nsp32_dbg(NSP32_DEBUG_TARGETFLAG,
"target: %d sync_flag: 0x%x syncreg: 0x%x ackwidth: 0x%x",
- SCpnt->device->id, target->sync_flag, target->syncreg,
+ sdev_id(SCpnt->device), target->sync_flag, target->syncreg,
target->ackwidth);
/* Selection */
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 3f2f246..1f73d67 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -5817,9 +5817,9 @@ static int osst_probe(struct device *dev
}
drive->number = devfs_register_tape(SDp->devfs_name);
- printk(KERN_INFO
- "osst :I: Attached OnStream %.5s tape at scsi%d, channel %d, id %d, lun %d as %s\n",
- SDp->model, SDp->host->host_no, SDp->channel, SDp->id, SDp->lun, tape_name(tpnt));
+ sdev_printk(KERN_INFO, SDp,
+ "osst :I: Attached OnStream %.5s tape as %s\n",
+ SDp->model, tape_name(tpnt));
return 0;
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
index fafcf5d..8dc3344 100644
--- a/drivers/scsi/ppa.c
+++ b/drivers/scsi/ppa.c
@@ -740,7 +740,7 @@ static int ppa_engine(ppa_struct *dev, s
}
case 2: /* Phase 2 - We are now talking to the scsi bus */
- if (!ppa_select(dev, cmd->device->id)) {
+ if (!ppa_select(dev, sdev_id(cmd->device))) {
ppa_fail(dev, DID_NO_CONNECT);
return 0;
}
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 322b5a4..2e1dc43 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -283,7 +283,7 @@ int scsi_debug_queuecommand(struct scsi_
unsigned char *cmd = (unsigned char *) SCpnt->cmnd;
int block, upper_blk, num, k;
int errsts = 0;
- int target = SCpnt->device->id;
+ int target = sdev_id(SCpnt->device);
struct sdebug_dev_info * devip = NULL;
int inj_recovered = 0;
@@ -303,7 +303,7 @@ int scsi_debug_queuecommand(struct scsi_
DID_NO_CONNECT << 16, 0);
}
- if (SCpnt->device->lun >= scsi_debug_max_luns)
+ if (scsilun_to_int(&SCpnt->device->lun) >= scsi_debug_max_luns)
return schedule_resp(SCpnt, NULL, done,
DID_NO_CONNECT << 16, 0);
devip = devInfoReg(SCpnt->device);
@@ -1008,8 +1008,7 @@ static void timer_intr_handler(unsigned
static int scsi_debug_slave_alloc(struct scsi_device * sdp)
{
if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
- printk(KERN_INFO "scsi_debug: slave_alloc <%u %u %u %u>\n",
- sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
+ sdev_printk(KERN_INFO, sdp, "scsi_debug: slave_alloc\n");
return 0;
}
@@ -1018,8 +1017,7 @@ static int scsi_debug_slave_configure(st
struct sdebug_dev_info * devip;
if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
- printk(KERN_INFO "scsi_debug: slave_configure <%u %u %u %u>\n",
- sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
+ sdev_printk(KERN_INFO, sdp, "scsi_debug: slave_configure\n");
if (sdp->host->max_cmd_len != SCSI_DEBUG_MAX_CMD_LEN)
sdp->host->max_cmd_len = SCSI_DEBUG_MAX_CMD_LEN;
devip = devInfoReg(sdp);
@@ -1036,8 +1034,7 @@ static void scsi_debug_slave_destroy(str
(struct sdebug_dev_info *)sdp->hostdata;
if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
- printk(KERN_INFO "scsi_debug: slave_destroy <%u %u %u %u>\n",
- sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
+ sdev_printk(KERN_INFO, sdp, "scsi_debug: slave_destroy\n");
if (devip) {
/* make this slot avaliable for re-use */
devip->used = 0;
@@ -1060,9 +1057,10 @@ static struct sdebug_dev_info * devInfoR
return NULL;
}
list_for_each_entry(devip, &sdbg_host->dev_info_list, dev_list) {
- if ((devip->used) && (devip->channel == sdev->channel) &&
- (devip->target == sdev->id) &&
- (devip->lun == sdev->lun))
+ if ((devip->used) &&
+ (devip->channel == sdev_channel(sdev)) &&
+ (devip->target == sdev_id(sdev)) &&
+ (devip->lun == scsilun_to_int(&sdev->lun)))
return devip;
else {
if ((!devip->used) && (!open_devip))
@@ -1082,9 +1080,9 @@ static struct sdebug_dev_info * devInfoR
&sdbg_host->dev_info_list);
}
if (open_devip) {
- open_devip->channel = sdev->channel;
- open_devip->target = sdev->id;
- open_devip->lun = sdev->lun;
+ open_devip->channel = sdev_channel(sdev);
+ open_devip->target = sdev_id(sdev);
+ open_devip->lun = scsilun_to_int(&sdev->lun);
open_devip->sdbg_host = sdbg_host;
open_devip->reset = 1;
open_devip->used = 1;
@@ -1326,9 +1324,9 @@ static int schedule_resp(struct scsi_cmn
if (scsi_result) {
struct scsi_device * sdp = cmnd->device;
- printk(KERN_INFO "scsi_debug: <%u %u %u %u> "
- "non-zero result=0x%x\n", sdp->host->host_no,
- sdp->channel, sdp->id, sdp->lun, scsi_result);
+ sdev_printk(KERN_INFO, sdp,
+ "non-zero result=0x%x\n",
+ scsi_result);
}
}
if (cmnd && devip) {
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index d001c04..f2807cc 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3885,9 +3885,8 @@ static int st_probe(struct device *dev)
if (SDp->type != TYPE_TAPE)
return -ENODEV;
if ((stp = st_incompatible(SDp))) {
- printk(KERN_INFO
- "st: Found incompatible tape at scsi%d, channel %d, id %d, lun %d\n",
- SDp->host->host_no, SDp->channel, SDp->id, SDp->lun);
+ sdev_printk(KERN_INFO, SDp,
+ "st: Found incompatible tape\n");
printk(KERN_INFO "st: The suggested driver is %s.\n", stp);
return -ENODEV;
}
@@ -4075,9 +4074,9 @@ static int st_probe(struct device *dev)
}
disk->number = devfs_register_tape(SDp->devfs_name);
- printk(KERN_WARNING
- "Attached scsi tape %s at scsi%d, channel %d, id %d, lun %d\n",
- tape_name(tpnt), SDp->host->host_no, SDp->channel, SDp->id, SDp->lun);
+ sdev_printk(KERN_WARNING, SDp, "Attached scsi tape %s\n",
+ tape_name(tpnt));
+
printk(KERN_WARNING "%s: try direct i/o: %s (alignment %d B), max page reachable by HBA %lu\n",
tape_name(tpnt), tpnt->try_dio ? "yes" : "no",
queue_dma_alignment(SDp->request_queue) + 1, tpnt->max_pfn);
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH RFC 4/2] HCIL drivers update; sdev_printk
2005-10-24 3:36 ` James Bottomley
@ 2005-10-24 4:01 ` Jeff Garzik
0 siblings, 0 replies; 19+ messages in thread
From: Jeff Garzik @ 2005-10-24 4:01 UTC (permalink / raw)
To: James Bottomley; +Cc: linux-scsi
James Bottomley wrote:
> On Sun, 2005-10-23 at 17:40 -0400, Jeff Garzik wrote:
>
>>Yet more driver work. Some bugs added (and noted).
>>
>>Added sdev_printk() to save typing.
>
>
> If you can unify this with the sdev_prink work here
>
> http://marc.theaimsgroup.com/?l=linux-scsi&m=112827155625203
>
> This can probably be applied independently
Is this in a git tree somewhere?
Jeff
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH RFC 9/n] sfoo_printk stuff merges
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
` (6 preceding siblings ...)
2005-10-24 3:52 ` [PATCH RFC 8/n] " Jeff Garzik
@ 2005-10-24 5:14 ` Jeff Garzik
2005-10-24 8:15 ` [PATCH RFC 10/n] HCIL drivers update Jeff Garzik
` (5 subsequent siblings)
13 siblings, 0 replies; 19+ messages in thread
From: Jeff Garzik @ 2005-10-24 5:14 UTC (permalink / raw)
To: linux-scsi, James Bottomley
Went ahead and merged your (James's) sfoo_printk patch into my
working repo.
Since referencing cmd->device is a hugely common idiom, I made two new
wrappers: scmd_printk() and scmd_id().
drivers/scsi/constants.c | 2 +-
drivers/scsi/hosts.c | 2 +-
drivers/scsi/scsi.c | 6 +++---
drivers/scsi/scsi_error.c | 5 ++---
drivers/scsi/scsi_lib.c | 6 +++---
drivers/scsi/scsi_transport_fc.c | 2 --
drivers/scsi/scsi_transport_spi.c | 22 ++++++++++------------
drivers/scsi/sd.c | 3 +--
drivers/scsi/sr.c | 11 ++++++-----
drivers/scsi/st.c | 7 +++----
include/scsi/scsi_device.h | 14 +++++++++++---
include/scsi/scsi_host.h | 4 ++++
12 files changed, 45 insertions(+), 39 deletions(-)
2ce012dc6c227831bdf4ab0da0d70807ec8a2ef5
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
index 553fb00..8bd936b 100644
--- a/drivers/scsi/constants.c
+++ b/drivers/scsi/constants.c
@@ -1389,7 +1389,7 @@ EXPORT_SYMBOL(scsi_print_msg);
void scsi_print_command(struct scsi_cmnd *cmd)
{
/* Assume appended output (i.e. not at start of line) */
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev, "command: ");
+ scmd_printk(KERN_INFO, cmd, "command:\n\t");
scsi_print_cdb(cmd->cmnd, cmd->cmd_len, 0);
}
EXPORT_SYMBOL(scsi_print_command);
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 02fe371..e2f247e 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -139,7 +139,7 @@ int scsi_host_set_state(struct Scsi_Host
illegal:
SCSI_LOG_ERROR_RECOVERY(1,
- dev_printk(KERN_ERR, &shost->shost_gendev,
+ shost_printk(KERN_ERR, shost,
"Illegal host state transition"
"%s->%s\n",
scsi_host_state_name(oldstate),
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index f710de0..6d29f3c 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -410,7 +410,7 @@ void scsi_log_send(struct scsi_cmnd *cmd
SCSI_LOG_MLQUEUE_BITS);
if (level > 1) {
sdev = cmd->device;
- sdev_printk(KERN_INFO, sdev, "scsi send ");
+ sdev_printk(KERN_INFO, sdev, "send ");
if (level > 2)
printk("0x%p ", cmd);
/*
@@ -454,7 +454,7 @@ void scsi_log_completion(struct scsi_cmn
if (((level > 0) && (cmd->result || disposition != SUCCESS)) ||
(level > 1)) {
sdev = cmd->device;
- sdev_printk(KERN_INFO, sdev, "scsi done ");
+ sdev_printk(KERN_INFO, sdev, "done ");
if (level > 2)
printk("0x%p ", cmd);
/*
@@ -808,7 +808,7 @@ static void scsi_softirq(struct softirq_
disposition = scsi_decide_disposition(cmd);
if (disposition != SUCCESS &&
time_before(cmd->jiffies_at_alloc + wait_for, jiffies)) {
- sdev_printk(KERN_ERR, cmd->device,
+ scmd_printk(KERN_ERR, cmd,
"timing out command, waited %lus\n",
wait_for/HZ);
disposition = SUCCESS;
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 867cc84..59e0f38 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1177,7 +1177,7 @@ static void scsi_eh_offline_sdevs(struct
struct scsi_cmnd *scmd, *next;
list_for_each_entry_safe(scmd, next, work_q, eh_entry) {
- sdev_printk(KERN_INFO, scmd->device,
+ scmd_printk(KERN_INFO, scmd,
"Device offlined - not"
" ready after error recovery\n");
scsi_device_set_state(scmd->device, SDEV_OFFLINE);
@@ -1341,8 +1341,7 @@ int scsi_decide_disposition(struct scsi_
return SUCCESS;
case RESERVATION_CONFLICT:
- sdev_printk(KERN_INFO, scmd->device,
- "reservation conflict\n");
+ scmd_printk(KERN_INFO, scmd, "reservation conflict\n");
return SUCCESS; /* causes immediate i/o error */
default:
return FAILED;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index a8ccffa..3543a8a 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -951,13 +951,13 @@ void scsi_io_completion(struct scsi_cmnd
return;
}
if (!(req->flags & REQ_QUIET))
- sdev_printk(KERN_INFO, cmd->device,
+ scmd_printk(KERN_INFO, cmd,
"Device not ready.\n");
scsi_end_request(cmd, 0, this_count, 1);
return;
case VOLUME_OVERFLOW:
if (!(req->flags & REQ_QUIET)) {
- sdev_printk(KERN_INFO, cmd->device,
+ scmd_printk(KERN_INFO, cmd,
"Volume overflow, CDB: ");
__scsi_print_command(cmd->data_cmnd);
scsi_print_sense("", cmd);
@@ -979,7 +979,7 @@ void scsi_io_completion(struct scsi_cmnd
}
if (result) {
if (!(req->flags & REQ_QUIET)) {
- sdev_printk(KERN_INFO, cmd->device,
+ scmd_printk(KERN_INFO, cmd,
"SCSI error: return code = 0x%x\n", result);
if (driver_byte(result) & DRIVER_SENSE)
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index f811ecf..cd4d987 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -32,8 +32,6 @@
#include <scsi/scsi_transport_fc.h>
#include "scsi_priv.h"
-#define FC_PRINTK(x, l, f, a...) printk(l "scsi(%d:%d:%d:%d): " f, (x)->host->host_no, (x)->channel, (x)->id, (x)->lun , ##a)
-
/*
* Redefine so that we can have same named attributes in the
* sdev/starget/host objects.
diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index 2d83310..718a2bc 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -33,8 +33,6 @@
#include <scsi/scsi_transport.h>
#include <scsi/scsi_transport_spi.h>
-#define SPI_PRINTK(x, l, f, a...) dev_printk(l, &(x)->dev, f , ##a)
-
#define SPI_NUM_ATTRS 14 /* increase this if you add attributes */
#define SPI_OTHER_ATTRS 1 /* Increase this if you add "always
* on" attributes */
@@ -702,10 +700,10 @@ spi_dv_retrain(struct scsi_device *sdev,
* IU, then QAS (if we can control them), then finally
* fall down the periods */
if (i->f->set_iu && spi_iu(starget)) {
- SPI_PRINTK(starget, KERN_ERR, "Domain Validation Disabing Information Units\n");
+ starget_printk(KERN_ERR, starget, "Domain Validation Disabing Information Units\n");
DV_SET(iu, 0);
} else if (i->f->set_qas && spi_qas(starget)) {
- SPI_PRINTK(starget, KERN_ERR, "Domain Validation Disabing Quick Arbitration and Selection\n");
+ starget_printk(KERN_ERR, starget, "Domain Validation Disabing Quick Arbitration and Selection\n");
DV_SET(qas, 0);
} else {
newperiod = spi_period(starget);
@@ -717,11 +715,11 @@ spi_dv_retrain(struct scsi_device *sdev,
if (unlikely(period > 0xff || period == prevperiod)) {
/* Total failure; set to async and return */
- SPI_PRINTK(starget, KERN_ERR, "Domain Validation Failure, dropping back to Asynchronous\n");
+ starget_printk(KERN_ERR, starget, "Domain Validation Failure, dropping back to Asynchronous\n");
DV_SET(offset, 0);
return SPI_COMPARE_FAILURE;
}
- SPI_PRINTK(starget, KERN_ERR, "Domain Validation detected failure, dropping back\n");
+ starget_printk(KERN_ERR, starget, "Domain Validation detected failure, dropping back\n");
DV_SET(period, period);
prevperiod = period;
}
@@ -788,7 +786,7 @@ spi_dv_device_internal(struct scsi_devic
if (spi_dv_device_compare_inquiry(sdev, buffer, buffer, DV_LOOPS)
!= SPI_COMPARE_SUCCESS) {
- SPI_PRINTK(starget, KERN_ERR, "Domain Validation Initial Inquiry Failed\n");
+ starget_printk(KERN_ERR, starget, "Domain Validation Initial Inquiry Failed\n");
/* FIXME: should probably offline the device here? */
return;
}
@@ -802,7 +800,7 @@ spi_dv_device_internal(struct scsi_devic
buffer + len,
DV_LOOPS)
!= SPI_COMPARE_SUCCESS) {
- SPI_PRINTK(starget, KERN_ERR, "Wide Transfers Fail\n");
+ starget_printk(KERN_ERR, starget, "Wide Transfers Fail\n");
i->f->set_width(starget, 0);
}
}
@@ -844,14 +842,14 @@ spi_dv_device_internal(struct scsi_devic
}
if (len == 0) {
- SPI_PRINTK(starget, KERN_INFO, "Domain Validation skipping write tests\n");
+ starget_printk(KERN_INFO, starget, "Domain Validation skipping write tests\n");
spi_dv_retrain(sdev, buffer, buffer + len,
spi_dv_device_compare_inquiry);
return;
}
if (len > SPI_MAX_ECHO_BUFFER_SIZE) {
- SPI_PRINTK(starget, KERN_WARNING, "Echo buffer size %d is too big, trimming to %d\n", len, SPI_MAX_ECHO_BUFFER_SIZE);
+ starget_printk(KERN_WARNING, starget, "Echo buffer size %d is too big, trimming to %d\n", len, SPI_MAX_ECHO_BUFFER_SIZE);
len = SPI_MAX_ECHO_BUFFER_SIZE;
}
@@ -902,11 +900,11 @@ spi_dv_device(struct scsi_device *sdev)
spi_dv_pending(starget) = 1;
down(&spi_dv_sem(starget));
- SPI_PRINTK(starget, KERN_INFO, "Beginning Domain Validation\n");
+ starget_printk(KERN_INFO, starget, "Beginning Domain Validation\n");
spi_dv_device_internal(sdev, buffer);
- SPI_PRINTK(starget, KERN_INFO, "Ending Domain Validation\n");
+ starget_printk(KERN_INFO, starget, "Ending Domain Validation\n");
up(&spi_dv_sem(starget));
spi_dv_pending(starget) = 0;
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 7c83923..d4abb09 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1608,8 +1608,7 @@ static int sd_probe(struct device *dev)
add_disk(gd);
sdev_printk(KERN_NOTICE, sdp, "Attached scsi %sdisk %s\n",
- sdp->removable ? "removable " : "",
- gd->disk_name);
+ sdp->removable ? "removable " : "", gd->disk_name);
return 0;
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index eb56d79..3bf06fb 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -360,7 +360,7 @@ static int sr_init_command(struct scsi_c
}
if (s_size != 512 && s_size != 1024 && s_size != 2048) {
- printk("sr: bad sector size %d\n", s_size);
+ scmd_printk(KERN_ERR, SCpnt, "bad sector size %d\n", s_size);
return 0;
}
@@ -385,8 +385,9 @@ static int sr_init_command(struct scsi_c
size += sg[i].length;
if (size != SCpnt->request_bufflen && SCpnt->use_sg) {
- printk(KERN_ERR "sr: mismatch count %d, bytes %d\n",
- size, SCpnt->request_bufflen);
+ scmd_printk(KERN_ERR, SCpnt,
+ "mismatch count %d, bytes %d\n",
+ size, SCpnt->request_bufflen);
if (SCpnt->request_bufflen > size)
SCpnt->request_bufflen = SCpnt->bufflen = size;
}
@@ -397,7 +398,7 @@ static int sr_init_command(struct scsi_c
*/
if (((unsigned int)SCpnt->request->sector % (s_size >> 9)) ||
(SCpnt->request_bufflen % s_size)) {
- printk("sr: unaligned transfer\n");
+ scmd_printk(KERN_NOTICE, SCpnt, "unaligned transfer\n");
return 0;
}
@@ -623,7 +624,7 @@ static int sr_probe(struct device *dev)
add_disk(disk);
sdev_printk(KERN_DEBUG, sdev,
- "Attached scsi CD-ROM %s\n", cd->cdi.name);
+ "Attached scsi CD-ROM %s\n", cd->cdi.name);
return 0;
fail_put:
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index f2807cc..1e8ccbe 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -3885,8 +3885,7 @@ static int st_probe(struct device *dev)
if (SDp->type != TYPE_TAPE)
return -ENODEV;
if ((stp = st_incompatible(SDp))) {
- sdev_printk(KERN_INFO, SDp,
- "st: Found incompatible tape\n");
+ sdev_printk(KERN_INFO, SDp, "Found incompatible tape\n");
printk(KERN_INFO "st: The suggested driver is %s.\n", stp);
return -ENODEV;
}
@@ -4074,8 +4073,8 @@ static int st_probe(struct device *dev)
}
disk->number = devfs_register_tape(SDp->devfs_name);
- sdev_printk(KERN_WARNING, SDp, "Attached scsi tape %s\n",
- tape_name(tpnt));
+ sdev_printk(KERN_WARNING, SDp,
+ "Attached scsi tape %s\n", tape_name(tpnt));
printk(KERN_WARNING "%s: try direct i/o: %s (alignment %d B), max page reachable by HBA %lu\n",
tape_name(tpnt), tpnt->try_dio ? "yes" : "no",
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 986a59d..140e27b 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -149,6 +149,12 @@ struct scsi_device {
#define transport_class_to_sdev(class_dev) \
to_scsi_device(class_dev->dev)
+#define sdev_printk(prefix, sdev, fmt, a...) \
+ dev_printk(prefix, &(sdev)->sdev_gendev, fmt, ##a)
+
+#define scmd_printk(prefix, scmd, fmt, a...) \
+ dev_printk(prefix, &(scmd)->device->sdev_gendev, fmt, ##a)
+
/*
* scsi_target: representation of a scsi target, for now, this is only
* used for single_lun devices. If no one has active IO to the target,
@@ -178,6 +184,9 @@ static inline struct scsi_target *scsi_t
#define transport_class_to_starget(class_dev) \
to_scsi_target(class_dev->dev)
+#define starget_printk(prefix, starget, fmt, a...) \
+ dev_printk(prefix, &(starget)->dev, fmt, ##a)
+
extern struct scsi_device *__scsi_add_device(struct Scsi_Host *,
uint, uint, const struct scsi_lun *, void *hostdata);
extern int scsi_add_device(struct Scsi_Host *host, uint channel,
@@ -268,9 +277,6 @@ extern int scsi_execute_req(struct scsi_
int data_direction, void *buffer, unsigned bufflen,
struct scsi_sense_hdr *, int timeout, int retries);
-#define sdev_printk(loglevel, scsidev, fmt, args...) \
- dev_printk(loglevel, &(scsidev)->sdev_gendev, fmt, ## args)
-
static inline unsigned int sdev_channel(struct scsi_device *sdev)
{
return sdev->sdev_target->channel;
@@ -281,6 +287,8 @@ static inline unsigned int sdev_id(struc
return sdev->sdev_target->id;
}
+#define scmd_id(scmd) sdev_id((scmd)->device)
+
static inline char *scsilun_to_str(const struct scsi_lun *lun, char *s)
{
sprintf(s, "%d", scsilun_to_int(lun));
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index e5a276c..35691ee 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -614,6 +614,10 @@ struct Scsi_Host {
#define class_to_shost(d) \
container_of(d, struct Scsi_Host, shost_classdev)
+#define shost_printk(prefix, shost, fmt, a...) \
+ dev_printk(prefix, &(shost)->shost_gendev, fmt, ##a)
+
+
int scsi_is_host_device(const struct device *);
static inline struct Scsi_Host *dev_to_shost(struct device *dev)
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH RFC 7/n] HCIL drivers update
2005-10-24 3:49 ` [PATCH RFC 7/n] " Jeff Garzik
@ 2005-10-24 6:43 ` Stefan Richter
0 siblings, 0 replies; 19+ messages in thread
From: Stefan Richter @ 2005-10-24 6:43 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-scsi
Jeff Garzik wrote:
> More sdev->{command,id,lun} work. DO NOT APPLY.
...
> diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
> index 12cec7c..87d381d 100644
> --- a/drivers/ieee1394/sbp2.c
> +++ b/drivers/ieee1394/sbp2.c
> @@ -2513,7 +2513,7 @@ static int sbp2scsi_queuecommand(struct
> * Until we handle multiple luns, just return selection time-out
> * to any IO directed at non-zero LUNs
> */
> - if (SCpnt->device->lun)
> + if (!scsilun_zero(&SCpnt->device->lun))
> goto done;
>
> /*
and
@@ somewhere @@ static int sbp2_start_device(
- error = scsi_add_device(scsi_id->scsi_host, 0, scsi_id->ud->id, 0);
+ const struct scsi_lun slun = {{0,0,0,0,0,0,0,0}};
+ error = scsi_add_device(scsi_id->scsi_host, 0, scsi_id->ud->id, &slun);
or something like that. I wonder whether something else than scsi_add_device()
should be used though.
Once better multi LU support is implemented in sbp2, the 2-byte SBP-2 LUN
can be converted into a SAM LUN.
--
Stefan Richter
-=====-=-=-= =-=- ==---
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH RFC 10/n] HCIL drivers update
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
` (7 preceding siblings ...)
2005-10-24 5:14 ` [PATCH RFC 9/n] sfoo_printk stuff merges Jeff Garzik
@ 2005-10-24 8:15 ` Jeff Garzik
2005-10-24 8:16 ` [PATCH RFC 11/n] " Jeff Garzik
` (4 subsequent siblings)
13 siblings, 0 replies; 19+ messages in thread
From: Jeff Garzik @ 2005-10-24 8:15 UTC (permalink / raw)
To: linux-scsi
Replace sdev_id(cmd->device) with scmd_id(cmd).
[patch too large for list, and is completely obvious]
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH RFC 11/n] HCIL drivers update
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
` (8 preceding siblings ...)
2005-10-24 8:15 ` [PATCH RFC 10/n] HCIL drivers update Jeff Garzik
@ 2005-10-24 8:16 ` Jeff Garzik
2005-10-24 8:17 ` [PATCH RFC 12/n] " Jeff Garzik
` (3 subsequent siblings)
13 siblings, 0 replies; 19+ messages in thread
From: Jeff Garzik @ 2005-10-24 8:16 UTC (permalink / raw)
To: linux-scsi
Replace sdev_channel(cmd->device) with scmd_channel(cmd).
drivers/block/cciss_scsi.c | 3 +--
drivers/message/fusion/mptscsih.c | 7 +++----
drivers/scsi/aacraid/aachba.c | 8 ++++----
drivers/scsi/aic7xxx/aic79xx_osm.c | 10 +++++-----
drivers/scsi/aic7xxx/aic7xxx_osm.c | 20 ++++++++++----------
drivers/scsi/aic7xxx_old.c | 24 ++++++++++++------------
drivers/scsi/atp870u.c | 6 +++---
drivers/scsi/dpt_i2o.c | 8 ++++----
drivers/scsi/eata.c | 12 ++++++------
drivers/scsi/gdth.c | 10 +++++-----
drivers/scsi/gdth_proc.c | 6 +++---
drivers/scsi/ipr.c | 2 +-
drivers/scsi/ips.c | 16 ++++++++--------
drivers/scsi/megaraid/mega_common.h | 2 +-
drivers/scsi/megaraid/megaraid_sas.h | 2 +-
drivers/scsi/qla1280.c | 2 +-
drivers/scsi/scsi_error.c | 8 ++++----
drivers/scsi/sg.c | 2 +-
drivers/scsi/u14-34f.c | 12 ++++++------
drivers/usb/image/microtek.c | 4 ++--
20 files changed, 81 insertions(+), 83 deletions(-)
163302b968bfac500e7a44f55b2e4780499d727c
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index e0277d9..9df7987 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -1272,8 +1272,7 @@ cciss_scsi_queue_command (struct scsi_cm
c = (ctlr_info_t **) &cmd->device->host->hostdata[0];
ctlr = (*c)->ctlr;
- rc = lookup_scsi3addr(ctlr, sdev_channel(cmd->device),
- scmd_id(cmd),
+ rc = lookup_scsi3addr(ctlr, scmd_channel(cmd), scmd_id(cmd),
&cmd->device->lun, scsi3addr);
if (rc != 0) {
/* the scsi nexus does not match any that we presented... */
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 0d54827..ced3739 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -1801,8 +1801,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
hd->abortSCpnt = SCpnt;
retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK,
- sdev_channel(SCpnt->device),
- scmd_id(SCpnt),
+ scmd_channel(SCpnt), scmd_id(SCpnt),
&SCpnt->device->lun,
ctx2abort, 2 /* 2 second timeout */);
@@ -1854,7 +1853,7 @@ mptscsih_dev_reset(struct scsi_cmnd * SC
int_to_scsilun(0, &lun0);
retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET,
- sdev_channel(SCpnt->device), scmd_id(SCpnt),
+ scmd_channel(SCpnt), scmd_id(SCpnt),
&lun0, 0, 5 /* 5 second timeout */);
printk (KERN_WARNING MYNAM ": %s: target reset: %s (sc=%p)\n",
@@ -1905,7 +1904,7 @@ mptscsih_bus_reset(struct scsi_cmnd * SC
int_to_scsilun(0, &lun0);
retval = mptscsih_TMHandler(hd, MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS,
- sdev_channel(SCpnt->device), 0, &lun0,
+ scmd_channel(SCpnt), 0, &lun0,
0, 5 /* 5 second timeout */);
printk (KERN_WARNING MYNAM ": %s: bus reset: %s (sc=%p)\n",
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 5540607..e792ae8 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -1447,7 +1447,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsi
* itself.
*/
if (scmd_id(scsicmd) != host->this_id) {
- if ((sdev_channel(scsicmd->device) == 0) ){
+ if ((scmd_channel(scsicmd) == 0) ){
if( (scmd_id(scsicmd) >= dev->maximum_num_containers) || (!scsilun_zero(&scsicmd->device->lun))){
scsicmd->result = DID_NO_CONNECT << 16;
scsicmd->scsi_done(scsicmd);
@@ -1931,7 +1931,7 @@ static void aac_srb_callback(void *conte
* the channel is 2
*/
} else if ((dev->raid_scsi_mode) &&
- (sdev_channel(scsicmd->device) == 2)) {
+ (scmd_channel(scsicmd) == 2)) {
scsicmd->result = DID_OK << 16 |
COMMAND_COMPLETE << 8;
} else {
@@ -1975,7 +1975,7 @@ static void aac_srb_callback(void *conte
* the channel is 2
*/
} else if ((dev->raid_scsi_mode) &&
- (sdev_channel(scsicmd->device) == 2)) {
+ (scmd_channel(scsicmd) == 2)) {
scsicmd->result = DID_OK << 16 |
COMMAND_COMPLETE << 8;
} else {
@@ -2128,7 +2128,7 @@ static int aac_send_srb_fib(struct scsi_
srbcmd = (struct aac_srb*) fib_data(cmd_fibcontext);
srbcmd->function = cpu_to_le32(SRBF_ExecuteScsi);
- srbcmd->channel = cpu_to_le32(aac_logical_to_phys(sdev_channel(scsicmd->device)));
+ srbcmd->channel = cpu_to_le32(aac_logical_to_phys(scmd_channel(scsicmd)));
srbcmd->id = cpu_to_le32(scmd_id(scsicmd));
srbcmd->lun = cpu_to_le32(scsilun_to_int(&scsicmd->device->lun));
srbcmd->flags = cpu_to_le32(flag);
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 233af25..70ca02a 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -683,7 +683,7 @@ ahd_linux_bus_reset(struct scsi_cmnd *cm
ahd_name(ahd), cmd);
#endif
ahd_lock(ahd, &s);
- found = ahd_reset_channel(ahd, sdev_channel(cmd->device) + 'A',
+ found = ahd_reset_channel(ahd, scmd_channel(cmd) + 'A',
/*initiate reset*/TRUE);
ahd_unlock(ahd, &s);
@@ -2113,7 +2113,7 @@ ahd_linux_queue_recovery_cmd(struct scsi
LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) {
if (ahd_match_scb(ahd, pending_scb,
scmd_id(cmd),
- sdev_channel(cmd->device) + 'A',
+ scmd_channel(cmd) + 'A',
CAM_LUN_WILDCARD,
SCB_LIST_NULL, ROLE_INITIATOR) == 0)
break;
@@ -2158,7 +2158,7 @@ ahd_linux_queue_recovery_cmd(struct scsi
if (flag == SCB_ABORT) {
if (ahd_search_qinfifo(ahd,
scmd_id(cmd),
- sdev_channel(cmd->device) + 'A',
+ scmd_channel(cmd) + 'A',
scsilun_to_int(&cmd->device->lun),
pending_scb->hscb->tag,
ROLE_INITIATOR, CAM_REQ_ABORTED,
@@ -2170,7 +2170,7 @@ ahd_linux_queue_recovery_cmd(struct scsi
}
} else if (ahd_search_qinfifo(ahd,
scmd_id(cmd),
- sdev_channel(cmd->device) + 'A',
+ scmd_channel(cmd) + 'A',
scsilun_to_int(&cmd->device->lun),
pending_scb->hscb->tag,
ROLE_INITIATOR, /*status*/0,
@@ -2268,7 +2268,7 @@ ahd_linux_queue_recovery_cmd(struct scsi
*/
ahd_search_qinfifo(ahd,
scmd_id(cmd),
- sdev_channel(cmd->device) + 'A',
+ scmd_channel(cmd) + 'A',
scsilun_to_int(&cmd->device->lun),
SCB_LIST_NULL, ROLE_INITIATOR,
CAM_REQUEUE_REQ, SEARCH_COMPLETE);
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index d9fb5a4..120fc48 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -757,7 +757,7 @@ ahc_linux_bus_reset(struct scsi_cmnd *cm
ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
ahc_lock(ahc, &flags);
- found = ahc_reset_channel(ahc, sdev_channel(cmd->device) + 'A',
+ found = ahc_reset_channel(ahc, scmd_channel(cmd) + 'A',
/*initiate reset*/TRUE);
ahc_unlock(ahc, &flags);
@@ -797,8 +797,8 @@ struct scsi_host_template aic7xxx_driver
/******************************** Macros **************************************/
#define BUILD_SCSIID(ahc, cmd) \
(((scmd_id(cmd) << TID_SHIFT) & TID) \
- | ((sdev_channel((cmd)->device) == 0) ? (ahc)->our_id : (ahc)->our_id_b) \
- | ((sdev_channel((cmd)->device) == 0) ? 0 : TWIN_CHNLB))
+ | ((scmd_channel(cmd) == 0) ? (ahc)->our_id : (ahc)->our_id_b) \
+ | ((scmd_channel(cmd) == 0) ? 0 : TWIN_CHNLB))
/******************************** Bus DMA *************************************/
int
@@ -1439,7 +1439,7 @@ ahc_linux_run_command(struct ahc_softc *
&& (ahc->features & AHC_SCB_BTT) == 0) {
int target_offset;
- target_offset = scmd_id(cmd) + sdev_channel(cmd->device) * 8;
+ target_offset = scmd_id(cmd) + scmd_channel(cmd) * 8;
untagged_q = &(ahc->untagged_queues[target_offset]);
if (!TAILQ_EMPTY(untagged_q))
/* if we're already executing an untagged command
@@ -2150,7 +2150,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
if ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED)) == 0
&& ahc_search_untagged_queues(ahc, cmd, scmd_id(cmd),
- sdev_channel(cmd->device) + 'A',
+ scmd_channel(cmd) + 'A',
scsilun_to_int(&cmd->device->lun),
CAM_REQ_ABORTED, SEARCH_COMPLETE) != 0) {
dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
@@ -2172,7 +2172,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
/* Any SCB for this device will do for a target reset */
LIST_FOREACH(pending_scb, &ahc->pending_scbs, pending_links) {
if (ahc_match_scb(ahc, pending_scb, scmd_id(cmd),
- sdev_channel(cmd->device) + 'A',
+ scmd_channel(cmd) + 'A',
CAM_LUN_WILDCARD,
SCB_LIST_NULL, ROLE_INITIATOR) == 0)
break;
@@ -2215,7 +2215,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
disconnected = TRUE;
if (flag == SCB_ABORT) {
if (ahc_search_qinfifo(ahc, scmd_id(cmd),
- sdev_channel(cmd->device) + 'A',
+ scmd_channel(cmd) + 'A',
scsilun_to_int(&cmd->device->lun),
pending_scb->hscb->tag,
ROLE_INITIATOR, CAM_REQ_ABORTED,
@@ -2226,7 +2226,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
goto done;
}
} else if (ahc_search_qinfifo(ahc, scmd_id(cmd),
- sdev_channel(cmd->device) + 'A',
+ scmd_channel(cmd) + 'A',
scsilun_to_int(&cmd->device->lun),
pending_scb->hscb->tag,
ROLE_INITIATOR, /*status*/0,
@@ -2303,7 +2303,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
* both the qinfifo and the disconnected list.
*/
ahc_search_disc_list(ahc, scmd_id(cmd),
- sdev_channel(cmd->device) + 'A',
+ scmd_channel(cmd) + 'A',
scsilun_to_int(&cmd->device->lun),
pending_scb->hscb->tag,
/*stop_on_first*/TRUE,
@@ -2329,7 +2329,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
* to run.
*/
ahc_search_qinfifo(ahc, scmd_id(cmd),
- sdev_channel(cmd->device) + 'A',
+ scmd_channel(cmd) + 'A',
scsilun_to_int(&cmd->device->lun),
SCB_LIST_NULL,
ROLE_INITIATOR, CAM_REQUEUE_REQ,
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index e695daf..5d6e234 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -1035,12 +1035,12 @@ static struct aic7xxx_syncrate {
(((scb->hscb)->target_channel_lun >> 4) & 0xf), \
((scb->hscb)->target_channel_lun & 0x07)
-#define CTL_OF_CMD(cmd) ((sdev_channel(cmd->device)) & 0x01), \
+#define CTL_OF_CMD(cmd) ((scmd_channel(cmd)) & 0x01), \
(scmd_id(cmd) & 0x0f), \
((scsilun_to_int(&cmd->device->lun)) & 0x07)
#define TARGET_INDEX(cmd) \
- (scmd_id(cmd) | (sdev_channel((cmd)->device) << 3))
+ (scmd_id(cmd) | (scmd_channel(cmd) << 3))
/*
* A nice little define to make doing our printks a little easier
@@ -4936,7 +4936,7 @@ aic7xxx_parse_msg(struct aic7xxx_host *p
struct aic_dev_data *aic_dev;
target = scmd_id(scb->cmd);
- channel = sdev_channel(scb->cmd->device);
+ channel = scmd_channel(scb->cmd);
lun = &scb->cmd->device->lun;
reply = reject = done = FALSE;
tindex = TARGET_INDEX(scb->cmd);
@@ -6029,14 +6029,14 @@ aic7xxx_handle_scsiint(struct aic7xxx_ho
sd = aic_dev->SDptr;
aic_dev->needppr = aic_dev->needppr_copy = 0;
aic7xxx_set_width(p, scmd_id(scb->cmd),
- sdev_channel(scb->cmd->device),
+ scmd_channel(scb->cmd),
&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,
scmd_id(scb->cmd),
- sdev_channel(scb->cmd->device), 0, 0,
+ scmd_channel(scb->cmd), 0, 0,
0, AHC_TRANS_ACTIVE|AHC_TRANS_CUR|AHC_TRANS_QUITE,
aic_dev);
aic_dev->goal.options = 0;
@@ -6315,7 +6315,7 @@ aic7xxx_handle_command_completion_intr(s
}
aic7xxx_reset_device(p,
scmd_id(scb->cmd),
- sdev_channel(scb->cmd->device),
+ scmd_channel(scb->cmd),
&scb->cmd->device->lun, scb->hscb->tag);
scb->flags &= ~(SCB_QUEUED_FOR_DONE | SCB_RESET | SCB_ABORT |
SCB_QUEUED_ABORT);
@@ -10207,7 +10207,7 @@ aic7xxx_buildscb(struct aic7xxx_host *p,
scb->flags |= SCB_DTR_SCB;
}
hscb->target_channel_lun = ((scmd_id(cmd) << 4) & 0xF0) |
- ((sdev_channel(cmd->device) & 0x01) << 3) |
+ ((scmd_channel(cmd) & 0x01) << 3) |
(scsilun_to_int(&cmd->device->lun) & 0x07);
/*
@@ -10447,7 +10447,7 @@ __aic7xxx_bus_device_reset(Scsi_Cmnd *cm
aic_inb(p, STCNT));
}
- channel = sdev_channel(cmd->device);
+ channel = scmd_channel(cmd);
/*
* Send a Device Reset Message:
@@ -10514,7 +10514,7 @@ __aic7xxx_bus_device_reset(Scsi_Cmnd *cm
* 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, sdev_channel(cmd->device),
+ if (aic7xxx_search_qinfifo(p, scmd_channel(cmd),
scmd_id(cmd), &cmd->device->lun, hscb->tag,
0, TRUE, NULL) == 0)
{
@@ -10683,7 +10683,7 @@ __aic7xxx_abort(Scsi_Cmnd *cmd)
* We just checked the waiting_q, now for the QINFIFO
*/
if ( ((found = aic7xxx_search_qinfifo(p, scmd_id(cmd),
- sdev_channel(cmd->device),
+ scmd_channel(cmd),
&cmd->device->lun, scb->hscb->tag, SCB_ABORT | SCB_QUEUED_FOR_DONE,
FALSE, NULL)) != 0) &&
(aic7xxx_verbose & VERBOSE_ABORT_PROCESS))
@@ -10907,10 +10907,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, sdev_channel(cmd->device), TRUE);
+ aic7xxx_reset_channel(p, scmd_channel(cmd), TRUE);
if (p->features & AHC_TWIN)
{
- aic7xxx_reset_channel(p, sdev_channel(cmd->device) ^ 0x01, TRUE);
+ aic7xxx_reset_channel(p, scmd_channel(cmd) ^ 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 04a8ff7..adc4aad 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -622,10 +622,10 @@ static int atp870u_queuecommand(struct s
struct atp_unit *dev;
struct Scsi_Host *host;
- c = sdev_channel(req_p->device);
+ c = scmd_channel(req_p);
req_p->sense_buffer[0]=0;
req_p->resid = 0;
- if (sdev_channel(req_p->device) > 1) {
+ if (scmd_channel(req_p) > 1) {
req_p->result = 0x00040000;
done(req_p);
#ifdef ED_DBGP
@@ -3109,7 +3109,7 @@ static int atp870u_abort(struct scsi_cmn
host = SCpnt->device->host;
dev = (struct atp_unit *)&host->hostdata;
- c = sdev_channel(SCpnt->device);
+ c = scmd_channel(SCpnt);
printk(" atp870u: abort Channel = %x \n", c);
printk("working=%x last_cmd=%x ", dev->working[c], dev->last_cmd[c]);
printk(" quhdu=%x quendu=%x ", dev->quhd[c], dev->quend[c]);
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 346d28d..484e221 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -426,7 +426,7 @@ static int adpt_queue(struct scsi_cmnd *
* command from scan_scsis_single.
*/
if ((pDev = adpt_find_device(pHba,
- sdev_channel(cmd->device),
+ scmd_channel(cmd),
scmd_id(cmd),
scsilun_to_int(&cmd->device->lun))) == NULL) {
// TODO: if any luns are at this bus, scsi id then fake a TEST_UNIT_READY and INQUIRY response
@@ -728,9 +728,9 @@ static int adpt_bus_reset(struct scsi_cm
pHba = (adpt_hba*)cmd->device->host->hostdata[0];
memset(msg, 0, sizeof(msg));
dev_printk(KERN_WARNING, &cmd->device->sdev_gendev,
- "Bus reset: tid: %d\n", pHba->channel[sdev_channel(cmd->device)].tid );
+ "Bus reset: tid: %d\n", pHba->channel[scmd_channel(cmd)].tid );
msg[0] = FOUR_WORD_MSG_SIZE|SGL_OFFSET_0;
- msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[sdev_channel(cmd->device)].tid);
+ msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[scmd_channel(cmd)].tid);
msg[2] = 0;
msg[3] = 0;
if(adpt_i2o_post_wait(pHba, msg,sizeof(msg), FOREVER) ){
@@ -749,7 +749,7 @@ static int __adpt_reset(struct scsi_cmnd
int rcode;
pHba = (adpt_hba*)cmd->device->host->hostdata[0];
dev_printk(KERN_WARNING, &cmd->device->sdev_gendev,
- "Hba Reset: tid: %d\n", pHba->channel[sdev_channel(cmd->device)].tid );
+ "Hba Reset: tid: %d\n", pHba->channel[scmd_channel(cmd)].tid );
rcode = adpt_hba_reset(pHba);
if(rcode == 0){
printk(KERN_WARNING"%s: HBA reset complete\n",pHba->name);
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index 1cad8a2..430133b 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -1822,7 +1822,7 @@ static int eata2x_queuecommand(struct sc
cpp->hbaci = 1;
#endif
cpp->one = 1;
- cpp->channel = sdev_channel(SCpnt->device);
+ cpp->channel = scmd_channel(SCpnt);
cpp->target = scmd_id(SCpnt);
cpp->lun = scsilun_to_int(&SCpnt->device->lun);
cpp->SCpnt = SCpnt;
@@ -2445,7 +2445,7 @@ static irqreturn_t ihdlr(int irq, struct
/* If there was a bus reset, redo operation on each target */
else if (tstatus != GOOD && SCpnt->device->type == TYPE_DISK
- && ha->target_redo[scmd_id(SCpnt)][sdev_channel(SCpnt->device)])
+ && ha->target_redo[scmd_id(SCpnt)][scmd_channel(SCpnt)])
status = DID_BUS_BUSY << 16;
/* Works around a flaw in scsi.c */
@@ -2458,7 +2458,7 @@ static irqreturn_t ihdlr(int irq, struct
status = DID_OK << 16;
if (tstatus == GOOD)
- ha->target_redo[scmd_id(SCpnt)][sdev_channel(SCpnt->device)] = 0;
+ ha->target_redo[scmd_id(SCpnt)][scmd_channel(SCpnt)] = 0;
if (spp->target_status && SCpnt->device->type == TYPE_DISK &&
(!(tstatus == CHECK_CONDITION && ha->iocount <= 1000 &&
@@ -2469,7 +2469,7 @@ static irqreturn_t ihdlr(int irq, struct
SCpnt->pid,
spp->target_status, SCpnt->sense_buffer[2]);
- ha->target_to[scmd_id(SCpnt)][sdev_channel(SCpnt->device)] = 0;
+ ha->target_to[scmd_id(SCpnt)][scmd_channel(SCpnt)] = 0;
if (ha->last_retried_pid == SCpnt->pid)
ha->retries = 0;
@@ -2478,11 +2478,11 @@ static irqreturn_t ihdlr(int irq, struct
case ASST: /* Selection Time Out */
case 0x02: /* Command Time Out */
- if (ha->target_to[scmd_id(SCpnt)][sdev_channel(SCpnt->device)] > 1)
+ if (ha->target_to[scmd_id(SCpnt)][scmd_channel(SCpnt)] > 1)
status = DID_ERROR << 16;
else {
status = DID_TIME_OUT << 16;
- ha->target_to[scmd_id(SCpnt)][sdev_channel(SCpnt->device)]++;
+ ha->target_to[scmd_id(SCpnt)][scmd_channel(SCpnt)]++;
}
break;
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 7524af9..c6e0c54 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -2248,7 +2248,7 @@ static void gdth_putq(int hanum,Scsi_Cmn
spin_lock_irqsave(&ha->smp_lock, flags);
scp->SCp.this_residual = (int)priority;
- b = virt_ctr ? NUMDATA(scp->device->host)->busnum : sdev_channel(scp->device);
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scmd_channel(scp);
t = scmd_id(scp);
if (priority >= DEFAULT_PRI) {
if ((b != ha->virt_bus && ha->raw[BUS_L2P(ha,b)].lock) ||
@@ -2308,7 +2308,7 @@ 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->device->host)->busnum : sdev_channel(nscp->device);
+ b = virt_ctr ? NUMDATA(nscp->device->host)->busnum : scmd_channel(nscp);
t = scmd_id(nscp);
l = scsilun_to_int(&nscp->device->lun);
if (nscp->SCp.this_residual >= DEFAULT_PRI) {
@@ -3620,7 +3620,7 @@ static int gdth_sync_event(int hanum,int
printk("\n");
} else {
- b = virt_ctr ? NUMDATA(scp->device->host)->busnum : sdev_channel(scp->device);
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scmd_channel(scp);
t = scmd_id(scp);
if (scp->SCp.sent_command == -1 && b != ha->virt_bus) {
ha->raw[BUS_L2P(ha,b)].io_cnt[t]--;
@@ -4712,14 +4712,14 @@ static int gdth_eh_bus_reset(Scsi_Cmnd *
TRACE2(("gdth_eh_bus_reset()\n"));
hanum = NUMDATA(scp->device->host)->hanum;
- b = virt_ctr ? NUMDATA(scp->device->host)->busnum : sdev_channel(scp->device);
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scmd_channel(scp);
ha = HADATA(gdth_ctr_tab[hanum]);
/* clear command tab */
spin_lock_irqsave(&ha->smp_lock, flags);
for (i = 0; i < GDTH_MAXCMDS; ++i) {
cmnd = ha->cmd_tab[i].cmnd;
- if (!SPECIAL_SCP(cmnd) && sdev_channel(cmnd->device) == b)
+ if (!SPECIAL_SCP(cmnd) && scmd_channel(cmnd) == b)
ha->cmd_tab[i].cmnd = UNUSED_CMND;
}
spin_unlock_irqrestore(&ha->smp_lock, flags);
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c
index a5a317f..dc8863b 100644
--- a/drivers/scsi/gdth_proc.c
+++ b/drivers/scsi/gdth_proc.c
@@ -951,7 +951,7 @@ static void gdth_wait_completion(int han
for (i = 0; i < GDTH_MAXCMDS; ++i) {
scp = ha->cmd_tab[i].cmnd;
- b = virt_ctr ? NUMDATA(scp->device->host)->busnum : sdev_channel(scp->device);
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scmd_channel(scp);
t = scmd_id(scp);
if (!SPECIAL_SCP(scp) && t == (unchar)id &&
b == (unchar)busnum) {
@@ -976,7 +976,7 @@ static void gdth_stop_timeout(int hanum,
spin_lock_irqsave(&ha->smp_lock, flags);
for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) {
- b = virt_ctr ? NUMDATA(scp->device->host)->busnum : sdev_channel(scp->device);
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scmd_channel(scp);
t = scmd_id(scp);
if (t == (unchar)id && b == (unchar)busnum) {
TRACE2(("gdth_stop_timeout(): update_timeout()\n"));
@@ -997,7 +997,7 @@ static void gdth_start_timeout(int hanum
spin_lock_irqsave(&ha->smp_lock, flags);
for (scp = ha->req_first; scp; scp = (Scsi_Cmnd *)scp->SCp.ptr) {
- b = virt_ctr ? NUMDATA(scp->device->host)->busnum : sdev_channel(scp->device);
+ b = virt_ctr ? NUMDATA(scp->device->host)->busnum : scmd_channel(scp);
t = scmd_id(scp);
if (t == (unchar)id && b == (unchar)busnum) {
TRACE2(("gdth_start_timeout(): update_timeout()\n"));
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index fdfbbeb..3027d9f 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -3762,7 +3762,7 @@ static void ipr_erp_start(struct ipr_ioa
*/
if (!res->resetting_device)
scsi_report_bus_reset(ioa_cfg->host,
- sdev_channel(scsi_cmd->device));
+ scmd_channel(scsi_cmd));
scsi_cmd->result |= (DID_ERROR << 16);
res->needs_sync_complete = 1;
break;
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index c752b6e..be6b13a 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -1125,8 +1125,8 @@ ips_queue(Scsi_Cmnd * SC, void (*done) (
SC->device->channel, SC->device->id, SC->device->lun);
/* Check for command to initiator IDs */
- if ((sdev_channel(SC->device) > 0)
- && (scmd_id(SC) == ha->ha_id[sdev_channel(SC->device)])) {
+ if ((scmd_channel(SC) > 0)
+ && (scmd_id(SC) == ha->ha_id[scmd_channel(SC)])) {
SC->result = DID_NO_CONNECT << 16;
done(SC);
@@ -1611,7 +1611,7 @@ ips_is_passthru(Scsi_Cmnd * SC)
return (0);
if ((SC->cmnd[0] == IPS_IOCTL_COMMAND) &&
- (sdev_channel(SC->device) == 0) &&
+ (scmd_channel(SC) == 0) &&
(scmd_id(SC) == IPS_ADAPTER_ID) &&
(scsilun_zero(&SC->device->lun) == 0) && SC->request_buffer) {
if ((!SC->use_sg) && SC->request_bufflen &&
@@ -1969,7 +1969,7 @@ ips_flash_firmware(ips_ha_t * ha, ips_pa
/* FIX stuff that might be wrong */
scb->sg_list.list = sg_list.list;
scb->scb_busaddr = cmd_busaddr;
- scb->bus = sdev_channel(scb->scsi_cmd->device);
+ scb->bus = scmd_channel(scb->scsi_cmd);
scb->target_id = scmd_id(scb->scsi_cmd);
scb->lun = scsilun_to_int(&scb->scsi_cmd->device->lun);
scb->sg_len = 0;
@@ -2038,7 +2038,7 @@ ips_usrcmd(ips_ha_t * ha, ips_passthru_t
/* FIX stuff that might be wrong */
scb->sg_list.list = sg_list.list;
scb->scb_busaddr = cmd_busaddr;
- scb->bus = sdev_channel(scb->scsi_cmd->device);
+ scb->bus = scmd_channel(scb->scsi_cmd);
scb->target_id = scmd_id(scb->scsi_cmd);
scb->lun = scsilun_to_int(&scb->scsi_cmd->device->lun);
scb->sg_len = 0;
@@ -2830,9 +2830,9 @@ ips_next(ips_ha_t * ha, int intr)
p = ha->scb_waitlist.head;
while ((p) && (scb = ips_getscb(ha))) {
- if ((sdev_channel(p->device) > 0)
+ if ((scmd_channel(p) > 0)
&& (ha->
- dcdb_active[sdev_channel(p->device) -
+ dcdb_active[scmd_channel(p) -
1] & (1 << scmd_id(p)))) {
ips_freescb(ha, scb);
p = (Scsi_Cmnd *) p->host_scribble;
@@ -2852,7 +2852,7 @@ ips_next(ips_ha_t * ha, int intr)
scb->target_id = scmd_id(SC);
scb->lun = scsilun_to_int(&SC->device->lun);
- scb->bus = sdev_channel(SC->device);
+ scb->bus = scmd_channel(SC);
scb->scsi_cmd = SC;
scb->breakup = 0;
scb->data_len = 0;
diff --git a/drivers/scsi/megaraid/mega_common.h b/drivers/scsi/megaraid/mega_common.h
index 81ce0c9..0aecc7b 100644
--- a/drivers/scsi/megaraid/mega_common.h
+++ b/drivers/scsi/megaraid/mega_common.h
@@ -199,7 +199,7 @@ typedef struct {
// conversion from scsi command
#define SCP2HOST(scp) (scp)->device->host // to host
#define SCP2HOSTDATA(scp) SCP2HOST(scp)->hostdata // to soft state
-#define SCP2CHANNEL(scp) sdev_channel((scp)->device) // to channel
+#define SCP2CHANNEL(scp) scmd_channel(scp) // to channel
#define SCP2TARGET(scp) scmd_id(scp) // to target
#define SCP2LUN(scp) scsilun_to_int(&(scp)->device->lun) // to LUN
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index 0a8f227..3b5cf42 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -1059,7 +1059,7 @@ struct megasas_instance {
};
#define MEGASAS_IS_LOGICAL(scp) \
- (sdev_channel(scp->device) < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1
+ (scmd_channel(scp) < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1
#define MEGASAS_DEV_INDEX(inst, scp) \
((scmd_channel(scp) % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index c829446..fe9623d 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -617,7 +617,7 @@ __setup("qla1280=", qla1280_setup);
#endif
#define CMD_HOST(Cmnd) Cmnd->device->host
-#define SCSI_BUS_32(Cmnd) sdev_channel(Cmnd->device)
+#define SCSI_BUS_32(Cmnd) scmd_channel(Cmnd)
#define SCSI_TCN_32(Cmnd) scmd_id(Cmnd)
#define SCSI_LUN_32(Cmnd) scsilun_to_int(&Cmnd->device->lun)
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 59e0f38..31602d0 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1037,7 +1037,7 @@ static int scsi_try_bus_reset(struct scs
ssleep(BUS_RESET_SETTLE_TIME);
spin_lock_irqsave(scmd->device->host->host_lock, flags);
scsi_report_bus_reset(scmd->device->host,
- sdev_channel(scmd->device));
+ scmd_channel(scmd));
spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
}
@@ -1066,7 +1066,7 @@ static int scsi_try_host_reset(struct sc
ssleep(HOST_RESET_SETTLE_TIME);
spin_lock_irqsave(scmd->device->host->host_lock, flags);
scsi_report_bus_reset(scmd->device->host,
- sdev_channel(scmd->device));
+ scmd_channel(scmd));
spin_unlock_irqrestore(scmd->device->host->host_lock, flags);
}
@@ -1096,7 +1096,7 @@ static int scsi_eh_bus_reset(struct Scsi
for (channel = 0; channel <= shost->max_channel; channel++) {
chan_scmd = NULL;
list_for_each_entry(scmd, work_q, eh_entry) {
- if (channel == sdev_channel(scmd->device)) {
+ if (channel == scmd_channel(scmd)) {
chan_scmd = scmd;
break;
/*
@@ -1114,7 +1114,7 @@ static int scsi_eh_bus_reset(struct Scsi
rtn = scsi_try_bus_reset(chan_scmd);
if (rtn == SUCCESS) {
list_for_each_entry_safe(scmd, next, work_q, eh_entry) {
- if (channel == sdev_channel(scmd->device))
+ if (channel == scmd_channel(scmd))
if (!scsi_device_online(scmd->device) ||
!scsi_eh_tur(scmd))
scsi_eh_finish_cmd(scmd,
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 9af8bbf..0287861 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -887,7 +887,7 @@ sg_ioctl(struct inode *inode, struct fil
return -ENODEV;
__put_user((int) sdp->device->host->host_no,
&sg_idp->host_no);
- __put_user((int) sdev_channel(sdp->device),
+ __put_user((int) scmd_channel(sdp),
&sg_idp->channel);
__put_user((int) scmd_id(sdp), &sg_idp->scsi_id);
__put_user((int) tmp_lun, &sg_idp->lun);
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index 013e817..a3bff57 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -1295,7 +1295,7 @@ static int u14_34f_queuecommand(struct s
"qcomm, mbox %d, pid %ld.\n", i, SCpnt->pid);
cpp->opcode = OP_SCSI;
- cpp->channel = sdev_channel(SCpnt->device);
+ cpp->channel = scmd_channel(SCpnt);
cpp->target = scmd_id(SCpnt);
cpp->lun = scsilun_to_int(&SCpnt->device->lun);
cpp->SCpnt = SCpnt;
@@ -1823,7 +1823,7 @@ static irqreturn_t ihdlr(int irq, unsign
/* If there was a bus reset, redo operation on each target */
else if (tstatus != GOOD && SCpnt->device->type == TYPE_DISK
- && HD(j)->target_redo[scmd_id(SCpnt)][sdev_channel(SCpnt->device)])
+ && HD(j)->target_redo[scmd_id(SCpnt)][scmd_channel(SCpnt)])
status = DID_BUS_BUSY << 16;
/* Works around a flaw in scsi.c */
@@ -1836,7 +1836,7 @@ static irqreturn_t ihdlr(int irq, unsign
status = DID_OK << 16;
if (tstatus == GOOD)
- HD(j)->target_redo[scmd_id(SCpnt)][sdev_channel(SCpnt->device)] = FALSE;
+ HD(j)->target_redo[scmd_id(SCpnt)][scmd_channel(SCpnt)] = FALSE;
if (spp->target_status && SCpnt->device->type == TYPE_DISK &&
(!(tstatus == CHECK_CONDITION && HD(j)->iocount <= 1000 &&
@@ -1846,18 +1846,18 @@ static irqreturn_t ihdlr(int irq, unsign
SCpnt->pid, spp->target_status,
SCpnt->sense_buffer[2]);
- HD(j)->target_to[scmd_id(SCpnt)][sdev_channel(SCpnt->device)] = 0;
+ HD(j)->target_to[scmd_id(SCpnt)][scmd_channel(SCpnt)] = 0;
if (HD(j)->last_retried_pid == SCpnt->pid) HD(j)->retries = 0;
break;
case ASST: /* Selection Time Out */
- if (HD(j)->target_to[scmd_id(SCpnt)][sdev_channel(SCpnt->device)] > 1)
+ if (HD(j)->target_to[scmd_id(SCpnt)][scmd_channel(SCpnt)] > 1)
status = DID_ERROR << 16;
else {
status = DID_TIME_OUT << 16;
- HD(j)->target_to[scmd_id(SCpnt)][sdev_channel(SCpnt->device)]++;
+ HD(j)->target_to[scmd_id(SCpnt)][scmd_channel(SCpnt)]++;
}
break;
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index 8b937ae..f3c1af6 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -593,12 +593,12 @@ int mts_scsi_queuecommand( Scsi_Cmnd *sr
if ( !scsilun_zero(&srb->device->lun) ||
scmd_id(srb) ||
- sdev_channel(srb->device) ) {
+ scmd_channel(srb) ) {
MTS_DEBUG("Command to LUN=%s ID=%d CHANNEL=%d from SCSI layer\n",
scsilun_to_str(&srb->device->lun, lunstr),
scmd_id(srb),
- sdev_channel(srb->device) );
+ scmd_channel(srb) );
MTS_DEBUG("this device doesn't exist\n");
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 12/n] HCIL drivers update
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
` (9 preceding siblings ...)
2005-10-24 8:16 ` [PATCH RFC 11/n] " Jeff Garzik
@ 2005-10-24 8:17 ` Jeff Garzik
2005-10-24 8:18 ` [PATCH RFC 13/n] " Jeff Garzik
` (2 subsequent siblings)
13 siblings, 0 replies; 19+ messages in thread
From: Jeff Garzik @ 2005-10-24 8:17 UTC (permalink / raw)
To: linux-scsi
Missed updates to scsi_add_device() callers.
drivers/ieee1394/sbp2.c | 4 +++-
drivers/message/i2o/i2o_scsi.c | 6 ++++--
drivers/s390/scsi/zfcp_erp.c | 8 ++++++--
drivers/scsi/aacraid/commsup.c | 5 +++--
4 files changed, 16 insertions(+), 7 deletions(-)
7c5c2cdf4c64c9114eff7764e1fb0a4da7ed9313
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index 87d381d..8982d36 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -813,6 +813,7 @@ static int sbp2_start_device(struct scsi
{
struct sbp2scsi_host_info *hi = scsi_id->hi;
int error;
+ struct scsi_lun lun0;
SBP2_DEBUG("sbp2_start_device");
@@ -961,7 +962,8 @@ alloc_fail:
sbp2_max_speed_and_size(scsi_id);
/* Add this device to the scsi layer now */
- error = scsi_add_device(scsi_id->scsi_host, 0, scsi_id->ud->id, 0);
+ int_to_scsilun(0, &lun0);
+ error = scsi_add_device(scsi_id->scsi_host, 0, scsi_id->ud->id, &lun0);
if (error) {
SBP2_ERR("scsi_add_device failed");
return error;
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c
index 9f1744c..87e6c6e 100644
--- a/drivers/message/i2o/i2o_scsi.c
+++ b/drivers/message/i2o/i2o_scsi.c
@@ -223,6 +223,7 @@ static int i2o_scsi_probe(struct device
u64 lun = -1;
int channel = -1;
int i;
+ struct scsi_lun slun;
i2o_shost = i2o_scsi_get_host(c);
if (!i2o_shost)
@@ -293,8 +294,9 @@ static int i2o_scsi_probe(struct device
return -EFAULT;
}
- scsi_dev =
- __scsi_add_device(i2o_shost->scsi_host, channel, id, lun, i2o_dev);
+ int_to_scsilun(lun, &slun);
+ scsi_dev = __scsi_add_device(i2o_shost->scsi_host, channel, id,
+ &slun, i2o_dev);
if (IS_ERR(scsi_dev)) {
osm_warn("can not add SCSI device %03x\n",
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 023f4e5..debec77 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -3447,10 +3447,14 @@ zfcp_erp_action_cleanup(int action, stru
&& (!atomic_test_mask(ZFCP_STATUS_UNIT_TEMPORARY,
&unit->status))
&& !unit->device
- && port->rport)
+ && port->rport) {
+ /* FIXME XXX this driver can do better */
+ struct scsi_lun slun;
+ int_to_scsilun(unit->scsi_lun, &slun);
scsi_add_device(port->adapter->scsi_host, 0,
port->rport->scsi_target_id,
- unit->scsi_lun);
+ &slun);
+ }
zfcp_unit_put(unit);
break;
case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index e4d543a..d50a024 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -997,10 +997,11 @@ static void aac_handle_aif(struct aac_de
scsi_device_put(device);
}
if (device_config_needed == ADD) {
+ struct scsi_lun slun;
+ int_to_scsilun(CONTAINER_TO_LUN(container), &slun);
scsi_add_device(dev->scsi_host_ptr,
CONTAINER_TO_CHANNEL(container),
- CONTAINER_TO_ID(container),
- CONTAINER_TO_LUN(container));
+ CONTAINER_TO_ID(container), &slun);
}
}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 13/n] HCIL drivers update
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
` (10 preceding siblings ...)
2005-10-24 8:17 ` [PATCH RFC 12/n] " Jeff Garzik
@ 2005-10-24 8:18 ` Jeff Garzik
2005-10-24 17:41 ` [PATCH RFC 14/n] more dev_printk driver work Jeff Garzik
2005-10-24 18:00 ` [PATCH RFC 15/n] HCIL drivers update Jeff Garzik
13 siblings, 0 replies; 19+ messages in thread
From: Jeff Garzik @ 2005-10-24 8:18 UTC (permalink / raw)
To: linux-scsi
Convert more stuff to sfoo_printk()
drivers/scsi/53c700.c | 37 ++++++++--------
drivers/scsi/53c700.h | 8 +++
drivers/scsi/NCR5380.c | 4 +
drivers/scsi/NCR53C9x.c | 81 +++++++++++++++----------------------
drivers/scsi/NCR53C9x.h | 22 ++++++++--
drivers/scsi/aha152x.c | 4 -
drivers/scsi/aha1542.c | 4 -
drivers/scsi/aic7xxx/aic79xx_osm.c | 26 ++++-------
drivers/scsi/aic7xxx/aic7xxx_osm.c | 30 +++++--------
9 files changed, 106 insertions(+), 110 deletions(-)
1d251738e8e0ce476d66010dadb5226f2a16ca3d
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index 6cc3f2d..ed1cab5 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -832,8 +832,8 @@ process_extended_message(struct Scsi_Hos
} else {
/* SDTR message out of the blue, reject it */
- printk(KERN_WARNING "scsi%d Unexpected SDTR msg\n",
- host->host_no);
+ shost_printk(KERN_WARNING, host,
+ "Unexpected SDTR msg\n");
hostdata->msgout[0] = A_REJECT_MSG;
dma_cache_sync(hostdata->msgout, 1, DMA_TO_DEVICE);
script_patch_16(hostdata->script, MessageCount, 1);
@@ -907,15 +907,17 @@ process_message(struct Scsi_Host *host,
NCR_700_clear_flag(SCp->device, NCR_700_DEV_BEGIN_SYNC_NEGOTIATION);
} else if(SCp != NULL && NCR_700_get_tag_neg_state(SCp->device) == NCR_700_DURING_TAG_NEGOTIATION) {
/* 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);
+ scmd_printk(KERN_WARNING, SCp,
+ "Rejected first tag queue attempt, turning off tag queueing\n");
/* we're done negotiating */
NCR_700_set_tag_neg_state(SCp->device, NCR_700_FINISHED_TAG_NEGOTIATION);
hostdata->tag_negotiated &= ~(1<<scmd_id(SCp));
SCp->device->tagged_supported = 0;
scsi_deactivate_tcq(SCp->device, host->cmd_per_lun);
} else {
- printk(KERN_WARNING "scsi%d (%d:%d) Unexpected REJECT Message %s\n",
- host->host_no, pun, lun,
+ shost_printk(KERN_WARNING, host,
+ "(%d:%d) Unexpected REJECT Message %s\n",
+ pun, lun,
NCR_700_phase[(dsps & 0xf00) >> 8]);
/* however, just ignore it */
}
@@ -1118,14 +1120,14 @@ process_script_interrupt(__u32 dsps, __u
}
slot = (struct NCR_700_command_slot *)SCp->host_scribble;
- DEBUG(("53c700: %d:%d:%d, reselection is tag %d, slot %p(%d)\n",
- host->host_no, SDp->id, SDp->lun,
- hostdata->msgin[2], slot, slot->tag));
+ DDEBUG(KERN_DEBUG, SDp,
+ "reselection is tag %d, slot %p(%d)\n",
+ hostdata->msgin[2], slot, slot->tag);
} else {
struct scsi_cmnd *SCp = scsi_find_tag(SDp, SCSI_NO_TAG);
if(unlikely(SCp == NULL)) {
- printk(KERN_ERR "scsi%d: (%d:%d) no saved request for untagged cmd\n",
- host->host_no, reselection_id, lun);
+ sdev_printk(KERN_ERR, SDp,
+ "no saved request for untagged cmd\n");
BUG();
}
slot = (struct NCR_700_command_slot *)SCp->host_scribble;
@@ -1769,15 +1771,13 @@ NCR_700_queuecommand(struct scsi_cmnd *S
if(NCR_700_get_depth(SCp->device) != 0
&& (!(hostdata->tag_negotiated & (1<<scmd_id(SCp)))
|| !blk_rq_tagged(SCp->request))) {
- DEBUG((KERN_ERR "scsi%d (%d:%d) has non zero depth %d\n",
- SCp->device->host->host_no, scmd_id(SCp), SCp->device->lun,
- NCR_700_get_depth(SCp->device)));
+ CDEBUG(KERN_ERR, SCp, "has non zero depth %d\n",
+ NCR_700_get_depth(SCp->device));
return SCSI_MLQUEUE_DEVICE_BUSY;
}
if(NCR_700_get_depth(SCp->device) >= SCp->device->queue_depth) {
- DEBUG((KERN_ERR "scsi%d (%d:%d) has max tag depth %d\n",
- SCp->device->host->host_no, scmd_id(SCp), SCp->device->lun,
- NCR_700_get_depth(SCp->device)));
+ CDEBUG(KERN_ERR, SCp, "has max tag depth %d\n",
+ NCR_700_get_depth(SCp->device));
return SCSI_MLQUEUE_DEVICE_BUSY;
}
NCR_700_set_depth(SCp->device, NCR_700_get_depth(SCp->device) + 1);
@@ -1823,9 +1823,8 @@ NCR_700_queuecommand(struct scsi_cmnd *S
if((hostdata->tag_negotiated &(1<<scmd_id(SCp)))
&& scsi_get_tag_type(SCp->device)) {
slot->tag = SCp->request->tag;
- DEBUG(("53c700 %d:%d:%d, sending out tag %d, slot %p\n",
- SCp->device->host->host_no, scmd_id(SCp), SCp->device->lun, slot->tag,
- slot));
+ CDEBUG(KERN_DEBUG, SCp, "sending out tag %d, slot %p\n",
+ slot->tag, slot);
} else {
slot->tag = SCSI_NO_TAG;
/* must populate current_cmnd for scsi_find_tag to work */
diff --git a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h
index e86012c..362d784 100644
--- a/drivers/scsi/53c700.h
+++ b/drivers/scsi/53c700.h
@@ -22,8 +22,14 @@
#ifdef NCR_700_DEBUG
#define DEBUG(x) printk x
+#define DDEBUG(prefix, sdev, fmt, a...) \
+ sdev_printk(prefix, sdev, fmt, ##a)
+#define CDEBUG(prefix, scmd, fmt, a...) \
+ scmd_printk(prefix, scmd, fmt, ##a)
#else
-#define DEBUG(x)
+#define DEBUG(x) do {} while (0)
+#define DDEBUG(prefix, scmd, fmt, a...) do {} while (0)
+#define CDEBUG(prefix, scmd, fmt, a...) do {} while (0)
#endif
/* The number of available command slots */
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index fb2400b..92ebb4a 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -779,7 +779,9 @@ static char *lprint_Scsi_Cmnd(Scsi_Cmnd
{
char lunstr[SCSILUN_STR_LEN];
- SPRINTF("scsi%d : destination target %d, lun %s\n", cmd->device->host->host_no, scmd_id(cmd), scsilun_to_str(&cmd->device->lun, lunstr));
+ SPRINTF("scsi%d : destination target %d, lun %s\n",
+ cmd->device->host->host_no, scmd_id(cmd),
+ scsilun_to_str(&cmd->device->lun, lunstr));
SPRINTF(" command = ");
pos = lprint_command(cmd->cmnd, pos, buffer, length);
return (pos);
diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c
index b54c51f..157cada 100644
--- a/drivers/scsi/NCR53C9x.c
+++ b/drivers/scsi/NCR53C9x.c
@@ -1091,8 +1091,8 @@ do_sync_known:
* to at least attempt allowing the device to
* disconnect.
*/
- ESPMISC(("esp: Selecting device for first time. target=%d "
- "lun=%d\n", target, SCptr->device->lun));
+ ESPMISC_C(KERN_DEBUG, SCptr,
+ "Selecting device for first time.\n");
if(!SDptr->borken && !esp_dev->disconnect)
esp_dev->disconnect = 1;
@@ -1165,8 +1165,8 @@ do_sync_known:
*/
if(((SDptr->scsi_level < 3) && (SDptr->type != TYPE_TAPE)) ||
toshiba_cdrom_hwbug_wkaround || SDptr->borken) {
- ESPMISC((KERN_INFO "esp%d: Disabling DISCONNECT for target %d "
- "lun %d\n", esp->esp_id, scmd_id(SCptr), SCptr->device->lun));
+ ESPMISC_C(KERN_INFO, SCptr,
+ "Disabling DISCONNECT for target\n");
esp_dev->disconnect = 0;
*cmdp++ = IDENTIFY(0, lun);
} else {
@@ -1248,8 +1248,8 @@ int esp_queue(Scsi_Cmnd *SCpnt, void (*d
esp->dma_led_on(esp);
/* We use the scratch area. */
- ESPQUEUE(("esp_queue: target=%d lun=%d ", scmd_id(SCpnt), SCpnt->lun));
- ESPDISC(("N<%02x,%02x>", scmd_id(SCpnt), SCpnt->lun));
+ ESPQUEUE_C(KERN_DEBUG, SCpnt, "esp_queue\n");
+ ESPDISC_C(KERN_DEBUG, SCpnt, "N\n");
esp_get_dmabufs(esp, SCpnt);
esp_save_pointers(esp, SCpnt); /* FIXME for tag queueing */
@@ -1277,14 +1277,9 @@ int esp_queue(Scsi_Cmnd *SCpnt, void (*d
/* Dump driver state. */
static void esp_dump_cmd(Scsi_Cmnd *SCptr)
{
- char lunstr[SCSILUN_STR_LEN];
-
- ESPLOG(("[tgt<%02x> lun<%s> "
- "pphase<%s> cphase<%s>]",
- scmd_id(SCptr),
- scsilun_to_str(&SCptr->device->lun, lunstr),
+ ESPLOG_C("", SCptr, "[pphase<%s> cphase<%s>]\n",
phase_string(SCptr->SCp.sent_command),
- phase_string(SCptr->SCp.phase)));
+ phase_string(SCptr->SCp.phase));
}
static void esp_dump_state(struct NCR_ESP *esp,
@@ -1327,17 +1322,17 @@ static void esp_dump_state(struct NCR_ES
#endif /* (DEBUG_ESP_CMDS) */
if(SCptr) {
- ESPLOG(("esp%d: current command ", esp->esp_id));
+ ESPLOG_C(KERN_INFO, SCptr, "command ");
esp_dump_cmd(SCptr);
}
- ESPLOG(("\n"));
+ ESPLOG_C("", SCptr, "\n");
SCptr = esp->disconnected_SC;
- ESPLOG(("esp%d: disconnected ", esp->esp_id));
+ ESPLOG_C(KERN_INFO, SCptr, "disconnected ");
while(SCptr) {
esp_dump_cmd(SCptr);
SCptr = (Scsi_Cmnd *) SCptr->host_scribble;
}
- ESPLOG(("\n"));
+ ESPLOG_C("", SCptr, "\n");
}
/* Abort a command. The host_lock is acquired by caller. */
@@ -2102,8 +2097,7 @@ static int esp_do_data_finale(struct NCR
ESPLOG(("esp%d: use_sg=%d ptr=%p this_residual=%d\n",
esp->esp_id,
SCptr->use_sg, SCptr->SCp.ptr, SCptr->SCp.this_residual));
- ESPLOG(("esp%d: Forcing async for target %d\n", esp->esp_id,
- scmd_id(SCptr)));
+ ESPLOG_C(KERN_INFO, SCptr, "Forcing async for target\n");
SCptr->device->borken = 1;
esp_dev->sync = 0;
bytes_sent = 0;
@@ -2220,8 +2214,8 @@ static int esp_do_freebus(struct NCR_ESP
* transfers until we are sure of the current target
* state.
*/
- ESPMISC(("esp: Status <%d> for target %d lun %d\n",
- SCptr->SCp.Status, scmd_id(SCptr), SCptr->device->lun));
+ ESPMISC_C(KERN_DEBUG, SCptr, "Status <%d>\n",
+ SCptr->SCp.Status);
/* But don't do this when spinning up a disk at
* boot time while we poll for completion as it
@@ -2232,14 +2226,14 @@ static int esp_do_freebus(struct NCR_ESP
if(esp_should_clear_sync(SCptr) != 0)
esp_dev->sync = 0;
}
- ESPDISC(("F<%02x,%02x>", scmd_id(SCptr), SCptr->device->lun));
+ ESPDISC_C(KERN_DEBUG, SCptr, "F\n");
esp_done(esp, ((SCptr->SCp.Status & 0xff) |
((SCptr->SCp.Message & 0xff)<<8) |
(DID_OK << 16)));
} else if(esp->prevmsgin == DISCONNECT) {
/* Normal disconnect. */
esp_cmd(esp, eregs, ESP_CMD_ESEL);
- ESPDISC(("D<%02x,%02x>", scmd_id(SCptr), SCptr->device->lun));
+ ESPDISC_C(KERN_DEBUG, SCptr, "D\n");
append_SC(&esp->disconnected_SC, SCptr);
esp->current_SC = NULL;
if(esp->issue_SC)
@@ -2637,8 +2631,7 @@ static int esp_select_complete(struct NC
* XXX spend the next second or so renegotiating
* XXX for synchronous transfers.
*/
- ESPLOG(("esp%d: STEP_ASEL for tgt %d\n",
- esp->esp_id, scmd_id(SCptr)));
+ ESPLOG_C(KERN_INFO, SCptr, "STEP_ASEL\n");
case ESP_STEP_SID:
/* Arbitration won, target selected, went
@@ -2744,8 +2737,6 @@ static int esp_select_complete(struct NC
/* Did the target even make it? */
if(esp->ireg == ESP_INTR_DC) {
- char lunstr[SCSILUN_STR_LEN];
-
/* wheee... nobody there or they didn't like
* what we told it to do, clean up.
*/
@@ -2763,10 +2754,8 @@ static int esp_select_complete(struct NC
SCptr->SCp.phase == in_slct_stop)) {
/* shit */
esp->snip = 0;
- ESPLOG(("esp%d: Failed synchronous negotiation for target %d "
- "lun %s\n", esp->esp_id,
- scmd_id(SCptr),
- scsilun_to_str(&SCptr->device->lun, lunstr)));
+ ESPLOG_C(KERN_WARNING, SCptr,
+ "Failed synchronous negotiation\n");
esp_dev->sync_max_offset = 0;
esp_dev->sync_min_period = 0;
esp_dev->sync = 1; /* so we don't negotiate again */
@@ -2793,8 +2782,9 @@ static int esp_select_complete(struct NC
* But first make sure that is really what is happening.
*/
if(((1<<scmd_id(SCptr)) & esp->targets_present)) {
- ESPLOG(("esp%d: Warning, live target %d not responding to "
- "selection.\n", esp->esp_id, scmd_id(SCptr)));
+ ESPLOG_C(KERN_WARNING, SCptr,
+ "Warning, live target not responding to "
+ "selection.\n");
/* This _CAN_ happen. The SCSI standard states that
* the target is to _not_ respond to selection if
@@ -2805,9 +2795,8 @@ static int esp_select_complete(struct NC
esp_done(esp, (DID_PARITY << 16));
} else {
/* Else, there really isn't anyone there. */
- ESPMISC(("esp: selection failure, maybe nobody there?\n"));
- ESPMISC(("esp: target %d lun %d\n",
- scmd_id(SCptr), SCptr->device->lun));
+ ESPMISC_C(KERN_WARNING, SCptr,
+ "selection failure, maybe nobody there?\n");
esp_done(esp, (DID_BAD_TARGET << 16));
}
return do_intr_end;
@@ -2882,13 +2871,13 @@ static int check_singlebyte_msg(struct N
switch(esp->cur_msgin[0]) {
default:
/* We don't want to hear about it. */
- ESPLOG(("esp%d: msg %02x which we don't know about\n", esp->esp_id,
- esp->cur_msgin[0]));
+ ESPLOG_C(KERN_INFO, esp->current_SC,
+ "msg %02x which we don't know about\n",
+ esp->cur_msgin[0]);
return MESSAGE_REJECT;
case NOP:
- ESPLOG(("esp%d: target %d sends a nop\n", esp->esp_id,
- scmd_id(esp->current_SC)));
+ ESPLOG_C(KERN_INFO, esp->current_SC, "target sends a nop\n");
return 0;
case RESTORE_POINTERS:
@@ -2980,16 +2969,15 @@ static void sync_report(struct NCR_ESP *
* again, it triggers a bug in our sparc64-gcc272
* sibling call optimization. -DaveM
*/
- ESPLOG((KERN_INFO "esp%d: target %d ",
- esp->esp_id, scmd_id(esp->current_SC)));
+ ESPLOG_C(KERN_INFO, esp->current_SC, " ");
ESPLOG(("[period %dns offset %d %d.%02dMHz ",
(int) msg3 * 4, (int) msg4,
integer, fraction));
ESPLOG(("%s SCSI%s]\n", type,
(((msg3 * 4) < 200) ? "-II" : "")));
} else {
- ESPLOG((KERN_INFO "esp%d: target %d asynchronous\n",
- esp->esp_id, scmd_id(esp->current_SC)));
+ ESPLOG_C(KERN_INFO, esp->current_SC,
+ "target asynchronous\n");
}
}
@@ -3488,8 +3476,9 @@ void esp_handle(struct NCR_ESP *esp)
* state now and ESP_CMD_TI is only allowed when
* a nexus is alive on the bus.
*/
- ESPLOG(("esp%d: Forcing async and disabling disconnect for "
- "target %d\n", esp->esp_id, scmd_id(SCptr)));
+ ESPLOG_C(KERN_WARNING, SCptr,
+ "Forcing async and disabling disconnect for "
+ "target\n");
SCptr->device->borken = 1; /* foo on you */
}
diff --git a/drivers/scsi/NCR53C9x.h b/drivers/scsi/NCR53C9x.h
index 06e7edf..8105e32 100644
--- a/drivers/scsi/NCR53C9x.h
+++ b/drivers/scsi/NCR53C9x.h
@@ -43,8 +43,8 @@
#define DEBUG_ESP
/* #define DEBUG_ESP_DATA */
-/* #define DEBUG_ESP_QUEUE */
-/* #define DEBUG_ESP_DISCONNECT */
+#define DEBUG_ESP_QUEUE
+#define DEBUG_ESP_DISCONNECT
/* #define DEBUG_ESP_STATUS */
/* #define DEBUG_ESP_PHASES */
/* #define DEBUG_ESP_WORKBUS */
@@ -58,12 +58,16 @@
* suits you if combinations of the above become too verbose when
* trying to track down a specific problem.
*/
-/* #define DEBUG_ESP_MISC */
+#define DEBUG_ESP_MISC
#if defined(DEBUG_ESP)
#define ESPLOG(foo) printk foo
+#define ESPLOG_C(prefix, scmd, fmt, a...) \
+ scmd_printk(prefix, scmd, fmt, ##a)
#else
#define ESPLOG(foo)
+#define ESPLOG_C(prefix, scmd, fmt, a...) \
+ do {} while (0)
#endif /* (DEBUG_ESP) */
#if defined(DEBUG_ESP_DATA)
@@ -74,14 +78,22 @@
#if defined(DEBUG_ESP_QUEUE)
#define ESPQUEUE(foo) printk foo
+#define ESPQUEUE_C(prefix, scmd, fmt, a...) \
+ scmd_printk(prefix, scmd, fmt, ##a)
#else
#define ESPQUEUE(foo)
+#define ESPQUEUE_C(prefix, scmd, fmt, a...) \
+ do {} while (0)
#endif
#if defined(DEBUG_ESP_DISCONNECT)
#define ESPDISC(foo) printk foo
+#define ESPDISC_C(prefix, scmd, fmt, a...) \
+ scmd_printk(prefix, scmd, fmt, ##a)
#else
#define ESPDISC(foo)
+#define ESPDISC_C(prefix, scmd, fmt, a...) \
+ do {} while (0)
#endif
#if defined(DEBUG_ESP_STATUS)
@@ -116,8 +128,12 @@
#if defined(DEBUG_ESP_MISC)
#define ESPMISC(foo) printk foo
+#define ESPMISC_C(prefix, scmd, fmt, a...) \
+ scmd_printk(prefix, scmd, fmt, ##a)
#else
#define ESPMISC(foo)
+#define ESPMISC_C(prefix, scmd, fmt, a...) \
+ do {} while (0)
#endif
/*
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index ebda58b..831bacd 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -2922,9 +2922,7 @@ static void disp_enintr(struct Scsi_Host
*/
static void show_command(Scsi_Cmnd *ptr)
{
- dev_printk(KERN_DEBUG, &ptr->device->sdev_gendev,
- "0x%08x: cmnd=(",
- (unsigned int) ptr);
+ scmd_printk(KERN_DEBUG, ptr, "%p: cmnd=(", ptr);
__scsi_print_command(ptr->cmnd);
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c
index 08551d7..5837149 100644
--- a/drivers/scsi/aha1542.c
+++ b/drivers/scsi/aha1542.c
@@ -1405,8 +1405,8 @@ static int aha1542_dev_reset(Scsi_Cmnd *
*/
aha1542_out(SCpnt->device->host->io_port, &ahacmd, 1);
- sdev_printk(KERN_WARNING, SCpnt->device,
- "aha1542.c: Trying device reset for target\n");
+ scmd_printk(KERN_WARNING, SCpnt,
+ "Trying device reset for target\n");
return SUCCESS;
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 70ca02a..023c3c1 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -532,7 +532,7 @@ ahd_linux_slave_alloc(struct scsi_device
struct ahd_linux_device *dev;
if (bootverbose)
- dev_printk(KERN_INFO, &sdev->sdev_gendev, "Slave Alloc\n");
+ sdev_printk(KERN_INFO, sdev, "Slave Alloc\n");
BUG_ON(targ->sdev[scsilun_to_int(&sdev->lun)] != NULL);
@@ -564,7 +564,7 @@ ahd_linux_slave_configure(struct scsi_de
ahd = *((struct ahd_softc **)sdev->host->hostdata);
if (bootverbose)
- dev_printk(KERN_INFO, &sdev->sdev_gendev, "Slave Configure\n");
+ sdev_printk(KERN_INFO, sdev, "Slave Configure\n");
ahd_linux_device_queue_depth(sdev);
@@ -584,7 +584,7 @@ ahd_linux_slave_destroy(struct scsi_devi
ahd = *((struct ahd_softc **)sdev->host->hostdata);
if (bootverbose)
- dev_printk(KERN_INFO, &sdev->sdev_gendev, "Slave Destroy\n");
+ sdev_printk(KERN_INFO, sdev, "Slave Destroy\n");
BUG_ON(dev->active);
@@ -2068,7 +2068,7 @@ ahd_linux_queue_recovery_cmd(struct scsi
wait = FALSE;
ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ scmd_printk(KERN_INFO, cmd,
"Attempting to queue a%s message:",
flag == SCB_ABORT ? "n ABORT" : " TARGET RESET");
@@ -2093,8 +2093,7 @@ ahd_linux_queue_recovery_cmd(struct scsi
* No target device for this command exists,
* so we must not still own the command.
*/
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- "Is not an active device\n");
+ scmd_printk(KERN_INFO, cmd, "Is not an active device\n");
retval = SUCCESS;
goto no_cmd;
}
@@ -2121,8 +2120,7 @@ ahd_linux_queue_recovery_cmd(struct scsi
}
if (pending_scb == NULL) {
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- "Command not found\n");
+ scmd_printk(KERN_INFO, cmd, "Command not found\n");
goto no_cmd;
}
@@ -2145,8 +2143,7 @@ ahd_linux_queue_recovery_cmd(struct scsi
paused = TRUE;
if ((pending_scb->flags & SCB_ACTIVE) == 0) {
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- "Command already completed\n");
+ scmd_printk(KERN_INFO, cmd, "Command already completed\n");
goto no_cmd;
}
@@ -2163,8 +2160,7 @@ ahd_linux_queue_recovery_cmd(struct scsi
pending_scb->hscb->tag,
ROLE_INITIATOR, CAM_REQ_ABORTED,
SEARCH_COMPLETE) > 0) {
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- "Cmd aborted from QINFIFO\n");
+ scmd_printk(KERN_INFO, cmd, "Cmd aborted from QINFIFO\n");
retval = SUCCESS;
goto done;
}
@@ -2214,8 +2210,7 @@ ahd_linux_queue_recovery_cmd(struct scsi
pending_scb->flags |= SCB_RECOVERY_SCB|flag;
ahd_outb(ahd, MSG_OUT, HOST_MSG);
ahd_outb(ahd, SCSISIGO, last_phase|ATNO);
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- "Device is active, asserting ATN\n");
+ scmd_printk(KERN_INFO, cmd, "Device is active, asserting ATN\n");
wait = TRUE;
} else if (disconnected) {
@@ -2278,8 +2273,7 @@ ahd_linux_queue_recovery_cmd(struct scsi
printf("Device is disconnected, re-queuing SCB\n");
wait = TRUE;
} else {
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- "Unable to deliver message\n");
+ scmd_printk(KERN_INFO, cmd, "Unable to deliver message\n");
retval = FAILED;
goto done;
}
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 120fc48..bf1af30 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -604,7 +604,7 @@ ahc_linux_slave_alloc(struct scsi_device
struct ahc_linux_device *dev;
if (bootverbose)
- dev_printk(KERN_INFO, &sdev->sdev_gendev, "Slave Alloc\n");
+ sdev_printk(KERN_INFO, sdev, "Slave Alloc\n");
BUG_ON(targ->sdev[scsilun_to_int(&sdev->lun)] != NULL);
@@ -639,7 +639,7 @@ ahc_linux_slave_configure(struct scsi_de
ahc = *((struct ahc_softc **)sdev->host->hostdata);
if (bootverbose)
- dev_printk(KERN_INFO, &sdev->sdev_gendev, "Slave Configure\n");
+ sdev_printk(KERN_INFO, sdev, "Slave Configure\n");
ahc_linux_device_queue_depth(sdev);
@@ -659,7 +659,7 @@ ahc_linux_slave_destroy(struct scsi_devi
ahc = *((struct ahc_softc **)sdev->host->hostdata);
if (bootverbose)
- dev_printk(KERN_INFO, &sdev->sdev_gendev, "Slave Destroy\n");
+ sdev_printk(KERN_INFO, sdev, "Slave Destroy\n");
BUG_ON(dev->active);
@@ -2117,8 +2117,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
wait = FALSE;
ahc = *(struct ahc_softc **)cmd->device->host->hostdata;
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- "Attempting to queue a%s message\n",
+ scmd_printk(KERN_INFO, cmd, "Attempting to queue a%s message\n",
flag == SCB_ABORT ? "n ABORT" : " TARGET RESET");
printf("CDB:");
@@ -2142,8 +2141,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
* No target device for this command exists,
* so we must not still own the command.
*/
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- "Is not an active device\n");
+ scmd_printk(KERN_INFO, cmd, "Is not an active device\n");
retval = SUCCESS;
goto no_cmd;
}
@@ -2153,8 +2151,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
scmd_channel(cmd) + 'A',
scsilun_to_int(&cmd->device->lun),
CAM_REQ_ABORTED, SEARCH_COMPLETE) != 0) {
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- "Command found on untagged queue\n");
+ scmd_printk(KERN_INFO, cmd, "Command found on untagged queue\n");
retval = SUCCESS;
goto done;
}
@@ -2180,8 +2177,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
}
if (pending_scb == NULL) {
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- "Command not found\n");
+ scmd_printk(KERN_INFO, cmd, "Command not found\n");
goto no_cmd;
}
@@ -2203,8 +2199,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
paused = TRUE;
if ((pending_scb->flags & SCB_ACTIVE) == 0) {
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- "Command already completed\n");
+ scmd_printk(KERN_INFO, cmd, "Command already completed\n");
goto no_cmd;
}
@@ -2220,8 +2215,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
pending_scb->hscb->tag,
ROLE_INITIATOR, CAM_REQ_ABORTED,
SEARCH_COMPLETE) > 0) {
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- "Cmd aborted from QINFIFO\n");
+ scmd_printk(KERN_INFO, cmd, "Cmd aborted from QINFIFO\n");
retval = SUCCESS;
goto done;
}
@@ -2271,8 +2265,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
pending_scb->flags |= SCB_RECOVERY_SCB|flag;
ahc_outb(ahc, MSG_OUT, HOST_MSG);
ahc_outb(ahc, SCSISIGO, last_phase|ATNO);
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- "Device is active, asserting ATN\n");
+ scmd_printk(KERN_INFO, cmd, "Device is active, asserting ATN\n");
wait = TRUE;
} else if (disconnected) {
@@ -2340,8 +2333,7 @@ ahc_linux_queue_recovery_cmd(struct scsi
printf("Device is disconnected, re-queuing SCB\n");
wait = TRUE;
} else {
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- "Unable to deliver message\n");
+ scmd_printk(KERN_INFO, cmd, "Unable to deliver message\n");
retval = FAILED;
goto done;
}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 14/n] more dev_printk driver work
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
` (11 preceding siblings ...)
2005-10-24 8:18 ` [PATCH RFC 13/n] " Jeff Garzik
@ 2005-10-24 17:41 ` Jeff Garzik
2005-10-24 18:00 ` [PATCH RFC 15/n] HCIL drivers update Jeff Garzik
13 siblings, 0 replies; 19+ messages in thread
From: Jeff Garzik @ 2005-10-24 17:41 UTC (permalink / raw)
To: linux-scsi
Took a pass through all scsi code in my temp repository, making two changes:
* convert sdev_printk(cmd->device,...) to scmd_printk(cmd,...)
* find any remaining printk/debug message statements that had to be
changed due to sdev->{channel,id,lun} changes, and make sure they
get converted to some variant of dev_printk.
Use of dev_printk and variants seems to be quite successful in killing a
ton of HCIL address usage.
drivers/message/fusion/mptbase.h | 4 +++
drivers/message/fusion/mptscsih.c | 8 -------
drivers/scsi/53c700.c | 25 +++++++++++-------------
drivers/scsi/NCR5380.c | 31 ++++++++++++++++--------------
drivers/scsi/NCR5380.h | 8 +++++++
drivers/scsi/NCR53C9x.c | 10 ++-------
drivers/scsi/aacraid/aacraid.h | 5 ++++
drivers/scsi/aic7xxx_old/aic7xxx_proc.c | 5 ----
drivers/scsi/atp870u.c | 11 ++++------
drivers/scsi/dc395x.c | 22 +++++++--------------
drivers/scsi/dpt_i2o.c | 12 +++++------
drivers/scsi/eata.c | 33 +++++++++++++-------------------
drivers/scsi/eata_pio.c | 10 ++++-----
drivers/scsi/ibmmca.c | 8 +++----
drivers/scsi/ide-scsi.c | 3 --
drivers/scsi/in2000.c | 2 -
drivers/scsi/megaraid/megaraid_sas.c | 3 --
drivers/scsi/qla2xxx/qla_dbg.c | 8 +++----
drivers/scsi/scsi_error.c | 3 --
drivers/scsi/scsi_scan.c | 6 ++---
drivers/scsi/sg.c | 7 +-----
drivers/scsi/tmscsim.c | 2 -
drivers/scsi/u14-34f.c | 19 ++++++++----------
23 files changed, 116 insertions(+), 129 deletions(-)
465c62e08c7a40fd53b966ba7f05cad6894ed419
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 7510527..3a56d58 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -654,8 +654,12 @@ typedef struct _mpt_sge {
*/
#ifdef MPT_DEBUG
#define dprintk(x) printk x
+#define dcwprintk(scmd, fmt, a...) \
+ scmd_printk(KERN_WARNING, scmd, "WARNING - " fmt, ##a)
#else
#define dprintk(x)
+#define dcwprintk(scmd, fmt, a...) \
+ do {} while (0)
#endif
#ifdef MPT_DEBUG_INIT
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index ced3739..7e4d6a8 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -975,13 +975,7 @@ mptscsih_report_queue_full(struct scsi_c
return;
if (time - hd->last_queue_full > 10 * HZ) {
- char lunstr[SCSILUN_STR_LEN];
-
- (void) lunstr; /* kill unused-var warning, if debug disabled */
-
- dprintk((MYIOC_s_WARN_FMT "Device (%d:%d:%s) reported QUEUE_FULL!\n",
- hd->ioc->name, 0, scmd_id(sc),
- scsilun_to_str(&sc->device->lun, lunstr)));
+ dcwprintk(sc, "Device QUEUE_FULL!\n");
hd->last_queue_full = time;
}
}
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index ed1cab5..c273d20 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -986,7 +986,8 @@ process_script_interrupt(__u32 dsps, __u
if(SCp->cmnd[0] == REQUEST_SENSE) {
/* OOPS: bad device, returning another
* contingent allegiance condition */
- printk(KERN_ERR "scsi%d (%d:%d) broken device is looping in contingent allegiance: ignoring\n", host->host_no, pun, lun);
+ scmd_printk(KERN_ERR, SCp,
+ "broken device is looping in contingent allegiance: ignoring\n");
NCR_700_scsi_done(hostdata, SCp, hostdata->status[0]);
} else {
#ifdef NCR_DEBUG
@@ -1050,7 +1051,8 @@ process_script_interrupt(__u32 dsps, __u
// SCp->request_bufflen,
// 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);
+ // scmd_printk(KERN_INFO, SCp,
+ // "Enabling Tag Command Queuing\n");
// hostdata->tag_negotiated |= (1<<scmd_id(SCp));
// NCR_700_set_flag(SCp->device, NCR_700_DEV_BEGIN_TAG_QUEUEING);
// } else {
@@ -1063,11 +1065,11 @@ process_script_interrupt(__u32 dsps, __u
} else if((dsps & 0xfffff0f0) == A_UNEXPECTED_PHASE) {
__u8 i = (dsps & 0xf00) >> 8;
- printk(KERN_ERR "scsi%d: (%d:%d), UNEXPECTED PHASE %s (%s)\n",
- host->host_no, pun, lun,
+ scmd_printk(KERN_ERR, SCp, "UNEXPECTED PHASE %s (%s)\n",
NCR_700_phase[i],
sbcl_to_string(NCR_700_readb(host, SBCL_REG)));
- printk(KERN_ERR " len = %d, cmd =", SCp->cmd_len);
+ scmd_printk(KERN_ERR, SCp, " len = %d, cmd =",
+ SCp->cmd_len);
scsi_print_command(SCp);
NCR_700_internal_bus_reset(host);
@@ -1801,8 +1803,7 @@ NCR_700_queuecommand(struct scsi_cmnd *S
if(blk_rq_tagged(SCp->request)
&& (hostdata->tag_negotiated &(1<<scmd_id(SCp))) == 0
&& NCR_700_get_tag_neg_state(SCp->device) == NCR_700_START_TAG_NEGOTIATION) {
- sdev_printk(KERN_ERR, SCp->device,
- "Enabling Tag Command Queuing\n");
+ scmd_printk(KERN_ERR, SCp, "Enabling Tag Command Queuing\n");
hostdata->tag_negotiated |= (1<<scmd_id(SCp));
NCR_700_set_tag_neg_state(SCp->device, NCR_700_DURING_TAG_NEGOTIATION);
}
@@ -1815,8 +1816,7 @@ NCR_700_queuecommand(struct scsi_cmnd *S
* */
if(!blk_rq_tagged(SCp->request)
&& (hostdata->tag_negotiated &(1<<scmd_id(SCp)))) {
- sdev_printk(KERN_INFO, SCp->device,
- "Disabling Tag Command Queuing\n");
+ scmd_printk(KERN_INFO, SCp, "Disabling Tag Command Queuing\n");
hostdata->tag_negotiated &= ~(1<<scmd_id(SCp));
}
@@ -1924,7 +1924,7 @@ NCR_700_abort(struct scsi_cmnd * SCp)
{
struct NCR_700_command_slot *slot;
- sdev_printk(KERN_INFO, SCp->device,
+ scmd_printk(KERN_INFO, SCp,
"New error handler wants to abort command\n\t");
scsi_print_command(SCp);
@@ -1958,7 +1958,7 @@ NCR_700_bus_reset(struct scsi_cmnd * SCp
struct NCR_700_Host_Parameters *hostdata =
(struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0];
- sdev_printk(KERN_INFO, SCp->device,
+ scmd_printk(KERN_INFO, SCp,
"New error handler wants BUS reset, cmd %p\n\t", SCp);
scsi_print_command(SCp);
@@ -1991,8 +1991,7 @@ NCR_700_bus_reset(struct scsi_cmnd * SCp
STATIC int
NCR_700_host_reset(struct scsi_cmnd * SCp)
{
- sdev_printk(KERN_INFO, SCp->device,
- "New error handler wants HOST reset\n\t");
+ scmd_printk(KERN_INFO, SCp, "New error handler wants HOST reset\n\t");
scsi_print_command(SCp);
spin_lock_irq(SCp->device->host->host_lock);
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 92ebb4a..0db23ae 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -1124,7 +1124,7 @@ static void NCR5380_main(void *p)
this is needed for Mustek scanners, that
do not respond to commands immediately
after a scan */
- sdev_printk(KERN_DEBUG, tmp->device,
+ scmd_printk(KERN_DEBUG, tmp,
"device did not respond in time\n");
LIST(tmp, hostdata->issue_queue);
tmp->host_scribble = (unsigned char *) hostdata->issue_queue;
@@ -1533,7 +1533,8 @@ part2:
goto failed;
}
- dprintk(NDEBUG_SELECTION, ("scsi%d : target %d selected, going into MESSAGE OUT phase.\n", instance->host_no, scmd_id(cmd)));
+ ddprintk(KERN_DEBUG, cmd,
+ "target selected, going into MESSAGE OUT phase.\n");
tmp[0] = IDENTIFY(((instance->irq == SCSI_IRQ_NONE) ? 0 : 1), &cmd->device->lun);
len = 1;
@@ -2198,8 +2199,7 @@ static void NCR5380_information_transfer
* If the watchdog timer fires, all future accesses to this
* device will use the polled-IO.
*/
- sdev_printk(KERN_INFO,
- cmd->device,
+ scmd_printk(KERN_INFO, cmd,
"switching to slow handshake\n");
cmd->device->borken = 1;
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | ICR_ASSERT_ATN);
@@ -2237,15 +2237,15 @@ static void NCR5380_information_transfer
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, scmd_id(cmd), cmd->device->lun));
+ ddprintk(KERN_DEBUG, cmd,
+ "linked command complete.\n");
/*
* Sanity check : A linked command should only terminate with
* one of these messages if there are more linked commands
* available.
*/
if (!cmd->next_link) {
- sdev_printk(KERN_INFO,
- cmd->device,
+ scmd_printk(KERN_INFO, cmd,
"linked command complete, no next_link\n");
sink = 1;
do_abort(instance);
@@ -2255,7 +2255,8 @@ static void NCR5380_information_transfer
/* 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, scmd_id(cmd), cmd->device->lun));
+ ddprintk(KERN_DEBUG, cmd,
+ "linked request done, calling scsi_done().\n");
collect_stats(hostdata, cmd);
cmd->scsi_done(cmd);
cmd = hostdata->connected;
@@ -2267,7 +2268,8 @@ static void NCR5380_information_transfer
sink = 1;
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
hostdata->connected = NULL;
- dprintk(NDEBUG_QUEUES, ("scsi%d : command for target %d, lun %s completed\n", instance->host_no, scmd_id(cmd), scsilun_to_str(&cmd->device->lun, lunstr)));
+ ddprintk(KERN_DEBUG, cmd,
+ "command completed\n");
hostdata->busy[scmd_id(cmd)] &= ~(1 << scsilun_to_int(&cmd->device->lun));
/*
@@ -2350,7 +2352,10 @@ static void NCR5380_information_transfer
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, scmd_id(cmd), cmd->device->lun));
+ ddprintk(KERN_DEBUG, cmd,
+ "command for target was moved from connected to"
+ " the disconnected_queue\n");
+
/*
* Restore phase bits to 0 so an interrupted selection,
* arbitration can resume.
@@ -2441,12 +2446,10 @@ static void NCR5380_information_transfer
scsi_print_msg(extended_msg);
printk("\n");
} else if (tmp != EXTENDED_MESSAGE)
- sdev_printk(KERN_INFO,
- cmd->device,
+ scmd_printk(KERN_INFO, cmd,
"rejecting unknown message %02x\n",tmp);
else
- sdev_printk(KERN_INFO,
- cmd->device,
+ scmd_printk(KERN_INFO, cmd,
"rejecting unknown extended message code %02x, length %d\n", extended_msg[1], extended_msg[0]);
msgout = MESSAGE_REJECT;
diff --git a/drivers/scsi/NCR5380.h b/drivers/scsi/NCR5380.h
index c3462e3..298b2df 100644
--- a/drivers/scsi/NCR5380.h
+++ b/drivers/scsi/NCR5380.h
@@ -289,6 +289,14 @@ struct NCR5380_hostdata {
#define NCR5380_dprint(a,b) do {} while(0)
#define NCR5380_dprint_phase(a,b) do {} while(0)
+#if 0
+#define ddprintk(prefix, scmd, fmt, a...) \
+ scmd_printk(prefix, scmd, fmt, ##a)
+#else
+#define ddprintk(prefix, scmd, fmt, a...) \
+ do {} while (0)
+#endif
+
#if defined(AUTOPROBE_IRQ)
static int NCR5380_probe_irq(struct Scsi_Host *instance, int possible);
#endif
diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c
index 157cada..477656b 100644
--- a/drivers/scsi/NCR53C9x.c
+++ b/drivers/scsi/NCR53C9x.c
@@ -2256,7 +2256,6 @@ static int esp_do_freebus(struct NCR_ESP
static int esp_bad_reconnect(struct NCR_ESP *esp)
{
Scsi_Cmnd *sp;
- char lunstr[SCSILUN_STR_LEN];
ESPLOG(("esp%d: Eieeee, reconnecting unknown command!\n",
esp->esp_id));
@@ -2264,24 +2263,21 @@ static int esp_bad_reconnect(struct NCR_
sp = esp->issue_SC;
ESPLOG(("esp%d: issue_SC[", esp->esp_id));
while(sp) {
- ESPLOG(("<%02x,%s>", scmd_id(sp),
- scsilun_to_str(&sp->device->lun, lunstr)));
+ ESPLOG_C(KERN_DEBUG, sp, ".. ");
sp = (Scsi_Cmnd *) sp->host_scribble;
}
ESPLOG(("]\n"));
sp = esp->current_SC;
ESPLOG(("esp%d: current_SC[", esp->esp_id));
while(sp) {
- ESPLOG(("<%02x,%s>", scmd_id(sp),
- scsilun_to_str(&sp->device->lun, lunstr)));
+ ESPLOG_C(KERN_DEBUG, sp, ".. ");
sp = (Scsi_Cmnd *) sp->host_scribble;
}
ESPLOG(("]\n"));
sp = esp->disconnected_SC;
ESPLOG(("esp%d: disconnected_SC[", esp->esp_id));
while(sp) {
- ESPLOG(("<%02x,%s>", scmd_id(sp),
- scsilun_to_str(&sp->device->lun, lunstr)));
+ ESPLOG_C(KERN_DEBUG, sp, ".. ");
sp = (Scsi_Cmnd *) sp->host_scribble;
}
ESPLOG(("]\n"));
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 57ae0db..27a23e3 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1,3 +1,6 @@
+#ifndef __AACRAID_AACRAID_H__
+#define __AACRAID_AACRAID_H__
+
#if (!defined(dprintk))
# define dprintk(x)
#endif
@@ -1788,3 +1791,5 @@ int probe_container(struct aac_dev *dev,
extern int numacb;
extern int acbsize;
extern char aac_driver_version[];
+
+#endif /* __AACRAID_AACRAID_H__ */
diff --git a/drivers/scsi/aic7xxx_old/aic7xxx_proc.c b/drivers/scsi/aic7xxx_old/aic7xxx_proc.c
index af4f7fe..48393b3 100644
--- a/drivers/scsi/aic7xxx_old/aic7xxx_proc.c
+++ b/drivers/scsi/aic7xxx_old/aic7xxx_proc.c
@@ -89,7 +89,6 @@ aic7xxx_proc_info ( struct Scsi_Host *HB
int size = 0;
unsigned char i;
unsigned char tindex;
- char lunstr[SCSILUN_STR_LEN];
for(p=first_aic7xxx; p && p->host != HBAptr; p=p->next)
;
@@ -263,9 +262,7 @@ aic7xxx_proc_info ( struct Scsi_Host *HB
{
sdptr = aic_dev->SDptr;
tindex = sdev_channel(sdptr) << 3 | sdev_id(sdptr);
- size += sprintf(BLS, "(scsi%d:%d:%d:%s)\n",
- p->host_no, sdev_channel(sdptr), sdev_id(sdptr),
- scsilun_to_str(&sdptr->lun, lunstr));
+ size += sprintf(BLS, "(scsi%s)\n", sdptr->sdev_gendev.bus_id);
size += sprintf(BLS, " Device using %s/%s",
(aic_dev->cur.width == MSG_EXT_WDTR_BUS_16_BIT) ?
"Wide" : "Narrow",
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index adc4aad..1511d54 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -297,11 +297,10 @@ stop_dma:
}
workreq = dev->id[c][target_id].curr_req;
#ifdef ED_DBGP
- printk(KERN_DEBUG "Channel = %d ID = %d LUN = %d CDB",c,scmd_id(workreq),workreq->device->lun);
- for(l=0;l<workreq->cmd_len;l++)
- {
+ scmd_printk(KERN_DEBUG, workreq, "CDB");
+ for (l = 0; l < workreq->cmd_len; l++)
printk(KERN_DEBUG " %x",workreq->cmnd[l]);
- }
+ printk("\n");
#endif
tmport = workport + 0x0f;
@@ -787,11 +786,11 @@ abortsnd:
oktosend:
#ifdef ED_DBGP
printk("OK to Send\n");
- printk("CDB");
+ scmd_printk(KERN_DEBUG, workreq, "CDB");
for(i=0;i<workreq->cmd_len;i++) {
printk(" %x",workreq->cmnd[i]);
}
- printk("\nChannel = %d ID = %d LUN = %d\n",c,scmd_id(workreq),workreq->device->lun);
+ printk("\n");
#endif
if (dev->dev_id == ATP885_DEVID) {
j = inb(dev->baseport + 0x29) & 0xfe;
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index 212393d..67758b5 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -1116,8 +1116,7 @@ static int dc395x_queue_command(struct s
/* does the specified lun on the specified device exist */
if (!(acb->dcb_map[scmd_id(cmd)] & (1 << lun))) {
- sdev_printk(KERN_INFO, cmd->device,
- "queue_command: Ignore target\n");
+ scmd_printk(KERN_INFO, cmd, "queue_command: Ignore target\n");
goto complete;
}
@@ -1125,8 +1124,7 @@ static int dc395x_queue_command(struct s
dcb = find_dcb(acb, scmd_id(cmd), &cmd->device->lun);
if (!dcb) {
/* should never happen */
- sdev_printk(KERN_INFO, cmd->device,
- "queue_command: No such device\n");
+ scmd_printk(KERN_INFO, cmd, "queue_command: No such device\n");
goto complete;
}
@@ -1217,7 +1215,7 @@ static void dump_register_info(struct Ad
dprintkl(KERN_INFO, "dump: srb=%p cmd=%p OOOPS!\n",
srb, srb->cmd);
else
- sdev_printk(KERN_INFO, srb->cmd->device,
+ scmd_printk(KERN_INFO, srb->cmd,
"dump: srb=%p cmd=%p (pid#%li) "
"cmnd=0x%02x\n",
srb, srb->cmd, srb->cmd->pid,
@@ -1314,7 +1312,7 @@ static int __dc395x_eh_bus_reset(struct
{
struct AdapterCtlBlk *acb =
(struct AdapterCtlBlk *)cmd->device->host->hostdata;
- sdev_printk(KERN_INFO, cmd->device,
+ scmd_printk(KERN_INFO, cmd,
"eh_bus_reset: (pid#%li) cmd=%p\n", cmd->pid, cmd);
if (timer_pending(&acb->waiting_timer))
@@ -1381,7 +1379,7 @@ static int dc395x_eh_abort(struct scsi_c
(struct AdapterCtlBlk *)cmd->device->host->hostdata;
struct DeviceCtlBlk *dcb;
struct ScsiReqBlk *srb;
- sdev_printk(KERN_INFO, cmd->device,
+ scmd_printk(KERN_INFO, cmd,
"eh_abort: (pid#%li) cmd=%p\n", cmd->pid, cmd);
dcb = find_dcb(acb, scmd_id(cmd), &cmd->device->lun);
@@ -1616,7 +1614,7 @@ static u8 start_scsi(struct AdapterCtlBl
tag_number++;
}
if (tag_number >= dcb->max_command) {
- sdev_printk(KERN_WARNING, srb->cmd->device,
+ scmd_printk(KERN_WARNING, srb->cmd,
"start_scsi: (pid#%li) "
"Out of tags)\n", srb->cmd->pid);
srb->state = SRB_READY;
@@ -3529,7 +3527,6 @@ static void doing_srb_done(struct Adapte
struct scsi_cmnd *cmd, u8 force)
{
struct DeviceCtlBlk *dcb;
- char lunstr[SCSILUN_STR_LEN];
dprintkl(KERN_INFO, "doing_srb_done: pids ");
list_for_each_entry(dcb, &acb->dcb_list, list) {
@@ -3544,9 +3541,7 @@ static void doing_srb_done(struct Adapte
p = srb->cmd;
dir = p->sc_data_direction;
result = MK_RES(0, did_flag, 0, 0);
- printk("G:%li(%02i-%s) ", p->pid,
- scmd_id(p),
- scsilun_to_str(&p->device->lun, lunstr));
+ scmd_printk(KERN_INFO, p, "G:%li ", p->pid);
srb_going_remove(dcb, srb);
free_tag(dcb, srb);
srb_free_insert(acb, srb);
@@ -3575,8 +3570,7 @@ static void doing_srb_done(struct Adapte
p = srb->cmd;
result = MK_RES(0, did_flag, 0, 0);
- printk("W:%li<%02i-%s>", p->pid, scmd_id(p),
- scsilun_to_str(&p->device->lun, lunstr));
+ scmd_printk(KERN_INFO, p, "W:%li", p->pid);
srb_waiting_remove(dcb, srb);
srb_free_insert(acb, srb);
p->result = result;
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 484e221..5818bd8 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -727,7 +727,7 @@ static int adpt_bus_reset(struct scsi_cm
pHba = (adpt_hba*)cmd->device->host->hostdata[0];
memset(msg, 0, sizeof(msg));
- dev_printk(KERN_WARNING, &cmd->device->sdev_gendev,
+ scmd_printk(KERN_WARNING, cmd,
"Bus reset: tid: %d\n", pHba->channel[scmd_channel(cmd)].tid );
msg[0] = FOUR_WORD_MSG_SIZE|SGL_OFFSET_0;
msg[1] = (I2O_HBA_BUS_RESET<<24|HOST_TID<<12|pHba->channel[scmd_channel(cmd)].tid);
@@ -748,7 +748,7 @@ static int __adpt_reset(struct scsi_cmnd
adpt_hba* pHba;
int rcode;
pHba = (adpt_hba*)cmd->device->host->hostdata[0];
- dev_printk(KERN_WARNING, &cmd->device->sdev_gendev,
+ scmd_printk(KERN_WARNING, cmd,
"Hba Reset: tid: %d\n", pHba->channel[scmd_channel(cmd)].tid );
rcode = adpt_hba_reset(pHba);
if(rcode == 0){
@@ -2261,7 +2261,7 @@ static s32 adpt_i2o_to_scsi(void __iomem
case I2O_SCSI_DSC_COMMAND_TIMEOUT:
case I2O_SCSI_DSC_NO_ADAPTER:
case I2O_SCSI_DSC_RESOURCE_UNAVAILABLE:
- dev_printk(KERN_WARNING, &cmd->device->sdev_gendev,
+ scmd_printk(KERN_WARNING, cmd,
"SCSI Timeout-Device hba status=0x%x, dev status=0x%x, cmd=0x%x\n",
hba_status, dev_status, cmd->cmnd[0]);
cmd->result = (DID_TIME_OUT << 16);
@@ -2302,7 +2302,7 @@ static s32 adpt_i2o_to_scsi(void __iomem
case I2O_SCSI_DSC_QUEUE_FROZEN:
case I2O_SCSI_DSC_REQUEST_INVALID:
default:
- dev_printk(KERN_WARNING, &cmd->device->sdev_gendev,
+ scmd_printk(KERN_WARNING, cmd,
"SCSI error %0x-Device hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n",
detailed_status & I2O_SCSI_DSC_MASK,
hba_status, dev_status, cmd->cmnd[0]);
@@ -2321,7 +2321,7 @@ static s32 adpt_i2o_to_scsi(void __iomem
cmd->sense_buffer[2] == DATA_PROTECT ){
/* This is to handle an array failed */
cmd->result = (DID_TIME_OUT << 16);
- dev_printk(KERN_WARNING, &cmd->device->sdev_gendev,
+ scmd_printk(KERN_WARNING, cmd,
"SCSI Data Protect-Device hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n",
hba_status, dev_status, cmd->cmnd[0]);
@@ -2333,7 +2333,7 @@ static s32 adpt_i2o_to_scsi(void __iomem
* for a limitted number of retries.
*/
cmd->result = (DID_TIME_OUT << 16);
- dev_printk(KERN_WARNING, &cmd->device->sdev_gendev,
+ scmd_printk(KERN_WARNING, cmd,
"I2O MSG_FAIL - Device tid=%d, cmd=0x%x\n",
((struct adpt_device*)(cmd->device->hostdata))->tid, cmd->cmnd[0]);
}
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index 430133b..b8bd8e7 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -1811,9 +1811,8 @@ static int eata2x_queuecommand(struct sc
SCpnt->host_scribble = (unsigned char *)&cpp->cpp_index;
if (do_trace)
- sdev_printk(KERN_INFO, SCpnt->device,
- "qcomm, mbox %d, pid %ld.\n",
- i, SCpnt->pid);
+ scmd_printk(KERN_INFO, SCpnt,
+ "qcomm, mbox %d, pid %ld.\n", i, SCpnt->pid);
cpp->reqsen = 1;
cpp->dispri = 1;
@@ -1845,9 +1844,8 @@ static int eata2x_queuecommand(struct sc
if (do_dma(shost->io_port, cpp->cp_dma_addr, SEND_CP_DMA)) {
unmap_dma(i, ha);
SCpnt->host_scribble = NULL;
- sdev_printk(KERN_INFO, SCpnt->device,
- "qcomm, pid %ld, adapter busy.\n",
- SCpnt->pid);
+ scmd_printk(KERN_INFO, SCpnt,
+ "qcomm, pid %ld, adapter busy.\n", SCpnt->pid);
return 1;
}
@@ -1862,16 +1860,14 @@ static int eata2x_eh_abort(struct scsi_c
unsigned int i;
if (SCarg->host_scribble == NULL) {
- sdev_printk(KERN_INFO, SCarg->device,
- "abort, pid %ld inactive.\n",
- SCarg->pid);
+ scmd_printk(KERN_INFO, SCarg,
+ "abort, pid %ld inactive.\n", SCarg->pid);
return SUCCESS;
}
i = *(unsigned int *)SCarg->host_scribble;
- sdev_printk(KERN_WARNING, SCarg->device,
- "abort, mbox %d, pid %ld.\n",
- i, SCarg->pid);
+ scmd_printk(KERN_WARNING, SCarg,
+ "abort, mbox %d, pid %ld.\n", i, SCarg->pid);
if (i >= shost->can_queue)
panic("%s: abort, invalid SCarg->host_scribble.\n", ha->board_name);
@@ -1932,9 +1928,8 @@ static int eata2x_eh_host_reset(struct s
struct Scsi_Host *shost = SCarg->device->host;
struct hostdata *ha = (struct hostdata *)shost->hostdata;
- sdev_printk(KERN_INFO, SCarg->device,
- "reset, enter, pid %ld.\n",
- SCarg->pid);
+ scmd_printk(KERN_INFO, SCarg,
+ "reset, enter, pid %ld.\n", SCarg->pid);
spin_lock_irq(shost->host_lock);
@@ -2251,7 +2246,7 @@ static int reorder(struct hostdata *ha,
k = il[n];
cpp = &ha->cp[k];
SCpnt = cpp->SCpnt;
- sdev_printk(KERN_INFO, SCpnt->device,
+ scmd_printk(KERN_INFO, SCpnt,
"%s 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"),
@@ -2298,7 +2293,7 @@ static void flush_dev(struct scsi_device
SCpnt = cpp->SCpnt;
if (do_dma(dev->host->io_port, cpp->cp_dma_addr, SEND_CP_DMA)) {
- sdev_printk(KERN_INFO, SCpnt->device,
+ scmd_printk(KERN_INFO, SCpnt,
"%s, pid %ld, mbox %d, adapter"
" busy, will abort.\n",
(ihdlr ? "ihdlr" : "qcomm"),
@@ -2463,7 +2458,7 @@ static irqreturn_t ihdlr(int irq, struct
if (spp->target_status && SCpnt->device->type == TYPE_DISK &&
(!(tstatus == CHECK_CONDITION && ha->iocount <= 1000 &&
(SCpnt->sense_buffer[2] & 0xf) == NOT_READY)))
- sdev_printk(KERN_INFO, SCpnt->device,
+ scmd_printk(KERN_INFO, SCpnt,
"ihdlr, pid %ld, "
"target_status 0x%x, sense key 0x%x.\n",
SCpnt->pid,
@@ -2533,7 +2528,7 @@ static irqreturn_t ihdlr(int irq, struct
spp->adapter_status != ASST && ha->iocount <= 1000) ||
do_trace || msg_byte(spp->target_status))
#endif
- sdev_printk(KERN_INFO, SCpnt->device, "ihdlr, mbox %2d, err 0x%x:%x,"
+ scmd_printk(KERN_INFO, SCpnt, "ihdlr, mbox %2d, err 0x%x:%x,"
" pid %ld, reg 0x%x, count %d.\n",
i, spp->adapter_status, spp->target_status,
SCpnt->pid, reg, ha->iocount);
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c
index 3a7455a..537aecf 100644
--- a/drivers/scsi/eata_pio.c
+++ b/drivers/scsi/eata_pio.c
@@ -384,7 +384,7 @@ static int eata_pio_queue(struct scsi_cm
cp->status = USED; /* claim free slot */
- DBG(DBG_QUEUE, sdev_printk(KERN_DEBUG, cmd->device,
+ DBG(DBG_QUEUE, scmd_printk(KERN_DEBUG, cmd,
"eata_pio_queue pid %ld, y %d\n",
cmd->pid, y));
@@ -429,7 +429,7 @@ static int eata_pio_queue(struct scsi_cm
if (eata_pio_send_command(base, EATA_CMD_PIO_SEND_CP)) {
cmd->result = DID_BUS_BUSY << 16;
- sdev_printk(KERN_NOTICE, cmd->device,
+ scmd_printk(KERN_NOTICE, cmd,
"eata_pio_queue pid %ld, HBA busy, "
"returning DID_BUS_BUSY, done.\n", cmd->pid);
done(cmd);
@@ -444,7 +444,7 @@ static int eata_pio_queue(struct scsi_cm
for (x = 0; x < hd->cppadlen; x++)
outw(0, base + HA_RDATA);
- DBG(DBG_QUEUE, sdev_printk(KERN_DEBUG, cmd->device,
+ DBG(DBG_QUEUE, scmd_printk(KERN_DEBUG, cmd,
"Queued base %#.4lx pid: %ld "
"slot %d irq %d\n", (long) sh->base, cmd->pid, y, sh->irq));
@@ -455,7 +455,7 @@ static int eata_pio_abort(struct scsi_cm
{
uint loop = HZ;
- DBG(DBG_ABNORM, sdev_printk(KERN_WARNING, cmd->device,
+ DBG(DBG_ABNORM, scmd_printk(KERN_WARNING, cmd,
"eata_pio_abort called pid: %ld\n",
cmd->pid));
@@ -491,7 +491,7 @@ static int eata_pio_host_reset(struct sc
struct scsi_cmnd *sp;
struct Scsi_Host *host = cmd->device->host;
- DBG(DBG_ABNORM, sdev_printk(KERN_WARNING, cmd->device,
+ DBG(DBG_ABNORM, scmd_printk(KERN_WARNING, cmd,
"eata_pio_reset called pid:%ld\n",
cmd->pid));
diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c
index da44f0e..e769bfd 100644
--- a/drivers/scsi/ibmmca.c
+++ b/drivers/scsi/ibmmca.c
@@ -674,7 +674,7 @@ static irqreturn_t interrupt_handler(int
#ifdef IM_DEBUG_TIMEOUT
if (cmd) {
if ((cmd->target == TIMEOUT_PUN) && (scsilun_to_int(&cmd->device->lun) == TIMEOUT_LUN)) {
- sdev_printk(KERN_INFO, cmd->device,
+ scmd_printk(KERN_INFO, cmd,
"IBM MCA SCSI: Ignoring interrupt\n");
return IRQ_HANDLED;
}
@@ -1861,7 +1861,7 @@ static int ibmmca_queuecommand(Scsi_Cmnd
next_ldn(host_index) = 7;
if (current_ldn == next_ldn(host_index)) { /* One circle done ? */
/* no non-processing ldn found */
- sdev_printk(KERN_WARNING, cmd->device,
+ scmd_printk(KERN_WARNING, cmd,
"IBM MCA SCSI: Cannot assign SCSI-device dynamically!\n"
" On ldn 7-14 SCSI-commands everywhere in progress.\n"
" Reporting DID_NO_CONNECT for device.\n");
@@ -1925,7 +1925,7 @@ static int ibmmca_queuecommand(Scsi_Cmnd
local_checking_phase_flag(host_index) = 0;
#ifdef IM_DEBUG_PROBE
/* Information on syslog terminal */
- sdev_printk(KERN_INFO, cmd->device,
+ scmd_printk(KERN_INFO, cmd,
"IBM MCA SCSI: ldn=0x%x dynamically reassigned to device.\n", ldn);
#endif
/* increase next_ldn for next dynamical assignment */
@@ -2173,7 +2173,7 @@ static int __ibmmca_abort(Scsi_Cmnd * cm
target = scmd_id(cmd);
/* get logical device number, and disable system interrupts */
- sdev_printk(KERN_WARNING, cmd->device,
+ scmd_printk(KERN_WARNING, cmd,
"IBM MCA SCSI: Sending abort to device.\n");
ldn = get_ldn(host_index)[target][scsilun_to_int(&cmd->device->lun)];
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 269cfbe..01f8ebf 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -893,8 +893,7 @@ static int idescsi_queue (struct scsi_cm
idescsi_pc_t *pc = NULL;
if (!drive) {
- sdev_printk (KERN_ERR, cmd->device,
- "ide-scsi: drive not present\n");
+ scmd_printk (KERN_ERR, cmd, "drive not present\n");
goto abort;
}
scsi = drive_to_idescsi(drive);
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
index 4442183..18c95d3 100644
--- a/drivers/scsi/in2000.c
+++ b/drivers/scsi/in2000.c
@@ -343,7 +343,7 @@ static int in2000_queuecommand(Scsi_Cmnd
instance = cmd->device->host;
hostdata = (struct IN2000_hostdata *) instance->hostdata;
- DB(DB_QUEUE_COMMAND, sdev_printk(KERN_DEBUG, cmd->device, "Q-%02x-%ld(", cmd->cmnd[0], cmd->pid))
+ DB(DB_QUEUE_COMMAND, scmd_printk(KERN_DEBUG, cmd, "Q-%02x-%ld(", 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
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 07bd25c..0b4bed4 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -758,8 +758,7 @@ static int megasas_generic_reset(struct
instance = (struct megasas_instance *)scmd->device->host->hostdata;
- dev_printk(KERN_NOTICE, &scmd->device->sdev_gendev,
- "megasas: RESET -%ld cmd=%x\n",
+ scmd_printk(KERN_NOTICE, scmd, "megasas: RESET -%ld cmd=%x\n",
scmd->serial_number, scmd->cmnd[0]);
if (instance->hw_crit_error) {
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 3590a46..128c17f 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -1985,11 +1985,11 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd
ha = (struct scsi_qla_host *)cmd->device->host->hostdata;
sp = (srb_t *) cmd->SCp.ptr;
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
+ scmd_printk(KERN_INFO, cmd,
"SCSI Command @=0x%p, Handle=0x%p\n", cmd, cmd->host_scribble);
- dev_printk(KERN_INFO, &cmd->device->sdev_gendev,
- " cmd_len=0x%02x\n",
- cmd->cmd_len);
+ scmd_printk(KERN_INFO, cmd,
+ " cmd_len=0x%02x\n", cmd->cmd_len);
+
printk(" CDB: ");
for (i = 0; i < cmd->cmd_len; i++) {
printk("0x%02x ", cmd->cmnd[i]);
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 31602d0..32e9ead 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -675,8 +675,7 @@ static int scsi_eh_get_sense(struct list
SCSI_SENSE_VALID(scmd))
continue;
- SCSI_LOG_ERROR_RECOVERY(2, sdev_printk(KERN_INFO,
- scmd->device,
+ SCSI_LOG_ERROR_RECOVERY(2, scmd_printk(KERN_INFO, scmd,
"%s: requesting sense\n",
current->comm));
rtn = scsi_request_sense(scmd);
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index a3c546a..abf4e42 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1411,9 +1411,9 @@ int scsi_scan_host_selected(struct Scsi_
{
char lunstr[SCSILUN_STR_LEN];
- SCSI_LOG_SCAN_BUS(3, printk (KERN_INFO "%s: <%u:%u:%u:%s>\n",
- __FUNCTION__, shost->host_no, channel, id,
- scsilun_to_str(lun, lunstr)));
+ SCSI_LOG_SCAN_BUS(3, shost_printk (KERN_INFO, shost,
+ "%s: <%u:%u:%s>\n",
+ __FUNCTION__, channel, id, scsilun_to_str(lun, lunstr)));
if (((channel != SCAN_WILD_CARD) && (channel > shost->max_channel)) ||
((id != SCAN_WILD_CARD) && (id > shost->max_id)))
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 0287861..d7cee61 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -3003,14 +3003,11 @@ static int sg_proc_seq_show_dev(struct s
struct sg_proc_deviter * it = (struct sg_proc_deviter *) v;
Sg_device *sdp;
struct scsi_device *scsidp;
- char lunstr[SCSILUN_STR_LEN];
sdp = it ? sg_get_dev(it->index) : NULL;
if (sdp && (scsidp = sdp->device) && (!sdp->detached))
- seq_printf(s, "%d\t%d\t%d\t%s\t%d\t%d\t%d\t%d\t%d\n",
- scsidp->host->host_no, sdev_channel(scsidp),
- sdev_id(scsidp),
- scsilun_to_str(&scsidp->lun, lunstr),
+ seq_printf(s, "%s\t%d\t%d\t%d\t%d\t%d\n",
+ scsidp->sdev_gendev.bus_id,
(int) scsidp->type,
1,
(int) scsidp->queue_depth,
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index a624127..75c6b14 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -2079,7 +2079,7 @@ static int DC390_abort(struct scsi_cmnd
struct dc390_acb *pACB = (struct dc390_acb*) cmd->device->host->hostdata;
struct dc390_dcb *pDCB = (struct dc390_dcb*) cmd->device->hostdata;
- sdev_printk(KERN_WARNING, cmd->device,
+ scmd_printk(KERN_WARNING, cmd,
"DC390: Abort command (pid %li)\n", cmd->pid);
/* abort() is too stupid for already sent commands at the moment.
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index a3bff57..927eac4 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -1291,7 +1291,7 @@ static int u14_34f_queuecommand(struct s
SCpnt->host_scribble = (unsigned char *) &cpp->cpp_index;
if (do_trace)
- sdev_printk(KERN_INFO, SCpnt->device,
+ scmd_printk(KERN_INFO, SCpnt,
"qcomm, mbox %d, pid %ld.\n", i, SCpnt->pid);
cpp->opcode = OP_SCSI;
@@ -1318,7 +1318,7 @@ static int u14_34f_queuecommand(struct s
if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
unmap_dma(i, j);
SCpnt->host_scribble = NULL;
- sdev_printk(KERN_INFO, SCpnt->device,
+ scmd_printk(KERN_INFO, SCpnt,
"qcomm, pid %ld, adapter busy.\n", SCpnt->pid);
return 1;
}
@@ -1339,13 +1339,13 @@ static int u14_34f_eh_abort(struct scsi_
j = ((struct hostdata *) SCarg->device->host->hostdata)->board_number;
if (SCarg->host_scribble == NULL) {
- sdev_printk(KERN_INFO, SCarg->device, "abort, pid %ld inactive.\n",
+ scmd_printk(KERN_INFO, SCarg, "abort, pid %ld inactive.\n",
SCarg->pid);
return SUCCESS;
}
i = *(unsigned int *)SCarg->host_scribble;
- sdev_printk(KERN_INFO, SCarg->device, "abort, mbox %d, pid %ld.\n",
+ scmd_printk(KERN_INFO, SCarg, "abort, mbox %d, pid %ld.\n",
i, SCarg->pid);
if (i >= sh[j]->can_queue)
@@ -1404,8 +1404,7 @@ static int u14_34f_eh_host_reset(struct
struct scsi_cmnd *SCpnt;
j = ((struct hostdata *) SCarg->device->host->hostdata)->board_number;
- sdev_printk(KERN_INFO, SCarg->device,
- "reset, enter, pid %ld.\n", SCarg->pid);
+ scmd_printk(KERN_INFO, SCarg, "reset, enter, pid %ld.\n", SCarg->pid);
spin_lock_irq(sh[j]->host_lock);
@@ -1708,8 +1707,8 @@ static void flush_dev(struct scsi_device
k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt;
if (wait_on_busy(sh[j]->io_port, MAXLOOP)) {
- sdev_printk(KERN_INFO, SCpnt->device,
- "%s, pid %ld, mbox %d, adapter"\
+ scmd_printk(KERN_INFO, SCpnt,
+ "%s, pid %ld, mbox %d, adapter"
" busy, will abort.\n", (ihdlr ? "ihdlr" : "qcomm"),
SCpnt->pid, k);
HD(j)->cp_stat[k] = ABORTING;
@@ -1841,7 +1840,7 @@ static irqreturn_t ihdlr(int irq, unsign
if (spp->target_status && SCpnt->device->type == TYPE_DISK &&
(!(tstatus == CHECK_CONDITION && HD(j)->iocount <= 1000 &&
(SCpnt->sense_buffer[2] & 0xf) == NOT_READY)))
- sdev_printk(KERN_INFO, SCpnt->device,
+ scmd_printk(KERN_INFO, SCpnt,
"ihdlr, pid %ld, target_status 0x%x, sense key 0x%x.\n",
SCpnt->pid, spp->target_status,
SCpnt->sense_buffer[2]);
@@ -1913,7 +1912,7 @@ static irqreturn_t ihdlr(int irq, unsign
spp->adapter_status != ASST && HD(j)->iocount <= 1000) ||
do_trace || msg_byte(spp->target_status))
#endif
- sdev_printk(KERN_INFO, SCpnt->device, "ihdlr, mbox %2d, err 0x%x:%x,"\
+ scmd_printk(KERN_INFO, SCpnt, "ihdlr, mbox %2d, err 0x%x:%x,"\
" pid %ld, reg 0x%x, count %d.\n",
i, spp->adapter_status, spp->target_status, SCpnt->pid,
reg, HD(j)->iocount);
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH RFC 15/n] HCIL drivers update
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
` (12 preceding siblings ...)
2005-10-24 17:41 ` [PATCH RFC 14/n] more dev_printk driver work Jeff Garzik
@ 2005-10-24 18:00 ` Jeff Garzik
13 siblings, 0 replies; 19+ messages in thread
From: Jeff Garzik @ 2005-10-24 18:00 UTC (permalink / raw)
To: linux-scsi
fix cases where 0 is passed as lun0, when we really want scsi_lun*
drivers/scsi/scsi_scan.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
1a13759a275199b7b6bb58dbddfee1e843b1ea2a
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index abf4e42..1ccc4b1 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -1074,6 +1074,7 @@ static int scsi_report_lun_scan(struct s
unsigned int retries;
int result;
struct scsi_lun *lunp, *lun_data;
+ struct scsi_lun lun0;
u8 *data;
struct scsi_sense_hdr sshdr;
struct scsi_device *sdev;
@@ -1092,8 +1093,9 @@ static int scsi_report_lun_scan(struct s
if (bflags & BLIST_NOLUN)
return 0;
- if (!(sdev = scsi_device_lookup_by_target(starget, 0))) {
- sdev = scsi_alloc_sdev(starget, 0, NULL);
+ int_to_scsilun(0, &lun0);
+ if (!(sdev = scsi_device_lookup_by_target(starget, &lun0))) {
+ sdev = scsi_alloc_sdev(starget, &lun0, NULL);
if (!sdev)
return 0;
if (scsi_device_get(sdev))
@@ -1499,6 +1501,7 @@ struct scsi_device *scsi_get_host_dev(st
{
struct scsi_device *sdev = NULL;
struct scsi_target *starget;
+ struct scsi_lun lun0;
down(&shost->scan_mutex);
if (!scsi_host_scan_allowed(shost))
@@ -1507,7 +1510,8 @@ struct scsi_device *scsi_get_host_dev(st
if (!starget)
goto out;
- sdev = scsi_alloc_sdev(starget, 0, NULL);
+ int_to_scsilun(0, &lun0);
+ sdev = scsi_alloc_sdev(starget, &lun0, NULL);
if (sdev) {
sdev->sdev_gendev.parent = get_device(&starget->dev);
sdev->borken = 0;
^ permalink raw reply related [flat|nested] 19+ messages in thread
end of thread, other threads:[~2005-10-24 18:00 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-23 2:41 [PATCH RFC] kill scsi_device::{channel,id} in generic code Jeff Garzik
2005-10-23 19:51 ` [PATCH RFC 1/2] HCIL drivers update Jeff Garzik
2005-10-23 19:52 ` [PATCH RFC 2/2] " Jeff Garzik
2005-10-23 20:12 ` [PATCH RFC 3/2] HCIL driver update: lpfc Jeff Garzik
2005-10-23 21:40 ` [PATCH RFC 4/2] HCIL drivers update; sdev_printk Jeff Garzik
2005-10-24 3:36 ` James Bottomley
2005-10-24 4:01 ` Jeff Garzik
2005-10-24 0:13 ` [PATCH RFC 5/n] HCIL drivers update Jeff Garzik
2005-10-24 0:14 ` [PATCH RFC 6/n] " Jeff Garzik
2005-10-24 3:49 ` [PATCH RFC 7/n] " Jeff Garzik
2005-10-24 6:43 ` Stefan Richter
2005-10-24 3:52 ` [PATCH RFC 8/n] " Jeff Garzik
2005-10-24 5:14 ` [PATCH RFC 9/n] sfoo_printk stuff merges Jeff Garzik
2005-10-24 8:15 ` [PATCH RFC 10/n] HCIL drivers update Jeff Garzik
2005-10-24 8:16 ` [PATCH RFC 11/n] " Jeff Garzik
2005-10-24 8:17 ` [PATCH RFC 12/n] " Jeff Garzik
2005-10-24 8:18 ` [PATCH RFC 13/n] " Jeff Garzik
2005-10-24 17:41 ` [PATCH RFC 14/n] more dev_printk driver work Jeff Garzik
2005-10-24 18:00 ` [PATCH RFC 15/n] HCIL drivers update Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).