diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 9be47c754d46..52e34defaac2 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -3306,13 +3306,6 @@ void hdd_start_driver_ops_timer(int drv_op); */ void hdd_stop_driver_ops_timer(void); -/** - * hdd_pld_ipa_uc_shutdown_pipes() - Disconnect IPA WDI pipes during PDR - * - * Return: None - */ -void hdd_pld_ipa_uc_shutdown_pipes(void); - /** * hdd_limit_max_per_index_score() -check if per index score doesn't exceed 100% * (0x64). If it exceed make it 100% diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index d3d1d6f6bc81..2c90c094c56f 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -1483,7 +1483,7 @@ static void wlan_hdd_purge_notifier(void) hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); if (!hdd_ctx) { - hdd_err("hdd context is NULL return!!"); + hdd_err("hdd_ctx is null"); return; } @@ -1493,43 +1493,15 @@ static void wlan_hdd_purge_notifier(void) cds_shutdown_notifier_call(); cds_shutdown_notifier_purge(); mutex_unlock(&hdd_ctx->iface_change_lock); + hdd_exit(); } -/** - * wlan_hdd_set_the_pld_uevent() - set the pld event - * @uevent: uevent status - * - * Return: void - */ -static void wlan_hdd_set_the_pld_uevent(struct pld_uevent_data *uevent) +static void __hdd_firmware_down_handler(void) { - switch (uevent->uevent) { - case PLD_RECOVERY: - cds_set_target_ready(false); - cds_set_recovery_in_progress(true); - break; - case PLD_FW_DOWN: - cds_set_target_ready(false); - cds_set_recovery_in_progress(true); - break; - } -} - -/** - * wlan_hdd_handle_the_pld_uevent() - handle the pld event - * @uevent: uevent status - * - * Return: void - */ -static void wlan_hdd_handle_the_pld_uevent(struct pld_uevent_data *uevent) -{ - enum cds_driver_state driver_state; struct hdd_context *hdd_ctx; - driver_state = cds_get_driver_state(); - - if (driver_state == CDS_DRIVER_STATE_UNINITIALIZED) + if (cds_get_driver_state() == CDS_DRIVER_STATE_UNINITIALIZED) return; if (cds_is_driver_loading()) @@ -1537,55 +1509,62 @@ static void wlan_hdd_handle_the_pld_uevent(struct pld_uevent_data *uevent) hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); if (!hdd_ctx) { - hdd_err("hdd_ctx is NULL return"); + hdd_err("hdd_ctx is null"); return; } if (hdd_ctx->driver_status == DRIVER_MODULES_CLOSED) { - hdd_info("Driver modules are already closed!"); + hdd_info("Driver modules are already closed"); return; } - switch (uevent->uevent) { - case PLD_RECOVERY: - cds_set_target_ready(false); - hdd_pld_ipa_uc_shutdown_pipes(); - break; - case PLD_FW_DOWN: - qdf_complete_wait_events(); - cds_set_target_ready(false); - wlan_cfg80211_cleanup_scan_queue(hdd_ctx->pdev, NULL); - if (pld_is_fw_rejuvenate(hdd_ctx->parent_dev) && - ucfg_ipa_is_enabled()) + cds_set_target_ready(false); + qdf_complete_wait_events(); + wlan_cfg80211_cleanup_scan_queue(hdd_ctx->pdev, NULL); + + if (ucfg_ipa_is_enabled()) { + ucfg_ipa_uc_force_pipe_shutdown(hdd_ctx->pdev); + + if (pld_is_fw_rejuvenate(hdd_ctx->parent_dev)) ucfg_ipa_fw_rejuvenate_send_msg(hdd_ctx->pdev); + } +} + +static void hdd_firmware_down_handler(void) +{ + hdd_info("Received firmware down indication"); + + cds_set_target_ready(false); + cds_set_recovery_in_progress(true); + + mutex_lock(&hdd_init_deinit_lock); + __hdd_firmware_down_handler(); + mutex_unlock(&hdd_init_deinit_lock); + + wlan_hdd_purge_notifier(); +} + +/** + * wlan_hdd_pld_uevent() - platform uevent handler + * @dev: device on which the uevent occurred + * @event_data: uevent parameters + * + * Return: None + */ +static void +wlan_hdd_pld_uevent(struct device *dev, struct pld_uevent_data *event_data) +{ + hdd_debug("Received uevent %d", event_data->uevent); + + switch (event_data->uevent) { + case PLD_FW_DOWN: + hdd_firmware_down_handler(); break; default: break; } } -/** - * wlan_hdd_pld_uevent() - update driver status - * @dev: device - * @uevent: uevent status - * - * Return: void - */ -static void wlan_hdd_pld_uevent(struct device *dev, - struct pld_uevent_data *uevent) -{ - hdd_enter(); - hdd_info("pld event %d", uevent->uevent); - - wlan_hdd_set_the_pld_uevent(uevent); - mutex_lock(&hdd_init_deinit_lock); - wlan_hdd_handle_the_pld_uevent(uevent); - mutex_unlock(&hdd_init_deinit_lock); - - wlan_hdd_purge_notifier(); - hdd_exit(); -} - #ifdef FEATURE_RUNTIME_PM /** * wlan_hdd_pld_runtime_suspend() - runtime suspend function registered to PLD diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 5396d63ba60c..4eedbe928b99 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -14534,16 +14534,6 @@ void hdd_drv_ops_inactivity_handler(void) cds_trigger_recovery(QDF_REASON_UNSPECIFIED); } -void hdd_pld_ipa_uc_shutdown_pipes(void) -{ - struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); - - if (!hdd_ctx) - return; - - ucfg_ipa_uc_force_pipe_shutdown(hdd_ctx->pdev); -} - /** * hdd_set_rx_mode_rps() - Enable/disable RPS in SAP mode * @struct hdd_context *hdd_ctx diff --git a/core/pld/inc/pld_common.h b/core/pld/inc/pld_common.h index c2ed1b5ac7a9..a359c8bcb256 100644 --- a/core/pld/inc/pld_common.h +++ b/core/pld/inc/pld_common.h @@ -119,13 +119,15 @@ struct pld_platform_cap { }; /** - * enum pld_uevent - WLAN FW status - * @PLD_RECOVERY: driver is recovering - * @PLD_FW_DOWN: FW is down + * enum pld_uevent - PLD uevent event types + * @PLD_FW_DOWN: firmware is down + * @PLD_FW_CRASHED: firmware has crashed + * @PLD_FW_RECOVERY_START: firmware is starting recovery */ enum pld_uevent { - PLD_RECOVERY, PLD_FW_DOWN, + PLD_FW_CRASHED, + PLD_FW_RECOVERY_START, }; /** diff --git a/core/pld/src/pld_pcie.c b/core/pld/src/pld_pcie.c index 485b530bee75..c9d658b663f0 100644 --- a/core/pld/src/pld_pcie.c +++ b/core/pld/src/pld_pcie.c @@ -192,7 +192,7 @@ static void pld_pcie_uevent(struct pci_dev *pdev, uint32_t status) switch (status) { case CNSS_RECOVERY: - data.uevent = PLD_RECOVERY; + data.uevent = PLD_FW_RECOVERY_START; break; case CNSS_FW_DOWN: data.uevent = PLD_FW_DOWN; diff --git a/core/pld/src/pld_snoc.c b/core/pld/src/pld_snoc.c index a39351edc4be..8a4aed5237e3 100644 --- a/core/pld/src/pld_snoc.c +++ b/core/pld/src/pld_snoc.c @@ -245,7 +245,7 @@ static int pld_snoc_uevent(struct device *dev, switch (uevent->uevent) { case ICNSS_UEVENT_FW_CRASHED: - data.uevent = PLD_RECOVERY; + data.uevent = PLD_FW_CRASHED; break; case ICNSS_UEVENT_FW_DOWN: if (uevent->data == NULL)