From 9cb78c16f5dadefd8dc5ba0ae5a2f26cd59419b3 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Wed, 25 Jun 2014 15:27:36 +0200 Subject: 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 Reviewed-by: Christoph Hellwig Reviewed-by: Ewan Milne Signed-off-by: Christoph Hellwig --- drivers/scsi/wd33c93.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'drivers/scsi/wd33c93.c') 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) cmd = (struct scsi_cmnd *) hostdata->input_Q; prev = NULL; while (cmd) { - if (!(hostdata->busy[cmd->device->id] & (1 << cmd->device->lun))) + if (!(hostdata->busy[cmd->device->id] & + (1 << (cmd->device->lun & 0xff)))) break; prev = cmd; cmd = (struct scsi_cmnd *) cmd->host_scribble; @@ -593,10 +594,10 @@ wd33c93_execute(struct Scsi_Host *instance) write_wd33c93(regs, WD_SOURCE_ID, ((cmd->SCp.phase) ? SRCID_ER : 0)); - write_wd33c93(regs, WD_TARGET_LUN, cmd->device->lun); + write_wd33c93(regs, WD_TARGET_LUN, (u8)cmd->device->lun); write_wd33c93(regs, WD_SYNCHRONOUS_TRANSFER, hostdata->sync_xfer[cmd->device->id]); - hostdata->busy[cmd->device->id] |= (1 << cmd->device->lun); + hostdata->busy[cmd->device->id] |= (1 << (cmd->device->lun & 0xFF)); if ((hostdata->level2 == L2_NONE) || (hostdata->sync_stat[cmd->device->id] == SS_UNSET)) { @@ -862,7 +863,7 @@ wd33c93_intr(struct Scsi_Host *instance) } cmd->result = DID_NO_CONNECT << 16; - hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); + hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff)); hostdata->state = S_UNCONNECTED; cmd->scsi_done(cmd); @@ -895,7 +896,7 @@ wd33c93_intr(struct Scsi_Host *instance) /* construct an IDENTIFY message with correct disconnect bit */ - hostdata->outgoing_msg[0] = (0x80 | 0x00 | cmd->device->lun); + hostdata->outgoing_msg[0] = IDENTIFY(0, cmd->device->lun); if (cmd->SCp.phase) hostdata->outgoing_msg[0] |= 0x40; @@ -1179,7 +1180,7 @@ wd33c93_intr(struct Scsi_Host *instance) lun = read_wd33c93(regs, WD_TARGET_LUN); DB(DB_INTR, printk(":%d.%d", cmd->SCp.Status, lun)) hostdata->connected = NULL; - hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); + hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff)); hostdata->state = S_UNCONNECTED; if (cmd->SCp.Status == ILLEGAL_STATUS_BYTE) cmd->SCp.Status = lun; @@ -1268,7 +1269,7 @@ wd33c93_intr(struct Scsi_Host *instance) } DB(DB_INTR, printk("UNEXP_DISC")) hostdata->connected = NULL; - hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); + hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff)); hostdata->state = S_UNCONNECTED; if (cmd->cmnd[0] == REQUEST_SENSE && cmd->SCp.Status != GOOD) cmd->result = @@ -1300,7 +1301,7 @@ wd33c93_intr(struct Scsi_Host *instance) switch (hostdata->state) { case S_PRE_CMP_DISC: hostdata->connected = NULL; - hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); + hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff)); hostdata->state = S_UNCONNECTED; DB(DB_INTR, printk(":%d", cmd->SCp.Status)) if (cmd->cmnd[0] == REQUEST_SENSE @@ -1353,7 +1354,7 @@ wd33c93_intr(struct Scsi_Host *instance) if (hostdata->selecting) { cmd = (struct scsi_cmnd *) hostdata->selecting; hostdata->selecting = NULL; - hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); + hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff)); cmd->host_scribble = (uchar *) hostdata->input_Q; hostdata->input_Q = cmd; @@ -1365,7 +1366,7 @@ wd33c93_intr(struct Scsi_Host *instance) if (cmd) { if (phs == 0x00) { hostdata->busy[cmd->device->id] &= - ~(1 << cmd->device->lun); + ~(1 << (cmd->device->lun & 0xff)); cmd->host_scribble = (uchar *) hostdata->input_Q; hostdata->input_Q = cmd; @@ -1448,7 +1449,7 @@ wd33c93_intr(struct Scsi_Host *instance) cmd = (struct scsi_cmnd *) hostdata->disconnected_Q; patch = NULL; while (cmd) { - if (id == cmd->device->id && lun == cmd->device->lun) + if (id == cmd->device->id && lun == (u8)cmd->device->lun) break; patch = cmd; cmd = (struct scsi_cmnd *) cmd->host_scribble; @@ -1459,7 +1460,7 @@ wd33c93_intr(struct Scsi_Host *instance) if (!cmd) { printk ("---TROUBLE: target %d.%d not in disconnect queue---", - id, lun); + id, (u8)lun); spin_unlock_irqrestore(&hostdata->lock, flags); return; } @@ -1705,7 +1706,7 @@ wd33c93_abort(struct scsi_cmnd * cmd) sr = read_wd33c93(regs, WD_SCSI_STATUS); printk("asr=%02x, sr=%02x.", asr, sr); - hostdata->busy[cmd->device->id] &= ~(1 << cmd->device->lun); + hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun & 0xff)); hostdata->connected = NULL; hostdata->state = S_UNCONNECTED; cmd->result = DID_ABORT << 16; @@ -2169,7 +2170,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance) seq_printf(m, "\nconnected: "); if (hd->connected) { cmd = (struct scsi_cmnd *) hd->connected; - seq_printf(m, " %d:%d(%02x)", + seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); } } @@ -2177,7 +2178,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance) seq_printf(m, "\ninput_Q: "); cmd = (struct scsi_cmnd *) hd->input_Q; while (cmd) { - seq_printf(m, " %d:%d(%02x)", + seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); cmd = (struct scsi_cmnd *) cmd->host_scribble; } @@ -2186,7 +2187,7 @@ wd33c93_show_info(struct seq_file *m, struct Scsi_Host *instance) seq_printf(m, "\ndisconnected_Q:"); cmd = (struct scsi_cmnd *) hd->disconnected_Q; while (cmd) { - seq_printf(m, " %d:%d(%02x)", + seq_printf(m, " %d:%llu(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]); cmd = (struct scsi_cmnd *) cmd->host_scribble; } -- cgit v1.2.3