Browse Source

qcacmn: Record data if pci write during suspended state

When FW was enabling WOW, a ring HP update interrupt is seen
which led to fw crash.
This change records any PCI writes that went through during
runtime suspend from host.

Change-Id: I3c44760ebaf49a131b483813522fe3e451957215
CRs-Fixed: 3280166
Ananya Gupta 2 years ago
parent
commit
61b836202a
2 changed files with 51 additions and 0 deletions
  1. 17 0
      hal/wifi3.0/hal_internal.h
  2. 34 0
      hal/wifi3.0/hal_srng.c

+ 17 - 0
hal/wifi3.0/hal_internal.h

@@ -1285,6 +1285,23 @@ union hal_shadow_reg_cfg {
 #endif
 #endif
 };
 };
 
 
+#ifdef HAL_RECORD_SUSPEND_WRITE
+#define HAL_SUSPEND_WRITE_HISTORY_MAX 256
+
+struct hal_suspend_write_record {
+	uint64_t ts;
+	uint8_t ring_id;
+	uit32_t value;
+	uint32_t direct_wcount;
+};
+
+struct hal_suspend_write_history {
+	qdf_atomic_t index;
+	struct hal_suspend_write_record record[HAL_SUSPEND_WRITE_HISTORY_MAX];
+
+};
+#endif
+
 /**
 /**
  * struct hal_soc - HAL context to be used to access SRNG APIs
  * struct hal_soc - HAL context to be used to access SRNG APIs
  *		    (currently used by data path and
  *		    (currently used by data path and

+ 34 - 0
hal/wifi3.0/hal_srng.c

@@ -978,6 +978,38 @@ static inline void hal_delayed_reg_write_deinit(struct hal_soc *hal)
 #endif
 #endif
 
 
 #ifdef FEATURE_HAL_DELAYED_REG_WRITE
 #ifdef FEATURE_HAL_DELAYED_REG_WRITE
+#ifdef HAL_RECORD_SUSPEND_WRITE
+static struct hal_suspend_write_history
+		g_hal_suspend_write_history[HAL_SUSPEND_WRITE_HISTORY_MAX];
+
+static
+void hal_event_suspend_record(uint8_t ring_id, uint32_t value, uint32_t count)
+{
+	uint32_t index = qdf_atomic_read(g_hal_suspend_write_history.index) &
+					(HAL_SUSPEND_WRITE_HISTORY_MAX - 1);
+	struct hal_suspend_write_record *cur_event =
+					&hal_suspend_write_event.record[index];
+
+	cur_event->ts = qdf_get_log_timestamp();
+	cur_event->ring_id = ring_id;
+	cur_event->value = value;
+	cur_event->direct_wcount = count;
+	qdf_atomic_inc(g_hal_suspend_write_history.index);
+}
+
+static inline
+void hal_record_suspend_write(uint8_t ring_id, uint32_t value, uint32_t count)
+{
+	if (hif_rtpm_get_state() >= HIF_RTPM_STATE_SUSPENDING)
+		hal_event_suspend_record(ring_id, value, count);
+}
+#else
+static inline
+void hal_record_suspend_write(uint8_t ring_id, uint32_t value, uint32_t count)
+{
+}
+#endif
+
 #ifdef QCA_WIFI_QCA6750
 #ifdef QCA_WIFI_QCA6750
 void hal_delayed_reg_write(struct hal_soc *hal_soc,
 void hal_delayed_reg_write(struct hal_soc *hal_soc,
 			   struct hal_srng *srng,
 			   struct hal_srng *srng,
@@ -1034,6 +1066,8 @@ void hal_delayed_reg_write(struct hal_soc *hal_soc,
 	} else {
 	} else {
 		hal_reg_write_enqueue(hal_soc, srng, addr, value);
 		hal_reg_write_enqueue(hal_soc, srng, addr, value);
 	}
 	}
+
+	hal_record_suspend_write(srng->ring_id, value, srng->wstats.direct);
 }
 }
 #endif
 #endif
 #endif
 #endif