diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-02-07 17:32:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-02-07 17:32:24 -0500 |
commit | 95025d6b27721ae8bbce592403fdc06e982204c8 (patch) | |
tree | 04cdc095c1d1b41406ebaf6c5d3639f4d27b3f38 | |
parent | 59c1204d464075fcb5d02e7daa6b23782dd4a088 (diff) | |
parent | 1e05b62ae4bd4c1209229de367b0989b39644f88 (diff) |
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
arch: fix ioport mapping on mips,sh
Kevin Cernekee reported that recent cleanup that replaced pci_iomap with
a generic function failed to take into account the differences in io
port handling on mips and sh architectures.
Rather than revert the changes reintroducing the code duplication, this
patchset fixes this by adding ability for architectures to override
ioport mapping for pci devices.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
sh: use the the PCI channels's io_map_base
mips: use the the PCI controller's io_map_base
lib: add NO_GENERIC_PCI_IOPORT_MAP
-rw-r--r-- | arch/mips/Kconfig | 1 | ||||
-rw-r--r-- | arch/mips/lib/iomap-pci.c | 4 | ||||
-rw-r--r-- | arch/sh/Kconfig | 1 | ||||
-rw-r--r-- | arch/sh/drivers/pci/pci.c | 4 | ||||
-rw-r--r-- | include/asm-generic/pci_iomap.h | 10 | ||||
-rw-r--r-- | lib/Kconfig | 3 | ||||
-rw-r--r-- | lib/pci_iomap.c | 2 |
7 files changed, 20 insertions, 5 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index c4c1312473fb..5ab6e89603c5 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -2356,6 +2356,7 @@ config PCI | |||
2356 | depends on HW_HAS_PCI | 2356 | depends on HW_HAS_PCI |
2357 | select PCI_DOMAINS | 2357 | select PCI_DOMAINS |
2358 | select GENERIC_PCI_IOMAP | 2358 | select GENERIC_PCI_IOMAP |
2359 | select NO_GENERIC_PCI_IOPORT_MAP | ||
2359 | help | 2360 | help |
2360 | Find out whether you have a PCI motherboard. PCI is the name of a | 2361 | Find out whether you have a PCI motherboard. PCI is the name of a |
2361 | bus system, i.e. the way the CPU talks to the other stuff inside | 2362 | 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 2635b1a96333..fd35daa45314 100644 --- a/arch/mips/lib/iomap-pci.c +++ b/arch/mips/lib/iomap-pci.c | |||
@@ -10,8 +10,8 @@ | |||
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <asm/io.h> | 11 | #include <asm/io.h> |
12 | 12 | ||
13 | static void __iomem *ioport_map_pci(struct pci_dev *dev, | 13 | void __iomem *__pci_ioport_map(struct pci_dev *dev, |
14 | unsigned long port, unsigned int nr) | 14 | unsigned long port, unsigned int nr) |
15 | { | 15 | { |
16 | struct pci_controller *ctrl = dev->bus->sysdata; | 16 | struct pci_controller *ctrl = dev->bus->sysdata; |
17 | unsigned long base = ctrl->io_map_base; | 17 | unsigned long base = ctrl->io_map_base; |
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 3c8db65c89e5..713fb58ca507 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -859,6 +859,7 @@ config PCI | |||
859 | depends on SYS_SUPPORTS_PCI | 859 | depends on SYS_SUPPORTS_PCI |
860 | select PCI_DOMAINS | 860 | select PCI_DOMAINS |
861 | select GENERIC_PCI_IOMAP | 861 | select GENERIC_PCI_IOMAP |
862 | select NO_GENERIC_PCI_IOPORT_MAP | ||
862 | help | 863 | help |
863 | Find out whether you have a PCI motherboard. PCI is the name of a | 864 | Find out whether you have a PCI motherboard. PCI is the name of a |
864 | bus system, i.e. the way the CPU talks to the other stuff inside | 865 | 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 8f18dd090a66..1e7b0e2e764d 100644 --- a/arch/sh/drivers/pci/pci.c +++ b/arch/sh/drivers/pci/pci.c | |||
@@ -356,8 +356,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, | |||
356 | 356 | ||
357 | #ifndef CONFIG_GENERIC_IOMAP | 357 | #ifndef CONFIG_GENERIC_IOMAP |
358 | 358 | ||
359 | static void __iomem *ioport_map_pci(struct pci_dev *dev, | 359 | void __iomem *__pci_ioport_map(struct pci_dev *dev, |
360 | unsigned long port, unsigned int nr) | 360 | unsigned long port, unsigned int nr) |
361 | { | 361 | { |
362 | struct pci_channel *chan = dev->sysdata; | 362 | struct pci_channel *chan = dev->sysdata; |
363 | 363 | ||
diff --git a/include/asm-generic/pci_iomap.h b/include/asm-generic/pci_iomap.h index 8de4b73e19e2..e58fcf891370 100644 --- a/include/asm-generic/pci_iomap.h +++ b/include/asm-generic/pci_iomap.h | |||
@@ -15,6 +15,16 @@ struct pci_dev; | |||
15 | #ifdef CONFIG_PCI | 15 | #ifdef CONFIG_PCI |
16 | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ | 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); | 17 | extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max); |
18 | /* Create a virtual mapping cookie for a port on a given PCI device. | ||
19 | * Do not call this directly, it exists to make it easier for architectures | ||
20 | * to override */ | ||
21 | #ifdef CONFIG_NO_GENERIC_PCI_IOPORT_MAP | ||
22 | extern void __iomem *__pci_ioport_map(struct pci_dev *dev, unsigned long port, | ||
23 | unsigned int nr); | ||
24 | #else | ||
25 | #define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr)) | ||
26 | #endif | ||
27 | |||
18 | #else | 28 | #else |
19 | static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) | 29 | static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max) |
20 | { | 30 | { |
diff --git a/lib/Kconfig b/lib/Kconfig index d69d321a0997..028aba9e72af 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
@@ -19,6 +19,9 @@ config RATIONAL | |||
19 | config GENERIC_FIND_FIRST_BIT | 19 | config GENERIC_FIND_FIRST_BIT |
20 | bool | 20 | bool |
21 | 21 | ||
22 | config NO_GENERIC_PCI_IOPORT_MAP | ||
23 | bool | ||
24 | |||
22 | config GENERIC_PCI_IOMAP | 25 | config GENERIC_PCI_IOMAP |
23 | bool | 26 | bool |
24 | 27 | ||
diff --git a/lib/pci_iomap.c b/lib/pci_iomap.c index 4b0fdc22e688..0d83ea8a9605 100644 --- a/lib/pci_iomap.c +++ b/lib/pci_iomap.c | |||
@@ -34,7 +34,7 @@ void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | |||
34 | if (maxlen && len > maxlen) | 34 | if (maxlen && len > maxlen) |
35 | len = maxlen; | 35 | len = maxlen; |
36 | if (flags & IORESOURCE_IO) | 36 | if (flags & IORESOURCE_IO) |
37 | return ioport_map(start, len); | 37 | return __pci_ioport_map(dev, start, len); |
38 | if (flags & IORESOURCE_MEM) { | 38 | if (flags & IORESOURCE_MEM) { |
39 | if (flags & IORESOURCE_CACHEABLE) | 39 | if (flags & IORESOURCE_CACHEABLE) |
40 | return ioremap(start, len); | 40 | return ioremap(start, len); |