[PATCH 02/21] Cleanup on function names of EEH core
The EEH has been implemented on pSeries platform. The original code looks a little bit nasty. The patch does cleanup on the current EEH implementation so that it looks more clean. * Try adding prefix eeh for functions. * Some function names have been adjusted so that they looks shorter and meaningful. Signed-off-by: Gavin Shan sha...@linux.vnet.ibm.com --- arch/powerpc/include/asm/ppc-pci.h |8 +- arch/powerpc/platforms/pseries/eeh.c| 102 +-- arch/powerpc/platforms/pseries/eeh_driver.c | 10 ++-- arch/powerpc/platforms/pseries/msi.c|2 +- 4 files changed, 59 insertions(+), 63 deletions(-) diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h index 221d82f..605a970 100644 --- a/arch/powerpc/include/asm/ppc-pci.h +++ b/arch/powerpc/include/asm/ppc-pci.h @@ -58,16 +58,16 @@ struct pci_dev *pci_get_device_by_addr(unsigned long addr); void eeh_slot_error_detail (struct pci_dn *pdn, int severity); #define EEH_THAW_MMIO 2 #define EEH_THAW_DMA 3 -int rtas_pci_enable(struct pci_dn *pdn, int function); -int rtas_set_slot_reset (struct pci_dn *); +int eeh_pci_enable(struct pci_dn *pdn, int function); +int eeh_reset_pe(struct pci_dn *); int eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs); void eeh_restore_bars(struct pci_dn *); -void rtas_configure_bridge(struct pci_dn *); +void eeh_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); void eeh_mark_slot(struct device_node *dn, int mode_flag); void eeh_clear_slot(struct device_node *dn, int mode_flag); -struct device_node *find_device_pe(struct device_node *dn); +struct device_node *eeh_find_device_pe(struct device_node *dn); void eeh_sysfs_add_device(struct pci_dev *pdev); void eeh_sysfs_remove_device(struct pci_dev *pdev); diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 5f6d37b..fa88589 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c @@ -130,7 +130,7 @@ static unsigned long slot_resets; #define IS_BRIDGE(class_code) (((class_code)16) == PCI_BASE_CLASS_BRIDGE) /** - * rtas_slot_error_detail - Retrieve error log through RTAS call + * eeh_rtas_slot_error_detail - Retrieve error log through RTAS call * @pdn: device node * @severity: temporary or permanent error log * @driver_log: driver log to be combined with the retrieved error log @@ -139,7 +139,7 @@ static unsigned long slot_resets; * This routine should be called to retrieve error log through the dedicated * RTAS call. */ -static void rtas_slot_error_detail(struct pci_dn *pdn, int severity, +static void eeh_rtas_slot_error_detail(struct pci_dn *pdn, int severity, char *driver_log, size_t loglen) { int config_addr; @@ -170,7 +170,7 @@ static void rtas_slot_error_detail(struct pci_dn *pdn, int severity, } /** - * gather_pci_data - Copy assorted PCI config space registers to buff + * eeh_gather_pci_data - Copy assorted PCI config space registers to buff * @pdn: device to report data for * @buf: point to buffer in which to log * @len: amount of room in buffer @@ -178,7 +178,7 @@ static void rtas_slot_error_detail(struct pci_dn *pdn, int severity, * This routine captures assorted PCI configuration space data, * and puts them into a buffer for RTAS error logging. */ -static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) +static size_t eeh_gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) { struct pci_dev *dev = pdn-pcidev; u32 cfg; @@ -258,7 +258,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) for_each_child_of_node(pdn-node, dn) { pdn = PCI_DN(dn); if (pdn) - n += gather_pci_data(pdn, buf+n, len-n); + n += eeh_gather_pci_data(pdn, buf+n, len-n); } } @@ -280,23 +280,23 @@ void eeh_slot_error_detail(struct pci_dn *pdn, int severity) size_t loglen = 0; pci_regs_buf[0] = 0; - rtas_pci_enable(pdn, EEH_THAW_MMIO); - rtas_configure_bridge(pdn); + eeh_pci_enable(pdn, EEH_THAW_MMIO); + eeh_configure_bridge(pdn); eeh_restore_bars(pdn); - loglen = gather_pci_data(pdn, pci_regs_buf, EEH_PCI_REGS_LOG_LEN); + loglen = eeh_gather_pci_data(pdn, pci_regs_buf, EEH_PCI_REGS_LOG_LEN); - rtas_slot_error_detail(pdn, severity, pci_regs_buf, loglen); + eeh_rtas_slot_error_detail(pdn, severity, pci_regs_buf, loglen); } /** - * read_slot_reset_state - Read the reset state of a device node's slot + * eeh_read_slot_reset_state - Read the reset state of a device node's slot * @dn: device node to read
[PATCH 02/21] Cleanup on function names of EEH core
The EEH has been implemented on pSeries platform. The original code looks a little bit nasty. The patch does cleanup on the current EEH implementation so that it looks more clean. * Try adding prefix eeh for functions. * Some function names have been adjusted so that they looks shorter and meaningful. Signed-off-by: Gavin Shan sha...@linux.vnet.ibm.com --- arch/powerpc/include/asm/ppc-pci.h |8 +- arch/powerpc/platforms/pseries/eeh.c| 102 +-- arch/powerpc/platforms/pseries/eeh_driver.c | 10 ++-- arch/powerpc/platforms/pseries/msi.c|2 +- 4 files changed, 59 insertions(+), 63 deletions(-) diff --git a/arch/powerpc/include/asm/ppc-pci.h b/arch/powerpc/include/asm/ppc-pci.h index 221d82f..605a970 100644 --- a/arch/powerpc/include/asm/ppc-pci.h +++ b/arch/powerpc/include/asm/ppc-pci.h @@ -58,16 +58,16 @@ struct pci_dev *pci_get_device_by_addr(unsigned long addr); void eeh_slot_error_detail (struct pci_dn *pdn, int severity); #define EEH_THAW_MMIO 2 #define EEH_THAW_DMA 3 -int rtas_pci_enable(struct pci_dn *pdn, int function); -int rtas_set_slot_reset (struct pci_dn *); +int eeh_pci_enable(struct pci_dn *pdn, int function); +int eeh_reset_pe(struct pci_dn *); int eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs); void eeh_restore_bars(struct pci_dn *); -void rtas_configure_bridge(struct pci_dn *); +void eeh_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); void eeh_mark_slot(struct device_node *dn, int mode_flag); void eeh_clear_slot(struct device_node *dn, int mode_flag); -struct device_node *find_device_pe(struct device_node *dn); +struct device_node *eeh_find_device_pe(struct device_node *dn); void eeh_sysfs_add_device(struct pci_dev *pdev); void eeh_sysfs_remove_device(struct pci_dev *pdev); diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 5f6d37b..fa88589 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c @@ -130,7 +130,7 @@ static unsigned long slot_resets; #define IS_BRIDGE(class_code) (((class_code)16) == PCI_BASE_CLASS_BRIDGE) /** - * rtas_slot_error_detail - Retrieve error log through RTAS call + * eeh_rtas_slot_error_detail - Retrieve error log through RTAS call * @pdn: device node * @severity: temporary or permanent error log * @driver_log: driver log to be combined with the retrieved error log @@ -139,7 +139,7 @@ static unsigned long slot_resets; * This routine should be called to retrieve error log through the dedicated * RTAS call. */ -static void rtas_slot_error_detail(struct pci_dn *pdn, int severity, +static void eeh_rtas_slot_error_detail(struct pci_dn *pdn, int severity, char *driver_log, size_t loglen) { int config_addr; @@ -170,7 +170,7 @@ static void rtas_slot_error_detail(struct pci_dn *pdn, int severity, } /** - * gather_pci_data - Copy assorted PCI config space registers to buff + * eeh_gather_pci_data - Copy assorted PCI config space registers to buff * @pdn: device to report data for * @buf: point to buffer in which to log * @len: amount of room in buffer @@ -178,7 +178,7 @@ static void rtas_slot_error_detail(struct pci_dn *pdn, int severity, * This routine captures assorted PCI configuration space data, * and puts them into a buffer for RTAS error logging. */ -static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) +static size_t eeh_gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) { struct pci_dev *dev = pdn-pcidev; u32 cfg; @@ -258,7 +258,7 @@ static size_t gather_pci_data(struct pci_dn *pdn, char * buf, size_t len) for_each_child_of_node(pdn-node, dn) { pdn = PCI_DN(dn); if (pdn) - n += gather_pci_data(pdn, buf+n, len-n); + n += eeh_gather_pci_data(pdn, buf+n, len-n); } } @@ -280,23 +280,23 @@ void eeh_slot_error_detail(struct pci_dn *pdn, int severity) size_t loglen = 0; pci_regs_buf[0] = 0; - rtas_pci_enable(pdn, EEH_THAW_MMIO); - rtas_configure_bridge(pdn); + eeh_pci_enable(pdn, EEH_THAW_MMIO); + eeh_configure_bridge(pdn); eeh_restore_bars(pdn); - loglen = gather_pci_data(pdn, pci_regs_buf, EEH_PCI_REGS_LOG_LEN); + loglen = eeh_gather_pci_data(pdn, pci_regs_buf, EEH_PCI_REGS_LOG_LEN); - rtas_slot_error_detail(pdn, severity, pci_regs_buf, loglen); + eeh_rtas_slot_error_detail(pdn, severity, pci_regs_buf, loglen); } /** - * read_slot_reset_state - Read the reset state of a device node's slot + * eeh_read_slot_reset_state - Read the reset state of a device node's slot * @dn: device node to read