diff options
author | Hannes Reinecke <hare@suse.de> | 2014-06-25 09:27:36 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-07-17 16:07:37 -0400 |
commit | 9cb78c16f5dadefd8dc5ba0ae5a2f26cd59419b3 (patch) | |
tree | 576b86c3ec56dd7176285ec2d27f27ca55f77bc3 /drivers/scsi/atari_NCR5380.c | |
parent | 755f516bbb983915d6cbfb5aa592cc0a5a99fd00 (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/atari_NCR5380.c')
-rw-r--r-- | drivers/scsi/atari_NCR5380.c | 62 |
1 files changed, 33 insertions, 29 deletions
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 | ||
362 | static int is_lun_busy(Scsi_Cmnd *cmd, int should_be_tagged) | 362 | static 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 | ||
386 | static void cmd_get_tag(Scsi_Cmnd *cmd, int should_be_tagged) | 387 | static 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 | ||
417 | static void cmd_free_tag(Scsi_Cmnd *cmd) | 419 | static 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 | } |