ARM: pci: make pcibios_assign_all_busses use pci_has_flag
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mm / iomap.c
blobad41414c02803b83af94b061967cd841e94e4016
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>
11 #include <asm/pci.h>
13 #ifdef __io
14 void __iomem *ioport_map(unsigned long port, unsigned int nr)
16 return __io(port);
18 EXPORT_SYMBOL(ioport_map);
20 void ioport_unmap(void __iomem *addr)
23 EXPORT_SYMBOL(ioport_unmap);
24 #endif
26 #ifdef CONFIG_PCI
27 unsigned int pci_flags = PCI_REASSIGN_ALL_RSRC;
28 EXPORT_SYMBOL(pci_flags);
30 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
32 resource_size_t start = pci_resource_start(dev, bar);
33 resource_size_t len = pci_resource_len(dev, bar);
34 unsigned long flags = pci_resource_flags(dev, bar);
36 if (!len || !start)
37 return NULL;
38 if (maxlen && len > maxlen)
39 len = maxlen;
40 if (flags & IORESOURCE_IO)
41 return ioport_map(start, len);
42 if (flags & IORESOURCE_MEM) {
43 if (flags & IORESOURCE_CACHEABLE)
44 return ioremap(start, len);
45 return ioremap_nocache(start, len);
47 return NULL;
49 EXPORT_SYMBOL(pci_iomap);
51 void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
53 if ((unsigned long)addr >= VMALLOC_START &&
54 (unsigned long)addr < VMALLOC_END)
55 iounmap(addr);
57 EXPORT_SYMBOL(pci_iounmap);
58 #endif