From 10fedfc0500b34672c5da39abef829baab43a64e Mon Sep 17 00:00:00 2001 From: Houston Hoffman Date: Mon, 23 Jan 2017 15:23:09 -0800 Subject: [PATCH] qcacmn: move shadow_config_v2 to srng services Wish to keep ce_main.c independent of hal. Change-Id: Ia1caddc9cb81ac996955ad316e4646a4abc8b876 CRs-Fixed: 1113131 --- hif/src/ce/ce_api.h | 7 +++- hif/src/ce/ce_main.c | 78 +++++------------------------------- hif/src/ce/ce_service.c | 9 ++++- hif/src/ce/ce_service_srng.c | 51 +++++++++++++++++++++++ 4 files changed, 76 insertions(+), 69 deletions(-) diff --git a/hif/src/ce/ce_api.h b/hif/src/ce/ce_api.h index 46766d700cc0..0afe16036d65 100644 --- a/hif/src/ce/ce_api.h +++ b/hif/src/ce/ce_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -28,6 +28,7 @@ #ifndef __COPY_ENGINE_API_H__ #define __COPY_ENGINE_API_H__ +#include "pld_common.h" #include "ce_main.h" #include "hif_main.h" @@ -542,5 +543,9 @@ struct ce_ops { struct CE_state *CE_state); void (*ce_per_engine_handler_adjust)(struct CE_state *CE_state, int disable_copy_compl_intr); + void (*ce_prepare_shadow_register_v2_cfg)(struct hif_softc *scn, + struct pld_shadow_reg_v2_cfg **shadow_config, + int *num_shadow_registers_configured); + }; #endif /* __COPY_ENGINE_API_H__ */ diff --git a/hif/src/ce/ce_main.c b/hif/src/ce/ce_main.c index ea60d5f00da3..22744be9b04b 100644 --- a/hif/src/ce/ce_main.c +++ b/hif/src/ce/ce_main.c @@ -63,10 +63,6 @@ #define QCA_WIFI_SUPPORT_SRNG #endif -#ifdef QCA_WIFI_SUPPORT_SRNG -#include "hal_api.h" -#endif - /* Forward references */ static int hif_post_recv_buffers_for_pipe(struct HIF_CE_pipe_info *pipe_info); @@ -653,72 +649,23 @@ static struct ce_ops *ce_services_attach(struct hif_softc *scn) return ce_services_legacy(); } -static void hif_hal_construct_ce_shadow_config(struct hif_softc *scn) -{ - struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn); - for (ce_id = 0; ce_id < scn->ce_count; ce_id++) { - if (hif_state->host_ce_config[ce_id].src_nentries) - hal_set_one_shadow_config(scn->hal_soc, - CE_SRC, ce_id); - - if (hif_state->host_ce_config[ce_id].dest_nentries) { - hal_set_one_shadow_config(scn->hal_soc, - CE_DST, ce_id); - - hal_set_one_shadow_config(scn->hal_soc, - CE_DST_STATUS, ce_id); - } - } -} - -static void hif_prepare_hal_shadow_register_cfg(struct hif_softc *scn, - struct pld_shadow_reg_v2_cfg **shadow_config, - int *num_shadow_registers_configured) -{ - int ce_id; - - if (!ce_srng_based(scn)) - return; - - if (scn->hal == NULL) { - HIF_ERROR("%s: hal not initialized: not initializing shadow config", - __func__); - return; - } - - hal_get_shadow_config(scn->hal_soc, shadow_config, - num_shadow_registers_configured); - - if (*num_shadow_registers_configured != 0) { - HIF_ERROR("%s: hal shadow register configuration allready constructed", - __func__); - - /* return with original configuration*/ - return; - } - - hal_construct_shadow_config(scn->hal_soc); - hif_hal_construct_ce_shadow_config(scn); - - /* get updated configuration */ - hal_get_shadow_config(scn->hal_soc, shadow_config, - num_shadow_registers_configured); - -} #else /* QCA_LITHIUM */ -void hif_prepare_hal_shadow_register_cfg(struct hif_softc *scn, - struct pld_shadow_reg_v2_cfg **shadow_config, - int *num_shadow_registers_configured) { - -} - static struct ce_ops *ce_services_attach(struct hif_softc *scn) { return ce_services_legacy(); } #endif /* QCA_LITHIUM */ +void hif_prepare_hal_shadow_register_cfg(struct hif_softc *scn, + struct pld_shadow_reg_v2_cfg **shadow_config, + int *num_shadow_registers_configured) { + struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn); + + return hif_state->ce_services->ce_prepare_shadow_register_v2_cfg( + scn, shadow_config, num_shadow_registers_configured); +} + static inline uint32_t ce_get_desc_size(struct hif_softc *scn, uint8_t ring_type) { @@ -2126,9 +2073,6 @@ int hif_wlan_enable(struct hif_softc *scn) #define CE_EPPING_USES_IRQ true - - - /** * hif_ce_prepare_config() - load the correct static tables. * @scn: hif context @@ -2142,6 +2086,8 @@ void hif_ce_prepare_config(struct hif_softc *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); + hif_state->ce_services = ce_services_attach(scn); + scn->ce_count = HOST_CE_COUNT; /* if epping is enabled we need to use the epping configuration. */ if (QDF_IS_EPPING_ENABLED(mode)) { @@ -2357,8 +2303,6 @@ int hif_config_ce(struct hif_softc *scn) hif_config_rri_on_ddr(scn); - hif_state->ce_services = ce_services_attach(scn); - for (pipe_num = 0; pipe_num < scn->ce_count; pipe_num++) { struct CE_attr *attr; pipe_info = &hif_state->pipe_info[pipe_num]; diff --git a/hif/src/ce/ce_service.c b/hif/src/ce/ce_service.c index b6173e0e3028..ddf4f9ef7e76 100644 --- a/hif/src/ce/ce_service.c +++ b/hif/src/ce/ce_service.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -2561,6 +2561,11 @@ static void ce_ring_setup_legacy(struct hif_softc *scn, uint8_t ring_type, } } +static void ce_prepare_shadow_register_v2_cfg_legacy(struct hif_softc *scn, + struct pld_shadow_reg_v2_cfg **shadow_config, + int *num_shadow_registers_configured) +{ /* noop */ } + struct ce_ops ce_service_legacy = { .ce_get_desc_size = ce_get_desc_size_legacy, .ce_ring_setup = ce_ring_setup_legacy, @@ -2575,6 +2580,8 @@ struct ce_ops ce_service_legacy = { .ce_completed_send_next_nolock = ce_completed_send_next_nolock_legacy, .ce_recv_entries_done_nolock = ce_recv_entries_done_nolock_legacy, .ce_send_entries_done_nolock = ce_send_entries_done_nolock_legacy, + .ce_prepare_shadow_register_v2_cfg = + ce_prepare_shadow_register_v2_cfg_legacy, }; diff --git a/hif/src/ce/ce_service_srng.c b/hif/src/ce/ce_service_srng.c index 3839ab98e9e4..1b963c762c36 100644 --- a/hif/src/ce/ce_service_srng.c +++ b/hif/src/ce/ce_service_srng.c @@ -682,6 +682,55 @@ static void ce_ring_setup_srng(struct hif_softc *scn, uint8_t ring_type, } } +static void ce_construct_shadow_config_srng(struct hif_softc *scn) +{ + struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn); + int ce_id; + + for (ce_id = 0; ce_id < scn->ce_count; ce_id++) { + if (hif_state->host_ce_config[ce_id].src_nentries) + hal_set_one_shadow_config(scn->hal_soc, + CE_SRC, ce_id); + + if (hif_state->host_ce_config[ce_id].dest_nentries) { + hal_set_one_shadow_config(scn->hal_soc, + CE_DST, ce_id); + + hal_set_one_shadow_config(scn->hal_soc, + CE_DST_STATUS, ce_id); + } + } +} + +static void ce_prepare_shadow_register_v2_cfg_srng(struct hif_softc *scn, + struct pld_shadow_reg_v2_cfg **shadow_config, + int *num_shadow_registers_configured) +{ + if (scn->hal_soc == NULL) { + HIF_ERROR("%s: hal not initialized: not initializing shadow config", + __func__); + return; + } + + hal_get_shadow_config(scn->hal_soc, shadow_config, + num_shadow_registers_configured); + + if (*num_shadow_registers_configured != 0) { + HIF_ERROR("%s: hal shadow register configuration allready constructed", + __func__); + + /* return with original configuration*/ + return; + } + + hal_construct_shadow_config(scn->hal_soc); + ce_construct_shadow_config_srng(scn); + + /* get updated configuration */ + hal_get_shadow_config(scn->hal_soc, shadow_config, + num_shadow_registers_configured); +} + static struct ce_ops ce_service_srng = { .ce_get_desc_size = ce_get_desc_size_srng, .ce_ring_setup = ce_ring_setup_srng, @@ -696,6 +745,8 @@ static struct ce_ops ce_service_srng = { .ce_completed_send_next_nolock = ce_completed_send_next_nolock_srng, .ce_recv_entries_done_nolock = ce_recv_entries_done_nolock_srng, .ce_send_entries_done_nolock = ce_send_entries_done_nolock_srng, + .ce_prepare_shadow_register_v2_cfg = + ce_prepare_shadow_register_v2_cfg_srng, }; struct ce_ops *ce_services_srng()