提交 e343a895 编写于 作者: L Linus Torvalds

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

lib: use generic pci_iomap on all architectures

Many architectures don't want to pull in iomap.c,
so they ended up duplicating pci_iomap from that file.
That function isn't trivial, and we are going to modify it
https://lkml.org/lkml/2011/11/14/183
so the duplication hurts.

This reduces the scope of the problem significantly,
by moving pci_iomap to a separate file and
referencing that from all architectures.

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  alpha: drop pci_iomap/pci_iounmap from pci-noop.c
  mn10300: switch to GENERIC_PCI_IOMAP
  mn10300: add missing __iomap markers
  frv: switch to GENERIC_PCI_IOMAP
  tile: switch to GENERIC_PCI_IOMAP
  tile: don't panic on iomap
  sparc: switch to GENERIC_PCI_IOMAP
  sh: switch to GENERIC_PCI_IOMAP
  powerpc: switch to GENERIC_PCI_IOMAP
  parisc: switch to GENERIC_PCI_IOMAP
  mips: switch to GENERIC_PCI_IOMAP
  microblaze: switch to GENERIC_PCI_IOMAP
  arm: switch to GENERIC_PCI_IOMAP
  alpha: switch to GENERIC_PCI_IOMAP
  lib: add GENERIC_PCI_IOMAP
  lib: move GENERIC_IOMAP to lib/Kconfig

