@ -361,17 +361,18 @@ static void __init init_tags(void)
static int is_lun_busy ( Scsi_Cmnd * cmd , int should_be_tagged )
static int is_lun_busy ( Scsi_Cmnd * cmd , int should_be_tagged )
{
{
u8 lun = cmd - > device - > lun ;
SETUP_HOSTDATA ( cmd - > device - > host ) ;
SETUP_HOSTDATA ( cmd - > device - > host ) ;
if ( hostdata - > busy [ cmd - > device - > id ] & ( 1 < < cmd - > device - > lun ) )
if ( hostdata - > busy [ cmd - > device - > id ] & ( 1 < < lun ) )
return 1 ;
return 1 ;
if ( ! should_be_tagged | |
if ( ! should_be_tagged | |
! setup_use_tagged_queuing | | ! cmd - > device - > tagged_supported )
! setup_use_tagged_queuing | | ! cmd - > device - > tagged_supported )
return 0 ;
return 0 ;
if ( TagAlloc [ cmd - > device - > id ] [ cmd - > device - > lun ] . nr_allocated > =
if ( TagAlloc [ cmd - > device - > id ] [ lun ] . nr_allocated > =
TagAlloc [ cmd - > device - > id ] [ cmd - > device - > lun ] . queue_size ) {
TagAlloc [ cmd - > device - > id ] [ lun ] . queue_size ) {
dprintk ( NDEBUG_TAGS , " scsi%d: target %d lun %d: no free tags \n " ,
dprintk ( NDEBUG_TAGS , " scsi%d: target %d lun %d: no free tags \n " ,
H_NO ( cmd ) , cmd - > device - > id , cmd - > device - > lun ) ;
H_NO ( cmd ) , cmd - > device - > id , lun ) ;
return 1 ;
return 1 ;
}
}
return 0 ;
return 0 ;
@ -385,6 +386,7 @@ static int is_lun_busy(Scsi_Cmnd *cmd, int should_be_tagged)
static void cmd_get_tag ( Scsi_Cmnd * cmd , int should_be_tagged )
static void cmd_get_tag ( Scsi_Cmnd * cmd , int should_be_tagged )
{
{
u8 lun = cmd - > device - > lun ;
SETUP_HOSTDATA ( cmd - > device - > host ) ;
SETUP_HOSTDATA ( cmd - > device - > host ) ;
/* If we or the target don't support tagged queuing, allocate the LUN for
/* 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)
if ( ! should_be_tagged | |
if ( ! should_be_tagged | |
! setup_use_tagged_queuing | | ! cmd - > device - > tagged_supported ) {
! setup_use_tagged_queuing | | ! cmd - > device - > tagged_supported ) {
cmd - > tag = TAG_NONE ;
cmd - > tag = TAG_NONE ;
hostdata - > busy [ cmd - > device - > id ] | = ( 1 < < cmd - > device - > lun ) ;
hostdata - > busy [ cmd - > device - > id ] | = ( 1 < < lun ) ;
dprintk ( NDEBUG_TAGS , " scsi%d: target %d lun %d now allocated by untagged "
dprintk ( NDEBUG_TAGS , " scsi%d: target %d lun %d now allocated by untagged "
" command \n " , H_NO ( cmd ) , cmd - > device - > id , cmd - > device - > lun ) ;
" command \n " , H_NO ( cmd ) , cmd - > device - > id , lun ) ;
} else {
} else {
TAG_ALLOC * ta = & TagAlloc [ cmd - > device - > id ] [ cmd - > device - > lun ] ;
TAG_ALLOC * ta = & TagAlloc [ cmd - > device - > id ] [ lun ] ;
cmd - > tag = find_first_zero_bit ( ta - > allocated , MAX_TAGS ) ;
cmd - > tag = find_first_zero_bit ( ta - > allocated , MAX_TAGS ) ;
set_bit ( cmd - > tag , ta - > allocated ) ;
set_bit ( cmd - > tag , ta - > allocated ) ;
@ -405,7 +407,7 @@ static void cmd_get_tag(Scsi_Cmnd *cmd, int should_be_tagged)
dprintk ( NDEBUG_TAGS , " scsi%d: using tag %d for target %d lun %d "
dprintk ( NDEBUG_TAGS , " scsi%d: using tag %d for target %d lun %d "
" (now %d tags in use) \n " ,
" (now %d tags in use) \n " ,
H_NO ( cmd ) , cmd - > tag , cmd - > device - > id ,
H_NO ( cmd ) , cmd - > tag , cmd - > device - > id ,
cmd - > device - > lun , ta - > nr_allocated ) ;
lun , ta - > nr_allocated ) ;
}
}
}
}
@ -416,21 +418,22 @@ static void cmd_get_tag(Scsi_Cmnd *cmd, int should_be_tagged)
static void cmd_free_tag ( Scsi_Cmnd * cmd )
static void cmd_free_tag ( Scsi_Cmnd * cmd )
{
{
u8 lun = cmd - > device - > lun ;
SETUP_HOSTDATA ( cmd - > device - > host ) ;
SETUP_HOSTDATA ( cmd - > device - > host ) ;
if ( cmd - > tag = = TAG_NONE ) {
if ( cmd - > tag = = TAG_NONE ) {
hostdata - > busy [ cmd - > device - > id ] & = ~ ( 1 < < cmd - > device - > lun ) ;
hostdata - > busy [ cmd - > device - > id ] & = ~ ( 1 < < lun ) ;
dprintk ( NDEBUG_TAGS , " scsi%d: target %d lun %d untagged cmd finished \n " ,
dprintk ( NDEBUG_TAGS , " scsi%d: target %d lun %d untagged cmd finished \n " ,
H_NO ( cmd ) , cmd - > device - > id , cmd - > device - > lun ) ;
H_NO ( cmd ) , cmd - > device - > id , lun ) ;
} else if ( cmd - > tag > = MAX_TAGS ) {
} else if ( cmd - > tag > = MAX_TAGS ) {
printk ( KERN_NOTICE " scsi%d: trying to free bad tag %d! \n " ,
printk ( KERN_NOTICE " scsi%d: trying to free bad tag %d! \n " ,
H_NO ( cmd ) , cmd - > tag ) ;
H_NO ( cmd ) , cmd - > tag ) ;
} else {
} else {
TAG_ALLOC * ta = & TagAlloc [ cmd - > device - > id ] [ cmd - > device - > lun ] ;
TAG_ALLOC * ta = & TagAlloc [ cmd - > device - > id ] [ lun ] ;
clear_bit ( cmd - > tag , ta - > allocated ) ;
clear_bit ( cmd - > tag , ta - > allocated ) ;
ta - > nr_allocated - - ;
ta - > nr_allocated - - ;
dprintk ( NDEBUG_TAGS , " scsi%d: freed tag %d for target %d lun %d \n " ,
dprintk ( NDEBUG_TAGS , " scsi%d: freed tag %d for target %d lun %d \n " ,
H_NO ( cmd ) , cmd - > tag , cmd - > device - > id , cmd - > device - > lun ) ;
H_NO ( cmd ) , cmd - > tag , cmd - > device - > id , lun ) ;
}
}
}
}
@ -713,7 +716,7 @@ static void lprint_Scsi_Cmnd(Scsi_Cmnd *cmd)
{
{
int i , s ;
int i , s ;
unsigned char * command ;
unsigned char * command ;
printk ( " scsi%d: destination target %d, lun %d \n " ,
printk ( " scsi%d: destination target %d, lun %llu \n " ,
H_NO ( cmd ) , cmd - > device - > id , cmd - > device - > lun ) ;
H_NO ( cmd ) , cmd - > device - > id , cmd - > device - > lun ) ;
printk ( KERN_CONT " command = " ) ;
printk ( KERN_CONT " command = " ) ;
command = cmd - > cmnd ;
command = cmd - > cmnd ;
@ -759,7 +762,7 @@ static void show_Scsi_Cmnd(Scsi_Cmnd *cmd, struct seq_file *m)
{
{
int i , s ;
int i , s ;
unsigned char * command ;
unsigned char * command ;
seq_printf ( m , " scsi%d: destination target %d, lun %d \n " ,
seq_printf ( m , " scsi%d: destination target %d, lun %llu \n " ,
H_NO ( cmd ) , cmd - > device - > id , cmd - > device - > lun ) ;
H_NO ( cmd ) , cmd - > device - > id , cmd - > device - > lun ) ;
seq_printf ( m , " command = " ) ;
seq_printf ( m , " command = " ) ;
command = cmd - > cmnd ;
command = cmd - > cmnd ;
@ -1060,12 +1063,13 @@ static void NCR5380_main(struct work_struct *work)
# endif
# endif
for ( tmp = ( Scsi_Cmnd * ) hostdata - > issue_queue ,
for ( tmp = ( Scsi_Cmnd * ) hostdata - > issue_queue ,
prev = NULL ; tmp ; prev = tmp , tmp = NEXT ( tmp ) ) {
prev = NULL ; tmp ; prev = tmp , tmp = NEXT ( tmp ) ) {
u8 lun = tmp - > device - > lun ;
# if (NDEBUG & NDEBUG_LISTS)
# if (NDEBUG & NDEBUG_LISTS)
if ( prev ! = tmp )
if ( prev ! = tmp )
printk ( " MAIN tmp=%p target=%d busy=%d lun=%d \n " ,
printk ( " MAIN tmp=%p target=%d busy=%d lun=%llu \n " ,
tmp , tmp - > device - > id , hostdata - > busy [ tmp - > device - > id ] ,
tmp , tmp - > device - > id , hostdata - > busy [ tmp - > device - > id ] ,
tmp - > device - > lun ) ;
lun ) ;
# endif
# endif
/* When we find one, remove it from the issue queue. */
/* When we find one, remove it from the issue queue. */
/* ++guenther: possible race with Falcon locking */
/* ++guenther: possible race with Falcon locking */
@ -1073,7 +1077,7 @@ static void NCR5380_main(struct work_struct *work)
# ifdef SUPPORT_TAGS
# ifdef SUPPORT_TAGS
! is_lun_busy ( tmp , tmp - > cmnd [ 0 ] ! = REQUEST_SENSE )
! is_lun_busy ( tmp , tmp - > cmnd [ 0 ] ! = REQUEST_SENSE )
# else
# else
! ( hostdata - > busy [ tmp - > device - > id ] & ( 1 < < tmp - > device - > lun ) )
! ( hostdata - > busy [ tmp - > device - > id ] & ( 1 < < lun ) )
# endif
# endif
) {
) {
/* ++guenther: just to be sure, this must be atomic */
/* ++guenther: just to be sure, this must be atomic */
@ -1099,7 +1103,7 @@ static void NCR5380_main(struct work_struct *work)
*/
*/
dprintk ( NDEBUG_MAIN , " scsi%d: main(): command for target %d "
dprintk ( NDEBUG_MAIN , " scsi%d: main(): command for target %d "
" lun %d removed from issue_queue \n " ,
" lun %d removed from issue_queue \n " ,
HOSTNO , tmp - > device - > id , tmp - > device - > lun ) ;
HOSTNO , tmp - > device - > id , lun ) ;
/*
/*
* REQUEST SENSE commands are issued without tagged
* REQUEST SENSE commands are issued without tagged
* queueing , even on SCSI - II devices because the
* queueing , even on SCSI - II devices because the
@ -2061,7 +2065,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
* accesses to this device will use the
* accesses to this device will use the
* polled - IO . */
* polled - IO . */
printk ( KERN_NOTICE " scsi%d: switching target %d "
printk ( KERN_NOTICE " scsi%d: switching target %d "
" lun %d to slow handshake \n " , HOSTNO ,
" lun %llu to slow handshake \n " , HOSTNO ,
cmd - > device - > id , cmd - > device - > lun ) ;
cmd - > device - > id , cmd - > device - > lun ) ;
cmd - > device - > borken = 1 ;
cmd - > device - > borken = 1 ;
NCR5380_write ( INITIATOR_COMMAND_REG , ICR_BASE |
NCR5380_write ( INITIATOR_COMMAND_REG , ICR_BASE |
@ -2113,7 +2117,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
/* Accept message by clearing ACK */
/* Accept message by clearing ACK */
NCR5380_write ( INITIATOR_COMMAND_REG , ICR_BASE ) ;
NCR5380_write ( INITIATOR_COMMAND_REG , ICR_BASE ) ;
dprintk ( NDEBUG_LINKED , " scsi%d: target %d lun %d linked command "
dprintk ( NDEBUG_LINKED , " scsi%d: target %d lun %llu linked command "
" complete. \n " , HOSTNO , cmd - > device - > id , cmd - > device - > lun ) ;
" complete. \n " , HOSTNO , cmd - > device - > id , cmd - > device - > lun ) ;
/* Enable reselect interrupts */
/* Enable reselect interrupts */
@ -2125,7 +2129,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
*/
*/
if ( ! cmd - > next_link ) {
if ( ! cmd - > next_link ) {
printk ( KERN_NOTICE " scsi%d: target %d lun %d "
printk ( KERN_NOTICE " scsi%d: target %d lun %llu "
" linked command complete, no next_link \n " ,
" linked command complete, no next_link \n " ,
HOSTNO , cmd - > device - > id , cmd - > device - > lun ) ;
HOSTNO , cmd - > device - > id , cmd - > device - > lun ) ;
sink = 1 ;
sink = 1 ;
@ -2138,7 +2142,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
* and don ' t free it ! */
* and don ' t free it ! */
cmd - > next_link - > tag = cmd - > tag ;
cmd - > next_link - > tag = cmd - > tag ;
cmd - > result = cmd - > SCp . Status | ( cmd - > SCp . Message < < 8 ) ;
cmd - > result = cmd - > SCp . Status | ( cmd - > SCp . Message < < 8 ) ;
dprintk ( NDEBUG_LINKED , " scsi%d: target %d lun %d linked request "
dprintk ( NDEBUG_LINKED , " scsi%d: target %d lun %llu linked request "
" done, calling scsi_done(). \n " ,
" done, calling scsi_done(). \n " ,
HOSTNO , cmd - > device - > id , cmd - > device - > lun ) ;
HOSTNO , cmd - > device - > id , cmd - > device - > lun ) ;
# ifdef NCR5380_STATS
# ifdef NCR5380_STATS
@ -2155,7 +2159,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
/* ++guenther: possible race with Falcon locking */
/* ++guenther: possible race with Falcon locking */
falcon_dont_release + + ;
falcon_dont_release + + ;
hostdata - > connected = NULL ;
hostdata - > connected = NULL ;
dprintk ( NDEBUG_QUEUES , " scsi%d: command for target %d, lun %d "
dprintk ( NDEBUG_QUEUES , " scsi%d: command for target %d, lun %llu "
" completed \n " , HOSTNO , cmd - > device - > id , cmd - > device - > lun ) ;
" completed \n " , HOSTNO , cmd - > device - > id , cmd - > device - > lun ) ;
# ifdef SUPPORT_TAGS
# ifdef SUPPORT_TAGS
cmd_free_tag ( cmd ) ;
cmd_free_tag ( cmd ) ;
@ -2169,7 +2173,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
/* ++Andreas: the mid level code knows about
/* ++Andreas: the mid level code knows about
QUEUE_FULL now . */
QUEUE_FULL now . */
TAG_ALLOC * ta = & TagAlloc [ cmd - > device - > id ] [ cmd - > device - > lun ] ;
TAG_ALLOC * ta = & TagAlloc [ cmd - > device - > id ] [ cmd - > device - > lun ] ;
dprintk ( NDEBUG_TAGS , " scsi%d: target %d lun %d returned "
dprintk ( NDEBUG_TAGS , " scsi%d: target %d lun %llu returned "
" QUEUE_FULL after %d commands \n " ,
" QUEUE_FULL after %d commands \n " ,
HOSTNO , cmd - > device - > id , cmd - > device - > lun ,
HOSTNO , cmd - > device - > id , cmd - > device - > lun ,
ta - > nr_allocated ) ;
ta - > nr_allocated ) ;
@ -2267,7 +2271,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
cmd - > device - > tagged_supported = 0 ;
cmd - > device - > tagged_supported = 0 ;
hostdata - > busy [ cmd - > device - > id ] | = ( 1 < < cmd - > device - > lun ) ;
hostdata - > busy [ cmd - > device - > id ] | = ( 1 < < cmd - > device - > lun ) ;
cmd - > tag = TAG_NONE ;
cmd - > tag = TAG_NONE ;
dprintk ( NDEBUG_TAGS , " scsi%d: target %d lun %d rejected "
dprintk ( NDEBUG_TAGS , " scsi%d: target %d lun %llu rejected "
" QUEUE_TAG message; tagged queuing "
" QUEUE_TAG message; tagged queuing "
" disabled \n " ,
" disabled \n " ,
HOSTNO , cmd - > device - > id , cmd - > device - > lun ) ;
HOSTNO , cmd - > device - > id , cmd - > device - > lun ) ;
@ -2284,7 +2288,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
hostdata - > connected = NULL ;
hostdata - > connected = NULL ;
hostdata - > disconnected_queue = cmd ;
hostdata - > disconnected_queue = cmd ;
local_irq_restore ( flags ) ;
local_irq_restore ( flags ) ;
dprintk ( NDEBUG_QUEUES , " scsi%d: command for target %d lun %d was "
dprintk ( NDEBUG_QUEUES , " scsi%d: command for target %d lun %llu was "
" moved from connected to the "
" moved from connected to the "
" disconnected_queue \n " , HOSTNO ,
" disconnected_queue \n " , HOSTNO ,
cmd - > device - > id , cmd - > device - > lun ) ;
cmd - > device - > id , cmd - > device - > lun ) ;
@ -2385,12 +2389,12 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
printk ( " \n " ) ;
printk ( " \n " ) ;
} else if ( tmp ! = EXTENDED_MESSAGE )
} else if ( tmp ! = EXTENDED_MESSAGE )
printk ( KERN_DEBUG " scsi%d: rejecting unknown "
printk ( KERN_DEBUG " scsi%d: rejecting unknown "
" message %02x from target %d, lun %d \n " ,
" message %02x from target %d, lun %llu \n " ,
HOSTNO , tmp , cmd - > device - > id , cmd - > device - > lun ) ;
HOSTNO , tmp , cmd - > device - > id , cmd - > device - > lun ) ;
else
else
printk ( KERN_DEBUG " scsi%d: rejecting unknown "
printk ( KERN_DEBUG " scsi%d: rejecting unknown "
" extended message "
" extended message "
" code %02x, length %d from target %d, lun %d \n " ,
" code %02x, length %d from target %d, lun %llu \n " ,
HOSTNO , extended_msg [ 1 ] , extended_msg [ 0 ] ,
HOSTNO , extended_msg [ 1 ] , extended_msg [ 0 ] ,
cmd - > device - > id , cmd - > device - > lun ) ;
cmd - > device - > id , cmd - > device - > lun ) ;
@ -2588,7 +2592,7 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
NCR5380_write ( INITIATOR_COMMAND_REG , ICR_BASE ) ;
NCR5380_write ( INITIATOR_COMMAND_REG , ICR_BASE ) ;
hostdata - > connected = tmp ;
hostdata - > connected = tmp ;
dprintk ( NDEBUG_RESELECTION , " scsi%d: nexus established, target = %d, lun = %d , tag = %d \n " ,
dprintk ( NDEBUG_RESELECTION , " scsi%d: nexus established, target = %d, lun = %llu , tag = %d \n " ,
HOSTNO , tmp - > device - > id , tmp - > device - > lun , tmp - > tag ) ;
HOSTNO , tmp - > device - > id , tmp - > device - > lun , tmp - > tag ) ;
falcon_dont_release - - ;
falcon_dont_release - - ;
}
}