diff options
Diffstat (limited to 'arch/ia64/sn/kernel/io_common.c')
-rw-r--r-- | arch/ia64/sn/kernel/io_common.c | 90 |
1 files changed, 26 insertions, 64 deletions
diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c index d4dd8f4b6b8d..d48bcd83253c 100644 --- a/arch/ia64/sn/kernel/io_common.c +++ b/arch/ia64/sn/kernel/io_common.c | |||
@@ -26,14 +26,10 @@ | |||
26 | #include <linux/acpi.h> | 26 | #include <linux/acpi.h> |
27 | #include <asm/sn/sn2/sn_hwperf.h> | 27 | #include <asm/sn/sn2/sn_hwperf.h> |
28 | #include <asm/sn/acpi.h> | 28 | #include <asm/sn/acpi.h> |
29 | #include "acpi/acglobal.h" | ||
29 | 30 | ||
30 | extern void sn_init_cpei_timer(void); | 31 | extern void sn_init_cpei_timer(void); |
31 | extern void register_sn_procfs(void); | 32 | extern void register_sn_procfs(void); |
32 | extern void sn_acpi_bus_fixup(struct pci_bus *); | ||
33 | extern void sn_bus_fixup(struct pci_bus *); | ||
34 | extern void sn_acpi_slot_fixup(struct pci_dev *, struct pcidev_info *); | ||
35 | extern void sn_more_slot_fixup(struct pci_dev *, struct pcidev_info *); | ||
36 | extern void sn_legacy_pci_window_fixup(struct pci_controller *, u64, u64); | ||
37 | extern void sn_io_acpi_init(void); | 33 | extern void sn_io_acpi_init(void); |
38 | extern void sn_io_init(void); | 34 | extern void sn_io_init(void); |
39 | 35 | ||
@@ -48,6 +44,9 @@ struct sysdata_el { | |||
48 | 44 | ||
49 | int sn_ioif_inited; /* SN I/O infrastructure initialized? */ | 45 | int sn_ioif_inited; /* SN I/O infrastructure initialized? */ |
50 | 46 | ||
47 | int sn_acpi_rev; /* SN ACPI revision */ | ||
48 | EXPORT_SYMBOL_GPL(sn_acpi_rev); | ||
49 | |||
51 | struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES]; /* indexed by asic type */ | 50 | struct sn_pcibus_provider *sn_pci_provider[PCIIO_ASIC_MAX_TYPES]; /* indexed by asic type */ |
52 | 51 | ||
53 | /* | 52 | /* |
@@ -99,25 +98,6 @@ sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num, | |||
99 | } | 98 | } |
100 | 99 | ||
101 | /* | 100 | /* |
102 | * Retrieve the pci device information given the bus and device|function number. | ||
103 | */ | ||
104 | static inline u64 | ||
105 | sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev, | ||
106 | u64 sn_irq_info) | ||
107 | { | ||
108 | struct ia64_sal_retval ret_stuff; | ||
109 | ret_stuff.status = 0; | ||
110 | ret_stuff.v0 = 0; | ||
111 | |||
112 | SAL_CALL_NOLOCK(ret_stuff, | ||
113 | (u64) SN_SAL_IOIF_GET_PCIDEV_INFO, | ||
114 | (u64) segment, (u64) bus_number, (u64) devfn, | ||
115 | (u64) pci_dev, | ||
116 | sn_irq_info, 0, 0); | ||
117 | return ret_stuff.v0; | ||
118 | } | ||
119 | |||
120 | /* | ||
121 | * sn_pcidev_info_get() - Retrieve the pcidev_info struct for the specified | 101 | * sn_pcidev_info_get() - Retrieve the pcidev_info struct for the specified |
122 | * device. | 102 | * device. |
123 | */ | 103 | */ |
@@ -249,50 +229,25 @@ void sn_pci_unfixup_slot(struct pci_dev *dev) | |||
249 | } | 229 | } |
250 | 230 | ||
251 | /* | 231 | /* |
252 | * sn_pci_fixup_slot() - This routine sets up a slot's resources consistent | 232 | * sn_pci_fixup_slot() |
253 | * with the Linux PCI abstraction layer. Resources | ||
254 | * acquired from our PCI provider include PIO maps | ||
255 | * to BAR space and interrupt objects. | ||
256 | */ | 233 | */ |
257 | void sn_pci_fixup_slot(struct pci_dev *dev) | 234 | void sn_pci_fixup_slot(struct pci_dev *dev, struct pcidev_info *pcidev_info, |
235 | struct sn_irq_info *sn_irq_info) | ||
258 | { | 236 | { |
259 | int segment = pci_domain_nr(dev->bus); | 237 | int segment = pci_domain_nr(dev->bus); |
260 | int status = 0; | ||
261 | struct pcibus_bussoft *bs; | 238 | struct pcibus_bussoft *bs; |
262 | struct pci_bus *host_pci_bus; | 239 | struct pci_bus *host_pci_bus; |
263 | struct pci_dev *host_pci_dev; | 240 | struct pci_dev *host_pci_dev; |
264 | struct pcidev_info *pcidev_info; | 241 | unsigned int bus_no, devfn; |
265 | struct sn_irq_info *sn_irq_info; | ||
266 | unsigned int bus_no, devfn; | ||
267 | 242 | ||
268 | pci_dev_get(dev); /* for the sysdata pointer */ | 243 | pci_dev_get(dev); /* for the sysdata pointer */ |
269 | pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL); | ||
270 | if (!pcidev_info) | ||
271 | BUG(); /* Cannot afford to run out of memory */ | ||
272 | |||
273 | sn_irq_info = kzalloc(sizeof(struct sn_irq_info), GFP_KERNEL); | ||
274 | if (!sn_irq_info) | ||
275 | BUG(); /* Cannot afford to run out of memory */ | ||
276 | |||
277 | /* Call to retrieve pci device information needed by kernel. */ | ||
278 | status = sal_get_pcidev_info((u64) segment, (u64) dev->bus->number, | ||
279 | dev->devfn, | ||
280 | (u64) __pa(pcidev_info), | ||
281 | (u64) __pa(sn_irq_info)); | ||
282 | if (status) | ||
283 | BUG(); /* Cannot get platform pci device information */ | ||
284 | 244 | ||
285 | /* Add pcidev_info to list in pci_controller.platform_data */ | 245 | /* Add pcidev_info to list in pci_controller.platform_data */ |
286 | list_add_tail(&pcidev_info->pdi_list, | 246 | list_add_tail(&pcidev_info->pdi_list, |
287 | &(SN_PLATFORM_DATA(dev->bus)->pcidev_info)); | 247 | &(SN_PLATFORM_DATA(dev->bus)->pcidev_info)); |
288 | |||
289 | if (SN_ACPI_BASE_SUPPORT()) | ||
290 | sn_acpi_slot_fixup(dev, pcidev_info); | ||
291 | else | ||
292 | sn_more_slot_fixup(dev, pcidev_info); | ||
293 | /* | 248 | /* |
294 | * Using the PROMs values for the PCI host bus, get the Linux | 249 | * Using the PROMs values for the PCI host bus, get the Linux |
295 | * PCI host_pci_dev struct and set up host bus linkages | 250 | * PCI host_pci_dev struct and set up host bus linkages |
296 | */ | 251 | */ |
297 | 252 | ||
298 | bus_no = (pcidev_info->pdi_slot_host_handle >> 32) & 0xff; | 253 | bus_no = (pcidev_info->pdi_slot_host_handle >> 32) & 0xff; |
@@ -489,11 +444,6 @@ void sn_generate_path(struct pci_bus *pci_bus, char *address) | |||
489 | sprintf(address, "%s^%d", address, geo_slot(geoid)); | 444 | sprintf(address, "%s^%d", address, geo_slot(geoid)); |
490 | } | 445 | } |
491 | 446 | ||
492 | /* | ||
493 | * sn_pci_fixup_bus() - Perform SN specific setup of software structs | ||
494 | * (pcibus_bussoft, pcidev_info) and hardware | ||
495 | * registers, for the specified bus and devices under it. | ||
496 | */ | ||
497 | void __devinit | 447 | void __devinit |
498 | sn_pci_fixup_bus(struct pci_bus *bus) | 448 | sn_pci_fixup_bus(struct pci_bus *bus) |
499 | { | 449 | { |
@@ -519,6 +469,15 @@ sn_io_early_init(void) | |||
519 | if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM()) | 469 | if (!ia64_platform_is("sn2") || IS_RUNNING_ON_FAKE_PROM()) |
520 | return 0; | 470 | return 0; |
521 | 471 | ||
472 | /* we set the acpi revision to that of the DSDT table OEM rev. */ | ||
473 | { | ||
474 | struct acpi_table_header *header = NULL; | ||
475 | |||
476 | acpi_get_table_by_index(ACPI_TABLE_INDEX_DSDT, &header); | ||
477 | BUG_ON(header == NULL); | ||
478 | sn_acpi_rev = header->oem_revision; | ||
479 | } | ||
480 | |||
522 | /* | 481 | /* |
523 | * prime sn_pci_provider[]. Individial provider init routines will | 482 | * prime sn_pci_provider[]. Individial provider init routines will |
524 | * override their respective default entries. | 483 | * override their respective default entries. |
@@ -544,8 +503,12 @@ sn_io_early_init(void) | |||
544 | register_sn_procfs(); | 503 | register_sn_procfs(); |
545 | #endif | 504 | #endif |
546 | 505 | ||
547 | printk(KERN_INFO "ACPI DSDT OEM Rev 0x%x\n", | 506 | { |
548 | acpi_gbl_DSDT->oem_revision); | 507 | struct acpi_table_header *header; |
508 | (void)acpi_get_table_by_index(ACPI_TABLE_INDEX_DSDT, &header); | ||
509 | printk(KERN_INFO "ACPI DSDT OEM Rev 0x%x\n", | ||
510 | header->oem_revision); | ||
511 | } | ||
549 | if (SN_ACPI_BASE_SUPPORT()) | 512 | if (SN_ACPI_BASE_SUPPORT()) |
550 | sn_io_acpi_init(); | 513 | sn_io_acpi_init(); |
551 | else | 514 | else |
@@ -605,7 +568,6 @@ sn_io_late_init(void) | |||
605 | 568 | ||
606 | fs_initcall(sn_io_late_init); | 569 | fs_initcall(sn_io_late_init); |
607 | 570 | ||
608 | EXPORT_SYMBOL(sn_pci_fixup_slot); | ||
609 | EXPORT_SYMBOL(sn_pci_unfixup_slot); | 571 | EXPORT_SYMBOL(sn_pci_unfixup_slot); |
610 | EXPORT_SYMBOL(sn_bus_store_sysdata); | 572 | EXPORT_SYMBOL(sn_bus_store_sysdata); |
611 | EXPORT_SYMBOL(sn_bus_free_sysdata); | 573 | EXPORT_SYMBOL(sn_bus_free_sysdata); |