Merge remote-tracking branch 's5p/for-next'
[linux-2.6/next.git] / arch / arm / mm / iomap.c
blob430df1a5978d04d198a88f2448c8a2de67c7e963
1 /*
2 * linux/arch/arm/mm/iomap.c
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>
12 unsigned long vga_base;
13 EXPORT_SYMBOL(vga_base);
15 #ifdef __io
16 void __iomem *ioport_map(unsigned long port, unsigned int nr)
18 return __io(port);
20 EXPORT_SYMBOL(ioport_map);
22 void ioport_unmap(void __iomem *addr)
25 EXPORT_SYMBOL(ioport_unmap);
26 #endif
28 #ifdef CONFIG_PCI
29 unsigned long pcibios_min_io = 0x1000;
30 EXPORT_SYMBOL(pcibios_min_io);
32 unsigned long pcibios_min_mem = 0x01000000;
33 EXPORT_SYMBOL(pcibios_min_mem);
35 unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC;
36 EXPORT_SYMBOL(pci_flags);
38 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
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);
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);
55 return NULL;
57 EXPORT_SYMBOL(pci_iomap);
59 void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
61 if ((unsigned long)addr >= VMALLOC_START &&
62 (unsigned long)addr < VMALLOC_END)
63 iounmap(addr);
65 EXPORT_SYMBOL(pci_iounmap);
66 #endif