diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/Kconfig | 1 | ||||
-rw-r--r-- | drivers/scsi/Makefile | 1 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/Kconfig | 61 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/Makefile | 15 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_module.c | 281 | ||||
-rw-r--r-- | drivers/scsi/mpt3sas/Kconfig | 16 | ||||
-rw-r--r-- | drivers/scsi/mpt3sas/Makefile | 2 | ||||
-rw-r--r-- | drivers/scsi/mpt3sas/mpt3sas_base.c | 11 | ||||
-rw-r--r-- | drivers/scsi/mpt3sas/mpt3sas_base.h | 61 | ||||
-rw-r--r-- | drivers/scsi/mpt3sas/mpt3sas_config.c | 2 | ||||
-rw-r--r-- | drivers/scsi/mpt3sas/mpt3sas_ctl.c | 151 | ||||
-rw-r--r-- | drivers/scsi/mpt3sas/mpt3sas_module.c | 253 | ||||
-rw-r--r-- | drivers/scsi/mpt3sas/mpt3sas_scsih.c | 481 | ||||
-rw-r--r-- | drivers/scsi/mpt3sas/mpt3sas_warpdrive.c (renamed from drivers/scsi/mpt2sas/mpt2sas_warpdrive.c) | 56 |
14 files changed, 566 insertions, 826 deletions
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 95f7a76cfafc..8aed855dd391 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -541,7 +541,6 @@ config SCSI_ARCMSR | |||
541 | 541 | ||
542 | source "drivers/scsi/esas2r/Kconfig" | 542 | source "drivers/scsi/esas2r/Kconfig" |
543 | source "drivers/scsi/megaraid/Kconfig.megaraid" | 543 | source "drivers/scsi/megaraid/Kconfig.megaraid" |
544 | source "drivers/scsi/mpt2sas/Kconfig" | ||
545 | source "drivers/scsi/mpt3sas/Kconfig" | 544 | source "drivers/scsi/mpt3sas/Kconfig" |
546 | source "drivers/scsi/ufs/Kconfig" | 545 | source "drivers/scsi/ufs/Kconfig" |
547 | 546 | ||
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 1a8c9b53fafa..c14bca4a9675 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile | |||
@@ -106,7 +106,6 @@ obj-$(CONFIG_CXLFLASH) += cxlflash/ | |||
106 | obj-$(CONFIG_MEGARAID_LEGACY) += megaraid.o | 106 | obj-$(CONFIG_MEGARAID_LEGACY) += megaraid.o |
107 | obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/ | 107 | obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/ |
108 | obj-$(CONFIG_MEGARAID_SAS) += megaraid/ | 108 | obj-$(CONFIG_MEGARAID_SAS) += megaraid/ |
109 | obj-$(CONFIG_SCSI_MPT2SAS) += mpt2sas/ | ||
110 | obj-$(CONFIG_SCSI_MPT3SAS) += mpt3sas/ | 109 | obj-$(CONFIG_SCSI_MPT3SAS) += mpt3sas/ |
111 | obj-$(CONFIG_SCSI_UFSHCD) += ufs/ | 110 | obj-$(CONFIG_SCSI_UFSHCD) += ufs/ |
112 | obj-$(CONFIG_SCSI_ACARD) += atp870u.o | 111 | obj-$(CONFIG_SCSI_ACARD) += atp870u.o |
diff --git a/drivers/scsi/mpt2sas/Kconfig b/drivers/scsi/mpt2sas/Kconfig deleted file mode 100644 index 1356a0aa5d14..000000000000 --- a/drivers/scsi/mpt2sas/Kconfig +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | # | ||
2 | # Kernel configuration file for the MPT2SAS | ||
3 | # | ||
4 | # This code is based on drivers/scsi/mpt2sas/Kconfig | ||
5 | # Copyright (C) 2007-2014 LSI Corporation | ||
6 | # (mailto:DL-MPTFusionLinux@lsi.com) | ||
7 | |||
8 | # This program is free software; you can redistribute it and/or | ||
9 | # modify it under the terms of the GNU General Public License | ||
10 | # as published by the Free Software Foundation; either version 2 | ||
11 | # of the License, or (at your option) any later version. | ||
12 | |||
13 | # This program is distributed in the hope that it will be useful, | ||
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | # GNU General Public License for more details. | ||
17 | |||
18 | # NO WARRANTY | ||
19 | # THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
20 | # CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT | ||
21 | # LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, | ||
22 | # MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is | ||
23 | # solely responsible for determining the appropriateness of using and | ||
24 | # distributing the Program and assumes all risks associated with its | ||
25 | # exercise of rights under this Agreement, including but not limited to | ||
26 | # the risks and costs of program errors, damage to or loss of data, | ||
27 | # programs or equipment, and unavailability or interruption of operations. | ||
28 | |||
29 | # DISCLAIMER OF LIABILITY | ||
30 | # NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY | ||
31 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
32 | # DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND | ||
33 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
34 | # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
35 | # USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED | ||
36 | # HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES | ||
37 | |||
38 | # You should have received a copy of the GNU General Public License | ||
39 | # along with this program; if not, write to the Free Software | ||
40 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
41 | # USA. | ||
42 | |||
43 | config SCSI_MPT2SAS | ||
44 | tristate "LSI MPT Fusion SAS 2.0 Device Driver" | ||
45 | depends on PCI && SCSI | ||
46 | select SCSI_SAS_ATTRS | ||
47 | select RAID_ATTRS | ||
48 | ---help--- | ||
49 | This driver supports PCI-Express SAS 6Gb/s Host Adapters. | ||
50 | |||
51 | config SCSI_MPT2SAS_MAX_SGE | ||
52 | int "LSI MPT Fusion Max number of SG Entries (16 - 128)" | ||
53 | depends on PCI && SCSI && SCSI_MPT2SAS | ||
54 | default "128" | ||
55 | range 16 128 | ||
56 | ---help--- | ||
57 | This option allows you to specify the maximum number of scatter- | ||
58 | gather entries per I/O. The driver default is 128, which matches | ||
59 | SAFE_PHYS_SEGMENTS. However, it may decreased down to 16. | ||
60 | Decreasing this parameter will reduce memory requirements | ||
61 | on a per controller instance. | ||
diff --git a/drivers/scsi/mpt2sas/Makefile b/drivers/scsi/mpt2sas/Makefile deleted file mode 100644 index 37716169b91a..000000000000 --- a/drivers/scsi/mpt2sas/Makefile +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | # mpt2sas makefile | ||
2 | |||
3 | # share the official mpi headers from the mpt3sas driver | ||
4 | ccflags-y += -I$(src)/../mpt3sas | ||
5 | ccflags-y += -DSCSI_MPT2SAS | ||
6 | |||
7 | # use the common object files from mpt3sas driver | ||
8 | obj-$(CONFIG_SCSI_MPT2SAS) += mpt2sas.o | ||
9 | mpt2sas-y += ../mpt3sas/mpt3sas_base.o \ | ||
10 | ../mpt3sas/mpt3sas_config.o \ | ||
11 | ../mpt3sas/mpt3sas_scsih.o \ | ||
12 | ../mpt3sas/mpt3sas_transport.o \ | ||
13 | ../mpt3sas/mpt3sas_ctl.o \ | ||
14 | ../mpt3sas/mpt3sas_trigger_diag.o \ | ||
15 | mpt2sas_module.o | ||
diff --git a/drivers/scsi/mpt2sas/mpt2sas_module.c b/drivers/scsi/mpt2sas/mpt2sas_module.c deleted file mode 100644 index d407ed04315d..000000000000 --- a/drivers/scsi/mpt2sas/mpt2sas_module.c +++ /dev/null | |||
@@ -1,281 +0,0 @@ | |||
1 | /* | ||
2 | * Scsi Host Layer for MPT (Message Passing Technology) based controllers | ||
3 | * | ||
4 | * Copyright (C) 2012-2014 LSI Corporation | ||
5 | * Copyright (C) 2013-2015 Avago Technologies | ||
6 | * (mailto: MPT-FusionLinux.pdl@avagotech.com) | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version 2 | ||
11 | * of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * NO WARRANTY | ||
19 | * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
20 | * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT | ||
21 | * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, | ||
22 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is | ||
23 | * solely responsible for determining the appropriateness of using and | ||
24 | * distributing the Program and assumes all risks associated with its | ||
25 | * exercise of rights under this Agreement, including but not limited to | ||
26 | * the risks and costs of program errors, damage to or loss of data, | ||
27 | * programs or equipment, and unavailability or interruption of operations. | ||
28 | |||
29 | * DISCLAIMER OF LIABILITY | ||
30 | * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY | ||
31 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
32 | * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND | ||
33 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
34 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
35 | * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED | ||
36 | * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES | ||
37 | |||
38 | * You should have received a copy of the GNU General Public License | ||
39 | * along with this program. | ||
40 | */ | ||
41 | |||
42 | #include <linux/module.h> | ||
43 | #include <linux/pci.h> | ||
44 | #include <linux/raid_class.h> | ||
45 | |||
46 | #include "mpt3sas_base.h" | ||
47 | #include "mpt3sas_ctl.h" | ||
48 | |||
49 | MODULE_AUTHOR(MPT3SAS_AUTHOR); | ||
50 | MODULE_DESCRIPTION(MPT2SAS_DESCRIPTION); | ||
51 | MODULE_LICENSE("GPL"); | ||
52 | MODULE_VERSION(MPT2SAS_DRIVER_VERSION); | ||
53 | |||
54 | /* shost template */ | ||
55 | static struct scsi_host_template mpt2sas_driver_template = { | ||
56 | .module = THIS_MODULE, | ||
57 | .name = "Fusion MPT SAS Host", | ||
58 | .proc_name = MPT2SAS_DRIVER_NAME, | ||
59 | .queuecommand = scsih_qcmd, | ||
60 | .target_alloc = scsih_target_alloc, | ||
61 | .slave_alloc = scsih_slave_alloc, | ||
62 | .slave_configure = scsih_slave_configure, | ||
63 | .target_destroy = scsih_target_destroy, | ||
64 | .slave_destroy = scsih_slave_destroy, | ||
65 | .scan_finished = scsih_scan_finished, | ||
66 | .scan_start = scsih_scan_start, | ||
67 | .change_queue_depth = scsih_change_queue_depth, | ||
68 | .eh_abort_handler = scsih_abort, | ||
69 | .eh_device_reset_handler = scsih_dev_reset, | ||
70 | .eh_target_reset_handler = scsih_target_reset, | ||
71 | .eh_host_reset_handler = scsih_host_reset, | ||
72 | .bios_param = scsih_bios_param, | ||
73 | .can_queue = 1, | ||
74 | .this_id = -1, | ||
75 | .sg_tablesize = MPT2SAS_SG_DEPTH, | ||
76 | .max_sectors = 32767, | ||
77 | .cmd_per_lun = 7, | ||
78 | .use_clustering = ENABLE_CLUSTERING, | ||
79 | .shost_attrs = mpt3sas_host_attrs, | ||
80 | .sdev_attrs = mpt3sas_dev_attrs, | ||
81 | .track_queue_depth = 1, | ||
82 | }; | ||
83 | |||
84 | /* raid transport support */ | ||
85 | static struct raid_function_template mpt2sas_raid_functions = { | ||
86 | .cookie = &mpt2sas_driver_template, | ||
87 | .is_raid = scsih_is_raid, | ||
88 | .get_resync = scsih_get_resync, | ||
89 | .get_state = scsih_get_state, | ||
90 | }; | ||
91 | |||
92 | /* | ||
93 | * The pci device ids are defined in mpi/mpi2_cnfg.h. | ||
94 | */ | ||
95 | static const struct pci_device_id mpt2sas_pci_table[] = { | ||
96 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2004, | ||
97 | PCI_ANY_ID, PCI_ANY_ID }, | ||
98 | /* Falcon ~ 2008*/ | ||
99 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2008, | ||
100 | PCI_ANY_ID, PCI_ANY_ID }, | ||
101 | /* Liberator ~ 2108 */ | ||
102 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2108_1, | ||
103 | PCI_ANY_ID, PCI_ANY_ID }, | ||
104 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2108_2, | ||
105 | PCI_ANY_ID, PCI_ANY_ID }, | ||
106 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2108_3, | ||
107 | PCI_ANY_ID, PCI_ANY_ID }, | ||
108 | /* Meteor ~ 2116 */ | ||
109 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2116_1, | ||
110 | PCI_ANY_ID, PCI_ANY_ID }, | ||
111 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2116_2, | ||
112 | PCI_ANY_ID, PCI_ANY_ID }, | ||
113 | /* Thunderbolt ~ 2208 */ | ||
114 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_1, | ||
115 | PCI_ANY_ID, PCI_ANY_ID }, | ||
116 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_2, | ||
117 | PCI_ANY_ID, PCI_ANY_ID }, | ||
118 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_3, | ||
119 | PCI_ANY_ID, PCI_ANY_ID }, | ||
120 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_4, | ||
121 | PCI_ANY_ID, PCI_ANY_ID }, | ||
122 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_5, | ||
123 | PCI_ANY_ID, PCI_ANY_ID }, | ||
124 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_6, | ||
125 | PCI_ANY_ID, PCI_ANY_ID }, | ||
126 | /* Mustang ~ 2308 */ | ||
127 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_1, | ||
128 | PCI_ANY_ID, PCI_ANY_ID }, | ||
129 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_2, | ||
130 | PCI_ANY_ID, PCI_ANY_ID }, | ||
131 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_3, | ||
132 | PCI_ANY_ID, PCI_ANY_ID }, | ||
133 | /* SSS6200 */ | ||
134 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SSS6200, | ||
135 | PCI_ANY_ID, PCI_ANY_ID }, | ||
136 | {0} /* Terminating entry */ | ||
137 | }; | ||
138 | MODULE_DEVICE_TABLE(pci, mpt2sas_pci_table); | ||
139 | |||
140 | static const struct file_operations mpt2sas_ctl_fops = { | ||
141 | .owner = THIS_MODULE, | ||
142 | .unlocked_ioctl = ctl_ioctl, | ||
143 | .poll = ctl_poll, | ||
144 | .fasync = ctl_fasync, | ||
145 | #ifdef CONFIG_COMPAT | ||
146 | .compat_ioctl = ctl_ioctl_compat, | ||
147 | #endif | ||
148 | .llseek = noop_llseek, | ||
149 | }; | ||
150 | |||
151 | static struct miscdevice mpt2sas_ctl_dev = { | ||
152 | .minor = MPT2SAS_MINOR, | ||
153 | .name = MPT2SAS_DEV_NAME, | ||
154 | .fops = &mpt2sas_ctl_fops, | ||
155 | }; | ||
156 | |||
157 | /** | ||
158 | * mpt2sas_ctl_init - main entry point for ctl. | ||
159 | * | ||
160 | */ | ||
161 | void | ||
162 | mpt2sas_ctl_init(void) | ||
163 | { | ||
164 | ctl_init(); | ||
165 | if (misc_register(&mpt2sas_ctl_dev) < 0) | ||
166 | pr_err("%s can't register misc device [minor=%d]\n", | ||
167 | MPT2SAS_DRIVER_NAME, MPT2SAS_MINOR); | ||
168 | } | ||
169 | |||
170 | /** | ||
171 | * mpt2sas_ctl_exit - exit point for ctl | ||
172 | * | ||
173 | */ | ||
174 | void | ||
175 | mpt2sas_ctl_exit(void) | ||
176 | { | ||
177 | ctl_exit(); | ||
178 | misc_deregister(&mpt2sas_ctl_dev); | ||
179 | } | ||
180 | |||
181 | /** | ||
182 | * _mpt2sas_probe - attach and add scsi host | ||
183 | * @pdev: PCI device struct | ||
184 | * @id: pci device id | ||
185 | * | ||
186 | * Returns 0 success, anything else error. | ||
187 | */ | ||
188 | static int | ||
189 | _mpt2sas_probe(struct pci_dev *pdev, const struct pci_device_id *id) | ||
190 | { | ||
191 | struct Scsi_Host *shost; | ||
192 | int rv; | ||
193 | |||
194 | shost = scsi_host_alloc(&mpt2sas_driver_template, | ||
195 | sizeof(struct MPT3SAS_ADAPTER)); | ||
196 | if (!shost) | ||
197 | return -ENODEV; | ||
198 | |||
199 | sprintf(driver_name, "%s", MPT2SAS_DRIVER_NAME); | ||
200 | rv = scsih_probe(pdev, shost); | ||
201 | return rv; | ||
202 | } | ||
203 | |||
204 | static struct pci_error_handlers _mpt2sas_err_handler = { | ||
205 | .error_detected = scsih_pci_error_detected, | ||
206 | .mmio_enabled = scsih_pci_mmio_enabled, | ||
207 | .slot_reset = scsih_pci_slot_reset, | ||
208 | .resume = scsih_pci_resume, | ||
209 | }; | ||
210 | |||
211 | static struct pci_driver mpt2sas_driver = { | ||
212 | .name = MPT2SAS_DRIVER_NAME, | ||
213 | .id_table = mpt2sas_pci_table, | ||
214 | .probe = _mpt2sas_probe, | ||
215 | .remove = scsih_remove, | ||
216 | .shutdown = scsih_shutdown, | ||
217 | .err_handler = &_mpt2sas_err_handler, | ||
218 | #ifdef CONFIG_PM | ||
219 | .suspend = scsih_suspend, | ||
220 | .resume = scsih_resume, | ||
221 | #endif | ||
222 | }; | ||
223 | |||
224 | /** | ||
225 | * _mpt2sas_init - main entry point for this driver. | ||
226 | * | ||
227 | * Returns 0 success, anything else error. | ||
228 | */ | ||
229 | static int __init | ||
230 | _mpt2sas_init(void) | ||
231 | { | ||
232 | int error; | ||
233 | |||
234 | pr_info("%s version %s loaded\n", MPT2SAS_DRIVER_NAME, | ||
235 | MPT2SAS_DRIVER_VERSION); | ||
236 | |||
237 | mpt3sas_transport_template = | ||
238 | sas_attach_transport(&mpt3sas_transport_functions); | ||
239 | if (!mpt3sas_transport_template) | ||
240 | return -ENODEV; | ||
241 | |||
242 | mpt3sas_raid_template = raid_class_attach(&mpt2sas_raid_functions); | ||
243 | if (!mpt3sas_raid_template) { | ||
244 | sas_release_transport(mpt3sas_transport_template); | ||
245 | return -ENODEV; | ||
246 | } | ||
247 | |||
248 | error = scsih_init(); | ||
249 | if (error) { | ||
250 | scsih_exit(); | ||
251 | return error; | ||
252 | } | ||
253 | |||
254 | mpt2sas_ctl_init(); | ||
255 | |||
256 | error = pci_register_driver(&mpt2sas_driver); | ||
257 | if (error) | ||
258 | scsih_exit(); | ||
259 | |||
260 | return error; | ||
261 | } | ||
262 | |||
263 | /** | ||
264 | * _mpt2sas_exit - exit point for this driver (when it is a module). | ||
265 | * | ||
266 | */ | ||
267 | static void __exit | ||
268 | _mpt2sas_exit(void) | ||
269 | { | ||
270 | pr_info("mpt2sas version %s unloading\n", | ||
271 | MPT2SAS_DRIVER_VERSION); | ||
272 | |||
273 | pci_unregister_driver(&mpt2sas_driver); | ||
274 | |||
275 | mpt2sas_ctl_exit(); | ||
276 | |||
277 | scsih_exit(); | ||
278 | } | ||
279 | |||
280 | module_init(_mpt2sas_init); | ||
281 | module_exit(_mpt2sas_exit); | ||
diff --git a/drivers/scsi/mpt3sas/Kconfig b/drivers/scsi/mpt3sas/Kconfig index 18b64bce10cb..29061467cc17 100644 --- a/drivers/scsi/mpt3sas/Kconfig +++ b/drivers/scsi/mpt3sas/Kconfig | |||
@@ -41,15 +41,27 @@ | |||
41 | # USA. | 41 | # USA. |
42 | 42 | ||
43 | config SCSI_MPT3SAS | 43 | config SCSI_MPT3SAS |
44 | tristate "LSI MPT Fusion SAS 3.0 Device Driver" | 44 | tristate "LSI MPT Fusion SAS 3.0 & SAS 2.0 Device Driver" |
45 | depends on PCI && SCSI | 45 | depends on PCI && SCSI |
46 | select SCSI_SAS_ATTRS | 46 | select SCSI_SAS_ATTRS |
47 | select RAID_ATTRS | 47 | select RAID_ATTRS |
48 | ---help--- | 48 | ---help--- |
49 | This driver supports PCI-Express SAS 12Gb/s Host Adapters. | 49 | This driver supports PCI-Express SAS 12Gb/s Host Adapters. |
50 | 50 | ||
51 | config SCSI_MPT2SAS_MAX_SGE | ||
52 | int "LSI MPT Fusion SAS 2.0 Max number of SG Entries (16 - 256)" | ||
53 | depends on PCI && SCSI && SCSI_MPT3SAS | ||
54 | default "128" | ||
55 | range 16 256 | ||
56 | ---help--- | ||
57 | This option allows you to specify the maximum number of scatter- | ||
58 | gather entries per I/O. The driver default is 128, which matches | ||
59 | MAX_PHYS_SEGMENTS in most kernels. However in SuSE kernels this | ||
60 | can be 256. However, it may decreased down to 16. Decreasing this | ||
61 | parameter will reduce memory requirements on a per controller instance. | ||
62 | |||
51 | config SCSI_MPT3SAS_MAX_SGE | 63 | config SCSI_MPT3SAS_MAX_SGE |
52 | int "LSI MPT Fusion Max number of SG Entries (16 - 256)" | 64 | int "LSI MPT Fusion SAS 3.0 Max number of SG Entries (16 - 256)" |
53 | depends on PCI && SCSI && SCSI_MPT3SAS | 65 | depends on PCI && SCSI && SCSI_MPT3SAS |
54 | default "128" | 66 | default "128" |
55 | range 16 256 | 67 | range 16 256 |
diff --git a/drivers/scsi/mpt3sas/Makefile b/drivers/scsi/mpt3sas/Makefile index 188057f69a92..b7643f596c1e 100644 --- a/drivers/scsi/mpt3sas/Makefile +++ b/drivers/scsi/mpt3sas/Makefile | |||
@@ -6,4 +6,4 @@ mpt3sas-y += mpt3sas_base.o \ | |||
6 | mpt3sas_transport.o \ | 6 | mpt3sas_transport.o \ |
7 | mpt3sas_ctl.o \ | 7 | mpt3sas_ctl.o \ |
8 | mpt3sas_trigger_diag.o \ | 8 | mpt3sas_trigger_diag.o \ |
9 | mpt3sas_module.o | 9 | mpt3sas_warpdrive.o |
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c index f5d589e839b3..11393ebf1a68 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c | |||
@@ -198,7 +198,7 @@ _base_fault_reset_work(struct work_struct *work) | |||
198 | ioc->remove_host = 1; | 198 | ioc->remove_host = 1; |
199 | /*Remove the Dead Host */ | 199 | /*Remove the Dead Host */ |
200 | p = kthread_run(mpt3sas_remove_dead_ioc_func, ioc, | 200 | p = kthread_run(mpt3sas_remove_dead_ioc_func, ioc, |
201 | "mpt3sas_dead_ioc_%d", ioc->id); | 201 | "%s_dead_ioc_%d", ioc->driver_name, ioc->id); |
202 | if (IS_ERR(p)) | 202 | if (IS_ERR(p)) |
203 | pr_err(MPT3SAS_FMT | 203 | pr_err(MPT3SAS_FMT |
204 | "%s: Running mpt3sas_dead_ioc thread failed !!!!\n", | 204 | "%s: Running mpt3sas_dead_ioc thread failed !!!!\n", |
@@ -254,7 +254,8 @@ mpt3sas_base_start_watchdog(struct MPT3SAS_ADAPTER *ioc) | |||
254 | 254 | ||
255 | INIT_DELAYED_WORK(&ioc->fault_reset_work, _base_fault_reset_work); | 255 | INIT_DELAYED_WORK(&ioc->fault_reset_work, _base_fault_reset_work); |
256 | snprintf(ioc->fault_reset_work_q_name, | 256 | snprintf(ioc->fault_reset_work_q_name, |
257 | sizeof(ioc->fault_reset_work_q_name), "poll_%d_status", ioc->id); | 257 | sizeof(ioc->fault_reset_work_q_name), "poll_%s%d_status", |
258 | ioc->driver_name, ioc->id); | ||
258 | ioc->fault_reset_work_q = | 259 | ioc->fault_reset_work_q = |
259 | create_singlethread_workqueue(ioc->fault_reset_work_q_name); | 260 | create_singlethread_workqueue(ioc->fault_reset_work_q_name); |
260 | if (!ioc->fault_reset_work_q) { | 261 | if (!ioc->fault_reset_work_q) { |
@@ -1835,10 +1836,10 @@ _base_request_irq(struct MPT3SAS_ADAPTER *ioc, u8 index, u32 vector) | |||
1835 | atomic_set(&reply_q->busy, 0); | 1836 | atomic_set(&reply_q->busy, 0); |
1836 | if (ioc->msix_enable) | 1837 | if (ioc->msix_enable) |
1837 | snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d-msix%d", | 1838 | snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d-msix%d", |
1838 | driver_name, ioc->id, index); | 1839 | ioc->driver_name, ioc->id, index); |
1839 | else | 1840 | else |
1840 | snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d", | 1841 | snprintf(reply_q->name, MPT_NAME_LENGTH, "%s%d", |
1841 | driver_name, ioc->id); | 1842 | ioc->driver_name, ioc->id); |
1842 | r = request_irq(vector, _base_interrupt, IRQF_SHARED, reply_q->name, | 1843 | r = request_irq(vector, _base_interrupt, IRQF_SHARED, reply_q->name, |
1843 | reply_q); | 1844 | reply_q); |
1844 | if (r) { | 1845 | if (r) { |
@@ -2064,7 +2065,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) | |||
2064 | 2065 | ||
2065 | 2066 | ||
2066 | if (pci_request_selected_regions(pdev, ioc->bars, | 2067 | if (pci_request_selected_regions(pdev, ioc->bars, |
2067 | driver_name)) { | 2068 | ioc->driver_name)) { |
2068 | pr_warn(MPT3SAS_FMT "pci_request_selected_regions: failed\n", | 2069 | pr_warn(MPT3SAS_FMT "pci_request_selected_regions: failed\n", |
2069 | ioc->name); | 2070 | ioc->name); |
2070 | ioc->bars = 0; | 2071 | ioc->bars = 0; |
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h index 213d7f8fe3dc..25c141c9ec9d 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.h +++ b/drivers/scsi/mpt3sas/mpt3sas_base.h | |||
@@ -935,6 +935,7 @@ struct MPT3SAS_ADAPTER { | |||
935 | u8 id; | 935 | u8 id; |
936 | int cpu_count; | 936 | int cpu_count; |
937 | char name[MPT_NAME_LENGTH]; | 937 | char name[MPT_NAME_LENGTH]; |
938 | char driver_name[MPT_NAME_LENGTH]; | ||
938 | char tmp_string[MPT_STRING_LENGTH]; | 939 | char tmp_string[MPT_STRING_LENGTH]; |
939 | struct pci_dev *pdev; | 940 | struct pci_dev *pdev; |
940 | Mpi2SystemInterfaceRegs_t __iomem *chip; | 941 | Mpi2SystemInterfaceRegs_t __iomem *chip; |
@@ -1246,7 +1247,6 @@ int mpt3sas_port_enable(struct MPT3SAS_ADAPTER *ioc); | |||
1246 | 1247 | ||
1247 | 1248 | ||
1248 | /* scsih shared API */ | 1249 | /* scsih shared API */ |
1249 | extern struct raid_template *mpt3sas_raid_template; | ||
1250 | u8 mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, | 1250 | u8 mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, |
1251 | u32 reply); | 1251 | u32 reply); |
1252 | void mpt3sas_scsih_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase); | 1252 | void mpt3sas_scsih_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase); |
@@ -1270,39 +1270,8 @@ struct _sas_device *__mpt3sas_get_sdev_by_addr( | |||
1270 | struct MPT3SAS_ADAPTER *ioc, u64 sas_address); | 1270 | struct MPT3SAS_ADAPTER *ioc, u64 sas_address); |
1271 | 1271 | ||
1272 | void mpt3sas_port_enable_complete(struct MPT3SAS_ADAPTER *ioc); | 1272 | void mpt3sas_port_enable_complete(struct MPT3SAS_ADAPTER *ioc); |
1273 | 1273 | struct _raid_device * | |
1274 | void scsih_exit(void); | 1274 | mpt3sas_raid_device_find_by_handle(struct MPT3SAS_ADAPTER *ioc, u16 handle); |
1275 | int scsih_init(void); | ||
1276 | int scsih_probe(struct pci_dev *pdev, struct Scsi_Host *shost); | ||
1277 | void scsih_remove(struct pci_dev *pdev); | ||
1278 | void scsih_shutdown(struct pci_dev *pdev); | ||
1279 | pci_ers_result_t scsih_pci_error_detected(struct pci_dev *pdev, | ||
1280 | pci_channel_state_t state); | ||
1281 | pci_ers_result_t scsih_pci_mmio_enabled(struct pci_dev *pdev); | ||
1282 | pci_ers_result_t scsih_pci_slot_reset(struct pci_dev *pdev); | ||
1283 | void scsih_pci_resume(struct pci_dev *pdev); | ||
1284 | int scsih_suspend(struct pci_dev *pdev, pm_message_t state); | ||
1285 | int scsih_resume(struct pci_dev *pdev); | ||
1286 | |||
1287 | int scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd); | ||
1288 | int scsih_target_alloc(struct scsi_target *starget); | ||
1289 | int scsih_slave_alloc(struct scsi_device *sdev); | ||
1290 | int scsih_slave_configure(struct scsi_device *sdev); | ||
1291 | void scsih_target_destroy(struct scsi_target *starget); | ||
1292 | void scsih_slave_destroy(struct scsi_device *sdev); | ||
1293 | int scsih_scan_finished(struct Scsi_Host *shost, unsigned long time); | ||
1294 | void scsih_scan_start(struct Scsi_Host *shost); | ||
1295 | int scsih_change_queue_depth(struct scsi_device *sdev, int qdepth); | ||
1296 | int scsih_abort(struct scsi_cmnd *scmd); | ||
1297 | int scsih_dev_reset(struct scsi_cmnd *scmd); | ||
1298 | int scsih_target_reset(struct scsi_cmnd *scmd); | ||
1299 | int scsih_host_reset(struct scsi_cmnd *scmd); | ||
1300 | int scsih_bios_param(struct scsi_device *sdev, struct block_device *bdev, | ||
1301 | sector_t capacity, int params[]); | ||
1302 | |||
1303 | int scsih_is_raid(struct device *dev); | ||
1304 | void scsih_get_resync(struct device *dev); | ||
1305 | void scsih_get_state(struct device *dev); | ||
1306 | 1275 | ||
1307 | /* config shared API */ | 1276 | /* config shared API */ |
1308 | u8 mpt3sas_config_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, | 1277 | u8 mpt3sas_config_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
@@ -1342,10 +1311,8 @@ int mpt3sas_config_get_sas_iounit_pg0(struct MPT3SAS_ADAPTER *ioc, | |||
1342 | u16 sz); | 1311 | u16 sz); |
1343 | int mpt3sas_config_get_iounit_pg1(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t | 1312 | int mpt3sas_config_get_iounit_pg1(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
1344 | *mpi_reply, Mpi2IOUnitPage1_t *config_page); | 1313 | *mpi_reply, Mpi2IOUnitPage1_t *config_page); |
1345 | #ifdef SCSI_MPT2SAS | ||
1346 | int mpt3sas_config_get_iounit_pg3(struct MPT3SAS_ADAPTER *ioc, | 1314 | int mpt3sas_config_get_iounit_pg3(struct MPT3SAS_ADAPTER *ioc, |
1347 | Mpi2ConfigReply_t *mpi_reply, Mpi2IOUnitPage3_t *config_page, u16 sz); | 1315 | Mpi2ConfigReply_t *mpi_reply, Mpi2IOUnitPage3_t *config_page, u16 sz); |
1348 | #endif | ||
1349 | int mpt3sas_config_set_iounit_pg1(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t | 1316 | int mpt3sas_config_set_iounit_pg1(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
1350 | *mpi_reply, Mpi2IOUnitPage1_t *config_page); | 1317 | *mpi_reply, Mpi2IOUnitPage1_t *config_page); |
1351 | int mpt3sas_config_get_iounit_pg8(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t | 1318 | int mpt3sas_config_get_iounit_pg8(struct MPT3SAS_ADAPTER *ioc, Mpi2ConfigReply_t |
@@ -1390,12 +1357,8 @@ int mpt3sas_config_get_volume_wwid(struct MPT3SAS_ADAPTER *ioc, | |||
1390 | /* ctl shared API */ | 1357 | /* ctl shared API */ |
1391 | extern struct device_attribute *mpt3sas_host_attrs[]; | 1358 | extern struct device_attribute *mpt3sas_host_attrs[]; |
1392 | extern struct device_attribute *mpt3sas_dev_attrs[]; | 1359 | extern struct device_attribute *mpt3sas_dev_attrs[]; |
1393 | long ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | 1360 | void mpt3sas_ctl_init(ushort hbas_to_enumerate); |
1394 | unsigned int ctl_poll(struct file *filep, poll_table *wait); | 1361 | void mpt3sas_ctl_exit(ushort hbas_to_enumerate); |
1395 | int ctl_fasync(int fd, struct file *filep, int mode); | ||
1396 | long ctl_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg); | ||
1397 | void ctl_init(void); | ||
1398 | void ctl_exit(void); | ||
1399 | u8 mpt3sas_ctl_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, | 1362 | u8 mpt3sas_ctl_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, |
1400 | u32 reply); | 1363 | u32 reply); |
1401 | void mpt3sas_ctl_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase); | 1364 | void mpt3sas_ctl_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase); |
@@ -1442,4 +1405,18 @@ void mpt3sas_trigger_scsi(struct MPT3SAS_ADAPTER *ioc, u8 sense_key, | |||
1442 | u8 asc, u8 ascq); | 1405 | u8 asc, u8 ascq); |
1443 | void mpt3sas_trigger_mpi(struct MPT3SAS_ADAPTER *ioc, u16 ioc_status, | 1406 | void mpt3sas_trigger_mpi(struct MPT3SAS_ADAPTER *ioc, u16 ioc_status, |
1444 | u32 loginfo); | 1407 | u32 loginfo); |
1408 | |||
1409 | /* warpdrive APIs */ | ||
1410 | u8 mpt3sas_get_num_volumes(struct MPT3SAS_ADAPTER *ioc); | ||
1411 | void mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, | ||
1412 | struct _raid_device *raid_device); | ||
1413 | inline u8 | ||
1414 | mpt3sas_scsi_direct_io_get(struct MPT3SAS_ADAPTER *ioc, u16 smid); | ||
1415 | inline void | ||
1416 | mpt3sas_scsi_direct_io_set(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 direct_io); | ||
1417 | void | ||
1418 | mpt3sas_setup_direct_io(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, | ||
1419 | struct _raid_device *raid_device, Mpi2SCSIIORequest_t *mpi_request, | ||
1420 | u16 smid); | ||
1421 | |||
1445 | #endif /* MPT3SAS_BASE_H_INCLUDED */ | 1422 | #endif /* MPT3SAS_BASE_H_INCLUDED */ |
diff --git a/drivers/scsi/mpt3sas/mpt3sas_config.c b/drivers/scsi/mpt3sas/mpt3sas_config.c index 2bbb0346b462..a6914ec99cc0 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_config.c +++ b/drivers/scsi/mpt3sas/mpt3sas_config.c | |||
@@ -865,7 +865,6 @@ mpt3sas_config_set_iounit_pg1(struct MPT3SAS_ADAPTER *ioc, | |||
865 | return r; | 865 | return r; |
866 | } | 866 | } |
867 | 867 | ||
868 | #ifdef SCSI_MPT2SAS | ||
869 | /** | 868 | /** |
870 | * mpt3sas_config_get_iounit_pg3 - obtain iounit page 3 | 869 | * mpt3sas_config_get_iounit_pg3 - obtain iounit page 3 |
871 | * @ioc: per adapter object | 870 | * @ioc: per adapter object |
@@ -901,7 +900,6 @@ mpt3sas_config_get_iounit_pg3(struct MPT3SAS_ADAPTER *ioc, | |||
901 | out: | 900 | out: |
902 | return r; | 901 | return r; |
903 | } | 902 | } |
904 | #endif | ||
905 | 903 | ||
906 | /** | 904 | /** |
907 | * mpt3sas_config_get_iounit_pg8 - obtain iounit page 8 | 905 | * mpt3sas_config_get_iounit_pg8 - obtain iounit page 8 |
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c index f257c962c899..d8366b056b70 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c +++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c | |||
@@ -409,11 +409,14 @@ mpt3sas_ctl_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index, | |||
409 | * _ctl_verify_adapter - validates ioc_number passed from application | 409 | * _ctl_verify_adapter - validates ioc_number passed from application |
410 | * @ioc: per adapter object | 410 | * @ioc: per adapter object |
411 | * @iocpp: The ioc pointer is returned in this. | 411 | * @iocpp: The ioc pointer is returned in this. |
412 | * @mpi_version: will be MPI2_VERSION for mpt2ctl ioctl device & | ||
413 | * MPI25_VERSION for mpt3ctl ioctl device. | ||
412 | * | 414 | * |
413 | * Return (-1) means error, else ioc_number. | 415 | * Return (-1) means error, else ioc_number. |
414 | */ | 416 | */ |
415 | static int | 417 | static int |
416 | _ctl_verify_adapter(int ioc_number, struct MPT3SAS_ADAPTER **iocpp) | 418 | _ctl_verify_adapter(int ioc_number, struct MPT3SAS_ADAPTER **iocpp, |
419 | int mpi_version) | ||
417 | { | 420 | { |
418 | struct MPT3SAS_ADAPTER *ioc; | 421 | struct MPT3SAS_ADAPTER *ioc; |
419 | /* global ioc lock to protect controller on list operations */ | 422 | /* global ioc lock to protect controller on list operations */ |
@@ -421,6 +424,11 @@ _ctl_verify_adapter(int ioc_number, struct MPT3SAS_ADAPTER **iocpp) | |||
421 | list_for_each_entry(ioc, &mpt3sas_ioc_list, list) { | 424 | list_for_each_entry(ioc, &mpt3sas_ioc_list, list) { |
422 | if (ioc->id != ioc_number) | 425 | if (ioc->id != ioc_number) |
423 | continue; | 426 | continue; |
427 | /* Check whether this ioctl command is from right | ||
428 | * ioctl device or not, if not continue the search. | ||
429 | */ | ||
430 | if (ioc->hba_mpi_version_belonged != mpi_version) | ||
431 | continue; | ||
424 | spin_unlock(&gioc_lock); | 432 | spin_unlock(&gioc_lock); |
425 | *iocpp = ioc; | 433 | *iocpp = ioc; |
426 | return ioc_number; | 434 | return ioc_number; |
@@ -488,7 +496,7 @@ mpt3sas_ctl_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase) | |||
488 | } | 496 | } |
489 | 497 | ||
490 | /** | 498 | /** |
491 | * ctl_fasync - | 499 | * _ctl_fasync - |
492 | * @fd - | 500 | * @fd - |
493 | * @filep - | 501 | * @filep - |
494 | * @mode - | 502 | * @mode - |
@@ -496,19 +504,19 @@ mpt3sas_ctl_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase) | |||
496 | * Called when application request fasyn callback handler. | 504 | * Called when application request fasyn callback handler. |
497 | */ | 505 | */ |
498 | int | 506 | int |
499 | ctl_fasync(int fd, struct file *filep, int mode) | 507 | _ctl_fasync(int fd, struct file *filep, int mode) |
500 | { | 508 | { |
501 | return fasync_helper(fd, filep, mode, &async_queue); | 509 | return fasync_helper(fd, filep, mode, &async_queue); |
502 | } | 510 | } |
503 | 511 | ||
504 | /** | 512 | /** |
505 | * ctl_poll - | 513 | * _ctl_poll - |
506 | * @file - | 514 | * @file - |
507 | * @wait - | 515 | * @wait - |
508 | * | 516 | * |
509 | */ | 517 | */ |
510 | unsigned int | 518 | unsigned int |
511 | ctl_poll(struct file *filep, poll_table *wait) | 519 | _ctl_poll(struct file *filep, poll_table *wait) |
512 | { | 520 | { |
513 | struct MPT3SAS_ADAPTER *ioc; | 521 | struct MPT3SAS_ADAPTER *ioc; |
514 | 522 | ||
@@ -1034,7 +1042,7 @@ _ctl_getiocinfo(struct MPT3SAS_ADAPTER *ioc, void __user *arg) | |||
1034 | karg.pci_information.u.bits.function = PCI_FUNC(ioc->pdev->devfn); | 1042 | karg.pci_information.u.bits.function = PCI_FUNC(ioc->pdev->devfn); |
1035 | karg.pci_information.segment_id = pci_domain_nr(ioc->pdev->bus); | 1043 | karg.pci_information.segment_id = pci_domain_nr(ioc->pdev->bus); |
1036 | karg.firmware_version = ioc->facts.FWVersion.Word; | 1044 | karg.firmware_version = ioc->facts.FWVersion.Word; |
1037 | strcpy(karg.driver_version, driver_name); | 1045 | strcpy(karg.driver_version, ioc->driver_name); |
1038 | strcat(karg.driver_version, "-"); | 1046 | strcat(karg.driver_version, "-"); |
1039 | switch (ioc->hba_mpi_version_belonged) { | 1047 | switch (ioc->hba_mpi_version_belonged) { |
1040 | case MPI2_VERSION: | 1048 | case MPI2_VERSION: |
@@ -1049,10 +1057,6 @@ _ctl_getiocinfo(struct MPT3SAS_ADAPTER *ioc, void __user *arg) | |||
1049 | strcat(karg.driver_version, MPT3SAS_DRIVER_VERSION); | 1057 | strcat(karg.driver_version, MPT3SAS_DRIVER_VERSION); |
1050 | break; | 1058 | break; |
1051 | } | 1059 | } |
1052 | if (ioc->hba_mpi_version_belonged == MPI2_VERSION) | ||
1053 | strcat(karg.driver_version, MPT2SAS_DRIVER_VERSION); | ||
1054 | else | ||
1055 | strcat(karg.driver_version, MPT3SAS_DRIVER_VERSION); | ||
1056 | karg.bios_version = le32_to_cpu(ioc->bios_pg3.BiosVersion); | 1060 | karg.bios_version = le32_to_cpu(ioc->bios_pg3.BiosVersion); |
1057 | 1061 | ||
1058 | if (copy_to_user(arg, &karg, sizeof(karg))) { | 1062 | if (copy_to_user(arg, &karg, sizeof(karg))) { |
@@ -2196,12 +2200,14 @@ _ctl_compat_mpt_command(struct MPT3SAS_ADAPTER *ioc, unsigned cmd, | |||
2196 | * _ctl_ioctl_main - main ioctl entry point | 2200 | * _ctl_ioctl_main - main ioctl entry point |
2197 | * @file - (struct file) | 2201 | * @file - (struct file) |
2198 | * @cmd - ioctl opcode | 2202 | * @cmd - ioctl opcode |
2199 | * @arg - | 2203 | * @arg - user space data buffer |
2200 | * compat - handles 32 bit applications in 64bit os | 2204 | * @compat - handles 32 bit applications in 64bit os |
2205 | * @mpi_version: will be MPI2_VERSION for mpt2ctl ioctl device & | ||
2206 | * MPI25_VERSION for mpt3ctl ioctl device. | ||
2201 | */ | 2207 | */ |
2202 | static long | 2208 | static long |
2203 | _ctl_ioctl_main(struct file *file, unsigned int cmd, void __user *arg, | 2209 | _ctl_ioctl_main(struct file *file, unsigned int cmd, void __user *arg, |
2204 | u8 compat) | 2210 | u8 compat, u16 mpi_version) |
2205 | { | 2211 | { |
2206 | struct MPT3SAS_ADAPTER *ioc; | 2212 | struct MPT3SAS_ADAPTER *ioc; |
2207 | struct mpt3_ioctl_header ioctl_header; | 2213 | struct mpt3_ioctl_header ioctl_header; |
@@ -2216,7 +2222,8 @@ _ctl_ioctl_main(struct file *file, unsigned int cmd, void __user *arg, | |||
2216 | return -EFAULT; | 2222 | return -EFAULT; |
2217 | } | 2223 | } |
2218 | 2224 | ||
2219 | if (_ctl_verify_adapter(ioctl_header.ioc_number, &ioc) == -1 || !ioc) | 2225 | if (_ctl_verify_adapter(ioctl_header.ioc_number, |
2226 | &ioc, mpi_version) == -1 || !ioc) | ||
2220 | return -ENODEV; | 2227 | return -ENODEV; |
2221 | 2228 | ||
2222 | /* pci_access_mutex lock acquired by ioctl path */ | 2229 | /* pci_access_mutex lock acquired by ioctl path */ |
@@ -2324,23 +2331,43 @@ out_unlock_pciaccess: | |||
2324 | } | 2331 | } |
2325 | 2332 | ||
2326 | /** | 2333 | /** |
2327 | * ctl_ioctl - main ioctl entry point (unlocked) | 2334 | * _ctl_ioctl - mpt3ctl main ioctl entry point (unlocked) |
2328 | * @file - (struct file) | 2335 | * @file - (struct file) |
2329 | * @cmd - ioctl opcode | 2336 | * @cmd - ioctl opcode |
2330 | * @arg - | 2337 | * @arg - |
2331 | */ | 2338 | */ |
2332 | long | 2339 | long |
2333 | ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 2340 | _ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
2334 | { | 2341 | { |
2335 | long ret; | 2342 | long ret; |
2336 | 2343 | ||
2337 | ret = _ctl_ioctl_main(file, cmd, (void __user *)arg, 0); | 2344 | /* pass MPI25_VERSION value, to indicate that this ioctl cmd |
2345 | * came from mpt3ctl ioctl device. | ||
2346 | */ | ||
2347 | ret = _ctl_ioctl_main(file, cmd, (void __user *)arg, 0, MPI25_VERSION); | ||
2338 | return ret; | 2348 | return ret; |
2339 | } | 2349 | } |
2340 | 2350 | ||
2351 | /** | ||
2352 | * _ctl_mpt2_ioctl - mpt2ctl main ioctl entry point (unlocked) | ||
2353 | * @file - (struct file) | ||
2354 | * @cmd - ioctl opcode | ||
2355 | * @arg - | ||
2356 | */ | ||
2357 | long | ||
2358 | _ctl_mpt2_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
2359 | { | ||
2360 | long ret; | ||
2361 | |||
2362 | /* pass MPI2_VERSION value, to indicate that this ioctl cmd | ||
2363 | * came from mpt2ctl ioctl device. | ||
2364 | */ | ||
2365 | ret = _ctl_ioctl_main(file, cmd, (void __user *)arg, 0, MPI2_VERSION); | ||
2366 | return ret; | ||
2367 | } | ||
2341 | #ifdef CONFIG_COMPAT | 2368 | #ifdef CONFIG_COMPAT |
2342 | /** | 2369 | /** |
2343 | * ctl_ioctl_compat - main ioctl entry point (compat) | 2370 | *_ ctl_ioctl_compat - main ioctl entry point (compat) |
2344 | * @file - | 2371 | * @file - |
2345 | * @cmd - | 2372 | * @cmd - |
2346 | * @arg - | 2373 | * @arg - |
@@ -2348,11 +2375,28 @@ ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
2348 | * This routine handles 32 bit applications in 64bit os. | 2375 | * This routine handles 32 bit applications in 64bit os. |
2349 | */ | 2376 | */ |
2350 | long | 2377 | long |
2351 | ctl_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg) | 2378 | _ctl_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg) |
2352 | { | 2379 | { |
2353 | long ret; | 2380 | long ret; |
2354 | 2381 | ||
2355 | ret = _ctl_ioctl_main(file, cmd, (void __user *)arg, 1); | 2382 | ret = _ctl_ioctl_main(file, cmd, (void __user *)arg, 1, MPI25_VERSION); |
2383 | return ret; | ||
2384 | } | ||
2385 | |||
2386 | /** | ||
2387 | *_ ctl_mpt2_ioctl_compat - main ioctl entry point (compat) | ||
2388 | * @file - | ||
2389 | * @cmd - | ||
2390 | * @arg - | ||
2391 | * | ||
2392 | * This routine handles 32 bit applications in 64bit os. | ||
2393 | */ | ||
2394 | long | ||
2395 | _ctl_mpt2_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg) | ||
2396 | { | ||
2397 | long ret; | ||
2398 | |||
2399 | ret = _ctl_ioctl_main(file, cmd, (void __user *)arg, 1, MPI2_VERSION); | ||
2356 | return ret; | 2400 | return ret; |
2357 | } | 2401 | } |
2358 | #endif | 2402 | #endif |
@@ -2739,7 +2783,6 @@ _ctl_ioc_reply_queue_count_show(struct device *cdev, | |||
2739 | static DEVICE_ATTR(reply_queue_count, S_IRUGO, _ctl_ioc_reply_queue_count_show, | 2783 | static DEVICE_ATTR(reply_queue_count, S_IRUGO, _ctl_ioc_reply_queue_count_show, |
2740 | NULL); | 2784 | NULL); |
2741 | 2785 | ||
2742 | #ifdef SCSI_MPT2SAS | ||
2743 | /** | 2786 | /** |
2744 | * _ctl_BRM_status_show - Backup Rail Monitor Status | 2787 | * _ctl_BRM_status_show - Backup Rail Monitor Status |
2745 | * @cdev - pointer to embedded class device | 2788 | * @cdev - pointer to embedded class device |
@@ -2815,7 +2858,6 @@ _ctl_BRM_status_show(struct device *cdev, struct device_attribute *attr, | |||
2815 | return rc; | 2858 | return rc; |
2816 | } | 2859 | } |
2817 | static DEVICE_ATTR(BRM_status, S_IRUGO, _ctl_BRM_status_show, NULL); | 2860 | static DEVICE_ATTR(BRM_status, S_IRUGO, _ctl_BRM_status_show, NULL); |
2818 | #endif | ||
2819 | 2861 | ||
2820 | struct DIAG_BUFFER_START { | 2862 | struct DIAG_BUFFER_START { |
2821 | __le32 Size; | 2863 | __le32 Size; |
@@ -3269,9 +3311,7 @@ struct device_attribute *mpt3sas_host_attrs[] = { | |||
3269 | &dev_attr_diag_trigger_event, | 3311 | &dev_attr_diag_trigger_event, |
3270 | &dev_attr_diag_trigger_scsi, | 3312 | &dev_attr_diag_trigger_scsi, |
3271 | &dev_attr_diag_trigger_mpi, | 3313 | &dev_attr_diag_trigger_mpi, |
3272 | #ifdef SCSI_MPT2SAS | ||
3273 | &dev_attr_BRM_status, | 3314 | &dev_attr_BRM_status, |
3274 | #endif | ||
3275 | NULL, | 3315 | NULL, |
3276 | }; | 3316 | }; |
3277 | 3317 | ||
@@ -3325,23 +3365,74 @@ struct device_attribute *mpt3sas_dev_attrs[] = { | |||
3325 | NULL, | 3365 | NULL, |
3326 | }; | 3366 | }; |
3327 | 3367 | ||
3368 | /* file operations table for mpt3ctl device */ | ||
3369 | static const struct file_operations ctl_fops = { | ||
3370 | .owner = THIS_MODULE, | ||
3371 | .unlocked_ioctl = _ctl_ioctl, | ||
3372 | .poll = _ctl_poll, | ||
3373 | .fasync = _ctl_fasync, | ||
3374 | #ifdef CONFIG_COMPAT | ||
3375 | .compat_ioctl = _ctl_ioctl_compat, | ||
3376 | #endif | ||
3377 | }; | ||
3378 | |||
3379 | /* file operations table for mpt2ctl device */ | ||
3380 | static const struct file_operations ctl_gen2_fops = { | ||
3381 | .owner = THIS_MODULE, | ||
3382 | .unlocked_ioctl = _ctl_mpt2_ioctl, | ||
3383 | .poll = _ctl_poll, | ||
3384 | .fasync = _ctl_fasync, | ||
3385 | #ifdef CONFIG_COMPAT | ||
3386 | .compat_ioctl = _ctl_mpt2_ioctl_compat, | ||
3387 | #endif | ||
3388 | }; | ||
3389 | |||
3390 | static struct miscdevice ctl_dev = { | ||
3391 | .minor = MPT3SAS_MINOR, | ||
3392 | .name = MPT3SAS_DEV_NAME, | ||
3393 | .fops = &ctl_fops, | ||
3394 | }; | ||
3395 | |||
3396 | static struct miscdevice gen2_ctl_dev = { | ||
3397 | .minor = MPT2SAS_MINOR, | ||
3398 | .name = MPT2SAS_DEV_NAME, | ||
3399 | .fops = &ctl_gen2_fops, | ||
3400 | }; | ||
3401 | |||
3328 | /** | 3402 | /** |
3329 | * ctl_init - main entry point for ctl. | 3403 | * mpt3sas_ctl_init - main entry point for ctl. |
3330 | * | 3404 | * |
3331 | */ | 3405 | */ |
3332 | void | 3406 | void |
3333 | ctl_init(void) | 3407 | mpt3sas_ctl_init(ushort hbas_to_enumerate) |
3334 | { | 3408 | { |
3335 | async_queue = NULL; | 3409 | async_queue = NULL; |
3410 | |||
3411 | /* Don't register mpt3ctl ioctl device if | ||
3412 | * hbas_to_enumarate is one. | ||
3413 | */ | ||
3414 | if (hbas_to_enumerate != 1) | ||
3415 | if (misc_register(&ctl_dev) < 0) | ||
3416 | pr_err("%s can't register misc device [minor=%d]\n", | ||
3417 | MPT3SAS_DRIVER_NAME, MPT3SAS_MINOR); | ||
3418 | |||
3419 | /* Don't register mpt3ctl ioctl device if | ||
3420 | * hbas_to_enumarate is two. | ||
3421 | */ | ||
3422 | if (hbas_to_enumerate != 2) | ||
3423 | if (misc_register(&gen2_ctl_dev) < 0) | ||
3424 | pr_err("%s can't register misc device [minor=%d]\n", | ||
3425 | MPT2SAS_DRIVER_NAME, MPT2SAS_MINOR); | ||
3426 | |||
3336 | init_waitqueue_head(&ctl_poll_wait); | 3427 | init_waitqueue_head(&ctl_poll_wait); |
3337 | } | 3428 | } |
3338 | 3429 | ||
3339 | /** | 3430 | /** |
3340 | * ctl_exit - exit point for ctl | 3431 | * mpt3sas_ctl_exit - exit point for ctl |
3341 | * | 3432 | * |
3342 | */ | 3433 | */ |
3343 | void | 3434 | void |
3344 | ctl_exit(void) | 3435 | mpt3sas_ctl_exit(ushort hbas_to_enumerate) |
3345 | { | 3436 | { |
3346 | struct MPT3SAS_ADAPTER *ioc; | 3437 | struct MPT3SAS_ADAPTER *ioc; |
3347 | int i; | 3438 | int i; |
@@ -3366,4 +3457,8 @@ ctl_exit(void) | |||
3366 | 3457 | ||
3367 | kfree(ioc->event_log); | 3458 | kfree(ioc->event_log); |
3368 | } | 3459 | } |
3460 | if (hbas_to_enumerate != 1) | ||
3461 | misc_deregister(&ctl_dev); | ||
3462 | if (hbas_to_enumerate != 2) | ||
3463 | misc_deregister(&gen2_ctl_dev); | ||
3369 | } | 3464 | } |
diff --git a/drivers/scsi/mpt3sas/mpt3sas_module.c b/drivers/scsi/mpt3sas/mpt3sas_module.c deleted file mode 100644 index 322dc8da3d7d..000000000000 --- a/drivers/scsi/mpt3sas/mpt3sas_module.c +++ /dev/null | |||
@@ -1,253 +0,0 @@ | |||
1 | /* | ||
2 | * Scsi Host Layer for MPT (Message Passing Technology) based controllers | ||
3 | * | ||
4 | * Copyright (C) 2012-2014 LSI Corporation | ||
5 | * Copyright (C) 2013-2015 Avago Technologies | ||
6 | * (mailto: MPT-FusionLinux.pdl@avagotech.com) | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version 2 | ||
11 | * of the License, or (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * NO WARRANTY | ||
19 | * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
20 | * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT | ||
21 | * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, | ||
22 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is | ||
23 | * solely responsible for determining the appropriateness of using and | ||
24 | * distributing the Program and assumes all risks associated with its | ||
25 | * exercise of rights under this Agreement, including but not limited to | ||
26 | * the risks and costs of program errors, damage to or loss of data, | ||
27 | * programs or equipment, and unavailability or interruption of operations. | ||
28 | |||
29 | * DISCLAIMER OF LIABILITY | ||
30 | * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY | ||
31 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
32 | * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND | ||
33 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
34 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
35 | * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED | ||
36 | * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES | ||
37 | |||
38 | * You should have received a copy of the GNU General Public License | ||
39 | * along with this program. | ||
40 | */ | ||
41 | |||
42 | #include <linux/module.h> | ||
43 | #include <linux/pci.h> | ||
44 | #include <linux/raid_class.h> | ||
45 | |||
46 | #include "mpt3sas_base.h" | ||
47 | #include "mpt3sas_ctl.h" | ||
48 | |||
49 | MODULE_AUTHOR(MPT3SAS_AUTHOR); | ||
50 | MODULE_DESCRIPTION(MPT3SAS_DESCRIPTION); | ||
51 | MODULE_LICENSE("GPL"); | ||
52 | MODULE_VERSION(MPT3SAS_DRIVER_VERSION); | ||
53 | |||
54 | /* shost template */ | ||
55 | static struct scsi_host_template mpt3sas_driver_template = { | ||
56 | .module = THIS_MODULE, | ||
57 | .name = "Fusion MPT SAS Host", | ||
58 | .proc_name = MPT3SAS_DRIVER_NAME, | ||
59 | .queuecommand = scsih_qcmd, | ||
60 | .target_alloc = scsih_target_alloc, | ||
61 | .slave_alloc = scsih_slave_alloc, | ||
62 | .slave_configure = scsih_slave_configure, | ||
63 | .target_destroy = scsih_target_destroy, | ||
64 | .slave_destroy = scsih_slave_destroy, | ||
65 | .scan_finished = scsih_scan_finished, | ||
66 | .scan_start = scsih_scan_start, | ||
67 | .change_queue_depth = scsih_change_queue_depth, | ||
68 | .eh_abort_handler = scsih_abort, | ||
69 | .eh_device_reset_handler = scsih_dev_reset, | ||
70 | .eh_target_reset_handler = scsih_target_reset, | ||
71 | .eh_host_reset_handler = scsih_host_reset, | ||
72 | .bios_param = scsih_bios_param, | ||
73 | .can_queue = 1, | ||
74 | .this_id = -1, | ||
75 | .sg_tablesize = MPT3SAS_SG_DEPTH, | ||
76 | .max_sectors = 32767, | ||
77 | .cmd_per_lun = 7, | ||
78 | .use_clustering = ENABLE_CLUSTERING, | ||
79 | .shost_attrs = mpt3sas_host_attrs, | ||
80 | .sdev_attrs = mpt3sas_dev_attrs, | ||
81 | .track_queue_depth = 1, | ||
82 | }; | ||
83 | |||
84 | /* raid transport support */ | ||
85 | static struct raid_function_template mpt3sas_raid_functions = { | ||
86 | .cookie = &mpt3sas_driver_template, | ||
87 | .is_raid = scsih_is_raid, | ||
88 | .get_resync = scsih_get_resync, | ||
89 | .get_state = scsih_get_state, | ||
90 | }; | ||
91 | |||
92 | /* | ||
93 | * The pci device ids are defined in mpi/mpi2_cnfg.h. | ||
94 | */ | ||
95 | static const struct pci_device_id mpt3sas_pci_table[] = { | ||
96 | { MPI2_MFGPAGE_VENDORID_LSI, MPI25_MFGPAGE_DEVID_SAS3004, | ||
97 | PCI_ANY_ID, PCI_ANY_ID }, | ||
98 | { MPI2_MFGPAGE_VENDORID_LSI, MPI25_MFGPAGE_DEVID_SAS3008, | ||
99 | PCI_ANY_ID, PCI_ANY_ID }, | ||
100 | /* Invader ~ 3108 */ | ||
101 | { MPI2_MFGPAGE_VENDORID_LSI, MPI25_MFGPAGE_DEVID_SAS3108_1, | ||
102 | PCI_ANY_ID, PCI_ANY_ID }, | ||
103 | { MPI2_MFGPAGE_VENDORID_LSI, MPI25_MFGPAGE_DEVID_SAS3108_2, | ||
104 | PCI_ANY_ID, PCI_ANY_ID }, | ||
105 | { MPI2_MFGPAGE_VENDORID_LSI, MPI25_MFGPAGE_DEVID_SAS3108_5, | ||
106 | PCI_ANY_ID, PCI_ANY_ID }, | ||
107 | { MPI2_MFGPAGE_VENDORID_LSI, MPI25_MFGPAGE_DEVID_SAS3108_6, | ||
108 | PCI_ANY_ID, PCI_ANY_ID }, | ||
109 | {0} /* Terminating entry */ | ||
110 | }; | ||
111 | MODULE_DEVICE_TABLE(pci, mpt3sas_pci_table); | ||
112 | |||
113 | static const struct file_operations mpt3sas_ctl_fops = { | ||
114 | .owner = THIS_MODULE, | ||
115 | .unlocked_ioctl = ctl_ioctl, | ||
116 | .poll = ctl_poll, | ||
117 | .fasync = ctl_fasync, | ||
118 | #ifdef CONFIG_COMPAT | ||
119 | .compat_ioctl = ctl_ioctl_compat, | ||
120 | #endif | ||
121 | }; | ||
122 | |||
123 | static struct miscdevice mpt3sas_ctl_dev = { | ||
124 | .minor = MPT3SAS_MINOR, | ||
125 | .name = MPT3SAS_DEV_NAME, | ||
126 | .fops = &mpt3sas_ctl_fops, | ||
127 | }; | ||
128 | |||
129 | /** | ||
130 | * mpt3sas_ctl_init - main entry point for ctl. | ||
131 | * | ||
132 | */ | ||
133 | void | ||
134 | mpt3sas_ctl_init(void) | ||
135 | { | ||
136 | ctl_init(); | ||
137 | if (misc_register(&mpt3sas_ctl_dev) < 0) | ||
138 | pr_err("%s can't register misc device [minor=%d]\n", | ||
139 | MPT3SAS_DRIVER_NAME, MPT3SAS_MINOR); | ||
140 | } | ||
141 | |||
142 | /** | ||
143 | * mpt3sas_ctl_exit - exit point for ctl | ||
144 | * | ||
145 | */ | ||
146 | void | ||
147 | mpt3sas_ctl_exit(void) | ||
148 | { | ||
149 | ctl_exit(); | ||
150 | misc_deregister(&mpt3sas_ctl_dev); | ||
151 | } | ||
152 | |||
153 | /** | ||
154 | * _mpt3sas_probe - attach and add scsi host | ||
155 | * @pdev: PCI device struct | ||
156 | * @id: pci device id | ||
157 | * | ||
158 | * Returns 0 success, anything else error. | ||
159 | */ | ||
160 | static int | ||
161 | _mpt3sas_probe(struct pci_dev *pdev, const struct pci_device_id *id) | ||
162 | { | ||
163 | struct Scsi_Host *shost; | ||
164 | int rv; | ||
165 | |||
166 | shost = scsi_host_alloc(&mpt3sas_driver_template, | ||
167 | sizeof(struct MPT3SAS_ADAPTER)); | ||
168 | if (!shost) | ||
169 | return -ENODEV; | ||
170 | |||
171 | sprintf(driver_name, "%s", MPT3SAS_DRIVER_NAME); | ||
172 | rv = scsih_probe(pdev, shost); | ||
173 | return rv; | ||
174 | } | ||
175 | |||
176 | static struct pci_error_handlers _mpt3sas_err_handler = { | ||
177 | .error_detected = scsih_pci_error_detected, | ||
178 | .mmio_enabled = scsih_pci_mmio_enabled, | ||
179 | .slot_reset = scsih_pci_slot_reset, | ||
180 | .resume = scsih_pci_resume, | ||
181 | }; | ||
182 | |||
183 | static struct pci_driver mpt3sas_driver = { | ||
184 | .name = MPT3SAS_DRIVER_NAME, | ||
185 | .id_table = mpt3sas_pci_table, | ||
186 | .probe = _mpt3sas_probe, | ||
187 | .remove = scsih_remove, | ||
188 | .shutdown = scsih_shutdown, | ||
189 | .err_handler = &_mpt3sas_err_handler, | ||
190 | #ifdef CONFIG_PM | ||
191 | .suspend = scsih_suspend, | ||
192 | .resume = scsih_resume, | ||
193 | #endif | ||
194 | }; | ||
195 | |||
196 | /** | ||
197 | * _mpt3sas_init - main entry point for this driver. | ||
198 | * | ||
199 | * Returns 0 success, anything else error. | ||
200 | */ | ||
201 | static int __init | ||
202 | _mpt3sas_init(void) | ||
203 | { | ||
204 | int error; | ||
205 | |||
206 | pr_info("%s version %s loaded\n", MPT3SAS_DRIVER_NAME, | ||
207 | MPT3SAS_DRIVER_VERSION); | ||
208 | |||
209 | mpt3sas_transport_template = | ||
210 | sas_attach_transport(&mpt3sas_transport_functions); | ||
211 | if (!mpt3sas_transport_template) | ||
212 | return -ENODEV; | ||
213 | |||
214 | mpt3sas_raid_template = raid_class_attach(&mpt3sas_raid_functions); | ||
215 | if (!mpt3sas_raid_template) { | ||
216 | sas_release_transport(mpt3sas_transport_template); | ||
217 | return -ENODEV; | ||
218 | } | ||
219 | |||
220 | error = scsih_init(); | ||
221 | if (error) { | ||
222 | scsih_exit(); | ||
223 | return error; | ||
224 | } | ||
225 | |||
226 | mpt3sas_ctl_init(); | ||
227 | |||
228 | error = pci_register_driver(&mpt3sas_driver); | ||
229 | if (error) | ||
230 | scsih_exit(); | ||
231 | |||
232 | return error; | ||
233 | } | ||
234 | |||
235 | /** | ||
236 | * _mpt3sas_exit - exit point for this driver (when it is a module). | ||
237 | * | ||
238 | */ | ||
239 | static void __exit | ||
240 | _mpt3sas_exit(void) | ||
241 | { | ||
242 | pr_info("mpt3sas version %s unloading\n", | ||
243 | MPT3SAS_DRIVER_VERSION); | ||
244 | |||
245 | pci_unregister_driver(&mpt3sas_driver); | ||
246 | |||
247 | mpt3sas_ctl_exit(); | ||
248 | |||
249 | scsih_exit(); | ||
250 | } | ||
251 | |||
252 | module_init(_mpt3sas_init); | ||
253 | module_exit(_mpt3sas_exit); | ||
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index d0ab0028c2eb..d95206b7e116 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c | |||
@@ -71,28 +71,17 @@ static int _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, | |||
71 | 71 | ||
72 | static u8 _scsih_check_for_pending_tm(struct MPT3SAS_ADAPTER *ioc, u16 smid); | 72 | static u8 _scsih_check_for_pending_tm(struct MPT3SAS_ADAPTER *ioc, u16 smid); |
73 | 73 | ||
74 | #ifdef SCSI_MPT2SAS | ||
75 | static void _scsih_disable_ddio(struct MPT3SAS_ADAPTER *ioc); | ||
76 | static u8 _scsih_get_num_volumes(struct MPT3SAS_ADAPTER *ioc); | ||
77 | static void | ||
78 | _scsih_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, | ||
79 | struct _raid_device *raid_device); | ||
80 | static inline u8 | ||
81 | _scsih_scsi_direct_io_get(struct MPT3SAS_ADAPTER *ioc, u16 smid); | ||
82 | static inline void | ||
83 | _scsih_scsi_direct_io_set(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 direct_io); | ||
84 | static void | ||
85 | _scsih_setup_direct_io(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, | ||
86 | struct _raid_device *raid_device, Mpi2SCSIIORequest_t *mpi_request, | ||
87 | u16 smid); | ||
88 | #endif | ||
89 | |||
90 | /* global parameters */ | 74 | /* global parameters */ |
91 | LIST_HEAD(mpt3sas_ioc_list); | 75 | LIST_HEAD(mpt3sas_ioc_list); |
92 | char driver_name[MPT_NAME_LENGTH]; | ||
93 | /* global ioc lock for list operations */ | 76 | /* global ioc lock for list operations */ |
94 | DEFINE_SPINLOCK(gioc_lock); | 77 | DEFINE_SPINLOCK(gioc_lock); |
95 | 78 | ||
79 | MODULE_AUTHOR(MPT3SAS_AUTHOR); | ||
80 | MODULE_DESCRIPTION(MPT3SAS_DESCRIPTION); | ||
81 | MODULE_LICENSE("GPL"); | ||
82 | MODULE_VERSION(MPT3SAS_DRIVER_VERSION); | ||
83 | MODULE_ALIAS("mpt2sas"); | ||
84 | |||
96 | /* local parameters */ | 85 | /* local parameters */ |
97 | static u8 scsi_io_cb_idx = -1; | 86 | static u8 scsi_io_cb_idx = -1; |
98 | static u8 tm_cb_idx = -1; | 87 | static u8 tm_cb_idx = -1; |
@@ -102,7 +91,8 @@ static u8 port_enable_cb_idx = -1; | |||
102 | static u8 transport_cb_idx = -1; | 91 | static u8 transport_cb_idx = -1; |
103 | static u8 scsih_cb_idx = -1; | 92 | static u8 scsih_cb_idx = -1; |
104 | static u8 config_cb_idx = -1; | 93 | static u8 config_cb_idx = -1; |
105 | static int mpt_ids; | 94 | static int mpt2_ids; |
95 | static int mpt3_ids; | ||
106 | 96 | ||
107 | static u8 tm_tr_cb_idx = -1 ; | 97 | static u8 tm_tr_cb_idx = -1 ; |
108 | static u8 tm_tr_volume_cb_idx = -1 ; | 98 | static u8 tm_tr_volume_cb_idx = -1 ; |
@@ -129,8 +119,12 @@ static u64 max_lun = MPT3SAS_MAX_LUN; | |||
129 | module_param(max_lun, ullong, 0); | 119 | module_param(max_lun, ullong, 0); |
130 | MODULE_PARM_DESC(max_lun, " max lun, default=16895 "); | 120 | MODULE_PARM_DESC(max_lun, " max lun, default=16895 "); |
131 | 121 | ||
132 | 122 | static ushort hbas_to_enumerate; | |
133 | 123 | module_param(hbas_to_enumerate, ushort, 0); | |
124 | MODULE_PARM_DESC(hbas_to_enumerate, | ||
125 | " 0 - enumerates both SAS 2.0 & SAS 3.0 generation HBAs\n \ | ||
126 | 1 - enumerates only SAS 2.0 generation HBAs\n \ | ||
127 | 2 - enumerates only SAS 3.0 generation HBAs (default=0)"); | ||
134 | 128 | ||
135 | /* diag_buffer_enable is bitwise | 129 | /* diag_buffer_enable is bitwise |
136 | * bit 0 set = TRACE | 130 | * bit 0 set = TRACE |
@@ -156,6 +150,7 @@ MODULE_PARM_DESC(prot_mask, " host protection capabilities mask, def=7 "); | |||
156 | 150 | ||
157 | /* raid transport support */ | 151 | /* raid transport support */ |
158 | struct raid_template *mpt3sas_raid_template; | 152 | struct raid_template *mpt3sas_raid_template; |
153 | struct raid_template *mpt2sas_raid_template; | ||
159 | 154 | ||
160 | 155 | ||
161 | /** | 156 | /** |
@@ -879,7 +874,7 @@ _scsih_raid_device_find_by_id(struct MPT3SAS_ADAPTER *ioc, int id, int channel) | |||
879 | } | 874 | } |
880 | 875 | ||
881 | /** | 876 | /** |
882 | * _scsih_raid_device_find_by_handle - raid device search | 877 | * mpt3sas_raid_device_find_by_handle - raid device search |
883 | * @ioc: per adapter object | 878 | * @ioc: per adapter object |
884 | * @handle: sas device handle (assigned by firmware) | 879 | * @handle: sas device handle (assigned by firmware) |
885 | * Context: Calling function should acquire ioc->raid_device_lock | 880 | * Context: Calling function should acquire ioc->raid_device_lock |
@@ -887,8 +882,8 @@ _scsih_raid_device_find_by_id(struct MPT3SAS_ADAPTER *ioc, int id, int channel) | |||
887 | * This searches for raid_device based on handle, then return raid_device | 882 | * This searches for raid_device based on handle, then return raid_device |
888 | * object. | 883 | * object. |
889 | */ | 884 | */ |
890 | static struct _raid_device * | 885 | struct _raid_device * |
891 | _scsih_raid_device_find_by_handle(struct MPT3SAS_ADAPTER *ioc, u16 handle) | 886 | mpt3sas_raid_device_find_by_handle(struct MPT3SAS_ADAPTER *ioc, u16 handle) |
892 | { | 887 | { |
893 | struct _raid_device *raid_device, *r; | 888 | struct _raid_device *raid_device, *r; |
894 | 889 | ||
@@ -1304,10 +1299,8 @@ scsih_target_alloc(struct scsi_target *starget) | |||
1304 | if (test_bit(sas_device->handle, ioc->pd_handles)) | 1299 | if (test_bit(sas_device->handle, ioc->pd_handles)) |
1305 | sas_target_priv_data->flags |= | 1300 | sas_target_priv_data->flags |= |
1306 | MPT_TARGET_FLAGS_RAID_COMPONENT; | 1301 | MPT_TARGET_FLAGS_RAID_COMPONENT; |
1307 | #ifndef SCSI_MPT2SAS | ||
1308 | if (sas_device->fast_path) | 1302 | if (sas_device->fast_path) |
1309 | sas_target_priv_data->flags |= MPT_TARGET_FASTPATH_IO; | 1303 | sas_target_priv_data->flags |= MPT_TARGET_FASTPATH_IO; |
1310 | #endif | ||
1311 | } | 1304 | } |
1312 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); | 1305 | spin_unlock_irqrestore(&ioc->sas_device_lock, flags); |
1313 | 1306 | ||
@@ -1596,7 +1589,10 @@ scsih_get_resync(struct device *dev) | |||
1596 | percent_complete = 0; | 1589 | percent_complete = 0; |
1597 | 1590 | ||
1598 | out: | 1591 | out: |
1599 | raid_set_resync(mpt3sas_raid_template, dev, percent_complete); | 1592 | if (ioc->hba_mpi_version_belonged == MPI2_VERSION) |
1593 | raid_set_resync(mpt2sas_raid_template, dev, percent_complete); | ||
1594 | if (ioc->hba_mpi_version_belonged == MPI25_VERSION) | ||
1595 | raid_set_resync(mpt3sas_raid_template, dev, percent_complete); | ||
1600 | } | 1596 | } |
1601 | 1597 | ||
1602 | /** | 1598 | /** |
@@ -1654,7 +1650,10 @@ scsih_get_state(struct device *dev) | |||
1654 | break; | 1650 | break; |
1655 | } | 1651 | } |
1656 | out: | 1652 | out: |
1657 | raid_set_state(mpt3sas_raid_template, dev, state); | 1653 | if (ioc->hba_mpi_version_belonged == MPI2_VERSION) |
1654 | raid_set_state(mpt2sas_raid_template, dev, state); | ||
1655 | if (ioc->hba_mpi_version_belonged == MPI25_VERSION) | ||
1656 | raid_set_state(mpt3sas_raid_template, dev, state); | ||
1658 | } | 1657 | } |
1659 | 1658 | ||
1660 | /** | 1659 | /** |
@@ -1663,7 +1662,8 @@ scsih_get_state(struct device *dev) | |||
1663 | * @volume_type: volume type | 1662 | * @volume_type: volume type |
1664 | */ | 1663 | */ |
1665 | static void | 1664 | static void |
1666 | _scsih_set_level(struct scsi_device *sdev, u8 volume_type) | 1665 | _scsih_set_level(struct MPT3SAS_ADAPTER *ioc, |
1666 | struct scsi_device *sdev, u8 volume_type) | ||
1667 | { | 1667 | { |
1668 | enum raid_level level = RAID_LEVEL_UNKNOWN; | 1668 | enum raid_level level = RAID_LEVEL_UNKNOWN; |
1669 | 1669 | ||
@@ -1682,7 +1682,12 @@ _scsih_set_level(struct scsi_device *sdev, u8 volume_type) | |||
1682 | break; | 1682 | break; |
1683 | } | 1683 | } |
1684 | 1684 | ||
1685 | raid_set_level(mpt3sas_raid_template, &sdev->sdev_gendev, level); | 1685 | if (ioc->hba_mpi_version_belonged == MPI2_VERSION) |
1686 | raid_set_level(mpt2sas_raid_template, | ||
1687 | &sdev->sdev_gendev, level); | ||
1688 | if (ioc->hba_mpi_version_belonged == MPI25_VERSION) | ||
1689 | raid_set_level(mpt3sas_raid_template, | ||
1690 | &sdev->sdev_gendev, level); | ||
1686 | } | 1691 | } |
1687 | 1692 | ||
1688 | 1693 | ||
@@ -1814,7 +1819,7 @@ scsih_slave_configure(struct scsi_device *sdev) | |||
1814 | if (sas_target_priv_data->flags & MPT_TARGET_FLAGS_VOLUME) { | 1819 | if (sas_target_priv_data->flags & MPT_TARGET_FLAGS_VOLUME) { |
1815 | 1820 | ||
1816 | spin_lock_irqsave(&ioc->raid_device_lock, flags); | 1821 | spin_lock_irqsave(&ioc->raid_device_lock, flags); |
1817 | raid_device = _scsih_raid_device_find_by_handle(ioc, handle); | 1822 | raid_device = mpt3sas_raid_device_find_by_handle(ioc, handle); |
1818 | spin_unlock_irqrestore(&ioc->raid_device_lock, flags); | 1823 | spin_unlock_irqrestore(&ioc->raid_device_lock, flags); |
1819 | if (!raid_device) { | 1824 | if (!raid_device) { |
1820 | dfailprintk(ioc, pr_warn(MPT3SAS_FMT | 1825 | dfailprintk(ioc, pr_warn(MPT3SAS_FMT |
@@ -1830,12 +1835,10 @@ scsih_slave_configure(struct scsi_device *sdev) | |||
1830 | return 1; | 1835 | return 1; |
1831 | } | 1836 | } |
1832 | 1837 | ||
1833 | #ifdef SCSI_MPT2SAS | ||
1834 | /* | 1838 | /* |
1835 | * WARPDRIVE: Initialize the required data for Direct IO | 1839 | * WARPDRIVE: Initialize the required data for Direct IO |
1836 | */ | 1840 | */ |
1837 | _scsih_init_warpdrive_properties(ioc, raid_device); | 1841 | mpt3sas_init_warpdrive_properties(ioc, raid_device); |
1838 | #endif | ||
1839 | 1842 | ||
1840 | /* RAID Queue Depth Support | 1843 | /* RAID Queue Depth Support |
1841 | * IS volume = underlying qdepth of drive type, either | 1844 | * IS volume = underlying qdepth of drive type, either |
@@ -1896,7 +1899,7 @@ scsih_slave_configure(struct scsi_device *sdev) | |||
1896 | 1899 | ||
1897 | /* raid transport support */ | 1900 | /* raid transport support */ |
1898 | if (!ioc->is_warpdrive) | 1901 | if (!ioc->is_warpdrive) |
1899 | _scsih_set_level(sdev, raid_device->volume_type); | 1902 | _scsih_set_level(ioc, sdev, raid_device->volume_type); |
1900 | return 0; | 1903 | return 0; |
1901 | } | 1904 | } |
1902 | 1905 | ||
@@ -3523,7 +3526,7 @@ _scsih_set_volume_delete_flag(struct MPT3SAS_ADAPTER *ioc, u16 handle) | |||
3523 | unsigned long flags; | 3526 | unsigned long flags; |
3524 | 3527 | ||
3525 | spin_lock_irqsave(&ioc->raid_device_lock, flags); | 3528 | spin_lock_irqsave(&ioc->raid_device_lock, flags); |
3526 | raid_device = _scsih_raid_device_find_by_handle(ioc, handle); | 3529 | raid_device = mpt3sas_raid_device_find_by_handle(ioc, handle); |
3527 | if (raid_device && raid_device->starget && | 3530 | if (raid_device && raid_device->starget && |
3528 | raid_device->starget->hostdata) { | 3531 | raid_device->starget->hostdata) { |
3529 | sas_target_priv_data = | 3532 | sas_target_priv_data = |
@@ -3841,9 +3844,7 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) | |||
3841 | struct MPT3SAS_ADAPTER *ioc = shost_priv(shost); | 3844 | struct MPT3SAS_ADAPTER *ioc = shost_priv(shost); |
3842 | struct MPT3SAS_DEVICE *sas_device_priv_data; | 3845 | struct MPT3SAS_DEVICE *sas_device_priv_data; |
3843 | struct MPT3SAS_TARGET *sas_target_priv_data; | 3846 | struct MPT3SAS_TARGET *sas_target_priv_data; |
3844 | #ifdef SCSI_MPT2SAS | ||
3845 | struct _raid_device *raid_device; | 3847 | struct _raid_device *raid_device; |
3846 | #endif | ||
3847 | Mpi2SCSIIORequest_t *mpi_request; | 3848 | Mpi2SCSIIORequest_t *mpi_request; |
3848 | u32 mpi_control; | 3849 | u32 mpi_control; |
3849 | u16 smid; | 3850 | u16 smid; |
@@ -3947,21 +3948,17 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) | |||
3947 | } else | 3948 | } else |
3948 | ioc->build_zero_len_sge(ioc, &mpi_request->SGL); | 3949 | ioc->build_zero_len_sge(ioc, &mpi_request->SGL); |
3949 | 3950 | ||
3950 | #ifdef SCSI_MPT2SAS | ||
3951 | raid_device = sas_target_priv_data->raid_device; | 3951 | raid_device = sas_target_priv_data->raid_device; |
3952 | if (raid_device && raid_device->direct_io_enabled) | 3952 | if (raid_device && raid_device->direct_io_enabled) |
3953 | _scsih_setup_direct_io(ioc, scmd, raid_device, mpi_request, | 3953 | mpt3sas_setup_direct_io(ioc, scmd, raid_device, mpi_request, |
3954 | smid); | 3954 | smid); |
3955 | #endif | ||
3956 | 3955 | ||
3957 | if (likely(mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST)) { | 3956 | if (likely(mpi_request->Function == MPI2_FUNCTION_SCSI_IO_REQUEST)) { |
3958 | #ifndef SCSI_MPT2SAS | ||
3959 | if (sas_target_priv_data->flags & MPT_TARGET_FASTPATH_IO) { | 3957 | if (sas_target_priv_data->flags & MPT_TARGET_FASTPATH_IO) { |
3960 | mpi_request->IoFlags = cpu_to_le16(scmd->cmd_len | | 3958 | mpi_request->IoFlags = cpu_to_le16(scmd->cmd_len | |
3961 | MPI25_SCSIIO_IOFLAGS_FAST_PATH); | 3959 | MPI25_SCSIIO_IOFLAGS_FAST_PATH); |
3962 | mpt3sas_base_put_smid_fast_path(ioc, smid, handle); | 3960 | mpt3sas_base_put_smid_fast_path(ioc, smid, handle); |
3963 | } else | 3961 | } else |
3964 | #endif | ||
3965 | mpt3sas_base_put_smid_scsi_io(ioc, smid, | 3962 | mpt3sas_base_put_smid_scsi_io(ioc, smid, |
3966 | le16_to_cpu(mpi_request->DevHandle)); | 3963 | le16_to_cpu(mpi_request->DevHandle)); |
3967 | } else | 3964 | } else |
@@ -4422,9 +4419,7 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) | |||
4422 | u32 log_info; | 4419 | u32 log_info; |
4423 | struct MPT3SAS_DEVICE *sas_device_priv_data; | 4420 | struct MPT3SAS_DEVICE *sas_device_priv_data; |
4424 | u32 response_code = 0; | 4421 | u32 response_code = 0; |
4425 | #ifdef SCSI_MPT2SAS | ||
4426 | unsigned long flags; | 4422 | unsigned long flags; |
4427 | #endif | ||
4428 | 4423 | ||
4429 | mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply); | 4424 | mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply); |
4430 | scmd = _scsih_scsi_lookup_get_clear(ioc, smid); | 4425 | scmd = _scsih_scsi_lookup_get_clear(ioc, smid); |
@@ -4446,18 +4441,17 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) | |||
4446 | } | 4441 | } |
4447 | ioc_status = le16_to_cpu(mpi_reply->IOCStatus); | 4442 | ioc_status = le16_to_cpu(mpi_reply->IOCStatus); |
4448 | 4443 | ||
4449 | #ifdef SCSI_MPT2SAS | ||
4450 | /* | 4444 | /* |
4451 | * WARPDRIVE: If direct_io is set then it is directIO, | 4445 | * WARPDRIVE: If direct_io is set then it is directIO, |
4452 | * the failed direct I/O should be redirected to volume | 4446 | * the failed direct I/O should be redirected to volume |
4453 | */ | 4447 | */ |
4454 | if (_scsih_scsi_direct_io_get(ioc, smid) && | 4448 | if (mpt3sas_scsi_direct_io_get(ioc, smid) && |
4455 | ((ioc_status & MPI2_IOCSTATUS_MASK) | 4449 | ((ioc_status & MPI2_IOCSTATUS_MASK) |
4456 | != MPI2_IOCSTATUS_SCSI_TASK_TERMINATED)) { | 4450 | != MPI2_IOCSTATUS_SCSI_TASK_TERMINATED)) { |
4457 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); | 4451 | spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); |
4458 | ioc->scsi_lookup[smid - 1].scmd = scmd; | 4452 | ioc->scsi_lookup[smid - 1].scmd = scmd; |
4459 | spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); | 4453 | spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); |
4460 | _scsih_scsi_direct_io_set(ioc, smid, 0); | 4454 | mpt3sas_scsi_direct_io_set(ioc, smid, 0); |
4461 | memcpy(mpi_request->CDB.CDB32, scmd->cmnd, scmd->cmd_len); | 4455 | memcpy(mpi_request->CDB.CDB32, scmd->cmnd, scmd->cmd_len); |
4462 | mpi_request->DevHandle = | 4456 | mpi_request->DevHandle = |
4463 | cpu_to_le16(sas_device_priv_data->sas_target->handle); | 4457 | cpu_to_le16(sas_device_priv_data->sas_target->handle); |
@@ -4465,7 +4459,6 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) | |||
4465 | sas_device_priv_data->sas_target->handle); | 4459 | sas_device_priv_data->sas_target->handle); |
4466 | return 0; | 4460 | return 0; |
4467 | } | 4461 | } |
4468 | #endif | ||
4469 | /* turning off TLR */ | 4462 | /* turning off TLR */ |
4470 | scsi_state = mpi_reply->SCSIState; | 4463 | scsi_state = mpi_reply->SCSIState; |
4471 | if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) | 4464 | if (scsi_state & MPI2_SCSI_STATE_RESPONSE_INFO_VALID) |
@@ -4475,10 +4468,11 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply) | |||
4475 | sas_device_priv_data->tlr_snoop_check++; | 4468 | sas_device_priv_data->tlr_snoop_check++; |
4476 | if (!ioc->is_warpdrive && | 4469 | if (!ioc->is_warpdrive && |
4477 | !scsih_is_raid(&scmd->device->sdev_gendev) && | 4470 | !scsih_is_raid(&scmd->device->sdev_gendev) && |
4478 | (sas_device_priv_data->flags & MPT_DEVICE_TLR_ON) && | 4471 | sas_is_tlr_enabled(scmd->device) && |
4479 | response_code == MPI2_SCSITASKMGMT_RSP_INVALID_FRAME) | 4472 | response_code == MPI2_SCSITASKMGMT_RSP_INVALID_FRAME) { |
4480 | sas_device_priv_data->flags &= | 4473 | sas_disable_tlr(scmd->device); |
4481 | ~MPT_DEVICE_TLR_ON; | 4474 | sdev_printk(KERN_INFO, scmd->device, "TLR disabled\n"); |
4475 | } | ||
4482 | } | 4476 | } |
4483 | 4477 | ||
4484 | xfer_cnt = le32_to_cpu(mpi_reply->TransferCount); | 4478 | xfer_cnt = le32_to_cpu(mpi_reply->TransferCount); |
@@ -5309,10 +5303,8 @@ _scsih_add_device(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phy_num, | |||
5309 | sas_device->device_info = device_info; | 5303 | sas_device->device_info = device_info; |
5310 | sas_device->sas_address = sas_address; | 5304 | sas_device->sas_address = sas_address; |
5311 | sas_device->phy = sas_device_pg0.PhyNum; | 5305 | sas_device->phy = sas_device_pg0.PhyNum; |
5312 | #ifndef SCSI_MPT2SAS | ||
5313 | sas_device->fast_path = (le16_to_cpu(sas_device_pg0.Flags) & | 5306 | sas_device->fast_path = (le16_to_cpu(sas_device_pg0.Flags) & |
5314 | MPI25_SAS_DEVICE0_FLAGS_FAST_PATH_CAPABLE) ? 1 : 0; | 5307 | MPI25_SAS_DEVICE0_FLAGS_FAST_PATH_CAPABLE) ? 1 : 0; |
5315 | #endif | ||
5316 | 5308 | ||
5317 | if (sas_device_pg0.Flags & MPI2_SAS_DEVICE0_FLAGS_ENCL_LEVEL_VALID) { | 5309 | if (sas_device_pg0.Flags & MPI2_SAS_DEVICE0_FLAGS_ENCL_LEVEL_VALID) { |
5318 | sas_device->enclosure_level = | 5310 | sas_device->enclosure_level = |
@@ -6014,7 +6006,6 @@ _scsih_sas_discovery_event(struct MPT3SAS_ADAPTER *ioc, | |||
6014 | } | 6006 | } |
6015 | } | 6007 | } |
6016 | 6008 | ||
6017 | #ifndef SCSI_MPT2SAS | ||
6018 | /** | 6009 | /** |
6019 | * _scsih_ir_fastpath - turn on fastpath for IR physdisk | 6010 | * _scsih_ir_fastpath - turn on fastpath for IR physdisk |
6020 | * @ioc: per adapter object | 6011 | * @ioc: per adapter object |
@@ -6034,6 +6025,9 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phys_disk_num) | |||
6034 | u16 ioc_status; | 6025 | u16 ioc_status; |
6035 | u32 log_info; | 6026 | u32 log_info; |
6036 | 6027 | ||
6028 | if (ioc->hba_mpi_version_belonged == MPI2_VERSION) | ||
6029 | return rc; | ||
6030 | |||
6037 | mutex_lock(&ioc->scsih_cmds.mutex); | 6031 | mutex_lock(&ioc->scsih_cmds.mutex); |
6038 | 6032 | ||
6039 | if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) { | 6033 | if (ioc->scsih_cmds.status != MPT3_CMD_NOT_USED) { |
@@ -6108,8 +6102,6 @@ _scsih_ir_fastpath(struct MPT3SAS_ADAPTER *ioc, u16 handle, u8 phys_disk_num) | |||
6108 | FORCE_BIG_HAMMER); | 6102 | FORCE_BIG_HAMMER); |
6109 | return rc; | 6103 | return rc; |
6110 | } | 6104 | } |
6111 | /* End of not defined SCSI_MPT2SAS */ | ||
6112 | #endif | ||
6113 | 6105 | ||
6114 | /** | 6106 | /** |
6115 | * _scsih_reprobe_lun - reprobing lun | 6107 | * _scsih_reprobe_lun - reprobing lun |
@@ -6202,7 +6194,7 @@ _scsih_sas_volume_delete(struct MPT3SAS_ADAPTER *ioc, u16 handle) | |||
6202 | struct scsi_target *starget = NULL; | 6194 | struct scsi_target *starget = NULL; |
6203 | 6195 | ||
6204 | spin_lock_irqsave(&ioc->raid_device_lock, flags); | 6196 | spin_lock_irqsave(&ioc->raid_device_lock, flags); |
6205 | raid_device = _scsih_raid_device_find_by_handle(ioc, handle); | 6197 | raid_device = mpt3sas_raid_device_find_by_handle(ioc, handle); |
6206 | if (raid_device) { | 6198 | if (raid_device) { |
6207 | if (raid_device->starget) { | 6199 | if (raid_device->starget) { |
6208 | starget = raid_device->starget; | 6200 | starget = raid_device->starget; |
@@ -6304,10 +6296,9 @@ _scsih_sas_pd_hide(struct MPT3SAS_ADAPTER *ioc, | |||
6304 | if (!sas_device) | 6296 | if (!sas_device) |
6305 | return; | 6297 | return; |
6306 | 6298 | ||
6307 | #ifndef SCSI_MPT2SAS | ||
6308 | /* hiding raid component */ | 6299 | /* hiding raid component */ |
6309 | _scsih_ir_fastpath(ioc, handle, element->PhysDiskNum); | 6300 | _scsih_ir_fastpath(ioc, handle, element->PhysDiskNum); |
6310 | #endif | 6301 | |
6311 | if (starget) | 6302 | if (starget) |
6312 | starget_for_each_device(starget, (void *)1, _scsih_reprobe_lun); | 6303 | starget_for_each_device(starget, (void *)1, _scsih_reprobe_lun); |
6313 | 6304 | ||
@@ -6355,9 +6346,7 @@ _scsih_sas_pd_add(struct MPT3SAS_ADAPTER *ioc, | |||
6355 | 6346 | ||
6356 | sas_device = mpt3sas_get_sdev_by_handle(ioc, handle); | 6347 | sas_device = mpt3sas_get_sdev_by_handle(ioc, handle); |
6357 | if (sas_device) { | 6348 | if (sas_device) { |
6358 | #ifndef SCSI_MPT2SAS | ||
6359 | _scsih_ir_fastpath(ioc, handle, element->PhysDiskNum); | 6349 | _scsih_ir_fastpath(ioc, handle, element->PhysDiskNum); |
6360 | #endif | ||
6361 | sas_device_put(sas_device); | 6350 | sas_device_put(sas_device); |
6362 | return; | 6351 | return; |
6363 | } | 6352 | } |
@@ -6382,9 +6371,7 @@ _scsih_sas_pd_add(struct MPT3SAS_ADAPTER *ioc, | |||
6382 | mpt3sas_transport_update_links(ioc, sas_address, handle, | 6371 | mpt3sas_transport_update_links(ioc, sas_address, handle, |
6383 | sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5); | 6372 | sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5); |
6384 | 6373 | ||
6385 | #ifndef SCSI_MPT2SAS | ||
6386 | _scsih_ir_fastpath(ioc, handle, element->PhysDiskNum); | 6374 | _scsih_ir_fastpath(ioc, handle, element->PhysDiskNum); |
6387 | #endif | ||
6388 | _scsih_add_device(ioc, handle, 0, 1); | 6375 | _scsih_add_device(ioc, handle, 0, 1); |
6389 | } | 6376 | } |
6390 | 6377 | ||
@@ -6495,15 +6482,14 @@ _scsih_sas_ir_config_change_event(struct MPT3SAS_ADAPTER *ioc, | |||
6495 | MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG) ? 1 : 0; | 6482 | MPI2_EVENT_IR_CHANGE_FLAGS_FOREIGN_CONFIG) ? 1 : 0; |
6496 | 6483 | ||
6497 | element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0]; | 6484 | element = (Mpi2EventIrConfigElement_t *)&event_data->ConfigElement[0]; |
6498 | if (ioc->shost_recovery) { | 6485 | if (ioc->shost_recovery && |
6499 | #ifndef SCSI_MPT2SAS | 6486 | ioc->hba_mpi_version_belonged != MPI2_VERSION) { |
6500 | for (i = 0; i < event_data->NumElements; i++, element++) { | 6487 | for (i = 0; i < event_data->NumElements; i++, element++) { |
6501 | if (element->ReasonCode == MPI2_EVENT_IR_CHANGE_RC_HIDE) | 6488 | if (element->ReasonCode == MPI2_EVENT_IR_CHANGE_RC_HIDE) |
6502 | _scsih_ir_fastpath(ioc, | 6489 | _scsih_ir_fastpath(ioc, |
6503 | le16_to_cpu(element->PhysDiskDevHandle), | 6490 | le16_to_cpu(element->PhysDiskDevHandle), |
6504 | element->PhysDiskNum); | 6491 | element->PhysDiskNum); |
6505 | } | 6492 | } |
6506 | #endif | ||
6507 | return; | 6493 | return; |
6508 | } | 6494 | } |
6509 | 6495 | ||
@@ -6586,7 +6572,7 @@ _scsih_sas_ir_volume_event(struct MPT3SAS_ADAPTER *ioc, | |||
6586 | case MPI2_RAID_VOL_STATE_OPTIMAL: | 6572 | case MPI2_RAID_VOL_STATE_OPTIMAL: |
6587 | 6573 | ||
6588 | spin_lock_irqsave(&ioc->raid_device_lock, flags); | 6574 | spin_lock_irqsave(&ioc->raid_device_lock, flags); |
6589 | raid_device = _scsih_raid_device_find_by_handle(ioc, handle); | 6575 | raid_device = mpt3sas_raid_device_find_by_handle(ioc, handle); |
6590 | spin_unlock_irqrestore(&ioc->raid_device_lock, flags); | 6576 | spin_unlock_irqrestore(&ioc->raid_device_lock, flags); |
6591 | 6577 | ||
6592 | if (raid_device) | 6578 | if (raid_device) |
@@ -6782,7 +6768,7 @@ _scsih_sas_ir_operation_status_event(struct MPT3SAS_ADAPTER *ioc, | |||
6782 | 6768 | ||
6783 | spin_lock_irqsave(&ioc->raid_device_lock, flags); | 6769 | spin_lock_irqsave(&ioc->raid_device_lock, flags); |
6784 | handle = le16_to_cpu(event_data->VolDevHandle); | 6770 | handle = le16_to_cpu(event_data->VolDevHandle); |
6785 | raid_device = _scsih_raid_device_find_by_handle(ioc, handle); | 6771 | raid_device = mpt3sas_raid_device_find_by_handle(ioc, handle); |
6786 | if (raid_device) | 6772 | if (raid_device) |
6787 | raid_device->percent_complete = | 6773 | raid_device->percent_complete = |
6788 | event_data->PercentComplete; | 6774 | event_data->PercentComplete; |
@@ -6964,14 +6950,12 @@ _scsih_mark_responding_raid_device(struct MPT3SAS_ADAPTER *ioc, u64 wwid, | |||
6964 | "handle(0x%04x), wwid(0x%016llx)\n", handle, | 6950 | "handle(0x%04x), wwid(0x%016llx)\n", handle, |
6965 | (unsigned long long)raid_device->wwid); | 6951 | (unsigned long long)raid_device->wwid); |
6966 | 6952 | ||
6967 | #ifdef SCSI_MPT2SAS | ||
6968 | /* | 6953 | /* |
6969 | * WARPDRIVE: The handles of the PDs might have changed | 6954 | * WARPDRIVE: The handles of the PDs might have changed |
6970 | * across the host reset so re-initialize the | 6955 | * across the host reset so re-initialize the |
6971 | * required data for Direct IO | 6956 | * required data for Direct IO |
6972 | */ | 6957 | */ |
6973 | _scsih_init_warpdrive_properties(ioc, raid_device); | 6958 | mpt3sas_init_warpdrive_properties(ioc, raid_device); |
6974 | #endif | ||
6975 | spin_lock_irqsave(&ioc->raid_device_lock, flags); | 6959 | spin_lock_irqsave(&ioc->raid_device_lock, flags); |
6976 | if (raid_device->handle == handle) { | 6960 | if (raid_device->handle == handle) { |
6977 | spin_unlock_irqrestore(&ioc->raid_device_lock, | 6961 | spin_unlock_irqrestore(&ioc->raid_device_lock, |
@@ -8326,13 +8310,96 @@ scsih_scan_finished(struct Scsi_Host *shost, unsigned long time) | |||
8326 | return 1; | 8310 | return 1; |
8327 | } | 8311 | } |
8328 | 8312 | ||
8329 | void | 8313 | /* shost template for SAS 2.0 HBA devices */ |
8330 | _scsih_determine_hba_mpi_version(struct MPT3SAS_ADAPTER *ioc) { | 8314 | static struct scsi_host_template mpt2sas_driver_template = { |
8315 | .module = THIS_MODULE, | ||
8316 | .name = "Fusion MPT SAS Host", | ||
8317 | .proc_name = MPT2SAS_DRIVER_NAME, | ||
8318 | .queuecommand = scsih_qcmd, | ||
8319 | .target_alloc = scsih_target_alloc, | ||
8320 | .slave_alloc = scsih_slave_alloc, | ||
8321 | .slave_configure = scsih_slave_configure, | ||
8322 | .target_destroy = scsih_target_destroy, | ||
8323 | .slave_destroy = scsih_slave_destroy, | ||
8324 | .scan_finished = scsih_scan_finished, | ||
8325 | .scan_start = scsih_scan_start, | ||
8326 | .change_queue_depth = scsih_change_queue_depth, | ||
8327 | .eh_abort_handler = scsih_abort, | ||
8328 | .eh_device_reset_handler = scsih_dev_reset, | ||
8329 | .eh_target_reset_handler = scsih_target_reset, | ||
8330 | .eh_host_reset_handler = scsih_host_reset, | ||
8331 | .bios_param = scsih_bios_param, | ||
8332 | .can_queue = 1, | ||
8333 | .this_id = -1, | ||
8334 | .sg_tablesize = MPT2SAS_SG_DEPTH, | ||
8335 | .max_sectors = 32767, | ||
8336 | .cmd_per_lun = 7, | ||
8337 | .use_clustering = ENABLE_CLUSTERING, | ||
8338 | .shost_attrs = mpt3sas_host_attrs, | ||
8339 | .sdev_attrs = mpt3sas_dev_attrs, | ||
8340 | .track_queue_depth = 1, | ||
8341 | }; | ||
8342 | |||
8343 | /* raid transport support for SAS 2.0 HBA devices */ | ||
8344 | static struct raid_function_template mpt2sas_raid_functions = { | ||
8345 | .cookie = &mpt2sas_driver_template, | ||
8346 | .is_raid = scsih_is_raid, | ||
8347 | .get_resync = scsih_get_resync, | ||
8348 | .get_state = scsih_get_state, | ||
8349 | }; | ||
8331 | 8350 | ||
8332 | switch (ioc->pdev->device) { | 8351 | /* shost template for SAS 3.0 HBA devices */ |
8352 | static struct scsi_host_template mpt3sas_driver_template = { | ||
8353 | .module = THIS_MODULE, | ||
8354 | .name = "Fusion MPT SAS Host", | ||
8355 | .proc_name = MPT3SAS_DRIVER_NAME, | ||
8356 | .queuecommand = scsih_qcmd, | ||
8357 | .target_alloc = scsih_target_alloc, | ||
8358 | .slave_alloc = scsih_slave_alloc, | ||
8359 | .slave_configure = scsih_slave_configure, | ||
8360 | .target_destroy = scsih_target_destroy, | ||
8361 | .slave_destroy = scsih_slave_destroy, | ||
8362 | .scan_finished = scsih_scan_finished, | ||
8363 | .scan_start = scsih_scan_start, | ||
8364 | .change_queue_depth = scsih_change_queue_depth, | ||
8365 | .eh_abort_handler = scsih_abort, | ||
8366 | .eh_device_reset_handler = scsih_dev_reset, | ||
8367 | .eh_target_reset_handler = scsih_target_reset, | ||
8368 | .eh_host_reset_handler = scsih_host_reset, | ||
8369 | .bios_param = scsih_bios_param, | ||
8370 | .can_queue = 1, | ||
8371 | .this_id = -1, | ||
8372 | .sg_tablesize = MPT3SAS_SG_DEPTH, | ||
8373 | .max_sectors = 32767, | ||
8374 | .cmd_per_lun = 7, | ||
8375 | .use_clustering = ENABLE_CLUSTERING, | ||
8376 | .shost_attrs = mpt3sas_host_attrs, | ||
8377 | .sdev_attrs = mpt3sas_dev_attrs, | ||
8378 | .track_queue_depth = 1, | ||
8379 | }; | ||
8380 | |||
8381 | /* raid transport support for SAS 3.0 HBA devices */ | ||
8382 | static struct raid_function_template mpt3sas_raid_functions = { | ||
8383 | .cookie = &mpt3sas_driver_template, | ||
8384 | .is_raid = scsih_is_raid, | ||
8385 | .get_resync = scsih_get_resync, | ||
8386 | .get_state = scsih_get_state, | ||
8387 | }; | ||
8388 | |||
8389 | /** | ||
8390 | * _scsih_determine_hba_mpi_version - determine in which MPI version class | ||
8391 | * this device belongs to. | ||
8392 | * @pdev: PCI device struct | ||
8393 | * | ||
8394 | * return MPI2_VERSION for SAS 2.0 HBA devices, | ||
8395 | * MPI25_VERSION for SAS 3.0 HBA devices. | ||
8396 | */ | ||
8397 | u16 | ||
8398 | _scsih_determine_hba_mpi_version(struct pci_dev *pdev) | ||
8399 | { | ||
8400 | |||
8401 | switch (pdev->device) { | ||
8333 | case MPI2_MFGPAGE_DEVID_SSS6200: | 8402 | case MPI2_MFGPAGE_DEVID_SSS6200: |
8334 | ioc->is_warpdrive = 1; | ||
8335 | ioc->hide_ir_msg = 1; | ||
8336 | case MPI2_MFGPAGE_DEVID_SAS2004: | 8403 | case MPI2_MFGPAGE_DEVID_SAS2004: |
8337 | case MPI2_MFGPAGE_DEVID_SAS2008: | 8404 | case MPI2_MFGPAGE_DEVID_SAS2008: |
8338 | case MPI2_MFGPAGE_DEVID_SAS2108_1: | 8405 | case MPI2_MFGPAGE_DEVID_SAS2108_1: |
@@ -8349,52 +8416,91 @@ _scsih_determine_hba_mpi_version(struct MPT3SAS_ADAPTER *ioc) { | |||
8349 | case MPI2_MFGPAGE_DEVID_SAS2308_1: | 8416 | case MPI2_MFGPAGE_DEVID_SAS2308_1: |
8350 | case MPI2_MFGPAGE_DEVID_SAS2308_2: | 8417 | case MPI2_MFGPAGE_DEVID_SAS2308_2: |
8351 | case MPI2_MFGPAGE_DEVID_SAS2308_3: | 8418 | case MPI2_MFGPAGE_DEVID_SAS2308_3: |
8352 | ioc->hba_mpi_version_belonged = MPI2_VERSION; | 8419 | return MPI2_VERSION; |
8353 | break; | ||
8354 | case MPI25_MFGPAGE_DEVID_SAS3004: | 8420 | case MPI25_MFGPAGE_DEVID_SAS3004: |
8355 | case MPI25_MFGPAGE_DEVID_SAS3008: | 8421 | case MPI25_MFGPAGE_DEVID_SAS3008: |
8356 | case MPI25_MFGPAGE_DEVID_SAS3108_1: | 8422 | case MPI25_MFGPAGE_DEVID_SAS3108_1: |
8357 | case MPI25_MFGPAGE_DEVID_SAS3108_2: | 8423 | case MPI25_MFGPAGE_DEVID_SAS3108_2: |
8358 | case MPI25_MFGPAGE_DEVID_SAS3108_5: | 8424 | case MPI25_MFGPAGE_DEVID_SAS3108_5: |
8359 | case MPI25_MFGPAGE_DEVID_SAS3108_6: | 8425 | case MPI25_MFGPAGE_DEVID_SAS3108_6: |
8360 | ioc->hba_mpi_version_belonged = MPI25_VERSION; | 8426 | return MPI25_VERSION; |
8361 | |||
8362 | /* Check whether the controller revision is C0 or above. | ||
8363 | * only C0 and above revision controllers support 96 MSI-X | ||
8364 | * vectors. | ||
8365 | */ | ||
8366 | if (ioc->pdev->revision >= SAS3_PCI_DEVICE_C0_REVISION) | ||
8367 | ioc->msix96_vector = 1; | ||
8368 | break; | ||
8369 | } | 8427 | } |
8370 | 8428 | return 0; | |
8371 | if ((ioc->pdev->device != MPI2_MFGPAGE_DEVID_SSS6200) && | ||
8372 | (ioc->hba_mpi_version_belonged == MPI2_VERSION)) | ||
8373 | ioc->mfg_pg10_hide_flag = MFG_PAGE10_EXPOSE_ALL_DISKS; | ||
8374 | } | 8429 | } |
8375 | 8430 | ||
8376 | /** | 8431 | /** |
8377 | * scsih_probe - attach and add scsi host | 8432 | * _scsih_probe - attach and add scsi host |
8378 | * @pdev: PCI device struct | 8433 | * @pdev: PCI device struct |
8379 | * @id: pci device id | 8434 | * @id: pci device id |
8380 | * | 8435 | * |
8381 | * Returns 0 success, anything else error. | 8436 | * Returns 0 success, anything else error. |
8382 | */ | 8437 | */ |
8383 | int | 8438 | int |
8384 | scsih_probe(struct pci_dev *pdev, struct Scsi_Host *shost) | 8439 | _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
8385 | { | 8440 | { |
8386 | struct MPT3SAS_ADAPTER *ioc; | 8441 | struct MPT3SAS_ADAPTER *ioc; |
8442 | struct Scsi_Host *shost = NULL; | ||
8387 | int rv; | 8443 | int rv; |
8444 | u16 hba_mpi_version; | ||
8445 | |||
8446 | /* Determine in which MPI version class this pci device belongs */ | ||
8447 | hba_mpi_version = _scsih_determine_hba_mpi_version(pdev); | ||
8448 | if (hba_mpi_version == 0) | ||
8449 | return -ENODEV; | ||
8450 | |||
8451 | /* Enumerate only SAS 2.0 HBA's if hbas_to_enumerate is one, | ||
8452 | * for other generation HBA's return with -ENODEV | ||
8453 | */ | ||
8454 | if ((hbas_to_enumerate == 1) && (hba_mpi_version != MPI2_VERSION)) | ||
8455 | return -ENODEV; | ||
8456 | |||
8457 | /* Enumerate only SAS 3.0 HBA's if hbas_to_enumerate is two, | ||
8458 | * for other generation HBA's return with -ENODEV | ||
8459 | */ | ||
8460 | if ((hbas_to_enumerate == 2) && (hba_mpi_version != MPI25_VERSION)) | ||
8461 | return -ENODEV; | ||
8462 | |||
8463 | switch (hba_mpi_version) { | ||
8464 | case MPI2_VERSION: | ||
8465 | /* Use mpt2sas driver host template for SAS 2.0 HBA's */ | ||
8466 | shost = scsi_host_alloc(&mpt2sas_driver_template, | ||
8467 | sizeof(struct MPT3SAS_ADAPTER)); | ||
8468 | if (!shost) | ||
8469 | return -ENODEV; | ||
8470 | ioc = shost_priv(shost); | ||
8471 | memset(ioc, 0, sizeof(struct MPT3SAS_ADAPTER)); | ||
8472 | ioc->hba_mpi_version_belonged = hba_mpi_version; | ||
8473 | ioc->id = mpt2_ids++; | ||
8474 | sprintf(ioc->driver_name, "%s", MPT2SAS_DRIVER_NAME); | ||
8475 | if (pdev->device == MPI2_MFGPAGE_DEVID_SSS6200) { | ||
8476 | ioc->is_warpdrive = 1; | ||
8477 | ioc->hide_ir_msg = 1; | ||
8478 | } else | ||
8479 | ioc->mfg_pg10_hide_flag = MFG_PAGE10_EXPOSE_ALL_DISKS; | ||
8480 | break; | ||
8481 | case MPI25_VERSION: | ||
8482 | /* Use mpt3sas driver host template for SAS 3.0 HBA's */ | ||
8483 | shost = scsi_host_alloc(&mpt3sas_driver_template, | ||
8484 | sizeof(struct MPT3SAS_ADAPTER)); | ||
8485 | if (!shost) | ||
8486 | return -ENODEV; | ||
8487 | ioc = shost_priv(shost); | ||
8488 | memset(ioc, 0, sizeof(struct MPT3SAS_ADAPTER)); | ||
8489 | ioc->hba_mpi_version_belonged = hba_mpi_version; | ||
8490 | ioc->id = mpt3_ids++; | ||
8491 | sprintf(ioc->driver_name, "%s", MPT3SAS_DRIVER_NAME); | ||
8492 | if (pdev->revision >= SAS3_PCI_DEVICE_C0_REVISION) | ||
8493 | ioc->msix96_vector = 1; | ||
8494 | break; | ||
8495 | default: | ||
8496 | return -ENODEV; | ||
8497 | } | ||
8388 | 8498 | ||
8389 | /* init local params */ | ||
8390 | ioc = shost_priv(shost); | ||
8391 | memset(ioc, 0, sizeof(struct MPT3SAS_ADAPTER)); | ||
8392 | INIT_LIST_HEAD(&ioc->list); | 8499 | INIT_LIST_HEAD(&ioc->list); |
8393 | spin_lock(&gioc_lock); | 8500 | spin_lock(&gioc_lock); |
8394 | list_add_tail(&ioc->list, &mpt3sas_ioc_list); | 8501 | list_add_tail(&ioc->list, &mpt3sas_ioc_list); |
8395 | spin_unlock(&gioc_lock); | 8502 | spin_unlock(&gioc_lock); |
8396 | ioc->shost = shost; | 8503 | ioc->shost = shost; |
8397 | ioc->id = mpt_ids++; | ||
8398 | ioc->pdev = pdev; | 8504 | ioc->pdev = pdev; |
8399 | ioc->scsi_io_cb_idx = scsi_io_cb_idx; | 8505 | ioc->scsi_io_cb_idx = scsi_io_cb_idx; |
8400 | ioc->tm_cb_idx = tm_cb_idx; | 8506 | ioc->tm_cb_idx = tm_cb_idx; |
@@ -8431,8 +8537,7 @@ scsih_probe(struct pci_dev *pdev, struct Scsi_Host *shost) | |||
8431 | INIT_LIST_HEAD(&ioc->delayed_tr_volume_list); | 8537 | INIT_LIST_HEAD(&ioc->delayed_tr_volume_list); |
8432 | INIT_LIST_HEAD(&ioc->reply_queue_list); | 8538 | INIT_LIST_HEAD(&ioc->reply_queue_list); |
8433 | 8539 | ||
8434 | _scsih_determine_hba_mpi_version(ioc); | 8540 | sprintf(ioc->name, "%s_cm%d", ioc->driver_name, ioc->id); |
8435 | sprintf(ioc->name, "%s_cm%d", driver_name, ioc->id); | ||
8436 | 8541 | ||
8437 | /* init shost parameters */ | 8542 | /* init shost parameters */ |
8438 | shost->max_cmd_len = 32; | 8543 | shost->max_cmd_len = 32; |
@@ -8472,7 +8577,7 @@ scsih_probe(struct pci_dev *pdev, struct Scsi_Host *shost) | |||
8472 | 8577 | ||
8473 | /* event thread */ | 8578 | /* event thread */ |
8474 | snprintf(ioc->firmware_event_name, sizeof(ioc->firmware_event_name), | 8579 | snprintf(ioc->firmware_event_name, sizeof(ioc->firmware_event_name), |
8475 | "fw_event%d", ioc->id); | 8580 | "fw_event_%s%d", ioc->driver_name, ioc->id); |
8476 | ioc->firmware_event_thread = alloc_ordered_workqueue( | 8581 | ioc->firmware_event_thread = alloc_ordered_workqueue( |
8477 | ioc->firmware_event_name, WQ_MEM_RECLAIM); | 8582 | ioc->firmware_event_name, WQ_MEM_RECLAIM); |
8478 | if (!ioc->firmware_event_thread) { | 8583 | if (!ioc->firmware_event_thread) { |
@@ -8490,21 +8595,19 @@ scsih_probe(struct pci_dev *pdev, struct Scsi_Host *shost) | |||
8490 | goto out_attach_fail; | 8595 | goto out_attach_fail; |
8491 | } | 8596 | } |
8492 | 8597 | ||
8493 | #ifdef SCSI_MPT2SAS | ||
8494 | if (ioc->is_warpdrive) { | 8598 | if (ioc->is_warpdrive) { |
8495 | if (ioc->mfg_pg10_hide_flag == MFG_PAGE10_EXPOSE_ALL_DISKS) | 8599 | if (ioc->mfg_pg10_hide_flag == MFG_PAGE10_EXPOSE_ALL_DISKS) |
8496 | ioc->hide_drives = 0; | 8600 | ioc->hide_drives = 0; |
8497 | else if (ioc->mfg_pg10_hide_flag == MFG_PAGE10_HIDE_ALL_DISKS) | 8601 | else if (ioc->mfg_pg10_hide_flag == MFG_PAGE10_HIDE_ALL_DISKS) |
8498 | ioc->hide_drives = 1; | 8602 | ioc->hide_drives = 1; |
8499 | else { | 8603 | else { |
8500 | if (_scsih_get_num_volumes(ioc)) | 8604 | if (mpt3sas_get_num_volumes(ioc)) |
8501 | ioc->hide_drives = 1; | 8605 | ioc->hide_drives = 1; |
8502 | else | 8606 | else |
8503 | ioc->hide_drives = 0; | 8607 | ioc->hide_drives = 0; |
8504 | } | 8608 | } |
8505 | } else | 8609 | } else |
8506 | ioc->hide_drives = 0; | 8610 | ioc->hide_drives = 0; |
8507 | #endif | ||
8508 | 8611 | ||
8509 | rv = scsi_add_host(shost, &pdev->dev); | 8612 | rv = scsi_add_host(shost, &pdev->dev); |
8510 | if (rv) { | 8613 | if (rv) { |
@@ -8705,6 +8808,89 @@ scsih_pci_mmio_enabled(struct pci_dev *pdev) | |||
8705 | return PCI_ERS_RESULT_NEED_RESET; | 8808 | return PCI_ERS_RESULT_NEED_RESET; |
8706 | } | 8809 | } |
8707 | 8810 | ||
8811 | /* | ||
8812 | * The pci device ids are defined in mpi/mpi2_cnfg.h. | ||
8813 | */ | ||
8814 | static const struct pci_device_id mpt3sas_pci_table[] = { | ||
8815 | /* Spitfire ~ 2004 */ | ||
8816 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2004, | ||
8817 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8818 | /* Falcon ~ 2008 */ | ||
8819 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2008, | ||
8820 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8821 | /* Liberator ~ 2108 */ | ||
8822 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2108_1, | ||
8823 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8824 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2108_2, | ||
8825 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8826 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2108_3, | ||
8827 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8828 | /* Meteor ~ 2116 */ | ||
8829 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2116_1, | ||
8830 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8831 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2116_2, | ||
8832 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8833 | /* Thunderbolt ~ 2208 */ | ||
8834 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_1, | ||
8835 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8836 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_2, | ||
8837 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8838 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_3, | ||
8839 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8840 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_4, | ||
8841 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8842 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_5, | ||
8843 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8844 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_6, | ||
8845 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8846 | /* Mustang ~ 2308 */ | ||
8847 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_1, | ||
8848 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8849 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_2, | ||
8850 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8851 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_3, | ||
8852 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8853 | /* SSS6200 */ | ||
8854 | { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SSS6200, | ||
8855 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8856 | /* Fury ~ 3004 and 3008 */ | ||
8857 | { MPI2_MFGPAGE_VENDORID_LSI, MPI25_MFGPAGE_DEVID_SAS3004, | ||
8858 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8859 | { MPI2_MFGPAGE_VENDORID_LSI, MPI25_MFGPAGE_DEVID_SAS3008, | ||
8860 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8861 | /* Invader ~ 3108 */ | ||
8862 | { MPI2_MFGPAGE_VENDORID_LSI, MPI25_MFGPAGE_DEVID_SAS3108_1, | ||
8863 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8864 | { MPI2_MFGPAGE_VENDORID_LSI, MPI25_MFGPAGE_DEVID_SAS3108_2, | ||
8865 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8866 | { MPI2_MFGPAGE_VENDORID_LSI, MPI25_MFGPAGE_DEVID_SAS3108_5, | ||
8867 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8868 | { MPI2_MFGPAGE_VENDORID_LSI, MPI25_MFGPAGE_DEVID_SAS3108_6, | ||
8869 | PCI_ANY_ID, PCI_ANY_ID }, | ||
8870 | {0} /* Terminating entry */ | ||
8871 | }; | ||
8872 | MODULE_DEVICE_TABLE(pci, mpt3sas_pci_table); | ||
8873 | |||
8874 | static struct pci_error_handlers _mpt3sas_err_handler = { | ||
8875 | .error_detected = scsih_pci_error_detected, | ||
8876 | .mmio_enabled = scsih_pci_mmio_enabled, | ||
8877 | .slot_reset = scsih_pci_slot_reset, | ||
8878 | .resume = scsih_pci_resume, | ||
8879 | }; | ||
8880 | |||
8881 | static struct pci_driver mpt3sas_driver = { | ||
8882 | .name = MPT3SAS_DRIVER_NAME, | ||
8883 | .id_table = mpt3sas_pci_table, | ||
8884 | .probe = _scsih_probe, | ||
8885 | .remove = scsih_remove, | ||
8886 | .shutdown = scsih_shutdown, | ||
8887 | .err_handler = &_mpt3sas_err_handler, | ||
8888 | #ifdef CONFIG_PM | ||
8889 | .suspend = scsih_suspend, | ||
8890 | .resume = scsih_resume, | ||
8891 | #endif | ||
8892 | }; | ||
8893 | |||
8708 | /** | 8894 | /** |
8709 | * scsih_init - main entry point for this driver. | 8895 | * scsih_init - main entry point for this driver. |
8710 | * | 8896 | * |
@@ -8713,7 +8899,8 @@ scsih_pci_mmio_enabled(struct pci_dev *pdev) | |||
8713 | int | 8899 | int |
8714 | scsih_init(void) | 8900 | scsih_init(void) |
8715 | { | 8901 | { |
8716 | mpt_ids = 0; | 8902 | mpt2_ids = 0; |
8903 | mpt3_ids = 0; | ||
8717 | 8904 | ||
8718 | mpt3sas_base_initialize_callback_handler(); | 8905 | mpt3sas_base_initialize_callback_handler(); |
8719 | 8906 | ||
@@ -8777,10 +8964,86 @@ scsih_exit(void) | |||
8777 | mpt3sas_base_release_callback_handler(tm_sas_control_cb_idx); | 8964 | mpt3sas_base_release_callback_handler(tm_sas_control_cb_idx); |
8778 | 8965 | ||
8779 | /* raid transport support */ | 8966 | /* raid transport support */ |
8780 | raid_class_release(mpt3sas_raid_template); | 8967 | if (hbas_to_enumerate != 1) |
8968 | raid_class_release(mpt3sas_raid_template); | ||
8969 | if (hbas_to_enumerate != 2) | ||
8970 | raid_class_release(mpt2sas_raid_template); | ||
8781 | sas_release_transport(mpt3sas_transport_template); | 8971 | sas_release_transport(mpt3sas_transport_template); |
8782 | } | 8972 | } |
8783 | 8973 | ||
8784 | #ifdef SCSI_MPT2SAS | 8974 | /** |
8785 | #include "../mpt2sas/mpt2sas_warpdrive.c" | 8975 | * _mpt3sas_init - main entry point for this driver. |
8786 | #endif | 8976 | * |
8977 | * Returns 0 success, anything else error. | ||
8978 | */ | ||
8979 | static int __init | ||
8980 | _mpt3sas_init(void) | ||
8981 | { | ||
8982 | int error; | ||
8983 | |||
8984 | pr_info("%s version %s loaded\n", MPT3SAS_DRIVER_NAME, | ||
8985 | MPT3SAS_DRIVER_VERSION); | ||
8986 | |||
8987 | mpt3sas_transport_template = | ||
8988 | sas_attach_transport(&mpt3sas_transport_functions); | ||
8989 | if (!mpt3sas_transport_template) | ||
8990 | return -ENODEV; | ||
8991 | |||
8992 | /* No need attach mpt3sas raid functions template | ||
8993 | * if hbas_to_enumarate value is one. | ||
8994 | */ | ||
8995 | if (hbas_to_enumerate != 1) { | ||
8996 | mpt3sas_raid_template = | ||
8997 | raid_class_attach(&mpt3sas_raid_functions); | ||
8998 | if (!mpt3sas_raid_template) { | ||
8999 | sas_release_transport(mpt3sas_transport_template); | ||
9000 | return -ENODEV; | ||
9001 | } | ||
9002 | } | ||
9003 | |||
9004 | /* No need to attach mpt2sas raid functions template | ||
9005 | * if hbas_to_enumarate value is two | ||
9006 | */ | ||
9007 | if (hbas_to_enumerate != 2) { | ||
9008 | mpt2sas_raid_template = | ||
9009 | raid_class_attach(&mpt2sas_raid_functions); | ||
9010 | if (!mpt2sas_raid_template) { | ||
9011 | sas_release_transport(mpt3sas_transport_template); | ||
9012 | return -ENODEV; | ||
9013 | } | ||
9014 | } | ||
9015 | |||
9016 | error = scsih_init(); | ||
9017 | if (error) { | ||
9018 | scsih_exit(); | ||
9019 | return error; | ||
9020 | } | ||
9021 | |||
9022 | mpt3sas_ctl_init(hbas_to_enumerate); | ||
9023 | |||
9024 | error = pci_register_driver(&mpt3sas_driver); | ||
9025 | if (error) | ||
9026 | scsih_exit(); | ||
9027 | |||
9028 | return error; | ||
9029 | } | ||
9030 | |||
9031 | /** | ||
9032 | * _mpt3sas_exit - exit point for this driver (when it is a module). | ||
9033 | * | ||
9034 | */ | ||
9035 | static void __exit | ||
9036 | _mpt3sas_exit(void) | ||
9037 | { | ||
9038 | pr_info("mpt3sas version %s unloading\n", | ||
9039 | MPT3SAS_DRIVER_VERSION); | ||
9040 | |||
9041 | pci_unregister_driver(&mpt3sas_driver); | ||
9042 | |||
9043 | mpt3sas_ctl_exit(hbas_to_enumerate); | ||
9044 | |||
9045 | scsih_exit(); | ||
9046 | } | ||
9047 | |||
9048 | module_init(_mpt3sas_init); | ||
9049 | module_exit(_mpt3sas_exit); | ||
diff --git a/drivers/scsi/mpt2sas/mpt2sas_warpdrive.c b/drivers/scsi/mpt3sas/mpt3sas_warpdrive.c index c4fcbc227346..540bd5005149 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_warpdrive.c +++ b/drivers/scsi/mpt3sas/mpt3sas_warpdrive.c | |||
@@ -38,13 +38,20 @@ | |||
38 | * You should have received a copy of the GNU General Public License | 38 | * You should have received a copy of the GNU General Public License |
39 | * along with this program. | 39 | * along with this program. |
40 | */ | 40 | */ |
41 | #include <linux/kernel.h> | ||
42 | #include <linux/module.h> | ||
43 | #include <linux/errno.h> | ||
44 | #include <linux/types.h> | ||
45 | #include <asm/unaligned.h> | ||
46 | |||
47 | #include "mpt3sas_base.h" | ||
41 | 48 | ||
42 | /** | 49 | /** |
43 | * _scsih_disable_ddio - Disable direct I/O for all the volumes | 50 | * _warpdrive_disable_ddio - Disable direct I/O for all the volumes |
44 | * @ioc: per adapter object | 51 | * @ioc: per adapter object |
45 | */ | 52 | */ |
46 | static void | 53 | static void |
47 | _scsih_disable_ddio(struct MPT3SAS_ADAPTER *ioc) | 54 | _warpdrive_disable_ddio(struct MPT3SAS_ADAPTER *ioc) |
48 | { | 55 | { |
49 | Mpi2RaidVolPage1_t vol_pg1; | 56 | Mpi2RaidVolPage1_t vol_pg1; |
50 | Mpi2ConfigReply_t mpi_reply; | 57 | Mpi2ConfigReply_t mpi_reply; |
@@ -62,7 +69,7 @@ _scsih_disable_ddio(struct MPT3SAS_ADAPTER *ioc) | |||
62 | break; | 69 | break; |
63 | handle = le16_to_cpu(vol_pg1.DevHandle); | 70 | handle = le16_to_cpu(vol_pg1.DevHandle); |
64 | spin_lock_irqsave(&ioc->raid_device_lock, flags); | 71 | spin_lock_irqsave(&ioc->raid_device_lock, flags); |
65 | raid_device = _scsih_raid_device_find_by_handle(ioc, handle); | 72 | raid_device = mpt3sas_raid_device_find_by_handle(ioc, handle); |
66 | if (raid_device) | 73 | if (raid_device) |
67 | raid_device->direct_io_enabled = 0; | 74 | raid_device->direct_io_enabled = 0; |
68 | spin_unlock_irqrestore(&ioc->raid_device_lock, flags); | 75 | spin_unlock_irqrestore(&ioc->raid_device_lock, flags); |
@@ -72,11 +79,11 @@ _scsih_disable_ddio(struct MPT3SAS_ADAPTER *ioc) | |||
72 | 79 | ||
73 | 80 | ||
74 | /** | 81 | /** |
75 | * _scsih_get_num_volumes - Get number of volumes in the ioc | 82 | * mpt3sas_get_num_volumes - Get number of volumes in the ioc |
76 | * @ioc: per adapter object | 83 | * @ioc: per adapter object |
77 | */ | 84 | */ |
78 | static u8 | 85 | u8 |
79 | _scsih_get_num_volumes(struct MPT3SAS_ADAPTER *ioc) | 86 | mpt3sas_get_num_volumes(struct MPT3SAS_ADAPTER *ioc) |
80 | { | 87 | { |
81 | Mpi2RaidVolPage1_t vol_pg1; | 88 | Mpi2RaidVolPage1_t vol_pg1; |
82 | Mpi2ConfigReply_t mpi_reply; | 89 | Mpi2ConfigReply_t mpi_reply; |
@@ -99,12 +106,12 @@ _scsih_get_num_volumes(struct MPT3SAS_ADAPTER *ioc) | |||
99 | 106 | ||
100 | 107 | ||
101 | /** | 108 | /** |
102 | * _scsih_init_warpdrive_properties - Set properties for warpdrive direct I/O. | 109 | * mpt3sas_init_warpdrive_properties - Set properties for warpdrive direct I/O. |
103 | * @ioc: per adapter object | 110 | * @ioc: per adapter object |
104 | * @raid_device: the raid_device object | 111 | * @raid_device: the raid_device object |
105 | */ | 112 | */ |
106 | static void | 113 | void |
107 | _scsih_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, | 114 | mpt3sas_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, |
108 | struct _raid_device *raid_device) | 115 | struct _raid_device *raid_device) |
109 | { | 116 | { |
110 | Mpi2RaidVolPage0_t *vol_pg0; | 117 | Mpi2RaidVolPage0_t *vol_pg0; |
@@ -124,8 +131,8 @@ _scsih_init_warpdrive_properties(struct MPT3SAS_ADAPTER *ioc, | |||
124 | "globally as drives are exposed\n", ioc->name); | 131 | "globally as drives are exposed\n", ioc->name); |
125 | return; | 132 | return; |
126 | } | 133 | } |
127 | if (_scsih_get_num_volumes(ioc) > 1) { | 134 | if (mpt3sas_get_num_volumes(ioc) > 1) { |
128 | _scsih_disable_ddio(ioc); | 135 | _warpdrive_disable_ddio(ioc); |
129 | pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " | 136 | pr_info(MPT3SAS_FMT "WarpDrive : Direct IO is disabled " |
130 | "globally as number of drives > 1\n", ioc->name); | 137 | "globally as number of drives > 1\n", ioc->name); |
131 | return; | 138 | return; |
@@ -254,34 +261,34 @@ out_error: | |||
254 | } | 261 | } |
255 | 262 | ||
256 | /** | 263 | /** |
257 | * _scsih_scsi_direct_io_get - returns direct io flag | 264 | * mpt3sas_scsi_direct_io_get - returns direct io flag |
258 | * @ioc: per adapter object | 265 | * @ioc: per adapter object |
259 | * @smid: system request message index | 266 | * @smid: system request message index |
260 | * | 267 | * |
261 | * Returns the smid stored scmd pointer. | 268 | * Returns the smid stored scmd pointer. |
262 | */ | 269 | */ |
263 | static inline u8 | 270 | inline u8 |
264 | _scsih_scsi_direct_io_get(struct MPT3SAS_ADAPTER *ioc, u16 smid) | 271 | mpt3sas_scsi_direct_io_get(struct MPT3SAS_ADAPTER *ioc, u16 smid) |
265 | { | 272 | { |
266 | return ioc->scsi_lookup[smid - 1].direct_io; | 273 | return ioc->scsi_lookup[smid - 1].direct_io; |
267 | } | 274 | } |
268 | 275 | ||
269 | /** | 276 | /** |
270 | * _scsih_scsi_direct_io_set - sets direct io flag | 277 | * mpt3sas_scsi_direct_io_set - sets direct io flag |
271 | * @ioc: per adapter object | 278 | * @ioc: per adapter object |
272 | * @smid: system request message index | 279 | * @smid: system request message index |
273 | * @direct_io: Zero or non-zero value to set in the direct_io flag | 280 | * @direct_io: Zero or non-zero value to set in the direct_io flag |
274 | * | 281 | * |
275 | * Returns Nothing. | 282 | * Returns Nothing. |
276 | */ | 283 | */ |
277 | static inline void | 284 | inline void |
278 | _scsih_scsi_direct_io_set(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 direct_io) | 285 | mpt3sas_scsi_direct_io_set(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 direct_io) |
279 | { | 286 | { |
280 | ioc->scsi_lookup[smid - 1].direct_io = direct_io; | 287 | ioc->scsi_lookup[smid - 1].direct_io = direct_io; |
281 | } | 288 | } |
282 | 289 | ||
283 | /** | 290 | /** |
284 | * _scsih_setup_direct_io - setup MPI request for WARPDRIVE Direct I/O | 291 | * mpt3sas_setup_direct_io - setup MPI request for WARPDRIVE Direct I/O |
285 | * @ioc: per adapter object | 292 | * @ioc: per adapter object |
286 | * @scmd: pointer to scsi command object | 293 | * @scmd: pointer to scsi command object |
287 | * @raid_device: pointer to raid device data structure | 294 | * @raid_device: pointer to raid device data structure |
@@ -290,12 +297,12 @@ _scsih_scsi_direct_io_set(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 direct_io) | |||
290 | * | 297 | * |
291 | * Returns nothing | 298 | * Returns nothing |
292 | */ | 299 | */ |
293 | static void | 300 | void |
294 | _scsih_setup_direct_io(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, | 301 | mpt3sas_setup_direct_io(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, |
295 | struct _raid_device *raid_device, Mpi2SCSIIORequest_t *mpi_request, | 302 | struct _raid_device *raid_device, Mpi2SCSIIORequest_t *mpi_request, |
296 | u16 smid) | 303 | u16 smid) |
297 | { | 304 | { |
298 | sector_t v_lba, p_lba, stripe_off, stripe_unit, column, io_size; | 305 | sector_t v_lba, p_lba, stripe_off, column, io_size; |
299 | u32 stripe_sz, stripe_exp; | 306 | u32 stripe_sz, stripe_exp; |
300 | u8 num_pds, cmd = scmd->cmnd[0]; | 307 | u8 num_pds, cmd = scmd->cmnd[0]; |
301 | 308 | ||
@@ -323,9 +330,8 @@ _scsih_setup_direct_io(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, | |||
323 | 330 | ||
324 | num_pds = raid_device->num_pds; | 331 | num_pds = raid_device->num_pds; |
325 | p_lba = v_lba >> stripe_exp; | 332 | p_lba = v_lba >> stripe_exp; |
326 | stripe_unit = p_lba / num_pds; | 333 | column = sector_div(p_lba, num_pds); |
327 | column = p_lba % num_pds; | 334 | p_lba = (p_lba << stripe_exp) + stripe_off; |
328 | p_lba = (stripe_unit << stripe_exp) + stripe_off; | ||
329 | mpi_request->DevHandle = cpu_to_le16(raid_device->pd_handle[column]); | 335 | mpi_request->DevHandle = cpu_to_le16(raid_device->pd_handle[column]); |
330 | 336 | ||
331 | if (cmd == READ_10 || cmd == WRITE_10) | 337 | if (cmd == READ_10 || cmd == WRITE_10) |
@@ -334,5 +340,5 @@ _scsih_setup_direct_io(struct MPT3SAS_ADAPTER *ioc, struct scsi_cmnd *scmd, | |||
334 | else | 340 | else |
335 | put_unaligned_be64(p_lba, &mpi_request->CDB.CDB32[2]); | 341 | put_unaligned_be64(p_lba, &mpi_request->CDB.CDB32[2]); |
336 | 342 | ||
337 | _scsih_scsi_direct_io_set(ioc, smid, 1); | 343 | mpt3sas_scsi_direct_io_set(ioc, smid, 1); |
338 | } | 344 | } |