aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2011-11-24 14:10:12 -0500
committerMichael S. Tsirkin <mst@redhat.com>2011-12-04 08:59:49 -0500
commita21a2fd4036f9a572415a7543896a1163c211ee5 (patch)
treee668585f82aee3abb56b011c78cdb7a5f46099da /arch/sparc
parent43db595e8b5d78ce5ad2feab719814a76e3ad2e5 (diff)
sparc: switch to GENERIC_PCI_IOMAP
sparc copied pci_iomap from generic code, probably to avoid pulling the rest of iomap.c in. Since that's in a separate file now, we can reuse the common implementation. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/Kconfig1
-rw-r--r--arch/sparc/include/asm/io_32.h2
-rw-r--r--arch/sparc/include/asm/io_64.h2
-rw-r--r--arch/sparc/lib/iomap.c23
4 files changed, 3 insertions, 25 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index f92602e86607..a4644f5ea98c 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -28,6 +28,7 @@ config SPARC
28 select HAVE_GENERIC_HARDIRQS 28 select HAVE_GENERIC_HARDIRQS
29 select GENERIC_IRQ_SHOW 29 select GENERIC_IRQ_SHOW
30 select USE_GENERIC_SMP_HELPERS if SMP 30 select USE_GENERIC_SMP_HELPERS if SMP
31 select GENERIC_PCI_IOMAP
31 32
32config SPARC32 33config SPARC32
33 def_bool !64BIT 34 def_bool !64BIT
diff --git a/arch/sparc/include/asm/io_32.h b/arch/sparc/include/asm/io_32.h
index c2ced21c9dc1..2006e5d359df 100644
--- a/arch/sparc/include/asm/io_32.h
+++ b/arch/sparc/include/asm/io_32.h
@@ -7,6 +7,7 @@
7 7
8#include <asm/page.h> /* IO address mapping routines need this */ 8#include <asm/page.h> /* IO address mapping routines need this */
9#include <asm/system.h> 9#include <asm/system.h>
10#include <asm-generic/pci_iomap.h>
10 11
11#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 12#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
12 13
@@ -324,7 +325,6 @@ extern void ioport_unmap(void __iomem *);
324 325
325/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ 326/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
326struct pci_dev; 327struct pci_dev;
327extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
328extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 328extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
329 329
330/* 330/*
diff --git a/arch/sparc/include/asm/io_64.h b/arch/sparc/include/asm/io_64.h
index 9c8965415f0a..9481e5a6fa90 100644
--- a/arch/sparc/include/asm/io_64.h
+++ b/arch/sparc/include/asm/io_64.h
@@ -8,6 +8,7 @@
8#include <asm/page.h> /* IO address mapping routines need this */ 8#include <asm/page.h> /* IO address mapping routines need this */
9#include <asm/system.h> 9#include <asm/system.h>
10#include <asm/asi.h> 10#include <asm/asi.h>
11#include <asm-generic/pci_iomap.h>
11 12
12/* PC crapola... */ 13/* PC crapola... */
13#define __SLOW_DOWN_IO do { } while (0) 14#define __SLOW_DOWN_IO do { } while (0)
@@ -514,7 +515,6 @@ extern void ioport_unmap(void __iomem *);
514 515
515/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ 516/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
516struct pci_dev; 517struct pci_dev;
517extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
518extern void pci_iounmap(struct pci_dev *dev, void __iomem *); 518extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
519 519
520static inline int sbus_can_dma_64bit(void) 520static inline int sbus_can_dma_64bit(void)
diff --git a/arch/sparc/lib/iomap.c b/arch/sparc/lib/iomap.c
index 9ef37e13a920..c4d42a50ebc0 100644
--- a/arch/sparc/lib/iomap.c
+++ b/arch/sparc/lib/iomap.c
@@ -18,31 +18,8 @@ void ioport_unmap(void __iomem *addr)
18EXPORT_SYMBOL(ioport_map); 18EXPORT_SYMBOL(ioport_map);
19EXPORT_SYMBOL(ioport_unmap); 19EXPORT_SYMBOL(ioport_unmap);
20 20
21/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
22void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
23{
24 resource_size_t start = pci_resource_start(dev, bar);
25 resource_size_t len = pci_resource_len(dev, bar);
26 unsigned long flags = pci_resource_flags(dev, bar);
27
28 if (!len || !start)
29 return NULL;
30 if (maxlen && len > maxlen)
31 len = maxlen;
32 if (flags & IORESOURCE_IO)
33 return ioport_map(start, len);
34 if (flags & IORESOURCE_MEM) {
35 if (flags & IORESOURCE_CACHEABLE)
36 return ioremap(start, len);
37 return ioremap_nocache(start, len);
38 }
39 /* What? */
40 return NULL;
41}
42
43void pci_iounmap(struct pci_dev *dev, void __iomem * addr) 21void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
44{ 22{
45 /* nothing to do */ 23 /* nothing to do */
46} 24}
47EXPORT_SYMBOL(pci_iomap);
48EXPORT_SYMBOL(pci_iounmap); 25EXPORT_SYMBOL(pci_iounmap);