aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2014-06-25 09:27:36 -0400
committerChristoph Hellwig <hch@lst.de>2014-07-17 16:07:37 -0400
commit9cb78c16f5dadefd8dc5ba0ae5a2f26cd59419b3 (patch)
tree576b86c3ec56dd7176285ec2d27f27ca55f77bc3
parent755f516bbb983915d6cbfb5aa592cc0a5a99fd00 (diff)
scsi: use 64-bit LUNs
The SCSI standard defines 64-bit values for LUNs, and large arrays employing large or hierarchical LUN numbers become more and more common. So update the linux SCSI stack to use 64-bit LUN numbers. Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Christoph Hellwig <hch@infradead.org> Reviewed-by: Ewan Milne <emilne@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/ata/libata-scsi.c2
-rw-r--r--drivers/ata/libata.h2
-rw-r--r--drivers/message/fusion/mptbase.h2
-rw-r--r--drivers/message/fusion/mptfc.c6
-rw-r--r--drivers/message/fusion/mptscsih.c14
-rw-r--r--drivers/message/fusion/mptscsih.h4
-rw-r--r--drivers/message/i2o/i2o_scsi.c11
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c3
-rw-r--r--drivers/s390/scsi/zfcp_unit.c4
-rw-r--r--drivers/scsi/53c700.c7
-rw-r--r--drivers/scsi/NCR5380.c31
-rw-r--r--drivers/scsi/NCR53c406a.c2
-rw-r--r--drivers/scsi/a100u2w.c2
-rw-r--r--drivers/scsi/aacraid/linit.c2
-rw-r--r--drivers/scsi/aha152x.c6
-rw-r--r--drivers/scsi/aic7xxx/aic79xx.h2
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c6
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_proc.c2
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c11
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_proc.c2
-rw-r--r--drivers/scsi/arcmsr/arcmsr_hba.c8
-rw-r--r--drivers/scsi/arm/acornscsi.c14
-rw-r--r--drivers/scsi/arm/fas216.c11
-rw-r--r--drivers/scsi/arm/queue.c3
-rw-r--r--drivers/scsi/atari_NCR5380.c62
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_io.c4
-rw-r--r--drivers/scsi/ch.c16
-rw-r--r--drivers/scsi/csiostor/csio_scsi.c24
-rw-r--r--drivers/scsi/dc395x.c40
-rw-r--r--drivers/scsi/dpt_i2o.c38
-rw-r--r--drivers/scsi/dpti.h6
-rw-r--r--drivers/scsi/eata.c2
-rw-r--r--drivers/scsi/fnic/fnic_scsi.c4
-rw-r--r--drivers/scsi/g_NCR5380.c2
-rw-r--r--drivers/scsi/hpsa.c2
-rw-r--r--drivers/scsi/hptiop.c2
-rw-r--r--drivers/scsi/in2000.c6
-rw-r--r--drivers/scsi/libiscsi.c8
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c11
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c36
-rw-r--r--drivers/scsi/megaraid.c4
-rw-r--r--drivers/scsi/megaraid/mega_common.h2
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_fusion.c4
-rw-r--r--drivers/scsi/mesh.c2
-rw-r--r--drivers/scsi/ncr53c8xx.c2
-rw-r--r--drivers/scsi/nsp32.c2
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c2
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c2
-rw-r--r--drivers/scsi/pmcraid.c2
-rw-r--r--drivers/scsi/ps3rom.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_def.h6
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h16
-rw-r--r--drivers/scsi/qla2xxx/qla_iocb.c11
-rw-r--r--drivers/scsi/qla2xxx/qla_isr.c4
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c12
-rw-r--r--drivers/scsi/qla2xxx/qla_mr.c8
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c35
-rw-r--r--drivers/scsi/qla4xxx/ql4_glbl.h4
-rw-r--r--drivers/scsi/qla4xxx/ql4_iocb.c2
-rw-r--r--drivers/scsi/qla4xxx/ql4_isr.c22
-rw-r--r--drivers/scsi/qla4xxx/ql4_mbx.c6
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c20
-rw-r--r--drivers/scsi/scsi.c8
-rw-r--r--drivers/scsi/scsi_debug.c15
-rw-r--r--drivers/scsi/scsi_priv.h2
-rw-r--r--drivers/scsi/scsi_proc.c2
-rw-r--r--drivers/scsi/scsi_scan.c54
-rw-r--r--drivers/scsi/scsi_sysfs.c14
-rw-r--r--drivers/scsi/scsi_transport_fc.c4
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c4
-rw-r--r--drivers/scsi/scsi_transport_sas.c2
-rw-r--r--drivers/scsi/sg.c4
-rw-r--r--drivers/scsi/sun3_NCR5380.c57
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_glue.c2
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.h2
-rw-r--r--drivers/scsi/tmscsim.c6
-rw-r--r--drivers/scsi/u14-34f.c10
-rw-r--r--drivers/scsi/wd33c93.c33
-rw-r--r--drivers/staging/rts5208/rtsx.c4
-rw-r--r--drivers/target/loopback/tcm_loop.c2
-rw-r--r--drivers/target/target_core_pscsi.c12
-rw-r--r--drivers/usb/storage/sddr09.c4
-rw-r--r--drivers/usb/storage/usb.c10
-rw-r--r--include/scsi/scsi.h2
-rw-r--r--include/scsi/scsi_device.h22
-rw-r--r--include/scsi/scsi_transport.h2
86 files changed, 438 insertions, 429 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 72691fd93948..0586f66d70fa 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3945,7 +3945,7 @@ void ata_scsi_hotplug(struct work_struct *work)
3945 * Zero. 3945 * Zero.
3946 */ 3946 */
3947int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, 3947int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
3948 unsigned int id, unsigned int lun) 3948 unsigned int id, u64 lun)
3949{ 3949{
3950 struct ata_port *ap = ata_shost_to_port(shost); 3950 struct ata_port *ap = ata_shost_to_port(shost);
3951 unsigned long flags; 3951 unsigned long flags;
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index 45b5ab3a95d5..5f4e0cca56ec 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -144,7 +144,7 @@ extern void ata_schedule_scsi_eh(struct Scsi_Host *shost);
144extern void ata_scsi_dev_rescan(struct work_struct *work); 144extern void ata_scsi_dev_rescan(struct work_struct *work);
145extern int ata_bus_probe(struct ata_port *ap); 145extern int ata_bus_probe(struct ata_port *ap);
146extern int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, 146extern int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel,
147 unsigned int id, unsigned int lun); 147 unsigned int id, u64 lun);
148 148
149 149
150/* libata-eh.c */ 150/* libata-eh.c */
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 76c05bc24cb7..f37ea6fdc6ae 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -405,7 +405,7 @@ typedef struct _VirtTarget {
405typedef struct _VirtDevice { 405typedef struct _VirtDevice {
406 VirtTarget *vtarget; 406 VirtTarget *vtarget;
407 u8 configured_lun; 407 u8 configured_lun;
408 int lun; 408 u64 lun;
409} VirtDevice; 409} VirtDevice;
410 410
411/* 411/*
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 02a3eefd6931..bf2a2cef562b 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -204,7 +204,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
204 || (loops > 0 && ioc->active == 0)) { 204 || (loops > 0 && ioc->active == 0)) {
205 spin_unlock_irqrestore(shost->host_lock, flags); 205 spin_unlock_irqrestore(shost->host_lock, flags);
206 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT 206 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
207 "mptfc_block_error_handler.%d: %d:%d, port status is " 207 "mptfc_block_error_handler.%d: %d:%llu, port status is "
208 "%x, active flag %d, deferring %s recovery.\n", 208 "%x, active flag %d, deferring %s recovery.\n",
209 ioc->name, ioc->sh->host_no, 209 ioc->name, ioc->sh->host_no,
210 SCpnt->device->id, SCpnt->device->lun, 210 SCpnt->device->id, SCpnt->device->lun,
@@ -218,7 +218,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
218 if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata 218 if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata
219 || ioc->active == 0) { 219 || ioc->active == 0) {
220 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT 220 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
221 "%s.%d: %d:%d, failing recovery, " 221 "%s.%d: %d:%llu, failing recovery, "
222 "port state %x, active %d, vdevice %p.\n", caller, 222 "port state %x, active %d, vdevice %p.\n", caller,
223 ioc->name, ioc->sh->host_no, 223 ioc->name, ioc->sh->host_no,
224 SCpnt->device->id, SCpnt->device->lun, ready, 224 SCpnt->device->id, SCpnt->device->lun, ready,
@@ -226,7 +226,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
226 return FAILED; 226 return FAILED;
227 } 227 }
228 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT 228 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
229 "%s.%d: %d:%d, executing recovery.\n", caller, 229 "%s.%d: %d:%llu, executing recovery.\n", caller,
230 ioc->name, ioc->sh->host_no, 230 ioc->name, ioc->sh->host_no,
231 SCpnt->device->id, SCpnt->device->lun)); 231 SCpnt->device->id, SCpnt->device->lun));
232 return (*func)(SCpnt); 232 return (*func)(SCpnt);
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 2a1c6f21af27..39e566803089 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -95,7 +95,7 @@ static void mptscsih_freeChainBuffers(MPT_ADAPTER *ioc, int req_idx);
95static void mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply_t *pScsiReply); 95static void mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR *mf, SCSIIOReply_t *pScsiReply);
96 96
97int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, 97int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id,
98 int lun, int ctx2abort, ulong timeout); 98 u64 lun, int ctx2abort, ulong timeout);
99 99
100int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset); 100int mptscsih_ioc_reset(MPT_ADAPTER *ioc, int post_reset);
101int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply); 101int mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply);
@@ -536,7 +536,7 @@ mptscsih_info_scsiio(MPT_ADAPTER *ioc, struct scsi_cmnd *sc, SCSIIOReply_t * pSc
536 } 536 }
537 537
538 scsi_print_command(sc); 538 scsi_print_command(sc);
539 printk(MYIOC_s_DEBUG_FMT "\tfw_channel = %d, fw_id = %d, lun = %d\n", 539 printk(MYIOC_s_DEBUG_FMT "\tfw_channel = %d, fw_id = %d, lun = %llu\n",
540 ioc->name, pScsiReply->Bus, pScsiReply->TargetID, sc->device->lun); 540 ioc->name, pScsiReply->Bus, pScsiReply->TargetID, sc->device->lun);
541 printk(MYIOC_s_DEBUG_FMT "\trequest_len = %d, underflow = %d, " 541 printk(MYIOC_s_DEBUG_FMT "\trequest_len = %d, underflow = %d, "
542 "resid = %d\n", ioc->name, scsi_bufflen(sc), sc->underflow, 542 "resid = %d\n", ioc->name, scsi_bufflen(sc), sc->underflow,
@@ -692,7 +692,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
692 */ 692 */
693 if (scsi_state & MPI_SCSI_STATE_RESPONSE_INFO_VALID && 693 if (scsi_state & MPI_SCSI_STATE_RESPONSE_INFO_VALID &&
694 pScsiReply->ResponseInfo) { 694 pScsiReply->ResponseInfo) {
695 printk(MYIOC_s_NOTE_FMT "[%d:%d:%d:%d] " 695 printk(MYIOC_s_NOTE_FMT "[%d:%d:%d:%llu] "
696 "FCP_ResponseInfo=%08xh\n", ioc->name, 696 "FCP_ResponseInfo=%08xh\n", ioc->name,
697 sc->device->host->host_no, sc->device->channel, 697 sc->device->host->host_no, sc->device->channel,
698 sc->device->id, sc->device->lun, 698 sc->device->id, sc->device->lun,
@@ -1155,7 +1155,7 @@ mptscsih_report_queue_full(struct scsi_cmnd *sc, SCSIIOReply_t *pScsiReply, SCSI
1155 return; 1155 return;
1156 ioc = hd->ioc; 1156 ioc = hd->ioc;
1157 if (time - hd->last_queue_full > 10 * HZ) { 1157 if (time - hd->last_queue_full > 10 * HZ) {
1158 dprintk(ioc, printk(MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n", 1158 dprintk(ioc, printk(MYIOC_s_WARN_FMT "Device (%d:%d:%llu) reported QUEUE_FULL!\n",
1159 ioc->name, 0, sc->device->id, sc->device->lun)); 1159 ioc->name, 0, sc->device->id, sc->device->lun));
1160 hd->last_queue_full = time; 1160 hd->last_queue_full = time;
1161 } 1161 }
@@ -1518,7 +1518,7 @@ mptscsih_freeChainBuffers(MPT_ADAPTER *ioc, int req_idx)
1518 * 1518 *
1519 **/ 1519 **/
1520int 1520int
1521mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, 1521mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, u64 lun,
1522 int ctx2abort, ulong timeout) 1522 int ctx2abort, ulong timeout)
1523{ 1523{
1524 MPT_FRAME_HDR *mf; 1524 MPT_FRAME_HDR *mf;
@@ -2380,7 +2380,7 @@ mptscsih_slave_configure(struct scsi_device *sdev)
2380 vdevice = sdev->hostdata; 2380 vdevice = sdev->hostdata;
2381 2381
2382 dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT 2382 dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2383 "device @ %p, channel=%d, id=%d, lun=%d\n", 2383 "device @ %p, channel=%d, id=%d, lun=%llu\n",
2384 ioc->name, sdev, sdev->channel, sdev->id, sdev->lun)); 2384 ioc->name, sdev, sdev->channel, sdev->id, sdev->lun));
2385 if (ioc->bus_type == SPI) 2385 if (ioc->bus_type == SPI)
2386 dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT 2386 dsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
@@ -2971,7 +2971,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io)
2971 + (my_idx * MPT_SENSE_BUFFER_ALLOC)); 2971 + (my_idx * MPT_SENSE_BUFFER_ALLOC));
2972 2972
2973 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT 2973 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2974 "%s: Sending Command 0x%02x for fw_channel=%d fw_id=%d lun=%d\n", 2974 "%s: Sending Command 0x%02x for fw_channel=%d fw_id=%d lun=%llu\n",
2975 ioc->name, __func__, cmd, io->channel, io->id, io->lun)); 2975 ioc->name, __func__, cmd, io->channel, io->id, io->lun));
2976 2976
2977 if (dir == MPI_SCSIIO_CONTROL_READ) 2977 if (dir == MPI_SCSIIO_CONTROL_READ)
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h
index 99e3390807f3..e1b1a198a62a 100644
--- a/drivers/message/fusion/mptscsih.h
+++ b/drivers/message/fusion/mptscsih.h
@@ -98,7 +98,7 @@ typedef struct _internal_cmd {
98 u8 cmd; /* SCSI Op Code */ 98 u8 cmd; /* SCSI Op Code */
99 u8 channel; /* bus number */ 99 u8 channel; /* bus number */
100 u8 id; /* SCSI ID (virtual) */ 100 u8 id; /* SCSI ID (virtual) */
101 int lun; 101 u64 lun;
102 u8 flags; /* Bit Field - See above */ 102 u8 flags; /* Bit Field - See above */
103 u8 physDiskNum; /* Phys disk number, -1 else */ 103 u8 physDiskNum; /* Phys disk number, -1 else */
104 u8 rsvd2; 104 u8 rsvd2;
@@ -115,7 +115,7 @@ extern int mptscsih_show_info(struct seq_file *, struct Scsi_Host *);
115extern const char * mptscsih_info(struct Scsi_Host *SChost); 115extern const char * mptscsih_info(struct Scsi_Host *SChost);
116extern int mptscsih_qcmd(struct scsi_cmnd *SCpnt); 116extern int mptscsih_qcmd(struct scsi_cmnd *SCpnt);
117extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, 117extern int mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel,
118 u8 id, int lun, int ctx2abort, ulong timeout); 118 u8 id, u64 lun, int ctx2abort, ulong timeout);
119extern void mptscsih_slave_destroy(struct scsi_device *device); 119extern void mptscsih_slave_destroy(struct scsi_device *device);
120extern int mptscsih_slave_configure(struct scsi_device *device); 120extern int mptscsih_slave_configure(struct scsi_device *device);
121extern int mptscsih_abort(struct scsi_cmnd * SCpnt); 121extern int mptscsih_abort(struct scsi_cmnd * SCpnt);
diff --git a/drivers/message/i2o/i2o_scsi.c b/drivers/message/i2o/i2o_scsi.c
index 1d31d7284cbd..e7de92c67cf6 100644
--- a/drivers/message/i2o/i2o_scsi.c
+++ b/drivers/message/i2o/i2o_scsi.c
@@ -78,7 +78,7 @@ static unsigned int i2o_scsi_max_lun = 255;
78struct i2o_scsi_host { 78struct i2o_scsi_host {
79 struct Scsi_Host *scsi_host; /* pointer to the SCSI host */ 79 struct Scsi_Host *scsi_host; /* pointer to the SCSI host */
80 struct i2o_controller *iop; /* pointer to the I2O controller */ 80 struct i2o_controller *iop; /* pointer to the I2O controller */
81 unsigned int lun; /* lun's used for block devices */ 81 u64 lun; /* lun's used for block devices */
82 struct i2o_device *channel[0]; /* channel->i2o_dev mapping table */ 82 struct i2o_device *channel[0]; /* channel->i2o_dev mapping table */
83}; 83};
84 84
@@ -287,9 +287,8 @@ static int i2o_scsi_probe(struct device *dev)
287 } 287 }
288 288
289 if (le64_to_cpu(lun) >= scsi_host->max_lun) { 289 if (le64_to_cpu(lun) >= scsi_host->max_lun) {
290 osm_warn("SCSI device lun (%lu) >= max_lun of I2O host (%d)", 290 osm_warn("SCSI device lun (%llu) >= max_lun of I2O host (%d)",
291 (long unsigned int)le64_to_cpu(lun), 291 le64_to_cpu(lun), scsi_host->max_lun);
292 scsi_host->max_lun);
293 return -EFAULT; 292 return -EFAULT;
294 } 293 }
295 294
@@ -308,9 +307,9 @@ static int i2o_scsi_probe(struct device *dev)
308 if (rc) 307 if (rc)
309 goto err; 308 goto err;
310 309
311 osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %ld\n", 310 osm_info("device added (TID: %03x) channel: %d, id: %d, lun: %llu\n",
312 i2o_dev->lct_data.tid, channel, le32_to_cpu(id), 311 i2o_dev->lct_data.tid, channel, le32_to_cpu(id),
313 (long unsigned int)le64_to_cpu(lun)); 312 le64_to_cpu(lun));
314 313
315 return 0; 314 return 0;
316 315
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 0ca64484cfa3..5d7fbe4e907e 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -418,7 +418,8 @@ void zfcp_dbf_scsi(char *tag, struct scsi_cmnd *sc, struct zfcp_fsf_req *fsf)
418 rec->scsi_retries = sc->retries; 418 rec->scsi_retries = sc->retries;
419 rec->scsi_allowed = sc->allowed; 419 rec->scsi_allowed = sc->allowed;
420 rec->scsi_id = sc->device->id; 420 rec->scsi_id = sc->device->id;
421 rec->scsi_lun = sc->device->lun; 421 /* struct zfcp_dbf_scsi needs to be updated to handle 64bit LUNs */
422 rec->scsi_lun = (u32)sc->device->lun;
422 rec->host_scribble = (unsigned long)sc->host_scribble; 423 rec->host_scribble = (unsigned long)sc->host_scribble;
423 424
424 memcpy(rec->scsi_opcode, sc->cmnd, 425 memcpy(rec->scsi_opcode, sc->cmnd,
diff --git a/drivers/s390/scsi/zfcp_unit.c b/drivers/s390/scsi/zfcp_unit.c
index 39f5446f7216..157d3d203ba1 100644
--- a/drivers/s390/scsi/zfcp_unit.c
+++ b/drivers/s390/scsi/zfcp_unit.c
@@ -21,7 +21,7 @@
21void zfcp_unit_scsi_scan(struct zfcp_unit *unit) 21void zfcp_unit_scsi_scan(struct zfcp_unit *unit)
22{ 22{
23 struct fc_rport *rport = unit->port->rport; 23 struct fc_rport *rport = unit->port->rport;
24 unsigned int lun; 24 u64 lun;
25 25
26 lun = scsilun_to_int((struct scsi_lun *) &unit->fcp_lun); 26 lun = scsilun_to_int((struct scsi_lun *) &unit->fcp_lun);
27 27
@@ -188,7 +188,7 @@ struct scsi_device *zfcp_unit_sdev(struct zfcp_unit *unit)
188{ 188{
189 struct Scsi_Host *shost; 189 struct Scsi_Host *shost;
190 struct zfcp_port *port; 190 struct zfcp_port *port;
191 unsigned int lun; 191 u64 lun;
192 192
193 lun = scsilun_to_int((struct scsi_lun *) &unit->fcp_lun); 193 lun = scsilun_to_int((struct scsi_lun *) &unit->fcp_lun);
194 port = unit->port; 194 port = unit->port;
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index a3adfb4357f5..fabd4be2c985 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -1005,7 +1005,7 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
1005 DMA_TO_DEVICE); 1005 DMA_TO_DEVICE);
1006 1006
1007 cmnd[0] = REQUEST_SENSE; 1007 cmnd[0] = REQUEST_SENSE;
1008 cmnd[1] = (SCp->device->lun & 0x7) << 5; 1008 cmnd[1] = (lun & 0x7) << 5;
1009 cmnd[2] = 0; 1009 cmnd[2] = 0;
1010 cmnd[3] = 0; 1010 cmnd[3] = 0;
1011 cmnd[4] = SCSI_SENSE_BUFFERSIZE; 1011 cmnd[4] = SCSI_SENSE_BUFFERSIZE;
@@ -1396,7 +1396,8 @@ NCR_700_start_command(struct scsi_cmnd *SCp)
1396 struct NCR_700_Host_Parameters *hostdata = 1396 struct NCR_700_Host_Parameters *hostdata =
1397 (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0]; 1397 (struct NCR_700_Host_Parameters *)SCp->device->host->hostdata[0];
1398 __u16 count = 1; /* for IDENTIFY message */ 1398 __u16 count = 1; /* for IDENTIFY message */
1399 1399 u8 lun = SCp->device->lun;
1400
1400 if(hostdata->state != NCR_700_HOST_FREE) { 1401 if(hostdata->state != NCR_700_HOST_FREE) {
1401 /* keep this inside the lock to close the race window where 1402 /* keep this inside the lock to close the race window where
1402 * the running command finishes on another CPU while we don't 1403 * the running command finishes on another CPU while we don't
@@ -1415,7 +1416,7 @@ NCR_700_start_command(struct scsi_cmnd *SCp)
1415 1416
1416 hostdata->msgout[0] = NCR_700_identify((SCp->cmnd[0] != REQUEST_SENSE && 1417 hostdata->msgout[0] = NCR_700_identify((SCp->cmnd[0] != REQUEST_SENSE &&
1417 slot->flags != NCR_700_FLAG_AUTOSENSE), 1418 slot->flags != NCR_700_FLAG_AUTOSENSE),
1418 SCp->device->lun); 1419 lun);
1419 /* for INQUIRY or REQUEST_SENSE commands, we cannot be sure 1420 /* for INQUIRY or REQUEST_SENSE commands, we cannot be sure
1420 * if the negotiated transfer parameters still hold, so 1421 * if the negotiated transfer parameters still hold, so
1421 * always renegotiate them */ 1422 * always renegotiate them */
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 93d13fc9a293..45da3c823322 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -762,7 +762,7 @@ static int __maybe_unused NCR5380_show_info(struct seq_file *m,
762 762
763static void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m) 763static void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m)
764{ 764{
765 SPRINTF("scsi%d : destination target %d, lun %d\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun); 765 SPRINTF("scsi%d : destination target %d, lun %llu\n", cmd->device->host->host_no, cmd->device->id, cmd->device->lun);
766 SPRINTF(" command = "); 766 SPRINTF(" command = ");
767 lprint_command(cmd->cmnd, m); 767 lprint_command(cmd->cmnd, m);
768} 768}
@@ -1039,9 +1039,10 @@ static void NCR5380_main(struct work_struct *work)
1039 for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev = NULL; tmp; prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble) 1039 for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, prev = NULL; tmp; prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble)
1040 { 1040 {
1041 if (prev != tmp) 1041 if (prev != tmp)
1042 dprintk(NDEBUG_LISTS, "MAIN tmp=%p target=%d busy=%d lun=%d\n", tmp, tmp->device->id, hostdata->busy[tmp->device->id], tmp->device->lun); 1042 dprintk(NDEBUG_LISTS, "MAIN tmp=%p target=%d busy=%d lun=%llu\n", tmp, tmp->device->id, hostdata->busy[tmp->device->id], tmp->device->lun);
1043 /* When we find one, remove it from the issue queue. */ 1043 /* When we find one, remove it from the issue queue. */
1044 if (!(hostdata->busy[tmp->device->id] & (1 << tmp->device->lun))) { 1044 if (!(hostdata->busy[tmp->device->id] &
1045 (1 << (u8)(tmp->device->lun & 0xff)))) {
1045 if (prev) { 1046 if (prev) {
1046 REMOVE(prev, prev->host_scribble, tmp, tmp->host_scribble); 1047 REMOVE(prev, prev->host_scribble, tmp, tmp->host_scribble);
1047 prev->host_scribble = tmp->host_scribble; 1048 prev->host_scribble = tmp->host_scribble;
@@ -1057,7 +1058,7 @@ static void NCR5380_main(struct work_struct *work)
1057 * On failure, we must add the command back to the 1058 * On failure, we must add the command back to the
1058 * issue queue so we can keep trying. 1059 * issue queue so we can keep trying.
1059 */ 1060 */
1060 dprintk(NDEBUG_MAIN|NDEBUG_QUEUES, "scsi%d : main() : command for target %d lun %d removed from issue_queue\n", instance->host_no, tmp->device->id, tmp->device->lun); 1061 dprintk(NDEBUG_MAIN|NDEBUG_QUEUES, "scsi%d : main() : command for target %d lun %llu removed from issue_queue\n", instance->host_no, tmp->device->id, tmp->device->lun);
1061 1062
1062 /* 1063 /*
1063 * A successful selection is defined as one that 1064 * A successful selection is defined as one that
@@ -1524,7 +1525,7 @@ part2:
1524 dprintk(NDEBUG_SELECTION, "scsi%d : nexus established.\n", instance->host_no); 1525 dprintk(NDEBUG_SELECTION, "scsi%d : nexus established.\n", instance->host_no);
1525 /* XXX need to handle errors here */ 1526 /* XXX need to handle errors here */
1526 hostdata->connected = cmd; 1527 hostdata->connected = cmd;
1527 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); 1528 hostdata->busy[cmd->device->id] |= (1 << (cmd->device->lun & 0xFF));
1528 1529
1529 initialize_SCp(cmd); 1530 initialize_SCp(cmd);
1530 1531
@@ -2210,14 +2211,14 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
2210 case LINKED_FLG_CMD_COMPLETE: 2211 case LINKED_FLG_CMD_COMPLETE:
2211 /* Accept message by clearing ACK */ 2212 /* Accept message by clearing ACK */
2212 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2213 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2213 dprintk(NDEBUG_LINKED, "scsi%d : target %d lun %d linked command complete.\n", instance->host_no, cmd->device->id, cmd->device->lun); 2214 dprintk(NDEBUG_LINKED, "scsi%d : target %d lun %llu linked command complete.\n", instance->host_no, cmd->device->id, cmd->device->lun);
2214 /* 2215 /*
2215 * Sanity check : A linked command should only terminate with 2216 * Sanity check : A linked command should only terminate with
2216 * one of these messages if there are more linked commands 2217 * one of these messages if there are more linked commands
2217 * available. 2218 * available.
2218 */ 2219 */
2219 if (!cmd->next_link) { 2220 if (!cmd->next_link) {
2220 printk("scsi%d : target %d lun %d linked command complete, no next_link\n" instance->host_no, cmd->device->id, cmd->device->lun); 2221 printk("scsi%d : target %d lun %llu linked command complete, no next_link\n" instance->host_no, cmd->device->id, cmd->device->lun);
2221 sink = 1; 2222 sink = 1;
2222 do_abort(instance); 2223 do_abort(instance);
2223 return; 2224 return;
@@ -2226,7 +2227,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
2226 /* The next command is still part of this process */ 2227 /* The next command is still part of this process */
2227 cmd->next_link->tag = cmd->tag; 2228 cmd->next_link->tag = cmd->tag;
2228 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); 2229 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
2229 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); 2230 dprintk(NDEBUG_LINKED, "scsi%d : target %d lun %llu linked request done, calling scsi_done().\n", instance->host_no, cmd->device->id, cmd->device->lun);
2230 collect_stats(hostdata, cmd); 2231 collect_stats(hostdata, cmd);
2231 cmd->scsi_done(cmd); 2232 cmd->scsi_done(cmd);
2232 cmd = hostdata->connected; 2233 cmd = hostdata->connected;
@@ -2238,8 +2239,8 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
2238 sink = 1; 2239 sink = 1;
2239 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2240 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2240 hostdata->connected = NULL; 2241 hostdata->connected = NULL;
2241 dprintk(NDEBUG_QUEUES, "scsi%d : command for target %d, lun %d completed\n", instance->host_no, cmd->device->id, cmd->device->lun); 2242 dprintk(NDEBUG_QUEUES, "scsi%d : command for target %d, lun %llu completed\n", instance->host_no, cmd->device->id, cmd->device->lun);
2242 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 2243 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xFF));
2243 2244
2244 /* 2245 /*
2245 * I'm not sure what the correct thing to do here is : 2246 * I'm not sure what the correct thing to do here is :
@@ -2304,7 +2305,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
2304 case ORDERED_QUEUE_TAG: 2305 case ORDERED_QUEUE_TAG:
2305 case SIMPLE_QUEUE_TAG: 2306 case SIMPLE_QUEUE_TAG:
2306 cmd->device->simple_tags = 0; 2307 cmd->device->simple_tags = 0;
2307 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); 2308 hostdata->busy[cmd->device->id] |= (1 << (cmd->device->lun & 0xFF));
2308 break; 2309 break;
2309 default: 2310 default:
2310 break; 2311 break;
@@ -2318,7 +2319,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
2318 hostdata->disconnected_queue; 2319 hostdata->disconnected_queue;
2319 hostdata->connected = NULL; 2320 hostdata->connected = NULL;
2320 hostdata->disconnected_queue = cmd; 2321 hostdata->disconnected_queue = cmd;
2321 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); 2322 dprintk(NDEBUG_QUEUES, "scsi%d : command for target %d lun %llu was moved from connected to" " the disconnected_queue\n", instance->host_no, cmd->device->id, cmd->device->lun);
2322 /* 2323 /*
2323 * Restore phase bits to 0 so an interrupted selection, 2324 * Restore phase bits to 0 so an interrupted selection,
2324 * arbitration can resume. 2325 * arbitration can resume.
@@ -2426,7 +2427,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) {
2426 hostdata->last_message = msgout; 2427 hostdata->last_message = msgout;
2427 NCR5380_transfer_pio(instance, &phase, &len, &data); 2428 NCR5380_transfer_pio(instance, &phase, &len, &data);
2428 if (msgout == ABORT) { 2429 if (msgout == ABORT) {
2429 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 2430 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xFF));
2430 hostdata->connected = NULL; 2431 hostdata->connected = NULL;
2431 cmd->result = DID_ERROR << 16; 2432 cmd->result = DID_ERROR << 16;
2432 collect_stats(hostdata, cmd); 2433 collect_stats(hostdata, cmd);
@@ -2562,7 +2563,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
2562 2563
2563 2564
2564 for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL; tmp; prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble) 2565 for (tmp = (Scsi_Cmnd *) hostdata->disconnected_queue, prev = NULL; tmp; prev = tmp, tmp = (Scsi_Cmnd *) tmp->host_scribble)
2565 if ((target_mask == (1 << tmp->device->id)) && (lun == tmp->device->lun) 2566 if ((target_mask == (1 << tmp->device->id)) && (lun == (u8)tmp->device->lun)
2566 ) { 2567 ) {
2567 if (prev) { 2568 if (prev) {
2568 REMOVE(prev, prev->host_scribble, tmp, tmp->host_scribble); 2569 REMOVE(prev, prev->host_scribble, tmp, tmp->host_scribble);
@@ -2588,7 +2589,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance) {
2588 do_abort(instance); 2589 do_abort(instance);
2589 } else { 2590 } else {
2590 hostdata->connected = tmp; 2591 hostdata->connected = tmp;
2591 dprintk(NDEBUG_RESELECTION, "scsi%d : nexus established, target = %d, lun = %d, tag = %d\n", instance->host_no, tmp->device->id, tmp->device->lun, tmp->tag); 2592 dprintk(NDEBUG_RESELECTION, "scsi%d : nexus established, target = %d, lun = %llu, tag = %d\n", instance->host_no, tmp->device->id, tmp->device->lun, tmp->tag);
2592 } 2593 }
2593} 2594}
2594 2595
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c
index c91888a0a23c..10c3374d759f 100644
--- a/drivers/scsi/NCR53c406a.c
+++ b/drivers/scsi/NCR53c406a.c
@@ -698,7 +698,7 @@ static int NCR53c406a_queue_lck(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
698 int i; 698 int i;
699 699
700 VDEB(printk("NCR53c406a_queue called\n")); 700 VDEB(printk("NCR53c406a_queue called\n"));
701 DEB(printk("cmd=%02x, cmd_len=%02x, target=%02x, lun=%02x, bufflen=%d\n", SCpnt->cmnd[0], SCpnt->cmd_len, SCpnt->target, SCpnt->lun, scsi_bufflen(SCpnt))); 701 DEB(printk("cmd=%02x, cmd_len=%02x, target=%02x, lun=%02x, bufflen=%d\n", SCpnt->cmnd[0], SCpnt->cmd_len, SCpnt->device->target, (u8)SCpnt->device->lun, scsi_bufflen(SCpnt)));
702 702
703#if 0 703#if 0
704 VDEB(for (i = 0; i < SCpnt->cmd_len; i++) 704 VDEB(for (i = 0; i < SCpnt->cmd_len; i++)
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index 0163457c12bb..522570d297ca 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -891,7 +891,7 @@ static int inia100_build_scb(struct orc_host * host, struct orc_scb * scb, struc
891 printk("max cdb length= %x\b", cmd->cmd_len); 891 printk("max cdb length= %x\b", cmd->cmd_len);
892 scb->cdb_len = IMAX_CDB; 892 scb->cdb_len = IMAX_CDB;
893 } 893 }
894 scb->ident = cmd->device->lun | DISC_ALLOW; 894 scb->ident = (u8)(cmd->device->lun & 0xff) | DISC_ALLOW;
895 if (cmd->device->tagged_supported) { /* Tag Support */ 895 if (cmd->device->tagged_supported) { /* Tag Support */
896 scb->tag_msg = SIMPLE_QUEUE_TAG; /* Do simple tag only */ 896 scb->tag_msg = SIMPLE_QUEUE_TAG; /* Do simple tag only */
897 } else { 897 } else {
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 4921ed19a027..63f576c9300a 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -551,7 +551,7 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)
551 int count; 551 int count;
552 int ret = FAILED; 552 int ret = FAILED;
553 553
554 printk(KERN_ERR "%s: Host adapter abort request (%d,%d,%d,%d)\n", 554 printk(KERN_ERR "%s: Host adapter abort request (%d,%d,%d,%llu)\n",
555 AAC_DRIVERNAME, 555 AAC_DRIVERNAME,
556 host->host_no, sdev_channel(dev), sdev_id(dev), dev->lun); 556 host->host_no, sdev_channel(dev), sdev_id(dev), dev->lun);
557 switch (cmd->cmnd[0]) { 557 switch (cmd->cmnd[0]) {
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index e86eb6a921fc..e77b72f78006 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -321,7 +321,7 @@ static LIST_HEAD(aha152x_host_list);
321#define CMDINFO(cmd) \ 321#define CMDINFO(cmd) \
322 (cmd) ? ((cmd)->device->host->host_no) : -1, \ 322 (cmd) ? ((cmd)->device->host->host_no) : -1, \
323 (cmd) ? ((cmd)->device->id & 0x0f) : -1, \ 323 (cmd) ? ((cmd)->device->id & 0x0f) : -1, \
324 (cmd) ? ((cmd)->device->lun & 0x07) : -1 324 (cmd) ? ((u8)(cmd)->device->lun & 0x07) : -1
325 325
326static inline void 326static inline void
327CMD_INC_RESID(struct scsi_cmnd *cmd, int inc) 327CMD_INC_RESID(struct scsi_cmnd *cmd, int inc)
@@ -1602,7 +1602,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
1602#if defined(AHA152X_DEBUG) 1602#if defined(AHA152X_DEBUG)
1603 int hostno=DONE_SC->device->host->host_no; 1603 int hostno=DONE_SC->device->host->host_no;
1604 int id=DONE_SC->device->id & 0xf; 1604 int id=DONE_SC->device->id & 0xf;
1605 int lun=DONE_SC->device->lun & 0x7; 1605 int lun=((u8)DONE_SC->device->lun) & 0x7;
1606#endif 1606#endif
1607 Scsi_Cmnd *ptr = DONE_SC; 1607 Scsi_Cmnd *ptr = DONE_SC;
1608 DONE_SC=NULL; 1608 DONE_SC=NULL;
@@ -2984,7 +2984,7 @@ static void get_command(struct seq_file *m, Scsi_Cmnd * ptr)
2984 int i; 2984 int i;
2985 2985
2986 SPRINTF("%p: target=%d; lun=%d; cmnd=( ", 2986 SPRINTF("%p: target=%d; lun=%d; cmnd=( ",
2987 ptr, ptr->device->id, ptr->device->lun); 2987 ptr, ptr->device->id, (u8)ptr->device->lun);
2988 2988
2989 for (i = 0; i < COMMAND_SIZE(ptr->cmnd[0]); i++) 2989 for (i = 0; i < COMMAND_SIZE(ptr->cmnd[0]); i++)
2990 SPRINTF("0x%02x ", ptr->cmnd[i]); 2990 SPRINTF("0x%02x ", ptr->cmnd[i]);
diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h
index 113874c1284b..df2e0e5367d2 100644
--- a/drivers/scsi/aic7xxx/aic79xx.h
+++ b/drivers/scsi/aic7xxx/aic79xx.h
@@ -115,7 +115,7 @@ struct scb_platform_data;
115#endif 115#endif
116 116
117#define AHD_BUILD_COL_IDX(target, lun) \ 117#define AHD_BUILD_COL_IDX(target, lun) \
118 (((lun) << 4) | target) 118 ((((u8)lun) << 4) | target)
119 119
120#define AHD_GET_SCB_COL_IDX(ahd, scb) \ 120#define AHD_GET_SCB_COL_IDX(ahd, scb) \
121 ((SCB_GET_LUN(scb) << 4) | SCB_GET_TARGET(ahd, scb)) 121 ((SCB_GET_LUN(scb) << 4) | SCB_GET_TARGET(ahd, scb))
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 69d5c43a65e5..ed333669a7dc 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -2137,7 +2137,7 @@ ahd_linux_queue_cmd_complete(struct ahd_softc *ahd, struct scsi_cmnd *cmd)
2137 if (do_fallback) { 2137 if (do_fallback) {
2138 printk("%s: device overrun (status %x) on %d:%d:%d\n", 2138 printk("%s: device overrun (status %x) on %d:%d:%d\n",
2139 ahd_name(ahd), status, cmd->device->channel, 2139 ahd_name(ahd), status, cmd->device->channel,
2140 cmd->device->id, cmd->device->lun); 2140 cmd->device->id, (u8)cmd->device->lun);
2141 } 2141 }
2142 2142
2143 ahd_cmd_set_transaction_status(cmd, new_status); 2143 ahd_cmd_set_transaction_status(cmd, new_status);
@@ -2253,13 +2253,13 @@ ahd_linux_queue_abort_cmd(struct scsi_cmnd *cmd)
2253 disconnected = TRUE; 2253 disconnected = TRUE;
2254 if (ahd_search_qinfifo(ahd, cmd->device->id, 2254 if (ahd_search_qinfifo(ahd, cmd->device->id,
2255 cmd->device->channel + 'A', 2255 cmd->device->channel + 'A',
2256 cmd->device->lun, 2256 cmd->device->lun,
2257 pending_scb->hscb->tag, 2257 pending_scb->hscb->tag,
2258 ROLE_INITIATOR, CAM_REQ_ABORTED, 2258 ROLE_INITIATOR, CAM_REQ_ABORTED,
2259 SEARCH_COMPLETE) > 0) { 2259 SEARCH_COMPLETE) > 0) {
2260 printk("%s:%d:%d:%d: Cmd aborted from QINFIFO\n", 2260 printk("%s:%d:%d:%d: Cmd aborted from QINFIFO\n",
2261 ahd_name(ahd), cmd->device->channel, 2261 ahd_name(ahd), cmd->device->channel,
2262 cmd->device->id, cmd->device->lun); 2262 cmd->device->id, (u8)cmd->device->lun);
2263 retval = SUCCESS; 2263 retval = SUCCESS;
2264 goto done; 2264 goto done;
2265 } 2265 }
diff --git a/drivers/scsi/aic7xxx/aic79xx_proc.c b/drivers/scsi/aic7xxx/aic79xx_proc.c
index e9778b4f7e32..27dbfccea774 100644
--- a/drivers/scsi/aic7xxx/aic79xx_proc.c
+++ b/drivers/scsi/aic7xxx/aic79xx_proc.c
@@ -197,7 +197,7 @@ ahd_dump_device_state(struct seq_file *m, struct scsi_device *sdev)
197 197
198 seq_printf(m, "\tChannel %c Target %d Lun %d Settings\n", 198 seq_printf(m, "\tChannel %c Target %d Lun %d Settings\n",
199 sdev->sdev_target->channel + 'A', 199 sdev->sdev_target->channel + 'A',
200 sdev->sdev_target->id, sdev->lun); 200 sdev->sdev_target->id, (u8)sdev->lun);
201 201
202 seq_printf(m, "\t\tCommands Queued %ld\n", dev->commands_issued); 202 seq_printf(m, "\t\tCommands Queued %ld\n", dev->commands_issued);
203 seq_printf(m, "\t\tCommands Active %d\n", dev->active); 203 seq_printf(m, "\t\tCommands Active %d\n", dev->active);
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 114ff0c6e311..d2c9bf39033d 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -2110,7 +2110,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2110 */ 2110 */
2111 printk("%s:%d:%d:%d: Is not an active device\n", 2111 printk("%s:%d:%d:%d: Is not an active device\n",
2112 ahc_name(ahc), cmd->device->channel, cmd->device->id, 2112 ahc_name(ahc), cmd->device->channel, cmd->device->id,
2113 cmd->device->lun); 2113 (u8)cmd->device->lun);
2114 retval = SUCCESS; 2114 retval = SUCCESS;
2115 goto no_cmd; 2115 goto no_cmd;
2116 } 2116 }
@@ -2118,11 +2118,11 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2118 if ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED)) == 0 2118 if ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED)) == 0
2119 && ahc_search_untagged_queues(ahc, cmd, cmd->device->id, 2119 && ahc_search_untagged_queues(ahc, cmd, cmd->device->id,
2120 cmd->device->channel + 'A', 2120 cmd->device->channel + 'A',
2121 cmd->device->lun, 2121 (u8)cmd->device->lun,
2122 CAM_REQ_ABORTED, SEARCH_COMPLETE) != 0) { 2122 CAM_REQ_ABORTED, SEARCH_COMPLETE) != 0) {
2123 printk("%s:%d:%d:%d: Command found on untagged queue\n", 2123 printk("%s:%d:%d:%d: Command found on untagged queue\n",
2124 ahc_name(ahc), cmd->device->channel, cmd->device->id, 2124 ahc_name(ahc), cmd->device->channel, cmd->device->id,
2125 cmd->device->lun); 2125 (u8)cmd->device->lun);
2126 retval = SUCCESS; 2126 retval = SUCCESS;
2127 goto done; 2127 goto done;
2128 } 2128 }
@@ -2188,13 +2188,14 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag)
2188 SEARCH_COMPLETE) > 0) { 2188 SEARCH_COMPLETE) > 0) {
2189 printk("%s:%d:%d:%d: Cmd aborted from QINFIFO\n", 2189 printk("%s:%d:%d:%d: Cmd aborted from QINFIFO\n",
2190 ahc_name(ahc), cmd->device->channel, 2190 ahc_name(ahc), cmd->device->channel,
2191 cmd->device->id, cmd->device->lun); 2191 cmd->device->id, (u8)cmd->device->lun);
2192 retval = SUCCESS; 2192 retval = SUCCESS;
2193 goto done; 2193 goto done;
2194 } 2194 }
2195 } else if (ahc_search_qinfifo(ahc, cmd->device->id, 2195 } else if (ahc_search_qinfifo(ahc, cmd->device->id,
2196 cmd->device->channel + 'A', 2196 cmd->device->channel + 'A',
2197 cmd->device->lun, pending_scb->hscb->tag, 2197 cmd->device->lun,
2198 pending_scb->hscb->tag,
2198 ROLE_INITIATOR, /*status*/0, 2199 ROLE_INITIATOR, /*status*/0,
2199 SEARCH_COUNT) > 0) { 2200 SEARCH_COUNT) > 0) {
2200 disconnected = FALSE; 2201 disconnected = FALSE;
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c
index 383a3d11652d..64eec6c07a83 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_proc.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c
@@ -175,7 +175,7 @@ ahc_dump_device_state(struct seq_file *m, struct scsi_device *sdev)
175 175
176 seq_printf(m, "\tChannel %c Target %d Lun %d Settings\n", 176 seq_printf(m, "\tChannel %c Target %d Lun %d Settings\n",
177 sdev->sdev_target->channel + 'A', 177 sdev->sdev_target->channel + 'A',
178 sdev->sdev_target->id, sdev->lun); 178 sdev->sdev_target->id, (u8)sdev->lun);
179 179
180 seq_printf(m, "\t\tCommands Queued %ld\n", dev->commands_issued); 180 seq_printf(m, "\t\tCommands Queued %ld\n", dev->commands_issued);
181 seq_printf(m, "\t\tCommands Active %d\n", dev->active); 181 seq_printf(m, "\t\tCommands Active %d\n", dev->active);
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index 652b41b4ddbd..b13764ca23fd 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -2335,7 +2335,7 @@ static int arcmsr_polling_hba_ccbdone(struct AdapterControlBlock *acb,
2335 " poll command abort successfully \n" 2335 " poll command abort successfully \n"
2336 , acb->host->host_no 2336 , acb->host->host_no
2337 , ccb->pcmd->device->id 2337 , ccb->pcmd->device->id
2338 , ccb->pcmd->device->lun 2338 , (u32)ccb->pcmd->device->lun
2339 , ccb); 2339 , ccb);
2340 ccb->pcmd->result = DID_ABORT << 16; 2340 ccb->pcmd->result = DID_ABORT << 16;
2341 arcmsr_ccb_complete(ccb); 2341 arcmsr_ccb_complete(ccb);
@@ -2399,7 +2399,7 @@ static int arcmsr_polling_hbb_ccbdone(struct AdapterControlBlock *acb,
2399 " poll command abort successfully \n" 2399 " poll command abort successfully \n"
2400 ,acb->host->host_no 2400 ,acb->host->host_no
2401 ,ccb->pcmd->device->id 2401 ,ccb->pcmd->device->id
2402 ,ccb->pcmd->device->lun 2402 ,(u32)ccb->pcmd->device->lun
2403 ,ccb); 2403 ,ccb);
2404 ccb->pcmd->result = DID_ABORT << 16; 2404 ccb->pcmd->result = DID_ABORT << 16;
2405 arcmsr_ccb_complete(ccb); 2405 arcmsr_ccb_complete(ccb);
@@ -2456,7 +2456,7 @@ polling_hbc_ccb_retry:
2456 " poll command abort successfully \n" 2456 " poll command abort successfully \n"
2457 , acb->host->host_no 2457 , acb->host->host_no
2458 , pCCB->pcmd->device->id 2458 , pCCB->pcmd->device->id
2459 , pCCB->pcmd->device->lun 2459 , (u32)pCCB->pcmd->device->lun
2460 , pCCB); 2460 , pCCB);
2461 pCCB->pcmd->result = DID_ABORT << 16; 2461 pCCB->pcmd->result = DID_ABORT << 16;
2462 arcmsr_ccb_complete(pCCB); 2462 arcmsr_ccb_complete(pCCB);
@@ -3058,7 +3058,7 @@ static int arcmsr_abort(struct scsi_cmnd *cmd)
3058 int rtn = FAILED; 3058 int rtn = FAILED;
3059 printk(KERN_NOTICE 3059 printk(KERN_NOTICE
3060 "arcmsr%d: abort device command of scsi id = %d lun = %d \n", 3060 "arcmsr%d: abort device command of scsi id = %d lun = %d \n",
3061 acb->host->host_no, cmd->device->id, cmd->device->lun); 3061 acb->host->host_no, cmd->device->id, (u32)cmd->device->lun);
3062 acb->acb_flags |= ACB_F_ABORT; 3062 acb->acb_flags |= ACB_F_ABORT;
3063 acb->num_aborts++; 3063 acb->num_aborts++;
3064 /* 3064 /*
diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c
index 2e797a367608..d89b9b4deb3c 100644
--- a/drivers/scsi/arm/acornscsi.c
+++ b/drivers/scsi/arm/acornscsi.c
@@ -760,7 +760,8 @@ intr_ret_t acornscsi_kick(AS_Host *host)
760 SCpnt->tag = SCpnt->device->current_tag; 760 SCpnt->tag = SCpnt->device->current_tag;
761 } else 761 } else
762#endif 762#endif
763 set_bit(SCpnt->device->id * 8 + SCpnt->device->lun, host->busyluns); 763 set_bit(SCpnt->device->id * 8 +
764 (u8)(SCpnt->device->lun & 0x07), host->busyluns);
764 765
765 host->stats.removes += 1; 766 host->stats.removes += 1;
766 767
@@ -863,7 +864,8 @@ static void acornscsi_done(AS_Host *host, struct scsi_cmnd **SCpntp,
863 if (!SCpnt->scsi_done) 864 if (!SCpnt->scsi_done)
864 panic("scsi%d.H: null scsi_done function in acornscsi_done", host->host->host_no); 865 panic("scsi%d.H: null scsi_done function in acornscsi_done", host->host->host_no);
865 866
866 clear_bit(SCpnt->device->id * 8 + SCpnt->device->lun, host->busyluns); 867 clear_bit(SCpnt->device->id * 8 +
868 (u8)(SCpnt->device->lun & 0x7), host->busyluns);
867 869
868 SCpnt->scsi_done(SCpnt); 870 SCpnt->scsi_done(SCpnt);
869 } else 871 } else
@@ -1576,7 +1578,8 @@ void acornscsi_message(AS_Host *host)
1576 printk(KERN_NOTICE "scsi%d.%c: disabling tagged queueing\n", 1578 printk(KERN_NOTICE "scsi%d.%c: disabling tagged queueing\n",
1577 host->host->host_no, acornscsi_target(host)); 1579 host->host->host_no, acornscsi_target(host));
1578 host->SCpnt->device->simple_tags = 0; 1580 host->SCpnt->device->simple_tags = 0;
1579 set_bit(host->SCpnt->device->id * 8 + host->SCpnt->device->lun, host->busyluns); 1581 set_bit(host->SCpnt->device->id * 8 +
1582 (u8)(host->SCpnt->device->lun & 0x7), host->busyluns);
1580 break; 1583 break;
1581#endif 1584#endif
1582 case EXTENDED_MESSAGE | (EXTENDED_SDTR << 8): 1585 case EXTENDED_MESSAGE | (EXTENDED_SDTR << 8):
@@ -2671,7 +2674,8 @@ int acornscsi_abort(struct scsi_cmnd *SCpnt)
2671//#if (DEBUG & DEBUG_ABORT) 2674//#if (DEBUG & DEBUG_ABORT)
2672 printk("clear "); 2675 printk("clear ");
2673//#endif 2676//#endif
2674 clear_bit(SCpnt->device->id * 8 + SCpnt->device->lun, host->busyluns); 2677 clear_bit(SCpnt->device->id * 8 +
2678 (u8)(SCpnt->device->lun & 0x7), host->busyluns);
2675 2679
2676 /* 2680 /*
2677 * We found the command, and cleared it out. Either 2681 * We found the command, and cleared it out. Either
@@ -2853,7 +2857,7 @@ static int acornscsi_show_info(struct seq_file *m, struct Scsi_Host *instance)
2853 2857
2854 shost_for_each_device(scd, instance) { 2858 shost_for_each_device(scd, instance) {
2855 seq_printf(m, "Device/Lun TaggedQ Sync\n"); 2859 seq_printf(m, "Device/Lun TaggedQ Sync\n");
2856 seq_printf(m, " %d/%d ", scd->id, scd->lun); 2860 seq_printf(m, " %d/%llu ", scd->id, scd->lun);
2857 if (scd->tagged_supported) 2861 if (scd->tagged_supported)
2858 seq_printf(m, "%3sabled(%3d) ", 2862 seq_printf(m, "%3sabled(%3d) ",
2859 scd->simple_tags ? "en" : "dis", 2863 scd->simple_tags ? "en" : "dis",
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index b46a6f6c0eb3..71cfb1e504c4 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -1821,7 +1821,8 @@ static void fas216_allocate_tag(FAS216_Info *info, struct scsi_cmnd *SCpnt)
1821 SCpnt->tag = SCpnt->device->current_tag; 1821 SCpnt->tag = SCpnt->device->current_tag;
1822 } else 1822 } else
1823#endif 1823#endif
1824 set_bit(SCpnt->device->id * 8 + SCpnt->device->lun, info->busyluns); 1824 set_bit(SCpnt->device->id * 8 +
1825 (u8)(SCpnt->device->lun & 0x7), info->busyluns);
1825 1826
1826 info->stats.removes += 1; 1827 info->stats.removes += 1;
1827 switch (SCpnt->cmnd[0]) { 1828 switch (SCpnt->cmnd[0]) {
@@ -2171,7 +2172,8 @@ static void fas216_done(FAS216_Info *info, unsigned int result)
2171 * status. 2172 * status.
2172 */ 2173 */
2173 info->device[SCpnt->device->id].parity_check = 0; 2174 info->device[SCpnt->device->id].parity_check = 0;
2174 clear_bit(SCpnt->device->id * 8 + SCpnt->device->lun, info->busyluns); 2175 clear_bit(SCpnt->device->id * 8 +
2176 (u8)(SCpnt->device->lun & 0x7), info->busyluns);
2175 2177
2176 fn = (void (*)(FAS216_Info *, struct scsi_cmnd *, unsigned int))SCpnt->host_scribble; 2178 fn = (void (*)(FAS216_Info *, struct scsi_cmnd *, unsigned int))SCpnt->host_scribble;
2177 fn(info, SCpnt, result); 2179 fn(info, SCpnt, result);
@@ -2398,7 +2400,8 @@ static enum res_find fas216_find_command(FAS216_Info *info,
2398 * been set. 2400 * been set.
2399 */ 2401 */
2400 info->origSCpnt = NULL; 2402 info->origSCpnt = NULL;
2401 clear_bit(SCpnt->device->id * 8 + SCpnt->device->lun, info->busyluns); 2403 clear_bit(SCpnt->device->id * 8 +
2404 (u8)(SCpnt->device->lun & 0x7), info->busyluns);
2402 printk("waiting for execution "); 2405 printk("waiting for execution ");
2403 res = res_success; 2406 res = res_success;
2404 } else 2407 } else
@@ -3000,7 +3003,7 @@ void fas216_print_devices(FAS216_Info *info, struct seq_file *m)
3000 3003
3001 shost_for_each_device(scd, info->host) { 3004 shost_for_each_device(scd, info->host) {
3002 dev = &info->device[scd->id]; 3005 dev = &info->device[scd->id];
3003 seq_printf(m, " %d/%d ", scd->id, scd->lun); 3006 seq_printf(m, " %d/%llu ", scd->id, scd->lun);
3004 if (scd->tagged_supported) 3007 if (scd->tagged_supported)
3005 seq_printf(m, "%3sabled(%3d) ", 3008 seq_printf(m, "%3sabled(%3d) ",
3006 scd->simple_tags ? "en" : "dis", 3009 scd->simple_tags ? "en" : "dis",
diff --git a/drivers/scsi/arm/queue.c b/drivers/scsi/arm/queue.c
index cb11ccef54e5..3441ce3ebabf 100644
--- a/drivers/scsi/arm/queue.c
+++ b/drivers/scsi/arm/queue.c
@@ -167,7 +167,8 @@ struct scsi_cmnd *queue_remove_exclude(Queue_t *queue, unsigned long *exclude)
167 spin_lock_irqsave(&queue->queue_lock, flags); 167 spin_lock_irqsave(&queue->queue_lock, flags);
168 list_for_each(l, &queue->head) { 168 list_for_each(l, &queue->head) {
169 QE_t *q = list_entry(l, QE_t, list); 169 QE_t *q = list_entry(l, QE_t, list);
170 if (!test_bit(q->SCpnt->device->id * 8 + q->SCpnt->device->lun, exclude)) { 170 if (!test_bit(q->SCpnt->device->id * 8 +
171 (u8)(q->SCpnt->device->lun & 0x7), exclude)) {
171 SCpnt = __queue_remove(queue, l); 172 SCpnt = __queue_remove(queue, l);
172 break; 173 break;
173 } 174 }
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 1814aa20b724..79e6f045c2a9 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -361,17 +361,18 @@ static void __init init_tags(void)
361 361
362static int is_lun_busy(Scsi_Cmnd *cmd, int should_be_tagged) 362static int is_lun_busy(Scsi_Cmnd *cmd, int should_be_tagged)
363{ 363{
364 u8 lun = cmd->device->lun;
364 SETUP_HOSTDATA(cmd->device->host); 365 SETUP_HOSTDATA(cmd->device->host);
365 366
366 if (hostdata->busy[cmd->device->id] & (1 << cmd->device->lun)) 367 if (hostdata->busy[cmd->device->id] & (1 << lun))
367 return 1; 368 return 1;
368 if (!should_be_tagged || 369 if (!should_be_tagged ||
369 !setup_use_tagged_queuing || !cmd->device->tagged_supported) 370 !setup_use_tagged_queuing || !cmd->device->tagged_supported)
370 return 0; 371 return 0;
371 if (TagAlloc[cmd->device->id][cmd->device->lun].nr_allocated >= 372 if (TagAlloc[cmd->device->id][lun].nr_allocated >=
372 TagAlloc[cmd->device->id][cmd->device->lun].queue_size) { 373 TagAlloc[cmd->device->id][lun].queue_size) {
373 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d: no free tags\n", 374 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d: no free tags\n",
374 H_NO(cmd), cmd->device->id, cmd->device->lun); 375 H_NO(cmd), cmd->device->id, lun);
375 return 1; 376 return 1;
376 } 377 }
377 return 0; 378 return 0;
@@ -385,6 +386,7 @@ static int is_lun_busy(Scsi_Cmnd *cmd, int should_be_tagged)
385 386
386static void cmd_get_tag(Scsi_Cmnd *cmd, int should_be_tagged) 387static void cmd_get_tag(Scsi_Cmnd *cmd, int should_be_tagged)
387{ 388{
389 u8 lun = cmd->device->lun;
388 SETUP_HOSTDATA(cmd->device->host); 390 SETUP_HOSTDATA(cmd->device->host);
389 391
390 /* If we or the target don't support tagged queuing, allocate the LUN for 392 /* If we or the target don't support tagged queuing, allocate the LUN for
@@ -393,11 +395,11 @@ static void cmd_get_tag(Scsi_Cmnd *cmd, int should_be_tagged)
393 if (!should_be_tagged || 395 if (!should_be_tagged ||
394 !setup_use_tagged_queuing || !cmd->device->tagged_supported) { 396 !setup_use_tagged_queuing || !cmd->device->tagged_supported) {
395 cmd->tag = TAG_NONE; 397 cmd->tag = TAG_NONE;
396 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); 398 hostdata->busy[cmd->device->id] |= (1 << lun);
397 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d now allocated by untagged " 399 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d now allocated by untagged "
398 "command\n", H_NO(cmd), cmd->device->id, cmd->device->lun); 400 "command\n", H_NO(cmd), cmd->device->id, lun);
399 } else { 401 } else {
400 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun]; 402 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][lun];
401 403
402 cmd->tag = find_first_zero_bit(ta->allocated, MAX_TAGS); 404 cmd->tag = find_first_zero_bit(ta->allocated, MAX_TAGS);
403 set_bit(cmd->tag, ta->allocated); 405 set_bit(cmd->tag, ta->allocated);
@@ -405,7 +407,7 @@ static void cmd_get_tag(Scsi_Cmnd *cmd, int should_be_tagged)
405 dprintk(NDEBUG_TAGS, "scsi%d: using tag %d for target %d lun %d " 407 dprintk(NDEBUG_TAGS, "scsi%d: using tag %d for target %d lun %d "
406 "(now %d tags in use)\n", 408 "(now %d tags in use)\n",
407 H_NO(cmd), cmd->tag, cmd->device->id, 409 H_NO(cmd), cmd->tag, cmd->device->id,
408 cmd->device->lun, ta->nr_allocated); 410 lun, ta->nr_allocated);
409 } 411 }
410} 412}
411 413
@@ -416,21 +418,22 @@ static void cmd_get_tag(Scsi_Cmnd *cmd, int should_be_tagged)
416 418
417static void cmd_free_tag(Scsi_Cmnd *cmd) 419static void cmd_free_tag(Scsi_Cmnd *cmd)
418{ 420{
421 u8 lun = cmd->device->lun;
419 SETUP_HOSTDATA(cmd->device->host); 422 SETUP_HOSTDATA(cmd->device->host);
420 423
421 if (cmd->tag == TAG_NONE) { 424 if (cmd->tag == TAG_NONE) {
422 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 425 hostdata->busy[cmd->device->id] &= ~(1 << lun);
423 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d untagged cmd finished\n", 426 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d untagged cmd finished\n",
424 H_NO(cmd), cmd->device->id, cmd->device->lun); 427 H_NO(cmd), cmd->device->id, lun);
425 } else if (cmd->tag >= MAX_TAGS) { 428 } else if (cmd->tag >= MAX_TAGS) {
426 printk(KERN_NOTICE "scsi%d: trying to free bad tag %d!\n", 429 printk(KERN_NOTICE "scsi%d: trying to free bad tag %d!\n",
427 H_NO(cmd), cmd->tag); 430 H_NO(cmd), cmd->tag);
428 } else { 431 } else {
429 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun]; 432 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][lun];
430 clear_bit(cmd->tag, ta->allocated); 433 clear_bit(cmd->tag, ta->allocated);
431 ta->nr_allocated--; 434 ta->nr_allocated--;
432 dprintk(NDEBUG_TAGS, "scsi%d: freed tag %d for target %d lun %d\n", 435 dprintk(NDEBUG_TAGS, "scsi%d: freed tag %d for target %d lun %d\n",
433 H_NO(cmd), cmd->tag, cmd->device->id, cmd->device->lun); 436 H_NO(cmd), cmd->tag, cmd->device->id, lun);
434 } 437 }
435} 438}
436 439
@@ -713,7 +716,7 @@ static void lprint_Scsi_Cmnd(Scsi_Cmnd *cmd)
713{ 716{
714 int i, s; 717 int i, s;
715 unsigned char *command; 718 unsigned char *command;
716 printk("scsi%d: destination target %d, lun %d\n", 719 printk("scsi%d: destination target %d, lun %llu\n",
717 H_NO(cmd), cmd->device->id, cmd->device->lun); 720 H_NO(cmd), cmd->device->id, cmd->device->lun);
718 printk(KERN_CONT " command = "); 721 printk(KERN_CONT " command = ");
719 command = cmd->cmnd; 722 command = cmd->cmnd;
@@ -759,7 +762,7 @@ static void show_Scsi_Cmnd(Scsi_Cmnd *cmd, struct seq_file *m)
759{ 762{
760 int i, s; 763 int i, s;
761 unsigned char *command; 764 unsigned char *command;
762 seq_printf(m, "scsi%d: destination target %d, lun %d\n", 765 seq_printf(m, "scsi%d: destination target %d, lun %llu\n",
763 H_NO(cmd), cmd->device->id, cmd->device->lun); 766 H_NO(cmd), cmd->device->id, cmd->device->lun);
764 seq_printf(m, " command = "); 767 seq_printf(m, " command = ");
765 command = cmd->cmnd; 768 command = cmd->cmnd;
@@ -1060,12 +1063,13 @@ static void NCR5380_main(struct work_struct *work)
1060#endif 1063#endif
1061 for (tmp = (Scsi_Cmnd *) hostdata->issue_queue, 1064 for (tmp = (Scsi_Cmnd *) hostdata->issue_queue,
1062 prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp)) { 1065 prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp)) {
1066 u8 lun = tmp->device->lun;
1063 1067
1064#if (NDEBUG & NDEBUG_LISTS) 1068#if (NDEBUG & NDEBUG_LISTS)
1065 if (prev != tmp) 1069 if (prev != tmp)
1066 printk("MAIN tmp=%p target=%d busy=%d lun=%d\n", 1070 printk("MAIN tmp=%p target=%d busy=%d lun=%llu\n",
1067 tmp, tmp->device->id, hostdata->busy[tmp->device->id], 1071 tmp, tmp->device->id, hostdata->busy[tmp->device->id],
1068 tmp->device->lun); 1072 lun);
1069#endif 1073#endif
1070 /* When we find one, remove it from the issue queue. */ 1074 /* When we find one, remove it from the issue queue. */
1071 /* ++guenther: possible race with Falcon locking */ 1075 /* ++guenther: possible race with Falcon locking */
@@ -1073,7 +1077,7 @@ static void NCR5380_main(struct work_struct *work)
1073#ifdef SUPPORT_TAGS 1077#ifdef SUPPORT_TAGS
1074 !is_lun_busy( tmp, tmp->cmnd[0] != REQUEST_SENSE) 1078 !is_lun_busy( tmp, tmp->cmnd[0] != REQUEST_SENSE)
1075#else 1079#else
1076 !(hostdata->busy[tmp->device->id] & (1 << tmp->device->lun)) 1080 !(hostdata->busy[tmp->device->id] & (1 << lun))
1077#endif 1081#endif
1078 ) { 1082 ) {
1079 /* ++guenther: just to be sure, this must be atomic */ 1083 /* ++guenther: just to be sure, this must be atomic */
@@ -1099,7 +1103,7 @@ static void NCR5380_main(struct work_struct *work)
1099 */ 1103 */
1100 dprintk(NDEBUG_MAIN, "scsi%d: main(): command for target %d " 1104 dprintk(NDEBUG_MAIN, "scsi%d: main(): command for target %d "
1101 "lun %d removed from issue_queue\n", 1105 "lun %d removed from issue_queue\n",
1102 HOSTNO, tmp->device->id, tmp->device->lun); 1106 HOSTNO, tmp->device->id, lun);
1103 /* 1107 /*
1104 * REQUEST SENSE commands are issued without tagged 1108 * REQUEST SENSE commands are issued without tagged
1105 * queueing, even on SCSI-II devices because the 1109 * queueing, even on SCSI-II devices because the
@@ -2061,7 +2065,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
2061 * accesses to this device will use the 2065 * accesses to this device will use the
2062 * polled-IO. */ 2066 * polled-IO. */
2063 printk(KERN_NOTICE "scsi%d: switching target %d " 2067 printk(KERN_NOTICE "scsi%d: switching target %d "
2064 "lun %d to slow handshake\n", HOSTNO, 2068 "lun %llu to slow handshake\n", HOSTNO,
2065 cmd->device->id, cmd->device->lun); 2069 cmd->device->id, cmd->device->lun);
2066 cmd->device->borken = 1; 2070 cmd->device->borken = 1;
2067 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 2071 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
@@ -2113,7 +2117,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
2113 /* Accept message by clearing ACK */ 2117 /* Accept message by clearing ACK */
2114 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2118 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2115 2119
2116 dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %d linked command " 2120 dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %llu linked command "
2117 "complete.\n", HOSTNO, cmd->device->id, cmd->device->lun); 2121 "complete.\n", HOSTNO, cmd->device->id, cmd->device->lun);
2118 2122
2119 /* Enable reselect interrupts */ 2123 /* Enable reselect interrupts */
@@ -2125,7 +2129,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
2125 */ 2129 */
2126 2130
2127 if (!cmd->next_link) { 2131 if (!cmd->next_link) {
2128 printk(KERN_NOTICE "scsi%d: target %d lun %d " 2132 printk(KERN_NOTICE "scsi%d: target %d lun %llu "
2129 "linked command complete, no next_link\n", 2133 "linked command complete, no next_link\n",
2130 HOSTNO, cmd->device->id, cmd->device->lun); 2134 HOSTNO, cmd->device->id, cmd->device->lun);
2131 sink = 1; 2135 sink = 1;
@@ -2138,7 +2142,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
2138 * and don't free it! */ 2142 * and don't free it! */
2139 cmd->next_link->tag = cmd->tag; 2143 cmd->next_link->tag = cmd->tag;
2140 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); 2144 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
2141 dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %d linked request " 2145 dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %llu linked request "
2142 "done, calling scsi_done().\n", 2146 "done, calling scsi_done().\n",
2143 HOSTNO, cmd->device->id, cmd->device->lun); 2147 HOSTNO, cmd->device->id, cmd->device->lun);
2144#ifdef NCR5380_STATS 2148#ifdef NCR5380_STATS
@@ -2155,7 +2159,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
2155 /* ++guenther: possible race with Falcon locking */ 2159 /* ++guenther: possible race with Falcon locking */
2156 falcon_dont_release++; 2160 falcon_dont_release++;
2157 hostdata->connected = NULL; 2161 hostdata->connected = NULL;
2158 dprintk(NDEBUG_QUEUES, "scsi%d: command for target %d, lun %d " 2162 dprintk(NDEBUG_QUEUES, "scsi%d: command for target %d, lun %llu "
2159 "completed\n", HOSTNO, cmd->device->id, cmd->device->lun); 2163 "completed\n", HOSTNO, cmd->device->id, cmd->device->lun);
2160#ifdef SUPPORT_TAGS 2164#ifdef SUPPORT_TAGS
2161 cmd_free_tag(cmd); 2165 cmd_free_tag(cmd);
@@ -2169,7 +2173,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
2169 /* ++Andreas: the mid level code knows about 2173 /* ++Andreas: the mid level code knows about
2170 QUEUE_FULL now. */ 2174 QUEUE_FULL now. */
2171 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun]; 2175 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
2172 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d returned " 2176 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %llu returned "
2173 "QUEUE_FULL after %d commands\n", 2177 "QUEUE_FULL after %d commands\n",
2174 HOSTNO, cmd->device->id, cmd->device->lun, 2178 HOSTNO, cmd->device->id, cmd->device->lun,
2175 ta->nr_allocated); 2179 ta->nr_allocated);
@@ -2267,7 +2271,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
2267 cmd->device->tagged_supported = 0; 2271 cmd->device->tagged_supported = 0;
2268 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); 2272 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
2269 cmd->tag = TAG_NONE; 2273 cmd->tag = TAG_NONE;
2270 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d rejected " 2274 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %llu rejected "
2271 "QUEUE_TAG message; tagged queuing " 2275 "QUEUE_TAG message; tagged queuing "
2272 "disabled\n", 2276 "disabled\n",
2273 HOSTNO, cmd->device->id, cmd->device->lun); 2277 HOSTNO, cmd->device->id, cmd->device->lun);
@@ -2284,7 +2288,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
2284 hostdata->connected = NULL; 2288 hostdata->connected = NULL;
2285 hostdata->disconnected_queue = cmd; 2289 hostdata->disconnected_queue = cmd;
2286 local_irq_restore(flags); 2290 local_irq_restore(flags);
2287 dprintk(NDEBUG_QUEUES, "scsi%d: command for target %d lun %d was " 2291 dprintk(NDEBUG_QUEUES, "scsi%d: command for target %d lun %llu was "
2288 "moved from connected to the " 2292 "moved from connected to the "
2289 "disconnected_queue\n", HOSTNO, 2293 "disconnected_queue\n", HOSTNO,
2290 cmd->device->id, cmd->device->lun); 2294 cmd->device->id, cmd->device->lun);
@@ -2385,12 +2389,12 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
2385 printk("\n"); 2389 printk("\n");
2386 } else if (tmp != EXTENDED_MESSAGE) 2390 } else if (tmp != EXTENDED_MESSAGE)
2387 printk(KERN_DEBUG "scsi%d: rejecting unknown " 2391 printk(KERN_DEBUG "scsi%d: rejecting unknown "
2388 "message %02x from target %d, lun %d\n", 2392 "message %02x from target %d, lun %llu\n",
2389 HOSTNO, tmp, cmd->device->id, cmd->device->lun); 2393 HOSTNO, tmp, cmd->device->id, cmd->device->lun);
2390 else 2394 else
2391 printk(KERN_DEBUG "scsi%d: rejecting unknown " 2395 printk(KERN_DEBUG "scsi%d: rejecting unknown "
2392 "extended message " 2396 "extended message "
2393 "code %02x, length %d from target %d, lun %d\n", 2397 "code %02x, length %d from target %d, lun %llu\n",
2394 HOSTNO, extended_msg[1], extended_msg[0], 2398 HOSTNO, extended_msg[1], extended_msg[0],
2395 cmd->device->id, cmd->device->lun); 2399 cmd->device->id, cmd->device->lun);
2396 2400
@@ -2588,7 +2592,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
2588 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2592 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2589 2593
2590 hostdata->connected = tmp; 2594 hostdata->connected = tmp;
2591 dprintk(NDEBUG_RESELECTION, "scsi%d: nexus established, target = %d, lun = %d, tag = %d\n", 2595 dprintk(NDEBUG_RESELECTION, "scsi%d: nexus established, target = %d, lun = %llu, tag = %d\n",
2592 HOSTNO, tmp->device->id, tmp->device->lun, tmp->tag); 2596 HOSTNO, tmp->device->id, tmp->device->lun, tmp->tag);
2593 falcon_dont_release--; 2597 falcon_dont_release--;
2594} 2598}
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c
index 7bc47fc7c686..e0bb209f3af1 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_io.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_io.c
@@ -1450,9 +1450,9 @@ static void bnx2fc_lun_reset_cmpl(struct bnx2fc_cmd *io_req)
1450 struct scsi_cmnd *sc_cmd = io_req->sc_cmd; 1450 struct scsi_cmnd *sc_cmd = io_req->sc_cmd;
1451 struct bnx2fc_rport *tgt = io_req->tgt; 1451 struct bnx2fc_rport *tgt = io_req->tgt;
1452 struct bnx2fc_cmd *cmd, *tmp; 1452 struct bnx2fc_cmd *cmd, *tmp;
1453 int tm_lun = sc_cmd->device->lun; 1453 u64 tm_lun = sc_cmd->device->lun;
1454 u64 lun;
1454 int rc = 0; 1455 int rc = 0;
1455 int lun;
1456 1456
1457 /* called with tgt_lock held */ 1457 /* called with tgt_lock held */
1458 BNX2FC_IO_DBG(io_req, "Entered bnx2fc_lun_reset_cmpl\n"); 1458 BNX2FC_IO_DBG(io_req, "Entered bnx2fc_lun_reset_cmpl\n");
diff --git a/drivers/scsi/ch.c b/drivers/scsi/ch.c
index 2a323742ce04..7e952cadbcf1 100644
--- a/drivers/scsi/ch.c
+++ b/drivers/scsi/ch.c
@@ -247,7 +247,7 @@ ch_read_element_status(scsi_changer *ch, u_int elem, char *data)
247 retry: 247 retry:
248 memset(cmd,0,sizeof(cmd)); 248 memset(cmd,0,sizeof(cmd));
249 cmd[0] = READ_ELEMENT_STATUS; 249 cmd[0] = READ_ELEMENT_STATUS;
250 cmd[1] = (ch->device->lun << 5) | 250 cmd[1] = ((ch->device->lun & 0x7) << 5) |
251 (ch->voltags ? 0x10 : 0) | 251 (ch->voltags ? 0x10 : 0) |
252 ch_elem_to_typecode(ch,elem); 252 ch_elem_to_typecode(ch,elem);
253 cmd[2] = (elem >> 8) & 0xff; 253 cmd[2] = (elem >> 8) & 0xff;
@@ -283,7 +283,7 @@ ch_init_elem(scsi_changer *ch)
283 VPRINTK(KERN_INFO, "INITIALIZE ELEMENT STATUS, may take some time ...\n"); 283 VPRINTK(KERN_INFO, "INITIALIZE ELEMENT STATUS, may take some time ...\n");
284 memset(cmd,0,sizeof(cmd)); 284 memset(cmd,0,sizeof(cmd));
285 cmd[0] = INITIALIZE_ELEMENT_STATUS; 285 cmd[0] = INITIALIZE_ELEMENT_STATUS;
286 cmd[1] = ch->device->lun << 5; 286 cmd[1] = (ch->device->lun & 0x7) << 5;
287 err = ch_do_scsi(ch, cmd, NULL, 0, DMA_NONE); 287 err = ch_do_scsi(ch, cmd, NULL, 0, DMA_NONE);
288 VPRINTK(KERN_INFO, "... finished\n"); 288 VPRINTK(KERN_INFO, "... finished\n");
289 return err; 289 return err;
@@ -303,7 +303,7 @@ ch_readconfig(scsi_changer *ch)
303 303
304 memset(cmd,0,sizeof(cmd)); 304 memset(cmd,0,sizeof(cmd));
305 cmd[0] = MODE_SENSE; 305 cmd[0] = MODE_SENSE;
306 cmd[1] = ch->device->lun << 5; 306 cmd[1] = (ch->device->lun & 0x7) << 5;
307 cmd[2] = 0x1d; 307 cmd[2] = 0x1d;
308 cmd[4] = 255; 308 cmd[4] = 255;
309 result = ch_do_scsi(ch, cmd, buffer, 255, DMA_FROM_DEVICE); 309 result = ch_do_scsi(ch, cmd, buffer, 255, DMA_FROM_DEVICE);
@@ -428,7 +428,7 @@ ch_position(scsi_changer *ch, u_int trans, u_int elem, int rotate)
428 trans = ch->firsts[CHET_MT]; 428 trans = ch->firsts[CHET_MT];
429 memset(cmd,0,sizeof(cmd)); 429 memset(cmd,0,sizeof(cmd));
430 cmd[0] = POSITION_TO_ELEMENT; 430 cmd[0] = POSITION_TO_ELEMENT;
431 cmd[1] = ch->device->lun << 5; 431 cmd[1] = (ch->device->lun & 0x7) << 5;
432 cmd[2] = (trans >> 8) & 0xff; 432 cmd[2] = (trans >> 8) & 0xff;
433 cmd[3] = trans & 0xff; 433 cmd[3] = trans & 0xff;
434 cmd[4] = (elem >> 8) & 0xff; 434 cmd[4] = (elem >> 8) & 0xff;
@@ -447,7 +447,7 @@ ch_move(scsi_changer *ch, u_int trans, u_int src, u_int dest, int rotate)
447 trans = ch->firsts[CHET_MT]; 447 trans = ch->firsts[CHET_MT];
448 memset(cmd,0,sizeof(cmd)); 448 memset(cmd,0,sizeof(cmd));
449 cmd[0] = MOVE_MEDIUM; 449 cmd[0] = MOVE_MEDIUM;
450 cmd[1] = ch->device->lun << 5; 450 cmd[1] = (ch->device->lun & 0x7) << 5;
451 cmd[2] = (trans >> 8) & 0xff; 451 cmd[2] = (trans >> 8) & 0xff;
452 cmd[3] = trans & 0xff; 452 cmd[3] = trans & 0xff;
453 cmd[4] = (src >> 8) & 0xff; 453 cmd[4] = (src >> 8) & 0xff;
@@ -470,7 +470,7 @@ ch_exchange(scsi_changer *ch, u_int trans, u_int src,
470 trans = ch->firsts[CHET_MT]; 470 trans = ch->firsts[CHET_MT];
471 memset(cmd,0,sizeof(cmd)); 471 memset(cmd,0,sizeof(cmd));
472 cmd[0] = EXCHANGE_MEDIUM; 472 cmd[0] = EXCHANGE_MEDIUM;
473 cmd[1] = ch->device->lun << 5; 473 cmd[1] = (ch->device->lun & 0x7) << 5;
474 cmd[2] = (trans >> 8) & 0xff; 474 cmd[2] = (trans >> 8) & 0xff;
475 cmd[3] = trans & 0xff; 475 cmd[3] = trans & 0xff;
476 cmd[4] = (src >> 8) & 0xff; 476 cmd[4] = (src >> 8) & 0xff;
@@ -518,7 +518,7 @@ ch_set_voltag(scsi_changer *ch, u_int elem,
518 elem, tag); 518 elem, tag);
519 memset(cmd,0,sizeof(cmd)); 519 memset(cmd,0,sizeof(cmd));
520 cmd[0] = SEND_VOLUME_TAG; 520 cmd[0] = SEND_VOLUME_TAG;
521 cmd[1] = (ch->device->lun << 5) | 521 cmd[1] = ((ch->device->lun & 0x7) << 5) |
522 ch_elem_to_typecode(ch,elem); 522 ch_elem_to_typecode(ch,elem);
523 cmd[2] = (elem >> 8) & 0xff; 523 cmd[2] = (elem >> 8) & 0xff;
524 cmd[3] = elem & 0xff; 524 cmd[3] = elem & 0xff;
@@ -754,7 +754,7 @@ static long ch_ioctl(struct file *file,
754 voltag_retry: 754 voltag_retry:
755 memset(ch_cmd, 0, sizeof(ch_cmd)); 755 memset(ch_cmd, 0, sizeof(ch_cmd));
756 ch_cmd[0] = READ_ELEMENT_STATUS; 756 ch_cmd[0] = READ_ELEMENT_STATUS;
757 ch_cmd[1] = (ch->device->lun << 5) | 757 ch_cmd[1] = ((ch->device->lun & 0x7) << 5) |
758 (ch->voltags ? 0x10 : 0) | 758 (ch->voltags ? 0x10 : 0) |
759 ch_elem_to_typecode(ch,elem); 759 ch_elem_to_typecode(ch,elem);
760 ch_cmd[2] = (elem >> 8) & 0xff; 760 ch_cmd[2] = (elem >> 8) & 0xff;
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index 7494e4bc69cc..86103c8475d8 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -1657,7 +1657,7 @@ csio_scsi_err_handler(struct csio_hw *hw, struct csio_ioreq *req)
1657 case FW_SCSI_UNDER_FLOW_ERR: 1657 case FW_SCSI_UNDER_FLOW_ERR:
1658 csio_warn(hw, 1658 csio_warn(hw,
1659 "Under-flow error,cmnd:0x%x expected" 1659 "Under-flow error,cmnd:0x%x expected"
1660 " len:0x%x resid:0x%x lun:0x%x ssn:0x%x\n", 1660 " len:0x%x resid:0x%x lun:0x%llx ssn:0x%x\n",
1661 cmnd->cmnd[0], scsi_bufflen(cmnd), 1661 cmnd->cmnd[0], scsi_bufflen(cmnd),
1662 scsi_get_resid(cmnd), cmnd->device->lun, 1662 scsi_get_resid(cmnd), cmnd->device->lun,
1663 rn->flowid); 1663 rn->flowid);
@@ -1957,7 +1957,7 @@ csio_eh_abort_handler(struct scsi_cmnd *cmnd)
1957 1957
1958 csio_dbg(hw, 1958 csio_dbg(hw,
1959 "Request to abort ioreq:%p cmd:%p cdb:%08llx" 1959 "Request to abort ioreq:%p cmd:%p cdb:%08llx"
1960 " ssni:0x%x lun:%d iq:0x%x\n", 1960 " ssni:0x%x lun:%llu iq:0x%x\n",
1961 ioreq, cmnd, *((uint64_t *)cmnd->cmnd), rn->flowid, 1961 ioreq, cmnd, *((uint64_t *)cmnd->cmnd), rn->flowid,
1962 cmnd->device->lun, csio_q_physiqid(hw, ioreq->iq_idx)); 1962 cmnd->device->lun, csio_q_physiqid(hw, ioreq->iq_idx));
1963 1963
@@ -2015,13 +2015,13 @@ inval_scmnd:
2015 /* FW successfully aborted the request */ 2015 /* FW successfully aborted the request */
2016 if (host_byte(cmnd->result) == DID_REQUEUE) { 2016 if (host_byte(cmnd->result) == DID_REQUEUE) {
2017 csio_info(hw, 2017 csio_info(hw,
2018 "Aborted SCSI command to (%d:%d) serial#:0x%lx\n", 2018 "Aborted SCSI command to (%d:%llu) serial#:0x%lx\n",
2019 cmnd->device->id, cmnd->device->lun, 2019 cmnd->device->id, cmnd->device->lun,
2020 cmnd->serial_number); 2020 cmnd->serial_number);
2021 return SUCCESS; 2021 return SUCCESS;
2022 } else { 2022 } else {
2023 csio_info(hw, 2023 csio_info(hw,
2024 "Failed to abort SCSI command, (%d:%d) serial#:0x%lx\n", 2024 "Failed to abort SCSI command, (%d:%llu) serial#:0x%lx\n",
2025 cmnd->device->id, cmnd->device->lun, 2025 cmnd->device->id, cmnd->device->lun,
2026 cmnd->serial_number); 2026 cmnd->serial_number);
2027 return FAILED; 2027 return FAILED;
@@ -2100,13 +2100,13 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
2100 if (!rn) 2100 if (!rn)
2101 goto fail; 2101 goto fail;
2102 2102
2103 csio_dbg(hw, "Request to reset LUN:%d (ssni:0x%x tgtid:%d)\n", 2103 csio_dbg(hw, "Request to reset LUN:%llu (ssni:0x%x tgtid:%d)\n",
2104 cmnd->device->lun, rn->flowid, rn->scsi_id); 2104 cmnd->device->lun, rn->flowid, rn->scsi_id);
2105 2105
2106 if (!csio_is_lnode_ready(ln)) { 2106 if (!csio_is_lnode_ready(ln)) {
2107 csio_err(hw, 2107 csio_err(hw,
2108 "LUN reset cannot be issued on non-ready" 2108 "LUN reset cannot be issued on non-ready"
2109 " local node vnpi:0x%x (LUN:%d)\n", 2109 " local node vnpi:0x%x (LUN:%llu)\n",
2110 ln->vnp_flowid, cmnd->device->lun); 2110 ln->vnp_flowid, cmnd->device->lun);
2111 goto fail; 2111 goto fail;
2112 } 2112 }
@@ -2126,7 +2126,7 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
2126 if (fc_remote_port_chkready(rn->rport)) { 2126 if (fc_remote_port_chkready(rn->rport)) {
2127 csio_err(hw, 2127 csio_err(hw,
2128 "LUN reset cannot be issued on non-ready" 2128 "LUN reset cannot be issued on non-ready"
2129 " remote node ssni:0x%x (LUN:%d)\n", 2129 " remote node ssni:0x%x (LUN:%llu)\n",
2130 rn->flowid, cmnd->device->lun); 2130 rn->flowid, cmnd->device->lun);
2131 goto fail; 2131 goto fail;
2132 } 2132 }
@@ -2168,7 +2168,7 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
2168 sld.level = CSIO_LEV_LUN; 2168 sld.level = CSIO_LEV_LUN;
2169 sld.lnode = ioreq->lnode; 2169 sld.lnode = ioreq->lnode;
2170 sld.rnode = ioreq->rnode; 2170 sld.rnode = ioreq->rnode;
2171 sld.oslun = (uint64_t)cmnd->device->lun; 2171 sld.oslun = cmnd->device->lun;
2172 2172
2173 spin_lock_irqsave(&hw->lock, flags); 2173 spin_lock_irqsave(&hw->lock, flags);
2174 /* Kick off TM SM on the ioreq */ 2174 /* Kick off TM SM on the ioreq */
@@ -2190,7 +2190,7 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
2190 2190
2191 /* LUN reset timed-out */ 2191 /* LUN reset timed-out */
2192 if (((struct scsi_cmnd *)csio_scsi_cmnd(ioreq)) == cmnd) { 2192 if (((struct scsi_cmnd *)csio_scsi_cmnd(ioreq)) == cmnd) {
2193 csio_err(hw, "LUN reset (%d:%d) timed out\n", 2193 csio_err(hw, "LUN reset (%d:%llu) timed out\n",
2194 cmnd->device->id, cmnd->device->lun); 2194 cmnd->device->id, cmnd->device->lun);
2195 2195
2196 spin_lock_irq(&hw->lock); 2196 spin_lock_irq(&hw->lock);
@@ -2203,7 +2203,7 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
2203 2203
2204 /* LUN reset returned, check cached status */ 2204 /* LUN reset returned, check cached status */
2205 if (cmnd->SCp.Status != FW_SUCCESS) { 2205 if (cmnd->SCp.Status != FW_SUCCESS) {
2206 csio_err(hw, "LUN reset failed (%d:%d), status: %d\n", 2206 csio_err(hw, "LUN reset failed (%d:%llu), status: %d\n",
2207 cmnd->device->id, cmnd->device->lun, cmnd->SCp.Status); 2207 cmnd->device->id, cmnd->device->lun, cmnd->SCp.Status);
2208 goto fail; 2208 goto fail;
2209 } 2209 }
@@ -2223,7 +2223,7 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
2223 /* Aborts may have timed out */ 2223 /* Aborts may have timed out */
2224 if (retval != 0) { 2224 if (retval != 0) {
2225 csio_err(hw, 2225 csio_err(hw,
2226 "Attempt to abort I/Os during LUN reset of %d" 2226 "Attempt to abort I/Os during LUN reset of %llu"
2227 " returned %d\n", cmnd->device->lun, retval); 2227 " returned %d\n", cmnd->device->lun, retval);
2228 /* Return I/Os back to active_q */ 2228 /* Return I/Os back to active_q */
2229 spin_lock_irq(&hw->lock); 2229 spin_lock_irq(&hw->lock);
@@ -2234,7 +2234,7 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
2234 2234
2235 CSIO_INC_STATS(rn, n_lun_rst); 2235 CSIO_INC_STATS(rn, n_lun_rst);
2236 2236
2237 csio_info(hw, "LUN reset occurred (%d:%d)\n", 2237 csio_info(hw, "LUN reset occurred (%d:%llu)\n",
2238 cmnd->device->id, cmnd->device->lun); 2238 cmnd->device->id, cmnd->device->lun);
2239 2239
2240 return SUCCESS; 2240 return SUCCESS;
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c
index ad7bee069d08..dff461f2338e 100644
--- a/drivers/scsi/dc395x.c
+++ b/drivers/scsi/dc395x.c
@@ -1087,7 +1087,7 @@ static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct s
1087 struct AdapterCtlBlk *acb = 1087 struct AdapterCtlBlk *acb =
1088 (struct AdapterCtlBlk *)cmd->device->host->hostdata; 1088 (struct AdapterCtlBlk *)cmd->device->host->hostdata;
1089 dprintkdbg(DBG_0, "queue_command: (0x%p) <%02i-%i> cmnd=0x%02x\n", 1089 dprintkdbg(DBG_0, "queue_command: (0x%p) <%02i-%i> cmnd=0x%02x\n",
1090 cmd, cmd->device->id, cmd->device->lun, cmd->cmnd[0]); 1090 cmd, cmd->device->id, (u8)cmd->device->lun, cmd->cmnd[0]);
1091 1091
1092 /* Assume BAD_TARGET; will be cleared later */ 1092 /* Assume BAD_TARGET; will be cleared later */
1093 cmd->result = DID_BAD_TARGET << 16; 1093 cmd->result = DID_BAD_TARGET << 16;
@@ -1102,7 +1102,7 @@ static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct s
1102 /* does the specified lun on the specified device exist */ 1102 /* does the specified lun on the specified device exist */
1103 if (!(acb->dcb_map[cmd->device->id] & (1 << cmd->device->lun))) { 1103 if (!(acb->dcb_map[cmd->device->id] & (1 << cmd->device->lun))) {
1104 dprintkl(KERN_INFO, "queue_command: Ignore target <%02i-%i>\n", 1104 dprintkl(KERN_INFO, "queue_command: Ignore target <%02i-%i>\n",
1105 cmd->device->id, cmd->device->lun); 1105 cmd->device->id, (u8)cmd->device->lun);
1106 goto complete; 1106 goto complete;
1107 } 1107 }
1108 1108
@@ -1111,7 +1111,7 @@ static int dc395x_queue_command_lck(struct scsi_cmnd *cmd, void (*done)(struct s
1111 if (!dcb) { 1111 if (!dcb) {
1112 /* should never happen */ 1112 /* should never happen */
1113 dprintkl(KERN_ERR, "queue_command: No such device <%02i-%i>", 1113 dprintkl(KERN_ERR, "queue_command: No such device <%02i-%i>",
1114 cmd->device->id, cmd->device->lun); 1114 cmd->device->id, (u8)cmd->device->lun);
1115 goto complete; 1115 goto complete;
1116 } 1116 }
1117 1117
@@ -1207,7 +1207,7 @@ static void dump_register_info(struct AdapterCtlBlk *acb,
1207 "cmnd=0x%02x <%02i-%i>\n", 1207 "cmnd=0x%02x <%02i-%i>\n",
1208 srb, srb->cmd, 1208 srb, srb->cmd,
1209 srb->cmd->cmnd[0], srb->cmd->device->id, 1209 srb->cmd->cmnd[0], srb->cmd->device->id,
1210 srb->cmd->device->lun); 1210 (u8)srb->cmd->device->lun);
1211 printk(" sglist=%p cnt=%i idx=%i len=%zu\n", 1211 printk(" sglist=%p cnt=%i idx=%i len=%zu\n",
1212 srb->segment_x, srb->sg_count, srb->sg_index, 1212 srb->segment_x, srb->sg_count, srb->sg_index,
1213 srb->total_xfer_length); 1213 srb->total_xfer_length);
@@ -1302,7 +1302,7 @@ static int __dc395x_eh_bus_reset(struct scsi_cmnd *cmd)
1302 (struct AdapterCtlBlk *)cmd->device->host->hostdata; 1302 (struct AdapterCtlBlk *)cmd->device->host->hostdata;
1303 dprintkl(KERN_INFO, 1303 dprintkl(KERN_INFO,
1304 "eh_bus_reset: (0%p) target=<%02i-%i> cmd=%p\n", 1304 "eh_bus_reset: (0%p) target=<%02i-%i> cmd=%p\n",
1305 cmd, cmd->device->id, cmd->device->lun, cmd); 1305 cmd, cmd->device->id, (u8)cmd->device->lun, cmd);
1306 1306
1307 if (timer_pending(&acb->waiting_timer)) 1307 if (timer_pending(&acb->waiting_timer))
1308 del_timer(&acb->waiting_timer); 1308 del_timer(&acb->waiting_timer);
@@ -1369,7 +1369,7 @@ static int dc395x_eh_abort(struct scsi_cmnd *cmd)
1369 struct DeviceCtlBlk *dcb; 1369 struct DeviceCtlBlk *dcb;
1370 struct ScsiReqBlk *srb; 1370 struct ScsiReqBlk *srb;
1371 dprintkl(KERN_INFO, "eh_abort: (0x%p) target=<%02i-%i> cmd=%p\n", 1371 dprintkl(KERN_INFO, "eh_abort: (0x%p) target=<%02i-%i> cmd=%p\n",
1372 cmd, cmd->device->id, cmd->device->lun, cmd); 1372 cmd, cmd->device->id, (u8)cmd->device->lun, cmd);
1373 1373
1374 dcb = find_dcb(acb, cmd->device->id, cmd->device->lun); 1374 dcb = find_dcb(acb, cmd->device->id, cmd->device->lun);
1375 if (!dcb) { 1375 if (!dcb) {
@@ -1605,7 +1605,7 @@ static u8 start_scsi(struct AdapterCtlBlk* acb, struct DeviceCtlBlk* dcb,
1605 dprintkl(KERN_WARNING, "start_scsi: (0x%p) " 1605 dprintkl(KERN_WARNING, "start_scsi: (0x%p) "
1606 "Out of tags target=<%02i-%i>)\n", 1606 "Out of tags target=<%02i-%i>)\n",
1607 srb->cmd, srb->cmd->device->id, 1607 srb->cmd, srb->cmd->device->id,
1608 srb->cmd->device->lun); 1608 (u8)srb->cmd->device->lun);
1609 srb->state = SRB_READY; 1609 srb->state = SRB_READY;
1610 DC395x_write16(acb, TRM_S1040_SCSI_CONTROL, 1610 DC395x_write16(acb, TRM_S1040_SCSI_CONTROL,
1611 DO_HWRESELECT); 1611 DO_HWRESELECT);
@@ -1623,7 +1623,7 @@ static u8 start_scsi(struct AdapterCtlBlk* acb, struct DeviceCtlBlk* dcb,
1623/*polling:*/ 1623/*polling:*/
1624 /* Send CDB ..command block ......... */ 1624 /* Send CDB ..command block ......... */
1625 dprintkdbg(DBG_KG, "start_scsi: (0x%p) <%02i-%i> cmnd=0x%02x tag=%i\n", 1625 dprintkdbg(DBG_KG, "start_scsi: (0x%p) <%02i-%i> cmnd=0x%02x tag=%i\n",
1626 srb->cmd, srb->cmd->device->id, srb->cmd->device->lun, 1626 srb->cmd, srb->cmd->device->id, (u8)srb->cmd->device->lun,
1627 srb->cmd->cmnd[0], srb->tag_number); 1627 srb->cmd->cmnd[0], srb->tag_number);
1628 if (srb->flag & AUTO_REQSENSE) { 1628 if (srb->flag & AUTO_REQSENSE) {
1629 DC395x_write8(acb, TRM_S1040_SCSI_FIFO, REQUEST_SENSE); 1629 DC395x_write8(acb, TRM_S1040_SCSI_FIFO, REQUEST_SENSE);
@@ -2041,7 +2041,7 @@ static void data_out_phase0(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb,
2041 u16 scsi_status = *pscsi_status; 2041 u16 scsi_status = *pscsi_status;
2042 u32 d_left_counter = 0; 2042 u32 d_left_counter = 0;
2043 dprintkdbg(DBG_0, "data_out_phase0: (0x%p) <%02i-%i>\n", 2043 dprintkdbg(DBG_0, "data_out_phase0: (0x%p) <%02i-%i>\n",
2044 srb->cmd, srb->cmd->device->id, srb->cmd->device->lun); 2044 srb->cmd, srb->cmd->device->id, (u8)srb->cmd->device->lun);
2045 2045
2046 /* 2046 /*
2047 * KG: We need to drain the buffers before we draw any conclusions! 2047 * KG: We need to drain the buffers before we draw any conclusions!
@@ -2171,7 +2171,7 @@ static void data_out_phase1(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb,
2171 u16 *pscsi_status) 2171 u16 *pscsi_status)
2172{ 2172{
2173 dprintkdbg(DBG_0, "data_out_phase1: (0x%p) <%02i-%i>\n", 2173 dprintkdbg(DBG_0, "data_out_phase1: (0x%p) <%02i-%i>\n",
2174 srb->cmd, srb->cmd->device->id, srb->cmd->device->lun); 2174 srb->cmd, srb->cmd->device->id, (u8)srb->cmd->device->lun);
2175 clear_fifo(acb, "data_out_phase1"); 2175 clear_fifo(acb, "data_out_phase1");
2176 /* do prepare before transfer when data out phase */ 2176 /* do prepare before transfer when data out phase */
2177 data_io_transfer(acb, srb, XFERDATAOUT); 2177 data_io_transfer(acb, srb, XFERDATAOUT);
@@ -2183,7 +2183,7 @@ static void data_in_phase0(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb,
2183 u16 scsi_status = *pscsi_status; 2183 u16 scsi_status = *pscsi_status;
2184 2184
2185 dprintkdbg(DBG_0, "data_in_phase0: (0x%p) <%02i-%i>\n", 2185 dprintkdbg(DBG_0, "data_in_phase0: (0x%p) <%02i-%i>\n",
2186 srb->cmd, srb->cmd->device->id, srb->cmd->device->lun); 2186 srb->cmd, srb->cmd->device->id, (u8)srb->cmd->device->lun);
2187 2187
2188 /* 2188 /*
2189 * KG: DataIn is much more tricky than DataOut. When the device is finished 2189 * KG: DataIn is much more tricky than DataOut. When the device is finished
@@ -2394,7 +2394,7 @@ static void data_in_phase1(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb,
2394 u16 *pscsi_status) 2394 u16 *pscsi_status)
2395{ 2395{
2396 dprintkdbg(DBG_0, "data_in_phase1: (0x%p) <%02i-%i>\n", 2396 dprintkdbg(DBG_0, "data_in_phase1: (0x%p) <%02i-%i>\n",
2397 srb->cmd, srb->cmd->device->id, srb->cmd->device->lun); 2397 srb->cmd, srb->cmd->device->id, (u8)srb->cmd->device->lun);
2398 data_io_transfer(acb, srb, XFERDATAIN); 2398 data_io_transfer(acb, srb, XFERDATAIN);
2399} 2399}
2400 2400
@@ -2406,7 +2406,7 @@ static void data_io_transfer(struct AdapterCtlBlk *acb,
2406 u8 bval; 2406 u8 bval;
2407 dprintkdbg(DBG_0, 2407 dprintkdbg(DBG_0,
2408 "data_io_transfer: (0x%p) <%02i-%i> %c len=%i, sg=(%i/%i)\n", 2408 "data_io_transfer: (0x%p) <%02i-%i> %c len=%i, sg=(%i/%i)\n",
2409 srb->cmd, srb->cmd->device->id, srb->cmd->device->lun, 2409 srb->cmd, srb->cmd->device->id, (u8)srb->cmd->device->lun,
2410 ((io_dir & DMACMD_DIR) ? 'r' : 'w'), 2410 ((io_dir & DMACMD_DIR) ? 'r' : 'w'),
2411 srb->total_xfer_length, srb->sg_index, srb->sg_count); 2411 srb->total_xfer_length, srb->sg_index, srb->sg_count);
2412 if (srb == acb->tmp_srb) 2412 if (srb == acb->tmp_srb)
@@ -2579,7 +2579,7 @@ static void status_phase0(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb,
2579 u16 *pscsi_status) 2579 u16 *pscsi_status)
2580{ 2580{
2581 dprintkdbg(DBG_0, "status_phase0: (0x%p) <%02i-%i>\n", 2581 dprintkdbg(DBG_0, "status_phase0: (0x%p) <%02i-%i>\n",
2582 srb->cmd, srb->cmd->device->id, srb->cmd->device->lun); 2582 srb->cmd, srb->cmd->device->id, (u8)srb->cmd->device->lun);
2583 srb->target_status = DC395x_read8(acb, TRM_S1040_SCSI_FIFO); 2583 srb->target_status = DC395x_read8(acb, TRM_S1040_SCSI_FIFO);
2584 srb->end_message = DC395x_read8(acb, TRM_S1040_SCSI_FIFO); /* get message */ 2584 srb->end_message = DC395x_read8(acb, TRM_S1040_SCSI_FIFO); /* get message */
2585 srb->state = SRB_COMPLETED; 2585 srb->state = SRB_COMPLETED;
@@ -2593,7 +2593,7 @@ static void status_phase1(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb,
2593 u16 *pscsi_status) 2593 u16 *pscsi_status)
2594{ 2594{
2595 dprintkdbg(DBG_0, "status_phase1: (0x%p) <%02i-%i>\n", 2595 dprintkdbg(DBG_0, "status_phase1: (0x%p) <%02i-%i>\n",
2596 srb->cmd, srb->cmd->device->id, srb->cmd->device->lun); 2596 srb->cmd, srb->cmd->device->id, (u8)srb->cmd->device->lun);
2597 srb->state = SRB_STATUS; 2597 srb->state = SRB_STATUS;
2598 DC395x_write16(acb, TRM_S1040_SCSI_CONTROL, DO_DATALATCH); /* it's important for atn stop */ 2598 DC395x_write16(acb, TRM_S1040_SCSI_CONTROL, DO_DATALATCH); /* it's important for atn stop */
2599 DC395x_write8(acb, TRM_S1040_SCSI_COMMAND, SCMD_COMP); 2599 DC395x_write8(acb, TRM_S1040_SCSI_COMMAND, SCMD_COMP);
@@ -3318,7 +3318,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
3318 int ckc_only = 1; 3318 int ckc_only = 1;
3319 3319
3320 dprintkdbg(DBG_1, "srb_done: (0x%p) <%02i-%i>\n", srb->cmd, 3320 dprintkdbg(DBG_1, "srb_done: (0x%p) <%02i-%i>\n", srb->cmd,
3321 srb->cmd->device->id, srb->cmd->device->lun); 3321 srb->cmd->device->id, (u8)srb->cmd->device->lun);
3322 dprintkdbg(DBG_SG, "srb_done: srb=%p sg=%i(%i/%i) buf=%p\n", 3322 dprintkdbg(DBG_SG, "srb_done: srb=%p sg=%i(%i/%i) buf=%p\n",
3323 srb, scsi_sg_count(cmd), srb->sg_index, srb->sg_count, 3323 srb, scsi_sg_count(cmd), srb->sg_index, srb->sg_count,
3324 scsi_sgtalbe(cmd)); 3324 scsi_sgtalbe(cmd));
@@ -3498,7 +3498,7 @@ static void srb_done(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
3498 if (srb->total_xfer_length) 3498 if (srb->total_xfer_length)
3499 dprintkdbg(DBG_KG, "srb_done: (0x%p) <%02i-%i> " 3499 dprintkdbg(DBG_KG, "srb_done: (0x%p) <%02i-%i> "
3500 "cmnd=0x%02x Missed %i bytes\n", 3500 "cmnd=0x%02x Missed %i bytes\n",
3501 cmd, cmd->device->id, cmd->device->lun, 3501 cmd, cmd->device->id, (u8)cmd->device->lun,
3502 cmd->cmnd[0], srb->total_xfer_length); 3502 cmd->cmnd[0], srb->total_xfer_length);
3503 } 3503 }
3504 3504
@@ -3538,7 +3538,7 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag,
3538 dir = p->sc_data_direction; 3538 dir = p->sc_data_direction;
3539 result = MK_RES(0, did_flag, 0, 0); 3539 result = MK_RES(0, did_flag, 0, 0);
3540 printk("G:%p(%02i-%i) ", p, 3540 printk("G:%p(%02i-%i) ", p,
3541 p->device->id, p->device->lun); 3541 p->device->id, (u8)p->device->lun);
3542 srb_going_remove(dcb, srb); 3542 srb_going_remove(dcb, srb);
3543 free_tag(dcb, srb); 3543 free_tag(dcb, srb);
3544 srb_free_insert(acb, srb); 3544 srb_free_insert(acb, srb);
@@ -3568,7 +3568,7 @@ static void doing_srb_done(struct AdapterCtlBlk *acb, u8 did_flag,
3568 3568
3569 result = MK_RES(0, did_flag, 0, 0); 3569 result = MK_RES(0, did_flag, 0, 0);
3570 printk("W:%p<%02i-%i>", p, p->device->id, 3570 printk("W:%p<%02i-%i>", p, p->device->id,
3571 p->device->lun); 3571 (u8)p->device->lun);
3572 srb_waiting_remove(dcb, srb); 3572 srb_waiting_remove(dcb, srb);
3573 srb_free_insert(acb, srb); 3573 srb_free_insert(acb, srb);
3574 p->result = result; 3574 p->result = result;
@@ -3677,7 +3677,7 @@ static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
3677{ 3677{
3678 struct scsi_cmnd *cmd = srb->cmd; 3678 struct scsi_cmnd *cmd = srb->cmd;
3679 dprintkdbg(DBG_1, "request_sense: (0x%p) <%02i-%i>\n", 3679 dprintkdbg(DBG_1, "request_sense: (0x%p) <%02i-%i>\n",
3680 cmd, cmd->device->id, cmd->device->lun); 3680 cmd, cmd->device->id, (u8)cmd->device->lun);
3681 3681
3682 srb->flag |= AUTO_REQSENSE; 3682 srb->flag |= AUTO_REQSENSE;
3683 srb->adapter_status = 0; 3683 srb->adapter_status = 0;
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index c0ae8fa57a3b..67283ef418ac 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -459,7 +459,7 @@ static int adpt_queue_lck(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd
459 * to the device structure. This should be a TEST_UNIT_READY 459 * to the device structure. This should be a TEST_UNIT_READY
460 * command from scan_scsis_single. 460 * command from scan_scsis_single.
461 */ 461 */
462 if ((pDev = adpt_find_device(pHba, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun)) == NULL) { 462 if ((pDev = adpt_find_device(pHba, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun)) == NULL) {
463 // TODO: if any luns are at this bus, scsi id then fake a TEST_UNIT_READY and INQUIRY response 463 // TODO: if any luns are at this bus, scsi id then fake a TEST_UNIT_READY and INQUIRY response
464 // with type 7F (for all luns less than the max for this bus,id) so the lun scan will continue. 464 // with type 7F (for all luns less than the max for this bus,id) so the lun scan will continue.
465 cmd->result = (DID_NO_CONNECT << 16); 465 cmd->result = (DID_NO_CONNECT << 16);
@@ -579,8 +579,8 @@ static int adpt_show_info(struct seq_file *m, struct Scsi_Host *host)
579 seq_printf(m," Rev: %-8.8s\n", d->pScsi_dev->rev); 579 seq_printf(m," Rev: %-8.8s\n", d->pScsi_dev->rev);
580 580
581 unit = d->pI2o_dev->lct_data.tid; 581 unit = d->pI2o_dev->lct_data.tid;
582 seq_printf(m, "\tTID=%d, (Channel=%d, Target=%d, Lun=%d) (%s)\n\n", 582 seq_printf(m, "\tTID=%d, (Channel=%d, Target=%d, Lun=%llu) (%s)\n\n",
583 unit, (int)d->scsi_channel, (int)d->scsi_id, (int)d->scsi_lun, 583 unit, (int)d->scsi_channel, (int)d->scsi_id, d->scsi_lun,
584 scsi_device_online(d->pScsi_dev)? "online":"offline"); 584 scsi_device_online(d->pScsi_dev)? "online":"offline");
585 d = d->next_lun; 585 d = d->next_lun;
586 } 586 }
@@ -1162,7 +1162,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
1162 } 1162 }
1163} 1163}
1164 1164
1165static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun) 1165static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u64 lun)
1166{ 1166{
1167 struct adpt_device* d; 1167 struct adpt_device* d;
1168 1168
@@ -1462,7 +1462,7 @@ static int adpt_i2o_parse_lct(adpt_hba* pHba)
1462 i2o_lct *lct = pHba->lct; 1462 i2o_lct *lct = pHba->lct;
1463 u8 bus_no = 0; 1463 u8 bus_no = 0;
1464 s16 scsi_id; 1464 s16 scsi_id;
1465 s16 scsi_lun; 1465 u64 scsi_lun;
1466 u32 buf[10]; // larger than 7, or 8 ... 1466 u32 buf[10]; // larger than 7, or 8 ...
1467 struct adpt_device* pDev; 1467 struct adpt_device* pDev;
1468 1468
@@ -1496,7 +1496,7 @@ static int adpt_i2o_parse_lct(adpt_hba* pHba)
1496 } 1496 }
1497 bus_no = buf[0]>>16; 1497 bus_no = buf[0]>>16;
1498 scsi_id = buf[1]; 1498 scsi_id = buf[1];
1499 scsi_lun = (buf[2]>>8 )&0xff; 1499 scsi_lun = scsilun_to_int((struct scsi_lun *)&buf[2]);
1500 if(bus_no >= MAX_CHANNEL) { // Something wrong skip it 1500 if(bus_no >= MAX_CHANNEL) { // Something wrong skip it
1501 printk(KERN_WARNING"%s: Channel number %d out of range \n", pHba->name, bus_no); 1501 printk(KERN_WARNING"%s: Channel number %d out of range \n", pHba->name, bus_no);
1502 continue; 1502 continue;
@@ -1571,7 +1571,7 @@ static int adpt_i2o_parse_lct(adpt_hba* pHba)
1571 if(adpt_i2o_query_scalar(pHba, tid, 0x8000, -1, buf, 32)>=0) { 1571 if(adpt_i2o_query_scalar(pHba, tid, 0x8000, -1, buf, 32)>=0) {
1572 bus_no = buf[0]>>16; 1572 bus_no = buf[0]>>16;
1573 scsi_id = buf[1]; 1573 scsi_id = buf[1];
1574 scsi_lun = (buf[2]>>8 )&0xff; 1574 scsi_lun = scsilun_to_int((struct scsi_lun *)&buf[2]);
1575 if(bus_no >= MAX_CHANNEL) { // Something wrong skip it 1575 if(bus_no >= MAX_CHANNEL) { // Something wrong skip it
1576 continue; 1576 continue;
1577 } 1577 }
@@ -2407,8 +2407,8 @@ static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
2407 case I2O_SCSI_DSC_COMMAND_TIMEOUT: 2407 case I2O_SCSI_DSC_COMMAND_TIMEOUT:
2408 case I2O_SCSI_DSC_NO_ADAPTER: 2408 case I2O_SCSI_DSC_NO_ADAPTER:
2409 case I2O_SCSI_DSC_RESOURCE_UNAVAILABLE: 2409 case I2O_SCSI_DSC_RESOURCE_UNAVAILABLE:
2410 printk(KERN_WARNING"%s: SCSI Timeout-Device (%d,%d,%d) hba status=0x%x, dev status=0x%x, cmd=0x%x\n", 2410 printk(KERN_WARNING"%s: SCSI Timeout-Device (%d,%d,%llu) hba status=0x%x, dev status=0x%x, cmd=0x%x\n",
2411 pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun, hba_status, dev_status, cmd->cmnd[0]); 2411 pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun, hba_status, dev_status, cmd->cmnd[0]);
2412 cmd->result = (DID_TIME_OUT << 16); 2412 cmd->result = (DID_TIME_OUT << 16);
2413 break; 2413 break;
2414 case I2O_SCSI_DSC_ADAPTER_BUSY: 2414 case I2O_SCSI_DSC_ADAPTER_BUSY:
@@ -2447,8 +2447,8 @@ static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
2447 case I2O_SCSI_DSC_QUEUE_FROZEN: 2447 case I2O_SCSI_DSC_QUEUE_FROZEN:
2448 case I2O_SCSI_DSC_REQUEST_INVALID: 2448 case I2O_SCSI_DSC_REQUEST_INVALID:
2449 default: 2449 default:
2450 printk(KERN_WARNING"%s: SCSI error %0x-Device(%d,%d,%d) hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n", 2450 printk(KERN_WARNING"%s: SCSI error %0x-Device(%d,%d,%llu) hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n",
2451 pHba->name, detailed_status & I2O_SCSI_DSC_MASK, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun, 2451 pHba->name, detailed_status & I2O_SCSI_DSC_MASK, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun,
2452 hba_status, dev_status, cmd->cmnd[0]); 2452 hba_status, dev_status, cmd->cmnd[0]);
2453 cmd->result = (DID_ERROR << 16); 2453 cmd->result = (DID_ERROR << 16);
2454 break; 2454 break;
@@ -2464,8 +2464,8 @@ static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
2464 cmd->sense_buffer[2] == DATA_PROTECT ){ 2464 cmd->sense_buffer[2] == DATA_PROTECT ){
2465 /* This is to handle an array failed */ 2465 /* This is to handle an array failed */
2466 cmd->result = (DID_TIME_OUT << 16); 2466 cmd->result = (DID_TIME_OUT << 16);
2467 printk(KERN_WARNING"%s: SCSI Data Protect-Device (%d,%d,%d) hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n", 2467 printk(KERN_WARNING"%s: SCSI Data Protect-Device (%d,%d,%llu) hba_status=0x%x, dev_status=0x%x, cmd=0x%x\n",
2468 pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun, 2468 pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun,
2469 hba_status, dev_status, cmd->cmnd[0]); 2469 hba_status, dev_status, cmd->cmnd[0]);
2470 2470
2471 } 2471 }
@@ -2476,8 +2476,8 @@ static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
2476 * for a limitted number of retries. 2476 * for a limitted number of retries.
2477 */ 2477 */
2478 cmd->result = (DID_TIME_OUT << 16); 2478 cmd->result = (DID_TIME_OUT << 16);
2479 printk(KERN_WARNING"%s: I2O MSG_FAIL - Device (%d,%d,%d) tid=%d, cmd=0x%x\n", 2479 printk(KERN_WARNING"%s: I2O MSG_FAIL - Device (%d,%d,%llu) tid=%d, cmd=0x%x\n",
2480 pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, (u32)cmd->device->lun, 2480 pHba->name, (u32)cmd->device->channel, (u32)cmd->device->id, cmd->device->lun,
2481 ((struct adpt_device*)(cmd->device->hostdata))->tid, cmd->cmnd[0]); 2481 ((struct adpt_device*)(cmd->device->hostdata))->tid, cmd->cmnd[0]);
2482 } 2482 }
2483 2483
@@ -2517,7 +2517,7 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
2517 i2o_lct *lct = pHba->lct; 2517 i2o_lct *lct = pHba->lct;
2518 u8 bus_no = 0; 2518 u8 bus_no = 0;
2519 s16 scsi_id; 2519 s16 scsi_id;
2520 s16 scsi_lun; 2520 u64 scsi_lun;
2521 u32 buf[10]; // at least 8 u32's 2521 u32 buf[10]; // at least 8 u32's
2522 struct adpt_device* pDev = NULL; 2522 struct adpt_device* pDev = NULL;
2523 struct i2o_device* pI2o_dev = NULL; 2523 struct i2o_device* pI2o_dev = NULL;
@@ -2564,7 +2564,7 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
2564 } 2564 }
2565 2565
2566 scsi_id = buf[1]; 2566 scsi_id = buf[1];
2567 scsi_lun = (buf[2]>>8 )&0xff; 2567 scsi_lun = scsilun_to_int((struct scsi_lun *)&buf[2]);
2568 pDev = pHba->channel[bus_no].device[scsi_id]; 2568 pDev = pHba->channel[bus_no].device[scsi_id];
2569 /* da lun */ 2569 /* da lun */
2570 while(pDev) { 2570 while(pDev) {
@@ -2633,7 +2633,7 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
2633 while(pDev) { 2633 while(pDev) {
2634 if(pDev->scsi_lun == scsi_lun) { 2634 if(pDev->scsi_lun == scsi_lun) {
2635 if(!scsi_device_online(pDev->pScsi_dev)) { 2635 if(!scsi_device_online(pDev->pScsi_dev)) {
2636 printk(KERN_WARNING"%s: Setting device (%d,%d,%d) back online\n", 2636 printk(KERN_WARNING"%s: Setting device (%d,%d,%llu) back online\n",
2637 pHba->name,bus_no,scsi_id,scsi_lun); 2637 pHba->name,bus_no,scsi_id,scsi_lun);
2638 if (pDev->pScsi_dev) { 2638 if (pDev->pScsi_dev) {
2639 scsi_device_set_state(pDev->pScsi_dev, SDEV_RUNNING); 2639 scsi_device_set_state(pDev->pScsi_dev, SDEV_RUNNING);
@@ -2665,7 +2665,7 @@ static s32 adpt_i2o_reparse_lct(adpt_hba* pHba)
2665 // in the LCT table 2665 // in the LCT table
2666 if (pDev->state & DPTI_DEV_UNSCANNED){ 2666 if (pDev->state & DPTI_DEV_UNSCANNED){
2667 pDev->state = DPTI_DEV_OFFLINE; 2667 pDev->state = DPTI_DEV_OFFLINE;
2668 printk(KERN_WARNING"%s: Device (%d,%d,%d) offline\n",pHba->name,pDev->scsi_channel,pDev->scsi_id,pDev->scsi_lun); 2668 printk(KERN_WARNING"%s: Device (%d,%d,%llu) offline\n",pHba->name,pDev->scsi_channel,pDev->scsi_id,pDev->scsi_lun);
2669 if (pDev->pScsi_dev) { 2669 if (pDev->pScsi_dev) {
2670 scsi_device_set_state(pDev->pScsi_dev, SDEV_OFFLINE); 2670 scsi_device_set_state(pDev->pScsi_dev, SDEV_OFFLINE);
2671 } 2671 }
diff --git a/drivers/scsi/dpti.h b/drivers/scsi/dpti.h
index aeb046186c84..1fa345ab8ecb 100644
--- a/drivers/scsi/dpti.h
+++ b/drivers/scsi/dpti.h
@@ -184,7 +184,7 @@ struct adpt_device {
184 u32 block_size; 184 u32 block_size;
185 u8 scsi_channel; 185 u8 scsi_channel;
186 u8 scsi_id; 186 u8 scsi_id;
187 u8 scsi_lun; 187 u64 scsi_lun;
188 u8 state; 188 u8 state;
189 u16 tid; 189 u16 tid;
190 struct i2o_device* pI2o_dev; 190 struct i2o_device* pI2o_dev;
@@ -231,7 +231,7 @@ typedef struct _adpt_hba {
231 u32 sg_tablesize; // Scatter/Gather List Size. 231 u32 sg_tablesize; // Scatter/Gather List Size.
232 u8 top_scsi_channel; 232 u8 top_scsi_channel;
233 u8 top_scsi_id; 233 u8 top_scsi_id;
234 u8 top_scsi_lun; 234 u64 top_scsi_lun;
235 u8 dma64; 235 u8 dma64;
236 236
237 i2o_status_block* status_block; 237 i2o_status_block* status_block;
@@ -300,7 +300,7 @@ static s32 adpt_send_nop(adpt_hba*pHba,u32 m);
300static void adpt_i2o_delete_hba(adpt_hba* pHba); 300static void adpt_i2o_delete_hba(adpt_hba* pHba);
301static void adpt_inquiry(adpt_hba* pHba); 301static void adpt_inquiry(adpt_hba* pHba);
302static void adpt_fail_posted_scbs(adpt_hba* pHba); 302static void adpt_fail_posted_scbs(adpt_hba* pHba);
303static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun); 303static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u64 lun);
304static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) ; 304static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) ;
305static int adpt_i2o_online_hba(adpt_hba* pHba); 305static int adpt_i2o_online_hba(adpt_hba* pHba);
306static void adpt_i2o_post_wait_complete(u32, int); 306static void adpt_i2o_post_wait_complete(u32, int);
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index ebf57364df91..0f27ac19cf01 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -2449,7 +2449,7 @@ static irqreturn_t ihdlr(struct Scsi_Host *shost)
2449 "target_status 0x%x, sense key 0x%x.\n", 2449 "target_status 0x%x, sense key 0x%x.\n",
2450 ha->board_name, 2450 ha->board_name,
2451 SCpnt->device->channel, SCpnt->device->id, 2451 SCpnt->device->channel, SCpnt->device->id,
2452 SCpnt->device->lun, 2452 (u8)SCpnt->device->lun,
2453 spp->target_status, SCpnt->sense_buffer[2]); 2453 spp->target_status, SCpnt->sense_buffer[2]);
2454 2454
2455 ha->target_to[SCpnt->device->id][SCpnt->device->channel] = 0; 2455 ha->target_to[SCpnt->device->id][SCpnt->device->channel] = 0;
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index ea28b5ca4c73..3f88f56582a2 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -1753,7 +1753,7 @@ int fnic_abort_cmd(struct scsi_cmnd *sc)
1753 tag = sc->request->tag; 1753 tag = sc->request->tag;
1754 FNIC_SCSI_DBG(KERN_DEBUG, 1754 FNIC_SCSI_DBG(KERN_DEBUG,
1755 fnic->lport->host, 1755 fnic->lport->host,
1756 "Abort Cmd called FCID 0x%x, LUN 0x%x TAG %x flags %x\n", 1756 "Abort Cmd called FCID 0x%x, LUN 0x%llx TAG %x flags %x\n",
1757 rport->port_id, sc->device->lun, tag, CMD_FLAGS(sc)); 1757 rport->port_id, sc->device->lun, tag, CMD_FLAGS(sc));
1758 1758
1759 CMD_FLAGS(sc) = FNIC_NO_FLAGS; 1759 CMD_FLAGS(sc) = FNIC_NO_FLAGS;
@@ -2207,7 +2207,7 @@ int fnic_device_reset(struct scsi_cmnd *sc)
2207 2207
2208 rport = starget_to_rport(scsi_target(sc->device)); 2208 rport = starget_to_rport(scsi_target(sc->device));
2209 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host, 2209 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
2210 "Device reset called FCID 0x%x, LUN 0x%x sc 0x%p\n", 2210 "Device reset called FCID 0x%x, LUN 0x%llx sc 0x%p\n",
2211 rport->port_id, sc->device->lun, sc); 2211 rport->port_id, sc->device->lun, sc);
2212 2212
2213 if (lp->state != LPORT_ST_READY || !(lp->link_up)) 2213 if (lp->state != LPORT_ST_READY || !(lp->link_up))
diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index a1bc8ca958e1..b331272e93bc 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -768,7 +768,7 @@ static void sprint_command(struct seq_file *m, unsigned char *command)
768 768
769static void sprint_Scsi_Cmnd(struct seq_file *m, Scsi_Cmnd * cmd) 769static void sprint_Scsi_Cmnd(struct seq_file *m, Scsi_Cmnd * cmd)
770{ 770{
771 PRINTP("host number %d destination target %d, lun %d\n" ANDP cmd->device->host->host_no ANDP cmd->device->id ANDP cmd->device->lun); 771 PRINTP("host number %d destination target %d, lun %llu\n" ANDP cmd->device->host->host_no ANDP cmd->device->id ANDP cmd->device->lun);
772 PRINTP(" command = "); 772 PRINTP(" command = ");
773 sprint_command(m, cmd->cmnd); 773 sprint_command(m, cmd->cmnd);
774} 774}
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 31184b35370f..a59e1e022e37 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -4590,7 +4590,7 @@ static int hpsa_eh_abort_handler(struct scsi_cmnd *sc)
4590 return FAILED; 4590 return FAILED;
4591 4591
4592 memset(msg, 0, sizeof(msg)); 4592 memset(msg, 0, sizeof(msg));
4593 ml += sprintf(msg+ml, "ABORT REQUEST on C%d:B%d:T%d:L%d ", 4593 ml += sprintf(msg+ml, "ABORT REQUEST on C%d:B%d:T%d:L%llu ",
4594 h->scsi_host->host_no, sc->device->channel, 4594 h->scsi_host->host_no, sc->device->channel,
4595 sc->device->id, sc->device->lun); 4595 sc->device->id, sc->device->lun);
4596 4596
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c
index ee196b363d81..dedb62c21b29 100644
--- a/drivers/scsi/hptiop.c
+++ b/drivers/scsi/hptiop.c
@@ -1024,7 +1024,7 @@ static int hptiop_queuecommand_lck(struct scsi_cmnd *scp,
1024 1024
1025 _req->scp = scp; 1025 _req->scp = scp;
1026 1026
1027 dprintk("hptiop_queuecmd(scp=%p) %d/%d/%d/%d cdb=(%08x-%08x-%08x-%08x) " 1027 dprintk("hptiop_queuecmd(scp=%p) %d/%d/%d/%llu cdb=(%08x-%08x-%08x-%08x) "
1028 "req_index=%d, req=%p\n", 1028 "req_index=%d, req=%p\n",
1029 scp, 1029 scp,
1030 host->host_no, scp->device->channel, 1030 host->host_no, scp->device->channel,
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c
index b1c4d831137d..ddf0694d87f0 100644
--- a/drivers/scsi/in2000.c
+++ b/drivers/scsi/in2000.c
@@ -2251,14 +2251,14 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
2251 seq_printf(m, "\nconnected: "); 2251 seq_printf(m, "\nconnected: ");
2252 if (hd->connected) { 2252 if (hd->connected) {
2253 cmd = (Scsi_Cmnd *) hd->connected; 2253 cmd = (Scsi_Cmnd *) hd->connected;
2254 seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); 2254 seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
2255 } 2255 }
2256 } 2256 }
2257 if (hd->proc & PR_INPUTQ) { 2257 if (hd->proc & PR_INPUTQ) {
2258 seq_printf(m, "\ninput_Q: "); 2258 seq_printf(m, "\ninput_Q: ");
2259 cmd = (Scsi_Cmnd *) hd->input_Q; 2259 cmd = (Scsi_Cmnd *) hd->input_Q;
2260 while (cmd) { 2260 while (cmd) {
2261 seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); 2261 seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
2262 cmd = (Scsi_Cmnd *) cmd->host_scribble; 2262 cmd = (Scsi_Cmnd *) cmd->host_scribble;
2263 } 2263 }
2264 } 2264 }
@@ -2266,7 +2266,7 @@ static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
2266 seq_printf(m, "\ndisconnected_Q:"); 2266 seq_printf(m, "\ndisconnected_Q:");
2267 cmd = (Scsi_Cmnd *) hd->disconnected_Q; 2267 cmd = (Scsi_Cmnd *) hd->disconnected_Q;
2268 while (cmd) { 2268 while (cmd) {
2269 seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); 2269 seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
2270 cmd = (Scsi_Cmnd *) cmd->host_scribble; 2270 cmd = (Scsi_Cmnd *) cmd->host_scribble;
2271 } 2271 }
2272 } 2272 }
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 3d1bc67bac9d..f2db82beb646 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -260,7 +260,7 @@ static int iscsi_check_tmf_restrictions(struct iscsi_task *task, int opcode)
260{ 260{
261 struct iscsi_conn *conn = task->conn; 261 struct iscsi_conn *conn = task->conn;
262 struct iscsi_tm *tmf = &conn->tmhdr; 262 struct iscsi_tm *tmf = &conn->tmhdr;
263 unsigned int hdr_lun; 263 u64 hdr_lun;
264 264
265 if (conn->tmf_state == TMF_INITIAL) 265 if (conn->tmf_state == TMF_INITIAL)
266 return 0; 266 return 0;
@@ -1859,8 +1859,7 @@ static int iscsi_exec_task_mgmt_fn(struct iscsi_conn *conn,
1859 * Fail commands. session lock held and recv side suspended and xmit 1859 * Fail commands. session lock held and recv side suspended and xmit
1860 * thread flushed 1860 * thread flushed
1861 */ 1861 */
1862static void fail_scsi_tasks(struct iscsi_conn *conn, unsigned lun, 1862static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error)
1863 int error)
1864{ 1863{
1865 struct iscsi_task *task; 1864 struct iscsi_task *task;
1866 int i; 1865 int i;
@@ -2279,7 +2278,8 @@ int iscsi_eh_device_reset(struct scsi_cmnd *sc)
2279 cls_session = starget_to_session(scsi_target(sc->device)); 2278 cls_session = starget_to_session(scsi_target(sc->device));
2280 session = cls_session->dd_data; 2279 session = cls_session->dd_data;
2281 2280
2282 ISCSI_DBG_EH(session, "LU Reset [sc %p lun %u]\n", sc, sc->device->lun); 2281 ISCSI_DBG_EH(session, "LU Reset [sc %p lun %llu]\n", sc,
2282 sc->device->lun);
2283 2283
2284 mutex_lock(&session->eh_mutex); 2284 mutex_lock(&session->eh_mutex);
2285 spin_lock_bh(&session->frwd_lock); 2285 spin_lock_bh(&session->frwd_lock);
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 25d0f127424d..7d02a19419a7 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -404,7 +404,7 @@ static int sas_recover_lu(struct domain_device *dev, struct scsi_cmnd *cmd)
404 404
405 int_to_scsilun(cmd->device->lun, &lun); 405 int_to_scsilun(cmd->device->lun, &lun);
406 406
407 SAS_DPRINTK("eh: device %llx LUN %x has the task\n", 407 SAS_DPRINTK("eh: device %llx LUN %llx has the task\n",
408 SAS_ADDR(dev->sas_addr), 408 SAS_ADDR(dev->sas_addr),
409 cmd->device->lun); 409 cmd->device->lun);
410 410
@@ -490,7 +490,8 @@ static void sas_wait_eh(struct domain_device *dev)
490} 490}
491EXPORT_SYMBOL(sas_wait_eh); 491EXPORT_SYMBOL(sas_wait_eh);
492 492
493static int sas_queue_reset(struct domain_device *dev, int reset_type, int lun, int wait) 493static int sas_queue_reset(struct domain_device *dev, int reset_type,
494 u64 lun, int wait)
494{ 495{
495 struct sas_ha_struct *ha = dev->port->ha; 496 struct sas_ha_struct *ha = dev->port->ha;
496 int scheduled = 0, tries = 100; 497 int scheduled = 0, tries = 100;
@@ -689,7 +690,7 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *
689 reset: 690 reset:
690 tmf_resp = sas_recover_lu(task->dev, cmd); 691 tmf_resp = sas_recover_lu(task->dev, cmd);
691 if (tmf_resp == TMF_RESP_FUNC_COMPLETE) { 692 if (tmf_resp == TMF_RESP_FUNC_COMPLETE) {
692 SAS_DPRINTK("dev %016llx LU %x is " 693 SAS_DPRINTK("dev %016llx LU %llx is "
693 "recovered\n", 694 "recovered\n",
694 SAS_ADDR(task->dev), 695 SAS_ADDR(task->dev),
695 cmd->device->lun); 696 cmd->device->lun);
@@ -742,7 +743,7 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *
742 * of effort could recover from errors. Quite 743 * of effort could recover from errors. Quite
743 * possibly the HA just disappeared. 744 * possibly the HA just disappeared.
744 */ 745 */
745 SAS_DPRINTK("error from device %llx, LUN %x " 746 SAS_DPRINTK("error from device %llx, LUN %llx "
746 "couldn't be recovered in any way\n", 747 "couldn't be recovered in any way\n",
747 SAS_ADDR(task->dev->sas_addr), 748 SAS_ADDR(task->dev->sas_addr),
748 cmd->device->lun); 749 cmd->device->lun);
@@ -941,7 +942,7 @@ int sas_slave_configure(struct scsi_device *scsi_dev)
941 scsi_set_tag_type(scsi_dev, MSG_SIMPLE_TAG); 942 scsi_set_tag_type(scsi_dev, MSG_SIMPLE_TAG);
942 scsi_activate_tcq(scsi_dev, SAS_DEF_QD); 943 scsi_activate_tcq(scsi_dev, SAS_DEF_QD);
943 } else { 944 } else {
944 SAS_DPRINTK("device %llx, LUN %x doesn't support " 945 SAS_DPRINTK("device %llx, LUN %llx doesn't support "
945 "TCQ\n", SAS_ADDR(dev->sas_addr), 946 "TCQ\n", SAS_ADDR(dev->sas_addr),
946 scsi_dev->lun); 947 scsi_dev->lun);
947 scsi_dev->tagged_supported = 0; 948 scsi_dev->tagged_supported = 0;
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 2df11daad85b..7862c5540861 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -258,7 +258,7 @@ static void
258lpfc_send_sdev_queuedepth_change_event(struct lpfc_hba *phba, 258lpfc_send_sdev_queuedepth_change_event(struct lpfc_hba *phba,
259 struct lpfc_vport *vport, 259 struct lpfc_vport *vport,
260 struct lpfc_nodelist *ndlp, 260 struct lpfc_nodelist *ndlp,
261 uint32_t lun, 261 uint64_t lun,
262 uint32_t old_val, 262 uint32_t old_val,
263 uint32_t new_val) 263 uint32_t new_val)
264{ 264{
@@ -3823,7 +3823,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
3823 if (rsplen != 0 && rsplen != 4 && rsplen != 8) { 3823 if (rsplen != 0 && rsplen != 4 && rsplen != 8) {
3824 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, 3824 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
3825 "2719 Invalid response length: " 3825 "2719 Invalid response length: "
3826 "tgt x%x lun x%x cmnd x%x rsplen x%x\n", 3826 "tgt x%x lun x%llx cmnd x%x rsplen x%x\n",
3827 cmnd->device->id, 3827 cmnd->device->id,
3828 cmnd->device->lun, cmnd->cmnd[0], 3828 cmnd->device->lun, cmnd->cmnd[0],
3829 rsplen); 3829 rsplen);
@@ -3834,7 +3834,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
3834 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, 3834 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
3835 "2757 Protocol failure detected during " 3835 "2757 Protocol failure detected during "
3836 "processing of FCP I/O op: " 3836 "processing of FCP I/O op: "
3837 "tgt x%x lun x%x cmnd x%x rspInfo3 x%x\n", 3837 "tgt x%x lun x%llx cmnd x%x rspInfo3 x%x\n",
3838 cmnd->device->id, 3838 cmnd->device->id,
3839 cmnd->device->lun, cmnd->cmnd[0], 3839 cmnd->device->lun, cmnd->cmnd[0],
3840 fcprsp->rspInfo3); 3840 fcprsp->rspInfo3);
@@ -4045,7 +4045,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
4045 else 4045 else
4046 logit = LOG_FCP | LOG_FCP_UNDER; 4046 logit = LOG_FCP | LOG_FCP_UNDER;
4047 lpfc_printf_vlog(vport, KERN_WARNING, logit, 4047 lpfc_printf_vlog(vport, KERN_WARNING, logit,
4048 "9030 FCP cmd x%x failed <%d/%d> " 4048 "9030 FCP cmd x%x failed <%d/%lld> "
4049 "status: x%x result: x%x " 4049 "status: x%x result: x%x "
4050 "sid: x%x did: x%x oxid: x%x " 4050 "sid: x%x did: x%x oxid: x%x "
4051 "Data: x%x x%x\n", 4051 "Data: x%x x%x\n",
@@ -4157,7 +4157,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
4157 uint32_t *lp = (uint32_t *)cmd->sense_buffer; 4157 uint32_t *lp = (uint32_t *)cmd->sense_buffer;
4158 4158
4159 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, 4159 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
4160 "0710 Iodone <%d/%d> cmd %p, error " 4160 "0710 Iodone <%d/%llu> cmd %p, error "
4161 "x%x SNS x%x x%x Data: x%x x%x\n", 4161 "x%x SNS x%x x%x Data: x%x x%x\n",
4162 cmd->device->id, cmd->device->lun, cmd, 4162 cmd->device->id, cmd->device->lun, cmd,
4163 cmd->result, *lp, *(lp + 3), cmd->retries, 4163 cmd->result, *lp, *(lp + 3), cmd->retries,
@@ -4390,7 +4390,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
4390static int 4390static int
4391lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_vport *vport, 4391lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_vport *vport,
4392 struct lpfc_scsi_buf *lpfc_cmd, 4392 struct lpfc_scsi_buf *lpfc_cmd,
4393 unsigned int lun, 4393 uint64_t lun,
4394 uint8_t task_mgmt_cmd) 4394 uint8_t task_mgmt_cmd)
4395{ 4395{
4396 struct lpfc_iocbq *piocbq; 4396 struct lpfc_iocbq *piocbq;
@@ -4719,12 +4719,12 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
4719 atomic_dec(&ndlp->cmd_pending); 4719 atomic_dec(&ndlp->cmd_pending);
4720 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, 4720 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
4721 "3376 FCP could not issue IOCB err %x" 4721 "3376 FCP could not issue IOCB err %x"
4722 "FCP cmd x%x <%d/%d> " 4722 "FCP cmd x%x <%d/%llu> "
4723 "sid: x%x did: x%x oxid: x%x " 4723 "sid: x%x did: x%x oxid: x%x "
4724 "Data: x%x x%x x%x x%x\n", 4724 "Data: x%x x%x x%x x%x\n",
4725 err, cmnd->cmnd[0], 4725 err, cmnd->cmnd[0],
4726 cmnd->device ? cmnd->device->id : 0xffff, 4726 cmnd->device ? cmnd->device->id : 0xffff,
4727 cmnd->device ? cmnd->device->lun : 0xffff, 4727 cmnd->device ? cmnd->device->lun : (u64) -1,
4728 vport->fc_myDID, ndlp->nlp_DID, 4728 vport->fc_myDID, ndlp->nlp_DID,
4729 phba->sli_rev == LPFC_SLI_REV4 ? 4729 phba->sli_rev == LPFC_SLI_REV4 ?
4730 lpfc_cmd->cur_iocbq.sli4_xritag : 0xffff, 4730 lpfc_cmd->cur_iocbq.sli4_xritag : 0xffff,
@@ -4807,7 +4807,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
4807 spin_unlock_irqrestore(&phba->hbalock, flags); 4807 spin_unlock_irqrestore(&phba->hbalock, flags);
4808 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, 4808 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
4809 "2873 SCSI Layer I/O Abort Request IO CMPL Status " 4809 "2873 SCSI Layer I/O Abort Request IO CMPL Status "
4810 "x%x ID %d LUN %d\n", 4810 "x%x ID %d LUN %llu\n",
4811 SUCCESS, cmnd->device->id, cmnd->device->lun); 4811 SUCCESS, cmnd->device->id, cmnd->device->lun);
4812 return SUCCESS; 4812 return SUCCESS;
4813 } 4813 }
@@ -4924,7 +4924,7 @@ wait_for_cmpl:
4924 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, 4924 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
4925 "0748 abort handler timed out waiting " 4925 "0748 abort handler timed out waiting "
4926 "for abortng I/O (xri:x%x) to complete: " 4926 "for abortng I/O (xri:x%x) to complete: "
4927 "ret %#x, ID %d, LUN %d\n", 4927 "ret %#x, ID %d, LUN %llu\n",
4928 iocb->sli4_xritag, ret, 4928 iocb->sli4_xritag, ret,
4929 cmnd->device->id, cmnd->device->lun); 4929 cmnd->device->id, cmnd->device->lun);
4930 } 4930 }
@@ -4935,7 +4935,7 @@ out_unlock:
4935out: 4935out:
4936 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, 4936 lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
4937 "0749 SCSI Layer I/O Abort Request Status x%x ID %d " 4937 "0749 SCSI Layer I/O Abort Request Status x%x ID %d "
4938 "LUN %d\n", ret, cmnd->device->id, 4938 "LUN %llu\n", ret, cmnd->device->id,
4939 cmnd->device->lun); 4939 cmnd->device->lun);
4940 return ret; 4940 return ret;
4941} 4941}
@@ -5047,7 +5047,7 @@ lpfc_check_fcp_rsp(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd)
5047 **/ 5047 **/
5048static int 5048static int
5049lpfc_send_taskmgmt(struct lpfc_vport *vport, struct lpfc_rport_data *rdata, 5049lpfc_send_taskmgmt(struct lpfc_vport *vport, struct lpfc_rport_data *rdata,
5050 unsigned tgt_id, unsigned int lun_id, 5050 unsigned tgt_id, uint64_t lun_id,
5051 uint8_t task_mgmt_cmd) 5051 uint8_t task_mgmt_cmd)
5052{ 5052{
5053 struct lpfc_hba *phba = vport->phba; 5053 struct lpfc_hba *phba = vport->phba;
@@ -5083,7 +5083,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct lpfc_rport_data *rdata,
5083 iocbq->iocb_cmpl = lpfc_tskmgmt_def_cmpl; 5083 iocbq->iocb_cmpl = lpfc_tskmgmt_def_cmpl;
5084 5084
5085 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, 5085 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
5086 "0702 Issue %s to TGT %d LUN %d " 5086 "0702 Issue %s to TGT %d LUN %llu "
5087 "rpi x%x nlp_flag x%x Data: x%x x%x\n", 5087 "rpi x%x nlp_flag x%x Data: x%x x%x\n",
5088 lpfc_taskmgmt_name(task_mgmt_cmd), tgt_id, lun_id, 5088 lpfc_taskmgmt_name(task_mgmt_cmd), tgt_id, lun_id,
5089 pnode->nlp_rpi, pnode->nlp_flag, iocbq->sli4_xritag, 5089 pnode->nlp_rpi, pnode->nlp_flag, iocbq->sli4_xritag,
@@ -5094,7 +5094,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct lpfc_rport_data *rdata,
5094 if ((status != IOCB_SUCCESS) || 5094 if ((status != IOCB_SUCCESS) ||
5095 (iocbqrsp->iocb.ulpStatus != IOSTAT_SUCCESS)) { 5095 (iocbqrsp->iocb.ulpStatus != IOSTAT_SUCCESS)) {
5096 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, 5096 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
5097 "0727 TMF %s to TGT %d LUN %d failed (%d, %d) " 5097 "0727 TMF %s to TGT %d LUN %llu failed (%d, %d) "
5098 "iocb_flag x%x\n", 5098 "iocb_flag x%x\n",
5099 lpfc_taskmgmt_name(task_mgmt_cmd), 5099 lpfc_taskmgmt_name(task_mgmt_cmd),
5100 tgt_id, lun_id, iocbqrsp->iocb.ulpStatus, 5100 tgt_id, lun_id, iocbqrsp->iocb.ulpStatus,
@@ -5238,7 +5238,7 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
5238 struct lpfc_rport_data *rdata; 5238 struct lpfc_rport_data *rdata;
5239 struct lpfc_nodelist *pnode; 5239 struct lpfc_nodelist *pnode;
5240 unsigned tgt_id = cmnd->device->id; 5240 unsigned tgt_id = cmnd->device->id;
5241 unsigned int lun_id = cmnd->device->lun; 5241 uint64_t lun_id = cmnd->device->lun;
5242 struct lpfc_scsi_event_header scsi_event; 5242 struct lpfc_scsi_event_header scsi_event;
5243 int status; 5243 int status;
5244 5244
@@ -5273,7 +5273,7 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
5273 FCP_LUN_RESET); 5273 FCP_LUN_RESET);
5274 5274
5275 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, 5275 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
5276 "0713 SCSI layer issued Device Reset (%d, %d) " 5276 "0713 SCSI layer issued Device Reset (%d, %llu) "
5277 "return x%x\n", tgt_id, lun_id, status); 5277 "return x%x\n", tgt_id, lun_id, status);
5278 5278
5279 /* 5279 /*
@@ -5308,7 +5308,7 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)
5308 struct lpfc_rport_data *rdata; 5308 struct lpfc_rport_data *rdata;
5309 struct lpfc_nodelist *pnode; 5309 struct lpfc_nodelist *pnode;
5310 unsigned tgt_id = cmnd->device->id; 5310 unsigned tgt_id = cmnd->device->id;
5311 unsigned int lun_id = cmnd->device->lun; 5311 uint64_t lun_id = cmnd->device->lun;
5312 struct lpfc_scsi_event_header scsi_event; 5312 struct lpfc_scsi_event_header scsi_event;
5313 int status; 5313 int status;
5314 5314
@@ -5343,7 +5343,7 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)
5343 FCP_TARGET_RESET); 5343 FCP_TARGET_RESET);
5344 5344
5345 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP, 5345 lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
5346 "0723 SCSI layer issued Target Reset (%d, %d) " 5346 "0723 SCSI layer issued Target Reset (%d, %llu) "
5347 "return x%x\n", tgt_id, lun_id, status); 5347 "return x%x\n", tgt_id, lun_id, status);
5348 5348
5349 /* 5349 /*
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index b7770516f4c2..6bb2b52646b4 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -1941,8 +1941,8 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
1941 1941
1942 printk(KERN_WARNING "megaraid: %s cmd=%x <c=%d t=%d l=%d>\n", 1942 printk(KERN_WARNING "megaraid: %s cmd=%x <c=%d t=%d l=%d>\n",
1943 (aor == SCB_ABORT)? "ABORTING":"RESET", 1943 (aor == SCB_ABORT)? "ABORTING":"RESET",
1944 cmd->cmnd[0], cmd->device->channel, 1944 cmd->cmnd[0], cmd->device->channel,
1945 cmd->device->id, cmd->device->lun); 1945 cmd->device->id, (u32)cmd->device->lun);
1946 1946
1947 if(list_empty(&adapter->pending_list)) 1947 if(list_empty(&adapter->pending_list))
1948 return FALSE; 1948 return FALSE;
diff --git a/drivers/scsi/megaraid/mega_common.h b/drivers/scsi/megaraid/mega_common.h
index 5ead1283a844..1d037ed52c33 100644
--- a/drivers/scsi/megaraid/mega_common.h
+++ b/drivers/scsi/megaraid/mega_common.h
@@ -204,7 +204,7 @@ typedef struct {
204#define SCP2HOSTDATA(scp) SCP2HOST(scp)->hostdata // to soft state 204#define SCP2HOSTDATA(scp) SCP2HOST(scp)->hostdata // to soft state
205#define SCP2CHANNEL(scp) (scp)->device->channel // to channel 205#define SCP2CHANNEL(scp) (scp)->device->channel // to channel
206#define SCP2TARGET(scp) (scp)->device->id // to target 206#define SCP2TARGET(scp) (scp)->device->id // to target
207#define SCP2LUN(scp) (scp)->device->lun // to LUN 207#define SCP2LUN(scp) (u32)(scp)->device->lun // to LUN
208 208
209// generic macro to convert scsi command and host to controller's soft state 209// generic macro to convert scsi command and host to controller's soft state
210#define SCSIHOST2ADAP(host) (((caddr_t *)(host->hostdata))[0]) 210#define SCSIHOST2ADAP(host) (((caddr_t *)(host->hostdata))[0])
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 22600419ae9f..3ed03dfab76c 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -1690,7 +1690,7 @@ NonFastPath:
1690 MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); 1690 MEGASAS_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
1691 } 1691 }
1692 io_request->RaidContext.VirtualDiskTgtId = cpu_to_le16(device_id); 1692 io_request->RaidContext.VirtualDiskTgtId = cpu_to_le16(device_id);
1693 io_request->LUN[1] = scmd->device->lun; 1693 int_to_scsilun(scmd->device->lun, (struct scsi_lun *)io_request->LUN);
1694} 1694}
1695 1695
1696/** 1696/**
@@ -1713,7 +1713,7 @@ megasas_build_io_fusion(struct megasas_instance *instance,
1713 device_id = MEGASAS_DEV_INDEX(instance, scp); 1713 device_id = MEGASAS_DEV_INDEX(instance, scp);
1714 1714
1715 /* Zero out some fields so they don't get reused */ 1715 /* Zero out some fields so they don't get reused */
1716 io_request->LUN[1] = 0; 1716 memset(io_request->LUN, 0x0, 8);
1717 io_request->CDB.EEDP32.PrimaryReferenceTag = 0; 1717 io_request->CDB.EEDP32.PrimaryReferenceTag = 0;
1718 io_request->CDB.EEDP32.PrimaryApplicationTagMask = 0; 1718 io_request->CDB.EEDP32.PrimaryApplicationTagMask = 0;
1719 io_request->EEDPFlags = 0; 1719 io_request->EEDPFlags = 0;
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c
index e8a04ae3276a..7a6160f172ce 100644
--- a/drivers/scsi/mesh.c
+++ b/drivers/scsi/mesh.c
@@ -1230,7 +1230,7 @@ static void handle_msgin(struct mesh_state *ms)
1230 ms->msgphase = msg_out; 1230 ms->msgphase = msg_out;
1231 } else if (code != cmd->device->lun + IDENTIFY_BASE) { 1231 } else if (code != cmd->device->lun + IDENTIFY_BASE) {
1232 printk(KERN_WARNING "mesh: lun mismatch " 1232 printk(KERN_WARNING "mesh: lun mismatch "
1233 "(%d != %d) on reselection from " 1233 "(%d != %llu) on reselection from "
1234 "target %d\n", code - IDENTIFY_BASE, 1234 "target %d\n", code - IDENTIFY_BASE,
1235 cmd->device->lun, ms->conn_tgt); 1235 cmd->device->lun, ms->conn_tgt);
1236 } 1236 }
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index 7d014b11df62..a7305ffc359d 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -6633,7 +6633,7 @@ static void ncr_sir_to_redo(struct ncb *np, int num, struct ccb *cp)
6633 ** patch requested size into sense command 6633 ** patch requested size into sense command
6634 */ 6634 */
6635 cp->sensecmd[0] = 0x03; 6635 cp->sensecmd[0] = 0x03;
6636 cp->sensecmd[1] = cmd->device->lun << 5; 6636 cp->sensecmd[1] = (cmd->device->lun & 0x7) << 5;
6637 cp->sensecmd[4] = sizeof(cp->sense_buf); 6637 cp->sensecmd[4] = sizeof(cp->sense_buf);
6638 6638
6639 /* 6639 /*
diff --git a/drivers/scsi/nsp32.c b/drivers/scsi/nsp32.c
index 0665f9cfdb02..50b086aef178 100644
--- a/drivers/scsi/nsp32.c
+++ b/drivers/scsi/nsp32.c
@@ -915,7 +915,7 @@ static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct s
915 int ret; 915 int ret;
916 916
917 nsp32_dbg(NSP32_DEBUG_QUEUECOMMAND, 917 nsp32_dbg(NSP32_DEBUG_QUEUECOMMAND,
918 "enter. target: 0x%x LUN: 0x%x cmnd: 0x%x cmndlen: 0x%x " 918 "enter. target: 0x%x LUN: 0x%llu cmnd: 0x%x cmndlen: 0x%x "
919 "use_sg: 0x%x reqbuf: 0x%lx reqlen: 0x%x", 919 "use_sg: 0x%x reqbuf: 0x%lx reqlen: 0x%x",
920 SCpnt->device->id, SCpnt->device->lun, SCpnt->cmnd[0], SCpnt->cmd_len, 920 SCpnt->device->id, SCpnt->device->lun, SCpnt->cmnd[0], SCpnt->cmd_len,
921 scsi_sg_count(SCpnt), scsi_sglist(SCpnt), scsi_bufflen(SCpnt)); 921 scsi_sg_count(SCpnt), scsi_sglist(SCpnt), scsi_bufflen(SCpnt));
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 987fbb1b244e..340ceff03823 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -195,7 +195,7 @@ static int nsp_queuecommand_lck(struct scsi_cmnd *SCpnt,
195 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata; 195 nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
196 196
197 nsp_dbg(NSP_DEBUG_QUEUECOMMAND, 197 nsp_dbg(NSP_DEBUG_QUEUECOMMAND,
198 "SCpnt=0x%p target=%d lun=%d sglist=0x%p bufflen=%d sg_count=%d", 198 "SCpnt=0x%p target=%d lun=%llu sglist=0x%p bufflen=%d sg_count=%d",
199 SCpnt, target, SCpnt->device->lun, scsi_sglist(SCpnt), 199 SCpnt, target, SCpnt->device->lun, scsi_sglist(SCpnt),
200 scsi_bufflen(SCpnt), scsi_sg_count(SCpnt)); 200 scsi_bufflen(SCpnt), scsi_sg_count(SCpnt));
201 //nsp_dbg(NSP_DEBUG_QUEUECOMMAND, "before CurrentSC=0x%p", data->CurrentSC); 201 //nsp_dbg(NSP_DEBUG_QUEUECOMMAND, "before CurrentSC=0x%p", data->CurrentSC);
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index f5b52731abd9..155f9573021f 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -558,7 +558,7 @@ SYM53C500_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
558 558
559 DEB(printk("cmd=%02x, cmd_len=%02x, target=%02x, lun=%02x, bufflen=%d\n", 559 DEB(printk("cmd=%02x, cmd_len=%02x, target=%02x, lun=%02x, bufflen=%d\n",
560 SCpnt->cmnd[0], SCpnt->cmd_len, SCpnt->device->id, 560 SCpnt->cmnd[0], SCpnt->cmd_len, SCpnt->device->id,
561 SCpnt->device->lun, scsi_bufflen(SCpnt))); 561 (u8)SCpnt->device->lun, scsi_bufflen(SCpnt)));
562 562
563 VDEB(for (i = 0; i < SCpnt->cmd_len; i++) 563 VDEB(for (i = 0; i < SCpnt->cmd_len; i++)
564 printk("cmd[%d]=%02x ", i, SCpnt->cmnd[i])); 564 printk("cmd[%d]=%02x ", i, SCpnt->cmnd[i]));
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index be8ce54f99b2..017f8b9554e5 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -237,7 +237,7 @@ static int pmcraid_slave_configure(struct scsi_device *scsi_dev)
237 scsi_dev->host->unique_id, 237 scsi_dev->host->unique_id,
238 scsi_dev->channel, 238 scsi_dev->channel,
239 scsi_dev->id, 239 scsi_dev->id,
240 scsi_dev->lun); 240 (u8)scsi_dev->lun);
241 241
242 if (RES_IS_GSCSI(res->cfg_entry)) { 242 if (RES_IS_GSCSI(res->cfg_entry)) {
243 scsi_dev->allow_restart = 1; 243 scsi_dev->allow_restart = 1;
diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c
index e6e2a30493e6..ef23fabe3924 100644
--- a/drivers/scsi/ps3rom.c
+++ b/drivers/scsi/ps3rom.c
@@ -78,7 +78,7 @@ static int ps3rom_slave_configure(struct scsi_device *scsi_dev)
78 struct ps3rom_private *priv = shost_priv(scsi_dev->host); 78 struct ps3rom_private *priv = shost_priv(scsi_dev->host);
79 struct ps3_storage_device *dev = priv->dev; 79 struct ps3_storage_device *dev = priv->dev;
80 80
81 dev_dbg(&dev->sbd.core, "%s:%u: id %u, lun %u, channel %u\n", __func__, 81 dev_dbg(&dev->sbd.core, "%s:%u: id %u, lun %llu, channel %u\n", __func__,
82 __LINE__, scsi_dev->id, scsi_dev->lun, scsi_dev->channel); 82 __LINE__, scsi_dev->id, scsi_dev->lun, scsi_dev->channel);
83 83
84 /* 84 /*
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index de5d0ae19d83..b64399153135 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -320,8 +320,8 @@ struct srb_iocb {
320 * defined in tsk_mgmt_entry struct 320 * defined in tsk_mgmt_entry struct
321 * for control_flags field in qla_fw.h. 321 * for control_flags field in qla_fw.h.
322 */ 322 */
323 uint64_t lun;
323 uint32_t flags; 324 uint32_t flags;
324 uint32_t lun;
325 uint32_t data; 325 uint32_t data;
326 struct completion comp; 326 struct completion comp;
327 __le16 comp_status; 327 __le16 comp_status;
@@ -2529,8 +2529,8 @@ struct isp_operations {
2529 void (*disable_intrs) (struct qla_hw_data *); 2529 void (*disable_intrs) (struct qla_hw_data *);
2530 2530
2531 int (*abort_command) (srb_t *); 2531 int (*abort_command) (srb_t *);
2532 int (*target_reset) (struct fc_port *, unsigned int, int); 2532 int (*target_reset) (struct fc_port *, uint64_t, int);
2533 int (*lun_reset) (struct fc_port *, unsigned int, int); 2533 int (*lun_reset) (struct fc_port *, uint64_t, int);
2534 int (*fabric_login) (struct scsi_qla_host *, uint16_t, uint8_t, 2534 int (*fabric_login) (struct scsi_qla_host *, uint16_t, uint8_t,
2535 uint8_t, uint8_t, uint16_t *, uint8_t); 2535 uint8_t, uint8_t, uint16_t *, uint8_t);
2536 int (*fabric_logout) (struct scsi_qla_host *, uint16_t, uint8_t, 2536 int (*fabric_logout) (struct scsi_qla_host *, uint16_t, uint8_t,
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index d48dea8fab1b..9ef0781b12da 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -212,7 +212,7 @@ extern void qla2x00_build_scsi_iocbs_64(srb_t *, cmd_entry_t *, uint16_t);
212extern int qla2x00_start_scsi(srb_t *sp); 212extern int qla2x00_start_scsi(srb_t *sp);
213extern int qla24xx_start_scsi(srb_t *sp); 213extern int qla24xx_start_scsi(srb_t *sp);
214int qla2x00_marker(struct scsi_qla_host *, struct req_que *, struct rsp_que *, 214int qla2x00_marker(struct scsi_qla_host *, struct req_que *, struct rsp_que *,
215 uint16_t, uint16_t, uint8_t); 215 uint16_t, uint64_t, uint8_t);
216extern int qla2x00_start_sp(srb_t *); 216extern int qla2x00_start_sp(srb_t *);
217extern int qla24xx_dif_start_scsi(srb_t *); 217extern int qla24xx_dif_start_scsi(srb_t *);
218extern int qla2x00_start_bidir(srb_t *, struct scsi_qla_host *, uint32_t); 218extern int qla2x00_start_bidir(srb_t *, struct scsi_qla_host *, uint32_t);
@@ -262,10 +262,10 @@ extern int
262qla2x00_abort_command(srb_t *); 262qla2x00_abort_command(srb_t *);
263 263
264extern int 264extern int
265qla2x00_abort_target(struct fc_port *, unsigned int, int); 265qla2x00_abort_target(struct fc_port *, uint64_t, int);
266 266
267extern int 267extern int
268qla2x00_lun_reset(struct fc_port *, unsigned int, int); 268qla2x00_lun_reset(struct fc_port *, uint64_t, int);
269 269
270extern int 270extern int
271qla2x00_get_adapter_id(scsi_qla_host_t *, uint16_t *, uint8_t *, uint8_t *, 271qla2x00_get_adapter_id(scsi_qla_host_t *, uint16_t *, uint8_t *, uint8_t *,
@@ -339,12 +339,12 @@ qla24xx_get_isp_stats(scsi_qla_host_t *, struct link_statistics *,
339extern int qla24xx_abort_command(srb_t *); 339extern int qla24xx_abort_command(srb_t *);
340extern int qla24xx_async_abort_command(srb_t *); 340extern int qla24xx_async_abort_command(srb_t *);
341extern int 341extern int
342qla24xx_abort_target(struct fc_port *, unsigned int, int); 342qla24xx_abort_target(struct fc_port *, uint64_t, int);
343extern int 343extern int
344qla24xx_lun_reset(struct fc_port *, unsigned int, int); 344qla24xx_lun_reset(struct fc_port *, uint64_t, int);
345extern int 345extern int
346qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *, unsigned int, 346qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *, unsigned int,
347 unsigned int, enum nexus_wait_type); 347 uint64_t, enum nexus_wait_type);
348extern int 348extern int
349qla2x00_system_error(scsi_qla_host_t *); 349qla2x00_system_error(scsi_qla_host_t *);
350 350
@@ -617,8 +617,8 @@ extern char *qlafx00_fw_version_str(struct scsi_qla_host *, char *);
617extern irqreturn_t qlafx00_intr_handler(int, void *); 617extern irqreturn_t qlafx00_intr_handler(int, void *);
618extern void qlafx00_enable_intrs(struct qla_hw_data *); 618extern void qlafx00_enable_intrs(struct qla_hw_data *);
619extern void qlafx00_disable_intrs(struct qla_hw_data *); 619extern void qlafx00_disable_intrs(struct qla_hw_data *);
620extern int qlafx00_abort_target(fc_port_t *, unsigned int, int); 620extern int qlafx00_abort_target(fc_port_t *, uint64_t, int);
621extern int qlafx00_lun_reset(fc_port_t *, unsigned int, int); 621extern int qlafx00_lun_reset(fc_port_t *, uint64_t, int);
622extern int qlafx00_start_scsi(srb_t *); 622extern int qlafx00_start_scsi(srb_t *);
623extern int qlafx00_abort_isp(scsi_qla_host_t *); 623extern int qlafx00_abort_isp(scsi_qla_host_t *);
624extern int qlafx00_iospace_config(struct qla_hw_data *); 624extern int qlafx00_iospace_config(struct qla_hw_data *);
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 760931529592..150529d98db4 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -520,7 +520,7 @@ qla2x00_start_iocbs(struct scsi_qla_host *vha, struct req_que *req)
520static int 520static int
521__qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req, 521__qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req,
522 struct rsp_que *rsp, uint16_t loop_id, 522 struct rsp_que *rsp, uint16_t loop_id,
523 uint16_t lun, uint8_t type) 523 uint64_t lun, uint8_t type)
524{ 524{
525 mrk_entry_t *mrk; 525 mrk_entry_t *mrk;
526 struct mrk_entry_24xx *mrk24 = NULL; 526 struct mrk_entry_24xx *mrk24 = NULL;
@@ -543,14 +543,13 @@ __qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req,
543 if (IS_FWI2_CAPABLE(ha)) { 543 if (IS_FWI2_CAPABLE(ha)) {
544 mrk24 = (struct mrk_entry_24xx *) mrk; 544 mrk24 = (struct mrk_entry_24xx *) mrk;
545 mrk24->nport_handle = cpu_to_le16(loop_id); 545 mrk24->nport_handle = cpu_to_le16(loop_id);
546 mrk24->lun[1] = LSB(lun); 546 int_to_scsilun(lun, (struct scsi_lun *)&mrk24->lun);
547 mrk24->lun[2] = MSB(lun);
548 host_to_fcp_swap(mrk24->lun, sizeof(mrk24->lun)); 547 host_to_fcp_swap(mrk24->lun, sizeof(mrk24->lun));
549 mrk24->vp_index = vha->vp_idx; 548 mrk24->vp_index = vha->vp_idx;
550 mrk24->handle = MAKE_HANDLE(req->id, mrk24->handle); 549 mrk24->handle = MAKE_HANDLE(req->id, mrk24->handle);
551 } else { 550 } else {
552 SET_TARGET_ID(ha, mrk->target, loop_id); 551 SET_TARGET_ID(ha, mrk->target, loop_id);
553 mrk->lun = cpu_to_le16(lun); 552 mrk->lun = cpu_to_le16((uint16_t)lun);
554 } 553 }
555 } 554 }
556 wmb(); 555 wmb();
@@ -562,7 +561,7 @@ __qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req,
562 561
563int 562int
564qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req, 563qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req,
565 struct rsp_que *rsp, uint16_t loop_id, uint16_t lun, 564 struct rsp_que *rsp, uint16_t loop_id, uint64_t lun,
566 uint8_t type) 565 uint8_t type)
567{ 566{
568 int ret; 567 int ret;
@@ -2047,7 +2046,7 @@ static void
2047qla24xx_tm_iocb(srb_t *sp, struct tsk_mgmt_entry *tsk) 2046qla24xx_tm_iocb(srb_t *sp, struct tsk_mgmt_entry *tsk)
2048{ 2047{
2049 uint32_t flags; 2048 uint32_t flags;
2050 unsigned int lun; 2049 uint64_t lun;
2051 struct fc_port *fcport = sp->fcport; 2050 struct fc_port *fcport = sp->fcport;
2052 scsi_qla_host_t *vha = fcport->vha; 2051 scsi_qla_host_t *vha = fcport->vha;
2053 struct qla_hw_data *ha = vha->hw; 2052 struct qla_hw_data *ha = vha->hw;
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index a56825c73c31..550a4a31f51a 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1659,7 +1659,7 @@ qla2x00_handle_sense(srb_t *sp, uint8_t *sense_data, uint32_t par_sense_len,
1659 1659
1660 if (sense_len) { 1660 if (sense_len) {
1661 ql_dbg(ql_dbg_io + ql_dbg_buffer, vha, 0x301c, 1661 ql_dbg(ql_dbg_io + ql_dbg_buffer, vha, 0x301c,
1662 "Check condition Sense data, nexus%ld:%d:%d cmd=%p.\n", 1662 "Check condition Sense data, nexus%ld:%d:%llu cmd=%p.\n",
1663 sp->fcport->vha->host_no, cp->device->id, cp->device->lun, 1663 sp->fcport->vha->host_no, cp->device->id, cp->device->lun,
1664 cp); 1664 cp);
1665 ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x302b, 1665 ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x302b,
@@ -2281,7 +2281,7 @@ check_scsi_status:
2281out: 2281out:
2282 if (logit) 2282 if (logit)
2283 ql_dbg(ql_dbg_io, fcport->vha, 0x3022, 2283 ql_dbg(ql_dbg_io, fcport->vha, 0x3022,
2284 "FCP command status: 0x%x-0x%x (0x%x) nexus=%ld:%d:%d " 2284 "FCP command status: 0x%x-0x%x (0x%x) nexus=%ld:%d:%llu "
2285 "portid=%02x%02x%02x oxid=0x%x cdb=%10phN len=0x%x " 2285 "portid=%02x%02x%02x oxid=0x%x cdb=%10phN len=0x%x "
2286 "rsp_info=0x%x resid=0x%x fw_resid=0x%x.\n", 2286 "rsp_info=0x%x resid=0x%x fw_resid=0x%x.\n",
2287 comp_status, scsi_status, res, vha->host_no, 2287 comp_status, scsi_status, res, vha->host_no,
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 1c33a77db5c2..d9aafc003be2 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -947,7 +947,7 @@ qla2x00_abort_command(srb_t *sp)
947} 947}
948 948
949int 949int
950qla2x00_abort_target(struct fc_port *fcport, unsigned int l, int tag) 950qla2x00_abort_target(struct fc_port *fcport, uint64_t l, int tag)
951{ 951{
952 int rval, rval2; 952 int rval, rval2;
953 mbx_cmd_t mc; 953 mbx_cmd_t mc;
@@ -1000,7 +1000,7 @@ qla2x00_abort_target(struct fc_port *fcport, unsigned int l, int tag)
1000} 1000}
1001 1001
1002int 1002int
1003qla2x00_lun_reset(struct fc_port *fcport, unsigned int l, int tag) 1003qla2x00_lun_reset(struct fc_port *fcport, uint64_t l, int tag)
1004{ 1004{
1005 int rval, rval2; 1005 int rval, rval2;
1006 mbx_cmd_t mc; 1006 mbx_cmd_t mc;
@@ -1022,7 +1022,7 @@ qla2x00_lun_reset(struct fc_port *fcport, unsigned int l, int tag)
1022 mcp->mb[1] = fcport->loop_id; 1022 mcp->mb[1] = fcport->loop_id;
1023 else 1023 else
1024 mcp->mb[1] = fcport->loop_id << 8; 1024 mcp->mb[1] = fcport->loop_id << 8;
1025 mcp->mb[2] = l; 1025 mcp->mb[2] = (u32)l;
1026 mcp->mb[3] = 0; 1026 mcp->mb[3] = 0;
1027 mcp->mb[9] = vha->vp_idx; 1027 mcp->mb[9] = vha->vp_idx;
1028 1028
@@ -2666,7 +2666,7 @@ struct tsk_mgmt_cmd {
2666 2666
2667static int 2667static int
2668__qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport, 2668__qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
2669 unsigned int l, int tag) 2669 uint64_t l, int tag)
2670{ 2670{
2671 int rval, rval2; 2671 int rval, rval2;
2672 struct tsk_mgmt_cmd *tsk; 2672 struct tsk_mgmt_cmd *tsk;
@@ -2760,7 +2760,7 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
2760} 2760}
2761 2761
2762int 2762int
2763qla24xx_abort_target(struct fc_port *fcport, unsigned int l, int tag) 2763qla24xx_abort_target(struct fc_port *fcport, uint64_t l, int tag)
2764{ 2764{
2765 struct qla_hw_data *ha = fcport->vha->hw; 2765 struct qla_hw_data *ha = fcport->vha->hw;
2766 2766
@@ -2771,7 +2771,7 @@ qla24xx_abort_target(struct fc_port *fcport, unsigned int l, int tag)
2771} 2771}
2772 2772
2773int 2773int
2774qla24xx_lun_reset(struct fc_port *fcport, unsigned int l, int tag) 2774qla24xx_lun_reset(struct fc_port *fcport, uint64_t l, int tag)
2775{ 2775{
2776 struct qla_hw_data *ha = fcport->vha->hw; 2776 struct qla_hw_data *ha = fcport->vha->hw;
2777 2777
diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c
index abeb3901498b..4775baa8b6a0 100644
--- a/drivers/scsi/qla2xxx/qla_mr.c
+++ b/drivers/scsi/qla2xxx/qla_mr.c
@@ -726,13 +726,13 @@ qlafx00_disable_intrs(struct qla_hw_data *ha)
726} 726}
727 727
728int 728int
729qlafx00_abort_target(fc_port_t *fcport, unsigned int l, int tag) 729qlafx00_abort_target(fc_port_t *fcport, uint64_t l, int tag)
730{ 730{
731 return qla2x00_async_tm_cmd(fcport, TCF_TARGET_RESET, l, tag); 731 return qla2x00_async_tm_cmd(fcport, TCF_TARGET_RESET, l, tag);
732} 732}
733 733
734int 734int
735qlafx00_lun_reset(fc_port_t *fcport, unsigned int l, int tag) 735qlafx00_lun_reset(fc_port_t *fcport, uint64_t l, int tag)
736{ 736{
737 return qla2x00_async_tm_cmd(fcport, TCF_LUN_RESET, l, tag); 737 return qla2x00_async_tm_cmd(fcport, TCF_LUN_RESET, l, tag);
738} 738}
@@ -2159,7 +2159,7 @@ qlafx00_handle_sense(srb_t *sp, uint8_t *sense_data, uint32_t par_sense_len,
2159 2159
2160 if (sense_len) { 2160 if (sense_len) {
2161 ql_dbg(ql_dbg_io + ql_dbg_buffer, vha, 0x3039, 2161 ql_dbg(ql_dbg_io + ql_dbg_buffer, vha, 0x3039,
2162 "Check condition Sense data, nexus%ld:%d:%d cmd=%p.\n", 2162 "Check condition Sense data, nexus%ld:%d:%llu cmd=%p.\n",
2163 sp->fcport->vha->host_no, cp->device->id, cp->device->lun, 2163 sp->fcport->vha->host_no, cp->device->id, cp->device->lun,
2164 cp); 2164 cp);
2165 ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x3049, 2165 ql_dump_buffer(ql_dbg_io + ql_dbg_buffer, vha, 0x3049,
@@ -2524,7 +2524,7 @@ check_scsi_status:
2524 2524
2525 if (logit) 2525 if (logit)
2526 ql_dbg(ql_dbg_io, fcport->vha, 0x3058, 2526 ql_dbg(ql_dbg_io, fcport->vha, 0x3058,
2527 "FCP command status: 0x%x-0x%x (0x%x) nexus=%ld:%d:%d " 2527 "FCP command status: 0x%x-0x%x (0x%x) nexus=%ld:%d:%llu "
2528 "tgt_id: 0x%x lscsi_status: 0x%x cdb=%10phN len=0x%x " 2528 "tgt_id: 0x%x lscsi_status: 0x%x cdb=%10phN len=0x%x "
2529 "rsp_info=0x%x resid=0x%x fw_resid=0x%x sense_len=0x%x, " 2529 "rsp_info=0x%x resid=0x%x fw_resid=0x%x sense_len=0x%x, "
2530 "par_sense_len=0x%x, rsp_info_len=0x%x\n", 2530 "par_sense_len=0x%x, rsp_info_len=0x%x\n",
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 5269aee1df3b..b22c75305b44 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -920,7 +920,8 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
920 scsi_qla_host_t *vha = shost_priv(cmd->device->host); 920 scsi_qla_host_t *vha = shost_priv(cmd->device->host);
921 srb_t *sp; 921 srb_t *sp;
922 int ret; 922 int ret;
923 unsigned int id, lun; 923 unsigned int id;
924 uint64_t lun;
924 unsigned long flags; 925 unsigned long flags;
925 int rval, wait = 0; 926 int rval, wait = 0;
926 struct qla_hw_data *ha = vha->hw; 927 struct qla_hw_data *ha = vha->hw;
@@ -944,7 +945,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
944 } 945 }
945 946
946 ql_dbg(ql_dbg_taskm, vha, 0x8002, 947 ql_dbg(ql_dbg_taskm, vha, 0x8002,
947 "Aborting from RISC nexus=%ld:%d:%d sp=%p cmd=%p\n", 948 "Aborting from RISC nexus=%ld:%d:%llu sp=%p cmd=%p\n",
948 vha->host_no, id, lun, sp, cmd); 949 vha->host_no, id, lun, sp, cmd);
949 950
950 /* Get a reference to the sp and drop the lock.*/ 951 /* Get a reference to the sp and drop the lock.*/
@@ -995,7 +996,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
995 } 996 }
996 997
997 ql_log(ql_log_info, vha, 0x801c, 998 ql_log(ql_log_info, vha, 0x801c,
998 "Abort command issued nexus=%ld:%d:%d -- %d %x.\n", 999 "Abort command issued nexus=%ld:%d:%llu -- %d %x.\n",
999 vha->host_no, id, lun, wait, ret); 1000 vha->host_no, id, lun, wait, ret);
1000 1001
1001 return ret; 1002 return ret;
@@ -1003,7 +1004,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
1003 1004
1004int 1005int
1005qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t, 1006qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t,
1006 unsigned int l, enum nexus_wait_type type) 1007 uint64_t l, enum nexus_wait_type type)
1007{ 1008{
1008 int cnt, match, status; 1009 int cnt, match, status;
1009 unsigned long flags; 1010 unsigned long flags;
@@ -1060,7 +1061,7 @@ static char *reset_errors[] = {
1060 1061
1061static int 1062static int
1062__qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type, 1063__qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
1063 struct scsi_cmnd *cmd, int (*do_reset)(struct fc_port *, unsigned int, int)) 1064 struct scsi_cmnd *cmd, int (*do_reset)(struct fc_port *, uint64_t, int))
1064{ 1065{
1065 scsi_qla_host_t *vha = shost_priv(cmd->device->host); 1066 scsi_qla_host_t *vha = shost_priv(cmd->device->host);
1066 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; 1067 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
@@ -1075,7 +1076,7 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
1075 return err; 1076 return err;
1076 1077
1077 ql_log(ql_log_info, vha, 0x8009, 1078 ql_log(ql_log_info, vha, 0x8009,
1078 "%s RESET ISSUED nexus=%ld:%d:%d cmd=%p.\n", name, vha->host_no, 1079 "%s RESET ISSUED nexus=%ld:%d:%llu cmd=%p.\n", name, vha->host_no,
1079 cmd->device->id, cmd->device->lun, cmd); 1080 cmd->device->id, cmd->device->lun, cmd);
1080 1081
1081 err = 0; 1082 err = 0;
@@ -1100,14 +1101,14 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
1100 } 1101 }
1101 1102
1102 ql_log(ql_log_info, vha, 0x800e, 1103 ql_log(ql_log_info, vha, 0x800e,
1103 "%s RESET SUCCEEDED nexus:%ld:%d:%d cmd=%p.\n", name, 1104 "%s RESET SUCCEEDED nexus:%ld:%d:%llu cmd=%p.\n", name,
1104 vha->host_no, cmd->device->id, cmd->device->lun, cmd); 1105 vha->host_no, cmd->device->id, cmd->device->lun, cmd);
1105 1106
1106 return SUCCESS; 1107 return SUCCESS;
1107 1108
1108eh_reset_failed: 1109eh_reset_failed:
1109 ql_log(ql_log_info, vha, 0x800f, 1110 ql_log(ql_log_info, vha, 0x800f,
1110 "%s RESET FAILED: %s nexus=%ld:%d:%d cmd=%p.\n", name, 1111 "%s RESET FAILED: %s nexus=%ld:%d:%llu cmd=%p.\n", name,
1111 reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun, 1112 reset_errors[err], vha->host_no, cmd->device->id, cmd->device->lun,
1112 cmd); 1113 cmd);
1113 return FAILED; 1114 return FAILED;
@@ -1154,7 +1155,8 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
1154 scsi_qla_host_t *vha = shost_priv(cmd->device->host); 1155 scsi_qla_host_t *vha = shost_priv(cmd->device->host);
1155 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata; 1156 fc_port_t *fcport = (struct fc_port *) cmd->device->hostdata;
1156 int ret = FAILED; 1157 int ret = FAILED;
1157 unsigned int id, lun; 1158 unsigned int id;
1159 uint64_t lun;
1158 1160
1159 id = cmd->device->id; 1161 id = cmd->device->id;
1160 lun = cmd->device->lun; 1162 lun = cmd->device->lun;
@@ -1169,7 +1171,7 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
1169 ret = FAILED; 1171 ret = FAILED;
1170 1172
1171 ql_log(ql_log_info, vha, 0x8012, 1173 ql_log(ql_log_info, vha, 0x8012,
1172 "BUS RESET ISSUED nexus=%ld:%d:%d.\n", vha->host_no, id, lun); 1174 "BUS RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun);
1173 1175
1174 if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) { 1176 if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
1175 ql_log(ql_log_fatal, vha, 0x8013, 1177 ql_log(ql_log_fatal, vha, 0x8013,
@@ -1193,7 +1195,7 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
1193 1195
1194eh_bus_reset_done: 1196eh_bus_reset_done:
1195 ql_log(ql_log_warn, vha, 0x802b, 1197 ql_log(ql_log_warn, vha, 0x802b,
1196 "BUS RESET %s nexus=%ld:%d:%d.\n", 1198 "BUS RESET %s nexus=%ld:%d:%llu.\n",
1197 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); 1199 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun);
1198 1200
1199 return ret; 1201 return ret;
@@ -1220,14 +1222,15 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
1220 scsi_qla_host_t *vha = shost_priv(cmd->device->host); 1222 scsi_qla_host_t *vha = shost_priv(cmd->device->host);
1221 struct qla_hw_data *ha = vha->hw; 1223 struct qla_hw_data *ha = vha->hw;
1222 int ret = FAILED; 1224 int ret = FAILED;
1223 unsigned int id, lun; 1225 unsigned int id;
1226 uint64_t lun;
1224 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev); 1227 scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
1225 1228
1226 id = cmd->device->id; 1229 id = cmd->device->id;
1227 lun = cmd->device->lun; 1230 lun = cmd->device->lun;
1228 1231
1229 ql_log(ql_log_info, vha, 0x8018, 1232 ql_log(ql_log_info, vha, 0x8018,
1230 "ADAPTER RESET ISSUED nexus=%ld:%d:%d.\n", vha->host_no, id, lun); 1233 "ADAPTER RESET ISSUED nexus=%ld:%d:%llu.\n", vha->host_no, id, lun);
1231 1234
1232 /* 1235 /*
1233 * No point in issuing another reset if one is active. Also do not 1236 * No point in issuing another reset if one is active. Also do not
@@ -1273,7 +1276,7 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
1273 1276
1274eh_host_reset_lock: 1277eh_host_reset_lock:
1275 ql_log(ql_log_info, vha, 0x8017, 1278 ql_log(ql_log_info, vha, 0x8017,
1276 "ADAPTER RESET %s nexus=%ld:%d:%d.\n", 1279 "ADAPTER RESET %s nexus=%ld:%d:%llu.\n",
1277 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun); 1280 (ret == FAILED) ? "FAILED" : "SUCCEEDED", vha->host_no, id, lun);
1278 1281
1279 return ret; 1282 return ret;
@@ -1409,7 +1412,7 @@ static void qla2x00_handle_queue_full(struct scsi_device *sdev, int qdepth)
1409 return; 1412 return;
1410 1413
1411 ql_dbg(ql_dbg_io, fcport->vha, 0x3029, 1414 ql_dbg(ql_dbg_io, fcport->vha, 0x3029,
1412 "Queue depth adjusted-down to %d for nexus=%ld:%d:%d.\n", 1415 "Queue depth adjusted-down to %d for nexus=%ld:%d:%llu.\n",
1413 sdev->queue_depth, fcport->vha->host_no, sdev->id, sdev->lun); 1416 sdev->queue_depth, fcport->vha->host_no, sdev->id, sdev->lun);
1414} 1417}
1415 1418
@@ -1432,7 +1435,7 @@ static void qla2x00_adjust_sdev_qdepth_up(struct scsi_device *sdev, int qdepth)
1432 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, qdepth); 1435 scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG, qdepth);
1433 1436
1434 ql_dbg(ql_dbg_io, vha, 0x302a, 1437 ql_dbg(ql_dbg_io, vha, 0x302a,
1435 "Queue depth adjusted-up to %d for nexus=%ld:%d:%d.\n", 1438 "Queue depth adjusted-up to %d for nexus=%ld:%d:%llu.\n",
1436 sdev->queue_depth, fcport->vha->host_no, sdev->id, sdev->lun); 1439 sdev->queue_depth, fcport->vha->host_no, sdev->id, sdev->lun);
1437} 1440}
1438 1441
diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h
index 5f58b451327e..2559144f5475 100644
--- a/drivers/scsi/qla4xxx/ql4_glbl.h
+++ b/drivers/scsi/qla4xxx/ql4_glbl.h
@@ -23,7 +23,7 @@ void qla4xxx_process_aen(struct scsi_qla_host *ha, uint8_t process_aen);
23int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host *ha); 23int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host *ha);
24int qla4xxx_abort_task(struct scsi_qla_host *ha, struct srb *srb); 24int qla4xxx_abort_task(struct scsi_qla_host *ha, struct srb *srb);
25int qla4xxx_reset_lun(struct scsi_qla_host *ha, struct ddb_entry *ddb_entry, 25int qla4xxx_reset_lun(struct scsi_qla_host *ha, struct ddb_entry *ddb_entry,
26 int lun); 26 uint64_t lun);
27int qla4xxx_reset_target(struct scsi_qla_host *ha, 27int qla4xxx_reset_target(struct scsi_qla_host *ha,
28 struct ddb_entry *ddb_entry); 28 struct ddb_entry *ddb_entry);
29int qla4xxx_get_flash(struct scsi_qla_host *ha, dma_addr_t dma_addr, 29int qla4xxx_get_flash(struct scsi_qla_host *ha, dma_addr_t dma_addr,
@@ -76,7 +76,7 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha, uint32_t fw_ddb_index,
76 uint32_t state, uint32_t conn_error); 76 uint32_t state, uint32_t conn_error);
77void qla4xxx_dump_buffer(void *b, uint32_t size); 77void qla4xxx_dump_buffer(void *b, uint32_t size);
78int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha, 78int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha,
79 struct ddb_entry *ddb_entry, int lun, uint16_t mrkr_mod); 79 struct ddb_entry *ddb_entry, uint64_t lun, uint16_t mrkr_mod);
80int qla4xxx_set_flash(struct scsi_qla_host *ha, dma_addr_t dma_addr, 80int qla4xxx_set_flash(struct scsi_qla_host *ha, dma_addr_t dma_addr,
81 uint32_t offset, uint32_t length, uint32_t options); 81 uint32_t offset, uint32_t length, uint32_t options);
82int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount, 82int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount,
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
index e5697ab144d2..08ab6dac226d 100644
--- a/drivers/scsi/qla4xxx/ql4_iocb.c
+++ b/drivers/scsi/qla4xxx/ql4_iocb.c
@@ -83,7 +83,7 @@ static int qla4xxx_get_req_pkt(struct scsi_qla_host *ha,
83 * This routine issues a marker IOCB. 83 * This routine issues a marker IOCB.
84 **/ 84 **/
85int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha, 85int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha,
86 struct ddb_entry *ddb_entry, int lun, uint16_t mrkr_mod) 86 struct ddb_entry *ddb_entry, uint64_t lun, uint16_t mrkr_mod)
87{ 87{
88 struct qla4_marker_entry *marker_entry; 88 struct qla4_marker_entry *marker_entry;
89 unsigned long flags = 0; 89 unsigned long flags = 0;
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index 081b6b78d2c6..4f9c0f2be89d 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -26,7 +26,7 @@ static void qla4xxx_copy_sense(struct scsi_qla_host *ha,
26 memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); 26 memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
27 sense_len = le16_to_cpu(sts_entry->senseDataByteCnt); 27 sense_len = le16_to_cpu(sts_entry->senseDataByteCnt);
28 if (sense_len == 0) { 28 if (sense_len == 0) {
29 DEBUG2(ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%d:%d: %s:" 29 DEBUG2(ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%d:%llu: %s:"
30 " sense len 0\n", ha->host_no, 30 " sense len 0\n", ha->host_no,
31 cmd->device->channel, cmd->device->id, 31 cmd->device->channel, cmd->device->id,
32 cmd->device->lun, __func__)); 32 cmd->device->lun, __func__));
@@ -43,7 +43,7 @@ static void qla4xxx_copy_sense(struct scsi_qla_host *ha,
43 sense_len = min_t(uint16_t, sense_len, IOCB_MAX_SENSEDATA_LEN); 43 sense_len = min_t(uint16_t, sense_len, IOCB_MAX_SENSEDATA_LEN);
44 memcpy(cmd->sense_buffer, sts_entry->senseData, sense_len); 44 memcpy(cmd->sense_buffer, sts_entry->senseData, sense_len);
45 45
46 DEBUG2(printk(KERN_INFO "scsi%ld:%d:%d:%d: %s: sense key = %x, " 46 DEBUG2(printk(KERN_INFO "scsi%ld:%d:%d:%llu: %s: sense key = %x, "
47 "ASL= %02x, ASC/ASCQ = %02x/%02x\n", ha->host_no, 47 "ASL= %02x, ASC/ASCQ = %02x/%02x\n", ha->host_no,
48 cmd->device->channel, cmd->device->id, 48 cmd->device->channel, cmd->device->id,
49 cmd->device->lun, __func__, 49 cmd->device->lun, __func__,
@@ -169,7 +169,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
169 169
170 cmd->result = DID_ERROR << 16; 170 cmd->result = DID_ERROR << 16;
171 171
172 DEBUG2(printk("scsi%ld:%d:%d:%d: %s: " 172 DEBUG2(printk("scsi%ld:%d:%d:%llu: %s: "
173 "Mid-layer Data underrun0, " 173 "Mid-layer Data underrun0, "
174 "xferlen = 0x%x, " 174 "xferlen = 0x%x, "
175 "residual = 0x%x\n", ha->host_no, 175 "residual = 0x%x\n", ha->host_no,
@@ -197,7 +197,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
197 break; 197 break;
198 198
199 case SCS_RESET_OCCURRED: 199 case SCS_RESET_OCCURRED:
200 DEBUG2(printk("scsi%ld:%d:%d:%d: %s: Device RESET occurred\n", 200 DEBUG2(printk("scsi%ld:%d:%d:%llu: %s: Device RESET occurred\n",
201 ha->host_no, cmd->device->channel, 201 ha->host_no, cmd->device->channel,
202 cmd->device->id, cmd->device->lun, __func__)); 202 cmd->device->id, cmd->device->lun, __func__));
203 203
@@ -205,7 +205,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
205 break; 205 break;
206 206
207 case SCS_ABORTED: 207 case SCS_ABORTED:
208 DEBUG2(printk("scsi%ld:%d:%d:%d: %s: Abort occurred\n", 208 DEBUG2(printk("scsi%ld:%d:%d:%llu: %s: Abort occurred\n",
209 ha->host_no, cmd->device->channel, 209 ha->host_no, cmd->device->channel,
210 cmd->device->id, cmd->device->lun, __func__)); 210 cmd->device->id, cmd->device->lun, __func__));
211 211
@@ -213,7 +213,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
213 break; 213 break;
214 214
215 case SCS_TIMEOUT: 215 case SCS_TIMEOUT:
216 DEBUG2(printk(KERN_INFO "scsi%ld:%d:%d:%d: Timeout\n", 216 DEBUG2(printk(KERN_INFO "scsi%ld:%d:%d:%llu: Timeout\n",
217 ha->host_no, cmd->device->channel, 217 ha->host_no, cmd->device->channel,
218 cmd->device->id, cmd->device->lun)); 218 cmd->device->id, cmd->device->lun));
219 219
@@ -232,7 +232,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
232 case SCS_DATA_OVERRUN: 232 case SCS_DATA_OVERRUN:
233 if ((sts_entry->iscsiFlags & ISCSI_FLAG_RESIDUAL_OVER) || 233 if ((sts_entry->iscsiFlags & ISCSI_FLAG_RESIDUAL_OVER) ||
234 (sts_entry->completionStatus == SCS_DATA_OVERRUN)) { 234 (sts_entry->completionStatus == SCS_DATA_OVERRUN)) {
235 DEBUG2(printk("scsi%ld:%d:%d:%d: %s: " "Data overrun\n", 235 DEBUG2(printk("scsi%ld:%d:%d:%llu: %s: " "Data overrun\n",
236 ha->host_no, 236 ha->host_no,
237 cmd->device->channel, cmd->device->id, 237 cmd->device->channel, cmd->device->id,
238 cmd->device->lun, __func__)); 238 cmd->device->lun, __func__));
@@ -259,7 +259,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
259 if (!scsi_status && (scsi_bufflen(cmd) - residual) < 259 if (!scsi_status && (scsi_bufflen(cmd) - residual) <
260 cmd->underflow) { 260 cmd->underflow) {
261 DEBUG2(ql4_printk(KERN_INFO, ha, 261 DEBUG2(ql4_printk(KERN_INFO, ha,
262 "scsi%ld:%d:%d:%d: %s: Mid-layer Data underrun, xferlen = 0x%x,residual = 0x%x\n", 262 "scsi%ld:%d:%d:%llu: %s: Mid-layer Data underrun, xferlen = 0x%x,residual = 0x%x\n",
263 ha->host_no, 263 ha->host_no,
264 cmd->device->channel, 264 cmd->device->channel,
265 cmd->device->id, 265 cmd->device->id,
@@ -291,7 +291,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha,
291 */ 291 */
292 292
293 DEBUG2(ql4_printk(KERN_INFO, ha, 293 DEBUG2(ql4_printk(KERN_INFO, ha,
294 "scsi%ld:%d:%d:%d: %s: Dropped frame(s) detected (0x%x of 0x%x bytes).\n", 294 "scsi%ld:%d:%d:%llu: %s: Dropped frame(s) detected (0x%x of 0x%x bytes).\n",
295 ha->host_no, 295 ha->host_no,
296 cmd->device->channel, 296 cmd->device->channel,
297 cmd->device->id, 297 cmd->device->id,
@@ -313,7 +313,7 @@ check_scsi_status:
313 313
314 case SCS_DEVICE_LOGGED_OUT: 314 case SCS_DEVICE_LOGGED_OUT:
315 case SCS_DEVICE_UNAVAILABLE: 315 case SCS_DEVICE_UNAVAILABLE:
316 DEBUG2(printk(KERN_INFO "scsi%ld:%d:%d:%d: SCS_DEVICE " 316 DEBUG2(printk(KERN_INFO "scsi%ld:%d:%d:%llu: SCS_DEVICE "
317 "state: 0x%x\n", ha->host_no, 317 "state: 0x%x\n", ha->host_no,
318 cmd->device->channel, cmd->device->id, 318 cmd->device->channel, cmd->device->id,
319 cmd->device->lun, sts_entry->completionStatus)); 319 cmd->device->lun, sts_entry->completionStatus));
@@ -333,7 +333,7 @@ check_scsi_status:
333 * SCSI Mid-Layer handles device queue full 333 * SCSI Mid-Layer handles device queue full
334 */ 334 */
335 cmd->result = DID_OK << 16 | sts_entry->scsiStatus; 335 cmd->result = DID_OK << 16 | sts_entry->scsiStatus;
336 DEBUG2(printk("scsi%ld:%d:%d: %s: QUEUE FULL detected " 336 DEBUG2(printk("scsi%ld:%d:%llu: %s: QUEUE FULL detected "
337 "compl=%02x, scsi=%02x, state=%02x, iFlags=%02x," 337 "compl=%02x, scsi=%02x, state=%02x, iFlags=%02x,"
338 " iResp=%02x\n", ha->host_no, cmd->device->id, 338 " iResp=%02x\n", ha->host_no, cmd->device->id,
339 cmd->device->lun, __func__, 339 cmd->device->lun, __func__,
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 0a3312c6dd6d..fdfae79924ac 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -1205,7 +1205,7 @@ int qla4xxx_abort_task(struct scsi_qla_host *ha, struct srb *srb)
1205 if (mbox_sts[0] != MBOX_STS_COMMAND_COMPLETE) { 1205 if (mbox_sts[0] != MBOX_STS_COMMAND_COMPLETE) {
1206 status = QLA_ERROR; 1206 status = QLA_ERROR;
1207 1207
1208 DEBUG2(printk(KERN_WARNING "scsi%ld:%d:%d: abort task FAILED: " 1208 DEBUG2(printk(KERN_WARNING "scsi%ld:%d:%llu: abort task FAILED: "
1209 "mbx0=%04X, mb1=%04X, mb2=%04X, mb3=%04X, mb4=%04X\n", 1209 "mbx0=%04X, mb1=%04X, mb2=%04X, mb3=%04X, mb4=%04X\n",
1210 ha->host_no, cmd->device->id, cmd->device->lun, mbox_sts[0], 1210 ha->host_no, cmd->device->id, cmd->device->lun, mbox_sts[0],
1211 mbox_sts[1], mbox_sts[2], mbox_sts[3], mbox_sts[4])); 1211 mbox_sts[1], mbox_sts[2], mbox_sts[3], mbox_sts[4]));
@@ -1225,14 +1225,14 @@ int qla4xxx_abort_task(struct scsi_qla_host *ha, struct srb *srb)
1225 * are valid before calling this routine. 1225 * are valid before calling this routine.
1226 **/ 1226 **/
1227int qla4xxx_reset_lun(struct scsi_qla_host * ha, struct ddb_entry * ddb_entry, 1227int qla4xxx_reset_lun(struct scsi_qla_host * ha, struct ddb_entry * ddb_entry,
1228 int lun) 1228 uint64_t lun)
1229{ 1229{
1230 uint32_t mbox_cmd[MBOX_REG_COUNT]; 1230 uint32_t mbox_cmd[MBOX_REG_COUNT];
1231 uint32_t mbox_sts[MBOX_REG_COUNT]; 1231 uint32_t mbox_sts[MBOX_REG_COUNT];
1232 uint32_t scsi_lun[2]; 1232 uint32_t scsi_lun[2];
1233 int status = QLA_SUCCESS; 1233 int status = QLA_SUCCESS;
1234 1234
1235 DEBUG2(printk("scsi%ld:%d:%d: lun reset issued\n", ha->host_no, 1235 DEBUG2(printk("scsi%ld:%d:%llu: lun reset issued\n", ha->host_no,
1236 ddb_entry->fw_ddb_index, lun)); 1236 ddb_entry->fw_ddb_index, lun));
1237 1237
1238 /* 1238 /*
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 320206376206..c5d9564d455c 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -9223,20 +9223,20 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd)
9223{ 9223{
9224 struct scsi_qla_host *ha = to_qla_host(cmd->device->host); 9224 struct scsi_qla_host *ha = to_qla_host(cmd->device->host);
9225 unsigned int id = cmd->device->id; 9225 unsigned int id = cmd->device->id;
9226 unsigned int lun = cmd->device->lun; 9226 uint64_t lun = cmd->device->lun;
9227 unsigned long flags; 9227 unsigned long flags;
9228 struct srb *srb = NULL; 9228 struct srb *srb = NULL;
9229 int ret = SUCCESS; 9229 int ret = SUCCESS;
9230 int wait = 0; 9230 int wait = 0;
9231 9231
9232 ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%d: Abort command issued cmd=%p, cdb=0x%x\n", 9232 ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%llu: Abort command issued cmd=%p, cdb=0x%x\n",
9233 ha->host_no, id, lun, cmd, cmd->cmnd[0]); 9233 ha->host_no, id, lun, cmd, cmd->cmnd[0]);
9234 9234
9235 spin_lock_irqsave(&ha->hardware_lock, flags); 9235 spin_lock_irqsave(&ha->hardware_lock, flags);
9236 srb = (struct srb *) CMD_SP(cmd); 9236 srb = (struct srb *) CMD_SP(cmd);
9237 if (!srb) { 9237 if (!srb) {
9238 spin_unlock_irqrestore(&ha->hardware_lock, flags); 9238 spin_unlock_irqrestore(&ha->hardware_lock, flags);
9239 ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%d: Specified command has already completed.\n", 9239 ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%llu: Specified command has already completed.\n",
9240 ha->host_no, id, lun); 9240 ha->host_no, id, lun);
9241 return SUCCESS; 9241 return SUCCESS;
9242 } 9242 }
@@ -9244,11 +9244,11 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd)
9244 spin_unlock_irqrestore(&ha->hardware_lock, flags); 9244 spin_unlock_irqrestore(&ha->hardware_lock, flags);
9245 9245
9246 if (qla4xxx_abort_task(ha, srb) != QLA_SUCCESS) { 9246 if (qla4xxx_abort_task(ha, srb) != QLA_SUCCESS) {
9247 DEBUG3(printk("scsi%ld:%d:%d: Abort_task mbx failed.\n", 9247 DEBUG3(printk("scsi%ld:%d:%llu: Abort_task mbx failed.\n",
9248 ha->host_no, id, lun)); 9248 ha->host_no, id, lun));
9249 ret = FAILED; 9249 ret = FAILED;
9250 } else { 9250 } else {
9251 DEBUG3(printk("scsi%ld:%d:%d: Abort_task mbx success.\n", 9251 DEBUG3(printk("scsi%ld:%d:%llu: Abort_task mbx success.\n",
9252 ha->host_no, id, lun)); 9252 ha->host_no, id, lun));
9253 wait = 1; 9253 wait = 1;
9254 } 9254 }
@@ -9258,14 +9258,14 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd)
9258 /* Wait for command to complete */ 9258 /* Wait for command to complete */
9259 if (wait) { 9259 if (wait) {
9260 if (!qla4xxx_eh_wait_on_command(ha, cmd)) { 9260 if (!qla4xxx_eh_wait_on_command(ha, cmd)) {
9261 DEBUG2(printk("scsi%ld:%d:%d: Abort handler timed out\n", 9261 DEBUG2(printk("scsi%ld:%d:%llu: Abort handler timed out\n",
9262 ha->host_no, id, lun)); 9262 ha->host_no, id, lun));
9263 ret = FAILED; 9263 ret = FAILED;
9264 } 9264 }
9265 } 9265 }
9266 9266
9267 ql4_printk(KERN_INFO, ha, 9267 ql4_printk(KERN_INFO, ha,
9268 "scsi%ld:%d:%d: Abort command - %s\n", 9268 "scsi%ld:%d:%llu: Abort command - %s\n",
9269 ha->host_no, id, lun, (ret == SUCCESS) ? "succeeded" : "failed"); 9269 ha->host_no, id, lun, (ret == SUCCESS) ? "succeeded" : "failed");
9270 9270
9271 return ret; 9271 return ret;
@@ -9293,7 +9293,7 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd)
9293 ret = FAILED; 9293 ret = FAILED;
9294 9294
9295 ql4_printk(KERN_INFO, ha, 9295 ql4_printk(KERN_INFO, ha,
9296 "scsi%ld:%d:%d:%d: DEVICE RESET ISSUED.\n", ha->host_no, 9296 "scsi%ld:%d:%d:%llu: DEVICE RESET ISSUED.\n", ha->host_no,
9297 cmd->device->channel, cmd->device->id, cmd->device->lun); 9297 cmd->device->channel, cmd->device->id, cmd->device->lun);
9298 9298
9299 DEBUG2(printk(KERN_INFO 9299 DEBUG2(printk(KERN_INFO
@@ -9323,7 +9323,7 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd)
9323 goto eh_dev_reset_done; 9323 goto eh_dev_reset_done;
9324 9324
9325 ql4_printk(KERN_INFO, ha, 9325 ql4_printk(KERN_INFO, ha,
9326 "scsi(%ld:%d:%d:%d): DEVICE RESET SUCCEEDED.\n", 9326 "scsi(%ld:%d:%d:%llu): DEVICE RESET SUCCEEDED.\n",
9327 ha->host_no, cmd->device->channel, cmd->device->id, 9327 ha->host_no, cmd->device->channel, cmd->device->id,
9328 cmd->device->lun); 9328 cmd->device->lun);
9329 9329
@@ -9440,7 +9440,7 @@ static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd)
9440 } 9440 }
9441 9441
9442 ql4_printk(KERN_INFO, ha, 9442 ql4_printk(KERN_INFO, ha,
9443 "scsi(%ld:%d:%d:%d): HOST RESET ISSUED.\n", ha->host_no, 9443 "scsi(%ld:%d:%d:%llu): HOST RESET ISSUED.\n", ha->host_no,
9444 cmd->device->channel, cmd->device->id, cmd->device->lun); 9444 cmd->device->channel, cmd->device->id, cmd->device->lun);
9445 9445
9446 if (qla4xxx_wait_for_hba_online(ha) != QLA_SUCCESS) { 9446 if (qla4xxx_wait_for_hba_online(ha) != QLA_SUCCESS) {
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 53b8b94e6c84..bff351b526cf 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -1291,7 +1291,7 @@ EXPORT_SYMBOL(__starget_for_each_device);
1291 * really want to use scsi_device_lookup_by_target instead. 1291 * really want to use scsi_device_lookup_by_target instead.
1292 **/ 1292 **/
1293struct scsi_device *__scsi_device_lookup_by_target(struct scsi_target *starget, 1293struct scsi_device *__scsi_device_lookup_by_target(struct scsi_target *starget,
1294 uint lun) 1294 u64 lun)
1295{ 1295{
1296 struct scsi_device *sdev; 1296 struct scsi_device *sdev;
1297 1297
@@ -1316,7 +1316,7 @@ EXPORT_SYMBOL(__scsi_device_lookup_by_target);
1316 * needs to be released with scsi_device_put once you're done with it. 1316 * needs to be released with scsi_device_put once you're done with it.
1317 **/ 1317 **/
1318struct scsi_device *scsi_device_lookup_by_target(struct scsi_target *starget, 1318struct scsi_device *scsi_device_lookup_by_target(struct scsi_target *starget,
1319 uint lun) 1319 u64 lun)
1320{ 1320{
1321 struct scsi_device *sdev; 1321 struct scsi_device *sdev;
1322 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 1322 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
@@ -1349,7 +1349,7 @@ EXPORT_SYMBOL(scsi_device_lookup_by_target);
1349 * really want to use scsi_device_lookup instead. 1349 * really want to use scsi_device_lookup instead.
1350 **/ 1350 **/
1351struct scsi_device *__scsi_device_lookup(struct Scsi_Host *shost, 1351struct scsi_device *__scsi_device_lookup(struct Scsi_Host *shost,
1352 uint channel, uint id, uint lun) 1352 uint channel, uint id, u64 lun)
1353{ 1353{
1354 struct scsi_device *sdev; 1354 struct scsi_device *sdev;
1355 1355
@@ -1375,7 +1375,7 @@ EXPORT_SYMBOL(__scsi_device_lookup);
1375 * needs to be released with scsi_device_put once you're done with it. 1375 * needs to be released with scsi_device_put once you're done with it.
1376 **/ 1376 **/
1377struct scsi_device *scsi_device_lookup(struct Scsi_Host *shost, 1377struct scsi_device *scsi_device_lookup(struct Scsi_Host *shost,
1378 uint channel, uint id, uint lun) 1378 uint channel, uint id, u64 lun)
1379{ 1379{
1380 struct scsi_device *sdev; 1380 struct scsi_device *sdev;
1381 unsigned long flags; 1381 unsigned long flags;
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index c4ad52c2ec69..6ed43fd19a22 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -228,9 +228,9 @@ struct sdebug_dev_info {
228 unsigned char sense_buff[SDEBUG_SENSE_LEN]; /* weak nexus */ 228 unsigned char sense_buff[SDEBUG_SENSE_LEN]; /* weak nexus */
229 unsigned int channel; 229 unsigned int channel;
230 unsigned int target; 230 unsigned int target;
231 unsigned int lun; 231 u64 lun;
232 struct sdebug_host_info *sdbg_host; 232 struct sdebug_host_info *sdbg_host;
233 unsigned int wlun; 233 u64 wlun;
234 char reset; 234 char reset;
235 char stopped; 235 char stopped;
236 char used; 236 char used;
@@ -2278,7 +2278,8 @@ static int resp_report_luns(struct scsi_cmnd * scp,
2278 struct sdebug_dev_info * devip) 2278 struct sdebug_dev_info * devip)
2279{ 2279{
2280 unsigned int alloc_len; 2280 unsigned int alloc_len;
2281 int lun_cnt, i, upper, num, n, wlun, lun; 2281 int lun_cnt, i, upper, num, n;
2282 u64 wlun, lun;
2282 unsigned char *cmd = (unsigned char *)scp->cmnd; 2283 unsigned char *cmd = (unsigned char *)scp->cmnd;
2283 int select_report = (int)cmd[2]; 2284 int select_report = (int)cmd[2];
2284 struct scsi_lun *one_lun; 2285 struct scsi_lun *one_lun;
@@ -2462,7 +2463,7 @@ static struct sdebug_dev_info * devInfoReg(struct scsi_device * sdev)
2462static int scsi_debug_slave_alloc(struct scsi_device *sdp) 2463static int scsi_debug_slave_alloc(struct scsi_device *sdp)
2463{ 2464{
2464 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) 2465 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
2465 printk(KERN_INFO "scsi_debug: slave_alloc <%u %u %u %u>\n", 2466 printk(KERN_INFO "scsi_debug: slave_alloc <%u %u %u %llu>\n",
2466 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun); 2467 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
2467 queue_flag_set_unlocked(QUEUE_FLAG_BIDI, sdp->request_queue); 2468 queue_flag_set_unlocked(QUEUE_FLAG_BIDI, sdp->request_queue);
2468 return 0; 2469 return 0;
@@ -2473,7 +2474,7 @@ static int scsi_debug_slave_configure(struct scsi_device *sdp)
2473 struct sdebug_dev_info *devip; 2474 struct sdebug_dev_info *devip;
2474 2475
2475 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) 2476 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
2476 printk(KERN_INFO "scsi_debug: slave_configure <%u %u %u %u>\n", 2477 printk(KERN_INFO "scsi_debug: slave_configure <%u %u %u %llu>\n",
2477 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun); 2478 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
2478 if (sdp->host->max_cmd_len != SCSI_DEBUG_MAX_CMD_LEN) 2479 if (sdp->host->max_cmd_len != SCSI_DEBUG_MAX_CMD_LEN)
2479 sdp->host->max_cmd_len = SCSI_DEBUG_MAX_CMD_LEN; 2480 sdp->host->max_cmd_len = SCSI_DEBUG_MAX_CMD_LEN;
@@ -2496,7 +2497,7 @@ static void scsi_debug_slave_destroy(struct scsi_device *sdp)
2496 (struct sdebug_dev_info *)sdp->hostdata; 2497 (struct sdebug_dev_info *)sdp->hostdata;
2497 2498
2498 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts) 2499 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
2499 printk(KERN_INFO "scsi_debug: slave_destroy <%u %u %u %u>\n", 2500 printk(KERN_INFO "scsi_debug: slave_destroy <%u %u %u %llu>\n",
2500 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun); 2501 sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
2501 if (devip) { 2502 if (devip) {
2502 /* make this slot available for re-use */ 2503 /* make this slot available for re-use */
@@ -2708,7 +2709,7 @@ static int schedule_resp(struct scsi_cmnd * cmnd,
2708 if (scsi_result) { 2709 if (scsi_result) {
2709 struct scsi_device * sdp = cmnd->device; 2710 struct scsi_device * sdp = cmnd->device;
2710 2711
2711 printk(KERN_INFO "scsi_debug: <%u %u %u %u> " 2712 printk(KERN_INFO "scsi_debug: <%u %u %u %llu> "
2712 "non-zero result=0x%x\n", sdp->host->host_no, 2713 "non-zero result=0x%x\n", sdp->host->host_no,
2713 sdp->channel, sdp->id, sdp->lun, scsi_result); 2714 sdp->channel, sdp->id, sdp->lun, scsi_result);
2714 } 2715 }
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index 48e5b657e79f..a45d1c2eb414 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -115,7 +115,7 @@ extern void scsi_exit_procfs(void);
115extern char scsi_scan_type[]; 115extern char scsi_scan_type[];
116extern int scsi_complete_async_scans(void); 116extern int scsi_complete_async_scans(void);
117extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int, 117extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int,
118 unsigned int, unsigned int, int); 118 unsigned int, u64, int);
119extern void scsi_forget_host(struct Scsi_Host *); 119extern void scsi_forget_host(struct Scsi_Host *);
120extern void scsi_rescan_device(struct device *); 120extern void scsi_rescan_device(struct device *);
121 121
diff --git a/drivers/scsi/scsi_proc.c b/drivers/scsi/scsi_proc.c
index 86f0c5d5c116..6fcefa2da503 100644
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -185,7 +185,7 @@ static int proc_print_scsidevice(struct device *dev, void *data)
185 185
186 sdev = to_scsi_device(dev); 186 sdev = to_scsi_device(dev);
187 seq_printf(s, 187 seq_printf(s,
188 "Host: scsi%d Channel: %02d Id: %02d Lun: %02d\n Vendor: ", 188 "Host: scsi%d Channel: %02d Id: %02d Lun: %02llu\n Vendor: ",
189 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); 189 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
190 for (i = 0; i < 8; i++) { 190 for (i = 0; i < 8; i++) {
191 if (sdev->vendor[i] >= 0x20) 191 if (sdev->vendor[i] >= 0x20)
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index a02f7b0976ed..1a71547832f3 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -220,7 +220,7 @@ static void scsi_unlock_floptical(struct scsi_device *sdev,
220 * scsi_Device pointer, or NULL on failure. 220 * scsi_Device pointer, or NULL on failure.
221 **/ 221 **/
222static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, 222static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
223 unsigned int lun, void *hostdata) 223 u64 lun, void *hostdata)
224{ 224{
225 struct scsi_device *sdev; 225 struct scsi_device *sdev;
226 int display_failure_msg = 1, ret; 226 int display_failure_msg = 1, ret;
@@ -1028,7 +1028,7 @@ static unsigned char *scsi_inq_str(unsigned char *buf, unsigned char *inq,
1028 * SCSI_SCAN_LUN_PRESENT: a new scsi_device was allocated and initialized 1028 * SCSI_SCAN_LUN_PRESENT: a new scsi_device was allocated and initialized
1029 **/ 1029 **/
1030static int scsi_probe_and_add_lun(struct scsi_target *starget, 1030static int scsi_probe_and_add_lun(struct scsi_target *starget,
1031 uint lun, int *bflagsp, 1031 u64 lun, int *bflagsp,
1032 struct scsi_device **sdevp, int rescan, 1032 struct scsi_device **sdevp, int rescan,
1033 void *hostdata) 1033 void *hostdata)
1034{ 1034{
@@ -1181,7 +1181,8 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
1181static void scsi_sequential_lun_scan(struct scsi_target *starget, 1181static void scsi_sequential_lun_scan(struct scsi_target *starget,
1182 int bflags, int scsi_level, int rescan) 1182 int bflags, int scsi_level, int rescan)
1183{ 1183{
1184 unsigned int sparse_lun, lun, max_dev_lun; 1184 uint max_dev_lun;
1185 u64 sparse_lun, lun;
1185 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); 1186 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
1186 1187
1187 SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: Sequential scan of" 1188 SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: Sequential scan of"
@@ -1271,10 +1272,10 @@ static void scsi_sequential_lun_scan(struct scsi_target *starget,
1271 * Given a struct scsi_lun of: 0a 04 0b 03 00 00 00 00, this function returns 1272 * Given a struct scsi_lun of: 0a 04 0b 03 00 00 00 00, this function returns
1272 * the integer: 0x0b030a04 1273 * the integer: 0x0b030a04
1273 **/ 1274 **/
1274int scsilun_to_int(struct scsi_lun *scsilun) 1275u64 scsilun_to_int(struct scsi_lun *scsilun)
1275{ 1276{
1276 int i; 1277 int i;
1277 unsigned int lun; 1278 u64 lun;
1278 1279
1279 lun = 0; 1280 lun = 0;
1280 for (i = 0; i < sizeof(lun); i += 2) 1281 for (i = 0; i < sizeof(lun); i += 2)
@@ -1302,7 +1303,7 @@ EXPORT_SYMBOL(scsilun_to_int);
1302 * scsi_lun of : struct scsi_lun of: 0a 04 0b 03 00 00 00 00 1303 * scsi_lun of : struct scsi_lun of: 0a 04 0b 03 00 00 00 00
1303 * 1304 *
1304 **/ 1305 **/
1305void int_to_scsilun(unsigned int lun, struct scsi_lun *scsilun) 1306void int_to_scsilun(u64 lun, struct scsi_lun *scsilun)
1306{ 1307{
1307 int i; 1308 int i;
1308 1309
@@ -1342,7 +1343,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1342 char devname[64]; 1343 char devname[64];
1343 unsigned char scsi_cmd[MAX_COMMAND_SIZE]; 1344 unsigned char scsi_cmd[MAX_COMMAND_SIZE];
1344 unsigned int length; 1345 unsigned int length;
1345 unsigned int lun; 1346 u64 lun;
1346 unsigned int num_luns; 1347 unsigned int num_luns;
1347 unsigned int retries; 1348 unsigned int retries;
1348 int result; 1349 int result;
@@ -1485,25 +1486,8 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1485 for (lunp = &lun_data[1]; lunp <= &lun_data[num_luns]; lunp++) { 1486 for (lunp = &lun_data[1]; lunp <= &lun_data[num_luns]; lunp++) {
1486 lun = scsilun_to_int(lunp); 1487 lun = scsilun_to_int(lunp);
1487 1488
1488 /* 1489 if (lun > sdev->host->max_lun) {
1489 * Check if the unused part of lunp is non-zero, and so 1490 printk(KERN_WARNING "scsi: %s lun%llu has a LUN larger"
1490 * does not fit in lun.
1491 */
1492 if (memcmp(&lunp->scsi_lun[sizeof(lun)], "\0\0\0\0", 4)) {
1493 int i;
1494
1495 /*
1496 * Output an error displaying the LUN in byte order,
1497 * this differs from what linux would print for the
1498 * integer LUN value.
1499 */
1500 printk(KERN_WARNING "scsi: %s lun 0x", devname);
1501 data = (char *)lunp->scsi_lun;
1502 for (i = 0; i < sizeof(struct scsi_lun); i++)
1503 printk("%02x", data[i]);
1504 printk(" has a LUN larger than currently supported.\n");
1505 } else if (lun > sdev->host->max_lun) {
1506 printk(KERN_WARNING "scsi: %s lun%d has a LUN larger"
1507 " than allowed by the host adapter\n", 1491 " than allowed by the host adapter\n",
1508 devname, lun); 1492 devname, lun);
1509 } else { 1493 } else {
@@ -1517,8 +1501,8 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1517 */ 1501 */
1518 sdev_printk(KERN_ERR, sdev, 1502 sdev_printk(KERN_ERR, sdev,
1519 "Unexpected response" 1503 "Unexpected response"
1520 " from lun %d while scanning, scan" 1504 " from lun %llu while scanning, scan"
1521 " aborted\n", lun); 1505 " aborted\n", (unsigned long long)lun);
1522 break; 1506 break;
1523 } 1507 }
1524 } 1508 }
@@ -1537,7 +1521,7 @@ static int scsi_report_lun_scan(struct scsi_target *starget, int bflags,
1537} 1521}
1538 1522
1539struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel, 1523struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel,
1540 uint id, uint lun, void *hostdata) 1524 uint id, u64 lun, void *hostdata)
1541{ 1525{
1542 struct scsi_device *sdev = ERR_PTR(-ENODEV); 1526 struct scsi_device *sdev = ERR_PTR(-ENODEV);
1543 struct device *parent = &shost->shost_gendev; 1527 struct device *parent = &shost->shost_gendev;
@@ -1573,7 +1557,7 @@ struct scsi_device *__scsi_add_device(struct Scsi_Host *shost, uint channel,
1573EXPORT_SYMBOL(__scsi_add_device); 1557EXPORT_SYMBOL(__scsi_add_device);
1574 1558
1575int scsi_add_device(struct Scsi_Host *host, uint channel, 1559int scsi_add_device(struct Scsi_Host *host, uint channel,
1576 uint target, uint lun) 1560 uint target, u64 lun)
1577{ 1561{
1578 struct scsi_device *sdev = 1562 struct scsi_device *sdev =
1579 __scsi_add_device(host, channel, target, lun, NULL); 1563 __scsi_add_device(host, channel, target, lun, NULL);
@@ -1602,7 +1586,7 @@ void scsi_rescan_device(struct device *dev)
1602EXPORT_SYMBOL(scsi_rescan_device); 1586EXPORT_SYMBOL(scsi_rescan_device);
1603 1587
1604static void __scsi_scan_target(struct device *parent, unsigned int channel, 1588static void __scsi_scan_target(struct device *parent, unsigned int channel,
1605 unsigned int id, unsigned int lun, int rescan) 1589 unsigned int id, u64 lun, int rescan)
1606{ 1590{
1607 struct Scsi_Host *shost = dev_to_shost(parent); 1591 struct Scsi_Host *shost = dev_to_shost(parent);
1608 int bflags = 0; 1592 int bflags = 0;
@@ -1670,7 +1654,7 @@ static void __scsi_scan_target(struct device *parent, unsigned int channel,
1670 * sequential scan of LUNs on the target id. 1654 * sequential scan of LUNs on the target id.
1671 **/ 1655 **/
1672void scsi_scan_target(struct device *parent, unsigned int channel, 1656void scsi_scan_target(struct device *parent, unsigned int channel,
1673 unsigned int id, unsigned int lun, int rescan) 1657 unsigned int id, u64 lun, int rescan)
1674{ 1658{
1675 struct Scsi_Host *shost = dev_to_shost(parent); 1659 struct Scsi_Host *shost = dev_to_shost(parent);
1676 1660
@@ -1690,7 +1674,7 @@ void scsi_scan_target(struct device *parent, unsigned int channel,
1690EXPORT_SYMBOL(scsi_scan_target); 1674EXPORT_SYMBOL(scsi_scan_target);
1691 1675
1692static void scsi_scan_channel(struct Scsi_Host *shost, unsigned int channel, 1676static void scsi_scan_channel(struct Scsi_Host *shost, unsigned int channel,
1693 unsigned int id, unsigned int lun, int rescan) 1677 unsigned int id, u64 lun, int rescan)
1694{ 1678{
1695 uint order_id; 1679 uint order_id;
1696 1680
@@ -1721,10 +1705,10 @@ static void scsi_scan_channel(struct Scsi_Host *shost, unsigned int channel,
1721} 1705}
1722 1706
1723int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel, 1707int scsi_scan_host_selected(struct Scsi_Host *shost, unsigned int channel,
1724 unsigned int id, unsigned int lun, int rescan) 1708 unsigned int id, u64 lun, int rescan)
1725{ 1709{
1726 SCSI_LOG_SCAN_BUS(3, shost_printk (KERN_INFO, shost, 1710 SCSI_LOG_SCAN_BUS(3, shost_printk (KERN_INFO, shost,
1727 "%s: <%u:%u:%u>\n", 1711 "%s: <%u:%u:%llu>\n",
1728 __func__, channel, id, lun)); 1712 __func__, channel, id, lun));
1729 1713
1730 if (((channel != SCAN_WILD_CARD) && (channel > shost->max_channel)) || 1714 if (((channel != SCAN_WILD_CARD) && (channel > shost->max_channel)) ||
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 074e8cc30955..5f36788705ba 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -80,7 +80,7 @@ const char *scsi_host_state_name(enum scsi_host_state state)
80 return name; 80 return name;
81} 81}
82 82
83static int check_set(unsigned int *val, char *src) 83static int check_set(unsigned long long *val, char *src)
84{ 84{
85 char *last; 85 char *last;
86 86
@@ -90,7 +90,7 @@ static int check_set(unsigned int *val, char *src)
90 /* 90 /*
91 * Doesn't check for int overflow 91 * Doesn't check for int overflow
92 */ 92 */
93 *val = simple_strtoul(src, &last, 0); 93 *val = simple_strtoull(src, &last, 0);
94 if (*last != '\0') 94 if (*last != '\0')
95 return 1; 95 return 1;
96 } 96 }
@@ -99,11 +99,11 @@ static int check_set(unsigned int *val, char *src)
99 99
100static int scsi_scan(struct Scsi_Host *shost, const char *str) 100static int scsi_scan(struct Scsi_Host *shost, const char *str)
101{ 101{
102 char s1[15], s2[15], s3[15], junk; 102 char s1[15], s2[15], s3[17], junk;
103 unsigned int channel, id, lun; 103 unsigned long long channel, id, lun;
104 int res; 104 int res;
105 105
106 res = sscanf(str, "%10s %10s %10s %c", s1, s2, s3, &junk); 106 res = sscanf(str, "%10s %10s %16s %c", s1, s2, s3, &junk);
107 if (res != 3) 107 if (res != 3)
108 return -EINVAL; 108 return -EINVAL;
109 if (check_set(&channel, s1)) 109 if (check_set(&channel, s1))
@@ -1230,13 +1230,13 @@ void scsi_sysfs_device_initialize(struct scsi_device *sdev)
1230 device_initialize(&sdev->sdev_gendev); 1230 device_initialize(&sdev->sdev_gendev);
1231 sdev->sdev_gendev.bus = &scsi_bus_type; 1231 sdev->sdev_gendev.bus = &scsi_bus_type;
1232 sdev->sdev_gendev.type = &scsi_dev_type; 1232 sdev->sdev_gendev.type = &scsi_dev_type;
1233 dev_set_name(&sdev->sdev_gendev, "%d:%d:%d:%d", 1233 dev_set_name(&sdev->sdev_gendev, "%d:%d:%d:%llu",
1234 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); 1234 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
1235 1235
1236 device_initialize(&sdev->sdev_dev); 1236 device_initialize(&sdev->sdev_dev);
1237 sdev->sdev_dev.parent = get_device(&sdev->sdev_gendev); 1237 sdev->sdev_dev.parent = get_device(&sdev->sdev_gendev);
1238 sdev->sdev_dev.class = &sdev_class; 1238 sdev->sdev_dev.class = &sdev_class;
1239 dev_set_name(&sdev->sdev_dev, "%d:%d:%d:%d", 1239 dev_set_name(&sdev->sdev_dev, "%d:%d:%d:%llu",
1240 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); 1240 sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
1241 sdev->scsi_level = starget->scsi_level; 1241 sdev->scsi_level = starget->scsi_level;
1242 transport_setup_device(&sdev->sdev_gendev); 1242 transport_setup_device(&sdev->sdev_gendev);
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 521f5838594b..8365705c231d 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -2089,7 +2089,7 @@ fc_timed_out(struct scsi_cmnd *scmd)
2089 * on the rport. 2089 * on the rport.
2090 */ 2090 */
2091static void 2091static void
2092fc_user_scan_tgt(struct Scsi_Host *shost, uint channel, uint id, uint lun) 2092fc_user_scan_tgt(struct Scsi_Host *shost, uint channel, uint id, u64 lun)
2093{ 2093{
2094 struct fc_rport *rport; 2094 struct fc_rport *rport;
2095 unsigned long flags; 2095 unsigned long flags;
@@ -2121,7 +2121,7 @@ fc_user_scan_tgt(struct Scsi_Host *shost, uint channel, uint id, uint lun)
2121 * object as the parent. 2121 * object as the parent.
2122 */ 2122 */
2123static int 2123static int
2124fc_user_scan(struct Scsi_Host *shost, uint channel, uint id, uint lun) 2124fc_user_scan(struct Scsi_Host *shost, uint channel, uint id, u64 lun)
2125{ 2125{
2126 uint chlo, chhi; 2126 uint chlo, chhi;
2127 uint tgtlo, tgthi; 2127 uint tgtlo, tgthi;
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 0102a2d70dd8..126bf260500f 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1780,7 +1780,7 @@ EXPORT_SYMBOL_GPL(iscsi_scan_finished);
1780struct iscsi_scan_data { 1780struct iscsi_scan_data {
1781 unsigned int channel; 1781 unsigned int channel;
1782 unsigned int id; 1782 unsigned int id;
1783 unsigned int lun; 1783 u64 lun;
1784}; 1784};
1785 1785
1786static int iscsi_user_scan_session(struct device *dev, void *data) 1786static int iscsi_user_scan_session(struct device *dev, void *data)
@@ -1827,7 +1827,7 @@ user_scan_exit:
1827} 1827}
1828 1828
1829static int iscsi_user_scan(struct Scsi_Host *shost, uint channel, 1829static int iscsi_user_scan(struct Scsi_Host *shost, uint channel,
1830 uint id, uint lun) 1830 uint id, u64 lun)
1831{ 1831{
1832 struct iscsi_scan_data scan_data; 1832 struct iscsi_scan_data scan_data;
1833 1833
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index c341f855fadc..9a058194b9bd 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -1705,7 +1705,7 @@ EXPORT_SYMBOL(scsi_is_sas_rphy);
1705 */ 1705 */
1706 1706
1707static int sas_user_scan(struct Scsi_Host *shost, uint channel, 1707static int sas_user_scan(struct Scsi_Host *shost, uint channel,
1708 uint id, uint lun) 1708 uint id, u64 lun)
1709{ 1709{
1710 struct sas_host_attrs *sas_host = to_sas_host_attrs(shost); 1710 struct sas_host_attrs *sas_host = to_sas_host_attrs(shost);
1711 struct sas_rphy *rphy; 1711 struct sas_rphy *rphy;
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 2e01a9dd26fa..1de183d72598 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -2542,7 +2542,7 @@ static int sg_proc_seq_show_dev(struct seq_file *s, void *v)
2542 seq_puts(s, "-1\t-1\t-1\t-1\t-1\t-1\t-1\t-1\t-1\n"); 2542 seq_puts(s, "-1\t-1\t-1\t-1\t-1\t-1\t-1\t-1\t-1\n");
2543 else { 2543 else {
2544 scsidp = sdp->device; 2544 scsidp = sdp->device;
2545 seq_printf(s, "%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", 2545 seq_printf(s, "%d\t%d\t%d\t%llu\t%d\t%d\t%d\t%d\t%d\n",
2546 scsidp->host->host_no, scsidp->channel, 2546 scsidp->host->host_no, scsidp->channel,
2547 scsidp->id, scsidp->lun, (int) scsidp->type, 2547 scsidp->id, scsidp->lun, (int) scsidp->type,
2548 1, 2548 1,
@@ -2671,7 +2671,7 @@ static int sg_proc_seq_show_debug(struct seq_file *s, void *v)
2671 else if (sdp->device) { 2671 else if (sdp->device) {
2672 struct scsi_device *scsidp = sdp->device; 2672 struct scsi_device *scsidp = sdp->device;
2673 2673
2674 seq_printf(s, "%d:%d:%d:%d em=%d", 2674 seq_printf(s, "%d:%d:%d:%llu em=%d",
2675 scsidp->host->host_no, 2675 scsidp->host->host_no,
2676 scsidp->channel, scsidp->id, 2676 scsidp->channel, scsidp->id,
2677 scsidp->lun, 2677 scsidp->lun,
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c
index 88220794cc98..1a2367a1b1f2 100644
--- a/drivers/scsi/sun3_NCR5380.c
+++ b/drivers/scsi/sun3_NCR5380.c
@@ -355,17 +355,18 @@ static void __init init_tags( void )
355 355
356static int is_lun_busy(struct scsi_cmnd *cmd, int should_be_tagged) 356static int is_lun_busy(struct scsi_cmnd *cmd, int should_be_tagged)
357{ 357{
358 u8 lun = cmd->device->lun;
358 SETUP_HOSTDATA(cmd->device->host); 359 SETUP_HOSTDATA(cmd->device->host);
359 360
360 if (hostdata->busy[cmd->device->id] & (1 << cmd->device->lun)) 361 if (hostdata->busy[cmd->device->id] & (1 << lun))
361 return( 1 ); 362 return( 1 );
362 if (!should_be_tagged || 363 if (!should_be_tagged ||
363 !setup_use_tagged_queuing || !cmd->device->tagged_supported) 364 !setup_use_tagged_queuing || !cmd->device->tagged_supported)
364 return( 0 ); 365 return( 0 );
365 if (TagAlloc[cmd->device->id][cmd->device->lun].nr_allocated >= 366 if (TagAlloc[cmd->device->id][lun].nr_allocated >=
366 TagAlloc[cmd->device->id][cmd->device->lun].queue_size ) { 367 TagAlloc[cmd->device->id][lun].queue_size ) {
367 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d: no free tags\n", 368 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d: no free tags\n",
368 H_NO(cmd), cmd->device->id, cmd->device->lun ); 369 H_NO(cmd), cmd->device->id, lun );
369 return( 1 ); 370 return( 1 );
370 } 371 }
371 return( 0 ); 372 return( 0 );
@@ -379,6 +380,7 @@ static int is_lun_busy(struct scsi_cmnd *cmd, int should_be_tagged)
379 380
380static void cmd_get_tag(struct scsi_cmnd *cmd, int should_be_tagged) 381static void cmd_get_tag(struct scsi_cmnd *cmd, int should_be_tagged)
381{ 382{
383 u8 lun = cmd->device->lun;
382 SETUP_HOSTDATA(cmd->device->host); 384 SETUP_HOSTDATA(cmd->device->host);
383 385
384 /* If we or the target don't support tagged queuing, allocate the LUN for 386 /* If we or the target don't support tagged queuing, allocate the LUN for
@@ -387,19 +389,19 @@ static void cmd_get_tag(struct scsi_cmnd *cmd, int should_be_tagged)
387 if (!should_be_tagged || 389 if (!should_be_tagged ||
388 !setup_use_tagged_queuing || !cmd->device->tagged_supported) { 390 !setup_use_tagged_queuing || !cmd->device->tagged_supported) {
389 cmd->tag = TAG_NONE; 391 cmd->tag = TAG_NONE;
390 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); 392 hostdata->busy[cmd->device->id] |= (1 << lun);
391 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d now allocated by untagged " 393 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d now allocated by untagged "
392 "command\n", H_NO(cmd), cmd->device->id, cmd->device->lun ); 394 "command\n", H_NO(cmd), cmd->device->id, lun );
393 } 395 }
394 else { 396 else {
395 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun]; 397 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][lun];
396 398
397 cmd->tag = find_first_zero_bit( &ta->allocated, MAX_TAGS ); 399 cmd->tag = find_first_zero_bit( &ta->allocated, MAX_TAGS );
398 set_bit( cmd->tag, &ta->allocated ); 400 set_bit( cmd->tag, &ta->allocated );
399 ta->nr_allocated++; 401 ta->nr_allocated++;
400 dprintk(NDEBUG_TAGS, "scsi%d: using tag %d for target %d lun %d " 402 dprintk(NDEBUG_TAGS, "scsi%d: using tag %d for target %d lun %d "
401 "(now %d tags in use)\n", 403 "(now %d tags in use)\n",
402 H_NO(cmd), cmd->tag, cmd->device->id, cmd->device->lun, 404 H_NO(cmd), cmd->tag, cmd->device->id, lun,
403 ta->nr_allocated ); 405 ta->nr_allocated );
404 } 406 }
405} 407}
@@ -411,23 +413,24 @@ static void cmd_get_tag(struct scsi_cmnd *cmd, int should_be_tagged)
411 413
412static void cmd_free_tag(struct scsi_cmnd *cmd) 414static void cmd_free_tag(struct scsi_cmnd *cmd)
413{ 415{
416 u8 lun = cmd->device->lun;
414 SETUP_HOSTDATA(cmd->device->host); 417 SETUP_HOSTDATA(cmd->device->host);
415 418
416 if (cmd->tag == TAG_NONE) { 419 if (cmd->tag == TAG_NONE) {
417 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 420 hostdata->busy[cmd->device->id] &= ~(1 << lun);
418 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d untagged cmd finished\n", 421 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d untagged cmd finished\n",
419 H_NO(cmd), cmd->device->id, cmd->device->lun ); 422 H_NO(cmd), cmd->device->id, lun );
420 } 423 }
421 else if (cmd->tag >= MAX_TAGS) { 424 else if (cmd->tag >= MAX_TAGS) {
422 printk(KERN_NOTICE "scsi%d: trying to free bad tag %d!\n", 425 printk(KERN_NOTICE "scsi%d: trying to free bad tag %d!\n",
423 H_NO(cmd), cmd->tag ); 426 H_NO(cmd), cmd->tag );
424 } 427 }
425 else { 428 else {
426 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun]; 429 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][lun];
427 clear_bit( cmd->tag, &ta->allocated ); 430 clear_bit( cmd->tag, &ta->allocated );
428 ta->nr_allocated--; 431 ta->nr_allocated--;
429 dprintk(NDEBUG_TAGS, "scsi%d: freed tag %d for target %d lun %d\n", 432 dprintk(NDEBUG_TAGS, "scsi%d: freed tag %d for target %d lun %d\n",
430 H_NO(cmd), cmd->tag, cmd->device->id, cmd->device->lun ); 433 H_NO(cmd), cmd->tag, cmd->device->id, lun );
431 } 434 }
432} 435}
433 436
@@ -659,7 +662,7 @@ static void lprint_Scsi_Cmnd(Scsi_Cmnd *cmd)
659{ 662{
660 int i, s; 663 int i, s;
661 unsigned char *command; 664 unsigned char *command;
662 printk("scsi%d: destination target %d, lun %d\n", 665 printk("scsi%d: destination target %d, lun %llu\n",
663 H_NO(cmd), cmd->device->id, cmd->device->lun); 666 H_NO(cmd), cmd->device->id, cmd->device->lun);
664 printk(KERN_CONT " command = "); 667 printk(KERN_CONT " command = ");
665 command = cmd->cmnd; 668 command = cmd->cmnd;
@@ -705,7 +708,7 @@ static void show_Scsi_Cmnd(Scsi_Cmnd *cmd, struct seq_file *m)
705{ 708{
706 int i, s; 709 int i, s;
707 unsigned char *command; 710 unsigned char *command;
708 seq_printf(m, "scsi%d: destination target %d, lun %d\n", 711 seq_printf(m, "scsi%d: destination target %d, lun %llu\n",
709 H_NO(cmd), cmd->device->id, cmd->device->lun); 712 H_NO(cmd), cmd->device->id, cmd->device->lun);
710 seq_printf(m, " command = "); 713 seq_printf(m, " command = ");
711 command = cmd->cmnd; 714 command = cmd->cmnd;
@@ -1007,7 +1010,7 @@ static void NCR5380_main (struct work_struct *bl)
1007 prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp) ) { 1010 prev = NULL; tmp; prev = tmp, tmp = NEXT(tmp) ) {
1008 1011
1009 if (prev != tmp) 1012 if (prev != tmp)
1010 dprintk(NDEBUG_LISTS, "MAIN tmp=%p target=%d busy=%d lun=%d\n", tmp, tmp->device->id, hostdata->busy[tmp->device->id], tmp->device->lun); 1013 dprintk(NDEBUG_LISTS, "MAIN tmp=%p target=%d busy=%d lun=%llu\n", tmp, tmp->device->id, hostdata->busy[tmp->device->id], tmp->device->lun);
1011 /* When we find one, remove it from the issue queue. */ 1014 /* When we find one, remove it from the issue queue. */
1012 /* ++guenther: possible race with Falcon locking */ 1015 /* ++guenther: possible race with Falcon locking */
1013 if ( 1016 if (
@@ -1038,7 +1041,7 @@ static void NCR5380_main (struct work_struct *bl)
1038 * issue queue so we can keep trying. 1041 * issue queue so we can keep trying.
1039 */ 1042 */
1040 dprintk(NDEBUG_MAIN, "scsi%d: main(): command for target %d " 1043 dprintk(NDEBUG_MAIN, "scsi%d: main(): command for target %d "
1041 "lun %d removed from issue_queue\n", 1044 "lun %llu removed from issue_queue\n",
1042 HOSTNO, tmp->device->id, tmp->device->lun); 1045 HOSTNO, tmp->device->id, tmp->device->lun);
1043 /* 1046 /*
1044 * REQUEST SENSE commands are issued without tagged 1047 * REQUEST SENSE commands are issued without tagged
@@ -2020,7 +2023,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
2020 * accesses to this device will use the 2023 * accesses to this device will use the
2021 * polled-IO. */ 2024 * polled-IO. */
2022 printk(KERN_NOTICE "scsi%d: switching target %d " 2025 printk(KERN_NOTICE "scsi%d: switching target %d "
2023 "lun %d to slow handshake\n", HOSTNO, 2026 "lun %llu to slow handshake\n", HOSTNO,
2024 cmd->device->id, cmd->device->lun); 2027 cmd->device->id, cmd->device->lun);
2025 cmd->device->borken = 1; 2028 cmd->device->borken = 1;
2026 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE | 2029 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE |
@@ -2078,7 +2081,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
2078 /* Accept message by clearing ACK */ 2081 /* Accept message by clearing ACK */
2079 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2082 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2080 2083
2081 dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %d linked command " 2084 dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %llu linked command "
2082 "complete.\n", HOSTNO, cmd->device->id, cmd->device->lun); 2085 "complete.\n", HOSTNO, cmd->device->id, cmd->device->lun);
2083 2086
2084 /* Enable reselect interrupts */ 2087 /* Enable reselect interrupts */
@@ -2090,7 +2093,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
2090 */ 2093 */
2091 2094
2092 if (!cmd->next_link) { 2095 if (!cmd->next_link) {
2093 printk(KERN_NOTICE "scsi%d: target %d lun %d " 2096 printk(KERN_NOTICE "scsi%d: target %d lun %llu "
2094 "linked command complete, no next_link\n", 2097 "linked command complete, no next_link\n",
2095 HOSTNO, cmd->device->id, cmd->device->lun); 2098 HOSTNO, cmd->device->id, cmd->device->lun);
2096 sink = 1; 2099 sink = 1;
@@ -2103,7 +2106,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
2103 * and don't free it! */ 2106 * and don't free it! */
2104 cmd->next_link->tag = cmd->tag; 2107 cmd->next_link->tag = cmd->tag;
2105 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8); 2108 cmd->result = cmd->SCp.Status | (cmd->SCp.Message << 8);
2106 dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %d linked request " 2109 dprintk(NDEBUG_LINKED, "scsi%d: target %d lun %llu linked request "
2107 "done, calling scsi_done().\n", 2110 "done, calling scsi_done().\n",
2108 HOSTNO, cmd->device->id, cmd->device->lun); 2111 HOSTNO, cmd->device->id, cmd->device->lun);
2109#ifdef NCR5380_STATS 2112#ifdef NCR5380_STATS
@@ -2118,7 +2121,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
2118 /* Accept message by clearing ACK */ 2121 /* Accept message by clearing ACK */
2119 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE); 2122 NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
2120 hostdata->connected = NULL; 2123 hostdata->connected = NULL;
2121 dprintk(NDEBUG_QUEUES, "scsi%d: command for target %d, lun %d " 2124 dprintk(NDEBUG_QUEUES, "scsi%d: command for target %d, lun %llu "
2122 "completed\n", HOSTNO, cmd->device->id, cmd->device->lun); 2125 "completed\n", HOSTNO, cmd->device->id, cmd->device->lun);
2123#ifdef SUPPORT_TAGS 2126#ifdef SUPPORT_TAGS
2124 cmd_free_tag( cmd ); 2127 cmd_free_tag( cmd );
@@ -2132,7 +2135,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
2132 /* ++Andreas: the mid level code knows about 2135 /* ++Andreas: the mid level code knows about
2133 QUEUE_FULL now. */ 2136 QUEUE_FULL now. */
2134 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun]; 2137 TAG_ALLOC *ta = &TagAlloc[cmd->device->id][cmd->device->lun];
2135 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d returned " 2138 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %llu returned "
2136 "QUEUE_FULL after %d commands\n", 2139 "QUEUE_FULL after %d commands\n",
2137 HOSTNO, cmd->device->id, cmd->device->lun, 2140 HOSTNO, cmd->device->id, cmd->device->lun,
2138 ta->nr_allocated); 2141 ta->nr_allocated);
@@ -2228,7 +2231,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
2228 cmd->device->tagged_supported = 0; 2231 cmd->device->tagged_supported = 0;
2229 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); 2232 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun);
2230 cmd->tag = TAG_NONE; 2233 cmd->tag = TAG_NONE;
2231 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %d rejected " 2234 dprintk(NDEBUG_TAGS, "scsi%d: target %d lun %llu rejected "
2232 "QUEUE_TAG message; tagged queuing " 2235 "QUEUE_TAG message; tagged queuing "
2233 "disabled\n", 2236 "disabled\n",
2234 HOSTNO, cmd->device->id, cmd->device->lun); 2237 HOSTNO, cmd->device->id, cmd->device->lun);
@@ -2245,7 +2248,7 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
2245 hostdata->connected = NULL; 2248 hostdata->connected = NULL;
2246 hostdata->disconnected_queue = cmd; 2249 hostdata->disconnected_queue = cmd;
2247 local_irq_restore(flags); 2250 local_irq_restore(flags);
2248 dprintk(NDEBUG_QUEUES, "scsi%d: command for target %d lun %d was " 2251 dprintk(NDEBUG_QUEUES, "scsi%d: command for target %d lun %llu was "
2249 "moved from connected to the " 2252 "moved from connected to the "
2250 "disconnected_queue\n", HOSTNO, 2253 "disconnected_queue\n", HOSTNO,
2251 cmd->device->id, cmd->device->lun); 2254 cmd->device->id, cmd->device->lun);
@@ -2349,12 +2352,12 @@ static void NCR5380_information_transfer (struct Scsi_Host *instance)
2349 printk("\n"); 2352 printk("\n");
2350 } else if (tmp != EXTENDED_MESSAGE) 2353 } else if (tmp != EXTENDED_MESSAGE)
2351 printk(KERN_DEBUG "scsi%d: rejecting unknown " 2354 printk(KERN_DEBUG "scsi%d: rejecting unknown "
2352 "message %02x from target %d, lun %d\n", 2355 "message %02x from target %d, lun %llu\n",
2353 HOSTNO, tmp, cmd->device->id, cmd->device->lun); 2356 HOSTNO, tmp, cmd->device->id, cmd->device->lun);
2354 else 2357 else
2355 printk(KERN_DEBUG "scsi%d: rejecting unknown " 2358 printk(KERN_DEBUG "scsi%d: rejecting unknown "
2356 "extended message " 2359 "extended message "
2357 "code %02x, length %d from target %d, lun %d\n", 2360 "code %02x, length %d from target %d, lun %llu\n",
2358 HOSTNO, extended_msg[1], extended_msg[0], 2361 HOSTNO, extended_msg[1], extended_msg[0],
2359 cmd->device->id, cmd->device->lun); 2362 cmd->device->id, cmd->device->lun);
2360 2363
@@ -2576,7 +2579,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
2576#endif 2579#endif
2577 2580
2578 hostdata->connected = tmp; 2581 hostdata->connected = tmp;
2579 dprintk(NDEBUG_RESELECTION, "scsi%d: nexus established, target = %d, lun = %d, tag = %d\n", 2582 dprintk(NDEBUG_RESELECTION, "scsi%d: nexus established, target = %d, lun = %llu, tag = %d\n",
2580 HOSTNO, tmp->device->id, tmp->device->lun, tmp->tag); 2583 HOSTNO, tmp->device->id, tmp->device->lun, tmp->tag);
2581} 2584}
2582 2585
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 6d3ee1ab6362..e59e6f96b725 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -851,7 +851,7 @@ static void sym53c8xx_slave_destroy(struct scsi_device *sdev)
851 * so let's try to stop all on-going I/O. 851 * so let's try to stop all on-going I/O.
852 */ 852 */
853 starget_printk(KERN_WARNING, tp->starget, 853 starget_printk(KERN_WARNING, tp->starget,
854 "Removing busy LCB (%d)\n", sdev->lun); 854 "Removing busy LCB (%d)\n", (u8)sdev->lun);
855 sym_reset_scsi_bus(np, 1); 855 sym_reset_scsi_bus(np, 1);
856 } 856 }
857 857
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h
index 5a80cbac3f92..a141b1758033 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.h
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h
@@ -581,7 +581,7 @@ struct sym_pmc {
581#define sym_lp(tp, lun) (!lun) ? (tp)->lun0p : NULL 581#define sym_lp(tp, lun) (!lun) ? (tp)->lun0p : NULL
582#else 582#else
583#define sym_lp(tp, lun) \ 583#define sym_lp(tp, lun) \
584 (!lun) ? (tp)->lun0p : (tp)->lunmp ? (tp)->lunmp[(lun)] : NULL 584 (!lun) ? (tp)->lun0p : (tp)->lunmp ? (tp)->lunmp[((u8)lun)] : NULL
585#endif 585#endif
586 586
587/* 587/*
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c
index b006cf789ba1..764575726c85 100644
--- a/drivers/scsi/tmscsim.c
+++ b/drivers/scsi/tmscsim.c
@@ -621,7 +621,7 @@ dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_sr
621 { 621 {
622 dc390_freetag (pDCB, pSRB); 622 dc390_freetag (pDCB, pSRB);
623 DEBUG0(printk ("DC390: Interrupt during Start SCSI (target %02i-%02i)\n", 623 DEBUG0(printk ("DC390: Interrupt during Start SCSI (target %02i-%02i)\n",
624 scmd->device->id, scmd->device->lun)); 624 scmd->device->id, (u8)scmd->device->lun));
625 pSRB->SRBState = SRB_READY; 625 pSRB->SRBState = SRB_READY;
626 //DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); 626 //DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD);
627 pACB->SelLost++; 627 pACB->SelLost++;
@@ -1726,7 +1726,7 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb*
1726 } else { 1726 } else {
1727 SET_RES_DRV(pcmd->result, DRIVER_SENSE); 1727 SET_RES_DRV(pcmd->result, DRIVER_SENSE);
1728 //pSRB->ScsiCmdLen = (u8) (pSRB->Segment1[0] >> 8); 1728 //pSRB->ScsiCmdLen = (u8) (pSRB->Segment1[0] >> 8);
1729 DEBUG0 (printk ("DC390: RETRY (%02x), target %02i-%02i\n", pcmd->cmnd[0], pcmd->device->id, pcmd->device->lun)); 1729 DEBUG0 (printk ("DC390: RETRY (%02x), target %02i-%02i\n", pcmd->cmnd[0], pcmd->device->id, (u8)pcmd->device->lun));
1730 pSRB->TotalXferredLen = 0; 1730 pSRB->TotalXferredLen = 0;
1731 SET_RES_DID(pcmd->result, DID_SOFT_ERROR); 1731 SET_RES_DID(pcmd->result, DID_SOFT_ERROR);
1732 } 1732 }
@@ -1746,7 +1746,7 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb*
1746 else if (status == SAM_STAT_TASK_SET_FULL) 1746 else if (status == SAM_STAT_TASK_SET_FULL)
1747 { 1747 {
1748 scsi_track_queue_full(pcmd->device, pDCB->GoingSRBCnt - 1); 1748 scsi_track_queue_full(pcmd->device, pDCB->GoingSRBCnt - 1);
1749 DEBUG0 (printk ("DC390: RETRY (%02x), target %02i-%02i\n", pcmd->cmnd[0], pcmd->device->id, pcmd->device->lun)); 1749 DEBUG0 (printk ("DC390: RETRY (%02x), target %02i-%02i\n", pcmd->cmnd[0], pcmd->device->id, (u8)pcmd->device->lun));
1750 pSRB->TotalXferredLen = 0; 1750 pSRB->TotalXferredLen = 0;
1751 SET_RES_DID(pcmd->result, DID_SOFT_ERROR); 1751 SET_RES_DID(pcmd->result, DID_SOFT_ERROR);
1752 } 1752 }
diff --git a/drivers/scsi/u14-34f.c b/drivers/scsi/u14-34f.c
index 5a03bb3bcfef..4e76fe863fc4 100644
--- a/drivers/scsi/u14-34f.c
+++ b/drivers/scsi/u14-34f.c
@@ -1285,14 +1285,14 @@ static int u14_34f_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct
1285 cpp->cpp_index = i; 1285 cpp->cpp_index = i;
1286 SCpnt->host_scribble = (unsigned char *) &cpp->cpp_index; 1286 SCpnt->host_scribble = (unsigned char *) &cpp->cpp_index;
1287 1287
1288 if (do_trace) printk("%s: qcomm, mbox %d, target %d.%d:%d.\n", 1288 if (do_trace) printk("%s: qcomm, mbox %d, target %d.%d:%llu.\n",
1289 BN(j), i, SCpnt->device->channel, SCpnt->device->id, 1289 BN(j), i, SCpnt->device->channel, SCpnt->device->id,
1290 SCpnt->device->lun); 1290 (u8)SCpnt->device->lun);
1291 1291
1292 cpp->opcode = OP_SCSI; 1292 cpp->opcode = OP_SCSI;
1293 cpp->channel = SCpnt->device->channel; 1293 cpp->channel = SCpnt->device->channel;
1294 cpp->target = SCpnt->device->id; 1294 cpp->target = SCpnt->device->id;
1295 cpp->lun = SCpnt->device->lun; 1295 cpp->lun = (u8)SCpnt->device->lun;
1296 cpp->SCpnt = SCpnt; 1296 cpp->SCpnt = SCpnt;
1297 cpp->cdb_len = SCpnt->cmd_len; 1297 cpp->cdb_len = SCpnt->cmd_len;
1298 memcpy(cpp->cdb, SCpnt->cmnd, SCpnt->cmd_len); 1298 memcpy(cpp->cdb, SCpnt->cmnd, SCpnt->cmd_len);
@@ -1663,10 +1663,10 @@ static int reorder(unsigned int j, unsigned long cursec,
1663 if (link_statistics && (overlap || !(flushcount % link_statistics))) 1663 if (link_statistics && (overlap || !(flushcount % link_statistics)))
1664 for (n = 0; n < n_ready; n++) { 1664 for (n = 0; n < n_ready; n++) {
1665 k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt; 1665 k = il[n]; cpp = &HD(j)->cp[k]; SCpnt = cpp->SCpnt;
1666 printk("%s %d.%d:%d mb %d fc %d nr %d sec %ld ns %u"\ 1666 printk("%s %d.%d:%llu mb %d fc %d nr %d sec %ld ns %u"\
1667 " cur %ld s:%c r:%c rev:%c in:%c ov:%c xd %d.\n", 1667 " cur %ld s:%c r:%c rev:%c in:%c ov:%c xd %d.\n",
1668 (ihdlr ? "ihdlr" : "qcomm"), SCpnt->channel, SCpnt->target, 1668 (ihdlr ? "ihdlr" : "qcomm"), SCpnt->channel, SCpnt->target,
1669 SCpnt->lun, k, flushcount, n_ready, 1669 (u8)SCpnt->lun, k, flushcount, n_ready,
1670 blk_rq_pos(SCpnt->request), blk_rq_sectors(SCpnt->request), 1670 blk_rq_pos(SCpnt->request), blk_rq_sectors(SCpnt->request),
1671 cursec, YESNO(s), YESNO(r), YESNO(rev), YESNO(input_only), 1671 cursec, YESNO(s), YESNO(r), YESNO(rev), YESNO(input_only),
1672 YESNO(overlap), cpp->xdir); 1672 YESNO(overlap), cpp->xdir);
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c
index 41883a87931d..c0506de4f3b6 100644
--- a/drivers/scsi/wd33c93.c
+++ b/drivers/scsi/wd33c93.c
@@ -502,7 +502,8 @@ wd33c93_execute(struct Scsi_Host *instance)
502 cmd = (struct scsi_cmnd *) hostdata->input_Q; 502 cmd = (struct scsi_cmnd *) hostdata->input_Q;
503 prev = NULL; 503 prev = NULL;
504 while (cmd) { 504 while (cmd) {
505 if (!(hostdata->busy[cmd->device->id] & (1 << cmd->device->lun))) 505 if (!(hostdata->busy[cmd->device->id] &
506 (1 << (cmd->device->lun & 0xff))))
506 break; 507 break;
507 prev = cmd; 508 prev = cmd;
508 cmd = (struct scsi_cmnd *) cmd->host_scribble; 509 cmd = (struct scsi_cmnd *) cmd->host_scribble;
@@ -593,10 +594,10 @@ wd33c93_execute(struct Scsi_Host *instance)
593 594
594 write_wd33c93(regs, WD_SOURCE_ID, ((cmd->SCp.phase) ? SRCID_ER : 0)); 595 write_wd33c93(regs, WD_SOURCE_ID, ((cmd->SCp.phase) ? SRCID_ER : 0));
595 596
596 write_wd33c93(regs, WD_TARGET_LUN, cmd->device->lun); 597 write_wd33c93(regs, WD_TARGET_LUN, (u8)cmd->device->lun);
597 write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER, 598 write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER,
598 hostdata->sync_xfer[cmd->device->id]); 599 hostdata->sync_xfer[cmd->device->id]);
599 hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); 600 hostdata->busy[cmd->device->id] |= (1 << (cmd->device->lun & 0xFF));
600 601
601 if ((hostdata->level2 == L2_NONE) || 602 if ((hostdata->level2 == L2_NONE) ||
602 (hostdata->sync_stat[cmd->device->id] == SS_UNSET)) { 603 (hostdata->sync_stat[cmd->device->id] == SS_UNSET)) {
@@ -862,7 +863,7 @@ wd33c93_intr(struct Scsi_Host *instance)
862 } 863 }
863 864
864 cmd->result = DID_NO_CONNECT << 16; 865 cmd->result = DID_NO_CONNECT << 16;
865 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 866 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
866 hostdata->state = S_UNCONNECTED; 867 hostdata->state = S_UNCONNECTED;
867 cmd->scsi_done(cmd); 868 cmd->scsi_done(cmd);
868 869
@@ -895,7 +896,7 @@ wd33c93_intr(struct Scsi_Host *instance)
895 896
896 /* construct an IDENTIFY message with correct disconnect bit */ 897 /* construct an IDENTIFY message with correct disconnect bit */
897 898
898 hostdata->outgoing_msg[0] = (0x80 | 0x00 | cmd->device->lun); 899 hostdata->outgoing_msg[0] = IDENTIFY(0, cmd->device->lun);
899 if (cmd->SCp.phase) 900 if (cmd->SCp.phase)
900 hostdata->outgoing_msg[0] |= 0x40; 901 hostdata->outgoing_msg[0] |= 0x40;
901 902
@@ -1179,7 +1180,7 @@ wd33c93_intr(struct Scsi_Host *instance)
1179 lun = read_wd33c93(regs, WD_TARGET_LUN); 1180 lun = read_wd33c93(regs, WD_TARGET_LUN);
1180 DB(DB_INTR, printk(":%d.%d", cmd->SCp.Status, lun)) 1181 DB(DB_INTR, printk(":%d.%d", cmd->SCp.Status, lun))
1181 hostdata->connected = NULL; 1182 hostdata->connected = NULL;
1182 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 1183 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
1183 hostdata->state = S_UNCONNECTED; 1184 hostdata->state = S_UNCONNECTED;
1184 if (cmd->SCp.Status == ILLEGAL_STATUS_BYTE) 1185 if (cmd->SCp.Status == ILLEGAL_STATUS_BYTE)
1185 cmd->SCp.Status = lun; 1186 cmd->SCp.Status = lun;
@@ -1268,7 +1269,7 @@ wd33c93_intr(struct Scsi_Host *instance)
1268 } 1269 }
1269 DB(DB_INTR, printk("UNEXP_DISC")) 1270 DB(DB_INTR, printk("UNEXP_DISC"))
1270 hostdata->connected = NULL; 1271 hostdata->connected = NULL;
1271 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 1272 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
1272 hostdata->state = S_UNCONNECTED; 1273 hostdata->state = S_UNCONNECTED;
1273 if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD) 1274 if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD)
1274 cmd->result = 1275 cmd->result =
@@ -1300,7 +1301,7 @@ wd33c93_intr(struct Scsi_Host *instance)
1300 switch (hostdata->state) { 1301 switch (hostdata->state) {
1301 case S_PRE_CMP_DISC: 1302 case S_PRE_CMP_DISC:
1302 hostdata->connected = NULL; 1303 hostdata->connected = NULL;
1303 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 1304 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
1304 hostdata->state = S_UNCONNECTED; 1305 hostdata->state = S_UNCONNECTED;
1305 DB(DB_INTR, printk(":%d", cmd->SCp.Status)) 1306 DB(DB_INTR, printk(":%d", cmd->SCp.Status))
1306 if (cmd->cmnd[0] == REQUEST_SENSE 1307 if (cmd->cmnd[0] == REQUEST_SENSE
@@ -1353,7 +1354,7 @@ wd33c93_intr(struct Scsi_Host *instance)
1353 if (hostdata->selecting) { 1354 if (hostdata->selecting) {
1354 cmd = (struct scsi_cmnd *) hostdata->selecting; 1355 cmd = (struct scsi_cmnd *) hostdata->selecting;
1355 hostdata->selecting = NULL; 1356 hostdata->selecting = NULL;
1356 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 1357 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
1357 cmd->host_scribble = 1358 cmd->host_scribble =
1358 (uchar *) hostdata->input_Q; 1359 (uchar *) hostdata->input_Q;
1359 hostdata->input_Q = cmd; 1360 hostdata->input_Q = cmd;
@@ -1365,7 +1366,7 @@ wd33c93_intr(struct Scsi_Host *instance)
1365 if (cmd) { 1366 if (cmd) {
1366 if (phs == 0x00) { 1367 if (phs == 0x00) {
1367 hostdata->busy[cmd->device->id] &= 1368 hostdata->busy[cmd->device->id] &=
1368 ~(1 << cmd->device->lun); 1369 ~(1 << (cmd->device->lun & 0xff));
1369 cmd->host_scribble = 1370 cmd->host_scribble =
1370 (uchar *) hostdata->input_Q; 1371 (uchar *) hostdata->input_Q;
1371 hostdata->input_Q = cmd; 1372 hostdata->input_Q = cmd;
@@ -1448,7 +1449,7 @@ wd33c93_intr(struct Scsi_Host *instance)
1448 cmd = (struct scsi_cmnd *) hostdata->disconnected_Q; 1449 cmd = (struct scsi_cmnd *) hostdata->disconnected_Q;
1449 patch = NULL; 1450 patch = NULL;
1450 while (cmd) { 1451 while (cmd) {
1451 if (id == cmd->device->id && lun == cmd->device->lun) 1452 if (id == cmd->device->id && lun == (u8)cmd->device->lun)
1452 break; 1453 break;
1453 patch = cmd; 1454 patch = cmd;
1454 cmd = (struct scsi_cmnd *) cmd->host_scribble; 1455 cmd = (struct scsi_cmnd *) cmd->host_scribble;
@@ -1459,7 +1460,7 @@ wd33c93_intr(struct Scsi_Host *instance)
1459 if (!cmd) { 1460 if (!cmd) {
1460 printk 1461 printk
1461 ("---TROUBLE: target %d.%d not in disconnect queue---", 1462 ("---TROUBLE: target %d.%d not in disconnect queue---",
1462 id, lun); 1463 id, (u8)lun);
1463 spin_unlock_irqrestore(&hostdata->lock, flags); 1464 spin_unlock_irqrestore(&hostdata->lock, flags);
1464 return; 1465 return;
1465 } 1466 }
@@ -1705,7 +1706,7 @@ wd33c93_abort(struct scsi_cmnd * cmd)
1705 sr = read_wd33c93(regs, WD_SCSI_STATUS); 1706 sr = read_wd33c93(regs, WD_SCSI_STATUS);
1706 printk("asr=%02x, sr=%02x.", asr, sr); 1707 printk("asr=%02x, sr=%02x.", asr, sr);
1707 1708
1708 hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); 1709 hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff));
1709 hostdata->connected = NULL; 1710 hostdata->connected = NULL;
1710 hostdata->state = S_UNCONNECTED; 1711 hostdata->state = S_UNCONNECTED;
1711 cmd->result = DID_ABORT << 16; 1712 cmd->result = DID_ABORT << 16;
@@ -2169,7 +2170,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
2169 seq_printf(m, "\nconnected: "); 2170 seq_printf(m, "\nconnected: ");
2170 if (hd->connected) { 2171 if (hd->connected) {
2171 cmd = (struct scsi_cmnd *) hd->connected; 2172 cmd = (struct scsi_cmnd *) hd->connected;
2172 seq_printf(m, " %d:%d(%02x)", 2173 seq_printf(m, " %d:%llu(%02x)",
2173 cmd->device->id, cmd->device->lun, cmd->cmnd[0]); 2174 cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
2174 } 2175 }
2175 } 2176 }
@@ -2177,7 +2178,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
2177 seq_printf(m, "\ninput_Q: "); 2178 seq_printf(m, "\ninput_Q: ");
2178 cmd = (struct scsi_cmnd *) hd->input_Q; 2179 cmd = (struct scsi_cmnd *) hd->input_Q;
2179 while (cmd) { 2180 while (cmd) {
2180 seq_printf(m, " %d:%d(%02x)", 2181 seq_printf(m, " %d:%llu(%02x)",
2181 cmd->device->id, cmd->device->lun, cmd->cmnd[0]); 2182 cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
2182 cmd = (struct scsi_cmnd *) cmd->host_scribble; 2183 cmd = (struct scsi_cmnd *) cmd->host_scribble;
2183 } 2184 }
@@ -2186,7 +2187,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance)
2186 seq_printf(m, "\ndisconnected_Q:"); 2187 seq_printf(m, "\ndisconnected_Q:");
2187 cmd = (struct scsi_cmnd *) hd->disconnected_Q; 2188 cmd = (struct scsi_cmnd *) hd->disconnected_Q;
2188 while (cmd) { 2189 while (cmd) {
2189 seq_printf(m, " %d:%d(%02x)", 2190 seq_printf(m, " %d:%llu(%02x)",
2190 cmd->device->id, cmd->device->lun, cmd->cmnd[0]); 2191 cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
2191 cmd = (struct scsi_cmnd *) cmd->host_scribble; 2192 cmd = (struct scsi_cmnd *) cmd->host_scribble;
2192 } 2193 }
diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index c0a0e6010372..77020905a73a 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -465,14 +465,14 @@ static int rtsx_control_thread(void *__dev)
465 else if (chip->srb->device->id) { 465 else if (chip->srb->device->id) {
466 dev_err(&dev->pci->dev, "Bad target number (%d:%d)\n", 466 dev_err(&dev->pci->dev, "Bad target number (%d:%d)\n",
467 chip->srb->device->id, 467 chip->srb->device->id,
468 chip->srb->device->lun); 468 (u8)chip->srb->device->lun);
469 chip->srb->result = DID_BAD_TARGET << 16; 469 chip->srb->result = DID_BAD_TARGET << 16;
470 } 470 }
471 471
472 else if (chip->srb->device->lun > chip->max_lun) { 472 else if (chip->srb->device->lun > chip->max_lun) {
473 dev_err(&dev->pci->dev, "Bad LUN (%d:%d)\n", 473 dev_err(&dev->pci->dev, "Bad LUN (%d:%d)\n",
474 chip->srb->device->id, 474 chip->srb->device->id,
475 chip->srb->device->lun); 475 (u8)chip->srb->device->lun);
476 chip->srb->result = DID_BAD_TARGET << 16; 476 chip->srb->result = DID_BAD_TARGET << 16;
477 } 477 }
478 478
diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c
index 8c64b8776a96..340de9d92b15 100644
--- a/drivers/target/loopback/tcm_loop.c
+++ b/drivers/target/loopback/tcm_loop.c
@@ -252,7 +252,7 @@ static int tcm_loop_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc)
252{ 252{
253 struct tcm_loop_cmd *tl_cmd; 253 struct tcm_loop_cmd *tl_cmd;
254 254
255 pr_debug("tcm_loop_queuecommand() %d:%d:%d:%d got CDB: 0x%02x" 255 pr_debug("tcm_loop_queuecommand() %d:%d:%d:%llu got CDB: 0x%02x"
256 " scsi_buf_len: %u\n", sc->device->host->host_no, 256 " scsi_buf_len: %u\n", sc->device->host->host_no,
257 sc->device->id, sc->device->channel, sc->device->lun, 257 sc->device->id, sc->device->channel, sc->device->lun,
258 sc->cmnd[0], scsi_bufflen(sc)); 258 sc->cmnd[0], scsi_bufflen(sc));
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 94d00df28f39..943b1dbe859a 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -312,7 +312,7 @@ static int pscsi_add_device_to_list(struct se_device *dev,
312 if (!sd->queue_depth) { 312 if (!sd->queue_depth) {
313 sd->queue_depth = PSCSI_DEFAULT_QUEUEDEPTH; 313 sd->queue_depth = PSCSI_DEFAULT_QUEUEDEPTH;
314 314
315 pr_err("Set broken SCSI Device %d:%d:%d" 315 pr_err("Set broken SCSI Device %d:%d:%llu"
316 " queue_depth to %d\n", sd->channel, sd->id, 316 " queue_depth to %d\n", sd->channel, sd->id,
317 sd->lun, sd->queue_depth); 317 sd->lun, sd->queue_depth);
318 } 318 }
@@ -375,7 +375,7 @@ static int pscsi_create_type_disk(struct se_device *dev, struct scsi_device *sd)
375 int ret; 375 int ret;
376 376
377 if (scsi_device_get(sd)) { 377 if (scsi_device_get(sd)) {
378 pr_err("scsi_device_get() failed for %d:%d:%d:%d\n", 378 pr_err("scsi_device_get() failed for %d:%d:%d:%llu\n",
379 sh->host_no, sd->channel, sd->id, sd->lun); 379 sh->host_no, sd->channel, sd->id, sd->lun);
380 spin_unlock_irq(sh->host_lock); 380 spin_unlock_irq(sh->host_lock);
381 return -EIO; 381 return -EIO;
@@ -401,7 +401,7 @@ static int pscsi_create_type_disk(struct se_device *dev, struct scsi_device *sd)
401 return ret; 401 return ret;
402 } 402 }
403 403
404 pr_debug("CORE_PSCSI[%d] - Added TYPE_DISK for %d:%d:%d:%d\n", 404 pr_debug("CORE_PSCSI[%d] - Added TYPE_DISK for %d:%d:%d:%llu\n",
405 phv->phv_host_id, sh->host_no, sd->channel, sd->id, sd->lun); 405 phv->phv_host_id, sh->host_no, sd->channel, sd->id, sd->lun);
406 return 0; 406 return 0;
407} 407}
@@ -417,7 +417,7 @@ static int pscsi_create_type_rom(struct se_device *dev, struct scsi_device *sd)
417 int ret; 417 int ret;
418 418
419 if (scsi_device_get(sd)) { 419 if (scsi_device_get(sd)) {
420 pr_err("scsi_device_get() failed for %d:%d:%d:%d\n", 420 pr_err("scsi_device_get() failed for %d:%d:%d:%llu\n",
421 sh->host_no, sd->channel, sd->id, sd->lun); 421 sh->host_no, sd->channel, sd->id, sd->lun);
422 spin_unlock_irq(sh->host_lock); 422 spin_unlock_irq(sh->host_lock);
423 return -EIO; 423 return -EIO;
@@ -429,7 +429,7 @@ static int pscsi_create_type_rom(struct se_device *dev, struct scsi_device *sd)
429 scsi_device_put(sd); 429 scsi_device_put(sd);
430 return ret; 430 return ret;
431 } 431 }
432 pr_debug("CORE_PSCSI[%d] - Added Type: %s for %d:%d:%d:%d\n", 432 pr_debug("CORE_PSCSI[%d] - Added Type: %s for %d:%d:%d:%llu\n",
433 phv->phv_host_id, scsi_device_type(sd->type), sh->host_no, 433 phv->phv_host_id, scsi_device_type(sd->type), sh->host_no,
434 sd->channel, sd->id, sd->lun); 434 sd->channel, sd->id, sd->lun);
435 435
@@ -452,7 +452,7 @@ static int pscsi_create_type_other(struct se_device *dev,
452 if (ret) 452 if (ret)
453 return ret; 453 return ret;
454 454
455 pr_debug("CORE_PSCSI[%d] - Added Type: %s for %d:%d:%d:%d\n", 455 pr_debug("CORE_PSCSI[%d] - Added Type: %s for %d:%d:%d:%llu\n",
456 phv->phv_host_id, scsi_device_type(sd->type), sh->host_no, 456 phv->phv_host_id, scsi_device_type(sd->type), sh->host_no,
457 sd->channel, sd->id, sd->lun); 457 sd->channel, sd->id, sd->lun);
458 return 0; 458 return 0;
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
index 073a2c32ccc4..38a4504ce450 100644
--- a/drivers/usb/storage/sddr09.c
+++ b/drivers/usb/storage/sddr09.c
@@ -1498,7 +1498,7 @@ static int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us)
1498{ 1498{
1499 int ret; 1499 int ret;
1500 1500
1501 usb_stor_dbg(us, "LUN=%d\n", srb->device->lun); 1501 usb_stor_dbg(us, "LUN=%d\n", (u8)srb->device->lun);
1502 1502
1503 switch (srb->device->lun) { 1503 switch (srb->device->lun) {
1504 case 0: 1504 case 0:
@@ -1524,7 +1524,7 @@ static int dpcm_transport(struct scsi_cmnd *srb, struct us_data *us)
1524 break; 1524 break;
1525 1525
1526 default: 1526 default:
1527 usb_stor_dbg(us, "Invalid LUN %d\n", srb->device->lun); 1527 usb_stor_dbg(us, "Invalid LUN %d\n", (u8)srb->device->lun);
1528 ret = USB_STOR_TRANSPORT_ERROR; 1528 ret = USB_STOR_TRANSPORT_ERROR;
1529 break; 1529 break;
1530 } 1530 }
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index f1c96261a501..cedb29252a92 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -347,14 +347,16 @@ static int usb_stor_control_thread(void * __us)
347 */ 347 */
348 else if (us->srb->device->id && 348 else if (us->srb->device->id &&
349 !(us->fflags & US_FL_SCM_MULT_TARG)) { 349 !(us->fflags & US_FL_SCM_MULT_TARG)) {
350 usb_stor_dbg(us, "Bad target number (%d:%d)\n", 350 usb_stor_dbg(us, "Bad target number (%d:%llu)\n",
351 us->srb->device->id, us->srb->device->lun); 351 us->srb->device->id,
352 us->srb->device->lun);
352 us->srb->result = DID_BAD_TARGET << 16; 353 us->srb->result = DID_BAD_TARGET << 16;
353 } 354 }
354 355
355 else if (us->srb->device->lun > us->max_lun) { 356 else if (us->srb->device->lun > us->max_lun) {
356 usb_stor_dbg(us, "Bad LUN (%d:%d)\n", 357 usb_stor_dbg(us, "Bad LUN (%d:%llu)\n",
357 us->srb->device->id, us->srb->device->lun); 358 us->srb->device->id,
359 us->srb->device->lun);
358 us->srb->result = DID_BAD_TARGET << 16; 360 us->srb->result = DID_BAD_TARGET << 16;
359 } 361 }
360 362
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 0a4edfe8af51..91e2e4215ba0 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -385,7 +385,7 @@ struct scsi_lun {
385#define SCSI_W_LUN_ACCESS_CONTROL (SCSI_W_LUN_BASE + 2) 385#define SCSI_W_LUN_ACCESS_CONTROL (SCSI_W_LUN_BASE + 2)
386#define SCSI_W_LUN_TARGET_LOG_PAGE (SCSI_W_LUN_BASE + 3) 386#define SCSI_W_LUN_TARGET_LOG_PAGE (SCSI_W_LUN_BASE + 3)
387 387
388static inline int scsi_is_wlun(unsigned int lun) 388static inline int scsi_is_wlun(u64 lun)
389{ 389{
390 return (lun & 0xff00) == SCSI_W_LUN_BASE; 390 return (lun & 0xff00) == SCSI_W_LUN_BASE;
391} 391}
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 27ab31017f09..9aa38f7b303b 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -98,8 +98,8 @@ struct scsi_device {
98 98
99 unsigned long last_queue_ramp_up; /* last queue ramp up time */ 99 unsigned long last_queue_ramp_up; /* last queue ramp up time */
100 100
101 unsigned int id, lun, channel; 101 unsigned int id, channel;
102 102 u64 lun;
103 unsigned int manufacturer; /* Manufacturer of device, for using 103 unsigned int manufacturer; /* Manufacturer of device, for using
104 * vendor-specific cmd's */ 104 * vendor-specific cmd's */
105 unsigned sector_size; /* size in bytes */ 105 unsigned sector_size; /* size in bytes */
@@ -321,9 +321,9 @@ static inline struct scsi_target *scsi_target(struct scsi_device *sdev)
321 dev_printk(prefix, &(starget)->dev, fmt, ##a) 321 dev_printk(prefix, &(starget)->dev, fmt, ##a)
322 322
323extern struct scsi_device *__scsi_add_device(struct Scsi_Host *, 323extern struct scsi_device *__scsi_add_device(struct Scsi_Host *,
324 uint, uint, uint, void *hostdata); 324 uint, uint, u64, void *hostdata);
325extern int scsi_add_device(struct Scsi_Host *host, uint channel, 325extern int scsi_add_device(struct Scsi_Host *host, uint channel,
326 uint target, uint lun); 326 uint target, u64 lun);
327extern int scsi_register_device_handler(struct scsi_device_handler *scsi_dh); 327extern int scsi_register_device_handler(struct scsi_device_handler *scsi_dh);
328extern void scsi_remove_device(struct scsi_device *); 328extern void scsi_remove_device(struct scsi_device *);
329extern int scsi_unregister_device_handler(struct scsi_device_handler *scsi_dh); 329extern int scsi_unregister_device_handler(struct scsi_device_handler *scsi_dh);
@@ -332,13 +332,13 @@ void scsi_attach_vpd(struct scsi_device *sdev);
332extern int scsi_device_get(struct scsi_device *); 332extern int scsi_device_get(struct scsi_device *);
333extern void scsi_device_put(struct scsi_device *); 333extern void scsi_device_put(struct scsi_device *);
334extern struct scsi_device *scsi_device_lookup(struct Scsi_Host *, 334extern struct scsi_device *scsi_device_lookup(struct Scsi_Host *,
335 uint, uint, uint); 335 uint, uint, u64);
336extern struct scsi_device *__scsi_device_lookup(struct Scsi_Host *, 336extern struct scsi_device *__scsi_device_lookup(struct Scsi_Host *,
337 uint, uint, uint); 337 uint, uint, u64);
338extern struct scsi_device *scsi_device_lookup_by_target(struct scsi_target *, 338extern struct scsi_device *scsi_device_lookup_by_target(struct scsi_target *,
339 uint); 339 u64);
340extern struct scsi_device *__scsi_device_lookup_by_target(struct scsi_target *, 340extern struct scsi_device *__scsi_device_lookup_by_target(struct scsi_target *,
341 uint); 341 u64);
342extern void starget_for_each_device(struct scsi_target *, void *, 342extern void starget_for_each_device(struct scsi_target *, void *,
343 void (*fn)(struct scsi_device *, void *)); 343 void (*fn)(struct scsi_device *, void *));
344extern void __starget_for_each_device(struct scsi_target *, void *, 344extern void __starget_for_each_device(struct scsi_target *, void *,
@@ -411,13 +411,13 @@ extern void scsi_device_resume(struct scsi_device *sdev);
411extern void scsi_target_quiesce(struct scsi_target *); 411extern void scsi_target_quiesce(struct scsi_target *);
412extern void scsi_target_resume(struct scsi_target *); 412extern void scsi_target_resume(struct scsi_target *);
413extern void scsi_scan_target(struct device *parent, unsigned int channel, 413extern void scsi_scan_target(struct device *parent, unsigned int channel,
414 unsigned int id, unsigned int lun, int rescan); 414 unsigned int id, u64 lun, int rescan);
415extern void scsi_target_reap(struct scsi_target *); 415extern void scsi_target_reap(struct scsi_target *);
416extern void scsi_target_block(struct device *); 416extern void scsi_target_block(struct device *);
417extern void scsi_target_unblock(struct device *, enum scsi_device_state); 417extern void scsi_target_unblock(struct device *, enum scsi_device_state);
418extern void scsi_remove_target(struct device *); 418extern void scsi_remove_target(struct device *);
419extern void int_to_scsilun(unsigned int, struct scsi_lun *); 419extern void int_to_scsilun(u64, struct scsi_lun *);
420extern int scsilun_to_int(struct scsi_lun *); 420extern u64 scsilun_to_int(struct scsi_lun *);
421extern const char *scsi_device_state_name(enum scsi_device_state); 421extern const char *scsi_device_state_name(enum scsi_device_state);
422extern int scsi_is_sdev_device(const struct device *); 422extern int scsi_is_sdev_device(const struct device *);
423extern int scsi_is_target_device(const struct device *); 423extern int scsi_is_target_device(const struct device *);
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h
index af244f4bba53..81292392adbc 100644
--- a/include/scsi/scsi_transport.h
+++ b/include/scsi/scsi_transport.h
@@ -35,7 +35,7 @@ struct scsi_transport_template {
35 /* 35 /*
36 * If set, called from sysfs and legacy procfs rescanning code. 36 * If set, called from sysfs and legacy procfs rescanning code.
37 */ 37 */
38 int (*user_scan)(struct Scsi_Host *, uint, uint, uint); 38 int (*user_scan)(struct Scsi_Host *, uint, uint, u64);
39 39
40 /* The size of the specific transport attribute structure (a 40 /* The size of the specific transport attribute structure (a
41 * space of this size will be left at the end of the 41 * space of this size will be left at the end of the