From bda2c4be27b3d1ecf475ea3d7acb63d99c499251 Mon Sep 17 00:00:00 2001 From: Mohammed Siddiq Date: Wed, 25 Nov 2020 17:41:36 +0530 Subject: [PATCH] qcacld-3.0: Add pld api to get PCI reg dump on SSR Add pld api to get PCI register dump on FW crash due to PCI bus failure. Change-Id: Ie30edbe2c60b0e71912667491c9fadbbe92373c4 --- core/pld/inc/pld_common.h | 1 + core/pld/src/pld_common.c | 29 +++++++++++++++++++++++++++++ core/pld/src/pld_pcie.h | 20 ++++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/core/pld/inc/pld_common.h b/core/pld/inc/pld_common.h index 7f1fb79a53bb..399d9ae2a650 100644 --- a/core/pld/inc/pld_common.h +++ b/core/pld/inc/pld_common.h @@ -470,6 +470,7 @@ void pld_allow_l1(struct device *dev); int pld_set_pcie_gen_speed(struct device *dev, u8 pcie_gen_speed); void pld_is_pci_link_down(struct device *dev); +void pld_get_bus_reg_dump(struct device *dev, uint8_t *buf, uint32_t len); int pld_shadow_control(struct device *dev, bool enable); void pld_schedule_recovery_work(struct device *dev, enum pld_recovery_reason reason); diff --git a/core/pld/src/pld_common.c b/core/pld/src/pld_common.c index 26acd52933c6..1670b0613edf 100644 --- a/core/pld/src/pld_common.c +++ b/core/pld/src/pld_common.c @@ -693,6 +693,35 @@ void pld_is_pci_link_down(struct device *dev) } } +/** + * pld_get_bus_reg_dump() - Get bus reg dump + * @dev: device + * @buffer: buffer for hang data + * @len: len of hang data + * + * Get pci reg dump for hang data. + * + * Return: void + */ +void pld_get_bus_reg_dump(struct device *dev, uint8_t *buf, uint32_t len) +{ + switch (pld_get_bus_type(dev)) { + case PLD_BUS_TYPE_PCIE_FW_SIM: + case PLD_BUS_TYPE_IPCI_FW_SIM: + break; + case PLD_BUS_TYPE_PCIE: + pld_pcie_get_reg_dump(dev, buf, len); + break; + case PLD_BUS_TYPE_SNOC_FW_SIM: + case PLD_BUS_TYPE_SNOC: + case PLD_BUS_TYPE_IPCI: + break; + default: + pr_err("Invalid device type\n"); + break; + } +} + /** * pld_schedule_recovery_work() - Schedule recovery work * @dev: device diff --git a/core/pld/src/pld_pcie.h b/core/pld/src/pld_pcie.h index 0d7b0d7647d9..07ed2933cf7b 100644 --- a/core/pld/src/pld_pcie.h +++ b/core/pld/src/pld_pcie.h @@ -187,6 +187,12 @@ static inline void pld_pcie_link_down(struct device *dev) { } +static inline int pld_pcie_get_reg_dump(struct device *dev, uint8_t *buf, + uint32_t len) +{ + return 0; +} + static inline int pld_pcie_is_fw_down(struct device *dev) { return 0; @@ -500,6 +506,20 @@ static inline void pld_pcie_link_down(struct device *dev) cnss_pci_link_down(dev); } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) +static inline int pld_pcie_get_reg_dump(struct device *dev, uint8_t *buf, + uint32_t len) +{ + return cnss_pci_get_reg_dump(dev, buf, len); +} +#else +static inline int pld_pcie_get_reg_dump(struct device *dev, uint8_t *buf, + uint32_t len) +{ + return 0; +} +#endif + static inline int pld_pcie_is_fw_down(struct device *dev) { return cnss_pci_is_device_down(dev);