Loading...
1/*
2 * linux/arch/arm/mm/iomap.c
3 *
4 * Map IO port and PCI memory spaces so that {read,write}[bwl] can
5 * be used to access this memory.
6 */
7#include <linux/module.h>
8#include <linux/pci.h>
9#include <linux/ioport.h>
10#include <linux/io.h>
11
12unsigned long vga_base;
13EXPORT_SYMBOL(vga_base);
14
15#ifdef __io
16void __iomem *ioport_map(unsigned long port, unsigned int nr)
17{
18 return __io(port);
19}
20EXPORT_SYMBOL(ioport_map);
21
22void ioport_unmap(void __iomem *addr)
23{
24}
25EXPORT_SYMBOL(ioport_unmap);
26#endif
27
28#ifdef CONFIG_PCI
29unsigned long pcibios_min_io = 0x1000;
30EXPORT_SYMBOL(pcibios_min_io);
31
32unsigned long pcibios_min_mem = 0x01000000;
33EXPORT_SYMBOL(pcibios_min_mem);
34
35unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC;
36EXPORT_SYMBOL(pci_flags);
37
38void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
39{
40 resource_size_t start = pci_resource_start(dev, bar);
41 resource_size_t len = pci_resource_len(dev, bar);
42 unsigned long flags = pci_resource_flags(dev, bar);
43
44 if (!len || !start)
45 return NULL;
46 if (maxlen && len > maxlen)
47 len = maxlen;
48 if (flags & IORESOURCE_IO)
49 return ioport_map(start, len);
50 if (flags & IORESOURCE_MEM) {
51 if (flags & IORESOURCE_CACHEABLE)
52 return ioremap(start, len);
53 return ioremap_nocache(start, len);
54 }
55 return NULL;
56}
57EXPORT_SYMBOL(pci_iomap);
58
59void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
60{
61 if ((unsigned long)addr >= VMALLOC_START &&
62 (unsigned long)addr < VMALLOC_END)
63 iounmap(addr);
64}
65EXPORT_SYMBOL(pci_iounmap);
66#endif
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * linux/arch/arm/mm/iomap.c
4 *
5 * Map IO port and PCI memory spaces so that {read,write}[bwl] can
6 * be used to access this memory.
7 */
8#include <linux/module.h>
9#include <linux/pci.h>
10#include <linux/ioport.h>
11#include <linux/io.h>
12
13#include <asm/vga.h>
14
15unsigned long vga_base;
16EXPORT_SYMBOL(vga_base);
17
18#ifdef __io
19void __iomem *ioport_map(unsigned long port, unsigned int nr)
20{
21 return __io(port);
22}
23EXPORT_SYMBOL(ioport_map);
24
25void ioport_unmap(void __iomem *addr)
26{
27}
28EXPORT_SYMBOL(ioport_unmap);
29#endif
30
31#ifdef CONFIG_PCI
32unsigned long pcibios_min_io = 0x1000;
33EXPORT_SYMBOL(pcibios_min_io);
34
35unsigned long pcibios_min_mem = 0x01000000;
36EXPORT_SYMBOL(pcibios_min_mem);
37
38void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
39{
40 if ((unsigned long)addr >= VMALLOC_START &&
41 (unsigned long)addr < VMALLOC_END)
42 iounmap(addr);
43}
44EXPORT_SYMBOL(pci_iounmap);
45#endif