- Altix: Add initial ACPI IO support
PATCH 1/3 - Altix: Add initial ACPI IO support
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. An ACPI vendor descriptor is now used to pass platform specific information for both nodes and busses, eliminating the need for the current SAL calls. Also, with ACPI support, SN fixup code is no longer needed to initiate the PCI bus scans, as the acpi_pci_root_driver does that.
However, to maintain backward compatibility with non-ACPI capable PROMs, none of the current 'fixup' code can been deleted, though much restructuring has been done. For example, the bulk of the code in io_common.c is relocated code that is now common regardless of what PROM is running, while io_acpi_init.c and io_init.c contain routines specific to an ACPI or non ACPI capable PROM respectively.
A new pci bus fixup platform vector has been created to provide a hook for invoking platform specific bus fixup from pcibios_fixup_bus().
The size of io_space[] has been increased to support systems with large IO configurations.
arch/ia64/pci/pci.c | 4 arch/ia64/sn/kernel/Makefile | 5 arch/ia64/sn/kernel/io_acpi_init.c | 198 ++++++++++ arch/ia64/sn/kernel/io_common.c | 612 +++++++++++++++++++++++++++++++ arch/ia64/sn/kernel/io_init.c | 626 +++++--------------------------- arch/ia64/sn/kernel/iomv.c | 11 arch/ia64/sn/kernel/setup.c | 18 arch/ia64/sn/kernel/tiocx.c | 2 arch/ia64/sn/pci/pcibr/pcibr_provider.c | 17 arch/ia64/sn/pci/tioce_provider.c | 18 include/asm-ia64/io.h | 2 include/asm-ia64/machvec.h | 12 include/asm-ia64/machvec_sn2.h | 2 include/asm-ia64/sn/acpi.h | 16 include/asm-ia64/sn/pcidev.h | 22 - include/asm-ia64/sn/sn_feature_sets.h | 6 include/asm-ia64/sn/sn_sal.h | 1 include/linux/pci.h | 1 18 files changed, 991 insertions(+), 582 deletions(-)
arch/ia64/pci/pci.c +3 -1
@@ -469,10 +469,11 @@ pcibios_fixup_resources(struct pci_dev * } } -static void __devinit pcibios_fixup_device_resources (struct pci_dev *dev) +void __devinit pcibios_fixup_device_resources (struct pci_dev *dev) {pcibios_fixup_resources (dev,0 ,PCI_BRIDGE_RESOURCES ); } +EXPORT_SYMBOL_GPL (pcibios_fixup_device_resources);static void __devinit pcibios_fixup_bridge_resources (struct pci_dev *dev) {
@@ -493,6 +494,7 @@ pcibios_fixup_bus (struct pci_bus *b) }list_for_each_entry (dev, &b->devices, bus_list)pcibios_fixup_device_resources (dev); +platform_pci_fixup_bus (b);return ; }
arch/ia64/sn/kernel/io_init.c +99 -527
740 lines not on this page · raw message
arch/ia64/sn/kernel/iomv.c +8 -3
@@ -3,10 +3,11 @@* License. See the file "COPYING" in the main directory of this archive * for more details. * -* Copyright (C) 2000-2003 Silicon Graphics, Inc. All rights reserved. +* Copyright (C) 2000-2003, 2006 Silicon Graphics, Inc. All rights reserved. */ #include <linux/module.h> +#include <linux/acpi.h> #include <asm/io.h> #include <asm/delay.h> #include <asm/vga.h>
@@ -15,6 +16,7 @@#include <asm/sn/pda.h> #include <asm/sn/sn_cpuid.h> #include <asm/sn/shub_mmr.h> +#include <asm/sn/acpi.h> #define IS_LEGACY_VGA_IOPORT (p) \ (((p) >= 0x3b0 && (p) <= 0x3bb) || ((p) >= 0x3c0 && (p) <= 0x3df))
@@ -31,11 +33,14 @@ void *sn_io_addr(unsigned long port) {if (!IS_RUNNING_ON_SIMULATOR ()) {if (IS_LEGACY_VGA_IOPORT (port)) - port += vga_console_iobase; +return (__ia64_mk_io_addr (port));/* On sn2, legacy I/O ports don't point at anything */ if (port < (64 *1024 ))return NULL ; -return ((void *)(port | __IA64_UNCACHED_OFFSET)); +if (SN_ACPI_BASE_SUPPORT ()) +return (__ia64_mk_io_addr (port)); +else +return ((void *)(port | __IA64_UNCACHED_OFFSET)); }else {/* but the simulator uses them... */ unsigned long addr;
arch/ia64/sn/kernel/setup.c +18 -0
@@ -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 )
@@ -414,6 +422,16 @@ void __init sn_setup(char **cmdline_p)if (! vga_console_membase)sn_scan_pcdp (); +/* +* Setup legacy IO space. +* vga_console_iobase maps to PCI IO Space address 0 on the +* bus containing the VGA console. +*/ +if (vga_console_iobase) { + io_space[0 ].mmio_base = vga_console_iobase; + io_space[0 ].sparse =0 ; + } +if (vga_console_membase) {/* usable vga ... make tty0 the preferred default console */ if (!strstr (*cmdline_p,"console=" ))
arch/ia64/sn/kernel/tiocx.c +1 -1
@@ -552,7 +552,7 @@ static void __exit tiocx_exit(void)bus_unregister (&tiocx_bus_type); } -subsys_initcall (tiocx_init); +fs_initcall (tiocx_init);module_exit (tiocx_exit);/************************************************************************
arch/ia64/sn/pci/pcibr/pcibr_provider.c +1 -16
@@ -3,7 +3,7 @@* License. See the file "COPYING" in the main directory of this archive * for more details. * -* Copyright (C) 2001-2004 Silicon Graphics, Inc. All rights reserved. +* Copyright (C) 2001-2004, 2006 Silicon Graphics, Inc. All rights reserved. */ #include <linux/interrupt.h>
@@ -109,7 +109,6 @@ void * pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *controller) { int nasid, cnode, j; -cnodeid_t near_cnode;struct hubdev_info *hubdev_info;struct pcibus_info *soft;struct sn_flush_device_kernel *sn_flush_device_kernel;
@@ -186,20 +185,6 @@ pcibr_bus_fixup(struct pcibus_bussoft *preturn NULL ; } -if (prom_bussoft->bs_asic_type ==PCIIO_ASIC_TYPE_TIOCP ) { -/* TIO PCI Bridge: find nearest node with CPUs */ -int e =sn_hwperf_get_nearest_node (cnode,NULL , &near_cnode); - -if (e <0 ) { - near_cnode = (cnodeid_t)-1 ;/* use any node */ -printk (KERN_WARNING "pcibr_bus_fixup: failed to find " -"near node with CPUs to TIO node %d, err=%d\n" , - cnode, e); - } - controller->node = near_cnode; - } -else - controller->node = cnode;return soft; }
include/asm-ia64/machvec.h +12 -0
@@ -35,6 +35,7 @@ typedef int ia64_mv_pci_legacy_read_t (stypedef int ia64_mv_pci_legacy_write_t (struct pci_bus *,u16 port,u32 val,u8 size);typedef void ia64_mv_migrate_t (struct task_struct * task); +typedef void ia64_mv_pci_fixup_bus_t (struct pci_bus *);/* DMA-mapping interface: */ typedef void ia64_mv_dma_init (void );
@@ -92,6 +93,11 @@ machvec_noop_task (struct task_struct *t { } +static inline void +machvec_noop_bus (struct pci_bus *bus) +{ +} +extern void machvec_setup (char **);extern void machvec_timer_interrupt (int ,void *,struct pt_regs *);extern void machvec_dma_sync_single (struct device *,dma_addr_t ,size_t ,int );
@@ -155,6 +161,7 @@ extern void machvec_tlb_migrate_finish (# define platform_readq_relaxed ia64_mv.readq_relaxed# define platform_migrate ia64_mv.migrate# define platform_msi_init ia64_mv.msi_init +# define platform_pci_fixup_bus ia64_mv.pci_fixup_bus# endif /* __attribute__((__aligned__(16))) is required to make size of the
@@ -205,6 +212,7 @@ struct ia64_machine_vector {ia64_mv_readq_relaxed_t *readq_relaxed;ia64_mv_migrate_t *migrate;ia64_mv_msi_init_t *msi_init; +ia64_mv_pci_fixup_bus_t *pci_fixup_bus; } __attribute__((__aligned__(16))); /* align attrib? see above comment */#define MACHVEC_INIT (name) \
@@ -251,6 +259,7 @@ struct ia64_machine_vector { platform_readq_relaxed, \ platform_migrate, \ platform_msi_init, \ + platform_pci_fixup_bus, \ } extern struct ia64_machine_vector ia64_mv;
@@ -407,5 +416,8 @@ extern int ia64_pci_legacy_write(struct#ifndef platform_msi_init# define platform_msi_init ((ia64_mv_msi_init_t*)NULL)#endif +#ifndef platform_pci_fixup_bus +# define platform_pci_fixup_bus machvec_noop_bus +#endif #endif /* _ASM_IA64_MACHVEC_H */
include/asm-ia64/machvec_sn2.h +2 -0
@@ -68,6 +68,7 @@ extern ia64_mv_dma_mapping_error sn_dma_extern ia64_mv_dma_supported sn_dma_supported;extern ia64_mv_migrate_t sn_migrate;extern ia64_mv_msi_init_t sn_msi_init; +extern ia64_mv_pci_fixup_bus_t sn_pci_fixup_bus;/*
@@ -124,6 +125,7 @@ extern ia64_mv_msi_init_t sn_msi_init;#else #define platform_msi_init ((ia64_mv_msi_init_t*)NULL)#endif +#define platform_pci_fixup_bus sn_pci_fixup_bus#include <asm/sn/io.h>
include/asm-ia64/sn/acpi.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Copyright (C) 2006 Silicon Graphics, Inc. All rights reserved. +*/ + +#ifndef _ASM_IA64_SN_ACPI_H +#define _ASM_IA64_SN_ACPI_H + +#include "acpi/acglobal.h" + +#define SN_ACPI_BASE_SUPPORT () (acpi_gbl_DSDT->oem_revision >= 0x20101) + +#endif /* _ASM_IA64_SN_ACPI_H */
include/asm-ia64/sn/sn_feature_sets.h +6 -0
@@ -44,8 +44,14 @@ 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/sn_sal.h +1 -0
@@ -77,6 +77,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
include/linux/pci.h +1 -0
@@ -400,6 +400,7 @@ extern struct bus_type pci_bus_type;extern struct list_head pci_root_buses;/* list of all known PCI buses */ extern struct list_head pci_devices;/* list of all devices */ +void pcibios_fixup_device_resources (struct pci_dev *);void pcibios_fixup_bus (struct pci_bus *);int pcibios_enable_device (struct pci_dev *,int mask);char *pcibios_setup (char *str);
include/asm-ia64/sn/pcidev.h +9 -13
@@ -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
@@ -72,8 +70,6 @@ extern void sn_irq_fixup(struct pci_dev struct sn_irq_info *sn_irq_info);extern void sn_irq_unfixup (struct pci_dev *pci_dev);extern struct pcidev_info *sn_pcidev_info_get (struct pci_dev *); -extern void sn_pci_controller_fixup (int segment,int busnum, -struct pci_bus *bus);extern void sn_bus_store_sysdata (struct pci_dev *dev);extern void sn_bus_free_sysdata (void );extern void sn_generate_path (struct pci_bus *pci_bus,char *address);
include/asm-ia64/io.h +1 -1
@@ -32,7 +32,7 @@*/ #define IO_SPACE_LIMIT 0xffffffffffffffffUL -#define MAX_IO_SPACES_BITS 4 +#define MAX_IO_SPACES_BITS 8#define MAX_IO_SPACES (1UL << MAX_IO_SPACES_BITS)#define IO_SPACE_BITS 24#define IO_SPACE_SIZE (1UL << IO_SPACE_BITS)
arch/ia64/sn/pci/tioce_provider.c +0 -18
@@ -15,7 +15,6 @@#include <asm/sn/pcidev.h> #include <asm/sn/pcibus_provider_defs.h> #include <asm/sn/tioce_provider.h> -#include <asm/sn/sn2/sn_hwperf.h> /* * 1/26/2006
@@ -991,8 +990,6 @@ tioce_target_interrupt(struct sn_irq_infstatic void *tioce_bus_fixup (struct pcibus_bussoft *prom_bussoft,struct pci_controller *controller) { -int my_nasid; -cnodeid_t my_cnode, mem_cnode;struct tioce_common *tioce_common;struct tioce_kernel *tioce_kern;struct tioce *tioce_mmr;
@@ -1036,21 +1033,6 @@ tioce_bus_fixup(struct pcibus_bussoft *p tioce_common->ce_pcibus.bs_persist_segment, tioce_common->ce_pcibus.bs_persist_busnum); -/* -* identify closest nasid for memory allocations -*/ - - my_nasid =NASID_GET (tioce_common->ce_pcibus.bs_base); - my_cnode =nasid_to_cnodeid (my_nasid); - -if (sn_hwperf_get_nearest_node (my_cnode, &mem_cnode,NULL ) <0 ) { -printk (KERN_WARNING "tioce_bus_fixup: failed to find " -"closest node with MEM to TIO node %d\n" , my_cnode); - mem_cnode = (cnodeid_t)-1 ;/* use any node */ - } - - controller->node = mem_cnode; -return tioce_common; }
arch/ia64/sn/kernel/Makefile +3 -2
@@ -4,13 +4,14 @@ # 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. # CPPFLAGS += -I$(srctree)/arch/ia64/sn/include obj-y += setup.o bte.o bte_error.o irq.o mca.o idle.o \ - huberror.o io_init.o iomv.o klconflib.o pio_phys.o \ + huberror.o io_acpi_init.o io_common.o \ + io_init.o iomv.o klconflib.o pio_phys.o \ sn2/ obj-$(CONFIG_IA64_GENERIC) += machvec.o obj-$(CONFIG_SGI_TIOCX) += tiocx.o
arch/ia64/sn/kernel/io_acpi_init.c new file +198 -0
198 lines not on this page · raw message
arch/ia64/sn/kernel/io_common.c new file +612 -0
612 lines not on this page · raw message
Quoted 1 line · On Fri, 22 Sep 2006 09:51:23 -0500 John Keller <[email protected]> wrote:
First phase in introducing ACPI support to SN.
This:
include/linux/pci.h +1 -0
@@ -405,6 +405,7 @@ extern struct bus_type pci_bus_type;extern struct list_head pci_root_buses;/* list of all known PCI buses */ extern struct list_head pci_devices;/* list of all devices */ +void pcibios_fixup_device_resources (struct pci_dev *);void pcibios_fixup_bus (struct pci_bus *);int __must_check pcibios_enable_device (struct pci_dev *,int mask);char *pcibios_setup (char *str);
breaks a bunch of architectures.
For example alpha has
void __initpcibios_fixup_device_resources(struct pci_dev *dev, struct pci_bus *bus)
box:/usr/src/linux-2.6.18> grep -rl pcibios_fixup_device_resources . ./arch/alpha/kernel/pci.c./arch/ia64/pci/pci.c./arch/mips/pci/pci.c./arch/powerpc/kernel/pci_64.c ./arch/powerpc/platforms/pseries/pci_dlpar.c ./include/asm-powerpc/pci.h
It needs work...
Quoted 34 lines
Quoted 1 line · On Fri, 22 Sep 2006 09:51:23 -0500 John Keller <[email protected]> wrote:
First phase in introducing ACPI support to SN.
This:
include/linux/pci.h +1
-0@@ -405,6 +405,7 @@ extern struct bus_type pci_bus_type;extern struct list_head pci_root_buses;/* list of all known PCI buses */ extern struct list_head pci_devices;/* list of all devices */ +void pcibios_fixup_device_resources (struct pci_dev *);void pcibios_fixup_bus (struct pci_bus *);int __must_check pcibios_enable_device (struct pci_dev *,int mask);char *pcibios_setup (char *str);breaks a bunch of architectures.
For example alpha has
void
__initpcibios_fixup_device_resources(struct pci_dev *dev, struct pci_bus *bus)box:/usr/src/linux-2.6.18> grep -rl
pcibios_fixup_device_resources../arch/alpha/kernel/pci.c./arch/ia64/pci/pci.c./arch/mips/pci/pci.c./arch/powerpc/kernel/pci_64.c./arch/powerpc/platforms/pseries/pci_dlpar.c./include/asm-powerpc/pci.h
Quoted 2 lines
It needs work...
Interesting. Looks like I made a bad assumption thinking the definitions would be the same for all archs.
I'll fix and resend.
John