17 #include <linux/pci.h>
18 #include <linux/export.h>
19 #include <asm/pci-bridge.h>
43 unsigned int flags = 0;
45 if (addr0 & 0x02000000) {
49 if (addr0 & 0x40000000)
57 if (!bridge && (addr0 & 0xff) == 0x30)
59 }
else if (addr0 & 0x01000000)
87 pr_debug(
" parse addresses (%d bytes) @ %p\n", proplen, addrs);
88 for (; proplen >= 20; proplen -= 20, addrs += 5) {
92 base = of_read_number(&addrs[1], 2);
93 size = of_read_number(&addrs[3], 2);
97 pr_debug(
" base: %llx, size: %llx, i: %x\n",
98 (
unsigned long long)base,
99 (
unsigned long long)size, i);
111 res->
name = pci_name(dev);
113 region.end = base + size - 1;
138 pr_debug(
" create device, devfn: %x, type: %s\n", devfn, type);
141 dev->
dev.of_node = of_node_get(node);
153 dev->
vendor = get_int_prop(node,
"vendor-id", 0xffff);
154 dev->
device = get_int_prop(node,
"device-id", 0xffff);
162 dev->
class = get_int_prop(node,
"class-code", 0);
163 dev->
revision = get_int_prop(node,
"revision-id", 0);
180 }
else if (!
strcmp(type,
"cardbus")) {
189 of_pci_parse_addrs(node, dev);
191 pr_debug(
" adding to system ...\n");
211 const u32 *busrange, *ranges;
222 if (busrange ==
NULL || len != 8) {
228 if (ranges ==
NULL) {
254 for (; len >= 32; len -= 32, ranges += 8) {
256 size = of_read_number(&ranges[6], 2);
257 if (flags == 0 || size == 0)
276 region.
start = of_read_number(&ranges[1], 2);
277 region.
end = region.
start + size - 1;
284 mode = PCI_PROBE_NORMAL;
285 if (
ppc_md.pci_probe_mode)
286 mode =
ppc_md.pci_probe_mode(bus);
287 pr_debug(
" probe mode: %d\n", mode);
289 if (mode == PCI_PROBE_DEVTREE)
291 else if (mode == PCI_PROBE_NORMAL)
310 pr_debug(
"of_scan_bus(%s) bus no %d...\n",
319 if (reg ==
NULL || reglen < 20)
321 devfn = (reg[0] >> 8) & 0xff;
333 if (!rescan_existing)
354 __of_scan_bus(node, bus, 0);
369 __of_scan_bus(node, bus, 1);