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

Function iflib_device_probe

freebsd/net/iflib.c:4490–4533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4488 **********************************************************************/
4489
4490int
4491iflib_device_probe(device_t dev)
4492{
4493 const pci_vendor_info_t *ent;
4494 if_shared_ctx_t sctx;
4495 uint16_t pci_device_id, pci_rev_id, pci_subdevice_id, pci_subvendor_id;
4496 uint16_t pci_vendor_id;
4497
4498 if ((sctx = DEVICE_REGISTER(dev)) == NULL || sctx->isc_magic != IFLIB_MAGIC)
4499 return (ENOTSUP);
4500
4501 pci_vendor_id = pci_get_vendor(dev);
4502 pci_device_id = pci_get_device(dev);
4503 pci_subvendor_id = pci_get_subvendor(dev);
4504 pci_subdevice_id = pci_get_subdevice(dev);
4505 pci_rev_id = pci_get_revid(dev);
4506 if (sctx->isc_parse_devinfo != NULL)
4507 sctx->isc_parse_devinfo(&pci_device_id, &pci_subvendor_id, &pci_subdevice_id, &pci_rev_id);
4508
4509 ent = sctx->isc_vendor_info;
4510 while (ent->pvi_vendor_id != 0) {
4511 if (pci_vendor_id != ent->pvi_vendor_id) {
4512 ent++;
4513 continue;
4514 }
4515 if ((pci_device_id == ent->pvi_device_id) &&
4516 ((pci_subvendor_id == ent->pvi_subvendor_id) ||
4517 (ent->pvi_subvendor_id == 0)) &&
4518 ((pci_subdevice_id == ent->pvi_subdevice_id) ||
4519 (ent->pvi_subdevice_id == 0)) &&
4520 ((pci_rev_id == ent->pvi_rev_id) ||
4521 (ent->pvi_rev_id == 0))) {
4522 device_set_desc_copy(dev, ent->pvi_name);
4523 /* this needs to be changed to zero if the bus probing code
4524 * ever stops re-probing on best match because the sctx
4525 * may have its values over written by register calls
4526 * in subsequent probes
4527 */
4528 return (BUS_PROBE_DEFAULT);
4529 }
4530 ent++;
4531 }
4532 return (ENXIO);
4533}
4534
4535int
4536iflib_device_probe_vendor(device_t dev)

Callers 1

Calls 1

device_set_desc_copyFunction · 0.85

Tested by

no test coverage detected