aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/3w-9xxx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/3w-9xxx.c')
-rw-r--r--drivers/scsi/3w-9xxx.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
index 7045511f9ad2..b92c19bb6876 100644
--- a/drivers/scsi/3w-9xxx.c
+++ b/drivers/scsi/3w-9xxx.c
@@ -4,7 +4,7 @@
4 Written By: Adam Radford <linuxraid@amcc.com> 4 Written By: Adam Radford <linuxraid@amcc.com>
5 Modifications By: Tom Couch <linuxraid@amcc.com> 5 Modifications By: Tom Couch <linuxraid@amcc.com>
6 6
7 Copyright (C) 2004-2007 Applied Micro Circuits Corporation. 7 Copyright (C) 2004-2008 Applied Micro Circuits Corporation.
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by 10 it under the terms of the GNU General Public License as published by
@@ -71,6 +71,10 @@
71 Add support for 9650SE controllers. 71 Add support for 9650SE controllers.
72 2.26.02.009 - Fix dma mask setting to fallback to 32-bit if 64-bit fails. 72 2.26.02.009 - Fix dma mask setting to fallback to 32-bit if 64-bit fails.
73 2.26.02.010 - Add support for 9690SA controllers. 73 2.26.02.010 - Add support for 9690SA controllers.
74 2.26.02.011 - Increase max AENs drained to 256.
75 Add MSI support and "use_msi" module parameter.
76 Fix bug in twa_get_param() on 4GB+.
77 Use pci_resource_len() for ioremap().
74*/ 78*/
75 79
76#include <linux/module.h> 80#include <linux/module.h>
@@ -95,7 +99,7 @@
95#include "3w-9xxx.h" 99#include "3w-9xxx.h"
96 100
97/* Globals */ 101/* Globals */
98#define TW_DRIVER_VERSION "2.26.02.010" 102#define TW_DRIVER_VERSION "2.26.02.011"
99static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT]; 103static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT];
100static unsigned int twa_device_extension_count; 104static unsigned int twa_device_extension_count;
101static int twa_major = -1; 105static int twa_major = -1;
@@ -107,6 +111,10 @@ MODULE_DESCRIPTION ("3ware 9000 Storage Controller Linux Driver");
107MODULE_LICENSE("GPL"); 111MODULE_LICENSE("GPL");
108MODULE_VERSION(TW_DRIVER_VERSION); 112MODULE_VERSION(TW_DRIVER_VERSION);
109 113
114static int use_msi = 0;
115module_param(use_msi, int, S_IRUGO);
116MODULE_PARM_DESC(use_msi, "Use Message Signaled Interrupts. Default: 0");
117
110/* Function prototypes */ 118/* Function prototypes */
111static void twa_aen_queue_event(TW_Device_Extension *tw_dev, TW_Command_Apache_Header *header); 119static void twa_aen_queue_event(TW_Device_Extension *tw_dev, TW_Command_Apache_Header *header);
112static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id); 120static int twa_aen_read_queue(TW_Device_Extension *tw_dev, int request_id);
@@ -1038,7 +1046,6 @@ static void *twa_get_param(TW_Device_Extension *tw_dev, int request_id, int tabl
1038 TW_Command_Full *full_command_packet; 1046 TW_Command_Full *full_command_packet;
1039 TW_Command *command_packet; 1047 TW_Command *command_packet;
1040 TW_Param_Apache *param; 1048 TW_Param_Apache *param;
1041 unsigned long param_value;
1042 void *retval = NULL; 1049 void *retval = NULL;
1043 1050
1044 /* Setup the command packet */ 1051 /* Setup the command packet */
@@ -1057,9 +1064,8 @@ static void *twa_get_param(TW_Device_Extension *tw_dev, int request_id, int tabl
1057 param->table_id = cpu_to_le16(table_id | 0x8000); 1064 param->table_id = cpu_to_le16(table_id | 0x8000);
1058 param->parameter_id = cpu_to_le16(parameter_id); 1065 param->parameter_id = cpu_to_le16(parameter_id);
1059 param->parameter_size_bytes = cpu_to_le16(parameter_size_bytes); 1066 param->parameter_size_bytes = cpu_to_le16(parameter_size_bytes);
1060 param_value = tw_dev->generic_buffer_phys[request_id];
1061 1067
1062 command_packet->byte8_offset.param.sgl[0].address = TW_CPU_TO_SGL(param_value); 1068 command_packet->byte8_offset.param.sgl[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]);
1063 command_packet->byte8_offset.param.sgl[0].length = cpu_to_le32(TW_SECTOR_SIZE); 1069 command_packet->byte8_offset.param.sgl[0].length = cpu_to_le32(TW_SECTOR_SIZE);
1064 1070
1065 /* Post the command packet to the board */ 1071 /* Post the command packet to the board */
@@ -2000,7 +2006,7 @@ static int __devinit twa_probe(struct pci_dev *pdev, const struct pci_device_id
2000{ 2006{
2001 struct Scsi_Host *host = NULL; 2007 struct Scsi_Host *host = NULL;
2002 TW_Device_Extension *tw_dev; 2008 TW_Device_Extension *tw_dev;
2003 u32 mem_addr; 2009 unsigned long mem_addr, mem_len;
2004 int retval = -ENODEV; 2010 int retval = -ENODEV;
2005 2011
2006 retval = pci_enable_device(pdev); 2012 retval = pci_enable_device(pdev);
@@ -2045,13 +2051,16 @@ static int __devinit twa_probe(struct pci_dev *pdev, const struct pci_device_id
2045 goto out_free_device_extension; 2051 goto out_free_device_extension;
2046 } 2052 }
2047 2053
2048 if (pdev->device == PCI_DEVICE_ID_3WARE_9000) 2054 if (pdev->device == PCI_DEVICE_ID_3WARE_9000) {
2049 mem_addr = pci_resource_start(pdev, 1); 2055 mem_addr = pci_resource_start(pdev, 1);
2050 else 2056 mem_len = pci_resource_len(pdev, 1);
2057 } else {
2051 mem_addr = pci_resource_start(pdev, 2); 2058 mem_addr = pci_resource_start(pdev, 2);
2059 mem_len = pci_resource_len(pdev, 2);
2060 }
2052 2061
2053 /* Save base address */ 2062 /* Save base address */
2054 tw_dev->base_addr = ioremap(mem_addr, PAGE_SIZE); 2063 tw_dev->base_addr = ioremap(mem_addr, mem_len);
2055 if (!tw_dev->base_addr) { 2064 if (!tw_dev->base_addr) {
2056 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x35, "Failed to ioremap"); 2065 TW_PRINTK(tw_dev->host, TW_DRIVER, 0x35, "Failed to ioremap");
2057 goto out_release_mem_region; 2066 goto out_release_mem_region;
@@ -2086,7 +2095,7 @@ static int __devinit twa_probe(struct pci_dev *pdev, const struct pci_device_id
2086 2095
2087 pci_set_drvdata(pdev, host); 2096 pci_set_drvdata(pdev, host);
2088 2097
2089 printk(KERN_WARNING "3w-9xxx: scsi%d: Found a 3ware 9000 Storage Controller at 0x%x, IRQ: %d.\n", 2098 printk(KERN_WARNING "3w-9xxx: scsi%d: Found a 3ware 9000 Storage Controller at 0x%lx, IRQ: %d.\n",
2090 host->host_no, mem_addr, pdev->irq); 2099 host->host_no, mem_addr, pdev->irq);
2091 printk(KERN_WARNING "3w-9xxx: scsi%d: Firmware %s, BIOS %s, Ports: %d.\n", 2100 printk(KERN_WARNING "3w-9xxx: scsi%d: Firmware %s, BIOS %s, Ports: %d.\n",
2092 host->host_no, 2101 host->host_no,
@@ -2097,6 +2106,11 @@ static int __devinit twa_probe(struct pci_dev *pdev, const struct pci_device_id
2097 le32_to_cpu(*(int *)twa_get_param(tw_dev, 2, TW_INFORMATION_TABLE, 2106 le32_to_cpu(*(int *)twa_get_param(tw_dev, 2, TW_INFORMATION_TABLE,
2098 TW_PARAM_PORTCOUNT, TW_PARAM_PORTCOUNT_LENGTH))); 2107 TW_PARAM_PORTCOUNT, TW_PARAM_PORTCOUNT_LENGTH)));
2099 2108
2109 /* Try to enable MSI */
2110 if (use_msi && (pdev->device != PCI_DEVICE_ID_3WARE_9000) &&
2111 !pci_enable_msi(pdev))
2112 set_bit(TW_USING_MSI, &tw_dev->flags);
2113
2100 /* Now setup the interrupt handler */ 2114 /* Now setup the interrupt handler */
2101 retval = request_irq(pdev->irq, twa_interrupt, IRQF_SHARED, "3w-9xxx", tw_dev); 2115 retval = request_irq(pdev->irq, twa_interrupt, IRQF_SHARED, "3w-9xxx", tw_dev);
2102 if (retval) { 2116 if (retval) {
@@ -2120,6 +2134,8 @@ static int __devinit twa_probe(struct pci_dev *pdev, const struct pci_device_id
2120 return 0; 2134 return 0;
2121 2135
2122out_remove_host: 2136out_remove_host:
2137 if (test_bit(TW_USING_MSI, &tw_dev->flags))
2138 pci_disable_msi(pdev);
2123 scsi_remove_host(host); 2139 scsi_remove_host(host);
2124out_iounmap: 2140out_iounmap:
2125 iounmap(tw_dev->base_addr); 2141 iounmap(tw_dev->base_addr);
@@ -2151,6 +2167,10 @@ static void twa_remove(struct pci_dev *pdev)
2151 /* Shutdown the card */ 2167 /* Shutdown the card */
2152 __twa_shutdown(tw_dev); 2168 __twa_shutdown(tw_dev);
2153 2169
2170 /* Disable MSI if enabled */
2171 if (test_bit(TW_USING_MSI, &tw_dev->flags))
2172 pci_disable_msi(pdev);
2173
2154 /* Free IO remapping */ 2174 /* Free IO remapping */
2155 iounmap(tw_dev->base_addr); 2175 iounmap(tw_dev->base_addr);
2156 2176