]>
Commit | Line | Data |
---|---|---|
140c1729 RB |
1 | /* |
2 | * Implement the default iomap interfaces | |
3 | * | |
4 | * (C) Copyright 2004 Linus Torvalds | |
5 | * (C) Copyright 2006 Ralf Baechle <[email protected]> | |
6 | * (C) Copyright 2007 MIPS Technologies, Inc. | |
7 | * written by Ralf Baechle <[email protected]> | |
8 | */ | |
9 | #include <linux/pci.h> | |
10 | #include <linux/module.h> | |
11 | #include <asm/io.h> | |
12 | ||
0f3b3956 MT |
13 | void __iomem *__pci_ioport_map(struct pci_dev *dev, |
14 | unsigned long port, unsigned int nr) | |
140c1729 RB |
15 | { |
16 | struct pci_controller *ctrl = dev->bus->sysdata; | |
17 | unsigned long base = ctrl->io_map_base; | |
18 | ||
19 | /* This will eventually become a BUG_ON but for now be gentle */ | |
20 | if (unlikely(!ctrl->io_map_base)) { | |
21 | struct pci_bus *bus = dev->bus; | |
22 | char name[8]; | |
23 | ||
24 | while (bus->parent) | |
25 | bus = bus->parent; | |
26 | ||
27 | ctrl->io_map_base = base = mips_io_port_base; | |
28 | ||
29 | sprintf(name, "%04x:%02x", pci_domain_nr(bus), bus->number); | |
30 | printk(KERN_WARNING "io_map_base of root PCI bus %s unset. " | |
31 | "Trying to continue but you better\nfix this issue or " | |
32 | "report it to [email protected] or your " | |
33 | "vendor.\n", name); | |
34 | #ifdef CONFIG_PCI_DOMAINS | |
35 | panic("To avoid data corruption io_map_base MUST be set with " | |
36 | "multiple PCI domains."); | |
37 | #endif | |
38 | } | |
39 | ||
40 | return (void __iomem *) (ctrl->io_map_base + port); | |
41 | } | |
42 | ||
140c1729 RB |
43 | void pci_iounmap(struct pci_dev *dev, void __iomem * addr) |
44 | { | |
45 | iounmap(addr); | |
46 | } | |
47 | ||
48 | EXPORT_SYMBOL(pci_iounmap); |