diff options
author | Moore, Eric Dean <Eric.Moore@lsil.com> | 2005-04-22 18:02:25 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-05-20 13:53:21 -0400 |
commit | 243eabcf6b9ab86ec1bc44c2bbb1ee9766481d16 (patch) | |
tree | cd06c235994fb3a2460062a227598db1ba680ed5 /drivers/message/fusion | |
parent | 0d0c79747e362ff54adc6418d2990d49cad9395d (diff) |
[SCSI] mptfusion: mptspi Adding Stub Driver - SCSI Parallel
(1) mptspi.c: This driver is having module_init, module_exit, and probe.
(2) mptspi.c: Registering for SCSI pci ids are done from this module.
(3) mptspi.c: Convert MODULE_PARM to module_param
Signed-off-by: Eric Moore <Eric.Moore@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message/fusion')
-rw-r--r-- | drivers/message/fusion/mptspi.c | 487 |
1 files changed, 487 insertions, 0 deletions
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c new file mode 100644 index 000000000000..a4e3c96524e7 --- /dev/null +++ b/drivers/message/fusion/mptspi.c | |||
@@ -0,0 +1,487 @@ | |||
1 | /* | ||
2 | * linux/drivers/message/fusion/mptspi.c | ||
3 | * For use with LSI Logic PCI chip/adapter(s) | ||
4 | * running LSI Logic Fusion MPT (Message Passing Technology) firmware. | ||
5 | * | ||
6 | * Copyright (c) 1999-2005 LSI Logic Corporation | ||
7 | * (mailto:mpt_linux_developer@lsil.com) | ||
8 | * | ||
9 | */ | ||
10 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
11 | /* | ||
12 | This program is free software; you can redistribute it and/or modify | ||
13 | it under the terms of the GNU General Public License as published by | ||
14 | the Free Software Foundation; version 2 of the License. | ||
15 | |||
16 | This program is distributed in the hope that it will be useful, | ||
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | GNU General Public License for more details. | ||
20 | |||
21 | NO WARRANTY | ||
22 | THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR | ||
23 | CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT | ||
24 | LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, | ||
25 | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is | ||
26 | solely responsible for determining the appropriateness of using and | ||
27 | distributing the Program and assumes all risks associated with its | ||
28 | exercise of rights under this Agreement, including but not limited to | ||
29 | the risks and costs of program errors, damage to or loss of data, | ||
30 | programs or equipment, and unavailability or interruption of operations. | ||
31 | |||
32 | DISCLAIMER OF LIABILITY | ||
33 | NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY | ||
34 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
35 | DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND | ||
36 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
37 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
38 | USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED | ||
39 | HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES | ||
40 | |||
41 | You should have received a copy of the GNU General Public License | ||
42 | along with this program; if not, write to the Free Software | ||
43 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
44 | */ | ||
45 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
46 | |||
47 | #include "linux_compat.h" /* linux-2.6 tweaks */ | ||
48 | #include <linux/module.h> | ||
49 | #include <linux/kernel.h> | ||
50 | #include <linux/init.h> | ||
51 | #include <linux/errno.h> | ||
52 | #include <linux/kdev_t.h> | ||
53 | #include <linux/blkdev.h> | ||
54 | #include <linux/delay.h> /* for mdelay */ | ||
55 | #include <linux/interrupt.h> /* needed for in_interrupt() proto */ | ||
56 | #include <linux/reboot.h> /* notifier code */ | ||
57 | #include <linux/sched.h> | ||
58 | #include <linux/workqueue.h> | ||
59 | |||
60 | #include <scsi/scsi.h> | ||
61 | #include <scsi/scsi_cmnd.h> | ||
62 | #include <scsi/scsi_device.h> | ||
63 | #include <scsi/scsi_host.h> | ||
64 | #include <scsi/scsi_tcq.h> | ||
65 | |||
66 | #include "mptbase.h" | ||
67 | #include "mptscsih.h" | ||
68 | |||
69 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
70 | #define my_NAME "Fusion MPT SPI Host driver" | ||
71 | #define my_VERSION MPT_LINUX_VERSION_COMMON | ||
72 | #define MYNAM "mptspi" | ||
73 | |||
74 | MODULE_AUTHOR(MODULEAUTHOR); | ||
75 | MODULE_DESCRIPTION(my_NAME); | ||
76 | MODULE_LICENSE("GPL"); | ||
77 | |||
78 | /* Command line args */ | ||
79 | #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION | ||
80 | static int mpt_dv = MPTSCSIH_DOMAIN_VALIDATION; | ||
81 | module_param(mpt_dv, int, 0); | ||
82 | MODULE_PARM_DESC(mpt_dv, " DV Algorithm: enhanced=1, basic=0 (default=MPTSCSIH_DOMAIN_VALIDATION=1)"); | ||
83 | |||
84 | static int mpt_width = MPTSCSIH_MAX_WIDTH; | ||
85 | module_param(mpt_width, int, 0); | ||
86 | MODULE_PARM_DESC(mpt_width, " Max Bus Width: wide=1, narrow=0 (default=MPTSCSIH_MAX_WIDTH=1)"); | ||
87 | |||
88 | static ushort mpt_factor = MPTSCSIH_MIN_SYNC; | ||
89 | module_param(mpt_factor, ushort, 0); | ||
90 | MODULE_PARM_DESC(mpt_factor, " Min Sync Factor (default=MPTSCSIH_MIN_SYNC=0x08)"); | ||
91 | #endif | ||
92 | |||
93 | static int mpt_saf_te = MPTSCSIH_SAF_TE; | ||
94 | module_param(mpt_saf_te, int, 0); | ||
95 | MODULE_PARM_DESC(mpt_saf_te, " Force enabling SEP Processor: enable=1 (default=MPTSCSIH_SAF_TE=0)"); | ||
96 | |||
97 | static int mpt_pq_filter = 0; | ||
98 | module_param(mpt_pq_filter, int, 0); | ||
99 | MODULE_PARM_DESC(mpt_pq_filter, " Enable peripheral qualifier filter: enable=1 (default=0)"); | ||
100 | |||
101 | static int mptspiDoneCtx = -1; | ||
102 | static int mptspiTaskCtx = -1; | ||
103 | static int mptspiInternalCtx = -1; /* Used only for internal commands */ | ||
104 | |||
105 | static struct device_attribute mptspi_queue_depth_attr = { | ||
106 | .attr = { | ||
107 | .name = "queue_depth", | ||
108 | .mode = S_IWUSR, | ||
109 | }, | ||
110 | .store = mptscsih_store_queue_depth, | ||
111 | }; | ||
112 | |||
113 | static struct device_attribute *mptspi_dev_attrs[] = { | ||
114 | &mptspi_queue_depth_attr, | ||
115 | NULL, | ||
116 | }; | ||
117 | |||
118 | static struct scsi_host_template mptspi_driver_template = { | ||
119 | .proc_name = "mptspi", | ||
120 | .proc_info = mptscsih_proc_info, | ||
121 | .name = "MPT SPI Host", | ||
122 | .info = mptscsih_info, | ||
123 | .queuecommand = mptscsih_qcmd, | ||
124 | .slave_alloc = mptscsih_slave_alloc, | ||
125 | .slave_configure = mptscsih_slave_configure, | ||
126 | .slave_destroy = mptscsih_slave_destroy, | ||
127 | .eh_abort_handler = mptscsih_abort, | ||
128 | .eh_device_reset_handler = mptscsih_dev_reset, | ||
129 | .eh_bus_reset_handler = mptscsih_bus_reset, | ||
130 | .eh_host_reset_handler = mptscsih_host_reset, | ||
131 | .bios_param = mptscsih_bios_param, | ||
132 | .can_queue = MPT_SCSI_CAN_QUEUE, | ||
133 | .this_id = -1, | ||
134 | .sg_tablesize = MPT_SCSI_SG_DEPTH, | ||
135 | .max_sectors = 8192, | ||
136 | .cmd_per_lun = 7, | ||
137 | .use_clustering = ENABLE_CLUSTERING, | ||
138 | .sdev_attrs = mptspi_dev_attrs, | ||
139 | }; | ||
140 | |||
141 | |||
142 | /**************************************************************************** | ||
143 | * Supported hardware | ||
144 | */ | ||
145 | |||
146 | static struct pci_device_id mptspi_pci_table[] = { | ||
147 | { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_53C1030, | ||
148 | PCI_ANY_ID, PCI_ANY_ID }, | ||
149 | { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_1030_53C1035, | ||
150 | PCI_ANY_ID, PCI_ANY_ID }, | ||
151 | {0} /* Terminating entry */ | ||
152 | }; | ||
153 | MODULE_DEVICE_TABLE(pci, mptspi_pci_table); | ||
154 | |||
155 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
156 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
157 | /* | ||
158 | * mptspi_probe - Installs scsi devices per bus. | ||
159 | * @pdev: Pointer to pci_dev structure | ||
160 | * | ||
161 | * Returns 0 for success, non-zero for failure. | ||
162 | * | ||
163 | */ | ||
164 | static int | ||
165 | mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id) | ||
166 | { | ||
167 | struct Scsi_Host *sh; | ||
168 | MPT_SCSI_HOST *hd; | ||
169 | MPT_ADAPTER *ioc; | ||
170 | unsigned long flags; | ||
171 | int sz, ii; | ||
172 | int numSGE = 0; | ||
173 | int scale; | ||
174 | int ioc_cap; | ||
175 | u8 *mem; | ||
176 | int error=0; | ||
177 | int r; | ||
178 | |||
179 | if ((r = mpt_attach(pdev,id)) != 0) | ||
180 | return r; | ||
181 | |||
182 | ioc = pci_get_drvdata(pdev); | ||
183 | |||
184 | /* Added sanity check on readiness of the MPT adapter. | ||
185 | */ | ||
186 | if (ioc->last_state != MPI_IOC_STATE_OPERATIONAL) { | ||
187 | printk(MYIOC_s_WARN_FMT | ||
188 | "Skipping because it's not operational!\n", | ||
189 | ioc->name); | ||
190 | return -ENODEV; | ||
191 | } | ||
192 | |||
193 | if (!ioc->active) { | ||
194 | printk(MYIOC_s_WARN_FMT "Skipping because it's disabled!\n", | ||
195 | ioc->name); | ||
196 | return -ENODEV; | ||
197 | } | ||
198 | |||
199 | /* Sanity check - ensure at least 1 port is INITIATOR capable | ||
200 | */ | ||
201 | ioc_cap = 0; | ||
202 | for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) { | ||
203 | if (ioc->pfacts[ii].ProtocolFlags & | ||
204 | MPI_PORTFACTS_PROTOCOL_INITIATOR) | ||
205 | ioc_cap ++; | ||
206 | } | ||
207 | |||
208 | if (!ioc_cap) { | ||
209 | printk(MYIOC_s_WARN_FMT | ||
210 | "Skipping ioc=%p because SCSI Initiator mode is NOT enabled!\n", | ||
211 | ioc->name, ioc); | ||
212 | return -ENODEV; | ||
213 | } | ||
214 | |||
215 | sh = scsi_host_alloc(&mptspi_driver_template, sizeof(MPT_SCSI_HOST)); | ||
216 | |||
217 | if (!sh) { | ||
218 | printk(MYIOC_s_WARN_FMT | ||
219 | "Unable to register controller with SCSI subsystem\n", | ||
220 | ioc->name); | ||
221 | return -1; | ||
222 | } | ||
223 | |||
224 | spin_lock_irqsave(&ioc->FreeQlock, flags); | ||
225 | |||
226 | /* Attach the SCSI Host to the IOC structure | ||
227 | */ | ||
228 | ioc->sh = sh; | ||
229 | |||
230 | sh->io_port = 0; | ||
231 | sh->n_io_port = 0; | ||
232 | sh->irq = 0; | ||
233 | |||
234 | /* set 16 byte cdb's */ | ||
235 | sh->max_cmd_len = 16; | ||
236 | |||
237 | /* Yikes! This is important! | ||
238 | * Otherwise, by default, linux | ||
239 | * only scans target IDs 0-7! | ||
240 | * pfactsN->MaxDevices unreliable | ||
241 | * (not supported in early | ||
242 | * versions of the FW). | ||
243 | * max_id = 1 + actual max id, | ||
244 | * max_lun = 1 + actual last lun, | ||
245 | * see hosts.h :o( | ||
246 | */ | ||
247 | sh->max_id = MPT_MAX_SCSI_DEVICES; | ||
248 | |||
249 | sh->max_lun = MPT_LAST_LUN + 1; | ||
250 | sh->max_channel = 0; | ||
251 | sh->this_id = ioc->pfacts[0].PortSCSIID; | ||
252 | |||
253 | /* Required entry. | ||
254 | */ | ||
255 | sh->unique_id = ioc->id; | ||
256 | |||
257 | /* Verify that we won't exceed the maximum | ||
258 | * number of chain buffers | ||
259 | * We can optimize: ZZ = req_sz/sizeof(SGE) | ||
260 | * For 32bit SGE's: | ||
261 | * numSGE = 1 + (ZZ-1)*(maxChain -1) + ZZ | ||
262 | * + (req_sz - 64)/sizeof(SGE) | ||
263 | * A slightly different algorithm is required for | ||
264 | * 64bit SGEs. | ||
265 | */ | ||
266 | scale = ioc->req_sz/(sizeof(dma_addr_t) + sizeof(u32)); | ||
267 | if (sizeof(dma_addr_t) == sizeof(u64)) { | ||
268 | numSGE = (scale - 1) * | ||
269 | (ioc->facts.MaxChainDepth-1) + scale + | ||
270 | (ioc->req_sz - 60) / (sizeof(dma_addr_t) + | ||
271 | sizeof(u32)); | ||
272 | } else { | ||
273 | numSGE = 1 + (scale - 1) * | ||
274 | (ioc->facts.MaxChainDepth-1) + scale + | ||
275 | (ioc->req_sz - 64) / (sizeof(dma_addr_t) + | ||
276 | sizeof(u32)); | ||
277 | } | ||
278 | |||
279 | if (numSGE < sh->sg_tablesize) { | ||
280 | /* Reset this value */ | ||
281 | dprintk((MYIOC_s_INFO_FMT | ||
282 | "Resetting sg_tablesize to %d from %d\n", | ||
283 | ioc->name, numSGE, sh->sg_tablesize)); | ||
284 | sh->sg_tablesize = numSGE; | ||
285 | } | ||
286 | |||
287 | /* Set the pci device pointer in Scsi_Host structure. | ||
288 | */ | ||
289 | scsi_set_device(sh, &ioc->pcidev->dev); | ||
290 | |||
291 | spin_unlock_irqrestore(&ioc->FreeQlock, flags); | ||
292 | |||
293 | hd = (MPT_SCSI_HOST *) sh->hostdata; | ||
294 | hd->ioc = ioc; | ||
295 | |||
296 | /* SCSI needs scsi_cmnd lookup table! | ||
297 | * (with size equal to req_depth*PtrSz!) | ||
298 | */ | ||
299 | sz = ioc->req_depth * sizeof(void *); | ||
300 | mem = kmalloc(sz, GFP_ATOMIC); | ||
301 | if (mem == NULL) { | ||
302 | error = -ENOMEM; | ||
303 | goto mptspi_probe_failed; | ||
304 | } | ||
305 | |||
306 | memset(mem, 0, sz); | ||
307 | hd->ScsiLookup = (struct scsi_cmnd **) mem; | ||
308 | |||
309 | dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p, sz=%d\n", | ||
310 | ioc->name, hd->ScsiLookup, sz)); | ||
311 | |||
312 | /* Allocate memory for the device structures. | ||
313 | * A non-Null pointer at an offset | ||
314 | * indicates a device exists. | ||
315 | * max_id = 1 + maximum id (hosts.h) | ||
316 | */ | ||
317 | sz = sh->max_id * sizeof(void *); | ||
318 | mem = kmalloc(sz, GFP_ATOMIC); | ||
319 | if (mem == NULL) { | ||
320 | error = -ENOMEM; | ||
321 | goto mptspi_probe_failed; | ||
322 | } | ||
323 | |||
324 | memset(mem, 0, sz); | ||
325 | hd->Targets = (VirtDevice **) mem; | ||
326 | |||
327 | dprintk((KERN_INFO | ||
328 | " Targets @ %p, sz=%d\n", hd->Targets, sz)); | ||
329 | |||
330 | /* Clear the TM flags | ||
331 | */ | ||
332 | hd->tmPending = 0; | ||
333 | hd->tmState = TM_STATE_NONE; | ||
334 | hd->resetPending = 0; | ||
335 | hd->abortSCpnt = NULL; | ||
336 | |||
337 | /* Clear the pointer used to store | ||
338 | * single-threaded commands, i.e., those | ||
339 | * issued during a bus scan, dv and | ||
340 | * configuration pages. | ||
341 | */ | ||
342 | hd->cmdPtr = NULL; | ||
343 | |||
344 | /* Initialize this SCSI Hosts' timers | ||
345 | * To use, set the timer expires field | ||
346 | * and add_timer | ||
347 | */ | ||
348 | init_timer(&hd->timer); | ||
349 | hd->timer.data = (unsigned long) hd; | ||
350 | hd->timer.function = mptscsih_timer_expired; | ||
351 | |||
352 | ioc->spi_data.Saf_Te = mpt_saf_te; | ||
353 | hd->mpt_pq_filter = mpt_pq_filter; | ||
354 | |||
355 | #ifdef MPTSCSIH_ENABLE_DOMAIN_VALIDATION | ||
356 | if (ioc->spi_data.maxBusWidth > mpt_width) | ||
357 | ioc->spi_data.maxBusWidth = mpt_width; | ||
358 | if (ioc->spi_data.minSyncFactor < mpt_factor) | ||
359 | ioc->spi_data.minSyncFactor = mpt_factor; | ||
360 | if (ioc->spi_data.minSyncFactor == MPT_ASYNC) { | ||
361 | ioc->spi_data.maxSyncOffset = 0; | ||
362 | } | ||
363 | ioc->spi_data.mpt_dv = mpt_dv; | ||
364 | hd->negoNvram = 0; | ||
365 | |||
366 | ddvprintk((MYIOC_s_INFO_FMT | ||
367 | "dv %x width %x factor %x saf_te %x mpt_pq_filter %x\n", | ||
368 | ioc->name, | ||
369 | mpt_dv, | ||
370 | mpt_width, | ||
371 | mpt_factor, | ||
372 | mpt_saf_te, | ||
373 | mpt_pq_filter)); | ||
374 | #else | ||
375 | hd->negoNvram = MPT_SCSICFG_USE_NVRAM; | ||
376 | ddvprintk((MYIOC_s_INFO_FMT | ||
377 | "saf_te %x mpt_pq_filter %x\n", | ||
378 | ioc->name, | ||
379 | mpt_saf_te, | ||
380 | mpt_pq_filter)); | ||
381 | #endif | ||
382 | |||
383 | ioc->spi_data.forceDv = 0; | ||
384 | ioc->spi_data.noQas = 0; | ||
385 | |||
386 | for (ii=0; ii < MPT_MAX_SCSI_DEVICES; ii++) | ||
387 | ioc->spi_data.dvStatus[ii] = | ||
388 | MPT_SCSICFG_NEGOTIATE; | ||
389 | |||
390 | for (ii=0; ii < MPT_MAX_SCSI_DEVICES; ii++) | ||
391 | ioc->spi_data.dvStatus[ii] |= | ||
392 | MPT_SCSICFG_DV_NOT_DONE; | ||
393 | |||
394 | init_waitqueue_head(&hd->scandv_waitq); | ||
395 | hd->scandv_wait_done = 0; | ||
396 | hd->last_queue_full = 0; | ||
397 | |||
398 | ioc->DoneCtx = mptspiDoneCtx; | ||
399 | ioc->TaskCtx = mptspiTaskCtx; | ||
400 | ioc->InternalCtx = mptspiInternalCtx; | ||
401 | |||
402 | error = scsi_add_host (sh, &ioc->pcidev->dev); | ||
403 | if(error) { | ||
404 | dprintk((KERN_ERR MYNAM | ||
405 | "scsi_add_host failed\n")); | ||
406 | goto mptspi_probe_failed; | ||
407 | } | ||
408 | |||
409 | scsi_scan_host(sh); | ||
410 | return 0; | ||
411 | |||
412 | mptspi_probe_failed: | ||
413 | |||
414 | mptscsih_remove(pdev); | ||
415 | return error; | ||
416 | } | ||
417 | |||
418 | static struct pci_driver mptspi_driver = { | ||
419 | .name = "mptspi", | ||
420 | .id_table = mptspi_pci_table, | ||
421 | .probe = mptspi_probe, | ||
422 | .remove = __devexit_p(mptscsih_remove), | ||
423 | .driver = { | ||
424 | .shutdown = mptscsih_shutdown, | ||
425 | }, | ||
426 | #ifdef CONFIG_PM | ||
427 | .suspend = mptscsih_suspend, | ||
428 | .resume = mptscsih_resume, | ||
429 | #endif | ||
430 | }; | ||
431 | |||
432 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
433 | /** | ||
434 | * mptspi_init - Register MPT adapter(s) as SCSI host(s) with | ||
435 | * linux scsi mid-layer. | ||
436 | * | ||
437 | * Returns 0 for success, non-zero for failure. | ||
438 | */ | ||
439 | static int __init | ||
440 | mptspi_init(void) | ||
441 | { | ||
442 | |||
443 | show_mptmod_ver(my_NAME, my_VERSION); | ||
444 | |||
445 | mptspiDoneCtx = mpt_register(mptscsih_io_done, MPTSPI_DRIVER); | ||
446 | mptspiTaskCtx = mpt_register(mptscsih_taskmgmt_complete, MPTSPI_DRIVER); | ||
447 | mptspiInternalCtx = mpt_register(mptscsih_scandv_complete, MPTSPI_DRIVER); | ||
448 | |||
449 | if (mpt_event_register(mptspiDoneCtx, mptscsih_event_process) == 0) { | ||
450 | devtprintk((KERN_INFO MYNAM | ||
451 | ": Registered for IOC event notifications\n")); | ||
452 | } | ||
453 | |||
454 | if (mpt_reset_register(mptspiDoneCtx, mptscsih_ioc_reset) == 0) { | ||
455 | dprintk((KERN_INFO MYNAM | ||
456 | ": Registered for IOC reset notifications\n")); | ||
457 | } | ||
458 | |||
459 | return pci_register_driver(&mptspi_driver); | ||
460 | } | ||
461 | |||
462 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
463 | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ | ||
464 | /** | ||
465 | * mptspi_exit - Unregisters MPT adapter(s) | ||
466 | * | ||
467 | */ | ||
468 | static void __exit | ||
469 | mptspi_exit(void) | ||
470 | { | ||
471 | pci_unregister_driver(&mptspi_driver); | ||
472 | |||
473 | mpt_reset_deregister(mptspiDoneCtx); | ||
474 | dprintk((KERN_INFO MYNAM | ||
475 | ": Deregistered for IOC reset notifications\n")); | ||
476 | |||
477 | mpt_event_deregister(mptspiDoneCtx); | ||
478 | dprintk((KERN_INFO MYNAM | ||
479 | ": Deregistered for IOC event notifications\n")); | ||
480 | |||
481 | mpt_deregister(mptspiInternalCtx); | ||
482 | mpt_deregister(mptspiTaskCtx); | ||
483 | mpt_deregister(mptspiDoneCtx); | ||
484 | } | ||
485 | |||
486 | module_init(mptspi_init); | ||
487 | module_exit(mptspi_exit); | ||