Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jan 2023 16:24:50 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 4073b7ddf14a - stable/13 - LinuxKPI: pci.h add more MSI related constanst and pci_is_enabled()
Message-ID:  <202301181624.30IGOogt037962@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=4073b7ddf14a2ff5adf5f18e3cc37a3fbb7994f3

commit 4073b7ddf14a2ff5adf5f18e3cc37a3fbb7994f3
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-10-31 22:14:10 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-01-18 13:24:22 +0000

    LinuxKPI: pci.h add more MSI related constanst and pci_is_enabled()
    
    Add more MSI related constansts defined to our native defines and
    pci_is_enabled().  All are needed for another wireless driver.
    
    Differential Revision: https://reviews.freebsd.org/D37225
    
    (cherry picked from commit 5f2f582ccceec8729ee85bf191a2f7373c2994a4)
---
 sys/compat/linuxkpi/common/include/linux/pci.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h
index 79999c3912f7..f870b039254c 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -163,6 +163,11 @@ MODULE_PNP_INFO("U32:vendor;U32:device;V32:subvendor;V32:subdevice",	\
 #define	PCI_EXP_LNKCTL2_ENTER_COMP	0x0010	/* Enter Compliance */
 #define	PCI_EXP_LNKCTL2_TX_MARGIN	0x0380	/* Transmit Margin */
 
+#define	PCI_MSI_ADDRESS_LO	PCIR_MSI_ADDR
+#define	PCI_MSI_ADDRESS_HI	PCIR_MSI_ADDR_HIGH
+#define	PCI_MSI_FLAGS		PCIR_MSI_CTRL
+#define	PCI_MSI_FLAGS_ENABLE	PCIM_MSICTRL_MSI_ENABLE
+
 #define PCI_EXP_LNKCAP_CLKPM	0x00040000
 #define PCI_EXP_DEVSTA_TRPND	0x0020
 
@@ -1611,4 +1616,12 @@ pcie_get_readrq(struct pci_dev *dev)
 	return (128 << ((ctl & PCI_EXP_DEVCTL_READRQ) >> 12));
 }
 
+static inline bool
+pci_is_enabled(struct pci_dev *pdev)
+{
+
+	return ((pci_read_config(pdev->dev.bsddev, PCIR_COMMAND, 2) &
+	    PCIM_CMD_BUSMASTEREN) != 0);
+}
+
 #endif	/* _LINUXKPI_LINUX_PCI_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202301181624.30IGOogt037962>