Lines Matching refs:pdev
46 static void ne_submit_request(struct pci_dev *pdev, enum ne_pci_dev_cmd_type cmd_type, in ne_submit_request() argument
49 struct ne_pci_dev *ne_pci_dev = pci_get_drvdata(pdev); in ne_submit_request()
64 static void ne_retrieve_reply(struct pci_dev *pdev, struct ne_pci_dev_cmd_reply *cmd_reply, in ne_retrieve_reply() argument
67 struct ne_pci_dev *ne_pci_dev = pci_get_drvdata(pdev); in ne_retrieve_reply()
81 static int ne_wait_for_reply(struct pci_dev *pdev) in ne_wait_for_reply() argument
83 struct ne_pci_dev *ne_pci_dev = pci_get_drvdata(pdev); in ne_wait_for_reply()
99 int ne_do_request(struct pci_dev *pdev, enum ne_pci_dev_cmd_type cmd_type, in ne_do_request() argument
103 struct ne_pci_dev *ne_pci_dev = pci_get_drvdata(pdev); in ne_do_request()
107 dev_err_ratelimited(&pdev->dev, "Invalid cmd type=%u\n", cmd_type); in ne_do_request()
113 dev_err_ratelimited(&pdev->dev, "Null cmd request for cmd type=%u\n", in ne_do_request()
120 dev_err_ratelimited(&pdev->dev, "Invalid req size=%zu for cmd type=%u\n", in ne_do_request()
127 dev_err_ratelimited(&pdev->dev, "Null cmd reply for cmd type=%u\n", in ne_do_request()
134 dev_err_ratelimited(&pdev->dev, "Invalid reply size=%zu for cmd type=%u\n", in ne_do_request()
148 ne_submit_request(pdev, cmd_type, cmd_request, cmd_request_size); in ne_do_request()
150 rc = ne_wait_for_reply(pdev); in ne_do_request()
152 dev_err_ratelimited(&pdev->dev, "Error in wait for reply for cmd type=%u [rc=%d]\n", in ne_do_request()
158 ne_retrieve_reply(pdev, cmd_reply, cmd_reply_size); in ne_do_request()
165 dev_err_ratelimited(&pdev->dev, "Error in cmd process logic, cmd type=%u [rc=%d]\n", in ne_do_request()
220 struct pci_dev *pdev = ne_pci_dev->pdev; in ne_event_work_handler() local
243 rc = ne_do_request(pdev, SLOT_INFO, in ne_event_work_handler()
247 dev_err(&pdev->dev, "Error in slot info [rc=%d]\n", rc); in ne_event_work_handler()
295 static int ne_setup_msix(struct pci_dev *pdev) in ne_setup_msix() argument
297 struct ne_pci_dev *ne_pci_dev = pci_get_drvdata(pdev); in ne_setup_msix()
301 nr_vecs = pci_msix_vec_count(pdev); in ne_setup_msix()
305 dev_err(&pdev->dev, "Error in getting vec count [rc=%d]\n", rc); in ne_setup_msix()
310 rc = pci_alloc_irq_vectors(pdev, nr_vecs, nr_vecs, PCI_IRQ_MSIX); in ne_setup_msix()
312 dev_err(&pdev->dev, "Error in alloc MSI-X vecs [rc=%d]\n", rc); in ne_setup_msix()
322 rc = request_irq(pci_irq_vector(pdev, NE_VEC_REPLY), ne_reply_handler, in ne_setup_msix()
325 dev_err(&pdev->dev, "Error in request irq reply [rc=%d]\n", rc); in ne_setup_msix()
334 dev_err(&pdev->dev, "Cannot get wq for dev events [rc=%d]\n", rc); in ne_setup_msix()
346 rc = request_irq(pci_irq_vector(pdev, NE_VEC_EVENT), ne_event_handler, in ne_setup_msix()
349 dev_err(&pdev->dev, "Error in request irq event [rc=%d]\n", rc); in ne_setup_msix()
359 free_irq(pci_irq_vector(pdev, NE_VEC_REPLY), ne_pci_dev); in ne_setup_msix()
361 pci_free_irq_vectors(pdev); in ne_setup_msix()
372 static void ne_teardown_msix(struct pci_dev *pdev) in ne_teardown_msix() argument
374 struct ne_pci_dev *ne_pci_dev = pci_get_drvdata(pdev); in ne_teardown_msix()
376 free_irq(pci_irq_vector(pdev, NE_VEC_EVENT), ne_pci_dev); in ne_teardown_msix()
381 free_irq(pci_irq_vector(pdev, NE_VEC_REPLY), ne_pci_dev); in ne_teardown_msix()
383 pci_free_irq_vectors(pdev); in ne_teardown_msix()
395 static int ne_pci_dev_enable(struct pci_dev *pdev) in ne_pci_dev_enable() argument
399 struct ne_pci_dev *ne_pci_dev = pci_get_drvdata(pdev); in ne_pci_dev_enable()
405 dev_err(&pdev->dev, "Error in pci dev version cmd\n"); in ne_pci_dev_enable()
414 dev_err(&pdev->dev, "Error in pci dev enable cmd\n"); in ne_pci_dev_enable()
428 static void ne_pci_dev_disable(struct pci_dev *pdev) in ne_pci_dev_disable() argument
431 struct ne_pci_dev *ne_pci_dev = pci_get_drvdata(pdev); in ne_pci_dev_disable()
453 dev_err(&pdev->dev, "Error in pci dev disable cmd\n"); in ne_pci_dev_disable()
466 static int ne_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) in ne_pci_probe() argument
475 rc = pci_enable_device(pdev); in ne_pci_probe()
477 dev_err(&pdev->dev, "Error in pci dev enable [rc=%d]\n", rc); in ne_pci_probe()
482 pci_set_master(pdev); in ne_pci_probe()
484 rc = pci_request_regions_exclusive(pdev, "nitro_enclaves"); in ne_pci_probe()
486 dev_err(&pdev->dev, "Error in pci request regions [rc=%d]\n", rc); in ne_pci_probe()
491 ne_pci_dev->iomem_base = pci_iomap(pdev, PCI_BAR_NE, 0); in ne_pci_probe()
495 dev_err(&pdev->dev, "Error in pci iomap [rc=%d]\n", rc); in ne_pci_probe()
500 pci_set_drvdata(pdev, ne_pci_dev); in ne_pci_probe()
502 rc = ne_setup_msix(pdev); in ne_pci_probe()
504 dev_err(&pdev->dev, "Error in pci dev msix setup [rc=%d]\n", rc); in ne_pci_probe()
509 ne_pci_dev_disable(pdev); in ne_pci_probe()
511 rc = ne_pci_dev_enable(pdev); in ne_pci_probe()
513 dev_err(&pdev->dev, "Error in ne_pci_dev enable [rc=%d]\n", rc); in ne_pci_probe()
523 ne_pci_dev->pdev = pdev; in ne_pci_probe()
529 dev_err(&pdev->dev, "Error in misc dev register [rc=%d]\n", rc); in ne_pci_probe()
538 ne_pci_dev_disable(pdev); in ne_pci_probe()
540 ne_teardown_msix(pdev); in ne_pci_probe()
542 pci_set_drvdata(pdev, NULL); in ne_pci_probe()
543 pci_iounmap(pdev, ne_pci_dev->iomem_base); in ne_pci_probe()
545 pci_release_regions(pdev); in ne_pci_probe()
547 pci_disable_device(pdev); in ne_pci_probe()
560 static void ne_pci_remove(struct pci_dev *pdev) in ne_pci_remove() argument
562 struct ne_pci_dev *ne_pci_dev = pci_get_drvdata(pdev); in ne_pci_remove()
568 ne_pci_dev_disable(pdev); in ne_pci_remove()
570 ne_teardown_msix(pdev); in ne_pci_remove()
572 pci_set_drvdata(pdev, NULL); in ne_pci_remove()
574 pci_iounmap(pdev, ne_pci_dev->iomem_base); in ne_pci_remove()
576 pci_release_regions(pdev); in ne_pci_remove()
578 pci_disable_device(pdev); in ne_pci_remove()
589 static void ne_pci_shutdown(struct pci_dev *pdev) in ne_pci_shutdown() argument
591 struct ne_pci_dev *ne_pci_dev = pci_get_drvdata(pdev); in ne_pci_shutdown()
600 ne_pci_dev_disable(pdev); in ne_pci_shutdown()
602 ne_teardown_msix(pdev); in ne_pci_shutdown()
604 pci_set_drvdata(pdev, NULL); in ne_pci_shutdown()
606 pci_iounmap(pdev, ne_pci_dev->iomem_base); in ne_pci_shutdown()
608 pci_release_regions(pdev); in ne_pci_shutdown()
610 pci_disable_device(pdev); in ne_pci_shutdown()