diff --git a/core/bmi/inc/bmi.h b/core/bmi/inc/bmi.h index c79aeec26b..b016e87695 100644 --- a/core/bmi/inc/bmi.h +++ b/core/bmi/inc/bmi.h @@ -41,6 +41,27 @@ struct ol_context; CDF_STATUS ol_cds_init(cdf_device_t cdf_dev, void *hif_ctx); void ol_cds_free(void); +/** + * struct hif_config_info - Place Holder for hif confiruation + * @enable_uart_print: UART Print + * @enable_self_recovery: Self Recovery + * @enable_fw_log: To Enable FW LOG + * @enable_lpass_support: LPASS support + * @enable_ramdump_collection: Ramdump Collection + * + * Structure for holding ini parameters. + */ + +struct ol_config_info { + bool enable_uart_print; + bool enable_self_recovery; + bool enable_fw_log; + bool enable_lpass_support; + bool enable_ramdump_collection; +}; + +void ol_init_ini_config(struct ol_context *ol_ctx, + struct ol_config_info *cfg); #ifdef HIF_PCI void bmi_cleanup(struct ol_context *scn); CDF_STATUS bmi_done(struct ol_context *ol_ctx); diff --git a/core/bmi/src/i_bmi.h b/core/bmi/src/i_bmi.h index 3cc45ac7d5..f6bcbb4632 100644 --- a/core/bmi/src/i_bmi.h +++ b/core/bmi/src/i_bmi.h @@ -155,10 +155,11 @@ struct bmi_info { */ struct ol_context { struct bmi_info bmi; + struct ol_config_info cfg_info; uint8_t *cal_in_flash; cdf_device_t cdf_dev; - struct ol_softc *scn; cdf_work_t ramdump_work; + struct ol_softc *scn; struct targetdef_t { struct targetdef_s *targetdef; } tgt_def; @@ -187,4 +188,5 @@ CDF_STATUS bmi_done_local(struct ol_context *ol_ctx); CDF_STATUS ol_download_firmware(struct ol_context *ol_ctx); CDF_STATUS ol_configure_target(struct ol_context *ol_ctx); void ramdump_work_handler(void *arg); +struct ol_config_info *ol_get_ini_handle(struct ol_context *ol_ctx); #endif diff --git a/core/bmi/src/ol_fw.c b/core/bmi/src/ol_fw.c index 7e6a4d9b81..5fc5ad3cac 100644 --- a/core/bmi/src/ol_fw.c +++ b/core/bmi/src/ol_fw.c @@ -527,14 +527,14 @@ int ol_copy_ramdump(struct ol_softc *scn) return ret; } -void ramdump_work_handler(void *ol_context) +void ramdump_work_handler(void *data) { int ret; uint32_t host_interest_address; uint32_t dram_dump_values[4]; uint32_t target_type; struct hif_target_info *tgt_info; - struct ol_context *ol_ctx = ol_context; + struct ol_context *ol_ctx = data; struct ol_softc *ramdump_scn = ol_ctx->scn; if (!ramdump_scn) { @@ -612,7 +612,7 @@ void ol_target_failure(void *instance, CDF_STATUS status) struct ol_context *ol_ctx = instance; struct ol_softc *scn = ol_ctx->scn; tp_wma_handle wma = cds_get_context(CDF_MODULE_ID_WMA); - struct hif_config_info *ini_cfg = hif_get_ini_handle(scn); + struct ol_config_info *ini_cfg = ol_get_ini_handle(ol_ctx); int ret; ol_target_status target_status = hif_get_target_status(scn); @@ -672,7 +672,7 @@ CDF_STATUS ol_configure_target(struct ol_context *ol_ctx) #endif struct ol_softc *scn = ol_ctx->scn; struct hif_target_info *tgt_info = hif_get_target_info_handle(scn); - struct hif_config_info *ini_cfg = hif_get_ini_handle(scn); + struct ol_config_info *ini_cfg = ol_get_ini_handle(ol_ctx); uint32_t target_type = tgt_info->target_type; /* Tell target which HTC version it is used */ @@ -813,7 +813,8 @@ CDF_STATUS ol_configure_target(struct ol_context *ol_ctx) return CDF_STATUS_SUCCESS; } -static int ol_check_dataset_patch(struct ol_softc *scn, uint32_t *address) +static int +ol_check_dataset_patch(struct ol_softc *scn, uint32_t *address) { /* Check if patch file needed for this target type/version. */ return 0; @@ -1209,7 +1210,7 @@ CDF_STATUS ol_download_firmware(struct ol_context *ol_ctx) int status = !EOK; CDF_STATUS ret; struct hif_target_info *tgt_info = hif_get_target_info_handle(scn); - struct hif_config_info *ini_cfg = hif_get_ini_handle(scn); + struct ol_config_info *ini_cfg = ol_get_ini_handle(ol_ctx); uint32_t target_type = tgt_info->target_type; uint32_t target_version = tgt_info->target_version; struct bmi_info *bmi_ctx = GET_BMI_CONTEXT(ol_ctx); @@ -1310,8 +1311,8 @@ CDF_STATUS ol_download_firmware(struct ol_context *ol_ctx) /* Apply the patches */ if (ol_check_dataset_patch(scn, &address)) { - if ((ol_transfer_bin_file(ol_ctx, ATH_PATCH_FILE, address, false)) - != EOK) { + if ((ol_transfer_bin_file(ol_ctx, ATH_PATCH_FILE, address, + false)) != EOK) { return -1; } bmi_write_memory(hif_hia_item_address(target_type, @@ -1546,17 +1547,16 @@ void ol_dump_target_memory(struct ol_softc *scn, void *memory_block) } } -/**--------------------------------------------------------------------------- -* \brief ol_target_coredump -* -* Function to perform core dump for the target -* -* \param: scn - ol_softc handler -* memory_block - non-NULL reserved memory location -* block_len - size of the dump to collect -* -* \return: None -* --------------------------------------------------------------------------*/ +/** + * ol_target_coredump() - API to collect target ramdump + * @inst - private context + * @memory_block - non-NULL reserved memory location + * @block_len - size of the dump to collect + * + * Function to perform core dump for the target. + * + * Return: int + */ static int ol_target_coredump(void *inst, void *memory_block, uint32_t block_len) { @@ -1633,3 +1633,27 @@ static int ol_target_coredump(void *inst, void *memory_block, } return ret; } + +/** + * ol_get_ini_handle() - API to get Ol INI configuration + * @ol_ctx: OL Context + * + * Return: pointer to OL configuration + */ +struct ol_config_info *ol_get_ini_handle(struct ol_context *ol_ctx) +{ + return &ol_ctx->cfg_info; +} + +/** + * ol_init_ini_config() - API to initialize INI configuration + * @ol_ctx: OL Context + * @cfg: OL ini configuration + * + * Return: void + */ +void ol_init_ini_config(struct ol_context *ol_ctx, + struct ol_config_info *cfg) +{ + cdf_mem_copy(&ol_ctx->cfg_info, cfg, sizeof(struct ol_config_info)); +} diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index a6bd718fce..de193faba0 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -172,8 +172,8 @@ CDF_STATUS cds_open(void) tMacOpenParameters mac_openParms; cdf_device_t cdf_ctx; HTC_INIT_INFO htcInfo; - struct ol_softc *scn; struct ol_context *ol_ctx; + struct ol_softc *scn; void *HTCHandle; hdd_context_t *pHddCtx; @@ -255,7 +255,7 @@ CDF_STATUS cds_open(void) goto err_sched_close; } - hdd_update_hif_config(scn, pHddCtx); + hdd_update_config(pHddCtx); ol_ctx = cds_get_context(CDF_MODULE_ID_BMI); /* Initialize BMI and Download firmware */ diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index a08d7362c6..30c514ac67 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1525,5 +1525,5 @@ hdd_adapter_t *hdd_get_adapter_by_sme_session_id(hdd_context_t *hdd_ctx, phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width); uint8_t wlan_hdd_find_opclass(tHalHandle hal, uint8_t channel, uint8_t bw_offset); -void hdd_update_hif_config(void *scn, hdd_context_t *hdd_ctx); +void hdd_update_config(hdd_context_t *hdd_ctx); #endif /* end #if !defined(WLAN_HDD_MAIN_H) */ diff --git a/core/hdd/src/wlan_hdd_ftm.c b/core/hdd/src/wlan_hdd_ftm.c index aee47a47fb..4cd57dce29 100644 --- a/core/hdd/src/wlan_hdd_ftm.c +++ b/core/hdd/src/wlan_hdd_ftm.c @@ -309,7 +309,7 @@ static CDF_STATUS wlan_ftm_cds_open(v_CONTEXT_t p_cds_context, goto err_htc_close; } #if defined(QCA_WIFI_FTM) - hdd_update_hif_config(pHifContext, hdd_ctx); + hdd_update_config(hdd_ctx); pHtcContext = cds_get_context(CDF_MODULE_ID_HTC); if (!pHtcContext) { diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index af356ed1d5..af3d07e4ea 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -105,6 +105,7 @@ extern int hdd_hostapd_stop(struct net_device *dev); #include "cds_concurrency.h" #include "wlan_hdd_green_ap.h" #include "platform_icnss.h" +#include "bmi.h" #ifdef MODULE #define WLAN_MODULE_NAME module_name(THIS_MODULE) @@ -6989,23 +6990,57 @@ static inline bool hdd_is_lpass_supported(hdd_context_t *hdd_ctx) #endif /** - * hdd_update_hif_config() - Initialize HIF ini parameters - * @scn: HIF Context - * @hdd_ctx: HDD Context + * hdd_update_ol_config - API to update ol configuration parameters + * @hdd_ctx: HDD context * - * API is used to initialize all HIF configuration parameters * Return: void */ -void hdd_update_hif_config(void *scn, hdd_context_t *hdd_ctx) +static void hdd_update_ol_config(hdd_context_t *hdd_ctx) { - struct hif_config_info *cfg = hif_get_ini_handle(scn); + struct ol_config_info cfg; + struct ol_context *ol_ctx = cds_get_context(CDF_MODULE_ID_BMI); - cfg->enable_self_recovery = hdd_ctx->config->enableSelfRecovery; - cfg->enable_uart_print = hdd_ctx->config->enablefwprint; - cfg->enable_fw_log = hdd_ctx->config->enable_fw_log; - cfg->enable_ramdump_collection = - hdd_ctx->config->is_ramdump_enabled; - cfg->enable_lpass_support = hdd_is_lpass_supported(hdd_ctx); + if (!ol_ctx) + return; + + cfg.enable_self_recovery = hdd_ctx->config->enableSelfRecovery; + cfg.enable_uart_print = hdd_ctx->config->enablefwprint; + cfg.enable_fw_log = hdd_ctx->config->enable_fw_log; + cfg.enable_ramdump_collection = hdd_ctx->config->is_ramdump_enabled; + cfg.enable_lpass_support = hdd_is_lpass_supported(hdd_ctx); + + ol_init_ini_config(ol_ctx, &cfg); +} + +/** + * hdd_update_hif_config - API to update HIF configuration parameters + * @hdd_ctx: HDD Context + * + * Return: void + */ +static void hdd_update_hif_config(hdd_context_t *hdd_ctx) +{ + struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF); + struct hif_config_info cfg; + + if (!scn) + return; + + cfg.enable_self_recovery = hdd_ctx->config->enableSelfRecovery; + hif_init_ini_config(scn, &cfg); +} + +/** + * hdd_update_config() - Initialize driver per module ini parameters + * @hdd_ctx: HDD Context + * + * API is used to initialize all driver per module configuration parameters + * Return: void + */ +void hdd_update_config(hdd_context_t *hdd_ctx) +{ + hdd_update_ol_config(hdd_ctx); + hdd_update_hif_config(hdd_ctx); } /* Register the module init/exit functions */ diff --git a/core/utils/epping/src/epping_main.c b/core/utils/epping/src/epping_main.c index 244f10f641..68e03eaa05 100644 --- a/core/utils/epping/src/epping_main.c +++ b/core/utils/epping/src/epping_main.c @@ -181,7 +181,6 @@ int epping_enable(struct device *parent_dev) HTC_INIT_INFO htcInfo; struct ol_softc *scn; tSirMacAddr adapter_macAddr; - struct hif_config_info *cfg; struct hif_target_info *tgt_info; struct ol_context *ol_ctx; @@ -216,11 +215,6 @@ int epping_enable(struct device *parent_dev) return -1; } - cfg = hif_get_ini_handle(scn); - - cfg->enable_uart_print = 0; - cfg->enable_fw_log = 0; - tgt_info = hif_get_target_info_handle(scn); /* store target type and target version info in hdd ctx */