MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dlb2_probe

Function dlb2_probe

dpdk/drivers/event/dlb2/pf/dlb2_main.c:83–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83struct dlb2_dev *
84dlb2_probe(struct rte_pci_device *pdev, const void *probe_args)
85{
86 struct dlb2_dev *dlb2_dev;
87 int ret = 0;
88 int dlb_version = 0;
89
90 DLB2_INFO(dlb2_dev, "probe\n");
91
92 dlb2_dev = rte_malloc("DLB2_PF", sizeof(struct dlb2_dev),
93 RTE_CACHE_LINE_SIZE);
94
95 if (dlb2_dev == NULL) {
96 ret = -ENOMEM;
97 goto dlb2_dev_malloc_fail;
98 }
99
100 dlb_version = DLB2_HW_DEVICE_FROM_PCI_ID(pdev);
101
102 /* PCI Bus driver has already mapped bar space into process.
103 * Save off our IO register and FUNC addresses.
104 */
105
106 /* BAR 0 */
107 if (pdev->mem_resource[0].addr == NULL) {
108 DLB2_ERR(dlb2_dev, "probe: BAR 0 addr (csr_kva) is NULL\n");
109 ret = -EINVAL;
110 goto pci_mmap_bad_addr;
111 }
112 dlb2_dev->hw.func_kva = (void *)(uintptr_t)pdev->mem_resource[0].addr;
113 dlb2_dev->hw.func_phys_addr = pdev->mem_resource[0].phys_addr;
114
115 DLB2_INFO(dlb2_dev, "DLB2 FUNC VA=%p, PA=%p, len=%p\n",
116 (void *)dlb2_dev->hw.func_kva,
117 (void *)dlb2_dev->hw.func_phys_addr,
118 (void *)(pdev->mem_resource[0].len));
119
120 /* BAR 2 */
121 if (pdev->mem_resource[2].addr == NULL) {
122 DLB2_ERR(dlb2_dev, "probe: BAR 2 addr (func_kva) is NULL\n");
123 ret = -EINVAL;
124 goto pci_mmap_bad_addr;
125 }
126 dlb2_dev->hw.csr_kva = (void *)(uintptr_t)pdev->mem_resource[2].addr;
127 dlb2_dev->hw.csr_phys_addr = pdev->mem_resource[2].phys_addr;
128
129 DLB2_INFO(dlb2_dev, "DLB2 CSR VA=%p, PA=%p, len=%p\n",
130 (void *)dlb2_dev->hw.csr_kva,
131 (void *)dlb2_dev->hw.csr_phys_addr,
132 (void *)(pdev->mem_resource[2].len));
133
134 dlb2_dev->pdev = pdev;
135
136 /* PM enable must be done before any other MMIO accesses, and this
137 * setting is persistent across device reset.
138 */
139 dlb2_pf_enable_pm(dlb2_dev);
140

Callers 1

dlb2_eventdev_pci_initFunction · 0.85

Calls 9

rte_mallocFunction · 0.85
dlb2_pf_enable_pmFunction · 0.85
dlb2_resource_probeFunction · 0.85
dlb2_pf_resetFunction · 0.85
dlb2_resource_initFunction · 0.85
dlb2_resource_freeFunction · 0.85
rte_freeFunction · 0.85

Tested by

no test coverage detected