From nobody Mon Apr 08 06:49:18 2024 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 4VCfp64fd0z5GL86; Mon, 8 Apr 2024 06:49:18 +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 4VCfp62v44z4md3; Mon, 8 Apr 2024 06:49:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712558958; 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=21c2VhxjyADWC03a4jC5S+Jm9w2raeT7rxtsznp5cKY=; b=A0hua9F2fjheWHsYsCaTTxfhO1ByWZ+GCI7dtkdWFvSi++PMPW81sgnwXAUar+1YqrWM2i zsalhcOU/uyxRFRct675g0unf5gaZj/OiM/2WBcrmx309+45H2ntpiDcOtGhdMJhTmQhV1 mg9BSijgVegLDITf83pY8u+qonvY6C1y1Kyq2goV/greeWFlTXQzWTah8JTyygGgOaN2yt cS5n4VqTsOmJiAgPym5VxVo20OC87wj7kw7vfHqMa36WjsRz0IhuAYmyvEKNqkdSUSJIvk kY7dWGbNrHGs2Mhu28VFiS/ct0okamcXB1n3tvMb0qMHlpTpVvN789ALvI6IRw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712558958; a=rsa-sha256; cv=none; b=NUo7Xk7pWG6PKg+Ryw9jSaBlotgdvcJXNtJOCaD5oSBrBCrygWrSWLBLwZUNda2vFU4Zj8 G0mxlMVHB11AxzEKOaJgKYHejStT0NuwZk9r8hwO84R5GKeG0CHde10vmrEm6ZtVKarZ1E RDNhjU9/yI2wTp68pqw+S2AECyGuR4PQ1c0TLIDc8n1F0mmHLCjYiPz/JUjqpRvS5BO07h zWUTlC9onQ/uHawaZNcN0DBGbBVp0Bv1QcQgSi3xodvuhjnKKciGg57efOg+uDYpABZ8df rrgvQuV5kV7/tQtoxj35DUZsrOldEqR57fntR//AseP3B98jCyi0eTC1TcPQrQ== 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=1712558958; 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=21c2VhxjyADWC03a4jC5S+Jm9w2raeT7rxtsznp5cKY=; b=Xs9TbmFICufta+GLsqwJkYfgE7Kx60bU4Vc4gnGG/OjX1U/zMFvH+YD+tIbp1XvlZ2/Yn4 tBgf2n8gb1U+n5I4WLvD0mxrmAIQfaSvEx1X7U+2IG7hAVtxvKIj6/yguBrZA7G/PDsGRF ZGmbSB9lTorfBzQWgRf8580SIaUBcPBkJM4dojFAEL5uma88gum2Qtd7yFM0dllm4HLFnW 4dso9+vT5FyA8Dn49m45z66lEiKG7xpX+HrE4J3gMd6Vdo57vnDDr7boNK0G5d7Hi33DuI UN8ASbkB7tOFZxNwexQ7y5khaO4P1ebZqpeJ1qOfzwh41lJGElyIh4DhUxHQSA== 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 4VCfp62WFLz11h6; Mon, 8 Apr 2024 06:49:18 +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 4386nI9T033015; Mon, 8 Apr 2024 06:49:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4386nIZC033012; Mon, 8 Apr 2024 06:49:18 GMT (envelope-from git) Date: Mon, 8 Apr 2024 06:49:18 GMT Message-Id: <202404080649.4386nIZC033012@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: f1206503e5a0 - main - LinuxKPI: Add pci_dev_id to linux/pci.h 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: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f1206503e5a0073f56710bfebb6e503dcf612536 Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=f1206503e5a0073f56710bfebb6e503dcf612536 commit f1206503e5a0073f56710bfebb6e503dcf612536 Author: Vladimir Kondratyev AuthorDate: 2024-04-08 06:47:43 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-04-08 06:47:43 +0000 LinuxKPI: Add pci_dev_id to linux/pci.h It returns bus/device/function number for given PCI device. Also add intermediate PCI_DEVID macro used in some drivers. Sponsored by: Serenity Cyber Security, LLC Reviewed by: emaste MFC after: 1 week --- sys/compat/linuxkpi/common/include/linux/pci.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h index 9c7e39bf4a42..bf69846f06f0 100644 --- a/sys/compat/linuxkpi/common/include/linux/pci.h +++ b/sys/compat/linuxkpi/common/include/linux/pci.h @@ -94,6 +94,7 @@ MODULE_PNP_INFO("U32:vendor;U32:device;V32:subvendor;V32:subdevice", \ #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) #define PCI_FUNC(devfn) ((devfn) & 0x07) #define PCI_BUS_NUM(devfn) (((devfn) >> 8) & 0xff) +#define PCI_DEVID(bus, devfn) ((((uint16_t)(bus)) << 8) | (devfn)) #define PCI_VDEVICE(_vendor, _device) \ .vendor = PCI_VENDOR_ID_##_vendor, .device = (_device), \ @@ -384,6 +385,12 @@ dev_is_pci(struct device *dev) return (device_get_devclass(dev->bsddev) == devclass_find("pci")); } +static inline uint16_t +pci_dev_id(struct pci_dev *pdev) +{ + return (PCI_DEVID(pdev->bus->number, pdev->devfn)); +} + static inline int pci_resource_type(struct pci_dev *pdev, int bar) {