diff --git a/hif/src/ce/ce_main.c b/hif/src/ce/ce_main.c index a794ccfe3e7f..b1b60b7b6146 100644 --- a/hif/src/ce/ce_main.c +++ b/hif/src/ce/ce_main.c @@ -418,7 +418,6 @@ static struct service_to_pipe target_service_to_ce_map_qca6290[] = { { HTC_CTRL_RSVD_SVC, PIPEDIR_IN , 2, }, { HTT_DATA_MSG_SVC, PIPEDIR_OUT, 4, }, { HTT_DATA_MSG_SVC, PIPEDIR_IN , 1, }, - { PACKET_LOG_SVC, PIPEDIR_IN , 5, }, /* (Additions here) */ { 0, 0, 0, }, }; @@ -523,10 +522,6 @@ static struct service_to_pipe target_service_to_ce_map_ar900b[] = { }; -static struct service_to_pipe *target_service_to_ce_map = - target_service_to_ce_map_wlan; -static int target_service_to_ce_map_sz = sizeof(target_service_to_ce_map_wlan); - static struct shadow_reg_cfg *target_shadow_reg_cfg = target_shadow_reg_cfg_map; static int shadow_cfg_sz = sizeof(target_shadow_reg_cfg_map); @@ -550,6 +545,43 @@ static struct service_to_pipe target_service_to_ce_map_wlan_epping[] = { {0, 0, 0,}, /* Must be last */ }; +static void hif_select_service_to_pipe_map(struct hif_softc *scn, + struct service_to_pipe **tgt_svc_map_to_use, + uint32_t *sz_tgt_svc_map_to_use) +{ + uint32_t mode = hif_get_conparam(scn); + struct hif_target_info *tgt_info = &scn->target_info; + + if (QDF_IS_EPPING_ENABLED(mode)) { + *tgt_svc_map_to_use = target_service_to_ce_map_wlan_epping; + *sz_tgt_svc_map_to_use = + sizeof(target_service_to_ce_map_wlan_epping); + } else { + switch (tgt_info->target_type) { + default: + *tgt_svc_map_to_use = target_service_to_ce_map_wlan; + *sz_tgt_svc_map_to_use = + sizeof(target_service_to_ce_map_wlan); + break; + case TARGET_TYPE_AR900B: + case TARGET_TYPE_QCA9984: + case TARGET_TYPE_IPQ4019: + case TARGET_TYPE_QCA9888: + case TARGET_TYPE_AR9888: + case TARGET_TYPE_AR9888V2: + *tgt_svc_map_to_use = target_service_to_ce_map_ar900b; + *sz_tgt_svc_map_to_use = + sizeof(target_service_to_ce_map_ar900b); + break; + case TARGET_TYPE_QCA6290: + *tgt_svc_map_to_use = target_service_to_ce_map_qca6290; + *sz_tgt_svc_map_to_use = + sizeof(target_service_to_ce_map_qca6290); + break; + } + } +} + /** * ce_mark_datapath() - marks the ce_state->htt_rx_data accordingly * @ce_state : pointer to the state context of the CE @@ -565,39 +597,14 @@ static struct service_to_pipe target_service_to_ce_map_wlan_epping[] = { static bool ce_mark_datapath(struct CE_state *ce_state) { struct service_to_pipe *svc_map; - size_t map_sz; + uint32_t map_sz; int i; bool rc = false; - struct hif_target_info *tgt_info; if (ce_state != NULL) { - tgt_info = &ce_state->scn->target_info; + hif_select_service_to_pipe_map(ce_state->scn, &svc_map, + &map_sz); - if (QDF_IS_EPPING_ENABLED(hif_get_conparam(ce_state->scn))) { - svc_map = target_service_to_ce_map_wlan_epping; - map_sz = sizeof(target_service_to_ce_map_wlan_epping) / - sizeof(struct service_to_pipe); - } else { - switch (tgt_info->target_type) { - default: - svc_map = target_service_to_ce_map_wlan; - map_sz = - sizeof(target_service_to_ce_map_wlan) / - sizeof(struct service_to_pipe); - break; - case TARGET_TYPE_AR900B: - case TARGET_TYPE_QCA9984: - case TARGET_TYPE_IPQ4019: - case TARGET_TYPE_QCA9888: - case TARGET_TYPE_AR9888: - case TARGET_TYPE_AR9888V2: - svc_map = target_service_to_ce_map_ar900b; - map_sz = - sizeof(target_service_to_ce_map_ar900b) - / sizeof(struct service_to_pipe); - break; - } - } for (i = 0; i < map_sz; i++) { if ((svc_map[i].pipenum == ce_state->id) && ((svc_map[i].service_id == HTT_DATA_MSG_SVC) || @@ -2111,6 +2118,7 @@ void hif_ce_stop(struct hif_softc *scn) hif_state->started = false; } + /** * hif_get_target_ce_config() - get copy engine configuration * @target_ce_config_ret: basic copy engine configuration @@ -2129,18 +2137,19 @@ void hif_ce_stop(struct hif_softc *scn) */ void hif_get_target_ce_config(struct hif_softc *scn, struct CE_pipe_config **target_ce_config_ret, - int *target_ce_config_sz_ret, + uint32_t *target_ce_config_sz_ret, struct service_to_pipe **target_service_to_ce_map_ret, - int *target_service_to_ce_map_sz_ret, + uint32_t *target_service_to_ce_map_sz_ret, struct shadow_reg_cfg **target_shadow_reg_cfg_ret, - int *shadow_cfg_sz_ret) + uint32_t *shadow_cfg_sz_ret) { struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn); *target_ce_config_ret = hif_state->target_ce_config; *target_ce_config_sz_ret = hif_state->target_ce_config_sz; - *target_service_to_ce_map_ret = target_service_to_ce_map; - *target_service_to_ce_map_sz_ret = target_service_to_ce_map_sz; + + hif_select_service_to_pipe_map(scn, target_service_to_ce_map_ret, + target_service_to_ce_map_sz_ret); if (target_shadow_reg_cfg_ret) *target_shadow_reg_cfg_ret = target_shadow_reg_cfg; @@ -2244,10 +2253,6 @@ void hif_ce_prepare_config(struct hif_softc *scn) hif_state->host_ce_config = host_ce_config_wlan_epping_poll; hif_state->target_ce_config = target_ce_config_wlan_epping; hif_state->target_ce_config_sz = sizeof(target_ce_config_wlan_epping); - target_service_to_ce_map = - target_service_to_ce_map_wlan_epping; - target_service_to_ce_map_sz = - sizeof(target_service_to_ce_map_wlan_epping); target_shadow_reg_cfg = target_shadow_reg_cfg_epping; shadow_cfg_sz = sizeof(target_shadow_reg_cfg_epping); } @@ -2276,9 +2281,6 @@ void hif_ce_prepare_config(struct hif_softc *scn) hif_state->target_ce_config_sz = sizeof(target_ce_config_wlan_ar900b); - target_service_to_ce_map = target_service_to_ce_map_ar900b; - target_service_to_ce_map_sz = - sizeof(target_service_to_ce_map_ar900b); break; case TARGET_TYPE_AR9888: @@ -2293,9 +2295,6 @@ void hif_ce_prepare_config(struct hif_softc *scn) hif_state->target_ce_config_sz = sizeof(target_ce_config_wlan_ar9888); - target_service_to_ce_map = target_service_to_ce_map_ar900b; - target_service_to_ce_map_sz = - sizeof(target_service_to_ce_map_ar900b); break; case TARGET_TYPE_QCA8074: @@ -2319,6 +2318,7 @@ void hif_ce_prepare_config(struct hif_softc *scn) hif_state->target_ce_config = target_ce_config_wlan_qca6290; hif_state->target_ce_config_sz = sizeof(target_ce_config_wlan_qca6290); + scn->ce_count = QCA_6290_CE_COUNT; break; } @@ -2856,42 +2856,14 @@ int hif_map_service_to_pipe(struct hif_opaque_softc *hif_hdl, uint16_t svc_id, unsigned int i; struct service_to_pipe element; struct service_to_pipe *tgt_svc_map_to_use; - size_t sz_tgt_svc_map_to_use; + uint32_t sz_tgt_svc_map_to_use; struct hif_softc *scn = HIF_GET_SOFTC(hif_hdl); - uint32_t mode = hif_get_conparam(scn); - struct hif_target_info *tgt_info = hif_get_target_info_handle(hif_hdl); + struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn); bool dl_updated = false; bool ul_updated = false; - struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn); - if (QDF_IS_EPPING_ENABLED(mode)) { - tgt_svc_map_to_use = target_service_to_ce_map_wlan_epping; - sz_tgt_svc_map_to_use = - sizeof(target_service_to_ce_map_wlan_epping); - } else { - switch (tgt_info->target_type) { - default: - tgt_svc_map_to_use = target_service_to_ce_map_wlan; - sz_tgt_svc_map_to_use = - sizeof(target_service_to_ce_map_wlan); - break; - case TARGET_TYPE_AR900B: - case TARGET_TYPE_QCA9984: - case TARGET_TYPE_IPQ4019: - case TARGET_TYPE_QCA9888: - case TARGET_TYPE_AR9888: - case TARGET_TYPE_AR9888V2: - tgt_svc_map_to_use = target_service_to_ce_map_ar900b; - sz_tgt_svc_map_to_use = - sizeof(target_service_to_ce_map_ar900b); - break; - case TARGET_TYPE_QCA6290: - tgt_svc_map_to_use = target_service_to_ce_map_qca6290; - sz_tgt_svc_map_to_use = - sizeof(target_service_to_ce_map_qca6290); - break; - } - } + hif_select_service_to_pipe_map(scn, &tgt_svc_map_to_use, + &sz_tgt_svc_map_to_use); *dl_is_polled = 0; /* polling for received messages not supported */ diff --git a/hif/src/ce/ce_main.h b/hif/src/ce/ce_main.h index 7b7b745245c0..bba327979f31 100644 --- a/hif/src/ce/ce_main.h +++ b/hif/src/ce/ce_main.h @@ -215,10 +215,10 @@ int hif_wlan_enable(struct hif_softc *scn); void hif_wlan_disable(struct hif_softc *scn); void hif_get_target_ce_config(struct hif_softc *scn, struct CE_pipe_config **target_ce_config_ret, - int *target_ce_config_sz_ret, + uint32_t *target_ce_config_sz_ret, struct service_to_pipe **target_service_to_ce_map_ret, - int *target_service_to_ce_map_sz_ret, + uint32_t *target_service_to_ce_map_sz_ret, struct shadow_reg_cfg **target_shadow_reg_cfg_v1_ret, - int *shadow_cfg_v1_sz_ret); + uint32_t *shadow_cfg_v1_sz_ret); #endif /* __CE_H__ */ diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c index f8680480e2d0..ced2ad2fc025 100644 --- a/hif/src/pcie/if_pci.c +++ b/hif/src/pcie/if_pci.c @@ -1759,7 +1759,7 @@ static int hif_set_hia(struct hif_softc *scn) struct hif_opaque_softc *hif_hdl = GET_HIF_OPAQUE_HDL(scn); struct hif_target_info *tgt_info = hif_get_target_info_handle(hif_hdl); uint32_t target_type = tgt_info->target_type; - int target_ce_config_sz, target_service_to_ce_map_sz; + uint32_t target_ce_config_sz, target_service_to_ce_map_sz; static struct CE_pipe_config *target_ce_config; struct service_to_pipe *target_service_to_ce_map;