This source file includes following definitions.
- pcibios_align_resource
- pcibios_fixup_bus
- pci_iobar_pfn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #include <linux/kernel.h>
16 #include <linux/pci.h>
17 #include <linux/delay.h>
18 #include <linux/string.h>
19 #include <linux/init.h>
20 #include <linux/sched.h>
21 #include <linux/errno.h>
22 #include <linux/memblock.h>
23
24 #include <asm/pci-bridge.h>
25 #include <asm/platform.h>
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 resource_size_t
41 pcibios_align_resource(void *data, const struct resource *res,
42 resource_size_t size, resource_size_t align)
43 {
44 struct pci_dev *dev = data;
45 resource_size_t start = res->start;
46
47 if (res->flags & IORESOURCE_IO) {
48 if (size > 0x100) {
49 pr_err("PCI: I/O Region %s/%d too large (%u bytes)\n",
50 pci_name(dev), dev->resource - res,
51 size);
52 }
53
54 if (start & 0x300)
55 start = (start + 0x3ff) & ~0x3ff;
56 }
57
58 return start;
59 }
60
61 void pcibios_fixup_bus(struct pci_bus *bus)
62 {
63 if (bus->parent) {
64
65 pci_read_bridge_bases(bus);
66 }
67 }
68
69
70
71
72
73
74 int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma)
75 {
76 struct pci_controller *pci_ctrl = (struct pci_controller*) pdev->sysdata;
77 resource_size_t ioaddr = pci_resource_start(pdev, bar);
78
79 if (pci_ctrl == 0)
80 return -EINVAL;
81
82
83 ioaddr -= (unsigned long)pci_ctrl->io_space.base;
84
85 vma->vm_pgoff += (ioaddr + pci_ctrl->io_space.start) >> PAGE_SHIFT;
86 return 0;
87 }