2 * IBM eServer i/pSeries Virtual SCSI Target Driver
3 * Copyright (C) 2003-2005 Dave Boutcher (boutcher@us.ibm.com) IBM Corp.
4 * Santiago Leon (santil@us.ibm.com) IBM Corp.
5 * Linda Xie (lxie@us.ibm.com) IBM Corp.
7 * Copyright (C) 2005-2006 FUJITA Tomonori <tomof@acm.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 #include <linux/interrupt.h>
25 #include <linux/module.h>
26 #include <scsi/scsi.h>
27 #include <scsi/scsi_host.h>
28 #include <scsi/scsi_tgt.h>
29 #include <scsi/libsrp.h>
30 #include <asm/hvcall.h>
31 #include <asm/iommu.h>
37 #define INITIAL_SRP_LIMIT 16
38 #define DEFAULT_MAX_SECTORS 256
40 #define TGT_NAME "ibmvstgt"
45 #define h_copy_rdma(l, sa, sb, da, db) \
46 plpar_hcall_norets(H_COPY_RDMA, l, sa, sb, da, db)
47 #define h_send_crq(ua, l, h) \
48 plpar_hcall_norets(H_SEND_CRQ, ua, l, h)
49 #define h_reg_crq(ua, tok, sz)\
50 plpar_hcall_norets(H_REG_CRQ, ua, tok, sz);
51 #define h_free_crq(ua) \
52 plpar_hcall_norets(H_FREE_CRQ, ua);
54 /* tmp - will replace with SCSI logging stuff */
55 #define eprintk(fmt, args...) \
57 printk("%s(%d) " fmt, __FUNCTION__, __LINE__, ##args); \
59 /* #define dprintk eprintk */
60 #define dprintk(fmt, args...)
63 struct vio_dev *dma_dev;
65 struct crq_queue crq_queue;
66 struct work_struct crq_work;
70 struct srp_target *target;
73 static struct workqueue_struct *vtgtd;
76 * These are fixed for the system and come from the Open Firmware device tree.
77 * We just store them here to save getting them every time.
79 static char system_id[64] = "";
80 static char partition_name[97] = "UNKNOWN";
81 static unsigned int partition_number = -1;
83 static struct vio_port *target_to_port(struct srp_target *target)
85 return (struct vio_port *) target->ldata;
88 static inline union viosrp_iu *vio_iu(struct iu_entry *iue)
90 return (union viosrp_iu *) (iue->sbuf->buf);
93 static int send_iu(struct iu_entry *iue, uint64_t length, uint8_t format)
95 struct srp_target *target = iue->target;
96 struct vio_port *vport = target_to_port(target);
99 struct viosrp_crq cooked;
103 /* First copy the SRP */
104 rc = h_copy_rdma(length, vport->liobn, iue->sbuf->dma,
105 vport->riobn, iue->remote_token);
108 eprintk("Error %ld transferring data\n", rc);
110 crq.cooked.valid = 0x80;
111 crq.cooked.format = format;
112 crq.cooked.reserved = 0x00;
113 crq.cooked.timeout = 0x00;
114 crq.cooked.IU_length = length;
115 crq.cooked.IU_data_ptr = vio_iu(iue)->srp.rsp.tag;
118 crq.cooked.status = 0x99; /* Just needs to be non-zero */
120 crq.cooked.status = 0x00;
122 rc1 = h_send_crq(vport->dma_dev->unit_address, crq.raw[0], crq.raw[1]);
125 eprintk("%ld sending response\n", rc1);
132 #define SRP_RSP_SENSE_DATA_LEN 18
134 static int send_rsp(struct iu_entry *iue, struct scsi_cmnd *sc,
135 unsigned char status, unsigned char asc)
137 union viosrp_iu *iu = vio_iu(iue);
138 uint64_t tag = iu->srp.rsp.tag;
140 /* If the linked bit is on and status is good */
141 if (test_bit(V_LINKED, &iue->flags) && (status == NO_SENSE))
144 memset(iu, 0, sizeof(struct srp_rsp));
145 iu->srp.rsp.opcode = SRP_RSP;
146 iu->srp.rsp.req_lim_delta = 1;
147 iu->srp.rsp.tag = tag;
149 if (test_bit(V_DIOVER, &iue->flags))
150 iu->srp.rsp.flags |= SRP_RSP_FLAG_DIOVER;
152 iu->srp.rsp.data_in_res_cnt = 0;
153 iu->srp.rsp.data_out_res_cnt = 0;
155 iu->srp.rsp.flags &= ~SRP_RSP_FLAG_RSPVALID;
157 iu->srp.rsp.resp_data_len = 0;
158 iu->srp.rsp.status = status;
160 uint8_t *sense = iu->srp.rsp.data;
163 iu->srp.rsp.flags |= SRP_RSP_FLAG_SNSVALID;
164 iu->srp.rsp.sense_data_len = SCSI_SENSE_BUFFERSIZE;
165 memcpy(sense, sc->sense_buffer, SCSI_SENSE_BUFFERSIZE);
167 iu->srp.rsp.status = SAM_STAT_CHECK_CONDITION;
168 iu->srp.rsp.flags |= SRP_RSP_FLAG_SNSVALID;
169 iu->srp.rsp.sense_data_len = SRP_RSP_SENSE_DATA_LEN;
171 /* Valid bit and 'current errors' */
172 sense[0] = (0x1 << 7 | 0x70);
175 /* Additional sense length */
176 sense[7] = 0xa; /* 10 bytes */
177 /* Additional sense code */
182 send_iu(iue, sizeof(iu->srp.rsp) + SRP_RSP_SENSE_DATA_LEN,
188 static void handle_cmd_queue(struct srp_target *target)
190 struct Scsi_Host *shost = target->shost;
191 struct iu_entry *iue;
197 spin_lock_irqsave(&target->lock, flags);
199 list_for_each_entry(iue, &target->cmd_queue, ilist) {
200 if (!test_and_set_bit(V_FLYING, &iue->flags)) {
201 spin_unlock_irqrestore(&target->lock, flags);
202 cmd = iue->sbuf->buf;
203 err = srp_cmd_queue(shost, cmd, iue, 0);
205 eprintk("cannot queue cmd %p %d\n", cmd, err);
212 spin_unlock_irqrestore(&target->lock, flags);
215 static int ibmvstgt_rdma(struct scsi_cmnd *sc, struct scatterlist *sg, int nsg,
216 struct srp_direct_buf *md, int nmd,
217 enum dma_data_direction dir, unsigned int rest)
219 struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr;
220 struct srp_target *target = iue->target;
221 struct vio_port *vport = target_to_port(target);
224 unsigned int done = 0;
228 token = sg_dma_address(sg + sidx);
230 for (i = 0; i < nmd && rest; i++) {
231 unsigned int mdone, mlen;
233 mlen = min(rest, md[i].len);
234 for (mdone = 0; mlen;) {
235 int slen = min(sg_dma_len(sg + sidx) - soff, mlen);
237 if (dir == DMA_TO_DEVICE)
238 err = h_copy_rdma(slen,
244 err = h_copy_rdma(slen,
250 if (err != H_SUCCESS) {
251 eprintk("rdma error %d %d %ld\n", dir, slen, err);
260 if (soff == sg_dma_len(sg + sidx)) {
263 token = sg_dma_address(sg + sidx);
266 eprintk("out of sg %p %d %d\n",
278 static int ibmvstgt_cmd_done(struct scsi_cmnd *sc,
279 void (*done)(struct scsi_cmnd *))
282 struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr;
283 struct srp_target *target = iue->target;
286 dprintk("%p %p %x %u\n", iue, target, vio_iu(iue)->srp.cmd.cdb[0],
290 err = srp_transfer_data(sc, &vio_iu(iue)->srp.cmd, ibmvstgt_rdma, 1, 1);
292 spin_lock_irqsave(&target->lock, flags);
293 list_del(&iue->ilist);
294 spin_unlock_irqrestore(&target->lock, flags);
296 if (err|| sc->result != SAM_STAT_GOOD) {
297 eprintk("operation failed %p %d %x\n",
298 iue, sc->result, vio_iu(iue)->srp.cmd.cdb[0]);
299 send_rsp(iue, sc, HARDWARE_ERROR, 0x00);
301 send_rsp(iue, sc, NO_SENSE, 0x00);
308 int send_adapter_info(struct iu_entry *iue,
309 dma_addr_t remote_buffer, uint16_t length)
311 struct srp_target *target = iue->target;
312 struct vio_port *vport = target_to_port(target);
313 struct Scsi_Host *shost = target->shost;
314 dma_addr_t data_token;
315 struct mad_adapter_info_data *info;
318 info = dma_alloc_coherent(target->dev, sizeof(*info), &data_token,
321 eprintk("bad dma_alloc_coherent %p\n", target);
325 /* Get remote info */
326 err = h_copy_rdma(sizeof(*info), vport->riobn, remote_buffer,
327 vport->liobn, data_token);
328 if (err == H_SUCCESS) {
329 dprintk("Client connect: %s (%d)\n",
330 info->partition_name, info->partition_number);
333 memset(info, 0, sizeof(*info));
335 strcpy(info->srp_version, "16.a");
336 strncpy(info->partition_name, partition_name,
337 sizeof(info->partition_name));
338 info->partition_number = partition_number;
339 info->mad_version = 1;
341 info->port_max_txu[0] = shost->hostt->max_sectors << 9;
343 /* Send our info to remote */
344 err = h_copy_rdma(sizeof(*info), vport->liobn, data_token,
345 vport->riobn, remote_buffer);
347 dma_free_coherent(target->dev, sizeof(*info), info, data_token);
349 if (err != H_SUCCESS) {
350 eprintk("Error sending adapter info %d\n", err);
357 static void process_login(struct iu_entry *iue)
359 union viosrp_iu *iu = vio_iu(iue);
360 struct srp_login_rsp *rsp = &iu->srp.login_rsp;
361 uint64_t tag = iu->srp.rsp.tag;
363 /* TODO handle case that requested size is wrong and
364 * buffer format is wrong
366 memset(iu, 0, sizeof(struct srp_login_rsp));
367 rsp->opcode = SRP_LOGIN_RSP;
368 rsp->req_lim_delta = INITIAL_SRP_LIMIT;
370 rsp->max_it_iu_len = sizeof(union srp_iu);
371 rsp->max_ti_iu_len = sizeof(union srp_iu);
372 /* direct and indirect */
373 rsp->buf_fmt = SRP_BUF_FORMAT_DIRECT | SRP_BUF_FORMAT_INDIRECT;
375 send_iu(iue, sizeof(*rsp), VIOSRP_SRP_FORMAT);
378 static inline void queue_cmd(struct iu_entry *iue)
380 struct srp_target *target = iue->target;
383 spin_lock_irqsave(&target->lock, flags);
384 list_add_tail(&iue->ilist, &target->cmd_queue);
385 spin_unlock_irqrestore(&target->lock, flags);
388 static int process_tsk_mgmt(struct iu_entry *iue)
390 union viosrp_iu *iu = vio_iu(iue);
393 dprintk("%p %u\n", iue, iu->srp.tsk_mgmt.tsk_mgmt_func);
395 switch (iu->srp.tsk_mgmt.tsk_mgmt_func) {
396 case SRP_TSK_ABORT_TASK:
399 case SRP_TSK_ABORT_TASK_SET:
402 case SRP_TSK_CLEAR_TASK_SET:
405 case SRP_TSK_LUN_RESET:
406 fn = LOGICAL_UNIT_RESET;
408 case SRP_TSK_CLEAR_ACA:
415 scsi_tgt_tsk_mgmt_request(iue->target->shost, fn,
416 iu->srp.tsk_mgmt.task_tag,
417 (struct scsi_lun *) &iu->srp.tsk_mgmt.lun,
420 send_rsp(iue, NULL, ILLEGAL_REQUEST, 0x20);
425 static int process_mad_iu(struct iu_entry *iue)
427 union viosrp_iu *iu = vio_iu(iue);
428 struct viosrp_adapter_info *info;
429 struct viosrp_host_config *conf;
431 switch (iu->mad.empty_iu.common.type) {
432 case VIOSRP_EMPTY_IU_TYPE:
433 eprintk("%s\n", "Unsupported EMPTY MAD IU");
435 case VIOSRP_ERROR_LOG_TYPE:
436 eprintk("%s\n", "Unsupported ERROR LOG MAD IU");
437 iu->mad.error_log.common.status = 1;
438 send_iu(iue, sizeof(iu->mad.error_log), VIOSRP_MAD_FORMAT);
440 case VIOSRP_ADAPTER_INFO_TYPE:
441 info = &iu->mad.adapter_info;
442 info->common.status = send_adapter_info(iue, info->buffer,
443 info->common.length);
444 send_iu(iue, sizeof(*info), VIOSRP_MAD_FORMAT);
446 case VIOSRP_HOST_CONFIG_TYPE:
447 conf = &iu->mad.host_config;
448 conf->common.status = 1;
449 send_iu(iue, sizeof(*conf), VIOSRP_MAD_FORMAT);
452 eprintk("Unknown type %u\n", iu->srp.rsp.opcode);
458 static int process_srp_iu(struct iu_entry *iue)
460 union viosrp_iu *iu = vio_iu(iue);
462 u8 opcode = iu->srp.rsp.opcode;
469 done = process_tsk_mgmt(iue);
483 eprintk("Unsupported type %u\n", opcode);
486 eprintk("Unknown type %u\n", opcode);
492 static void process_iu(struct viosrp_crq *crq, struct srp_target *target)
494 struct vio_port *vport = target_to_port(target);
495 struct iu_entry *iue;
499 iue = srp_iu_get(target);
501 eprintk("Error getting IU from pool, %p\n", target);
505 iue->remote_token = crq->IU_data_ptr;
507 err = h_copy_rdma(crq->IU_length, vport->riobn,
508 iue->remote_token, vport->liobn, iue->sbuf->dma);
510 if (err != H_SUCCESS) {
511 eprintk("%ld transferring data error %p\n", err, iue);
515 if (crq->format == VIOSRP_MAD_FORMAT)
516 done = process_mad_iu(iue);
518 done = process_srp_iu(iue);
524 static irqreturn_t ibmvstgt_interrupt(int irq, void *data)
526 struct srp_target *target = (struct srp_target *) data;
527 struct vio_port *vport = target_to_port(target);
529 vio_disable_interrupts(vport->dma_dev);
530 queue_work(vtgtd, &vport->crq_work);
535 static int crq_queue_create(struct crq_queue *queue, struct srp_target *target)
538 struct vio_port *vport = target_to_port(target);
540 queue->msgs = (struct viosrp_crq *) get_zeroed_page(GFP_KERNEL);
543 queue->size = PAGE_SIZE / sizeof(*queue->msgs);
545 queue->msg_token = dma_map_single(target->dev, queue->msgs,
546 queue->size * sizeof(*queue->msgs),
549 if (dma_mapping_error(queue->msg_token))
552 err = h_reg_crq(vport->dma_dev->unit_address, queue->msg_token,
555 /* If the adapter was left active for some reason (like kexec)
556 * try freeing and re-registering
558 if (err == H_RESOURCE) {
560 err = h_free_crq(vport->dma_dev->unit_address);
561 } while (err == H_BUSY || H_IS_LONG_BUSY(err));
563 err = h_reg_crq(vport->dma_dev->unit_address, queue->msg_token,
567 if (err != H_SUCCESS && err != 2) {
568 eprintk("Error 0x%x opening virtual adapter\n", err);
572 err = request_irq(vport->dma_dev->irq, &ibmvstgt_interrupt,
573 IRQF_DISABLED, "ibmvstgt", target);
577 vio_enable_interrupts(vport->dma_dev);
579 h_send_crq(vport->dma_dev->unit_address, 0xC001000000000000, 0);
582 spin_lock_init(&queue->lock);
588 err = h_free_crq(vport->dma_dev->unit_address);
589 } while (err == H_BUSY || H_IS_LONG_BUSY(err));
592 dma_unmap_single(target->dev, queue->msg_token,
593 queue->size * sizeof(*queue->msgs), DMA_BIDIRECTIONAL);
595 free_page((unsigned long) queue->msgs);
601 static void crq_queue_destroy(struct srp_target *target)
603 struct vio_port *vport = target_to_port(target);
604 struct crq_queue *queue = &vport->crq_queue;
607 free_irq(vport->dma_dev->irq, target);
609 err = h_free_crq(vport->dma_dev->unit_address);
610 } while (err == H_BUSY || H_IS_LONG_BUSY(err));
612 dma_unmap_single(target->dev, queue->msg_token,
613 queue->size * sizeof(*queue->msgs), DMA_BIDIRECTIONAL);
615 free_page((unsigned long) queue->msgs);
618 static void process_crq(struct viosrp_crq *crq, struct srp_target *target)
620 struct vio_port *vport = target_to_port(target);
621 dprintk("%x %x\n", crq->valid, crq->format);
623 switch (crq->valid) {
626 switch (crq->format) {
628 h_send_crq(vport->dma_dev->unit_address,
629 0xC002000000000000, 0);
634 eprintk("Unknown format %u\n", crq->format);
638 /* transport event */
642 switch (crq->format) {
643 case VIOSRP_SRP_FORMAT:
644 case VIOSRP_MAD_FORMAT:
645 process_iu(crq, target);
647 case VIOSRP_OS400_FORMAT:
648 case VIOSRP_AIX_FORMAT:
649 case VIOSRP_LINUX_FORMAT:
650 case VIOSRP_INLINE_FORMAT:
651 eprintk("Unsupported format %u\n", crq->format);
654 eprintk("Unknown format %u\n", crq->format);
658 eprintk("unknown message type 0x%02x!?\n", crq->valid);
662 static inline struct viosrp_crq *next_crq(struct crq_queue *queue)
664 struct viosrp_crq *crq;
667 spin_lock_irqsave(&queue->lock, flags);
668 crq = &queue->msgs[queue->cur];
669 if (crq->valid & 0x80) {
670 if (++queue->cur == queue->size)
674 spin_unlock_irqrestore(&queue->lock, flags);
679 static void handle_crq(struct work_struct *work)
681 struct vio_port *vport = container_of(work, struct vio_port, crq_work);
682 struct srp_target *target = vport->target;
683 struct viosrp_crq *crq;
687 while ((crq = next_crq(&vport->crq_queue)) != NULL) {
688 process_crq(crq, target);
692 vio_enable_interrupts(vport->dma_dev);
694 crq = next_crq(&vport->crq_queue);
696 vio_disable_interrupts(vport->dma_dev);
697 process_crq(crq, target);
703 handle_cmd_queue(target);
707 static int ibmvstgt_eh_abort_handler(struct scsi_cmnd *sc)
710 struct iu_entry *iue = (struct iu_entry *) sc->SCp.ptr;
711 struct srp_target *target = iue->target;
713 dprintk("%p %p %x\n", iue, target, vio_iu(iue)->srp.cmd.cdb[0]);
715 spin_lock_irqsave(&target->lock, flags);
716 list_del(&iue->ilist);
717 spin_unlock_irqrestore(&target->lock, flags);
724 static int ibmvstgt_tsk_mgmt_response(u64 mid, int result)
726 struct iu_entry *iue = (struct iu_entry *) ((void *) mid);
727 union viosrp_iu *iu = vio_iu(iue);
728 unsigned char status, asc;
730 eprintk("%p %d\n", iue, result);
734 switch (iu->srp.tsk_mgmt.tsk_mgmt_func) {
735 case SRP_TSK_ABORT_TASK:
738 status = ABORTED_COMMAND;
744 send_rsp(iue, NULL, status, asc);
750 static ssize_t system_id_show(struct class_device *cdev, char *buf)
752 return snprintf(buf, PAGE_SIZE, "%s\n", system_id);
755 static ssize_t partition_number_show(struct class_device *cdev, char *buf)
757 return snprintf(buf, PAGE_SIZE, "%x\n", partition_number);
760 static ssize_t unit_address_show(struct class_device *cdev, char *buf)
762 struct Scsi_Host *shost = class_to_shost(cdev);
763 struct srp_target *target = host_to_srp_target(shost);
764 struct vio_port *vport = target_to_port(target);
765 return snprintf(buf, PAGE_SIZE, "%x\n", vport->dma_dev->unit_address);
768 static CLASS_DEVICE_ATTR(system_id, S_IRUGO, system_id_show, NULL);
769 static CLASS_DEVICE_ATTR(partition_number, S_IRUGO, partition_number_show, NULL);
770 static CLASS_DEVICE_ATTR(unit_address, S_IRUGO, unit_address_show, NULL);
772 static struct class_device_attribute *ibmvstgt_attrs[] = {
773 &class_device_attr_system_id,
774 &class_device_attr_partition_number,
775 &class_device_attr_unit_address,
779 static struct scsi_host_template ibmvstgt_sht = {
781 .module = THIS_MODULE,
782 .can_queue = INITIAL_SRP_LIMIT,
783 .sg_tablesize = SG_ALL,
784 .use_clustering = DISABLE_CLUSTERING,
785 .max_sectors = DEFAULT_MAX_SECTORS,
786 .transfer_response = ibmvstgt_cmd_done,
787 .eh_abort_handler = ibmvstgt_eh_abort_handler,
788 .tsk_mgmt_response = ibmvstgt_tsk_mgmt_response,
789 .shost_attrs = ibmvstgt_attrs,
790 .proc_name = TGT_NAME,
793 static int ibmvstgt_probe(struct vio_dev *dev, const struct vio_device_id *id)
795 struct Scsi_Host *shost;
796 struct srp_target *target;
797 struct vio_port *vport;
798 unsigned int *dma, dma_size;
801 vport = kzalloc(sizeof(struct vio_port), GFP_KERNEL);
804 shost = scsi_host_alloc(&ibmvstgt_sht, sizeof(struct srp_target));
807 err = scsi_tgt_alloc_queue(shost);
811 target = host_to_srp_target(shost);
812 target->shost = shost;
813 vport->dma_dev = dev;
814 target->ldata = vport;
815 vport->target = target;
816 err = srp_target_alloc(target, &dev->dev, INITIAL_SRP_LIMIT,
821 dma = (unsigned int *) vio_get_attribute(dev, "ibm,my-dma-window",
823 if (!dma || dma_size != 40) {
824 eprintk("Couldn't get window property %d\n", dma_size);
826 goto free_srp_target;
828 vport->liobn = dma[0];
829 vport->riobn = dma[5];
831 INIT_WORK(&vport->crq_work, handle_crq);
833 err = crq_queue_create(&vport->crq_queue, target);
835 goto free_srp_target;
837 err = scsi_add_host(shost, target->dev);
843 crq_queue_destroy(target);
845 srp_target_free(target);
847 scsi_host_put(shost);
853 static int ibmvstgt_remove(struct vio_dev *dev)
855 struct srp_target *target = (struct srp_target *) dev->dev.driver_data;
856 struct Scsi_Host *shost = target->shost;
857 struct vio_port *vport = target->ldata;
859 crq_queue_destroy(target);
860 scsi_remove_host(shost);
861 scsi_tgt_free_queue(shost);
862 srp_target_free(target);
864 scsi_host_put(shost);
868 static struct vio_device_id ibmvstgt_device_table[] __devinitdata = {
869 {"v-scsi-host", "IBM,v-scsi-host"},
873 MODULE_DEVICE_TABLE(vio, ibmvstgt_device_table);
875 static struct vio_driver ibmvstgt_driver = {
876 .id_table = ibmvstgt_device_table,
877 .probe = ibmvstgt_probe,
878 .remove = ibmvstgt_remove,
881 .owner = THIS_MODULE,
885 static int get_system_info(void)
887 struct device_node *rootdn;
888 const char *id, *model, *name;
889 const unsigned int *num;
891 rootdn = of_find_node_by_path("/");
895 model = of_get_property(rootdn, "model", NULL);
896 id = of_get_property(rootdn, "system-id", NULL);
898 snprintf(system_id, sizeof(system_id), "%s-%s", model, id);
900 name = of_get_property(rootdn, "ibm,partition-name", NULL);
902 strncpy(partition_name, name, sizeof(partition_name));
904 num = of_get_property(rootdn, "ibm,partition-no", NULL);
906 partition_number = *num;
912 static int ibmvstgt_init(void)
916 printk("IBM eServer i/pSeries Virtual SCSI Target Driver\n");
918 vtgtd = create_workqueue("ibmvtgtd");
922 err = get_system_info();
926 err = vio_register_driver(&ibmvstgt_driver);
933 destroy_workqueue(vtgtd);
937 static void ibmvstgt_exit(void)
939 printk("Unregister IBM virtual SCSI driver\n");
941 destroy_workqueue(vtgtd);
942 vio_unregister_driver(&ibmvstgt_driver);
945 MODULE_DESCRIPTION("IBM Virtual SCSI Target");
946 MODULE_AUTHOR("Santiago Leon");
947 MODULE_LICENSE("GPL");
949 module_init(ibmvstgt_init);
950 module_exit(ibmvstgt_exit);