From 77bd741561016134d1761d6101c4f0361025062f Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Thu, 3 Nov 2005 18:52:49 -0600 Subject: [PATCH] powerpc: PCI Error Recovery: PPC64 core recovery routines Various PCI bus errors can be signaled by newer PCI controllers. The core error recovery routines are architecture dependent. This patch adds a recovery infrastructure for the PPC64 pSeries systems. Signed-off-by: Linas Vepstas Signed-off-by: Paul Mackerras (cherry picked from e8ca11b460c4c9c7fa6b529be221529ebd770e38 commit) --- include/asm-powerpc/eeh.h | 8 +++++--- include/asm-powerpc/eeh_event.h | 7 +++++-- include/asm-powerpc/ppc-pci.h | 9 +++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/eeh.h b/include/asm-powerpc/eeh.h index 4395b7bc1ed4..b263fb2fa6e4 100644 --- a/include/asm-powerpc/eeh.h +++ b/include/asm-powerpc/eeh.h @@ -34,9 +34,11 @@ struct device_node; extern int eeh_subsystem_enabled; /* Values for eeh_mode bits in device_node */ -#define EEH_MODE_SUPPORTED (1<<0) -#define EEH_MODE_NOCHECK (1<<1) -#define EEH_MODE_ISOLATED (1<<2) +#define EEH_MODE_SUPPORTED (1<<0) +#define EEH_MODE_NOCHECK (1<<1) +#define EEH_MODE_ISOLATED (1<<2) +#define EEH_MODE_RECOVERING (1<<3) +#define EEH_MODE_IRQ_DISABLED (1<<4) /* Max number of EEH freezes allowed before we consider the device * to be permanently disabled. */ diff --git a/include/asm-powerpc/eeh_event.h b/include/asm-powerpc/eeh_event.h index 5e11a00b6fa0..93d55a2bebfd 100644 --- a/include/asm-powerpc/eeh_event.h +++ b/include/asm-powerpc/eeh_event.h @@ -30,7 +30,7 @@ struct eeh_event { struct list_head list; struct device_node *dn; /* struct device node */ struct pci_dev *dev; /* affected device */ - int state; + enum pci_channel_state state; /* PCI bus state for the affected device */ int time_unavail; /* milliseconds until device might be available */ }; @@ -47,8 +47,11 @@ struct eeh_event { */ int eeh_send_failure_event (struct device_node *dn, struct pci_dev *dev, - int reset_state, + enum pci_channel_state state, int time_unavail); +/* Main recovery function */ +void handle_eeh_events (struct eeh_event *); + #endif /* __KERNEL__ */ #endif /* ASM_PPC64_EEH_EVENT_H */ diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h index bdef312900a1..caf67a3bcb78 100644 --- a/include/asm-powerpc/ppc-pci.h +++ b/include/asm-powerpc/ppc-pci.h @@ -52,6 +52,15 @@ extern unsigned long pci_probe_only; /* ---- EEH internal-use-only related routines ---- */ #ifdef CONFIG_EEH +/** + * eeh_slot_error_detail -- record and EEH error condition to the log + * @severity: 1 if temporary, 2 if permanent failure. + * + * Obtains the the EEH error details from the RTAS subsystem, + * and then logs these details with the RTAS error log system. + */ +void eeh_slot_error_detail (struct pci_dn *pdn, int severity); + /** * rtas_set_slot_reset -- unfreeze a frozen slot * -- cgit From 5d5a0936b3ad9e3d3f6eaf61f1a06c62ea0e7a59 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Thu, 3 Nov 2005 18:53:07 -0600 Subject: [PATCH] powerpc: Split out PCI address cache to its own file 25-pci-address-cache.patch The core EEH file is rather large. This patch splits out a self-contained chunk of it into its own file. This is the chunk that performes the caching and lookup of pci devices based on the i/o addresses of thier resoures. This code is almos architecture-independent and could be used by any system that wanted to find a pci device based only on the i/o address used by the device. Signed-off-by: Linas Vepstas Signed-off-by: Paul Mackerras (cherry picked from b0b291d59906d4a9a89ed9e34d9fd684c7188924 commit) --- include/asm-powerpc/ppc-pci.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h index caf67a3bcb78..79239a200f18 100644 --- a/include/asm-powerpc/ppc-pci.h +++ b/include/asm-powerpc/ppc-pci.h @@ -52,6 +52,14 @@ extern unsigned long pci_probe_only; /* ---- EEH internal-use-only related routines ---- */ #ifdef CONFIG_EEH + +void pci_addr_cache_insert_device(struct pci_dev *dev); +void pci_addr_cache_remove_device(struct pci_dev *dev); +void pci_addr_cache_build(void); +struct pci_dev *pci_get_device_by_addr(unsigned long addr); + +void eeh_save_bars(struct pci_dev * pdev, struct pci_dn *pdn); + /** * eeh_slot_error_detail -- record and EEH error condition to the log * @severity: 1 if temporary, 2 if permanent failure. -- cgit From 25e591f6dd07365cbf0b1c2454386ce597dd5e05 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Thu, 3 Nov 2005 18:53:20 -0600 Subject: [PATCH] powerpc: Add "partitionable endpoint" support 26-eeh-partition-endpoint.patch New versions of firmware introduce a new method by which the "partitionable endpoint" (the point at which the pci bus is cut) should be located. This code adds the support for this (mandatory) new feature. Signed-off-by: Linas Vepstas Signed-off-by: Paul Mackerras (cherry picked from 9fcfb5d35b5294659f9299aa9cae6fd16325c07e commit) --- include/asm-powerpc/pci-bridge.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h index 1a08860e789e..a81bc363f350 100644 --- a/include/asm-powerpc/pci-bridge.h +++ b/include/asm-powerpc/pci-bridge.h @@ -68,6 +68,7 @@ struct pci_dn { #ifdef CONFIG_PPC_PSERIES int eeh_mode; /* See eeh.h for possible EEH_MODEs */ int eeh_config_addr; + int eeh_pe_config_addr; /* new-style partition endpoint address */ int eeh_check_count; /* # times driver ignored error */ int eeh_freeze_count; /* # times this device froze up. */ int eeh_is_bridge; /* device is pci-to-pci bridge */ -- cgit From 9fb40eb883ad2d22ad6975b4323cb76e018fa280 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Thu, 3 Nov 2005 18:54:29 -0600 Subject: [PATCH] powerpc: Remove duplicate code 234-eeh-find-pe.patch The find_device_pe() routine is duplicated in two files. Remove one of the two copies, declare the other extern. Signed-off-by: Linas Vepstas Signed-off-by: Paul Mackerras (cherry picked from 48408e708282d4d0269136ff27ea5acbd9410b5a commit) --- include/asm-powerpc/ppc-pci.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h index 79239a200f18..4820b368bf15 100644 --- a/include/asm-powerpc/ppc-pci.h +++ b/include/asm-powerpc/ppc-pci.h @@ -109,6 +109,9 @@ int rtas_write_config(struct pci_dn *, int where, int size, u32 val); void eeh_mark_slot (struct device_node *dn, int mode_flag); void eeh_clear_slot (struct device_node *dn, int mode_flag); +/* Find the associated "Partiationable Endpoint" PE */ +struct device_node * find_device_pe(struct device_node *dn); + #endif #endif /* __KERNEL__ */ -- cgit From b6495c0c8f100b882d85774f44529519befefba9 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Thu, 3 Nov 2005 18:54:54 -0600 Subject: [PATCH] powerpc: Don't continue with PCI Error recovery if slot reset failed. 238-eeh-stop-if-reset_failed.patch If the firmware is unable to reset the PCI slot for some reason, then don't attempt any further recovery steps after that point. Instead, mark the device as permanently failed. Signed-off-by: Linas Vepstas Signed-off-by: Paul Mackerras (cherry picked from e06b942521eb2cdaf232726f45a820d5837acb12 commit) --- include/asm-powerpc/ppc-pci.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h index 4820b368bf15..1a2db61694f2 100644 --- a/include/asm-powerpc/ppc-pci.h +++ b/include/asm-powerpc/ppc-pci.h @@ -76,8 +76,10 @@ void eeh_slot_error_detail (struct pci_dn *pdn, int severity); * does this by asserting the PCI #RST line for 1/8th of * a second; this routine will sleep while the adapter is * being reset. + * + * Returns a non-zero value if the reset failed. */ -void rtas_set_slot_reset (struct pci_dn *); +int rtas_set_slot_reset (struct pci_dn *); /** * eeh_restore_bars - Restore device configuration info. -- cgit From 7684b40cb53ba00cc51271f1c42897b776c48fbc Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Thu, 3 Nov 2005 18:55:19 -0600 Subject: [PATCH] powerpc: Save device BARs much earlier in the boot sequence 241-eeh-save-bars-earlier.patch Save the PCI device bars *before* any PCI probing is done. Signed-off-by: Linas Vepstas Signed-off-by: Paul Mackerras (cherry picked from 76c902b919098860f3d4e125f847abcc4cb1782a commit) --- include/asm-powerpc/pci-bridge.h | 8 ++++---- include/asm-powerpc/ppc-pci.h | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h index a81bc363f350..b0d816fe2e27 100644 --- a/include/asm-powerpc/pci-bridge.h +++ b/include/asm-powerpc/pci-bridge.h @@ -61,9 +61,10 @@ struct pci_controller; struct iommu_table; struct pci_dn { - int busno; /* for pci devices */ - int bussubno; /* for pci devices */ - int devfn; /* for pci devices */ + int busno; /* pci bus number */ + int bussubno; /* pci subordinate bus number */ + int devfn; /* pci device and function number */ + int class_code; /* pci device class */ #ifdef CONFIG_PPC_PSERIES int eeh_mode; /* See eeh.h for possible EEH_MODEs */ @@ -71,7 +72,6 @@ struct pci_dn { int eeh_pe_config_addr; /* new-style partition endpoint address */ int eeh_check_count; /* # times driver ignored error */ int eeh_freeze_count; /* # times this device froze up. */ - int eeh_is_bridge; /* device is pci-to-pci bridge */ #endif int pci_ext_config_space; /* for pci devices */ struct pci_controller *phb; /* for pci devices */ diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h index 1a2db61694f2..f80482c7231f 100644 --- a/include/asm-powerpc/ppc-pci.h +++ b/include/asm-powerpc/ppc-pci.h @@ -58,8 +58,6 @@ void pci_addr_cache_remove_device(struct pci_dev *dev); void pci_addr_cache_build(void); struct pci_dev *pci_get_device_by_addr(unsigned long addr); -void eeh_save_bars(struct pci_dev * pdev, struct pci_dn *pdn); - /** * eeh_slot_error_detail -- record and EEH error condition to the log * @severity: 1 if temporary, 2 if permanent failure. @@ -103,6 +101,7 @@ void eeh_restore_bars(struct pci_dn *); void rtas_configure_bridge(struct pci_dn *); int rtas_write_config(struct pci_dn *, int where, int size, u32 val); +int rtas_read_config(struct pci_dn *, int where, int size, u32 *val); /** * mark and clear slots: find "partition endpoint" PE and set or -- cgit From 13b8a272297b29870d5bf5f8db7a381dd9e82382 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Tue, 10 Jan 2006 16:19:05 +1100 Subject: powerpc: Introduce a new config symbol to control 16550 early debug code The previous change by Kumar Gala in this area led to legacy_serial.c and udbg_16550.c being built as modules when CONFIG_SERIAL_8250=m. Fix this by introducing a new symbol, CONFIG_PPC_UDBG_16550, to control whether these files get built, and arrange for it to be selected for those platforms that need it. Signed-off-by: Paul Mackerras --- include/asm-powerpc/serial.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/asm-powerpc/serial.h b/include/asm-powerpc/serial.h index 6dc9546d6908..3e8589b43cb2 100644 --- a/include/asm-powerpc/serial.h +++ b/include/asm-powerpc/serial.h @@ -15,6 +15,10 @@ /* Default baud base if not found in device-tree */ #define BASE_BAUD ( 1843200 / 16 ) +#ifdef CONFIG_PPC_UDBG_16550 extern void find_legacy_serial_ports(void); +#else +#define find_legacy_serial_ports() do { } while (0) +#endif #endif /* _PPC64_SERIAL_H */ -- cgit