Lines Matching +full:host +full:- +full:port
2 * sx8.c: Driver for Promise SATA SX8 looks-like-I2O hardware
4 * Copyright 2004-2005 Red Hat, Inc.
19 #include <linux/blk-mq.h>
28 #include <linux/dma-mapping.h>
62 * Therefore, we default to the safe option -- 1 command -- but
75 /* 0xf is just arbitrary, non-zero noise; this is sorta like poisoning */
107 /* adapter-wide limits */
114 CARM_MAX_REQ = 64, /* max command msgs per host */
117 /* S/G limits, host-wide and per-request */
119 CARM_MAX_HOST_SG = 600, /* max s/g entries per host */
120 CARM_SG_LOW_WATER = (CARM_MAX_HOST_SG / 4), /* re-fill mark */
126 CARM_HMUC = 0x18, /* host message unit control */
193 FW_VER_NON_RAID = (1 << 1), /* 1=non-RAID firmware, 0=RAID */
217 HST_DEV_SCAN_START, /* start per-device probe */
218 HST_DEV_SCAN, /* continue per-device probe */
223 HST_GET_FW_VER, /* get firmware version, adapter port cnt */
245 struct carm_host *host; member
296 struct carm_port port[CARM_MAX_PORTS]; member
432 struct carm_port *port = bdev->bd_disk->private_data; in carm_bdev_getgeo() local
434 geo->heads = (u8) port->dev_geom_head; in carm_bdev_getgeo()
435 geo->sectors = (u8) port->dev_geom_sect; in carm_bdev_getgeo()
436 geo->cylinders = port->dev_geom_cyl; in carm_bdev_getgeo()
450 return -ENOENT; in carm_lookup_bucket()
461 static inline void *carm_ref_msg(struct carm_host *host, in carm_ref_msg() argument
464 return host->msg_base + (msg_idx * CARM_MSG_SIZE); in carm_ref_msg()
467 static inline dma_addr_t carm_ref_msg_dma(struct carm_host *host, in carm_ref_msg_dma() argument
470 return host->msg_dma + (msg_idx * CARM_MSG_SIZE); in carm_ref_msg_dma()
473 static int carm_send_msg(struct carm_host *host, in carm_send_msg() argument
476 void __iomem *mmio = host->mmio; in carm_send_msg()
477 u32 msg = (u32) carm_ref_msg_dma(host, tag); in carm_send_msg()
478 u32 cm_bucket = crq->msg_bucket; in carm_send_msg()
492 DPRINTK("host msg queue full\n"); in carm_send_msg()
493 rc = -EBUSY; in carm_send_msg()
502 static int carm_array_info (struct carm_host *host, unsigned int array_idx) in carm_array_info() argument
511 rq = blk_mq_alloc_request(host->oob_q, REQ_OP_DRV_OUT, 0); in carm_array_info()
513 rc = -ENOMEM; in carm_array_info()
518 ioc = carm_ref_msg(host, rq->tag); in carm_array_info()
519 msg_dma = carm_ref_msg_dma(host, rq->tag); in carm_array_info()
522 crq->msg_type = CARM_MSG_ARRAY; in carm_array_info()
523 crq->msg_subtype = CARM_ARRAY_INFO; in carm_array_info()
527 crq->msg_bucket = (u32) rc; in carm_array_info()
530 ioc->type = CARM_MSG_ARRAY; in carm_array_info()
531 ioc->subtype = CARM_ARRAY_INFO; in carm_array_info()
532 ioc->array_id = (u8) array_idx; in carm_array_info()
533 ioc->handle = cpu_to_le32(TAG_ENCODE(rq->tag)); in carm_array_info()
534 ioc->data_addr = cpu_to_le32(msg_data); in carm_array_info()
536 spin_lock_irq(&host->lock); in carm_array_info()
537 assert(host->state == HST_DEV_SCAN_START || in carm_array_info()
538 host->state == HST_DEV_SCAN); in carm_array_info()
539 spin_unlock_irq(&host->lock); in carm_array_info()
541 DPRINTK("blk_execute_rq_nowait, tag == %u\n", rq->tag); in carm_array_info()
542 blk_execute_rq_nowait(host->oob_q, NULL, rq, true, NULL); in carm_array_info()
547 spin_lock_irq(&host->lock); in carm_array_info()
548 host->state = HST_ERROR; in carm_array_info()
549 spin_unlock_irq(&host->lock); in carm_array_info()
555 static int carm_send_special (struct carm_host *host, carm_sspc_t func) in carm_send_special() argument
564 rq = blk_mq_alloc_request(host->oob_q, REQ_OP_DRV_OUT, 0); in carm_send_special()
566 return -ENOMEM; in carm_send_special()
569 mem = carm_ref_msg(host, rq->tag); in carm_send_special()
571 msg_size = func(host, rq->tag, mem); in carm_send_special()
574 crq->msg_type = ioc->type; in carm_send_special()
575 crq->msg_subtype = ioc->subtype; in carm_send_special()
578 crq->msg_bucket = (u32) rc; in carm_send_special()
580 DPRINTK("blk_execute_rq_nowait, tag == %u\n", rq->tag); in carm_send_special()
581 blk_execute_rq_nowait(host->oob_q, NULL, rq, true, NULL); in carm_send_special()
586 static unsigned int carm_fill_sync_time(struct carm_host *host, in carm_fill_sync_time() argument
594 st->type = CARM_MSG_MISC; in carm_fill_sync_time()
595 st->subtype = MISC_SET_TIME; in carm_fill_sync_time()
596 st->handle = cpu_to_le32(TAG_ENCODE(idx)); in carm_fill_sync_time()
597 st->timestamp = cpu_to_le32(tv); in carm_fill_sync_time()
602 static unsigned int carm_fill_alloc_buf(struct carm_host *host, in carm_fill_alloc_buf() argument
608 ab->type = CARM_MSG_MISC; in carm_fill_alloc_buf()
609 ab->subtype = MISC_ALLOC_MEM; in carm_fill_alloc_buf()
610 ab->handle = cpu_to_le32(TAG_ENCODE(idx)); in carm_fill_alloc_buf()
611 ab->n_sg = 1; in carm_fill_alloc_buf()
612 ab->sg_type = SGT_32BIT; in carm_fill_alloc_buf()
613 ab->addr = cpu_to_le32(host->shm_dma + (PDC_SHM_SIZE >> 1)); in carm_fill_alloc_buf()
614 ab->len = cpu_to_le32(PDC_SHM_SIZE >> 1); in carm_fill_alloc_buf()
615 ab->evt_pool = cpu_to_le32(host->shm_dma + (16 * 1024)); in carm_fill_alloc_buf()
616 ab->n_evt = cpu_to_le32(1024); in carm_fill_alloc_buf()
617 ab->rbuf_pool = cpu_to_le32(host->shm_dma); in carm_fill_alloc_buf()
618 ab->n_rbuf = cpu_to_le32(RMSG_Q_LEN); in carm_fill_alloc_buf()
619 ab->msg_pool = cpu_to_le32(host->shm_dma + RBUF_LEN); in carm_fill_alloc_buf()
620 ab->n_msg = cpu_to_le32(CARM_Q_LEN); in carm_fill_alloc_buf()
621 ab->sg[0].start = cpu_to_le32(host->shm_dma + (PDC_SHM_SIZE >> 1)); in carm_fill_alloc_buf()
622 ab->sg[0].len = cpu_to_le32(65536); in carm_fill_alloc_buf()
627 static unsigned int carm_fill_scan_channels(struct carm_host *host, in carm_fill_scan_channels() argument
631 u32 msg_data = (u32) (carm_ref_msg_dma(host, idx) + in carm_fill_scan_channels()
635 ioc->type = CARM_MSG_IOCTL; in carm_fill_scan_channels()
636 ioc->subtype = CARM_IOC_SCAN_CHAN; in carm_fill_scan_channels()
637 ioc->handle = cpu_to_le32(TAG_ENCODE(idx)); in carm_fill_scan_channels()
638 ioc->data_addr = cpu_to_le32(msg_data); in carm_fill_scan_channels()
647 static unsigned int carm_fill_get_fw_ver(struct carm_host *host, in carm_fill_get_fw_ver() argument
651 u32 msg_data = (u32) (carm_ref_msg_dma(host, idx) + sizeof(*ioc)); in carm_fill_get_fw_ver()
654 ioc->type = CARM_MSG_MISC; in carm_fill_get_fw_ver()
655 ioc->subtype = MISC_GET_FW_VER; in carm_fill_get_fw_ver()
656 ioc->handle = cpu_to_le32(TAG_ENCODE(idx)); in carm_fill_get_fw_ver()
657 ioc->data_addr = cpu_to_le32(msg_data); in carm_fill_get_fw_ver()
663 static inline void carm_push_q (struct carm_host *host, struct request_queue *q) in carm_push_q() argument
665 unsigned int idx = host->wait_q_prod % CARM_MAX_WAIT_Q; in carm_push_q()
670 host->wait_q[idx] = q; in carm_push_q()
671 host->wait_q_prod++; in carm_push_q()
672 BUG_ON(host->wait_q_prod == host->wait_q_cons); /* overrun */ in carm_push_q()
675 static inline struct request_queue *carm_pop_q(struct carm_host *host) in carm_pop_q() argument
679 if (host->wait_q_prod == host->wait_q_cons) in carm_pop_q()
682 idx = host->wait_q_cons % CARM_MAX_WAIT_Q; in carm_pop_q()
683 host->wait_q_cons++; in carm_pop_q()
685 return host->wait_q[idx]; in carm_pop_q()
688 static inline void carm_round_robin(struct carm_host *host) in carm_round_robin() argument
690 struct request_queue *q = carm_pop_q(host); in carm_round_robin()
705 struct request_queue *q = hctx->queue; in carm_queue_rq()
706 struct request *rq = bd->rq; in carm_queue_rq()
707 struct carm_port *port = q->queuedata; in carm_queue_rq() local
708 struct carm_host *host = port->host; in carm_queue_rq() local
716 crq->n_elem = 0; in carm_queue_rq()
717 sg_init_table(crq->sg, CARM_MAX_REQ_SG); in carm_queue_rq()
721 spin_lock_irq(&host->lock); in carm_queue_rq()
726 sg = &crq->sg[0]; in carm_queue_rq()
732 n_elem = dma_map_sg(&host->pdev->dev, sg, n_elem, carm_rq_dir(rq)); in carm_queue_rq()
737 if (host->hw_sg_used >= CARM_MAX_HOST_SG - n_elem) in carm_queue_rq()
740 crq->n_elem = n_elem; in carm_queue_rq()
741 host->hw_sg_used += n_elem; in carm_queue_rq()
748 msg = (struct carm_msg_rw *) carm_ref_msg(host, rq->tag); in carm_queue_rq()
751 msg->type = CARM_MSG_WRITE; in carm_queue_rq()
752 crq->msg_type = CARM_MSG_WRITE; in carm_queue_rq()
754 msg->type = CARM_MSG_READ; in carm_queue_rq()
755 crq->msg_type = CARM_MSG_READ; in carm_queue_rq()
758 msg->id = port->port_no; in carm_queue_rq()
759 msg->sg_count = n_elem; in carm_queue_rq()
760 msg->sg_type = SGT_32BIT; in carm_queue_rq()
761 msg->handle = cpu_to_le32(TAG_ENCODE(rq->tag)); in carm_queue_rq()
762 msg->lba = cpu_to_le32(blk_rq_pos(rq) & 0xffffffff); in carm_queue_rq()
764 msg->lba_high = cpu_to_le16( (u16) tmp ); in carm_queue_rq()
765 msg->lba_count = cpu_to_le16(blk_rq_sectors(rq)); in carm_queue_rq()
767 msg_size = sizeof(struct carm_msg_rw) - sizeof(msg->sg); in carm_queue_rq()
769 struct carm_msg_sg *carm_sg = &msg->sg[i]; in carm_queue_rq()
770 carm_sg->start = cpu_to_le32(sg_dma_address(&crq->sg[i])); in carm_queue_rq()
771 carm_sg->len = cpu_to_le32(sg_dma_len(&crq->sg[i])); in carm_queue_rq()
777 crq->msg_bucket = (u32) rc; in carm_queue_rq()
782 VPRINTK("send msg, tag == %u\n", rq->tag); in carm_queue_rq()
783 rc = carm_send_msg(host, crq, rq->tag); in carm_queue_rq()
785 host->hw_sg_used -= n_elem; in carm_queue_rq()
789 spin_unlock_irq(&host->lock); in carm_queue_rq()
792 dma_unmap_sg(&host->pdev->dev, &crq->sg[0], n_elem, carm_rq_dir(rq)); in carm_queue_rq()
793 carm_push_q(host, q); in carm_queue_rq()
794 spin_unlock_irq(&host->lock); in carm_queue_rq()
797 carm_round_robin(host); in carm_queue_rq()
798 spin_unlock_irq(&host->lock); in carm_queue_rq()
802 static void carm_handle_array_info(struct carm_host *host, in carm_handle_array_info() argument
806 struct carm_port *port; in carm_handle_array_info() local
817 if (le32_to_cpu(desc->array_status) & ARRAY_NO_EXIST) in carm_handle_array_info()
820 cur_port = host->cur_scan_dev; in carm_handle_array_info()
825 cur_port, (int) desc->array_id); in carm_handle_array_info()
829 port = &host->port[cur_port]; in carm_handle_array_info()
831 lo = (u64) le32_to_cpu(desc->size); in carm_handle_array_info()
832 hi = (u64) le16_to_cpu(desc->size_hi); in carm_handle_array_info()
834 port->capacity = lo | (hi << 32); in carm_handle_array_info()
835 port->dev_geom_head = le16_to_cpu(desc->head); in carm_handle_array_info()
836 port->dev_geom_sect = le16_to_cpu(desc->sect); in carm_handle_array_info()
837 port->dev_geom_cyl = le16_to_cpu(desc->cyl); in carm_handle_array_info()
839 host->dev_active |= (1 << cur_port); in carm_handle_array_info()
841 strncpy(port->name, desc->name, sizeof(port->name)); in carm_handle_array_info()
842 port->name[sizeof(port->name) - 1] = 0; in carm_handle_array_info()
843 slen = strlen(port->name); in carm_handle_array_info()
844 while (slen && (port->name[slen - 1] == ' ')) { in carm_handle_array_info()
845 port->name[slen - 1] = 0; in carm_handle_array_info()
846 slen--; in carm_handle_array_info()
849 printk(KERN_INFO DRV_NAME "(%s): port %u device %Lu sectors\n", in carm_handle_array_info()
850 pci_name(host->pdev), port->port_no, in carm_handle_array_info()
851 (unsigned long long) port->capacity); in carm_handle_array_info()
852 printk(KERN_INFO DRV_NAME "(%s): port %u device \"%s\"\n", in carm_handle_array_info()
853 pci_name(host->pdev), port->port_no, port->name); in carm_handle_array_info()
856 assert(host->state == HST_DEV_SCAN); in carm_handle_array_info()
857 schedule_work(&host->fsm_task); in carm_handle_array_info()
860 static void carm_handle_scan_chan(struct carm_host *host, in carm_handle_scan_chan() argument
875 /* TODO: scan and support non-disk devices */ in carm_handle_scan_chan()
877 if (msg_data[i] == 0) { /* direct-access device (disk) */ in carm_handle_scan_chan()
878 host->dev_present |= (1 << i); in carm_handle_scan_chan()
883 pci_name(host->pdev), dev_count); in carm_handle_scan_chan()
886 assert(host->state == HST_PORT_SCAN); in carm_handle_scan_chan()
887 host->state = new_state; in carm_handle_scan_chan()
888 schedule_work(&host->fsm_task); in carm_handle_scan_chan()
891 static void carm_handle_generic(struct carm_host *host, in carm_handle_generic() argument
897 assert(host->state == cur_state); in carm_handle_generic()
899 host->state = HST_ERROR; in carm_handle_generic()
901 host->state = next_state; in carm_handle_generic()
902 schedule_work(&host->fsm_task); in carm_handle_generic()
905 static inline void carm_handle_resp(struct carm_host *host, in carm_handle_resp() argument
919 pci_name(host->pdev), handle); in carm_handle_resp()
926 rq = blk_mq_tag_to_rq(host->tag_set.tags[0], msg_idx); in carm_handle_resp()
930 if (likely(crq->msg_type == CARM_MSG_READ || in carm_handle_resp()
931 crq->msg_type == CARM_MSG_WRITE)) { in carm_handle_resp()
932 dma_unmap_sg(&host->pdev->dev, &crq->sg[0], crq->n_elem, in carm_handle_resp()
937 mem = carm_ref_msg(host, msg_idx); in carm_handle_resp()
939 switch (crq->msg_type) { in carm_handle_resp()
941 switch (crq->msg_subtype) { in carm_handle_resp()
943 carm_handle_scan_chan(host, crq, mem, error); in carm_handle_resp()
953 switch (crq->msg_subtype) { in carm_handle_resp()
955 carm_handle_generic(host, crq, error, in carm_handle_resp()
959 carm_handle_generic(host, crq, error, in carm_handle_resp()
966 host->fw_ver = le32_to_cpu(ver->version); in carm_handle_resp()
967 host->flags |= (ver->features & FL_FW_VER_MASK); in carm_handle_resp()
969 carm_handle_generic(host, crq, error, in carm_handle_resp()
981 switch (crq->msg_subtype) { in carm_handle_resp()
983 carm_handle_array_info(host, crq, mem, error); in carm_handle_resp()
1001 pci_name(host->pdev), crq->msg_type, crq->msg_subtype); in carm_handle_resp()
1004 host->hw_sg_used -= crq->n_elem; in carm_handle_resp()
1007 if (host->hw_sg_used <= CARM_SG_LOW_WATER) in carm_handle_resp()
1008 carm_round_robin(host); in carm_handle_resp()
1011 static inline void carm_handle_responses(struct carm_host *host) in carm_handle_responses() argument
1013 void __iomem *mmio = host->mmio; in carm_handle_responses()
1014 struct carm_response *resp = (struct carm_response *) host->shm; in carm_handle_responses()
1016 unsigned int idx = host->resp_idx % RMSG_Q_LEN; in carm_handle_responses()
1030 carm_handle_resp(host, resp[idx].ret_handle, status); in carm_handle_responses()
1039 pci_name(host->pdev), (int) evt_type); in carm_handle_responses()
1048 host->resp_idx += work; in carm_handle_responses()
1053 struct carm_host *host = __host; in carm_interrupt() local
1059 if (!host) { in carm_interrupt()
1060 VPRINTK("no host\n"); in carm_interrupt()
1064 spin_lock_irqsave(&host->lock, flags); in carm_interrupt()
1066 mmio = host->mmio; in carm_interrupt()
1079 if (unlikely(host->state == HST_INVALID)) { in carm_interrupt()
1086 carm_handle_responses(host); in carm_interrupt()
1090 spin_unlock_irqrestore(&host->lock, flags); in carm_interrupt()
1097 struct carm_host *host = in carm_fsm_task() local
1105 spin_lock_irqsave(&host->lock, flags); in carm_fsm_task()
1106 state = host->state; in carm_fsm_task()
1107 spin_unlock_irqrestore(&host->lock, flags); in carm_fsm_task()
1118 rc = carm_send_special(host, carm_fill_alloc_buf); in carm_fsm_task()
1126 rc = carm_send_special(host, carm_fill_sync_time); in carm_fsm_task()
1134 rc = carm_send_special(host, carm_fill_get_fw_ver); in carm_fsm_task()
1142 rc = carm_send_special(host, carm_fill_scan_channels); in carm_fsm_task()
1150 host->cur_scan_dev = -1; in carm_fsm_task()
1156 next_dev = -1; in carm_fsm_task()
1157 for (i = host->cur_scan_dev + 1; i < CARM_MAX_PORTS; i++) in carm_fsm_task()
1158 if (host->dev_present & (1 << i)) { in carm_fsm_task()
1164 host->cur_scan_dev = next_dev; in carm_fsm_task()
1165 rc = carm_array_info(host, next_dev); in carm_fsm_task()
1179 if (host->dev_active & (1 << i)) { in carm_fsm_task()
1180 struct carm_port *port = &host->port[i]; in carm_fsm_task() local
1181 struct gendisk *disk = port->disk; in carm_fsm_task()
1183 set_capacity(disk, port->capacity); in carm_fsm_task()
1189 pci_name(host->pdev), activated); in carm_fsm_task()
1197 complete(&host->probe_comp); in carm_fsm_task()
1212 spin_lock_irqsave(&host->lock, flags); in carm_fsm_task()
1213 host->state = new_state; in carm_fsm_task()
1214 spin_unlock_irqrestore(&host->lock, flags); in carm_fsm_task()
1217 schedule_work(&host->fsm_task); in carm_fsm_task()
1241 return -EBUSY; in carm_init_wait()
1244 static void carm_init_responses(struct carm_host *host) in carm_init_responses() argument
1246 void __iomem *mmio = host->mmio; in carm_init_responses()
1248 struct carm_response *resp = (struct carm_response *) host->shm; in carm_init_responses()
1256 static int carm_init_host(struct carm_host *host) in carm_init_host() argument
1258 void __iomem *mmio = host->mmio; in carm_init_host()
1307 writel(host->shm_dma & 0xffffffff, mmio + RBUF_ADDR_LO); in carm_init_host()
1308 writel((host->shm_dma >> 16) >> 16, mmio + RBUF_ADDR_HI); in carm_init_host()
1325 carm_init_responses(host); in carm_init_host()
1328 spin_lock_irq(&host->lock); in carm_init_host()
1329 assert(host->state == HST_INVALID); in carm_init_host()
1330 host->state = HST_PROBE_START; in carm_init_host()
1331 spin_unlock_irq(&host->lock); in carm_init_host()
1332 schedule_work(&host->fsm_task); in carm_init_host()
1342 static int carm_init_disk(struct carm_host *host, unsigned int port_no) in carm_init_disk() argument
1344 struct carm_port *port = &host->port[port_no]; in carm_init_disk() local
1348 port->host = host; in carm_init_disk()
1349 port->port_no = port_no; in carm_init_disk()
1353 return -ENOMEM; in carm_init_disk()
1355 port->disk = disk; in carm_init_disk()
1356 sprintf(disk->disk_name, DRV_NAME "/%u", in carm_init_disk()
1357 (unsigned int)host->id * CARM_MAX_PORTS + port_no); in carm_init_disk()
1358 disk->major = host->major; in carm_init_disk()
1359 disk->first_minor = port_no * CARM_MINORS_PER_MAJOR; in carm_init_disk()
1360 disk->fops = &carm_bd_ops; in carm_init_disk()
1361 disk->private_data = port; in carm_init_disk()
1363 q = blk_mq_init_queue(&host->tag_set); in carm_init_disk()
1370 q->queuedata = port; in carm_init_disk()
1371 disk->queue = q; in carm_init_disk()
1375 static void carm_free_disk(struct carm_host *host, unsigned int port_no) in carm_free_disk() argument
1377 struct carm_port *port = &host->port[port_no]; in carm_free_disk() local
1378 struct gendisk *disk = port->disk; in carm_free_disk()
1383 if (disk->flags & GENHD_FL_UP) in carm_free_disk()
1385 if (disk->queue) in carm_free_disk()
1386 blk_cleanup_queue(disk->queue); in carm_free_disk()
1390 static int carm_init_shm(struct carm_host *host) in carm_init_shm() argument
1392 host->shm = dma_alloc_coherent(&host->pdev->dev, CARM_SHM_SIZE, in carm_init_shm()
1393 &host->shm_dma, GFP_KERNEL); in carm_init_shm()
1394 if (!host->shm) in carm_init_shm()
1395 return -ENOMEM; in carm_init_shm()
1397 host->msg_base = host->shm + RBUF_LEN; in carm_init_shm()
1398 host->msg_dma = host->shm_dma + RBUF_LEN; in carm_init_shm()
1400 memset(host->shm, 0xff, RBUF_LEN); in carm_init_shm()
1401 memset(host->msg_base, 0, PDC_SHM_SIZE - RBUF_LEN); in carm_init_shm()
1408 struct carm_host *host; in carm_init_one() local
1423 rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); in carm_init_one()
1430 host = kzalloc(sizeof(*host), GFP_KERNEL); in carm_init_one()
1431 if (!host) { in carm_init_one()
1434 rc = -ENOMEM; in carm_init_one()
1438 host->pdev = pdev; in carm_init_one()
1439 spin_lock_init(&host->lock); in carm_init_one()
1440 INIT_WORK(&host->fsm_task, carm_fsm_task); in carm_init_one()
1441 init_completion(&host->probe_comp); in carm_init_one()
1443 host->mmio = ioremap(pci_resource_start(pdev, 0), in carm_init_one()
1445 if (!host->mmio) { in carm_init_one()
1448 rc = -ENOMEM; in carm_init_one()
1452 rc = carm_init_shm(host); in carm_init_one()
1459 memset(&host->tag_set, 0, sizeof(host->tag_set)); in carm_init_one()
1460 host->tag_set.ops = &carm_mq_ops; in carm_init_one()
1461 host->tag_set.cmd_size = sizeof(struct carm_request); in carm_init_one()
1462 host->tag_set.nr_hw_queues = 1; in carm_init_one()
1463 host->tag_set.nr_maps = 1; in carm_init_one()
1464 host->tag_set.queue_depth = max_queue; in carm_init_one()
1465 host->tag_set.numa_node = NUMA_NO_NODE; in carm_init_one()
1466 host->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; in carm_init_one()
1468 rc = blk_mq_alloc_tag_set(&host->tag_set); in carm_init_one()
1472 q = blk_mq_init_queue(&host->tag_set); in carm_init_one()
1475 blk_mq_free_tag_set(&host->tag_set); in carm_init_one()
1479 host->oob_q = q; in carm_init_one()
1480 q->queuedata = host; in carm_init_one()
1486 host->major = 160; in carm_init_one()
1488 host->major = 161; in carm_init_one()
1490 host->flags |= FL_DYN_MAJOR; in carm_init_one()
1492 host->id = carm_host_id; in carm_init_one()
1493 sprintf(host->name, DRV_NAME "%d", carm_host_id); in carm_init_one()
1495 rc = register_blkdev(host->major, host->name); in carm_init_one()
1498 if (host->flags & FL_DYN_MAJOR) in carm_init_one()
1499 host->major = rc; in carm_init_one()
1502 rc = carm_init_disk(host, i); in carm_init_one()
1509 rc = request_irq(pdev->irq, carm_interrupt, IRQF_SHARED, DRV_NAME, host); in carm_init_one()
1516 rc = carm_init_host(host); in carm_init_one()
1521 wait_for_completion(&host->probe_comp); in carm_init_one()
1524 host->name, pci_name(pdev), (int) CARM_MAX_PORTS, in carm_init_one()
1526 pdev->irq, host->major); in carm_init_one()
1529 pci_set_drvdata(pdev, host); in carm_init_one()
1533 free_irq(pdev->irq, host); in carm_init_one()
1536 carm_free_disk(host, i); in carm_init_one()
1537 unregister_blkdev(host->major, host->name); in carm_init_one()
1539 if (host->major == 160) in carm_init_one()
1541 else if (host->major == 161) in carm_init_one()
1543 blk_cleanup_queue(host->oob_q); in carm_init_one()
1544 blk_mq_free_tag_set(&host->tag_set); in carm_init_one()
1546 dma_free_coherent(&pdev->dev, CARM_SHM_SIZE, host->shm, host->shm_dma); in carm_init_one()
1548 iounmap(host->mmio); in carm_init_one()
1550 kfree(host); in carm_init_one()
1560 struct carm_host *host = pci_get_drvdata(pdev); in carm_remove_one() local
1563 if (!host) { in carm_remove_one()
1564 printk(KERN_ERR PFX "BUG: no host data for PCI(%s)\n", in carm_remove_one()
1569 free_irq(pdev->irq, host); in carm_remove_one()
1571 carm_free_disk(host, i); in carm_remove_one()
1572 unregister_blkdev(host->major, host->name); in carm_remove_one()
1573 if (host->major == 160) in carm_remove_one()
1575 else if (host->major == 161) in carm_remove_one()
1577 blk_cleanup_queue(host->oob_q); in carm_remove_one()
1578 blk_mq_free_tag_set(&host->tag_set); in carm_remove_one()
1579 dma_free_coherent(&pdev->dev, CARM_SHM_SIZE, host->shm, host->shm_dma); in carm_remove_one()
1580 iounmap(host->mmio); in carm_remove_one()
1581 kfree(host); in carm_remove_one()