blob: 2f06e60e3846a824969f9882ed9ae790295baee1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/*
* Implement the default iomap interfaces
*
* (C) Copyright 2004 Linus Torvalds
*/
#include <common.h>
#include <linux/pci.h>
#include <io.h>
#include <module.h>
/**
* pci_iomap - create a virtual mapping cookie for a PCI BAR
* @dev: PCI device that owns the BAR
* @bar: BAR number
*
* Using this function you will get a __iomem address to your device BAR.
* You can access it using ioread*() and iowrite*(). These functions hide
* the details if this is a MMIO or PIO address space and will just do what
* you expect from them in the correct way.
*
*/
void __iomem *pci_iomap(struct pci_dev *dev, int bar)
{
struct pci_bus *bus = dev->bus;
resource_size_t start = pci_resource_start(dev, bar);
if (bus->host->pci_ops->res_start)
start = bus->host->pci_ops->res_start(bus, start);
return IOMEM(start);
}
EXPORT_SYMBOL(pci_iomap);
|