^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0+ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /* Generic I/O port emulation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Written by David Howells (dhowells@redhat.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #ifndef __ASM_GENERIC_PCI_IOMAP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #define __ASM_GENERIC_PCI_IOMAP_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct pci_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #ifdef CONFIG_PCI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) extern void __iomem *pci_iomap_wc(struct pci_dev *dev, int bar, unsigned long max);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) extern void __iomem *pci_iomap_range(struct pci_dev *dev, int bar,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) unsigned long offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) unsigned long maxlen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) extern void __iomem *pci_iomap_wc_range(struct pci_dev *dev, int bar,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) unsigned long offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) unsigned long maxlen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /* Create a virtual mapping cookie for a port on a given PCI device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * Do not call this directly, it exists to make it easier for architectures
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * to override */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #ifdef CONFIG_NO_GENERIC_PCI_IOPORT_MAP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) extern void __iomem *__pci_ioport_map(struct pci_dev *dev, unsigned long port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) unsigned int nr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define __pci_ioport_map(dev, port, nr) ioport_map((port), (nr))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #elif defined(CONFIG_GENERIC_PCI_IOMAP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static inline void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) static inline void __iomem *pci_iomap_wc(struct pci_dev *dev, int bar, unsigned long max)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) static inline void __iomem *pci_iomap_range(struct pci_dev *dev, int bar,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) unsigned long offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) unsigned long maxlen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) static inline void __iomem *pci_iomap_wc_range(struct pci_dev *dev, int bar,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) unsigned long offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) unsigned long maxlen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #endif /* __ASM_GENERIC_IO_H */