Jelajahi Sumber

cnss2: Add base changes for pci hang data support on HMT

Add base changes for pci hang data support for HMT.

Change-Id: I0e1dde6649b36ffdca5a6a75f2198f4fde50d211
CRs-Fixed: 3111908
Sandeep Singh 2 tahun lalu
induk
melakukan
1e6a925b34
2 mengubah file dengan 23 tambahan dan 0 penghapusan
  1. 21 0
      cnss2/pci.c
  2. 2 0
      inc/cnss2.h

+ 21 - 0
cnss2/pci.c

@@ -1381,6 +1381,27 @@ int cnss_pci_link_down(struct device *dev)
 }
 EXPORT_SYMBOL(cnss_pci_link_down);
 
+int cnss_pci_get_reg_dump(struct device *dev, uint8_t *buffer, uint32_t len)
+{
+	struct pci_dev *pci_dev = to_pci_dev(dev);
+	struct cnss_pci_data *pci_priv = cnss_get_pci_priv(pci_dev);
+
+	if (!pci_priv) {
+		cnss_pr_err("pci_priv is NULL\n");
+		return -ENODEV;
+	}
+
+	if (pci_priv->pci_link_state == PCI_LINK_DOWN) {
+		cnss_pr_dbg("No PCIe reg dump since PCIe is suspended(D3)\n");
+		return -EACCES;
+	}
+
+	cnss_pr_dbg("Start to get PCIe reg dump\n");
+
+	return _cnss_pci_get_reg_dump(pci_priv, buffer, len);
+}
+EXPORT_SYMBOL(cnss_pci_get_reg_dump);
+
 int cnss_pcie_is_device_down(struct cnss_pci_data *pci_priv)
 {
 	struct cnss_plat_data *plat_priv;

+ 2 - 0
inc/cnss2.h

@@ -290,4 +290,6 @@ extern int cnss_get_mem_segment_info(enum cnss_remote_mem_type type,
 				     struct cnss_mem_segment segment[],
 				     u32 segment_count);
 extern int cnss_get_pci_slot(struct device *dev);
+extern int cnss_pci_get_reg_dump(struct device *dev, uint8_t *buffer,
+				 uint32_t len);
 #endif /* _NET_CNSS2_H */