pci_64.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. /*
  2. * Port for PPC64 David Engebretsen, IBM Corp.
  3. * Contains common pci routines for ppc64 platform, pSeries and iSeries brands.
  4. *
  5. * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM
  6. * Rework, based on alpha PCI code.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version
  11. * 2 of the License, or (at your option) any later version.
  12. */
  13. #undef DEBUG
  14. #include <linux/kernel.h>
  15. #include <linux/pci.h>
  16. #include <linux/string.h>
  17. #include <linux/init.h>
  18. #include <linux/bootmem.h>
  19. #include <linux/mm.h>
  20. #include <linux/list.h>
  21. #include <linux/syscalls.h>
  22. #include <linux/irq.h>
  23. #include <linux/vmalloc.h>
  24. #include <asm/processor.h>
  25. #include <asm/io.h>
  26. #include <asm/prom.h>
  27. #include <asm/pci-bridge.h>
  28. #include <asm/byteorder.h>
  29. #include <asm/machdep.h>
  30. #include <asm/ppc-pci.h>
  31. unsigned long pci_probe_only = 1;
  32. /* pci_io_base -- the base address from which io bars are offsets.
  33. * This is the lowest I/O base address (so bar values are always positive),
  34. * and it *must* be the start of ISA space if an ISA bus exists because
  35. * ISA drivers use hard coded offsets. If no ISA bus exists nothing
  36. * is mapped on the first 64K of IO space
  37. */
  38. unsigned long pci_io_base = ISA_IO_BASE;
  39. EXPORT_SYMBOL(pci_io_base);
  40. static void fixup_broken_pcnet32(struct pci_dev* dev)
  41. {
  42. if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) {
  43. dev->vendor = PCI_VENDOR_ID_AMD;
  44. pci_write_config_word(dev, PCI_VENDOR_ID, PCI_VENDOR_ID_AMD);
  45. }
  46. }
  47. DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32);
  48. static u32 get_int_prop(struct device_node *np, const char *name, u32 def)
  49. {
  50. const u32 *prop;
  51. int len;
  52. prop = of_get_property(np, name, &len);
  53. if (prop && len >= 4)
  54. return *prop;
  55. return def;
  56. }
  57. static unsigned int pci_parse_of_flags(u32 addr0, int bridge)
  58. {
  59. unsigned int flags = 0;
  60. if (addr0 & 0x02000000) {
  61. flags = IORESOURCE_MEM | PCI_BASE_ADDRESS_SPACE_MEMORY;
  62. flags |= (addr0 >> 22) & PCI_BASE_ADDRESS_MEM_TYPE_64;
  63. flags |= (addr0 >> 28) & PCI_BASE_ADDRESS_MEM_TYPE_1M;
  64. if (addr0 & 0x40000000)
  65. flags |= IORESOURCE_PREFETCH
  66. | PCI_BASE_ADDRESS_MEM_PREFETCH;
  67. /* Note: We don't know whether the ROM has been left enabled
  68. * by the firmware or not. We mark it as disabled (ie, we do
  69. * not set the IORESOURCE_ROM_ENABLE flag) for now rather than
  70. * do a config space read, it will be force-enabled if needed
  71. */
  72. if (!bridge && (addr0 & 0xff) == 0x30)
  73. flags |= IORESOURCE_READONLY;
  74. } else if (addr0 & 0x01000000)
  75. flags = IORESOURCE_IO | PCI_BASE_ADDRESS_SPACE_IO;
  76. if (flags)
  77. flags |= IORESOURCE_SIZEALIGN;
  78. return flags;
  79. }
  80. static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev)
  81. {
  82. u64 base, size;
  83. unsigned int flags;
  84. struct resource *res;
  85. const u32 *addrs;
  86. u32 i;
  87. int proplen;
  88. addrs = of_get_property(node, "assigned-addresses", &proplen);
  89. if (!addrs)
  90. return;
  91. pr_debug(" parse addresses (%d bytes) @ %p\n", proplen, addrs);
  92. for (; proplen >= 20; proplen -= 20, addrs += 5) {
  93. flags = pci_parse_of_flags(addrs[0], 0);
  94. if (!flags)
  95. continue;
  96. base = of_read_number(&addrs[1], 2);
  97. size = of_read_number(&addrs[3], 2);
  98. if (!size)
  99. continue;
  100. i = addrs[0] & 0xff;
  101. pr_debug(" base: %llx, size: %llx, i: %x\n",
  102. (unsigned long long)base,
  103. (unsigned long long)size, i);
  104. if (PCI_BASE_ADDRESS_0 <= i && i <= PCI_BASE_ADDRESS_5) {
  105. res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2];
  106. } else if (i == dev->rom_base_reg) {
  107. res = &dev->resource[PCI_ROM_RESOURCE];
  108. flags |= IORESOURCE_READONLY | IORESOURCE_CACHEABLE;
  109. } else {
  110. printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i);
  111. continue;
  112. }
  113. res->start = base;
  114. res->end = base + size - 1;
  115. res->flags = flags;
  116. res->name = pci_name(dev);
  117. }
  118. }
  119. struct pci_dev *of_create_pci_dev(struct device_node *node,
  120. struct pci_bus *bus, int devfn)
  121. {
  122. struct pci_dev *dev;
  123. const char *type;
  124. dev = alloc_pci_dev();
  125. if (!dev)
  126. return NULL;
  127. type = of_get_property(node, "device_type", NULL);
  128. if (type == NULL)
  129. type = "";
  130. pr_debug(" create device, devfn: %x, type: %s\n", devfn, type);
  131. dev->bus = bus;
  132. dev->sysdata = node;
  133. dev->dev.parent = bus->bridge;
  134. dev->dev.bus = &pci_bus_type;
  135. dev->devfn = devfn;
  136. dev->multifunction = 0; /* maybe a lie? */
  137. dev->vendor = get_int_prop(node, "vendor-id", 0xffff);
  138. dev->device = get_int_prop(node, "device-id", 0xffff);
  139. dev->subsystem_vendor = get_int_prop(node, "subsystem-vendor-id", 0);
  140. dev->subsystem_device = get_int_prop(node, "subsystem-id", 0);
  141. dev->cfg_size = pci_cfg_space_size(dev);
  142. dev_set_name(&dev->dev, "%04x:%02x:%02x.%d", pci_domain_nr(bus),
  143. dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
  144. dev->class = get_int_prop(node, "class-code", 0);
  145. dev->revision = get_int_prop(node, "revision-id", 0);
  146. pr_debug(" class: 0x%x\n", dev->class);
  147. pr_debug(" revision: 0x%x\n", dev->revision);
  148. dev->current_state = 4; /* unknown power state */
  149. dev->error_state = pci_channel_io_normal;
  150. dev->dma_mask = 0xffffffff;
  151. if (!strcmp(type, "pci") || !strcmp(type, "pciex")) {
  152. /* a PCI-PCI bridge */
  153. dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
  154. dev->rom_base_reg = PCI_ROM_ADDRESS1;
  155. } else if (!strcmp(type, "cardbus")) {
  156. dev->hdr_type = PCI_HEADER_TYPE_CARDBUS;
  157. } else {
  158. dev->hdr_type = PCI_HEADER_TYPE_NORMAL;
  159. dev->rom_base_reg = PCI_ROM_ADDRESS;
  160. /* Maybe do a default OF mapping here */
  161. dev->irq = NO_IRQ;
  162. }
  163. pci_parse_of_addrs(node, dev);
  164. pr_debug(" adding to system ...\n");
  165. pci_device_add(dev, bus);
  166. return dev;
  167. }
  168. EXPORT_SYMBOL(of_create_pci_dev);
  169. static void __devinit __of_scan_bus(struct device_node *node,
  170. struct pci_bus *bus, int rescan_existing)
  171. {
  172. struct device_node *child;
  173. const u32 *reg;
  174. int reglen, devfn;
  175. struct pci_dev *dev;
  176. pr_debug("of_scan_bus(%s) bus no %d... \n",
  177. node->full_name, bus->number);
  178. /* Scan direct children */
  179. for_each_child_of_node(node, child) {
  180. pr_debug(" * %s\n", child->full_name);
  181. reg = of_get_property(child, "reg", &reglen);
  182. if (reg == NULL || reglen < 20)
  183. continue;
  184. devfn = (reg[0] >> 8) & 0xff;
  185. /* create a new pci_dev for this device */
  186. dev = of_create_pci_dev(child, bus, devfn);
  187. if (!dev)
  188. continue;
  189. pr_debug(" dev header type: %x\n", dev->hdr_type);
  190. }
  191. /* Apply all fixups necessary. We don't fixup the bus "self"
  192. * for an existing bridge that is being rescanned
  193. */
  194. if (!rescan_existing)
  195. pcibios_setup_bus_self(bus);
  196. pcibios_setup_bus_devices(bus);
  197. /* Now scan child busses */
  198. list_for_each_entry(dev, &bus->devices, bus_list) {
  199. if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
  200. dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) {
  201. struct device_node *child = pci_device_to_OF_node(dev);
  202. if (dev)
  203. of_scan_pci_bridge(child, dev);
  204. }
  205. }
  206. }
  207. void __devinit of_scan_bus(struct device_node *node,
  208. struct pci_bus *bus)
  209. {
  210. __of_scan_bus(node, bus, 0);
  211. }
  212. EXPORT_SYMBOL_GPL(of_scan_bus);
  213. void __devinit of_rescan_bus(struct device_node *node,
  214. struct pci_bus *bus)
  215. {
  216. __of_scan_bus(node, bus, 1);
  217. }
  218. EXPORT_SYMBOL_GPL(of_rescan_bus);
  219. void __devinit of_scan_pci_bridge(struct device_node *node,
  220. struct pci_dev *dev)
  221. {
  222. struct pci_bus *bus;
  223. const u32 *busrange, *ranges;
  224. int len, i, mode;
  225. struct resource *res;
  226. unsigned int flags;
  227. u64 size;
  228. pr_debug("of_scan_pci_bridge(%s)\n", node->full_name);
  229. /* parse bus-range property */
  230. busrange = of_get_property(node, "bus-range", &len);
  231. if (busrange == NULL || len != 8) {
  232. printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n",
  233. node->full_name);
  234. return;
  235. }
  236. ranges = of_get_property(node, "ranges", &len);
  237. if (ranges == NULL) {
  238. printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n",
  239. node->full_name);
  240. return;
  241. }
  242. bus = pci_add_new_bus(dev->bus, dev, busrange[0]);
  243. if (!bus) {
  244. printk(KERN_ERR "Failed to create pci bus for %s\n",
  245. node->full_name);
  246. return;
  247. }
  248. bus->primary = dev->bus->number;
  249. bus->subordinate = busrange[1];
  250. bus->bridge_ctl = 0;
  251. bus->sysdata = node;
  252. /* parse ranges property */
  253. /* PCI #address-cells == 3 and #size-cells == 2 always */
  254. res = &dev->resource[PCI_BRIDGE_RESOURCES];
  255. for (i = 0; i < PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES; ++i) {
  256. res->flags = 0;
  257. bus->resource[i] = res;
  258. ++res;
  259. }
  260. i = 1;
  261. for (; len >= 32; len -= 32, ranges += 8) {
  262. flags = pci_parse_of_flags(ranges[0], 1);
  263. size = of_read_number(&ranges[6], 2);
  264. if (flags == 0 || size == 0)
  265. continue;
  266. if (flags & IORESOURCE_IO) {
  267. res = bus->resource[0];
  268. if (res->flags) {
  269. printk(KERN_ERR "PCI: ignoring extra I/O range"
  270. " for bridge %s\n", node->full_name);
  271. continue;
  272. }
  273. } else {
  274. if (i >= PCI_NUM_RESOURCES - PCI_BRIDGE_RESOURCES) {
  275. printk(KERN_ERR "PCI: too many memory ranges"
  276. " for bridge %s\n", node->full_name);
  277. continue;
  278. }
  279. res = bus->resource[i];
  280. ++i;
  281. }
  282. res->start = of_read_number(&ranges[1], 2);
  283. res->end = res->start + size - 1;
  284. res->flags = flags;
  285. }
  286. sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
  287. bus->number);
  288. pr_debug(" bus name: %s\n", bus->name);
  289. mode = PCI_PROBE_NORMAL;
  290. if (ppc_md.pci_probe_mode)
  291. mode = ppc_md.pci_probe_mode(bus);
  292. pr_debug(" probe mode: %d\n", mode);
  293. if (mode == PCI_PROBE_DEVTREE)
  294. of_scan_bus(node, bus);
  295. else if (mode == PCI_PROBE_NORMAL)
  296. pci_scan_child_bus(bus);
  297. }
  298. EXPORT_SYMBOL(of_scan_pci_bridge);
  299. void __devinit scan_phb(struct pci_controller *hose)
  300. {
  301. struct pci_bus *bus;
  302. struct device_node *node = hose->dn;
  303. int mode;
  304. pr_debug("PCI: Scanning PHB %s\n",
  305. node ? node->full_name : "<NO NAME>");
  306. /* Create an empty bus for the toplevel */
  307. bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, node);
  308. if (bus == NULL) {
  309. printk(KERN_ERR "Failed to create bus for PCI domain %04x\n",
  310. hose->global_number);
  311. return;
  312. }
  313. bus->secondary = hose->first_busno;
  314. hose->bus = bus;
  315. /* Get some IO space for the new PHB */
  316. pcibios_map_io_space(bus);
  317. /* Wire up PHB bus resources */
  318. pcibios_setup_phb_resources(hose);
  319. /* Get probe mode and perform scan */
  320. mode = PCI_PROBE_NORMAL;
  321. if (node && ppc_md.pci_probe_mode)
  322. mode = ppc_md.pci_probe_mode(bus);
  323. pr_debug(" probe mode: %d\n", mode);
  324. if (mode == PCI_PROBE_DEVTREE) {
  325. bus->subordinate = hose->last_busno;
  326. of_scan_bus(node, bus);
  327. }
  328. if (mode == PCI_PROBE_NORMAL)
  329. hose->last_busno = bus->subordinate = pci_scan_child_bus(bus);
  330. }
  331. static int __init pcibios_init(void)
  332. {
  333. struct pci_controller *hose, *tmp;
  334. printk(KERN_INFO "PCI: Probing PCI hardware\n");
  335. /* For now, override phys_mem_access_prot. If we need it,g
  336. * later, we may move that initialization to each ppc_md
  337. */
  338. ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
  339. if (pci_probe_only)
  340. ppc_pci_flags |= PPC_PCI_PROBE_ONLY;
  341. /* On ppc64, we always enable PCI domains and we keep domain 0
  342. * backward compatible in /proc for video cards
  343. */
  344. ppc_pci_flags |= PPC_PCI_ENABLE_PROC_DOMAINS | PPC_PCI_COMPAT_DOMAIN_0;
  345. /* Scan all of the recorded PCI controllers. */
  346. list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
  347. scan_phb(hose);
  348. pci_bus_add_devices(hose->bus);
  349. }
  350. /* Call common code to handle resource allocation */
  351. pcibios_resource_survey();
  352. printk(KERN_DEBUG "PCI: Probing PCI hardware done\n");
  353. return 0;
  354. }
  355. subsys_initcall(pcibios_init);
  356. #ifdef CONFIG_HOTPLUG
  357. int pcibios_unmap_io_space(struct pci_bus *bus)
  358. {
  359. struct pci_controller *hose;
  360. WARN_ON(bus == NULL);
  361. /* If this is not a PHB, we only flush the hash table over
  362. * the area mapped by this bridge. We don't play with the PTE
  363. * mappings since we might have to deal with sub-page alignemnts
  364. * so flushing the hash table is the only sane way to make sure
  365. * that no hash entries are covering that removed bridge area
  366. * while still allowing other busses overlapping those pages
  367. */
  368. if (bus->self) {
  369. struct resource *res = bus->resource[0];
  370. pr_debug("IO unmapping for PCI-PCI bridge %s\n",
  371. pci_name(bus->self));
  372. __flush_hash_table_range(&init_mm, res->start + _IO_BASE,
  373. res->end + _IO_BASE + 1);
  374. return 0;
  375. }
  376. /* Get the host bridge */
  377. hose = pci_bus_to_host(bus);
  378. /* Check if we have IOs allocated */
  379. if (hose->io_base_alloc == 0)
  380. return 0;
  381. pr_debug("IO unmapping for PHB %s\n", hose->dn->full_name);
  382. pr_debug(" alloc=0x%p\n", hose->io_base_alloc);
  383. /* This is a PHB, we fully unmap the IO area */
  384. vunmap(hose->io_base_alloc);
  385. return 0;
  386. }
  387. EXPORT_SYMBOL_GPL(pcibios_unmap_io_space);
  388. #endif /* CONFIG_HOTPLUG */
  389. int __devinit pcibios_map_io_space(struct pci_bus *bus)
  390. {
  391. struct vm_struct *area;
  392. unsigned long phys_page;
  393. unsigned long size_page;
  394. unsigned long io_virt_offset;
  395. struct pci_controller *hose;
  396. WARN_ON(bus == NULL);
  397. /* If this not a PHB, nothing to do, page tables still exist and
  398. * thus HPTEs will be faulted in when needed
  399. */
  400. if (bus->self) {
  401. pr_debug("IO mapping for PCI-PCI bridge %s\n",
  402. pci_name(bus->self));
  403. pr_debug(" virt=0x%016llx...0x%016llx\n",
  404. bus->resource[0]->start + _IO_BASE,
  405. bus->resource[0]->end + _IO_BASE);
  406. return 0;
  407. }
  408. /* Get the host bridge */
  409. hose = pci_bus_to_host(bus);
  410. phys_page = _ALIGN_DOWN(hose->io_base_phys, PAGE_SIZE);
  411. size_page = _ALIGN_UP(hose->pci_io_size, PAGE_SIZE);
  412. /* Make sure IO area address is clear */
  413. hose->io_base_alloc = NULL;
  414. /* If there's no IO to map on that bus, get away too */
  415. if (hose->pci_io_size == 0 || hose->io_base_phys == 0)
  416. return 0;
  417. /* Let's allocate some IO space for that guy. We don't pass
  418. * VM_IOREMAP because we don't care about alignment tricks that
  419. * the core does in that case. Maybe we should due to stupid card
  420. * with incomplete address decoding but I'd rather not deal with
  421. * those outside of the reserved 64K legacy region.
  422. */
  423. area = __get_vm_area(size_page, 0, PHB_IO_BASE, PHB_IO_END);
  424. if (area == NULL)
  425. return -ENOMEM;
  426. hose->io_base_alloc = area->addr;
  427. hose->io_base_virt = (void __iomem *)(area->addr +
  428. hose->io_base_phys - phys_page);
  429. pr_debug("IO mapping for PHB %s\n", hose->dn->full_name);
  430. pr_debug(" phys=0x%016llx, virt=0x%p (alloc=0x%p)\n",
  431. hose->io_base_phys, hose->io_base_virt, hose->io_base_alloc);
  432. pr_debug(" size=0x%016lx (alloc=0x%016lx)\n",
  433. hose->pci_io_size, size_page);
  434. /* Establish the mapping */
  435. if (__ioremap_at(phys_page, area->addr, size_page,
  436. _PAGE_NO_CACHE | _PAGE_GUARDED) == NULL)
  437. return -ENOMEM;
  438. /* Fixup hose IO resource */
  439. io_virt_offset = (unsigned long)hose->io_base_virt - _IO_BASE;
  440. hose->io_resource.start += io_virt_offset;
  441. hose->io_resource.end += io_virt_offset;
  442. pr_debug(" hose->io_resource=0x%016llx...0x%016llx\n",
  443. hose->io_resource.start, hose->io_resource.end);
  444. return 0;
  445. }
  446. EXPORT_SYMBOL_GPL(pcibios_map_io_space);
  447. #define IOBASE_BRIDGE_NUMBER 0
  448. #define IOBASE_MEMORY 1
  449. #define IOBASE_IO 2
  450. #define IOBASE_ISA_IO 3
  451. #define IOBASE_ISA_MEM 4
  452. long sys_pciconfig_iobase(long which, unsigned long in_bus,
  453. unsigned long in_devfn)
  454. {
  455. struct pci_controller* hose;
  456. struct list_head *ln;
  457. struct pci_bus *bus = NULL;
  458. struct device_node *hose_node;
  459. /* Argh ! Please forgive me for that hack, but that's the
  460. * simplest way to get existing XFree to not lockup on some
  461. * G5 machines... So when something asks for bus 0 io base
  462. * (bus 0 is HT root), we return the AGP one instead.
  463. */
  464. if (in_bus == 0 && machine_is_compatible("MacRISC4")) {
  465. struct device_node *agp;
  466. agp = of_find_compatible_node(NULL, NULL, "u3-agp");
  467. if (agp)
  468. in_bus = 0xf0;
  469. of_node_put(agp);
  470. }
  471. /* That syscall isn't quite compatible with PCI domains, but it's
  472. * used on pre-domains setup. We return the first match
  473. */
  474. for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) {
  475. bus = pci_bus_b(ln);
  476. if (in_bus >= bus->number && in_bus <= bus->subordinate)
  477. break;
  478. bus = NULL;
  479. }
  480. if (bus == NULL || bus->sysdata == NULL)
  481. return -ENODEV;
  482. hose_node = (struct device_node *)bus->sysdata;
  483. hose = PCI_DN(hose_node)->phb;
  484. switch (which) {
  485. case IOBASE_BRIDGE_NUMBER:
  486. return (long)hose->first_busno;
  487. case IOBASE_MEMORY:
  488. return (long)hose->pci_mem_offset;
  489. case IOBASE_IO:
  490. return (long)hose->io_base_phys;
  491. case IOBASE_ISA_IO:
  492. return (long)isa_io_base;
  493. case IOBASE_ISA_MEM:
  494. return -EINVAL;
  495. }
  496. return -EOPNOTSUPP;
  497. }
  498. #ifdef CONFIG_NUMA
  499. int pcibus_to_node(struct pci_bus *bus)
  500. {
  501. struct pci_controller *phb = pci_bus_to_host(bus);
  502. return phb->node;
  503. }
  504. EXPORT_SYMBOL(pcibus_to_node);
  505. #endif