io_common.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2006 Silicon Graphics, Inc. All rights reserved.
  7. */
  8. #include <linux/bootmem.h>
  9. #include <asm/sn/types.h>
  10. #include <asm/sn/addrs.h>
  11. #include <asm/sn/sn_feature_sets.h>
  12. #include <asm/sn/geo.h>
  13. #include <asm/sn/io.h>
  14. #include <asm/sn/l1.h>
  15. #include <asm/sn/module.h>
  16. #include <asm/sn/pcibr_provider.h>
  17. #include <asm/sn/pcibus_provider_defs.h>
  18. #include <asm/sn/pcidev.h>
  19. #include <asm/sn/simulator.h>
  20. #include <asm/sn/sn_sal.h>
  21. #include <asm/sn/tioca_provider.h>
  22. #include <asm/sn/tioce_provider.h>
  23. #include "xtalk/hubdev.h"
  24. #include "xtalk/xwidgetdev.h"
  25. #include <linux/acpi.h>
  26. #include <asm/sn/sn2/sn_hwperf.h>
  27. #include <asm/sn/acpi.h>
  28. extern void sn_init_cpei_timer(void);
  29. extern void register_sn_procfs(void);
  30. extern void sn_acpi_bus_fixup(struct pci_bus *);
  31. extern void sn_bus_fixup(struct pci_bus *);
  32. extern void sn_acpi_slot_fixup(struct pci_dev *, struct pcidev_info *);
  33. extern void sn_more_slot_fixup(struct pci_dev *, struct pcidev_info *);
  34. extern void sn_legacy_pci_window_fixup(struct pci_controller *, u64, u64);
  35. extern void sn_io_acpi_init(void);
  36. extern void sn_io_init(void);
  37. static struct list_head sn_sysdata_list;
  38. /* sysdata list struct */
  39. struct sysdata_el {
  40. struct list_head entry;
  41. void *sysdata;
  42. };
  43. int sn_ioif_inited; /* SN I/O infrastructure initialized? */
  44. struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES]; /* indexed by asic type */
  45. /*
  46. * Hooks and struct for unsupported pci providers
  47. */
  48. static dma_addr_t
  49. sn_default_pci_map(struct pci_dev *pdev, unsigned long paddr, size_t size, int type)
  50. {
  51. return 0;
  52. }
  53. static void
  54. sn_default_pci_unmap(struct pci_dev *pdev, dma_addr_t addr, int direction)
  55. {
  56. return;
  57. }
  58. static void *
  59. sn_default_pci_bus_fixup(struct pcibus_bussoft *soft, struct pci_controller *controller)
  60. {
  61. return NULL;
  62. }
  63. static struct sn_pcibus_provider sn_pci_default_provider = {
  64. .dma_map = sn_default_pci_map,
  65. .dma_map_consistent = sn_default_pci_map,
  66. .dma_unmap = sn_default_pci_unmap,
  67. .bus_fixup = sn_default_pci_bus_fixup,
  68. };
  69. /*
  70. * Retrieve the DMA Flush List given nasid, widget, and device.
  71. * This list is needed to implement the WAR - Flush DMA data on PIO Reads.
  72. */
  73. static inline u64
  74. sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num,
  75. u64 address)
  76. {
  77. struct ia64_sal_retval ret_stuff;
  78. ret_stuff.status = 0;
  79. ret_stuff.v0 = 0;
  80. SAL_CALL_NOLOCK(ret_stuff,
  81. (u64) SN_SAL_IOIF_GET_DEVICE_DMAFLUSH_LIST,
  82. (u64) nasid, (u64) widget_num,
  83. (u64) device_num, (u64) address, 0, 0, 0);
  84. return ret_stuff.status;
  85. }
  86. /*
  87. * Retrieve the pci device information given the bus and device|function number.
  88. */
  89. static inline u64
  90. sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev,
  91. u64 sn_irq_info)
  92. {
  93. struct ia64_sal_retval ret_stuff;
  94. ret_stuff.status = 0;
  95. ret_stuff.v0 = 0;
  96. SAL_CALL_NOLOCK(ret_stuff,
  97. (u64) SN_SAL_IOIF_GET_PCIDEV_INFO,
  98. (u64) segment, (u64) bus_number, (u64) devfn,
  99. (u64) pci_dev,
  100. sn_irq_info, 0, 0);
  101. return ret_stuff.v0;
  102. }
  103. /*
  104. * sn_pcidev_info_get() - Retrieve the pcidev_info struct for the specified
  105. * device.
  106. */
  107. inline struct pcidev_info *
  108. sn_pcidev_info_get(struct pci_dev *dev)
  109. {
  110. struct pcidev_info *pcidev;
  111. list_for_each_entry(pcidev,
  112. &(SN_PLATFORM_DATA(dev)->pcidev_info), pdi_list) {
  113. if (pcidev->pdi_linux_pcidev == dev)
  114. return pcidev;
  115. }
  116. return NULL;
  117. }
  118. /* Older PROM flush WAR
  119. *
  120. * 01/16/06 -- This war will be in place until a new official PROM is released.
  121. * Additionally note that the struct sn_flush_device_war also has to be
  122. * removed from arch/ia64/sn/include/xtalk/hubdev.h
  123. */
  124. static u8 war_implemented = 0;
  125. static s64 sn_device_fixup_war(u64 nasid, u64 widget, int device,
  126. struct sn_flush_device_common *common)
  127. {
  128. struct sn_flush_device_war *war_list;
  129. struct sn_flush_device_war *dev_entry;
  130. struct ia64_sal_retval isrv = {0,0,0,0};
  131. if (!war_implemented) {
  132. printk(KERN_WARNING "PROM version < 4.50 -- implementing old "
  133. "PROM flush WAR\n");
  134. war_implemented = 1;
  135. }
  136. war_list = kzalloc(DEV_PER_WIDGET * sizeof(*war_list), GFP_KERNEL);
  137. if (!war_list)
  138. BUG();
  139. SAL_CALL_NOLOCK(isrv, SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST,
  140. nasid, widget, __pa(war_list), 0, 0, 0 ,0);
  141. if (isrv.status)
  142. panic("sn_device_fixup_war failed: %s\n",
  143. ia64_sal_strerror(isrv.status));
  144. dev_entry = war_list + device;
  145. memcpy(common,dev_entry, sizeof(*common));
  146. kfree(war_list);
  147. return isrv.status;
  148. }
  149. /*
  150. * sn_common_hubdev_init() - This routine is called to initialize the HUB data
  151. * structure for each node in the system.
  152. */
  153. void __init
  154. sn_common_hubdev_init(struct hubdev_info *hubdev)
  155. {
  156. struct sn_flush_device_kernel *sn_flush_device_kernel;
  157. struct sn_flush_device_kernel *dev_entry;
  158. s64 status;
  159. int widget, device, size;
  160. /* Attach the error interrupt handlers */
  161. if (hubdev->hdi_nasid & 1) /* If TIO */
  162. ice_error_init(hubdev);
  163. else
  164. hub_error_init(hubdev);
  165. for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++)
  166. hubdev->hdi_xwidget_info[widget].xwi_hubinfo = hubdev;
  167. if (!hubdev->hdi_flush_nasid_list.widget_p)
  168. return;
  169. size = (HUB_WIDGET_ID_MAX + 1) *
  170. sizeof(struct sn_flush_device_kernel *);
  171. hubdev->hdi_flush_nasid_list.widget_p =
  172. kzalloc(size, GFP_KERNEL);
  173. if (!hubdev->hdi_flush_nasid_list.widget_p)
  174. BUG();
  175. for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) {
  176. size = DEV_PER_WIDGET *
  177. sizeof(struct sn_flush_device_kernel);
  178. sn_flush_device_kernel = kzalloc(size, GFP_KERNEL);
  179. if (!sn_flush_device_kernel)
  180. BUG();
  181. dev_entry = sn_flush_device_kernel;
  182. for (device = 0; device < DEV_PER_WIDGET;
  183. device++, dev_entry++) {
  184. size = sizeof(struct sn_flush_device_common);
  185. dev_entry->common = kzalloc(size, GFP_KERNEL);
  186. if (!dev_entry->common)
  187. BUG();
  188. if (sn_prom_feature_available(PRF_DEVICE_FLUSH_LIST))
  189. status = sal_get_device_dmaflush_list(
  190. hubdev->hdi_nasid, widget, device,
  191. (u64)(dev_entry->common));
  192. else
  193. status = sn_device_fixup_war(hubdev->hdi_nasid,
  194. widget, device,
  195. dev_entry->common);
  196. if (status != SALRET_OK)
  197. panic("SAL call failed: %s\n",
  198. ia64_sal_strerror(status));
  199. spin_lock_init(&dev_entry->sfdl_flush_lock);
  200. }
  201. if (sn_flush_device_kernel)
  202. hubdev->hdi_flush_nasid_list.widget_p[widget] =
  203. sn_flush_device_kernel;
  204. }
  205. }
  206. void sn_pci_unfixup_slot(struct pci_dev *dev)
  207. {
  208. struct pci_dev *host_pci_dev = SN_PCIDEV_INFO(dev)->host_pci_dev;
  209. sn_irq_unfixup(dev);
  210. pci_dev_put(host_pci_dev);
  211. pci_dev_put(dev);
  212. }
  213. /*
  214. * sn_pci_fixup_slot() - This routine sets up a slot's resources consistent
  215. * with the Linux PCI abstraction layer. Resources
  216. * acquired from our PCI provider include PIO maps
  217. * to BAR space and interrupt objects.
  218. */
  219. void sn_pci_fixup_slot(struct pci_dev *dev)
  220. {
  221. int segment = pci_domain_nr(dev->bus);
  222. int status = 0;
  223. struct pcibus_bussoft *bs;
  224. struct pci_bus *host_pci_bus;
  225. struct pci_dev *host_pci_dev;
  226. struct pcidev_info *pcidev_info;
  227. struct sn_irq_info *sn_irq_info;
  228. unsigned int bus_no, devfn;
  229. pci_dev_get(dev); /* for the sysdata pointer */
  230. pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL);
  231. if (!pcidev_info)
  232. BUG(); /* Cannot afford to run out of memory */
  233. sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL);
  234. if (!sn_irq_info)
  235. BUG(); /* Cannot afford to run out of memory */
  236. /* Call to retrieve pci device information needed by kernel. */
  237. status = sal_get_pcidev_info((u64) segment, (u64) dev->bus->number,
  238. dev->devfn,
  239. (u64) __pa(pcidev_info),
  240. (u64) __pa(sn_irq_info));
  241. if (status)
  242. BUG(); /* Cannot get platform pci device information */
  243. /* Add pcidev_info to list in pci_controller.platform_data */
  244. list_add_tail(&pcidev_info->pdi_list,
  245. &(SN_PLATFORM_DATA(dev->bus)->pcidev_info));
  246. if (SN_ACPI_BASE_SUPPORT())
  247. sn_acpi_slot_fixup(dev, pcidev_info);
  248. else
  249. sn_more_slot_fixup(dev, pcidev_info);
  250. /*
  251. * Using the PROMs values for the PCI host bus, get the Linux
  252. * PCI host_pci_dev struct and set up host bus linkages
  253. */
  254. bus_no = (pcidev_info->pdi_slot_host_handle >> 32) & 0xff;
  255. devfn = pcidev_info->pdi_slot_host_handle & 0xffffffff;
  256. host_pci_bus = pci_find_bus(segment, bus_no);
  257. host_pci_dev = pci_get_slot(host_pci_bus, devfn);
  258. pcidev_info->host_pci_dev = host_pci_dev;
  259. pcidev_info->pdi_linux_pcidev = dev;
  260. pcidev_info->pdi_host_pcidev_info = SN_PCIDEV_INFO(host_pci_dev);
  261. bs = SN_PCIBUS_BUSSOFT(dev->bus);
  262. pcidev_info->pdi_pcibus_info = bs;
  263. if (bs && bs->bs_asic_type < PCIIO_ASIC_MAX_TYPES) {
  264. SN_PCIDEV_BUSPROVIDER(dev) = sn_pci_provider[bs->bs_asic_type];
  265. } else {
  266. SN_PCIDEV_BUSPROVIDER(dev) = &sn_pci_default_provider;
  267. }
  268. /* Only set up IRQ stuff if this device has a host bus context */
  269. if (bs && sn_irq_info->irq_irq) {
  270. pcidev_info->pdi_sn_irq_info = sn_irq_info;
  271. dev->irq = pcidev_info->pdi_sn_irq_info->irq_irq;
  272. sn_irq_fixup(dev, sn_irq_info);
  273. } else {
  274. pcidev_info->pdi_sn_irq_info = NULL;
  275. kfree(sn_irq_info);
  276. }
  277. }
  278. /*
  279. * sn_common_bus_fixup - Perform platform specific bus fixup.
  280. * Execute the ASIC specific fixup routine
  281. * for this bus.
  282. */
  283. void
  284. sn_common_bus_fixup(struct pci_bus *bus,
  285. struct pcibus_bussoft *prom_bussoft_ptr)
  286. {
  287. int cnode;
  288. struct pci_controller *controller;
  289. struct hubdev_info *hubdev_info;
  290. int nasid;
  291. void *provider_soft;
  292. struct sn_pcibus_provider *provider;
  293. struct sn_platform_data *sn_platform_data;
  294. controller = PCI_CONTROLLER(bus);
  295. /*
  296. * Per-provider fixup. Copies the bus soft structure from prom
  297. * to local area and links SN_PCIBUS_BUSSOFT().
  298. */
  299. if (prom_bussoft_ptr->bs_asic_type >= PCIIO_ASIC_MAX_TYPES) {
  300. printk(KERN_WARNING "sn_common_bus_fixup: Unsupported asic type, %d",
  301. prom_bussoft_ptr->bs_asic_type);
  302. return;
  303. }
  304. if (prom_bussoft_ptr->bs_asic_type == PCIIO_ASIC_TYPE_PPB)
  305. return; /* no further fixup necessary */
  306. provider = sn_pci_provider[prom_bussoft_ptr->bs_asic_type];
  307. if (provider == NULL)
  308. panic("sn_common_bus_fixup: No provider registered for this asic type, %d",
  309. prom_bussoft_ptr->bs_asic_type);
  310. if (provider->bus_fixup)
  311. provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr,
  312. controller);
  313. else
  314. provider_soft = NULL;
  315. /*
  316. * Generic bus fixup goes here. Don't reference prom_bussoft_ptr
  317. * after this point.
  318. */
  319. controller->platform_data = kzalloc(sizeof(struct sn_platform_data),
  320. GFP_KERNEL);
  321. if (controller->platform_data == NULL)
  322. BUG();
  323. sn_platform_data =
  324. (struct sn_platform_data *) controller->platform_data;
  325. sn_platform_data->provider_soft = provider_soft;
  326. INIT_LIST_HEAD(&((struct sn_platform_data *)
  327. controller->platform_data)->pcidev_info);
  328. nasid = NASID_GET(SN_PCIBUS_BUSSOFT(bus)->bs_base);
  329. cnode = nasid_to_cnodeid(nasid);
  330. hubdev_info = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo);
  331. SN_PCIBUS_BUSSOFT(bus)->bs_xwidget_info =
  332. &(hubdev_info->hdi_xwidget_info[SN_PCIBUS_BUSSOFT(bus)->bs_xid]);
  333. /*
  334. * If the node information we obtained during the fixup phase is
  335. * invalid then set controller->node to -1 (undetermined)
  336. */
  337. if (controller->node >= num_online_nodes()) {
  338. struct pcibus_bussoft *b = SN_PCIBUS_BUSSOFT(bus);
  339. printk(KERN_WARNING "Device ASIC=%u XID=%u PBUSNUM=%u"
  340. "L_IO=%lx L_MEM=%lx BASE=%lx\n",
  341. b->bs_asic_type, b->bs_xid, b->bs_persist_busnum,
  342. b->bs_legacy_io, b->bs_legacy_mem, b->bs_base);
  343. printk(KERN_WARNING "on node %d but only %d nodes online."
  344. "Association set to undetermined.\n",
  345. controller->node, num_online_nodes());
  346. controller->node = -1;
  347. }
  348. }
  349. void sn_bus_store_sysdata(struct pci_dev *dev)
  350. {
  351. struct sysdata_el *element;
  352. element = kzalloc(sizeof(struct sysdata_el), GFP_KERNEL);
  353. if (!element) {
  354. dev_dbg(dev, "%s: out of memory!\n", __FUNCTION__);
  355. return;
  356. }
  357. element->sysdata = SN_PCIDEV_INFO(dev);
  358. list_add(&element->entry, &sn_sysdata_list);
  359. }
  360. void sn_bus_free_sysdata(void)
  361. {
  362. struct sysdata_el *element;
  363. struct list_head *list, *safe;
  364. list_for_each_safe(list, safe, &sn_sysdata_list) {
  365. element = list_entry(list, struct sysdata_el, entry);
  366. list_del(&element->entry);
  367. list_del(&(((struct pcidev_info *)
  368. (element->sysdata))->pdi_list));
  369. kfree(element->sysdata);
  370. kfree(element);
  371. }
  372. return;
  373. }
  374. /*
  375. * hubdev_init_node() - Creates the HUB data structure and link them to it's
  376. * own NODE specific data area.
  377. */
  378. void hubdev_init_node(nodepda_t * npda, cnodeid_t node)
  379. {
  380. struct hubdev_info *hubdev_info;
  381. int size;
  382. pg_data_t *pg;
  383. size = sizeof(struct hubdev_info);
  384. if (node >= num_online_nodes()) /* Headless/memless IO nodes */
  385. pg = NODE_DATA(0);
  386. else
  387. pg = NODE_DATA(node);
  388. hubdev_info = (struct hubdev_info *)alloc_bootmem_node(pg, size);
  389. npda->pdinfo = (void *)hubdev_info;
  390. }
  391. geoid_t
  392. cnodeid_get_geoid(cnodeid_t cnode)
  393. {
  394. struct hubdev_info *hubdev;
  395. hubdev = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo);
  396. return hubdev->hdi_geoid;
  397. }
  398. void sn_generate_path(struct pci_bus *pci_bus, char *address)
  399. {
  400. nasid_t nasid;
  401. cnodeid_t cnode;
  402. geoid_t geoid;
  403. moduleid_t moduleid;
  404. u16 bricktype;
  405. nasid = NASID_GET(SN_PCIBUS_BUSSOFT(pci_bus)->bs_base);
  406. cnode = nasid_to_cnodeid(nasid);
  407. geoid = cnodeid_get_geoid(cnode);
  408. moduleid = geo_module(geoid);
  409. sprintf(address, "module_%c%c%c%c%.2d",
  410. '0'+RACK_GET_CLASS(MODULE_GET_RACK(moduleid)),
  411. '0'+RACK_GET_GROUP(MODULE_GET_RACK(moduleid)),
  412. '0'+RACK_GET_NUM(MODULE_GET_RACK(moduleid)),
  413. MODULE_GET_BTCHAR(moduleid), MODULE_GET_BPOS(moduleid));
  414. /* Tollhouse requires slot id to be displayed */
  415. bricktype = MODULE_GET_BTYPE(moduleid);
  416. if ((bricktype == L1_BRICKTYPE_191010) ||
  417. (bricktype == L1_BRICKTYPE_1932))
  418. sprintf(address, "%s^%d", address, geo_slot(geoid));
  419. }
  420. /*
  421. * sn_pci_fixup_bus() - Perform SN specific setup of software structs
  422. * (pcibus_bussoft, pcidev_info) and hardware
  423. * registers, for the specified bus and devices under it.
  424. */
  425. void __devinit
  426. sn_pci_fixup_bus(struct pci_bus *bus)
  427. {
  428. if (SN_ACPI_BASE_SUPPORT())
  429. sn_acpi_bus_fixup(bus);
  430. else
  431. sn_bus_fixup(bus);
  432. }
  433. /*
  434. * sn_io_early_init - Perform early IO (and some non-IO) initialization.
  435. * In particular, setup the sn_pci_provider[] array.
  436. * This needs to be done prior to any bus scanning
  437. * (acpi_scan_init()) in the ACPI case, as the SN
  438. * bus fixup code will reference the array.
  439. */
  440. static int __init
  441. sn_io_early_init(void)
  442. {
  443. int i;
  444. if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM())
  445. return 0;
  446. /*
  447. * prime sn_pci_provider[]. Individial provider init routines will
  448. * override their respective default entries.
  449. */
  450. for (i = 0; i < PCIIO_ASIC_MAX_TYPES; i++)
  451. sn_pci_provider[i] = &sn_pci_default_provider;
  452. pcibr_init_provider();
  453. tioca_init_provider();
  454. tioce_init_provider();
  455. /*
  456. * This is needed to avoid bounce limit checks in the blk layer
  457. */
  458. ia64_max_iommu_merge_mask = ~PAGE_MASK;
  459. sn_irq_lh_init();
  460. INIT_LIST_HEAD(&sn_sysdata_list);
  461. sn_init_cpei_timer();
  462. #ifdef CONFIG_PROC_FS
  463. register_sn_procfs();
  464. #endif
  465. printk(KERN_INFO "ACPI DSDT OEM Rev 0x%x\n",
  466. acpi_gbl_DSDT->oem_revision);
  467. if (SN_ACPI_BASE_SUPPORT())
  468. sn_io_acpi_init();
  469. else
  470. sn_io_init();
  471. return 0;
  472. }
  473. arch_initcall(sn_io_early_init);
  474. /*
  475. * sn_io_late_init() - Perform any final platform specific IO initialization.
  476. */
  477. int __init
  478. sn_io_late_init(void)
  479. {
  480. struct pci_bus *bus;
  481. struct pcibus_bussoft *bussoft;
  482. cnodeid_t cnode;
  483. nasid_t nasid;
  484. cnodeid_t near_cnode;
  485. if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM())
  486. return 0;
  487. /*
  488. * Setup closest node in pci_controller->node for
  489. * PIC, TIOCP, TIOCE (TIOCA does it during bus fixup using
  490. * info from the PROM).
  491. */
  492. bus = NULL;
  493. while ((bus = pci_find_next_bus(bus)) != NULL) {
  494. bussoft = SN_PCIBUS_BUSSOFT(bus);
  495. nasid = NASID_GET(bussoft->bs_base);
  496. cnode = nasid_to_cnodeid(nasid);
  497. if ((bussoft->bs_asic_type == PCIIO_ASIC_TYPE_TIOCP) ||
  498. (bussoft->bs_asic_type == PCIIO_ASIC_TYPE_TIOCE)) {
  499. /* TIO PCI Bridge: find nearest node with CPUs */
  500. int e = sn_hwperf_get_nearest_node(cnode, NULL,
  501. &near_cnode);
  502. if (e < 0) {
  503. near_cnode = (cnodeid_t)-1; /* use any node */
  504. printk(KERN_WARNING "pcibr_bus_fixup: failed "
  505. "to find near node with CPUs to TIO "
  506. "node %d, err=%d\n", cnode, e);
  507. }
  508. PCI_CONTROLLER(bus)->node = near_cnode;
  509. } else if (bussoft->bs_asic_type == PCIIO_ASIC_TYPE_PIC) {
  510. PCI_CONTROLLER(bus)->node = cnode;
  511. }
  512. }
  513. sn_ioif_inited = 1; /* SN I/O infrastructure now initialized */
  514. return 0;
  515. }
  516. fs_initcall(sn_io_late_init);
  517. EXPORT_SYMBOL(sn_pci_fixup_slot);
  518. EXPORT_SYMBOL(sn_pci_unfixup_slot);
  519. EXPORT_SYMBOL(sn_bus_store_sysdata);
  520. EXPORT_SYMBOL(sn_bus_free_sysdata);
  521. EXPORT_SYMBOL(sn_generate_path);