Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 1 | /* |
Houston Hoffman | ebc6814 | 2016-01-18 15:38:27 -0800 | [diff] [blame] | 2 | * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | #ifndef _HIF_H_ |
| 29 | #define _HIF_H_ |
| 30 | |
| 31 | #ifdef __cplusplus |
| 32 | extern "C" { |
| 33 | #endif /* __cplusplus */ |
| 34 | |
| 35 | /* Header files */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 36 | #include <qdf_status.h> |
| 37 | #include "qdf_nbuf.h" |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 38 | #include "ol_if_athvar.h" |
| 39 | #include <linux/platform_device.h> |
| 40 | #ifdef HIF_PCI |
| 41 | #include <linux/pci.h> |
| 42 | #endif /* HIF_PCI */ |
| 43 | |
| 44 | #define ENABLE_MBOX_DUMMY_SPACE_FEATURE 1 |
| 45 | |
| 46 | typedef struct htc_callbacks HTC_CALLBACKS; |
| 47 | typedef void __iomem *A_target_id_t; |
Komal Seelam | 6ee5590 | 2016-04-11 17:11:07 +0530 | [diff] [blame] | 48 | typedef void *hif_handle_t; |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 49 | |
| 50 | #define HIF_TYPE_AR6002 2 |
| 51 | #define HIF_TYPE_AR6003 3 |
| 52 | #define HIF_TYPE_AR6004 5 |
| 53 | #define HIF_TYPE_AR9888 6 |
| 54 | #define HIF_TYPE_AR6320 7 |
| 55 | #define HIF_TYPE_AR6320V2 8 |
| 56 | /* For attaching Peregrine 2.0 board host_reg_tbl only */ |
Houston Hoffman | c3c6bc1 | 2016-05-06 17:08:39 -0700 | [diff] [blame] | 57 | #define HIF_TYPE_AR9888V2 9 |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 58 | #define HIF_TYPE_ADRASTEA 10 |
Houston Hoffman | 56e0d70 | 2016-05-05 17:48:06 -0700 | [diff] [blame] | 59 | #define HIF_TYPE_AR900B 11 |
| 60 | #define HIF_TYPE_QCA9984 12 |
| 61 | #define HIF_TYPE_IPQ4019 13 |
| 62 | #define HIF_TYPE_QCA9888 14 |
| 63 | |
Govind Singh | 051a8c4 | 2016-05-10 12:23:41 +0530 | [diff] [blame^] | 64 | /* TARGET definition needs to be abstracted in fw common |
| 65 | * header files, below is the placeholder till WIN codebase |
| 66 | * moved to latest copy of fw common header files. |
| 67 | */ |
| 68 | #ifdef CONFIG_WIN |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 69 | #define TARGET_TYPE_UNKNOWN 0 |
| 70 | #define TARGET_TYPE_AR6001 1 |
| 71 | #define TARGET_TYPE_AR6002 2 |
| 72 | #define TARGET_TYPE_AR6003 3 |
| 73 | #define TARGET_TYPE_AR6004 5 |
| 74 | #define TARGET_TYPE_AR6006 6 |
| 75 | #define TARGET_TYPE_AR9888 7 |
| 76 | #define TARGET_TYPE_AR6320 8 |
| 77 | #define TARGET_TYPE_AR900B 9 |
Houston Hoffman | fb698ef | 2016-05-05 19:50:44 -0700 | [diff] [blame] | 78 | #define TARGET_TYPE_QCA9984 10 |
| 79 | #define TARGET_TYPE_IPQ4019 11 |
| 80 | #define TARGET_TYPE_QCA9888 12 |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 81 | /* For attach Peregrine 2.0 board target_reg_tbl only */ |
Houston Hoffman | c3c6bc1 | 2016-05-06 17:08:39 -0700 | [diff] [blame] | 82 | #define TARGET_TYPE_AR9888V2 13 |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 83 | /* For attach Rome1.0 target_reg_tbl only*/ |
Houston Hoffman | c3c6bc1 | 2016-05-06 17:08:39 -0700 | [diff] [blame] | 84 | #define TARGET_TYPE_AR6320V1 14 |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 85 | /* For Rome2.0/2.1 target_reg_tbl ID*/ |
Houston Hoffman | c3c6bc1 | 2016-05-06 17:08:39 -0700 | [diff] [blame] | 86 | #define TARGET_TYPE_AR6320V2 15 |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 87 | /* For Rome3.0 target_reg_tbl ID*/ |
Houston Hoffman | c3c6bc1 | 2016-05-06 17:08:39 -0700 | [diff] [blame] | 88 | #define TARGET_TYPE_AR6320V3 16 |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 89 | /* For Tufello1.0 target_reg_tbl ID*/ |
Houston Hoffman | c3c6bc1 | 2016-05-06 17:08:39 -0700 | [diff] [blame] | 90 | #define TARGET_TYPE_QCA9377V1 17 |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 91 | /* For Adrastea target */ |
Houston Hoffman | c3c6bc1 | 2016-05-06 17:08:39 -0700 | [diff] [blame] | 92 | #define TARGET_TYPE_ADRASTEA 19 |
Govind Singh | 051a8c4 | 2016-05-10 12:23:41 +0530 | [diff] [blame^] | 93 | #endif |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 94 | |
| 95 | struct CE_state; |
Sanjay Devnani | 9ce1577 | 2015-11-12 14:08:57 -0800 | [diff] [blame] | 96 | #define CE_COUNT_MAX 12 |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 97 | |
Prakash Manjunathappa | 82b8996 | 2016-05-05 18:54:23 -0700 | [diff] [blame] | 98 | #ifdef CONFIG_SLUB_DEBUG_ON |
| 99 | #define QCA_NAPI_BUDGET 64 |
| 100 | #define QCA_NAPI_DEF_SCALE 2 |
| 101 | #else /* PERF build */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 102 | #define QCA_NAPI_BUDGET 64 |
| 103 | #define QCA_NAPI_DEF_SCALE 16 |
Prakash Manjunathappa | 82b8996 | 2016-05-05 18:54:23 -0700 | [diff] [blame] | 104 | #endif /* SLUB_DEBUG_ON */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 105 | #define HIF_NAPI_MAX_RECEIVES (QCA_NAPI_BUDGET * QCA_NAPI_DEF_SCALE) |
| 106 | |
| 107 | /* NOTE: "napi->scale" can be changed, |
| 108 | but this does not change the number of buckets */ |
| 109 | #define QCA_NAPI_NUM_BUCKETS (QCA_NAPI_BUDGET / QCA_NAPI_DEF_SCALE) |
| 110 | struct qca_napi_stat { |
| 111 | uint32_t napi_schedules; |
| 112 | uint32_t napi_polls; |
| 113 | uint32_t napi_completes; |
| 114 | uint32_t napi_workdone; |
| 115 | uint32_t napi_budget_uses[QCA_NAPI_NUM_BUCKETS]; |
| 116 | }; |
| 117 | |
| 118 | /** |
| 119 | * per NAPI instance data structure |
| 120 | * This data structure holds stuff per NAPI instance. |
| 121 | * Note that, in the current implementation, though scale is |
| 122 | * an instance variable, it is set to the same value for all |
| 123 | * instances. |
| 124 | */ |
| 125 | struct qca_napi_info { |
Houston Hoffman | c7d5429 | 2016-04-13 18:55:37 -0700 | [diff] [blame] | 126 | struct net_device netdev; /* dummy net_dev */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 127 | struct napi_struct napi; /* one NAPI Instance per CE in phase I */ |
| 128 | uint8_t scale; /* currently same on all instances */ |
| 129 | uint8_t id; |
| 130 | struct qca_napi_stat stats[NR_CPUS]; |
| 131 | }; |
| 132 | |
| 133 | /** |
| 134 | * NAPI data-sructure common to all NAPI instances. |
| 135 | * |
| 136 | * A variable of this type will be stored in hif module context. |
| 137 | */ |
| 138 | |
| 139 | struct qca_napi_data { |
| 140 | /* NOTE: make sure the mutex is inited only at the very beginning |
| 141 | once for the lifetime of the driver. For now, granularity of one |
| 142 | is OK, but we might want to have a better granularity later */ |
| 143 | struct mutex mutex; |
| 144 | uint32_t state; |
| 145 | uint32_t ce_map; /* bitmap of created/registered NAPI |
| 146 | instances, indexed by pipe_id, |
| 147 | not used by clients (clients use an |
| 148 | id returned by create) */ |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 149 | struct qca_napi_info napis[CE_COUNT_MAX]; |
| 150 | }; |
| 151 | |
Komal Seelam | 91553ce | 2016-01-27 18:57:10 +0530 | [diff] [blame] | 152 | /** |
Komal Seelam | a5911d3 | 2016-02-24 19:21:59 +0530 | [diff] [blame] | 153 | * struct hif_config_info - Place Holder for hif confiruation |
Komal Seelam | 91553ce | 2016-01-27 18:57:10 +0530 | [diff] [blame] | 154 | * @enable_self_recovery: Self Recovery |
Komal Seelam | 91553ce | 2016-01-27 18:57:10 +0530 | [diff] [blame] | 155 | * |
Komal Seelam | a5911d3 | 2016-02-24 19:21:59 +0530 | [diff] [blame] | 156 | * Structure for holding hif ini parameters. |
Komal Seelam | 91553ce | 2016-01-27 18:57:10 +0530 | [diff] [blame] | 157 | */ |
| 158 | struct hif_config_info { |
Komal Seelam | 91553ce | 2016-01-27 18:57:10 +0530 | [diff] [blame] | 159 | bool enable_self_recovery; |
Houston Hoffman | b21a053 | 2016-03-14 21:12:12 -0700 | [diff] [blame] | 160 | #ifdef FEATURE_RUNTIME_PM |
| 161 | bool enable_runtime_pm; |
| 162 | u_int32_t runtime_pm_delay; |
| 163 | #endif |
Komal Seelam | 91553ce | 2016-01-27 18:57:10 +0530 | [diff] [blame] | 164 | }; |
| 165 | |
| 166 | /** |
| 167 | * struct hif_target_info - Target Information |
| 168 | * @target_version: Target Version |
| 169 | * @target_type: Target Type |
| 170 | * @target_revision: Target Revision |
| 171 | * @soc_version: SOC Version |
| 172 | * |
| 173 | * Structure to hold target information. |
| 174 | */ |
| 175 | struct hif_target_info { |
| 176 | uint32_t target_version; |
| 177 | uint32_t target_type; |
| 178 | uint32_t target_revision; |
| 179 | uint32_t soc_version; |
| 180 | }; |
| 181 | |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 182 | struct hif_opaque_softc { |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 183 | }; |
| 184 | |
| 185 | typedef enum { |
| 186 | HIF_DEVICE_POWER_UP, /* HIF layer should power up interface |
| 187 | * and/or module */ |
| 188 | HIF_DEVICE_POWER_DOWN, /* HIF layer should initiate bus-specific |
| 189 | * measures to minimize power */ |
| 190 | HIF_DEVICE_POWER_CUT /* HIF layer should initiate bus-specific |
| 191 | * AND/OR platform-specific measures |
| 192 | * to completely power-off the module and |
| 193 | * associated hardware (i.e. cut power |
| 194 | * supplies) */ |
| 195 | } HIF_DEVICE_POWER_CHANGE_TYPE; |
| 196 | |
| 197 | /** |
| 198 | * enum hif_enable_type: what triggered the enabling of hif |
| 199 | * |
| 200 | * @HIF_ENABLE_TYPE_PROBE: probe triggered enable |
| 201 | * @HIF_ENABLE_TYPE_REINIT: reinit triggered enable |
| 202 | */ |
| 203 | enum hif_enable_type { |
| 204 | HIF_ENABLE_TYPE_PROBE, |
| 205 | HIF_ENABLE_TYPE_REINIT, |
| 206 | HIF_ENABLE_TYPE_MAX |
| 207 | }; |
| 208 | |
| 209 | /** |
| 210 | * enum hif_disable_type: what triggered the disabling of hif |
| 211 | * |
| 212 | * @HIF_DISABLE_TYPE_PROBE_ERROR: probe error triggered disable |
| 213 | * @HIF_DISABLE_TYPE_REINIT_ERROR: reinit error triggered |
| 214 | * disable |
| 215 | * @HIF_DISABLE_TYPE_REMOVE: remove triggered disable |
| 216 | * @HIF_DISABLE_TYPE_SHUTDOWN: shutdown triggered disable |
| 217 | */ |
| 218 | enum hif_disable_type { |
| 219 | HIF_DISABLE_TYPE_PROBE_ERROR, |
| 220 | HIF_DISABLE_TYPE_REINIT_ERROR, |
| 221 | HIF_DISABLE_TYPE_REMOVE, |
| 222 | HIF_DISABLE_TYPE_SHUTDOWN, |
| 223 | HIF_DISABLE_TYPE_MAX |
| 224 | }; |
Govind Singh | 4cc8213 | 2016-05-12 20:02:01 +0530 | [diff] [blame] | 225 | /** |
| 226 | * enum hif_device_config_opcode: configure mode |
| 227 | * |
| 228 | * @HIF_DEVICE_POWER_STATE: device power state |
| 229 | * @HIF_DEVICE_GET_MBOX_BLOCK_SIZE: get mbox block size |
| 230 | * @HIF_DEVICE_GET_MBOX_ADDR: get mbox block address |
| 231 | * @HIF_DEVICE_GET_PENDING_EVENTS_FUNC: get pending events functions |
| 232 | * @HIF_DEVICE_GET_IRQ_PROC_MODE: get irq proc mode |
| 233 | * @HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC: receive event function |
| 234 | * @HIF_DEVICE_POWER_STATE_CHANGE: change power state |
| 235 | * @HIF_DEVICE_GET_IRQ_YIELD_PARAMS: get yield params |
| 236 | * @HIF_CONFIGURE_QUERY_SCATTER_REQUEST_SUPPORT: configure scatter request |
| 237 | * @HIF_DEVICE_GET_OS_DEVICE: get OS device |
| 238 | * @HIF_DEVICE_DEBUG_BUS_STATE: debug bus state |
| 239 | * @HIF_BMI_DONE: bmi done |
| 240 | * @HIF_DEVICE_SET_TARGET_TYPE: set target type |
| 241 | * @HIF_DEVICE_SET_HTC_CONTEXT: set htc context |
| 242 | * @HIF_DEVICE_GET_HTC_CONTEXT: get htc context |
| 243 | */ |
| 244 | enum hif_device_config_opcode { |
| 245 | HIF_DEVICE_POWER_STATE = 0, |
| 246 | HIF_DEVICE_GET_MBOX_BLOCK_SIZE, |
| 247 | HIF_DEVICE_GET_MBOX_ADDR, |
| 248 | HIF_DEVICE_GET_PENDING_EVENTS_FUNC, |
| 249 | HIF_DEVICE_GET_IRQ_PROC_MODE, |
| 250 | HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC, |
| 251 | HIF_DEVICE_POWER_STATE_CHANGE, |
| 252 | HIF_DEVICE_GET_IRQ_YIELD_PARAMS, |
| 253 | HIF_CONFIGURE_QUERY_SCATTER_REQUEST_SUPPORT, |
| 254 | HIF_DEVICE_GET_OS_DEVICE, |
| 255 | HIF_DEVICE_DEBUG_BUS_STATE, |
| 256 | HIF_BMI_DONE, |
| 257 | HIF_DEVICE_SET_TARGET_TYPE, |
| 258 | HIF_DEVICE_SET_HTC_CONTEXT, |
| 259 | HIF_DEVICE_GET_HTC_CONTEXT, |
| 260 | }; |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 261 | |
| 262 | #ifdef CONFIG_ATH_PCIE_ACCESS_DEBUG |
| 263 | typedef struct _HID_ACCESS_LOG { |
| 264 | uint32_t seqnum; |
| 265 | bool is_write; |
| 266 | void *addr; |
| 267 | uint32_t value; |
| 268 | } HIF_ACCESS_LOG; |
| 269 | #endif |
| 270 | |
Houston Hoffman | 56e0d70 | 2016-05-05 17:48:06 -0700 | [diff] [blame] | 271 | void hif_reg_write(struct hif_opaque_softc *hif_ctx, uint32_t offset, |
| 272 | uint32_t value); |
| 273 | uint32_t hif_reg_read(struct hif_opaque_softc *hif_ctx, uint32_t offset); |
| 274 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 275 | #define HIF_MAX_DEVICES 1 |
| 276 | |
| 277 | struct htc_callbacks { |
| 278 | void *context; /* context to pass to the dsrhandler |
| 279 | * note : rwCompletionHandler is provided |
| 280 | * the context passed to hif_read_write */ |
Govind Singh | 4cc8213 | 2016-05-12 20:02:01 +0530 | [diff] [blame] | 281 | QDF_STATUS(*rwCompletionHandler)(void *rwContext, QDF_STATUS status); |
| 282 | QDF_STATUS(*dsrHandler)(void *context); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 283 | }; |
| 284 | |
Komal Seelam | 7508012 | 2016-03-02 15:18:25 +0530 | [diff] [blame] | 285 | /** |
| 286 | * struct hif_driver_state_callbacks - Callbacks for HIF to query Driver state |
| 287 | * @context: Private data context |
| 288 | * @set_recovery_in_progress: To Set Driver state for recovery in progress |
| 289 | * @is_recovery_in_progress: Query if driver state is recovery in progress |
| 290 | * @is_load_unload_in_progress: Query if driver state Load/Unload in Progress |
| 291 | * @is_driver_unloading: Query if driver is unloading. |
| 292 | * |
| 293 | * This Structure provides callback pointer for HIF to query hdd for driver |
| 294 | * states. |
| 295 | */ |
| 296 | struct hif_driver_state_callbacks { |
Komal Seelam | bd7c51d | 2016-02-24 10:27:30 +0530 | [diff] [blame] | 297 | void *context; |
| 298 | void (*set_recovery_in_progress)(void *context, uint8_t val); |
Komal Seelam | bd7c51d | 2016-02-24 10:27:30 +0530 | [diff] [blame] | 299 | bool (*is_recovery_in_progress)(void *context); |
| 300 | bool (*is_load_unload_in_progress)(void *context); |
| 301 | bool (*is_driver_unloading)(void *context); |
| 302 | }; |
| 303 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 304 | /* This API detaches the HTC layer from the HIF device */ |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 305 | void hif_detach_htc(struct hif_opaque_softc *scn); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 306 | |
| 307 | /****************************************************************/ |
| 308 | /* BMI and Diag window abstraction */ |
| 309 | /****************************************************************/ |
| 310 | |
| 311 | #define HIF_BMI_EXCHANGE_NO_TIMEOUT ((uint32_t)(0)) |
| 312 | |
| 313 | #define DIAG_TRANSFER_LIMIT 2048U /* maximum number of bytes that can be |
| 314 | * handled atomically by |
| 315 | * DiagRead/DiagWrite */ |
| 316 | |
| 317 | /* |
| 318 | * API to handle HIF-specific BMI message exchanges, this API is synchronous |
| 319 | * and only allowed to be called from a context that can block (sleep) */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 320 | QDF_STATUS hif_exchange_bmi_msg(struct hif_opaque_softc *scn, |
| 321 | qdf_dma_addr_t cmd, qdf_dma_addr_t rsp, |
Komal Seelam | 2a5fa63 | 2016-02-15 10:33:44 +0530 | [diff] [blame] | 322 | uint8_t *pSendMessage, uint32_t Length, |
| 323 | uint8_t *pResponseMessage, |
| 324 | uint32_t *pResponseLength, uint32_t TimeoutMS); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 325 | |
| 326 | /* |
| 327 | * APIs to handle HIF specific diagnostic read accesses. These APIs are |
| 328 | * synchronous and only allowed to be called from a context that |
| 329 | * can block (sleep). They are not high performance APIs. |
| 330 | * |
| 331 | * hif_diag_read_access reads a 4 Byte aligned/length value from a |
| 332 | * Target register or memory word. |
| 333 | * |
| 334 | * hif_diag_read_mem reads an arbitrary length of arbitrarily aligned memory. |
| 335 | */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 336 | QDF_STATUS hif_diag_read_access(struct hif_opaque_softc *scn, uint32_t address, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 337 | uint32_t *data); |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 338 | QDF_STATUS hif_diag_read_mem(struct hif_opaque_softc *scn, uint32_t address, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 339 | uint8_t *data, int nbytes); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 340 | void hif_dump_target_memory(struct hif_opaque_softc *scn, void *ramdump_base, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 341 | uint32_t address, uint32_t size); |
| 342 | /* |
| 343 | * APIs to handle HIF specific diagnostic write accesses. These APIs are |
| 344 | * synchronous and only allowed to be called from a context that |
| 345 | * can block (sleep). |
| 346 | * They are not high performance APIs. |
| 347 | * |
| 348 | * hif_diag_write_access writes a 4 Byte aligned/length value to a |
| 349 | * Target register or memory word. |
| 350 | * |
| 351 | * hif_diag_write_mem writes an arbitrary length of arbitrarily aligned memory. |
| 352 | */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 353 | QDF_STATUS hif_diag_write_access(struct hif_opaque_softc *scn, uint32_t address, |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 354 | uint32_t data); |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 355 | QDF_STATUS hif_diag_write_mem(struct hif_opaque_softc *scn, uint32_t address, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 356 | uint8_t *data, int nbytes); |
| 357 | |
Manjunathappa Prakash | 4a9c3a8 | 2016-04-14 01:12:14 -0700 | [diff] [blame] | 358 | typedef void (*fastpath_msg_handler)(void *, qdf_nbuf_t *, uint32_t); |
| 359 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 360 | /* |
| 361 | * Set the FASTPATH_mode_on flag in sc, for use by data path |
| 362 | */ |
| 363 | #ifdef WLAN_FEATURE_FASTPATH |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 364 | void hif_enable_fastpath(struct hif_opaque_softc *hif_ctx); |
| 365 | bool hif_is_fastpath_mode_enabled(struct hif_opaque_softc *hif_ctx); |
| 366 | void *hif_get_ce_handle(struct hif_opaque_softc *hif_ctx, int); |
Houston Hoffman | 127467f | 2016-04-26 22:37:14 -0700 | [diff] [blame] | 367 | int hif_ce_fastpath_cb_register(struct hif_opaque_softc *hif_ctx, |
| 368 | fastpath_msg_handler handler, void *context); |
Manjunathappa Prakash | 4a9c3a8 | 2016-04-14 01:12:14 -0700 | [diff] [blame] | 369 | #else |
Houston Hoffman | 127467f | 2016-04-26 22:37:14 -0700 | [diff] [blame] | 370 | static inline int hif_ce_fastpath_cb_register(struct hif_opaque_softc *hif_ctx, |
| 371 | fastpath_msg_handler handler, |
Manjunathappa Prakash | 4a9c3a8 | 2016-04-14 01:12:14 -0700 | [diff] [blame] | 372 | void *context) |
| 373 | { |
| 374 | return QDF_STATUS_E_FAILURE; |
| 375 | } |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 376 | #endif |
| 377 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 378 | /* |
| 379 | * Enable/disable CDC max performance workaround |
| 380 | * For max-performace set this to 0 |
| 381 | * To allow SoC to enter sleep set this to 1 |
| 382 | */ |
| 383 | #define CONFIG_DISABLE_CDC_MAX_PERF_WAR 0 |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 384 | |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 385 | void hif_ipa_get_ce_resource(struct hif_opaque_softc *scn, |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 386 | qdf_dma_addr_t *ce_sr_base_paddr, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 387 | uint32_t *ce_sr_ring_size, |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 388 | qdf_dma_addr_t *ce_reg_paddr); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 389 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 390 | /** |
| 391 | * @brief List of callbacks - filled in by HTC. |
| 392 | */ |
| 393 | struct hif_msg_callbacks { |
| 394 | void *Context; |
| 395 | /**< context meaningful to HTC */ |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 396 | QDF_STATUS (*txCompletionHandler)(void *Context, qdf_nbuf_t wbuf, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 397 | uint32_t transferID, |
| 398 | uint32_t toeplitz_hash_result); |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 399 | QDF_STATUS (*rxCompletionHandler)(void *Context, qdf_nbuf_t wbuf, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 400 | uint8_t pipeID); |
| 401 | void (*txResourceAvailHandler)(void *context, uint8_t pipe); |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 402 | void (*fwEventHandler)(void *context, QDF_STATUS status); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 403 | }; |
| 404 | |
Komal Seelam | 6ee5590 | 2016-04-11 17:11:07 +0530 | [diff] [blame] | 405 | enum hif_target_status { |
| 406 | TARGET_STATUS_CONNECTED = 0, /* target connected */ |
| 407 | TARGET_STATUS_RESET, /* target got reset */ |
| 408 | TARGET_STATUS_EJECT, /* target got ejected */ |
| 409 | TARGET_STATUS_SUSPEND /*target got suspend */ |
| 410 | }; |
| 411 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 412 | #define HIF_DATA_ATTR_SET_TX_CLASSIFY(attr, v) \ |
| 413 | (attr |= (v & 0x01) << 5) |
| 414 | #define HIF_DATA_ATTR_SET_ENCAPSULATION_TYPE(attr, v) \ |
| 415 | (attr |= (v & 0x03) << 6) |
| 416 | #define HIF_DATA_ATTR_SET_ADDR_X_SEARCH_DISABLE(attr, v) \ |
| 417 | (attr |= (v & 0x01) << 13) |
| 418 | #define HIF_DATA_ATTR_SET_ADDR_Y_SEARCH_DISABLE(attr, v) \ |
| 419 | (attr |= (v & 0x01) << 14) |
| 420 | #define HIF_DATA_ATTR_SET_TOEPLITZ_HASH_ENABLE(attr, v) \ |
| 421 | (attr |= (v & 0x01) << 15) |
| 422 | #define HIF_DATA_ATTR_SET_PACKET_OR_RESULT_OFFSET(attr, v) \ |
| 423 | (attr |= (v & 0x0FFF) << 16) |
| 424 | #define HIF_DATA_ATTR_SET_ENABLE_11H(attr, v) \ |
| 425 | (attr |= (v & 0x01) << 30) |
| 426 | |
Houston Hoffman | 8592507 | 2016-05-06 17:02:18 -0700 | [diff] [blame] | 427 | struct hif_ul_pipe_info { |
| 428 | unsigned int nentries; |
| 429 | unsigned int nentries_mask; |
| 430 | unsigned int sw_index; |
| 431 | unsigned int write_index; /* cached copy */ |
| 432 | unsigned int hw_index; /* cached copy */ |
| 433 | void *base_addr_owner_space; /* Host address space */ |
| 434 | qdf_dma_addr_t base_addr_CE_space; /* CE address space */ |
| 435 | }; |
| 436 | |
| 437 | struct hif_dl_pipe_info { |
| 438 | unsigned int nentries; |
| 439 | unsigned int nentries_mask; |
| 440 | unsigned int sw_index; |
| 441 | unsigned int write_index; /* cached copy */ |
| 442 | unsigned int hw_index; /* cached copy */ |
| 443 | void *base_addr_owner_space; /* Host address space */ |
| 444 | qdf_dma_addr_t base_addr_CE_space; /* CE address space */ |
| 445 | }; |
| 446 | |
| 447 | struct hif_pipe_addl_info { |
| 448 | uint32_t pci_mem; |
| 449 | uint32_t ctrl_addr; |
| 450 | struct hif_ul_pipe_info ul_pipe; |
| 451 | struct hif_dl_pipe_info dl_pipe; |
| 452 | }; |
| 453 | |
Houston Hoffman | f303f91 | 2016-03-14 21:11:42 -0700 | [diff] [blame] | 454 | struct hif_bus_id; |
| 455 | typedef struct hif_bus_id hif_bus_id; |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 456 | |
Govind Singh | 4cc8213 | 2016-05-12 20:02:01 +0530 | [diff] [blame] | 457 | void hif_claim_device(struct hif_opaque_softc *hif_ctx); |
| 458 | QDF_STATUS hif_get_config_item(struct hif_opaque_softc *hif_ctx, |
| 459 | int opcode, void *config, uint32_t config_len); |
| 460 | void hif_set_mailbox_swap(struct hif_opaque_softc *hif_ctx); |
| 461 | void hif_mask_interrupt_call(struct hif_opaque_softc *scn); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 462 | void hif_post_init(struct hif_opaque_softc *scn, void *hHTC, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 463 | struct hif_msg_callbacks *callbacks); |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 464 | QDF_STATUS hif_start(struct hif_opaque_softc *scn); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 465 | void hif_stop(struct hif_opaque_softc *scn); |
| 466 | void hif_flush_surprise_remove(struct hif_opaque_softc *scn); |
| 467 | void hif_dump(struct hif_opaque_softc *scn, uint8_t CmdId, bool start); |
Poddar, Siddarth | e41943f | 2016-04-27 15:33:48 +0530 | [diff] [blame] | 468 | void hif_trigger_dump(struct hif_opaque_softc *hif_ctx, |
| 469 | uint8_t cmd_id, bool start); |
| 470 | |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 471 | QDF_STATUS hif_send_head(struct hif_opaque_softc *scn, uint8_t PipeID, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 472 | uint32_t transferID, uint32_t nbytes, |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 473 | qdf_nbuf_t wbuf, uint32_t data_attr); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 474 | void hif_send_complete_check(struct hif_opaque_softc *scn, uint8_t PipeID, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 475 | int force); |
Houston Hoffman | 56e0d70 | 2016-05-05 17:48:06 -0700 | [diff] [blame] | 476 | void hif_shut_down_device(struct hif_opaque_softc *scn); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 477 | void hif_get_default_pipe(struct hif_opaque_softc *scn, uint8_t *ULPipe, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 478 | uint8_t *DLPipe); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 479 | int hif_map_service_to_pipe(struct hif_opaque_softc *scn, uint16_t svc_id, |
Sanjay Devnani | c319c82 | 2015-11-06 16:44:28 -0800 | [diff] [blame] | 480 | uint8_t *ul_pipe, uint8_t *dl_pipe, int *ul_is_polled, |
| 481 | int *dl_is_polled); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 482 | uint16_t |
| 483 | hif_get_free_queue_number(struct hif_opaque_softc *scn, uint8_t PipeID); |
| 484 | void *hif_get_targetdef(struct hif_opaque_softc *scn); |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 485 | uint32_t hif_hia_item_address(uint32_t target_type, uint32_t item_offset); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 486 | void hif_set_target_sleep(struct hif_opaque_softc *scn, bool sleep_ok, |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 487 | bool wait_for_it); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 488 | int hif_check_fw_reg(struct hif_opaque_softc *scn); |
Yuanyuan Liu | a5f0a39 | 2016-05-09 11:39:48 -0700 | [diff] [blame] | 489 | #ifndef HIF_PCI |
Yuanyuan Liu | 4e3feeb | 2016-04-20 10:41:15 -0700 | [diff] [blame] | 490 | static inline int hif_check_soc_status(struct hif_opaque_softc *scn) |
| 491 | { |
| 492 | return 0; |
| 493 | } |
| 494 | #else |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 495 | int hif_check_soc_status(struct hif_opaque_softc *scn); |
Yuanyuan Liu | 4e3feeb | 2016-04-20 10:41:15 -0700 | [diff] [blame] | 496 | #endif |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 497 | void hif_get_hw_info(struct hif_opaque_softc *scn, u32 *version, u32 *revision, |
| 498 | const char **target_name); |
| 499 | void hif_disable_isr(struct hif_opaque_softc *scn); |
| 500 | void hif_reset_soc(struct hif_opaque_softc *scn); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 501 | void hif_save_htc_htt_config_endpoint(struct hif_opaque_softc *hif_ctx, |
Nirav Shah | d7f9159 | 2016-04-21 14:18:43 +0530 | [diff] [blame] | 502 | int htc_htt_tx_endpoint); |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 503 | struct hif_opaque_softc *hif_open(qdf_device_t qdf_ctx, uint32_t mode, |
| 504 | enum qdf_bus_type bus_type, |
Komal Seelam | 7508012 | 2016-03-02 15:18:25 +0530 | [diff] [blame] | 505 | struct hif_driver_state_callbacks *cbk); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 506 | void hif_close(struct hif_opaque_softc *hif_ctx); |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 507 | QDF_STATUS hif_enable(struct hif_opaque_softc *hif_ctx, struct device *dev, |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 508 | void *bdev, const hif_bus_id *bid, |
Chouhan, Anurag | fc06aa9 | 2016-03-03 19:05:05 +0530 | [diff] [blame] | 509 | enum qdf_bus_type bus_type, |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 510 | enum hif_enable_type type); |
| 511 | void hif_disable(struct hif_opaque_softc *hif_ctx, enum hif_disable_type type); |
Nirav Shah | b70bd73 | 2016-05-25 14:31:51 +0530 | [diff] [blame] | 512 | void hif_display_stats(struct hif_opaque_softc *hif_ctx); |
| 513 | void hif_clear_stats(struct hif_opaque_softc *hif_ctx); |
Houston Hoffman | 9078a15 | 2015-11-02 16:15:02 -0800 | [diff] [blame] | 514 | #ifdef FEATURE_RUNTIME_PM |
| 515 | struct hif_pm_runtime_lock; |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 516 | int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx); |
| 517 | void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx); |
| 518 | int hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx); |
Houston Hoffman | 9078a15 | 2015-11-02 16:15:02 -0800 | [diff] [blame] | 519 | struct hif_pm_runtime_lock *hif_runtime_lock_init(const char *name); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 520 | void hif_runtime_lock_deinit(struct hif_opaque_softc *hif_ctx, |
Komal Seelam | 644263d | 2016-02-22 20:45:49 +0530 | [diff] [blame] | 521 | struct hif_pm_runtime_lock *lock); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 522 | int hif_pm_runtime_prevent_suspend(struct hif_opaque_softc *ol_sc, |
Houston Hoffman | 9078a15 | 2015-11-02 16:15:02 -0800 | [diff] [blame] | 523 | struct hif_pm_runtime_lock *lock); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 524 | int hif_pm_runtime_allow_suspend(struct hif_opaque_softc *ol_sc, |
Houston Hoffman | 9078a15 | 2015-11-02 16:15:02 -0800 | [diff] [blame] | 525 | struct hif_pm_runtime_lock *lock); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 526 | int hif_pm_runtime_prevent_suspend_timeout(struct hif_opaque_softc *ol_sc, |
Houston Hoffman | 9078a15 | 2015-11-02 16:15:02 -0800 | [diff] [blame] | 527 | struct hif_pm_runtime_lock *lock, unsigned int delay); |
| 528 | #else |
| 529 | struct hif_pm_runtime_lock { |
| 530 | const char *name; |
| 531 | }; |
Houston Hoffman | f460785 | 2015-12-17 17:14:40 -0800 | [diff] [blame] | 532 | |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 533 | static inline void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx) |
Houston Hoffman | f460785 | 2015-12-17 17:14:40 -0800 | [diff] [blame] | 534 | {} |
| 535 | |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 536 | static inline int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx) |
Houston Hoffman | 9078a15 | 2015-11-02 16:15:02 -0800 | [diff] [blame] | 537 | { return 0; } |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 538 | static inline int hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx) |
Houston Hoffman | 9078a15 | 2015-11-02 16:15:02 -0800 | [diff] [blame] | 539 | { return 0; } |
| 540 | static inline struct hif_pm_runtime_lock *hif_runtime_lock_init( |
| 541 | const char *name) |
| 542 | { return NULL; } |
Komal Seelam | f860068 | 2016-02-02 18:17:13 +0530 | [diff] [blame] | 543 | static inline void |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 544 | hif_runtime_lock_deinit(struct hif_opaque_softc *hif_ctx, |
Komal Seelam | 644263d | 2016-02-22 20:45:49 +0530 | [diff] [blame] | 545 | struct hif_pm_runtime_lock *lock) {} |
Houston Hoffman | 9078a15 | 2015-11-02 16:15:02 -0800 | [diff] [blame] | 546 | |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 547 | static inline int hif_pm_runtime_prevent_suspend(struct hif_opaque_softc *ol_sc, |
Houston Hoffman | 9078a15 | 2015-11-02 16:15:02 -0800 | [diff] [blame] | 548 | struct hif_pm_runtime_lock *lock) |
| 549 | { return 0; } |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 550 | static inline int hif_pm_runtime_allow_suspend(struct hif_opaque_softc *ol_sc, |
Houston Hoffman | 9078a15 | 2015-11-02 16:15:02 -0800 | [diff] [blame] | 551 | struct hif_pm_runtime_lock *lock) |
| 552 | { return 0; } |
Komal Seelam | 644263d | 2016-02-22 20:45:49 +0530 | [diff] [blame] | 553 | static inline int |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 554 | hif_pm_runtime_prevent_suspend_timeout(struct hif_opaque_softc *ol_sc, |
Houston Hoffman | 9078a15 | 2015-11-02 16:15:02 -0800 | [diff] [blame] | 555 | struct hif_pm_runtime_lock *lock, unsigned int delay) |
| 556 | { return 0; } |
| 557 | #endif |
| 558 | |
Houston Hoffman | fb7d612 | 2016-03-14 21:11:46 -0700 | [diff] [blame] | 559 | void hif_enable_power_management(struct hif_opaque_softc *hif_ctx, |
| 560 | bool is_packet_log_enabled); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 561 | void hif_disable_power_management(struct hif_opaque_softc *hif_ctx); |
Houston Hoffman | 78467a8 | 2016-01-05 20:08:56 -0800 | [diff] [blame] | 562 | |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 563 | void hif_vote_link_down(struct hif_opaque_softc *); |
| 564 | void hif_vote_link_up(struct hif_opaque_softc *); |
| 565 | bool hif_can_suspend_link(struct hif_opaque_softc *); |
Houston Hoffman | 78467a8 | 2016-01-05 20:08:56 -0800 | [diff] [blame] | 566 | |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 567 | int hif_bus_resume(struct hif_opaque_softc *); |
| 568 | int hif_bus_suspend(struct hif_opaque_softc *); |
Houston Hoffman | 692cc05 | 2015-11-10 18:42:47 -0800 | [diff] [blame] | 569 | |
| 570 | #ifdef FEATURE_RUNTIME_PM |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 571 | int hif_pre_runtime_suspend(struct hif_opaque_softc *hif_ctx); |
| 572 | void hif_pre_runtime_resume(struct hif_opaque_softc *hif_ctx); |
| 573 | int hif_runtime_suspend(struct hif_opaque_softc *hif_ctx); |
| 574 | int hif_runtime_resume(struct hif_opaque_softc *hif_ctx); |
| 575 | void hif_process_runtime_suspend_success(struct hif_opaque_softc *); |
| 576 | void hif_process_runtime_suspend_failure(struct hif_opaque_softc *); |
| 577 | void hif_process_runtime_resume_success(struct hif_opaque_softc *); |
Houston Hoffman | 692cc05 | 2015-11-10 18:42:47 -0800 | [diff] [blame] | 578 | #endif |
| 579 | |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 580 | int hif_dump_registers(struct hif_opaque_softc *scn); |
| 581 | int ol_copy_ramdump(struct hif_opaque_softc *scn); |
| 582 | void hif_crash_shutdown(struct hif_opaque_softc *hif_ctx); |
| 583 | void hif_get_hw_info(struct hif_opaque_softc *scn, u32 *version, u32 *revision, |
Komal Seelam | 91553ce | 2016-01-27 18:57:10 +0530 | [diff] [blame] | 584 | const char **target_name); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 585 | void hif_lro_flush_cb_register(struct hif_opaque_softc *scn, |
Komal Seelam | c92a0cf | 2016-02-22 20:43:52 +0530 | [diff] [blame] | 586 | void (handler)(void *), void *data); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 587 | void hif_lro_flush_cb_deregister(struct hif_opaque_softc *scn); |
Houston Hoffman | 2635259 | 2016-03-14 21:11:43 -0700 | [diff] [blame] | 588 | bool hif_needs_bmi(struct hif_opaque_softc *scn); |
Houston Hoffman | 60a1eeb | 2016-03-14 21:11:44 -0700 | [diff] [blame] | 589 | enum qdf_bus_type hif_get_bus_type(struct hif_opaque_softc *hif_hdl); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 590 | struct hif_target_info *hif_get_target_info_handle(struct hif_opaque_softc * |
| 591 | scn); |
| 592 | struct hif_config_info *hif_get_ini_handle(struct hif_opaque_softc *scn); |
| 593 | struct ramdump_info *hif_get_ramdump_ctx(struct hif_opaque_softc *hif_ctx); |
Komal Seelam | 6ee5590 | 2016-04-11 17:11:07 +0530 | [diff] [blame] | 594 | enum hif_target_status hif_get_target_status(struct hif_opaque_softc *hif_ctx); |
| 595 | void hif_set_target_status(struct hif_opaque_softc *hif_ctx, enum |
| 596 | hif_target_status); |
Komal Seelam | 5584a7c | 2016-02-24 19:22:48 +0530 | [diff] [blame] | 597 | void hif_init_ini_config(struct hif_opaque_softc *hif_ctx, |
| 598 | struct hif_config_info *cfg); |
Houston Hoffman | 56e0d70 | 2016-05-05 17:48:06 -0700 | [diff] [blame] | 599 | void hif_update_tx_ring(struct hif_opaque_softc *osc, u_int32_t num_htt_cmpls); |
| 600 | qdf_nbuf_t hif_batch_send(struct hif_opaque_softc *osc, qdf_nbuf_t msdu, |
| 601 | uint32_t transfer_id, u_int32_t len, uint32_t sendhead); |
| 602 | int hif_send_single(struct hif_opaque_softc *osc, qdf_nbuf_t msdu, uint32_t |
| 603 | transfer_id, u_int32_t len); |
Nirav Shah | da0881a | 2016-05-16 10:45:16 +0530 | [diff] [blame] | 604 | int hif_send_fast(struct hif_opaque_softc *osc, qdf_nbuf_t nbuf, |
| 605 | uint32_t transfer_id, uint32_t download_len); |
Houston Hoffman | 56e0d70 | 2016-05-05 17:48:06 -0700 | [diff] [blame] | 606 | void hif_pkt_dl_len_set(void *hif_sc, unsigned int pkt_download_len); |
Houston Hoffman | fb698ef | 2016-05-05 19:50:44 -0700 | [diff] [blame] | 607 | void hif_ce_war_disable(void); |
| 608 | void hif_ce_war_enable(void); |
Houston Hoffman | 8592507 | 2016-05-06 17:02:18 -0700 | [diff] [blame] | 609 | void hif_disable_interrupt(struct hif_opaque_softc *osc, uint32_t pipe_num); |
| 610 | #ifdef QCA_NSS_WIFI_OFFLOAD_SUPPORT |
| 611 | struct hif_pipe_addl_info *hif_get_addl_pipe_info(struct hif_opaque_softc *osc, |
| 612 | struct hif_pipe_addl_info *hif_info, uint32_t pipe_number); |
| 613 | uint32_t hif_set_nss_wifiol_mode(struct hif_opaque_softc *osc, |
| 614 | uint32_t pipe_num); |
| 615 | int32_t hif_get_nss_wifiol_bypass_nw_process(struct hif_opaque_softc *osc); |
| 616 | #endif |
Houston Hoffman | fb698ef | 2016-05-05 19:50:44 -0700 | [diff] [blame] | 617 | |
Prakash Dhavali | d5c9f1c | 2015-11-08 19:04:44 -0800 | [diff] [blame] | 618 | #ifdef __cplusplus |
| 619 | } |
| 620 | #endif |
| 621 | #endif /* _HIF_H_ */ |