aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2023-06-06 00:58:43 +0000
committerXin LI <delphij@FreeBSD.org>2023-06-06 04:05:55 +0000
commit1bbdfb0b438689a839e29094fcb582a104cbabd9 (patch)
treed0e406ac3754e0a794ad761690942b42dded4a3a /sys/dev
parentd66540e829ec22b9654cf4b9119bed9326f89fad (diff)
downloadsrc-1bbdfb0b438689a839e29094fcb582a104cbabd9.tar.gz
src-1bbdfb0b438689a839e29094fcb582a104cbabd9.zip
gve: Add PNP info to PCI attachment of gve(4) driver.
Reviewed-by: imp Differential Revision: https://reviews.freebsd.org/D40429
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/gve/gve_main.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/sys/dev/gve/gve_main.c b/sys/dev/gve/gve_main.c
index ae45a0cfc24a..383fd326d33a 100644
--- a/sys/dev/gve/gve_main.c
+++ b/sys/dev/gve/gve_main.c
@@ -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
@@ -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);
}
@@ -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);