pci_iomap.h 1.9 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0+ */
D
David Howells 已提交
2
/* Generic I/O port emulation.
M
Michael S. Tsirkin 已提交
3 4 5 6 7 8 9 10 11 12 13
 *
 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
 * Written by David Howells (dhowells@redhat.com)
 */
#ifndef __ASM_GENERIC_PCI_IOMAP_H
#define __ASM_GENERIC_PCI_IOMAP_H

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);
14
extern void __iomem *pci_iomap_wc(struct pci_dev *dev, int bar, unsigned long max);
M
Michael S. Tsirkin 已提交
15 16 17
extern void __iomem *pci_iomap_range(struct pci_dev *dev, int bar,
				     unsigned long offset,
				     unsigned long maxlen);
18 19 20
extern void __iomem *pci_iomap_wc_range(struct pci_dev *dev, int bar,
					unsigned long offset,
					unsigned long maxlen);
21
extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
22 23 24 25 26 27 28 29 30 31
/* 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

32
#elif defined(CONFIG_GENERIC_PCI_IOMAP)
M
Michael S. Tsirkin 已提交
33 34 35 36
static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
{
	return NULL;
}
M
Michael S. Tsirkin 已提交
37

38 39 40 41
static inline void __iomem *pci_iomap_wc(struct pci_dev *dev, int bar, unsigned long max)
{
	return NULL;
}
M
Michael S. Tsirkin 已提交
42 43 44 45 46 47
static inline void __iomem *pci_iomap_range(struct pci_dev *dev, int bar,
					    unsigned long offset,
					    unsigned long maxlen)
{
	return NULL;
}
48 49 50 51 52 53
static inline void __iomem *pci_iomap_wc_range(struct pci_dev *dev, int bar,
					       unsigned long offset,
					       unsigned long maxlen)
{
	return NULL;
}
54 55
static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
{ }
M
Michael S. Tsirkin 已提交
56 57
#endif

58
#endif /* __ASM_GENERIC_PCI_IOMAP_H */