[Arm-dev] [PATCH v1 71/87] arm64, pci, acpi: Let ARM64 to use MMCONFIG PCI config space accessors.

Thu Aug 13 13:19:08 UTC 2015
Vadim Lomovtsev <Vadim.Lomovtsev at caviumnetworks.com>

From: Tomasz Nowicki <tomasz.nowicki at linaro.org>

Signed-off-by: Tomasz Nowicki <tomasz.nowicki at linaro.org>
Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev at caviumnetworks.com>
---
 arch/arm64/Kconfig           |  3 +++
 arch/arm64/include/asm/pci.h | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index e32e427..e50c588 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -283,6 +283,9 @@ config PCI_DOMAINS_GENERIC
 config PCI_SYSCALL
 	def_bool PCI
 
+config PCI_MMCONFIG
+	def_bool PCI && ACPI
+
 source "drivers/pci/Kconfig"
 source "drivers/pci/pcie/Kconfig"
 source "drivers/pci/hotplug/Kconfig"
diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h
index ad3fb18..4e47457 100644
--- a/arch/arm64/include/asm/pci.h
+++ b/arch/arm64/include/asm/pci.h
@@ -27,6 +27,42 @@
 extern int isa_dma_bridge_buggy;
 
 #ifdef CONFIG_PCI
+
+#ifdef CONFIG_ACPI
+/*
+ * ARM64 PCI config space access primitives.
+ */
+static inline unsigned char mmio_config_readb(void __iomem *pos)
+{
+	return readb(pos);
+}
+
+static inline unsigned short mmio_config_readw(void __iomem *pos)
+{
+	return readw(pos);
+}
+
+static inline unsigned int mmio_config_readl(void __iomem *pos)
+{
+	return readl(pos);
+}
+
+static inline void mmio_config_writeb(void __iomem *pos, u8 val)
+{
+	writeb(val, pos);
+}
+
+static inline void mmio_config_writew(void __iomem *pos, u16 val)
+{
+	writew(val, pos);
+}
+
+static inline void mmio_config_writel(void __iomem *pos, u32 val)
+{
+	writel(val, pos);
+}
+#endif  /* CONFIG_ACPI */
+
 static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 {
 	/* no legacy IRQ on arm64 */
-- 
2.4.3