From nobody Thu Aug 01 22:28:02 2024 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 4WZkBC2jdSz5RZYb; Thu, 01 Aug 2024 22:28:03 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WZkBC0zDcz4Zk3; Thu, 1 Aug 2024 22:28:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722551283; 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=4wXSnxW9L7mLYRQ1bSWhK1Um1xUccqIa1oDTtNmYWPE=; b=ssA2UCd23ewvOrvZ5HALrnkTcFBD6RKzzsU+xE3z+M5lYSrmbHs77jGQ0RcrvWC+SGPl/1 qOw4FEhTa4PzGQCx0v72x8loypZls4cnFYFTNXK9ktqtFoE5Qp1fxwFSNI+M7S+BluISjH qN3kKw9qhA24nMbjldZsegKdFeRONxtEQ2H/OCqeAOeSUli2cPMqgyew+F0fXYurBOpOqK umerL+1v8O/XY1Gb1/DsdiiDEpZlisB2tHh9r3hu/6UDEcLznNjT93ot/U1qZj/bYGs0EV 5w8d8N3kn4T4y/ewzBWDbUPTIFThN9YKYAJncPAUQLRW1t5EoAFCc75haGQzuA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722551283; a=rsa-sha256; cv=none; b=lYY5UIWnaUrHZlN5esA5woHSHnq9+/ukqo8uMPRNxLQHGGTGfLZZXKl+rBCX6Wift1ppFI QRg799UCbH6xkQsLBf0sMwFeVJ/Co7FD8ODcxa0/FHicvi8ztoi9K+lpL9uj9vNUwgdlWp NypmnqxvvuTF3iF6ayGU7Gq/NC/p334KRANjwUxYEUoRQYI6+thDPUS6SD7yNCv+IypMGV xPUmBxwvwsV3a4HF/tb7vmHvLHni9coQJQK1trDYPPGcOovB8YmoSyGlNbPAYI6ksxRrfd 5I4mh8h88DU6lNLEllDUoppAyj2TgIFyFJuzuMaWomdoDzD5M+j5Ma91XnRptQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722551283; 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=4wXSnxW9L7mLYRQ1bSWhK1Um1xUccqIa1oDTtNmYWPE=; b=QzfrBp8JHFu9I+zsb0Ihg6gefZYZvOxU7qD5hDduPAnqZM1ir+nTjH+VI4krJM+kd4RMC1 A2dQXLcB1mxvjaFd+uXyJvktOdWYBT/YTgzwYgJIHkiws9SqRTObX4JchyuxFAaBA8jF2h Ma+REWZJrxXMIqeYWKdBceNrjE2gfQpldtXD/FwyIt4pP2SgQ6Oo27CVSGUrfrG4bDwKO4 3zRCHqxGQrCSmXm+ThqWJb5jZahddvdNq2f2yYNV4E32ugeh4qa3hLEtJe+K0P9Q4fJCzd GN2mUGQxyuMexTWTk5EAeRJ+KozQcZyrjxeEiyfFLRAtQzr/rsIs+S/wGwL20g== 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 4WZkBC0bSBz12nv; Thu, 1 Aug 2024 22:28:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 471MS2Eq028593; Thu, 1 Aug 2024 22:28:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 471MS2M3028590; Thu, 1 Aug 2024 22:28:02 GMT (envelope-from git) Date: Thu, 1 Aug 2024 22:28:02 GMT Message-Id: <202408012228.471MS2M3028590@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: ce2d721b9fab - stable/14 - LinuxKPI: Add pci_match_id to linux/pci.h 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: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: ce2d721b9fab172a7a3484155461076b026f0179 Auto-Submitted: auto-generated The branch stable/14 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=ce2d721b9fab172a7a3484155461076b026f0179 commit ce2d721b9fab172a7a3484155461076b026f0179 Author: Vladimir Kondratyev AuthorDate: 2024-07-21 13:09:27 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-08-01 21:15:44 +0000 LinuxKPI: Add pci_match_id to linux/pci.h It finds out if a given PCI device matches a given pci_id table. Sponsored by: Serenity Cyber Security, LLC MFC after: 1 week Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D45846 (cherry picked from commit 5b1171a0b75fc88bffb5a67b0b02d8d59eb8d5c4) --- sys/compat/linuxkpi/common/include/linux/pci.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index f8ee6c5600da..027dc0dfca0b 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -1268,6 +1268,29 @@ pci_dev_present(const struct pci_device_id *cur) return (0); } +static inline const struct pci_device_id * +pci_match_id(const struct pci_device_id *ids, struct pci_dev *pdev) +{ + if (ids == NULL) + return (NULL); + + for (; + ids->vendor != 0 || ids->subvendor != 0 || ids->class_mask != 0; + ids++) + if ((ids->vendor == PCI_ANY_ID || + ids->vendor == pdev->vendor) && + (ids->device == PCI_ANY_ID || + ids->device == pdev->device) && + (ids->subvendor == PCI_ANY_ID || + ids->subvendor == pdev->subsystem_vendor) && + (ids->subdevice == PCI_ANY_ID || + ids->subdevice == pdev->subsystem_device) && + ((ids->class ^ pdev->class) & ids->class_mask) == 0) + return (ids); + + return (NULL); +} + struct pci_dev *lkpi_pci_get_domain_bus_and_slot(int domain, unsigned int bus, unsigned int devfn); #define pci_get_domain_bus_and_slot(domain, bus, devfn) \