Lines Matching full:dispatch
165 "BEGIN", "PCI-ENABLE-DONE", "PCI-MAP-DONE", "DISPATCH-INIT-DONE",
308 oct->dispatch.dlist = (struct lio_dispatch *)(buf + configsize); in lio_allocate_device_mem()
520 oct->dispatch.count = 0; in lio_init_dispatch_list()
523 oct->dispatch.dlist[i].opcode = 0; in lio_init_dispatch_list()
524 STAILQ_INIT(&oct->dispatch.dlist[i].head); in lio_init_dispatch_list()
527 mtx_init(&oct->dispatch.lock, "dispatch_lock", NULL, MTX_DEF); in lio_init_dispatch_list()
541 mtx_lock(&oct->dispatch.lock); in lio_delete_dispatch_list()
544 struct lio_stailq_head *dispatch; in lio_delete_dispatch_list() local
546 dispatch = &oct->dispatch.dlist[i].head; in lio_delete_dispatch_list()
547 while (!STAILQ_EMPTY(dispatch)) { in lio_delete_dispatch_list()
548 temp = STAILQ_FIRST(dispatch); in lio_delete_dispatch_list()
549 STAILQ_REMOVE_HEAD(&oct->dispatch.dlist[i].head, in lio_delete_dispatch_list()
554 oct->dispatch.dlist[i].opcode = 0; in lio_delete_dispatch_list()
557 oct->dispatch.count = 0; in lio_delete_dispatch_list()
559 mtx_unlock(&oct->dispatch.lock); in lio_delete_dispatch_list()
571 struct lio_stailq_node *dispatch; in lio_get_dispatch() local
578 mtx_lock(&octeon_dev->dispatch.lock); in lio_get_dispatch()
580 if (octeon_dev->dispatch.count == 0) { in lio_get_dispatch()
581 mtx_unlock(&octeon_dev->dispatch.lock); in lio_get_dispatch()
585 if (!(octeon_dev->dispatch.dlist[idx].opcode)) { in lio_get_dispatch()
586 mtx_unlock(&octeon_dev->dispatch.lock); in lio_get_dispatch()
590 if (octeon_dev->dispatch.dlist[idx].opcode == combined_opcode) { in lio_get_dispatch()
591 fn = octeon_dev->dispatch.dlist[idx].dispatch_fn; in lio_get_dispatch()
593 STAILQ_FOREACH(dispatch, &octeon_dev->dispatch.dlist[idx].head, in lio_get_dispatch()
595 if (((struct lio_dispatch *)dispatch)->opcode == in lio_get_dispatch()
598 dispatch)->dispatch_fn; in lio_get_dispatch()
604 mtx_unlock(&octeon_dev->dispatch.lock); in lio_get_dispatch()
636 mtx_lock(&oct->dispatch.lock); in lio_register_dispatch_fn()
637 /* Add dispatch function to first level of lookup table */ in lio_register_dispatch_fn()
638 if (oct->dispatch.dlist[idx].opcode == 0) { in lio_register_dispatch_fn()
639 oct->dispatch.dlist[idx].opcode = combined_opcode; in lio_register_dispatch_fn()
640 oct->dispatch.dlist[idx].dispatch_fn = fn; in lio_register_dispatch_fn()
641 oct->dispatch.dlist[idx].arg = fn_arg; in lio_register_dispatch_fn()
642 oct->dispatch.count++; in lio_register_dispatch_fn()
643 mtx_unlock(&oct->dispatch.lock); in lio_register_dispatch_fn()
647 mtx_unlock(&oct->dispatch.lock); in lio_register_dispatch_fn()
655 struct lio_dispatch *dispatch; in lio_register_dispatch_fn() local
658 "Adding opcode to dispatch list linked list\n"); in lio_register_dispatch_fn()
659 dispatch = (struct lio_dispatch *) in lio_register_dispatch_fn()
662 if (dispatch == NULL) { in lio_register_dispatch_fn()
664 "No memory to add dispatch function\n"); in lio_register_dispatch_fn()
668 dispatch->opcode = combined_opcode; in lio_register_dispatch_fn()
669 dispatch->dispatch_fn = fn; in lio_register_dispatch_fn()
670 dispatch->arg = fn_arg; in lio_register_dispatch_fn()
673 * Add dispatch function to linked list of fn ptrs in lio_register_dispatch_fn()
676 mtx_lock(&oct->dispatch.lock); in lio_register_dispatch_fn()
677 STAILQ_INSERT_HEAD(&oct->dispatch.dlist[idx].head, in lio_register_dispatch_fn()
678 &dispatch->node, entries); in lio_register_dispatch_fn()
679 oct->dispatch.count++; in lio_register_dispatch_fn()
680 mtx_unlock(&oct->dispatch.lock); in lio_register_dispatch_fn()
683 lio_dev_err(oct, "Found previously registered dispatch fn for opcode/subcode: %x/%x\n", in lio_register_dispatch_fn()
710 struct lio_stailq_node *dispatch, *dfree = NULL, *tmp2; in lio_unregister_dispatch_fn() local
717 mtx_lock(&oct->dispatch.lock); in lio_unregister_dispatch_fn()
719 if (oct->dispatch.count == 0) { in lio_unregister_dispatch_fn()
720 mtx_unlock(&oct->dispatch.lock); in lio_unregister_dispatch_fn()
721 lio_dev_err(oct, "No dispatch functions registered for this device\n"); in lio_unregister_dispatch_fn()
724 if (oct->dispatch.dlist[idx].opcode == combined_opcode) { in lio_unregister_dispatch_fn()
725 dispatch_head = &oct->dispatch.dlist[idx].head; in lio_unregister_dispatch_fn()
727 dispatch = STAILQ_FIRST(dispatch_head); in lio_unregister_dispatch_fn()
728 oct->dispatch.dlist[idx].opcode = in lio_unregister_dispatch_fn()
729 ((struct lio_dispatch *)dispatch)->opcode; in lio_unregister_dispatch_fn()
730 oct->dispatch.dlist[idx].dispatch_fn = in lio_unregister_dispatch_fn()
731 ((struct lio_dispatch *)dispatch)->dispatch_fn; in lio_unregister_dispatch_fn()
732 oct->dispatch.dlist[idx].arg = in lio_unregister_dispatch_fn()
733 ((struct lio_dispatch *)dispatch)->arg; in lio_unregister_dispatch_fn()
735 dfree = dispatch; in lio_unregister_dispatch_fn()
737 oct->dispatch.dlist[idx].opcode = 0; in lio_unregister_dispatch_fn()
738 oct->dispatch.dlist[idx].dispatch_fn = NULL; in lio_unregister_dispatch_fn()
739 oct->dispatch.dlist[idx].arg = NULL; in lio_unregister_dispatch_fn()
743 STAILQ_FOREACH_SAFE(dispatch, in lio_unregister_dispatch_fn()
744 &oct->dispatch.dlist[idx].head, in lio_unregister_dispatch_fn()
746 if (((struct lio_dispatch *)dispatch)->opcode == in lio_unregister_dispatch_fn()
748 STAILQ_REMOVE(&oct->dispatch.dlist[idx].head, in lio_unregister_dispatch_fn()
749 dispatch, in lio_unregister_dispatch_fn()
751 dfree = dispatch; in lio_unregister_dispatch_fn()
758 oct->dispatch.count--; in lio_unregister_dispatch_fn()
760 mtx_unlock(&oct->dispatch.lock); in lio_unregister_dispatch_fn()