5 #include <linux/kernel.h>
8 #include <linux/string.h>
10 #include <linux/capability.h>
11 #include <linux/sched.h>
12 #include <linux/errno.h>
15 #include <linux/list.h>
17 #include <linux/slab.h>
18 #include <linux/export.h>
20 #include <asm/processor.h>
23 #include <asm/sections.h>
24 #include <asm/pci-bridge.h>
26 #include <asm/byteorder.h>
27 #include <asm/uaccess.h>
28 #include <asm/machdep.h>
38 static void fixup_cpc710_pci64(
struct pci_dev*
dev);
39 static u8* pci_to_OF_bus_map;
44 static int pci_assign_all_buses;
46 static int pci_bus_count;
76 if (pci_bus >= pci_bus_count)
79 if (bus_range ==
NULL || len < 2 *
sizeof(
int)) {
81 "assuming it starts at 0\n", node->
full_name);
84 pci_to_OF_bus_map[
pci_bus] = bus_range[0];
88 const unsigned int *class_code, *
reg;
116 if (!pci_to_OF_bus_map) {
124 for (i=0; i<pci_bus_count; i++)
125 pci_to_OF_bus_map[i] = 0xff;
139 memcpy(map_prop->
value, pci_to_OF_bus_map, pci_bus_count);
143 printk(
"PCI->OF bus map:\n");
144 for (i=0; i<pci_bus_count; i++) {
145 if (pci_to_OF_bus_map[i] == 0xff)
147 printk(
"%d -> %d\n", i, pci_to_OF_bus_map[i]);
167 if (!reg || size < 5 *
sizeof(
u32))
178 if (!pci_to_OF_bus_map)
182 if (pci_to_OF_bus_map[dev->
bus->number] == *bus &&
183 dev->
devfn == *devfn) {
184 *bus = dev->
bus->number;
208 of_prop->
name =
"pci-OF-bus-map";
210 of_prop->
value = &of_prop[1];
218 unsigned long io_offset;
223 res->
start += io_offset;
224 res->
end += io_offset;
234 if (pci_has_flag(PCI_REASSIGN_ALL_BUS))
235 pci_assign_all_buses = 1;
239 if (pci_assign_all_buses)
244 if (pci_assign_all_buses || next_busno <= hose->
last_busno)
247 pci_bus_count = next_busno;
253 if (pci_assign_all_buses)
260 if (
ppc_md.pcibios_after_init)
261 ppc_md.pcibios_after_init();
269 pci_bus_to_hose(
int bus)
290 hose = pci_bus_to_hose(bus);
298 return (
long)hose->pci_mem_offset;
300 return (
long)hose->io_base_phys;