From 6a206753d63373a4b5868df1c18557dbddf9aa01 Mon Sep 17 00:00:00 2001 From: Akshay Kosigi Date: Mon, 10 Jun 2019 23:14:52 +0530 Subject: [PATCH] qcacmn: Add code to remove void pointer usage Add code to remove void pointer usage for hal_soc and introduce opaque pointer to be used intead of void from dp layer into hal layer Change-Id: Ia38571174c6ed79558d0f0c9cd1a0f4afaa66483 CRs-Fixed: 2480857 --- dp/wifi3.0/dp_reo.c | 2 +- dp/wifi3.0/dp_types.h | 2 +- hal/wifi3.0/hal_api.h | 34 +++++--- hal/wifi3.0/hal_api_mon.h | 12 ++- hal/wifi3.0/hal_generic_api.h | 12 +-- hal/wifi3.0/hal_internal.h | 18 ++++- hal/wifi3.0/hal_reo.c | 147 ++++++++++++++++++++-------------- hal/wifi3.0/hal_reo.h | 37 ++++----- hal/wifi3.0/hal_rx.h | 36 ++++++--- hal/wifi3.0/hal_srng.c | 13 +-- hal/wifi3.0/hal_tx.h | 43 +++++++--- 11 files changed, 222 insertions(+), 134 deletions(-) diff --git a/dp/wifi3.0/dp_reo.c b/dp/wifi3.0/dp_reo.c index cc047969f0..b3661aa79b 100644 --- a/dp/wifi3.0/dp_reo.c +++ b/dp/wifi3.0/dp_reo.c @@ -117,7 +117,7 @@ uint32_t dp_reo_status_ring_handler(struct dp_intr *int_ctx, struct dp_soc *soc) num = reo_status.fl_queue_status.header.cmd_num; break; case HAL_REO_FLUSH_CACHE_STATUS_TLV: - hal_reo_flush_cache_status(reo_desc, soc->hal_soc, + hal_reo_flush_cache_status(reo_desc, &reo_status.fl_cache_status, soc->hal_soc); num = reo_status.fl_cache_status.header.cmd_num; diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index af997612c1..e4d68b925d 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -862,7 +862,7 @@ struct dp_soc { uint8_t num_hw_dscp_tid_map; /* HAL SOC handle */ - void *hal_soc; + hal_soc_handle_t hal_soc; /* Device ID coming from Bus sub-system */ uint32_t device_id; diff --git a/hal/wifi3.0/hal_api.h b/hal/wifi3.0/hal_api.h index 7382234b8e..126b4ee119 100644 --- a/hal/wifi3.0/hal_api.h +++ b/hal/wifi3.0/hal_api.h @@ -493,16 +493,16 @@ extern void *hal_srng_setup(void *hal_soc, int ring_type, int ring_num, /** * hal_reo_read_write_ctrl_ix - Read or write REO_DESTINATION_RING_CTRL_IX - * @hal: HAL SOC handle + * @hal_soc_hdl: HAL SOC handle * @read: boolean value to indicate if read or write * @ix0: pointer to store IX0 reg value * @ix1: pointer to store IX1 reg value * @ix2: pointer to store IX2 reg value * @ix3: pointer to store IX3 reg value */ -extern void hal_reo_read_write_ctrl_ix(struct hal_soc *hal, bool read, - uint32_t *ix0, uint32_t *ix1, - uint32_t *ix2, uint32_t *ix3); +void hal_reo_read_write_ctrl_ix(hal_soc_handle_t hal_soc_hdl, bool read, + uint32_t *ix0, uint32_t *ix1, + uint32_t *ix2, uint32_t *ix3); /** * hal_srng_set_hp_paddr() - Set physical address to dest SRNG head pointer @@ -561,10 +561,12 @@ void *hal_srng_dst_peek(void *hal_soc, void *hal_ring) * * Return: 0 on success; error on failire */ -static inline int hal_srng_access_start_unlocked(void *hal_soc, void *hal_ring) +static inline int +hal_srng_access_start_unlocked(hal_soc_handle_t hal_soc_hdl, + void *hal_ring) { struct hal_srng *srng = (struct hal_srng *)hal_ring; - struct hal_soc *soc = (struct hal_soc *)hal_soc; + struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl; uint32_t *desc; if (srng->ring_dir == HAL_SRNG_SRC_RING) @@ -575,7 +577,7 @@ static inline int hal_srng_access_start_unlocked(void *hal_soc, void *hal_ring) *(volatile uint32_t *)(srng->u.dst_ring.hp_addr); if (srng->flags & HAL_SRNG_CACHED_DESC) { - desc = hal_srng_dst_peek(hal_soc, hal_ring); + desc = hal_srng_dst_peek(hal_soc_hdl, hal_ring); if (qdf_likely(desc)) { qdf_mem_dma_cache_sync(soc->qdf_dev, qdf_mem_virt_to_phys @@ -599,7 +601,8 @@ static inline int hal_srng_access_start_unlocked(void *hal_soc, void *hal_ring) * * Return: 0 on success; error on failire */ -static inline int hal_srng_access_start(void *hal_soc, void *hal_ring) +static inline int hal_srng_access_start(hal_soc_handle_t hal_soc_hdl, + void *hal_ring) { struct hal_srng *srng = (struct hal_srng *)hal_ring; @@ -610,7 +613,7 @@ static inline int hal_srng_access_start(void *hal_soc, void *hal_ring) SRNG_LOCK(&(srng->lock)); - return hal_srng_access_start_unlocked(hal_soc, hal_ring); + return hal_srng_access_start_unlocked(hal_soc_hdl, hal_ring); } /** @@ -1138,8 +1141,10 @@ static inline uint32_t hal_idle_list_scatter_buf_size(void *hal_soc) * @hal_soc: Opaque HAL SOC handle * */ -static inline uint32_t hal_get_link_desc_size(struct hal_soc *hal_soc) +static inline uint32_t hal_get_link_desc_size(hal_soc_handle_t hal_soc_hdl) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + if (!hal_soc || !hal_soc->ops) { qdf_print("Error: Invalid ops\n"); QDF_BUG(0); @@ -1355,7 +1360,7 @@ extern void hal_get_meminfo(void *hal_soc,struct hal_mem_info *mem ); * * @hal_soc: Opaque HAL SOC handle */ -uint32_t hal_get_target_type(struct hal_soc *hal); +uint32_t hal_get_target_type(hal_soc_handle_t hal_soc_hdl); /** * hal_get_ba_aging_timeout - Retrieve BA aging timeout @@ -1409,11 +1414,14 @@ static inline void hal_srng_src_hw_init(struct hal_soc *hal, * * Return: Update tail pointer and head pointer in arguments. */ -static inline void hal_get_hw_hptp(struct hal_soc *hal, void *hal_ring, +static inline void hal_get_hw_hptp(hal_soc_handle_t hal_soc_hdl, void *hal_ring, uint32_t *headp, uint32_t *tailp, uint8_t ring_type) { - hal->ops->hal_get_hw_hptp(hal, hal_ring, headp, tailp, ring_type); + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + + hal_soc->ops->hal_get_hw_hptp(hal_soc_hdl, hal_ring, + headp, tailp, ring_type); } /** diff --git a/hal/wifi3.0/hal_api_mon.h b/hal/wifi3.0/hal_api_mon.h index 4918e958e5..5d893de0e9 100644 --- a/hal/wifi3.0/hal_api_mon.h +++ b/hal/wifi3.0/hal_api_mon.h @@ -537,12 +537,16 @@ static inline void hal_rx_proc_phyrx_other_receive_info_tlv(struct hal_soc *hal_ */ static inline uint32_t hal_rx_status_get_tlv_info(void *rx_tlv_hdr, void *ppdu_info, - struct hal_soc *hal_soc, + hal_soc_handle_t hal_soc_hdl, qdf_nbuf_t nbuf) { - return hal_soc->ops->hal_rx_status_get_tlv_info(rx_tlv_hdr, - ppdu_info, hal_soc, - nbuf); + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + + return hal_soc->ops->hal_rx_status_get_tlv_info( + rx_tlv_hdr, + ppdu_info, + hal_soc_hdl, + nbuf); } static inline diff --git a/hal/wifi3.0/hal_generic_api.h b/hal/wifi3.0/hal_generic_api.h index e01a0636ff..546aa68e86 100644 --- a/hal/wifi3.0/hal_generic_api.h +++ b/hal/wifi3.0/hal_generic_api.h @@ -321,9 +321,10 @@ hal_rx_update_rssi_chain(struct hal_rx_ppdu_info *ppdu_info, */ static inline uint32_t hal_rx_status_get_tlv_info_generic(void *rx_tlv_hdr, void *ppduinfo, - void *halsoc, qdf_nbuf_t nbuf) + hal_soc_handle_t hal_soc_hdl, + qdf_nbuf_t nbuf) { - struct hal_soc *hal = (struct hal_soc *)halsoc; + struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl; uint32_t tlv_tag, user_id, tlv_len, value; uint8_t group_id = 0; uint8_t he_dcm = 0; @@ -1562,21 +1563,22 @@ static void hal_reo_setup_generic(void *hal_soc, * Return: Update tail pointer and head pointer in arguments. */ static inline -void hal_get_hw_hptp_generic(struct hal_soc *soc, void *hal_ring, +void hal_get_hw_hptp_generic(hal_soc_handle_t hal_soc_hdl, void *hal_ring, uint32_t *headp, uint32_t *tailp, uint8_t ring) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; struct hal_srng *srng = (struct hal_srng *)hal_ring; struct hal_hw_srng_config *ring_config; enum hal_ring_type ring_type = (enum hal_ring_type)ring; - if (!soc || !srng) { + if (!hal_soc || !srng) { QDF_TRACE(QDF_MODULE_ID_HAL, QDF_TRACE_LEVEL_ERROR, "%s: Context is Null", __func__); return; } - ring_config = HAL_SRNG_CONFIG(soc, ring_type); + ring_config = HAL_SRNG_CONFIG(hal_soc, ring_type); if (!ring_config->lmac_ring) { if (srng->ring_dir == HAL_SRNG_SRC_RING) { *headp = SRNG_SRC_REG_READ(srng, HP); diff --git a/hal/wifi3.0/hal_internal.h b/hal/wifi3.0/hal_internal.h index c13416638d..8181cc5f4f 100644 --- a/hal/wifi3.0/hal_internal.h +++ b/hal/wifi3.0/hal_internal.h @@ -51,6 +51,11 @@ extern bool is_hal_verbose_debug_enabled; params) #endif +/* + * dp_hal_soc - opaque handle for DP HAL soc + */ +struct hal_soc_handle; +typedef struct hal_soc_handle *hal_soc_handle_t; /* TBD: This should be movded to shared HW header file */ enum hal_srng_ring_id { @@ -295,7 +300,7 @@ struct hal_hw_txrx_ops { struct hal_srng *srng); void (*hal_srng_src_hw_init)(void *hal, struct hal_srng *srng); - void (*hal_get_hw_hptp)(struct hal_soc *hal, void *hal_ring, + void (*hal_get_hw_hptp)(hal_soc_handle_t hal_soc_hdl, void *hal_ring, uint32_t *headp, uint32_t *tailp, uint8_t ring_type); void (*hal_reo_setup)(void *hal_soc, void *reoparams); @@ -337,8 +342,9 @@ struct hal_hw_txrx_ops { void* (*hal_rx_link_desc_msdu0_ptr)(void *msdu_link_ptr); void (*hal_reo_status_get_header)(uint32_t *d, int b, void *h); uint32_t (*hal_rx_status_get_tlv_info)(void *rx_tlv_hdr, - void *ppdu_info, - void *hal, qdf_nbuf_t nbuf); + void *ppdu_info, + hal_soc_handle_t hal_soc_hdl, + qdf_nbuf_t nbuf); void (*hal_rx_wbm_err_info_get)(void *wbm_desc, void *wbm_er_info); void (*hal_rx_dump_mpdu_start_tlv)(void *mpdustart, @@ -398,4 +404,10 @@ struct hal_soc { void hal_qca6390_attach(struct hal_soc *hal_soc); void hal_qca6290_attach(struct hal_soc *hal_soc); void hal_qca8074_attach(struct hal_soc *hal_soc); + +static inline +hal_soc_handle_t hal_soc_to_hal_soc_handle(struct hal_soc *hal_soc) +{ + return (hal_soc_handle_t)hal_soc; +} #endif /* _HAL_INTERNAL_H_ */ diff --git a/hal/wifi3.0/hal_reo.c b/hal/wifi3.0/hal_reo.c index ea766e99d6..7e9f2c81b1 100644 --- a/hal/wifi3.0/hal_reo.c +++ b/hal/wifi3.0/hal_reo.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 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 @@ -395,18 +395,19 @@ inline void hal_reo_cmd_set_descr_addr(uint32_t *reo_desc, } } -inline int hal_reo_cmd_queue_stats(void *reo_ring, struct hal_soc *soc, - struct hal_reo_cmd_params *cmd) +inline int hal_reo_cmd_queue_stats(void *reo_ring, hal_soc_handle_t hal_soc_hdl, + struct hal_reo_cmd_params *cmd) { uint32_t *reo_desc, val; + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; - hal_srng_access_start(soc, reo_ring); - reo_desc = hal_srng_src_get_next(soc, reo_ring); + hal_srng_access_start(hal_soc_hdl, reo_ring); + reo_desc = hal_srng_src_get_next(hal_soc, reo_ring); if (!reo_desc) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, "%s: Out of cmd ring entries", __func__); - hal_srng_access_end(soc, reo_ring); + hal_srng_access_end(hal_soc, reo_ring); return -EBUSY; } @@ -430,7 +431,7 @@ inline int hal_reo_cmd_queue_stats(void *reo_ring, struct hal_soc *soc, HAL_DESC_SET_FIELD(reo_desc, REO_GET_QUEUE_STATS_2, CLEAR_STATS, cmd->u.stats_params.clear); - hal_srng_access_end(soc, reo_ring); + hal_srng_access_end(hal_soc, reo_ring); val = reo_desc[CMD_HEADER_DW_OFFSET]; return HAL_GET_FIELD(UNIFORM_REO_CMD_HEADER_0, REO_CMD_NUMBER, @@ -438,17 +439,18 @@ inline int hal_reo_cmd_queue_stats(void *reo_ring, struct hal_soc *soc, } qdf_export_symbol(hal_reo_cmd_queue_stats); -inline int hal_reo_cmd_flush_queue(void *reo_ring, struct hal_soc *soc, - struct hal_reo_cmd_params *cmd) +inline int hal_reo_cmd_flush_queue(void *reo_ring, hal_soc_handle_t hal_soc_hdl, + struct hal_reo_cmd_params *cmd) { uint32_t *reo_desc, val; + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; - hal_srng_access_start(soc, reo_ring); - reo_desc = hal_srng_src_get_next(soc, reo_ring); + hal_srng_access_start(hal_soc_hdl, reo_ring); + reo_desc = hal_srng_src_get_next(hal_soc, reo_ring); if (!reo_desc) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, "%s: Out of cmd ring entries", __func__); - hal_srng_access_end(soc, reo_ring); + hal_srng_access_end(hal_soc, reo_ring); return -EBUSY; } @@ -477,44 +479,45 @@ inline int hal_reo_cmd_flush_queue(void *reo_ring, struct hal_soc *soc, BLOCK_RESOURCE_INDEX, cmd->u.fl_queue_params.index); } - hal_srng_access_end(soc, reo_ring); + hal_srng_access_end(hal_soc, reo_ring); val = reo_desc[CMD_HEADER_DW_OFFSET]; return HAL_GET_FIELD(UNIFORM_REO_CMD_HEADER_0, REO_CMD_NUMBER, val); } qdf_export_symbol(hal_reo_cmd_flush_queue); -inline int hal_reo_cmd_flush_cache(void *reo_ring, struct hal_soc *soc, - struct hal_reo_cmd_params *cmd) +inline int hal_reo_cmd_flush_cache(void *reo_ring, hal_soc_handle_t hal_soc_hdl, + struct hal_reo_cmd_params *cmd) { uint32_t *reo_desc, val; struct hal_reo_cmd_flush_cache_params *cp; uint8_t index = 0; + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; cp = &cmd->u.fl_cache_params; - hal_srng_access_start(soc, reo_ring); + hal_srng_access_start(hal_soc_hdl, reo_ring); /* We need a cache block resource for this operation, and REO HW has * only 4 such blocking resources. These resources are managed using * reo_res_bitmap, and we return failure if none is available. */ if (cp->block_use_after_flush) { - index = hal_find_zero_bit(soc->reo_res_bitmap); + index = hal_find_zero_bit(hal_soc->reo_res_bitmap); if (index > 3) { qdf_print("%s, No blocking resource available!", __func__); - hal_srng_access_end(soc, reo_ring); + hal_srng_access_end(hal_soc, reo_ring); return -EBUSY; } - soc->index = index; + hal_soc->index = index; } - reo_desc = hal_srng_src_get_next(soc, reo_ring); + reo_desc = hal_srng_src_get_next(hal_soc, reo_ring); if (!reo_desc) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, "%s: Out of cmd ring entries", __func__); - hal_srng_access_end(soc, reo_ring); + hal_srng_access_end(hal_soc, reo_ring); hal_srng_dump(reo_ring); return -EBUSY; } @@ -557,37 +560,39 @@ inline int hal_reo_cmd_flush_cache(void *reo_ring, struct hal_soc *soc, HAL_DESC_SET_FIELD(reo_desc, REO_FLUSH_CACHE_2, FLUSH_ENTIRE_CACHE, cp->flush_all); - hal_srng_access_end(soc, reo_ring); + hal_srng_access_end(hal_soc, reo_ring); val = reo_desc[CMD_HEADER_DW_OFFSET]; return HAL_GET_FIELD(UNIFORM_REO_CMD_HEADER_0, REO_CMD_NUMBER, val); } qdf_export_symbol(hal_reo_cmd_flush_cache); -inline int hal_reo_cmd_unblock_cache(void *reo_ring, struct hal_soc *soc, - struct hal_reo_cmd_params *cmd) +inline int hal_reo_cmd_unblock_cache(void *reo_ring, + hal_soc_handle_t hal_soc_hdl, + struct hal_reo_cmd_params *cmd) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; uint32_t *reo_desc, val; uint8_t index = 0; - hal_srng_access_start(soc, reo_ring); + hal_srng_access_start(hal_soc_hdl, reo_ring); if (cmd->u.unblk_cache_params.type == UNBLOCK_RES_INDEX) { - index = hal_find_one_bit(soc->reo_res_bitmap); + index = hal_find_one_bit(hal_soc->reo_res_bitmap); if (index > 3) { - hal_srng_access_end(soc, reo_ring); + hal_srng_access_end(hal_soc, reo_ring); qdf_print("%s: No blocking resource to unblock!", __func__); return -EBUSY; } } - reo_desc = hal_srng_src_get_next(soc, reo_ring); + reo_desc = hal_srng_src_get_next(hal_soc, reo_ring); if (!reo_desc) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, "%s: Out of cmd ring entries", __func__); - hal_srng_access_end(soc, reo_ring); + hal_srng_access_end(hal_soc, reo_ring); return -EBUSY; } @@ -613,24 +618,26 @@ inline int hal_reo_cmd_unblock_cache(void *reo_ring, struct hal_soc *soc, cmd->u.unblk_cache_params.index); } - hal_srng_access_end(soc, reo_ring); + hal_srng_access_end(hal_soc, reo_ring); val = reo_desc[CMD_HEADER_DW_OFFSET]; return HAL_GET_FIELD(UNIFORM_REO_CMD_HEADER_0, REO_CMD_NUMBER, val); } qdf_export_symbol(hal_reo_cmd_unblock_cache); -inline int hal_reo_cmd_flush_timeout_list(void *reo_ring, struct hal_soc *soc, - struct hal_reo_cmd_params *cmd) +inline int hal_reo_cmd_flush_timeout_list(void *reo_ring, + hal_soc_handle_t hal_soc_hdl, + struct hal_reo_cmd_params *cmd) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; uint32_t *reo_desc, val; - hal_srng_access_start(soc, reo_ring); - reo_desc = hal_srng_src_get_next(soc, reo_ring); + hal_srng_access_start(hal_soc_hdl, reo_ring); + reo_desc = hal_srng_src_get_next(hal_soc, reo_ring); if (!reo_desc) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, "%s: Out of cmd ring entries", __func__); - hal_srng_access_end(soc, reo_ring); + hal_srng_access_end(hal_soc, reo_ring); return -EBUSY; } @@ -658,27 +665,29 @@ inline int hal_reo_cmd_flush_timeout_list(void *reo_ring, struct hal_soc *soc, MINIMUM_FORWARD_BUF_COUNT, cmd->u.fl_tim_list_params.min_fwd_buf); - hal_srng_access_end(soc, reo_ring); + hal_srng_access_end(hal_soc, reo_ring); val = reo_desc[CMD_HEADER_DW_OFFSET]; return HAL_GET_FIELD(UNIFORM_REO_CMD_HEADER_0, REO_CMD_NUMBER, val); } qdf_export_symbol(hal_reo_cmd_flush_timeout_list); -inline int hal_reo_cmd_update_rx_queue(void *reo_ring, struct hal_soc *soc, - struct hal_reo_cmd_params *cmd) +inline int hal_reo_cmd_update_rx_queue(void *reo_ring, + hal_soc_handle_t hal_soc_hdl, + struct hal_reo_cmd_params *cmd) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; uint32_t *reo_desc, val; struct hal_reo_cmd_update_queue_params *p; p = &cmd->u.upd_queue_params; - hal_srng_access_start(soc, reo_ring); - reo_desc = hal_srng_src_get_next(soc, reo_ring); + hal_srng_access_start(hal_soc_hdl, reo_ring); + reo_desc = hal_srng_src_get_next(hal_soc, reo_ring); if (!reo_desc) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, "%s: Out of cmd ring entries", __func__); - hal_srng_access_end(soc, reo_ring); + hal_srng_access_end(hal_soc, reo_ring); return -EBUSY; } @@ -866,17 +875,19 @@ inline int hal_reo_cmd_update_rx_queue(void *reo_ring, struct hal_soc *soc, HAL_DESC_SET_FIELD(reo_desc, REO_UPDATE_RX_REO_QUEUE_8, PN_127_96, p->pn_127_96); - hal_srng_access_end(soc, reo_ring); + hal_srng_access_end(hal_soc, reo_ring); val = reo_desc[CMD_HEADER_DW_OFFSET]; return HAL_GET_FIELD(UNIFORM_REO_CMD_HEADER_0, REO_CMD_NUMBER, val); } qdf_export_symbol(hal_reo_cmd_update_rx_queue); -inline void hal_reo_queue_stats_status(uint32_t *reo_desc, - struct hal_reo_queue_status *st, - struct hal_soc *hal_soc) +inline void +hal_reo_queue_stats_status(uint32_t *reo_desc, + struct hal_reo_queue_status *st, + hal_soc_handle_t hal_soc_hdl) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; uint32_t val; /* Offsets of descriptor fields defined in HW headers start @@ -1066,10 +1077,12 @@ inline void hal_reo_queue_stats_status(uint32_t *reo_desc, } qdf_export_symbol(hal_reo_queue_stats_status); -inline void hal_reo_flush_queue_status(uint32_t *reo_desc, - struct hal_reo_flush_queue_status *st, - struct hal_soc *hal_soc) +inline void +hal_reo_flush_queue_status(uint32_t *reo_desc, + struct hal_reo_flush_queue_status *st, + hal_soc_handle_t hal_soc_hdl) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; uint32_t val; /* Offsets of descriptor fields defined in HW headers start @@ -1088,10 +1101,12 @@ inline void hal_reo_flush_queue_status(uint32_t *reo_desc, } qdf_export_symbol(hal_reo_flush_queue_status); -inline void hal_reo_flush_cache_status(uint32_t *reo_desc, struct hal_soc *soc, - struct hal_reo_flush_cache_status *st, - struct hal_soc *hal_soc) +inline void +hal_reo_flush_cache_status(uint32_t *reo_desc, + struct hal_reo_flush_cache_status *st, + hal_soc_handle_t hal_soc_hdl) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; uint32_t val; /* Offsets of descriptor fields defined in HW headers start @@ -1115,7 +1130,8 @@ inline void hal_reo_flush_cache_status(uint32_t *reo_desc, struct hal_soc *soc, BLOCK_ERROR_DETAILS, val); if (!st->block_error) - qdf_set_bit(soc->index, (unsigned long *)&soc->reo_res_bitmap); + qdf_set_bit(hal_soc->index, + (unsigned long *)&hal_soc->reo_res_bitmap); /* cache flush status */ val = reo_desc[HAL_OFFSET_DW(REO_FLUSH_CACHE_STATUS_2, @@ -1144,9 +1160,10 @@ inline void hal_reo_flush_cache_status(uint32_t *reo_desc, struct hal_soc *soc, qdf_export_symbol(hal_reo_flush_cache_status); inline void hal_reo_unblock_cache_status(uint32_t *reo_desc, - struct hal_soc *soc, + hal_soc_handle_t hal_soc_hdl, struct hal_reo_unblk_cache_status *st) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; uint32_t val; /* Offsets of descriptor fields defined in HW headers start @@ -1155,7 +1172,7 @@ inline void hal_reo_unblock_cache_status(uint32_t *reo_desc, /* header */ hal_reo_status_get_header(reo_desc, HAL_REO_UNBLK_CACHE_STATUS_TLV, - &(st->header), soc); + &st->header, hal_soc); /* error bit */ val = reo_desc[HAL_OFFSET_DW(REO_UNBLOCK_CACHE_STATUS_2, @@ -1172,17 +1189,18 @@ inline void hal_reo_unblock_cache_status(uint32_t *reo_desc, val); if (!st->error && (st->unblock_type == UNBLOCK_RES_INDEX)) - qdf_clear_bit(soc->index, - (unsigned long *)&soc->reo_res_bitmap); + qdf_clear_bit(hal_soc->index, + (unsigned long *)&hal_soc->reo_res_bitmap); } qdf_export_symbol(hal_reo_unblock_cache_status); inline void hal_reo_flush_timeout_list_status( uint32_t *reo_desc, struct hal_reo_flush_timeout_list_status *st, - struct hal_soc *hal_soc) + hal_soc_handle_t hal_soc_hdl) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; uint32_t val; /* Offsets of descriptor fields defined in HW headers start @@ -1226,8 +1244,9 @@ qdf_export_symbol(hal_reo_flush_timeout_list_status); inline void hal_reo_desc_thres_reached_status( uint32_t *reo_desc, struct hal_reo_desc_thres_reached_status *st, - struct hal_soc *hal_soc) + hal_soc_handle_t hal_soc_hdl) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; uint32_t val; /* Offsets of descriptor fields defined in HW headers start @@ -1283,10 +1302,13 @@ inline void hal_reo_desc_thres_reached_status( } qdf_export_symbol(hal_reo_desc_thres_reached_status); -inline void hal_reo_rx_update_queue_status(uint32_t *reo_desc, - struct hal_reo_update_rx_queue_status *st, - struct hal_soc *hal_soc) +inline void +hal_reo_rx_update_queue_status(uint32_t *reo_desc, + struct hal_reo_update_rx_queue_status *st, + hal_soc_handle_t hal_soc_hdl) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + /* Offsets of descriptor fields defined in HW headers start * from the field after TLV header */ reo_desc += (sizeof(struct tlv_32_hdr) >> 2); @@ -1306,13 +1328,14 @@ qdf_export_symbol(hal_reo_rx_update_queue_status); * * Return: none */ -inline void hal_reo_init_cmd_ring(struct hal_soc *soc, void *hal_srng) +inline void hal_reo_init_cmd_ring(hal_soc_handle_t hal_soc_hdl, void *hal_srng) { int cmd_num; uint32_t *desc_addr; struct hal_srng_params srng_params; uint32_t desc_size; uint32_t num_desc; + struct hal_soc *soc = (struct hal_soc *)hal_soc_hdl; hal_get_srng_params(soc, hal_srng, &srng_params); diff --git a/hal/wifi3.0/hal_reo.h b/hal/wifi3.0/hal_reo.h index c9b1265afa..b52f03fc91 100644 --- a/hal/wifi3.0/hal_reo.h +++ b/hal/wifi3.0/hal_reo.h @@ -496,43 +496,44 @@ void hal_reo_cmd_set_descr_addr(uint32_t *reo_desc, enum hal_reo_cmd_type type, uint32_t paddr_lo, uint8_t paddr_hi); -int hal_reo_cmd_queue_stats(void *reo_ring, struct hal_soc *soc, +int hal_reo_cmd_queue_stats(void *reo_ring, hal_soc_handle_t hal_soc_hdl, struct hal_reo_cmd_params *cmd); -int hal_reo_cmd_flush_queue(void *reo_ring, struct hal_soc *soc, +int hal_reo_cmd_flush_queue(void *reo_ring, hal_soc_handle_t hal_soc_hdl, struct hal_reo_cmd_params *cmd); -int hal_reo_cmd_flush_cache(void *reo_ring, struct hal_soc *soc, +int hal_reo_cmd_flush_cache(void *reo_ring, hal_soc_handle_t hal_soc_hdl, struct hal_reo_cmd_params *cmd); -int hal_reo_cmd_unblock_cache(void *reo_ring, struct hal_soc *soc, +int hal_reo_cmd_unblock_cache(void *reo_ring, hal_soc_handle_t hal_soc_hdl, struct hal_reo_cmd_params *cmd); -int hal_reo_cmd_flush_timeout_list(void *reo_ring, struct hal_soc *soc, +int hal_reo_cmd_flush_timeout_list(void *reo_ring, hal_soc_handle_t hal_soc_hdl, struct hal_reo_cmd_params *cmd); -int hal_reo_cmd_update_rx_queue(void *reo_ring, struct hal_soc *soc, +int hal_reo_cmd_update_rx_queue(void *reo_ring, hal_soc_handle_t hal_soc_hdl, struct hal_reo_cmd_params *cmd); /* REO status ring routines */ void hal_reo_queue_stats_status(uint32_t *reo_desc, struct hal_reo_queue_status *st, - struct hal_soc *hal_soc); + hal_soc_handle_t hal_soc_hdl); void hal_reo_flush_queue_status(uint32_t *reo_desc, - struct hal_reo_flush_queue_status *st, - struct hal_soc *hal_soc); -void hal_reo_flush_cache_status(uint32_t *reo_desc, struct hal_soc *soc, - struct hal_reo_flush_cache_status *st, - struct hal_soc *hal_soc); -void hal_reo_unblock_cache_status(uint32_t *reo_desc, struct hal_soc *soc, - struct hal_reo_unblk_cache_status *st); + struct hal_reo_flush_queue_status *st, + hal_soc_handle_t hal_soc_hdl); +void hal_reo_flush_cache_status(uint32_t *reo_desc, + struct hal_reo_flush_cache_status *st, + hal_soc_handle_t hal_soc_hdl); +void hal_reo_unblock_cache_status(uint32_t *reo_desc, + hal_soc_handle_t hal_soc_hdl, + struct hal_reo_unblk_cache_status *st); void hal_reo_flush_timeout_list_status( uint32_t *reo_desc, struct hal_reo_flush_timeout_list_status *st, - struct hal_soc *hal_soc); + hal_soc_handle_t hal_soc_hdl); void hal_reo_desc_thres_reached_status( uint32_t *reo_desc, struct hal_reo_desc_thres_reached_status *st, - struct hal_soc *hal_soc); + hal_soc_handle_t hal_soc_hdl); void hal_reo_rx_update_queue_status(uint32_t *reo_desc, struct hal_reo_update_rx_queue_status *st, - struct hal_soc *hal_soc); + hal_soc_handle_t hal_soc_hdl); -void hal_reo_init_cmd_ring(struct hal_soc *soc, void *hal_srng); +void hal_reo_init_cmd_ring(hal_soc_handle_t hal_soc_hdl, void *hal_srng); #endif /* _HAL_REO_H */ diff --git a/hal/wifi3.0/hal_rx.h b/hal/wifi3.0/hal_rx.h index 254a2e3bdf..4d851ba527 100644 --- a/hal/wifi3.0/hal_rx.h +++ b/hal/wifi3.0/hal_rx.h @@ -1815,8 +1815,10 @@ QDF_STATUS hal_rx_mpdu_get_addr4(uint8_t *buf, uint8_t *mac_addr) * Return: da index */ static inline uint16_t -hal_rx_msdu_end_da_idx_get(struct hal_soc *hal_soc, uint8_t *buf) +hal_rx_msdu_end_da_idx_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + return hal_soc->ops->hal_rx_msdu_end_da_idx_get(buf); } @@ -2067,11 +2069,12 @@ static inline void *hal_rx_msdu_desc_info_get_ptr(void *msdu_details_ptr, void * * * Return: void */ -static inline void hal_rx_msdu_list_get(struct hal_soc *hal_soc, +static inline void hal_rx_msdu_list_get(hal_soc_handle_t hal_soc_hdl, void *msdu_link_desc, struct hal_rx_msdu_list *msdu_list, uint16_t *num_msdus) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; struct rx_msdu_details *msdu_details; struct rx_msdu_desc_info *msdu_desc_info; struct rx_msdu_link *msdu_link = (struct rx_msdu_link *)msdu_link_desc; @@ -2134,8 +2137,9 @@ static inline void hal_rx_msdu_list_get(struct hal_soc *hal_soc, * Return: dst_ind (REO destination ring ID) */ static inline uint32_t -hal_rx_msdu_reo_dst_ind_get(struct hal_soc *hal_soc, void *msdu_link_desc) +hal_rx_msdu_reo_dst_ind_get(hal_soc_handle_t hal_soc_hdl, void *msdu_link_desc) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; struct rx_msdu_details *msdu_details; struct rx_msdu_desc_info *msdu_desc_info; struct rx_msdu_link *msdu_link = (struct rx_msdu_link *)msdu_link_desc; @@ -3237,10 +3241,13 @@ static inline void hal_rx_wbm_err_info_get_from_tlv(uint8_t *buf, * * Return: void */ -static inline void hal_rx_mon_hw_desc_get_mpdu_status(struct hal_soc *hal_soc, - void *hw_desc_addr, - struct mon_rx_status *rs) +static inline +void hal_rx_mon_hw_desc_get_mpdu_status(hal_soc_handle_t hal_soc_hdl, + void *hw_desc_addr, + struct mon_rx_status *rs) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + hal_soc->ops->hal_rx_mon_hw_desc_get_mpdu_status(hw_desc_addr, rs); } @@ -3264,9 +3271,11 @@ static inline uint8_t hal_rx_get_tlv(struct hal_soc *hal_soc, void *rx_tlv) * @buf: pointer to the start of RX PKT TLV header * Return: uint32_t(nss) */ -static inline uint32_t hal_rx_msdu_start_nss_get(struct hal_soc *hal_soc, - uint8_t *buf) +static inline +uint32_t hal_rx_msdu_start_nss_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + return hal_soc->ops->hal_rx_msdu_start_nss_get(buf); } @@ -3293,9 +3302,11 @@ static inline void hal_rx_dump_msdu_start_tlv(struct hal_soc *hal_soc, * * */ -static inline uint32_t hal_rx_mpdu_start_tid_get(struct hal_soc *hal_soc, +static inline uint32_t hal_rx_mpdu_start_tid_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + return hal_soc->ops->hal_rx_mpdu_start_tid_get(buf); } @@ -3307,9 +3318,11 @@ static inline uint32_t hal_rx_mpdu_start_tid_get(struct hal_soc *hal_soc, * Return: uint32_t(reception_type) */ static inline -uint32_t hal_rx_msdu_start_reception_type_get(struct hal_soc *hal_soc, +uint32_t hal_rx_msdu_start_reception_type_get(hal_soc_handle_t hal_soc_hdl, uint8_t *buf) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + return hal_soc->ops->hal_rx_msdu_start_reception_type_get(buf); } @@ -3321,7 +3334,7 @@ uint32_t hal_rx_msdu_start_reception_type_get(struct hal_soc *hal_soc, * * Return: void */ -static inline void hal_rx_dump_pkt_tlvs(struct hal_soc *hal_soc, +static inline void hal_rx_dump_pkt_tlvs(hal_soc_handle_t hal_soc_hdl, uint8_t *buf, uint8_t dbg_level) { struct rx_pkt_tlvs *pkt_tlvs = (struct rx_pkt_tlvs *)buf; @@ -3332,6 +3345,7 @@ static inline void hal_rx_dump_pkt_tlvs(struct hal_soc *hal_soc, &pkt_tlvs->msdu_start_tlv.rx_msdu_start; struct rx_mpdu_end *mpdu_end = &pkt_tlvs->mpdu_end_tlv.rx_mpdu_end; struct rx_msdu_end *msdu_end = &pkt_tlvs->msdu_end_tlv.rx_msdu_end; + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; hal_rx_dump_rx_attention_tlv(rx_attn, dbg_level); hal_rx_dump_mpdu_start_tlv(mpdu_start, dbg_level, hal_soc); diff --git a/hal/wifi3.0/hal_srng.c b/hal/wifi3.0/hal_srng.c index 9fe510143b..0b7587278b 100644 --- a/hal/wifi3.0/hal_srng.c +++ b/hal/wifi3.0/hal_srng.c @@ -266,10 +266,11 @@ static void hal_target_based_configure(struct hal_soc *hal) } } -uint32_t hal_get_target_type(struct hal_soc *hal) +uint32_t hal_get_target_type(hal_soc_handle_t hal_soc_hdl) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; struct hif_target_info *tgt_info = - hif_get_target_info_handle(hal->hif_handle); + hif_get_target_info_handle(hal_soc->hif_handle); return tgt_info->target_type; } @@ -336,7 +337,7 @@ void *hal_attach(void *hif_handle, qdf_device_t qdf_dev) qdf_spinlock_create(&hal->register_access_lock); hal->register_window = 0; - hal->target_type = hal_get_target_type(hal); + hal->target_type = hal_get_target_type(hal_soc_to_hal_soc_handle(hal)); hal_target_based_configure(hal); @@ -435,10 +436,12 @@ static inline void hal_ce_dst_setup(struct hal_soc *hal, struct hal_srng *srng, * @ix2: pointer to store IX2 reg value * @ix3: pointer to store IX3 reg value */ -void hal_reo_read_write_ctrl_ix(struct hal_soc *hal, bool read, uint32_t *ix0, - uint32_t *ix1, uint32_t *ix2, uint32_t *ix3) +void hal_reo_read_write_ctrl_ix(hal_soc_handle_t hal_soc_hdl, bool read, + uint32_t *ix0, uint32_t *ix1, + uint32_t *ix2, uint32_t *ix3) { uint32_t reg_offset; + struct hal_soc *hal = (struct hal_soc *)hal_soc_hdl; if (read) { if (ix0) { diff --git a/hal/wifi3.0/hal_tx.h b/hal/wifi3.0/hal_tx.h index de730cc1c9..5f71897684 100644 --- a/hal/wifi3.0/hal_tx.h +++ b/hal/wifi3.0/hal_tx.h @@ -892,9 +892,12 @@ static inline void hal_tx_init_data_ring(void *hal_soc, void *hal_srng) * * Return: void */ -static inline void hal_tx_desc_set_dscp_tid_table_id(struct hal_soc *hal_soc, - void *desc, uint8_t id) +static inline +void hal_tx_desc_set_dscp_tid_table_id(hal_soc_handle_t hal_soc_hdl, + void *desc, uint8_t id) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + hal_soc->ops->hal_tx_desc_set_dscp_tid_table_id(desc, id); } @@ -907,9 +910,11 @@ static inline void hal_tx_desc_set_dscp_tid_table_id(struct hal_soc *hal_soc, * * Return: void */ -static inline void hal_tx_set_dscp_tid_map(struct hal_soc *hal_soc, +static inline void hal_tx_set_dscp_tid_map(hal_soc_handle_t hal_soc_hdl, uint8_t *map, uint8_t id) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + hal_soc->ops->hal_tx_set_dscp_tid_map(hal_soc, map, id); } @@ -923,9 +928,12 @@ static inline void hal_tx_set_dscp_tid_map(struct hal_soc *hal_soc, * * Return: void */ -static inline void hal_tx_update_dscp_tid(struct hal_soc *hal_soc, uint8_t tid, - uint8_t id, uint8_t dscp) +static inline +void hal_tx_update_dscp_tid(hal_soc_handle_t hal_soc_hdl, uint8_t tid, + uint8_t id, uint8_t dscp) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + hal_soc->ops->hal_tx_update_dscp_tid(hal_soc, tid, id, dscp); } @@ -940,9 +948,11 @@ static inline void hal_tx_update_dscp_tid(struct hal_soc *hal_soc, uint8_t tid, * * Return: void */ -static inline void hal_tx_desc_set_lmac_id(struct hal_soc *hal_soc, +static inline void hal_tx_desc_set_lmac_id(hal_soc_handle_t hal_soc_hdl, void *desc, uint8_t lmac_id) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + hal_soc->ops->hal_tx_desc_set_lmac_id(desc, lmac_id); } @@ -956,9 +966,11 @@ static inline void hal_tx_desc_set_lmac_id(struct hal_soc *hal_soc, * * Return: void */ -static inline void hal_tx_desc_set_search_type(struct hal_soc *hal_soc, +static inline void hal_tx_desc_set_search_type(hal_soc_handle_t hal_soc_hdl, void *desc, uint8_t search_type) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + hal_soc->ops->hal_tx_desc_set_search_type(desc, search_type); } @@ -971,10 +983,12 @@ static inline void hal_tx_desc_set_search_type(struct hal_soc *hal_soc, * * Return: void */ -static inline void hal_tx_desc_set_search_index(struct hal_soc *hal_soc, +static inline void hal_tx_desc_set_search_index(hal_soc_handle_t hal_soc_hdl, void *desc, uint32_t search_index) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + hal_soc->ops->hal_tx_desc_set_search_index(desc, search_index); } @@ -1024,9 +1038,11 @@ static inline void hal_tx_desc_set_buf_addr(void *desc, dma_addr_t paddr, * * Return: void */ -static inline void hal_tx_set_pcp_tid_map_default(struct hal_soc *hal_soc, +static inline void hal_tx_set_pcp_tid_map_default(hal_soc_handle_t hal_soc_hdl, uint8_t *map) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + hal_soc->ops->hal_tx_set_pcp_tid_map(hal_soc, map); } @@ -1039,9 +1055,11 @@ static inline void hal_tx_set_pcp_tid_map_default(struct hal_soc *hal_soc, * * Return: void */ -static inline void hal_tx_update_pcp_tid_map(struct hal_soc *hal_soc, +static inline void hal_tx_update_pcp_tid_map(hal_soc_handle_t hal_soc_hdl, uint8_t pcp, uint8_t tid) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + hal_soc->ops->hal_tx_update_pcp_tid_map(hal_soc, tid, tid); } @@ -1053,8 +1071,11 @@ static inline void hal_tx_update_pcp_tid_map(struct hal_soc *hal_soc, * * Return: void */ -static inline void hal_tx_set_tidmap_prty(struct hal_soc *hal_soc, uint8_t val) +static inline +void hal_tx_set_tidmap_prty(hal_soc_handle_t hal_soc_hdl, uint8_t val) { + struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl; + hal_soc->ops->hal_tx_set_tidmap_prty(hal_soc, val); } #endif /* HAL_TX_H */