Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b923650b authored by Michael S. Tsirkin's avatar Michael S. Tsirkin
Browse files

lib: add NO_GENERIC_PCI_IOPORT_MAP



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: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 0a962657
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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)
{
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@ config RATIONAL
config GENERIC_FIND_FIRST_BIT
	bool

config NO_GENERIC_PCI_IOPORT_MAP
	bool

config GENERIC_PCI_IOMAP
	bool

+1 −1
Original line number Diff line number Diff line
@@ -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);