Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[pandora-kernel.git] / arch / ia64 / sn / kernel / io_init.c
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) 1992 - 1997, 2000-2005 Silicon Graphics, Inc. All rights reserved.
7  */
8
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/geo.h>
14 #include <asm/sn/io.h>
15 #include <asm/sn/pcibr_provider.h>
16 #include <asm/sn/pcibus_provider_defs.h>
17 #include <asm/sn/pcidev.h>
18 #include <asm/sn/simulator.h>
19 #include <asm/sn/sn_sal.h>
20 #include <asm/sn/tioca_provider.h>
21 #include <asm/sn/tioce_provider.h>
22 #include "xtalk/hubdev.h"
23 #include "xtalk/xwidgetdev.h"
24
25 static struct list_head sn_sysdata_list;
26
27 /* sysdata list struct */
28 struct sysdata_el {
29         struct list_head entry;
30         void *sysdata;
31 };
32
33 struct slab_info {
34         struct hubdev_info hubdev;
35 };
36
37 struct brick {
38         moduleid_t id;          /* Module ID of this module        */
39         struct slab_info slab_info[MAX_SLABS + 1];
40 };
41
42 int sn_ioif_inited = 0;         /* SN I/O infrastructure initialized? */
43
44 struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES];       /* indexed by asic type */
45
46 static int max_segment_number = 0; /* Default highest segment number */
47 static int max_pcibus_number = 255; /* Default highest pci bus number */
48
49 /*
50  * Hooks and struct for unsupported pci providers
51  */
52
53 static dma_addr_t
54 sn_default_pci_map(struct pci_dev *pdev, unsigned long paddr, size_t size)
55 {
56         return 0;
57 }
58
59 static void
60 sn_default_pci_unmap(struct pci_dev *pdev, dma_addr_t addr, int direction)
61 {
62         return;
63 }
64
65 static void *
66 sn_default_pci_bus_fixup(struct pcibus_bussoft *soft, struct pci_controller *controller)
67 {
68         return NULL;
69 }
70
71 static struct sn_pcibus_provider sn_pci_default_provider = {
72         .dma_map = sn_default_pci_map,
73         .dma_map_consistent = sn_default_pci_map,
74         .dma_unmap = sn_default_pci_unmap,
75         .bus_fixup = sn_default_pci_bus_fixup,
76 };
77
78 /*
79  * Retrieve the DMA Flush List given nasid.  This list is needed 
80  * to implement the WAR - Flush DMA data on PIO Reads.
81  */
82 static inline uint64_t
83 sal_get_widget_dmaflush_list(u64 nasid, u64 widget_num, u64 address)
84 {
85
86         struct ia64_sal_retval ret_stuff;
87         ret_stuff.status = 0;
88         ret_stuff.v0 = 0;
89
90         SAL_CALL_NOLOCK(ret_stuff,
91                         (u64) SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST,
92                         (u64) nasid, (u64) widget_num, (u64) address, 0, 0, 0,
93                         0);
94         return ret_stuff.v0;
95
96 }
97
98 /*
99  * Retrieve the hub device info structure for the given nasid.
100  */
101 static inline uint64_t sal_get_hubdev_info(u64 handle, u64 address)
102 {
103
104         struct ia64_sal_retval ret_stuff;
105         ret_stuff.status = 0;
106         ret_stuff.v0 = 0;
107
108         SAL_CALL_NOLOCK(ret_stuff,
109                         (u64) SN_SAL_IOIF_GET_HUBDEV_INFO,
110                         (u64) handle, (u64) address, 0, 0, 0, 0, 0);
111         return ret_stuff.v0;
112 }
113
114 /*
115  * Retrieve the pci bus information given the bus number.
116  */
117 static inline uint64_t sal_get_pcibus_info(u64 segment, u64 busnum, u64 address)
118 {
119
120         struct ia64_sal_retval ret_stuff;
121         ret_stuff.status = 0;
122         ret_stuff.v0 = 0;
123
124         SAL_CALL_NOLOCK(ret_stuff,
125                         (u64) SN_SAL_IOIF_GET_PCIBUS_INFO,
126                         (u64) segment, (u64) busnum, (u64) address, 0, 0, 0, 0);
127         return ret_stuff.v0;
128 }
129
130 /*
131  * Retrieve the pci device information given the bus and device|function number.
132  */
133 static inline uint64_t
134 sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev, 
135                         u64 sn_irq_info)
136 {
137         struct ia64_sal_retval ret_stuff;
138         ret_stuff.status = 0;
139         ret_stuff.v0 = 0;
140
141         SAL_CALL_NOLOCK(ret_stuff,
142                         (u64) SN_SAL_IOIF_GET_PCIDEV_INFO,
143                         (u64) segment, (u64) bus_number, (u64) devfn, 
144                         (u64) pci_dev,
145                         sn_irq_info, 0, 0);
146         return ret_stuff.v0;
147 }
148
149 /*
150  * sn_pcidev_info_get() - Retrieve the pcidev_info struct for the specified
151  *                        device.
152  */
153 inline struct pcidev_info *
154 sn_pcidev_info_get(struct pci_dev *dev)
155 {
156         struct pcidev_info *pcidev;
157
158         list_for_each_entry(pcidev,
159                             &(SN_PCI_CONTROLLER(dev)->pcidev_info), pdi_list) {
160                 if (pcidev->pdi_linux_pcidev == dev) {
161                         return pcidev;
162                 }
163         }
164         return NULL;
165 }
166
167 /*
168  * sn_fixup_ionodes() - This routine initializes the HUB data strcuture for 
169  *      each node in the system.
170  */
171 static void sn_fixup_ionodes(void)
172 {
173
174         struct sn_flush_device_list *sn_flush_device_list;
175         struct hubdev_info *hubdev;
176         uint64_t status;
177         uint64_t nasid;
178         int i, widget;
179
180         /*
181          * Get SGI Specific HUB chipset information.
182          * Inform Prom that this kernel can support domain bus numbering.
183          */
184         for (i = 0; i < num_cnodes; i++) {
185                 hubdev = (struct hubdev_info *)(NODEPDA(i)->pdinfo);
186                 nasid = cnodeid_to_nasid(i);
187                 hubdev->max_segment_number = 0xffffffff;
188                 hubdev->max_pcibus_number = 0xff;
189                 status = sal_get_hubdev_info(nasid, (uint64_t) __pa(hubdev));
190                 if (status)
191                         continue;
192
193                 /* Save the largest Domain and pcibus numbers found. */
194                 if (hubdev->max_segment_number) {
195                         /*
196                          * Dealing with a Prom that supports segments.
197                          */
198                         max_segment_number = hubdev->max_segment_number;
199                         max_pcibus_number = hubdev->max_pcibus_number;
200                 }
201
202                 /* Attach the error interrupt handlers */
203                 if (nasid & 1)
204                         ice_error_init(hubdev);
205                 else
206                         hub_error_init(hubdev);
207
208                 for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++)
209                         hubdev->hdi_xwidget_info[widget].xwi_hubinfo = hubdev;
210
211                 if (!hubdev->hdi_flush_nasid_list.widget_p)
212                         continue;
213
214                 hubdev->hdi_flush_nasid_list.widget_p =
215                     kmalloc((HUB_WIDGET_ID_MAX + 1) *
216                             sizeof(struct sn_flush_device_list *), GFP_KERNEL);
217
218                 memset(hubdev->hdi_flush_nasid_list.widget_p, 0x0,
219                        (HUB_WIDGET_ID_MAX + 1) *
220                        sizeof(struct sn_flush_device_list *));
221
222                 for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) {
223                         sn_flush_device_list = kmalloc(DEV_PER_WIDGET *
224                                                        sizeof(struct
225                                                               sn_flush_device_list),
226                                                        GFP_KERNEL);
227                         memset(sn_flush_device_list, 0x0,
228                                DEV_PER_WIDGET *
229                                sizeof(struct sn_flush_device_list));
230
231                         status =
232                             sal_get_widget_dmaflush_list(nasid, widget,
233                                                          (uint64_t)
234                                                          __pa
235                                                          (sn_flush_device_list));
236                         if (status) {
237                                 kfree(sn_flush_device_list);
238                                 continue;
239                         }
240
241                         spin_lock_init(&sn_flush_device_list->sfdl_flush_lock);
242                         hubdev->hdi_flush_nasid_list.widget_p[widget] =
243                             sn_flush_device_list;
244                 }
245
246         }
247
248 }
249
250 /*
251  * sn_pci_window_fixup() - Create a pci_window for each device resource.
252  *                         Until ACPI support is added, we need this code
253  *                         to setup pci_windows for use by
254  *                         pcibios_bus_to_resource(),
255  *                         pcibios_resource_to_bus(), etc.
256  */
257 static void
258 sn_pci_window_fixup(struct pci_dev *dev, unsigned int count,
259                     int64_t * pci_addrs)
260 {
261         struct pci_controller *controller = PCI_CONTROLLER(dev->bus);
262         unsigned int i;
263         unsigned int idx;
264         unsigned int new_count;
265         struct pci_window *new_window;
266
267         if (count == 0)
268                 return;
269         idx = controller->windows;
270         new_count = controller->windows + count;
271         new_window = kcalloc(new_count, sizeof(struct pci_window), GFP_KERNEL);
272         if (new_window == NULL)
273                 BUG();
274         if (controller->window) {
275                 memcpy(new_window, controller->window,
276                        sizeof(struct pci_window) * controller->windows);
277                 kfree(controller->window);
278         }
279
280         /* Setup a pci_window for each device resource. */
281         for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
282                 if (pci_addrs[i] == -1)
283                         continue;
284
285                 new_window[idx].offset = dev->resource[i].start - pci_addrs[i];
286                 new_window[idx].resource = dev->resource[i];
287                 idx++;
288         }
289
290         controller->windows = new_count;
291         controller->window = new_window;
292 }
293
294 void sn_pci_unfixup_slot(struct pci_dev *dev)
295 {
296         struct pci_dev *host_pci_dev = SN_PCIDEV_INFO(dev)->host_pci_dev;
297
298         sn_irq_unfixup(dev);
299         pci_dev_put(host_pci_dev);
300         pci_dev_put(dev);
301 }
302
303 /*
304  * sn_pci_fixup_slot() - This routine sets up a slot's resources
305  * consistent with the Linux PCI abstraction layer.  Resources acquired
306  * from our PCI provider include PIO maps to BAR space and interrupt
307  * objects.
308  */
309 void sn_pci_fixup_slot(struct pci_dev *dev)
310 {
311         unsigned int count = 0;
312         int idx;
313         int segment = pci_domain_nr(dev->bus);
314         int status = 0;
315         struct pcibus_bussoft *bs;
316         struct pci_bus *host_pci_bus;
317         struct pci_dev *host_pci_dev;
318         struct pcidev_info *pcidev_info;
319         int64_t pci_addrs[PCI_ROM_RESOURCE + 1];
320         struct sn_irq_info *sn_irq_info;
321         unsigned long size;
322         unsigned int bus_no, devfn;
323
324         pci_dev_get(dev); /* for the sysdata pointer */
325         pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL);
326         if (pcidev_info <= 0)
327                 BUG();          /* Cannot afford to run out of memory */
328
329         sn_irq_info = kmalloc(sizeof(struct sn_irq_info), GFP_KERNEL);
330         if (sn_irq_info <= 0)
331                 BUG();          /* Cannot afford to run out of memory */
332         memset(sn_irq_info, 0, sizeof(struct sn_irq_info));
333
334         /* Call to retrieve pci device information needed by kernel. */
335         status = sal_get_pcidev_info((u64) segment, (u64) dev->bus->number, 
336                                      dev->devfn,
337                                      (u64) __pa(pcidev_info),
338                                      (u64) __pa(sn_irq_info));
339         if (status)
340                 BUG(); /* Cannot get platform pci device information */
341
342         /* Add pcidev_info to list in sn_pci_controller struct */
343         list_add_tail(&pcidev_info->pdi_list,
344                       &(SN_PCI_CONTROLLER(dev->bus)->pcidev_info));
345
346         /* Copy over PIO Mapped Addresses */
347         for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) {
348                 unsigned long start, end, addr;
349
350                 if (!pcidev_info->pdi_pio_mapped_addr[idx]) {
351                         pci_addrs[idx] = -1;
352                         continue;
353                 }
354
355                 start = dev->resource[idx].start;
356                 end = dev->resource[idx].end;
357                 size = end - start;
358                 if (size == 0) {
359                         pci_addrs[idx] = -1;
360                         continue;
361                 }
362                 pci_addrs[idx] = start;
363                 count++;
364                 addr = pcidev_info->pdi_pio_mapped_addr[idx];
365                 addr = ((addr << 4) >> 4) | __IA64_UNCACHED_OFFSET;
366                 dev->resource[idx].start = addr;
367                 dev->resource[idx].end = addr + size;
368                 if (dev->resource[idx].flags & IORESOURCE_IO)
369                         dev->resource[idx].parent = &ioport_resource;
370                 else
371                         dev->resource[idx].parent = &iomem_resource;
372         }
373         /* Create a pci_window in the pci_controller struct for
374          * each device resource.
375          */
376         if (count > 0)
377                 sn_pci_window_fixup(dev, count, pci_addrs);
378
379         /*
380          * Using the PROMs values for the PCI host bus, get the Linux
381          * PCI host_pci_dev struct and set up host bus linkages
382          */
383
384         bus_no = (pcidev_info->pdi_slot_host_handle >> 32) & 0xff;
385         devfn = pcidev_info->pdi_slot_host_handle & 0xffffffff;
386         host_pci_bus = pci_find_bus(segment, bus_no);
387         host_pci_dev = pci_get_slot(host_pci_bus, devfn);
388
389         pcidev_info->host_pci_dev = host_pci_dev;
390         pcidev_info->pdi_linux_pcidev = dev;
391         pcidev_info->pdi_host_pcidev_info = SN_PCIDEV_INFO(host_pci_dev);
392         bs = SN_PCIBUS_BUSSOFT(dev->bus);
393         pcidev_info->pdi_pcibus_info = bs;
394
395         if (bs && bs->bs_asic_type < PCIIO_ASIC_MAX_TYPES) {
396                 SN_PCIDEV_BUSPROVIDER(dev) = sn_pci_provider[bs->bs_asic_type];
397         } else {
398                 SN_PCIDEV_BUSPROVIDER(dev) = &sn_pci_default_provider;
399         }
400
401         /* Only set up IRQ stuff if this device has a host bus context */
402         if (bs && sn_irq_info->irq_irq) {
403                 pcidev_info->pdi_sn_irq_info = sn_irq_info;
404                 dev->irq = pcidev_info->pdi_sn_irq_info->irq_irq;
405                 sn_irq_fixup(dev, sn_irq_info);
406         } else {
407                 pcidev_info->pdi_sn_irq_info = NULL;
408                 kfree(sn_irq_info);
409         }
410 }
411
412 /*
413  * sn_pci_controller_fixup() - This routine sets up a bus's resources
414  * consistent with the Linux PCI abstraction layer.
415  */
416 void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
417 {
418         int status = 0;
419         int nasid, cnode;
420         struct pci_controller *controller;
421         struct sn_pci_controller *sn_controller;
422         struct pcibus_bussoft *prom_bussoft_ptr;
423         struct hubdev_info *hubdev_info;
424         void *provider_soft = NULL;
425         struct sn_pcibus_provider *provider;
426
427         status = sal_get_pcibus_info((u64) segment, (u64) busnum,
428                                      (u64) ia64_tpa(&prom_bussoft_ptr));
429         if (status > 0)
430                 return;         /*bus # does not exist */
431         prom_bussoft_ptr = __va(prom_bussoft_ptr);
432
433         /* Allocate a sn_pci_controller, which has a pci_controller struct
434          * as the first member.
435          */
436         sn_controller = kzalloc(sizeof(struct sn_pci_controller), GFP_KERNEL);
437         if (!sn_controller)
438                 BUG();
439         INIT_LIST_HEAD(&sn_controller->pcidev_info);
440         controller = &sn_controller->pci_controller;
441         controller->segment = segment;
442
443         if (bus == NULL) {
444                 bus = pci_scan_bus(busnum, &pci_root_ops, controller);
445                 if (bus == NULL)
446                         goto error_return; /* error, or bus already scanned */
447                 bus->sysdata = NULL;
448         }
449
450         if (bus->sysdata)
451                 goto error_return; /* sysdata already alloc'd */
452
453         /*
454          * Per-provider fixup.  Copies the contents from prom to local
455          * area and links SN_PCIBUS_BUSSOFT().
456          */
457
458         if (prom_bussoft_ptr->bs_asic_type >= PCIIO_ASIC_MAX_TYPES)
459                 goto error_return; /* unsupported asic type */
460
461         if (prom_bussoft_ptr->bs_asic_type == PCIIO_ASIC_TYPE_PPB)
462                 goto error_return; /* no further fixup necessary */
463
464         provider = sn_pci_provider[prom_bussoft_ptr->bs_asic_type];
465         if (provider == NULL)
466                 goto error_return; /* no provider registerd for this asic */
467
468         bus->sysdata = controller;
469         if (provider->bus_fixup)
470                 provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr, controller);
471
472         if (provider_soft == NULL) {
473                 /* fixup failed or not applicable */
474                 bus->sysdata = NULL;
475                 goto error_return;
476         }
477
478         /*
479          * Setup pci_windows for legacy IO and MEM space.
480          * (Temporary until ACPI support is in place.)
481          */
482         controller->window = kcalloc(2, sizeof(struct pci_window), GFP_KERNEL);
483         if (controller->window == NULL)
484                 BUG();
485         controller->window[0].offset = prom_bussoft_ptr->bs_legacy_io;
486         controller->window[0].resource.name = "legacy_io";
487         controller->window[0].resource.flags = IORESOURCE_IO;
488         controller->window[0].resource.start = prom_bussoft_ptr->bs_legacy_io;
489         controller->window[0].resource.end =
490             controller->window[0].resource.start + 0xffff;
491         controller->window[0].resource.parent = &ioport_resource;
492         controller->window[1].offset = prom_bussoft_ptr->bs_legacy_mem;
493         controller->window[1].resource.name = "legacy_mem";
494         controller->window[1].resource.flags = IORESOURCE_MEM;
495         controller->window[1].resource.start = prom_bussoft_ptr->bs_legacy_mem;
496         controller->window[1].resource.end =
497             controller->window[1].resource.start + (1024 * 1024) - 1;
498         controller->window[1].resource.parent = &iomem_resource;
499         controller->windows = 2;
500
501         /*
502          * Generic bus fixup goes here.  Don't reference prom_bussoft_ptr
503          * after this point.
504          */
505
506         PCI_CONTROLLER(bus)->platform_data = provider_soft;
507         nasid = NASID_GET(SN_PCIBUS_BUSSOFT(bus)->bs_base);
508         cnode = nasid_to_cnodeid(nasid);
509         hubdev_info = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo);
510         SN_PCIBUS_BUSSOFT(bus)->bs_xwidget_info =
511             &(hubdev_info->hdi_xwidget_info[SN_PCIBUS_BUSSOFT(bus)->bs_xid]);
512
513         /*
514          * If the node information we obtained during the fixup phase is invalid
515          * then set controller->node to -1 (undetermined)
516          */
517         if (controller->node >= num_online_nodes()) {
518                 struct pcibus_bussoft *b = SN_PCIBUS_BUSSOFT(bus);
519
520                 printk(KERN_WARNING "Device ASIC=%u XID=%u PBUSNUM=%u"
521                                     "L_IO=%lx L_MEM=%lx BASE=%lx\n",
522                         b->bs_asic_type, b->bs_xid, b->bs_persist_busnum,
523                         b->bs_legacy_io, b->bs_legacy_mem, b->bs_base);
524                 printk(KERN_WARNING "on node %d but only %d nodes online."
525                         "Association set to undetermined.\n",
526                         controller->node, num_online_nodes());
527                 controller->node = -1;
528         }
529         return;
530
531 error_return:
532
533         kfree(sn_controller);
534         return;
535 }
536
537 void sn_bus_store_sysdata(struct pci_dev *dev)
538 {
539         struct sysdata_el *element;
540
541         element = kzalloc(sizeof(struct sysdata_el), GFP_KERNEL);
542         if (!element) {
543                 dev_dbg(dev, "%s: out of memory!\n", __FUNCTION__);
544                 return;
545         }
546         element->sysdata = SN_PCIDEV_INFO(dev);
547         list_add(&element->entry, &sn_sysdata_list);
548 }
549
550 void sn_bus_free_sysdata(void)
551 {
552         struct sysdata_el *element;
553         struct list_head *list;
554
555 sn_sysdata_free_start:
556         list_for_each(list, &sn_sysdata_list) {
557                 element = list_entry(list, struct sysdata_el, entry);
558                 list_del(&element->entry);
559                 kfree(element->sysdata);
560                 kfree(element);
561                 goto sn_sysdata_free_start;
562         }
563         return;
564 }
565
566 /*
567  * Ugly hack to get PCI setup until we have a proper ACPI namespace.
568  */
569
570 #define PCI_BUSES_TO_SCAN 256
571
572 static int __init sn_pci_init(void)
573 {
574         int i = 0;
575         int j = 0;
576         struct pci_dev *pci_dev = NULL;
577         extern void sn_init_cpei_timer(void);
578 #ifdef CONFIG_PROC_FS
579         extern void register_sn_procfs(void);
580 #endif
581
582         if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM())
583                 return 0;
584
585         /*
586          * prime sn_pci_provider[].  Individial provider init routines will
587          * override their respective default entries.
588          */
589
590         for (i = 0; i < PCIIO_ASIC_MAX_TYPES; i++)
591                 sn_pci_provider[i] = &sn_pci_default_provider;
592
593         pcibr_init_provider();
594         tioca_init_provider();
595         tioce_init_provider();
596
597         /*
598          * This is needed to avoid bounce limit checks in the blk layer
599          */
600         ia64_max_iommu_merge_mask = ~PAGE_MASK;
601         sn_fixup_ionodes();
602         sn_irq_lh_init();
603         INIT_LIST_HEAD(&sn_sysdata_list);
604         sn_init_cpei_timer();
605
606 #ifdef CONFIG_PROC_FS
607         register_sn_procfs();
608 #endif
609
610         /* busses are not known yet ... */
611         for (i = 0; i <= max_segment_number; i++)
612                 for (j = 0; j <= max_pcibus_number; j++)
613                         sn_pci_controller_fixup(i, j, NULL);
614
615         /*
616          * Generic Linux PCI Layer has created the pci_bus and pci_dev 
617          * structures - time for us to add our SN PLatform specific 
618          * information.
619          */
620
621         while ((pci_dev =
622                 pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) != NULL)
623                 sn_pci_fixup_slot(pci_dev);
624
625         sn_ioif_inited = 1;     /* sn I/O infrastructure now initialized */
626
627         return 0;
628 }
629
630 /*
631  * hubdev_init_node() - Creates the HUB data structure and link them to it's 
632  *      own NODE specific data area.
633  */
634 void hubdev_init_node(nodepda_t * npda, cnodeid_t node)
635 {
636
637         struct hubdev_info *hubdev_info;
638
639         if (node >= num_online_nodes()) /* Headless/memless IO nodes */
640                 hubdev_info =
641                     (struct hubdev_info *)alloc_bootmem_node(NODE_DATA(0),
642                                                              sizeof(struct
643                                                                     hubdev_info));
644         else
645                 hubdev_info =
646                     (struct hubdev_info *)alloc_bootmem_node(NODE_DATA(node),
647                                                              sizeof(struct
648                                                                     hubdev_info));
649         npda->pdinfo = (void *)hubdev_info;
650
651 }
652
653 geoid_t
654 cnodeid_get_geoid(cnodeid_t cnode)
655 {
656
657         struct hubdev_info *hubdev;
658
659         hubdev = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo);
660         return hubdev->hdi_geoid;
661
662 }
663
664 subsys_initcall(sn_pci_init);
665 EXPORT_SYMBOL(sn_pci_fixup_slot);
666 EXPORT_SYMBOL(sn_pci_unfixup_slot);
667 EXPORT_SYMBOL(sn_pci_controller_fixup);
668 EXPORT_SYMBOL(sn_bus_store_sysdata);
669 EXPORT_SYMBOL(sn_bus_free_sysdata);