[IA64-SGI] sn2 housekeeping
[linux-2.6.22.y-op.git] / arch / ia64 / sn / kernel / io_init.c
blobd7e4d79e16a8d425747d45abed163a124c98b6da
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.
6 * Copyright (C) 1992 - 1997, 2000-2005 Silicon Graphics, Inc. All rights reserved.
7 */
9 #include <linux/bootmem.h>
10 #include <linux/nodemask.h>
11 #include <asm/sn/types.h>
12 #include <asm/sn/addrs.h>
13 #include <asm/sn/sn_feature_sets.h>
14 #include <asm/sn/geo.h>
15 #include <asm/sn/io.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"
26 static struct list_head sn_sysdata_list;
28 /* sysdata list struct */
29 struct sysdata_el {
30 struct list_head entry;
31 void *sysdata;
34 struct slab_info {
35 struct hubdev_info hubdev;
38 struct brick {
39 moduleid_t id; /* Module ID of this module */
40 struct slab_info slab_info[MAX_SLABS + 1];
43 int sn_ioif_inited = 0; /* SN I/O infrastructure initialized? */
45 struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES]; /* indexed by asic type */
47 static int max_segment_number = 0; /* Default highest segment number */
48 static int max_pcibus_number = 255; /* Default highest pci bus number */
51 * Hooks and struct for unsupported pci providers
54 static dma_addr_t
55 sn_default_pci_map(struct pci_dev *pdev, unsigned long paddr, size_t size)
57 return 0;
60 static void
61 sn_default_pci_unmap(struct pci_dev *pdev, dma_addr_t addr, int direction)
63 return;
66 static void *
67 sn_default_pci_bus_fixup(struct pcibus_bussoft *soft, struct pci_controller *controller)
69 return NULL;
72 static struct sn_pcibus_provider sn_pci_default_provider = {
73 .dma_map = sn_default_pci_map,
74 .dma_map_consistent = sn_default_pci_map,
75 .dma_unmap = sn_default_pci_unmap,
76 .bus_fixup = sn_default_pci_bus_fixup,
80 * Retrieve the DMA Flush List given nasid, widget, and device.
81 * This list is needed to implement the WAR - Flush DMA data on PIO Reads.
83 static inline u64
84 sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num,
85 u64 address)
88 struct ia64_sal_retval ret_stuff;
89 ret_stuff.status = 0;
90 ret_stuff.v0 = 0;
92 SAL_CALL_NOLOCK(ret_stuff,
93 (u64) SN_SAL_IOIF_GET_DEVICE_DMAFLUSH_LIST,
94 (u64) nasid, (u64) widget_num,
95 (u64) device_num, (u64) address, 0, 0, 0);
96 return ret_stuff.status;
101 * Retrieve the hub device info structure for the given nasid.
103 static inline u64 sal_get_hubdev_info(u64 handle, u64 address)
106 struct ia64_sal_retval ret_stuff;
107 ret_stuff.status = 0;
108 ret_stuff.v0 = 0;
110 SAL_CALL_NOLOCK(ret_stuff,
111 (u64) SN_SAL_IOIF_GET_HUBDEV_INFO,
112 (u64) handle, (u64) address, 0, 0, 0, 0, 0);
113 return ret_stuff.v0;
117 * Retrieve the pci bus information given the bus number.
119 static inline u64 sal_get_pcibus_info(u64 segment, u64 busnum, u64 address)
122 struct ia64_sal_retval ret_stuff;
123 ret_stuff.status = 0;
124 ret_stuff.v0 = 0;
126 SAL_CALL_NOLOCK(ret_stuff,
127 (u64) SN_SAL_IOIF_GET_PCIBUS_INFO,
128 (u64) segment, (u64) busnum, (u64) address, 0, 0, 0, 0);
129 return ret_stuff.v0;
133 * Retrieve the pci device information given the bus and device|function number.
135 static inline u64
136 sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev,
137 u64 sn_irq_info)
139 struct ia64_sal_retval ret_stuff;
140 ret_stuff.status = 0;
141 ret_stuff.v0 = 0;
143 SAL_CALL_NOLOCK(ret_stuff,
144 (u64) SN_SAL_IOIF_GET_PCIDEV_INFO,
145 (u64) segment, (u64) bus_number, (u64) devfn,
146 (u64) pci_dev,
147 sn_irq_info, 0, 0);
148 return ret_stuff.v0;
152 * sn_pcidev_info_get() - Retrieve the pcidev_info struct for the specified
153 * device.
155 inline struct pcidev_info *
156 sn_pcidev_info_get(struct pci_dev *dev)
158 struct pcidev_info *pcidev;
160 list_for_each_entry(pcidev,
161 &(SN_PCI_CONTROLLER(dev)->pcidev_info), pdi_list) {
162 if (pcidev->pdi_linux_pcidev == dev) {
163 return pcidev;
166 return NULL;
169 /* Older PROM flush WAR
171 * 01/16/06 -- This war will be in place until a new official PROM is released.
172 * Additionally note that the struct sn_flush_device_war also has to be
173 * removed from arch/ia64/sn/include/xtalk/hubdev.h
175 static u8 war_implemented = 0;
177 static s64 sn_device_fixup_war(u64 nasid, u64 widget, int device,
178 struct sn_flush_device_common *common)
180 struct sn_flush_device_war *war_list;
181 struct sn_flush_device_war *dev_entry;
182 struct ia64_sal_retval isrv = {0,0,0,0};
184 if (!war_implemented) {
185 printk(KERN_WARNING "PROM version < 4.50 -- implementing old "
186 "PROM flush WAR\n");
187 war_implemented = 1;
190 war_list = kzalloc(DEV_PER_WIDGET * sizeof(*war_list), GFP_KERNEL);
191 if (!war_list)
192 BUG();
194 SAL_CALL_NOLOCK(isrv, SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST,
195 nasid, widget, __pa(war_list), 0, 0, 0 ,0);
196 if (isrv.status)
197 panic("sn_device_fixup_war failed: %s\n",
198 ia64_sal_strerror(isrv.status));
200 dev_entry = war_list + device;
201 memcpy(common,dev_entry, sizeof(*common));
202 kfree(war_list);
204 return isrv.status;
208 * sn_fixup_ionodes() - This routine initializes the HUB data strcuture for
209 * each node in the system.
211 static void __init sn_fixup_ionodes(void)
213 struct sn_flush_device_kernel *sn_flush_device_kernel;
214 struct sn_flush_device_kernel *dev_entry;
215 struct hubdev_info *hubdev;
216 u64 status;
217 u64 nasid;
218 int i, widget, device;
221 * Get SGI Specific HUB chipset information.
222 * Inform Prom that this kernel can support domain bus numbering.
224 for (i = 0; i < num_cnodes; i++) {
225 hubdev = (struct hubdev_info *)(NODEPDA(i)->pdinfo);
226 nasid = cnodeid_to_nasid(i);
227 hubdev->max_segment_number = 0xffffffff;
228 hubdev->max_pcibus_number = 0xff;
229 status = sal_get_hubdev_info(nasid, (u64) __pa(hubdev));
230 if (status)
231 continue;
233 /* Save the largest Domain and pcibus numbers found. */
234 if (hubdev->max_segment_number) {
236 * Dealing with a Prom that supports segments.
238 max_segment_number = hubdev->max_segment_number;
239 max_pcibus_number = hubdev->max_pcibus_number;
242 /* Attach the error interrupt handlers */
243 if (nasid & 1)
244 ice_error_init(hubdev);
245 else
246 hub_error_init(hubdev);
248 for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++)
249 hubdev->hdi_xwidget_info[widget].xwi_hubinfo = hubdev;
251 if (!hubdev->hdi_flush_nasid_list.widget_p)
252 continue;
254 hubdev->hdi_flush_nasid_list.widget_p =
255 kmalloc((HUB_WIDGET_ID_MAX + 1) *
256 sizeof(struct sn_flush_device_kernel *),
257 GFP_KERNEL);
258 memset(hubdev->hdi_flush_nasid_list.widget_p, 0x0,
259 (HUB_WIDGET_ID_MAX + 1) *
260 sizeof(struct sn_flush_device_kernel *));
262 for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) {
263 sn_flush_device_kernel = kmalloc(DEV_PER_WIDGET *
264 sizeof(struct
265 sn_flush_device_kernel),
266 GFP_KERNEL);
267 if (!sn_flush_device_kernel)
268 BUG();
269 memset(sn_flush_device_kernel, 0x0,
270 DEV_PER_WIDGET *
271 sizeof(struct sn_flush_device_kernel));
273 dev_entry = sn_flush_device_kernel;
274 for (device = 0; device < DEV_PER_WIDGET;
275 device++,dev_entry++) {
276 dev_entry->common = kmalloc(sizeof(struct
277 sn_flush_device_common),
278 GFP_KERNEL);
279 if (!dev_entry->common)
280 BUG();
281 memset(dev_entry->common, 0x0, sizeof(struct
282 sn_flush_device_common));
284 if (sn_prom_feature_available(
285 PRF_DEVICE_FLUSH_LIST))
286 status = sal_get_device_dmaflush_list(
287 nasid,
288 widget,
289 device,
290 (u64)(dev_entry->common));
291 else
292 status = sn_device_fixup_war(nasid,
293 widget,
294 device,
295 dev_entry->common);
296 if (status != SALRET_OK)
297 panic("SAL call failed: %s\n",
298 ia64_sal_strerror(status));
300 spin_lock_init(&dev_entry->sfdl_flush_lock);
303 if (sn_flush_device_kernel)
304 hubdev->hdi_flush_nasid_list.widget_p[widget] =
305 sn_flush_device_kernel;
311 * sn_pci_window_fixup() - Create a pci_window for each device resource.
312 * Until ACPI support is added, we need this code
313 * to setup pci_windows for use by
314 * pcibios_bus_to_resource(),
315 * pcibios_resource_to_bus(), etc.
317 static void
318 sn_pci_window_fixup(struct pci_dev *dev, unsigned int count,
319 s64 * pci_addrs)
321 struct pci_controller *controller = PCI_CONTROLLER(dev->bus);
322 unsigned int i;
323 unsigned int idx;
324 unsigned int new_count;
325 struct pci_window *new_window;
327 if (count == 0)
328 return;
329 idx = controller->windows;
330 new_count = controller->windows + count;
331 new_window = kcalloc(new_count, sizeof(struct pci_window), GFP_KERNEL);
332 if (new_window == NULL)
333 BUG();
334 if (controller->window) {
335 memcpy(new_window, controller->window,
336 sizeof(struct pci_window) * controller->windows);
337 kfree(controller->window);
340 /* Setup a pci_window for each device resource. */
341 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
342 if (pci_addrs[i] == -1)
343 continue;
345 new_window[idx].offset = dev->resource[i].start - pci_addrs[i];
346 new_window[idx].resource = dev->resource[i];
347 idx++;
350 controller->windows = new_count;
351 controller->window = new_window;
354 void sn_pci_unfixup_slot(struct pci_dev *dev)
356 struct pci_dev *host_pci_dev = SN_PCIDEV_INFO(dev)->host_pci_dev;
358 sn_irq_unfixup(dev);
359 pci_dev_put(host_pci_dev);
360 pci_dev_put(dev);
364 * sn_pci_fixup_slot() - This routine sets up a slot's resources
365 * consistent with the Linux PCI abstraction layer. Resources acquired
366 * from our PCI provider include PIO maps to BAR space and interrupt
367 * objects.
369 void sn_pci_fixup_slot(struct pci_dev *dev)
371 unsigned int count = 0;
372 int idx;
373 int segment = pci_domain_nr(dev->bus);
374 int status = 0;
375 struct pcibus_bussoft *bs;
376 struct pci_bus *host_pci_bus;
377 struct pci_dev *host_pci_dev;
378 struct pcidev_info *pcidev_info;
379 s64 pci_addrs[PCI_ROM_RESOURCE + 1];
380 struct sn_irq_info *sn_irq_info;
381 unsigned long size;
382 unsigned int bus_no, devfn;
384 pci_dev_get(dev); /* for the sysdata pointer */
385 pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL);
386 if (pcidev_info <= 0)
387 BUG(); /* Cannot afford to run out of memory */
389 sn_irq_info = kmalloc(sizeof(struct sn_irq_info), GFP_KERNEL);
390 if (sn_irq_info <= 0)
391 BUG(); /* Cannot afford to run out of memory */
392 memset(sn_irq_info, 0, sizeof(struct sn_irq_info));
394 /* Call to retrieve pci device information needed by kernel. */
395 status = sal_get_pcidev_info((u64) segment, (u64) dev->bus->number,
396 dev->devfn,
397 (u64) __pa(pcidev_info),
398 (u64) __pa(sn_irq_info));
399 if (status)
400 BUG(); /* Cannot get platform pci device information */
402 /* Add pcidev_info to list in sn_pci_controller struct */
403 list_add_tail(&pcidev_info->pdi_list,
404 &(SN_PCI_CONTROLLER(dev->bus)->pcidev_info));
406 /* Copy over PIO Mapped Addresses */
407 for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) {
408 unsigned long start, end, addr;
410 if (!pcidev_info->pdi_pio_mapped_addr[idx]) {
411 pci_addrs[idx] = -1;
412 continue;
415 start = dev->resource[idx].start;
416 end = dev->resource[idx].end;
417 size = end - start;
418 if (size == 0) {
419 pci_addrs[idx] = -1;
420 continue;
422 pci_addrs[idx] = start;
423 count++;
424 addr = pcidev_info->pdi_pio_mapped_addr[idx];
425 addr = ((addr << 4) >> 4) | __IA64_UNCACHED_OFFSET;
426 dev->resource[idx].start = addr;
427 dev->resource[idx].end = addr + size;
428 if (dev->resource[idx].flags & IORESOURCE_IO)
429 dev->resource[idx].parent = &ioport_resource;
430 else
431 dev->resource[idx].parent = &iomem_resource;
433 /* Create a pci_window in the pci_controller struct for
434 * each device resource.
436 if (count > 0)
437 sn_pci_window_fixup(dev, count, pci_addrs);
440 * Using the PROMs values for the PCI host bus, get the Linux
441 * PCI host_pci_dev struct and set up host bus linkages
444 bus_no = (pcidev_info->pdi_slot_host_handle >> 32) & 0xff;
445 devfn = pcidev_info->pdi_slot_host_handle & 0xffffffff;
446 host_pci_bus = pci_find_bus(segment, bus_no);
447 host_pci_dev = pci_get_slot(host_pci_bus, devfn);
449 pcidev_info->host_pci_dev = host_pci_dev;
450 pcidev_info->pdi_linux_pcidev = dev;
451 pcidev_info->pdi_host_pcidev_info = SN_PCIDEV_INFO(host_pci_dev);
452 bs = SN_PCIBUS_BUSSOFT(dev->bus);
453 pcidev_info->pdi_pcibus_info = bs;
455 if (bs && bs->bs_asic_type < PCIIO_ASIC_MAX_TYPES) {
456 SN_PCIDEV_BUSPROVIDER(dev) = sn_pci_provider[bs->bs_asic_type];
457 } else {
458 SN_PCIDEV_BUSPROVIDER(dev) = &sn_pci_default_provider;
461 /* Only set up IRQ stuff if this device has a host bus context */
462 if (bs && sn_irq_info->irq_irq) {
463 pcidev_info->pdi_sn_irq_info = sn_irq_info;
464 dev->irq = pcidev_info->pdi_sn_irq_info->irq_irq;
465 sn_irq_fixup(dev, sn_irq_info);
466 } else {
467 pcidev_info->pdi_sn_irq_info = NULL;
468 kfree(sn_irq_info);
472 * MSI currently not supported on altix. Remove this when
473 * the MSI abstraction patches are integrated into the kernel
474 * (sometime after 2.6.16 releases)
476 dev->no_msi = 1;
480 * sn_pci_controller_fixup() - This routine sets up a bus's resources
481 * consistent with the Linux PCI abstraction layer.
483 void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
485 int status = 0;
486 int nasid, cnode;
487 struct pci_controller *controller;
488 struct sn_pci_controller *sn_controller;
489 struct pcibus_bussoft *prom_bussoft_ptr;
490 struct hubdev_info *hubdev_info;
491 void *provider_soft = NULL;
492 struct sn_pcibus_provider *provider;
494 status = sal_get_pcibus_info((u64) segment, (u64) busnum,
495 (u64) ia64_tpa(&prom_bussoft_ptr));
496 if (status > 0)
497 return; /*bus # does not exist */
498 prom_bussoft_ptr = __va(prom_bussoft_ptr);
500 /* Allocate a sn_pci_controller, which has a pci_controller struct
501 * as the first member.
503 sn_controller = kzalloc(sizeof(struct sn_pci_controller), GFP_KERNEL);
504 if (!sn_controller)
505 BUG();
506 INIT_LIST_HEAD(&sn_controller->pcidev_info);
507 controller = &sn_controller->pci_controller;
508 controller->segment = segment;
510 if (bus == NULL) {
511 bus = pci_scan_bus(busnum, &pci_root_ops, controller);
512 if (bus == NULL)
513 goto error_return; /* error, or bus already scanned */
514 bus->sysdata = NULL;
517 if (bus->sysdata)
518 goto error_return; /* sysdata already alloc'd */
521 * Per-provider fixup. Copies the contents from prom to local
522 * area and links SN_PCIBUS_BUSSOFT().
525 if (prom_bussoft_ptr->bs_asic_type >= PCIIO_ASIC_MAX_TYPES)
526 goto error_return; /* unsupported asic type */
528 if (prom_bussoft_ptr->bs_asic_type == PCIIO_ASIC_TYPE_PPB)
529 goto error_return; /* no further fixup necessary */
531 provider = sn_pci_provider[prom_bussoft_ptr->bs_asic_type];
532 if (provider == NULL)
533 goto error_return; /* no provider registerd for this asic */
535 bus->sysdata = controller;
536 if (provider->bus_fixup)
537 provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr, controller);
539 if (provider_soft == NULL) {
540 /* fixup failed or not applicable */
541 bus->sysdata = NULL;
542 goto error_return;
546 * Setup pci_windows for legacy IO and MEM space.
547 * (Temporary until ACPI support is in place.)
549 controller->window = kcalloc(2, sizeof(struct pci_window), GFP_KERNEL);
550 if (controller->window == NULL)
551 BUG();
552 controller->window[0].offset = prom_bussoft_ptr->bs_legacy_io;
553 controller->window[0].resource.name = "legacy_io";
554 controller->window[0].resource.flags = IORESOURCE_IO;
555 controller->window[0].resource.start = prom_bussoft_ptr->bs_legacy_io;
556 controller->window[0].resource.end =
557 controller->window[0].resource.start + 0xffff;
558 controller->window[0].resource.parent = &ioport_resource;
559 controller->window[1].offset = prom_bussoft_ptr->bs_legacy_mem;
560 controller->window[1].resource.name = "legacy_mem";
561 controller->window[1].resource.flags = IORESOURCE_MEM;
562 controller->window[1].resource.start = prom_bussoft_ptr->bs_legacy_mem;
563 controller->window[1].resource.end =
564 controller->window[1].resource.start + (1024 * 1024) - 1;
565 controller->window[1].resource.parent = &iomem_resource;
566 controller->windows = 2;
569 * Generic bus fixup goes here. Don't reference prom_bussoft_ptr
570 * after this point.
573 PCI_CONTROLLER(bus)->platform_data = provider_soft;
574 nasid = NASID_GET(SN_PCIBUS_BUSSOFT(bus)->bs_base);
575 cnode = nasid_to_cnodeid(nasid);
576 hubdev_info = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo);
577 SN_PCIBUS_BUSSOFT(bus)->bs_xwidget_info =
578 &(hubdev_info->hdi_xwidget_info[SN_PCIBUS_BUSSOFT(bus)->bs_xid]);
581 * If the node information we obtained during the fixup phase is invalid
582 * then set controller->node to -1 (undetermined)
584 if (controller->node >= num_online_nodes()) {
585 struct pcibus_bussoft *b = SN_PCIBUS_BUSSOFT(bus);
587 printk(KERN_WARNING "Device ASIC=%u XID=%u PBUSNUM=%u"
588 "L_IO=%lx L_MEM=%lx BASE=%lx\n",
589 b->bs_asic_type, b->bs_xid, b->bs_persist_busnum,
590 b->bs_legacy_io, b->bs_legacy_mem, b->bs_base);
591 printk(KERN_WARNING "on node %d but only %d nodes online."
592 "Association set to undetermined.\n",
593 controller->node, num_online_nodes());
594 controller->node = -1;
596 return;
598 error_return:
600 kfree(sn_controller);
601 return;
604 void sn_bus_store_sysdata(struct pci_dev *dev)
606 struct sysdata_el *element;
608 element = kzalloc(sizeof(struct sysdata_el), GFP_KERNEL);
609 if (!element) {
610 dev_dbg(dev, "%s: out of memory!\n", __FUNCTION__);
611 return;
613 element->sysdata = SN_PCIDEV_INFO(dev);
614 list_add(&element->entry, &sn_sysdata_list);
617 void sn_bus_free_sysdata(void)
619 struct sysdata_el *element;
620 struct list_head *list;
622 sn_sysdata_free_start:
623 list_for_each(list, &sn_sysdata_list) {
624 element = list_entry(list, struct sysdata_el, entry);
625 list_del(&element->entry);
626 kfree(element->sysdata);
627 kfree(element);
628 goto sn_sysdata_free_start;
630 return;
634 * Ugly hack to get PCI setup until we have a proper ACPI namespace.
637 #define PCI_BUSES_TO_SCAN 256
639 static int __init sn_pci_init(void)
641 int i = 0;
642 int j = 0;
643 struct pci_dev *pci_dev = NULL;
644 extern void sn_init_cpei_timer(void);
645 #ifdef CONFIG_PROC_FS
646 extern void register_sn_procfs(void);
647 #endif
649 if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM())
650 return 0;
653 * prime sn_pci_provider[]. Individial provider init routines will
654 * override their respective default entries.
657 for (i = 0; i < PCIIO_ASIC_MAX_TYPES; i++)
658 sn_pci_provider[i] = &sn_pci_default_provider;
660 pcibr_init_provider();
661 tioca_init_provider();
662 tioce_init_provider();
665 * This is needed to avoid bounce limit checks in the blk layer
667 ia64_max_iommu_merge_mask = ~PAGE_MASK;
668 sn_fixup_ionodes();
669 sn_irq_lh_init();
670 INIT_LIST_HEAD(&sn_sysdata_list);
671 sn_init_cpei_timer();
673 #ifdef CONFIG_PROC_FS
674 register_sn_procfs();
675 #endif
677 /* busses are not known yet ... */
678 for (i = 0; i <= max_segment_number; i++)
679 for (j = 0; j <= max_pcibus_number; j++)
680 sn_pci_controller_fixup(i, j, NULL);
683 * Generic Linux PCI Layer has created the pci_bus and pci_dev
684 * structures - time for us to add our SN PLatform specific
685 * information.
688 while ((pci_dev =
689 pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) != NULL)
690 sn_pci_fixup_slot(pci_dev);
692 sn_ioif_inited = 1; /* sn I/O infrastructure now initialized */
694 return 0;
698 * hubdev_init_node() - Creates the HUB data structure and link them to it's
699 * own NODE specific data area.
701 void hubdev_init_node(nodepda_t * npda, cnodeid_t node)
704 struct hubdev_info *hubdev_info;
706 if (node >= num_online_nodes()) /* Headless/memless IO nodes */
707 hubdev_info =
708 (struct hubdev_info *)alloc_bootmem_node(NODE_DATA(0),
709 sizeof(struct
710 hubdev_info));
711 else
712 hubdev_info =
713 (struct hubdev_info *)alloc_bootmem_node(NODE_DATA(node),
714 sizeof(struct
715 hubdev_info));
716 npda->pdinfo = (void *)hubdev_info;
720 geoid_t
721 cnodeid_get_geoid(cnodeid_t cnode)
724 struct hubdev_info *hubdev;
726 hubdev = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo);
727 return hubdev->hdi_geoid;
731 subsys_initcall(sn_pci_init);
732 EXPORT_SYMBOL(sn_pci_fixup_slot);
733 EXPORT_SYMBOL(sn_pci_unfixup_slot);
734 EXPORT_SYMBOL(sn_pci_controller_fixup);
735 EXPORT_SYMBOL(sn_bus_store_sysdata);
736 EXPORT_SYMBOL(sn_bus_free_sysdata);