From nobody Tue Jun 06 04:06:43 2023 X-Original-To: dev-commits-src-all@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 4QZxkC5skkz4bgYM; Tue, 6 Jun 2023 04:06:43 +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 4QZxkC3h86z3Lfx; Tue, 6 Jun 2023 04:06:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686024403; 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=p3LqbGDpxUs6rxX64INDjKS0VNlPXIfU3PATg/Wi0+k=; b=ZjSrkk2tf6QrEOxXiCENeA5tVljELWzDgYzb2Q6aPXDKTn4lksdRvHXokXLOjev/KJj2u/ RmMX9IItQEzP3oh6brghVU5Q2oV/y0kQWh9i0vbB0Dl8PRawT8/6FVyenji4WMeTc0hhf6 /W2RmAklVS+9Jda+BQlj2rvOeVrTWFINf5+VXm/JtIUtB82YYkYRBlwtIciOYXm2gzEh9Q hYfRhW7QJa1H3c5kEWSbkFc8/mguM3rLfFi5Ivkimc1Y8/yPbUTHUJk0xCUE4QJSsAigR2 P5AxJbx165dPRUjJUTSSG3JBjBiH0JvMYYzJbrWgSFNqa74ud2p1+GedCCE2ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686024403; 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=p3LqbGDpxUs6rxX64INDjKS0VNlPXIfU3PATg/Wi0+k=; b=Qqiw4bHtGrg1Ap3c5gj250swU9SQmLhv6sznFTtxc7c1wnvko7TKJ1RBF0sFdkUpIei9aX lZib1guzPwOPIRG23z9ctrCsQHGpOh4rO7pEKNJMuH1i3d5TQXQKJbs9ArLgRQBA+Oh6gS kKDcWkSrJVxQH10zsciQ39HMAHdOQ/DrR0HGYTmtv14aXFHZ80SmqHRvglYAnV7EAxPWAe aOAaDev/S0mcFI2OTVubgaq4xQicH6QfvusrcSroMhpmJTnJsjX5V0TRgkpaWMdTFRFUIH LAkoBWA5I/oQQ6iS8bZp0YW5fcnupGQW2MHutwRr4moOhRP5aegfU9gsuoyUKg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686024403; a=rsa-sha256; cv=none; b=jRwpEiPSPhHaX+Mwyt9VQhWhkY86kmL4mCb4kjrLHFeaeoMZS4sznR0zh0eiE6DJ6tSXHB BOPIpPaS0tb3bbpcogjvFmyf7FbHRQa3VxF7VXegSIcTPKBL4EskUtl3AJ8L5l3E2MhYoQ c0ogcd3n6oGGk7K7346fo6zP5N3Kt4/IJSixm/9/uCX4pXpFfIqBeiVEzpmhmGCni917zX vPdAvU+dB2Z4J9BT0elAivRNledhpyLtn+pfWDac4tO1RG2P02yokM9HUfmL4bdJWZKq6c xyZym2nFJjyPlhv7Xxj4zJxJdP/5TfRfAcXG/C0MfvQoV4JaASPgQZpoGBYo1w== 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 4QZxkC2lcNzFsl; Tue, 6 Jun 2023 04:06:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35646hne078042; Tue, 6 Jun 2023 04:06:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35646hbA078041; Tue, 6 Jun 2023 04:06:43 GMT (envelope-from git) Date: Tue, 6 Jun 2023 04:06:43 GMT Message-Id: <202306060406.35646hbA078041@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 1bbdfb0b4386 - main - gve: Add PNP info to PCI attachment of gve(4) driver. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: 1bbdfb0b438689a839e29094fcb582a104cbabd9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=1bbdfb0b438689a839e29094fcb582a104cbabd9 commit 1bbdfb0b438689a839e29094fcb582a104cbabd9 Author: Xin LI AuthorDate: 2023-06-06 00:58:43 +0000 Commit: Xin LI CommitDate: 2023-06-06 04:05:55 +0000 gve: Add PNP info to PCI attachment of gve(4) driver. Reviewed-by: imp Differential Revision: https://reviews.freebsd.org/D40429 --- 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);