From patchwork Wed Dec 2 11:52:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336430 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47048C64E90 for ; Wed, 2 Dec 2020 11:53:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EAFC320DD4 for ; Wed, 2 Dec 2020 11:53:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388316AbgLBLxr (ORCPT ); Wed, 2 Dec 2020 06:53:47 -0500 Received: from mx2.suse.de ([195.135.220.15]:37848 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729236AbgLBLxq (ORCPT ); Wed, 2 Dec 2020 06:53:46 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id BBFBCACC1; Wed, 2 Dec 2020 11:53:03 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 04/34] 3w-sas: Whitespace fixes and tag with SPDX Date: Wed, 2 Dec 2020 12:52:19 +0100 Message-Id: <20201202115249.37690-5-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org General whitespace cleanup and add an SPDX tag to the file. Signed-off-by: Hannes Reinecke --- drivers/scsi/3w-sas.c | 86 +++++++++------------------- drivers/scsi/3w-sas.h | 152 ++++++++++++++++++++++---------------------------- 2 files changed, 95 insertions(+), 143 deletions(-) diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c index dda6fa857709..f92a7b856867 100644 --- a/drivers/scsi/3w-sas.c +++ b/drivers/scsi/3w-sas.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* 3w-sas.c -- LSI 3ware SAS/SATA-RAID Controller device driver for Linux. @@ -5,39 +6,6 @@ Copyright (C) 2009 LSI Corporation. - 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 - Controllers supported by this driver: LSI 3ware 9750 6Gb/s SAS/SATA-RAID @@ -120,7 +88,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 +119,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 +142,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 +159,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 +400,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 +451,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 +516,7 @@ static int twl_poll_response(TW_Device_Extension *tw_dev, int request_id, int se msleep(50); } retval = 0; -out: +out: return retval; } /* End twl_poll_response() */ @@ -802,7 +770,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 +847,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 +905,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 +936,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 +954,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 +972,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 +1179,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 +1213,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 +1438,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 +1492,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 +1643,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); diff --git a/drivers/scsi/3w-sas.h b/drivers/scsi/3w-sas.h index 05e77d84c16d..f1e5fb45c21a 100644 --- a/drivers/scsi/3w-sas.h +++ b/drivers/scsi/3w-sas.h @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* 3w-sas.h -- LSI 3ware SAS/SATA-RAID Controller device driver for Linux. @@ -5,39 +6,6 @@ Copyright (C) 2009 LSI Corporation. - 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: aradford@gmail.com */ @@ -52,17 +20,17 @@ static char *twl_aen_severity_table[] = }; /* Liberator register offsets */ -#define TWL_STATUS 0x0 /* Status */ -#define TWL_HIBDB 0x20 /* Inbound doorbell */ -#define TWL_HISTAT 0x30 /* Host interrupt status */ -#define TWL_HIMASK 0x34 /* Host interrupt mask */ +#define TWL_STATUS 0x0 /* Status */ +#define TWL_HIBDB 0x20 /* Inbound doorbell */ +#define TWL_HISTAT 0x30 /* Host interrupt status */ +#define TWL_HIMASK 0x34 /* Host interrupt mask */ #define TWL_HOBDB 0x9C /* Outbound doorbell */ -#define TWL_HOBDBC 0xA0 /* Outbound doorbell clear */ -#define TWL_SCRPD3 0xBC /* Scratchpad */ -#define TWL_HIBQPL 0xC0 /* Host inbound Q low */ -#define TWL_HIBQPH 0xC4 /* Host inbound Q high */ -#define TWL_HOBQPL 0xC8 /* Host outbound Q low */ -#define TWL_HOBQPH 0xCC /* Host outbound Q high */ +#define TWL_HOBDBC 0xA0 /* Outbound doorbell clear */ +#define TWL_SCRPD3 0xBC /* Scratchpad */ +#define TWL_HIBQPL 0xC0 /* Host inbound Q low */ +#define TWL_HIBQPH 0xC4 /* Host inbound Q high */ +#define TWL_HOBQPL 0xC8 /* Host outbound Q low */ +#define TWL_HOBQPH 0xCC /* Host outbound Q high */ #define TWL_HISTATUS_VALID_INTERRUPT 0xC #define TWL_HISTATUS_ATTENTION_INTERRUPT 0x4 #define TWL_HISTATUS_RESPONSE_INTERRUPT 0x8 @@ -80,12 +48,12 @@ static char *twl_aen_severity_table[] = #define TW_OP_EXECUTE_SCSI 0x10 /* Asynchronous Event Notification (AEN) codes used by the driver */ -#define TW_AEN_QUEUE_EMPTY 0x0000 -#define TW_AEN_SOFT_RESET 0x0001 +#define TW_AEN_QUEUE_EMPTY 0x0000 +#define TW_AEN_SOFT_RESET 0x0001 #define TW_AEN_SYNC_TIME_WITH_HOST 0x031 -#define TW_AEN_SEVERITY_ERROR 0x1 -#define TW_AEN_SEVERITY_DEBUG 0x4 -#define TW_AEN_NOT_RETRIEVED 0x1 +#define TW_AEN_SEVERITY_ERROR 0x1 +#define TW_AEN_SEVERITY_DEBUG 0x4 +#define TW_AEN_NOT_RETRIEVED 0x1 /* Command state defines */ #define TW_S_INITIAL 0x1 /* Initial state */ @@ -101,7 +69,7 @@ static char *twl_aen_severity_table[] = #define TW_CURRENT_DRIVER_BRANCH 0 /* Misc defines */ -#define TW_SECTOR_SIZE 512 +#define TW_SECTOR_SIZE 512 #define TW_MAX_UNITS 32 #define TW_INIT_MESSAGE_CREDITS 0x100 #define TW_INIT_COMMAND_PACKET_SIZE 0x3 @@ -116,15 +84,15 @@ static char *twl_aen_severity_table[] = #define TW_MAX_RESET_TRIES 2 #define TW_MAX_CMDS_PER_LUN 254 #define TW_MAX_AEN_DRAIN 255 -#define TW_IN_RESET 2 +#define TW_IN_RESET 2 #define TW_USING_MSI 3 #define TW_IN_ATTENTION_LOOP 4 -#define TW_MAX_SECTORS 256 -#define TW_MAX_CDB_LEN 16 -#define TW_IOCTL_CHRDEV_TIMEOUT 60 /* 60 seconds */ -#define TW_IOCTL_CHRDEV_FREE -1 -#define TW_COMMAND_OFFSET 128 /* 128 bytes */ -#define TW_VERSION_TABLE 0x0402 +#define TW_MAX_SECTORS 256 +#define TW_MAX_CDB_LEN 16 +#define TW_IOCTL_CHRDEV_TIMEOUT 60 /* 60 seconds */ +#define TW_IOCTL_CHRDEV_FREE -1 +#define TW_COMMAND_OFFSET 128 /* 128 bytes */ +#define TW_VERSION_TABLE 0x0402 #define TW_TIMEKEEP_TABLE 0x040A #define TW_INFORMATION_TABLE 0x0403 #define TW_PARAM_FWVER 3 @@ -136,15 +104,15 @@ static char *twl_aen_severity_table[] = #define TW_PARAM_PHY_SUMMARY_TABLE 1 #define TW_PARAM_PHYCOUNT 2 #define TW_PARAM_PHYCOUNT_LENGTH 1 -#define TW_IOCTL_FIRMWARE_PASS_THROUGH 0x108 // Used by smartmontools +#define TW_IOCTL_FIRMWARE_PASS_THROUGH 0x108 // Used by smartmontools #define TW_ALLOCATION_LENGTH 128 #define TW_SENSE_DATA_LENGTH 18 #define TW_ERROR_LOGICAL_UNIT_NOT_SUPPORTED 0x10a #define TW_ERROR_INVALID_FIELD_IN_CDB 0x10d -#define TW_ERROR_UNIT_OFFLINE 0x128 +#define TW_ERROR_UNIT_OFFLINE 0x128 #define TW_MESSAGE_SOURCE_CONTROLLER_ERROR 3 #define TW_MESSAGE_SOURCE_CONTROLLER_EVENT 4 -#define TW_DRIVER 6 +#define TW_DRIVER 6 #ifndef PCI_DEVICE_ID_3WARE_9750 #define PCI_DEVICE_ID_3WARE_9750 0x1010 #endif @@ -167,25 +135,41 @@ static char *twl_aen_severity_table[] = #define TW_NOTMFA_OUT(x) (x & 0x1) /* request_id: 12, lun: 4 */ -#define TW_REQ_LUN_IN(lun, request_id) (((lun << 12) & 0xf000) | (request_id & 0xfff)) +#define TW_REQ_LUN_IN(lun, request_id) \ + (((lun << 12) & 0xf000) | (request_id & 0xfff)) #define TW_LUN_OUT(lun) ((lun >> 12) & 0xf) /* Register access macros */ -#define TWL_STATUS_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + TWL_STATUS) -#define TWL_HOBQPL_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + TWL_HOBQPL) -#define TWL_HOBQPH_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + TWL_HOBQPH) -#define TWL_HOBDB_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + TWL_HOBDB) -#define TWL_HOBDBC_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + TWL_HOBDBC) -#define TWL_HIMASK_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + TWL_HIMASK) -#define TWL_HISTAT_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + TWL_HISTAT) -#define TWL_HIBQPH_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + TWL_HIBQPH) -#define TWL_HIBQPL_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + TWL_HIBQPL) -#define TWL_HIBDB_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + TWL_HIBDB) -#define TWL_SCRPD3_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + TWL_SCRPD3) -#define TWL_MASK_INTERRUPTS(x) (writel(~0, TWL_HIMASK_REG_ADDR(tw_dev))) -#define TWL_UNMASK_INTERRUPTS(x) (writel(~TWL_HISTATUS_VALID_INTERRUPT, TWL_HIMASK_REG_ADDR(tw_dev))) -#define TWL_CLEAR_DB_INTERRUPT(x) (writel(~0, TWL_HOBDBC_REG_ADDR(tw_dev))) -#define TWL_SOFT_RESET(x) (writel(TWL_ISSUE_SOFT_RESET, TWL_HIBDB_REG_ADDR(tw_dev))) +#define TWL_STATUS_REG_ADDR(x) \ + ((unsigned char __iomem *)x->base_addr + TWL_STATUS) +#define TWL_HOBQPL_REG_ADDR(x) \ + ((unsigned char __iomem *)x->base_addr + TWL_HOBQPL) +#define TWL_HOBQPH_REG_ADDR(x) \ + ((unsigned char __iomem *)x->base_addr + TWL_HOBQPH) +#define TWL_HOBDB_REG_ADDR(x) \ + ((unsigned char __iomem *)x->base_addr + TWL_HOBDB) +#define TWL_HOBDBC_REG_ADDR(x) \ + ((unsigned char __iomem *)x->base_addr + TWL_HOBDBC) +#define TWL_HIMASK_REG_ADDR(x) \ + ((unsigned char __iomem *)x->base_addr + TWL_HIMASK) +#define TWL_HISTAT_REG_ADDR(x) \ + ((unsigned char __iomem *)x->base_addr + TWL_HISTAT) +#define TWL_HIBQPH_REG_ADDR(x) \ + ((unsigned char __iomem *)x->base_addr + TWL_HIBQPH) +#define TWL_HIBQPL_REG_ADDR(x) \ + ((unsigned char __iomem *)x->base_addr + TWL_HIBQPL) +#define TWL_HIBDB_REG_ADDR(x) \ + ((unsigned char __iomem *)x->base_addr + TWL_HIBDB) +#define TWL_SCRPD3_REG_ADDR(x) \ + ((unsigned char __iomem *)x->base_addr + TWL_SCRPD3) +#define TWL_MASK_INTERRUPTS(x) \ + (writel(~0, TWL_HIMASK_REG_ADDR(tw_dev))) +#define TWL_UNMASK_INTERRUPTS(x) \ + (writel(~TWL_HISTATUS_VALID_INTERRUPT, TWL_HIMASK_REG_ADDR(tw_dev))) +#define TWL_CLEAR_DB_INTERRUPT(x) \ + (writel(~0, TWL_HOBDBC_REG_ADDR(tw_dev))) +#define TWL_SOFT_RESET(x) \ + (writel(TWL_ISSUE_SOFT_RESET, TWL_HIBDB_REG_ADDR(tw_dev))) /* Macros */ #define TW_PRINTK(h,a,b,c) { \ @@ -317,7 +301,7 @@ typedef struct TAG_TW_Ioctl_Driver_Command { typedef struct TAG_TW_Ioctl_Apache { TW_Ioctl_Driver_Command driver_command; - char padding[488]; + char padding[488]; TW_Command_Full firmware_command; char data_buffer[1]; } TW_Ioctl_Buf_Apache; @@ -352,10 +336,10 @@ typedef struct TAG_TW_Compatibility_Info #pragma pack() typedef struct TAG_TW_Device_Extension { - void __iomem *base_addr; - unsigned long *generic_buffer_virt[TW_Q_LENGTH]; - dma_addr_t generic_buffer_phys[TW_Q_LENGTH]; - TW_Command_Full *command_packet_virt[TW_Q_LENGTH]; + void __iomem *base_addr; + unsigned long *generic_buffer_virt[TW_Q_LENGTH]; + dma_addr_t generic_buffer_phys[TW_Q_LENGTH]; + TW_Command_Full *command_packet_virt[TW_Q_LENGTH]; dma_addr_t command_packet_phys[TW_Q_LENGTH]; TW_Command_Apache_Header *sense_buffer_virt[TW_Q_LENGTH]; dma_addr_t sense_buffer_phys[TW_Q_LENGTH]; @@ -364,7 +348,7 @@ typedef struct TAG_TW_Device_Extension { unsigned char free_queue[TW_Q_LENGTH]; unsigned char free_head; unsigned char free_tail; - int state[TW_Q_LENGTH]; + int state[TW_Q_LENGTH]; unsigned int posted_request_count; unsigned int max_posted_request_count; unsigned int max_sgl_entries; @@ -375,9 +359,9 @@ typedef struct TAG_TW_Device_Extension { unsigned int aen_count; struct Scsi_Host *host; long flags; - TW_Event *event_queue[TW_Q_LENGTH]; - unsigned char error_index; - unsigned int error_sequence_id; + TW_Event *event_queue[TW_Q_LENGTH]; + unsigned char error_index; + unsigned int error_sequence_id; int chrdev_request_id; wait_queue_head_t ioctl_wqueue; struct mutex ioctl_lock; From patchwork Wed Dec 2 11:52:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336425 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA76CC83016 for ; Wed, 2 Dec 2020 11:54:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4CAAE22203 for ; Wed, 2 Dec 2020 11:54:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388444AbgLBLyd (ORCPT ); Wed, 2 Dec 2020 06:54:33 -0500 Received: from mx2.suse.de ([195.135.220.15]:38740 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729196AbgLBLya (ORCPT ); Wed, 2 Dec 2020 06:54:30 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 11B1BAD60; Wed, 2 Dec 2020 11:53:04 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 06/34] aic7xxx,aic79xx: Whitespace cleanup Date: Wed, 2 Dec 2020 12:52:21 +0100 Message-Id: <20201202115249.37690-7-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Signed-off-by: Hannes Reinecke --- drivers/scsi/aic7xxx/aic79xx.h | 36 +++++----- drivers/scsi/aic7xxx/aic79xx_core.c | 105 ++++++++++++++--------------- drivers/scsi/aic7xxx/aic79xx_osm.h | 14 ++-- drivers/scsi/aic7xxx/aic7xxx_core.c | 131 +++++++++++++++++------------------- drivers/scsi/aic7xxx/aic7xxx_osm.c | 71 ++++++++++--------- drivers/scsi/aic7xxx/aic7xxx_osm.h | 16 ++--- 6 files changed, 185 insertions(+), 188 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h index 9a515551641c..419e3e3f9679 100644 --- a/drivers/scsi/aic7xxx/aic79xx.h +++ b/drivers/scsi/aic7xxx/aic79xx.h @@ -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 */ }; diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index 98b02e7d38bb..aa55bffa0617 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c @@ -57,7 +57,7 @@ static const char *const ahd_chip_names[] = * Hardware error codes. */ struct ahd_hard_error_entry { - uint8_t errno; + uint8_t errno; const char *errmesg; }; @@ -113,7 +113,7 @@ static void ahd_free_tstate(struct ahd_softc *ahd, u_int scsi_id, char channel, int force); #endif static void ahd_devlimited_syncrate(struct ahd_softc *ahd, - struct ahd_initiator_tinfo *, + struct ahd_initiator_tinfo *, u_int *period, u_int *ppr_options, role_t role); @@ -170,7 +170,7 @@ static void ahd_setup_target_msgin(struct ahd_softc *ahd, static u_int ahd_sglist_size(struct ahd_softc *ahd); static u_int ahd_sglist_allocsize(struct ahd_softc *ahd); static bus_dmamap_callback_t - ahd_dmamap_cb; + ahd_dmamap_cb; static void ahd_initialize_hscbs(struct ahd_softc *ahd); static int ahd_init_scbdata(struct ahd_softc *ahd); static void ahd_fini_scbdata(struct ahd_softc *ahd); @@ -268,7 +268,7 @@ static void ahd_run_tqinfifo(struct ahd_softc *ahd, int paused); static void ahd_handle_hwerrint(struct ahd_softc *ahd); static void ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat); static void ahd_handle_scsiint(struct ahd_softc *ahd, - u_int intstat); + u_int intstat); /************************ Sequencer Execution Control *************************/ void @@ -1203,7 +1203,7 @@ ahd_flush_qoutfifo(struct ahd_softc *ahd) while ((ahd_inb(ahd, LQISTAT2) & LQIGSAVAIL) != 0) { u_int fifo_mode; u_int i; - + scbid = ahd_inw(ahd, GSFIFO); scb = ahd_lookup_scb(ahd, scbid); if (scb == NULL) { @@ -1326,7 +1326,7 @@ ahd_flush_qoutfifo(struct ahd_softc *ahd) while (!SCBID_IS_NULL(scbid)) { uint8_t *hscb_ptr; u_int i; - + ahd_set_scbptr(ahd, scbid); next_scbid = ahd_inw_scbram(ahd, SCB_NEXT_COMPLETE); scb = ahd_lookup_scb(ahd, scbid); @@ -1991,7 +1991,7 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat) { struct scb *scb; u_int scb_index; - + #ifdef AHD_DEBUG if ((ahd_debug & AHD_SHOW_RECOVERY) != 0) { printk("%s: CFG4OVERRUN mode = %x\n", ahd_name(ahd), @@ -2094,8 +2094,7 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat) ahd->msg_type = MSG_TYPE_TARGET_MSGOUT; ahd->msgin_index = 0; - } - else + } else ahd_setup_target_msgin(ahd, &devinfo, scb); @@ -2338,9 +2337,9 @@ ahd_handle_seqint(struct ahd_softc *ahd, u_int intstat) ; ahd_outb(ahd, SCB_TASK_MANAGEMENT, 0); ahd_search_qinfifo(ahd, SCB_GET_TARGET(ahd, scb), - SCB_GET_CHANNEL(ahd, scb), - SCB_GET_LUN(scb), SCB_GET_TAG(scb), - ROLE_INITIATOR, /*status*/0, + SCB_GET_CHANNEL(ahd, scb), + SCB_GET_LUN(scb), SCB_GET_TAG(scb), + ROLE_INITIATOR, /*status*/0, SEARCH_REMOVE); } break; @@ -2694,14 +2693,14 @@ ahd_handle_transmission_error(struct ahd_softc *ahd) perrdiag = ahd_inb(ahd, PERRDIAG); msg_out = MSG_INITIATOR_DET_ERR; ahd_outb(ahd, CLRSINT1, CLRSCSIPERR); - + /* * Try to find the SCB associated with this error. */ silent = FALSE; if (lqistat1 == 0 || (lqistat1 & LQICRCI_NLQ) != 0) { - if ((lqistat1 & (LQICRCI_NLQ|LQIOVERI_NLQ)) != 0) + if ((lqistat1 & (LQICRCI_NLQ|LQIOVERI_NLQ)) != 0) ahd_set_active_fifo(ahd); scbid = ahd_get_scbptr(ahd); scb = ahd_lookup_scb(ahd, scbid); @@ -3446,7 +3445,6 @@ ahd_clear_critical_section(struct ahd_softc *ahd) cs = ahd->critical_sections; for (i = 0; i < ahd->num_critical_sections; i++, cs++) { - if (cs->begin < seqaddr && cs->end >= seqaddr) break; } @@ -3472,8 +3470,8 @@ ahd_clear_critical_section(struct ahd_softc *ahd) if (stepping == FALSE) { first_instr = seqaddr; - ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); - simode0 = ahd_inb(ahd, SIMODE0); + ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG); + simode0 = ahd_inb(ahd, SIMODE0); simode3 = ahd_inb(ahd, SIMODE3); lqimode0 = ahd_inb(ahd, LQIMODE0); lqimode1 = ahd_inb(ahd, LQIMODE1); @@ -3515,7 +3513,7 @@ ahd_clear_critical_section(struct ahd_softc *ahd) ahd_outb(ahd, LQOMODE1, lqomode1); ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); ahd_outb(ahd, SEQCTL0, ahd_inb(ahd, SEQCTL0) & ~STEP); - ahd_outb(ahd, SIMODE1, simode1); + ahd_outb(ahd, SIMODE1, simode1); /* * SCSIINT seems to glitch occasionally when * the interrupt masks are restored. Clear SCSIINT @@ -3553,7 +3551,7 @@ ahd_clear_intstat(struct ahd_softc *ahd) ahd_outb(ahd, CLRSINT1, CLRSELTIMEO|CLRATNO|CLRSCSIRSTI |CLRBUSFREE|CLRSCSIPERR|CLRREQINIT); ahd_outb(ahd, CLRSINT0, CLRSELDO|CLRSELDI|CLRSELINGO - |CLRIOERR|CLROVERRUN); + |CLRIOERR|CLROVERRUN); ahd_outb(ahd, CLRINT, CLRSCSIINT); } @@ -3689,7 +3687,7 @@ ahd_devlimited_syncrate(struct ahd_softc *ahd, */ if (role == ROLE_TARGET) transinfo = &tinfo->user; - else + else transinfo = &tinfo->goal; *ppr_options &= (transinfo->ppr_options|MSG_EXT_PPR_PCOMP_EN); if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) { @@ -3720,7 +3718,7 @@ ahd_find_syncrate(struct ahd_softc *ahd, u_int *period, if ((*ppr_options & MSG_EXT_PPR_DT_REQ) != 0 && *period > AHD_SYNCRATE_MIN_DT) *ppr_options &= ~MSG_EXT_PPR_DT_REQ; - + if (*period > AHD_SYNCRATE_MIN) *period = 0; @@ -4083,7 +4081,7 @@ ahd_update_neg_table(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, ahd_outb(ahd, NEGOADDR, devinfo->target); period = tinfo->period; offset = tinfo->offset; - memcpy(iocell_opts, ahd->iocell_opts, sizeof(ahd->iocell_opts)); + memcpy(iocell_opts, ahd->iocell_opts, sizeof(ahd->iocell_opts)); ppr_opts = tinfo->ppr_options & (MSG_EXT_PPR_QAS_REQ|MSG_EXT_PPR_DT_REQ |MSG_EXT_PPR_IU_REQ|MSG_EXT_PPR_RTI); con_opts = 0; @@ -4849,7 +4847,7 @@ ahd_handle_message_phase(struct ahd_softc *ahd) #endif ahd_assert_atn(ahd); } - } else + } else ahd->msgin_index++; if (message_done == MSGLOOP_TERMINATED) { @@ -4952,7 +4950,7 @@ ahd_handle_message_phase(struct ahd_softc *ahd) */ return; } - + ahd->msgin_index++; /* @@ -5816,7 +5814,7 @@ ahd_reinitialize_dataptrs(struct ahd_softc *ahd) AHD_ASSERT_MODES(ahd, AHD_MODE_DFF0_MSK|AHD_MODE_DFF1_MSK, AHD_MODE_DFF0_MSK|AHD_MODE_DFF1_MSK); - + scb_index = ahd_get_scbptr(ahd); scb = ahd_lookup_scb(ahd, scb_index); @@ -5938,7 +5936,7 @@ ahd_handle_devreset(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, ahd_set_syncrate(ahd, devinfo, /*period*/0, /*offset*/0, /*ppr_options*/0, AHD_TRANS_CUR, /*paused*/TRUE); - + if (status != CAM_SEL_TIMEOUT) ahd_send_async(ahd, devinfo->channel, devinfo->target, CAM_LUN_WILDCARD, AC_SENT_BDR); @@ -5954,11 +5952,11 @@ ahd_setup_target_msgin(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, struct scb *scb) { - /* + /* * To facilitate adding multiple messages together, * each routine should increment the index and len * variables instead of setting them explicitly. - */ + */ ahd->msgout_index = 0; ahd->msgout_len = 0; @@ -6091,7 +6089,7 @@ ahd_softc_init(struct ahd_softc *ahd) { ahd->unpause = 0; - ahd->pause = PAUSE; + ahd->pause = PAUSE; return (0); } @@ -6203,7 +6201,7 @@ ahd_reset(struct ahd_softc *ahd, int reinit) u_int sxfrctl1; int wait; uint32_t cmd; - + /* * Preserve the value of the SXFRCTL1 register for all channels. * It contains settings that affect termination and we don't want @@ -6443,7 +6441,7 @@ ahd_init_scbdata(struct ahd_softc *ahd) /* * Note that we were successful */ - return (0); + return (0); error_exit: @@ -6961,7 +6959,7 @@ ahd_controller_info(struct ahd_softc *ahd, char *buf) static const char *channel_strings[] = { "Primary Low", "Primary High", - "Secondary Low", + "Secondary Low", "Secondary High" }; @@ -7233,7 +7231,7 @@ ahd_chip_init(struct ahd_softc *ahd) } else { sxfrctl1 |= ahd->seltime; } - + ahd_outb(ahd, SXFRCTL0, DFON); ahd_outb(ahd, SXFRCTL1, sxfrctl1|ahd->seltime|ENSTIMER|ACTNEGEN); ahd_outb(ahd, SIMODE1, ENSELTIMO|ENSCSIRST|ENSCSIPERR); @@ -7489,7 +7487,7 @@ ahd_chip_init(struct ahd_softc *ahd) ahd_outb(ahd, CMDSIZE_TABLE + 5, 11); ahd_outb(ahd, CMDSIZE_TABLE + 6, 0); ahd_outb(ahd, CMDSIZE_TABLE + 7, 0); - + /* Tell the sequencer of our initial queue positions */ ahd_set_modes(ahd, AHD_MODE_CCHAN, AHD_MODE_CCHAN); ahd_outb(ahd, QOFF_CTLSTA, SCB_QSIZE_512); @@ -7886,7 +7884,7 @@ ahd_resume(struct ahd_softc *ahd) { ahd_reset(ahd, /*reinit*/TRUE); - ahd_intr_enable(ahd, TRUE); + ahd_intr_enable(ahd, TRUE); ahd_restart(ahd); } #endif @@ -7928,7 +7926,7 @@ ahd_find_busy_tcl(struct ahd_softc *ahd, u_int tcl) u_int scbid; u_int scb_offset; u_int saved_scbptr; - + scb_offset = ahd_index_busy_tcl(ahd, &saved_scbptr, tcl); scbid = ahd_inw_scbram(ahd, scb_offset); ahd_set_scbptr(ahd, saved_scbptr); @@ -7940,7 +7938,7 @@ ahd_busy_tcl(struct ahd_softc *ahd, u_int tcl, u_int scbid) { u_int scb_offset; u_int saved_scbptr; - + scb_offset = ahd_index_busy_tcl(ahd, &saved_scbptr, tcl); ahd_outw(ahd, scb_offset, scbid); ahd_set_scbptr(ahd, saved_scbptr); @@ -7993,7 +7991,7 @@ ahd_freeze_devq(struct ahd_softc *ahd, struct scb *scb) target = SCB_GET_TARGET(ahd, scb); lun = SCB_GET_LUN(scb); channel = SCB_GET_CHANNEL(ahd, scb); - + ahd_search_qinfifo(ahd, target, channel, lun, /*tag*/SCB_LIST_NULL, ROLE_UNKNOWN, CAM_REQUEUE_REQ, SEARCH_COMPLETE); @@ -8034,7 +8032,7 @@ ahd_qinfifo_requeue(struct ahd_softc *ahd, struct scb *prev_scb, ahd_outl(ahd, NEXT_QUEUED_SCB_ADDR, busaddr); } else { prev_scb->hscb->next_hscb_busaddr = scb->hscb->hscb_busaddr; - ahd_sync_scb(ahd, prev_scb, + ahd_sync_scb(ahd, prev_scb, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); } ahd->qinfifo[AHD_QIN_WRAP(ahd->qinfifonext)] = SCB_GET_TAG(scb); @@ -8334,7 +8332,7 @@ ahd_search_qinfifo(struct ahd_softc *ahd, int target, char channel, static int ahd_search_scb_list(struct ahd_softc *ahd, int target, char channel, int lun, u_int tag, role_t role, uint32_t status, - ahd_search_action action, u_int *list_head, + ahd_search_action action, u_int *list_head, u_int *list_tail, u_int tid) { struct scb *scb; @@ -8792,7 +8790,7 @@ ahd_stat_timer(struct timer_list *t) struct ahd_softc *ahd = from_timer(ahd, t, stat_timer); u_long s; int enint_coal; - + ahd_lock(ahd, &s); enint_coal = ahd->hs_mailbox & ENINT_COALESCE; @@ -8837,7 +8835,7 @@ ahd_handle_scsi_status(struct ahd_softc *ahd, struct scb *scb) * operations are on data structures that the sequencer * is not touching once the queue is frozen. */ - hscb = scb->hscb; + hscb = scb->hscb; if (ahd_is_paused(ahd)) { paused = 1; @@ -9110,7 +9108,7 @@ ahd_calc_residual(struct ahd_softc *ahd, struct scb *scb) /* * Remainder of the SG where the transfer - * stopped. + * stopped. */ resid = ahd_le32toh(spkt->residual_datacnt) & AHD_SG_LEN_MASK; sg = ahd_sg_bus_to_virt(ahd, scb, resid_sgptr & SG_PTR_MASK); @@ -9293,7 +9291,7 @@ ahd_loadseq(struct ahd_softc *ahd) /* * Setup downloadable constant table. - * + * * The computation for the S/G prefetch variables is * a bit complicated. We would like to always fetch * in terms of cachelined sized increments. However, @@ -9382,7 +9380,7 @@ ahd_loadseq(struct ahd_softc *ahd) if (begin_set[cs_count] == TRUE && end_set[cs_count] == FALSE) { cs_table[cs_count].end = downloaded; - end_set[cs_count] = TRUE; + end_set[cs_count] = TRUE; cs_count++; } continue; @@ -9617,7 +9615,7 @@ ahd_print_register(const ahd_reg_parse_entry_t *table, u_int num_entries, printed_mask == 0 ? ":(" : "|", table[entry].name); printed_mask |= table[entry].mask; - + break; } if (entry >= num_entries) @@ -9654,7 +9652,7 @@ ahd_dump_card_state(struct ahd_softc *ahd) ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI); printk(">>>>>>>>>>>>>>>>>> Dump Card State Begins <<<<<<<<<<<<<<<<<\n" "%s: Dumping Card State at program address 0x%x Mode 0x%x\n", - ahd_name(ahd), + ahd_name(ahd), ahd_inw(ahd, CURADDR), ahd_build_mode_state(ahd, ahd->saved_src_mode, ahd->saved_dst_mode)); @@ -9770,7 +9768,6 @@ ahd_dump_card_state(struct ahd_softc *ahd) } printk("\n"); - printk("Sequencer DMA-Up and Complete list: "); scb_index = ahd_inw(ahd, COMPLETE_DMA_SCB_HEAD); i = 0; @@ -9948,7 +9945,7 @@ ahd_read_seeprom(struct ahd_softc *ahd, uint16_t *buf, ahd_outb(ahd, SEEADR, cur_addr); ahd_outb(ahd, SEECTL, SEEOP_READ | SEESTART); - + error = ahd_wait_seeprom(ahd); if (error) break; @@ -10003,7 +10000,7 @@ ahd_write_seeprom(struct ahd_softc *ahd, uint16_t *buf, ahd_outw(ahd, SEEDAT, *buf++); ahd_outb(ahd, SEEADR, cur_addr); ahd_outb(ahd, SEECTL, SEEOP_WRITE | SEESTART); - + retval = ahd_wait_seeprom(ahd); if (retval) break; @@ -10108,7 +10105,7 @@ ahd_acquire_seeprom(struct ahd_softc *ahd) error = ahd_read_flexport(ahd, FLXADDR_ROMSTAT_CURSENSECTL, &seetype); if (error != 0 - || ((seetype & FLX_ROMSTAT_SEECFG) == FLX_ROMSTAT_SEE_NONE)) + || ((seetype & FLX_ROMSTAT_SEECFG) == FLX_ROMSTAT_SEE_NONE)) return (0); return (1); #endif @@ -10250,7 +10247,7 @@ ahd_handle_en_lun(struct ahd_softc *ahd, struct cam_sim *sim, union ccb *ccb) our_id = ahd->our_id; if (ccb->ccb_h.target_id != our_id) { if ((ahd->features & AHD_MULTI_TID) != 0 - && (ahd->flags & AHD_INITIATORROLE) != 0) { + && (ahd->flags & AHD_INITIATORROLE) != 0) { /* * Only allow additional targets if * the initiator role is disabled. @@ -10437,7 +10434,7 @@ ahd_handle_en_lun(struct ahd_softc *ahd, struct cam_sim *sim, union ccb *ccb) } ahd_lock(ahd, &s); - + ccb->ccb_h.status = CAM_REQ_CMP; LIST_FOREACH(scb, &ahd->pending_scbs, pending_links) { struct ccb_hdr *ccbh; @@ -10701,7 +10698,7 @@ ahd_handle_target_cmd(struct ahd_softc *ahd, struct target_cmd *cmd) printk("Reserved or VU command code type encountered\n"); break; } - + memcpy(atio->cdb_io.cdb_bytes, byte, atio->cdb_len); atio->ccb_h.status |= CAM_CDB_RECVD; diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h index 8a8b7ae7aed3..d6e38298f15b 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.h +++ b/drivers/scsi/aic7xxx/aic79xx_osm.h @@ -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, diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index 725bb7f58054..72006483b016 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c @@ -66,7 +66,7 @@ static const char *const ahc_chip_names[] = { * Hardware error codes. */ struct ahc_hard_error_entry { - uint8_t errno; + uint8_t errno; const char *errmesg; }; @@ -142,7 +142,7 @@ static void ahc_free_tstate(struct ahc_softc *ahc, #endif static const struct ahc_syncrate* ahc_devlimited_syncrate(struct ahc_softc *ahc, - struct ahc_initiator_tinfo *, + struct ahc_initiator_tinfo *, u_int *period, u_int *ppr_options, role_t role); @@ -195,7 +195,7 @@ static void ahc_setup_target_msgin(struct ahc_softc *ahc, struct scb *scb); #endif -static bus_dmamap_callback_t ahc_dmamap_cb; +static bus_dmamap_callback_t ahc_dmamap_cb; static void ahc_build_free_scb_list(struct ahc_softc *ahc); static int ahc_init_scbdata(struct ahc_softc *ahc); static void ahc_fini_scbdata(struct ahc_softc *ahc); @@ -978,7 +978,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) { struct scb *scb; struct ahc_devinfo devinfo; - + ahc_fetch_devinfo(ahc, &devinfo); /* @@ -1022,7 +1022,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) goto unpause; } - hscb = scb->hscb; + hscb = scb->hscb; /* Don't want to clobber the original sense code */ if ((scb->flags & SCB_SENSE) != 0) { @@ -1071,7 +1071,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) &tstate); tinfo = &targ_info->curr; sg = scb->sg_list; - sc = (struct scsi_sense *)(&hscb->shared_data.cdb); + sc = (struct scsi_sense *)(&hscb->shared_data.cdb); /* * Save off the residual if there is one. */ @@ -1117,8 +1117,8 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) * errors will be reported before any data * phases occur. */ - if (ahc_get_residual(scb) - == ahc_get_transfer_length(scb)) { + if (ahc_get_residual(scb) + == ahc_get_transfer_length(scb)) { ahc_update_neg_request(ahc, &devinfo, tstate, targ_info, AHC_NEG_IF_NON_ASYNC); @@ -1129,7 +1129,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) scb->flags |= SCB_AUTO_NEGOTIATE; } hscb->cdb_len = sizeof(*sc); - hscb->dataptr = sg->addr; + hscb->dataptr = sg->addr; hscb->datacnt = sg->len; hscb->sgptr = scb->sg_list_phys | SG_FULL_RESID; hscb->sgptr = ahc_htole32(hscb->sgptr); @@ -1187,13 +1187,13 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) ahc_assert_atn(ahc); break; } - case SEND_REJECT: + case SEND_REJECT: { u_int rejbyte = ahc_inb(ahc, ACCUM); printk("%s:%c:%d: Warning - unknown message received from " - "target (0x%x). Rejecting\n", + "target (0x%x). Rejecting\n", ahc_name(ahc), devinfo.channel, devinfo.target, rejbyte); - break; + break; } case PROTO_VIOLATION: { @@ -1286,8 +1286,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) ahc->msg_type = MSG_TYPE_TARGET_MSGOUT; ahc->msgin_index = 0; - } - else + } else ahc_setup_target_msgin(ahc, &devinfo, scb); @@ -1359,7 +1358,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) if (scb != NULL) ahc_set_transaction_status(scb, CAM_UNCOR_PARITY); - ahc_reset_channel(ahc, devinfo.channel, + ahc_reset_channel(ahc, devinfo.channel, /*init reset*/TRUE); } } else { @@ -1391,7 +1390,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) printk("data overrun detected %s." " Tag == 0x%x.\n", ahc_phase_table[i].phasemsg, - scb->hscb->tag); + scb->hscb->tag); ahc_print_path(ahc, scb); printk("%s seen Data Phase. Length = %ld. NumSGs = %d.\n", ahc_inb(ahc, SEQ_FLAGS) & DPHASE ? "Have" : "Haven't", @@ -1402,7 +1401,7 @@ ahc_handle_seqint(struct ahc_softc *ahc, u_int intstat) printk("sg[%d] - Addr 0x%x%x : Length %d\n", i, (ahc_le32toh(scb->sg_list[i].len) >> 24 - & SG_HIGH_ADDR_BITS), + & SG_HIGH_ADDR_BITS), ahc_le32toh(scb->sg_list[i].addr), ahc_le32toh(scb->sg_list[i].len) & AHC_SG_LEN_MASK); @@ -1549,7 +1548,7 @@ ahc_handle_scsiint(struct ahc_softc *ahc, u_int intstat) if (status == 0 && status0 == 0) { if ((ahc->features & AHC_TWIN) != 0) { /* Try the other channel */ - ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) ^ SELBUSB); + ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) ^ SELBUSB); status = ahc_inb(ahc, SSTAT1) & (SELTO|SCSIRSTI|BUSFREE|SCSIPERR); intr_channel = (cur_channel == 'A') ? 'B' : 'A'; @@ -1595,7 +1594,7 @@ ahc_handle_scsiint(struct ahc_softc *ahc, u_int intstat) printk("%s: Someone reset channel %c\n", ahc_name(ahc), intr_channel); if (intr_channel != cur_channel) - ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) ^ SELBUSB); + ahc_outb(ahc, SBLKCTL, ahc_inb(ahc, SBLKCTL) ^ SELBUSB); ahc_reset_channel(ahc, intr_channel, /*Initiate Reset*/FALSE); } else if ((status & SCSIPERR) != 0) { /* @@ -1688,8 +1687,8 @@ ahc_handle_scsiint(struct ahc_softc *ahc, u_int intstat) } /* - * We've set the hardware to assert ATN if we - * get a parity error on "in" phases, so all 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. @@ -1986,7 +1985,7 @@ ahc_clear_critical_section(struct ahc_softc *ahc) | (ahc_inb(ahc, SEQADDR1) << 8); /* - * Seqaddr represents the next instruction to execute, + * Seqaddr represents the next instruction to execute, * so we are really executing the instruction just * before it. */ @@ -1994,7 +1993,6 @@ ahc_clear_critical_section(struct ahc_softc *ahc) seqaddr -= 1; cs = ahc->critical_sections; for (i = 0; i < ahc->num_critical_sections; i++, cs++) { - if (cs->begin < seqaddr && cs->end >= seqaddr) break; } @@ -2064,7 +2062,7 @@ ahc_clear_intstat(struct ahc_softc *ahc) CLRREQINIT); ahc_flush_device_writes(ahc); ahc_outb(ahc, CLRSINT0, CLRSELDO|CLRSELDI|CLRSELINGO); - ahc_flush_device_writes(ahc); + ahc_flush_device_writes(ahc); ahc_outb(ahc, CLRINT, CLRSCSIINT); ahc_flush_device_writes(ahc); } @@ -2101,7 +2099,7 @@ ahc_print_scb(struct scb *scb) printk("sg[%d] - Addr 0x%x%x : Length %d\n", i, (ahc_le32toh(scb->sg_list[i].len) >> 24 - & SG_HIGH_ADDR_BITS), + & SG_HIGH_ADDR_BITS), ahc_le32toh(scb->sg_list[i].addr), ahc_le32toh(scb->sg_list[i].len)); } @@ -2223,7 +2221,7 @@ ahc_devlimited_syncrate(struct ahc_softc *ahc, */ if (role == ROLE_TARGET) transinfo = &tinfo->user; - else + else transinfo = &tinfo->goal; *ppr_options &= transinfo->ppr_options; if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) { @@ -2655,9 +2653,9 @@ ahc_set_tags(struct ahc_softc *ahc, struct scsi_cmnd *cmd, { struct scsi_device *sdev = cmd->device; - ahc_platform_set_tags(ahc, sdev, devinfo, alg); - ahc_send_async(ahc, devinfo->channel, devinfo->target, - devinfo->lun, AC_TRANSFER_NEG); + ahc_platform_set_tags(ahc, sdev, devinfo, alg); + ahc_send_async(ahc, devinfo->channel, devinfo->target, + devinfo->lun, AC_TRANSFER_NEG); } /* @@ -2756,9 +2754,9 @@ ahc_fetch_devinfo(struct ahc_softc *ahc, struct ahc_devinfo *devinfo) role = ROLE_INITIATOR; if (role == ROLE_TARGET - && (ahc->features & AHC_MULTI_TID) != 0 - && (ahc_inb(ahc, SEQ_FLAGS) - & (CMDPHASE_PENDING|TARG_CMD_PENDING|NO_DISCONNECT)) != 0) { + && (ahc->features & AHC_MULTI_TID) != 0 + && (ahc_inb(ahc, SEQ_FLAGS) + & (CMDPHASE_PENDING|TARG_CMD_PENDING|NO_DISCONNECT)) != 0) { /* We were selected, so pull our id from TARGIDIN */ our_id = ahc_inb(ahc, TARGIDIN) & OID; } else if ((ahc->features & AHC_ULTRA2) != 0) @@ -3366,7 +3364,7 @@ ahc_handle_message_phase(struct ahc_softc *ahc) #endif ahc_assert_atn(ahc); } - } else + } else ahc->msgin_index++; if (message_done == MSGLOOP_TERMINATED) { @@ -3459,7 +3457,7 @@ ahc_handle_message_phase(struct ahc_softc *ahc) */ return; } - + ahc->msgin_index++; /* @@ -4338,7 +4336,7 @@ ahc_handle_devreset(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, ahc_set_syncrate(ahc, devinfo, /*syncrate*/NULL, /*period*/0, /*offset*/0, /*ppr_options*/0, AHC_TRANS_CUR, /*paused*/TRUE); - + if (status != CAM_SEL_TIMEOUT) ahc_send_async(ahc, devinfo->channel, devinfo->target, CAM_LUN_WILDCARD, AC_SENT_BDR); @@ -4355,11 +4353,11 @@ ahc_setup_target_msgin(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, struct scb *scb) { - /* + /* * To facilitate adding multiple messages together, * each routine should increment the index and len * variables instead of setting them explicitly. - */ + */ ahc->msgout_index = 0; ahc->msgout_len = 0; @@ -4432,7 +4430,7 @@ ahc_softc_init(struct ahc_softc *ahc) ahc->unpause = ahc_inb(ahc, HCNTRL) & IRQMS; else ahc->unpause = 0; - ahc->pause = ahc->unpause | PAUSE; + ahc->pause = ahc->unpause | PAUSE; /* XXX The shared scb data stuff should be deprecated */ if (ahc->scb_data == NULL) { ahc->scb_data = kzalloc(sizeof(*ahc->scb_data), GFP_ATOMIC); @@ -4553,7 +4551,7 @@ ahc_reset(struct ahc_softc *ahc, int reinit) u_int sxfrctl1_a, sxfrctl1_b; int error; int wait; - + /* * Preserve the value of the SXFRCTL1 register for all channels. * It contains settings that affect termination and we don't want @@ -4642,7 +4640,7 @@ ahc_reset(struct ahc_softc *ahc, int reinit) */ error = ahc->bus_chip_init(ahc); #ifdef AHC_DUMP_SEQ - else + else ahc_dumpseq(ahc); #endif @@ -4707,7 +4705,7 @@ ahc_build_free_scb_list(struct ahc_softc *ahc) /* Set the next pointer */ if ((ahc->flags & AHC_PAGESCBS) != 0) ahc_outb(ahc, SCB_NEXT, i+1); - else + else ahc_outb(ahc, SCB_NEXT, SCB_LIST_NULL); /* Make the tag number, SCSIID, and lun invalid */ @@ -4860,7 +4858,7 @@ ahc_init_scbdata(struct ahc_softc *ahc) /* * Note that we were successful */ - return (0); + return (0); error_exit: @@ -5003,7 +5001,7 @@ ahc_controller_info(struct ahc_softc *ahc, char *buf) len = sprintf(buf, "%s: ", ahc_chip_names[ahc->chip & AHC_CHIPID_MASK]); buf += len; if ((ahc->features & AHC_TWIN) != 0) - len = sprintf(buf, "Twin Channel, A SCSI Id=%d, " + len = sprintf(buf, "Twin Channel, A SCSI Id=%d, " "B SCSI Id=%d, primary %c, ", ahc->our_id, ahc->our_id_b, (ahc->flags & AHC_PRIMARY_CHANNEL) + 'A'); @@ -5139,7 +5137,7 @@ ahc_chip_init(struct ahc_softc *ahc) ahc_outb(ahc, CMDSIZE_TABLE + 5, 11); ahc_outb(ahc, CMDSIZE_TABLE + 6, 0); ahc_outb(ahc, CMDSIZE_TABLE + 7, 0); - + if ((ahc->features & AHC_HS_MAILBOX) != 0) ahc_outb(ahc, HS_MAILBOX, 0); @@ -5270,7 +5268,7 @@ ahc_init(struct ahc_softc *ahc) */ if ((ahc->flags & AHC_USEDEFAULTS) != 0) ahc->our_id = ahc->our_id_b = 7; - + /* * Default to allowing initiator operations. */ @@ -5288,7 +5286,7 @@ ahc_init(struct ahc_softc *ahc) * DMA tag for our command fifos and other data in system memory * the card's sequencer must be able to access. For initiator * roles, we need to allocate space for the qinfifo and qoutfifo. - * The qinfifo and qoutfifo are composed of 256 1 byte elements. + * The qinfifo and qoutfifo are composed of 256 1 byte elements. * When providing for the target mode role, we must additionally * provide space for the incoming target command fifo and an extra * byte to deal with a dma bug in some chip versions. @@ -5397,7 +5395,7 @@ ahc_init(struct ahc_softc *ahc) && (ahc->flags & AHC_INITIATORROLE) != 0) ahc->flags |= AHC_RESET_BUS_A; - ultraenb = 0; + ultraenb = 0; tagenable = ALL_TARGETS_MASK; /* Grab the disconnection disable table and invert it for our needs */ @@ -5493,9 +5491,9 @@ ahc_init(struct ahc_softc *ahc) && (ultraenb & mask) != 0) { /* Treat 10MHz as a non-ultra speed */ scsirate &= ~SXFR; - ultraenb &= ~mask; + ultraenb &= ~mask; } - tinfo->user.period = + tinfo->user.period = ahc_find_period(ahc, scsirate, (ultraenb & mask) ? AHC_SYNCRATE_ULTRA @@ -5622,7 +5620,7 @@ ahc_resume(struct ahc_softc *ahc) { ahc_reset(ahc, /*reinit*/TRUE); - ahc_intr_enable(ahc, TRUE); + ahc_intr_enable(ahc, TRUE); ahc_restart(ahc); return (0); } @@ -5640,7 +5638,7 @@ ahc_index_busy_tcl(struct ahc_softc *ahc, u_int tcl) if ((ahc->flags & AHC_SCB_BTT) != 0) { u_int saved_scbptr; - + saved_scbptr = ahc_inb(ahc, SCBPTR); ahc_outb(ahc, SCBPTR, TCL_LUN(tcl)); scbid = ahc_inb(ahc, SCB_64_BTT + TCL_TARGET_OFFSET(tcl)); @@ -5660,7 +5658,7 @@ ahc_unbusy_tcl(struct ahc_softc *ahc, u_int tcl) if ((ahc->flags & AHC_SCB_BTT) != 0) { u_int saved_scbptr; - + saved_scbptr = ahc_inb(ahc, SCBPTR); ahc_outb(ahc, SCBPTR, TCL_LUN(tcl)); ahc_outb(ahc, SCB_64_BTT+TCL_TARGET_OFFSET(tcl), SCB_LIST_NULL); @@ -5678,7 +5676,7 @@ ahc_busy_tcl(struct ahc_softc *ahc, u_int tcl, u_int scbid) if ((ahc->flags & AHC_SCB_BTT) != 0) { u_int saved_scbptr; - + saved_scbptr = ahc_inb(ahc, SCBPTR); ahc_outb(ahc, SCBPTR, TCL_LUN(tcl)); ahc_outb(ahc, SCB_64_BTT + TCL_TARGET_OFFSET(tcl), scbid); @@ -5736,7 +5734,7 @@ ahc_freeze_devq(struct ahc_softc *ahc, struct scb *scb) target = SCB_GET_TARGET(ahc, scb); lun = SCB_GET_LUN(scb); channel = SCB_GET_CHANNEL(ahc, scb); - + ahc_search_qinfifo(ahc, target, channel, lun, /*tag*/SCB_LIST_NULL, ROLE_UNKNOWN, CAM_REQUEUE_REQ, SEARCH_COMPLETE); @@ -5774,7 +5772,7 @@ ahc_qinfifo_requeue(struct ahc_softc *ahc, struct scb *prev_scb, ahc_outb(ahc, NEXT_QUEUED_SCB, scb->hscb->tag); } else { prev_scb->hscb->next = scb->hscb->tag; - ahc_sync_scb(ahc, prev_scb, + ahc_sync_scb(ahc, prev_scb, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); } ahc->qinfifo[ahc->qinfifonext++] = scb->hscb->tag; @@ -5991,7 +5989,6 @@ ahc_search_qinfifo(struct ahc_softc *ahc, int target, char channel, break; } } else { - prev = next; next = ahc_inb(ahc, SCB_NEXT); } @@ -6237,7 +6234,7 @@ ahc_rem_wscb(struct ahc_softc *ahc, u_int scbpos, u_int prev) /* update the waiting list */ if (prev == SCB_LIST_NULL) { /* First in the list */ - ahc_outb(ahc, WAITING_SCBH, next); + ahc_outb(ahc, WAITING_SCBH, next); /* * Ensure we aren't attempting to perform @@ -6246,7 +6243,7 @@ ahc_rem_wscb(struct ahc_softc *ahc, u_int scbpos, u_int prev) ahc_outb(ahc, SCSISEQ, (ahc_inb(ahc, SCSISEQ) & ~ENSELO)); } else { /* - * Select the scb that pointed to us + * Select the scb that pointed to us * and update its next pointer. */ ahc_outb(ahc, SCBPTR, prev); @@ -6640,7 +6637,7 @@ ahc_calc_residual(struct ahc_softc *ahc, struct scb *scb) /* * Remainder of the SG where the transfer - * stopped. + * stopped. */ resid = ahc_le32toh(spkt->residual_datacnt) & AHC_SG_LEN_MASK; sg = ahc_sg_bus_to_virt(scb, resid_sgptr & SG_PTR_MASK); @@ -6859,7 +6856,7 @@ ahc_loadseq(struct ahc_softc *ahc) if (begin_set[cs_count] == TRUE && end_set[cs_count] == FALSE) { cs_table[cs_count].end = downloaded; - end_set[cs_count] = TRUE; + end_set[cs_count] = TRUE; cs_count++; } continue; @@ -7087,7 +7084,6 @@ ahc_print_register(const ahc_reg_parse_entry_t *table, u_int num_entries, printed_mask == 0 ? ":(" : "|", table[entry].name); printed_mask |= table[entry].mask; - break; } if (entry >= num_entries) @@ -7201,7 +7197,7 @@ ahc_dump_card_state(struct ahc_softc *ahc) scb_index = ahc_inb(ahc, SCB_NEXT); } printk("\n"); - + ahc_sync_qoutfifo(ahc, BUS_DMASYNC_POSTREAD); printk("QOUTFIFO entries: "); qoutpos = ahc->qoutfifonext; @@ -7378,7 +7374,7 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb) if ((ahc->features & AHC_MULTIROLE) != 0) { if ((ahc->features & AHC_MULTI_TID) != 0 - && (ahc->flags & AHC_INITIATORROLE) != 0) { + && (ahc->flags & AHC_INITIATORROLE) != 0) { /* * Only allow additional targets if * the initiator role is disabled. @@ -7529,7 +7525,6 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb) targid_mask |= target_mask; ahc_outb(ahc, TARGID, targid_mask); ahc_outb(ahc, TARGID+1, (targid_mask >> 8)); - ahc_update_scsiid(ahc, targid_mask); } else { u_int our_id; @@ -7594,7 +7589,7 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb) } ahc_lock(ahc, &s); - + ccb->ccb_h.status = CAM_REQ_CMP; LIST_FOREACH(scb, &ahc->pending_scbs, pending_links) { struct ccb_hdr *ccbh; @@ -7653,7 +7648,7 @@ ahc_handle_en_lun(struct ahc_softc *ahc, struct cam_sim *sim, union ccb *ccb) targid_mask &= ~target_mask; ahc_outb(ahc, TARGID, targid_mask); ahc_outb(ahc, TARGID+1, - (targid_mask >> 8)); + (targid_mask >> 8)); ahc_update_scsiid(ahc, targid_mask); } } @@ -7782,7 +7777,7 @@ ahc_run_tqinfifo(struct ahc_softc *ahc, int paused) ahc_outb(ahc, HS_MAILBOX, hs_mailbox); } else { if (!paused) - ahc_pause(ahc); + ahc_pause(ahc); ahc_outb(ahc, KERNEL_TQINPOS, ahc->tqinfifonext & HOST_TQINPOS); if (!paused) @@ -7881,7 +7876,7 @@ ahc_handle_target_cmd(struct ahc_softc *ahc, struct target_cmd *cmd) printk("Reserved or VU command code type encountered\n"); break; } - + memcpy(atio->cdb_io.cdb_bytes, byte, atio->cdb_len); atio->ccb_h.status |= CAM_CDB_RECVD; diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 7bba961d1ae0..0aaca2eab6b6 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -452,7 +452,7 @@ ahc_insb(struct ahc_softc * ahc, long port, uint8_t *array, int count) static void ahc_linux_unmap_scb(struct ahc_softc*, struct scb*); static int ahc_linux_map_seg(struct ahc_softc *ahc, struct scb *scb, - struct ahc_dma_seg *sg, + struct ahc_dma_seg *sg, dma_addr_t addr, bus_size_t len); static void @@ -571,7 +571,7 @@ ahc_linux_target_alloc(struct scsi_target *starget) target_offset = starget->id; if (starget->channel != 0) target_offset += 8; - + if (starget->channel) our_id = ahc->our_id_b; @@ -597,18 +597,18 @@ ahc_linux_target_alloc(struct scsi_target *starget) ultra = 0; flags &= ~CFXFER; } - + if ((ahc->features & AHC_ULTRA2) != 0) { scsirate = (flags & CFXFER) | (ultra ? 0x8 : 0); } else { scsirate = (flags & CFXFER) << 4; - maxsync = ultra ? AHC_SYNCRATE_ULTRA : + maxsync = ultra ? AHC_SYNCRATE_ULTRA : AHC_SYNCRATE_FAST; } spi_max_width(starget) = (flags & CFWIDEB) ? 1 : 0; if (!(flags & CFSYNCH)) spi_max_offset(starget) = 0; - spi_min_period(starget) = + spi_min_period(starget) = ahc_find_period(ahc, scsirate, maxsync); } ahc_compile_devinfo(&devinfo, our_id, starget->id, @@ -657,7 +657,7 @@ ahc_linux_slave_alloc(struct scsi_device *sdev) * a tagged queuing capable device. */ dev->maxtags = 0; - + spi_period(starget) = 0; return 0; @@ -1219,8 +1219,8 @@ ahc_platform_free(struct ahc_softc *ahc) starget = ahc->platform_data->starget[i]; if (starget != NULL) { ahc->platform_data->starget[i] = NULL; - } - } + } + } if (ahc->platform_data->irq != AHC_LINUX_NOIRQ) free_irq(ahc->platform_data->irq, ahc); @@ -1267,7 +1267,7 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev, default: case AHC_QUEUE_NONE: now_queuing = 0; - break; + break; case AHC_QUEUE_BASIC: now_queuing = AHC_DEV_Q_BASIC; break; @@ -1468,10 +1468,10 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev, hscb->scsioffset = tinfo->curr.offset; if ((tstate->ultraenb & mask) != 0) hscb->control |= ULTRAENB; - + if ((ahc->user_discenable & mask) != 0) hscb->control |= DISCENB; - + if ((tstate->auto_negotiate & mask) != 0) { scb->flags |= SCB_AUTO_NEGOTIATE; scb->hscb->control |= MK_MESSAGE; @@ -1531,7 +1531,7 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev, */ scb->hscb->sgptr = ahc_htole32(scb->sg_list_phys | SG_FULL_RESID); - + /* * Copy the first SG into the "current" * data pointer area. @@ -1551,7 +1551,7 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev, dev->commands_issued++; if ((dev->flags & AHC_DEV_PERIODIC_OTAG) != 0) dev->commands_since_idle_or_otag++; - + scb->flags |= SCB_ACTIVE; if (untagged_q) { TAILQ_INSERT_TAIL(untagged_q, scb, links.tqe); @@ -1572,7 +1572,7 @@ ahc_linux_isr(int irq, void *dev_id) int ours; ahc = (struct ahc_softc *) dev_id; - ahc_lock(ahc, &flags); + ahc_lock(ahc, &flags); ours = ahc_intr(ahc); ahc_unlock(ahc, &flags); return IRQ_RETVAL(ours); @@ -1647,22 +1647,22 @@ ahc_send_async(struct ahc_softc *ahc, char channel, spi_display_xfer_agreement(starget); break; } - case AC_SENT_BDR: + case AC_SENT_BDR: { WARN_ON(lun != CAM_LUN_WILDCARD); scsi_report_device_reset(ahc->platform_data->host, channel - 'A', target); break; } - case AC_BUS_RESET: + case AC_BUS_RESET: if (ahc->platform_data->host != NULL) { scsi_report_bus_reset(ahc->platform_data->host, channel - 'A'); } - break; - default: - panic("ahc_send_async: Unexpected async event"); - } + break; + default: + panic("ahc_send_async: Unexpected async event"); + } } /* @@ -1802,7 +1802,7 @@ ahc_linux_handle_scsi_status(struct ahc_softc *ahc, sdev->sdev_target->id, sdev->lun, sdev->sdev_target->channel == 0 ? 'A' : 'B', ROLE_INITIATOR); - + /* * We don't currently trust the mid-layer to * properly deal with queue full or busy. So, @@ -2108,7 +2108,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) /* Any SCB for this device will do for a target reset */ LIST_FOREACH(pending_scb, &ahc->pending_scbs, pending_links) { - if (ahc_match_scb(ahc, pending_scb, scmd_id(cmd), + if (ahc_match_scb(ahc, pending_scb, scmd_id(cmd), scmd_channel(cmd) + 'A', CAM_LUN_WILDCARD, SCB_LIST_NULL, ROLE_INITIATOR)) @@ -2329,7 +2329,7 @@ static void ahc_linux_set_period(struct scsi_target *starget, int period) struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); struct ahc_tmode_tstate *tstate; - struct ahc_initiator_tinfo *tinfo + struct ahc_initiator_tinfo *tinfo = ahc_fetch_transinfo(ahc, starget->channel + 'A', shost->this_id, starget->id, &tstate); @@ -2361,7 +2361,8 @@ static void ahc_linux_set_period(struct scsi_target *starget, int period) ppr_options &= MSG_EXT_PPR_QAS_REQ; } - syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, AHC_SYNCRATE_DT); + syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, + AHC_SYNCRATE_DT); ahc_lock(ahc, &flags); ahc_set_syncrate(ahc, &devinfo, syncrate, period, offset, ppr_options, AHC_TRANS_GOAL, FALSE); @@ -2373,7 +2374,7 @@ static void ahc_linux_set_offset(struct scsi_target *starget, int offset) struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); struct ahc_tmode_tstate *tstate; - struct ahc_initiator_tinfo *tinfo + struct ahc_initiator_tinfo *tinfo = ahc_fetch_transinfo(ahc, starget->channel + 'A', shost->this_id, starget->id, &tstate); @@ -2386,7 +2387,8 @@ static void ahc_linux_set_offset(struct scsi_target *starget, int offset) ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, starget->channel + 'A', ROLE_INITIATOR); if (offset != 0) { - syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, AHC_SYNCRATE_DT); + syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, + AHC_SYNCRATE_DT); period = tinfo->goal.period; ppr_options = tinfo->goal.ppr_options; } @@ -2401,7 +2403,7 @@ static void ahc_linux_set_dt(struct scsi_target *starget, int dt) struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); struct ahc_tmode_tstate *tstate; - struct ahc_initiator_tinfo *tinfo + struct ahc_initiator_tinfo *tinfo = ahc_fetch_transinfo(ahc, starget->channel + 'A', shost->this_id, starget->id, &tstate); @@ -2422,7 +2424,8 @@ static void ahc_linux_set_dt(struct scsi_target *starget, int dt) ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, starget->channel + 'A', ROLE_INITIATOR); - syncrate = ahc_find_syncrate(ahc, &period, &ppr_options,AHC_SYNCRATE_DT); + syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, + AHC_SYNCRATE_DT); ahc_lock(ahc, &flags); ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset, ppr_options, AHC_TRANS_GOAL, FALSE); @@ -2439,7 +2442,7 @@ static void ahc_linux_set_qas(struct scsi_target *starget, int qas) struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); struct ahc_tmode_tstate *tstate; - struct ahc_initiator_tinfo *tinfo + struct ahc_initiator_tinfo *tinfo = ahc_fetch_transinfo(ahc, starget->channel + 'A', shost->this_id, starget->id, &tstate); @@ -2455,7 +2458,8 @@ static void ahc_linux_set_qas(struct scsi_target *starget, int qas) ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, starget->channel + 'A', ROLE_INITIATOR); - syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, AHC_SYNCRATE_DT); + syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, + AHC_SYNCRATE_DT); ahc_lock(ahc, &flags); ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset, ppr_options, AHC_TRANS_GOAL, FALSE); @@ -2467,7 +2471,7 @@ static void ahc_linux_set_iu(struct scsi_target *starget, int iu) struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); struct ahc_tmode_tstate *tstate; - struct ahc_initiator_tinfo *tinfo + struct ahc_initiator_tinfo *tinfo = ahc_fetch_transinfo(ahc, starget->channel + 'A', shost->this_id, starget->id, &tstate); @@ -2483,7 +2487,8 @@ static void ahc_linux_set_iu(struct scsi_target *starget, int iu) ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0, starget->channel + 'A', ROLE_INITIATOR); - syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, AHC_SYNCRATE_DT); + syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, + AHC_SYNCRATE_DT); ahc_lock(ahc, &flags); ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset, ppr_options, AHC_TRANS_GOAL, FALSE); @@ -2499,7 +2504,7 @@ static void ahc_linux_get_signalling(struct Scsi_Host *shost) if (!(ahc->features & AHC_ULTRA2)) { /* non-LVD chipset, may not have SBLKCTL reg */ - spi_signalling(shost) = + spi_signalling(shost) = ahc->features & AHC_HVD ? SPI_SIGNAL_HVD : SPI_SIGNAL_SE; diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index f8489078f003..125ba5eb175d 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h @@ -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, From patchwork Wed Dec 2 11:52:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59511C83016 for ; Wed, 2 Dec 2020 11:53:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22CD32222A for ; Wed, 2 Dec 2020 11:53:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388347AbgLBLxr (ORCPT ); Wed, 2 Dec 2020 06:53:47 -0500 Received: from mx2.suse.de ([195.135.220.15]:37986 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729736AbgLBLxq (ORCPT ); Wed, 2 Dec 2020 06:53:46 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E7267ACF9; Wed, 2 Dec 2020 11:53:03 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 07/34] aic7xxx,aic79xx: kill pointless forward declarations Date: Wed, 2 Dec 2020 12:52:22 +0100 Message-Id: <20201202115249.37690-8-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Signed-off-by: Hannes Reinecke Reviewed-by: Christoph Hellwig --- drivers/scsi/aic7xxx/aic79xx_osm.h | 23 ----------------------- drivers/scsi/aic7xxx/aic7xxx_osm.h | 23 ----------------------- 2 files changed, 46 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h index d6e38298f15b..35ec24f28d2c 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.h +++ b/drivers/scsi/aic7xxx/aic79xx_osm.h @@ -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) diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index 125ba5eb175d..53240f53b654 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h @@ -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) From patchwork Wed Dec 2 11:52:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28DC1C83014 for ; Wed, 2 Dec 2020 11:54:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6C5C22203 for ; Wed, 2 Dec 2020 11:54:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729706AbgLBLy3 (ORCPT ); Wed, 2 Dec 2020 06:54:29 -0500 Received: from mx2.suse.de ([195.135.220.15]:38744 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729236AbgLBLy2 (ORCPT ); Wed, 2 Dec 2020 06:54:28 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 00218AD41; Wed, 2 Dec 2020 11:53:03 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 09/34] bfa: drop driver-defined SCSI status codes Date: Wed, 2 Dec 2020 12:52:24 +0100 Message-Id: <20201202115249.37690-10-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Drop the driver-defined SCSI status code and use the generic ones instead. Signed-off-by: Hannes Reinecke Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig --- 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(-) diff --git a/drivers/scsi/bfa/bfa_fc.h b/drivers/scsi/bfa/bfa_fc.h index b00fb2409c50..d536270bbe9f 100644 --- a/drivers/scsi/bfa/bfa_fc.h +++ b/drivers/scsi/bfa/bfa_fc.h @@ -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 */ /* diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c index 38d1c453074d..7ad22288071b 100644 --- a/drivers/scsi/bfa/bfa_fcpim.c +++ b/drivers/scsi/bfa/bfa_fcpim.c @@ -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, diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index 22f06be2606f..6b5841b1c06e 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c @@ -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) From patchwork Wed Dec 2 11:52:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336429 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BCD4C64E8A for ; Wed, 2 Dec 2020 11:54:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1786A20DD4 for ; Wed, 2 Dec 2020 11:54:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729679AbgLBLy2 (ORCPT ); Wed, 2 Dec 2020 06:54:28 -0500 Received: from mx2.suse.de ([195.135.220.15]:38738 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729317AbgLBLy1 (ORCPT ); Wed, 2 Dec 2020 06:54:27 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 239DEAD64; Wed, 2 Dec 2020 11:53:04 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 10/34] acornscsi: use standard defines Date: Wed, 2 Dec 2020 12:52:25 +0100 Message-Id: <20201202115249.37690-11-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use 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. Signed-off-by: Hannes Reinecke --- drivers/scsi/arm/acornscsi.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/arm/acornscsi.c b/drivers/scsi/arm/acornscsi.c index 9a912fd0f70b..248a5bfad153 100644 --- a/drivers/scsi/arm/acornscsi.c +++ b/drivers/scsi/arm/acornscsi.c @@ -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", From patchwork Wed Dec 2 11:52:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336426 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 084C5C83019 for ; Wed, 2 Dec 2020 11:54:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B3EC022206 for ; Wed, 2 Dec 2020 11:54:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388379AbgLBLyd (ORCPT ); Wed, 2 Dec 2020 06:54:33 -0500 Received: from mx2.suse.de ([195.135.220.15]:38790 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726442AbgLBLyb (ORCPT ); Wed, 2 Dec 2020 06:54:31 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 34FA5AD89; Wed, 2 Dec 2020 11:53:04 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke , Hannes Reinecke Subject: [PATCH 12/34] dc395: drop private SAM status code definitions Date: Wed, 2 Dec 2020 12:52:27 +0100 Message-Id: <20201202115249.37690-13-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Hannes Reinecke We don't need to duplicate definitions from the common include files. Signed-off-by: Hannes Reinecke --- drivers/scsi/dc395x.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/scsi/dc395x.h b/drivers/scsi/dc395x.h index 5379a936141a..a7786a6d462e 100644 --- a/drivers/scsi/dc395x.h +++ b/drivers/scsi/dc395x.h @@ -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 From patchwork Wed Dec 2 11:52:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336424 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEAE6C83013 for ; Wed, 2 Dec 2020 11:54:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 70CE92222A for ; Wed, 2 Dec 2020 11:54:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388485AbgLBLyo (ORCPT ); Wed, 2 Dec 2020 06:54:44 -0500 Received: from mx2.suse.de ([195.135.220.15]:38738 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388399AbgLBLyn (ORCPT ); Wed, 2 Dec 2020 06:54:43 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 66469AE2D; Wed, 2 Dec 2020 11:53:04 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 14/34] zfcp: do not set COMMAND_COMPLETE Date: Wed, 2 Dec 2020 12:52:29 +0100 Message-Id: <20201202115249.37690-15-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org COMMAND_COMPLETE is defined as '0', and it is a SCSI parallel message to boot. So drop the call to set_msg_byte(). Signed-off-by: Hannes Reinecke --- drivers/s390/scsi/zfcp_fc.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/s390/scsi/zfcp_fc.h b/drivers/s390/scsi/zfcp_fc.h index 6902ae1f8e4f..8aaf409ce9cb 100644 --- a/drivers/s390/scsi/zfcp_fc.h +++ b/drivers/s390/scsi/zfcp_fc.h @@ -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; From patchwork Wed Dec 2 11:52:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEB1BC64E90 for ; Wed, 2 Dec 2020 11:54:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 779F322206 for ; Wed, 2 Dec 2020 11:54:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388097AbgLBLy3 (ORCPT ); Wed, 2 Dec 2020 06:54:29 -0500 Received: from mx2.suse.de ([195.135.220.15]:38746 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729019AbgLBLy2 (ORCPT ); Wed, 2 Dec 2020 06:54:28 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2775CAD75; Wed, 2 Dec 2020 11:53:04 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 15/34] aacraid: avoid setting message byte on completion Date: Wed, 2 Dec 2020 12:52:30 +0100 Message-Id: <20201202115249.37690-16-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The 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. Signed-off-by: Hannes Reinecke --- drivers/scsi/aacraid/aachba.c | 173 ++++++++++++++++-------------------------- 1 file changed, 64 insertions(+), 109 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 31233f6a0274..4ca5e13a26a6 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -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; } From patchwork Wed Dec 2 11:52:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336418 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7E74C83013 for ; Wed, 2 Dec 2020 11:55:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 75E5F22206 for ; Wed, 2 Dec 2020 11:55:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729736AbgLBLzM (ORCPT ); Wed, 2 Dec 2020 06:55:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:41086 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729633AbgLBLzK (ORCPT ); Wed, 2 Dec 2020 06:55:10 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 93C30AE59; Wed, 2 Dec 2020 11:53:04 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 20/34] dc395x: drop internal SCSI message definitions Date: Wed, 2 Dec 2020 12:52:35 +0100 Message-Id: <20201202115249.37690-21-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Drop the internel SCSI message definitions and use the functions provided by the SPI transport class. Signed-off-by: Hannes Reinecke Reviewed-by: Christoph Hellwig --- drivers/scsi/dc395x.c | 25 ++++++++++--------------- drivers/scsi/dc395x.h | 22 ---------------------- 2 files changed, 10 insertions(+), 37 deletions(-) diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index 7b522ff345d5..b1125012bee0 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c @@ -64,6 +64,7 @@ #include #include #include +#include #include "dc395x.h" @@ -1281,11 +1282,7 @@ 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) */ + spi_populate_sync_msg(ptr, dcb->min_nego_period, dcb->sync_offset); srb->msg_count += 5; srb->state |= SRB_DO_SYNC_NEGO; } @@ -1305,10 +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; + spi_populate_width_msg(ptr, wide); srb->msg_count += 4; srb->state |= SRB_DO_WIDE_NEGO; } @@ -1476,7 +1470,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 +1726,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 +1736,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 +2533,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 +2775,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; diff --git a/drivers/scsi/dc395x.h b/drivers/scsi/dc395x.h index a7786a6d462e..24a36c046d07 100644 --- a/drivers/scsi/dc395x.h +++ b/drivers/scsi/dc395x.h @@ -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 From patchwork Wed Dec 2 11:52:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAC79C8301A for ; Wed, 2 Dec 2020 11:54:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 86A462222A for ; Wed, 2 Dec 2020 11:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388550AbgLBLyt (ORCPT ); Wed, 2 Dec 2020 06:54:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:38740 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388458AbgLBLys (ORCPT ); Wed, 2 Dec 2020 06:54:48 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9B2F4AE63; Wed, 2 Dec 2020 11:53:04 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 22/34] scsi_debug: do not set COMMAND_COMPLETE Date: Wed, 2 Dec 2020 12:52:37 +0100 Message-Id: <20201202115249.37690-23-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org COMMAND_COMPLETE is defined as '0', so setting it is quite pointless. Signed-off-by: Hannes Reinecke Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 24c0f7ec0351..93048f13a4e3 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -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; From patchwork Wed Dec 2 11:52:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336419 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 715E2C64E90 for ; Wed, 2 Dec 2020 11:55:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15F502222C for ; Wed, 2 Dec 2020 11:55:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729344AbgLBLzK (ORCPT ); Wed, 2 Dec 2020 06:55:10 -0500 Received: from mx2.suse.de ([195.135.220.15]:41078 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729324AbgLBLzK (ORCPT ); Wed, 2 Dec 2020 06:55:10 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6BA47AE3C; Wed, 2 Dec 2020 11:53:04 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 23/34] ufshcd: do not set COMMAND_COMPLETE Date: Wed, 2 Dec 2020 12:52:38 +0100 Message-Id: <20201202115249.37690-24-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org COMMAND_COMPLETE is defined as '0', so setting it is quite pointless. Signed-off-by: Hannes Reinecke --- drivers/scsi/ufs/ufshcd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 80cbce414678..f9b1d3b22ae9 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4789,9 +4789,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: From patchwork Wed Dec 2 11:52:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336416 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CAC7C83019 for ; Wed, 2 Dec 2020 11:55:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7B0B22206 for ; Wed, 2 Dec 2020 11:55:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388241AbgLBLzP (ORCPT ); Wed, 2 Dec 2020 06:55:15 -0500 Received: from mx2.suse.de ([195.135.220.15]:41218 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729196AbgLBLzO (ORCPT ); Wed, 2 Dec 2020 06:55:14 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CC3A4AE6D; Wed, 2 Dec 2020 11:53:04 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 24/34] atp870u: use standard definitions Date: Wed, 2 Dec 2020 12:52:39 +0100 Message-Id: <20201202115249.37690-25-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Use standard definitions for SCSI commands and return status instead of the hardcoded values. Signed-off-by: Hannes Reinecke Reviewed-by: Christoph Hellwig --- drivers/scsi/atp870u.c | 54 ++++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c index e559baeb0329..da6ca2b153d8 100644 --- a/drivers/scsi/atp870u.c +++ b/drivers/scsi/atp870u.c @@ -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 From patchwork Wed Dec 2 11:52:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336421 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31628C83014 for ; Wed, 2 Dec 2020 11:54:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DAD1520DD4 for ; Wed, 2 Dec 2020 11:54:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388491AbgLBLyq (ORCPT ); Wed, 2 Dec 2020 06:54:46 -0500 Received: from mx2.suse.de ([195.135.220.15]:38736 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387923AbgLBLyo (ORCPT ); Wed, 2 Dec 2020 06:54:44 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 6FBB5AE52; Wed, 2 Dec 2020 11:53:04 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 25/34] mac53c94: Do not set invalid command result Date: Wed, 2 Dec 2020 12:52:40 +0100 Message-Id: <20201202115249.37690-26-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org CMD_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. Signed-off-by: Hannes Reinecke --- drivers/scsi/mac53c94.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c index 43edf83fdb62..9e989776609b 100644 --- a/drivers/scsi/mac53c94.c +++ b/drivers/scsi/mac53c94.c @@ -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; From patchwork Wed Dec 2 11:52:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336417 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEAACC83017 for ; Wed, 2 Dec 2020 11:55:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6CA4D22206 for ; Wed, 2 Dec 2020 11:55:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729768AbgLBLzO (ORCPT ); Wed, 2 Dec 2020 06:55:14 -0500 Received: from mx2.suse.de ([195.135.220.15]:41220 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729757AbgLBLzO (ORCPT ); Wed, 2 Dec 2020 06:55:14 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D2F10AE6E; Wed, 2 Dec 2020 11:53:04 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 26/34] dpt_i2o: use DID_ERROR instead of INITIATOR_ERROR message Date: Wed, 2 Dec 2020 12:52:41 +0100 Message-Id: <20201202115249.37690-27-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Change 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. Signed-off-by: Hannes Reinecke Reviewed-by: Christoph Hellwig --- drivers/scsi/dpt_i2o.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 4251212acbbe..a18a4a08f049 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c @@ -2226,7 +2226,7 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d default: 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; } From patchwork Wed Dec 2 11:52:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336422 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FE18C8301D for ; Wed, 2 Dec 2020 11:54:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E56C722203 for ; Wed, 2 Dec 2020 11:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388595AbgLBLyu (ORCPT ); Wed, 2 Dec 2020 06:54:50 -0500 Received: from mx2.suse.de ([195.135.220.15]:38792 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388523AbgLBLyt (ORCPT ); Wed, 2 Dec 2020 06:54:49 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DEA53AE76; Wed, 2 Dec 2020 11:53:04 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 27/34] esp_scsi: use host byte as last argument to esp_cmd_is_done() Date: Wed, 2 Dec 2020 12:52:42 +0100 Message-Id: <20201202115249.37690-28-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Just pass in the host byte to esp_cmd_is_done(), and set the status or message bytes before calling this function. Signed-off-by: Hannes Reinecke --- drivers/scsi/esp_scsi.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c index 43a1fd11df5e..f6f663f554a7 100644 --- a/drivers/scsi/esp_scsi.c +++ b/drivers/scsi/esp_scsi.c @@ -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,7 @@ 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; + set_host_byte(cmd, host_byte); if (ent->eh_done) { complete(ent->eh_done); @@ -944,12 +944,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 +1238,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 +1283,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 +1868,9 @@ 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)); + cmd->result = ent->status; + set_msg_byte(cmd, ent->message); + esp_cmd_is_done(esp, ent, cmd, DID_OK); } } else if (ent->message == DISCONNECT) { esp_log_disconnect("Disconnecting tgt[%d] tag[%x:%x]\n", From patchwork Wed Dec 2 11:52:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336420 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA00FC64E90 for ; Wed, 2 Dec 2020 11:54:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F50420DD4 for ; Wed, 2 Dec 2020 11:54:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388538AbgLBLyt (ORCPT ); Wed, 2 Dec 2020 06:54:49 -0500 Received: from mx2.suse.de ([195.135.220.15]:38718 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388478AbgLBLyp (ORCPT ); Wed, 2 Dec 2020 06:54:45 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9C68BAE64; Wed, 2 Dec 2020 11:53:04 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 30/34] ips: use correct command completion on error Date: Wed, 2 Dec 2020 12:52:45 +0100 Message-Id: <20201202115249.37690-31-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org A 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. Signed-off-by: Hannes Reinecke Reviewed-by: Christoph Hellwig --- drivers/scsi/ips.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 2e6077c502fc..1a3c534826ba 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c @@ -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); } From patchwork Wed Dec 2 11:52:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 336415 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B675C64E90 for ; Wed, 2 Dec 2020 11:55:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E30022203 for ; Wed, 2 Dec 2020 11:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388120AbgLBLz0 (ORCPT ); Wed, 2 Dec 2020 06:55:26 -0500 Received: from mx2.suse.de ([195.135.220.15]:41358 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726851AbgLBLz0 (ORCPT ); Wed, 2 Dec 2020 06:55:26 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 42491AE89; Wed, 2 Dec 2020 11:53:05 +0000 (UTC) From: Hannes Reinecke To: "Martin K. Petersen" Cc: James Bottomley , Christoph Hellwig , linux-scsi@vger.kernel.org, Hannes Reinecke Subject: [PATCH 33/34] advansys: kill driver_defined status byte accessors Date: Wed, 2 Dec 2020 12:52:48 +0100 Message-Id: <20201202115249.37690-34-hare@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20201202115249.37690-1-hare@suse.de> References: <20201202115249.37690-1-hare@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Replace the driver-defined status byte accessors by the mid-layer defined ones. Signed-off-by: Hannes Reinecke --- drivers/scsi/advansys.c | 80 ++++++++++++++----------------------------------- 1 file changed, 22 insertions(+), 58 deletions(-) diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c index 79830e77afa9..ee33f2aa147d 100644 --- a/drivers/scsi/advansys.c +++ b/drivers/scsi/advansys.c @@ -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) @@ -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: + scp->result = 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); + scp->result = 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); + scp->result = scsiqp->scsi_status; + set_host_byte(scp, DID_ERROR); break; } @@ -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: + scp->result = 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); + scp->result = 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); + scp->result = 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; }