SCSI result handling cleanup, part 1
Subsystems (21)
PATCH v3 2/35 3w-xxxx: Whitespace cleanup
In reply to Hannes Reinecke--- drivers/scsi/3w-xxxx.c | 251 ++++++++++++++++++++--------------------- drivers/scsi/3w-xxxx.h | 199 ++++++++++++++++---------------- 2 files changed, 229 insertions(+), 221 deletions(-)
drivers/scsi/3w-xxxx.c +125 -126
@@ -1,52 +1,52 @@ -/* +/* 3w-xxxx.c -- 3ware Storage Controller device driver for Linux. Written By: Adam Radford <[email protected]> Modifications By: Joel Jacobson <[email protected]> -Arnaldo Carvalho de Melo <[email protected]> +Arnaldo Carvalho de Melo <[email protected]> Brad Strand <[email protected]> Copyright (C) 1999-2010 3ware Inc. -Kernel compatibility By: Andre Hedrick <[email protected]> +Kernel compatibility By: Andre Hedrick <[email protected]> Non-Copyright (C) 2000 Andre Hedrick <[email protected]> -+ Further tiny build fixes and trivial hoovering Alan Cox This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -NO WARRANTY -THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR -CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT -LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is -solely responsible for determining the appropriateness of using and -distributing the Program and assumes all risks associated with its -exercise of rights under this Agreement, including but not limited to -the risks and costs of program errors, damage to or loss of data, -programs or equipment, and unavailability or interruption of operations. - -DISCLAIMER OF LIABILITY -NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED -HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Bugs/Comments/Suggestions should be mailed to: +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +NO WARRANTY +THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR +CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT +LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, +MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is +solely responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement, including but not limited to +the risks and costs of program errors, damage to or loss of data, +programs or equipment, and unavailability or interruption of operations. + +DISCLAIMER OF LIABILITY +NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Bugs/Comments/Suggestions should be mailed to: [email protected]
@@ -70,7 +70,7 @@ 1.02.00.003 - Fix tw_interrupt() to report error to scsi layer when controller status is non-zero. Added handling of request_sense opcode. - Fix possible null pointer dereference in + Fix possible null pointer dereference in tw_reset_device_extension() 1.02.00.004 - Add support for device id of 3ware 7000 series controllers. Make tw_setfeature() call with interrupts disabled.
@@ -239,7 +239,7 @@ static int tw_reset_device_extension(TW_Device_Extension *tw_dev);/* This function will check the status register for unexpected bits */ static int tw_check_bits (u32 status_reg_value) { -if ((status_reg_value &TW_STATUS_EXPECTED_BITS ) !=TW_STATUS_EXPECTED_BITS ) { +if ((status_reg_value &TW_STATUS_EXPECTED_BITS ) !=TW_STATUS_EXPECTED_BITS ) {dprintk (KERN_WARNING "3w-xxxx: tw_check_bits(): No expected bits (0x%x).\n" , status_reg_value);return 1 ; }
@@ -291,7 +291,7 @@ static int tw_decode_bits(TW_Device_Extension *tw_dev, u32 status_reg_value, int }return 1 ; } - +return 0 ; }/* End tw_decode_bits() */
@@ -390,7 +390,7 @@ static int tw_post_command_packet(TW_Device_Extension *tw_dev, int request_id) }else { tw_dev->pending_tail = tw_dev->pending_tail +1 ; } - } + }TW_UNMASK_COMMAND_INTERRUPT (tw_dev);return 1 ; }
@@ -403,7 +403,7 @@ static int tw_decode_sense(TW_Device_Extension *tw_dev, int request_id, int fillint i;TW_Command *command; -dprintk (KERN_WARNING "3w-xxxx: tw_decode_sense()\n" ); +dprintk (KERN_WARNING "3w-xxxx: tw_decode_sense()\n" ); command = (TW_Command *)tw_dev->command_packet_virtual_address[request_id];printk (KERN_WARNING "3w-xxxx: scsi%d: Command failed: status = 0x%x, flags = 0x%x, unit #%d.\n" , tw_dev->host->host_no, command->status, command->flags,TW_UNIT_OUT (command->unit__hostid));
@@ -443,10 +443,10 @@ static int tw_decode_sense(TW_Device_Extension *tw_dev, int request_id, int fill }/* End tw_decode_sense() */ /* This function will report controller error status */ -static int tw_check_errors (TW_Device_Extension *tw_dev) +static int tw_check_errors (TW_Device_Extension *tw_dev) {u32 status_reg_value; - + status_reg_value =inl (TW_STATUS_REG_ADDR (tw_dev));if (TW_STATUS_ERRORS (status_reg_value) ||tw_check_bits (status_reg_value)) {
@@ -458,7 +458,7 @@ static int tw_check_errors(TW_Device_Extension *tw_dev) }/* End tw_check_errors() */ /* This function will empty the response que */ -static void tw_empty_response_que (TW_Device_Extension *tw_dev) +static void tw_empty_response_que (TW_Device_Extension *tw_dev) {u32 status_reg_value, response_que_value;
@@ -525,7 +525,7 @@ static ssize_t tw_show_stats(struct device *dev, struct device_attribute *attr,/* Create sysfs 'stats' entry */ static struct device_attribute tw_host_stats_attr = { .attr = { - .name ="stats" , + .name ="stats" , .mode =S_IRUGO , }, .show = tw_show_stats
@@ -538,7 +538,7 @@ static struct device_attribute *tw_host_attrs[] = { };/* This function will read the aen queue from the isr */ -static int tw_aen_read_queue (TW_Device_Extension *tw_dev,int request_id) +static int tw_aen_read_queue (TW_Device_Extension *tw_dev,int request_id) {TW_Command *command_packet;TW_Param *param;
@@ -604,7 +604,7 @@ static int tw_aen_read_queue(TW_Device_Extension *tw_dev, int request_id) }/* End tw_aen_read_queue() */ /* This function will complete an aen request from the isr */ -static int tw_aen_complete (TW_Device_Extension *tw_dev,int request_id) +static int tw_aen_complete (TW_Device_Extension *tw_dev,int request_id) {TW_Param *param;unsigned short aen;
@@ -628,7 +628,7 @@ static int tw_aen_complete(TW_Device_Extension *tw_dev, int request_id)if ((tw_aen_string[aen &0xff ][strlen (tw_aen_string[aen &0xff ])-1 ]) =='#' ) {printk (KERN_WARNING "3w-xxxx: scsi%d: AEN: %s%d.\n" , tw_dev->host->host_no, tw_aen_string[aen &0xff ], aen >>8 ); }else { -if (aen !=0x0 ) +if (aen !=0x0 )printk (KERN_WARNING "3w-xxxx: scsi%d: AEN: %s.\n" , tw_dev->host->host_no, tw_aen_string[aen &0xff ]); } }else {
@@ -746,7 +746,7 @@ static int tw_aen_drain_queue(TW_Device_Extension *tw_dev)printk (KERN_WARNING "3w-xxxx: tw_aen_drain_queue(): Unexpected request id.\n" );return 1 ; } - +if (command_packet->status !=0 ) {if (command_packet->flags !=TW_AEN_TABLE_UNDEFINED ) {/* Bad response */
@@ -908,7 +908,7 @@ static long tw_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long a/* Hardware can only do multiple of 512 byte transfers */ data_buffer_length_adjusted = (data_buffer_length +511 ) & ~511 ; - +/* Now allocate ioctl buf memory */ cpu_addr =dma_alloc_coherent (&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof (TW_New_Ioctl) -1 , &dma_handle,GFP_KERNEL );if (cpu_addr ==NULL ) {
@@ -1075,7 +1075,7 @@ static void tw_free_device_extension(TW_Device_Extension *tw_dev) }/* End tw_free_device_extension() */ /* This function will send an initconnection command to controller */ -static int tw_initconnection (TW_Device_Extension *tw_dev,int message_credits) +static int tw_initconnection (TW_Device_Extension *tw_dev,int message_credits) {unsigned long command_que_value;TW_Command *command_packet;
@@ -1105,10 +1105,10 @@ static int tw_initconnection(TW_Device_Extension *tw_dev, int message_credits)printk (KERN_WARNING "3w-xxxx: tw_initconnection(): Bad command packet physical address.\n" );return 1 ; } - +/* Send command packet to the board */ outl (command_que_value,TW_COMMAND_QUEUE_REG_ADDR (tw_dev)); - +/* Poll for completion */ if (tw_poll_status_gone (tw_dev,TW_STATUS_RESPONSE_QUEUE_EMPTY ,30 ) ==0 ) { response_queue.value =inl (TW_RESPONSE_QUEUE_REG_ADDR (tw_dev));
@@ -1130,7 +1130,7 @@ static int tw_initconnection(TW_Device_Extension *tw_dev, int message_credits)/* Set a value in the features table */ static int tw_setfeature (TW_Device_Extension *tw_dev,int parm,int param_size, -unsigned char *val) +unsigned char *val) {TW_Param *param;TW_Command *command_packet;
@@ -1139,7 +1139,7 @@ static int tw_setfeature(TW_Device_Extension *tw_dev, int parm, int param_size,unsigned long command_que_value;unsigned long param_value; -/* Initialize SetParam command packet */ +/* Initialize SetParam command packet */ if (tw_dev->command_packet_virtual_address[request_id] ==NULL ) {printk (KERN_WARNING "3w-xxxx: tw_setfeature(): Bad command packet virtual address.\n" );return 1 ;
@@ -1169,7 +1169,7 @@ static int tw_setfeature(TW_Device_Extension *tw_dev, int parm, int param_size, command_packet->request_id = request_id; command_packet->byte6.parameter_count =1 ; - command_que_value = tw_dev->command_packet_physical_address[request_id]; + command_que_value = tw_dev->command_packet_physical_address[request_id];if (command_que_value ==0 ) {printk (KERN_WARNING "3w-xxxx: tw_setfeature(): Bad command packet physical address.\n" );return 1 ;
@@ -1199,7 +1199,7 @@ static int tw_setfeature(TW_Device_Extension *tw_dev, int parm, int param_size, }/* End tw_setfeature() */ /* This function will reset a controller */ -static int tw_reset_sequence (TW_Device_Extension *tw_dev) +static int tw_reset_sequence (TW_Device_Extension *tw_dev) {int error =0 ;int tries =0 ;
@@ -1298,7 +1298,7 @@ static int tw_reset_device_extension(TW_Device_Extension *tw_dev)/* Abort all requests that are in progress */ for (i=0 ;i<TW_Q_LENGTH ;i++) { -if ((tw_dev->state[i] !=TW_S_FINISHED ) && +if ((tw_dev->state[i] !=TW_S_FINISHED ) && (tw_dev->state[i] !=TW_S_INITIAL ) && (tw_dev->state[i] !=TW_S_COMPLETED )) { srb = tw_dev->srb[i];
@@ -1339,11 +1339,11 @@ static int tw_reset_device_extension(TW_Device_Extension *tw_dev)/* This funciton returns unit geometry in cylinders/heads/sectors */ static int tw_scsi_biosparam (struct scsi_device *sdev,struct block_device *bdev, -sector_t capacity,int geom[]) +sector_t capacity,int geom[]) {int heads, sectors, cylinders;TW_Device_Extension *tw_dev; - +dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_biosparam()\n" ); tw_dev = (TW_Device_Extension *)sdev->host->hostdata;
@@ -1358,7 +1358,7 @@ static int tw_scsi_biosparam(struct scsi_device *sdev, struct block_device *bdev }dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_biosparam(): heads = %d, sectors = %d, cylinders = %d\n" , heads, sectors, cylinders); - geom[0 ] = heads; + geom[0 ] = heads; geom[1 ] = sectors; geom[2 ] = cylinders;
@@ -1366,7 +1366,7 @@ static int tw_scsi_biosparam(struct scsi_device *sdev, struct block_device *bdev }/* End tw_scsi_biosparam() */ /* This is the new scsi eh reset function */ -static int tw_scsi_eh_reset (struct scsi_cmnd *SCpnt) +static int tw_scsi_eh_reset (struct scsi_cmnd *SCpnt) {TW_Device_Extension *tw_dev=NULL ;int retval =FAILED ;
@@ -1554,7 +1554,7 @@ static int tw_scsiop_mode_sense(TW_Device_Extension *tw_dev, int request_id)/* Now try to post the command packet */ tw_post_command_packet (tw_dev, request_id); - +return 0 ; }/* End tw_scsiop_mode_sense() */
@@ -1575,16 +1575,16 @@ static int tw_scsiop_mode_sense_complete(TW_Device_Extension *tw_dev, int reques flags = (char *)&(param->data[0 ]);memset (request_buffer,0 ,sizeof (request_buffer)); - request_buffer[0 ] =0xf ;/* mode data length */ - request_buffer[1 ] =0 ;/* default medium type */ - request_buffer[2 ] =0x10 ;/* dpo/fua support on */ - request_buffer[3 ] =0 ;/* no block descriptors */ - request_buffer[4 ] =0x8 ;/* caching page */ - request_buffer[5 ] =0xa ;/* page length */ + request_buffer[0 ] =0xf ;/* mode data length */ + request_buffer[1 ] =0 ;/* default medium type */ + request_buffer[2 ] =0x10 ;/* dpo/fua support on */ + request_buffer[3 ] =0 ;/* no block descriptors */ + request_buffer[4 ] =0x8 ;/* caching page */ + request_buffer[5 ] =0xa ;/* page length */ if (*flags &0x1 ) - request_buffer[6 ] =0x5 ;/* WCE on, RCD on */ + request_buffer[6 ] =0x5 ;/* WCE on, RCD on */ else - request_buffer[6 ] =0x1 ;/* WCE off, RCD on */ + request_buffer[6 ] =0x1 ;/* WCE off, RCD on */ tw_transfer_internal (tw_dev, request_id, request_buffer,sizeof (request_buffer));
@@ -1592,7 +1592,7 @@ static int tw_scsiop_mode_sense_complete(TW_Device_Extension *tw_dev, int reques }/* End tw_scsiop_mode_sense_complete() */ /* This function handles scsi read_capacity commands */ -static int tw_scsiop_read_capacity (TW_Device_Extension *tw_dev,int request_id) +static int tw_scsiop_read_capacity (TW_Device_Extension *tw_dev,int request_id) {TW_Param *param;TW_Command *command_packet;
@@ -1624,8 +1624,8 @@ static int tw_scsiop_read_capacity(TW_Device_Extension *tw_dev, int request_id) } param = (TW_Param *)tw_dev->alignment_virtual_address[request_id];memset (param,0 ,sizeof (TW_Sector)); - param->table_id =TW_UNIT_INFORMATION_TABLE_BASE + - tw_dev->srb[request_id]->device->id; + param->table_id =TW_UNIT_INFORMATION_TABLE_BASE + + tw_dev->srb[request_id]->device->id; param->parameter_id =4 ;/* unitcapacity parameter */ param->parameter_size_bytes =4 ; param_value = tw_dev->alignment_physical_address[request_id];
@@ -1633,7 +1633,7 @@ static int tw_scsiop_read_capacity(TW_Device_Extension *tw_dev, int request_id)dprintk (KERN_NOTICE "3w-xxxx: tw_scsiop_read_capacity(): Bad alignment physical address.\n" );return 1 ; } - + command_packet->byte8.param.sgl[0 ].address = param_value; command_packet->byte8.param.sgl[0 ].length =sizeof (TW_Sector); command_que_value = tw_dev->command_packet_physical_address[request_id];
@@ -1644,7 +1644,7 @@ static int tw_scsiop_read_capacity(TW_Device_Extension *tw_dev, int request_id)/* Now try to post the command to the board */ tw_post_command_packet (tw_dev, request_id); - +return 0 ; }/* End tw_scsiop_read_capacity() */
@@ -1666,7 +1666,7 @@ static int tw_scsiop_read_capacity_complete(TW_Device_Extension *tw_dev, int req } param_data = &(param->data[0 ]); - capacity = (param_data[3 ] <<24 ) | (param_data[2 ] <<16 ) | + capacity = (param_data[3 ] <<24 ) | (param_data[2 ] <<16 ) | (param_data[1 ] <<8 ) | param_data[0 ];/* Subtract one sector to fix get last sector ioctl */
@@ -1692,7 +1692,7 @@ static int tw_scsiop_read_capacity_complete(TW_Device_Extension *tw_dev, int req }/* End tw_scsiop_read_capacity_complete() */ /* This function handles scsi read or write commands */ -static int tw_scsiop_read_write (TW_Device_Extension *tw_dev,int request_id) +static int tw_scsiop_read_write (TW_Device_Extension *tw_dev,int request_id) {TW_Command *command_packet;unsigned long command_que_value;
@@ -1742,12 +1742,12 @@ static int tw_scsiop_read_write(TW_Device_Extension *tw_dev, int request_id) lba = ((u32 )srb->cmnd[2 ] <<24 ) | ((u32 )srb->cmnd[3 ] <<16 ) | ((u32 )srb->cmnd[4 ] <<8 ) | (u32 )srb->cmnd[5 ]; num_sectors = (u32 )srb->cmnd[8 ] | ((u32 )srb->cmnd[7 ] <<8 ); } - +/* Update sector statistic */ tw_dev->sector_count = num_sectors;if (tw_dev->sector_count > tw_dev->max_sector_count) tw_dev->max_sector_count = tw_dev->sector_count; - +dprintk (KERN_NOTICE "3w-xxxx: tw_scsiop_read_write(): lba = 0x%x num_sectors = 0x%x\n" , lba, num_sectors); command_packet->byte8.io.lba = lba; command_packet->byte6.block_count = num_sectors;
@@ -1772,7 +1772,7 @@ static int tw_scsiop_read_write(TW_Device_Extension *tw_dev, int request_id)dprintk (KERN_WARNING "3w-xxxx: tw_scsiop_read_write(): Bad command packet physical address.\n" );return 1 ; } - +/* Now try to post the command to the board */ tw_post_command_packet (tw_dev, request_id);
@@ -1933,7 +1933,7 @@ static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_c/* Save done function into struct scsi_cmnd */ SCpnt->scsi_done = done; - +/* Queue the command and get a request id */ tw_state_request_start (tw_dev, &request_id);
@@ -1941,48 +1941,47 @@ static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_c tw_dev->srb[request_id] = SCpnt;switch (*command) { -case READ_10 : -case READ_6 : -case WRITE_10 : -case WRITE_6 : -dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught READ/WRITE.\n" ); - retval =tw_scsiop_read_write (tw_dev, request_id); -break ; -case TEST_UNIT_READY : -dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught TEST_UNIT_READY.\n" ); - retval =tw_scsiop_test_unit_ready (tw_dev, request_id); -break ; -case INQUIRY : -dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught INQUIRY.\n" ); - retval =tw_scsiop_inquiry (tw_dev, request_id); -break ; -case READ_CAPACITY : -dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught READ_CAPACITY.\n" ); - retval =tw_scsiop_read_capacity (tw_dev, request_id); -break ; -case REQUEST_SENSE : -dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught REQUEST_SENSE.\n" ); - retval =tw_scsiop_request_sense (tw_dev, request_id); -break ; -case MODE_SENSE : -dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught MODE_SENSE.\n" ); - retval =tw_scsiop_mode_sense (tw_dev, request_id); -break ; -case SYNCHRONIZE_CACHE : -dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught SYNCHRONIZE_CACHE.\n" ); - retval =tw_scsiop_synchronize_cache (tw_dev, request_id); -break ; -case TW_IOCTL : -printk (KERN_WARNING "3w-xxxx: SCSI_IOCTL_SEND_COMMAND deprecated, please update your 3ware tools.\n" ); -break ; -default : -printk (KERN_NOTICE "3w-xxxx: scsi%d: Unknown scsi opcode: 0x%x\n" , tw_dev->host->host_no, *command); - tw_dev->state[request_id] =TW_S_COMPLETED ; -tw_state_request_finish (tw_dev, request_id); - SCpnt->result = (DRIVER_SENSE <<24 ) |SAM_STAT_CHECK_CONDITION ; -scsi_build_sense_buffer (1 , SCpnt->sense_buffer,ILLEGAL_REQUEST ,0x20 ,0 ); -done (SCpnt); - retval =0 ; +case READ_10 : +case READ_6 : +case WRITE_10 : +case WRITE_6 : +dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught READ/WRITE.\n" ); + retval =tw_scsiop_read_write (tw_dev, request_id); +break ; +case TEST_UNIT_READY : +dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught TEST_UNIT_READY.\n" ); + retval =tw_scsiop_test_unit_ready (tw_dev, request_id); +break ; +case INQUIRY : +dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught INQUIRY.\n" ); + retval =tw_scsiop_inquiry (tw_dev, request_id); +break ; +case READ_CAPACITY : +dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught READ_CAPACITY.\n" ); + retval =tw_scsiop_read_capacity (tw_dev, request_id); +break ; +case REQUEST_SENSE : +dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught REQUEST_SENSE.\n" ); + retval =tw_scsiop_request_sense (tw_dev, request_id); +break ; +case MODE_SENSE : +dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught MODE_SENSE.\n" ); + retval =tw_scsiop_mode_sense (tw_dev, request_id); +break ; +case SYNCHRONIZE_CACHE : +dprintk (KERN_NOTICE "3w-xxxx: tw_scsi_queue(): caught SYNCHRONIZE_CACHE.\n" ); + retval =tw_scsiop_synchronize_cache (tw_dev, request_id); +break ; +case TW_IOCTL : +printk (KERN_WARNING "3w-xxxx: SCSI_IOCTL_SEND_COMMAND deprecated, please update your 3ware tools.\n" ); +break ; +default : +printk (KERN_NOTICE "3w-xxxx: scsi%d: Unknown scsi opcode: 0x%x\n" , tw_dev->host->host_no, *command); + tw_dev->state[request_id] =TW_S_COMPLETED ; +tw_state_request_finish (tw_dev, request_id); +scsi_build_sense_buffer (1 , SCpnt->sense_buffer,ILLEGAL_REQUEST ,0x20 ,0 ); +done (SCpnt); + retval =0 ; }if (retval) { tw_dev->state[request_id] =TW_S_COMPLETED ;
@@ -1997,7 +1996,7 @@ static int tw_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cstatic DEF_SCSI_QCMD (tw_scsi_queue)/* This function is the interrupt service routine */ -static irqreturn_t tw_interrupt(int irq, void *dev_instance) +static irqreturn_t tw_interrupt(int irq, void *dev_instance) {int request_id;u32 status_reg_value;
@@ -2073,7 +2072,7 @@ static irqreturn_t tw_interrupt(int irq, void *dev_instance) } }/* If there are no more pending requests, we mask command interrupt */ -if (tw_dev->pending_request_count ==0 ) +if (tw_dev->pending_request_count ==0 )TW_MASK_COMMAND_INTERRUPT (tw_dev); }
@@ -2174,7 +2173,7 @@ static irqreturn_t tw_interrupt(int irq, void *dev_instance) tw_dev->posted_request_count--; } } - +/* Check for valid status after each drain */ status_reg_value =inl (TW_STATUS_REG_ADDR (tw_dev));if (tw_check_bits (status_reg_value)) {
@@ -2244,7 +2243,7 @@ static struct scsi_host_template driver_template = { .this_id = -1, .sg_tablesize = TW_MAX_SGL_LENGTH, .max_sectors = TW_MAX_SECTORS, - .cmd_per_lun = TW_MAX_CMDS_PER_LUN, + .cmd_per_lun = TW_MAX_CMDS_PER_LUN, .shost_attrs = tw_host_attrs, .emulated = 1, .no_write_same = 1,
drivers/scsi/3w-xxxx.h +104 -95
269 lines not on this page · raw message
Signature · 1 line
2.29.2
PATCH v3 4/35 3w-sas: Whitespace cleanup
In reply to Hannes Reinecke--- drivers/scsi/3w-sas.c | 52 +++++++++---------- drivers/scsi/3w-sas.h | 118 ++++++++++++++++++++++++------------------ 2 files changed, 93 insertions(+), 77 deletions(-)
drivers/scsi/3w-sas.c +26 -26
@@ -120,7 +120,7 @@ static struct bin_attribute twl_sysfs_aen_read_attr = { .attr = { .name = "3ware_aen_read", .mode = S_IRUSR, - }, + }, .size = 0, .read = twl_sysfs_aen_read };
@@ -151,7 +151,7 @@ static struct bin_attribute twl_sysfs_compat_info_attr = { .attr = { .name = "3ware_compat_info", .mode = S_IRUSR, - }, + }, .size = 0, .read = twl_sysfs_compat_info };
@@ -174,7 +174,7 @@ static ssize_t twl_show_stats(struct device *dev,"Last sector count: %4d\n" "Max sector count: %4d\n" "SCSI Host Resets: %4d\n" -"AEN's: %4d\n" , +"AEN's: %4d\n" ,TW_DRIVER_VERSION , tw_dev->posted_request_count, tw_dev->max_posted_request_count,
@@ -191,7 +191,7 @@ static ssize_t twl_show_stats(struct device *dev,/* stats sysfs attribute initializer */ static struct device_attribute twl_host_stats_attr = { .attr = { - .name ="3ware_stats" , + .name ="3ware_stats" , .mode =S_IRUGO , }, .show = twl_show_stats
@@ -432,7 +432,7 @@ static void twl_aen_sync_time(TW_Device_Extension *tw_dev, int request_id) param->parameter_id =cpu_to_le16 (0x3 );/* SchedulerTime */ param->parameter_size_bytes =cpu_to_le16 (4 ); -/* Convert system time in UTC to local time seconds since last +/* Convert system time in UTC to local time seconds since last Sunday 12:00AM */ local_time = (ktime_get_real_seconds () - (sys_tz.tz_minuteswest *60 ));div_u64_rem (local_time - (3 *86400 ),604800 , &schedulertime);
@@ -483,7 +483,7 @@ static int twl_aen_complete(TW_Device_Extension *tw_dev, int request_id)/* Keep reading the queue in case there are more aen's */ if (twl_aen_read_queue (tw_dev, request_id)) goto out2; -else { +else { retval =0 ; goto out; }
@@ -548,7 +548,7 @@ static int twl_poll_response(TW_Device_Extension *tw_dev, int request_id, int semsleep (50 ); } retval =0 ; -out: +out:return retval; }/* End twl_poll_response() */
@@ -802,7 +802,7 @@ static long twl_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long/* Now copy in the command packet response */ memcpy (&(tw_ioctl->firmware_command), tw_dev->command_packet_virt[request_id],sizeof (TW_Command_Full)); - +/* Now complete the io */ spin_lock_irqsave (tw_dev->host->host_lock, flags); tw_dev->posted_request_count--;
@@ -879,7 +879,7 @@ static int twl_fill_sense(TW_Device_Extension *tw_dev, int i, int request_id, in tw_dev->host->host_no,TW_MESSAGE_SOURCE_CONTROLLER_ERROR , header->status_block.error, - error_str, + error_str, header->err_specific_desc); else printk(KERN_WARNING "3w-sas: ERROR: (0x%02X:0x%04X): %s:%s.\n",
@@ -937,8 +937,8 @@ static void *twl_get_param(TW_Device_Extension *tw_dev, int request_id, int tabl command_packet = &full_command_packet->command.oldcommand; command_packet->opcode__sgloffset =TW_OPSGL_IN (2 ,TW_OP_GET_PARAM ); - command_packet->size =TW_COMMAND_SIZE ; - command_packet->request_id = request_id; + command_packet->size =TW_COMMAND_SIZE ; + command_packet->request_id = request_id; command_packet->byte6_offset.block_count =cpu_to_le16 (1 );/* Now setup the param */
@@ -968,14 +968,14 @@ static void *twl_get_param(TW_Device_Extension *tw_dev, int request_id, int tabl/* This function will send an initconnection command to controller */ static int twl_initconnection (TW_Device_Extension *tw_dev,int message_credits, -u32 set_features,unsigned short current_fw_srl, -unsigned short current_fw_arch_id, -unsigned short current_fw_branch, -unsigned short current_fw_build, -unsigned short *fw_on_ctlr_srl, -unsigned short *fw_on_ctlr_arch_id, -unsigned short *fw_on_ctlr_branch, -unsigned short *fw_on_ctlr_build, +u32 set_features,unsigned short current_fw_srl, +unsigned short current_fw_arch_id, +unsigned short current_fw_branch, +unsigned short current_fw_build, +unsigned short *fw_on_ctlr_srl, +unsigned short *fw_on_ctlr_arch_id, +unsigned short *fw_on_ctlr_branch, +unsigned short *fw_on_ctlr_build,u32 *init_connect_result) {TW_Command_Full *full_command_packet;
@@ -986,7 +986,7 @@ static int twl_initconnection(TW_Device_Extension *tw_dev, int message_credits, full_command_packet = tw_dev->command_packet_virt[request_id];memset (full_command_packet,0 ,sizeof (TW_Command_Full)); full_command_packet->header.header_desc.size_header =128 ; - + tw_initconnect = (TW_Initconnect *)&full_command_packet->command.oldcommand; tw_initconnect->opcode__reserved =TW_OPRES_IN (0 ,TW_OP_INIT_CONNECTION ); tw_initconnect->request_id = request_id;
@@ -1004,7 +1004,7 @@ static int twl_initconnection(TW_Device_Extension *tw_dev, int message_credits, tw_initconnect->fw_arch_id =cpu_to_le16 (current_fw_arch_id); tw_initconnect->fw_branch =cpu_to_le16 (current_fw_branch); tw_initconnect->fw_build =cpu_to_le16 (current_fw_build); - }else + }else tw_initconnect->size =TW_INIT_COMMAND_PACKET_SIZE ;/* Send command packet to the board */
@@ -1211,7 +1211,7 @@ static irqreturn_t twl_interrupt(int irq, void *dev_instance)if (!error) cmd->result = (DID_OK <<16 ); - +/* Report residual bytes for single sgl */ if ((scsi_sg_count (cmd) <=1 ) && (full_command_packet->command.newcommand.status ==0 )) {if (full_command_packet->command.newcommand.sg_list[0 ].length <scsi_bufflen (tw_dev->srb[request_id]))
@@ -1245,7 +1245,7 @@ static int twl_poll_register(TW_Device_Extension *tw_dev, void *reg, u32 value, reg_value =readl (reg); before = jiffies; -while ((reg_value & value) != result) { +while ((reg_value & value) != result) { reg_value =readl (reg);if (time_after (jiffies, before +HZ * seconds)) goto out;
@@ -1470,7 +1470,7 @@ static int twl_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_/* Save done function into scsi_cmnd struct */ SCpnt->scsi_done = done; - +/* Get a free request id */ twl_get_request_id (tw_dev, &request_id);
@@ -1524,7 +1524,7 @@ static void twl_shutdown(struct pci_dev *pdev) tw_dev = (TW_Device_Extension *)host->hostdata; -if (tw_dev->online) +if (tw_dev->online)__twl_shutdown (tw_dev); }/* End twl_shutdown() */
@@ -1675,7 +1675,7 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)/* Re-enable interrupts on the card */ TWL_UNMASK_INTERRUPTS (tw_dev); - +/* Finally, scan the host */ scsi_scan_host (host);
drivers/scsi/3w-sas.h +67 -51
191 lines not on this page · raw message
Signature · 1 line
2.29.2
PATCH v3 3/35 3w-9xxx: Whitespace cleanup
In reply to Hannes Reinecke--- drivers/scsi/3w-9xxx.c | 56 +++++++-------- drivers/scsi/3w-9xxx.h | 156 ++++++++++++++++++++++------------------- 2 files changed, 113 insertions(+), 99 deletions(-)
drivers/scsi/3w-9xxx.c +28 -28
@@ -128,14 +128,14 @@ static int twa_fill_sense(TW_Device_Extension *tw_dev, int request_id, int copy_static void twa_free_request_id (TW_Device_Extension *tw_dev,int request_id);static void twa_get_request_id (TW_Device_Extension *tw_dev,int *request_id);static int twa_initconnection (TW_Device_Extension *tw_dev,int message_credits, -u32 set_features,unsigned short current_fw_srl, -unsigned short current_fw_arch_id, -unsigned short current_fw_branch, -unsigned short current_fw_build, -unsigned short *fw_on_ctlr_srl, -unsigned short *fw_on_ctlr_arch_id, -unsigned short *fw_on_ctlr_branch, -unsigned short *fw_on_ctlr_build, +u32 set_features,unsigned short current_fw_srl, +unsigned short current_fw_arch_id, +unsigned short current_fw_branch, +unsigned short current_fw_build, +unsigned short *fw_on_ctlr_srl, +unsigned short *fw_on_ctlr_arch_id, +unsigned short *fw_on_ctlr_branch, +unsigned short *fw_on_ctlr_build,u32 *init_connect_result);static void twa_load_sgl (TW_Device_Extension *tw_dev,TW_Command_Full *full_command_packet,int request_id,dma_addr_t dma_handle,int length);static int twa_poll_response (TW_Device_Extension *tw_dev,int request_id,int seconds);
@@ -171,7 +171,7 @@ static ssize_t twa_show_stats(struct device *dev,"Last sector count: %4d\n" "Max sector count: %4d\n" "SCSI Host Resets: %4d\n" -"AEN's: %4d\n" , +"AEN's: %4d\n" ,TW_DRIVER_VERSION , tw_dev->posted_request_count, tw_dev->max_posted_request_count,
@@ -190,7 +190,7 @@ static ssize_t twa_show_stats(struct device *dev,/* Create sysfs 'stats' entry */ static struct device_attribute twa_host_stats_attr = { .attr = { - .name ="stats" , + .name ="stats" , .mode =S_IRUGO , }, .show = twa_show_stats
@@ -242,7 +242,7 @@ static int twa_aen_complete(TW_Device_Extension *tw_dev, int request_id)/* Keep reading the queue in case there are more aen's */ if (twa_aen_read_queue (tw_dev, request_id)) goto out2; -else { +else { retval =0 ; goto out; }
@@ -497,7 +497,7 @@ static void twa_aen_sync_time(TW_Device_Extension *tw_dev, int request_id) param->parameter_id =cpu_to_le16 (0x3 );/* SchedulerTime */ param->parameter_size_bytes =cpu_to_le16 (4 ); -/* Convert system time in UTC to local time seconds since last +/* Convert system time in UTC to local time seconds since last Sunday 12:00AM */ local_time = (ktime_get_real_seconds () - (sys_tz.tz_minuteswest *60 ));div_u64_rem (local_time - (3 *86400 ),604800 , &schedulertime);
@@ -729,7 +729,7 @@ static long twa_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned long/* Now copy in the command packet response */ memcpy (&(tw_ioctl->firmware_command), tw_dev->command_packet_virt[request_id],sizeof (TW_Command_Full)); - +/* Now complete the io */ spin_lock_irqsave (tw_dev->host->host_lock, flags); tw_dev->posted_request_count--;
@@ -766,7 +766,7 @@ static long twa_chrdev_ioctl(struct file *file, unsigned int cmd, unsigned longif (tw_dev->aen_clobber) { tw_ioctl->driver_command.status =TW_IOCTL_ERROR_STATUS_AEN_CLOBBER ; tw_dev->aen_clobber =0 ; - }else + }else tw_ioctl->driver_command.status =0 ; event_index = tw_dev->error_index; }else {
@@ -1067,8 +1067,8 @@ static void *twa_get_param(TW_Device_Extension *tw_dev, int request_id, int tabl command_packet = &full_command_packet->command.oldcommand; command_packet->opcode__sgloffset =TW_OPSGL_IN (2 ,TW_OP_GET_PARAM ); - command_packet->size =TW_COMMAND_SIZE ; - command_packet->request_id = request_id; + command_packet->size =TW_COMMAND_SIZE ; + command_packet->request_id = request_id; command_packet->byte6_offset.block_count =cpu_to_le16 (1 );/* Now setup the param */
@@ -1106,14 +1106,14 @@ static void twa_get_request_id(TW_Device_Extension *tw_dev, int *request_id)/* This function will send an initconnection command to controller */ static int twa_initconnection (TW_Device_Extension *tw_dev,int message_credits, -u32 set_features,unsigned short current_fw_srl, -unsigned short current_fw_arch_id, -unsigned short current_fw_branch, -unsigned short current_fw_build, -unsigned short *fw_on_ctlr_srl, -unsigned short *fw_on_ctlr_arch_id, -unsigned short *fw_on_ctlr_branch, -unsigned short *fw_on_ctlr_build, +u32 set_features,unsigned short current_fw_srl, +unsigned short current_fw_arch_id, +unsigned short current_fw_branch, +unsigned short current_fw_build, +unsigned short *fw_on_ctlr_srl, +unsigned short *fw_on_ctlr_arch_id, +unsigned short *fw_on_ctlr_branch, +unsigned short *fw_on_ctlr_build,u32 *init_connect_result) {TW_Command_Full *full_command_packet;
@@ -1124,7 +1124,7 @@ static int twa_initconnection(TW_Device_Extension *tw_dev, int message_credits, full_command_packet = tw_dev->command_packet_virt[request_id];memset (full_command_packet,0 ,sizeof (TW_Command_Full)); full_command_packet->header.header_desc.size_header =128 ; - + tw_initconnect = (TW_Initconnect *)&full_command_packet->command.oldcommand; tw_initconnect->opcode__reserved =TW_OPRES_IN (0 ,TW_OP_INIT_CONNECTION ); tw_initconnect->request_id = request_id;
@@ -1142,7 +1142,7 @@ static int twa_initconnection(TW_Device_Extension *tw_dev, int message_credits, tw_initconnect->fw_arch_id =cpu_to_le16 (current_fw_arch_id); tw_initconnect->fw_branch =cpu_to_le16 (current_fw_branch); tw_initconnect->fw_build =cpu_to_le16 (current_fw_build); - }else + }else tw_initconnect->size =TW_INIT_COMMAND_PACKET_SIZE ;/* Send command packet to the board */
@@ -1455,7 +1455,7 @@ static int twa_poll_response(TW_Device_Extension *tw_dev, int request_id, int se/* This function will poll the status register for a flag */ static int twa_poll_status (TW_Device_Extension *tw_dev,u32 flag,int seconds) { -u32 status_reg_value; +u32 status_reg_value;unsigned long before;int retval =1 ;
@@ -1770,7 +1770,7 @@ static int twa_scsi_queue_lck(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_/* Save done function into scsi_cmnd struct */ SCpnt->scsi_done = done; - +/* Get a free request id */ twa_get_request_id (tw_dev, &request_id);
drivers/scsi/3w-9xxx.h +85 -71
259 lines not on this page · raw message
Signature · 1 line
2.29.2
v3 cover SCSI result handling cleanup, part 1
Hi all,
this is the first part of an attempt to clean up SCSI result handling. The patchset primarily cleans up various drivers by fixing up whitespaces or move to standard definitions.
It also fixes some minor issues in some drivers which set the wrong result values.
And, of course, another attempt to kill the gdth driver
I have a larger patchset based on this one to update the SCSI result handling for all drivers, but decided to split things in two to not overload reviewers
As usual, comments and reviews are welcome.
Changes to v1:
- Add reviews from Christoph
- Included review from Finn Thain
- Add set_status_byte() helper
- Add cleanup for dc395c
- Add additional patch for using SAM status values instead of the shifted linux versions
Changes to v2:
- Add Reviewed-by: tags
- Drop additional patches again
Changes to v3:
- Rebased to 5.12/scsi-queue
- Fixup kbuild failures
- Correct review tag from hch
Hannes Reinecke (35):
scsi: drop gdth driver
3w-xxxx: Whitespace cleanup
3w-9xxx: Whitespace cleanup
3w-sas: Whitespace cleanup
atp870u: Whitespace cleanup
aic7xxx,aic79xx: Whitespace cleanup
aic7xxx,aic79xx: kill pointless forward declarations aic7xxx,aic79xxx: remove driver-defined SAM status definitions
bfa: drop driver-defined SCSI status codes
acornscsi: use standard defines
nsp32: fixup status handling
dc395: drop private SAM status code definitions
qla4xxx: use standard SAM status definitions
zfcp: do not set COMMAND_COMPLETE
aacraid: avoid setting message byte on completion
hpsa: do not set COMMAND_COMPLETE
stex: do not set COMMAND_COMPLETE
nsp_cs: drop internal SCSI message definition aic7xxx,aic79xx: drop internal SCSI message definition
dc395x: drop internal SCSI message definitions
initio: drop internal SCSI message definition
scsi_debug: do not set COMMAND_COMPLETE
ufshcd: do not set COMMAND_COMPLETE
atp870u: use standard definitions
mac53c94: Do not set invalid command result
dpt_i2o: use DID_ERROR instead of INITIATOR_ERROR message
scsi: add 'set_status_byte()' accessor
esp_scsi: use host byte as last argument to esp_cmd_is_done()
esp_scsi: do not set SCSI message byte
wd33c93: use SCSI status
ips: use correct command completion on error
storvsc: Return DID_ERROR for invalid commands
qla2xxx: fc_remote_port_chkready() returns a SCSI result value
advansys: kill driver_defined status byte accessors
ncr53c8xx: Use SAM status values
Documentation/kbuild/makefiles.rst | 4 +- Documentation/process/magic-number.rst | 2 - Documentation/scsi/scsi-parameters.rst | 3 - .../userspace-api/ioctl/ioctl-number.rst | 1 - drivers/s390/scsi/zfcp_fc.h | 1 - drivers/scsi/3w-9xxx.c | 56 +- drivers/scsi/3w-9xxx.h | 156 +- drivers/scsi/3w-sas.c | 52 +- drivers/scsi/3w-sas.h | 118 +- drivers/scsi/3w-xxxx.c | 251 +- drivers/scsi/3w-xxxx.h | 199 +- drivers/scsi/Kconfig | 15 +- drivers/scsi/Makefile | 2 - drivers/scsi/aacraid/aachba.c | 173 +- drivers/scsi/advansys.c | 84 +- drivers/scsi/aic7xxx/aic79xx.h | 36 +- drivers/scsi/aic7xxx/aic79xx_core.c | 257 +- drivers/scsi/aic7xxx/aic79xx_osm.c | 20 +- drivers/scsi/aic7xxx/aic79xx_osm.h | 37 +- drivers/scsi/aic7xxx/aic79xx_osm_pci.c | 6 +- drivers/scsi/aic7xxx/aic79xx_proc.c | 13 +- drivers/scsi/aic7xxx/aic7xxx_93cx6.c | 4 +- drivers/scsi/aic7xxx/aic7xxx_core.c | 263 +- drivers/scsi/aic7xxx/aic7xxx_osm.c | 88 +- drivers/scsi/aic7xxx/aic7xxx_osm.h | 39 +- drivers/scsi/aic7xxx/aic7xxx_proc.c | 15 +- drivers/scsi/aic7xxx/aiclib.h | 15 - drivers/scsi/aic7xxx/scsi_message.h | 41 - drivers/scsi/arm/acornscsi.c | 14 +- drivers/scsi/atp870u.c | 451 +- drivers/scsi/atp870u.h | 14 +- drivers/scsi/bfa/bfa_fc.h | 15 - drivers/scsi/bfa/bfa_fcpim.c | 2 +- drivers/scsi/bfa/bfad_im.c | 2 +- drivers/scsi/dc395x.c | 28 +- drivers/scsi/dc395x.h | 38 - drivers/scsi/dpt_i2o.c | 2 +- drivers/scsi/esp_scsi.c | 23 +- drivers/scsi/gdth.c | 4322 ----------------- drivers/scsi/gdth.h | 981 ---- drivers/scsi/gdth_ioctl.h | 251 - drivers/scsi/gdth_proc.c | 586 --- drivers/scsi/gdth_proc.h | 18 - drivers/scsi/hpsa.c | 4 +- drivers/scsi/initio.c | 64 +- drivers/scsi/initio.h | 25 - drivers/scsi/ips.c | 9 +- drivers/scsi/mac53c94.c | 1 - drivers/scsi/ncr53c8xx.c | 83 +- drivers/scsi/ncr53c8xx.h | 16 - drivers/scsi/nsp32.c | 2 +- drivers/scsi/pcmcia/nsp_cs.c | 12 +- drivers/scsi/pcmcia/nsp_cs.h | 11 - drivers/scsi/qla2xxx/qla_os.c | 2 +- drivers/scsi/qla4xxx/ql4_fw.h | 1 - drivers/scsi/qla4xxx/ql4_isr.c | 2 +- drivers/scsi/scsi_debug.c | 2 +- drivers/scsi/stex.c | 25 +- drivers/scsi/storvsc_drv.c | 2 +- drivers/scsi/ufs/ufshcd.c | 4 +- drivers/scsi/wd33c93.c | 6 +- include/scsi/scsi.h | 1 + include/scsi/scsi_cmnd.h | 5 + 63 files changed, 1307 insertions(+), 7668 deletions(-) delete mode 100644 drivers/scsi/gdth.c delete mode 100644 drivers/scsi/gdth.h delete mode 100644 drivers/scsi/gdth_ioctl.h delete mode 100644 drivers/scsi/gdth_proc.c delete mode 100644 drivers/scsi/gdth_proc.h
Signature · 1 line
2.29.2
PATCH v3 9/35 bfa: drop driver-defined SCSI status codes
Drop the driver-defined SCSI status code and use the generic ones instead.
--- drivers/scsi/bfa/bfa_fc.h | 15 --------------- drivers/scsi/bfa/bfa_fcpim.c | 2 +- drivers/scsi/bfa/bfad_im.c | 2 +- 3 files changed, 2 insertions(+), 17 deletions(-)
drivers/scsi/bfa/bfa_fc.h +0 -15
@@ -33,21 +33,6 @@ struct scsi_cdb_s {u8 scsi_cdb[SCSI_MAX_CDBLEN ]; }; -/* ------------------------------------------------------------ -* SCSI status byte values -* ------------------------------------------------------------ -*/ -#define SCSI_STATUS_GOOD 0x00 -#define SCSI_STATUS_CHECK_CONDITION 0x02 -#define SCSI_STATUS_CONDITION_MET 0x04 -#define SCSI_STATUS_BUSY 0x08 -#define SCSI_STATUS_INTERMEDIATE 0x10 -#define SCSI_STATUS_ICM 0x14/* intermediate condition met */ -#define SCSI_STATUS_RESERVATION_CONFLICT 0x18 -#define SCSI_STATUS_COMMAND_TERMINATED 0x22 -#define SCSI_STATUS_QUEUE_FULL 0x28 -#define SCSI_STATUS_ACA_ACTIVE 0x30 -#define SCSI_MAX_ALLOC_LEN 0xFF/* maximum allocarion length */ /*
drivers/scsi/bfa/bfa_fcpim.c +1 -1
@@ -2146,7 +2146,7 @@ __bfa_cb_ioim_comp(void *cbarg, bfa_boolean_t complete)/* * setup sense information, if present */ -if ((m->scsi_status ==SCSI_STATUS_CHECK_CONDITION ) && +if ((m->scsi_status ==SAM_STAT_CHECK_CONDITION ) && m->sns_len) { sns_len = m->sns_len; snsinfo = BFA_SNSINFO_FROM_TAG(ioim->fcpim->fcp,
drivers/scsi/bfa/bfad_im.c +1 -1
@@ -106,7 +106,7 @@ bfa_cb_ioim_good_comp(void *drv, struct bfad_ioim_s *dio)struct bfad_itnim_data_s *itnim_data;struct bfad_itnim_s *itnim; - cmnd->result =DID_OK <<16 |SCSI_STATUS_GOOD ; + cmnd->result =DID_OK <<16 |SAM_STAT_GOOD ;/* Unmap DMA, if host is NULL, it means a scsi passthru cmd */ if (cmnd->device->host !=NULL )
Signature · 1 line
2.29.2
PATCH v3 7/35 aic7xxx,aic79xx: kill pointless forward declarations
In reply to Hannes Reinecke--- drivers/scsi/aic7xxx/aic79xx_osm.h | 23 ----------------------- drivers/scsi/aic7xxx/aic7xxx_osm.h | 23 ----------------------- 2 files changed, 46 deletions(-)
drivers/scsi/aic7xxx/aic79xx_osm.h +0 -23
@@ -497,29 +497,6 @@ int ahd_proc_write_seeprom(struct Scsi_Host *, char *, int);int ahd_linux_show_info (struct seq_file *,struct Scsi_Host *);/*********************** Transaction Access Wrappers **************************/ -static inline void ahd_cmd_set_transaction_status (struct scsi_cmnd *,uint32_t ); -static inline void ahd_set_transaction_status (struct scb *,uint32_t ); -static inline void ahd_cmd_set_scsi_status (struct scsi_cmnd *,uint32_t ); -static inline void ahd_set_scsi_status (struct scb *,uint32_t ); -static inline uint32_t ahd_cmd_get_transaction_status (struct scsi_cmnd *cmd); -static inline uint32_t ahd_get_transaction_status (struct scb *); -static inline uint32_t ahd_cmd_get_scsi_status (struct scsi_cmnd *cmd); -static inline uint32_t ahd_get_scsi_status (struct scb *); -static inline void ahd_set_transaction_tag (struct scb *,int ,u_int ); -static inline u_long ahd_get_transfer_length (struct scb *); -static inline int ahd_get_transfer_dir (struct scb *); -static inline void ahd_set_residual (struct scb *,u_long ); -static inline void ahd_set_sense_residual (struct scb *scb,u_long resid); -static inline u_long ahd_get_residual (struct scb *); -static inline u_long ahd_get_sense_residual (struct scb *); -static inline int ahd_perform_autosense (struct scb *); -static inline uint32_t ahd_get_sense_bufsize (struct ahd_softc *, -struct scb *); -static inline void ahd_notify_xfer_settings_change (struct ahd_softc *, -struct ahd_devinfo *); -static inline void ahd_platform_scb_free (struct ahd_softc *ahd, -struct scb *scb); -static inline void ahd_freeze_scb (struct scb *scb);static inline void ahd_cmd_set_transaction_status (struct scsi_cmnd *cmd,uint32_t status)
drivers/scsi/aic7xxx/aic7xxx_osm.h +0 -23
@@ -515,29 +515,6 @@ int ahc_linux_show_info(struct seq_file *, struct Scsi_Host *);/*************************** Domain Validation ********************************/ /*********************** Transaction Access Wrappers *************************/ -static inline void ahc_cmd_set_transaction_status (struct scsi_cmnd *,uint32_t ); -static inline void ahc_set_transaction_status (struct scb *,uint32_t ); -static inline void ahc_cmd_set_scsi_status (struct scsi_cmnd *,uint32_t ); -static inline void ahc_set_scsi_status (struct scb *,uint32_t ); -static inline uint32_t ahc_cmd_get_transaction_status (struct scsi_cmnd *cmd); -static inline uint32_t ahc_get_transaction_status (struct scb *); -static inline uint32_t ahc_cmd_get_scsi_status (struct scsi_cmnd *cmd); -static inline uint32_t ahc_get_scsi_status (struct scb *); -static inline void ahc_set_transaction_tag (struct scb *,int ,u_int ); -static inline u_long ahc_get_transfer_length (struct scb *); -static inline int ahc_get_transfer_dir (struct scb *); -static inline void ahc_set_residual (struct scb *,u_long ); -static inline void ahc_set_sense_residual (struct scb *scb,u_long resid); -static inline u_long ahc_get_residual (struct scb *); -static inline u_long ahc_get_sense_residual (struct scb *); -static inline int ahc_perform_autosense (struct scb *); -static inline uint32_t ahc_get_sense_bufsize (struct ahc_softc *, -struct scb *); -static inline void ahc_notify_xfer_settings_change (struct ahc_softc *, -struct ahc_devinfo *); -static inline void ahc_platform_scb_free (struct ahc_softc *ahc, -struct scb *scb); -static inline void ahc_freeze_scb (struct scb *scb);static inline void ahc_cmd_set_transaction_status (struct scsi_cmnd *cmd,uint32_t status)
Signature · 1 line
2.29.2
PATCH v3 8/35 aic7xxx,aic79xxx: remove driver-defined SAM status definitions
In reply to Hannes ReineckeReplace the driver-defined SAM status definitions with the standard mid-layer defined ones.
--- drivers/scsi/aic7xxx/aic79xx_core.c | 8 ++++---- drivers/scsi/aic7xxx/aic79xx_osm.c | 16 ++++++++-------- drivers/scsi/aic7xxx/aic7xxx_core.c | 6 +++--- drivers/scsi/aic7xxx/aic7xxx_osm.c | 12 ++++++------ drivers/scsi/aic7xxx/aiclib.h | 15 --------------- 5 files changed, 21 insertions(+), 36 deletions(-)
drivers/scsi/aic7xxx/aic79xx_core.c +4 -4
@@ -8911,7 +8911,7 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb)break ; } } -if (siu->status ==SCSI_STATUS_OK ) +if (siu->status ==SAM_STAT_GOOD )ahd_set_transaction_status (scb,CAM_REQ_CMP_ERR ); }
@@ -8925,8 +8925,8 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb)ahd_done (ahd, scb);break ; } -case SCSI_STATUS_CMD_TERMINATED : -case SCSI_STATUS_CHECK_COND : +case SAM_STAT_COMMAND_TERMINATED : +case SAM_STAT_CHECK_CONDITION : {struct ahd_devinfo devinfo;struct ahd_dma_seg *sg;
@@ -9016,7 +9016,7 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb)ahd_queue_scb (ahd, scb);break ; } -case SCSI_STATUS_OK : +case SAM_STAT_GOOD :printk ("%s: Interrupted for status of 0???\n" ,ahd_name (ahd)); fallthrough;
drivers/scsi/aic7xxx/aic79xx_osm.c +8 -8
@@ -1834,7 +1834,7 @@ ahd_done(struct ahd_softc *ahd, struct scb *scb)if (dev->openings ==1 &&ahd_get_transaction_status (scb) ==CAM_REQ_CMP - &&ahd_get_scsi_status (scb) !=SCSI_STATUS_QUEUE_FULL ) + &&ahd_get_scsi_status (scb) !=SAM_STAT_TASK_SET_FULL ) dev->tag_success_count++;/* * Some devices deal with temporary internal resource
@@ -1891,8 +1891,8 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd,switch (ahd_get_scsi_status (scb)) {default :break ; -case SCSI_STATUS_CHECK_COND : -case SCSI_STATUS_CMD_TERMINATED : +case SAM_STAT_CHECK_CONDITION : +case SAM_STAT_COMMAND_TERMINATED : {struct scsi_cmnd *cmd;
@@ -1947,7 +1947,7 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd, }break ; } -case SCSI_STATUS_QUEUE_FULL : +case SAM_STAT_TASK_SET_FULL :/* * By the time the core driver has returned this * command, all other commands that were queued
@@ -1993,7 +1993,7 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd, dev->last_queuefull_same_count =0 ; }ahd_set_transaction_status (scb,CAM_REQUEUE_REQ ); -ahd_set_scsi_status (scb,SCSI_STATUS_OK ); +ahd_set_scsi_status (scb,SAM_STAT_GOOD );ahd_platform_set_tags (ahd, sdev, &devinfo, (dev->flags &AHD_DEV_Q_BASIC ) ?AHD_QUEUE_BASIC :AHD_QUEUE_TAGGED );
@@ -2007,7 +2007,7 @@ ahd_linux_handle_scsi_status(struct ahd_softc *ahd,ahd_platform_set_tags (ahd, sdev, &devinfo, (dev->flags &AHD_DEV_Q_BASIC ) ?AHD_QUEUE_BASIC :AHD_QUEUE_TAGGED ); -ahd_set_scsi_status (scb,SCSI_STATUS_BUSY ); +ahd_set_scsi_status (scb,SAM_STAT_BUSY ); } }
@@ -2039,8 +2039,8 @@ ahd_linux_queue_cmd_complete(struct ahd_softc *ahd, struct scsi_cmnd *cmd) scsi_status =ahd_cmd_get_scsi_status (cmd);switch (scsi_status) { -case SCSI_STATUS_CMD_TERMINATED : -case SCSI_STATUS_CHECK_COND : +case SAM_STAT_COMMAND_TERMINATED : +case SAM_STAT_CHECK_CONDITION :if ((cmd->result >>24 ) !=DRIVER_SENSE ) { do_fallback =1 ; }else {
drivers/scsi/aic7xxx/aic7xxx_core.c +3 -3
@@ -1041,12 +1041,12 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat)ahc_freeze_scb (scb);ahc_set_scsi_status (scb, hscb->shared_data.status.scsi_status);switch (hscb->shared_data.status.scsi_status) { -case SCSI_STATUS_OK : +case SAM_STAT_GOOD :printk ("%s: Interrupted for status of 0???\n" ,ahc_name (ahc));break ; -case SCSI_STATUS_CMD_TERMINATED : -case SCSI_STATUS_CHECK_COND : +case SAM_STAT_COMMAND_TERMINATED : +case SAM_STAT_CHECK_CONDITION : {struct ahc_dma_seg *sg;struct scsi_sense *sc;
drivers/scsi/aic7xxx/aic7xxx_osm.c +6 -6
@@ -1759,7 +1759,7 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb)if (dev->openings ==1 &&ahc_get_transaction_status (scb) ==CAM_REQ_CMP - &&ahc_get_scsi_status (scb) !=SCSI_STATUS_QUEUE_FULL ) + &&ahc_get_scsi_status (scb) !=SAM_STAT_TASK_SET_FULL ) dev->tag_success_count++;/* * Some devices deal with temporary internal resource
@@ -1816,8 +1816,8 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,switch (ahc_get_scsi_status (scb)) {default :break ; -case SCSI_STATUS_CHECK_COND : -case SCSI_STATUS_CMD_TERMINATED : +case SAM_STAT_CHECK_CONDITION : +case SAM_STAT_COMMAND_TERMINATED : {struct scsi_cmnd *cmd;
@@ -1855,7 +1855,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc, }break ; } -case SCSI_STATUS_QUEUE_FULL : +case SAM_STAT_TASK_SET_FULL : {/* * By the time the core driver has returned this
@@ -1899,7 +1899,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc, dev->last_queuefull_same_count =0 ; }ahc_set_transaction_status (scb,CAM_REQUEUE_REQ ); -ahc_set_scsi_status (scb,SCSI_STATUS_OK ); +ahc_set_scsi_status (scb,SAM_STAT_GOOD );ahc_platform_set_tags (ahc, sdev, &devinfo, (dev->flags &AHC_DEV_Q_BASIC ) ?AHC_QUEUE_BASIC :AHC_QUEUE_TAGGED );
@@ -1910,7 +1910,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc,* as if the target returned BUSY SCSI status. */ dev->openings =1 ; -ahc_set_scsi_status (scb,SCSI_STATUS_BUSY ); +ahc_set_scsi_status (scb,SAM_STAT_BUSY );ahc_platform_set_tags (ahc, sdev, &devinfo, (dev->flags &AHC_DEV_Q_BASIC ) ?AHC_QUEUE_BASIC :AHC_QUEUE_TAGGED );
drivers/scsi/aic7xxx/aiclib.h +0 -15
@@ -117,21 +117,6 @@ struct scsi_sense_data#define SSD_FULL_SIZE sizeof(struct scsi_sense_data) }; -/* -* Status Byte -*/ -#define SCSI_STATUS_OK 0x00 -#define SCSI_STATUS_CHECK_COND 0x02 -#define SCSI_STATUS_COND_MET 0x04 -#define SCSI_STATUS_BUSY 0x08 -#define SCSI_STATUS_INTERMED 0x10 -#define SCSI_STATUS_INTERMED_COND_MET 0x14 -#define SCSI_STATUS_RESERV_CONFLICT 0x18 -#define SCSI_STATUS_CMD_TERMINATED 0x22/* Obsolete in SAM-2 */ -#define SCSI_STATUS_QUEUE_FULL 0x28 -#define SCSI_STATUS_ACA_ACTIVE 0x30 -#define SCSI_STATUS_TASK_ABORTED 0x40 -/************************* Large Disk Handling ********************************/ static inline int aic_sector_div (sector_t capacity,int heads,int sectors)
Signature · 1 line
2.29.2
PATCH v3 10/35 acornscsi: use standard defines
In reply to Hannes ReineckeUse midlayer-defined values and drop the non-existing QUEUE_FULL case; we are checking the SCSI messages in the switch statement, and QUEUE_FULL is a SCSI status hence it can never occur here.
--- drivers/scsi/arm/acornscsi.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/scsi/arm/acornscsi.c +2 -12
@@ -144,12 +144,6 @@#define VER_MINOR 0#define VER_PATCH 6 -#ifndef ABORT_TAG -#define ABORT_TAG 0xd -#else -#error "Yippee! ABORT TAG is now defined! Remove this error!" -#endif -#ifdef USE_DMAC /* * DMAC setup parameters
@@ -1490,8 +1484,8 @@ void acornscsi_message(AS_Host *host) }switch (message[0 ]) { -case ABORT : -case ABORT_TAG : +case ABORT_TASK_SET : +case ABORT_TASK :case COMMAND_COMPLETE :if (host->scsi.phase !=PHASE_STATUSIN ) { printk(KERN_ERR "scsi%d.%c: command complete following non-status in phase?\n",
@@ -1596,10 +1590,6 @@ void acornscsi_message(AS_Host *host) }break ; -case QUEUE_FULL : -/* TODO: target queue is full */ -break ; -case SIMPLE_QUEUE_TAG :/* tag queue reconnect... message[1] = queue tag. Print something to indicate something happened! */ printk("scsi%d.%c: reconnect queue tag %02X\n",
Signature · 1 line
2.29.2
PATCH v3 11/35 nsp32: fixup status handling
In reply to Hannes ReineckeSCp.status is always the SAM-defined status value, not the linux ones. Fixup the one wrong definition.
--- drivers/scsi/nsp32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/nsp32.c +1 -1
@@ -935,7 +935,7 @@ static int nsp32_queuecommand_lck(struct scsi_cmnd *SCpnt, void (*done)(struct s SCpnt->scsi_done = done; data->CurrentSC = SCpnt; - SCpnt->SCp.Status =CHECK_CONDITION ; + SCpnt->SCp.Status =SAM_STAT_CHECK_CONDITION ; SCpnt->SCp.Message =0 ;scsi_set_resid (SCpnt,scsi_bufflen (SCpnt));
Signature · 1 line
2.29.2
PATCH v3 14/35 zfcp: do not set COMMAND_COMPLETE
In reply to Hannes ReineckeCOMMAND_COMPLETE is defined as '0', and it is a SCSI parallel message to boot. So drop the call to set_msg_byte().
--- drivers/s390/scsi/zfcp_fc.h | 1 - 1 file changed, 1 deletion(-)
drivers/s390/scsi/zfcp_fc.h +0 -1
@@ -275,7 +275,6 @@ void zfcp_fc_eval_fcp_rsp(struct fcp_resp_with_ext *fcp_rsp,u32 sense_len, resid;u8 rsp_flags; -set_msg_byte (scsi,COMMAND_COMPLETE ); scsi->result |= fcp_rsp->resp.fr_status; rsp_flags = fcp_rsp->resp.fr_flags;
Signature · 1 line
2.29.2
PATCH v3 17/35 stex: do not set COMMAND_COMPLETE
In reply to Hannes ReineckeCOMMAND_COMPLETE is defined as '0', so setting it is quite pointless.
--- drivers/scsi/stex.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/scsi/stex.c +13 -12
@@ -625,7 +625,7 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))if (page ==0x8 || page ==0x3f ) {scsi_sg_copy_from_buffer (cmd, ms10_caching_page,sizeof (ms10_caching_page)); - cmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 ; + cmd->result =DID_OK <<16 ;done (cmd); }else stex_invalid_field (cmd, done);
@@ -644,7 +644,7 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *))break ;case TEST_UNIT_READY :if (id == host->max_id -1 ) { - cmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 ; + cmd->result =DID_OK <<16 ;done (cmd);return 0 ; }
@@ -661,7 +661,7 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) (cmd->cmnd[1] & INQUIRY_EVPD) == 0) {scsi_sg_copy_from_buffer (cmd, (void *)console_inq_page,sizeof (console_inq_page)); - cmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 ; + cmd->result =DID_OK <<16 ;done (cmd); } elsestex_invalid_field (cmd ,done );
@@ -679,9 +679,10 @@ stex_queuecommand_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) ver.console_id = host->max_id -1 ; ver.host_no = hba->host->host_no; cp_len =scsi_sg_copy_from_buffer (cmd, &ver, cp_len); - cmd->result =sizeof (ver) == cp_len ? -DID_OK <<16 |COMMAND_COMPLETE <<8 : -DID_ERROR <<16 |COMMAND_COMPLETE <<8 ; +if (sizeof (ver) == cp_len) + cmd->result =DID_OK <<16 ; +else + cmd->result =DID_ERROR <<16 ;done (cmd);return 0 ; }
@@ -736,16 +737,16 @@ static void stex_scsi_done(struct st_ccb *ccb) result = ccb->scsi_status;switch (ccb->scsi_status) {case SAM_STAT_GOOD : - result |=DID_OK <<16 |COMMAND_COMPLETE <<8 ; + result |=DID_OK <<16 ;break ;case SAM_STAT_CHECK_CONDITION : result |=DRIVER_SENSE <<24 ;break ;case SAM_STAT_BUSY : - result |=DID_BUS_BUSY <<16 |COMMAND_COMPLETE <<8 ; + result |=DID_BUS_BUSY <<16 ;break ;default : - result |=DID_ERROR <<16 |COMMAND_COMPLETE <<8 ; + result |=DID_ERROR <<16 ;break ; } }
@@ -753,15 +754,15 @@ static void stex_scsi_done(struct st_ccb *ccb) result =DRIVER_SENSE <<24 |SAM_STAT_CHECK_CONDITION ; else switch (ccb->srb_status) {case SRB_STATUS_SELECTION_TIMEOUT : - result =DID_NO_CONNECT <<16 |COMMAND_COMPLETE <<8 ; + result =DID_NO_CONNECT <<16 ;break ;case SRB_STATUS_BUSY : - result =DID_BUS_BUSY <<16 |COMMAND_COMPLETE <<8 ; + result =DID_BUS_BUSY <<16 ;break ;case SRB_STATUS_INVALID_REQUEST :case SRB_STATUS_ERROR :default : - result =DID_ERROR <<16 |COMMAND_COMPLETE <<8 ; + result =DID_ERROR <<16 ;break ; }
Signature · 1 line
2.29.2
PATCH v3 5/35 atp870u: Whitespace cleanup
In reply to Hannes Reinecke--- drivers/scsi/atp870u.c | 431 ++++++++++++++++++++++++----------------- drivers/scsi/atp870u.h | 14 +- 2 files changed, 258 insertions(+), 187 deletions(-)
drivers/scsi/atp870u.c +251 -180
@@ -42,7 +42,8 @@static struct scsi_host_template atp870u_template;static void send_s870 (struct atp_unit *dev,unsigned char c); -static void atp_is (struct atp_unit *dev,unsigned char c,bool wide_chip,unsigned char lvdmode); +static void atp_is (struct atp_unit *dev,unsigned char c,bool wide_chip, +unsigned char lvdmode);static inline void atp_writeb_base (struct atp_unit *atp,u8 reg,u8 val) {
@@ -137,16 +138,17 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) }if ((j &0x80 ) ==0 )return IRQ_NONE ; -#ifdef ED_DBGP +#ifdef ED_DBGP printk ("atp870u_intr_handle enter\n" ); -#endif +#endif dev->in_int[c] =1 ; cmdp =atp_readb_io (dev, c,0x10 );if (dev->working[c] !=0 ) {if (is885 (dev)) {if ((atp_readb_io (dev, c,0x16 ) &0x80 ) ==0 ) -atp_writeb_io (dev, c,0x16 , (atp_readb_io (dev, c,0x16 ) |0x80 )); - } +atp_writeb_io (dev, c,0x16 , + (atp_readb_io (dev, c,0x16 ) |0x80 )); + }if ((atp_readb_pci (dev, c,0x00 ) &0x08 ) !=0 ) {for (k=0 ; k <1000 ; k++) {
@@ -157,9 +159,9 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) } }atp_writeb_pci (dev, c,0 ,0x00 ); - + i =atp_readb_io (dev, c,0x17 ); - +if (is885 (dev))atp_writeb_pci (dev, c,2 ,0x06 );
@@ -185,44 +187,51 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) dev->r1f[c][target_id] |= j;#ifdef ED_DBGP printk ("atp870u_intr_handle status = %x\n" ,i); -#endif +#endif if (i ==0x85 ) {if ((dev->last_cmd[c] &0xf0 ) !=0x40 ) { dev->last_cmd[c] =0xff ; }if (is885 (dev)) { adrcnt =0 ; - ((unsigned char *) &adrcnt)[2 ] =atp_readb_io (dev, c,0x12 ); - ((unsigned char *) &adrcnt)[1 ] =atp_readb_io (dev, c,0x13 ); - ((unsigned char *) &adrcnt)[0 ] =atp_readb_io (dev, c,0x14 ); + ((unsigned char *) &adrcnt)[2 ] = +atp_readb_io (dev, c,0x12 ); + ((unsigned char *) &adrcnt)[1 ] = +atp_readb_io (dev, c,0x13 ); + ((unsigned char *) &adrcnt)[0 ] = +atp_readb_io (dev, c,0x14 );if (dev->id[c][target_id].last_len != adrcnt) { k = dev->id[c][target_id].last_len; - k -= adrcnt; - dev->id[c][target_id].tran_len = k; + k -= adrcnt; + dev->id[c][target_id].tran_len = k; dev->id[c][target_id].last_len = adrcnt; }#ifdef ED_DBGP -printk ("dev->id[c][target_id].last_len = %d dev->id[c][target_id].tran_len = %d\n" ,dev->id[c][target_id].last_len,dev->id[c][target_id].tran_len); -#endif +printk ("dev->id[c][target_id].last_len = %d " +"dev->id[c][target_id].tran_len = %d\n" , + dev->id[c][target_id].last_len, + dev->id[c][target_id].tran_len); +#endif }/* * Flip wide -*/ +*/ if (dev->wide_id[c] !=0 ) {atp_writeb_io (dev, c,0x1b ,0x01 );while ((atp_readb_io (dev, c,0x1b ) &0x01 ) !=0x01 )atp_writeb_io (dev, c,0x1b ,0x01 ); - } + }/* * Issue more commands */ -spin_lock_irqsave (dev->host->host_lock, flags); -if (((dev->quhd[c] != dev->quend[c]) || (dev->last_cmd[c] !=0xff )) && +spin_lock_irqsave (dev->host->host_lock, flags); +if (((dev->quhd[c] != dev->quend[c]) || + (dev->last_cmd[c] !=0xff )) && (dev->in_snd[c] ==0 )) {#ifdef ED_DBGP printk ("Call sent_s870\n" ); -#endif +#endif send_s870 (dev,c); }spin_unlock_irqrestore (dev->host->host_lock, flags);
@@ -232,7 +241,7 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) dev->in_int[c] =0 ;#ifdef ED_DBGP printk ("Status 0x85 return\n" ); -#endif +#endif return IRQ_HANDLED ; }
@@ -247,9 +256,12 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) dev->last_cmd[c] =0xff ; } adrcnt =0 ; - ((unsigned char *) &adrcnt)[2 ] =atp_readb_io (dev, c,0x12 ); - ((unsigned char *) &adrcnt)[1 ] =atp_readb_io (dev, c,0x13 ); - ((unsigned char *) &adrcnt)[0 ] =atp_readb_io (dev, c,0x14 ); + ((unsigned char *) &adrcnt)[2 ] = +atp_readb_io (dev, c,0x12 ); + ((unsigned char *) &adrcnt)[1 ] = +atp_readb_io (dev, c,0x13 ); + ((unsigned char *) &adrcnt)[0 ] = +atp_readb_io (dev, c,0x14 ); k = dev->id[c][target_id].last_len; k -= adrcnt; dev->id[c][target_id].tran_len = k;
@@ -262,17 +274,16 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)if (is885 (dev)) {if ((i ==0x4c ) || (i ==0x4d ) || (i ==0x8c ) || (i ==0x8d )) { -if ((i ==0x4c ) || (i ==0x8c )) - i=0x48 ; -else - i=0x49 ; - } - +if ((i ==0x4c ) || (i ==0x8c )) + i=0x48 ; +else + i=0x49 ; + } }if ((i ==0x80 ) || (i ==0x8f )) {#ifdef ED_DBGP printk (KERN_DEBUG "Device reselect\n" ); -#endif +#endif lun =0 ;if (cmdp ==0x44 || i ==0x80 ) lun =atp_readb_io (dev, c,0x1d ) &0x07 ;
@@ -283,11 +294,14 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)if (cmdp ==0x41 ) {#ifdef ED_DBGP printk ("cmdp = 0x41\n" ); -#endif +#endif adrcnt =0 ; - ((unsigned char *) &adrcnt)[2 ] =atp_readb_io (dev, c,0x12 ); - ((unsigned char *) &adrcnt)[1 ] =atp_readb_io (dev, c,0x13 ); - ((unsigned char *) &adrcnt)[0 ] =atp_readb_io (dev, c,0x14 ); + ((unsigned char *) &adrcnt)[2 ] = +atp_readb_io (dev, c,0x12 ); + ((unsigned char *) &adrcnt)[1 ] = +atp_readb_io (dev, c,0x13 ); + ((unsigned char *) &adrcnt)[0 ] = +atp_readb_io (dev, c,0x14 ); k = dev->id[c][target_id].last_len; k -= adrcnt; dev->id[c][target_id].tran_len = k;
@@ -298,7 +312,7 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) }else {#ifdef ED_DBGP printk ("cmdp != 0x41\n" ); -#endif +#endif atp_writeb_io (dev, c,0x10 ,0x46 ); dev->id[c][target_id].dirct =0x00 ;atp_writeb_io (dev, c,0x12 ,0x00 );
@@ -330,13 +344,13 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)if (is885 (dev))atp_writeb_io (dev, c,0x10 ,0x45 ); workreq = dev->id[c][target_id].curr_req; -#ifdef ED_DBGP +#ifdef ED_DBGP scmd_printk (KERN_DEBUG , workreq,"CDB" );for (l =0 ; l < workreq->cmd_len; l++)printk (KERN_DEBUG " %x" ,workreq->cmnd[l]);printk ("\n" ); -#endif - +#endif +atp_writeb_io (dev, c,0x0f , lun);atp_writeb_io (dev, c,0x11 , dev->id[c][target_id].devsp); adrcnt = dev->id[c][target_id].tran_len;
@@ -345,9 +359,12 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)atp_writeb_io (dev, c,0x12 , ((unsigned char *) &k)[2 ]);atp_writeb_io (dev, c,0x13 , ((unsigned char *) &k)[1 ]);atp_writeb_io (dev, c,0x14 , ((unsigned char *) &k)[0 ]); -#ifdef ED_DBGP -printk ("k %x, k[0] 0x%x k[1] 0x%x k[2] 0x%x\n" , k,atp_readb_io (dev, c,0x14 ),atp_readb_io (dev, c,0x13 ),atp_readb_io (dev, c,0x12 )); -#endif +#ifdef ED_DBGP +printk ("k %x, k[0] 0x%x k[1] 0x%x k[2] 0x%x\n" , k, +atp_readb_io (dev, c,0x14 ), +atp_readb_io (dev, c,0x13 ), +atp_readb_io (dev, c,0x12 )); +#endif /* Remap wide */ j = target_id;if (target_id >7 ) {
@@ -357,26 +374,39 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) j |= dev->id[c][target_id].dirct;atp_writeb_io (dev, c,0x15 , j);atp_writeb_io (dev, c,0x16 ,0x80 ); - -/* enable 32 bit fifo transfer */ + +/* enable 32 bit fifo transfer */ if (is885 (dev)) { i =atp_readb_pci (dev, c,1 ) &0xf3 ; -//j=workreq->cmnd[0]; -if ((workreq->cmnd[0 ] ==0x08 ) || (workreq->cmnd[0 ] ==0x28 ) || (workreq->cmnd[0 ] ==0x0a ) || (workreq->cmnd[0 ] ==0x2a )) { +//j=workreq->cmnd[0]; +if ((workreq->cmnd[0 ] ==0x08 ) || + (workreq->cmnd[0 ] ==0x28 ) || + (workreq->cmnd[0 ] ==0x0a ) || + (workreq->cmnd[0 ] ==0x2a )) { i |=0x0c ; }atp_writeb_pci (dev, c,1 , i); }else if (is880 (dev)) { -if ((workreq->cmnd[0 ] ==0x08 ) || (workreq->cmnd[0 ] ==0x28 ) || (workreq->cmnd[0 ] ==0x0a ) || (workreq->cmnd[0 ] ==0x2a )) -atp_writeb_base (dev,0x3b , (atp_readb_base (dev,0x3b ) &0x3f ) |0xc0 ); +if ((workreq->cmnd[0 ] ==0x08 ) || + (workreq->cmnd[0 ] ==0x28 ) || + (workreq->cmnd[0 ] ==0x0a ) || + (workreq->cmnd[0 ] ==0x2a )) +atp_writeb_base (dev,0x3b , + (atp_readb_base (dev,0x3b ) &0x3f ) |0xc0 );else -atp_writeb_base (dev,0x3b ,atp_readb_base (dev,0x3b ) &0x3f ); - }else { -if ((workreq->cmnd[0 ] ==0x08 ) || (workreq->cmnd[0 ] ==0x28 ) || (workreq->cmnd[0 ] ==0x0a ) || (workreq->cmnd[0 ] ==0x2a )) -atp_writeb_base (dev,0x3a , (atp_readb_base (dev,0x3a ) &0xf3 ) |0x08 ); +atp_writeb_base (dev,0x3b , +atp_readb_base (dev,0x3b ) &0x3f ); + }else { +if ((workreq->cmnd[0 ] ==0x08 ) || + (workreq->cmnd[0 ] ==0x28 ) || + (workreq->cmnd[0 ] ==0x0a ) || + (workreq->cmnd[0 ] ==0x2a )) +atp_writeb_base (dev,0x3a , + (atp_readb_base (dev,0x3a ) &0xf3 ) |0x08 );else -atp_writeb_base (dev,0x3a ,atp_readb_base (dev,0x3a ) &0xf3 ); - } +atp_writeb_base (dev,0x3a , +atp_readb_base (dev,0x3a ) &0xf3 ); + } j =0 ; id =1 ; id = id << target_id;
@@ -394,12 +424,12 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) dev->in_int[c] =0 ;#ifdef ED_DBGP printk ("dev->id[c][target_id].last_len = 0\n" ); -#endif +#endif return IRQ_HANDLED ; }#ifdef ED_DBGP printk ("target_id = %d adrcnt = %d\n" ,target_id,adrcnt); -#endif +#endif prd = dev->id[c][target_id].prd_pos;while (adrcnt !=0 ) { id = ((unsigned short int *)prd)[2 ];
@@ -409,8 +439,8 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) k = id; }if (k > adrcnt) { - ((unsigned short int *)prd)[2 ] = (unsigned short int ) - (k - adrcnt); + ((unsigned short int *)prd)[2 ] = + (unsigned short int )(k - adrcnt); ((unsigned long *)prd)[0 ] += adrcnt; adrcnt =0 ; dev->id[c][target_id].prd_pos = prd;
@@ -421,11 +451,12 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)if (adrcnt ==0 ) { dev->id[c][target_id].prd_pos = prd; } - } + } }atp_writel_pci (dev, c,0x04 , dev->id[c][target_id].prdaddr);#ifdef ED_DBGP -printk ("dev->id[%d][%d].prdaddr 0x%8x\n" , c, target_id, dev->id[c][target_id].prdaddr); +printk ("dev->id[%d][%d].prdaddr 0x%8x\n" , + c, target_id, dev->id[c][target_id].prdaddr);#endif if (!is885 (dev)) {atp_writeb_pci (dev, c,2 ,0x06 );
@@ -440,7 +471,7 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) dev->in_int[c] =0 ;#ifdef ED_DBGP printk ("status 0x80 return dirct != 0\n" ); -#endif +#endif return IRQ_HANDLED ; }atp_writeb_io (dev, c,0x18 ,0x08 );
@@ -448,7 +479,7 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) dev->in_int[c] =0 ;#ifdef ED_DBGP printk ("status 0x80 return dirct = 0\n" ); -#endif +#endif return IRQ_HANDLED ; }
@@ -484,7 +515,7 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) (*workreq->scsi_done) (workreq);#ifdef ED_DBGP printk ("workreq->scsi_done\n" ); -#endif +#endif /* * Clear it off the queue */
@@ -498,16 +529,17 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)atp_writeb_io (dev, c,0x1b ,0x01 );while ((atp_readb_io (dev, c,0x1b ) &0x01 ) !=0x01 )atp_writeb_io (dev, c,0x1b ,0x01 ); - } + }/* * If there is stuff to send and nothing going then send it */ spin_lock_irqsave (dev->host->host_lock, flags); -if (((dev->last_cmd[c] !=0xff ) || (dev->quhd[c] != dev->quend[c])) && +if (((dev->last_cmd[c] !=0xff ) || + (dev->quhd[c] != dev->quend[c])) && (dev->in_snd[c] ==0 )) {#ifdef ED_DBGP printk ("Call sent_s870(scsi_done)\n" ); -#endif +#endif send_s870 (dev,c); }spin_unlock_irqrestore (dev->host->host_lock, flags);
@@ -528,9 +560,12 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)atp_writeb_io (dev, c,0x10 ,0x41 );if (is885 (dev)) { k = dev->id[c][target_id].last_len; -atp_writeb_io (dev, c,0x12 , ((unsigned char *) (&k))[2 ]); -atp_writeb_io (dev, c,0x13 , ((unsigned char *) (&k))[1 ]); -atp_writeb_io (dev, c,0x14 , ((unsigned char *) (&k))[0 ]); +atp_writeb_io (dev, c,0x12 , + ((unsigned char *) (&k))[2 ]); +atp_writeb_io (dev, c,0x13 , + ((unsigned char *) (&k))[1 ]); +atp_writeb_io (dev, c,0x14 , + ((unsigned char *) (&k))[0 ]); dev->id[c][target_id].dirct =0x00 ; }else { dev->id[c][target_id].dirct =0x00 ;
@@ -547,11 +582,15 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)atp_writeb_io (dev, c,0x10 ,0x41 );if (is885 (dev)) { k = dev->id[c][target_id].last_len; -atp_writeb_io (dev, c,0x12 , ((unsigned char *) (&k))[2 ]); -atp_writeb_io (dev, c,0x13 , ((unsigned char *) (&k))[1 ]); -atp_writeb_io (dev, c,0x14 , ((unsigned char *) (&k))[0 ]); +atp_writeb_io (dev, c,0x12 , + ((unsigned char *) (&k))[2 ]); +atp_writeb_io (dev, c,0x13 , + ((unsigned char *) (&k))[1 ]); +atp_writeb_io (dev, c,0x14 , + ((unsigned char *) (&k))[0 ]); } -atp_writeb_io (dev, c,0x15 ,atp_readb_io (dev, c,0x15 ) |0x20 ); +atp_writeb_io (dev, c,0x15 , +atp_readb_io (dev, c,0x15 ) |0x20 ); dev->id[c][target_id].dirct =0x20 ;atp_writeb_io (dev, c,0x18 ,0x08 );atp_writeb_pci (dev, c,0 ,0x01 );
@@ -593,17 +632,15 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,if (scmd_channel (req_p) >1 ) { req_p->result =0x00040000 ;done (req_p); -#ifdef ED_DBGP -printk ("atp870u_queuecommand : req_p->device->channel > 1\n" ); -#endif +#ifdef ED_DBGP +printk ("atp870u_queuecommand : req_p->device->channel > 1\n" ); +#endif return 0 ; } host = req_p->device->host; dev = (struct atp_unit *)&host->hostdata; - - m =1 ; m = m <<scmd_id (req_p);
@@ -620,14 +657,14 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,if (done) { req_p->scsi_done = done; }else { -#ifdef ED_DBGP +#ifdef ED_DBGP printk ("atp870u_queuecommand: done can't be NULL\n" ); -#endif +#endif req_p->result =0 ;done (req_p);return 0 ; } - +/* * Count new command */
@@ -635,7 +672,7 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,if (dev->quend[c] >= qcnt) { dev->quend[c] =0 ; } - +/* * Check queue state */
@@ -643,27 +680,32 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,if (dev->quend[c] ==0 ) { dev->quend[c] = qcnt; } -#ifdef ED_DBGP +#ifdef ED_DBGP printk ("atp870u_queuecommand : dev->quhd[c] == dev->quend[c]\n" ); -#endif +#endif dev->quend[c]--; req_p->result =0x00020000 ; -done (req_p); +done (req_p);return 0 ; } dev->quereq[c][dev->quend[c]] = req_p; -#ifdef ED_DBGP -printk ("dev->ioport[c] = %x atp_readb_io(dev, c, 0x1c) = %x dev->in_int[%d] = %d dev->in_snd[%d] = %d\n" ,dev->ioport[c],atp_readb_io (dev, c,0x1c ),c,dev->in_int[c],c,dev->in_snd[c]); +#ifdef ED_DBGP +printk ("dev->ioport[c] = %x atp_readb_io(dev, c, 0x1c) = %x " +"dev->in_int[%d] = %d dev->in_snd[%d] = %d\n" , + dev->ioport[c],atp_readb_io (dev, c,0x1c ), c, + dev->in_int[c],c,dev->in_snd[c]);#endif -if ((atp_readb_io (dev, c,0x1c ) ==0 ) && (dev->in_int[c] ==0 ) && (dev->in_snd[c] ==0 )) { +if ((atp_readb_io (dev, c,0x1c ) ==0 ) && + (dev->in_int[c] ==0 ) && + (dev->in_snd[c] ==0 )) {#ifdef ED_DBGP printk ("Call sent_s870(atp870u_queuecommand)\n" ); -#endif +#endif send_s870 (dev,c); } -#ifdef ED_DBGP +#ifdef ED_DBGP printk ("atp870u_queuecommand : exit\n" ); -#endif +#endif return 0 ; }
@@ -674,7 +716,7 @@ static DEF_SCSI_QCMD(atp870u_queuecommand)* @host: host * * On entry there is work queued to be done. We move some of that work to the -* controller itself. +* controller itself. * * Caller holds the host lock. */
@@ -689,7 +731,7 @@ static void send_s870(struct atp_unit *dev,unsigned char c)unsigned long sg_count;if (dev->in_snd[c] !=0 ) { -#ifdef ED_DBGP +#ifdef ED_DBGP printk ("cmnd in_snd\n" );#endif return ;
@@ -729,7 +771,8 @@ static void send_s870(struct atp_unit *dev,unsigned char c) dev->id[c][scmd_id (workreq)].curr_req = workreq; dev->last_cmd[c] =scmd_id (workreq); } -if ((atp_readb_io (dev, c,0x1f ) &0xb0 ) !=0 ||atp_readb_io (dev, c,0x1c ) !=0 ) { +if ((atp_readb_io (dev, c,0x1f ) &0xb0 ) !=0 || +atp_readb_io (dev, c,0x1c ) !=0 ) {#ifdef ED_DBGP printk ("Abort to Send\n" );#endif
@@ -744,7 +787,7 @@ static void send_s870(struct atp_unit *dev,unsigned char c) printk(" %x",workreq->cmnd[i]); }printk ("\n" ); -#endif +#endif l =scsi_bufflen (workreq);if (is885 (dev)) {
@@ -752,7 +795,7 @@ static void send_s870(struct atp_unit *dev,unsigned char c)atp_writeb_base (dev,0x29 , j); dev->r1f[c][scmd_id (workreq)] =0 ; } - +if (workreq->cmnd[0 ] ==READ_CAPACITY ) {if (l >8 ) l =8 ;
@@ -796,8 +839,9 @@ static void send_s870(struct atp_unit *dev,unsigned char c)* Write the target */ atp_writeb_io (dev, c,0x11 , dev->id[c][target_id].devsp); -#ifdef ED_DBGP -printk ("dev->id[%d][%d].devsp = %2x\n" ,c,target_id,dev->id[c][target_id].devsp); +#ifdef ED_DBGP +printk ("dev->id[%d][%d].devsp = %2x\n" ,c,target_id, + dev->id[c][target_id].devsp);#endif sg_count =scsi_dma_map (workreq);
@@ -807,12 +851,12 @@ static void send_s870(struct atp_unit *dev,unsigned char c)atp_writeb_io (dev, c,0x12 , ((unsigned char *) (&l))[2 ]);atp_writeb_io (dev, c,0x13 , ((unsigned char *) (&l))[1 ]);atp_writeb_io (dev, c,0x14 , ((unsigned char *) (&l))[0 ]); - j = target_id; + j = target_id; dev->id[c][j].last_len = l; dev->id[c][j].tran_len =0 ; -#ifdef ED_DBGP +#ifdef ED_DBGP printk ("dev->id[%2d][%2d].last_len = %d\n" ,c,j,dev->id[c][j].last_len); -#endif +#endif /* * Flip the wide bits */
@@ -832,8 +876,8 @@ static void send_s870(struct atp_unit *dev,unsigned char c)if (l ==0 ) {if (atp_readb_io (dev, c,0x1c ) ==0 ) {#ifdef ED_DBGP -printk ("change SCSI_CMD_REG 0x08\n" ); -#endif +printk ("change SCSI_CMD_REG 0x08\n" ); +#endif atp_writeb_io (dev, c,0x18 ,0x08 ); }else dev->last_cmd[c] |=0x40 ;
@@ -854,9 +898,9 @@ static void send_s870(struct atp_unit *dev,unsigned char c)scsi_for_each_sg (workreq, sgpnt, sg_count, j) { bttl =sg_dma_address (sgpnt); l=sg_dma_len (sgpnt); -#ifdef ED_DBGP +#ifdef ED_DBGP printk ("1. bttl %x, l %x\n" ,bttl, l); -#endif +#endif while (l >0x10000 ) { (((u16 *) (prd))[i +3 ]) =0x0000 ; (((u16 *) (prd))[i +2 ]) =0x0000 ;
@@ -868,17 +912,22 @@ static void send_s870(struct atp_unit *dev,unsigned char c) (((u32 *) (prd))[i >>1 ]) =cpu_to_le32 (bttl); (((u16 *) (prd))[i +2 ]) =cpu_to_le16 (l); (((u16 *) (prd))[i +3 ]) =0 ; - i +=0x04 ; + i +=0x04 ; } - (((u16 *) (prd))[i -1 ]) =cpu_to_le16 (0x8000 ); -#ifdef ED_DBGP -printk ("prd %4x %4x %4x %4x\n" ,(((unsigned short int *)prd)[0 ]),(((unsigned short int *)prd)[1 ]),(((unsigned short int *)prd)[2 ]),(((unsigned short int *)prd)[3 ])); + (((u16 *) (prd))[i -1 ]) =cpu_to_le16 (0x8000 ); +#ifdef ED_DBGP +printk ("prd %4x %4x %4x %4x\n" , + (((unsigned short int *)prd)[0 ]), + (((unsigned short int *)prd)[1 ]), + (((unsigned short int *)prd)[2 ]), + (((unsigned short int *)prd)[3 ]));printk ("2. bttl %x, l %x\n" ,bttl, l); -#endif +#endif } -#ifdef ED_DBGP -printk ("send_s870: prdaddr_2 0x%8x target_id %d\n" , dev->id[c][target_id].prdaddr,target_id); -#endif +#ifdef ED_DBGP +printk ("send_s870: prdaddr_2 0x%8x target_id %d\n" , + dev->id[c][target_id].prdaddr,target_id); +#endif dev->id[c][target_id].prdaddr = dev->id[c][target_id].prd_bus;atp_writel_pci (dev, c,4 , dev->id[c][target_id].prdaddr);atp_writeb_pci (dev, c,2 ,0x06 );
@@ -886,30 +935,36 @@ static void send_s870(struct atp_unit *dev,unsigned char c)if (is885 (dev)) { j =atp_readb_pci (dev, c,1 ) &0xf3 ;if ((workreq->cmnd[0 ] ==0x08 ) || (workreq->cmnd[0 ] ==0x28 ) || - (workreq->cmnd[0 ] ==0x0a ) || (workreq->cmnd[0 ] ==0x2a )) { - j |=0x0c ; + (workreq->cmnd[0 ] ==0x0a ) || (workreq->cmnd[0 ] ==0x2a )) { + j |=0x0c ; }atp_writeb_pci (dev, c,1 , j); }else if (is880 (dev)) { -if ((workreq->cmnd[0 ] ==0x08 ) || (workreq->cmnd[0 ] ==0x28 ) || (workreq->cmnd[0 ] ==0x0a ) || (workreq->cmnd[0 ] ==0x2a )) -atp_writeb_base (dev,0x3b , (atp_readb_base (dev,0x3b ) &0x3f ) |0xc0 ); +if ((workreq->cmnd[0 ] ==0x08 ) || (workreq->cmnd[0 ] ==0x28 ) || + (workreq->cmnd[0 ] ==0x0a ) || (workreq->cmnd[0 ] ==0x2a )) +atp_writeb_base (dev,0x3b , + (atp_readb_base (dev,0x3b ) &0x3f ) |0xc0 );else -atp_writeb_base (dev,0x3b ,atp_readb_base (dev,0x3b ) &0x3f ); - }else { -if ((workreq->cmnd[0 ] ==0x08 ) || (workreq->cmnd[0 ] ==0x28 ) || (workreq->cmnd[0 ] ==0x0a ) || (workreq->cmnd[0 ] ==0x2a )) -atp_writeb_base (dev,0x3a , (atp_readb_base (dev,0x3a ) &0xf3 ) |0x08 ); +atp_writeb_base (dev,0x3b , +atp_readb_base (dev,0x3b ) &0x3f ); + }else { +if ((workreq->cmnd[0 ] ==0x08 ) || (workreq->cmnd[0 ] ==0x28 ) || + (workreq->cmnd[0 ] ==0x0a ) || (workreq->cmnd[0 ] ==0x2a )) +atp_writeb_base (dev,0x3a , + (atp_readb_base (dev,0x3a ) &0xf3 ) |0x08 );else -atp_writeb_base (dev,0x3a ,atp_readb_base (dev,0x3a ) &0xf3 ); - } +atp_writeb_base (dev,0x3a , +atp_readb_base (dev,0x3a ) &0xf3 ); + }if (workreq->sc_data_direction ==DMA_TO_DEVICE ) { dev->id[c][target_id].dirct =0x20 ;if (atp_readb_io (dev, c,0x1c ) ==0 ) {atp_writeb_io (dev, c,0x18 ,0x08 );atp_writeb_pci (dev, c,0 ,0x01 ); -#ifdef ED_DBGP +#ifdef ED_DBGP printk ("start DMA(to target)\n" ); -#endif +#endif }else { dev->last_cmd[c] |=0x40 ; }
@@ -919,9 +974,9 @@ static void send_s870(struct atp_unit *dev,unsigned char c)if (atp_readb_io (dev, c,0x1c ) ==0 ) {atp_writeb_io (dev, c,0x18 ,0x08 );atp_writeb_pci (dev, c,0 ,0x09 ); -#ifdef ED_DBGP +#ifdef ED_DBGP printk ("start DMA(to host)\n" ); -#endif +#endif }else { dev->last_cmd[c] |=0x40 ; }
@@ -1193,7 +1248,9 @@ static void atp870u_free_tables(struct Scsi_Host *host)for (k =0 ; k <16 ; k++) {if (!atp_dev->id[j][k].prd_table)continue ; -dma_free_coherent (&atp_dev->pdev->dev,1024 , atp_dev->id[j][k].prd_table, atp_dev->id[j][k].prd_bus); +dma_free_coherent (&atp_dev->pdev->dev,1024 , + atp_dev->id[j][k].prd_table, + atp_dev->id[j][k].prd_bus); atp_dev->id[j][k].prd_table =NULL ; } }
@@ -1204,35 +1261,38 @@ static int atp870u_init_tables(struct Scsi_Host *host)struct atp_unit *atp_dev = (struct atp_unit *)&host->hostdata;int c,k;for (c=0 ;c <2 ;c++) { -for (k=0 ;k<16 ;k++) { - atp_dev->id[c][k].prd_table =dma_alloc_coherent (&atp_dev->pdev->dev,1024 , &(atp_dev->id[c][k].prd_bus),GFP_KERNEL ); -if (!atp_dev->id[c][k].prd_table) { -printk ("atp870u_init_tables fail\n" ); +for (k=0 ;k<16 ;k++) { + atp_dev->id[c][k].prd_table = +dma_alloc_coherent (&atp_dev->pdev->dev,1024 , + &(atp_dev->id[c][k].prd_bus), +GFP_KERNEL ); +if (!atp_dev->id[c][k].prd_table) { +printk ("atp870u_init_tables fail\n" );atp870u_free_tables (host);return -ENOMEM ; } atp_dev->id[c][k].prdaddr = atp_dev->id[c][k].prd_bus; atp_dev->id[c][k].devsp=0x20 ; atp_dev->id[c][k].devtype =0x7f ; - atp_dev->id[c][k].curr_req =NULL ; - } - - atp_dev->active_id[c] =0 ; - atp_dev->wide_id[c] =0 ; - atp_dev->host_id[c] =0x07 ; - atp_dev->quhd[c] =0 ; - atp_dev->quend[c] =0 ; - atp_dev->last_cmd[c] =0xff ; - atp_dev->in_snd[c] =0 ; - atp_dev->in_int[c] =0 ; - -for (k =0 ; k < qcnt; k++) { - atp_dev->quereq[c][k] =NULL ; - } -for (k =0 ; k <16 ; k++) { + atp_dev->id[c][k].curr_req =NULL ; + } + + atp_dev->active_id[c] =0 ; + atp_dev->wide_id[c] =0 ; + atp_dev->host_id[c] =0x07 ; + atp_dev->quhd[c] =0 ; + atp_dev->quend[c] =0 ; + atp_dev->last_cmd[c] =0xff ; + atp_dev->in_snd[c] =0 ; + atp_dev->in_int[c] =0 ; + +for (k =0 ; k < qcnt; k++) { + atp_dev->quereq[c][k] =NULL ; + } +for (k =0 ; k <16 ; k++) { atp_dev->id[c][k].curr_req =NULL ; atp_dev->sp[c][k] =0x04 ; - } + } }return 0 ; }
@@ -1263,7 +1323,8 @@ static void atp870_init(struct Scsi_Host *shpnt)pci_read_config_byte (pdev,0x49 , &host_id); -dev_info (&pdev->dev,"ACARD AEC-671X PCI Ultra/W SCSI-2/3 Host Adapter: IO:%lx, IRQ:%d.\n" , +dev_info (&pdev->dev,"ACARD AEC-671X PCI Ultra/W SCSI-2/3 " +"Host Adapter: IO:%lx, IRQ:%d.\n" , shpnt->io_port, shpnt->irq); atpdev->ioport[0 ] = shpnt->io_port;
@@ -1314,7 +1375,8 @@ static void atp880_init(struct Scsi_Host *shpnt) host_id =atp_readb_base (atpdev,0x39 ) >>4 ; -dev_info (&pdev->dev,"ACARD AEC-67160 PCI Ultra3 LVD Host Adapter: IO:%lx, IRQ:%d.\n" , +dev_info (&pdev->dev,"ACARD AEC-67160 PCI Ultra3 LVD " +"Host Adapter: IO:%lx, IRQ:%d.\n" , shpnt->io_port, shpnt->irq); atpdev->host_id[0 ] = host_id;
@@ -1393,7 +1455,8 @@ static void atp885_init(struct Scsi_Host *shpnt)unsigned int n;unsigned char setupdata[2 ][16 ]; -dev_info (&pdev->dev,"ACARD AEC-67162 PCI Ultra3 LVD Host Adapter: IO:%lx, IRQ:%d.\n" , +dev_info (&pdev->dev,"ACARD AEC-67162 PCI Ultra3 LVD " +"Host Adapter: IO:%lx, IRQ:%d.\n" , shpnt->io_port, shpnt->irq); atpdev->ioport[0 ] = shpnt->io_port +0x80 ;
@@ -1413,11 +1476,13 @@ static void atp885_init(struct Scsi_Host *shpnt) atpdev->global_map[m] =0 ;for (k =0 ; k <4 ; k++) {atp_writew_base (atpdev,0x3c , n++); - ((u32 *)&setupdata[m][0 ])[k] =atp_readl_base (atpdev,0x38 ); + ((u32 *)&setupdata[m][0 ])[k] = +atp_readl_base (atpdev,0x38 ); }for (k =0 ; k <4 ; k++) {atp_writew_base (atpdev,0x3c , n++); - ((u32 *)&atpdev->sp[m][0 ])[k] =atp_readl_base (atpdev,0x38 ); + ((u32 *)&atpdev->sp[m][0 ])[k] = +atp_readl_base (atpdev,0x38 ); } n +=8 ; }
@@ -1510,17 +1575,17 @@ static int atp870u_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto fail;if (dma_set_mask (&pdev->dev,DMA_BIT_MASK (32 ))) { -printk (KERN_ERR "atp870u: DMA mask required but not available.\n" ); - err = -EIO ; - goto disable_device; - } +printk (KERN_ERR "atp870u: DMA mask required but not available.\n" ); + err = -EIO ; + goto disable_device; + } err =pci_request_regions (pdev,"atp870u" );if (err) goto disable_device;pci_set_master (pdev); - err = -ENOMEM ; + err = -ENOMEM ; shpnt =scsi_host_alloc (&atp870u_template,sizeof (struct atp_unit ));if (!shpnt) goto release_region;
@@ -1586,7 +1651,7 @@ static int atp870u_abort(struct scsi_cmnd * SCpnt) {unsigned char j, k, c;struct scsi_cmnd *workrequ; -struct atp_unit *dev; +struct atp_unit *dev;struct Scsi_Host *host; host = SCpnt->device->host;
@@ -1655,11 +1720,10 @@ static int atp870u_biosparam(struct scsi_device *disk, struct block_device *dev, }static void atp870u_remove (struct pci_dev *pdev) -{ +{struct atp_unit *devext =pci_get_drvdata (pdev);struct Scsi_Host *pshost = devext->host; - - +scsi_remove_host (pshost);free_irq (pshost->irq, pshost);pci_release_regions (pdev);
@@ -1671,23 +1735,23 @@ MODULE_LICENSE("GPL");static struct scsi_host_template atp870u_template = { .module =THIS_MODULE , - .name ="atp870u" /* name */ , + .name ="atp870u" /* name */ , .proc_name ="atp870u" , .show_info = atp870u_show_info, - .info = atp870u_info/* info */ , - .queuecommand = atp870u_queuecommand/* queuecommand */ , - .eh_abort_handler = atp870u_abort/* abort */ , - .bios_param = atp870u_biosparam/* biosparm */ , - .can_queue = qcnt/* can_queue */ , - .this_id =7 /* SCSI ID */ , - .sg_tablesize =ATP870U_SCATTER /*SG_ALL*/ , + .info = atp870u_info/* info */ , + .queuecommand = atp870u_queuecommand/* queuecommand */ , + .eh_abort_handler = atp870u_abort/* abort */ , + .bios_param = atp870u_biosparam/* biosparm */ , + .can_queue = qcnt/* can_queue */ , + .this_id =7 /* SCSI ID */ , + .sg_tablesize =ATP870U_SCATTER /*SG_ALL*/ , .max_sectors =ATP870U_MAX_SECTORS , };static struct pci_device_id atp870u_id_table[] = { {PCI_DEVICE (PCI_VENDOR_ID_ARTOP ,ATP885_DEVID ) }, - {PCI_DEVICE (PCI_VENDOR_ID_ARTOP ,ATP880_DEVID1 ) }, - {PCI_DEVICE (PCI_VENDOR_ID_ARTOP ,ATP880_DEVID2 ) }, + {PCI_DEVICE (PCI_VENDOR_ID_ARTOP ,ATP880_DEVID1 ) }, + {PCI_DEVICE (PCI_VENDOR_ID_ARTOP ,ATP880_DEVID2 ) }, {PCI_DEVICE (PCI_VENDOR_ID_ARTOP ,PCI_DEVICE_ID_ARTOP_AEC7610 ) }, {PCI_DEVICE (PCI_VENDOR_ID_ARTOP ,PCI_DEVICE_ID_ARTOP_AEC7612UW ) }, {PCI_DEVICE (PCI_VENDOR_ID_ARTOP ,PCI_DEVICE_ID_ARTOP_AEC7612U ) },
@@ -1709,7 +1773,8 @@ static struct pci_driver atp870u_driver = {module_pci_driver (atp870u_driver); -static void atp_is (struct atp_unit *dev,unsigned char c,bool wide_chip,unsigned char lvdmode) +static void atp_is (struct atp_unit *dev,unsigned char c,bool wide_chip, +unsigned char lvdmode) {unsigned char i, j, k, rmb, n;unsigned short int m;
@@ -1982,8 +2047,9 @@ static void atp_is(struct atp_unit *dev, unsigned char c, bool wide_chip, unsign m = m << i; dev->wide_id[c] |= m; dev->id[c][i].devsp =0xce ; -#ifdef ED_DBGP -printk ("dev->id[%2d][%2d].devsp = %2x\n" ,c,i,dev->id[c][i].devsp); +#ifdef ED_DBGP +printk ("dev->id[%2d][%2d].devsp = %2x\n" , + c, i, dev->id[c][i].devsp);#endif continue ; }
@@ -2005,7 +2071,8 @@ static void atp_is(struct atp_unit *dev, unsigned char c, bool wide_chip, unsignwhile ((atp_readb_io (dev, c,0x1f ) &0x80 ) ==0x00 )cpu_relax (); -if (atp_readb_io (dev, c,0x17 ) !=0x11 &&atp_readb_io (dev, c,0x17 ) !=0x8e ) +if (atp_readb_io (dev, c,0x17 ) !=0x11 && +atp_readb_io (dev, c,0x17 ) !=0x8e )continue ;while (atp_readb_io (dev, c,0x17 ) !=0x8e )
@@ -2109,7 +2176,9 @@ static void atp_is(struct atp_unit *dev, unsigned char c, bool wide_chip, unsign m = m << i; dev->wide_id[c] |= m; not_wide: -if ((dev->id[c][i].devtype ==0x00 ) || (dev->id[c][i].devtype ==0x07 ) || ((dev->id[c][i].devtype ==0x05 ) && ((n &0x10 ) !=0 ))) { +if ((dev->id[c][i].devtype ==0x00 ) || + (dev->id[c][i].devtype ==0x07 ) || + ((dev->id[c][i].devtype ==0x05 ) && ((n &0x10 ) !=0 ))) { m =1 ; m = m << i;if ((dev->async[c] & m) !=0 ) {
@@ -2148,7 +2217,8 @@ static void atp_is(struct atp_unit *dev, unsigned char c, bool wide_chip, unsignwhile ((atp_readb_io (dev, c,0x1f ) &0x80 ) ==0x00 )cpu_relax (); -if (atp_readb_io (dev, c,0x17 ) !=0x11 &&atp_readb_io (dev, c,0x17 ) !=0x8e ) +if (atp_readb_io (dev, c,0x17 ) !=0x11 && +atp_readb_io (dev, c,0x17 ) !=0x8e )continue ;while (atp_readb_io (dev, c,0x17 ) !=0x8e )
@@ -2310,7 +2380,8 @@ static void atp_is(struct atp_unit *dev, unsigned char c, bool wide_chip, unsign set_syn_ok: dev->id[c][i].devsp = (dev->id[c][i].devsp &0x0f ) | j;#ifdef ED_DBGP -printk ("dev->id[%2d][%2d].devsp = %2x\n" ,c,i,dev->id[c][i].devsp); +printk ("dev->id[%2d][%2d].devsp = %2x\n" , + c,i,dev->id[c][i].devsp);#endif } }
drivers/scsi/atp870u.h +7 -7
@@ -7,10 +7,10 @@/* I/O Port */ -#define MAX_CDB 12 -#define MAX_SENSE 14 -#define qcnt 32 -#define ATP870U_SCATTER 128 +#define MAX_CDB 12 +#define MAX_SENSE 14 +#define qcnt 32 +#define ATP870U_SCATTER 128#define MAX_ADAPTER 8#define MAX_SCSI_ID 16
@@ -40,7 +40,7 @@ struct atp_unitunsigned short ultra_map[2 ];unsigned short async[2 ];unsigned char sp[2 ][16 ]; -unsigned char r1f[2 ][16 ]; +unsigned char r1f[2 ][16 ];struct scsi_cmnd *quereq[2 ][qcnt];struct atp_id {
@@ -55,8 +55,8 @@ struct atp_unitdma_addr_t prdaddr;/* Dynamically updated in driver */ struct scsi_cmnd *curr_req; } id[2 ][16 ]; -struct Scsi_Host *host; -struct pci_dev *pdev; +struct Scsi_Host *host; +struct pci_dev *pdev;unsigned int unit; };
Signature · 1 line
2.29.2
PATCH v3 6/35 aic7xxx,aic79xx: Whitespace cleanup
In reply to Hannes Reinecke--- drivers/scsi/aic7xxx/aic79xx.h | 36 +++---- drivers/scsi/aic7xxx/aic79xx_core.c | 111 ++++++++++----------- drivers/scsi/aic7xxx/aic79xx_osm.h | 14 +-- drivers/scsi/aic7xxx/aic79xx_osm_pci.c | 6 +- drivers/scsi/aic7xxx/aic79xx_proc.c | 13 +-- drivers/scsi/aic7xxx/aic7xxx_93cx6.c | 4 +- drivers/scsi/aic7xxx/aic7xxx_core.c | 131 ++++++++++++------------- drivers/scsi/aic7xxx/aic7xxx_osm.c | 71 +++++++------- drivers/scsi/aic7xxx/aic7xxx_osm.h | 16 +-- drivers/scsi/aic7xxx/aic7xxx_proc.c | 15 +-- 10 files changed, 208 insertions(+), 209 deletions(-)
drivers/scsi/aic7xxx/aic79xx.h +18 -18
@@ -211,7 +211,7 @@ typedef enum {*/ typedef enum { AHD_FENONE = 0x00000, - AHD_WIDE = 0x00001,/* Wide Channel */ + AHD_WIDE = 0x00001,/* Wide Channel */ AHD_AIC79XXB_SLOWCRC = 0x00002,/* SLOWCRC bit should be set */ AHD_MULTI_FUNC = 0x00100,/* Multi-Function/Channel Device */ AHD_TARGETMODE = 0x01000,/* Has tested target mode support */
@@ -433,7 +433,7 @@ union initiator_data {* Target mode version of the shared data SCB segment. */ struct target_data { -uint32_t spare[2 ]; +uint32_t spare[2 ];uint8_t scsi_status;/* SCSI status to give to initiator */ uint8_t target_phases;/* Bitmap of phases to execute */ uint8_t data_phase;/* Data-In or Data-Out */
@@ -608,9 +608,9 @@ struct scb {struct ahd_softc *ahd_softc;scb_flag flags;struct scb_platform_data *platform_data; -struct map_node *hscb_map; -struct map_node *sg_map; -struct map_node *sense_map; +struct map_node *hscb_map; +struct map_node *sg_map; +struct map_node *sense_map;void *sg_list;uint8_t *sense_data;dma_addr_t sg_list_busaddr;
@@ -674,7 +674,7 @@ struct scb_data {struct target_cmd {uint8_t scsiid;/* Our ID and the initiator's ID */ uint8_t identify;/* Identify message */ -uint8_t bytes[22 ];/* +uint8_t bytes[22 ];/* * Bytes contains any additional message * bytes terminated by 0xFF. The remainder * is the cdb to execute.
@@ -712,7 +712,7 @@ struct ahd_tmode_event {* structure here so we can store arrays of them, etc. in OS neutral * data structures. */ -#ifdef AHD_TARGET_MODE +#ifdef AHD_TARGET_MODE struct ahd_tmode_lstate { struct cam_path *path; struct ccb_hdr_slist accept_tios;
@@ -807,11 +807,11 @@ struct ahd_tmode_tstate {/***************************** Lookup Tables **********************************/ /* * Phase -> name and message out response -* to parity errors in each phase table. +* to parity errors in each phase table. */ struct ahd_phase_table_entry { -uint8_t phase; -uint8_t mesg_out;/* Message response to parity errors */ +uint8_t phase; +uint8_t mesg_out;/* Message response to parity errors */ const char *phasemsg; };
@@ -844,7 +844,7 @@ struct seeprom_config {#define CFBS_ENABLED 0x04#define CFBS_DISABLED_SCAN 0x08#define CFENABLEDV 0x0010/* Perform Domain Validation */ -#define CFCTRL_A 0x0020/* BIOS displays Ctrl-A message */ +#define CFCTRL_A 0x0020/* BIOS displays Ctrl-A message */ #define CFSPARITY 0x0040/* SCSI parity */ #define CFEXTEND 0x0080/* extended translation enabled */ #define CFBOOTCD 0x0100/* Support Bootable CD-ROM */
@@ -858,7 +858,7 @@ struct seeprom_config {/* * Host Adapter Control Bits */ -uint16_t adapter_control;/* word 17 */ +uint16_t adapter_control;/* word 17 */ #define CFAUTOTERM 0x0001/* Perform Auto termination */ #define CFSTERM 0x0002/* SCSI low byte termination */ #define CFWSTERM 0x0004/* SCSI high byte termination */
@@ -867,7 +867,7 @@ struct seeprom_config {#define CFSEHIGHTERM 0x0020/* Ultra2 secondary high term */ #define CFSTPWLEVEL 0x0040/* Termination level control */ #define CFBIOSAUTOTERM 0x0080/* Perform Auto termination */ -#define CFTERM_MENU 0x0100/* BIOS displays termination menu */ +#define CFTERM_MENU 0x0100/* BIOS displays termination menu */ #define CFCLUSTERENB 0x8000/* Cluster Enable */ /*
@@ -881,7 +881,7 @@ struct seeprom_config {/* * Maximum targets */ -uint16_t max_targets;/* word 19 */ +uint16_t max_targets;/* word 19 */ #define CFMAXTARG 0x00ff/* maximum targets */ #define CFBOOTLUN 0x0f00/* Lun to boot from */ #define CFBOOTID 0xf000/* Target to boot from */
@@ -941,7 +941,7 @@ struct vpd_config {#define FLX_ROMSTAT_EE_2MBx8 0x2#define FLX_ROMSTAT_EE_4MBx8 0x3#define FLX_ROMSTAT_EE_16MBx8 0x4 -#define CURSENSE_ENB 0x1 +#define CURSENSE_ENB 0x1#define FLXADDR_FLEXSTAT 0x2#define FLX_FSTAT_BUSY 0x1#define FLXADDR_CURRENT_STAT 0x4
@@ -1051,8 +1051,8 @@ struct ahd_completion };struct ahd_softc { -bus_space_tag_t tags[2 ]; -bus_space_handle_t bshs[2 ]; +bus_space_tag_t tags[2 ]; +bus_space_handle_t bshs[2 ];struct scb_data scb_data;struct hardware_scb *next_queued_hscb;
@@ -1243,7 +1243,7 @@ struct ahd_softc {u_int int_coalescing_threshold;u_int int_coalescing_stop_threshold; -uint16_t user_discenable;/* Disconnection allowed */ +uint16_t user_discenable;/* Disconnection allowed */ uint16_t user_tagenable;/* Tagged Queuing allowed */ };
drivers/scsi/aic7xxx/aic79xx_core.c +54 -57
426 lines not on this page · raw message
drivers/scsi/aic7xxx/aic79xx_osm.h +7 -7
@@ -242,7 +242,7 @@ struct ahd_linux_device {int active;/* -* The currently allowed number of +* The currently allowed number of * transactions that can be queued to * the device. Must be signed for * conversion from tagged to untagged
@@ -256,7 +256,7 @@ struct ahd_linux_device {* device's queue is halted. */ u_int qfrozen; - +/* * Cumulative command counter. */
@@ -340,11 +340,11 @@ struct ahd_platform_data {/* * Fields accessed from interrupt context. */ -struct scsi_target *starget[AHD_NUM_TARGETS ]; +struct scsi_target *starget[AHD_NUM_TARGETS ];spinlock_t spin_lock;struct completion *eh_done; -struct Scsi_Host *host;/* pointer to scsi host */ +struct Scsi_Host *host;/* pointer to scsi host */ #define AHD_LINUX_NOIRQ ((uint32_t)~0)uint32_t irq;/* IRQ for this adapter */ uint32_t bios_address;
@@ -655,9 +655,9 @@ static inline void ahd_freeze_scb(struct scb *scb) {if ((scb->io_ctx->result & (CAM_DEV_QFRZN <<16 )) ==0 ) { - scb->io_ctx->result |=CAM_DEV_QFRZN <<16 ; - scb->platform_data->dev->qfrozen++; - } + scb->io_ctx->result |=CAM_DEV_QFRZN <<16 ; + scb->platform_data->dev->qfrozen++; + } } void ahd_platform_set_tags(struct ahd_softc *ahd, struct scsi_device *sdev,
drivers/scsi/aic7xxx/aic79xx_osm_pci.c +3 -3
@@ -45,8 +45,8 @@/* Define the macro locally since it's different for different class of chips. */ -#define ID (x) \ - ID2C(x), \ +#define ID (x) \ + ID2C(x), \ ID2C(IDIROC(x))static const struct pci_device_id ahd_linux_pci_id_table[] = {
@@ -367,7 +367,7 @@ ahd_pci_map_int(struct ahd_softc *ahd) IRQF_SHARED, "aic79xx", ahd);if (!error) ahd->platform_data->irq = ahd->dev_softc->irq; - +return (-error); }
drivers/scsi/aic7xxx/aic79xx_proc.c +7 -6
@@ -100,17 +100,17 @@ ahd_format_transinfo(struct seq_file *m, struct ahd_transinfo *tinfo)seq_puts (m,"Renegotiation Pending\n" );return ; } - speed =3300 ; - freq =0 ; + speed =3300 ; + freq =0 ;if (tinfo->offset !=0 ) { freq =ahd_calc_syncsrate (tinfo->period); speed = freq; } speed *= (0x01 << tinfo->width); - mb = speed /1000 ; -if (mb >0 ) + mb = speed /1000 ; +if (mb >0 )seq_printf (m,"%d.%03dMB/s transfers" , mb, speed %1000 ); -else +else seq_printf (m,"%dKB/s transfers" , speed);if (freq !=0 ) {
@@ -242,7 +242,8 @@ ahd_proc_write_seeprom(struct Scsi_Host *shost, char *buffer, int length)u_int start_addr;if (ahd->seep_config ==NULL ) { - ahd->seep_config =kmalloc (sizeof (*ahd->seep_config),GFP_ATOMIC ); + ahd->seep_config =kmalloc (sizeof (*ahd->seep_config), +GFP_ATOMIC );if (ahd->seep_config ==NULL ) {printk ("aic79xx: Unable to allocate serial " "eeprom buffer. Write failing\n" );
drivers/scsi/aic7xxx/aic7xxx_93cx6.c +2 -2
@@ -73,8 +73,8 @@* add other 93Cx6 functions. */ struct seeprom_cmd { -uint8_t len; -uint8_t bits[11 ]; +uint8_t len; +uint8_t bits[11 ]; };/* Short opcodes for the c46 */
drivers/scsi/aic7xxx/aic7xxx_core.c +63 -68
481 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_osm.c +38 -33
236 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_osm.h +8 -8
@@ -258,7 +258,7 @@ struct ahc_linux_device {int active;/* -* The currently allowed number of +* The currently allowed number of * transactions that can be queued to * the device. Must be signed for * conversion from tagged to untagged
@@ -272,7 +272,7 @@ struct ahc_linux_device {* device's queue is halted. */ u_int qfrozen; - +/* * Cumulative command counter. */
@@ -351,16 +351,16 @@ struct ahc_platform_data {/* * Fields accessed from interrupt context. */ -struct scsi_target *starget[AHC_NUM_TARGETS ]; +struct scsi_target *starget[AHC_NUM_TARGETS ];spinlock_t spin_lock;u_int qfrozen;struct completion *eh_done; -struct Scsi_Host *host;/* pointer to scsi host */ +struct Scsi_Host *host;/* pointer to scsi host */ #define AHC_LINUX_NOIRQ ((uint32_t)~0)uint32_t irq;/* IRQ for this adapter */ uint32_t bios_address; -resource_size_t mem_busaddr;/* Mem Base Addr */ +resource_size_t mem_busaddr;/* Mem Base Addr */ };void ahc_delay (long );
@@ -671,9 +671,9 @@ static inline void ahc_freeze_scb(struct scb *scb) {if ((scb->io_ctx->result & (CAM_DEV_QFRZN <<16 )) ==0 ) { - scb->io_ctx->result |=CAM_DEV_QFRZN <<16 ; - scb->platform_data->dev->qfrozen++; - } + scb->io_ctx->result |=CAM_DEV_QFRZN <<16 ; + scb->platform_data->dev->qfrozen++; + } } void ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
drivers/scsi/aic7xxx/aic7xxx_proc.c +8 -7
@@ -97,17 +97,17 @@ ahc_format_transinfo(struct seq_file *m, struct ahc_transinfo *tinfo)u_int freq;u_int mb; - speed =3300 ; - freq =0 ; + speed =3300 ; + freq =0 ;if (tinfo->offset !=0 ) { freq =ahc_calc_syncsrate (tinfo->period); speed = freq; } speed *= (0x01 << tinfo->width); - mb = speed /1000 ; -if (mb >0 ) + mb = speed /1000 ; +if (mb >0 )seq_printf (m,"%d.%03dMB/s transfers" , mb, speed %1000 ); -else +else seq_printf (m,"%dKB/s transfers" , speed);if (freq !=0 ) {
@@ -234,7 +234,7 @@ ahc_proc_write_seeprom(struct Scsi_Host *shost, char *buffer, int length)if ((ahc->chip &AHC_VL ) !=0 ) { sd.sd_control_offset =SEECTL_2840 ; sd.sd_status_offset =STATUS_2840 ; - sd.sd_dataout_offset =STATUS_2840 ; + sd.sd_dataout_offset =STATUS_2840 ; sd.sd_chip =C46 ; sd.sd_MS =0 ; sd.sd_RDY =EEPROM_TF ;
@@ -255,7 +255,8 @@ ahc_proc_write_seeprom(struct Scsi_Host *shost, char *buffer, int length)u_int start_addr;if (ahc->seep_config ==NULL ) { - ahc->seep_config =kmalloc (sizeof (*ahc->seep_config),GFP_ATOMIC ); + ahc->seep_config =kmalloc (sizeof (*ahc->seep_config), +GFP_ATOMIC );if (ahc->seep_config ==NULL ) {printk ("aic7xxx: Unable to allocate serial " "eeprom buffer. Write failing\n" );
Signature · 1 line
2.29.2
PATCH v3 18/35 nsp_cs: drop internal SCSI message definition
In reply to Hannes ReineckeUse the standard SCSI message definitions instead of the driver-internal ones.
--- drivers/scsi/pcmcia/nsp_cs.c | 12 ++++++------ drivers/scsi/pcmcia/nsp_cs.h | 11 ----------- 2 files changed, 6 insertions(+), 17 deletions(-)
drivers/scsi/pcmcia/nsp_cs.c +6 -6
@@ -1132,7 +1132,7 @@ static irqreturn_t nspintr(int irq, void *dev_id)//*sync_neg = SYNC_NOT_YET; /* all command complete and return status */ -if (tmpSC->SCp.Message ==MSG_COMMAND_COMPLETE ) { +if (tmpSC->SCp.Message ==COMMAND_COMPLETE ) { tmpSC->result = (DID_OK <<16 ) | ((tmpSC->SCp.Message &0xff ) <<8 ) | ((tmpSC->SCp.Status &0xff ) <<0 );
@@ -1226,9 +1226,9 @@ static irqreturn_t nspintr(int irq, void *dev_id) data->Sync[target].SyncOffset =0 ;/**/ - data->MsgBuffer[i] =MSG_EXTENDED ; i++; + data->MsgBuffer[i] =EXTENDED_MESSAGE ; i++; data->MsgBuffer[i] =3 ; i++; - data->MsgBuffer[i] =MSG_EXT_SDTR ; i++; + data->MsgBuffer[i] =EXTENDED_SDTR ; i++; data->MsgBuffer[i] =0x0c ; i++; data->MsgBuffer[i] =15 ; i++;/**/
@@ -1255,9 +1255,9 @@ static irqreturn_t nspintr(int irq, void *dev_id)//nsp_dbg(NSP_DEBUG_INTR, "sync target=%d,lun=%d",target,lun); if (data->MsgLen >=5 && - data->MsgBuffer[0 ] ==MSG_EXTENDED && + data->MsgBuffer[0 ] ==EXTENDED_MESSAGE && data->MsgBuffer[1 ] ==3 && - data->MsgBuffer[2 ] ==MSG_EXT_SDTR ) { + data->MsgBuffer[2 ] ==EXTENDED_SDTR ) { data->Sync[target].SyncPeriod = data->MsgBuffer[3 ]; data->Sync[target].SyncOffset = data->MsgBuffer[4 ];//nsp_dbg(NSP_DEBUG_INTR, "sync ok, %d %d", data->MsgBuffer[3], data->MsgBuffer[4]);
@@ -1275,7 +1275,7 @@ static irqreturn_t nspintr(int irq, void *dev_id) tmp =-1 ;for (i =0 ; i < data->MsgLen; i++) { tmp = data->MsgBuffer[i]; -if (data->MsgBuffer[i] ==MSG_EXTENDED ) { +if (data->MsgBuffer[i] ==EXTENDED_MESSAGE ) { i += (1 + data->MsgBuffer[i+1 ]); } }
drivers/scsi/pcmcia/nsp_cs.h +0 -11
@@ -370,17 +370,6 @@ enum _burst_mode { BURST_MEM32 = 2, }; -/************************************************************************** -* SCSI messaage -*/ -#define MSG_COMMAND_COMPLETE 0x00 -#define MSG_EXTENDED 0x01 -#define MSG_ABORT 0x06 -#define MSG_NO_OPERATION 0x08 -#define MSG_BUS_DEVICE_RESET 0x0c - -#define MSG_EXT_SDTR 0x01 -/* scatter-gather table */ # define BUFFER_ADDR ((char *)((sg_virt(SCpnt->SCp.buffer))))
Signature · 1 line
2.29.2
PATCH v3 20/35 dc395x: drop internal SCSI message definitions
In reply to Hannes ReineckeDrop the internel SCSI message definitions and use the functions provided by the SPI transport class.
--- drivers/scsi/Kconfig | 1 + drivers/scsi/dc395x.c | 28 +++++++++++----------------- drivers/scsi/dc395x.h | 22 ---------------------- 3 files changed, 12 insertions(+), 39 deletions(-)
drivers/scsi/Kconfig +1 -0
@@ -1168,6 +1168,7 @@ config SCSI_SIM710 config SCSI_DC395x tristate "Tekram DC395(U/UW/F) and DC315(U) SCSI support" depends on PCI && SCSI + select SCSI_SPI_ATTRS help This driver supports PCI SCSI host adapters based on the ASIC TRM-S1040 chip, e.g Tekram DC395(U/UW/F) and DC315(U) variants.
drivers/scsi/dc395x.c +11 -17
@@ -64,6 +64,7 @@#include <scsi/scsi_cmnd.h> #include <scsi/scsi_device.h> #include <scsi/scsi_host.h> +#include <scsi/scsi_transport_spi.h> #include "dc395x.h"
@@ -1281,12 +1282,8 @@ static void build_sdtr(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, }else if (dcb->sync_offset ==0 ) dcb->sync_offset =SYNC_NEGO_OFFSET ; - *ptr++ =MSG_EXTENDED ;/* (01h) */ - *ptr++ =3 ;/* length */ - *ptr++ =EXTENDED_SDTR ;/* (01h) */ - *ptr++ = dcb->min_nego_period;/* Transfer period (in 4ns) */ - *ptr++ = dcb->sync_offset;/* Transfer period (max. REQ/ACK dist) */ - srb->msg_count +=5 ; + srb->msg_count +=spi_populate_sync_msg (ptr, dcb->min_nego_period, + dcb->sync_offset); srb->state |=SRB_DO_SYNC_NEGO ; }
@@ -1305,11 +1302,7 @@ static void build_wdtr(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, srb->msgout_buf[1]);return ; } - *ptr++ =MSG_EXTENDED ;/* (01h) */ - *ptr++ =2 ;/* length */ - *ptr++ =EXTENDED_WDTR ;/* (03h) */ - *ptr++ = wide; - srb->msg_count +=4 ; + srb->msg_count +=spi_populate_width_msg (ptr, wide); srb->state |=SRB_DO_WIDE_NEGO ; }
@@ -1476,7 +1469,7 @@ static u8 start_scsi(struct AdapterCtlBlk* acb, struct DeviceCtlBlk* dcb,return 1 ; }/* Send Tag id */ -DC395x_write8 (acb,TRM_S1040_SCSI_FIFO ,MSG_SIMPLE_QTAG ); +DC395x_write8 (acb,TRM_S1040_SCSI_FIFO ,SIMPLE_QUEUE_TAG );DC395x_write8 (acb,TRM_S1040_SCSI_FIFO , tag_number); dcb->tag_mask |= tag_mask; srb->tag_number = tag_number;
@@ -1732,8 +1725,9 @@ static void msgout_phase1(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb,if (!srb->msg_count) {dprintkdbg (DBG_0 ,"msgout_phase1: (0x%p) NOP msg\n" , srb->cmd); -DC395x_write8 (acb,TRM_S1040_SCSI_FIFO ,MSG_NOP ); -DC395x_write16 (acb,TRM_S1040_SCSI_CONTROL ,DO_DATALATCH );/* it's important for atn stop */ +DC395x_write8 (acb,TRM_S1040_SCSI_FIFO ,NOP ); +DC395x_write16 (acb,TRM_S1040_SCSI_CONTROL ,DO_DATALATCH ); +/* it's important for atn stop */ DC395x_write8 (acb,TRM_S1040_SCSI_COMMAND ,SCMD_FIFO_OUT );return ; }
@@ -1741,7 +1735,7 @@ static void msgout_phase1(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb,for (i =0 ; i < srb->msg_count; i++)DC395x_write8 (acb,TRM_S1040_SCSI_FIFO , *ptr++); srb->msg_count =0 ; -if (srb->msgout_buf[0 ] ==MSG_ABORT ) +if (srb->msgout_buf[0 ] ==ABORT_TASK_SET ) srb->state =SRB_ABORT_SENT ;DC395x_write8 (acb,TRM_S1040_SCSI_COMMAND ,SCMD_FIFO_OUT );
@@ -2538,7 +2532,7 @@ static struct ScsiReqBlk *msgin_qtag(struct AdapterCtlBlk *acb, srb = acb->tmp_srb; srb->state =SRB_UNEXPECT_RESEL ; dcb->active_srb = srb; - srb->msgout_buf[0 ] =MSG_ABORT_TAG ; + srb->msgout_buf[0 ] =ABORT_TASK ; srb->msg_count =1 ; DC395x_ENABLE_MSGOUT;dprintkl (KERN_DEBUG ,"msgin_qtag: Unknown tag %i - abort\n" , tag);
@@ -2780,7 +2774,7 @@ static void msgin_phase0(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb,msgin_reject (acb, srb);break ; -case MSG_IGNOREWIDE : +case IGNORE_WIDE_RESIDUE :/* Discard wide residual */ dprintkdbg (DBG_0 ,"msgin_phase0: Ignore Wide Residual!\n" );break ;
drivers/scsi/dc395x.h +0 -22
@@ -172,28 +172,6 @@#define SYNC_NEGO_OFFSET 15 -/* SCSI MSG BYTE */ -#define MSG_COMPLETE 0x00 -#define MSG_EXTENDED 0x01 -#define MSG_SAVE_PTR 0x02 -#define MSG_RESTORE_PTR 0x03 -#define MSG_DISCONNECT 0x04 -#define MSG_INITIATOR_ERROR 0x05 -#define MSG_ABORT 0x06 -#define MSG_REJECT_ 0x07 -#define MSG_NOP 0x08 -#define MSG_PARITY_ERROR 0x09 -#define MSG_LINK_CMD_COMPL 0x0A -#define MSG_LINK_CMD_COMPL_FLG 0x0B -#define MSG_BUS_RESET 0x0C -#define MSG_ABORT_TAG 0x0D -#define MSG_SIMPLE_QTAG 0x20 -#define MSG_HEAD_QTAG 0x21 -#define MSG_ORDER_QTAG 0x22 -#define MSG_IGNOREWIDE 0x23 -#define MSG_IDENTIFY 0x80 -#define MSG_HOST_ID 0xC0 -/* cmd->result */ #define STATUS_MASK_ 0xFF#define MSG_MASK 0xFF00
Signature · 1 line
2.29.2
PATCH v3 23/35 ufshcd: do not set COMMAND_COMPLETE
In reply to Hannes ReineckeCOMMAND_COMPLETE is defined as '0', so setting it is quite pointless.
--- drivers/scsi/ufs/ufshcd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/ufs/ufshcd.c +1 -3
@@ -4891,9 +4891,7 @@ ufshcd_scsi_cmd_status(struct ufshcd_lrb *lrbp, int scsi_status)ufshcd_copy_sense_data (lrbp); fallthrough;case SAM_STAT_GOOD : - result |=DID_OK <<16 | -COMMAND_COMPLETE <<8 | - scsi_status; + result |=DID_OK <<16 | scsi_status;break ;case SAM_STAT_TASK_SET_FULL :case SAM_STAT_BUSY :
Signature · 1 line
2.29.2
PATCH v3 1/35 scsi: drop gdth driver
In reply to Hannes ReineckeThe gdth driver refers to a SCSI parallel, PCI-only HBA RAID adapter which was manufactured by the now-defunct ICP Vortex company, later acquired by Adaptec and superseded by the aacraid series of controllers. The driver itself would require a major overhaul before any modifications can be attempted, but seeing that it's unlikely to have any users left it should rather be removed completely.
--- Documentation/kbuild/makefiles.rst | 4 +- Documentation/process/magic-number.rst | 2 - Documentation/scsi/scsi-parameters.rst | 3 - .../userspace-api/ioctl/ioctl-number.rst | 1 - drivers/scsi/Kconfig | 14 - drivers/scsi/Makefile | 2 - drivers/scsi/gdth.c | 4322 ----------------- drivers/scsi/gdth.h | 981 ---- drivers/scsi/gdth_ioctl.h | 251 - drivers/scsi/gdth_proc.c | 586 --- drivers/scsi/gdth_proc.h | 18 - 11 files changed, 1 insertion(+), 6183 deletions(-) delete mode 100644 drivers/scsi/gdth.c delete mode 100644 drivers/scsi/gdth.h delete mode 100644 drivers/scsi/gdth_ioctl.h delete mode 100644 drivers/scsi/gdth_proc.c delete mode 100644 drivers/scsi/gdth_proc.h
Documentation/kbuild/makefiles.rst +1 -3
@@ -461,10 +461,8 @@ more details, with real examples. # drivers/scsi/Makefile CFLAGS_aha152x.o = -DAHA152X_STAT -DAUTOCONF - CFLAGS_gdth.o = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ \ - -DGDTH_STATISTICS - These two lines specify compilation flags for aha152x.o and gdth.o. + This line specify compilation flags for aha152x.o. $(AFLAGS_$@) is a similar feature for source files in assembly languages.
Documentation/process/magic-number.rst +0 -2
@@ -99,7 +99,6 @@ USB_SERIAL_PORT_MAGIC 0x7301 usb_serial_port ``drivers/usb/se CG_MAGIC 0x00090255 ufs_cylinder_group ``include/linux/ufs_fs.h`` RPORT_MAGIC 0x00525001 r_port ``drivers/char/rocket_int.h`` LSEMAGIC 0x05091998 lse ``drivers/fc4/fc.c`` -GDTIOCTL_MAGIC 0x06030f07 gdth_iowr_str ``drivers/scsi/gdth_ioctl.h`` RIEBL_MAGIC 0x09051990 ``drivers/net/atarilance.c`` NBD_REQUEST_MAGIC 0x12560953 nbd_request ``include/linux/nbd.h`` RED_MAGIC2 0x170fc2a5 (any) ``mm/slab.c``
@@ -143,7 +142,6 @@ PWC_MAGIC 0x89DC10AB pwc_device ``drivers/usb/me NBD_REPLY_MAGIC 0x96744668 nbd_reply ``include/linux/nbd.h`` ENI155_MAGIC 0xa54b872d midway_eprom ``drivers/atm/eni.h`` CODA_MAGIC 0xC0DAC0DA coda_file_info ``fs/coda/coda_fs_i.h`` -DPMEM_MAGIC 0xc0ffee11 gdt_pci_sram ``drivers/scsi/gdth.h`` YAM_MAGIC 0xF10A7654 yam_port ``drivers/net/hamradio/yam.c`` CCB_MAGIC 0xf2691ad2 ccb ``drivers/scsi/ncr53c8xx.c`` QUEUE_MAGIC_FREE 0xf7e1c9a3 queue_entry ``drivers/scsi/arm/queue.c``
Documentation/scsi/scsi-parameters.rst +0 -3
@@ -38,9 +38,6 @@ parameters may be changed at runtime by the command See drivers/scsi/BusLogic.c, comment before function BusLogic_ParseDriverOptions(). - gdth= [HW,SCSI] - See header of drivers/scsi/gdth.c. - gvp11= [HW,SCSI] ips= [HW,SCSI] Adaptec / IBM ServeRAID controller
Documentation/userspace-api/ioctl/ioctl-number.rst +0 -1
@@ -157,7 +157,6 @@ Code Seq# Include File Comments 'I' all linux/isdn.h conflict! 'I' 00-0F drivers/isdn/divert/isdn_divert.h conflict! 'I' 40-4F linux/mISDNif.h conflict! -'J' 00-1F drivers/scsi/gdth_ioctl.h 'K' all linux/kd.h 'L' 00-1F linux/loop.h conflict! 'L' 10-1F drivers/scsi/mpt3sas/mpt3sas_ctl.h conflict!
drivers/scsi/Kconfig +0 -14
@@ -669,20 +669,6 @@ config SCSI_FDOMAIN_ISA To compile this driver as a module, choose M here: the module will be called fdomain_isa. -config SCSI_GDTH - tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support" - depends on PCI && SCSI - help - Formerly called GDT SCSI Disk Array Controller Support. - - This is a driver for RAID/SCSI Disk Array Controllers (EISA/ISA/PCI) - manufactured by Intel Corporation/ICP vortex GmbH. It is documented - in the kernel source in <file:drivers/scsi/gdth.c> and - <file:drivers/scsi/gdth.h>. - - To compile this driver as a module, choose M here: the - module will be called gdth. - config SCSI_ISCI tristate "Intel(R) C600 Series Chipset SAS Controller" depends on PCI && SCSI
drivers/scsi/Makefile +0 -2
@@ -16,7 +16,6 @@ CFLAGS_aha152x.o = -DAHA152X_STAT -DAUTOCONF -CFLAGS_gdth.o = # -DDEBUG_GDTH=2 -D__SERIAL__ -D__COM2__ -DGDTH_STATISTICS obj-$(CONFIG_PCMCIA) += pcmcia/
@@ -103,7 +102,6 @@ obj-$(CONFIG_SCSI_MPT3SAS) += mpt3sas/ obj-$(CONFIG_SCSI_UFSHCD) += ufs/ obj-$(CONFIG_SCSI_ACARD) += atp870u.o obj-$(CONFIG_SCSI_SUNESP) += esp_scsi.o sun_esp.o -obj-$(CONFIG_SCSI_GDTH) += gdth.o obj-$(CONFIG_SCSI_INITIO) += initio.o obj-$(CONFIG_SCSI_INIA100) += a100u2w.o obj-$(CONFIG_SCSI_QLOGICPTI) += qlogicpti.o
drivers/scsi/gdth.c deleted +0 -4322
2,925 lines not on this page · raw message
drivers/scsi/gdth.h deleted +0 -981
981 lines not on this page · raw message
drivers/scsi/gdth_ioctl.h deleted +0 -251
251 lines not on this page · raw message
drivers/scsi/gdth_proc.c deleted +0 -586
586 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.29.2
Part of the diff is not shown here. View the raw message.
PATCH v3 19/35 aic7xxx,aic79xx: drop internal SCSI message definition
In reply to Hannes ReineckeUse the standard SCSI message definitions instead of the driver-internal ones.
--- drivers/scsi/aic7xxx/aic79xx_core.c | 138 ++++++++++++++-------------- drivers/scsi/aic7xxx/aic79xx_osm.c | 4 +- drivers/scsi/aic7xxx/aic7xxx_core.c | 126 ++++++++++++------------- drivers/scsi/aic7xxx/aic7xxx_osm.c | 5 +- drivers/scsi/aic7xxx/scsi_message.h | 41 --------- include/scsi/scsi.h | 1 + 6 files changed, 138 insertions(+), 177 deletions(-)
drivers/scsi/aic7xxx/aic79xx_core.c +69 -69
@@ -73,16 +73,16 @@ static const u_int num_errors = ARRAY_SIZE(ahd_hard_errors);static const struct ahd_phase_table_entry ahd_phase_table[] = { - {P_DATAOUT ,MSG_NOOP ,"in Data-out phase" }, - {P_DATAIN ,MSG_INITIATOR_DET_ERR ,"in Data-in phase" }, - {P_DATAOUT_DT ,MSG_NOOP ,"in DT Data-out phase" }, - {P_DATAIN_DT ,MSG_INITIATOR_DET_ERR ,"in DT Data-in phase" }, - {P_COMMAND ,MSG_NOOP ,"in Command phase" }, - {P_MESGOUT ,MSG_NOOP ,"in Message-out phase" }, - {P_STATUS ,MSG_INITIATOR_DET_ERR ,"in Status phase" }, + {P_DATAOUT ,NOP ,"in Data-out phase" }, + {P_DATAIN ,INITIATOR_ERROR ,"in Data-in phase" }, + {P_DATAOUT_DT ,NOP ,"in DT Data-out phase" }, + {P_DATAIN_DT ,INITIATOR_ERROR ,"in DT Data-in phase" }, + {P_COMMAND ,NOP ,"in Command phase" }, + {P_MESGOUT ,NOP ,"in Message-out phase" }, + {P_STATUS ,INITIATOR_ERROR ,"in Status phase" }, {P_MESGIN ,MSG_PARITY_ERROR ,"in Message-in phase" }, - {P_BUSFREE ,MSG_NOOP ,"while idle" }, - {0 ,MSG_NOOP ,"in unknown phase" } + {P_BUSFREE ,NOP ,"while idle" }, + {0 ,NOP ,"in unknown phase" } };/*
@@ -1126,7 +1126,7 @@ ahd_restart(struct ahd_softc *ahd)/* No more pending messages */ ahd_clear_msg_state (ahd);ahd_outb (ahd,SCSISIGO ,0 );/* De-assert BSY */ -ahd_outb (ahd,MSG_OUT ,MSG_NOOP );/* No message to send */ +ahd_outb (ahd,MSG_OUT ,NOP );/* No message to send */ ahd_outb (ahd,SXFRCTL1 ,ahd_inb (ahd,SXFRCTL1 ) & ~BITBUCKET );ahd_outb (ahd,SEQINTCTL ,0 );ahd_outb (ahd,LASTPHASE ,P_BUSFREE );
@@ -2007,7 +2007,7 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)*/ ahd_assert_atn (ahd);ahd_outb (ahd,MSG_OUT ,HOST_MSG ); - ahd->msgout_buf[0 ] =MSG_ABORT_TASK ; + ahd->msgout_buf[0 ] =ABORT_TASK ; ahd->msgout_len =1 ; ahd->msgout_index =0 ; ahd->msg_type =MSG_TYPE_INITIATOR_MSGOUT ;
@@ -2135,7 +2135,7 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat)printk ("SXFRCTL0 == 0x%x\n" ,ahd_inb (ahd,SXFRCTL0 ));printk ("SEQCTL0 == 0x%x\n" ,ahd_inb (ahd,SEQCTL0 ));ahd_dump_card_state (ahd); - ahd->msgout_buf[0 ] =MSG_BUS_DEV_RESET ; + ahd->msgout_buf[0 ] =TARGET_RESET ; ahd->msgout_len =1 ; ahd->msgout_index =0 ; ahd->msg_type =MSG_TYPE_INITIATOR_MSGOUT ;
@@ -2691,7 +2691,7 @@ ahd_handle_transmission_error(struct ahd_softc *ahd) lastphase =ahd_inb (ahd,LASTPHASE ); curphase =ahd_inb (ahd,SCSISIGI ) &PHASE_MASK ; perrdiag =ahd_inb (ahd,PERRDIAG ); - msg_out =MSG_INITIATOR_DET_ERR ; + msg_out =INITIATOR_ERROR ;ahd_outb (ahd,CLRSINT1 ,CLRSCSIPERR );/*
@@ -2823,14 +2823,14 @@ ahd_handle_transmission_error(struct ahd_softc *ahd) }/* -* We've set the hardware to assert ATN if we +* We've set the hardware to assert ATN if we * get a parity error on "in" phases, so all we * need to do is stuff the message buffer with * the appropriate message. "In" phases have set -* mesg_out to something other than MSG_NOP. +* mesg_out to something other than NOP. */ ahd->send_msg_perror = msg_out; -if (scb !=NULL && msg_out ==MSG_INITIATOR_DET_ERR ) +if (scb !=NULL && msg_out ==INITIATOR_ERROR ) scb->flags |=SCB_TRANSMISSION_ERROR ;ahd_outb (ahd,MSG_OUT ,HOST_MSG );ahd_outb (ahd,CLRINT ,CLRSCSIINT );
@@ -3050,8 +3050,8 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)u_int tag; tag =SCB_LIST_NULL ; -if (ahd_sent_msg (ahd,AHDMSG_1B ,MSG_ABORT_TAG , TRUE) - ||ahd_sent_msg (ahd,AHDMSG_1B ,MSG_ABORT , TRUE)) { +if (ahd_sent_msg (ahd,AHDMSG_1B ,ABORT_TASK , TRUE) + ||ahd_sent_msg (ahd,AHDMSG_1B ,ABORT_TASK_SET , TRUE)) {int found;int sent_msg;
@@ -3066,9 +3066,9 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)ahd_print_path (ahd, scb);printk ("SCB %d - Abort%s Completed.\n" ,SCB_GET_TAG (scb), - sent_msg ==MSG_ABORT_TAG ?"" :" Tag" ); + sent_msg ==ABORT_TASK ?"" :" Tag" ); -if (sent_msg ==MSG_ABORT_TAG ) +if (sent_msg ==ABORT_TASK ) tag =SCB_GET_TAG (scb);if ((scb->flags &SCB_EXTERNAL_RESET ) !=0 ) {
@@ -3093,12 +3093,12 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)printk ("found == 0x%x\n" , found); printerror =0 ; }else if (ahd_sent_msg (ahd,AHDMSG_1B , -MSG_BUS_DEV_RESET , TRUE)) { +TARGET_RESET , TRUE)) {ahd_handle_devreset (ahd, &devinfo,CAM_LUN_WILDCARD ,CAM_BDR_SENT ,"Bus Device Reset" ,/*verbose_level*/ 0 ); printerror =0 ; - }else if (ahd_sent_msg (ahd,AHDMSG_EXT ,MSG_EXT_PPR , FALSE) + }else if (ahd_sent_msg (ahd,AHDMSG_EXT ,EXTENDED_PPR , FALSE) && ppr_busfree ==0 ) {struct ahd_initiator_tinfo *tinfo;struct ahd_tmode_tstate *tstate;
@@ -3151,7 +3151,7 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd) } printerror =0 ; } - }else if (ahd_sent_msg (ahd,AHDMSG_EXT ,MSG_EXT_WDTR , FALSE) + }else if (ahd_sent_msg (ahd,AHDMSG_EXT ,EXTENDED_WDTR , FALSE) && ppr_busfree ==0 ) {/* * Negotiation Rejected. Go-narrow and
@@ -3176,7 +3176,7 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd)ahd_qinfifo_requeue_tail (ahd, scb); } printerror =0 ; - }else if (ahd_sent_msg (ahd,AHDMSG_EXT ,MSG_EXT_SDTR , FALSE) + }else if (ahd_sent_msg (ahd,AHDMSG_EXT ,EXTENDED_SDTR , FALSE) && ppr_busfree ==0 ) {/* * Negotiation Rejected. Go-async and
@@ -3204,7 +3204,7 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd) printerror =0 ; }else if ((ahd->msg_flags &MSG_FLAG_EXPECT_IDE_BUSFREE ) !=0 &&ahd_sent_msg (ahd,AHDMSG_1B , -MSG_INITIATOR_DET_ERR , TRUE)) { +INITIATOR_ERROR , TRUE)) {#ifdef AHD_DEBUG if ((ahd_debug &AHD_SHOW_MESSAGES ) !=0 )
@@ -3213,7 +3213,7 @@ ahd_handle_nonpkt_busfree(struct ahd_softc *ahd) printerror =0 ; }else if ((ahd->msg_flags &MSG_FLAG_EXPECT_QASREJ_BUSFREE ) &&ahd_sent_msg (ahd,AHDMSG_1B , -MSG_MESSAGE_REJECT , TRUE)) { +MESSAGE_REJECT , TRUE)) {#ifdef AHD_DEBUG if ((ahd_debug &AHD_SHOW_MESSAGES ) !=0 )
@@ -3367,7 +3367,7 @@ ahd_handle_proto_violation(struct ahd_softc *ahd)ahd_outb (ahd,MSG_OUT ,HOST_MSG );if (scb ==NULL ) {ahd_print_devinfo (ahd, &devinfo); - ahd->msgout_buf[0 ] =MSG_ABORT_TASK ; + ahd->msgout_buf[0 ] =ABORT_TASK ; ahd->msgout_len =1 ; ahd->msgout_index =0 ; ahd->msg_type =MSG_TYPE_INITIATOR_MSGOUT ;
@@ -4389,7 +4389,7 @@ ahd_setup_initiator_msgout(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, }else if (scb ==NULL ) {printk ("%s: WARNING. No pending message for " "I_T msgin. Issuing NO-OP\n" ,ahd_name (ahd)); - ahd->msgout_buf[ahd->msgout_index++] =MSG_NOOP ; + ahd->msgout_buf[ahd->msgout_index++] =NOP ; ahd->msgout_len++; ahd->msg_type =MSG_TYPE_INITIATOR_MSGOUT ;return ;
@@ -4415,7 +4415,7 @@ ahd_setup_initiator_msgout(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, }if (scb->flags &SCB_DEVICE_RESET ) { - ahd->msgout_buf[ahd->msgout_index++] =MSG_BUS_DEV_RESET ; + ahd->msgout_buf[ahd->msgout_index++] =TARGET_RESET ; ahd->msgout_len++;ahd_print_path (ahd, scb);printk ("Bus Device Reset Message Sent\n" );
@@ -4430,9 +4430,9 @@ ahd_setup_initiator_msgout(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, }else if ((scb->flags &SCB_ABORT ) !=0 ) {if ((scb->hscb->control &TAG_ENB ) !=0 ) { - ahd->msgout_buf[ahd->msgout_index++] =MSG_ABORT_TAG ; + ahd->msgout_buf[ahd->msgout_index++] =ABORT_TASK ; }else { - ahd->msgout_buf[ahd->msgout_index++] =MSG_ABORT ; + ahd->msgout_buf[ahd->msgout_index++] =ABORT_TASK_SET ; } ahd->msgout_len++;ahd_print_path (ahd, scb);
@@ -4664,7 +4664,7 @@ ahd_clear_msg_state(struct ahd_softc *ahd)*/ ahd_outb (ahd,CLRSINT1 ,CLRATNO ); } -ahd_outb (ahd,MSG_OUT ,MSG_NOOP ); +ahd_outb (ahd,MSG_OUT ,NOP );ahd_outb (ahd,SEQ_FLAGS2 ,ahd_inb (ahd,SEQ_FLAGS2 ) & ~TARGET_MSG_PENDING );ahd_restore_modes (ahd, saved_modes);
@@ -4745,7 +4745,7 @@ ahd_handle_message_phase(struct ahd_softc *ahd)* with a busfree. */ if ((ahd->msg_flags &MSG_FLAG_PACKETIZED ) !=0 - && ahd->send_msg_perror ==MSG_INITIATOR_DET_ERR ) + && ahd->send_msg_perror ==INITIATOR_ERROR ) ahd->msg_flags |=MSG_FLAG_EXPECT_IDE_BUSFREE ;ahd_outb (ahd,RETURN_2 , ahd->send_msg_perror);
@@ -5023,7 +5023,7 @@ ahd_sent_msg(struct ahd_softc *ahd, ahd_msgtype type, u_int msgval, int full) index =0 ;while (index < ahd->msgout_len) { -if (ahd->msgout_buf[index] ==MSG_EXTENDED ) { +if (ahd->msgout_buf[index] ==EXTENDED_MESSAGE ) {u_int end_index; end_index = index +1 + ahd->msgout_buf[index +1 ];
@@ -5037,8 +5037,8 @@ ahd_sent_msg(struct ahd_softc *ahd, ahd_msgtype type, u_int msgval, int full) found = TRUE; } index = end_index; - }else if (ahd->msgout_buf[index] >=MSG_SIMPLE_TASK - && ahd->msgout_buf[index] <=MSG_IGN_WIDE_RESIDUE ) { + }else if (ahd->msgout_buf[index] >=SIMPLE_QUEUE_TAG + && ahd->msgout_buf[index] <=IGNORE_WIDE_RESIDUE ) {/* Skip tag type and tag id or residue param*/ index +=2 ;
@@ -5089,30 +5089,30 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)* extended message type. */ switch (ahd->msgin_buf[0 ]) { -case MSG_DISCONNECT : -case MSG_SAVEDATAPOINTER : -case MSG_CMDCOMPLETE : -case MSG_RESTOREPOINTERS : -case MSG_IGN_WIDE_RESIDUE : +case DISCONNECT : +case SAVE_POINTERS : +case COMMAND_COMPLETE : +case RESTORE_POINTERS : +case IGNORE_WIDE_RESIDUE :/* * End our message loop as these are messages * the sequencer handles on its own. */ done =MSGLOOP_TERMINATED ;break ; -case MSG_MESSAGE_REJECT : +case MESSAGE_REJECT : response =ahd_handle_msg_reject (ahd, devinfo); fallthrough; -case MSG_NOOP : +case NOP : done =MSGLOOP_MSGCOMPLETE ;break ; -case MSG_EXTENDED : +case EXTENDED_MESSAGE : {/* Wait for enough of the message to begin validation */ if (ahd->msgin_index <2 )break ;switch (ahd->msgin_buf[2 ]) { -case MSG_EXT_SDTR : +case EXTENDED_SDTR : {u_int period;u_int ppr_options;
@@ -5160,7 +5160,7 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)* and didn't have to fall down to async * transfers. */ -if (ahd_sent_msg (ahd,AHDMSG_EXT ,MSG_EXT_SDTR , TRUE)) { +if (ahd_sent_msg (ahd,AHDMSG_EXT ,EXTENDED_SDTR , TRUE)) {/* We started it */ if (saved_offset != offset) {/* Went too low - force async */
@@ -5187,7 +5187,7 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo) done =MSGLOOP_MSGCOMPLETE ;break ; } -case MSG_EXT_WDTR : +case EXTENDED_WDTR : {u_int bus_width;u_int saved_width;
@@ -5221,7 +5221,7 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo) saved_width, bus_width); } -if (ahd_sent_msg (ahd,AHDMSG_EXT ,MSG_EXT_WDTR , TRUE)) { +if (ahd_sent_msg (ahd,AHDMSG_EXT ,EXTENDED_WDTR , TRUE)) {/* * Don't send a WDTR back to the * target, since we asked first.
@@ -5283,7 +5283,7 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo) done =MSGLOOP_MSGCOMPLETE ;break ; } -case MSG_EXT_PPR : +case EXTENDED_PPR : {u_int period;u_int offset;
@@ -5338,7 +5338,7 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)ahd_validate_offset (ahd, tinfo, period, &offset, bus_width, devinfo->role); -if (ahd_sent_msg (ahd,AHDMSG_EXT ,MSG_EXT_PPR , TRUE)) { +if (ahd_sent_msg (ahd,AHDMSG_EXT ,EXTENDED_PPR , TRUE)) {/* * If we are unable to do any of the * requested options (we went too low),
@@ -5401,7 +5401,7 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)break ; }#ifdef AHD_TARGET_MODE -case MSG_BUS_DEV_RESET : +case TARGET_RESET : ahd_handle_devreset(ahd, devinfo, CAM_LUN_WILDCARD, CAM_BDR_SENT, "Bus Device Reset Received",
@@ -5409,9 +5409,9 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)ahd_restart (ahd); done =MSGLOOP_TERMINATED ;break ; -case MSG_ABORT_TAG : -case MSG_ABORT : -case MSG_CLEAR_QUEUE : +case ABORT_TASK : +case ABORT_TASK_SET : +case CLEAR_TASK_SET : {int tag;
@@ -5421,7 +5421,7 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)break ; } tag =SCB_LIST_NULL ; -if (ahd->msgin_buf[0 ] ==MSG_ABORT_TAG ) +if (ahd->msgin_buf[0 ] ==ABORT_TASK ) tag =ahd_inb (ahd,INITIATOR_TAG ); ahd_abort_scbs(ahd, devinfo->target, devinfo->channel, devinfo->lun, tag, ROLE_TARGET,
@@ -5445,7 +5445,7 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)break ; }#endif -case MSG_QAS_REQUEST : +case QAS_REQUEST :#ifdef AHD_DEBUG if ((ahd_debug &AHD_SHOW_MESSAGES ) !=0 ) printk("%s: QAS request. SCSISIGI == 0x%x\n",
@@ -5453,7 +5453,7 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)#endif ahd->msg_flags |=MSG_FLAG_EXPECT_QASREJ_BUSFREE ; fallthrough; -case MSG_TERM_IO_PROC : +case TERMINATE_IO_PROC :default : reject = TRUE;break ;
@@ -5465,7 +5465,7 @@ ahd_parse_msg(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)*/ ahd->msgout_index =0 ; ahd->msgout_len =1 ; - ahd->msgout_buf[0 ] =MSG_MESSAGE_REJECT ; + ahd->msgout_buf[0 ] =MESSAGE_REJECT ; done =MSGLOOP_MSGCOMPLETE ; response = TRUE; }
@@ -5504,8 +5504,8 @@ ahd_handle_msg_reject(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)/* Might be necessary */ last_msg =ahd_inb (ahd,LAST_MSG ); -if (ahd_sent_msg (ahd,AHDMSG_EXT ,MSG_EXT_PPR ,/*full*/ FALSE)) { -if (ahd_sent_msg (ahd,AHDMSG_EXT ,MSG_EXT_PPR ,/*full*/ TRUE) +if (ahd_sent_msg (ahd,AHDMSG_EXT ,EXTENDED_PPR ,/*full*/ FALSE)) { +if (ahd_sent_msg (ahd,AHDMSG_EXT ,EXTENDED_PPR ,/*full*/ TRUE) && tinfo->goal.period <=AHD_SYNCRATE_PACED ) {/* * Target may not like our SPI-4 PPR Options.
@@ -5542,7 +5542,7 @@ ahd_handle_msg_reject(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)ahd_build_transfer_msg (ahd, devinfo); ahd->msgout_index =0 ; response =1 ; - }else if (ahd_sent_msg (ahd,AHDMSG_EXT ,MSG_EXT_WDTR ,/*full*/ FALSE)) { + }else if (ahd_sent_msg (ahd,AHDMSG_EXT ,EXTENDED_WDTR ,/*full*/ FALSE)) {/* note 8bit xfers */ printk("(%s:%c:%d:%d): refuses WIDE negotiation. Using "
@@ -5567,7 +5567,7 @@ ahd_handle_msg_reject(struct ahd_softc *ahd, struct ahd_devinfo *devinfo) ahd->msgout_index =0 ; response =1 ; } - }else if (ahd_sent_msg (ahd,AHDMSG_EXT ,MSG_EXT_SDTR ,/*full*/ FALSE)) { + }else if (ahd_sent_msg (ahd,AHDMSG_EXT ,EXTENDED_SDTR ,/*full*/ FALSE)) {/* note asynch xfers and clear flag */ ahd_set_syncrate(ahd, devinfo, /*period*/0, /*offset*/0, /*ppr_options*/0,
@@ -5577,13 +5577,13 @@ ahd_handle_msg_reject(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)"Using asynchronous transfers\n" ,ahd_name (ahd), devinfo->channel, devinfo->target, devinfo->lun); - }else if ((scb->hscb->control &MSG_SIMPLE_TASK ) !=0 ) { + }else if ((scb->hscb->control &SIMPLE_QUEUE_TAG ) !=0 ) {int tag_type;int mask; - tag_type = (scb->hscb->control &MSG_SIMPLE_TASK ); + tag_type = (scb->hscb->control &SIMPLE_QUEUE_TAG ); -if (tag_type ==MSG_SIMPLE_TASK ) { +if (tag_type ==SIMPLE_QUEUE_TAG ) {printk ("(%s:%c:%d:%d): refuses tagged commands. " "Performing non-tagged I/O\n" ,ahd_name (ahd), devinfo->channel, devinfo->target, devinfo->lun);
@@ -5593,7 +5593,7 @@ ahd_handle_msg_reject(struct ahd_softc *ahd, struct ahd_devinfo *devinfo)printk ("(%s:%c:%d:%d): refuses %s tagged commands. " "Performing simple queue tagged I/O only\n" ,ahd_name (ahd), devinfo->channel, devinfo->target, - devinfo->lun, tag_type ==MSG_ORDERED_TASK + devinfo->lun, tag_type ==ORDERED_QUEUE_TAG ?"ordered" :"head of queue" );ahd_set_tags (ahd, scb->io_ctx, devinfo,AHD_QUEUE_BASIC ); mask = ~0x03 ;
@@ -5607,7 +5607,7 @@ ahd_handle_msg_reject(struct ahd_softc *ahd, struct ahd_devinfo *devinfo) ahd_inb_scbram(ahd, SCB_CONTROL) & mask); scb->hscb->control &= mask;ahd_set_transaction_tag (scb,/*enabled*/ FALSE, -/*type*/ MSG_SIMPLE_TASK ); +/*type*/ SIMPLE_QUEUE_TAG );ahd_outb (ahd,MSG_OUT ,MSG_IDENTIFYFLAG );ahd_assert_atn (ahd); ahd_busy_tcl(ahd, BUILD_TCL(scb->hscb->scsiid, devinfo->lun),
@@ -5922,7 +5922,7 @@ ahd_handle_devreset(struct ahd_softc *ahd, struct ahd_devinfo *devinfo,continue ;ahd_queue_lstate_event (ahd, lstate, devinfo->our_scsiid, -MSG_BUS_DEV_RESET ,/*arg*/ 0 ); +TARGET_RESET ,/*arg*/ 0 );ahd_send_lstate_events (ahd, lstate); } }
@@ -9158,7 +9158,7 @@ ahd_queue_lstate_event(struct ahd_softc *ahd, struct ahd_tmode_lstate *lstate, - (lstate->event_r_idx - lstate->event_w_idx);if (event_type ==EVENT_TYPE_BUS_RESET - || event_type ==MSG_BUS_DEV_RESET ) { + || event_type ==TARGET_RESET ) {/* * Any earlier events are irrelevant, so reset our buffer. * This has the effect of allowing us to deal with reset
drivers/scsi/aic7xxx/aic79xx_osm.c +2 -2
@@ -1602,10 +1602,10 @@ ahd_linux_run_command(struct ahd_softc *ahd, struct ahd_linux_device *dev,if ((dev->flags & (AHD_DEV_Q_TAGGED |AHD_DEV_Q_BASIC )) !=0 ) {if (dev->commands_since_idle_or_otag ==AHD_OTAG_THRESH && (dev->flags &AHD_DEV_Q_TAGGED ) !=0 ) { - hscb->control |=MSG_ORDERED_TASK ; + hscb->control |=ORDERED_QUEUE_TAG ; dev->commands_since_idle_or_otag =0 ; }else { - hscb->control |=MSG_SIMPLE_TASK ; + hscb->control |=SIMPLE_QUEUE_TAG ; } }
drivers/scsi/aic7xxx/aic7xxx_core.c +63 -63
377 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_osm.c +3 -2
@@ -1,3 +1,4 @@ +/* * Adaptec AIC7xxx device driver for Linux. *
@@ -1480,10 +1481,10 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev,if ((dev->flags & (AHC_DEV_Q_TAGGED |AHC_DEV_Q_BASIC )) !=0 ) {if (dev->commands_since_idle_or_otag ==AHC_OTAG_THRESH && (dev->flags &AHC_DEV_Q_TAGGED ) !=0 ) { - hscb->control |=MSG_ORDERED_TASK ; + hscb->control |=ORDERED_QUEUE_TAG ; dev->commands_since_idle_or_otag =0 ; }else { - hscb->control |=MSG_SIMPLE_TASK ; + hscb->control |=SIMPLE_QUEUE_TAG ; } }
drivers/scsi/aic7xxx/scsi_message.h +0 -41
60 lines not on this page · raw message
include/scsi/scsi.h +1 -0
@@ -116,6 +116,7 @@ static inline int scsi_is_wlun(u64 lun)#define CLEAR_TASK_SET 0x0e#define INITIATE_RECOVERY 0x0f/* SCSI-II only */ #define RELEASE_RECOVERY 0x10/* SCSI-II only */ +#define TERMINATE_IO_PROC 0x11/* SCSI-II only */ #define CLEAR_ACA 0x16#define LOGICAL_UNIT_RESET 0x17#define SIMPLE_QUEUE_TAG 0x20
Signature · 1 line
2.29.2
PATCH v3 29/35 esp_scsi: do not set SCSI message byte
In reply to Hannes ReineckeThe message byte setting always devolves to COMMAND_COMPLETE, so we can drop setting the message byte in the SCSI result.
--- drivers/scsi/esp_scsi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/scsi/esp_scsi.c +1 -4
@@ -907,10 +907,8 @@ static void esp_cmd_is_done(struct esp *esp, struct esp_cmd_entry *ent,esp_free_lun_tag (ent, dev->hostdata); cmd->result =0 ;set_host_byte (cmd, host_byte); -if (host_byte ==DID_OK ) { -set_msg_byte (cmd, ent->message); +if (host_byte ==DID_OK )set_status_byte (cmd, ent->status); - }if (ent->eh_done) {complete (ent->eh_done);
@@ -926,7 +924,6 @@ static void esp_cmd_is_done(struct esp *esp, struct esp_cmd_entry *ent,*/ cmd->result = ((DRIVER_SENSE <<24 ) | (DID_OK <<16 ) | - (COMMAND_COMPLETE <<8 ) | (SAM_STAT_CHECK_CONDITION <<0 )); ent->flags &= ~ESP_CMD_FLAG_AUTOSENSE ;
Signature · 1 line
2.29.2
PATCH v3 26/35 dpt_i2o: use DID_ERROR instead of INITIATOR_ERROR message
In reply to Hannes ReineckeChange the error code for an invalid SCSI opcode to DID_ERROR; INITIATOR_ERROR is a scsi parallel message which doesn't apply for RAID HBAs.
--- drivers/scsi/dpt_i2o.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/dpt_i2o.c +1 -1
@@ -2226,7 +2226,7 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_ddefault :printk (KERN_WARNING "%s: scsi opcode 0x%x not supported.\n" , pHba->name, cmd->cmnd[0 ]); - cmd->result = (DID_OK <<16 ) | (INITIATOR_ERROR <<8 ); + cmd->result = (DID_ERROR <<16 ); cmd->scsi_done (cmd);return 0 ; }
Signature · 1 line
2.29.2
PATCH v3 15/35 aacraid: avoid setting message byte on completion
In reply to Hannes ReineckeThe aacraid controller is a RAID controller, and the driver will never see any SCSI messages. Plus it's quite pointless to set the message byte if the host byte is already set, as the latter takes precedence during error recovery.
So drop the message byte values for the final result.
--- drivers/scsi/aacraid/aachba.c | 173 +++++++++++++--------------------- 1 file changed, 64 insertions(+), 109 deletions(-)
drivers/scsi/aacraid/aachba.c +64 -109
@@ -556,7 +556,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr) } } - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 |SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ;aac_fib_complete (fibptr); scsicmd->scsi_done (scsicmd);
@@ -1092,7 +1092,7 @@ static void get_container_serial_callback(void *context, struct fib * fibptr) } } - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 |SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ;aac_fib_complete (fibptr); scsicmd->scsi_done (scsicmd);
@@ -1191,8 +1191,7 @@ static int aac_bounds_32(struct aac_dev * dev, struct scsi_cmnd * cmd, u64 lba)if (lba &0xffffffff00000000LL ) {int cid =scmd_id (cmd);dprintk ((KERN_DEBUG "aacraid: Illegal lba\n" )); - cmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_CHECK_CONDITION ; + cmd->result =DID_OK <<16 |SAM_STAT_CHECK_CONDITION ;set_sense (&dev->fsa_dev[cid].sense_data,HARDWARE_ERROR ,SENCODE_INTERNAL_TARGET_FAILURE ,ASENCODE_INTERNAL_TARGET_FAILURE ,0 ,0 );
@@ -2364,13 +2363,11 @@ static void io_callback(void *context, struct fib * fibptr) readreply = (struct aac_read_reply *)fib_data (fibptr);switch (le32_to_cpu (readreply->status)) {case ST_OK : - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ; dev->fsa_dev[cid].sense_data.sense_key =NO_SENSE ;break ;case ST_NOT_READY : - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_CHECK_CONDITION ; + scsicmd->result =DID_OK <<16 |SAM_STAT_CHECK_CONDITION ;set_sense (&dev->fsa_dev[cid].sense_data,NOT_READY ,SENCODE_BECOMING_READY ,ASENCODE_BECOMING_READY ,0 ,0 ); memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
@@ -2378,8 +2375,7 @@ static void io_callback(void *context, struct fib * fibptr) SCSI_SENSE_BUFFERSIZE));break ;case ST_MEDERR : - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_CHECK_CONDITION ; + scsicmd->result =DID_OK <<16 |SAM_STAT_CHECK_CONDITION ;set_sense (&dev->fsa_dev[cid].sense_data,MEDIUM_ERROR ,SENCODE_UNRECOVERED_READ_ERROR ,ASENCODE_NO_SENSE ,0 ,0 ); memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
@@ -2391,8 +2387,7 @@ static void io_callback(void *context, struct fib * fibptr)printk (KERN_WARNING "io_callback: io failed, status = %d\n" ,le32_to_cpu (readreply->status));#endif - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_CHECK_CONDITION ; + scsicmd->result =DID_OK <<16 |SAM_STAT_CHECK_CONDITION ;set_sense (&dev->fsa_dev[cid].sense_data,HARDWARE_ERROR ,SENCODE_INTERNAL_TARGET_FAILURE ,ASENCODE_INTERNAL_TARGET_FAILURE ,0 ,0 );
@@ -2467,8 +2462,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)if ((lba + count) > (dev->fsa_dev[scmd_id (scsicmd)].size)) { cid =scmd_id (scsicmd);dprintk ((KERN_DEBUG "aacraid: Illegal lba\n" )); - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_CHECK_CONDITION ; + scsicmd->result =DID_OK <<16 |SAM_STAT_CHECK_CONDITION ;set_sense (&dev->fsa_dev[cid].sense_data,ILLEGAL_REQUEST ,SENCODE_LBA_OUT_OF_RANGE ,ASENCODE_INTERNAL_TARGET_FAILURE ,0 ,0 );
@@ -2500,7 +2494,7 @@ static int aac_read(struct scsi_cmnd * scsicmd)/* * For some reason, the Fib didn't queue, return QUEUE_FULL */ - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 |SAM_STAT_TASK_SET_FULL ; + scsicmd->result =DID_OK <<16 |SAM_STAT_TASK_SET_FULL ; scsicmd->scsi_done (scsicmd);aac_fib_complete (cmd_fibcontext);aac_fib_free (cmd_fibcontext);
@@ -2559,8 +2553,7 @@ static int aac_write(struct scsi_cmnd * scsicmd)if ((lba + count) > (dev->fsa_dev[scmd_id (scsicmd)].size)) { cid =scmd_id (scsicmd);dprintk ((KERN_DEBUG "aacraid: Illegal lba\n" )); - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_CHECK_CONDITION ; + scsicmd->result =DID_OK <<16 |SAM_STAT_CHECK_CONDITION ;set_sense (&dev->fsa_dev[cid].sense_data,ILLEGAL_REQUEST ,SENCODE_LBA_OUT_OF_RANGE ,ASENCODE_INTERNAL_TARGET_FAILURE ,0 ,0 );
@@ -2592,7 +2585,7 @@ static int aac_write(struct scsi_cmnd * scsicmd)/* * For some reason, the Fib didn't queue, return QUEUE_FULL */ - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 |SAM_STAT_TASK_SET_FULL ; + scsicmd->result =DID_OK <<16 |SAM_STAT_TASK_SET_FULL ; scsicmd->scsi_done (scsicmd);aac_fib_complete (cmd_fibcontext);
@@ -2615,8 +2608,7 @@ static void synchronize_callback(void *context, struct fib *fibptr) synchronizereply =fib_data (fibptr);if (le32_to_cpu (synchronizereply->status) ==CT_OK ) - cmd->result =DID_OK <<16 | -COMMAND_COMPLETE <<8 |SAM_STAT_GOOD ; + cmd->result =DID_OK <<16 |SAM_STAT_GOOD ;else {struct scsi_device *sdev = cmd->device;struct aac_dev *dev = fibptr->dev;
@@ -2624,8 +2616,7 @@ static void synchronize_callback(void *context, struct fib *fibptr)printk (KERN_WARNING "synchronize_callback: synchronize failed, status = %d\n" ,le32_to_cpu (synchronizereply->status)); - cmd->result =DID_OK <<16 | -COMMAND_COMPLETE <<8 |SAM_STAT_CHECK_CONDITION ; + cmd->result =DID_OK <<16 |SAM_STAT_CHECK_CONDITION ;set_sense (&dev->fsa_dev[cid].sense_data,HARDWARE_ERROR ,SENCODE_INTERNAL_TARGET_FAILURE ,ASENCODE_INTERNAL_TARGET_FAILURE ,0 ,0 );
@@ -2699,7 +2690,7 @@ static void aac_start_stop_callback(void *context, struct fib *fibptr)BUG_ON (fibptr ==NULL ); - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 |SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ;aac_fib_complete (fibptr);aac_fib_free (fibptr);
@@ -2716,8 +2707,7 @@ static int aac_start_stop(struct scsi_cmnd *scsicmd)if (!(aac->supplement_adapter_info.supported_options2 &AAC_OPTION_POWER_MANAGEMENT )) { - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ; scsicmd->scsi_done (scsicmd);return 0 ; }
@@ -2848,7 +2838,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) (scsicmd->cmnd[0] != TEST_UNIT_READY)) {dprintk ((KERN_WARNING "Only INQUIRY & TUR command supported for controller, rcvd = 0x%x.\n" , scsicmd->cmnd[0 ])); - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 |SAM_STAT_CHECK_CONDITION ; + scsicmd->result =DID_OK <<16 |SAM_STAT_CHECK_CONDITION ;set_sense (&dev->fsa_dev[cid].sense_data,ILLEGAL_REQUEST ,SENCODE_INVALID_COMMAND ,ASENCODE_INVALID_COMMAND ,0 ,0 );
@@ -2877,8 +2867,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)case SYNCHRONIZE_CACHE :if (((aac_cache &6 ) ==6 ) && dev->cache_protected) { - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ;break ; }/* Issue FIB to tell Firmware to flush it's cache */
@@ -2907,9 +2896,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) arr[1 ] = scsicmd->cmnd[2 ];scsi_sg_copy_from_buffer (scsicmd, &inq_data,sizeof (inq_data)); - scsicmd->result =DID_OK <<16 | -COMMAND_COMPLETE <<8 | -SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ; }else if (scsicmd->cmnd[2 ] ==0x80 ) {/* unit serial number page */ arr[3] = setinqserial(dev, &arr[4],
@@ -2920,9 +2907,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)if (aac_wwn !=2 )return aac_get_container_serial ( scsicmd); - scsicmd->result =DID_OK <<16 | -COMMAND_COMPLETE <<8 | -SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ; }else if (scsicmd->cmnd[2 ] ==0x83 ) {/* vpd page 0x83 - Device Identification Page */ char *sno = (char *)&inq_data;
@@ -2931,14 +2916,10 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)if (aac_wwn !=2 )return aac_get_container_serial ( scsicmd); - scsicmd->result =DID_OK <<16 | -COMMAND_COMPLETE <<8 | -SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ; }else {/* vpd page not implemented */ - scsicmd->result =DID_OK <<16 | -COMMAND_COMPLETE <<8 | -SAM_STAT_CHECK_CONDITION ; + scsicmd->result =DID_OK <<16 |SAM_STAT_CHECK_CONDITION ;set_sense (&dev->fsa_dev[cid].sense_data,ILLEGAL_REQUEST ,SENCODE_INVALID_CDB_FIELD ,ASENCODE_NO_SENSE ,7 ,2 );
@@ -2964,8 +2945,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) inq_data.inqd_pdt =INQD_PDT_PROC ;/* Processor device */ scsi_sg_copy_from_buffer (scsicmd, &inq_data,sizeof (inq_data)); - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ;break ; }if (dev->in_reset)
@@ -3014,8 +2994,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)/* Do not cache partition table for arrays */ scsicmd->device->removable =1 ; - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ;break ; }
@@ -3041,8 +3020,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)scsi_sg_copy_from_buffer (scsicmd, cp,sizeof (cp));/* Do not cache partition table for arrays */ scsicmd->device->removable =1 ; - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ;break ; }
@@ -3121,8 +3099,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)scsi_sg_copy_from_buffer (scsicmd, (char *)&mpd, mode_buf_length); - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ;break ; }case MODE_SENSE_10 :
@@ -3199,8 +3176,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) (char *)&mpd10, mode_buf_length); - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ;break ; }case REQUEST_SENSE :
@@ -3209,8 +3185,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd) sizeof(struct sense_data));memset (&dev->fsa_dev[cid].sense_data,0 ,sizeof (struct sense_data )); - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ;break ;case ALLOW_MEDIUM_REMOVAL :
@@ -3220,16 +3195,14 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)else fsa_dev_ptr[cid].locked =0 ; - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ;break ;/* * These commands are all No-Ops */ case TEST_UNIT_READY :if (fsa_dev_ptr[cid].sense_data.sense_key ==NOT_READY ) { - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_CHECK_CONDITION ; + scsicmd->result =DID_OK <<16 |SAM_STAT_CHECK_CONDITION ;set_sense (&dev->fsa_dev[cid].sense_data,NOT_READY ,SENCODE_BECOMING_READY ,ASENCODE_BECOMING_READY ,0 ,0 );
@@ -3246,8 +3219,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)case REZERO_UNIT :case REASSIGN_BLOCKS :case SEEK_10 : - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_GOOD ; + scsicmd->result =DID_OK <<16 |SAM_STAT_GOOD ;break ;case START_STOP :
@@ -3259,8 +3231,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)*/ dprintk ((KERN_WARNING "Unhandled SCSI Command: 0x%x.\n" , scsicmd->cmnd[0 ])); - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 | -SAM_STAT_CHECK_CONDITION ; + scsicmd->result =DID_OK <<16 |SAM_STAT_CHECK_CONDITION ;set_sense (&dev->fsa_dev[cid].sense_data,ILLEGAL_REQUEST ,SENCODE_INVALID_COMMAND ,ASENCODE_INVALID_COMMAND ,0 ,0 );
@@ -3441,9 +3412,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr) le32_to_cpu(srbreply->status)); len =min_t (u32,le32_to_cpu (srbreply->sense_data_size),SCSI_SENSE_BUFFERSIZE ); - scsicmd->result =DID_ERROR <<16 - |COMMAND_COMPLETE <<8 - |SAM_STAT_CHECK_CONDITION ; + scsicmd->result =DID_ERROR <<16 |SAM_STAT_CHECK_CONDITION ;memcpy (scsicmd->sense_buffer, srbreply->sense_data, len); }
@@ -3455,7 +3424,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)case SRB_STATUS_ERROR_RECOVERY :case SRB_STATUS_PENDING :case SRB_STATUS_SUCCESS : - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_OK <<16 ;break ;case SRB_STATUS_DATA_OVERRUN :switch (scsicmd->cmnd[0 ]) {
@@ -3472,60 +3441,52 @@ static void aac_srb_callback(void *context, struct fib * fibptr)pr_warn ("aacraid: SCSI CMD underflow\n" ); else pr_warn("aacraid: SCSI CMD Data Overrun\n"); - scsicmd->result =DID_ERROR <<16 - |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_ERROR <<16 ;break ;case INQUIRY : - scsicmd->result =DID_OK <<16 - |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_OK <<16 ;break ;default : - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_OK <<16 ;break ; }break ;case SRB_STATUS_ABORTED : - scsicmd->result =DID_ABORT <<16 |ABORT <<8 ; + scsicmd->result =DID_ABORT <<16 ;break ;case SRB_STATUS_ABORT_FAILED :/* * Not sure about this one - but assuming the * hba was trying to abort for some reason */ - scsicmd->result =DID_ERROR <<16 |ABORT <<8 ; + scsicmd->result =DID_ERROR <<16 ;break ;case SRB_STATUS_PARITY_ERROR : - scsicmd->result =DID_PARITY <<16 - |MSG_PARITY_ERROR <<8 ; + scsicmd->result =DID_PARITY <<16 ;break ;case SRB_STATUS_NO_DEVICE :case SRB_STATUS_INVALID_PATH_ID :case SRB_STATUS_INVALID_TARGET_ID :case SRB_STATUS_INVALID_LUN :case SRB_STATUS_SELECTION_TIMEOUT : - scsicmd->result =DID_NO_CONNECT <<16 - |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_NO_CONNECT <<16 ;break ;case SRB_STATUS_COMMAND_TIMEOUT :case SRB_STATUS_TIMEOUT : - scsicmd->result =DID_TIME_OUT <<16 - |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_TIME_OUT <<16 ;break ;case SRB_STATUS_BUSY : - scsicmd->result =DID_BUS_BUSY <<16 - |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_BUS_BUSY <<16 ;break ;case SRB_STATUS_BUS_RESET : - scsicmd->result =DID_RESET <<16 - |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_RESET <<16 ;break ;case SRB_STATUS_MESSAGE_REJECTED : - scsicmd->result =DID_ERROR <<16 - |MESSAGE_REJECT <<8 ; + scsicmd->result =DID_ERROR <<16 ;break ;case SRB_STATUS_REQUEST_FLUSHED :case SRB_STATUS_ERROR :
@@ -3561,19 +3522,14 @@ static void aac_srb_callback(void *context, struct fib * fibptr) || (scsicmd->cmnd[0] == ATA_16)) { if (scsicmd->cmnd[2] & (0x01 << 5)) { - scsicmd->result =DID_OK <<16 - |COMMAND_COMPLETE <<8 ; -break ; + scsicmd->result = DID_OK << 16; } else { - scsicmd->result =DID_ERROR <<16 - |COMMAND_COMPLETE <<8 ; -break ; + scsicmd->result = DID_ERROR << 16; } } else { - scsicmd->result =DID_ERROR <<16 - |COMMAND_COMPLETE <<8 ; -break ; + scsicmd->result =DID_ERROR <<16 ; } +break ; }if (le32_to_cpu (srbreply->scsi_status) ==SAM_STAT_CHECK_CONDITION ) {
@@ -3609,7 +3565,7 @@ static void hba_resp_task_complete(struct aac_dev *dev,switch (err->status) {case SAM_STAT_GOOD : - scsicmd->result |=DID_OK <<16 |COMMAND_COMPLETE <<8 ; + scsicmd->result |=DID_OK <<16 ;break ;case SAM_STAT_CHECK_CONDITION : {
@@ -3620,19 +3576,19 @@ static void hba_resp_task_complete(struct aac_dev *dev,if (len)memcpy (scsicmd->sense_buffer, err->sense_response_buf, len); - scsicmd->result |=DID_OK <<16 |COMMAND_COMPLETE <<8 ; + scsicmd->result |=DID_OK <<16 ;break ; }case SAM_STAT_BUSY : - scsicmd->result |=DID_BUS_BUSY <<16 |COMMAND_COMPLETE <<8 ; + scsicmd->result |=DID_BUS_BUSY <<16 ;break ;case SAM_STAT_TASK_ABORTED : - scsicmd->result |=DID_ABORT <<16 |ABORT <<8 ; + scsicmd->result |=DID_ABORT <<16 ;break ;case SAM_STAT_RESERVATION_CONFLICT :case SAM_STAT_TASK_SET_FULL :default : - scsicmd->result |=DID_ERROR <<16 |COMMAND_COMPLETE <<8 ; + scsicmd->result |=DID_ERROR <<16 ;break ; } }
@@ -3652,27 +3608,26 @@ static void hba_resp_task_failure(struct aac_dev *dev, dev->hba_map[bus][cid].devtype =AAC_DEVTYPE_ARC_RAW ; dev->hba_map[bus][cid].rmw_nexus =0xffffffff ; } - scsicmd->result =DID_NO_CONNECT <<16 |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_NO_CONNECT <<16 ;break ; }case HBA_RESP_STAT_IO_ERROR :case HBA_RESP_STAT_NO_PATH_TO_DEVICE : - scsicmd->result =DID_OK <<16 | -COMMAND_COMPLETE <<8 |SAM_STAT_BUSY ; + scsicmd->result =DID_OK <<16 |SAM_STAT_BUSY ;break ;case HBA_RESP_STAT_IO_ABORTED : - scsicmd->result =DID_ABORT <<16 |ABORT <<8 ; + scsicmd->result =DID_ABORT <<16 ;break ;case HBA_RESP_STAT_INVALID_DEVICE : - scsicmd->result =DID_NO_CONNECT <<16 |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_NO_CONNECT <<16 ;break ;case HBA_RESP_STAT_UNDERRUN :/* UNDERRUN is OK */ - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_OK <<16 ;break ;case HBA_RESP_STAT_OVERRUN :default : - scsicmd->result =DID_ERROR <<16 |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_ERROR <<16 ;break ; } }
@@ -3705,7 +3660,7 @@ void aac_hba_callback(void *context, struct fib *fibptr)if (fibptr->flags &FIB_CONTEXT_FLAG_FASTRESP ) {/* fast response */ - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_OK <<16 ; goto out; }
@@ -3717,17 +3672,17 @@ void aac_hba_callback(void *context, struct fib *fibptr)hba_resp_task_failure (dev, scsicmd, err);break ;case HBA_RESP_SVCRES_TMF_REJECTED : - scsicmd->result =DID_ERROR <<16 |MESSAGE_REJECT <<8 ; + scsicmd->result =DID_ERROR <<16 ;break ;case HBA_RESP_SVCRES_TMF_LUN_INVALID : - scsicmd->result =DID_NO_CONNECT <<16 |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_NO_CONNECT <<16 ;break ;case HBA_RESP_SVCRES_TMF_COMPLETE :case HBA_RESP_SVCRES_TMF_SUCCEEDED : - scsicmd->result =DID_OK <<16 |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_OK <<16 ;break ;default : - scsicmd->result =DID_ERROR <<16 |COMMAND_COMPLETE <<8 ; + scsicmd->result =DID_ERROR <<16 ;break ; }
Signature · 1 line
2.29.2
PATCH v3 22/35 scsi_debug: do not set COMMAND_COMPLETE
In reply to Hannes ReineckeCOMMAND_COMPLETE is defined as '0', so setting it is quite pointless.
--- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_debug.c +1 -1
@@ -853,7 +853,7 @@ static const int illegal_condition_result = (DRIVER_SENSE <<24 ) | (DID_ABORT <<16 ) |SAM_STAT_CHECK_CONDITION ;static const int device_qfull_result = - (DID_OK <<16 ) | (COMMAND_COMPLETE <<8 ) |SAM_STAT_TASK_SET_FULL ; + (DID_OK <<16 ) |SAM_STAT_TASK_SET_FULL ;static const int condition_met_result =SAM_STAT_CONDITION_MET ;
Signature · 1 line
2.29.2
PATCH v3 13/35 qla4xxx: use standard SAM status definitions
In reply to Hannes ReineckeUse standard SAM status definitions and drop the
driver-defined ones.
--- drivers/scsi/qla4xxx/ql4_fw.h | 1 - drivers/scsi/qla4xxx/ql4_isr.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/qla4xxx/ql4_fw.h +0 -1
@@ -1181,7 +1181,6 @@ struct status_entry {uint32_t handle;/* 04-07 */ uint8_t scsiStatus;/* 08 */ -#define SCSI_CHECK_CONDITION 0x02uint8_t iscsiFlags;/* 09 */ #define ISCSI_FLAG_RESIDUAL_UNDER 0x02
drivers/scsi/qla4xxx/ql4_isr.c +1 -1
@@ -182,7 +182,7 @@ static void qla4xxx_status_entry(struct scsi_qla_host *ha, cmd->result =DID_OK <<16 | scsi_status; -if (scsi_status !=SCSI_CHECK_CONDITION ) +if (scsi_status !=SAM_STAT_CHECK_CONDITION )break ;/* Copy Sense Data into sense buffer. */
Signature · 1 line
2.29.2
PATCH v3 33/35 qla2xxx: fc_remote_port_chkready() returns a SCSI result value
In reply to Hannes Reineckefc_remote_port_chkready() returns a SCSI result value, not the port status. So fixup the value when the remote port isn't set.
--- drivers/scsi/qla2xxx/qla_os.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_os.c +1 -1
@@ -957,7 +957,7 @@ qla2xxx_mqueuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd,srb_t *sp;int rval; - rval = rport ?fc_remote_port_chkready (rport) :FC_PORTSTATE_OFFLINE ; + rval = rport ?fc_remote_port_chkready (rport) : (DID_NO_CONNECT <<16 );if (rval) { cmd->result = rval; ql_dbg(ql_dbg_io + ql_dbg_verbose, vha, 0x3076,
Signature · 1 line
2.29.2
PATCH v3 30/35 wd33c93: use SCSI status
In reply to Hannes ReineckeUse standard SCSI status and drop usage of the linux-specific ones.
--- drivers/scsi/wd33c93.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/wd33c93.c +3 -3
@@ -1176,7 +1176,7 @@ wd33c93_intr(struct Scsi_Host *instance)if (cmd->SCp.Status ==ILLEGAL_STATUS_BYTE ) cmd->SCp.Status = lun;if (cmd->cmnd[0 ] ==REQUEST_SENSE - && cmd->SCp.Status !=GOOD ) + && cmd->SCp.Status !=SAM_STAT_GOOD ) cmd->result = (cmd-> result &0x00ffff ) | (DID_ERROR <<16 );
@@ -1262,7 +1262,7 @@ wd33c93_intr(struct Scsi_Host *instance) hostdata->connected =NULL ; hostdata->busy[cmd->device->id] &= ~(1 << (cmd->device->lun &0xff )); hostdata->state =S_UNCONNECTED ; -if (cmd->cmnd[0 ] ==REQUEST_SENSE && cmd->SCp.Status !=GOOD ) +if (cmd->cmnd[0 ] ==REQUEST_SENSE && cmd->SCp.Status !=SAM_STAT_GOOD ) cmd->result = (cmd->result &0x00ffff ) | (DID_ERROR <<16 );else
@@ -1296,7 +1296,7 @@ wd33c93_intr(struct Scsi_Host *instance) hostdata->state =S_UNCONNECTED ; DB(DB_INTR, printk(":%d", cmd->SCp.Status))if (cmd->cmnd[0 ] ==REQUEST_SENSE - && cmd->SCp.Status !=GOOD ) + && cmd->SCp.Status !=SAM_STAT_GOOD ) cmd->result = (cmd-> result &0x00ffff ) | (DID_ERROR <<16 );
Signature · 1 line
2.29.2
PATCH v3 27/35 scsi: add 'set_status_byte()' accessor
In reply to Hannes ReineckeAdd the missing 'set_status_byte()' accessor function.
--- include/scsi/scsi_cmnd.h | 5 +++++ 1 file changed, 5 insertions(+)
include/scsi/scsi_cmnd.h +5 -0
@@ -308,6 +308,11 @@ static inline struct scsi_data_buffer *scsi_prot(struct scsi_cmnd *cmd)#define scsi_for_each_prot_sg (cmd, sg, nseg, __i) \ for_each_sg(scsi_prot_sglist(cmd), sg, nseg, __i) +static inline void set_status_byte (struct scsi_cmnd *cmd,char status) +{ + cmd->result = (cmd->result &0xffffff00 ) | status; +} +static inline void set_msg_byte (struct scsi_cmnd *cmd,char status) { cmd->result = (cmd->result &0xffff00ff ) | (status <<8 );
Signature · 1 line
2.29.2
PATCH v3 32/35 storvsc: Return DID_ERROR for invalid commands
In reply to Hannes ReineckeILLEGAL_COMMAND is a sense code, not a driver byte.
--- drivers/scsi/storvsc_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/storvsc_drv.c +1 -1
@@ -1671,7 +1671,7 @@ static bool storvsc_scsi_cmd_ok(struct scsi_cmnd *scmnd)* this. So, don't send it. */ case SET_WINDOW : - scmnd->result =ILLEGAL_REQUEST <<16 ; + scmnd->result =DID_ERROR <<16 ; allowed = false;break ;default :
Signature · 1 line
2.29.2
PATCH v3 31/35 ips: use correct command completion on error
In reply to Hannes ReineckeA non-zero queuecommand() return code means 'busy', ie the command hasn't been submitted. So any command which should be failed need to be completed via the ->scsi_done() callback with the appropriate result code set.
--- drivers/scsi/ips.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/scsi/ips.c +7 -2
@@ -1045,10 +1045,10 @@ static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *) ha = (ips_ha_t *)SC ->device->host->hostdata;if (!ha) -return (1 ); + goto out_error;if (!ha->active) -return (DID_ERROR ); + goto out_error;if (ips_is_passthru (SC )) {if (ha->copp_waitlist.count ==IPS_MAX_IOCTL_QUEUE ) {
@@ -1123,6 +1123,11 @@ static int ips_queue_lck(struct scsi_cmnd *SC, void (*done) (struct scsi_cmnd *)ips_next (ha,IPS_INTR_IORL ); +return (0 ); +out_error: +SC ->result =DID_ERROR <<16 ; +done (SC ); +return (0 ); }
Signature · 1 line
2.29.2
PATCH v3 21/35 initio: drop internal SCSI message definition
In reply to Hannes ReineckeUse the standard SCSI message definitions instead of the driver-internal ones.
--- drivers/scsi/initio.c | 64 ++++++++++++++++++++++--------------------- drivers/scsi/initio.h | 25 ----------------- 2 files changed, 33 insertions(+), 56 deletions(-)
drivers/scsi/initio.c +33 -31
@@ -1315,15 +1315,15 @@ static int initio_state_1(struct initio_host * host) }if ((active_tc->flags & (TCF_WDTR_DONE |TCF_NO_WDTR )) ==0 ) { active_tc->flags |=TCF_WDTR_DONE ; -outb (MSG_EXTEND , host->addr + TUL_SFifo); +outb (EXTENDED_MESSAGE , host->addr + TUL_SFifo);outb (2 , host->addr + TUL_SFifo);/* Extended msg length */ -outb (3 , host->addr + TUL_SFifo);/* Sync request */ +outb (EXTENDED_SDTR , host->addr + TUL_SFifo);/* Sync request */ outb (1 , host->addr + TUL_SFifo);/* Start from 16 bits */ }else if ((active_tc->flags & (TCF_SYNC_DONE |TCF_NO_SYNC_NEGO )) ==0 ) { active_tc->flags |=TCF_SYNC_DONE ; -outb (MSG_EXTEND , host->addr + TUL_SFifo); +outb (EXTENDED_MESSAGE , host->addr + TUL_SFifo);outb (3 , host->addr + TUL_SFifo);/* extended msg length */ -outb (1 , host->addr + TUL_SFifo);/* sync request */ +outb (EXTENDED_SDTR , host->addr + TUL_SFifo);/* sync request */ outb (initio_rate_tbl[active_tc->flags &TCF_SCSI_RATE ], host->addr + TUL_SFifo);outb (MAX_OFFSET , host->addr + TUL_SFifo);/* REQ/ACK offset */ }
@@ -1409,16 +1409,16 @@ static int initio_state_3(struct initio_host * host)case MSG_OUT :/* Message out phase */ if (active_tc->flags & (TCF_SYNC_DONE |TCF_NO_SYNC_NEGO )) { -outb (MSG_NOP , host->addr + TUL_SFifo);/* msg nop */ +outb (NOP , host->addr + TUL_SFifo);/* msg nop */ outb (TSC_XF_FIFO_OUT , host->addr + TUL_SCmd);if (wait_tulip (host) ==-1 )return -1 ; }else { active_tc->flags |=TCF_SYNC_DONE ; -outb (MSG_EXTEND , host->addr + TUL_SFifo); +outb (EXTENDED_MESSAGE , host->addr + TUL_SFifo);outb (3 , host->addr + TUL_SFifo);/* ext. msg len */ -outb (1 , host->addr + TUL_SFifo);/* sync request */ +outb (EXTENDED_SDTR , host->addr + TUL_SFifo);/* sync request */ outb (initio_rate_tbl[active_tc->flags &TCF_SCSI_RATE ], host->addr + TUL_SFifo);outb (MAX_OFFSET , host->addr + TUL_SFifo);/* REQ/ACK offset */ outb (TSC_XF_FIFO_OUT , host->addr + TUL_SCmd);
@@ -1479,7 +1479,7 @@ static int initio_state_4(struct initio_host * host)return -1 ;return 6 ; }else { -outb (MSG_NOP , host->addr + TUL_SFifo);/* msg nop */ +outb (NOP , host->addr + TUL_SFifo);/* msg nop */ outb (TSC_XF_FIFO_OUT , host->addr + TUL_SCmd);if (wait_tulip (host) ==-1 )return -1 ;
@@ -1616,7 +1616,7 @@ static int initio_state_6(struct initio_host * host)break ;case MSG_OUT :/* Message out phase */ -outb (MSG_NOP , host->addr + TUL_SFifo);/* msg nop */ +outb (NOP , host->addr + TUL_SFifo);/* msg nop */ outb (TSC_XF_FIFO_OUT , host->addr + TUL_SCmd);if (wait_tulip (host) ==-1 )return -1 ;
@@ -1789,9 +1789,9 @@ int initio_status_msg(struct initio_host * host)if (host->phase ==MSG_OUT ) {if (host->jsstatus0 &TSS_PAR_ERROR ) -outb (MSG_PARITY , host->addr + TUL_SFifo); +outb (MSG_PARITY_ERROR , host->addr + TUL_SFifo);else -outb (MSG_NOP , host->addr + TUL_SFifo); +outb (NOP , host->addr + TUL_SFifo);outb (TSC_XF_FIFO_OUT , host->addr + TUL_SCmd);return wait_tulip (host); }
@@ -1802,7 +1802,7 @@ int initio_status_msg(struct initio_host * host)return -1 ;if (host->phase !=MSG_OUT )return initio_bad_seq (host); -outb (MSG_PARITY , host->addr + TUL_SFifo); +outb (MSG_PARITY_ERROR , host->addr + TUL_SFifo);outb (TSC_XF_FIFO_OUT , host->addr + TUL_SCmd);return wait_tulip (host); }
@@ -1815,7 +1815,8 @@ int initio_status_msg(struct initio_host * host)return initio_wait_done_disc (host); } -if (msg ==MSG_LINK_COMP || msg ==MSG_LINK_FLAG ) { +if (msg ==LINKED_CMD_COMPLETE || + msg ==LINKED_FLG_CMD_COMPLETE ) {if ((scb->tastat &0x18 ) ==0x10 )return initio_msgin_accept (host); }
@@ -1930,7 +1931,8 @@ int int_initio_resel(struct initio_host * host)return -1 ; msg =inb (host->addr + TUL_SFifo);/* Read Tag Message */ -if (msg <MSG_STAG || msg >MSG_OTAG )/* Is simple Tag */ +if (msg <SIMPLE_QUEUE_TAG || msg >ORDERED_QUEUE_TAG ) +/* Is simple Tag */ goto no_tag;if (initio_msgin_accept (host) ==-1 )
@@ -2010,7 +2012,7 @@ static int initio_msgout_abort_targ(struct initio_host * host)if (host->phase !=MSG_OUT )return initio_bad_seq (host); -outb (MSG_ABORT , host->addr + TUL_SFifo); +outb (ABORT_TASK_SET , host->addr + TUL_SFifo);outb (TSC_XF_FIFO_OUT , host->addr + TUL_SCmd);return initio_wait_disc (host);
@@ -2033,7 +2035,7 @@ static int initio_msgout_abort_tag(struct initio_host * host)if (host->phase !=MSG_OUT )return initio_bad_seq (host); -outb (MSG_ABORT_TAG , host->addr + TUL_SFifo); +outb (ABORT_TASK , host->addr + TUL_SFifo);outb (TSC_XF_FIFO_OUT , host->addr + TUL_SCmd);return initio_wait_disc (host);
@@ -2059,15 +2061,15 @@ static int initio_msgin(struct initio_host * host)return -1 ;switch (inb (host->addr + TUL_SFifo)) { -case MSG_DISC :/* Disconnect msg */ +case DISCONNECT :/* Disconnect msg */ outb (TSC_MSG_ACCEPT , host->addr + TUL_SCmd);return initio_wait_disc (host); -case MSG_SDP : -case MSG_RESTORE : -case MSG_NOP : +case SAVE_POINTERS : +case RESTORE_POINTERS : +case NOP :initio_msgin_accept (host);break ; -case MSG_REJ :/* Clear ATN first */ +case MESSAGE_REJECT :/* Clear ATN first */ outb ((inb (host->addr + TUL_SSignal) & (TSC_SET_ACK |7 )), host->addr + TUL_SSignal); active_tc = host->active_tc;
@@ -2076,13 +2078,13 @@ static int initio_msgin(struct initio_host * host) host->addr + TUL_SSignal);initio_msgin_accept (host);break ; -case MSG_EXTEND :/* extended msg */ +case EXTENDED_MESSAGE :/* extended msg */ initio_msgin_extend (host);break ; -case MSG_IGNOREWIDE : +case IGNORE_WIDE_RESIDUE :initio_msgin_accept (host);break ; -case MSG_COMP : +case COMMAND_COMPLETE :outb (TSC_FLUSH_FIFO , host->addr + TUL_SCtrl0);outb (TSC_MSG_ACCEPT , host->addr + TUL_SCmd);return initio_wait_done_disc (host);
@@ -2104,7 +2106,7 @@ static int initio_msgout_reject(struct initio_host * host)return -1 ;if (host->phase ==MSG_OUT ) { -outb (MSG_REJ , host->addr + TUL_SFifo);/* Msg reject */ +outb (MESSAGE_REJECT , host->addr + TUL_SFifo);/* Msg reject */ outb (TSC_XF_FIFO_OUT , host->addr + TUL_SCmd);return wait_tulip (host); }
@@ -2113,7 +2115,7 @@ static int initio_msgout_reject(struct initio_host * host)static int initio_msgout_ide (struct initio_host * host) { -outb (MSG_IDE , host->addr + TUL_SFifo);/* Initiator Detected Error */ +outb (INITIATOR_ERROR , host->addr + TUL_SFifo);/* Initiator Detected Error */ outb (TSC_XF_FIFO_OUT , host->addr + TUL_SCmd);return wait_tulip (host); }
@@ -2167,9 +2169,9 @@ static int initio_msgin_extend(struct initio_host * host)initio_sync_done (host); -outb (MSG_EXTEND , host->addr + TUL_SFifo); +outb (EXTENDED_MESSAGE , host->addr + TUL_SFifo);outb (3 , host->addr + TUL_SFifo); -outb (1 , host->addr + TUL_SFifo); +outb (EXTENDED_SDTR , host->addr + TUL_SFifo);outb (host->msg[2 ], host->addr + TUL_SFifo);outb (host->msg[3 ], host->addr + TUL_SFifo);outb (TSC_XF_FIFO_OUT , host->addr + TUL_SCmd);
@@ -2199,9 +2201,9 @@ static int initio_msgin_extend(struct initio_host * host)if (initio_msgin_accept (host) !=MSG_OUT )return host->phase;/* WDTR msg out */ -outb (MSG_EXTEND , host->addr + TUL_SFifo); +outb (EXTENDED_MESSAGE , host->addr + TUL_SFifo);outb (2 , host->addr + TUL_SFifo); -outb (3 , host->addr + TUL_SFifo); +outb (EXTENDED_WDTR , host->addr + TUL_SFifo);outb (host->msg[2 ], host->addr + TUL_SFifo);outb (TSC_XF_FIFO_OUT , host->addr + TUL_SCmd);return wait_tulip (host);
@@ -2391,7 +2393,7 @@ int initio_bus_device_reset(struct initio_host * host) } tmp = tmp->next; } -outb (MSG_DEVRST , host->addr + TUL_SFifo); +outb (TARGET_RESET , host->addr + TUL_SFifo);outb (TSC_XF_FIFO_OUT , host->addr + TUL_SCmd);return initio_wait_disc (host);
drivers/scsi/initio.h +0 -25
@@ -433,31 +433,6 @@ struct scsi_ctrl_blk {#define TARGET_BUSY 0x08#define INI_QUEUE_FULL 0x28 -/* SCSI MESSAGE */ -#define MSG_COMP 0x00 -#define MSG_EXTEND 0x01 -#define MSG_SDP 0x02 -#define MSG_RESTORE 0x03 -#define MSG_DISC 0x04 -#define MSG_IDE 0x05 -#define MSG_ABORT 0x06 -#define MSG_REJ 0x07 -#define MSG_NOP 0x08 -#define MSG_PARITY 0x09 -#define MSG_LINK_COMP 0x0A -#define MSG_LINK_FLAG 0x0B -#define MSG_DEVRST 0x0C -#define MSG_ABORT_TAG 0x0D - -/* Queue tag msg: Simple_quque_tag, Head_of_queue_tag, Ordered_queue_tag */ -#define MSG_STAG 0x20 -#define MSG_HTAG 0x21 -#define MSG_OTAG 0x22 - -#define MSG_IGNOREWIDE 0x23 - -#define MSG_IDENT 0x80 -/*********************************************************************** Target Device Control Structure **********************************************************************/
Signature · 1 line
2.29.2
PATCH v3 12/35 dc395: drop private SAM status code definitions
In reply to Hannes ReineckeWe don't need to duplicate definitions from the common include files.
--- drivers/scsi/dc395x.h | 16 ---------------- 1 file changed, 16 deletions(-)
drivers/scsi/dc395x.h +0 -16
@@ -156,15 +156,6 @@#define H_ABORT 0x0FF/* SCSI BUS Status byte codes */ -#define SCSI_STAT_GOOD 0x0/* Good status */ -#define SCSI_STAT_CHECKCOND 0x02/* SCSI Check Condition */ -#define SCSI_STAT_CONDMET 0x04/* Condition Met */ -#define SCSI_STAT_BUSY 0x08/* Target busy status */ -#define SCSI_STAT_INTER 0x10/* Intermediate status */ -#define SCSI_STAT_INTERCONDMET 0x14/* Intermediate condition met */ -#define SCSI_STAT_RESCONFLICT 0x18/* Reservation conflict */ -#define SCSI_STAT_CMDTERM 0x22/* Command Terminated */ -#define SCSI_STAT_QUEUEFULL 0x28/* Queue Full */ #define SCSI_STAT_UNEXP_BUS_F 0xFD/* Unexpect Bus Free */ #define SCSI_STAT_BUS_RST_DETECT 0xFE/* Scsi Bus Reset detected */ #define SCSI_STAT_SEL_TIMEOUT 0xFF/* Selection Time out */
@@ -203,13 +194,6 @@#define MSG_IDENTIFY 0x80#define MSG_HOST_ID 0xC0 -/* SCSI STATUS BYTE */ -#define STATUS_GOOD 0x00 -#define CHECK_CONDITION_ 0x02 -#define STATUS_BUSY 0x08 -#define STATUS_INTERMEDIATE 0x10 -#define RESERVE_CONFLICT 0x18 -/* cmd->result */ #define STATUS_MASK_ 0xFF#define MSG_MASK 0xFF00
Signature · 1 line
2.29.2
PATCH v3 25/35 mac53c94: Do not set invalid command result
In reply to Hannes ReineckeCMD_ACCEPT_MSG is an internal definition, and most certainly not a SCSI status. As the latter gets set during command completion we can drop the assignment here.
--- drivers/scsi/mac53c94.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/mac53c94.c +0 -1
@@ -326,7 +326,6 @@ static void mac53c94_interrupt(int irq, void *dev_id) } cmd->SCp.Status =readb (®s->fifo); cmd->SCp.Message =readb (®s->fifo); - cmd->result =CMD_ACCEPT_MSG ;writeb (CMD_ACCEPT_MSG , ®s->command); state->phase = busfreeing;break ;
Signature · 1 line
2.29.2
PATCH v3 24/35 atp870u: use standard definitions
In reply to Hannes ReineckeUse standard definitions for SCSI commands and return status instead of the hardcoded values.
--- drivers/scsi/atp870u.c | 54 +++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 24 deletions(-)
drivers/scsi/atp870u.c +30 -24
@@ -379,28 +379,28 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id)if (is885 (dev)) { i =atp_readb_pci (dev, c,1 ) &0xf3 ;//j=workreq->cmnd[0]; -if ((workreq->cmnd[0 ] ==0x08 ) || - (workreq->cmnd[0 ] ==0x28 ) || - (workreq->cmnd[0 ] ==0x0a ) || - (workreq->cmnd[0 ] ==0x2a )) { +if ((workreq->cmnd[0 ] ==READ_6 ) || + (workreq->cmnd[0 ] ==READ_10 ) || + (workreq->cmnd[0 ] ==WRITE_6 ) || + (workreq->cmnd[0 ] ==WRITE_10 )) { i |=0x0c ; }atp_writeb_pci (dev, c,1 , i); }else if (is880 (dev)) { -if ((workreq->cmnd[0 ] ==0x08 ) || - (workreq->cmnd[0 ] ==0x28 ) || - (workreq->cmnd[0 ] ==0x0a ) || - (workreq->cmnd[0 ] ==0x2a )) +if ((workreq->cmnd[0 ] ==READ_6 ) || + (workreq->cmnd[0 ] ==READ_10 ) || + (workreq->cmnd[0 ] ==WRITE_6 ) || + (workreq->cmnd[0 ] ==WRITE_10 ))atp_writeb_base (dev,0x3b , (atp_readb_base (dev,0x3b ) &0x3f ) |0xc0 );else atp_writeb_base (dev,0x3b ,atp_readb_base (dev,0x3b ) &0x3f ); }else { -if ((workreq->cmnd[0 ] ==0x08 ) || - (workreq->cmnd[0 ] ==0x28 ) || - (workreq->cmnd[0 ] ==0x0a ) || - (workreq->cmnd[0 ] ==0x2a )) +if ((workreq->cmnd[0 ] ==READ_6 ) || + (workreq->cmnd[0 ] ==READ_10 ) || + (workreq->cmnd[0 ] ==WRITE_6 ) || + (workreq->cmnd[0 ] ==WRITE_10 ))atp_writeb_base (dev,0x3a , (atp_readb_base (dev,0x3a ) &0xf3 ) |0x08 );else
@@ -497,10 +497,10 @@ static irqreturn_t atp870u_intr_handle(int irq, void *dev_id) workreq->result =atp_readb_io (dev, c,0x0f );if (((dev->r1f[c][target_id] &0x10 ) !=0 ) &&is885 (dev)) {printk (KERN_WARNING "AEC67162 CRC ERROR !\n" ); - workreq->result =0x02 ; + workreq->result =SAM_STAT_CHECK_CONDITION ; } }else - workreq->result =0x02 ; + workreq->result =SAM_STAT_CHECK_CONDITION ;if (is885 (dev)) { j =atp_readb_base (dev,0x29 ) |0x01 ;
@@ -630,7 +630,7 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p, req_p->sense_buffer[0 ]=0 ;scsi_set_resid (req_p,0 );if (scmd_channel (req_p) >1 ) { - req_p->result =0x00040000 ; + req_p->result =DID_BAD_TARGET <<16 ;done (req_p);#ifdef ED_DBGP printk ("atp870u_queuecommand : req_p->device->channel > 1\n" );
@@ -649,7 +649,7 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,*/ if ((m & dev->active_id[c]) ==0 ) { - req_p->result =0x00040000 ; + req_p->result =DID_BAD_TARGET <<16 ;done (req_p);return 0 ; }
@@ -684,7 +684,7 @@ static int atp870u_queuecommand_lck(struct scsi_cmnd *req_p,printk ("atp870u_queuecommand : dev->quhd[c] == dev->quend[c]\n" );#endif dev->quend[c]--; - req_p->result =0x00020000 ; + req_p->result =DID_BUS_BUSY <<16 ;done (req_p);return 0 ; }
@@ -800,7 +800,7 @@ static void send_s870(struct atp_unit *dev,unsigned char c)if (l >8 ) l =8 ; } -if (workreq->cmnd[0 ] ==0x00 ) { +if (workreq->cmnd[0 ] ==TEST_UNIT_READY ) { l =0 ; }
@@ -934,22 +934,28 @@ static void send_s870(struct atp_unit *dev,unsigned char c)atp_writeb_pci (dev, c,2 ,0x00 );if (is885 (dev)) { j =atp_readb_pci (dev, c,1 ) &0xf3 ; -if ((workreq->cmnd[0 ] ==0x08 ) || (workreq->cmnd[0 ] ==0x28 ) || - (workreq->cmnd[0 ] ==0x0a ) || (workreq->cmnd[0 ] ==0x2a )) { +if ((workreq->cmnd[0 ] ==READ_6 ) || + (workreq->cmnd[0 ] ==READ_10 ) || + (workreq->cmnd[0 ] ==WRITE_6 ) || + (workreq->cmnd[0 ] ==WRITE_10 )) { j |=0x0c ; }atp_writeb_pci (dev, c,1 , j); }else if (is880 (dev)) { -if ((workreq->cmnd[0 ] ==0x08 ) || (workreq->cmnd[0 ] ==0x28 ) || - (workreq->cmnd[0 ] ==0x0a ) || (workreq->cmnd[0 ] ==0x2a )) +if ((workreq->cmnd[0 ] ==READ_6 ) || + (workreq->cmnd[0 ] ==READ_10 ) || + (workreq->cmnd[0 ] ==WRITE_6 ) || + (workreq->cmnd[0 ] ==WRITE_10 ))atp_writeb_base (dev,0x3b , (atp_readb_base (dev,0x3b ) &0x3f ) |0xc0 );else atp_writeb_base (dev,0x3b ,atp_readb_base (dev,0x3b ) &0x3f ); }else { -if ((workreq->cmnd[0 ] ==0x08 ) || (workreq->cmnd[0 ] ==0x28 ) || - (workreq->cmnd[0 ] ==0x0a ) || (workreq->cmnd[0 ] ==0x2a )) +if ((workreq->cmnd[0 ] ==READ_6 ) || + (workreq->cmnd[0 ] ==READ_10 ) || + (workreq->cmnd[0 ] ==WRITE_6 ) || + (workreq->cmnd[0 ] ==WRITE_10 ))atp_writeb_base (dev,0x3a , (atp_readb_base (dev,0x3a ) &0xf3 ) |0x08 );else
Signature · 1 line
2.29.2
PATCH v3 16/35 hpsa: do not set COMMAND_COMPLETE
In reply to Hannes ReineckeCOMMAND_COMPLETE is defined as '0', and it is a SCSI parallel message to boot. So drop the call to set_msg_byte().
--- drivers/scsi/hpsa.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/hpsa.c +1 -3
@@ -2396,7 +2396,6 @@ static int handle_ioaccel_mode2_error(struct ctlr_info *h,break ;case IOACCEL2_STATUS_SR_UNDERRUN : cmd->result = (DID_OK <<16 );/* host byte */ - cmd->result |= (COMMAND_COMPLETE <<8 );/* msg byte */ ioaccel2_resid =get_unaligned_le32 ( &c2->error_data.resid_cnt[0 ]);scsi_set_resid (cmd, ioaccel2_resid);
@@ -2597,8 +2596,7 @@ static void complete_scsi_command(struct CommandList *cp) (c2->sg[0].chain_indicator == IOACCEL2_CHAIN))hpsa_unmap_ioaccel2_sg_chain_block (h, c2); - cmd->result = (DID_OK <<16 );/* host byte */ - cmd->result |= (COMMAND_COMPLETE <<8 );/* msg byte */ + cmd->result = (DID_OK <<16 );/* host byte */ /* SCSI command has already been cleaned up in SML */ if (dev->was_removed) {
Signature · 1 line
2.29.2
PATCH v3 35/35 ncr53c8xx: Use SAM status values
In reply to Hannes ReineckeUse SAM status values instead of the driver-defined ones. This also fixes a potential bug as the driver-defined values declare 'COMMAND TERMINATED' with a value of 0x20, whereas SCSI-II defines it with a value of 0x22.
--- drivers/scsi/ncr53c8xx.c | 83 ++++++++++++++++++++++------------------ drivers/scsi/ncr53c8xx.h | 16 -------- 2 files changed, 46 insertions(+), 53 deletions(-)
drivers/scsi/ncr53c8xx.c +46 -37
@@ -148,6 +148,11 @@ static int ncr_debug = SCSI_NCR_DEBUG_FLAGS;#define DEBUG_FLAGS SCSI_NCR_DEBUG_FLAGS#endif +/* +* Locally used status flag +*/ +#define SAM_STAT_ILLEGAL 0xff +static inline struct list_head *ncr_list_pop (struct list_head *head) {if (!list_empty (head)) {
@@ -998,8 +1003,6 @@ typedef u32 tagmap_t;** Other definitions */ -#define ScsiResult (host_code, scsi_code) (((host_code) << 16) + ((scsi_code) & 0x7f)) -#define initverbose (driver_setup.verbose)#define bootverbose (np->verbose)
@@ -2430,7 +2433,7 @@ static struct script script0 __initdata = {*/ SCR_FROM_REG (SS_REG ),0 , -SCR_CALL ^IFFALSE (DATA (S_GOOD )), +SCR_CALL ^IFFALSE (DATA (SAM_STAT_GOOD )),PADDRH (bad_status), #ifndef SCSI_NCR_CCB_DONE_SUPPORT
@@ -2879,7 +2882,7 @@ static struct scripth scripth0 __initdata = {8 ,SCR_TO_REG (HS_REG ),0 , -SCR_LOAD_REG (SS_REG ,S_GOOD ), +SCR_LOAD_REG (SS_REG ,SAM_STAT_GOOD ),0 ,SCR_JUMP , PADDR (cleanup_ok),
@@ -3341,15 +3344,15 @@ static struct scripth scripth0 __initdata = { PADDRH (reset), }/*-------------------------< BAD_STATUS >-----------------*/,{/* -** If command resulted in either QUEUE FULL, +** If command resulted in either TASK_SET FULL, ** CHECK CONDITION or COMMAND TERMINATED, ** call the C code. */ -SCR_INT ^IFTRUE (DATA (S_QUEUE_FULL )), +SCR_INT ^IFTRUE (DATA (SAM_STAT_TASK_SET_FULL )),SIR_BAD_STATUS , -SCR_INT ^IFTRUE (DATA (S_CHECK_COND )), +SCR_INT ^IFTRUE (DATA (SAM_STAT_CHECK_CONDITION )),SIR_BAD_STATUS , -SCR_INT ^IFTRUE (DATA (S_TERMINATED )), +SCR_INT ^IFTRUE (DATA (SAM_STAT_COMMAND_TERMINATED )),SIR_BAD_STATUS ,SCR_RETURN , 0,
@@ -4371,7 +4374,7 @@ static int ncr_queue_command (struct ncb *np, struct scsi_cmnd *cmd)*/ cp->actualquirks =0 ; cp->host_status = cp->nego_status ?HS_NEGOTIATE :HS_BUSY ; - cp->scsi_status =S_ILLEGAL ; + cp->scsi_status =SAM_STAT_ILLEGAL ; cp->parity_status =0 ; cp->xerr_status =XE_OK ;
@@ -4602,7 +4605,7 @@ static int ncr_reset_bus (struct ncb *np, struct scsi_cmnd *cmd, int sync_reset)* in order to keep it alive. */ if (!found && sync_reset && !retrieve_from_waiting_list (0 , np, cmd)) { - cmd->result =DID_RESET <<16 ; +set_host_byte (cmd,DID_RESET );ncr_queue_done_cmd (np, cmd); }
@@ -4630,7 +4633,7 @@ static int ncr_abort_command (struct ncb *np, struct scsi_cmnd *cmd)* First, look for the scsi command in the waiting list */ if (remove_from_waiting_list (np, cmd)) { - cmd->result =ScsiResult (DID_ABORT ,0 ); +set_host_byte (cmd,DID_ABORT );ncr_queue_done_cmd (np, cmd);return SCSI_ABORT_SUCCESS ; }
@@ -4895,7 +4898,8 @@ void ncr_complete (struct ncb *np, struct ccb *cp)** Print out any error for debugging purpose. */ if (DEBUG_FLAGS & (DEBUG_RESULT |DEBUG_TINY )) { -if (cp->host_status!=HS_COMPLETE || cp->scsi_status!=S_GOOD ) { +if (cp->host_status !=HS_COMPLETE || + cp->scsi_status !=SAM_STAT_GOOD ) {PRINT_ADDR (cmd,"ERROR: cmd=%x host_status=%x " "scsi_status=%x\n" , cmd->cmnd[0 ], cp->host_status, cp->scsi_status);
@@ -4905,15 +4909,16 @@ void ncr_complete (struct ncb *np, struct ccb *cp)/* ** Check the status. */ + cmd->result =0 ;if ( (cp->host_status ==HS_COMPLETE ) - && (cp->scsi_status ==S_GOOD || - cp->scsi_status ==S_COND_MET )) { + && (cp->scsi_status ==SAM_STAT_GOOD || + cp->scsi_status ==SAM_STAT_CONDITION_MET )) {/* * All went well (GOOD status). -* CONDITION MET status is returned on +* CONDITION MET status is returned on * `Pre-Fetch' or `Search data' success. */ - cmd->result =ScsiResult (DID_OK , cp->scsi_status); +set_status_byte (cmd, cp->scsi_status);/* ** @RESID@
@@ -4944,11 +4949,11 @@ void ncr_complete (struct ncb *np, struct ccb *cp) } } }else if ((cp->host_status ==HS_COMPLETE ) - && (cp->scsi_status ==S_CHECK_COND )) { + && (cp->scsi_status ==SAM_STAT_CHECK_CONDITION )) {/* ** Check condition code */ - cmd->result =DID_OK <<16 |S_CHECK_COND ; +set_status_byte (cmd,SAM_STAT_CHECK_CONDITION );/* ** Copy back sense data to caller's buffer.
@@ -4965,20 +4970,20 @@ void ncr_complete (struct ncb *np, struct ccb *cp)printk (".\n" ); } }else if ((cp->host_status ==HS_COMPLETE ) - && (cp->scsi_status ==S_CONFLICT )) { + && (cp->scsi_status ==SAM_STAT_RESERVATION_CONFLICT )) {/* ** Reservation Conflict condition code */ - cmd->result =DID_OK <<16 |S_CONFLICT ; - +set_status_byte (cmd,SAM_STAT_RESERVATION_CONFLICT ); + }else if ((cp->host_status ==HS_COMPLETE ) - && (cp->scsi_status ==S_BUSY || - cp->scsi_status ==S_QUEUE_FULL )) { + && (cp->scsi_status ==SAM_STAT_BUSY || + cp->scsi_status ==SAM_STAT_TASK_SET_FULL )) {/* ** Target is busy. */ - cmd->result =ScsiResult (DID_OK , cp->scsi_status); +set_status_byte (cmd, cp->scsi_status); }else if ((cp->host_status ==HS_SEL_TIMEOUT ) || (cp->host_status ==HS_TIMEOUT )) {
@@ -4986,21 +4991,24 @@ void ncr_complete (struct ncb *np, struct ccb *cp)/* ** No response */ - cmd->result =ScsiResult (DID_TIME_OUT , cp->scsi_status); +set_status_byte (cmd, cp->scsi_status); +set_host_byte (cmd,DID_TIME_OUT ); }else if (cp->host_status ==HS_RESET ) {/* ** SCSI bus reset */ - cmd->result =ScsiResult (DID_RESET , cp->scsi_status); +set_status_byte (cmd, sp->scsi_status); +set_host_byte (cmd,DID_RESET ); }else if (cp->host_status ==HS_ABORTED ) {/* ** Transfer aborted */ - cmd->result =ScsiResult (DID_ABORT , cp->scsi_status); +set_status_byte (cmd, cp->scsi_status); +set_host_byte (cmd,DID_ABORT ); }else {
@@ -5010,7 +5018,8 @@ void ncr_complete (struct ncb *np, struct ccb *cp)PRINT_ADDR (cmd,"COMMAND FAILED (%x %x) @%p.\n" , cp->host_status, cp->scsi_status, cp); - cmd->result =ScsiResult (DID_ERROR , cp->scsi_status); +set_status_byte (cmd, cp->scsi_status); +set_host_byte (cmd,DID_ERROR ); }/*
@@ -5026,10 +5035,10 @@ void ncr_complete (struct ncb *np, struct ccb *cp)if (cp->host_status==HS_COMPLETE ) {switch (cp->scsi_status) { -case S_GOOD : +case SAM_STAT_GOOD :printk (" GOOD" );break ; -case S_CHECK_COND : +case SAM_STAT_CHECK_CONDITION :printk (" SENSE:" ); p = (u_char *) &cmd->sense_buffer;for (i=0 ; i<14 ; i++)
@@ -6564,7 +6573,7 @@ static void ncr_sir_to_redo(struct ncb *np, int num, struct ccb *cp)switch (s_status) {default :/* Just for safety, should never happen */ -case S_QUEUE_FULL : +case SAM_STAT_TASK_SET_FULL :/* ** Decrease number of tags to the number of ** disconnected commands.
@@ -6588,15 +6597,15 @@ static void ncr_sir_to_redo(struct ncb *np, int num, struct ccb *cp)*/ cp->phys.header.savep = cp->startp; cp->host_status =HS_BUSY ; - cp->scsi_status =S_ILLEGAL ; + cp->scsi_status =SAM_STAT_ILLEGAL ;ncr_put_start_queue (np, cp);if (disc_cnt)INB (nc_ctest2);/* Clear SIGP */ OUTL_DSP (NCB_SCRIPT_PHYS (np, reselect));return ; -case S_TERMINATED : -case S_CHECK_COND : +case SAM_STAT_COMMAND_TERMINATED : +case SAM_STAT_CHECK_CONDIION :/* ** If we were requesting sense, give up. */
@@ -6646,7 +6655,7 @@ static void ncr_sir_to_redo(struct ncb *np, int num, struct ccb *cp) cp->phys.header.wlastp = startp; cp->host_status =HS_BUSY ; - cp->scsi_status =S_ILLEGAL ; + cp->scsi_status =SAM_STAT_ILLEGAL ; cp->auto_sense = s_status; cp->start.schedule.l_paddr =
@@ -8035,7 +8044,7 @@ printk("ncr53c8xx_queue_command\n");spin_lock_irqsave (&np->smp_lock, flags);if ((sts =ncr_queue_command (np, cmd)) !=DID_OK ) { - cmd->result = sts <<16 ; + set_host_byte(cmd, sts;#ifdef DEBUG_NCR53C8XX printk ("ncr53c8xx : command not queued - result=%d\n" , sts);#endif
@@ -8226,7 +8235,7 @@ static void process_waiting_list(struct ncb *np, int sts)#ifdef DEBUG_WAITING_LIST printk ("%s: cmd %lx done forced sts=%d\n" ,ncr_name (np), (u_long ) wcmd, sts);#endif - wcmd->result = sts <<16 ; +set_host_byte (wcmd, sts);ncr_queue_done_cmd (np, wcmd); } }
drivers/scsi/ncr53c8xx.h +0 -16
@@ -1238,22 +1238,6 @@ struct scr_tblsel {**----------------------------------------------------------- */ -/* -** Status -*/ - -#define S_GOOD (0x00) -#define S_CHECK_COND (0x02) -#define S_COND_MET (0x04) -#define S_BUSY (0x08) -#define S_INT (0x10) -#define S_INT_COND_MET (0x14) -#define S_CONFLICT (0x18) -#define S_TERMINATED (0x20) -#define S_QUEUE_FULL (0x28) -#define S_ILLEGAL (0xff) -#define S_SENSE (0x80) -/* * End of ncrreg from FreeBSD */
Signature · 1 line
2.29.2
PATCH v3 34/35 advansys: kill driver_defined status byte accessors
In reply to Hannes ReineckeReplace the driver-defined status byte accessors by the mid-layer defined ones.
--- drivers/scsi/advansys.c | 84 ++++++++++++----------------------------- 1 file changed, 24 insertions(+), 60 deletions(-)
drivers/scsi/advansys.c +24 -60
@@ -2085,12 +2085,6 @@ do { \#define ASC_BUSY 0#define ASC_ERROR (-1) -/* struct scsi_cmnd function return codes */ -#define STATUS_BYTE (byte) (byte) -#define MSG_BYTE (byte) ((byte) << 8) -#define HOST_BYTE (byte) ((byte) << 16) -#define DRIVER_BYTE (byte) ((byte) << 24) -#define ASC_STATS (shost, counter) ASC_STATS_ADD(shost, counter, 1)#ifndef ADVANSYS_STATS #define ASC_STATS_ADD (shost, counter, count)
@@ -5986,10 +5980,10 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)/* * 'done_status' contains the command's ending status. */ + scp->result =0 ;switch (scsiqp->done_status) {case QD_NO_ERROR :ASC_DBG (2 ,"QD_NO_ERROR\n" ); - scp->result =0 ;/* * Check for an underrun condition.
@@ -6010,47 +6004,33 @@ static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)ASC_DBG (2 ,"QD_WITH_ERROR\n" );switch (scsiqp->host_status) {case QHSTA_NO_ERROR : +set_status_byte (scp, scsiqp->scsi_status);if (scsiqp->scsi_status ==SAM_STAT_CHECK_CONDITION ) {ASC_DBG (2 ,"SAM_STAT_CHECK_CONDITION\n" );ASC_DBG_PRT_SENSE (2 , scp->sense_buffer,SCSI_SENSE_BUFFERSIZE ); -/* -* Note: The 'status_byte()' macro used by -* target drivers defined in scsi.h shifts the -* status byte returned by host drivers right -* by 1 bit. This is why target drivers also -* use right shifted status byte definitions. -* For instance target drivers use -* CHECK_CONDITION, defined to 0x1, instead of -* the SCSI defined check condition value of -* 0x2. Host drivers are supposed to return -* the status byte as it is defined by SCSI. -*/ - scp->result =DRIVER_BYTE (DRIVER_SENSE ) | -STATUS_BYTE (scsiqp->scsi_status); - }else { - scp->result =STATUS_BYTE (scsiqp->scsi_status); +set_driver_byte (scp,DRIVER_SENSE ); }break ;default :/* Some other QHSTA error occurred. */ ASC_DBG (1 ,"host_status 0x%x\n" , scsiqp->host_status); - scp->result =HOST_BYTE (DID_BAD_TARGET ); +set_host_byte (scp,DID_BAD_TARGET );break ; }break ;case QD_ABORTED_BY_HOST :ASC_DBG (1 ,"QD_ABORTED_BY_HOST\n" ); - scp->result = -HOST_BYTE (DID_ABORT ) |STATUS_BYTE (scsiqp->scsi_status); +set_status_byte (scp, scsiqp->scsi_status); +set_host_byte (scp,DID_ABORT );break ;default :ASC_DBG (1 ,"done_status 0x%x\n" , scsiqp->done_status); - scp->result = -HOST_BYTE (DID_ERROR ) |STATUS_BYTE (scsiqp->scsi_status); +set_status_byte (scp, scsiqp->scsi_status); +set_host_byte (scp,DID_ERROR );break ; }
@@ -6752,10 +6732,10 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)/* * 'qdonep' contains the command's ending status. */ + scp->result =0 ;switch (qdonep->d3.done_stat) {case QD_NO_ERROR :ASC_DBG (2 ,"QD_NO_ERROR\n" ); - scp->result =0 ;/* * Check for an underrun condition.
@@ -6775,51 +6755,35 @@ static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)ASC_DBG (2 ,"QD_WITH_ERROR\n" );switch (qdonep->d3.host_stat) {case QHSTA_NO_ERROR : +set_status_byte (scp, qdonep->d3.scsi_stat);if (qdonep->d3.scsi_stat ==SAM_STAT_CHECK_CONDITION ) {ASC_DBG (2 ,"SAM_STAT_CHECK_CONDITION\n" );ASC_DBG_PRT_SENSE (2 , scp->sense_buffer,SCSI_SENSE_BUFFERSIZE ); -/* -* Note: The 'status_byte()' macro used by -* target drivers defined in scsi.h shifts the -* status byte returned by host drivers right -* by 1 bit. This is why target drivers also -* use right shifted status byte definitions. -* For instance target drivers use -* CHECK_CONDITION, defined to 0x1, instead of -* the SCSI defined check condition value of -* 0x2. Host drivers are supposed to return -* the status byte as it is defined by SCSI. -*/ - scp->result =DRIVER_BYTE (DRIVER_SENSE ) | -STATUS_BYTE (qdonep->d3.scsi_stat); - }else { - scp->result =STATUS_BYTE (qdonep->d3.scsi_stat); +set_driver_byte (scp,DRIVER_SENSE ); }break ;default :/* QHSTA error occurred */ ASC_DBG (1 ,"host_stat 0x%x\n" , qdonep->d3.host_stat); - scp->result =HOST_BYTE (DID_BAD_TARGET ); +set_host_byte (scp,DID_BAD_TARGET );break ; }break ;case QD_ABORTED_BY_HOST :ASC_DBG (1 ,"QD_ABORTED_BY_HOST\n" ); - scp->result = -HOST_BYTE (DID_ABORT ) |MSG_BYTE (qdonep->d3. - scsi_msg) | -STATUS_BYTE (qdonep->d3.scsi_stat); +set_status_byte (scp, qdonep->d3.scsi_stat); +set_msg_byte (scp, qdonep->d3.scsi_msg); +set_host_byte (scp,DID_ABORT );break ;default :ASC_DBG (1 ,"done_stat 0x%x\n" , qdonep->d3.done_stat); - scp->result = -HOST_BYTE (DID_ERROR ) |MSG_BYTE (qdonep->d3. - scsi_msg) | -STATUS_BYTE (qdonep->d3.scsi_stat); +set_status_byte (scp, qdonep->d3.scsi_stat); +set_msg_byte (scp, qdonep->d3.scsi_msg); +set_host_byte (scp,DID_ERROR );break ; }
@@ -7558,7 +7522,7 @@ static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,"sg_tablesize %d\n" , use_sg, scp->device->host->sg_tablesize);scsi_dma_unmap (scp); - scp->result =HOST_BYTE (DID_ERROR ); +set_host_byte (scp,DID_ERROR );return ASC_ERROR ; }
@@ -7566,7 +7530,7 @@ static int asc_build_req(struct asc_board *boardp, struct scsi_cmnd *scp, use_sg * sizeof(struct asc_sg_list), GFP_ATOMIC);if (!asc_sg_head) {scsi_dma_unmap (scp); - scp->result =HOST_BYTE (DID_SOFT_ERROR ); +set_host_byte (scp,DID_SOFT_ERROR );return ASC_ERROR ; }
@@ -7809,7 +7773,7 @@ adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp,"ADV_MAX_SG_LIST %d\n" , use_sg, scp->device->host->sg_tablesize);scsi_dma_unmap (scp); - scp->result =HOST_BYTE (DID_ERROR ); +set_host_byte (scp,DID_ERROR ); reqp->cmndp =NULL ; scp->host_scribble =NULL ;
@@ -7821,7 +7785,7 @@ adv_build_req(struct asc_board *boardp, struct scsi_cmnd *scp, ret =adv_get_sglist (boardp, reqp, scsiqp, scp, use_sg);if (ret !=ADV_SUCCESS ) {scsi_dma_unmap (scp); - scp->result =HOST_BYTE (DID_ERROR ); +set_host_byte (scp,DID_ERROR ); reqp->cmndp =NULL ; scp->host_scribble =NULL ;
@@ -8518,13 +8482,13 @@ static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp)scmd_printk (KERN_ERR , scp,"ExeScsiQueue() ASC_ERROR, " "err_code 0x%x\n" , err_code);ASC_STATS (scp->device->host, exe_error); - scp->result =HOST_BYTE (DID_ERROR ); +set_host_byte (scp,DID_ERROR );break ;default :scmd_printk (KERN_ERR , scp,"ExeScsiQueue() unknown, " "err_code 0x%x\n" , err_code);ASC_STATS (scp->device->host, exe_unknown); - scp->result =HOST_BYTE (DID_ERROR ); +set_host_byte (scp,DID_ERROR );break ; }
Signature · 1 line
2.29.2
PATCH v3 28/35 esp_scsi: use host byte as last argument to esp_cmd_is_done()
In reply to Hannes ReineckeJust pass in the host byte to esp_cmd_is_done(), and set the status or message bytes if the host byte is DID_OK.
--- drivers/scsi/esp_scsi.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-)
drivers/scsi/esp_scsi.c +10 -14
@@ -896,7 +896,7 @@ static void esp_put_ent(struct esp *esp, struct esp_cmd_entry *ent) }static void esp_cmd_is_done (struct esp *esp,struct esp_cmd_entry *ent, -struct scsi_cmnd *cmd,unsigned int result) +struct scsi_cmnd *cmd,unsigned char host_byte) {struct scsi_device *dev = cmd->device;int tgt = dev->id;
@@ -905,7 +905,12 @@ static void esp_cmd_is_done(struct esp *esp, struct esp_cmd_entry *ent, esp->active_cmd =NULL ;esp_unmap_dma (esp, cmd);esp_free_lun_tag (ent, dev->hostdata); - cmd->result = result; + cmd->result =0 ; +set_host_byte (cmd, host_byte); +if (host_byte ==DID_OK ) { +set_msg_byte (cmd, ent->message); +set_status_byte (cmd, ent->status); + }if (ent->eh_done) {complete (ent->eh_done);
@@ -944,12 +949,6 @@ static void esp_cmd_is_done(struct esp *esp, struct esp_cmd_entry *ent,esp_maybe_execute_command (esp); } -static unsigned int compose_result (unsigned int status,unsigned int message, -unsigned int driver_code) -{ -return (status | (message <<8 ) | (driver_code <<16 )); -} -static void esp_event_queue_full (struct esp *esp,struct esp_cmd_entry *ent) {struct scsi_device *dev = ent->cmd->device;
@@ -1244,7 +1243,7 @@ static int esp_finish_select(struct esp *esp)* all bets are off. */ esp_schedule_reset (esp); -esp_cmd_is_done (esp, ent, cmd, (DID_ERROR <<16 )); +esp_cmd_is_done (esp, ent, cmd,DID_ERROR );return 0 ; }
@@ -1289,7 +1288,7 @@ static int esp_finish_select(struct esp *esp) esp->target[dev->id].flags |=ESP_TGT_CHECK_NEGO ;scsi_esp_cmd (esp,ESP_CMD_ESEL ); -esp_cmd_is_done (esp, ent, cmd, (DID_BAD_TARGET <<16 )); +esp_cmd_is_done (esp, ent, cmd,DID_BAD_TARGET );return 1 ; }
@@ -1874,10 +1873,7 @@ static int esp_process_event(struct esp *esp) ent->flags |=ESP_CMD_FLAG_AUTOSENSE ;esp_autosense (esp, ent); }else { -esp_cmd_is_done (esp, ent, cmd, -compose_result (ent->status, - ent->message, -DID_OK )); +esp_cmd_is_done (esp, ent, cmd,DID_OK ); } }else if (ent->message ==DISCONNECT ) { esp_log_disconnect("Disconnecting tgt[%d] tag[%x:%x]\n",
Signature · 1 line
2.29.2
Martin K. Petersen
AppliedHannes,
Quoted 5 lines
this is the first part of an attempt to clean up SCSI result handling. The patchset primarily cleans up various drivers by fixing up whitespaces or move to standard definitions. It also fixes some minor issues in some drivers which set the wrong result values. And, of course, another attempt to kill the gdth driver
Applied to 5.12/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 8 lines · Hannes Reinecke
this is the first part of an attempt to clean up SCSI result handling. The patchset primarily cleans up various drivers by fixing up whitespaces or move to standard definitions.
It also fixes some minor issues in some drivers which set the wrong result values.
And, of course, another attempt to kill the gdth driver[...]
Applied to 5.12/scsi-queue, thanks!
[01/35] scsi: drop gdth driver
https://git.kernel.org/mkp/scsi/c/0653c358d2dc [02/35] 3w-xxxx: Whitespace cleanup https://git.kernel.org/mkp/scsi/c/8148dfba29e7 [03/35] 3w-9xxx: Whitespace cleanup https://git.kernel.org/mkp/scsi/c/bf4eebbf53c9 [04/35] 3w-sas: Whitespace cleanup https://git.kernel.org/mkp/scsi/c/1789671ded39 [05/35] atp870u: Whitespace cleanup https://git.kernel.org/mkp/scsi/c/bcd5c59f21e3 [06/35] aic7xxx,aic79xx: Whitespace cleanup https://git.kernel.org/mkp/scsi/c/7662d92374df [07/35] aic7xxx,aic79xx: kill pointless forward declarations https://git.kernel.org/mkp/scsi/c/c23435dbc747 [08/35] aic7xxx,aic79xxx: remove driver-defined SAM status definitions https://git.kernel.org/mkp/scsi/c/54c9f6fdefcc [09/35] bfa: drop driver-defined SCSI status codes https://git.kernel.org/mkp/scsi/c/eb74b9322bce [10/35] acornscsi: use standard defines https://git.kernel.org/mkp/scsi/c/0eb198d2c35f [11/35] nsp32: fixup status handling https://git.kernel.org/mkp/scsi/c/23d339f08fac [12/35] dc395: drop private SAM status code definitions https://git.kernel.org/mkp/scsi/c/f55475891edb [13/35] qla4xxx: use standard SAM status definitions https://git.kernel.org/mkp/scsi/c/35f1cad1f928 [14/35] zfcp: do not set COMMAND_COMPLETE https://git.kernel.org/mkp/scsi/c/3273c91bbd01 [15/35] aacraid: avoid setting message byte on completion https://git.kernel.org/mkp/scsi/c/cdec16c1177a [16/35] hpsa: do not set COMMAND_COMPLETE https://git.kernel.org/mkp/scsi/c/0e310ac4ef0d [17/35] stex: do not set COMMAND_COMPLETE https://git.kernel.org/mkp/scsi/c/8959e81cf44a [18/35] nsp_cs: drop internal SCSI message definition https://git.kernel.org/mkp/scsi/c/1c9eb798d566 [19/35] aic7xxx,aic79xx: drop internal SCSI message definition https://git.kernel.org/mkp/scsi/c/d8cd784ff7b3 [20/35] dc395x: drop internal SCSI message definitions https://git.kernel.org/mkp/scsi/c/9c2d26707351 [21/35] initio: drop internal SCSI message definition https://git.kernel.org/mkp/scsi/c/9df17f4679b7 [22/35] scsi_debug: do not set COMMAND_COMPLETE https://git.kernel.org/mkp/scsi/c/7a64c81448b2 [23/35] ufshcd: do not set COMMAND_COMPLETE https://git.kernel.org/mkp/scsi/c/db83d8a5c862 [24/35] atp870u: use standard definitions https://git.kernel.org/mkp/scsi/c/f3272258d79a [25/35] mac53c94: Do not set invalid command result https://git.kernel.org/mkp/scsi/c/ddb99b1d1d4a [26/35] dpt_i2o: use DID_ERROR instead of INITIATOR_ERROR message https://git.kernel.org/mkp/scsi/c/78c9efdd8dbf [27/35] scsi: add 'set_status_byte()' accessor https://git.kernel.org/mkp/scsi/c/d37932a91600 [28/35] esp_scsi: use host byte as last argument to esp_cmd_is_done() https://git.kernel.org/mkp/scsi/c/6b50529e2f6f [29/35] esp_scsi: do not set SCSI message byte https://git.kernel.org/mkp/scsi/c/809dadb15a91 [30/35] wd33c93: use SCSI status https://git.kernel.org/mkp/scsi/c/fc8e006c38e2 [31/35] ips: use correct command completion on error https://git.kernel.org/mkp/scsi/c/88188179f36c [32/35] storvsc: Return DID_ERROR for invalid commands https://git.kernel.org/mkp/scsi/c/ecc751b27a57 [33/35] qla2xxx: fc_remote_port_chkready() returns a SCSI result value https://git.kernel.org/mkp/scsi/c/6098c3005d5a [34/35] advansys: kill driver_defined status byte accessors https://git.kernel.org/mkp/scsi/c/aced5500ec82 [35/35] ncr53c8xx: Use SAM status values https://git.kernel.org/mkp/scsi/c/491152c7c3b5
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Re: [PATCH 01/35] scsi: drop gdth driver
In reply to Hannes ReineckeQuoted 9 lines · Hannes Reinecke
The gdth driver refers to a SCSI parallel, PCI-only HBA RAID adapter which was manufactured by the now-defunct ICP Vortex company, later acquired by Adaptec and superseded by the aacraid series of controllers. The driver itself would require a major overhaul before any modifications can be attempted, but seeing that it's unlikely to have any users left it should rather be removed completely.
Signed-off-by Hannes Reinecke<[email protected]>Cautiously-Acked-by Christoph Hellwig<[email protected]>
So it seems that scsi_get_host_dev() and scsi_free_host_dev() are still hanging around without a user...
Sounding like a very broken record - I would rather if we had the reserved commands patchset to use them now...