]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/scsi/device_handler/scsi_dh_rdac.c
Merge phase #2 (PAT updates) of git://git.kernel.org/pub/scm/linux/kernel/git/tip...
[linux-2.6-omap-h63xx.git] / drivers / scsi / device_handler / scsi_dh_rdac.c
1 /*
2  * Engenio/LSI RDAC SCSI Device Handler
3  *
4  * Copyright (C) 2005 Mike Christie. All rights reserved.
5  * Copyright (C) Chandra Seetharaman, IBM Corp. 2007
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  *
21  */
22 #include <scsi/scsi.h>
23 #include <scsi/scsi_eh.h>
24 #include <scsi/scsi_dh.h>
25
26 #define RDAC_NAME "rdac"
27
28 /*
29  * LSI mode page stuff
30  *
31  * These struct definitions and the forming of the
32  * mode page were taken from the LSI RDAC 2.4 GPL'd
33  * driver, and then converted to Linux conventions.
34  */
35 #define RDAC_QUIESCENCE_TIME 20;
36 /*
37  * Page Codes
38  */
39 #define RDAC_PAGE_CODE_REDUNDANT_CONTROLLER 0x2c
40
41 /*
42  * Controller modes definitions
43  */
44 #define RDAC_MODE_TRANSFER_SPECIFIED_LUNS       0x02
45
46 /*
47  * RDAC Options field
48  */
49 #define RDAC_FORCED_QUIESENCE 0x02
50
51 #define RDAC_TIMEOUT    (60 * HZ)
52 #define RDAC_RETRIES    3
53
54 struct rdac_mode_6_hdr {
55         u8      data_len;
56         u8      medium_type;
57         u8      device_params;
58         u8      block_desc_len;
59 };
60
61 struct rdac_mode_10_hdr {
62         u16     data_len;
63         u8      medium_type;
64         u8      device_params;
65         u16     reserved;
66         u16     block_desc_len;
67 };
68
69 struct rdac_mode_common {
70         u8      controller_serial[16];
71         u8      alt_controller_serial[16];
72         u8      rdac_mode[2];
73         u8      alt_rdac_mode[2];
74         u8      quiescence_timeout;
75         u8      rdac_options;
76 };
77
78 struct rdac_pg_legacy {
79         struct rdac_mode_6_hdr hdr;
80         u8      page_code;
81         u8      page_len;
82         struct rdac_mode_common common;
83 #define MODE6_MAX_LUN   32
84         u8      lun_table[MODE6_MAX_LUN];
85         u8      reserved2[32];
86         u8      reserved3;
87         u8      reserved4;
88 };
89
90 struct rdac_pg_expanded {
91         struct rdac_mode_10_hdr hdr;
92         u8      page_code;
93         u8      subpage_code;
94         u8      page_len[2];
95         struct rdac_mode_common common;
96         u8      lun_table[256];
97         u8      reserved3;
98         u8      reserved4;
99 };
100
101 struct c9_inquiry {
102         u8      peripheral_info;
103         u8      page_code;      /* 0xC9 */
104         u8      reserved1;
105         u8      page_len;
106         u8      page_id[4];     /* "vace" */
107         u8      avte_cvp;
108         u8      path_prio;
109         u8      reserved2[38];
110 };
111
112 #define SUBSYS_ID_LEN   16
113 #define SLOT_ID_LEN     2
114
115 struct c4_inquiry {
116         u8      peripheral_info;
117         u8      page_code;      /* 0xC4 */
118         u8      reserved1;
119         u8      page_len;
120         u8      page_id[4];     /* "subs" */
121         u8      subsys_id[SUBSYS_ID_LEN];
122         u8      revision[4];
123         u8      slot_id[SLOT_ID_LEN];
124         u8      reserved[2];
125 };
126
127 struct rdac_controller {
128         u8                      subsys_id[SUBSYS_ID_LEN];
129         u8                      slot_id[SLOT_ID_LEN];
130         int                     use_ms10;
131         struct kref             kref;
132         struct list_head        node; /* list of all controllers */
133         union                   {
134                 struct rdac_pg_legacy legacy;
135                 struct rdac_pg_expanded expanded;
136         } mode_select;
137 };
138 struct c8_inquiry {
139         u8      peripheral_info;
140         u8      page_code; /* 0xC8 */
141         u8      reserved1;
142         u8      page_len;
143         u8      page_id[4]; /* "edid" */
144         u8      reserved2[3];
145         u8      vol_uniq_id_len;
146         u8      vol_uniq_id[16];
147         u8      vol_user_label_len;
148         u8      vol_user_label[60];
149         u8      array_uniq_id_len;
150         u8      array_unique_id[16];
151         u8      array_user_label_len;
152         u8      array_user_label[60];
153         u8      lun[8];
154 };
155
156 struct c2_inquiry {
157         u8      peripheral_info;
158         u8      page_code;      /* 0xC2 */
159         u8      reserved1;
160         u8      page_len;
161         u8      page_id[4];     /* "swr4" */
162         u8      sw_version[3];
163         u8      sw_date[3];
164         u8      features_enabled;
165         u8      max_lun_supported;
166         u8      partitions[239]; /* Total allocation length should be 0xFF */
167 };
168
169 struct rdac_dh_data {
170         struct rdac_controller  *ctlr;
171 #define UNINITIALIZED_LUN       (1 << 8)
172         unsigned                lun;
173 #define RDAC_STATE_ACTIVE       0
174 #define RDAC_STATE_PASSIVE      1
175         unsigned char           state;
176
177 #define RDAC_LUN_UNOWNED        0
178 #define RDAC_LUN_OWNED          1
179 #define RDAC_LUN_AVT            2
180         char                    lun_state;
181         unsigned char           sense[SCSI_SENSE_BUFFERSIZE];
182         union                   {
183                 struct c2_inquiry c2;
184                 struct c4_inquiry c4;
185                 struct c8_inquiry c8;
186                 struct c9_inquiry c9;
187         } inq;
188 };
189
190 static const char *lun_state[] =
191 {
192         "unowned",
193         "owned",
194         "owned (AVT mode)",
195 };
196
197 static LIST_HEAD(ctlr_list);
198 static DEFINE_SPINLOCK(list_lock);
199
200 static inline struct rdac_dh_data *get_rdac_data(struct scsi_device *sdev)
201 {
202         struct scsi_dh_data *scsi_dh_data = sdev->scsi_dh_data;
203         BUG_ON(scsi_dh_data == NULL);
204         return ((struct rdac_dh_data *) scsi_dh_data->buf);
205 }
206
207 static struct request *get_rdac_req(struct scsi_device *sdev,
208                         void *buffer, unsigned buflen, int rw)
209 {
210         struct request *rq;
211         struct request_queue *q = sdev->request_queue;
212
213         rq = blk_get_request(q, rw, GFP_NOIO);
214
215         if (!rq) {
216                 sdev_printk(KERN_INFO, sdev,
217                                 "get_rdac_req: blk_get_request failed.\n");
218                 return NULL;
219         }
220
221         if (buflen && blk_rq_map_kern(q, rq, buffer, buflen, GFP_NOIO)) {
222                 blk_put_request(rq);
223                 sdev_printk(KERN_INFO, sdev,
224                                 "get_rdac_req: blk_rq_map_kern failed.\n");
225                 return NULL;
226         }
227
228         rq->cmd_type = REQ_TYPE_BLOCK_PC;
229         rq->cmd_flags |= REQ_FAILFAST | REQ_NOMERGE;
230         rq->retries = RDAC_RETRIES;
231         rq->timeout = RDAC_TIMEOUT;
232
233         return rq;
234 }
235
236 static struct request *rdac_failover_get(struct scsi_device *sdev,
237                                          struct rdac_dh_data *h)
238 {
239         struct request *rq;
240         struct rdac_mode_common *common;
241         unsigned data_size;
242
243         if (h->ctlr->use_ms10) {
244                 struct rdac_pg_expanded *rdac_pg;
245
246                 data_size = sizeof(struct rdac_pg_expanded);
247                 rdac_pg = &h->ctlr->mode_select.expanded;
248                 memset(rdac_pg, 0, data_size);
249                 common = &rdac_pg->common;
250                 rdac_pg->page_code = RDAC_PAGE_CODE_REDUNDANT_CONTROLLER + 0x40;
251                 rdac_pg->subpage_code = 0x1;
252                 rdac_pg->page_len[0] = 0x01;
253                 rdac_pg->page_len[1] = 0x28;
254                 rdac_pg->lun_table[h->lun] = 0x81;
255         } else {
256                 struct rdac_pg_legacy *rdac_pg;
257
258                 data_size = sizeof(struct rdac_pg_legacy);
259                 rdac_pg = &h->ctlr->mode_select.legacy;
260                 memset(rdac_pg, 0, data_size);
261                 common = &rdac_pg->common;
262                 rdac_pg->page_code = RDAC_PAGE_CODE_REDUNDANT_CONTROLLER;
263                 rdac_pg->page_len = 0x68;
264                 rdac_pg->lun_table[h->lun] = 0x81;
265         }
266         common->rdac_mode[1] = RDAC_MODE_TRANSFER_SPECIFIED_LUNS;
267         common->quiescence_timeout = RDAC_QUIESCENCE_TIME;
268         common->rdac_options = RDAC_FORCED_QUIESENCE;
269
270         /* get request for block layer packet command */
271         rq = get_rdac_req(sdev, &h->ctlr->mode_select, data_size, WRITE);
272         if (!rq)
273                 return NULL;
274
275         /* Prepare the command. */
276         if (h->ctlr->use_ms10) {
277                 rq->cmd[0] = MODE_SELECT_10;
278                 rq->cmd[7] = data_size >> 8;
279                 rq->cmd[8] = data_size & 0xff;
280         } else {
281                 rq->cmd[0] = MODE_SELECT;
282                 rq->cmd[4] = data_size;
283         }
284         rq->cmd_len = COMMAND_SIZE(rq->cmd[0]);
285
286         rq->sense = h->sense;
287         memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE);
288         rq->sense_len = 0;
289
290         return rq;
291 }
292
293 static void release_controller(struct kref *kref)
294 {
295         struct rdac_controller *ctlr;
296         ctlr = container_of(kref, struct rdac_controller, kref);
297
298         spin_lock(&list_lock);
299         list_del(&ctlr->node);
300         spin_unlock(&list_lock);
301         kfree(ctlr);
302 }
303
304 static struct rdac_controller *get_controller(u8 *subsys_id, u8 *slot_id)
305 {
306         struct rdac_controller *ctlr, *tmp;
307
308         spin_lock(&list_lock);
309
310         list_for_each_entry(tmp, &ctlr_list, node) {
311                 if ((memcmp(tmp->subsys_id, subsys_id, SUBSYS_ID_LEN) == 0) &&
312                           (memcmp(tmp->slot_id, slot_id, SLOT_ID_LEN) == 0)) {
313                         kref_get(&tmp->kref);
314                         spin_unlock(&list_lock);
315                         return tmp;
316                 }
317         }
318         ctlr = kmalloc(sizeof(*ctlr), GFP_ATOMIC);
319         if (!ctlr)
320                 goto done;
321
322         /* initialize fields of controller */
323         memcpy(ctlr->subsys_id, subsys_id, SUBSYS_ID_LEN);
324         memcpy(ctlr->slot_id, slot_id, SLOT_ID_LEN);
325         kref_init(&ctlr->kref);
326         ctlr->use_ms10 = -1;
327         list_add(&ctlr->node, &ctlr_list);
328 done:
329         spin_unlock(&list_lock);
330         return ctlr;
331 }
332
333 static int submit_inquiry(struct scsi_device *sdev, int page_code,
334                           unsigned int len, struct rdac_dh_data *h)
335 {
336         struct request *rq;
337         struct request_queue *q = sdev->request_queue;
338         int err = SCSI_DH_RES_TEMP_UNAVAIL;
339
340         rq = get_rdac_req(sdev, &h->inq, len, READ);
341         if (!rq)
342                 goto done;
343
344         /* Prepare the command. */
345         rq->cmd[0] = INQUIRY;
346         rq->cmd[1] = 1;
347         rq->cmd[2] = page_code;
348         rq->cmd[4] = len;
349         rq->cmd_len = COMMAND_SIZE(INQUIRY);
350
351         rq->sense = h->sense;
352         memset(rq->sense, 0, SCSI_SENSE_BUFFERSIZE);
353         rq->sense_len = 0;
354
355         err = blk_execute_rq(q, NULL, rq, 1);
356         if (err == -EIO)
357                 err = SCSI_DH_IO;
358
359         blk_put_request(rq);
360 done:
361         return err;
362 }
363
364 static int get_lun(struct scsi_device *sdev, struct rdac_dh_data *h)
365 {
366         int err;
367         struct c8_inquiry *inqp;
368
369         err = submit_inquiry(sdev, 0xC8, sizeof(struct c8_inquiry), h);
370         if (err == SCSI_DH_OK) {
371                 inqp = &h->inq.c8;
372                 if (inqp->page_code != 0xc8)
373                         return SCSI_DH_NOSYS;
374                 if (inqp->page_id[0] != 'e' || inqp->page_id[1] != 'd' ||
375                     inqp->page_id[2] != 'i' || inqp->page_id[3] != 'd')
376                         return SCSI_DH_NOSYS;
377                 h->lun = inqp->lun[7]; /* Uses only the last byte */
378         }
379         return err;
380 }
381
382 static int check_ownership(struct scsi_device *sdev, struct rdac_dh_data *h)
383 {
384         int err;
385         struct c9_inquiry *inqp;
386
387         h->lun_state = RDAC_LUN_UNOWNED;
388         err = submit_inquiry(sdev, 0xC9, sizeof(struct c9_inquiry), h);
389         if (err == SCSI_DH_OK) {
390                 inqp = &h->inq.c9;
391                 if ((inqp->avte_cvp >> 7) == 0x1) {
392                         /* LUN in AVT mode */
393                         sdev_printk(KERN_NOTICE, sdev,
394                                     "%s: AVT mode detected\n",
395                                     RDAC_NAME);
396                         h->lun_state = RDAC_LUN_AVT;
397                 } else if ((inqp->avte_cvp & 0x1) != 0) {
398                         /* LUN was owned by the controller */
399                         h->lun_state = RDAC_LUN_OWNED;
400                 }
401         }
402
403         return err;
404 }
405
406 static int initialize_controller(struct scsi_device *sdev,
407                                  struct rdac_dh_data *h)
408 {
409         int err;
410         struct c4_inquiry *inqp;
411
412         err = submit_inquiry(sdev, 0xC4, sizeof(struct c4_inquiry), h);
413         if (err == SCSI_DH_OK) {
414                 inqp = &h->inq.c4;
415                 h->ctlr = get_controller(inqp->subsys_id, inqp->slot_id);
416                 if (!h->ctlr)
417                         err = SCSI_DH_RES_TEMP_UNAVAIL;
418         }
419         return err;
420 }
421
422 static int set_mode_select(struct scsi_device *sdev, struct rdac_dh_data *h)
423 {
424         int err;
425         struct c2_inquiry *inqp;
426
427         err = submit_inquiry(sdev, 0xC2, sizeof(struct c2_inquiry), h);
428         if (err == SCSI_DH_OK) {
429                 inqp = &h->inq.c2;
430                 /*
431                  * If more than MODE6_MAX_LUN luns are supported, use
432                  * mode select 10
433                  */
434                 if (inqp->max_lun_supported >= MODE6_MAX_LUN)
435                         h->ctlr->use_ms10 = 1;
436                 else
437                         h->ctlr->use_ms10 = 0;
438         }
439         return err;
440 }
441
442 static int mode_select_handle_sense(struct scsi_device *sdev,
443                                     unsigned char *sensebuf)
444 {
445         struct scsi_sense_hdr sense_hdr;
446         int sense, err = SCSI_DH_IO, ret;
447
448         ret = scsi_normalize_sense(sensebuf, SCSI_SENSE_BUFFERSIZE, &sense_hdr);
449         if (!ret)
450                 goto done;
451
452         err = SCSI_DH_OK;
453         sense = (sense_hdr.sense_key << 16) | (sense_hdr.asc << 8) |
454                         sense_hdr.ascq;
455         /* If it is retryable failure, submit the c9 inquiry again */
456         if (sense == 0x59136 || sense == 0x68b02 || sense == 0xb8b02 ||
457                             sense == 0x62900) {
458                 /* 0x59136    - Command lock contention
459                  * 0x[6b]8b02 - Quiesense in progress or achieved
460                  * 0x62900    - Power On, Reset, or Bus Device Reset
461                  */
462                 err = SCSI_DH_RETRY;
463         }
464
465         if (sense)
466                 sdev_printk(KERN_INFO, sdev,
467                         "MODE_SELECT failed with sense 0x%x.\n", sense);
468 done:
469         return err;
470 }
471
472 static int send_mode_select(struct scsi_device *sdev, struct rdac_dh_data *h)
473 {
474         struct request *rq;
475         struct request_queue *q = sdev->request_queue;
476         int err = SCSI_DH_RES_TEMP_UNAVAIL;
477
478         rq = rdac_failover_get(sdev, h);
479         if (!rq)
480                 goto done;
481
482         sdev_printk(KERN_INFO, sdev, "queueing MODE_SELECT command.\n");
483
484         err = blk_execute_rq(q, NULL, rq, 1);
485         if (err != SCSI_DH_OK)
486                 err = mode_select_handle_sense(sdev, h->sense);
487         if (err == SCSI_DH_OK)
488                 h->state = RDAC_STATE_ACTIVE;
489
490         blk_put_request(rq);
491 done:
492         return err;
493 }
494
495 static int rdac_activate(struct scsi_device *sdev)
496 {
497         struct rdac_dh_data *h = get_rdac_data(sdev);
498         int err = SCSI_DH_OK;
499
500         err = check_ownership(sdev, h);
501         if (err != SCSI_DH_OK)
502                 goto done;
503
504         if (!h->ctlr) {
505                 err = initialize_controller(sdev, h);
506                 if (err != SCSI_DH_OK)
507                         goto done;
508         }
509
510         if (h->ctlr->use_ms10 == -1) {
511                 err = set_mode_select(sdev, h);
512                 if (err != SCSI_DH_OK)
513                         goto done;
514         }
515         if (h->lun_state == RDAC_LUN_UNOWNED)
516                 err = send_mode_select(sdev, h);
517 done:
518         return err;
519 }
520
521 static int rdac_prep_fn(struct scsi_device *sdev, struct request *req)
522 {
523         struct rdac_dh_data *h = get_rdac_data(sdev);
524         int ret = BLKPREP_OK;
525
526         if (h->state != RDAC_STATE_ACTIVE) {
527                 ret = BLKPREP_KILL;
528                 req->cmd_flags |= REQ_QUIET;
529         }
530         return ret;
531
532 }
533
534 static int rdac_check_sense(struct scsi_device *sdev,
535                                 struct scsi_sense_hdr *sense_hdr)
536 {
537         struct rdac_dh_data *h = get_rdac_data(sdev);
538         switch (sense_hdr->sense_key) {
539         case NOT_READY:
540                 if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x81)
541                         /* LUN Not Ready - Storage firmware incompatible
542                          * Manual code synchonisation required.
543                          *
544                          * Nothing we can do here. Try to bypass the path.
545                          */
546                         return SUCCESS;
547                 if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0xA1)
548                         /* LUN Not Ready - Quiescense in progress
549                          *
550                          * Just retry and wait.
551                          */
552                         return ADD_TO_MLQUEUE;
553                 break;
554         case ILLEGAL_REQUEST:
555                 if (sense_hdr->asc == 0x94 && sense_hdr->ascq == 0x01) {
556                         /* Invalid Request - Current Logical Unit Ownership.
557                          * Controller is not the current owner of the LUN,
558                          * Fail the path, so that the other path be used.
559                          */
560                         h->state = RDAC_STATE_PASSIVE;
561                         return SUCCESS;
562                 }
563                 break;
564         case UNIT_ATTENTION:
565                 if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00)
566                         /*
567                          * Power On, Reset, or Bus Device Reset, just retry.
568                          */
569                         return ADD_TO_MLQUEUE;
570                 break;
571         }
572         /* success just means we do not care what scsi-ml does */
573         return SCSI_RETURN_NOT_HANDLED;
574 }
575
576 static const struct scsi_dh_devlist rdac_dev_list[] = {
577         {"IBM", "1722"},
578         {"IBM", "1724"},
579         {"IBM", "1726"},
580         {"IBM", "1742"},
581         {"IBM", "1814"},
582         {"IBM", "1815"},
583         {"IBM", "1818"},
584         {"IBM", "3526"},
585         {"SGI", "TP9400"},
586         {"SGI", "TP9500"},
587         {"SGI", "IS"},
588         {"STK", "OPENstorage D280"},
589         {"SUN", "CSM200_R"},
590         {"SUN", "LCSM100_F"},
591         {"DELL", "MD3000"},
592         {"DELL", "MD3000i"},
593         {NULL, NULL},
594 };
595
596 static int rdac_bus_attach(struct scsi_device *sdev);
597 static void rdac_bus_detach(struct scsi_device *sdev);
598
599 static struct scsi_device_handler rdac_dh = {
600         .name = RDAC_NAME,
601         .module = THIS_MODULE,
602         .devlist = rdac_dev_list,
603         .prep_fn = rdac_prep_fn,
604         .check_sense = rdac_check_sense,
605         .attach = rdac_bus_attach,
606         .detach = rdac_bus_detach,
607         .activate = rdac_activate,
608 };
609
610 static int rdac_bus_attach(struct scsi_device *sdev)
611 {
612         struct scsi_dh_data *scsi_dh_data;
613         struct rdac_dh_data *h;
614         unsigned long flags;
615         int err;
616
617         scsi_dh_data = kzalloc(sizeof(struct scsi_device_handler *)
618                                + sizeof(*h) , GFP_KERNEL);
619         if (!scsi_dh_data) {
620                 sdev_printk(KERN_ERR, sdev, "%s: Attach failed\n",
621                             RDAC_NAME);
622                 return 0;
623         }
624
625         scsi_dh_data->scsi_dh = &rdac_dh;
626         h = (struct rdac_dh_data *) scsi_dh_data->buf;
627         h->lun = UNINITIALIZED_LUN;
628         h->state = RDAC_STATE_ACTIVE;
629
630         err = get_lun(sdev, h);
631         if (err != SCSI_DH_OK)
632                 goto failed;
633
634         err = check_ownership(sdev, h);
635         if (err != SCSI_DH_OK)
636                 goto failed;
637
638         if (!try_module_get(THIS_MODULE))
639                 goto failed;
640
641         spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
642         sdev->scsi_dh_data = scsi_dh_data;
643         spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
644
645         sdev_printk(KERN_NOTICE, sdev,
646                     "%s: LUN %d (%s)\n",
647                     RDAC_NAME, h->lun, lun_state[(int)h->lun_state]);
648
649         return 0;
650
651 failed:
652         kfree(scsi_dh_data);
653         sdev_printk(KERN_ERR, sdev, "%s: not attached\n",
654                     RDAC_NAME);
655         return -EINVAL;
656 }
657
658 static void rdac_bus_detach( struct scsi_device *sdev )
659 {
660         struct scsi_dh_data *scsi_dh_data;
661         struct rdac_dh_data *h;
662         unsigned long flags;
663
664         spin_lock_irqsave(sdev->request_queue->queue_lock, flags);
665         scsi_dh_data = sdev->scsi_dh_data;
666         sdev->scsi_dh_data = NULL;
667         spin_unlock_irqrestore(sdev->request_queue->queue_lock, flags);
668
669         h = (struct rdac_dh_data *) scsi_dh_data->buf;
670         if (h->ctlr)
671                 kref_put(&h->ctlr->kref, release_controller);
672         kfree(scsi_dh_data);
673         module_put(THIS_MODULE);
674         sdev_printk(KERN_NOTICE, sdev, "%s: Detached\n", RDAC_NAME);
675 }
676
677
678
679 static int __init rdac_init(void)
680 {
681         int r;
682
683         r = scsi_register_device_handler(&rdac_dh);
684         if (r != 0)
685                 printk(KERN_ERR "Failed to register scsi device handler.");
686         return r;
687 }
688
689 static void __exit rdac_exit(void)
690 {
691         scsi_unregister_device_handler(&rdac_dh);
692 }
693
694 module_init(rdac_init);
695 module_exit(rdac_exit);
696
697 MODULE_DESCRIPTION("Multipath LSI/Engenio RDAC driver");
698 MODULE_AUTHOR("Mike Christie, Chandra Seetharaman");
699 MODULE_LICENSE("GPL");