From nobody Fri Aug 18 23:18:45 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RSHqp1Yrcz4frxM; Fri, 18 Aug 2023 23:18:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RSHqp0x7Tz4nYG; Fri, 18 Aug 2023 23:18:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692400726; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VzCzvM0df/QNylriAJf8balj0vHywVKRCIDeUODjA+8=; b=TgtwFTKOThjA49wZTIX05YdkHsb3KokCLpJmkitJzAQWV9rH3zpKRm6mJduF7GsJJVqSJ6 0fwvBTmDNbHLSwxshX+3/w+7MUjGVvpjPdOwi2hgVNIc5nxfLSNAd1LU6wxClhe4rOnXOF 8ZFRbHupd38tt/kOBC5bSLI4AvYTJjwFXqZRuA8Capm6wb83KEGUQiFmhp+yAhd8CfyXld x9dIkGkMCM2z4sS1EVjD3vUnvy5CCMHt79hsKdg1yTgKTh7+OjpmScjhy2AoJrvsMwht8u M0mZ8/E4+t/zogvAJk4/iEXioIdMy73f0FzC7JYRZz5oScAOUmQen7N5mb66rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692400726; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=VzCzvM0df/QNylriAJf8balj0vHywVKRCIDeUODjA+8=; b=Sa4grg/ltkDYkZyZ6YMmqYCIav7bYBnSgbcU/kNnTXF7/psliGlfQM4HtCkS+zdjF0aAI+ JGXOe2BuRXgsFsMgUMbi2WUEStfoAUYJB8kLMp9TUW9VpbkYS+ppOIIj2GG7c0sUaEGlwf 1RU+L27l4WkipIpfuEBfWeEgTq8lRWNipA1qQfmLEfrytjhI/vhH8nhDdxrhRooW0AY4Ec 3Z1k6YlBOqeuSOvL4tw8bXZ5aYQKfO1MxB4CSWXyDGECgN5ltQ91CSaBzSW8L8q15NbUqy 3ZlLVWE8/++sRqID7HW/QUG3m9l2Ix6+V63sA1Stcgo0kSA+PbFlPfEoAb2K8w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692400726; a=rsa-sha256; cv=none; b=KjVMNFwQ13nB97xfsxH+9qW+NoJDUK9JcEWOOLKNCL1TJ2un7AYcd5T6b29fKI7kj6hIsr /GHGHabEKDcV43A5L0RgItaA6yOJNLZHwW9uSbL4tVb1Ev1wNnLaiC2MR8wL/ihBqUNgGP en7XltxTIsRQha4IvX3cAEwZDPUt37qX/LC4gQsZASJayAZ/lnDoVQ7mpos656vOIh1AHu vriZXScLgPl2zQlwFubyvRdw6G3mb4nJtkjMUBtg93TlBX3jW7vK72WiGb3RG9oZP/gDvY ORHawkV7ntzV2f4y6r+uROhmQtBNJnZ1HU9gw8Ws5LKyfhbkrV9+ctg+G7vZkw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RSHqp02ZFzbQv; Fri, 18 Aug 2023 23:18:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37INIjD2018617; Fri, 18 Aug 2023 23:18:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37INIjWu018614; Fri, 18 Aug 2023 23:18:45 GMT (envelope-from git) Date: Fri, 18 Aug 2023 23:18:45 GMT Message-Id: <202308182318.37INIjWu018614@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 80a7ab5a4f79 - stable/13 - gve: Add PNP info to PCI attachment of gve(4) driver. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 80a7ab5a4f7952c24f817ee8a21bc1d4a1fb2436 Auto-Submitted: auto-generated The branch stable/13 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=80a7ab5a4f7952c24f817ee8a21bc1d4a1fb2436 commit 80a7ab5a4f7952c24f817ee8a21bc1d4a1fb2436 Author: Xin LI AuthorDate: 2023-06-06 00:58:43 +0000 Commit: Xin LI CommitDate: 2023-08-18 23:18:15 +0000 gve: Add PNP info to PCI attachment of gve(4) driver. Reviewed-by: imp Differential Revision: https://reviews.freebsd.org/D40429 (cherry picked from commit 1bbdfb0b438689a839e29094fcb582a104cbabd9) --- sys/dev/gve/gve_main.c | 28 ++++++++++++++++++++++++---- 1 file 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);