diff options
Diffstat (limited to 'arch/ia64/sn/kernel/io_init.c')
-rw-r--r-- | arch/ia64/sn/kernel/io_init.c | 97 |
1 files changed, 40 insertions, 57 deletions
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c index 3437c2390429..3edef0d32f86 100644 --- a/arch/ia64/sn/kernel/io_init.c +++ b/arch/ia64/sn/kernel/io_init.c | |||
@@ -23,6 +23,10 @@ | |||
23 | #include "xtalk/hubdev.h" | 23 | #include "xtalk/hubdev.h" |
24 | #include "xtalk/xwidgetdev.h" | 24 | #include "xtalk/xwidgetdev.h" |
25 | 25 | ||
26 | |||
27 | extern void sn_init_cpei_timer(void); | ||
28 | extern void register_sn_procfs(void); | ||
29 | |||
26 | static struct list_head sn_sysdata_list; | 30 | static struct list_head sn_sysdata_list; |
27 | 31 | ||
28 | /* sysdata list struct */ | 32 | /* sysdata list struct */ |
@@ -40,12 +44,12 @@ struct brick { | |||
40 | struct slab_info slab_info[MAX_SLABS + 1]; | 44 | struct slab_info slab_info[MAX_SLABS + 1]; |
41 | }; | 45 | }; |
42 | 46 | ||
43 | int sn_ioif_inited = 0; /* SN I/O infrastructure initialized? */ | 47 | int sn_ioif_inited; /* SN I/O infrastructure initialized? */ |
44 | 48 | ||
45 | struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES]; /* indexed by asic type */ | 49 | struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES]; /* indexed by asic type */ |
46 | 50 | ||
47 | static int max_segment_number = 0; /* Default highest segment number */ | 51 | static int max_segment_number; /* Default highest segment number */ |
48 | static int max_pcibus_number = 255; /* Default highest pci bus number */ | 52 | static int max_pcibus_number = 255; /* Default highest pci bus number */ |
49 | 53 | ||
50 | /* | 54 | /* |
51 | * Hooks and struct for unsupported pci providers | 55 | * Hooks and struct for unsupported pci providers |
@@ -84,7 +88,6 @@ static inline u64 | |||
84 | sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num, | 88 | sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num, |
85 | u64 address) | 89 | u64 address) |
86 | { | 90 | { |
87 | |||
88 | struct ia64_sal_retval ret_stuff; | 91 | struct ia64_sal_retval ret_stuff; |
89 | ret_stuff.status = 0; | 92 | ret_stuff.status = 0; |
90 | ret_stuff.v0 = 0; | 93 | ret_stuff.v0 = 0; |
@@ -94,7 +97,6 @@ sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num, | |||
94 | (u64) nasid, (u64) widget_num, | 97 | (u64) nasid, (u64) widget_num, |
95 | (u64) device_num, (u64) address, 0, 0, 0); | 98 | (u64) device_num, (u64) address, 0, 0, 0); |
96 | return ret_stuff.status; | 99 | return ret_stuff.status; |
97 | |||
98 | } | 100 | } |
99 | 101 | ||
100 | /* | 102 | /* |
@@ -102,7 +104,6 @@ sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num, | |||
102 | */ | 104 | */ |
103 | static inline u64 sal_get_hubdev_info(u64 handle, u64 address) | 105 | static inline u64 sal_get_hubdev_info(u64 handle, u64 address) |
104 | { | 106 | { |
105 | |||
106 | struct ia64_sal_retval ret_stuff; | 107 | struct ia64_sal_retval ret_stuff; |
107 | ret_stuff.status = 0; | 108 | ret_stuff.status = 0; |
108 | ret_stuff.v0 = 0; | 109 | ret_stuff.v0 = 0; |
@@ -118,7 +119,6 @@ static inline u64 sal_get_hubdev_info(u64 handle, u64 address) | |||
118 | */ | 119 | */ |
119 | static inline u64 sal_get_pcibus_info(u64 segment, u64 busnum, u64 address) | 120 | static inline u64 sal_get_pcibus_info(u64 segment, u64 busnum, u64 address) |
120 | { | 121 | { |
121 | |||
122 | struct ia64_sal_retval ret_stuff; | 122 | struct ia64_sal_retval ret_stuff; |
123 | ret_stuff.status = 0; | 123 | ret_stuff.status = 0; |
124 | ret_stuff.v0 = 0; | 124 | ret_stuff.v0 = 0; |
@@ -215,7 +215,7 @@ static void __init sn_fixup_ionodes(void) | |||
215 | struct hubdev_info *hubdev; | 215 | struct hubdev_info *hubdev; |
216 | u64 status; | 216 | u64 status; |
217 | u64 nasid; | 217 | u64 nasid; |
218 | int i, widget, device; | 218 | int i, widget, device, size; |
219 | 219 | ||
220 | /* | 220 | /* |
221 | * Get SGI Specific HUB chipset information. | 221 | * Get SGI Specific HUB chipset information. |
@@ -251,48 +251,37 @@ static void __init sn_fixup_ionodes(void) | |||
251 | if (!hubdev->hdi_flush_nasid_list.widget_p) | 251 | if (!hubdev->hdi_flush_nasid_list.widget_p) |
252 | continue; | 252 | continue; |
253 | 253 | ||
254 | size = (HUB_WIDGET_ID_MAX + 1) * | ||
255 | sizeof(struct sn_flush_device_kernel *); | ||
254 | hubdev->hdi_flush_nasid_list.widget_p = | 256 | hubdev->hdi_flush_nasid_list.widget_p = |
255 | kmalloc((HUB_WIDGET_ID_MAX + 1) * | 257 | kzalloc(size, GFP_KERNEL); |
256 | sizeof(struct sn_flush_device_kernel *), | 258 | if (!hubdev->hdi_flush_nasid_list.widget_p) |
257 | GFP_KERNEL); | 259 | BUG(); |
258 | memset(hubdev->hdi_flush_nasid_list.widget_p, 0x0, | ||
259 | (HUB_WIDGET_ID_MAX + 1) * | ||
260 | sizeof(struct sn_flush_device_kernel *)); | ||
261 | 260 | ||
262 | for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) { | 261 | for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) { |
263 | sn_flush_device_kernel = kmalloc(DEV_PER_WIDGET * | 262 | size = DEV_PER_WIDGET * |
264 | sizeof(struct | 263 | sizeof(struct sn_flush_device_kernel); |
265 | sn_flush_device_kernel), | 264 | sn_flush_device_kernel = kzalloc(size, GFP_KERNEL); |
266 | GFP_KERNEL); | ||
267 | if (!sn_flush_device_kernel) | 265 | if (!sn_flush_device_kernel) |
268 | BUG(); | 266 | BUG(); |
269 | memset(sn_flush_device_kernel, 0x0, | ||
270 | DEV_PER_WIDGET * | ||
271 | sizeof(struct sn_flush_device_kernel)); | ||
272 | 267 | ||
273 | dev_entry = sn_flush_device_kernel; | 268 | dev_entry = sn_flush_device_kernel; |
274 | for (device = 0; device < DEV_PER_WIDGET; | 269 | for (device = 0; device < DEV_PER_WIDGET; |
275 | device++,dev_entry++) { | 270 | device++,dev_entry++) { |
276 | dev_entry->common = kmalloc(sizeof(struct | 271 | size = sizeof(struct sn_flush_device_common); |
277 | sn_flush_device_common), | 272 | dev_entry->common = kzalloc(size, GFP_KERNEL); |
278 | GFP_KERNEL); | ||
279 | if (!dev_entry->common) | 273 | if (!dev_entry->common) |
280 | BUG(); | 274 | BUG(); |
281 | memset(dev_entry->common, 0x0, sizeof(struct | ||
282 | sn_flush_device_common)); | ||
283 | 275 | ||
284 | if (sn_prom_feature_available( | 276 | if (sn_prom_feature_available( |
285 | PRF_DEVICE_FLUSH_LIST)) | 277 | PRF_DEVICE_FLUSH_LIST)) |
286 | status = sal_get_device_dmaflush_list( | 278 | status = sal_get_device_dmaflush_list( |
287 | nasid, | 279 | nasid, widget, device, |
288 | widget, | 280 | (u64)(dev_entry->common)); |
289 | device, | ||
290 | (u64)(dev_entry->common)); | ||
291 | else | 281 | else |
292 | status = sn_device_fixup_war(nasid, | 282 | status = sn_device_fixup_war(nasid, |
293 | widget, | 283 | widget, device, |
294 | device, | 284 | dev_entry->common); |
295 | dev_entry->common); | ||
296 | if (status != SALRET_OK) | 285 | if (status != SALRET_OK) |
297 | panic("SAL call failed: %s\n", | 286 | panic("SAL call failed: %s\n", |
298 | ia64_sal_strerror(status)); | 287 | ia64_sal_strerror(status)); |
@@ -383,13 +372,12 @@ void sn_pci_fixup_slot(struct pci_dev *dev) | |||
383 | 372 | ||
384 | pci_dev_get(dev); /* for the sysdata pointer */ | 373 | pci_dev_get(dev); /* for the sysdata pointer */ |
385 | pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL); | 374 | pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL); |
386 | if (pcidev_info <= 0) | 375 | if (!pcidev_info) |
387 | BUG(); /* Cannot afford to run out of memory */ | 376 | BUG(); /* Cannot afford to run out of memory */ |
388 | 377 | ||
389 | sn_irq_info = kmalloc(sizeof(struct sn_irq_info), GFP_KERNEL); | 378 | sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL); |
390 | if (sn_irq_info <= 0) | 379 | if (!sn_irq_info) |
391 | BUG(); /* Cannot afford to run out of memory */ | 380 | BUG(); /* Cannot afford to run out of memory */ |
392 | memset(sn_irq_info, 0, sizeof(struct sn_irq_info)); | ||
393 | 381 | ||
394 | /* Call to retrieve pci device information needed by kernel. */ | 382 | /* Call to retrieve pci device information needed by kernel. */ |
395 | status = sal_get_pcidev_info((u64) segment, (u64) dev->bus->number, | 383 | status = sal_get_pcidev_info((u64) segment, (u64) dev->bus->number, |
@@ -482,13 +470,13 @@ void sn_pci_fixup_slot(struct pci_dev *dev) | |||
482 | */ | 470 | */ |
483 | void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus) | 471 | void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus) |
484 | { | 472 | { |
485 | int status = 0; | 473 | int status; |
486 | int nasid, cnode; | 474 | int nasid, cnode; |
487 | struct pci_controller *controller; | 475 | struct pci_controller *controller; |
488 | struct sn_pci_controller *sn_controller; | 476 | struct sn_pci_controller *sn_controller; |
489 | struct pcibus_bussoft *prom_bussoft_ptr; | 477 | struct pcibus_bussoft *prom_bussoft_ptr; |
490 | struct hubdev_info *hubdev_info; | 478 | struct hubdev_info *hubdev_info; |
491 | void *provider_soft = NULL; | 479 | void *provider_soft; |
492 | struct sn_pcibus_provider *provider; | 480 | struct sn_pcibus_provider *provider; |
493 | 481 | ||
494 | status = sal_get_pcibus_info((u64) segment, (u64) busnum, | 482 | status = sal_get_pcibus_info((u64) segment, (u64) busnum, |
@@ -535,6 +523,8 @@ void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus) | |||
535 | bus->sysdata = controller; | 523 | bus->sysdata = controller; |
536 | if (provider->bus_fixup) | 524 | if (provider->bus_fixup) |
537 | provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr, controller); | 525 | provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr, controller); |
526 | else | ||
527 | provider_soft = NULL; | ||
538 | 528 | ||
539 | if (provider_soft == NULL) { | 529 | if (provider_soft == NULL) { |
540 | /* fixup failed or not applicable */ | 530 | /* fixup failed or not applicable */ |
@@ -638,13 +628,8 @@ void sn_bus_free_sysdata(void) | |||
638 | 628 | ||
639 | static int __init sn_pci_init(void) | 629 | static int __init sn_pci_init(void) |
640 | { | 630 | { |
641 | int i = 0; | 631 | int i, j; |
642 | int j = 0; | ||
643 | struct pci_dev *pci_dev = NULL; | 632 | 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 | ||
648 | 633 | ||
649 | if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM()) | 634 | if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM()) |
650 | return 0; | 635 | return 0; |
@@ -700,32 +685,29 @@ static int __init sn_pci_init(void) | |||
700 | */ | 685 | */ |
701 | void hubdev_init_node(nodepda_t * npda, cnodeid_t node) | 686 | void hubdev_init_node(nodepda_t * npda, cnodeid_t node) |
702 | { | 687 | { |
703 | |||
704 | struct hubdev_info *hubdev_info; | 688 | struct hubdev_info *hubdev_info; |
689 | int size; | ||
690 | pg_data_t *pg; | ||
691 | |||
692 | size = sizeof(struct hubdev_info); | ||
705 | 693 | ||
706 | if (node >= num_online_nodes()) /* Headless/memless IO nodes */ | 694 | if (node >= num_online_nodes()) /* Headless/memless IO nodes */ |
707 | hubdev_info = | 695 | pg = NODE_DATA(0); |
708 | (struct hubdev_info *)alloc_bootmem_node(NODE_DATA(0), | ||
709 | sizeof(struct | ||
710 | hubdev_info)); | ||
711 | else | 696 | else |
712 | hubdev_info = | 697 | pg = NODE_DATA(node); |
713 | (struct hubdev_info *)alloc_bootmem_node(NODE_DATA(node), | ||
714 | sizeof(struct | ||
715 | hubdev_info)); | ||
716 | npda->pdinfo = (void *)hubdev_info; | ||
717 | 698 | ||
699 | hubdev_info = (struct hubdev_info *)alloc_bootmem_node(pg, size); | ||
700 | |||
701 | npda->pdinfo = (void *)hubdev_info; | ||
718 | } | 702 | } |
719 | 703 | ||
720 | geoid_t | 704 | geoid_t |
721 | cnodeid_get_geoid(cnodeid_t cnode) | 705 | cnodeid_get_geoid(cnodeid_t cnode) |
722 | { | 706 | { |
723 | |||
724 | struct hubdev_info *hubdev; | 707 | struct hubdev_info *hubdev; |
725 | 708 | ||
726 | hubdev = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo); | 709 | hubdev = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo); |
727 | return hubdev->hdi_geoid; | 710 | return hubdev->hdi_geoid; |
728 | |||
729 | } | 711 | } |
730 | 712 | ||
731 | subsys_initcall(sn_pci_init); | 713 | subsys_initcall(sn_pci_init); |
@@ -734,3 +716,4 @@ EXPORT_SYMBOL(sn_pci_unfixup_slot); | |||
734 | EXPORT_SYMBOL(sn_pci_controller_fixup); | 716 | EXPORT_SYMBOL(sn_pci_controller_fixup); |
735 | EXPORT_SYMBOL(sn_bus_store_sysdata); | 717 | EXPORT_SYMBOL(sn_bus_store_sysdata); |
736 | EXPORT_SYMBOL(sn_bus_free_sysdata); | 718 | EXPORT_SYMBOL(sn_bus_free_sysdata); |
719 | EXPORT_SYMBOL(sn_pcidev_info_get); | ||