Browse Source

qcacmn: get the data during the issue with the bus

Whenever there is a recovery triggered, if there is a
failure in reading the bus id collect the bus specific
registers to understand the reason for the failures.

Change-Id: I7387d63d9205d24fd881824b9a9fac48a7816c73
CRs-Fixed: 2833331
Arun Kumar Khandavalli 4 years ago
parent
commit
3c61a1d942

+ 3 - 2
hif/src/dispatcher/dummy.c

@@ -406,9 +406,10 @@ int hif_dummy_config_irq_by_ceid(struct hif_softc *scn, int ce_id)
  * @data: hang event data buffer
  * @offset: offset at which data needs to be written
  *
- * Return: None
+ * Return: bool
  */
-void hif_dummy_log_bus_info(struct hif_softc *scn, uint8_t *data,
+bool hif_dummy_log_bus_info(struct hif_softc *scn, uint8_t *data,
 			    unsigned int *offset)
 {
+	return false;
 }

+ 1 - 1
hif/src/dispatcher/dummy.h

@@ -88,5 +88,5 @@ int hif_dummy_map_ce_to_irq(struct hif_softc *scn, int ce_id);
 int hif_dummy_addr_in_boundary(struct hif_softc *scn, uint32_t offset);
 void hif_dummy_config_irq_affinity(struct hif_softc *scn);
 int hif_dummy_config_irq_by_ceid(struct hif_softc *scn, int ce_id);
-void hif_dummy_log_bus_info(struct hif_softc *scn, uint8_t *data,
+bool hif_dummy_log_bus_info(struct hif_softc *scn, uint8_t *data,
 			    unsigned int *offset);

+ 4 - 2
hif/src/dispatcher/multibus.c

@@ -576,10 +576,12 @@ int hif_config_irq_by_ceid(struct hif_softc *hif_sc, int ce_id)
 }
 
 #ifdef HIF_BUS_LOG_INFO
-void hif_log_bus_info(struct hif_softc *hif_sc, uint8_t *data,
+bool hif_log_bus_info(struct hif_softc *hif_sc, uint8_t *data,
 		      unsigned int *offset)
 {
 	if (hif_sc->bus_ops.hif_log_bus_info)
-		hif_sc->bus_ops.hif_log_bus_info(hif_sc, data, offset);
+		return hif_sc->bus_ops.hif_log_bus_info(hif_sc, data, offset);
+
+	return false;
 }
 #endif

+ 5 - 4
hif/src/dispatcher/multibus.h

@@ -92,7 +92,7 @@ struct hif_bus_ops {
 	bool (*hif_needs_bmi)(struct hif_softc *hif_sc);
 	void (*hif_config_irq_affinity)(struct hif_softc *hif_sc);
 	int (*hif_config_irq_by_ceid)(struct hif_softc *hif_sc, int ce_id);
-	void (*hif_log_bus_info)(struct hif_softc *scn, uint8_t *data,
+	bool (*hif_log_bus_info)(struct hif_softc *scn, uint8_t *data,
 				 unsigned int *offset);
 };
 
@@ -279,15 +279,16 @@ int hif_config_irq_by_ceid(struct hif_softc *hif_sc, int ce_id);
  * @data: hang event data buffer
  * @offset: offset at which data needs to be written
  *
- * Return:  None
+ * Return:  true if bus_id is invalid else false
  */
-void hif_log_bus_info(struct hif_softc *scn, uint8_t *data,
+bool hif_log_bus_info(struct hif_softc *scn, uint8_t *data,
 		      unsigned int *offset);
 #else
 static inline
-void hif_log_bus_info(struct hif_softc *scn, uint8_t *data,
+bool hif_log_bus_info(struct hif_softc *scn, uint8_t *data,
 		      unsigned int *offset)
 {
+	return false;
 }
 #endif
 #endif /* _MULTIBUS_H_ */

+ 6 - 2
hif/src/hif_main.c

@@ -483,6 +483,7 @@ int hif_recovery_notifier_cb(struct notifier_block *block, unsigned long state,
 	struct qdf_notifer_data *notif_data = data;
 	qdf_notif_block *notif_block;
 	struct hif_softc *hif_handle;
+	bool bus_id_invalid;
 
 	if (!data || !block)
 		return -EINVAL;
@@ -493,8 +494,11 @@ int hif_recovery_notifier_cb(struct notifier_block *block, unsigned long state,
 	if (!hif_handle)
 		return -EINVAL;
 
-	hif_log_bus_info(hif_handle, notif_data->hang_data,
-			 &notif_data->offset);
+	bus_id_invalid = hif_log_bus_info(hif_handle, notif_data->hang_data,
+					  &notif_data->offset);
+	if (bus_id_invalid)
+		return NOTIFY_STOP_MASK;
+
 	hif_log_ce_info(hif_handle, notif_data->hang_data,
 			&notif_data->offset);
 

+ 12 - 3
hif/src/pcie/if_pci.c

@@ -59,6 +59,7 @@
 #include "ahb_api.h"
 #include "wlan_cfg.h"
 #include "qdf_hang_event_notifier.h"
+#include "qdf_platform.h"
 
 /* Maximum ms timeout for host to wake up target */
 #define PCIE_WAKE_TIMEOUT 1000
@@ -2352,7 +2353,7 @@ static inline int __hif_check_link_status(struct hif_softc *scn)
 
 
 #ifdef HIF_BUS_LOG_INFO
-void hif_log_pcie_info(struct hif_softc *scn, uint8_t *data,
+bool hif_log_pcie_info(struct hif_softc *scn, uint8_t *data,
 		       unsigned int *offset)
 {
 	struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn);
@@ -2361,7 +2362,7 @@ void hif_log_pcie_info(struct hif_softc *scn, uint8_t *data,
 
 	if (!sc) {
 		hif_err("HIF Bus Context is Invalid");
-		return;
+		return false;
 	}
 
 	pfrm_read_config_word(sc->pdev, PCI_DEVICE_ID, &info.dev_id);
@@ -2371,10 +2372,18 @@ void hif_log_pcie_info(struct hif_softc *scn, uint8_t *data,
 			     size - QDF_HANG_EVENT_TLV_HDR_SIZE);
 
 	if (*offset + size > QDF_WLAN_HANG_FW_OFFSET)
-		return;
+		return false;
 
 	qdf_mem_copy(data + *offset, &info, size);
 	*offset = *offset + size;
+
+	if (info.dev_id == sc->devid)
+		return false;
+
+	qdf_recovery_reason_update(QCA_HANG_BUS_FAILURE);
+	qdf_get_bus_reg_dump(scn->qdf_dev->dev, data,
+			     (QDF_WLAN_HANG_FW_OFFSET - size));
+	return true;
 }
 #endif
 

+ 3 - 2
hif/src/pcie/if_pci.h

@@ -196,13 +196,14 @@ void hif_print_pci_stats(struct hif_pci_softc *pci_scn)
 }
 #endif /* FORCE_WAKE */
 #ifdef HIF_BUS_LOG_INFO
-void hif_log_pcie_info(struct hif_softc *scn, uint8_t *data,
+bool hif_log_pcie_info(struct hif_softc *scn, uint8_t *data,
 		       unsigned int *offset);
 #else
 static inline
-void hif_log_pcie_info(struct hif_softc *scn, uint8_t *data,
+bool hif_log_pcie_info(struct hif_softc *scn, uint8_t *data,
 		       unsigned int *offset)
 {
+	return false;
 }
 #endif
 #endif /* __ATH_PCI_H__ */