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

Function pci_scan_one

dpdk/drivers/bus/pci/bsd/pci.c:215–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213}
214
215static int
216pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
217{
218 struct rte_pci_device_internal *pdev;
219 struct rte_pci_device *dev;
220 struct pci_bar_io bar;
221 unsigned i, max;
222
223 pdev = malloc(sizeof(*pdev));
224 if (pdev == NULL) {
225 RTE_LOG(ERR, EAL, "Cannot allocate memory for internal pci device\n");
226 return -1;
227 }
228
229 memset(pdev, 0, sizeof(*pdev));
230 dev = &pdev->device;
231 dev->device.bus = &rte_pci_bus.bus;
232
233 dev->addr.domain = conf->pc_sel.pc_domain;
234 dev->addr.bus = conf->pc_sel.pc_bus;
235 dev->addr.devid = conf->pc_sel.pc_dev;
236 dev->addr.function = conf->pc_sel.pc_func;
237
238 /* get vendor id */
239 dev->id.vendor_id = conf->pc_vendor;
240
241 /* get device id */
242 dev->id.device_id = conf->pc_device;
243
244 /* get subsystem_vendor id */
245 dev->id.subsystem_vendor_id = conf->pc_subvendor;
246
247 /* get subsystem_device id */
248 dev->id.subsystem_device_id = conf->pc_subdevice;
249
250 /* get class id */
251 dev->id.class_id = (conf->pc_class << 16) |
252 (conf->pc_subclass << 8) |
253 (conf->pc_progif);
254
255 /* TODO: get max_vfs */
256 dev->max_vfs = 0;
257
258 /* FreeBSD has no NUMA support (yet) */
259 dev->device.numa_node = SOCKET_ID_ANY;
260
261 pci_common_set(dev);
262
263 /* FreeBSD has only one pass through driver */
264 dev->kdrv = RTE_PCI_KDRV_NIC_UIO;
265
266 /* parse resources */
267 switch (conf->pc_hdr & PCIM_HDRTYPE) {
268 case PCIM_HDRTYPE_NORMAL:
269 max = PCIR_MAX_BAR_0;
270 break;
271 case PCIM_HDRTYPE_BRIDGE:
272 max = PCIR_MAX_BAR_1;

Callers 1

rte_pci_scanFunction · 0.70

Calls 9

mallocFunction · 0.85
memsetFunction · 0.85
pci_common_setFunction · 0.85
rte_pci_add_deviceFunction · 0.85
rte_pci_addr_cmpFunction · 0.85
rte_pci_insert_deviceFunction · 0.85
pci_freeFunction · 0.85
ioctlFunction · 0.50
memmoveFunction · 0.50

Tested by

no test coverage detected