diff options
-rw-r--r-- | arch/powerpc/kernel/pci-common.c | 36 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci_32.c | 32 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci_64.c | 42 |
3 files changed, 36 insertions, 74 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 68102ce7e438..0245c989d30a 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -655,3 +655,39 @@ int pci_proc_domain(struct pci_bus *bus) | |||
655 | #endif | 655 | #endif |
656 | } | 656 | } |
657 | 657 | ||
658 | void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
659 | struct resource *res) | ||
660 | { | ||
661 | resource_size_t offset = 0, mask = (resource_size_t)-1; | ||
662 | struct pci_controller *hose = pci_bus_to_host(dev->bus); | ||
663 | |||
664 | if (!hose) | ||
665 | return; | ||
666 | if (res->flags & IORESOURCE_IO) { | ||
667 | offset = (unsigned long)hose->io_base_virt - _IO_BASE; | ||
668 | mask = 0xffffffffu; | ||
669 | } else if (res->flags & IORESOURCE_MEM) | ||
670 | offset = hose->pci_mem_offset; | ||
671 | |||
672 | region->start = (res->start - offset) & mask; | ||
673 | region->end = (res->end - offset) & mask; | ||
674 | } | ||
675 | EXPORT_SYMBOL(pcibios_resource_to_bus); | ||
676 | |||
677 | void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
678 | struct pci_bus_region *region) | ||
679 | { | ||
680 | resource_size_t offset = 0, mask = (resource_size_t)-1; | ||
681 | struct pci_controller *hose = pci_bus_to_host(dev->bus); | ||
682 | |||
683 | if (!hose) | ||
684 | return; | ||
685 | if (res->flags & IORESOURCE_IO) { | ||
686 | offset = (unsigned long)hose->io_base_virt - _IO_BASE; | ||
687 | mask = 0xffffffffu; | ||
688 | } else if (res->flags & IORESOURCE_MEM) | ||
689 | offset = hose->pci_mem_offset; | ||
690 | res->start = (region->start + offset) & mask; | ||
691 | res->end = (region->end + offset) & mask; | ||
692 | } | ||
693 | EXPORT_SYMBOL(pcibios_bus_to_resource); | ||
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c index 9a79a3d700ba..f05ef5b17892 100644 --- a/arch/powerpc/kernel/pci_32.c +++ b/arch/powerpc/kernel/pci_32.c | |||
@@ -145,38 +145,6 @@ pcibios_fixup_resources(struct pci_dev *dev) | |||
145 | } | 145 | } |
146 | DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources); | 146 | DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources); |
147 | 147 | ||
148 | void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
149 | struct resource *res) | ||
150 | { | ||
151 | resource_size_t offset = 0, mask = (resource_size_t)-1; | ||
152 | struct pci_controller *hose = dev->sysdata; | ||
153 | |||
154 | if (hose && res->flags & IORESOURCE_IO) { | ||
155 | offset = (unsigned long)hose->io_base_virt - isa_io_base; | ||
156 | mask = 0xffffffffu; | ||
157 | } else if (hose && res->flags & IORESOURCE_MEM) | ||
158 | offset = hose->pci_mem_offset; | ||
159 | region->start = (res->start - offset) & mask; | ||
160 | region->end = (res->end - offset) & mask; | ||
161 | } | ||
162 | EXPORT_SYMBOL(pcibios_resource_to_bus); | ||
163 | |||
164 | void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
165 | struct pci_bus_region *region) | ||
166 | { | ||
167 | resource_size_t offset = 0, mask = (resource_size_t)-1; | ||
168 | struct pci_controller *hose = dev->sysdata; | ||
169 | |||
170 | if (hose && res->flags & IORESOURCE_IO) { | ||
171 | offset = (unsigned long)hose->io_base_virt - isa_io_base; | ||
172 | mask = 0xffffffffu; | ||
173 | } else if (hose && res->flags & IORESOURCE_MEM) | ||
174 | offset = hose->pci_mem_offset; | ||
175 | res->start = (region->start + offset) & mask; | ||
176 | res->end = (region->end + offset) & mask; | ||
177 | } | ||
178 | EXPORT_SYMBOL(pcibios_bus_to_resource); | ||
179 | |||
180 | static int skip_isa_ioresource_align(struct pci_dev *dev) | 148 | static int skip_isa_ioresource_align(struct pci_dev *dev) |
181 | { | 149 | { |
182 | if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) && | 150 | if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) && |
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index e0f3731c3a1c..6d1c28fc5e23 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c | |||
@@ -93,48 +93,6 @@ static void fixup_broken_pcnet32(struct pci_dev* dev) | |||
93 | } | 93 | } |
94 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32); | 94 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32); |
95 | 95 | ||
96 | void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, | ||
97 | struct resource *res) | ||
98 | { | ||
99 | unsigned long offset = 0; | ||
100 | struct pci_controller *hose = pci_bus_to_host(dev->bus); | ||
101 | |||
102 | if (!hose) | ||
103 | return; | ||
104 | |||
105 | if (res->flags & IORESOURCE_IO) | ||
106 | offset = (unsigned long)hose->io_base_virt - _IO_BASE; | ||
107 | |||
108 | if (res->flags & IORESOURCE_MEM) | ||
109 | offset = hose->pci_mem_offset; | ||
110 | |||
111 | region->start = res->start - offset; | ||
112 | region->end = res->end - offset; | ||
113 | } | ||
114 | |||
115 | void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, | ||
116 | struct pci_bus_region *region) | ||
117 | { | ||
118 | unsigned long offset = 0; | ||
119 | struct pci_controller *hose = pci_bus_to_host(dev->bus); | ||
120 | |||
121 | if (!hose) | ||
122 | return; | ||
123 | |||
124 | if (res->flags & IORESOURCE_IO) | ||
125 | offset = (unsigned long)hose->io_base_virt - _IO_BASE; | ||
126 | |||
127 | if (res->flags & IORESOURCE_MEM) | ||
128 | offset = hose->pci_mem_offset; | ||
129 | |||
130 | res->start = region->start + offset; | ||
131 | res->end = region->end + offset; | ||
132 | } | ||
133 | |||
134 | #ifdef CONFIG_HOTPLUG | ||
135 | EXPORT_SYMBOL(pcibios_resource_to_bus); | ||
136 | EXPORT_SYMBOL(pcibios_bus_to_resource); | ||
137 | #endif | ||
138 | 96 | ||
139 | /* | 97 | /* |
140 | * We need to avoid collisions with `mirrored' VGA ports | 98 | * We need to avoid collisions with `mirrored' VGA ports |