Fix up trivial conflicts due to changes nearby in arch/{m68k,score}/Kconfig
...@@ -70,10 +70,6 @@ config GENERIC_ISA_DMA ...@@ -70,10 +70,6 @@ config GENERIC_ISA_DMA
bool bool
default y default y
config GENERIC_IOMAP
bool
default n
source "init/Kconfig" source "init/Kconfig"
source "kernel/Kconfig.freezer" source "kernel/Kconfig.freezer"
...@@ -319,6 +315,7 @@ config ISA_DMA_API ...@@ -319,6 +315,7 @@ config ISA_DMA_API
config PCI config PCI
bool bool
depends on !ALPHA_JENSEN depends on !ALPHA_JENSEN
select GENERIC_PCI_IOMAP
default y default y
help help
Find out whether you have a PCI motherboard. PCI is the name of a Find out whether you have a PCI motherboard. PCI is the name of a
......
...@@ -185,15 +185,3 @@ struct dma_map_ops alpha_noop_ops = { ...@@ -185,15 +185,3 @@ struct dma_map_ops alpha_noop_ops = {
struct dma_map_ops *dma_ops = &alpha_noop_ops; struct dma_map_ops *dma_ops = &alpha_noop_ops;
EXPORT_SYMBOL(dma_ops); EXPORT_SYMBOL(dma_ops);
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
return NULL;
}
void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
{
}
EXPORT_SYMBOL(pci_iomap);
EXPORT_SYMBOL(pci_iounmap);
...@@ -508,30 +508,7 @@ sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn) ...@@ -508,30 +508,7 @@ sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
/* Create an __iomem token from a PCI BAR. Copied from lib/iomap.c with /* Destroy an __iomem token. Not copied from lib/iomap.c. */
no changes, since we don't want the other things in that object file. */
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start)
return NULL;
if (maxlen && len > maxlen)
len = maxlen;
if (flags & IORESOURCE_IO)
return ioport_map(start, len);
if (flags & IORESOURCE_MEM) {
/* Not checking IORESOURCE_CACHEABLE because alpha does
not distinguish between ioremap and ioremap_nocache. */
return ioremap(start, len);
}
return NULL;
}
/* Destroy that token. Not copied from lib/iomap.c. */
void pci_iounmap(struct pci_dev *dev, void __iomem * addr) void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
{ {
...@@ -539,7 +516,6 @@ void pci_iounmap(struct pci_dev *dev, void __iomem * addr) ...@@ -539,7 +516,6 @@ void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
iounmap(addr); iounmap(addr);
} }
EXPORT_SYMBOL(pci_iomap);
EXPORT_SYMBOL(pci_iounmap); EXPORT_SYMBOL(pci_iounmap);
/* FIXME: Some boxes have multiple ISA bridges! */ /* FIXME: Some boxes have multiple ISA bridges! */
......
...@@ -31,6 +31,7 @@ config ARM ...@@ -31,6 +31,7 @@ config ARM
select HAVE_SPARSE_IRQ select HAVE_SPARSE_IRQ
select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW
select CPU_PM if (SUSPEND || CPU_IDLE) select CPU_PM if (SUSPEND || CPU_IDLE)
select GENERIC_PCI_IOMAP
help help
The ARM series is a line of low-power-consumption RISC chip designs The ARM series is a line of low-power-consumption RISC chip designs
licensed by ARM Ltd and targeted at embedded applications and licensed by ARM Ltd and targeted at embedded applications and
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/memory.h> #include <asm/memory.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm-generic/pci_iomap.h>
/* /*
* ISA I/O bus memory addresses are 1:1 with the physical address. * 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,7 +307,6 @@ extern void ioport_unmap(void __iomem *addr);
struct pci_dev; struct pci_dev;
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen);
extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr); extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
/* /*
......
...@@ -35,27 +35,6 @@ EXPORT_SYMBOL(pcibios_min_mem); ...@@ -35,27 +35,6 @@ EXPORT_SYMBOL(pcibios_min_mem);
unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC; unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC;
EXPORT_SYMBOL(pci_flags); EXPORT_SYMBOL(pci_flags);
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start)
return NULL;
if (maxlen && len > maxlen)
len = maxlen;
if (flags & IORESOURCE_IO)
return ioport_map(start, len);
if (flags & IORESOURCE_MEM) {
if (flags & IORESOURCE_CACHEABLE)
return ioremap(start, len);
return ioremap_nocache(start, len);
}
return NULL;
}
EXPORT_SYMBOL(pci_iomap);
void pci_iounmap(struct pci_dev *dev, void __iomem *addr) void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
{ {
if ((unsigned long)addr >= VMALLOC_START && if ((unsigned long)addr >= VMALLOC_START &&
......
...@@ -19,10 +19,6 @@ config GENERIC_CMOS_UPDATE ...@@ -19,10 +19,6 @@ config GENERIC_CMOS_UPDATE
config ARCH_USES_GETTIMEOFFSET config ARCH_USES_GETTIMEOFFSET
def_bool n def_bool n
config GENERIC_IOMAP
bool
default y
config ARCH_HAS_ILOG2_U32 config ARCH_HAS_ILOG2_U32
bool bool
default n default n
...@@ -52,6 +48,7 @@ config CRIS ...@@ -52,6 +48,7 @@ config CRIS
select HAVE_IDE select HAVE_IDE
select HAVE_GENERIC_HARDIRQS select HAVE_GENERIC_HARDIRQS
select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW
select GENERIC_IOMAP
config HZ config HZ
int int
......
...@@ -317,6 +317,7 @@ config PCI ...@@ -317,6 +317,7 @@ config PCI
bool "Use PCI" bool "Use PCI"
depends on MB93090_MB00 depends on MB93090_MB00
default y default y
select GENERIC_PCI_IOMAP
help help
Some FR-V systems (such as the MB93090-MB00 VDK) have PCI Some FR-V systems (such as the MB93090-MB00 VDK) have PCI
onboard. If you have one of these boards and you wish to use the PCI onboard. If you have one of these boards and you wish to use the PCI
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <asm/virtconvert.h> #include <asm/virtconvert.h>
#include <asm/string.h> #include <asm/string.h>
#include <asm/mb-regs.h> #include <asm/mb-regs.h>
#include <asm-generic/pci_iomap.h>
#include <linux/delay.h> #include <linux/delay.h>
/* /*
...@@ -370,7 +371,6 @@ static inline void iowrite32_rep(void __iomem *p, const void *src, unsigned long ...@@ -370,7 +371,6 @@ static inline void iowrite32_rep(void __iomem *p, const void *src, unsigned long
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
struct pci_dev; struct pci_dev;
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
{ {
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
ifeq "$(CONFIG_PCI)" "y" ifeq "$(CONFIG_PCI)" "y"
obj-y := pci-frv.o pci-irq.o pci-vdk.o pci-iomap.o obj-y := pci-frv.o pci-irq.o pci-vdk.o
ifeq "$(CONFIG_MMU)" "y" ifeq "$(CONFIG_MMU)" "y"
obj-y += pci-dma.o obj-y += pci-dma.o
......
/* pci-iomap.c: description
*
* Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/pci.h>
#include <linux/module.h>
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start)
return NULL;
if ((flags & IORESOURCE_IO) || (flags & IORESOURCE_MEM))
return (void __iomem *) start;
return NULL;
}
EXPORT_SYMBOL(pci_iomap);
...@@ -26,6 +26,7 @@ config HEXAGON ...@@ -26,6 +26,7 @@ config HEXAGON
select HAVE_ARCH_KGDB select HAVE_ARCH_KGDB
select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRACEHOOK
select NO_IOPORT select NO_IOPORT
select GENERIC_IOMAP
# mostly generic routines, with some accelerated ones # mostly generic routines, with some accelerated ones
---help--- ---help---
Qualcomm Hexagon is a processor architecture designed for high Qualcomm Hexagon is a processor architecture designed for high
...@@ -73,9 +74,6 @@ config GENERIC_CSUM ...@@ -73,9 +74,6 @@ config GENERIC_CSUM
config GENERIC_IRQ_PROBE config GENERIC_IRQ_PROBE
def_bool y def_bool y
config GENERIC_IOMAP
def_bool y
#config ZONE_DMA #config ZONE_DMA
# bool # bool
# default y # default y
......
...@@ -32,6 +32,7 @@ config IA64 ...@@ -32,6 +32,7 @@ config IA64
select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW
select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_OPTIONAL_GPIOLIB
select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_HAVE_NMI_SAFE_CMPXCHG
select GENERIC_IOMAP
default y default y
help help
The Itanium Processor Family is Intel's 64-bit successor to The Itanium Processor Family is Intel's 64-bit successor to
...@@ -105,10 +106,6 @@ config EFI ...@@ -105,10 +106,6 @@ config EFI
bool bool
default y default y
config GENERIC_IOMAP
bool
default y
config ARCH_CLOCKSOURCE_DATA config ARCH_CLOCKSOURCE_DATA
def_bool y def_bool y
......
...@@ -37,9 +37,6 @@ config GENERIC_CALIBRATE_DELAY ...@@ -37,9 +37,6 @@ config GENERIC_CALIBRATE_DELAY
bool bool
default y default y
config GENERIC_IOMAP
def_bool MMU
config GENERIC_CSUM config GENERIC_CSUM
bool bool
...@@ -81,6 +78,7 @@ source "kernel/Kconfig.freezer" ...@@ -81,6 +78,7 @@ source "kernel/Kconfig.freezer"
config MMU config MMU
bool "MMU-based Paged Memory Management Support" bool "MMU-based Paged Memory Management Support"
default y default y
select GENERIC_IOMAP
help help
Select if you want MMU-based virtualised addressing space Select if you want MMU-based virtualised addressing space
support by paged memory management. If unsure, say 'Y'. support by paged memory management. If unsure, say 'Y'.
......
...@@ -17,6 +17,7 @@ config MICROBLAZE ...@@ -17,6 +17,7 @@ config MICROBLAZE
select HAVE_GENERIC_HARDIRQS select HAVE_GENERIC_HARDIRQS
select GENERIC_IRQ_PROBE select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW
select GENERIC_PCI_IOMAP
config SWAP config SWAP
def_bool n def_bool n
......
...@@ -10,25 +10,6 @@ ...@@ -10,25 +10,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/pci-bridge.h> #include <asm/pci-bridge.h>
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t 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 ioremap(start, len);
/* What? */
return NULL;
}
EXPORT_SYMBOL(pci_iomap);
void pci_iounmap(struct pci_dev *dev, void __iomem *addr) void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
{ {
if (isa_vaddr_is_ioport(addr)) if (isa_vaddr_is_ioport(addr))
......
...@@ -2317,6 +2317,7 @@ config PCI ...@@ -2317,6 +2317,7 @@ config PCI
bool "Support for PCI controller" bool "Support for PCI controller"
depends on HW_HAS_PCI depends on HW_HAS_PCI
select PCI_DOMAINS select PCI_DOMAINS
select GENERIC_PCI_IOMAP
help help
Find out whether you have a PCI motherboard. PCI is the name of a Find out whether you have a PCI motherboard. PCI is the name of a
bus system, i.e. the way the CPU talks to the other stuff inside bus system, i.e. the way the CPU talks to the other stuff inside
......
...@@ -40,32 +40,6 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev, ...@@ -40,32 +40,6 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev,
return (void __iomem *) (ctrl->io_map_base + port); return (void __iomem *) (ctrl->io_map_base + port);
} }
/*
* Create a virtual mapping cookie for a PCI BAR (memory or IO)
*/
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start)
return NULL;
if (maxlen && len > maxlen)
len = maxlen;
if (flags & IORESOURCE_IO)
return ioport_map_pci(dev, start, len);
if (flags & IORESOURCE_MEM) {
if (flags & IORESOURCE_CACHEABLE)
return ioremap(start, len);
return ioremap_nocache(start, len);
}
/* What? */
return NULL;
}
EXPORT_SYMBOL(pci_iomap);
void pci_iounmap(struct pci_dev *dev, void __iomem * addr) void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
{ {
iounmap(addr); iounmap(addr);
......
...@@ -252,6 +252,7 @@ config PCI ...@@ -252,6 +252,7 @@ config PCI
bool "Use PCI" bool "Use PCI"
depends on MN10300_UNIT_ASB2305 depends on MN10300_UNIT_ASB2305
default y default y
select GENERIC_PCI_IOMAP
help help
Some systems (such as the ASB2305) have PCI onboard. If you have one Some systems (such as the ASB2305) have PCI onboard. If you have one
of these boards and you wish to use the PCI facilities, say Y here. of these boards and you wish to use the PCI facilities, say Y here.
......
...@@ -229,7 +229,6 @@ static inline void outsl(unsigned long addr, const void *buffer, int count) ...@@ -229,7 +229,6 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
struct pci_dev; struct pci_dev;
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
{ {
} }
...@@ -251,15 +250,15 @@ static inline void *phys_to_virt(unsigned long address) ...@@ -251,15 +250,15 @@ static inline void *phys_to_virt(unsigned long address)
/* /*
* Change "struct page" to physical address. * Change "struct page" to physical address.
*/ */
static inline void *__ioremap(unsigned long offset, unsigned long size, static inline void __iomem *__ioremap(unsigned long offset, unsigned long size,
unsigned long flags) unsigned long flags)
{ {
return (void *) offset; return (void __iomem *) offset;
} }
static inline void *ioremap(unsigned long offset, unsigned long size) static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
{ {
return (void *) offset; return (void __iomem *) offset;
} }
/* /*
...@@ -267,14 +266,14 @@ static inline void *ioremap(unsigned long offset, unsigned long size) ...@@ -267,14 +266,14 @@ static inline void *ioremap(unsigned long offset, unsigned long size)
* area. it's useful if some control registers are in such an area and write * area. it's useful if some control registers are in such an area and write
* combining or read caching is not desirable: * combining or read caching is not desirable:
*/ */
static inline void *ioremap_nocache(unsigned long offset, unsigned long size) static inline void __iomem *ioremap_nocache(unsigned long offset, unsigned long size)
{ {
return (void *) (offset | 0x20000000); return (void __iomem *) (offset | 0x20000000);
} }
#define ioremap_wc ioremap_nocache #define ioremap_wc ioremap_nocache
static inline void iounmap(void *addr) static inline void iounmap(void __iomem *addr)
{ {
} }
......
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
############################################################################### ###############################################################################
obj-y := unit-init.o leds.o obj-y := unit-init.o leds.o
obj-$(CONFIG_PCI) += pci.o pci-asb2305.o pci-irq.o pci-iomap.o obj-$(CONFIG_PCI) += pci.o pci-asb2305.o pci-irq.o
...@@ -38,9 +38,6 @@ config RWSEM_XCHGADD_ALGORITHM ...@@ -38,9 +38,6 @@ config RWSEM_XCHGADD_ALGORITHM
config GENERIC_HWEIGHT config GENERIC_HWEIGHT
def_bool y def_bool y
config GENERIC_IOMAP
def_bool y
config NO_IOPORT config NO_IOPORT
def_bool y def_bool y
......
...@@ -14,6 +14,7 @@ config PARISC ...@@ -14,6 +14,7 @@ config PARISC
select GENERIC_ATOMIC64 if !64BIT select GENERIC_ATOMIC64 if !64BIT
select HAVE_GENERIC_HARDIRQS select HAVE_GENERIC_HARDIRQS
select GENERIC_IRQ_PROBE select GENERIC_IRQ_PROBE
select GENERIC_PCI_IOMAP
select IRQ_PER_CPU select IRQ_PER_CPU
select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_HAVE_NMI_SAFE_CMPXCHG
......
...@@ -436,28 +436,6 @@ void ioport_unmap(void __iomem *addr) ...@@ -436,28 +436,6 @@ void ioport_unmap(void __iomem *addr)
} }
} }
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start)
return NULL;
if (maxlen && len > maxlen)
len = maxlen;
if (flags & IORESOURCE_IO)
return ioport_map(start, len);
if (flags & IORESOURCE_MEM) {
if (flags & IORESOURCE_CACHEABLE)
return ioremap(start, len);
return ioremap_nocache(start, len);
}
/* What? */
return NULL;
}
void pci_iounmap(struct pci_dev *dev, void __iomem * addr) void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
{ {
if (!INDIRECT_ADDR(addr)) { if (!INDIRECT_ADDR(addr)) {
...@@ -483,5 +461,4 @@ EXPORT_SYMBOL(iowrite16_rep); ...@@ -483,5 +461,4 @@ EXPORT_SYMBOL(iowrite16_rep);
EXPORT_SYMBOL(iowrite32_rep); EXPORT_SYMBOL(iowrite32_rep);
EXPORT_SYMBOL(ioport_map); EXPORT_SYMBOL(ioport_map);
EXPORT_SYMBOL(ioport_unmap); EXPORT_SYMBOL(ioport_unmap);
EXPORT_SYMBOL(pci_iomap);
EXPORT_SYMBOL(pci_iounmap); EXPORT_SYMBOL(pci_iounmap);
...@@ -718,6 +718,7 @@ config PCI ...@@ -718,6 +718,7 @@ config PCI
default PCI_PERMEDIA if !4xx && !CPM2 && !8xx default PCI_PERMEDIA if !4xx && !CPM2 && !8xx
default PCI_QSPAN if !4xx && !CPM2 && 8xx default PCI_QSPAN if !4xx && !CPM2 && 8xx
select ARCH_SUPPORTS_MSI select ARCH_SUPPORTS_MSI
select GENERIC_PCI_IOMAP
help help
Find out whether your system includes a PCI bus. PCI is the name of Find out whether your system includes a PCI bus. PCI is the name of
a bus system, i.e. the way the CPU talks to the other stuff inside a bus system, i.e. the way the CPU talks to the other stuff inside
......
...@@ -119,24 +119,6 @@ EXPORT_SYMBOL(ioport_map); ...@@ -119,24 +119,6 @@ EXPORT_SYMBOL(ioport_map);
EXPORT_SYMBOL(ioport_unmap); EXPORT_SYMBOL(ioport_unmap);
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t 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 ioremap(start, len);
/* What? */
return NULL;
}
void pci_iounmap(struct pci_dev *dev, void __iomem *addr) void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
{ {
if (isa_vaddr_is_ioport(addr)) if (isa_vaddr_is_ioport(addr))
...@@ -146,6 +128,5 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *addr) ...@@ -146,6 +128,5 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
iounmap(addr); iounmap(addr);
} }
EXPORT_SYMBOL(pci_iomap);
EXPORT_SYMBOL(pci_iounmap); EXPORT_SYMBOL(pci_iounmap);
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
...@@ -175,9 +175,6 @@ config PPC_INDIRECT_MMIO ...@@ -175,9 +175,6 @@ config PPC_INDIRECT_MMIO
config PPC_IO_WORKAROUNDS config PPC_IO_WORKAROUNDS
bool bool
config GENERIC_IOMAP
bool
source "drivers/cpufreq/Kconfig" source "drivers/cpufreq/Kconfig"
menu "CPU Frequency drivers" menu "CPU Frequency drivers"
......
...@@ -4,6 +4,7 @@ config SCORE ...@@ -4,6 +4,7 @@ config SCORE
def_bool y def_bool y
select HAVE_GENERIC_HARDIRQS select HAVE_GENERIC_HARDIRQS
select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW
select GENERIC_IOMAP
select HAVE_MEMBLOCK select HAVE_MEMBLOCK
select HAVE_MEMBLOCK_NODE_MAP select HAVE_MEMBLOCK_NODE_MAP
select ARCH_DISCARD_MEMBLOCK select ARCH_DISCARD_MEMBLOCK
...@@ -36,9 +37,6 @@ endmenu ...@@ -36,9 +37,6 @@ endmenu
config CPU_SCORE7 config CPU_SCORE7
bool bool
config GENERIC_IOMAP
def_bool y
config NO_DMA config NO_DMA
bool bool
default y default y
......
...@@ -85,9 +85,6 @@ config GENERIC_GPIO ...@@ -85,9 +85,6 @@ config GENERIC_GPIO
config GENERIC_CALIBRATE_DELAY config GENERIC_CALIBRATE_DELAY
bool bool
config GENERIC_IOMAP
bool
config GENERIC_CLOCKEVENTS config GENERIC_CLOCKEVENTS
def_bool y def_bool y
...@@ -861,6 +858,7 @@ config PCI ...@@ -861,6 +858,7 @@ config PCI
bool "PCI support" bool "PCI support"
depends on SYS_SUPPORTS_PCI depends on SYS_SUPPORTS_PCI
select PCI_DOMAINS select PCI_DOMAINS
select GENERIC_PCI_IOMAP
help help
Find out whether you have a PCI motherboard. PCI is the name of a Find out whether you have a PCI motherboard. PCI is the name of a
bus system, i.e. the way the CPU talks to the other stuff inside bus system, i.e. the way the CPU talks to the other stuff inside
......
...@@ -393,29 +393,6 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev, ...@@ -393,29 +393,6 @@ static void __iomem *ioport_map_pci(struct pci_dev *dev,
return (void __iomem *)(chan->io_map_base + port); return (void __iomem *)(chan->io_map_base + port);
} }
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);
if (unlikely(!len || !start))
return NULL;
if (maxlen && len > maxlen)
len = maxlen;
if (flags & IORESOURCE_IO)
return ioport_map_pci(dev, start, len);
if (flags & IORESOURCE_MEM) {
if (flags & IORESOURCE_CACHEABLE)
return ioremap(start, len);
return ioremap_nocache(start, len);
}
return NULL;
}
EXPORT_SYMBOL(pci_iomap);
void pci_iounmap(struct pci_dev *dev, void __iomem *addr) void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
{ {
iounmap(addr); iounmap(addr);
......
...@@ -28,6 +28,7 @@ config SPARC ...@@ -28,6 +28,7 @@ config SPARC
select HAVE_GENERIC_HARDIRQS select HAVE_GENERIC_HARDIRQS
select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW
select USE_GENERIC_SMP_HELPERS if SMP select USE_GENERIC_SMP_HELPERS if SMP
select GENERIC_PCI_IOMAP
config SPARC32 config SPARC32
def_bool !64BIT def_bool !64BIT
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <asm/page.h> /* IO address mapping routines need this */ #include <asm/page.h> /* IO address mapping routines need this */
#include <asm/system.h> #include <asm/system.h>
#include <asm-generic/pci_iomap.h>
#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
...@@ -324,7 +325,6 @@ extern void ioport_unmap(void __iomem *); ...@@ -324,7 +325,6 @@ extern void ioport_unmap(void __iomem *);
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
struct pci_dev; struct pci_dev;
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
extern void pci_iounmap(struct pci_dev *dev, void __iomem *); extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
/* /*
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <asm/page.h> /* IO address mapping routines need this */ #include <asm/page.h> /* IO address mapping routines need this */
#include <asm/system.h> #include <asm/system.h>
#include <asm/asi.h> #include <asm/asi.h>
#include <asm-generic/pci_iomap.h>
/* PC crapola... */ /* PC crapola... */
#define __SLOW_DOWN_IO do { } while (0) #define __SLOW_DOWN_IO do { } while (0)
...@@ -514,7 +515,6 @@ extern void ioport_unmap(void __iomem *); ...@@ -514,7 +515,6 @@ extern void ioport_unmap(void __iomem *);
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
struct pci_dev; struct pci_dev;
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
extern void pci_iounmap(struct pci_dev *dev, void __iomem *); extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
static inline int sbus_can_dma_64bit(void) static inline int sbus_can_dma_64bit(void)
......
...@@ -18,31 +18,8 @@ void ioport_unmap(void __iomem *addr) ...@@ -18,31 +18,8 @@ void ioport_unmap(void __iomem *addr)
EXPORT_SYMBOL(ioport_map); EXPORT_SYMBOL(ioport_map);
EXPORT_SYMBOL(ioport_unmap); EXPORT_SYMBOL(ioport_unmap);
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start)
return NULL;
if (maxlen && len > maxlen)
len = maxlen;
if (flags & IORESOURCE_IO)
return ioport_map(start, len);
if (flags & IORESOURCE_MEM) {
if (flags & IORESOURCE_CACHEABLE)
return ioremap(start, len);
return ioremap_nocache(start, len);
}
/* What? */
return NULL;
}
void pci_iounmap(struct pci_dev *dev, void __iomem * addr) void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
{ {
/* nothing to do */ /* nothing to do */
} }
EXPORT_SYMBOL(pci_iomap);
EXPORT_SYMBOL(pci_iounmap); EXPORT_SYMBOL(pci_iounmap);
...@@ -321,6 +321,7 @@ config PCI ...@@ -321,6 +321,7 @@ config PCI
bool "PCI support" bool "PCI support"
default y default y
select PCI_DOMAINS select PCI_DOMAINS
select GENERIC_PCI_IOMAP
---help--- ---help---
Enable PCI root complex support, so PCIe endpoint devices can Enable PCI root complex support, so PCIe endpoint devices can
be attached to the Tile chip. Many, but not all, PCI devices be attached to the Tile chip. Many, but not all, PCI devices
......
...@@ -204,7 +204,8 @@ static inline long ioport_panic(void) ...@@ -204,7 +204,8 @@ static inline long ioport_panic(void)
static inline void __iomem *ioport_map(unsigned long port, unsigned int len) static inline void __iomem *ioport_map(unsigned long port, unsigned int len)
{ {
return (void __iomem *) ioport_panic(); pr_info("ioport_map: mapping IO resources is unsupported on tile.\n");
return NULL;
} }
static inline void ioport_unmap(void __iomem *addr) static inline void ioport_unmap(void __iomem *addr)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#define _ASM_TILE_PCI_H #define _ASM_TILE_PCI_H
#include <linux/pci.h> #include <linux/pci.h>
#include <asm-generic/pci_iomap.h>
/* /*
* Structure of a PCI controller (host bridge) * Structure of a PCI controller (host bridge)
...@@ -49,7 +50,6 @@ struct pci_controller { ...@@ -49,7 +50,6 @@ struct pci_controller {
int __devinit tile_pci_init(void); int __devinit tile_pci_init(void);
int __devinit pcibios_init(void); int __devinit pcibios_init(void);
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {} static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) {}
void __devinit pcibios_fixup_bus(struct pci_bus *bus); void __devinit pcibios_fixup_bus(struct pci_bus *bus);
......
...@@ -466,27 +466,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask) ...@@ -466,27 +466,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
return 0; return 0;
} }
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_MEM)) {
pr_info("PCI: Trying to map invalid resource %#lx\n", flags);
start = 0;
}
return (void __iomem *)start;
}
EXPORT_SYMBOL(pci_iomap);
/**************************************************************** /****************************************************************
* *
* Tile PCI config space read/write routines * Tile PCI config space read/write routines
......
...@@ -12,6 +12,7 @@ config UNICORE32 ...@@ -12,6 +12,7 @@ config UNICORE32
select GENERIC_IRQ_PROBE select GENERIC_IRQ_PROBE
select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW
select ARCH_WANT_FRAME_POINTERS select ARCH_WANT_FRAME_POINTERS
select GENERIC_IOMAP
help help
UniCore-32 is 32-bit Instruction Set Architecture, UniCore-32 is 32-bit Instruction Set Architecture,
including a series of low-power-consumption RISC chip including a series of low-power-consumption RISC chip
...@@ -30,9 +31,6 @@ config GENERIC_CLOCKEVENTS ...@@ -30,9 +31,6 @@ config GENERIC_CLOCKEVENTS
config GENERIC_CSUM config GENERIC_CSUM
def_bool y def_bool y
config GENERIC_IOMAP
def_bool y
config NO_IOPORT config NO_IOPORT
bool bool
......
...@@ -78,6 +78,7 @@ config X86 ...@@ -78,6 +78,7 @@ config X86
select HAVE_BPF_JIT if (X86_64 && NET) select HAVE_BPF_JIT if (X86_64 && NET)
select CLKEVT_I8253 select CLKEVT_I8253
select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_HAVE_NMI_SAFE_CMPXCHG
select GENERIC_IOMAP
config INSTRUCTION_DECODER config INSTRUCTION_DECODER
def_bool (KPROBES || PERF_EVENTS) def_bool (KPROBES || PERF_EVENTS)
...@@ -143,9 +144,6 @@ config NEED_SG_DMA_LENGTH ...@@ -143,9 +144,6 @@ config NEED_SG_DMA_LENGTH
config GENERIC_ISA_DMA config GENERIC_ISA_DMA
def_bool ISA_DMA_API def_bool ISA_DMA_API
config GENERIC_IOMAP
def_bool y
config GENERIC_BUG config GENERIC_BUG
def_bool y def_bool y
depends on BUG depends on BUG
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <asm-generic/iomap.h> #include <asm-generic/iomap.h>
#endif #endif
#include <asm-generic/pci_iomap.h>
#ifndef mmiowb #ifndef mmiowb
#define mmiowb() do {} while (0) #define mmiowb() do {} while (0)
#endif #endif
...@@ -283,9 +285,7 @@ static inline void writesb(const void __iomem *addr, const void *buf, int len) ...@@ -283,9 +285,7 @@ static inline void writesb(const void __iomem *addr, const void *buf, int len)
#define __io_virt(x) ((void __force *) (x)) #define __io_virt(x) ((void __force *) (x))
#ifndef CONFIG_GENERIC_IOMAP #ifndef CONFIG_GENERIC_IOMAP
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
struct pci_dev; struct pci_dev;
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
{ {
} }
......
...@@ -67,18 +67,15 @@ extern void ioport_unmap(void __iomem *); ...@@ -67,18 +67,15 @@ extern void ioport_unmap(void __iomem *);
#endif #endif
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ /* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */
struct pci_dev; struct pci_dev;
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
extern void pci_iounmap(struct pci_dev *dev, void __iomem *); extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
#else #else
struct pci_dev; struct pci_dev;
static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
{
return NULL;
}
static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
{ } { }
#endif #endif
#include <asm-generic/pci_iomap.h>
#endif #endif
/* ASB2305 PCI I/O mapping handler /* Generic I/O port emulation, based on MN10300 code
* *
* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com) * Written by David Howells (dhowells@redhat.com)
...@@ -8,24 +8,18 @@ ...@@ -8,24 +8,18 @@
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
* 2 of the Licence, or (at your option) any later version. * 2 of the Licence, or (at your option) any later version.
*/ */
#include <linux/pci.h> #ifndef __ASM_GENERIC_PCI_IOMAP_H
#include <linux/module.h> #define __ASM_GENERIC_PCI_IOMAP_H
/* struct pci_dev;
* Create a virtual mapping cookie for a PCI BAR (memory or IO) #ifdef CONFIG_PCI
*/ /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
#else
static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
{ {
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start)
return NULL;
if ((flags & IORESOURCE_IO) || (flags & IORESOURCE_MEM))
return (void __iomem *) start;
return NULL; return NULL;
} }
EXPORT_SYMBOL(pci_iomap); #endif
#endif /* __ASM_GENERIC_IO_H */
...@@ -19,6 +19,13 @@ config RATIONAL ...@@ -19,6 +19,13 @@ config RATIONAL
config GENERIC_FIND_FIRST_BIT config GENERIC_FIND_FIRST_BIT
bool bool
config GENERIC_PCI_IOMAP
bool
config GENERIC_IOMAP
bool
select GENERIC_PCI_IOMAP
config CRC_CCITT config CRC_CCITT
tristate "CRC-CCITT functions" tristate "CRC-CCITT functions"
help help
......
...@@ -33,6 +33,7 @@ endif ...@@ -33,6 +33,7 @@ endif
lib-$(CONFIG_HOTPLUG) += kobject_uevent.o lib-$(CONFIG_HOTPLUG) += kobject_uevent.o
obj-$(CONFIG_GENERIC_IOMAP) += iomap.o obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o
obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o
obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o
obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o
......
...@@ -242,45 +242,11 @@ EXPORT_SYMBOL(ioport_unmap); ...@@ -242,45 +242,11 @@ EXPORT_SYMBOL(ioport_unmap);
#endif /* CONFIG_HAS_IOPORT */ #endif /* CONFIG_HAS_IOPORT */
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
/** /* Hide the details if this is a MMIO or PIO address space and just do what
* pci_iomap - create a virtual mapping cookie for a PCI BAR * you expect in the correct way. */
* @dev: PCI device that owns the BAR
* @bar: BAR number
* @maxlen: length of the memory to map
*
* Using this function you will get a __iomem address to your device BAR.
* You can access it using ioread*() and iowrite*(). These functions hide
* the details if this is a MMIO or PIO address space and will just do what
* you expect from them in the correct way.
*
* @maxlen specifies the maximum length to map. If you want to get access to
* the complete BAR without checking for its length first, pass %0 here.
* */
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start)
return NULL;
if (maxlen && len > maxlen)
len = maxlen;
if (flags & IORESOURCE_IO)
return ioport_map(start, len);
if (flags & IORESOURCE_MEM) {
if (flags & IORESOURCE_CACHEABLE)
return ioremap(start, len);
return ioremap_nocache(start, len);
}
/* What? */
return NULL;
}
void pci_iounmap(struct pci_dev *dev, void __iomem * addr) void pci_iounmap(struct pci_dev *dev, void __iomem * addr)
{ {
IO_COND(addr, /* nothing */, iounmap(addr)); IO_COND(addr, /* nothing */, iounmap(addr));
} }
EXPORT_SYMBOL(pci_iomap);
EXPORT_SYMBOL(pci_iounmap); EXPORT_SYMBOL(pci_iounmap);
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
/*
* Implement the default iomap interfaces
*
* (C) Copyright 2004 Linus Torvalds
*/
#include <linux/pci.h>
#include <linux/io.h>
#include <linux/export.h>
#ifdef CONFIG_PCI
/**
* pci_iomap - create a virtual mapping cookie for a PCI BAR
* @dev: PCI device that owns the BAR
* @bar: BAR number
* @maxlen: length of the memory to map
*
* Using this function you will get a __iomem address to your device BAR.
* You can access it using ioread*() and iowrite*(). These functions hide
* the details if this is a MMIO or PIO address space and will just do what
* you expect from them in the correct way.
*
* @maxlen specifies the maximum length to map. If you want to get access to
* the complete BAR without checking for its length first, pass %0 here.
* */
void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
{
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start)
return NULL;
if (maxlen && len > maxlen)
len = maxlen;
if (flags & IORESOURCE_IO)
return ioport_map(start, len);
if (flags & IORESOURCE_MEM) {
if (flags & IORESOURCE_CACHEABLE)
return ioremap(start, len);
return ioremap_nocache(start, len);
}
/* What? */
return NULL;
}
EXPORT_SYMBOL(pci_iomap);
#endif /* CONFIG_PCI */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册