Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pci_iomap.c
Go to the documentation of this file.
1 /*
2  * Implement the default iomap interfaces
3  *
4  * (C) Copyright 2004 Linus Torvalds
5  */
6 #include <linux/pci.h>
7 #include <linux/io.h>
8 
9 #include <linux/export.h>
10 
11 #ifdef CONFIG_PCI
12 
26 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
27 {
30  unsigned long flags = pci_resource_flags(dev, bar);
31 
32  if (!len || !start)
33  return NULL;
34  if (maxlen && len > maxlen)
35  len = maxlen;
36  if (flags & IORESOURCE_IO)
37  return __pci_ioport_map(dev, start, len);
38  if (flags & IORESOURCE_MEM) {
39  if (flags & IORESOURCE_CACHEABLE)
40  return ioremap(start, len);
41  return ioremap_nocache(start, len);
42  }
43  /* What? */
44  return NULL;
45 }
46 
47 EXPORT_SYMBOL(pci_iomap);
48 #endif /* CONFIG_PCI */