Lines Matching full:cd

163 static void print_ddcb_info(struct genwqe_dev *cd, struct ddcb_queue *queue)  in print_ddcb_info()  argument
168 struct pci_dev *pci_dev = cd->pci_dev; in print_ddcb_info()
170 spin_lock_irqsave(&cd->print_lock, flags); in print_ddcb_info()
174 cd->card_idx, queue->ddcb_act, queue->ddcb_next); in print_ddcb_info()
190 spin_unlock_irqrestore(&cd->print_lock, flags); in print_ddcb_info()
229 * @cd: pointer to genwqe device descriptor
241 static int ddcb_requ_finished(struct genwqe_dev *cd, struct ddcb_requ *req) in ddcb_requ_finished() argument
244 (cd->card_state != GENWQE_CARD_USED); in ddcb_requ_finished()
251 * @cd: pointer to genwqe device descriptor
265 static int enqueue_ddcb(struct genwqe_dev *cd, struct ddcb_queue *queue, in enqueue_ddcb() argument
312 __genwqe_writeq(cd, queue->IO_QUEUE_OFFSET, num); /* start queue */ in enqueue_ddcb()
360 * @cd: pointer to genwqe device descriptor
365 static int genwqe_check_ddcb_queue(struct genwqe_dev *cd, in genwqe_check_ddcb_queue() argument
370 struct pci_dev *pci_dev = cd->pci_dev; in genwqe_check_ddcb_queue()
410 errcnts = __genwqe_readq(cd, queue->IO_QUEUE_ERRCNTS); in genwqe_check_ddcb_queue()
411 status = __genwqe_readq(cd, queue->IO_QUEUE_STATUS); in genwqe_check_ddcb_queue()
462 * @cd: pointer to genwqe device descriptor
477 int __genwqe_wait_ddcb(struct genwqe_dev *cd, struct ddcb_requ *req) in __genwqe_wait_ddcb() argument
482 struct pci_dev *pci_dev = cd->pci_dev; in __genwqe_wait_ddcb()
496 ddcb_requ_finished(cd, req), in __genwqe_wait_ddcb()
514 genwqe_check_ddcb_queue(cd, req->queue); in __genwqe_wait_ddcb()
515 if (ddcb_requ_finished(cd, req)) in __genwqe_wait_ddcb()
524 __genwqe_readq(cd, queue->IO_QUEUE_STATUS)); in __genwqe_wait_ddcb()
529 print_ddcb_info(cd, req->queue); in __genwqe_wait_ddcb()
547 if (cd->card_state != GENWQE_CARD_USED) { in __genwqe_wait_ddcb()
558 * @cd: pointer to genwqe device descriptor
567 static struct ddcb *get_next_ddcb(struct genwqe_dev *cd, in get_next_ddcb() argument
607 * @cd: genwqe device descriptor
620 int __genwqe_purge_ddcb(struct genwqe_dev *cd, struct ddcb_requ *req) in __genwqe_purge_ddcb() argument
626 struct pci_dev *pci_dev = cd->pci_dev; in __genwqe_purge_ddcb()
710 queue_status = __genwqe_readq(cd, queue->IO_QUEUE_STATUS); in __genwqe_purge_ddcb()
720 print_ddcb_info(cd, req->queue); in __genwqe_purge_ddcb()
725 int genwqe_init_debug_data(struct genwqe_dev *cd, struct genwqe_debug_data *d) in genwqe_init_debug_data() argument
728 struct pci_dev *pci_dev = cd->pci_dev; in genwqe_init_debug_data()
739 d->slu_unitcfg = cd->slu_unitcfg; in genwqe_init_debug_data()
740 d->app_unitcfg = cd->app_unitcfg; in genwqe_init_debug_data()
746 * @cd: pointer to genwqe device descriptor
754 int __genwqe_enqueue_ddcb(struct genwqe_dev *cd, struct ddcb_requ *req, in __genwqe_enqueue_ddcb() argument
760 struct pci_dev *pci_dev = cd->pci_dev; in __genwqe_enqueue_ddcb()
764 if (cd->card_state != GENWQE_CARD_USED) { in __genwqe_enqueue_ddcb()
772 queue = req->queue = &cd->queue; in __genwqe_enqueue_ddcb()
778 genwqe_check_ddcb_queue(cd, queue); in __genwqe_enqueue_ddcb()
787 pddcb = get_next_ddcb(cd, queue, &req->num); /* get ptr and num */ in __genwqe_enqueue_ddcb()
832 if ((cd->slu_unitcfg & 0xFFFF0ull) > 0x34199ull) in __genwqe_enqueue_ddcb()
855 if (genwqe_get_slu_id(cd) <= 0x2) { in __genwqe_enqueue_ddcb()
887 genwqe_init_debug_data(cd, &req->debug_data); in __genwqe_enqueue_ddcb()
892 enqueue_ddcb(cd, queue, pddcb, req->num); in __genwqe_enqueue_ddcb()
900 wake_up_interruptible(&cd->queue_waitq); in __genwqe_enqueue_ddcb()
907 * @cd: pointer to genwqe device descriptor
911 int __genwqe_execute_raw_ddcb(struct genwqe_dev *cd, in __genwqe_execute_raw_ddcb() argument
916 struct pci_dev *pci_dev = cd->pci_dev; in __genwqe_execute_raw_ddcb()
929 rc = __genwqe_enqueue_ddcb(cd, req, f_flags); in __genwqe_execute_raw_ddcb()
933 rc = __genwqe_wait_ddcb(cd, req); in __genwqe_execute_raw_ddcb()
959 __genwqe_purge_ddcb(cd, req); in __genwqe_execute_raw_ddcb()
973 * @cd: pointer to genwqe device descriptor
977 static int genwqe_next_ddcb_ready(struct genwqe_dev *cd) in genwqe_next_ddcb_ready() argument
981 struct ddcb_queue *queue = &cd->queue; in genwqe_next_ddcb_ready()
1002 * @cd: pointer to genwqe device descriptor
1008 int genwqe_ddcbs_in_flight(struct genwqe_dev *cd) in genwqe_ddcbs_in_flight() argument
1012 struct ddcb_queue *queue = &cd->queue; in genwqe_ddcbs_in_flight()
1021 static int setup_ddcb_queue(struct genwqe_dev *cd, struct ddcb_queue *queue) in setup_ddcb_queue() argument
1027 struct pci_dev *pci_dev = cd->pci_dev; in setup_ddcb_queue()
1042 queue->ddcb_vaddr = __genwqe_alloc_consistent(cd, queue_size, in setup_ddcb_queue()
1080 __genwqe_writeq(cd, queue->IO_QUEUE_CONFIG, 0x07); /* iCRC/vCRC */ in setup_ddcb_queue()
1081 __genwqe_writeq(cd, queue->IO_QUEUE_SEGMENT, queue->ddcb_daddr); in setup_ddcb_queue()
1082 __genwqe_writeq(cd, queue->IO_QUEUE_INITSQN, queue->ddcb_seq); in setup_ddcb_queue()
1083 __genwqe_writeq(cd, queue->IO_QUEUE_WRAP, val64); in setup_ddcb_queue()
1090 __genwqe_free_consistent(cd, queue_size, queue->ddcb_vaddr, in setup_ddcb_queue()
1103 static void free_ddcb_queue(struct genwqe_dev *cd, struct ddcb_queue *queue) in free_ddcb_queue() argument
1113 __genwqe_free_consistent(cd, queue_size, queue->ddcb_vaddr, in free_ddcb_queue()
1123 struct genwqe_dev *cd = (struct genwqe_dev *)dev_id; in genwqe_pf_isr() local
1124 struct pci_dev *pci_dev = cd->pci_dev; in genwqe_pf_isr()
1130 cd->irqs_processed++; in genwqe_pf_isr()
1131 wake_up_interruptible(&cd->queue_waitq); in genwqe_pf_isr()
1137 gfir = __genwqe_readq(cd, IO_SLC_CFGREG_GFIR); in genwqe_pf_isr()
1141 if (cd->use_platform_recovery) { in genwqe_pf_isr()
1147 readq(cd->mmio + IO_SLC_CFGREG_GFIR); in genwqe_pf_isr()
1154 wake_up_interruptible(&cd->health_waitq); in genwqe_pf_isr()
1171 struct genwqe_dev *cd = (struct genwqe_dev *)dev_id; in genwqe_vf_isr() local
1173 cd->irqs_processed++; in genwqe_vf_isr()
1174 wake_up_interruptible(&cd->queue_waitq); in genwqe_vf_isr()
1191 struct genwqe_dev *cd = (struct genwqe_dev *)data; in genwqe_card_thread() local
1195 genwqe_check_ddcb_queue(cd, &cd->queue); in genwqe_card_thread()
1199 cd->queue_waitq, in genwqe_card_thread()
1200 genwqe_ddcbs_in_flight(cd) || in genwqe_card_thread()
1204 cd->queue_waitq, in genwqe_card_thread()
1205 genwqe_next_ddcb_ready(cd) || in genwqe_card_thread()
1222 * @cd: pointer to genwqe device descriptor
1228 int genwqe_setup_service_layer(struct genwqe_dev *cd) in genwqe_setup_service_layer() argument
1232 struct pci_dev *pci_dev = cd->pci_dev; in genwqe_setup_service_layer()
1234 if (genwqe_is_privileged(cd)) { in genwqe_setup_service_layer()
1235 rc = genwqe_card_reset(cd); in genwqe_setup_service_layer()
1241 genwqe_read_softreset(cd); in genwqe_setup_service_layer()
1244 queue = &cd->queue; in genwqe_setup_service_layer()
1255 rc = setup_ddcb_queue(cd, queue); in genwqe_setup_service_layer()
1261 init_waitqueue_head(&cd->queue_waitq); in genwqe_setup_service_layer()
1262 cd->card_thread = kthread_run(genwqe_card_thread, cd, in genwqe_setup_service_layer()
1264 cd->card_idx); in genwqe_setup_service_layer()
1265 if (IS_ERR(cd->card_thread)) { in genwqe_setup_service_layer()
1266 rc = PTR_ERR(cd->card_thread); in genwqe_setup_service_layer()
1267 cd->card_thread = NULL; in genwqe_setup_service_layer()
1271 rc = genwqe_set_interrupt_capability(cd, GENWQE_MSI_IRQS); in genwqe_setup_service_layer()
1280 init_waitqueue_head(&cd->health_waitq); in genwqe_setup_service_layer()
1282 if (genwqe_is_privileged(cd)) { in genwqe_setup_service_layer()
1284 GENWQE_DEVNAME, cd); in genwqe_setup_service_layer()
1287 GENWQE_DEVNAME, cd); in genwqe_setup_service_layer()
1294 cd->card_state = GENWQE_CARD_USED; in genwqe_setup_service_layer()
1298 genwqe_reset_interrupt_capability(cd); in genwqe_setup_service_layer()
1300 kthread_stop(cd->card_thread); in genwqe_setup_service_layer()
1301 cd->card_thread = NULL; in genwqe_setup_service_layer()
1303 free_ddcb_queue(cd, queue); in genwqe_setup_service_layer()
1310 * @cd: pointer to genwqe device descriptor
1316 static int queue_wake_up_all(struct genwqe_dev *cd) in queue_wake_up_all() argument
1320 struct ddcb_queue *queue = &cd->queue; in queue_wake_up_all()
1335 * @cd: pointer to genwqe device descriptor
1342 int genwqe_finish_queue(struct genwqe_dev *cd) in genwqe_finish_queue() argument
1346 struct pci_dev *pci_dev = cd->pci_dev; in genwqe_finish_queue()
1347 struct ddcb_queue *queue = &cd->queue; in genwqe_finish_queue()
1353 if (cd->card_state == GENWQE_CARD_USED) in genwqe_finish_queue()
1354 cd->card_state = GENWQE_CARD_UNUSED; in genwqe_finish_queue()
1358 queue_wake_up_all(cd); in genwqe_finish_queue()
1362 in_flight = genwqe_ddcbs_in_flight(cd); in genwqe_finish_queue()
1390 * @cd: genwqe device descriptor
1394 int genwqe_release_service_layer(struct genwqe_dev *cd) in genwqe_release_service_layer() argument
1396 struct pci_dev *pci_dev = cd->pci_dev; in genwqe_release_service_layer()
1398 if (!ddcb_queue_initialized(&cd->queue)) in genwqe_release_service_layer()
1401 free_irq(pci_dev->irq, cd); in genwqe_release_service_layer()
1402 genwqe_reset_interrupt_capability(cd); in genwqe_release_service_layer()
1404 if (cd->card_thread != NULL) { in genwqe_release_service_layer()
1405 kthread_stop(cd->card_thread); in genwqe_release_service_layer()
1406 cd->card_thread = NULL; in genwqe_release_service_layer()
1409 free_ddcb_queue(cd, &cd->queue); in genwqe_release_service_layer()