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