From 4d77312b6dd95507034c60dc13f1266a2b2b8e69 Mon Sep 17 00:00:00 2001 From: Nisha Menon Date: Fri, 10 Jan 2020 16:31:17 -0800 Subject: [PATCH] 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 --- hal/wifi3.0/hal_api.h | 17 +++++++++-------- qdf/inc/qdf_platform.h | 10 +++++++++- qdf/src/qdf_platform.c | 11 ++++++++++- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/hal/wifi3.0/hal_api.h b/hal/wifi3.0/hal_api.h index 616bab4b21..a5c94ed931 100644 --- a/hal/wifi3.0/hal_api.h +++ b/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; } diff --git a/qdf/inc/qdf_platform.h b/qdf/inc/qdf_platform.h index e5a165ad22..091c48a52a 100644 --- a/qdf/inc/qdf_platform.h +++ b/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*/ diff --git a/qdf/src/qdf_platform.c b/qdf/src/qdf_platform.c index 11554b8007..4556ccbbca 100644 --- a/qdf/src/qdf_platform.c +++ b/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); +