Skip to contentSkip to conversation

ppc32: Add "native" iomap interfaces

PATCH New Benjamin Herrenschmidt 1 participant 1 message Oct 16, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ppc32: Add "native" iomap interfaces

Hi !

This patch adds proper ppc32 "iomap" interfaces.

arch/ppc/Kconfig +0 -4
diff -urN linux-2.5/arch/ppc/Kconfig linux-lappy/arch/ppc/Kconfig
@@ -35,10 +35,6 @@
 	bool
 	default y
 
-config GENERIC_IOMAP
-	bool
-	default y
-
 source "init/Kconfig"
 
 menu "Processor"
arch/ppc/kernel/pci.c +26 -0
diff -urN linux-2.5/arch/ppc/kernel/pci.c linux-lappy/arch/ppc/kernel/pci.c
@@ -1709,6 +1709,32 @@
 	res->child = NULL;
 }
 
+void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
+{
+	unsigned long start = pci_resource_start(dev, bar);
+	unsigned long len = pci_resource_len(dev, bar);
+	unsigned long flags = pci_resource_flags(dev, bar);
+
+	if (!len)
+		return NULL;
+	if (max && len > max)
+		len = max;
+	if (flags & IORESOURCE_IO)
+		return ioport_map(start, len);
+	if (flags & IORESOURCE_MEM)
+		return (void __iomem *) start;
+	/* What? */
+	return NULL;
+}
+
+void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
+{
+	/* Nothing to do */
+}
+EXPORT_SYMBOL(pci_iomap);
+EXPORT_SYMBOL(pci_iounmap);
+
+
 /*
  * Null PCI config access functions, for the case when we can't
  * find a hose.
arch/ppc/mm/pgtable.c +13 -0
diff -urN linux-2.5/arch/ppc/mm/pgtable.c linux-lappy/arch/ppc/mm/pgtable.c
@@ -22,6 +22,7 @@
 
 #include <linux/config.h>
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/types.h>
 #include <linux/mm.h>
 #include <linux/vmalloc.h>
@@ -271,6 +272,18 @@
 		vunmap((void *) (PAGE_MASK & (unsigned long)addr));
 }
 
+void __iomem *ioport_map(unsigned long port, unsigned int len)
+{
+	return (void __iomem *) (port + _IO_BASE);
+}
+
+void ioport_unmap(void __iomem *addr)
+{
+	/* Nothing to do */
+}
+EXPORT_SYMBOL(ioport_map);
+EXPORT_SYMBOL(ioport_unmap);
+
 int
 map_page(unsigned long va, phys_addr_t pa, int flags)
 {
include/asm-ppc/io.h +73 -0

79 lines not on this page · raw message