浏览代码

qcacmn: Check if FW or host in recovery before invoking assert

Force wake request is sent before register write. If this req
fails check if FW is down or host is in recovery before
asserting.

Change-Id: I6d31b1f95b68ae4e462f59ed32ed933de55cacae
CRs-Fixed: 2601364
Nisha Menon 5 年之前
父节点
当前提交
4d77312b6d
共有 3 个文件被更改,包括 28 次插入10 次删除
  1. 9 8
      hal/wifi3.0/hal_api.h
  2. 9 1
      qdf/inc/qdf_platform.h
  3. 10 1
      qdf/src/qdf_platform.c

+ 9 - 8
hal/wifi3.0/hal_api.h

@@ -25,6 +25,7 @@
 #include "hal_internal.h"
 #include "hif.h"
 #include "hif_io32.h"
+#include "qdf_platform.h"
 
 /* calculate the register address offset from bar0 of shadow register x */
 #if defined(QCA_WIFI_QCA6390) || defined(QCA_WIFI_QCA6490)
@@ -296,7 +297,7 @@ static inline void hal_write32_mb(struct hal_soc *hal_soc, uint32_t offset,
 		ret = hif_force_wake_request(hal_soc->hif_handle);
 		if (ret) {
 			hal_err("Wake up request failed");
-			QDF_BUG(0);
+			qdf_check_state_before_panic();
 			return;
 		}
 	}
@@ -315,8 +316,8 @@ static inline void hal_write32_mb(struct hal_soc *hal_soc, uint32_t offset,
 	if (!hal_soc->init_phase) {
 		ret = hif_force_wake_release(hal_soc->hif_handle);
 		if (ret) {
-			hal_err("Wake up request failed");
-			QDF_BUG(0);
+			hal_err("Wake up release failed");
+			qdf_check_state_before_panic();
 			return;
 		}
 	}
@@ -344,7 +345,7 @@ static inline void hal_write32_mb_confirm(struct hal_soc *hal_soc,
 		ret = hif_force_wake_request(hal_soc->hif_handle);
 		if (ret) {
 			hal_err("Wake up request failed");
-			QDF_BUG(0);
+			qdf_check_state_before_panic();
 			return;
 		}
 	}
@@ -370,8 +371,8 @@ static inline void hal_write32_mb_confirm(struct hal_soc *hal_soc,
 	if (!hal_soc->init_phase) {
 		ret = hif_force_wake_release(hal_soc->hif_handle);
 		if (ret) {
-			hal_err("Wake up request failed");
-			QDF_BUG(0);
+			hal_err("Wake up release failed");
+			qdf_check_state_before_panic();
 			return;
 		}
 	}
@@ -461,7 +462,7 @@ uint32_t hal_read32_mb(struct hal_soc *hal_soc, uint32_t offset)
 	if ((!hal_soc->init_phase) &&
 	    hif_force_wake_request(hal_soc->hif_handle)) {
 		hal_err("Wake up request failed");
-		QDF_BUG(0);
+		qdf_check_state_before_panic();
 		return 0;
 	}
 
@@ -479,7 +480,7 @@ uint32_t hal_read32_mb(struct hal_soc *hal_soc, uint32_t offset)
 	if ((!hal_soc->init_phase) &&
 	    hif_force_wake_release(hal_soc->hif_handle)) {
 		hal_err("Wake up release failed");
-		QDF_BUG(0);
+		qdf_check_state_before_panic();
 		return 0;
 	}
 

+ 9 - 1
qdf/inc/qdf_platform.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -219,5 +219,13 @@ bool qdf_is_drv_connected(void);
 void qdf_register_drv_connected_callback(qdf_is_drv_connected_callback
 					 is_drv_connected);
 
+/**
+ * qdf_check_state_before_panic() - API to check if FW is down
+ * or driver is in recovery before calling assert
+ *
+ * Return: none
+ */
+void qdf_check_state_before_panic(void);
+
 #endif /*_QDF_PLATFORM_H*/
 

+ 10 - 1
qdf/src/qdf_platform.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -148,3 +148,12 @@ bool qdf_is_drv_connected(void)
 	return is_drv_connected_cb();
 }
 qdf_export_symbol(qdf_is_drv_connected);
+
+void qdf_check_state_before_panic(void)
+{
+	if (!qdf_is_recovering() && !qdf_is_fw_down())
+		QDF_BUG(0);
+}
+
+qdf_export_symbol(qdf_check_state_before_panic);
+