kill scsi_device::{channel,id} in generic code
Subsystems (30)
RFC PATCH 1/1 kill scsi_device::{channel,id} in generic code
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).
drivers/scsi/constants.c +1 -5
@@ -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);
drivers/scsi/scsi.c +14 -15
@@ -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_cmnif (((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_cmnif (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 scsistruct 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_lookupstruct 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; }
drivers/scsi/scsi_error.c +21 -26
108 lines not on this page · raw message
drivers/scsi/scsi_ioctl.c +4 -8
@@ -122,12 +122,8 @@ static int ioctl_internal_command(structbreak ; }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,
drivers/scsi/scsi_lib.c +10 -11
@@ -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_qif (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 requebreak ;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 ; }
drivers/scsi/scsi_proc.c +3 -1
@@ -150,7 +150,9 @@ static int proc_print_scsidevice(structseq_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]);
drivers/scsi/scsi_scan.c +9 -13
@@ -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); }
drivers/scsi/scsi_sysfs.c +3 -5
@@ -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);
drivers/scsi/sd.c +6 -6
@@ -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 ;
drivers/scsi/sg.c +10 -14
@@ -885,9 +885,9 @@ sg_ioctl(struct inode *inode, struct filreturn -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(structseq_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",
drivers/scsi/sr.c +2 -4
@@ -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:
include/scsi/scsi_device.h +11 -1
@@ -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 ;
RFC PATCH 1/2 HCIL drivers update
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
drivers/scsi/53c700.c +52 -59
@@ -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_Hosbreak ;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_Hosbreak ;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, __uif (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, __uNCR_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, __ustruct 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 *Sscsi_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",
drivers/scsi/53c700.h +3 -3
@@ -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 */
drivers/scsi/BusLogic.c +6 -6
@@ -2139,7 +2139,7 @@ static void __init BusLogic_InitializeHostatic 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 scstatic 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);/*
drivers/scsi/aacraid/aachba.c +16 -16
@@ -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 *celse {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 *deif (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 ){
drivers/scsi/aacraid/aacraid.h +0 -1
@@ -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)
drivers/scsi/advansys.c +22 -21
124 lines not on this page · raw message
drivers/scsi/aha152x.c +3 -2
@@ -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);
drivers/scsi/aic7xxx/aic79xx_osm.c +48 -48
241 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_osm.c +54 -59
266 lines not on this page · raw message
drivers/scsi/dpt_i2o.c +19 -12
@@ -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_cmndadpt_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 __iomemcase 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 __iomemcase 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 ]); }
drivers/scsi/fdomain.c +2 -2
@@ -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
RFC PATCH 2/2 HCIL drivers update
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(-)
drivers/scsi/lpfc/lpfc_scsi.c +52 -28
@@ -370,6 +370,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hbastruct 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_hbauint32_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 lpfcstruct 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 lpfclpfc_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 lpfclpfc_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 *creturn 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_cmnstruct 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_cmnif (!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 *sdeif (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 ; }
drivers/scsi/lpfc/lpfc_sli.c +4 -3
@@ -2504,12 +2504,13 @@ lpfc_sli_validate_iocb_cmd(struct lpfc_sswitch (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 :
drivers/scsi/megaraid/mega_common.h +4 -4
@@ -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) \/* \
drivers/scsi/megaraid/megaraid_mbox.c +4 -4
@@ -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 devicefor (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;
drivers/scsi/megaraid/megaraid_sas.c +7 -7
@@ -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 "
drivers/scsi/megaraid/megaraid_sas.h +3 -3
@@ -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 {
drivers/scsi/pcmcia/nsp_cs.c +7 -7
@@ -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 *SCpstatic 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);/*
drivers/scsi/pcmcia/sym53c500_cs.c +1 -1
@@ -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++) {
drivers/scsi/psi240i.c +2 -2
@@ -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;
drivers/scsi/qla2xxx/qla_dbg.c +4 -3
@@ -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++) {
drivers/scsi/qla2xxx/qla_iocb.c +3 -3
@@ -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)) {
drivers/scsi/qla2xxx/qla_isr.c +3 -4
@@ -1034,11 +1034,10 @@ qla2x00_status_entry(scsi_qla_host_t *haif ((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 ;
drivers/scsi/qla2xxx/qla_mbx.c +1 -1
@@ -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 ;
drivers/scsi/qla2xxx/qla_os.c +17 -26
124 lines not on this page · raw message
drivers/scsi/scsi_scan.c +1 -1
@@ -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);
drivers/scsi/sym53c8xx_2/sym_glue.c +27 -17
135 lines not on this page · raw message
drivers/scsi/sym53c8xx_2/sym_hipd.c +52 -42
288 lines not on this page · raw message
drivers/scsi/sym53c8xx_2/sym_hipd.h +9 -4
@@ -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);
drivers/scsi/sym53c8xx_2/sym_misc.h +7 -3
@@ -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
drivers/usb/storage/dpcm.c +12 -5
@@ -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 ; }
drivers/usb/storage/transport.c +2 -2
@@ -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 */
drivers/usb/storage/usb.c +16 -6
@@ -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
include/scsi/scsi.h +1 -1
@@ -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
include/scsi/scsi_device.h +11 -0
@@ -289,6 +289,17 @@ static inline int scsilun_eq(const strucreturn (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 ;
[PATCH RFC 3/2] HCIL driver update: lpfc
In reply to Jeff GarzikApplied 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(-)
drivers/scsi/lpfc/lpfc_scsi.c +7 -24
@@ -370,7 +370,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hbastruct 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_hbauint32_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 lpfcstruct 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 lpfclpfc_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 lpfclpfc_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 lpfclpfc_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_cmnstruct 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);
[PATCH RFC 4/2] HCIL drivers update; sdev_printk
In reply to Jeff GarzikYet 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
drivers/scsi/aic7xxx_old.c +122 -110
@@ -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_hostunsigned 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_hostif (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_hostlist_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_hostaic_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_hosstruct 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_hoscase 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_hosif (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_hosif (!(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_hosmemcpy (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 *pint 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_hounsigned 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(sunpause_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_hoScsi_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 aic7xxstruct 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 aic7xxif (!(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 );
drivers/scsi/aic7xxx_old/aic7xxx_proc.c +5 -3
@@ -89,6 +89,7 @@ aic7xxx_proc_info ( struct Scsi_Host *HBint 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 *HBlist_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",
drivers/scsi/fd_mcs.c +2 -2
@@ -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
drivers/scsi/in2000.c +51 -40
267 lines not on this page · raw message
drivers/scsi/ips.c +17 -17
@@ -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 ;
drivers/scsi/pcmcia/nsp_cs.c +3 -2
@@ -957,7 +957,8 @@ static irqreturn_t nspintr(int irq, voidunsigned 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);/*
drivers/scsi/u14-34f.c +29 -31
136 lines not on this page · raw message
drivers/scsi/ultrastor.c +2 -2
@@ -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;
include/scsi/scsi_device.h +3 -0
@@ -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;
Re: [PATCH RFC 4/2] HCIL drivers update; sdev_printk
Quoted 3 lines · Jeff Garzik
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
Re: [PATCH RFC 4/2] HCIL drivers update; sdev_printk
Quoted 4 lines · James Bottomley
Quoted 2 lines · Jeff Garzik
Yet more driver work. Some bugs added (and noted).
Quoted 8 lines
Quoted 1 line
Added
sdev_printk()to save typing.If you can unify this with the
sdev_prinkwork herehttp://marc.theaimsgroup.com/?l=linux-scsi&m=112827155625203
This can probably be applied independently
Is this in a git tree somewhere?
Jeff
RFC PATCH 1/1 HCIL drivers update
In reply to Jeff GarzikUse 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
drivers/scsi/scsi.c +5 -7
@@ -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_cmnif (((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_cmnif (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 :
drivers/scsi/scsi_error.c +5 -5
@@ -241,7 +241,7 @@ static inline void scsi_eh_prt_fail_statif (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(structstruct 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 :
drivers/scsi/scsi_ioctl.c +1 -1
@@ -122,7 +122,7 @@ static int ioctl_internal_command(structbreak ; }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);
drivers/scsi/scsi_lib.c +9 -11
@@ -952,15 +952,13 @@ void scsi_io_completion(struct scsi_cmndreturn ; }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_qif (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 requebreak ;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))
drivers/scsi/scsi_scan.c +4 -4
@@ -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",
drivers/scsi/scsi_transport_spi.c +1 -1
@@ -618,7 +618,7 @@ spi_dv_device_echo_buffer(struct scsi_dereturn 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 ; }
drivers/scsi/sd.c +2 -4
@@ -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);
drivers/scsi/sg.c +2 -2
@@ -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 ;
drivers/scsi/sr.c +1 -1
@@ -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 ;
RFC PATCH 1/1 HCIL drivers update
In reply to Jeff GarzikMore 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
drivers/scsi/NCR5380.c +42 -28
@@ -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_Cmcase 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 NCR5380case 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_Houdelay (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_transferScsi_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_transfercase 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_transfercase 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_transferscsi_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 Scsifor (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);
drivers/scsi/NCR53C9x.c +58 -42
328 lines not on this page · raw message
drivers/scsi/NCR53c406a.c +1 -1
@@ -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++) {
drivers/scsi/cpqfcTSinit.c +8 -4
@@ -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); }
drivers/scsi/eata.c +39 -49
183 lines not on this page · raw message
drivers/scsi/eata_pio.c +18 -9
@@ -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_cmelse 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_cmif (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_cmfor (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 scstruct 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);
drivers/scsi/g_NCR5380.c +8 -6
@@ -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(strif (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];
drivers/scsi/libata-scsi.c +6 -6
@@ -344,12 +344,12 @@ int ata_scsi_slave_config(struct scsi_deblk_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, sstruct 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)))
drivers/scsi/ncr53c8xx.c +38 -37
231 lines not on this page · raw message
drivers/scsi/qla1280.c +8 -8
@@ -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 scsuint16_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 ;
drivers/scsi/qlogicfas408.c +2 -2
@@ -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 ;
drivers/scsi/qlogicfc.c +11 -10
@@ -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 ;
drivers/scsi/qlogicisp.c +2 -2
@@ -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 );
drivers/scsi/seagate.c +14 -10
@@ -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 (intDPRINTK (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 (SDANY ("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 (Sreturn 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 ;
drivers/scsi/sym53c416.c +1 -1
@@ -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++)
drivers/scsi/wd7000.c +2 -1
@@ -1094,7 +1094,8 @@ static int wd7000_queuecommand(struct scAdapter *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 );
RFC PATCH 1/1 HCIL drivers update
In reply to Jeff GarzikMore 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
drivers/block/cciss_scsi.c +34 -17
@@ -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 *sget 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 */
drivers/block/cciss_scsi.h +2 -1
@@ -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 */ };
drivers/ieee1394/sbp2.c +1 -1
@@ -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;/*
drivers/message/fusion/mptsas.c +2 -2
@@ -136,7 +136,7 @@ mptsas_slave_alloc(struct scsi_device *dstruct 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; } }
drivers/message/fusion/mptscsih.c +60 -40
324 lines not on this page · raw message
drivers/scsi/53c700.c +78 -66
358 lines not on this page · raw message
drivers/scsi/53c700.h +3 -3
@@ -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 */
drivers/scsi/a100u2w.c +4 -4
@@ -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 * pHprintk ("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)); }
drivers/scsi/aha152x.c +14 -11
@@ -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(SScsi_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]);
drivers/scsi/aha1542.c +6 -5
@@ -601,8 +601,8 @@ static int aha1542_queuecommand(Scsi_Cmnunchar 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 ;
drivers/scsi/aha1740.c +2 -2
@@ -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 */
drivers/scsi/atp870u.c +12 -12
@@ -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 sstruct 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]);
drivers/scsi/dc395x.c +50 -46
271 lines not on this page · raw message
drivers/scsi/gdth.c +16 -15
@@ -2248,8 +2248,8 @@ static void gdth_putq(int hanum,Scsi_Cmnspin_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 hgdth_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,Sulong 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,intprintk ("\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 *inodreturn -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);
drivers/scsi/gdth_proc.c +6 -6
@@ -951,8 +951,8 @@ static void gdth_wait_completion(int hanfor (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 hanumspin_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);
drivers/scsi/ibmmca.c +33 -21
121 lines not on this page · raw message
drivers/scsi/ide-scsi.c +2 -1
@@ -893,7 +893,8 @@ static int idescsi_queue (struct scsi_cmidescsi_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);
drivers/scsi/initio.c +4 -4
@@ -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_deTCS *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;
drivers/scsi/tmscsim.c +7 -5
@@ -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_cmndstruct 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)
drivers/usb/image/microtek.c +11 -3
@@ -583,14 +583,22 @@ int mts_scsi_queuecommand( Scsi_Cmnd *srstruct 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" );
Re: [PATCH RFC 7/n] HCIL drivers update
Quoted 1 line · Jeff Garzik
More sdev->{command,id,lun} work. DO NOT APPLY.
...
drivers/ieee1394/sbp2.c static int sbp2scsi_queuecommand(struct · line 2519
Quoted 13 lines
drivers/ieee1394/sbp2.c +1
-1@@ -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.
Signature · 3 lines
Stefan Richter -=====-=-=-= =-=- ==--- http://arcgraph.de/sr/
RFC PATCH 1/1 HCIL drivers update
In reply to Jeff Garzikmore 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
drivers/scsi/3w-9xxx.c +10 -6
@@ -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_cmTW_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_Dememcpy (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 */
drivers/scsi/3w-xxxx.c +19 -13
@@ -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 ; }
drivers/scsi/aic7xxx_old.c +11 -9
@@ -3934,10 +3934,11 @@ aic7xxx_handle_seqint(struct aic7xxx_hosstruct 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_hoselse 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_hosif (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 ;
drivers/scsi/ch.c +16 -14
@@ -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);
drivers/scsi/imm.c +1 -1
@@ -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 ; }
drivers/scsi/ipr.c +21 -8
@@ -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_dspin_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 pcscsi_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 ;
drivers/scsi/ipr.h +2 -3
@@ -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__)
drivers/scsi/nsp32.c +11 -11
@@ -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(strunsp32_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(strunsp32_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 scsnsp32_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 scsnsp32_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 */
drivers/scsi/osst.c +3 -3
@@ -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 ;
drivers/scsi/ppa.c +1 -1
@@ -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 ; }
drivers/scsi/scsi_debug.c +15 -17
@@ -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(unsignedstatic 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(ststruct 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 * devInfoRreturn 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_cmnif (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) {
drivers/scsi/st.c +5 -6
@@ -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);
RFC PATCH 1/1 sfoo_printk stuff merges
In reply to Jeff GarzikWent 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
drivers/scsi/constants.c +1 -1
@@ -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);
drivers/scsi/hosts.c +1 -1
@@ -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),
drivers/scsi/scsi.c +3 -3
@@ -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_cmnif (((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 ;
drivers/scsi/scsi_error.c +2 -3
@@ -1177,7 +1177,7 @@ static void scsi_eh_offline_sdevs(structstruct 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 ;
drivers/scsi/scsi_lib.c +3 -3
@@ -951,13 +951,13 @@ void scsi_io_completion(struct scsi_cmndreturn ; }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 )
drivers/scsi/scsi_transport_fc.c +0 -2
@@ -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.
drivers/scsi/scsi_transport_spi.c +10 -12
@@ -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_devicif (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 ;
drivers/scsi/sd.c +1 -2
@@ -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 ;
drivers/scsi/sr.c +6 -5
@@ -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:
drivers/scsi/st.c +3 -4
@@ -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",
include/scsi/scsi_device.h +11 -3
@@ -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(strucreturn 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));
include/scsi/scsi_host.h +4 -0
@@ -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)
RFC PATCH 1/1 HCIL drivers update
In reply to Jeff GarzikReplace sdev_id(cmd->device) with scmd_id(cmd).
[patch too large for list, and is completely obvious]
RFC PATCH 1/1 HCIL drivers update
In reply to Jeff GarzikReplace 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
drivers/block/cciss_scsi.c +1 -2
@@ -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... */
drivers/message/fusion/mptscsih.c +3 -4
@@ -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 * SCint_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 * SCint_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",
drivers/scsi/aacraid/aachba.c +4 -4
@@ -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);
drivers/scsi/aic7xxx/aic79xx_osm.c +5 -5
@@ -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 scsiif (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 );
drivers/scsi/aic7xxx/aic7xxx_osm.c +10 -10
@@ -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 scsiif ((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,
drivers/scsi/aic7xxx_old.c +12 -12
@@ -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 *pstruct 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 );
drivers/scsi/atp870u.c +3 -3
@@ -622,10 +622,10 @@ static int atp870u_queuecommand(struct sstruct 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]);
drivers/scsi/dpt_i2o.c +4 -4
@@ -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_cmndint 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);
drivers/scsi/eata.c +6 -6
@@ -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, structcase 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 ;
drivers/scsi/gdth.c +5 -5
@@ -2248,7 +2248,7 @@ static void gdth_putq(int hanum,Scsi_Cmnspin_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,intprintk ("\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);
drivers/scsi/gdth_proc.c +3 -3
@@ -951,7 +951,7 @@ static void gdth_wait_completion(int hanfor (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 hanumspin_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" ));
drivers/scsi/ipr.c +1 -1
@@ -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 ;
drivers/scsi/ips.c +8 -8
@@ -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 ;
drivers/scsi/megaraid/mega_common.h +1 -1
@@ -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
drivers/scsi/megaraid/megaraid_sas.h +1 -1
@@ -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) + \
drivers/scsi/qla1280.c +1 -1
@@ -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)
drivers/scsi/scsi_error.c +4 -4
@@ -1037,7 +1037,7 @@ static int scsi_try_bus_reset(struct scsssleep (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 scssleep (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 Scsifor (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,
drivers/scsi/sg.c +1 -1
@@ -887,7 +887,7 @@ sg_ioctl(struct inode *inode, struct filreturn -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);
drivers/scsi/u14-34f.c +6 -6
@@ -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 ;
drivers/usb/image/microtek.c +2 -2
@@ -593,12 +593,12 @@ int mts_scsi_queuecommand( Scsi_Cmnd *srif ( !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" );
RFC PATCH 1/1 HCIL drivers update
In reply to Jeff GarzikMissed 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
drivers/ieee1394/sbp2.c +3 -1
@@ -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;
drivers/message/i2o/i2o_scsi.c +4 -2
@@ -223,6 +223,7 @@ static int i2o_scsi_probe(struct deviceu64 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 devicereturn -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",
drivers/s390/scsi/zfcp_erp.c +6 -2
@@ -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 :
drivers/scsi/aacraid/commsup.c +3 -2
@@ -997,10 +997,11 @@ static void aac_handle_aif(struct aac_descsi_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); } }
RFC PATCH 1/1 HCIL drivers update
In reply to Jeff GarzikConvert 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
drivers/scsi/53c700.c +18 -19
@@ -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 *Sif (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 *Sif ((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 */
drivers/scsi/53c700.h +7 -1
@@ -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 */
drivers/scsi/NCR5380.c +3 -1
@@ -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);
drivers/scsi/NCR53C9x.c +35 -46
200 lines not on this page · raw message
drivers/scsi/NCR53C9x.h +19 -3
@@ -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 /*
drivers/scsi/aha152x.c +1 -3
@@ -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);
drivers/scsi/aha1542.c +2 -2
@@ -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 ;
drivers/scsi/aic7xxx/aic79xx_osm.c +10 -16
@@ -532,7 +532,7 @@ ahd_linux_slave_alloc(struct scsi_devicestruct 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 scsiprintf ("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; }
drivers/scsi/aic7xxx/aic7xxx_osm.c +11 -19
@@ -604,7 +604,7 @@ ahc_linux_slave_alloc(struct scsi_devicestruct 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 scsiprintf ("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; }
RFC PATCH 1/1 more dev_printk driver work
In reply to Jeff GarzikTook 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
drivers/message/fusion/mptbase.h +4 -0
@@ -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
drivers/message/fusion/mptscsih.c +1 -7
@@ -975,13 +975,7 @@ mptscsih_report_queue_full(struct scsi_creturn ;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; } }
drivers/scsi/53c700.c +12 -13
@@ -986,7 +986,8 @@ process_script_interrupt(__u32 dsps, __uif (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 *Sif (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 * SCpstruct 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 intNCR_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);
drivers/scsi/NCR5380.c +17 -14
@@ -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_transfercase 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_transferscsi_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 ;
drivers/scsi/NCR5380.h +8 -0
@@ -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
drivers/scsi/NCR53C9x.c +3 -7
@@ -2256,7 +2256,6 @@ static int esp_do_freebus(struct NCR_ESPstatic 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" ));
drivers/scsi/aacraid/aacraid.h +5 -0
@@ -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__ */
drivers/scsi/aic7xxx_old/aic7xxx_proc.c +1 -4
@@ -89,7 +89,6 @@ aic7xxx_proc_info ( struct Scsi_Host *HBint 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",
drivers/scsi/atp870u.c +5 -6
@@ -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 ;
drivers/scsi/dc395x.c +8 -14
@@ -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 Addprintkl (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;
drivers/scsi/dpt_i2o.c +6 -6
@@ -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_cmndadpt_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 __iomemcase 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 __iomemcase 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 ]); }
drivers/scsi/eata.c +14 -19
@@ -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 scif (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_cunsigned 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 sstruct 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, structif (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);
drivers/scsi/eata_pio.c +5 -5
@@ -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_cmif (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_cmfor (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 scstruct 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));
drivers/scsi/ibmmca.c +4 -4
@@ -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_Cmndnext_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_Cmndlocal_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)];
drivers/scsi/ide-scsi.c +1 -2
@@ -893,8 +893,7 @@ static int idescsi_queue (struct scsi_cmidescsi_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);
drivers/scsi/in2000.c +1 -1
@@ -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
drivers/scsi/megaraid/megaraid_sas.c +1 -2
@@ -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) {
drivers/scsi/qla2xxx/qla_dbg.c +4 -4
@@ -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]);
drivers/scsi/scsi_error.c +1 -2
@@ -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);
drivers/scsi/scsi_scan.c +3 -3
@@ -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)))
drivers/scsi/sg.c +2 -5
@@ -3003,14 +3003,11 @@ static int sg_proc_seq_show_dev(struct sstruct 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,
drivers/scsi/tmscsim.c +1 -1
@@ -2079,7 +2079,7 @@ static int DC390_abort(struct scsi_cmndstruct 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.
drivers/scsi/u14-34f.c +9 -10
@@ -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 sif (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(structstruct 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, unsignif (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);
RFC PATCH 1/1 HCIL drivers update
In reply to Jeff Garzikfix 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
drivers/scsi/scsi_scan.c +7 -3
@@ -1074,6 +1074,7 @@ static int scsi_report_lun_scan(struct sunsigned 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 sif (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(stif (!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 ;