Skip to content

Commit

Permalink
lib: add NO_GENERIC_PCI_IOPORT_MAP
Browse files Browse the repository at this point in the history
Some architectures need to override the way
IO port mapping is done on PCI devices.
Supply a generic macro that calls
ioport_map, and make it possible for architectures
to override.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
mstsirkin committed Jan 31, 2012
1 parent 0a96265 commit b923650
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions include/asm-generic/pci_iomap.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ struct pci_dev;
#ifdef CONFIG_PCI
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
/* Create a virtual mapping cookie for a port on a given PCI device.
* Do not call this directly, it exists to make it easier for architectures
* to override */
#ifdef CONFIG_NO_GENERIC_PCI_IOPORT_MAP
extern void __iomem *__pci_ioport_map(struct pci_dev *dev, unsigned long port,
unsigned int nr);
#else
#define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr))
#endif

#else
static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
{
Expand Down
3 changes: 3 additions & 0 deletions lib/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ config RATIONAL
config GENERIC_FIND_FIRST_BIT
bool

config NO_GENERIC_PCI_IOPORT_MAP
bool

config GENERIC_PCI_IOMAP
bool

Expand Down
2 changes: 1 addition & 1 deletion lib/pci_iomap.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
if (maxlen && len > maxlen)
len = maxlen;
if (flags & IORESOURCE_IO)
return ioport_map(start, len);
return __pci_ioport_map(dev, start, len);
if (flags & IORESOURCE_MEM) {
if (flags & IORESOURCE_CACHEABLE)
return ioremap(start, len);
Expand Down

0 comments on commit b923650

Please sign in to comment.