ソースを参照

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
Mohammed Siddiq 4 年 前
コミット
76ca8c9fc1
3 ファイル変更50 行追加0 行削除
  1. 1 0
      core/pld/inc/pld_common.h
  2. 28 0
      core/pld/src/pld_common.c
  3. 21 0
      core/pld/src/pld_pcie.h

+ 1 - 0
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);

+ 28 - 0
core/pld/src/pld_common.c

@@ -693,6 +693,34 @@ 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:
+		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

+ 21 - 0
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,21 @@ static inline void pld_pcie_link_down(struct device *dev)
 	cnss_pci_link_down(dev);
 }
 
+#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) && \
+		(LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 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);