Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 1 | /* |
Krunal Soni | 9911b44 | 2019-02-22 15:39:03 -0800 | [diff] [blame] | 2 | * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 3 | * |
Balamurugan Mahalingam | 5d80641 | 2018-07-30 18:04:15 +0530 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 8 | * |
Balamurugan Mahalingam | 5d80641 | 2018-07-30 18:04:15 +0530 | [diff] [blame] | 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 17 | */ |
| 18 | |
| 19 | #ifndef _HAL_INTERNAL_H_ |
| 20 | #define _HAL_INTERNAL_H_ |
| 21 | |
| 22 | #include "qdf_types.h" |
| 23 | #include "qdf_lock.h" |
Leo Chang | 5ea93a4 | 2016-11-03 12:39:49 -0700 | [diff] [blame] | 24 | #include "qdf_mem.h" |
Ravi Joshi | 36f68ad | 2016-11-09 17:09:47 -0800 | [diff] [blame] | 25 | #include "qdf_nbuf.h" |
Houston Hoffman | 5141f9d | 2017-01-05 10:49:17 -0800 | [diff] [blame] | 26 | #include "pld_common.h" |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 27 | |
Mohit Khanna | efdae7f | 2018-11-02 16:19:48 -0700 | [diff] [blame] | 28 | #define hal_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_TXRX, params) |
| 29 | #define hal_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_TXRX, params) |
| 30 | #define hal_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_TXRX, params) |
| 31 | #define hal_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_TXRX, params) |
| 32 | #define hal_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_TXRX, params) |
Krunal Soni | 9911b44 | 2019-02-22 15:39:03 -0800 | [diff] [blame] | 33 | #ifdef ENABLE_VERBOSE_DEBUG |
| 34 | extern bool is_hal_verbose_debug_enabled; |
| 35 | #define hal_verbose_debug(params...) \ |
| 36 | if (unlikely(is_hal_verbose_debug_enabled)) \ |
| 37 | do {\ |
| 38 | QDF_TRACE_DEBUG(QDF_MODULE_ID_TXRX, params); \ |
| 39 | } while (0) |
| 40 | #define hal_verbose_hex_dump(params...) \ |
| 41 | if (unlikely(is_hal_verbose_debug_enabled)) \ |
| 42 | do {\ |
| 43 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_TXRX, \ |
| 44 | QDF_TRACE_LEVEL_DEBUG, \ |
| 45 | params); \ |
| 46 | } while (0) |
| 47 | #else |
| 48 | #define hal_verbose_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_TXRX, params) |
| 49 | #define hal_verbose_hex_dump(params...) \ |
| 50 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG, \ |
| 51 | params) |
| 52 | #endif |
Mohit Khanna | efdae7f | 2018-11-02 16:19:48 -0700 | [diff] [blame] | 53 | |
Akshay Kosigi | 6a20675 | 2019-06-10 23:14:52 +0530 | [diff] [blame] | 54 | /* |
| 55 | * dp_hal_soc - opaque handle for DP HAL soc |
| 56 | */ |
| 57 | struct hal_soc_handle; |
| 58 | typedef struct hal_soc_handle *hal_soc_handle_t; |
Mohit Khanna | 6c22db3 | 2018-03-19 21:47:51 -0700 | [diff] [blame] | 59 | |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 60 | /* TBD: This should be movded to shared HW header file */ |
| 61 | enum hal_srng_ring_id { |
| 62 | /* UMAC rings */ |
| 63 | HAL_SRNG_REO2SW1 = 0, |
| 64 | HAL_SRNG_REO2SW2 = 1, |
| 65 | HAL_SRNG_REO2SW3 = 2, |
| 66 | HAL_SRNG_REO2SW4 = 3, |
| 67 | HAL_SRNG_REO2TCL = 4, |
| 68 | HAL_SRNG_SW2REO = 5, |
| 69 | /* 6-7 unused */ |
| 70 | HAL_SRNG_REO_CMD = 8, |
| 71 | HAL_SRNG_REO_STATUS = 9, |
| 72 | /* 10-15 unused */ |
| 73 | HAL_SRNG_SW2TCL1 = 16, |
| 74 | HAL_SRNG_SW2TCL2 = 17, |
| 75 | HAL_SRNG_SW2TCL3 = 18, |
| 76 | HAL_SRNG_SW2TCL4 = 19, /* FW2TCL ring */ |
| 77 | /* 20-23 unused */ |
| 78 | HAL_SRNG_SW2TCL_CMD = 24, |
| 79 | HAL_SRNG_TCL_STATUS = 25, |
| 80 | /* 26-31 unused */ |
| 81 | HAL_SRNG_CE_0_SRC = 32, |
| 82 | HAL_SRNG_CE_1_SRC = 33, |
| 83 | HAL_SRNG_CE_2_SRC = 34, |
| 84 | HAL_SRNG_CE_3_SRC = 35, |
| 85 | HAL_SRNG_CE_4_SRC = 36, |
| 86 | HAL_SRNG_CE_5_SRC = 37, |
| 87 | HAL_SRNG_CE_6_SRC = 38, |
| 88 | HAL_SRNG_CE_7_SRC = 39, |
| 89 | HAL_SRNG_CE_8_SRC = 40, |
| 90 | HAL_SRNG_CE_9_SRC = 41, |
| 91 | HAL_SRNG_CE_10_SRC = 42, |
| 92 | HAL_SRNG_CE_11_SRC = 43, |
| 93 | /* 44-55 unused */ |
| 94 | HAL_SRNG_CE_0_DST = 56, |
| 95 | HAL_SRNG_CE_1_DST = 57, |
| 96 | HAL_SRNG_CE_2_DST = 58, |
| 97 | HAL_SRNG_CE_3_DST = 59, |
| 98 | HAL_SRNG_CE_4_DST = 60, |
| 99 | HAL_SRNG_CE_5_DST = 61, |
| 100 | HAL_SRNG_CE_6_DST = 62, |
| 101 | HAL_SRNG_CE_7_DST = 63, |
| 102 | HAL_SRNG_CE_8_DST = 64, |
| 103 | HAL_SRNG_CE_9_DST = 65, |
| 104 | HAL_SRNG_CE_10_DST = 66, |
| 105 | HAL_SRNG_CE_11_DST = 67, |
| 106 | /* 68-79 unused */ |
| 107 | HAL_SRNG_CE_0_DST_STATUS = 80, |
| 108 | HAL_SRNG_CE_1_DST_STATUS = 81, |
| 109 | HAL_SRNG_CE_2_DST_STATUS = 82, |
| 110 | HAL_SRNG_CE_3_DST_STATUS = 83, |
| 111 | HAL_SRNG_CE_4_DST_STATUS = 84, |
| 112 | HAL_SRNG_CE_5_DST_STATUS = 85, |
| 113 | HAL_SRNG_CE_6_DST_STATUS = 86, |
| 114 | HAL_SRNG_CE_7_DST_STATUS = 87, |
| 115 | HAL_SRNG_CE_8_DST_STATUS = 88, |
| 116 | HAL_SRNG_CE_9_DST_STATUS = 89, |
| 117 | HAL_SRNG_CE_10_DST_STATUS = 90, |
| 118 | HAL_SRNG_CE_11_DST_STATUS = 91, |
| 119 | /* 92-103 unused */ |
| 120 | HAL_SRNG_WBM_IDLE_LINK = 104, |
| 121 | HAL_SRNG_WBM_SW_RELEASE = 105, |
| 122 | HAL_SRNG_WBM2SW0_RELEASE = 106, |
| 123 | HAL_SRNG_WBM2SW1_RELEASE = 107, |
| 124 | HAL_SRNG_WBM2SW2_RELEASE = 108, |
| 125 | HAL_SRNG_WBM2SW3_RELEASE = 109, |
| 126 | /* 110-127 unused */ |
| 127 | HAL_SRNG_UMAC_ID_END = 127, |
| 128 | /* LMAC rings - The following set will be replicated for each LMAC */ |
| 129 | HAL_SRNG_LMAC1_ID_START = 128, |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 130 | HAL_SRNG_WMAC1_SW2RXDMA0_BUF0 = HAL_SRNG_LMAC1_ID_START, |
| 131 | #ifdef IPA_OFFLOAD |
| 132 | HAL_SRNG_WMAC1_SW2RXDMA0_BUF1 = (HAL_SRNG_LMAC1_ID_START + 1), |
| 133 | HAL_SRNG_WMAC1_SW2RXDMA0_BUF2 = (HAL_SRNG_LMAC1_ID_START + 2), |
| 134 | HAL_SRNG_WMAC1_SW2RXDMA1_BUF = (HAL_SRNG_WMAC1_SW2RXDMA0_BUF2 + 1), |
| 135 | #else |
| 136 | HAL_SRNG_WMAC1_SW2RXDMA1_BUF = (HAL_SRNG_WMAC1_SW2RXDMA0_BUF0 + 1), |
Naveen Rawat | ba24c48 | 2017-05-15 12:02:48 -0700 | [diff] [blame] | 137 | #endif |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 138 | HAL_SRNG_WMAC1_SW2RXDMA2_BUF = (HAL_SRNG_WMAC1_SW2RXDMA1_BUF + 1), |
| 139 | HAL_SRNG_WMAC1_SW2RXDMA0_STATBUF = (HAL_SRNG_WMAC1_SW2RXDMA2_BUF + 1), |
| 140 | HAL_SRNG_WMAC1_SW2RXDMA1_STATBUF = |
| 141 | (HAL_SRNG_WMAC1_SW2RXDMA0_STATBUF + 1), |
| 142 | HAL_SRNG_WMAC1_RXDMA2SW0 = (HAL_SRNG_WMAC1_SW2RXDMA1_STATBUF + 1), |
| 143 | HAL_SRNG_WMAC1_RXDMA2SW1 = (HAL_SRNG_WMAC1_RXDMA2SW0 + 1), |
| 144 | HAL_SRNG_WMAC1_SW2RXDMA1_DESC = (HAL_SRNG_WMAC1_RXDMA2SW1 + 1), |
| 145 | #ifdef WLAN_FEATURE_CIF_CFR |
| 146 | HAL_SRNG_WIFI_POS_SRC_DMA_RING = (HAL_SRNG_WMAC1_SW2RXDMA1_DESC + 1), |
Sathish Kumar | 03d77e6 | 2017-11-17 17:27:52 +0530 | [diff] [blame] | 147 | HAL_SRNG_DIR_BUF_RX_SRC_DMA_RING = (HAL_SRNG_WIFI_POS_SRC_DMA_RING + 1), |
| 148 | #else |
| 149 | HAL_SRNG_DIR_BUF_RX_SRC_DMA_RING = (HAL_SRNG_WMAC1_SW2RXDMA1_DESC + 1), |
Yun Park | fde6b9e | 2017-06-26 17:13:11 -0700 | [diff] [blame] | 150 | #endif |
| 151 | /* -142 unused */ |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 152 | HAL_SRNG_LMAC1_ID_END = 143 |
| 153 | }; |
| 154 | |
Balamurugan Mahalingam | d015964 | 2018-07-11 15:02:29 +0530 | [diff] [blame] | 155 | #define HAL_RXDMA_MAX_RING_SIZE 0xFFFF |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 156 | #define HAL_MAX_LMACS 3 |
| 157 | #define HAL_MAX_RINGS_PER_LMAC (HAL_SRNG_LMAC1_ID_END - HAL_SRNG_LMAC1_ID_START) |
| 158 | #define HAL_MAX_LMAC_RINGS (HAL_MAX_LMACS * HAL_MAX_RINGS_PER_LMAC) |
| 159 | |
| 160 | #define HAL_SRNG_ID_MAX (HAL_SRNG_UMAC_ID_END + HAL_MAX_LMAC_RINGS) |
| 161 | |
| 162 | enum hal_srng_dir { |
| 163 | HAL_SRNG_SRC_RING, |
| 164 | HAL_SRNG_DST_RING |
| 165 | }; |
| 166 | |
| 167 | /* Lock wrappers for SRNG */ |
| 168 | #define hal_srng_lock_t qdf_spinlock_t |
| 169 | #define SRNG_LOCK_INIT(_lock) qdf_spinlock_create(_lock) |
Gurumoorthi Gnanasambandhan | ed4bcf8 | 2017-05-24 00:10:59 +0530 | [diff] [blame] | 170 | #define SRNG_LOCK(_lock) qdf_spin_lock_bh(_lock) |
| 171 | #define SRNG_UNLOCK(_lock) qdf_spin_unlock_bh(_lock) |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 172 | #define SRNG_LOCK_DESTROY(_lock) qdf_spinlock_destroy(_lock) |
| 173 | |
Balamurugan Mahalingam | d015964 | 2018-07-11 15:02:29 +0530 | [diff] [blame] | 174 | struct hal_soc; |
Akshay Kosigi | 91c5652 | 2019-07-02 11:49:39 +0530 | [diff] [blame] | 175 | |
| 176 | /** |
Akshay Kosigi | 0bca9fb | 2019-06-27 15:26:13 +0530 | [diff] [blame] | 177 | * dp_hal_ring - opaque handle for DP HAL SRNG |
| 178 | */ |
| 179 | struct hal_ring_handle; |
| 180 | typedef struct hal_ring_handle *hal_ring_handle_t; |
| 181 | |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 182 | #define MAX_SRNG_REG_GROUPS 2 |
| 183 | |
Sravan Kumar Kairam | 78b01a1 | 2019-09-16 14:22:55 +0530 | [diff] [blame] | 184 | /* Hal Srng bit mask |
| 185 | * HAL_SRNG_FLUSH_EVENT: SRNG HP TP flush in case of link down |
| 186 | */ |
| 187 | #define HAL_SRNG_FLUSH_EVENT BIT(0) |
| 188 | |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 189 | /* Common SRNG ring structure for source and destination rings */ |
| 190 | struct hal_srng { |
| 191 | /* Unique SRNG ring ID */ |
| 192 | uint8_t ring_id; |
| 193 | |
| 194 | /* Ring initialization done */ |
| 195 | uint8_t initialized; |
| 196 | |
| 197 | /* Interrupt/MSI value assigned to this ring */ |
| 198 | int irq; |
| 199 | |
| 200 | /* Physical base address of the ring */ |
| 201 | qdf_dma_addr_t ring_base_paddr; |
| 202 | |
| 203 | /* Virtual base address of the ring */ |
| 204 | uint32_t *ring_base_vaddr; |
| 205 | |
| 206 | /* Number of entries in ring */ |
| 207 | uint32_t num_entries; |
| 208 | |
| 209 | /* Ring size */ |
| 210 | uint32_t ring_size; |
| 211 | |
| 212 | /* Ring size mask */ |
| 213 | uint32_t ring_size_mask; |
| 214 | |
| 215 | /* Size of ring entry */ |
| 216 | uint32_t entry_size; |
| 217 | |
| 218 | /* Interrupt timer threshold – in micro seconds */ |
| 219 | uint32_t intr_timer_thres_us; |
| 220 | |
| 221 | /* Interrupt batch counter threshold – in number of ring entries */ |
| 222 | uint32_t intr_batch_cntr_thres_entries; |
| 223 | |
| 224 | /* MSI Address */ |
| 225 | qdf_dma_addr_t msi_addr; |
| 226 | |
| 227 | /* MSI data */ |
| 228 | uint32_t msi_data; |
| 229 | |
| 230 | /* Misc flags */ |
| 231 | uint32_t flags; |
| 232 | |
| 233 | /* Lock for serializing ring index updates */ |
| 234 | hal_srng_lock_t lock; |
| 235 | |
| 236 | /* Start offset of SRNG register groups for this ring |
| 237 | * TBD: See if this is required - register address can be derived |
| 238 | * from ring ID |
| 239 | */ |
| 240 | void *hwreg_base[MAX_SRNG_REG_GROUPS]; |
| 241 | |
| 242 | /* Source or Destination ring */ |
| 243 | enum hal_srng_dir ring_dir; |
| 244 | |
| 245 | union { |
| 246 | struct { |
| 247 | /* SW tail pointer */ |
| 248 | uint32_t tp; |
| 249 | |
| 250 | /* Shadow head pointer location to be updated by HW */ |
| 251 | uint32_t *hp_addr; |
| 252 | |
| 253 | /* Cached head pointer */ |
| 254 | uint32_t cached_hp; |
| 255 | |
| 256 | /* Tail pointer location to be updated by SW – This |
| 257 | * will be a register address and need not be |
| 258 | * accessed through SW structure */ |
| 259 | uint32_t *tp_addr; |
| 260 | |
| 261 | /* Current SW loop cnt */ |
Houston Hoffman | 7410912 | 2016-10-21 14:58:34 -0700 | [diff] [blame] | 262 | uint32_t loop_cnt; |
| 263 | |
| 264 | /* max transfer size */ |
| 265 | uint16_t max_buffer_length; |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 266 | } dst_ring; |
| 267 | |
| 268 | struct { |
| 269 | /* SW head pointer */ |
| 270 | uint32_t hp; |
| 271 | |
| 272 | /* SW reap head pointer */ |
| 273 | uint32_t reap_hp; |
| 274 | |
| 275 | /* Shadow tail pointer location to be updated by HW */ |
| 276 | uint32_t *tp_addr; |
| 277 | |
| 278 | /* Cached tail pointer */ |
| 279 | uint32_t cached_tp; |
| 280 | |
| 281 | /* Head pointer location to be updated by SW – This |
| 282 | * will be a register address and need not be accessed |
| 283 | * through SW structure */ |
| 284 | uint32_t *hp_addr; |
| 285 | |
| 286 | /* Low threshold – in number of ring entries */ |
| 287 | uint32_t low_threshold; |
| 288 | } src_ring; |
| 289 | } u; |
Houston Hoffman | 8bbc990 | 2017-04-10 14:09:51 -0700 | [diff] [blame] | 290 | |
| 291 | struct hal_soc *hal_soc; |
Venkata Sharath Chandra Manchala | 5ee6efd | 2019-08-01 11:22:04 -0700 | [diff] [blame] | 292 | |
| 293 | /* Number of times hp/tp updated in runtime resume */ |
Sravan Kumar Kairam | 78b01a1 | 2019-09-16 14:22:55 +0530 | [diff] [blame] | 294 | uint32_t flush_count; |
| 295 | /* hal srng event flag*/ |
| 296 | unsigned long srng_event; |
| 297 | /* last flushed time stamp */ |
| 298 | uint64_t last_flush_ts; |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 299 | }; |
| 300 | |
| 301 | /* HW SRNG configuration table */ |
| 302 | struct hal_hw_srng_config { |
| 303 | int start_ring_id; |
| 304 | uint16_t max_rings; |
| 305 | uint16_t entry_size; |
| 306 | uint32_t reg_start[MAX_SRNG_REG_GROUPS]; |
| 307 | uint16_t reg_size[MAX_SRNG_REG_GROUPS]; |
| 308 | uint8_t lmac_ring; |
| 309 | enum hal_srng_dir ring_dir; |
Venkata Sharath Chandra Manchala | 9a59bd6 | 2018-06-14 16:53:29 -0700 | [diff] [blame] | 310 | uint32_t max_size; |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 311 | }; |
| 312 | |
Houston Hoffman | 5141f9d | 2017-01-05 10:49:17 -0800 | [diff] [blame] | 313 | #define MAX_SHADOW_REGISTERS 36 |
| 314 | |
Balamurugan Mahalingam | d015964 | 2018-07-11 15:02:29 +0530 | [diff] [blame] | 315 | struct hal_hw_txrx_ops { |
Balamurugan Mahalingam | 5d80641 | 2018-07-30 18:04:15 +0530 | [diff] [blame] | 316 | |
| 317 | /* init and setup */ |
Akshay Kosigi | 8eda31c | 2019-07-10 14:42:42 +0530 | [diff] [blame] | 318 | void (*hal_srng_dst_hw_init)(struct hal_soc *hal, |
| 319 | struct hal_srng *srng); |
| 320 | void (*hal_srng_src_hw_init)(struct hal_soc *hal, |
| 321 | struct hal_srng *srng); |
| 322 | void (*hal_get_hw_hptp)(struct hal_soc *hal, |
Akshay Kosigi | 0bca9fb | 2019-06-27 15:26:13 +0530 | [diff] [blame] | 323 | hal_ring_handle_t hal_ring_hdl, |
Venkata Sharath Chandra Manchala | 443b9b4 | 2018-10-10 12:04:54 -0700 | [diff] [blame] | 324 | uint32_t *headp, uint32_t *tailp, |
| 325 | uint8_t ring_type); |
Akshay Kosigi | 8eda31c | 2019-07-10 14:42:42 +0530 | [diff] [blame] | 326 | void (*hal_reo_setup)(struct hal_soc *hal_soc, void *reoparams); |
| 327 | void (*hal_setup_link_idle_list)( |
| 328 | struct hal_soc *hal_soc, |
| 329 | qdf_dma_addr_t scatter_bufs_base_paddr[], |
| 330 | void *scatter_bufs_base_vaddr[], |
| 331 | uint32_t num_scatter_bufs, |
| 332 | uint32_t scatter_buf_size, |
| 333 | uint32_t last_buf_end_offset, |
| 334 | uint32_t num_entries); |
Balamurugan Mahalingam | 5d80641 | 2018-07-30 18:04:15 +0530 | [diff] [blame] | 335 | |
Balamurugan Mahalingam | d015964 | 2018-07-11 15:02:29 +0530 | [diff] [blame] | 336 | /* tx */ |
| 337 | void (*hal_tx_desc_set_dscp_tid_table_id)(void *desc, uint8_t id); |
Akshay Kosigi | 8eda31c | 2019-07-10 14:42:42 +0530 | [diff] [blame] | 338 | void (*hal_tx_set_dscp_tid_map)(struct hal_soc *hal_soc, uint8_t *map, |
Balamurugan Mahalingam | d015964 | 2018-07-11 15:02:29 +0530 | [diff] [blame] | 339 | uint8_t id); |
Akshay Kosigi | 8eda31c | 2019-07-10 14:42:42 +0530 | [diff] [blame] | 340 | void (*hal_tx_update_dscp_tid)(struct hal_soc *hal_soc, uint8_t tid, |
| 341 | uint8_t id, |
Balamurugan Mahalingam | d015964 | 2018-07-11 15:02:29 +0530 | [diff] [blame] | 342 | uint8_t dscp); |
| 343 | void (*hal_tx_desc_set_lmac_id)(void *desc, uint8_t lmac_id); |
Balamurugan Mahalingam | 5d80641 | 2018-07-30 18:04:15 +0530 | [diff] [blame] | 344 | void (*hal_tx_desc_set_buf_addr)(void *desc, dma_addr_t paddr, |
| 345 | uint8_t pool_id, uint32_t desc_id, uint8_t type); |
Balamurugan Mahalingam | fa1d9c7 | 2018-09-25 12:13:34 +0530 | [diff] [blame] | 346 | void (*hal_tx_desc_set_search_type)(void *desc, uint8_t search_type); |
| 347 | void (*hal_tx_desc_set_search_index)(void *desc, uint32_t search_index); |
Subhranil Choudhury | 4ee1b5e | 2019-08-20 18:20:47 +0530 | [diff] [blame] | 348 | void (*hal_tx_desc_set_cache_set_num)(void *desc, uint8_t search_index); |
Akshay Kosigi | 8eda31c | 2019-07-10 14:42:42 +0530 | [diff] [blame] | 349 | void (*hal_tx_comp_get_status)(void *desc, void *ts, |
| 350 | struct hal_soc *hal); |
Balamurugan Mahalingam | 764219e | 2018-09-17 15:34:25 +0530 | [diff] [blame] | 351 | uint8_t (*hal_tx_comp_get_release_reason)(void *hal_desc); |
Balamurugan Mahalingam | d015964 | 2018-07-11 15:02:29 +0530 | [diff] [blame] | 352 | |
| 353 | /* rx */ |
| 354 | uint32_t (*hal_rx_msdu_start_nss_get)(uint8_t *); |
| 355 | void (*hal_rx_mon_hw_desc_get_mpdu_status)(void *hw_desc_addr, |
| 356 | struct mon_rx_status *rs); |
| 357 | uint8_t (*hal_rx_get_tlv)(void *rx_tlv); |
| 358 | void (*hal_rx_proc_phyrx_other_receive_info_tlv)(void *rx_tlv_hdr, |
| 359 | void *ppdu_info_handle); |
| 360 | void (*hal_rx_dump_msdu_start_tlv)(void *msdu_start, uint8_t dbg_level); |
Balamurugan Mahalingam | 97ad106 | 2018-07-11 15:22:58 +0530 | [diff] [blame] | 361 | void (*hal_rx_dump_msdu_end_tlv)(void *msdu_end, |
| 362 | uint8_t dbg_level); |
Balamurugan Mahalingam | d015964 | 2018-07-11 15:02:29 +0530 | [diff] [blame] | 363 | uint32_t (*hal_get_link_desc_size)(void); |
| 364 | uint32_t (*hal_rx_mpdu_start_tid_get)(uint8_t *buf); |
| 365 | uint32_t (*hal_rx_msdu_start_reception_type_get)(uint8_t *buf); |
Balamurugan Mahalingam | 96d2d41 | 2018-07-10 10:11:58 +0530 | [diff] [blame] | 366 | uint16_t (*hal_rx_msdu_end_da_idx_get)(uint8_t *buf); |
Balamurugan Mahalingam | 5d80641 | 2018-07-30 18:04:15 +0530 | [diff] [blame] | 367 | void* (*hal_rx_msdu_desc_info_get_ptr)(void *msdu_details_ptr); |
| 368 | void* (*hal_rx_link_desc_msdu0_ptr)(void *msdu_link_ptr); |
| 369 | void (*hal_reo_status_get_header)(uint32_t *d, int b, void *h); |
| 370 | uint32_t (*hal_rx_status_get_tlv_info)(void *rx_tlv_hdr, |
Akshay Kosigi | 6a20675 | 2019-06-10 23:14:52 +0530 | [diff] [blame] | 371 | void *ppdu_info, |
| 372 | hal_soc_handle_t hal_soc_hdl, |
| 373 | qdf_nbuf_t nbuf); |
Balamurugan Mahalingam | 764219e | 2018-09-17 15:34:25 +0530 | [diff] [blame] | 374 | void (*hal_rx_wbm_err_info_get)(void *wbm_desc, |
| 375 | void *wbm_er_info); |
| 376 | void (*hal_rx_dump_mpdu_start_tlv)(void *mpdustart, |
| 377 | uint8_t dbg_level); |
Debasis Das | c39a68d | 2019-01-28 17:02:06 +0530 | [diff] [blame] | 378 | |
Akshay Kosigi | 8eda31c | 2019-07-10 14:42:42 +0530 | [diff] [blame] | 379 | void (*hal_tx_set_pcp_tid_map)(struct hal_soc *hal_soc, uint8_t *map); |
| 380 | void (*hal_tx_update_pcp_tid_map)(struct hal_soc *hal_soc, uint8_t pcp, |
Debasis Das | c39a68d | 2019-01-28 17:02:06 +0530 | [diff] [blame] | 381 | uint8_t id); |
Akshay Kosigi | 8eda31c | 2019-07-10 14:42:42 +0530 | [diff] [blame] | 382 | void (*hal_tx_set_tidmap_prty)(struct hal_soc *hal_soc, uint8_t prio); |
Venkata Sharath Chandra Manchala | d1b7e4c | 2019-09-20 10:01:21 -0700 | [diff] [blame] | 383 | uint8_t (*hal_rx_get_rx_fragment_number)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | ee90938 | 2019-09-20 10:52:37 -0700 | [diff] [blame] | 384 | uint8_t (*hal_rx_msdu_end_da_is_mcbc_get)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | 59ebd5e | 2019-09-20 15:52:55 -0700 | [diff] [blame] | 385 | uint8_t (*hal_rx_msdu_end_sa_is_valid_get)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | 5bf1e5a | 2019-09-20 16:18:42 -0700 | [diff] [blame] | 386 | uint16_t (*hal_rx_msdu_end_sa_idx_get)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | 43d5632 | 2019-09-20 16:51:48 -0700 | [diff] [blame] | 387 | uint32_t (*hal_rx_desc_is_first_msdu)(void *hw_desc_addr); |
Venkata Sharath Chandra Manchala | f05b2ae | 2019-09-20 17:25:21 -0700 | [diff] [blame] | 388 | uint32_t (*hal_rx_msdu_end_l3_hdr_padding_get)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | c1a4c8b | 2019-09-20 17:42:07 -0700 | [diff] [blame] | 389 | uint32_t (*hal_rx_encryption_info_valid)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | a2d7497 | 2019-09-20 18:02:57 -0700 | [diff] [blame] | 390 | void (*hal_rx_print_pn)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | cb255b4 | 2019-09-21 11:03:38 -0700 | [diff] [blame] | 391 | uint8_t (*hal_rx_msdu_end_first_msdu_get)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | 7905538 | 2019-09-21 11:22:30 -0700 | [diff] [blame] | 392 | uint8_t (*hal_rx_msdu_end_da_is_valid_get)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | 55f2d92 | 2019-09-21 11:37:01 -0700 | [diff] [blame] | 393 | uint8_t (*hal_rx_msdu_end_last_msdu_get)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | 2a52d34 | 2019-09-21 11:52:54 -0700 | [diff] [blame] | 394 | bool (*hal_rx_get_mpdu_mac_ad4_valid)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | 96ed623 | 2019-09-21 12:11:19 -0700 | [diff] [blame] | 395 | uint32_t (*hal_rx_mpdu_start_sw_peer_id_get)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | e7924fd | 2019-09-21 12:44:52 -0700 | [diff] [blame] | 396 | uint32_t (*hal_rx_mpdu_get_to_ds)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | 1e3a479 | 2019-09-21 13:15:09 -0700 | [diff] [blame] | 397 | uint32_t (*hal_rx_mpdu_get_fr_ds)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | 25ba7b8 | 2019-09-21 13:31:30 -0700 | [diff] [blame] | 398 | uint8_t (*hal_rx_get_mpdu_frame_control_valid)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | e3ae319 | 2019-09-21 13:59:46 -0700 | [diff] [blame] | 399 | QDF_STATUS |
| 400 | (*hal_rx_mpdu_get_addr1)(uint8_t *buf, uint8_t *mac_addr); |
Venkata Sharath Chandra Manchala | a81a2fe | 2019-09-21 14:29:40 -0700 | [diff] [blame] | 401 | QDF_STATUS |
| 402 | (*hal_rx_mpdu_get_addr2)(uint8_t *buf, uint8_t *mac_addr); |
Venkata Sharath Chandra Manchala | 7c86825 | 2019-09-21 14:58:34 -0700 | [diff] [blame] | 403 | QDF_STATUS |
| 404 | (*hal_rx_mpdu_get_addr3)(uint8_t *buf, uint8_t *mac_addr); |
Venkata Sharath Chandra Manchala | aa76283 | 2019-09-21 15:13:47 -0700 | [diff] [blame] | 405 | QDF_STATUS |
| 406 | (*hal_rx_mpdu_get_addr4)(uint8_t *buf, uint8_t *mac_addr); |
Venkata Sharath Chandra Manchala | 68d6f0d | 2019-09-21 15:33:47 -0700 | [diff] [blame] | 407 | uint8_t (*hal_rx_get_mpdu_sequence_control_valid)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | 5ddc518 | 2019-09-21 15:53:03 -0700 | [diff] [blame] | 408 | bool (*hal_rx_is_unicast)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | 8513048 | 2019-09-21 16:17:01 -0700 | [diff] [blame] | 409 | uint32_t (*hal_rx_tid_get)(hal_soc_handle_t hal_soc_hdl, uint8_t *buf); |
Venkata Sharath Chandra Manchala | 84d5092 | 2019-09-21 16:48:04 -0700 | [diff] [blame] | 410 | uint32_t (*hal_rx_hw_desc_get_ppduid_get)(void *hw_desc_addr); |
Venkata Sharath Chandra Manchala | 56022cb | 2019-09-21 18:17:21 -0700 | [diff] [blame] | 411 | uint32_t (*hal_rx_mpdu_start_mpdu_qos_control_valid_get)(uint8_t *buf); |
Venkata Sharath Chandra Manchala | 685045e | 2019-09-21 18:32:51 -0700 | [diff] [blame^] | 412 | uint32_t (*hal_rx_msdu_end_sa_sw_peer_id_get)(uint8_t *buf); |
Balamurugan Mahalingam | d015964 | 2018-07-11 15:02:29 +0530 | [diff] [blame] | 413 | }; |
| 414 | |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 415 | /** |
| 416 | * HAL context to be used to access SRNG APIs (currently used by data path |
| 417 | * and transport (CE) modules) |
| 418 | */ |
| 419 | struct hal_soc { |
| 420 | /* HIF handle to access HW registers */ |
Akshay Kosigi | 8eda31c | 2019-07-10 14:42:42 +0530 | [diff] [blame] | 421 | struct hif_opaque_softc *hif_handle; |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 422 | |
| 423 | /* QDF device handle */ |
| 424 | qdf_device_t qdf_dev; |
| 425 | |
| 426 | /* Device base address */ |
| 427 | void *dev_base_addr; |
| 428 | |
| 429 | /* HAL internal state for all SRNG rings. |
| 430 | * TODO: See if this is required |
| 431 | */ |
| 432 | struct hal_srng srng_list[HAL_SRNG_ID_MAX]; |
| 433 | |
| 434 | /* Remote pointer memory for HW/FW updates */ |
| 435 | uint32_t *shadow_rdptr_mem_vaddr; |
| 436 | qdf_dma_addr_t shadow_rdptr_mem_paddr; |
| 437 | |
| 438 | /* Shared memory for ring pointer updates from host to FW */ |
| 439 | uint32_t *shadow_wrptr_mem_vaddr; |
| 440 | qdf_dma_addr_t shadow_wrptr_mem_paddr; |
Manoj Ekbote | 4f0c6b1 | 2016-10-30 16:01:38 -0700 | [diff] [blame] | 441 | |
| 442 | /* REO blocking resource index */ |
| 443 | uint8_t reo_res_bitmap; |
| 444 | uint8_t index; |
Balamurugan Mahalingam | d015964 | 2018-07-11 15:02:29 +0530 | [diff] [blame] | 445 | uint32_t target_type; |
Houston Hoffman | 5141f9d | 2017-01-05 10:49:17 -0800 | [diff] [blame] | 446 | |
| 447 | /* shadow register configuration */ |
| 448 | struct pld_shadow_reg_v2_cfg shadow_config[MAX_SHADOW_REGISTERS]; |
| 449 | int num_shadow_registers_configured; |
Houston Hoffman | 61dad49 | 2017-04-07 17:09:34 -0700 | [diff] [blame] | 450 | bool use_register_windowing; |
| 451 | uint32_t register_window; |
| 452 | qdf_spinlock_t register_access_lock; |
Balamurugan Mahalingam | d015964 | 2018-07-11 15:02:29 +0530 | [diff] [blame] | 453 | |
| 454 | /* srng table */ |
| 455 | struct hal_hw_srng_config *hw_srng_table; |
| 456 | int32_t *hal_hw_reg_offset; |
| 457 | struct hal_hw_txrx_ops *ops; |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 458 | }; |
Balamurugan Mahalingam | 96d2d41 | 2018-07-10 10:11:58 +0530 | [diff] [blame] | 459 | |
| 460 | void hal_qca6390_attach(struct hal_soc *hal_soc); |
| 461 | void hal_qca6290_attach(struct hal_soc *hal_soc); |
| 462 | void hal_qca8074_attach(struct hal_soc *hal_soc); |
Akshay Kosigi | 6a20675 | 2019-06-10 23:14:52 +0530 | [diff] [blame] | 463 | |
Akshay Kosigi | 0bca9fb | 2019-06-27 15:26:13 +0530 | [diff] [blame] | 464 | /* |
| 465 | * hal_soc_to_dp_hal_roc - API to convert hal_soc to opaque |
| 466 | * dp_hal_soc handle type |
| 467 | * @hal_soc - hal_soc type |
| 468 | * |
| 469 | * Return: hal_soc_handle_t type |
| 470 | */ |
Akshay Kosigi | 6a20675 | 2019-06-10 23:14:52 +0530 | [diff] [blame] | 471 | static inline |
| 472 | hal_soc_handle_t hal_soc_to_hal_soc_handle(struct hal_soc *hal_soc) |
| 473 | { |
| 474 | return (hal_soc_handle_t)hal_soc; |
| 475 | } |
Akshay Kosigi | 0bca9fb | 2019-06-27 15:26:13 +0530 | [diff] [blame] | 476 | |
| 477 | /* |
| 478 | * hal_srng_to_hal_ring_handle - API to convert hal_srng to opaque |
| 479 | * dp_hal_ring handle type |
| 480 | * @hal_srng - hal_srng type |
| 481 | * |
| 482 | * Return: hal_ring_handle_t type |
| 483 | */ |
| 484 | static inline |
| 485 | hal_ring_handle_t hal_srng_to_hal_ring_handle(struct hal_srng *hal_srng) |
| 486 | { |
| 487 | return (hal_ring_handle_t)hal_srng; |
| 488 | } |
Akshay Kosigi | 8eda31c | 2019-07-10 14:42:42 +0530 | [diff] [blame] | 489 | |
| 490 | /* |
| 491 | * hal_ring_handle_to_hal_srng - API to convert dp_hal_ring to hal_srng handle |
| 492 | * @hal_ring - hal_ring_handle_t type |
| 493 | * |
| 494 | * Return: hal_srng pointer type |
| 495 | */ |
| 496 | static inline |
| 497 | struct hal_srng *hal_ring_handle_to_hal_srng(hal_ring_handle_t hal_ring) |
| 498 | { |
| 499 | return (struct hal_srng *)hal_ring; |
| 500 | } |
Karunakar Dasineni | 8fbfeea | 2016-08-31 14:43:27 -0700 | [diff] [blame] | 501 | #endif /* _HAL_INTERNAL_H_ */ |