summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/NCR5380.c
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 /drivers/scsi/NCR5380.c
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>
Diffstat (limited to 'drivers/scsi/NCR5380.c')
-rw-r--r--drivers/scsi/NCR5380.c31
1 files changed, 16 insertions, 15 deletions
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