pci: New PCI-E reset API
Subsystems (5)
PATCH 1/3 pci: New PCI-E reset API
Adds a new API which can be used to issue various types of PCI-E reset, including PCI-E warm reset and PCI-E hot reset. This is needed for an ipr PCI-E adapter which does not properly implement BIST. Running BIST on this adapter results in PCI-E errors. The only reliable reset mechanism that exists on this hardware is PCI Fundamental reset (warm reset). Since driving this type of reset is architecture unique, this provides the necessary hooks for architectures to add this support.
---
linux-2.6-bjking1/drivers/pci/pci.c | 29 +++++++++++++++++++++++++++++ linux-2.6-bjking1/include/linux/pci.h | 14 ++++++++++++++ 2 files changed, 43 insertions(+)
drivers/pci/pci.c renamed from drivers/pci/pci.c~pci_pci_reset_api +29 -0
@@ -893,6 +893,34 @@ pci_disable_device(struct pci_dev *dev) }/** +* pcibios_set_pcie_reset_state - set reset state for device dev +* @dev: the PCI-E device reset +* @state: Reset state to enter into +* +* +* Sets the PCI-E reset state for the device. This is the default +* implementation. Architecture implementations can override this. +*/ +int __attribute__ ((weak))pcibios_set_pcie_reset_state (struct pci_dev *dev, +enum pcie_reset_state state) +{ +return -EINVAL ; +} + +/** +* pci_set_pcie_reset_state - set reset state for device dev +* @dev: the PCI-E device reset +* @state: Reset state to enter into +* +* +* Sets the PCI reset state for the device. +*/ +int pci_set_pcie_reset_state (struct pci_dev *dev,enum pcie_reset_state state) +{ +return pcibios_set_pcie_reset_state (dev, state); +} + +/** * pci_enable_wake - enable device to generate PME# when suspended * @dev: - PCI device to operate on * @state: - Current state of device.
@@ -1374,4 +1402,5 @@ EXPORT_SYMBOL(pci_set_power_state);EXPORT_SYMBOL (pci_save_state);EXPORT_SYMBOL (pci_restore_state);EXPORT_SYMBOL (pci_enable_wake); +EXPORT_SYMBOL_GPL (pci_set_pcie_reset_state);
include/linux/pci.h renamed from include/linux/pci.h~pci_pci_reset_api +14 -0
@@ -96,6 +96,19 @@ enum pci_channel_state { pci_channel_io_perm_failure = (__force pci_channel_state_t) 3, }; +typedef unsigned int __bitwise pcie_reset_state_t ; + +enum pcie_reset_state { +/* Reset is NOT asserted (Use to deassert reset) */ + pci_reset_normal = (__force pcie_reset_state_t )1 , + +/* Use #PERST to reset PCI-E device */ + pci_reset_pcie_warm_reset = (__force pcie_reset_state_t )2 , + +/* Use PCI-E Hot Reset to reset device */ + pci_reset_pcie_hot_reset = (__force pcie_reset_state_t )3 +}; +typedef unsigned short __bitwise pci_bus_flags_t ;enum pci_bus_flags {PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t )1 ,
@@ -539,6 +552,7 @@ static inline int pci_is_managed(structvoid pci_disable_device (struct pci_dev *dev);void pci_set_master (struct pci_dev *dev); +int pci_set_pcie_reset_state (struct pci_dev *dev,enum pcie_reset_state state);#define HAVE_PCI_SET_MWI int __must_check pci_set_mwi (struct pci_dev *dev);void pci_clear_mwi (struct pci_dev *dev);
_
PATCH 2/3 powerpc: Add powerpc PCI-E reset API implementation
Adds the pSeries platform implementation for a new PCI API which can be used to issue various types of PCI-E reset, including PCI-E warm reset and PCI-E hot reset. This is needed for an ipr PCI-E adapter which does not properly implement BIST. Running BIST on this adapter results in PCI-E errors. The only reliable reset mechanism that exists on this hardware is PCI Fundamental reset (warm reset).
---
linux-2.6-bjking1/arch/powerpc/platforms/pseries/eeh.c | 30 +++++++++++++++++ 1 files changed, 30 insertions(+)
arch/powerpc/platforms/pseries/eeh.c renamed from arch/powerpc/platforms/pseries/eeh.c~powerpc_slot_reset_api3 +30 -0
@@ -561,6 +561,36 @@ rtas_pci_slot_reset(struct pci_dn *pdn, }/** +* pcibios_set_pcie_slot_reset - Set PCI-E reset state +* @dev: pci device struct +* @state: reset state to enter +* +* Return value: +* 0 if success +**/ +int pcibios_set_pcie_reset_state (struct pci_dev *dev,enum pcie_reset_state state) +{ +struct device_node *dn =pci_device_to_OF_node (dev); +struct pci_dn *pdn =PCI_DN (dn); + +switch (state) { +case pci_reset_normal: +rtas_pci_slot_reset (pdn,0 ); +break ; +case pci_reset_pcie_hot_reset: +rtas_pci_slot_reset (pdn,1 ); +break ; +case pci_reset_pcie_warm_reset: +rtas_pci_slot_reset (pdn,3 ); +break ; +default : +return -EINVAL ; + }; + +return 0 ; +} + +/** * rtas_set_slot_reset -- assert the pci #RST line for 1/4 second * @pdn: pci device node to be reset. *
_
PATCH 3/3 ipr: Use PCI-E reset API for new ipr adapter
In reply to Brian KingUse a newly added PCI API to issue a PCI Fundamental reset (warm reset) to a new ipr PCI-E adapter. Typically, the ipr adapter uses the start BIST bit in config space to reset an adapter. Issuing start BIST on this particular adapter results in the PCI-E logic on the card losing sync, which causes PCI-E errors, making the card unusable. The only reset mechanism that exists on this hardware that does not have this problem is PCI Fundamental reset (warm reset).
---
linux-2.6-bjking1/drivers/scsi/ipr.c | 61 ++++++++++++++++++++++++++++++++--- linux-2.6-bjking1/drivers/scsi/ipr.h | 10 ++++- 2 files changed, 64 insertions(+), 7 deletions(-)
drivers/scsi/ipr.h renamed from drivers/scsi/ipr.h~ipr_pci_reset6 +8 -2
@@ -37,8 +37,8 @@/* * Literals */ -#define IPR_DRIVER_VERSION "2.3.1" -#define IPR_DRIVER_DATE "(January 23, 2007)" +#define IPR_DRIVER_VERSION "2.3.2" +#define IPR_DRIVER_DATE "(January 26, 2007)"/* * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding
@@ -104,6 +104,9 @@#define IPR_IOASC_IOA_WAS_RESET 0x10000001#define IPR_IOASC_PCI_ACCESS_ERROR 0x10000002 +/* Driver data flags */ +#define IPR_USE_PCI_WARM_RESET 0x00000001 +#define IPR_DEFAULT_MAX_ERROR_DUMP 984#define IPR_NUM_LOG_HCAMS 2#define IPR_NUM_CFG_CHG_HCAMS 2
@@ -182,6 +185,7 @@#define IPR_WAIT_FOR_RESET_TIMEOUT (2 * HZ)#define IPR_CHECK_FOR_RESET_TIMEOUT (HZ / 10)#define IPR_WAIT_FOR_BIST_TIMEOUT (2 * HZ) +#define IPR_PCI_RESET_TIMEOUT (HZ / 2)#define IPR_DUMP_TIMEOUT (15 * HZ)/*
@@ -1058,6 +1062,7 @@ struct ipr_ioa_cfg { u8 allow_cmds:1; u8 allow_ml_add_del:1; u8 needs_hard_reset:1; + u8 needs_warm_reset:1;enum ipr_cache_state cache_state;u16 type;/* CCIN of the card */
@@ -1150,6 +1155,7 @@ struct ipr_ioa_cfg {struct pci_pool *ipr_cmd_pool;struct ipr_cmnd *reset_cmd; +int (*reset) (struct ipr_cmnd *);struct ata_host ata_host;char ipr_cmd_label[8 ];
drivers/scsi/ipr.c renamed from drivers/scsi/ipr.c~ipr_pci_reset6 +56 -5
97 lines not on this page · raw message
_
Greg,
I saw you pulled this into your gregkh-2.6 tree. Does that mean it is queued for 2.6.22?
Thanks,
Brian
Quoted 92 lines · Brian King
Adds a new API which can be used to issue various types of PCI-E reset, including PCI-E warm reset and PCI-E hot reset. This is needed for an ipr PCI-E adapter which does not properly implement BIST. Running BIST on this adapter results in PCI-E errors. The only reliable reset mechanism that exists on this hardware is PCI Fundamental reset (warm reset). Since driving this type of reset is architecture unique, this provides the necessary hooks for architectures to add this support.
Signed-off-by Brian King <[email protected]>---
linux-2.6-bjking1/drivers/pci/pci.c | 29 +++++++++++++++++++++++++++++ linux-2.6-bjking1/include/linux/pci.h | 14 ++++++++++++++ 2 files changed, 43 insertions(+)diff -puN
drivers/pci/pci.c~pci_pci_reset_apidrivers/pci/pci.cdrivers/pci/pci.c renamed from drivers/pci/pci.c~pci_pci_reset_api +29
-0@@ -893,6 +893,34 @@ pci_disable_device(struct pci_dev *dev) }/** +* pcibios_set_pcie_reset_state - set reset state for device dev +* @dev: the PCI-E device reset +* @state: Reset state to enter into +* +* +* Sets the PCI-E reset state for the device. This is the default +* implementation. Architecture implementations can override this. +*/ +int __attribute__ ((weak))pcibios_set_pcie_reset_state (struct pci_dev *dev, +enum pcie_reset_state state) +{ +return -EINVAL ; +} + +/** +* pci_set_pcie_reset_state - set reset state for device dev +* @dev: the PCI-E device reset +* @state: Reset state to enter into +* +* +* Sets the PCI reset state for the device. +*/ +int pci_set_pcie_reset_state (struct pci_dev *dev,enum pcie_reset_state state) +{ +return pcibios_set_pcie_reset_state (dev, state); +} + +/** * pci_enable_wake - enable device to generate PME# when suspended * @dev: - PCI device to operate on * @state: - Current state of device. @@ -1374,4 +1402,5 @@ EXPORT_SYMBOL(pci_set_power_state);EXPORT_SYMBOL (pci_save_state);EXPORT_SYMBOL (pci_restore_state);EXPORT_SYMBOL (pci_enable_wake); +EXPORT_SYMBOL_GPL (pci_set_pcie_reset_state);diff -puN
include/linux/pci.h~pci_pci_reset_apiinclude/linux/pci.hinclude/linux/pci.h renamed from include/linux/pci.h~pci_pci_reset_api +14
-0@@ -96,6 +96,19 @@ enum pci_channel_state { pci_channel_io_perm_failure = (__force pci_channel_state_t) 3, }; +typedef unsigned int __bitwise pcie_reset_state_t ; + +enum pcie_reset_state { +/* Reset is NOT asserted (Use to deassert reset) */ + pci_reset_normal = (__force pcie_reset_state_t )1 , + +/* Use #PERST to reset PCI-E device */ + pci_reset_pcie_warm_reset = (__force pcie_reset_state_t )2 , + +/* Use PCI-E Hot Reset to reset device */ + pci_reset_pcie_hot_reset = (__force pcie_reset_state_t )3 +}; +typedef unsigned short __bitwise pci_bus_flags_t ;enum pci_bus_flags {PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t )1 ,@@ -539,6 +552,7 @@ static inline int pci_is_managed(structvoid pci_disable_device (struct pci_dev *dev);void pci_set_master (struct pci_dev *dev); +int pci_set_pcie_reset_state (struct pci_dev *dev,enum pcie_reset_state state);#define HAVE_PCI_SET_MWI int __must_check pci_set_mwi (struct pci_dev *dev);void pci_clear_mwi (struct pci_dev *dev);_
Signature · 3 lines
Brian King eServer Storage I/O IBM Linux Technology Center
Quoted 4 lines · Brian King
Greg,
I saw you pulled this into your gregkh-2.6 tree. Does that mean it is queued for 2.6.22?
Yes it is. Is that a problem?
thanks,
greg k-h
Quoted 7 lines · Greg KH
Quoted 4 lines · Brian King
Greg,
I saw you pulled this into your gregkh-2.6 tree. Does that mean it is queued for 2.6.22?
Yes it is. Is that a problem?
No problem at all.
Thanks,
Brian
Signature · 3 lines
Brian King eServer Storage I/O IBM Linux Technology Center