RESEND - SN: Add initial ACPI support
PATCH 1/1 RESEND - SN: Add initial ACPI support
resend #3
Changes made to correct alignment, white space, and coding style issues.
-------
First phase in introducing ACPI support to SN.
In this phase, when running with an ACPI capable PROM, the DSDT will define the root busses and all SN nodes (SGIHUB, SGITIO). An acpi bus driver will be registered for the node devices, with the acpi_pci_root_driver being used for the root busses. Platform specific info is passed via vendor descriptors, eliminating the corresponding SAL calls. SN fixup code no longer needs to initiate the pci bus scans, as the acpi_pci_root_driver takes care of that now.
To maintain backward compatibility with non-ACPI capable PROMs, none of the current 'fixup' code has been deleted.
arch/ia64/kernel/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-y := acpi.o entry.o efi.o efi_stub.o obj-$(CONFIG_IA64_BRL_EMU) += brl_emu.o obj-$(CONFIG_IA64_GENERIC) += acpi-ext.o +obj-$(CONFIG_IA64_SGI_SN2) += acpi-ext.o obj-$(CONFIG_IA64_HP_ZX1) += acpi-ext.o obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o obj-$(CONFIG_IA64_PALINFO) += palinfo.o
arch/ia64/sn/kernel/io_init.c +352 -122
588 lines not on this page · raw message
include/asm-ia64/sn/sn_sal.h +2 -1
@@ -8,7 +8,7 @@* License. See the file "COPYING" in the main directory of this archive * for more details. * -* Copyright (c) 2000-2005 Silicon Graphics, Inc. All rights reserved. +* Copyright (c) 2000-2006 Silicon Graphics, Inc. All rights reserved. */
@@ -78,6 +78,7 @@#define SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST 0x02000058 // deprecated#define SN_SAL_IOIF_GET_DEVICE_DMAFLUSH_LIST 0x0200005a +#define SN_SAL_IOIF_INIT 0x0200005f#define SN_SAL_HUB_ERROR_INTERRUPT 0x02000060#define SN_SAL_BTE_RECOVER 0x02000061#define SN_SAL_RESERVED_DO_NOT_USE 0x02000062
arch/ia64/sn/kernel/setup.c +9 -1
@@ -3,7 +3,7 @@* License. See the file "COPYING" in the main directory of this archive * for more details. * -* Copyright (C) 1999,2001-2005 Silicon Graphics, Inc. All rights reserved. +* Copyright (C) 1999,2001-2006 Silicon Graphics, Inc. All rights reserved. */ #include <linux/config.h>
@@ -389,6 +389,14 @@ void __init sn_setup(char **cmdline_p)ia64_sn_plat_set_error_handling_features ();// obsolete ia64_sn_set_os_feature (OSF_MCA_SLV_TO_OS_INIT_SLV );ia64_sn_set_os_feature (OSF_FEAT_LOG_SBES ); +/* +* Note: The calls to notify the PROM of ACPI and PCI Segment +* support must be done prior to acpi_load_tables(), as +* an ACPI capable PROM will rebuild the DSDT as result +* of the call. +*/ +ia64_sn_set_os_feature (OSF_PCISEGMENT_ENABLE ); +ia64_sn_set_os_feature (OSF_ACPI_ENABLE );#if defined(CONFIG_VT ) && defined(CONFIG_VGA_CONSOLE )
include/asm-ia64/sn/sn_feature_sets.h +6 -1
@@ -8,7 +8,7 @@* License. See the file "COPYING" in the main directory of this archive * for more details. * -* Copyright (c) 2005 Silicon Graphics, Inc. All rights reserved. +* Copyright (c) 2005-2006 Silicon Graphics, Inc. All rights reserved. */
@@ -50,8 +50,13 @@ extern int sn_prom_feature_available(int* Once enabled, a feature cannot be disabled. * * By default, features are disabled unless explicitly enabled. +* +* These defines must be kept in sync with the corresponding +* PROM definitions in feature_sets.h. */ #define OSF_MCA_SLV_TO_OS_INIT_SLV 0#define OSF_FEAT_LOG_SBES 1 +#define OSF_ACPI_ENABLE 2 +#define OSF_PCISEGMENT_ENABLE 3#endif /* _ASM_IA64_SN_FEATURE_SETS_H */
include/asm-ia64/sn/pcidev.h +9 -11
@@ -3,7 +3,7 @@* License. See the file "COPYING" in the main directory of this archive * for more details. * -* Copyright (C) 1992 - 1997, 2000-2005 Silicon Graphics, Inc. All rights reserved. +* Copyright (C) 1992 - 1997, 2000-2006 Silicon Graphics, Inc. All rights reserved. */ #ifndef _ASM_IA64_SN_PCI_PCIDEV_H#define _ASM_IA64_SN_PCI_PCIDEV_H
@@ -12,31 +12,29 @@/* * In ia64, pci_dev->sysdata must be a *pci_controller. To provide access to -* the pcidev_info structs for all devices under a controller, we extend the -* definition of pci_controller, via sn_pci_controller, to include a list -* of pcidev_info. +* the pcidev_info structs for all devices under a controller, we keep a +* list of pcidev_info under pci_controller->platform_data. */ -struct sn_pci_controller { -struct pci_controller pci_controller; +struct sn_platform_data { +void *provider_soft;struct list_head pcidev_info; }; -#define SN_PCI_CONTROLLER (dev) ((struct sn_pci_controller *) dev->sysdata) +#define SN_PLATFORM_DATA (busdev) \ + ((struct sn_platform_data *)(PCI_CONTROLLER(busdev)->platform_data))#define SN_PCIDEV_INFO (dev) sn_pcidev_info_get(dev) -#define SN_PCIBUS_BUSSOFT_INFO (pci_bus) \ - (struct pcibus_info *)((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data))/* * Given a pci_bus, return the sn pcibus_bussoft struct. Note that * this only works for root busses, not for busses represented by PPB's. */ #define SN_PCIBUS_BUSSOFT (pci_bus) \ - ((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data)) + ((struct pcibus_bussoft *)(SN_PLATFORM_DATA(pci_bus)->provider_soft))#define SN_PCIBUS_BUSSOFT_INFO (pci_bus) \ - (struct pcibus_info *)((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data)) + ((struct pcibus_info *)(SN_PLATFORM_DATA(pci_bus)->provider_soft))/* * Given a struct pci_dev, return the sn pcibus_bussoft struct. Note * that this is not equivalent to SN_PCIBUS_BUSSOFT(pci_dev->bus) due
arch/ia64/sn/kernel/tiocx.c +2 -2
@@ -3,7 +3,7 @@* License. See the file "COPYING" in the main directory of this archive * for more details. * -* Copyright (c) 2005 Silicon Graphics, Inc. All rights reserved. +* Copyright (c) 2005-2006 Silicon Graphics, Inc. All rights reserved. */ #include <linux/module.h>
@@ -548,7 +548,7 @@ static void __exit tiocx_exit(void)bus_unregister (&tiocx_bus_type); } -subsys_initcall (tiocx_init); +fs_initcall (tiocx_init);module_exit (tiocx_exit);/************************************************************************
Quoted 1 line · John Keller
+obj-$(CONFIG_IA64_SGI_SN2) += acpi-ext.o
Just FYI, this code is moving into drivers/acpi soon. Robert Moore might have made a trivial interface change when he integrated it into the ACPI CA. No big deal, basically acpi-ext.c was arch-independent and we moved it to generic code.
Quoted 1 line
+ *
sn_fixup_ionodes()- This routine initializes the HUB data strcuture for
s/strcuture/structure/
Quoted 5 lines
/*
- *sn_pci_controller_fixup()- This routine sets up a bus's resources
- * consistent with the Linux PCI abstraction layer.
+ *sn_common_bus_fixup()
*/
Nit: A comment that merely restates the function name is useless. Actually, it's worse than useless because it takes up space and requires maintenance.
Quoted 1 line
+void
sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
This function looks very much like pci_acpi_scan_root(). Is this the old, non-ACPI path?
arch/ia64/sn/kernel/io_init.c static int __init sn_pci_init(void) · line 665
Quoted 2 lines
arch/ia64/sn/kernel/io_init.c +2
-0+printk (KERN_INFO "ACPI DSDT OEM Rev 0x%x\n" , + acpi_gbl_DSDT->oem_revision);
Doesn't ACPI print something like this for you already? (I think it's KERN_DEBUG now, so usually not on the console, but still in dmesg.)
Quoted 10 lines
arch/ia64/sn/kernel/io_init.c +10
-0+static int __init +sn_io_fixup (void ) +{ +struct pci_bus *bus; +struct pci_dev *pci_dev =NULL ; +extern void sn_init_cpei_timer (void ); +#ifdef CONFIG_PROC_FS +extern void register_sn_procfs (void ); +#endif +
arch/ia64/sn/kernel/io_init.c EXPORT_SYMBOL(sn_pci_unfixup_slot); · line 863
Quoted 10 lines
arch/ia64/sn/kernel/io_init.c +10
-0+if (!ia64_platform_is ("sn2" ) ||IS_RUNNING_ON_FAKE_PROM ()) +return 0 ; + +/* Exit if running with old PROM without ACPI support */ +if (!SN_ACPI_BASE_SUPPORT ()) +return 0 ; + +sn_irq_lh_init (); +INIT_LIST_HEAD (&sn_sysdata_list); +sn_init_cpei_timer ();
Seems like a weird place to call sn_init_cpei_timer(). I guess I have no idea what the CPEI stuff is, but it looks like it *could* report platform errors other than PCI. And you probably want to call it even if you don't have ACPI support, don't you?
Quoted 9 lines
arch/ia64/sn/kernel/io_init.c +9
-0+ +#ifdef CONFIG_PROC_FS +register_sn_procfs (); +#endif + +/* +* Generic Linux PCI Layer has created the pci_bus and pci_dev +* structures - time for us to add our SN Platform specific +* information.
arch/ia64/sn/kernel/io_init.c EXPORT_SYMBOL(sn_pci_unfixup_slot); · line 882
Quoted 10 lines
arch/ia64/sn/kernel/io_init.c +10
-0+*/ + + bus =NULL ; +while ((bus =pci_find_next_bus (bus)) !=NULL ) +sn_pci_bus_fixup (bus); + +while ((pci_dev = +pci_find_device (PCI_ANY_ID ,PCI_ANY_ID , pci_dev)) !=NULL ) { +sn_pci_fixup_slot (pci_dev); + }
You're doing these fixups with an fs_initcall(). I think they should be done by hooking into pcibios_fixup_bus() (maybe we need a new platform vector or optional function pointer there; I think PPC has something like that already). The initcall scheme won't work if you hot-plug things.
Bjorn
Quoted 19 lines · John Keller
Quoted 1 line
+obj-$(CONFIG_IA64_SGI_SN2) += acpi-ext.o
Just FYI, this code is moving into
drivers/acpisoon. Robert Moore might have made a trivial interface change when he integrated it into the ACPI CA. No big deal, basicallyacpi-ext.cwas arch-independent and we moved it to generic code.Quoted 1 line
+ *
sn_fixup_ionodes()- This routine initializes the HUB data strcuture fors/strcuture/structure/
Quoted 5 lines
/*
- *sn_pci_controller_fixup()- This routine sets up a bus's resources
- * consistent with the Linux PCI abstraction layer.
+ *sn_common_bus_fixup()
*/
Quoted 3 lines
Nit: A comment that merely restates the function name is useless. Actually, it's worse than useless because it takes up space and requires maintenance.
Yeah, I agree, my mistake.
Quoted 11 lines
Quoted 2 lines
+void
sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)This function looks very much like
pci_acpi_scan_root(). Is this the old, non-ACPI path?arch/ia64/sn/kernel/io_init.c static int __init sn_pci_init(void) · line 665
Quoted 2 lines
arch/ia64/sn/kernel/io_init.c +2
-0+printk (KERN_INFO "ACPI DSDT OEM Rev 0x%x\n" , + acpi_gbl_DSDT->oem_revision);Doesn't ACPI print something like this for you already? (I think it's
KERN_DEBUGnow, so usually not on the console, but still in dmesg.)
I haven't seen it. If so, I'll remove this.
Quoted 18 lines
Quoted 18 lines
arch/ia64/sn/kernel/io_init.c +17
-0+static int __init +sn_io_fixup (void ) +{ +struct pci_bus *bus; +struct pci_dev *pci_dev =NULL ; +extern void sn_init_cpei_timer (void ); +#ifdef CONFIG_PROC_FS +extern void register_sn_procfs (void ); +#endif + +if (!ia64_platform_is ("sn2" ) ||IS_RUNNING_ON_FAKE_PROM ()) +return 0 ; + +/* Exit if running with old PROM without ACPI support */ +if (!SN_ACPI_BASE_SUPPORT ()) +return 0 ; +
Quoted 8 lines
arch/ia64/sn/kernel/io_init.c EXPORT_SYMBOL(sn_pci_unfixup_slot); · line 863
Quoted 3 lines
arch/ia64/sn/kernel/io_init.c +3
-0+sn_irq_lh_init (); +INIT_LIST_HEAD (&sn_sysdata_list); +sn_init_cpei_timer ();Seems like a weird place to call
sn_init_cpei_timer(). I guess I have no idea what the CPEI stuff is, but it looks like it *could* report platform errors other than PCI. And you probably want to call it even if you don't have ACPI support, don't you?
I'll look into what this call is all about. The current code is doing this in the io fixup path, and I just kept it in the new SN ACPI code path.
Quoted 18 lines
Quoted 18 lines
arch/ia64/sn/kernel/io_init.c +17
-0+ +#ifdef CONFIG_PROC_FS +register_sn_procfs (); +#endif + +/* +* Generic Linux PCI Layer has created the pci_bus and pci_dev +* structures - time for us to add our SN Platform specific +* information. +*/ + + bus =NULL ; +while ((bus =pci_find_next_bus (bus)) !=NULL ) +sn_pci_bus_fixup (bus); + +while ((pci_dev = +pci_find_device (PCI_ANY_ID ,PCI_ANY_ID , pci_dev)) !=NULL ) {
Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ sn_pci_fixup_slot(pci_dev); + }You're doing these fixups with an
fs_initcall(). I think they should be done by hooking intopcibios_fixup_bus()(maybe we need a new platform vector or optional function pointer there; I think PPC has something like that already). The initcall scheme won't work if you hot-plug things.
Is there a preferred way to do this (platform vector vs PPC way)? Or is there some way to register an ACPI driver to invoke this code? (I guess the acpi_pci_root_driver is already registered for the bridge.)
Quoted 8 lines
Bjorn
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Bjorn,
Just noticed that my last reply didn't respond to all your comments....
John
----
Quoted 8 lines · John Keller
Quoted 1 line
+obj-$(CONFIG_IA64_SGI_SN2) += acpi-ext.o
Just FYI, this code is moving into
drivers/acpisoon. Robert Moore might have made a trivial interface change when he integrated it into the ACPI CA. No big deal, basicallyacpi-ext.cwas arch-independent and we moved it to generic code.
Yes, I saw earlier discussions of this, and am aware it's coming soon, and I believe it is already in Len's acpica tree.
...
Quoted 5 lines
Quoted 2 lines
+void
sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)This function looks very much like
pci_acpi_scan_root(). Is this the old, non-ACPI path?
Correct. sn_pci_controller_fixup() is the old non-ACPI path.