Date: Thu, 1 Aug 2024 22:27:28 GMT From: Vladimir Kondratyev <wulf@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: acfd6cea1f57 - stable/14 - LinuxKPI: Add pci_dev_id to linux/pci.h Message-ID: <202408012227.471MRSdH027132@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=acfd6cea1f570baf0ec866b42f9fe56de1ec1ea9 commit acfd6cea1f570baf0ec866b42f9fe56de1ec1ea9 Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2024-04-08 06:47:43 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2024-08-01 21:09:38 +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 (cherry picked from commit f1206503e5a0073f56710bfebb6e503dcf612536) --- 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 98ba160150f7..f8ee6c5600da 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), \ @@ -386,6 +387,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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202408012227.471MRSdH027132>