Skip to content

Commit

Permalink
gve: Add PNP info to PCI attachment of gve(4) driver.
Browse files Browse the repository at this point in the history
Reviewed-by:		imp
Differential Revision:	https://reviews.freebsd.org/D40429
  • Loading branch information
delphij committed Jun 6, 2023
1 parent d66540e commit 1bbdfb0
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions sys/dev/gve/gve_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@

#define GVE_DEFAULT_RX_COPYBREAK 256

/* Devices supported by this driver. */
static struct gve_dev {
uint16_t vendor_id;
uint16_t device_id;
const char *name;
} gve_devs[] = {
{ PCI_VENDOR_ID_GOOGLE, PCI_DEV_ID_GVNIC, "gVNIC" }
};
#define GVE_DEVS_COUNT nitems(gve_devs)

struct sx gve_global_lock;

static int
Expand Down Expand Up @@ -701,10 +711,18 @@ gve_service_task(void *arg, int pending)
static int
gve_probe(device_t dev)
{
if (pci_get_vendor(dev) == PCI_VENDOR_ID_GOOGLE &&
pci_get_device(dev) == PCI_DEV_ID_GVNIC) {
device_set_desc(dev, "gVNIC");
return (BUS_PROBE_DEFAULT);
uint16_t deviceid, vendorid;
int i;

vendorid = pci_get_vendor(dev);
deviceid = pci_get_device(dev);

for (i = 0; i < GVE_DEVS_COUNT; i++) {
if (vendorid == gve_devs[i].vendor_id &&
deviceid == gve_devs[i].device_id) {
device_set_desc(dev, gve_devs[i].name);
return (BUS_PROBE_DEFAULT);
}
}
return (ENXIO);
}
Expand Down Expand Up @@ -851,3 +869,5 @@ DRIVER_MODULE(gve, pci, gve_driver, gve_devclass, 0, 0);
#else
DRIVER_MODULE(gve, pci, gve_driver, 0, 0);
#endif
MODULE_PNP_INFO("U16:vendor;U16:device", pci, gve, gve_devs,
GVE_DEVS_COUNT);

0 comments on commit 1bbdfb0

Please sign in to comment.