diff options
48 files changed, 124 insertions, 369 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 3d74801a4015..56a4df952fb0 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
@@ -70,10 +70,6 @@ config GENERIC_ISA_DMA | |||
70 | bool | 70 | bool |
71 | default y | 71 | default y |
72 | 72 | ||
73 | config GENERIC_IOMAP | ||
74 | bool | ||
75 | default n | ||
76 | |||
77 | source "init/Kconfig" | 73 | source "init/Kconfig" |
78 | source "kernel/Kconfig.freezer" | 74 | source "kernel/Kconfig.freezer" |
79 | 75 | ||
@@ -319,6 +315,7 @@ config ISA_DMA_API | |||
319 | config PCI | 315 | config PCI |
320 | bool | 316 | bool |
321 | depends on !ALPHA_JENSEN | 317 | depends on !ALPHA_JENSEN |
318 | select GENERIC_PCI_IOMAP | ||
322 | default y | 319 | default y |
323 | help | 320 | help |
324 | Find out whether you have a PCI motherboard. PCI is the name of a | 321 | Find out whether you have a PCI motherboard. PCI is the name of a |
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c index 246100ef07c2..04eea4894ef3 100644 --- a/arch/alpha/kernel/pci-noop.c +++ b/arch/alpha/kernel/pci-noop.c | |||
@@ -185,15 +185,3 @@ struct dma_map_ops alpha_noop_ops = { | |||
185 | 185 | ||
186 | struct dma_map_ops *dma_ops = &alpha_noop_ops; | 186 | struct dma_map_ops *dma_ops = &alpha_noop_ops; |
187 | EXPORT_SYMBOL(dma_ops); | 187 | EXPORT_SYMBOL(dma_ops); |
188 | |||
189 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ||
190 | { | ||
191 | return NULL; | ||
192 | } | ||
193 | |||
194 | void pci_iounmap(struct pci_dev *dev, void __iomem * addr) | ||
195 | { | ||
196 | } | ||
197 | |||
198 | EXPORT_SYMBOL(pci_iomap); | ||
199 | EXPORT_SYMBOL(pci_iounmap); | ||
diff --git a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c index c9ab94ee1ca8..f3cae275d3f5 100644 --- a/arch/alpha/kernel/pci.c +++ b/arch/alpha/kernel/pci.c | |||
@@ -508,30 +508,7 @@ sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn) | |||
508 | return -EOPNOTSUPP; | 508 | return -EOPNOTSUPP; |
509 | } | 509 | } |
510 | 510 | ||
511 | /* Create an __iomem token from a PCI BAR. Copied from lib/iomap.c with | 511 | /* Destroy an __iomem token. Not copied from lib/iomap.c. */ |
512 | no changes, since we don't want the other things in that object file. */ | ||
513 | |||
514 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ||
515 | { | ||
516 | resource_size_t start = pci_resource_start(dev, bar); | ||
517 | resource_size_t len = pci_resource_len(dev, bar); | ||
518 | unsigned long flags = pci_resource_flags(dev, bar); | ||
519 | |||
520 | if (!len || !start) | ||
521 | return NULL; | ||
522 | if (maxlen && len > maxlen) | ||
523 | len = maxlen; | ||
524 | if (flags & IORESOURCE_IO) | ||
525 | return ioport_map(start, len); | ||
526 | if (flags & IORESOURCE_MEM) { | ||
527 | /* Not checking IORESOURCE_CACHEABLE because alpha does | ||
528 | not distinguish between ioremap and ioremap_nocache. */ | ||
529 | return ioremap(start, len); | ||
530 | } | ||
531 | return NULL; | ||
532 | } | ||
533 | |||
534 | /* Destroy that token. Not copied from lib/iomap.c. */ | ||
535 | 512 | ||
536 | void pci_iounmap(struct pci_dev *dev, void __iomem * addr) | 513 | void pci_iounmap(struct pci_dev *dev, void __iomem * addr) |
537 | { | 514 | { |
@@ -539,7 +516,6 @@ void pci_iounmap(struct pci_dev *dev, void __iomem * addr) | |||
539 | iounmap(addr); | 516 | iounmap(addr); |
540 | } | 517 | } |
541 | 518 | ||
542 | EXPORT_SYMBOL(pci_iomap); | ||
543 | EXPORT_SYMBOL(pci_iounmap); | 519 | EXPORT_SYMBOL(pci_iounmap); |
544 | 520 | ||
545 | /* FIXME: Some boxes have multiple ISA bridges! */ | 521 | /* FIXME: Some boxes have multiple ISA bridges! */ |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 98a6459cd398..24626b0419ee 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -31,6 +31,7 @@ config ARM | |||
31 | select HAVE_SPARSE_IRQ | 31 | select HAVE_SPARSE_IRQ |
32 | select GENERIC_IRQ_SHOW | 32 | select GENERIC_IRQ_SHOW |
33 | select CPU_PM if (SUSPEND || CPU_IDLE) | 33 | select CPU_PM if (SUSPEND || CPU_IDLE) |
34 | select GENERIC_PCI_IOMAP | ||
34 | help | 35 | help |
35 | The ARM series is a line of low-power-consumption RISC chip designs | 36 | The ARM series is a line of low-power-consumption RISC chip designs |
36 | licensed by ARM Ltd and targeted at embedded applications and | 37 | licensed by ARM Ltd and targeted at embedded applications and |
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index 065d100fa63e..9275828feb3d 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <asm/byteorder.h> | 27 | #include <asm/byteorder.h> |
28 | #include <asm/memory.h> | 28 | #include <asm/memory.h> |
29 | #include <asm/system.h> | 29 | #include <asm/system.h> |
30 | #include <asm-generic/pci_iomap.h> | ||
30 | 31 | ||
31 | /* | 32 | /* |
32 | * ISA I/O bus memory addresses are 1:1 with the physical address. | 33 | * ISA I/O bus memory addresses are 1:1 with the physical address. |
@@ -306,7 +307,6 @@ extern void ioport_unmap(void __iomem *addr); | |||
306 | 307 | ||
307 | struct pci_dev; | 308 | struct pci_dev; |
308 | 309 | ||
309 | extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen); | ||
310 | extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr); | 310 | extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr); |
311 | 311 | ||
312 | /* | 312 | /* |
diff --git a/arch/arm/mm/iomap.c b/arch/arm/mm/iomap.c index 430df1a5978d..e62956e12030 100644 --- a/arch/arm/mm/iomap.c +++ b/arch/arm/mm/iomap.c | |||
@@ -35,27 +35,6 @@ EXPORT_SYMBOL(pcibios_min_mem); | |||
35 | unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC; | 35 | unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC; |
36 | EXPORT_SYMBOL(pci_flags); | 36 | EXPORT_SYMBOL(pci_flags); |
37 | 37 | ||
38 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ||
39 | { | ||
40 | resource_size_t start = pci_resource_start(dev, bar); | ||
41 | resource_size_t len = pci_resource_len(dev, bar); | ||
42 | unsigned long flags = pci_resource_flags(dev, bar); | ||
43 | |||
44 | if (!len || !start) | ||
45 | return NULL; | ||
46 | if (maxlen && len > maxlen) | ||
47 | len = maxlen; | ||
48 | if (flags & IORESOURCE_IO) | ||
49 | return ioport_map(start, len); | ||
50 | if (flags & IORESOURCE_MEM) { | ||
51 | if (flags & IORESOURCE_CACHEABLE) | ||
52 | return ioremap(start, len); | ||
53 | return ioremap_nocache(start, len); | ||
54 | } | ||
55 | return NULL; | ||
56 | } | ||
57 | EXPORT_SYMBOL(pci_iomap); | ||
58 | |||
59 | void pci_iounmap(struct pci_dev *dev, void __iomem *addr) | 38 | void pci_iounmap(struct pci_dev *dev, void __iomem *addr) |
60 | { | 39 | { |
61 | if ((unsigned long)addr >= VMALLOC_START && | 40 | if ((unsigned long)addr >= VMALLOC_START && |
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index 408b055c585f..b3abfb08aa5c 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig | |||
@@ -19,10 +19,6 @@ config GENERIC_CMOS_UPDATE | |||
19 | config ARCH_USES_GETTIMEOFFSET | 19 | config ARCH_USES_GETTIMEOFFSET |
20 | def_bool n | 20 | def_bool n |
21 | 21 | ||
22 | config GENERIC_IOMAP | ||
23 | bool | ||
24 | default y | ||
25 | |||
26 | config ARCH_HAS_ILOG2_U32 | 22 | config ARCH_HAS_ILOG2_U32 |
27 | bool | 23 | bool |
28 | default n | 24 | default n |
@@ -52,6 +48,7 @@ config CRIS | |||
52 | select HAVE_IDE | 48 | select HAVE_IDE |
53 | select HAVE_GENERIC_HARDIRQS | 49 | select HAVE_GENERIC_HARDIRQS |
54 | select GENERIC_IRQ_SHOW | 50 | select GENERIC_IRQ_SHOW |
51 | select GENERIC_IOMAP | ||
55 | 52 | ||
56 | config HZ | 53 | config HZ |
57 | int | 54 | int |
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index c5e69abb4889..bbbf7927f238 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -317,6 +317,7 @@ config PCI | |||
317 | bool "Use PCI" | 317 | bool "Use PCI" |
318 | depends on MB93090_MB00 | 318 | depends on MB93090_MB00 |
319 | default y | 319 | default y |
320 | select GENERIC_PCI_IOMAP | ||
320 | help | 321 | help |
321 | Some FR-V systems (such as the MB93090-MB00 VDK) have PCI | 322 | Some FR-V systems (such as the MB93090-MB00 VDK) have PCI |
322 | onboard. If you have one of these boards and you wish to use the PCI | 323 | onboard. If you have one of these boards and you wish to use the PCI |
diff --git a/arch/frv/include/asm/io.h b/arch/frv/include/asm/io.h index ca7475e73b5e..8cb50a2fbcb2 100644 --- a/arch/frv/include/asm/io.h +++ b/arch/frv/include/asm/io.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/virtconvert.h> | 21 | #include <asm/virtconvert.h> |
22 | #include <asm/string.h> | 22 | #include <asm/string.h> |
23 | #include <asm/mb-regs.h> | 23 | #include <asm/mb-regs.h> |
24 | #include <asm-generic/pci_iomap.h> | ||
24 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
25 | 26 | ||
26 | /* | 27 | /* |
@@ -370,7 +371,6 @@ static inline void iowrite32_rep(void __iomem *p, const void *src, unsigned long | |||
370 | 371 | ||
371 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ | 372 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ |
372 | struct pci_dev; | 373 | struct pci_dev; |
373 | extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); | ||
374 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) | 374 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) |
375 | { | 375 | { |
376 | } | 376 | } |
diff --git a/arch/frv/mb93090-mb00/Makefile b/arch/frv/mb93090-mb00/Makefile index b73b542f8f48..21f1df1b378a 100644 --- a/arch/frv/mb93090-mb00/Makefile +++ b/arch/frv/mb93090-mb00/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | ifeq "$(CONFIG_PCI)" "y" | 5 | ifeq "$(CONFIG_PCI)" "y" |
6 | obj-y := pci-frv.o pci-irq.o pci-vdk.o pci-iomap.o | 6 | obj-y := pci-frv.o pci-irq.o pci-vdk.o |
7 | 7 | ||
8 | ifeq "$(CONFIG_MMU)" "y" | 8 | ifeq "$(CONFIG_MMU)" "y" |
9 | obj-y += pci-dma.o | 9 | obj-y += pci-dma.o |
diff --git a/arch/frv/mb93090-mb00/pci-iomap.c b/arch/frv/mb93090-mb00/pci-iomap.c deleted file mode 100644 index 35f6df28351e..000000000000 --- a/arch/frv/mb93090-mb00/pci-iomap.c +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | /* pci-iomap.c: description | ||
2 | * | ||
3 | * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | #include <linux/pci.h> | ||
12 | #include <linux/module.h> | ||
13 | |||
14 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ||
15 | { | ||
16 | resource_size_t start = pci_resource_start(dev, bar); | ||
17 | resource_size_t len = pci_resource_len(dev, bar); | ||
18 | unsigned long flags = pci_resource_flags(dev, bar); | ||
19 | |||
20 | if (!len || !start) | ||
21 | return NULL; | ||
22 | |||
23 | if ((flags & IORESOURCE_IO) || (flags & IORESOURCE_MEM)) | ||
24 | return (void __iomem *) start; | ||
25 | |||
26 | return NULL; | ||
27 | } | ||
28 | |||
29 | EXPORT_SYMBOL(pci_iomap); | ||
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig index 02513c2dd5ec..9059e3905887 100644 --- a/arch/hexagon/Kconfig +++ b/arch/hexagon/Kconfig | |||
@@ -26,6 +26,7 @@ config HEXAGON | |||
26 | select HAVE_ARCH_KGDB | 26 | select HAVE_ARCH_KGDB |
27 | select HAVE_ARCH_TRACEHOOK | 27 | select HAVE_ARCH_TRACEHOOK |
28 | select NO_IOPORT | 28 | select NO_IOPORT |
29 | select GENERIC_IOMAP | ||
29 | # mostly generic routines, with some accelerated ones | 30 | # mostly generic routines, with some accelerated ones |
30 | ---help--- | 31 | ---help--- |
31 | Qualcomm Hexagon is a processor architecture designed for high | 32 | Qualcomm Hexagon is a processor architecture designed for high |
@@ -73,9 +74,6 @@ config GENERIC_CSUM | |||
73 | config GENERIC_IRQ_PROBE | 74 | config GENERIC_IRQ_PROBE |
74 | def_bool y | 75 | def_bool y |
75 | 76 | ||
76 | config GENERIC_IOMAP | ||
77 | def_bool y | ||
78 | |||
79 | #config ZONE_DMA | 77 | #config ZONE_DMA |
80 | # bool | 78 | # bool |
81 | # default y | 79 | # default y |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 3b7a7c483785..bd7266903bf8 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -32,6 +32,7 @@ config IA64 | |||
32 | select GENERIC_IRQ_SHOW | 32 | select GENERIC_IRQ_SHOW |
33 | select ARCH_WANT_OPTIONAL_GPIOLIB | 33 | select ARCH_WANT_OPTIONAL_GPIOLIB |
34 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 34 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
35 | select GENERIC_IOMAP | ||
35 | default y | 36 | default y |
36 | help | 37 | help |
37 | The Itanium Processor Family is Intel's 64-bit successor to | 38 | The Itanium Processor Family is Intel's 64-bit successor to |
@@ -105,10 +106,6 @@ config EFI | |||
105 | bool | 106 | bool |
106 | default y | 107 | default y |
107 | 108 | ||
108 | config GENERIC_IOMAP | ||
109 | bool | ||
110 | default y | ||
111 | |||
112 | config ARCH_CLOCKSOURCE_DATA | 109 | config ARCH_CLOCKSOURCE_DATA |
113 | def_bool y | 110 | def_bool y |
114 | 111 | ||
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 81fdaa72c540..99c363617f27 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig | |||
@@ -37,9 +37,6 @@ config GENERIC_CALIBRATE_DELAY | |||
37 | bool | 37 | bool |
38 | default y | 38 | default y |
39 | 39 | ||
40 | config GENERIC_IOMAP | ||
41 | def_bool MMU | ||
42 | |||
43 | config GENERIC_CSUM | 40 | config GENERIC_CSUM |
44 | bool | 41 | bool |
45 | 42 | ||
@@ -81,6 +78,7 @@ source "kernel/Kconfig.freezer" | |||
81 | config MMU | 78 | config MMU |
82 | bool "MMU-based Paged Memory Management Support" | 79 | bool "MMU-based Paged Memory Management Support" |
83 | default y | 80 | default y |
81 | select GENERIC_IOMAP | ||
84 | help | 82 | help |
85 | Select if you want MMU-based virtualised addressing space | 83 | Select if you want MMU-based virtualised addressing space |
86 | support by paged memory management. If unsure, say 'Y'. | 84 | support by paged memory management. If unsure, say 'Y'. |
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index e446bab2427b..f0eead74fff6 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig | |||
@@ -17,6 +17,7 @@ config MICROBLAZE | |||
17 | select HAVE_GENERIC_HARDIRQS | 17 | select HAVE_GENERIC_HARDIRQS |
18 | select GENERIC_IRQ_PROBE | 18 | select GENERIC_IRQ_PROBE |
19 | select GENERIC_IRQ_SHOW | 19 | select GENERIC_IRQ_SHOW |
20 | select GENERIC_PCI_IOMAP | ||
20 | 21 | ||
21 | config SWAP | 22 | config SWAP |
22 | def_bool n | 23 | def_bool n |
diff --git a/arch/microblaze/pci/iomap.c b/arch/microblaze/pci/iomap.c index 57acda852f5a..b07abbac0319 100644 --- a/arch/microblaze/pci/iomap.c +++ b/arch/microblaze/pci/iomap.c | |||
@@ -10,25 +10,6 @@ | |||
10 | #include <asm/io.h> | 10 | #include <asm/io.h> |
11 | #include <asm/pci-bridge.h> | 11 | #include <asm/pci-bridge.h> |
12 | 12 | ||
13 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) | ||
14 | { | ||
15 | resource_size_t start = pci_resource_start(dev, bar); | ||
16 | resource_size_t len = pci_resource_len(dev, bar); | ||
17 | unsigned long flags = pci_resource_flags(dev, bar); | ||
18 | |||
19 | if (!len) | ||
20 | return NULL; | ||
21 | if (max && len > max) | ||
22 | len = max; | ||
23 | if (flags & IORESOURCE_IO) | ||
24 | return ioport_map(start, len); | ||
25 | if (flags & IORESOURCE_MEM) | ||
26 | return ioremap(start, len); | ||
27 | /* What? */ | ||
28 | return NULL; | ||
29 | } | ||
30 | EXPORT_SYMBOL(pci_iomap); | ||
31 | |||
32 | void pci_iounmap(struct pci_dev *dev, void __iomem *addr) | 13 | void pci_iounmap(struct pci_dev *dev, void __iomem *addr) |
33 | { | 14 | { |
34 | if (isa_vaddr_is_ioport(addr)) | 15 | if (isa_vaddr_is_ioport(addr)) |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index c529cfe52c53..29d92187ff30 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -2317,6 +2317,7 @@ config PCI | |||
2317 | bool "Support for PCI controller" | 2317 | bool "Support for PCI controller" |
2318 | depends on HW_HAS_PCI | 2318 | depends on HW_HAS_PCI |
2319 | select PCI_DOMAINS | 2319 | select PCI_DOMAINS |
2320 | select GENERIC_PCI_IOMAP | ||
2320 | help | 2321 | help |
2321 | Find out whether you have a PCI motherboard. PCI is the name of a | 2322 | Find out whether you have a PCI motherboard. PCI is the name of a |
2322 | bus system, i.e. the way the CPU talks to the other stuff inside | 2323 | bus system, i.e. the way the CPU talks to the other stuff inside |
diff --git a/arch/mips/lib/iomap-pci.c b/arch/mips/lib/iomap-pci.c index 2ab899c4b4ce..2635b1a96333 100644 --- a/arch/mips/lib/iomap-pci.c +++ b/arch/mips/lib/iomap-pci.c | |||
@@ -40,32 +40,6 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev, | |||
40 | return (void __iomem *) (ctrl->io_map_base + port); | 40 | return (void __iomem *) (ctrl->io_map_base + port); |
41 | } | 41 | } |
42 | 42 | ||
43 | /* | ||
44 | * Create a virtual mapping cookie for a PCI BAR (memory or IO) | ||
45 | */ | ||
46 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ||
47 | { | ||
48 | resource_size_t start = pci_resource_start(dev, bar); | ||
49 | resource_size_t len = pci_resource_len(dev, bar); | ||
50 | unsigned long flags = pci_resource_flags(dev, bar); | ||
51 | |||
52 | if (!len || !start) | ||
53 | return NULL; | ||
54 | if (maxlen && len > maxlen) | ||
55 | len = maxlen; | ||
56 | if (flags & IORESOURCE_IO) | ||
57 | return ioport_map_pci(dev, start, len); | ||
58 | if (flags & IORESOURCE_MEM) { | ||
59 | if (flags & IORESOURCE_CACHEABLE) | ||
60 | return ioremap(start, len); | ||
61 | return ioremap_nocache(start, len); | ||
62 | } | ||
63 | /* What? */ | ||
64 | return NULL; | ||
65 | } | ||
66 | |||
67 | EXPORT_SYMBOL(pci_iomap); | ||
68 | |||
69 | void pci_iounmap(struct pci_dev *dev, void __iomem * addr) | 43 | void pci_iounmap(struct pci_dev *dev, void __iomem * addr) |
70 | { | 44 | { |
71 | iounmap(addr); | 45 | iounmap(addr); |
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig index 438db84a1f7c..8f1c40d5817e 100644 --- a/arch/mn10300/Kconfig +++ b/arch/mn10300/Kconfig | |||
@@ -252,6 +252,7 @@ config PCI | |||
252 | bool "Use PCI" | 252 | bool "Use PCI" |
253 | depends on MN10300_UNIT_ASB2305 | 253 | depends on MN10300_UNIT_ASB2305 |
254 | default y | 254 | default y |
255 | select GENERIC_PCI_IOMAP | ||
255 | help | 256 | help |
256 | Some systems (such as the ASB2305) have PCI onboard. If you have one | 257 | Some systems (such as the ASB2305) have PCI onboard. If you have one |
257 | of these boards and you wish to use the PCI facilities, say Y here. | 258 | of these boards and you wish to use the PCI facilities, say Y here. |
diff --git a/arch/mn10300/include/asm/io.h b/arch/mn10300/include/asm/io.h index 787255da744e..139df8c53de8 100644 --- a/arch/mn10300/include/asm/io.h +++ b/arch/mn10300/include/asm/io.h | |||
@@ -229,7 +229,6 @@ static inline void outsl(unsigned long addr, const void *buffer, int count) | |||
229 | 229 | ||
230 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ | 230 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ |
231 | struct pci_dev; | 231 | struct pci_dev; |
232 | extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); | ||
233 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) | 232 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) |
234 | { | 233 | { |
235 | } | 234 | } |
@@ -251,15 +250,15 @@ static inline void *phys_to_virt(unsigned long address) | |||
251 | /* | 250 | /* |
252 | * Change "struct page" to physical address. | 251 | * Change "struct page" to physical address. |
253 | */ | 252 | */ |
254 | static inline void *__ioremap(unsigned long offset, unsigned long size, | 253 | static inline void __iomem *__ioremap(unsigned long offset, unsigned long size, |
255 | unsigned long flags) | 254 | unsigned long flags) |
256 | { | 255 | { |
257 | return (void *) offset; | 256 | return (void __iomem *) offset; |
258 | } | 257 | } |
259 | 258 | ||
260 | static inline void *ioremap(unsigned long offset, unsigned long size) | 259 | static inline void __iomem *ioremap(unsigned long offset, unsigned long size) |
261 | { | 260 | { |
262 | return (void *) offset; | 261 | return (void __iomem *) offset; |
263 | } | 262 | } |
264 | 263 | ||
265 | /* | 264 | /* |
@@ -267,14 +266,14 @@ static inline void *ioremap(unsigned long offset, unsigned long size) | |||
267 | * area. it's useful if some control registers are in such an area and write | 266 | * area. it's useful if some control registers are in such an area and write |
268 | * combining or read caching is not desirable: | 267 | * combining or read caching is not desirable: |
269 | */ | 268 | */ |
270 | static inline void *ioremap_nocache(unsigned long offset, unsigned long size) | 269 | static inline void __iomem *ioremap_nocache(unsigned long offset, unsigned long size) |
271 | { | 270 | { |
272 | return (void *) (offset | 0x20000000); | 271 | return (void __iomem *) (offset | 0x20000000); |
273 | } | 272 | } |
274 | 273 | ||
275 | #define ioremap_wc ioremap_nocache | 274 | #define ioremap_wc ioremap_nocache |
276 | 275 | ||
277 | static inline void iounmap(void *addr) | 276 | static inline void iounmap(void __iomem *addr) |
278 | { | 277 | { |
279 | } | 278 | } |
280 | 279 | ||
diff --git a/arch/mn10300/unit-asb2305/Makefile b/arch/mn10300/unit-asb2305/Makefile index 0551022225b3..cbc5abaa939a 100644 --- a/arch/mn10300/unit-asb2305/Makefile +++ b/arch/mn10300/unit-asb2305/Makefile | |||
@@ -5,4 +5,4 @@ | |||
5 | ############################################################################### | 5 | ############################################################################### |
6 | obj-y := unit-init.o leds.o | 6 | obj-y := unit-init.o leds.o |
7 | 7 | ||
8 | obj-$(CONFIG_PCI) += pci.o pci-asb2305.o pci-irq.o pci-iomap.o | 8 | obj-$(CONFIG_PCI) += pci.o pci-asb2305.o pci-irq.o |
diff --git a/arch/mn10300/unit-asb2305/pci-iomap.c b/arch/mn10300/unit-asb2305/pci-iomap.c deleted file mode 100644 index c1a8d8f941fd..000000000000 --- a/arch/mn10300/unit-asb2305/pci-iomap.c +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /* ASB2305 PCI I/O mapping handler | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | #include <linux/pci.h> | ||
12 | #include <linux/module.h> | ||
13 | |||
14 | /* | ||
15 | * Create a virtual mapping cookie for a PCI BAR (memory or IO) | ||
16 | */ | ||
17 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ||
18 | { | ||
19 | resource_size_t start = pci_resource_start(dev, bar); | ||
20 | resource_size_t len = pci_resource_len(dev, bar); | ||
21 | unsigned long flags = pci_resource_flags(dev, bar); | ||
22 | |||
23 | if (!len || !start) | ||
24 | return NULL; | ||
25 | |||
26 | if ((flags & IORESOURCE_IO) || (flags & IORESOURCE_MEM)) | ||
27 | return (void __iomem *) start; | ||
28 | |||
29 | return NULL; | ||
30 | } | ||
31 | EXPORT_SYMBOL(pci_iomap); | ||
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig index e518a5a4cf4c..081a54f1a93d 100644 --- a/arch/openrisc/Kconfig +++ b/arch/openrisc/Kconfig | |||
@@ -38,9 +38,6 @@ config RWSEM_XCHGADD_ALGORITHM | |||
38 | config GENERIC_HWEIGHT | 38 | config GENERIC_HWEIGHT |
39 | def_bool y | 39 | def_bool y |
40 | 40 | ||
41 | config GENERIC_IOMAP | ||
42 | def_bool y | ||
43 | |||
44 | config NO_IOPORT | 41 | config NO_IOPORT |
45 | def_bool y | 42 | def_bool y |
46 | 43 | ||
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index fdfd8be29e95..242a1b7ac759 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig | |||
@@ -14,6 +14,7 @@ config PARISC | |||
14 | select GENERIC_ATOMIC64 if !64BIT | 14 | select GENERIC_ATOMIC64 if !64BIT |
15 | select HAVE_GENERIC_HARDIRQS | 15 | select HAVE_GENERIC_HARDIRQS |
16 | select GENERIC_IRQ_PROBE | 16 | select GENERIC_IRQ_PROBE |
17 | select GENERIC_PCI_IOMAP | ||
17 | select IRQ_PER_CPU | 18 | select IRQ_PER_CPU |
18 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 19 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
19 | 20 | ||
diff --git a/arch/parisc/lib/iomap.c b/arch/parisc/lib/iomap.c index 8f470c93b16d..fb8e10a4fb39 100644 --- a/arch/parisc/lib/iomap.c +++ b/arch/parisc/lib/iomap.c | |||
@@ -436,28 +436,6 @@ void ioport_unmap(void __iomem *addr) | |||
436 | } | 436 | } |
437 | } | 437 | } |
438 | 438 | ||
439 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ | ||
440 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ||
441 | { | ||
442 | resource_size_t start = pci_resource_start(dev, bar); | ||
443 | resource_size_t len = pci_resource_len(dev, bar); | ||
444 | unsigned long flags = pci_resource_flags(dev, bar); | ||
445 | |||
446 | if (!len || !start) | ||
447 | return NULL; | ||
448 | if (maxlen && len > maxlen) | ||
449 | len = maxlen; | ||
450 | if (flags & IORESOURCE_IO) | ||
451 | return ioport_map(start, len); | ||
452 | if (flags & IORESOURCE_MEM) { | ||
453 | if (flags & IORESOURCE_CACHEABLE) | ||
454 | return ioremap(start, len); | ||
455 | return ioremap_nocache(start, len); | ||
456 | } | ||
457 | /* What? */ | ||
458 | return NULL; | ||
459 | } | ||
460 | |||
461 | void pci_iounmap(struct pci_dev *dev, void __iomem * addr) | 439 | void pci_iounmap(struct pci_dev *dev, void __iomem * addr) |
462 | { | 440 | { |
463 | if (!INDIRECT_ADDR(addr)) { | 441 | if (!INDIRECT_ADDR(addr)) { |
@@ -483,5 +461,4 @@ EXPORT_SYMBOL(iowrite16_rep); | |||
483 | EXPORT_SYMBOL(iowrite32_rep); | 461 | EXPORT_SYMBOL(iowrite32_rep); |
484 | EXPORT_SYMBOL(ioport_map); | 462 | EXPORT_SYMBOL(ioport_map); |
485 | EXPORT_SYMBOL(ioport_unmap); | 463 | EXPORT_SYMBOL(ioport_unmap); |
486 | EXPORT_SYMBOL(pci_iomap); | ||
487 | EXPORT_SYMBOL(pci_iounmap); | 464 | EXPORT_SYMBOL(pci_iounmap); |
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 692ac7588e20..1919634a9b32 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -718,6 +718,7 @@ config PCI | |||
718 | default PCI_PERMEDIA if !4xx && !CPM2 && !8xx | 718 | default PCI_PERMEDIA if !4xx && !CPM2 && !8xx |
719 | default PCI_QSPAN if !4xx && !CPM2 && 8xx | 719 | default PCI_QSPAN if !4xx && !CPM2 && 8xx |
720 | select ARCH_SUPPORTS_MSI | 720 | select ARCH_SUPPORTS_MSI |
721 | select GENERIC_PCI_IOMAP | ||
721 | help | 722 | help |
722 | Find out whether your system includes a PCI bus. PCI is the name of | 723 | Find out whether your system includes a PCI bus. PCI is the name of |
723 | a bus system, i.e. the way the CPU talks to the other stuff inside | 724 | a bus system, i.e. the way the CPU talks to the other stuff inside |
diff --git a/arch/powerpc/kernel/iomap.c b/arch/powerpc/kernel/iomap.c index 262791807397..97a3715ac8bd 100644 --- a/arch/powerpc/kernel/iomap.c +++ b/arch/powerpc/kernel/iomap.c | |||
@@ -119,24 +119,6 @@ EXPORT_SYMBOL(ioport_map); | |||
119 | EXPORT_SYMBOL(ioport_unmap); | 119 | EXPORT_SYMBOL(ioport_unmap); |
120 | 120 | ||
121 | #ifdef CONFIG_PCI | 121 | #ifdef CONFIG_PCI |
122 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) | ||
123 | { | ||
124 | resource_size_t start = pci_resource_start(dev, bar); | ||
125 | resource_size_t len = pci_resource_len(dev, bar); | ||
126 | unsigned long flags = pci_resource_flags(dev, bar); | ||
127 | |||
128 | if (!len) | ||
129 | return NULL; | ||
130 | if (max && len > max) | ||
131 | len = max; | ||
132 | if (flags & IORESOURCE_IO) | ||
133 | return ioport_map(start, len); | ||
134 | if (flags & IORESOURCE_MEM) | ||
135 | return ioremap(start, len); | ||
136 | /* What? */ | ||
137 | return NULL; | ||
138 | } | ||
139 | |||
140 | void pci_iounmap(struct pci_dev *dev, void __iomem *addr) | 122 | void pci_iounmap(struct pci_dev *dev, void __iomem *addr) |
141 | { | 123 | { |
142 | if (isa_vaddr_is_ioport(addr)) | 124 | if (isa_vaddr_is_ioport(addr)) |
@@ -146,6 +128,5 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *addr) | |||
146 | iounmap(addr); | 128 | iounmap(addr); |
147 | } | 129 | } |
148 | 130 | ||
149 | EXPORT_SYMBOL(pci_iomap); | ||
150 | EXPORT_SYMBOL(pci_iounmap); | 131 | EXPORT_SYMBOL(pci_iounmap); |
151 | #endif /* CONFIG_PCI */ | 132 | #endif /* CONFIG_PCI */ |
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index 31e1adeaa92a..0cfb46d54b8c 100644 --- a/arch/powerpc/platforms/Kconfig +++ b/arch/powerpc/platforms/Kconfig | |||
@@ -175,9 +175,6 @@ config PPC_INDIRECT_MMIO | |||
175 | config PPC_IO_WORKAROUNDS | 175 | config PPC_IO_WORKAROUNDS |
176 | bool | 176 | bool |
177 | 177 | ||
178 | config GENERIC_IOMAP | ||
179 | bool | ||
180 | |||
181 | source "drivers/cpufreq/Kconfig" | 178 | source "drivers/cpufreq/Kconfig" |
182 | 179 | ||
183 | menu "CPU Frequency drivers" | 180 | menu "CPU Frequency drivers" |
diff --git a/arch/score/Kconfig b/arch/score/Kconfig index 8b0c9464aa9d..3df65d39abc1 100644 --- a/arch/score/Kconfig +++ b/arch/score/Kconfig | |||
@@ -4,6 +4,7 @@ config SCORE | |||
4 | def_bool y | 4 | def_bool y |
5 | select HAVE_GENERIC_HARDIRQS | 5 | select HAVE_GENERIC_HARDIRQS |
6 | select GENERIC_IRQ_SHOW | 6 | select GENERIC_IRQ_SHOW |
7 | select GENERIC_IOMAP | ||
7 | select HAVE_MEMBLOCK | 8 | select HAVE_MEMBLOCK |
8 | select HAVE_MEMBLOCK_NODE_MAP | 9 | select HAVE_MEMBLOCK_NODE_MAP |
9 | select ARCH_DISCARD_MEMBLOCK | 10 | select ARCH_DISCARD_MEMBLOCK |
@@ -36,9 +37,6 @@ endmenu | |||
36 | config CPU_SCORE7 | 37 | config CPU_SCORE7 |
37 | bool | 38 | bool |
38 | 39 | ||
39 | config GENERIC_IOMAP | ||
40 | def_bool y | ||
41 | |||
42 | config NO_DMA | 40 | config NO_DMA |
43 | bool | 41 | bool |
44 | default y | 42 | default y |
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 47a2f1c2cb0d..3c8db65c89e5 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -85,9 +85,6 @@ config GENERIC_GPIO | |||
85 | config GENERIC_CALIBRATE_DELAY | 85 | config GENERIC_CALIBRATE_DELAY |
86 | bool | 86 | bool |
87 | 87 | ||
88 | config GENERIC_IOMAP | ||
89 | bool | ||
90 | |||
91 | config GENERIC_CLOCKEVENTS | 88 | config GENERIC_CLOCKEVENTS |
92 | def_bool y | 89 | def_bool y |
93 | 90 | ||
@@ -861,6 +858,7 @@ config PCI | |||
861 | bool "PCI support" | 858 | bool "PCI support" |
862 | depends on SYS_SUPPORTS_PCI | 859 | depends on SYS_SUPPORTS_PCI |
863 | select PCI_DOMAINS | 860 | select PCI_DOMAINS |
861 | select GENERIC_PCI_IOMAP | ||
864 | help | 862 | help |
865 | Find out whether you have a PCI motherboard. PCI is the name of a | 863 | Find out whether you have a PCI motherboard. PCI is the name of a |
866 | bus system, i.e. the way the CPU talks to the other stuff inside | 864 | bus system, i.e. the way the CPU talks to the other stuff inside |
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c index c2691afe8f79..11aaf2fdec84 100644 --- a/arch/sh/drivers/pci/pci.c +++ b/arch/sh/drivers/pci/pci.c | |||
@@ -393,29 +393,6 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev, | |||
393 | return (void __iomem *)(chan->io_map_base + port); | 393 | return (void __iomem *)(chan->io_map_base + port); |
394 | } | 394 | } |
395 | 395 | ||
396 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ||
397 | { | ||
398 | resource_size_t start = pci_resource_start(dev, bar); | ||
399 | resource_size_t len = pci_resource_len(dev, bar); | ||
400 | unsigned long flags = pci_resource_flags(dev, bar); | ||
401 | |||
402 | if (unlikely(!len || !start)) | ||
403 | return NULL; | ||
404 | if (maxlen && len > maxlen) | ||
405 | len = maxlen; | ||
406 | |||
407 | if (flags & IORESOURCE_IO) | ||
408 | return ioport_map_pci(dev, start, len); | ||
409 | if (flags & IORESOURCE_MEM) { | ||
410 | if (flags & IORESOURCE_CACHEABLE) | ||
411 | return ioremap(start, len); | ||
412 | return ioremap_nocache(start, len); | ||
413 | } | ||
414 | |||
415 | return NULL; | ||
416 | } | ||
417 | EXPORT_SYMBOL(pci_iomap); | ||
418 | |||
419 | void pci_iounmap(struct pci_dev *dev, void __iomem *addr) | 396 | void pci_iounmap(struct pci_dev *dev, void __iomem *addr) |
420 | { | 397 | { |
421 | iounmap(addr); | 398 | iounmap(addr); |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 868ea08dff0b..96657992a72e 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 | ||
32 | config SPARC32 | 33 | config 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) */ |
326 | struct pci_dev; | 327 | struct pci_dev; |
327 | extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); | ||
328 | extern void pci_iounmap(struct pci_dev *dev, void __iomem *); | 328 | extern 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) */ |
516 | struct pci_dev; | 517 | struct pci_dev; |
517 | extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); | ||
518 | extern void pci_iounmap(struct pci_dev *dev, void __iomem *); | 518 | extern void pci_iounmap(struct pci_dev *dev, void __iomem *); |
519 | 519 | ||
520 | static inline int sbus_can_dma_64bit(void) | 520 | static 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) | |||
18 | EXPORT_SYMBOL(ioport_map); | 18 | EXPORT_SYMBOL(ioport_map); |
19 | EXPORT_SYMBOL(ioport_unmap); | 19 | EXPORT_SYMBOL(ioport_unmap); |
20 | 20 | ||
21 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ | ||
22 | void __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 | |||
43 | void pci_iounmap(struct pci_dev *dev, void __iomem * addr) | 21 | void pci_iounmap(struct pci_dev *dev, void __iomem * addr) |
44 | { | 22 | { |
45 | /* nothing to do */ | 23 | /* nothing to do */ |
46 | } | 24 | } |
47 | EXPORT_SYMBOL(pci_iomap); | ||
48 | EXPORT_SYMBOL(pci_iounmap); | 25 | EXPORT_SYMBOL(pci_iounmap); |
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index 70a0de46cd1b..11270ca22c0a 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig | |||
@@ -321,6 +321,7 @@ config PCI | |||
321 | bool "PCI support" | 321 | bool "PCI support" |
322 | default y | 322 | default y |
323 | select PCI_DOMAINS | 323 | select PCI_DOMAINS |
324 | select GENERIC_PCI_IOMAP | ||
324 | ---help--- | 325 | ---help--- |
325 | Enable PCI root complex support, so PCIe endpoint devices can | 326 | Enable PCI root complex support, so PCIe endpoint devices can |
326 | be attached to the Tile chip. Many, but not all, PCI devices | 327 | be attached to the Tile chip. Many, but not all, PCI devices |
diff --git a/arch/tile/include/asm/io.h b/arch/tile/include/asm/io.h index c9ea1652af03..d2152deb1f3c 100644 --- a/arch/tile/include/asm/io.h +++ b/arch/tile/include/asm/io.h | |||
@@ -204,7 +204,8 @@ static inline long ioport_panic(void) | |||
204 | 204 | ||
205 | static inline void __iomem *ioport_map(unsigned long port, unsigned int len) | 205 | static inline void __iomem *ioport_map(unsigned long port, unsigned int len) |
206 | { | 206 | { |
207 | return (void __iomem *) ioport_panic(); | 207 | pr_info("ioport_map: mapping IO resources is unsupported on tile.\n"); |
208 | return NULL; | ||
208 | } | 209 | } |
209 | 210 | ||
210 | static inline void ioport_unmap(void __iomem *addr) | 211 | static inline void ioport_unmap(void __iomem *addr) |
diff --git a/arch/tile/include/asm/pci.h b/arch/tile/include/asm/pci.h index 7f03cefed1b9..1d25fea42e54 100644 --- a/arch/tile/include/asm/pci.h +++ b/arch/tile/include/asm/pci.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define _ASM_TILE_PCI_H | 16 | #define _ASM_TILE_PCI_H |
17 | 17 | ||
18 | #include <linux/pci.h> | 18 | #include <linux/pci.h> |
19 | #include <asm-generic/pci_iomap.h> | ||
19 | 20 | ||
20 | /* | 21 | /* |
21 | * Structure of a PCI controller (host bridge) | 22 | * Structure of a PCI controller (host bridge) |
@@ -49,7 +50,6 @@ struct pci_controller { | |||
49 | int __devinit tile_pci_init(void); | 50 | int __devinit tile_pci_init(void); |
50 | int __devinit pcibios_init(void); | 51 | int __devinit pcibios_init(void); |
51 | 52 | ||
52 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); | ||
53 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {} | 53 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {} |
54 | 54 | ||
55 | void __devinit pcibios_fixup_bus(struct pci_bus *bus); | 55 | void __devinit pcibios_fixup_bus(struct pci_bus *bus); |
diff --git a/arch/tile/kernel/pci.c b/arch/tile/kernel/pci.c index 9d610d3fb11e..25567934a21e 100644 --- a/arch/tile/kernel/pci.c +++ b/arch/tile/kernel/pci.c | |||
@@ -466,27 +466,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) | |||
466 | return 0; | 466 | return 0; |
467 | } | 467 | } |
468 | 468 | ||
469 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) | ||
470 | { | ||
471 | unsigned long start = pci_resource_start(dev, bar); | ||
472 | unsigned long len = pci_resource_len(dev, bar); | ||
473 | unsigned long flags = pci_resource_flags(dev, bar); | ||
474 | |||
475 | if (!len) | ||
476 | return NULL; | ||
477 | if (max && len > max) | ||
478 | len = max; | ||
479 | |||
480 | if (!(flags & IORESOURCE_MEM)) { | ||
481 | pr_info("PCI: Trying to map invalid resource %#lx\n", flags); | ||
482 | start = 0; | ||
483 | } | ||
484 | |||
485 | return (void __iomem *)start; | ||
486 | } | ||
487 | EXPORT_SYMBOL(pci_iomap); | ||
488 | |||
489 | |||
490 | /**************************************************************** | 469 | /**************************************************************** |
491 | * | 470 | * |
492 | * Tile PCI config space read/write routines | 471 | * Tile PCI config space read/write routines |
diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig index 942ed6174f1d..eeb8054c7cd8 100644 --- a/arch/unicore32/Kconfig +++ b/arch/unicore32/Kconfig | |||
@@ -12,6 +12,7 @@ config UNICORE32 | |||
12 | select GENERIC_IRQ_PROBE | 12 | select GENERIC_IRQ_PROBE |
13 | select GENERIC_IRQ_SHOW | 13 | select GENERIC_IRQ_SHOW |
14 | select ARCH_WANT_FRAME_POINTERS | 14 | select ARCH_WANT_FRAME_POINTERS |
15 | select GENERIC_IOMAP | ||
15 | help | 16 | help |
16 | UniCore-32 is 32-bit Instruction Set Architecture, | 17 | UniCore-32 is 32-bit Instruction Set Architecture, |
17 | including a series of low-power-consumption RISC chip | 18 | including a series of low-power-consumption RISC chip |
@@ -30,9 +31,6 @@ config GENERIC_CLOCKEVENTS | |||
30 | config GENERIC_CSUM | 31 | config GENERIC_CSUM |
31 | def_bool y | 32 | def_bool y |
32 | 33 | ||
33 | config GENERIC_IOMAP | ||
34 | def_bool y | ||
35 | |||
36 | config NO_IOPORT | 34 | config NO_IOPORT |
37 | bool | 35 | bool |
38 | 36 | ||
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index d6ddc0bfe36a..1a31254ceb83 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -78,6 +78,7 @@ config X86 | |||
78 | select HAVE_BPF_JIT if (X86_64 && NET) | 78 | select HAVE_BPF_JIT if (X86_64 && NET) |
79 | select CLKEVT_I8253 | 79 | select CLKEVT_I8253 |
80 | select ARCH_HAVE_NMI_SAFE_CMPXCHG | 80 | select ARCH_HAVE_NMI_SAFE_CMPXCHG |
81 | select GENERIC_IOMAP | ||
81 | 82 | ||
82 | config INSTRUCTION_DECODER | 83 | config INSTRUCTION_DECODER |
83 | def_bool (KPROBES || PERF_EVENTS) | 84 | def_bool (KPROBES || PERF_EVENTS) |
@@ -143,9 +144,6 @@ config NEED_SG_DMA_LENGTH | |||
143 | config GENERIC_ISA_DMA | 144 | config GENERIC_ISA_DMA |
144 | def_bool ISA_DMA_API | 145 | def_bool ISA_DMA_API |
145 | 146 | ||
146 | config GENERIC_IOMAP | ||
147 | def_bool y | ||
148 | |||
149 | config GENERIC_BUG | 147 | config GENERIC_BUG |
150 | def_bool y | 148 | def_bool y |
151 | depends on BUG | 149 | depends on BUG |
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index c2cf2eda0626..448303bdb85f 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h | |||
@@ -19,6 +19,8 @@ | |||
19 | #include <asm-generic/iomap.h> | 19 | #include <asm-generic/iomap.h> |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #include <asm-generic/pci_iomap.h> | ||
23 | |||
22 | #ifndef mmiowb | 24 | #ifndef mmiowb |
23 | #define mmiowb() do {} while (0) | 25 | #define mmiowb() do {} while (0) |
24 | #endif | 26 | #endif |
@@ -283,9 +285,7 @@ static inline void writesb(const void __iomem *addr, const void *buf, int len) | |||
283 | #define __io_virt(x) ((void __force *) (x)) | 285 | #define __io_virt(x) ((void __force *) (x)) |
284 | 286 | ||
285 | #ifndef CONFIG_GENERIC_IOMAP | 287 | #ifndef CONFIG_GENERIC_IOMAP |
286 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ | ||
287 | struct pci_dev; | 288 | struct pci_dev; |
288 | extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); | ||
289 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) | 289 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) |
290 | { | 290 | { |
291 | } | 291 | } |
diff --git a/include/asm-generic/iomap.h b/include/asm-generic/iomap.h index 98dcd76ce836..8a3d4fde2604 100644 --- a/include/asm-generic/iomap.h +++ b/include/asm-generic/iomap.h | |||
@@ -67,18 +67,15 @@ extern void ioport_unmap(void __iomem *); | |||
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | #ifdef CONFIG_PCI | 69 | #ifdef CONFIG_PCI |
70 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ | 70 | /* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */ |
71 | struct pci_dev; | 71 | struct pci_dev; |
72 | extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); | ||
73 | extern void pci_iounmap(struct pci_dev *dev, void __iomem *); | 72 | extern void pci_iounmap(struct pci_dev *dev, void __iomem *); |
74 | #else | 73 | #else |
75 | struct pci_dev; | 74 | struct pci_dev; |
76 | static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) | ||
77 | { | ||
78 | return NULL; | ||
79 | } | ||
80 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) | 75 | static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) |
81 | { } | 76 | { } |
82 | #endif | 77 | #endif |
83 | 78 | ||
79 | #include <asm-generic/pci_iomap.h> | ||
80 | |||
84 | #endif | 81 | #endif |
diff --git a/include/asm-generic/pci_iomap.h b/include/asm-generic/pci_iomap.h new file mode 100644 index 000000000000..8de4b73e19e2 --- /dev/null +++ b/include/asm-generic/pci_iomap.h | |||
@@ -0,0 +1,25 @@ | |||
1 | /* Generic I/O port emulation, based on MN10300 code | ||
2 | * | ||
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | #ifndef __ASM_GENERIC_PCI_IOMAP_H | ||
12 | #define __ASM_GENERIC_PCI_IOMAP_H | ||
13 | |||
14 | struct pci_dev; | ||
15 | #ifdef CONFIG_PCI | ||
16 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ | ||
17 | extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); | ||
18 | #else | ||
19 | static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) | ||
20 | { | ||
21 | return NULL; | ||
22 | } | ||
23 | #endif | ||
24 | |||
25 | #endif /* __ASM_GENERIC_IO_H */ | ||
diff --git a/lib/Kconfig b/lib/Kconfig index f34be6417d71..7f6b8bca8c25 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
@@ -19,6 +19,13 @@ config RATIONAL | |||
19 | config GENERIC_FIND_FIRST_BIT | 19 | config GENERIC_FIND_FIRST_BIT |
20 | bool | 20 | bool |
21 | 21 | ||
22 | config GENERIC_PCI_IOMAP | ||
23 | bool | ||
24 | |||
25 | config GENERIC_IOMAP | ||
26 | bool | ||
27 | select GENERIC_PCI_IOMAP | ||
28 | |||
22 | config CRC_CCITT | 29 | config CRC_CCITT |
23 | tristate "CRC-CCITT functions" | 30 | tristate "CRC-CCITT functions" |
24 | help | 31 | help |
diff --git a/lib/Makefile b/lib/Makefile index c0ffaaff6534..884ed376164d 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -33,6 +33,7 @@ endif | |||
33 | 33 | ||
34 | lib-$(CONFIG_HOTPLUG) += kobject_uevent.o | 34 | lib-$(CONFIG_HOTPLUG) += kobject_uevent.o |
35 | obj-$(CONFIG_GENERIC_IOMAP) += iomap.o | 35 | obj-$(CONFIG_GENERIC_IOMAP) += iomap.o |
36 | obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o | ||
36 | obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o | 37 | obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o |
37 | obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o | 38 | obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o |
38 | obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o | 39 | obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o |
diff --git a/lib/iomap.c b/lib/iomap.c index 5dbcb4b2d864..ada922a808e6 100644 --- a/lib/iomap.c +++ b/lib/iomap.c | |||
@@ -242,45 +242,11 @@ EXPORT_SYMBOL(ioport_unmap); | |||
242 | #endif /* CONFIG_HAS_IOPORT */ | 242 | #endif /* CONFIG_HAS_IOPORT */ |
243 | 243 | ||
244 | #ifdef CONFIG_PCI | 244 | #ifdef CONFIG_PCI |
245 | /** | 245 | /* Hide the details if this is a MMIO or PIO address space and just do what |
246 | * pci_iomap - create a virtual mapping cookie for a PCI BAR | 246 | * you expect in the correct way. */ |
247 | * @dev: PCI device that owns the BAR | ||
248 | * @bar: BAR number | ||
249 | * @maxlen: length of the memory to map | ||
250 | * | ||
251 | * Using this function you will get a __iomem address to your device BAR. | ||
252 | * You can access it using ioread*() and iowrite*(). These functions hide | ||
253 | * the details if this is a MMIO or PIO address space and will just do what | ||
254 | * you expect from them in the correct way. | ||
255 | * | ||
256 | * @maxlen specifies the maximum length to map. If you want to get access to | ||
257 | * the complete BAR without checking for its length first, pass %0 here. | ||
258 | * */ | ||
259 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ||
260 | { | ||
261 | resource_size_t start = pci_resource_start(dev, bar); | ||
262 | resource_size_t len = pci_resource_len(dev, bar); | ||
263 | unsigned long flags = pci_resource_flags(dev, bar); | ||
264 | |||
265 | if (!len || !start) | ||
266 | return NULL; | ||
267 | if (maxlen && len > maxlen) | ||
268 | len = maxlen; | ||
269 | if (flags & IORESOURCE_IO) | ||
270 | return ioport_map(start, len); | ||
271 | if (flags & IORESOURCE_MEM) { | ||
272 | if (flags & IORESOURCE_CACHEABLE) | ||
273 | return ioremap(start, len); | ||
274 | return ioremap_nocache(start, len); | ||
275 | } | ||
276 | /* What? */ | ||
277 | return NULL; | ||
278 | } | ||
279 | |||
280 | void pci_iounmap(struct pci_dev *dev, void __iomem * addr) | 247 | void pci_iounmap(struct pci_dev *dev, void __iomem * addr) |
281 | { | 248 | { |
282 | IO_COND(addr, /* nothing */, iounmap(addr)); | 249 | IO_COND(addr, /* nothing */, iounmap(addr)); |
283 | } | 250 | } |
284 | EXPORT_SYMBOL(pci_iomap); | ||
285 | EXPORT_SYMBOL(pci_iounmap); | 251 | EXPORT_SYMBOL(pci_iounmap); |
286 | #endif /* CONFIG_PCI */ | 252 | #endif /* CONFIG_PCI */ |
diff --git a/lib/pci_iomap.c b/lib/pci_iomap.c new file mode 100644 index 000000000000..4b0fdc22e688 --- /dev/null +++ b/lib/pci_iomap.c | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * Implement the default iomap interfaces | ||
3 | * | ||
4 | * (C) Copyright 2004 Linus Torvalds | ||
5 | */ | ||
6 | #include <linux/pci.h> | ||
7 | #include <linux/io.h> | ||
8 | |||
9 | #include <linux/export.h> | ||
10 | |||
11 | #ifdef CONFIG_PCI | ||
12 | /** | ||
13 | * pci_iomap - create a virtual mapping cookie for a PCI BAR | ||
14 | * @dev: PCI device that owns the BAR | ||
15 | * @bar: BAR number | ||
16 | * @maxlen: length of the memory to map | ||
17 | * | ||
18 | * Using this function you will get a __iomem address to your device BAR. | ||
19 | * You can access it using ioread*() and iowrite*(). These functions hide | ||
20 | * the details if this is a MMIO or PIO address space and will just do what | ||
21 | * you expect from them in the correct way. | ||
22 | * | ||
23 | * @maxlen specifies the maximum length to map. If you want to get access to | ||
24 | * the complete BAR without checking for its length first, pass %0 here. | ||
25 | * */ | ||
26 | void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | ||
27 | { | ||
28 | resource_size_t start = pci_resource_start(dev, bar); | ||
29 | resource_size_t len = pci_resource_len(dev, bar); | ||
30 | unsigned long flags = pci_resource_flags(dev, bar); | ||
31 | |||
32 | if (!len || !start) | ||
33 | return NULL; | ||
34 | if (maxlen && len > maxlen) | ||
35 | len = maxlen; | ||
36 | if (flags & IORESOURCE_IO) | ||
37 | return ioport_map(start, len); | ||
38 | if (flags & IORESOURCE_MEM) { | ||
39 | if (flags & IORESOURCE_CACHEABLE) | ||
40 | return ioremap(start, len); | ||
41 | return ioremap_nocache(start, len); | ||
42 | } | ||
43 | /* What? */ | ||
44 | return NULL; | ||
45 | } | ||
46 | |||
47 | EXPORT_SYMBOL(pci_iomap); | ||
48 | #endif /* CONFIG_PCI */ | ||