Skylar Chang | fda3a8e | 2018-01-29 10:54:56 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/ipa.h> |
| 14 | #include <linux/device.h> |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/mm.h> |
| 18 | #include <linux/module.h> |
| 19 | #include <linux/of.h> |
| 20 | #include <linux/platform_device.h> |
| 21 | #include <linux/ipa_uc_offload.h> |
| 22 | #include "ipa_api.h" |
| 23 | |
| 24 | #define DRV_NAME "ipa" |
| 25 | |
| 26 | #define IPA_API_DISPATCH_RETURN(api, p...) \ |
| 27 | do { \ |
| 28 | if (!ipa_api_ctrl) { \ |
Gidon Studinski | 3021a6f | 2016-11-10 12:48:48 +0200 | [diff] [blame] | 29 | pr_err("%s:%d IPA HW is not supported\n", \ |
| 30 | __func__, __LINE__); \ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 31 | ret = -EPERM; \ |
| 32 | } \ |
| 33 | else { \ |
| 34 | if (ipa_api_ctrl->api) { \ |
| 35 | ret = ipa_api_ctrl->api(p); \ |
| 36 | } else { \ |
| 37 | pr_err("%s not implemented for IPA ver %d\n", \ |
| 38 | __func__, ipa_api_hw_type); \ |
| 39 | WARN_ON(1); \ |
| 40 | ret = -EPERM; \ |
| 41 | } \ |
| 42 | } \ |
| 43 | } while (0) |
| 44 | |
| 45 | #define IPA_API_DISPATCH(api, p...) \ |
| 46 | do { \ |
| 47 | if (!ipa_api_ctrl) \ |
Gidon Studinski | 3021a6f | 2016-11-10 12:48:48 +0200 | [diff] [blame] | 48 | pr_err("%s:%d IPA HW is not supported\n", \ |
| 49 | __func__, __LINE__); \ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 50 | else { \ |
| 51 | if (ipa_api_ctrl->api) { \ |
| 52 | ipa_api_ctrl->api(p); \ |
| 53 | } else { \ |
| 54 | pr_err("%s not implemented for IPA ver %d\n", \ |
| 55 | __func__, ipa_api_hw_type); \ |
| 56 | WARN_ON(1); \ |
| 57 | } \ |
| 58 | } \ |
| 59 | } while (0) |
| 60 | |
| 61 | #define IPA_API_DISPATCH_RETURN_PTR(api, p...) \ |
| 62 | do { \ |
| 63 | if (!ipa_api_ctrl) { \ |
Gidon Studinski | 3021a6f | 2016-11-10 12:48:48 +0200 | [diff] [blame] | 64 | pr_err("%s:%d IPA HW is not supported\n", \ |
| 65 | __func__, __LINE__); \ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 66 | ret = NULL; \ |
| 67 | } \ |
| 68 | else { \ |
| 69 | if (ipa_api_ctrl->api) { \ |
| 70 | ret = ipa_api_ctrl->api(p); \ |
| 71 | } else { \ |
| 72 | pr_err("%s not implemented for IPA ver %d\n", \ |
| 73 | __func__, ipa_api_hw_type); \ |
| 74 | WARN_ON(1); \ |
| 75 | ret = NULL; \ |
| 76 | } \ |
| 77 | } \ |
| 78 | } while (0) |
| 79 | |
| 80 | #define IPA_API_DISPATCH_RETURN_BOOL(api, p...) \ |
| 81 | do { \ |
| 82 | if (!ipa_api_ctrl) { \ |
Gidon Studinski | 3021a6f | 2016-11-10 12:48:48 +0200 | [diff] [blame] | 83 | pr_err("%s:%d IPA HW is not supported\n", \ |
| 84 | __func__, __LINE__); \ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 85 | ret = false; \ |
| 86 | } \ |
| 87 | else { \ |
| 88 | if (ipa_api_ctrl->api) { \ |
| 89 | ret = ipa_api_ctrl->api(p); \ |
| 90 | } else { \ |
| 91 | pr_err("%s not implemented for IPA ver %d\n", \ |
| 92 | __func__, ipa_api_hw_type); \ |
| 93 | WARN_ON(1); \ |
| 94 | ret = false; \ |
| 95 | } \ |
| 96 | } \ |
| 97 | } while (0) |
| 98 | |
| 99 | static enum ipa_hw_type ipa_api_hw_type; |
| 100 | static struct ipa_api_controller *ipa_api_ctrl; |
| 101 | |
| 102 | const char *ipa_clients_strings[IPA_CLIENT_MAX] = { |
| 103 | __stringify(IPA_CLIENT_HSIC1_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 104 | __stringify(IPA_CLIENT_HSIC1_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 105 | __stringify(IPA_CLIENT_HSIC2_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 106 | __stringify(IPA_CLIENT_HSIC2_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 107 | __stringify(IPA_CLIENT_HSIC3_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 108 | __stringify(IPA_CLIENT_HSIC3_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 109 | __stringify(IPA_CLIENT_HSIC4_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 110 | __stringify(IPA_CLIENT_HSIC4_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 111 | __stringify(IPA_CLIENT_HSIC5_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 112 | __stringify(IPA_CLIENT_HSIC5_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 113 | __stringify(IPA_CLIENT_WLAN1_PROD), |
| 114 | __stringify(IPA_CLIENT_WLAN1_CONS), |
| 115 | __stringify(IPA_CLIENT_A5_WLAN_AMPDU_PROD), |
| 116 | __stringify(IPA_CLIENT_WLAN2_CONS), |
| 117 | __stringify(RESERVERD_PROD_14), |
| 118 | __stringify(IPA_CLIENT_WLAN3_CONS), |
| 119 | __stringify(RESERVERD_PROD_16), |
| 120 | __stringify(IPA_CLIENT_WLAN4_CONS), |
| 121 | __stringify(IPA_CLIENT_USB_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 122 | __stringify(IPA_CLIENT_USB_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 123 | __stringify(IPA_CLIENT_USB2_PROD), |
| 124 | __stringify(IPA_CLIENT_USB2_CONS), |
| 125 | __stringify(IPA_CLIENT_USB3_PROD), |
| 126 | __stringify(IPA_CLIENT_USB3_CONS), |
| 127 | __stringify(IPA_CLIENT_USB4_PROD), |
| 128 | __stringify(IPA_CLIENT_USB4_CONS), |
| 129 | __stringify(IPA_CLIENT_UC_USB_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 130 | __stringify(IPA_CLIENT_USB_DPL_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 131 | __stringify(IPA_CLIENT_A2_EMBEDDED_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 132 | __stringify(IPA_CLIENT_A2_EMBEDDED_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 133 | __stringify(IPA_CLIENT_A2_TETHERED_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 134 | __stringify(IPA_CLIENT_A2_TETHERED_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 135 | __stringify(IPA_CLIENT_APPS_LAN_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 136 | __stringify(IPA_CLIENT_APPS_LAN_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 137 | __stringify(IPA_CLIENT_APPS_WAN_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 138 | __stringify(IPA_CLIENT_APPS_WAN_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 139 | __stringify(IPA_CLIENT_APPS_CMD_PROD), |
| 140 | __stringify(IPA_CLIENT_A5_LAN_WAN_CONS), |
| 141 | __stringify(IPA_CLIENT_ODU_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 142 | __stringify(IPA_CLIENT_ODU_EMB_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 143 | __stringify(RESERVERD_PROD_40), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 144 | __stringify(IPA_CLIENT_ODU_TETH_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 145 | __stringify(IPA_CLIENT_MHI_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 146 | __stringify(IPA_CLIENT_MHI_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 147 | __stringify(IPA_CLIENT_MEMCPY_DMA_SYNC_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 148 | __stringify(IPA_CLIENT_MEMCPY_DMA_SYNC_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 149 | __stringify(IPA_CLIENT_MEMCPY_DMA_ASYNC_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 150 | __stringify(IPA_CLIENT_MEMCPY_DMA_ASYNC_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 151 | __stringify(IPA_CLIENT_ETHERNET_PROD), |
Michael Adisumarta | d309fa4 | 2017-04-27 10:26:07 -0700 | [diff] [blame] | 152 | __stringify(IPA_CLIENT_ETHERNET_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 153 | __stringify(IPA_CLIENT_Q6_LAN_PROD), |
| 154 | __stringify(IPA_CLIENT_Q6_LAN_CONS), |
| 155 | __stringify(IPA_CLIENT_Q6_WAN_PROD), |
| 156 | __stringify(IPA_CLIENT_Q6_WAN_CONS), |
| 157 | __stringify(IPA_CLIENT_Q6_CMD_PROD), |
| 158 | __stringify(IPA_CLIENT_Q6_DUN_CONS), |
| 159 | __stringify(IPA_CLIENT_Q6_DECOMP_PROD), |
| 160 | __stringify(IPA_CLIENT_Q6_DECOMP_CONS), |
| 161 | __stringify(IPA_CLIENT_Q6_DECOMP2_PROD), |
| 162 | __stringify(IPA_CLIENT_Q6_DECOMP2_CONS), |
| 163 | __stringify(RESERVERD_PROD_60), |
| 164 | __stringify(IPA_CLIENT_Q6_LTE_WIFI_AGGR_CONS), |
| 165 | __stringify(IPA_CLIENT_TEST_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 166 | __stringify(IPA_CLIENT_TEST_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 167 | __stringify(IPA_CLIENT_TEST1_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 168 | __stringify(IPA_CLIENT_TEST1_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 169 | __stringify(IPA_CLIENT_TEST2_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 170 | __stringify(IPA_CLIENT_TEST2_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 171 | __stringify(IPA_CLIENT_TEST3_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 172 | __stringify(IPA_CLIENT_TEST3_CONS), |
Skylar Chang | a951658 | 2017-05-09 11:36:47 -0700 | [diff] [blame] | 173 | __stringify(IPA_CLIENT_TEST4_PROD), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 174 | __stringify(IPA_CLIENT_TEST4_CONS), |
Skylar Chang | 7fa2271 | 2017-04-03 18:29:21 -0700 | [diff] [blame] | 175 | __stringify(IPA_CLIENT_DUMMY_CONS), |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 176 | }; |
| 177 | |
| 178 | /** |
| 179 | * ipa_write_64() - convert 64 bit value to byte array |
| 180 | * @w: 64 bit integer |
| 181 | * @dest: byte array |
| 182 | * |
| 183 | * Return value: converted value |
| 184 | */ |
| 185 | u8 *ipa_write_64(u64 w, u8 *dest) |
| 186 | { |
| 187 | if (unlikely(dest == NULL)) { |
| 188 | pr_err("ipa_write_64: NULL address!\n"); |
| 189 | return dest; |
| 190 | } |
| 191 | *dest++ = (u8)((w) & 0xFF); |
| 192 | *dest++ = (u8)((w >> 8) & 0xFF); |
| 193 | *dest++ = (u8)((w >> 16) & 0xFF); |
| 194 | *dest++ = (u8)((w >> 24) & 0xFF); |
| 195 | *dest++ = (u8)((w >> 32) & 0xFF); |
| 196 | *dest++ = (u8)((w >> 40) & 0xFF); |
| 197 | *dest++ = (u8)((w >> 48) & 0xFF); |
| 198 | *dest++ = (u8)((w >> 56) & 0xFF); |
| 199 | |
| 200 | return dest; |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * ipa_write_32() - convert 32 bit value to byte array |
| 205 | * @w: 32 bit integer |
| 206 | * @dest: byte array |
| 207 | * |
| 208 | * Return value: converted value |
| 209 | */ |
| 210 | u8 *ipa_write_32(u32 w, u8 *dest) |
| 211 | { |
| 212 | if (unlikely(dest == NULL)) { |
| 213 | pr_err("ipa_write_32: NULL address!\n"); |
| 214 | return dest; |
| 215 | } |
| 216 | *dest++ = (u8)((w) & 0xFF); |
| 217 | *dest++ = (u8)((w >> 8) & 0xFF); |
| 218 | *dest++ = (u8)((w >> 16) & 0xFF); |
| 219 | *dest++ = (u8)((w >> 24) & 0xFF); |
| 220 | |
| 221 | return dest; |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * ipa_write_16() - convert 16 bit value to byte array |
| 226 | * @hw: 16 bit integer |
| 227 | * @dest: byte array |
| 228 | * |
| 229 | * Return value: converted value |
| 230 | */ |
| 231 | u8 *ipa_write_16(u16 hw, u8 *dest) |
| 232 | { |
| 233 | if (unlikely(dest == NULL)) { |
| 234 | pr_err("ipa_write_16: NULL address!\n"); |
| 235 | return dest; |
| 236 | } |
| 237 | *dest++ = (u8)((hw) & 0xFF); |
| 238 | *dest++ = (u8)((hw >> 8) & 0xFF); |
| 239 | |
| 240 | return dest; |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * ipa_write_8() - convert 8 bit value to byte array |
| 245 | * @hw: 8 bit integer |
| 246 | * @dest: byte array |
| 247 | * |
| 248 | * Return value: converted value |
| 249 | */ |
| 250 | u8 *ipa_write_8(u8 b, u8 *dest) |
| 251 | { |
| 252 | if (unlikely(dest == NULL)) { |
| 253 | pr_err("ipa_write_8: NULL address!\n"); |
| 254 | return dest; |
| 255 | } |
| 256 | *dest++ = (b) & 0xFF; |
| 257 | |
| 258 | return dest; |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * ipa_pad_to_64() - pad byte array to 64 bit value |
| 263 | * @dest: byte array |
| 264 | * |
| 265 | * Return value: padded value |
| 266 | */ |
| 267 | u8 *ipa_pad_to_64(u8 *dest) |
| 268 | { |
| 269 | int i = (long)dest & 0x7; |
| 270 | int j; |
| 271 | |
| 272 | if (i) |
| 273 | for (j = 0; j < (8 - i); j++) |
| 274 | *dest++ = 0; |
| 275 | |
| 276 | return dest; |
| 277 | } |
| 278 | |
| 279 | /** |
| 280 | * ipa_pad_to_32() - pad byte array to 32 bit value |
| 281 | * @dest: byte array |
| 282 | * |
| 283 | * Return value: padded value |
| 284 | */ |
| 285 | u8 *ipa_pad_to_32(u8 *dest) |
| 286 | { |
| 287 | int i = (long)dest & 0x3; |
| 288 | int j; |
| 289 | |
| 290 | if (i) |
| 291 | for (j = 0; j < (4 - i); j++) |
| 292 | *dest++ = 0; |
| 293 | |
| 294 | return dest; |
| 295 | } |
| 296 | |
Michael Adisumarta | b1bafa4 | 2018-04-16 16:48:10 -0700 | [diff] [blame] | 297 | int ipa_smmu_store_sgt(struct sg_table **out_ch_ptr, |
| 298 | struct sg_table *in_sgt_ptr) |
| 299 | { |
| 300 | unsigned int nents; |
| 301 | |
| 302 | if (in_sgt_ptr != NULL) { |
| 303 | *out_ch_ptr = kzalloc(sizeof(struct sg_table), GFP_KERNEL); |
| 304 | if (*out_ch_ptr == NULL) |
| 305 | return -ENOMEM; |
| 306 | |
| 307 | nents = in_sgt_ptr->nents; |
| 308 | |
| 309 | (*out_ch_ptr)->sgl = |
| 310 | kcalloc(nents, sizeof(struct scatterlist), |
| 311 | GFP_KERNEL); |
| 312 | if ((*out_ch_ptr)->sgl == NULL) { |
| 313 | kfree(*out_ch_ptr); |
| 314 | *out_ch_ptr = NULL; |
| 315 | return -ENOMEM; |
| 316 | } |
| 317 | |
| 318 | memcpy((*out_ch_ptr)->sgl, in_sgt_ptr->sgl, |
| 319 | nents*sizeof((*out_ch_ptr)->sgl)); |
| 320 | (*out_ch_ptr)->nents = nents; |
| 321 | (*out_ch_ptr)->orig_nents = in_sgt_ptr->orig_nents; |
| 322 | } |
| 323 | return 0; |
| 324 | } |
| 325 | |
| 326 | int ipa_smmu_free_sgt(struct sg_table **out_sgt_ptr) |
| 327 | { |
| 328 | if (*out_sgt_ptr != NULL) { |
| 329 | kfree((*out_sgt_ptr)->sgl); |
| 330 | (*out_sgt_ptr)->sgl = NULL; |
| 331 | kfree(*out_sgt_ptr); |
| 332 | *out_sgt_ptr = NULL; |
| 333 | } |
| 334 | return 0; |
| 335 | } |
| 336 | |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 337 | /** |
| 338 | * ipa_connect() - low-level IPA client connect |
| 339 | * @in: [in] input parameters from client |
| 340 | * @sps: [out] sps output from IPA needed by client for sps_connect |
| 341 | * @clnt_hdl: [out] opaque client handle assigned by IPA to client |
| 342 | * |
| 343 | * Should be called by the driver of the peripheral that wants to connect to |
| 344 | * IPA in BAM-BAM mode. these peripherals are USB and HSIC. this api |
| 345 | * expects caller to take responsibility to add any needed headers, routing |
| 346 | * and filtering tables and rules as needed. |
| 347 | * |
| 348 | * Returns: 0 on success, negative on failure |
| 349 | * |
| 350 | * Note: Should not be called from atomic context |
| 351 | */ |
| 352 | int ipa_connect(const struct ipa_connect_params *in, struct ipa_sps_params *sps, |
| 353 | u32 *clnt_hdl) |
| 354 | { |
| 355 | int ret; |
| 356 | |
| 357 | IPA_API_DISPATCH_RETURN(ipa_connect, in, sps, clnt_hdl); |
| 358 | |
| 359 | return ret; |
| 360 | } |
| 361 | EXPORT_SYMBOL(ipa_connect); |
| 362 | |
| 363 | /** |
| 364 | * ipa_disconnect() - low-level IPA client disconnect |
| 365 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 366 | * |
| 367 | * Should be called by the driver of the peripheral that wants to disconnect |
| 368 | * from IPA in BAM-BAM mode. this api expects caller to take responsibility to |
| 369 | * free any needed headers, routing and filtering tables and rules as needed. |
| 370 | * |
| 371 | * Returns: 0 on success, negative on failure |
| 372 | * |
| 373 | * Note: Should not be called from atomic context |
| 374 | */ |
| 375 | int ipa_disconnect(u32 clnt_hdl) |
| 376 | { |
| 377 | int ret; |
| 378 | |
| 379 | IPA_API_DISPATCH_RETURN(ipa_disconnect, clnt_hdl); |
| 380 | |
| 381 | return ret; |
| 382 | } |
| 383 | EXPORT_SYMBOL(ipa_disconnect); |
| 384 | |
| 385 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 386 | * ipa_clear_endpoint_delay() - Clear ep_delay. |
| 387 | * @clnt_hdl: [in] IPA client handle |
| 388 | * |
| 389 | * Returns: 0 on success, negative on failure |
| 390 | * |
| 391 | * Note: Should not be called from atomic context |
| 392 | */ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 393 | int ipa_clear_endpoint_delay(u32 clnt_hdl) |
| 394 | { |
| 395 | int ret; |
| 396 | |
| 397 | IPA_API_DISPATCH_RETURN(ipa_clear_endpoint_delay, clnt_hdl); |
| 398 | |
| 399 | return ret; |
| 400 | } |
| 401 | EXPORT_SYMBOL(ipa_clear_endpoint_delay); |
| 402 | |
| 403 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 404 | * ipa_reset_endpoint() - reset an endpoint from BAM perspective |
| 405 | * @clnt_hdl: [in] IPA client handle |
| 406 | * |
| 407 | * Returns: 0 on success, negative on failure |
| 408 | * |
| 409 | * Note: Should not be called from atomic context |
| 410 | */ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 411 | int ipa_reset_endpoint(u32 clnt_hdl) |
| 412 | { |
| 413 | int ret; |
| 414 | |
| 415 | IPA_API_DISPATCH_RETURN(ipa_reset_endpoint, clnt_hdl); |
| 416 | |
| 417 | return ret; |
| 418 | } |
| 419 | EXPORT_SYMBOL(ipa_reset_endpoint); |
| 420 | |
| 421 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 422 | * ipa_disable_endpoint() - Disable an endpoint from IPA perspective |
| 423 | * @clnt_hdl: [in] IPA client handle |
| 424 | * |
| 425 | * Returns: 0 on success, negative on failure |
| 426 | * |
| 427 | * Note: Should not be called from atomic context |
| 428 | */ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 429 | int ipa_disable_endpoint(u32 clnt_hdl) |
| 430 | { |
| 431 | int ret; |
| 432 | |
| 433 | IPA_API_DISPATCH_RETURN(ipa_disable_endpoint, clnt_hdl); |
| 434 | |
| 435 | return ret; |
| 436 | } |
| 437 | EXPORT_SYMBOL(ipa_disable_endpoint); |
| 438 | |
| 439 | |
| 440 | /** |
| 441 | * ipa_cfg_ep - IPA end-point configuration |
| 442 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 443 | * @ipa_ep_cfg: [in] IPA end-point configuration params |
| 444 | * |
| 445 | * This includes nat, header, mode, aggregation and route settings and is a one |
| 446 | * shot API to configure the IPA end-point fully |
| 447 | * |
| 448 | * Returns: 0 on success, negative on failure |
| 449 | * |
| 450 | * Note: Should not be called from atomic context |
| 451 | */ |
| 452 | int ipa_cfg_ep(u32 clnt_hdl, const struct ipa_ep_cfg *ipa_ep_cfg) |
| 453 | { |
| 454 | int ret; |
| 455 | |
| 456 | IPA_API_DISPATCH_RETURN(ipa_cfg_ep, clnt_hdl, ipa_ep_cfg); |
| 457 | |
| 458 | return ret; |
| 459 | } |
| 460 | EXPORT_SYMBOL(ipa_cfg_ep); |
| 461 | |
| 462 | /** |
| 463 | * ipa_cfg_ep_nat() - IPA end-point NAT configuration |
| 464 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
Amir Levy | dc65f4c | 2017-07-06 09:49:50 +0300 | [diff] [blame] | 465 | * @ep_nat: [in] IPA NAT end-point configuration params |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 466 | * |
| 467 | * Returns: 0 on success, negative on failure |
| 468 | * |
| 469 | * Note: Should not be called from atomic context |
| 470 | */ |
| 471 | int ipa_cfg_ep_nat(u32 clnt_hdl, const struct ipa_ep_cfg_nat *ep_nat) |
| 472 | { |
| 473 | int ret; |
| 474 | |
| 475 | IPA_API_DISPATCH_RETURN(ipa_cfg_ep_nat, clnt_hdl, ep_nat); |
| 476 | |
| 477 | return ret; |
| 478 | } |
| 479 | EXPORT_SYMBOL(ipa_cfg_ep_nat); |
| 480 | |
| 481 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 482 | * ipa_cfg_ep_conn_track() - IPA end-point IPv6CT configuration |
| 483 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 484 | * @ep_conn_track: [in] IPA IPv6CT end-point configuration params |
| 485 | * |
| 486 | * Returns: 0 on success, negative on failure |
| 487 | * |
| 488 | * Note: Should not be called from atomic context |
| 489 | */ |
Amir Levy | dc65f4c | 2017-07-06 09:49:50 +0300 | [diff] [blame] | 490 | int ipa_cfg_ep_conn_track(u32 clnt_hdl, |
| 491 | const struct ipa_ep_cfg_conn_track *ep_conn_track) |
| 492 | { |
| 493 | int ret; |
| 494 | |
| 495 | IPA_API_DISPATCH_RETURN(ipa_cfg_ep_conn_track, clnt_hdl, |
| 496 | ep_conn_track); |
| 497 | |
| 498 | return ret; |
| 499 | } |
| 500 | EXPORT_SYMBOL(ipa_cfg_ep_conn_track); |
| 501 | |
| 502 | /** |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 503 | * ipa_cfg_ep_hdr() - IPA end-point header configuration |
| 504 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 505 | * @ipa_ep_cfg: [in] IPA end-point configuration params |
| 506 | * |
| 507 | * Returns: 0 on success, negative on failure |
| 508 | * |
| 509 | * Note: Should not be called from atomic context |
| 510 | */ |
| 511 | int ipa_cfg_ep_hdr(u32 clnt_hdl, const struct ipa_ep_cfg_hdr *ep_hdr) |
| 512 | { |
| 513 | int ret; |
| 514 | |
| 515 | IPA_API_DISPATCH_RETURN(ipa_cfg_ep_hdr, clnt_hdl, ep_hdr); |
| 516 | |
| 517 | return ret; |
| 518 | } |
| 519 | EXPORT_SYMBOL(ipa_cfg_ep_hdr); |
| 520 | |
| 521 | /** |
| 522 | * ipa_cfg_ep_hdr_ext() - IPA end-point extended header configuration |
| 523 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 524 | * @ep_hdr_ext: [in] IPA end-point configuration params |
| 525 | * |
| 526 | * Returns: 0 on success, negative on failure |
| 527 | * |
| 528 | * Note: Should not be called from atomic context |
| 529 | */ |
| 530 | int ipa_cfg_ep_hdr_ext(u32 clnt_hdl, |
| 531 | const struct ipa_ep_cfg_hdr_ext *ep_hdr_ext) |
| 532 | { |
| 533 | int ret; |
| 534 | |
| 535 | IPA_API_DISPATCH_RETURN(ipa_cfg_ep_hdr_ext, clnt_hdl, ep_hdr_ext); |
| 536 | |
| 537 | return ret; |
| 538 | } |
| 539 | EXPORT_SYMBOL(ipa_cfg_ep_hdr_ext); |
| 540 | |
| 541 | /** |
| 542 | * ipa_cfg_ep_mode() - IPA end-point mode configuration |
| 543 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 544 | * @ipa_ep_cfg: [in] IPA end-point configuration params |
| 545 | * |
| 546 | * Returns: 0 on success, negative on failure |
| 547 | * |
| 548 | * Note: Should not be called from atomic context |
| 549 | */ |
| 550 | int ipa_cfg_ep_mode(u32 clnt_hdl, const struct ipa_ep_cfg_mode *ep_mode) |
| 551 | { |
| 552 | int ret; |
| 553 | |
| 554 | IPA_API_DISPATCH_RETURN(ipa_cfg_ep_mode, clnt_hdl, ep_mode); |
| 555 | |
| 556 | return ret; |
| 557 | } |
| 558 | EXPORT_SYMBOL(ipa_cfg_ep_mode); |
| 559 | |
| 560 | /** |
| 561 | * ipa_cfg_ep_aggr() - IPA end-point aggregation configuration |
| 562 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 563 | * @ipa_ep_cfg: [in] IPA end-point configuration params |
| 564 | * |
| 565 | * Returns: 0 on success, negative on failure |
| 566 | * |
| 567 | * Note: Should not be called from atomic context |
| 568 | */ |
| 569 | int ipa_cfg_ep_aggr(u32 clnt_hdl, const struct ipa_ep_cfg_aggr *ep_aggr) |
| 570 | { |
| 571 | int ret; |
| 572 | |
| 573 | IPA_API_DISPATCH_RETURN(ipa_cfg_ep_aggr, clnt_hdl, ep_aggr); |
| 574 | |
| 575 | return ret; |
| 576 | } |
| 577 | EXPORT_SYMBOL(ipa_cfg_ep_aggr); |
| 578 | |
| 579 | /** |
| 580 | * ipa_cfg_ep_deaggr() - IPA end-point deaggregation configuration |
| 581 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 582 | * @ep_deaggr: [in] IPA end-point configuration params |
| 583 | * |
| 584 | * Returns: 0 on success, negative on failure |
| 585 | * |
| 586 | * Note: Should not be called from atomic context |
| 587 | */ |
| 588 | int ipa_cfg_ep_deaggr(u32 clnt_hdl, |
| 589 | const struct ipa_ep_cfg_deaggr *ep_deaggr) |
| 590 | { |
| 591 | int ret; |
| 592 | |
| 593 | IPA_API_DISPATCH_RETURN(ipa_cfg_ep_deaggr, clnt_hdl, ep_deaggr); |
| 594 | |
| 595 | return ret; |
| 596 | } |
| 597 | EXPORT_SYMBOL(ipa_cfg_ep_deaggr); |
| 598 | |
| 599 | /** |
| 600 | * ipa_cfg_ep_route() - IPA end-point routing configuration |
| 601 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 602 | * @ipa_ep_cfg: [in] IPA end-point configuration params |
| 603 | * |
| 604 | * Returns: 0 on success, negative on failure |
| 605 | * |
| 606 | * Note: Should not be called from atomic context |
| 607 | */ |
| 608 | int ipa_cfg_ep_route(u32 clnt_hdl, const struct ipa_ep_cfg_route *ep_route) |
| 609 | { |
| 610 | int ret; |
| 611 | |
| 612 | IPA_API_DISPATCH_RETURN(ipa_cfg_ep_route, clnt_hdl, ep_route); |
| 613 | |
| 614 | return ret; |
| 615 | } |
| 616 | EXPORT_SYMBOL(ipa_cfg_ep_route); |
| 617 | |
| 618 | /** |
| 619 | * ipa_cfg_ep_holb() - IPA end-point holb configuration |
| 620 | * |
| 621 | * If an IPA producer pipe is full, IPA HW by default will block |
| 622 | * indefinitely till space opens up. During this time no packets |
| 623 | * including those from unrelated pipes will be processed. Enabling |
| 624 | * HOLB means IPA HW will be allowed to drop packets as/when needed |
| 625 | * and indefinite blocking is avoided. |
| 626 | * |
| 627 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 628 | * @ipa_ep_cfg: [in] IPA end-point configuration params |
| 629 | * |
| 630 | * Returns: 0 on success, negative on failure |
| 631 | */ |
| 632 | int ipa_cfg_ep_holb(u32 clnt_hdl, const struct ipa_ep_cfg_holb *ep_holb) |
| 633 | { |
| 634 | int ret; |
| 635 | |
| 636 | IPA_API_DISPATCH_RETURN(ipa_cfg_ep_holb, clnt_hdl, ep_holb); |
| 637 | |
| 638 | return ret; |
| 639 | } |
| 640 | EXPORT_SYMBOL(ipa_cfg_ep_holb); |
| 641 | |
| 642 | |
| 643 | /** |
| 644 | * ipa_cfg_ep_cfg() - IPA end-point cfg configuration |
| 645 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 646 | * @ipa_ep_cfg: [in] IPA end-point configuration params |
| 647 | * |
| 648 | * Returns: 0 on success, negative on failure |
| 649 | * |
| 650 | * Note: Should not be called from atomic context |
| 651 | */ |
| 652 | int ipa_cfg_ep_cfg(u32 clnt_hdl, const struct ipa_ep_cfg_cfg *cfg) |
| 653 | { |
| 654 | int ret; |
| 655 | |
| 656 | IPA_API_DISPATCH_RETURN(ipa_cfg_ep_cfg, clnt_hdl, cfg); |
| 657 | |
| 658 | return ret; |
| 659 | } |
| 660 | EXPORT_SYMBOL(ipa_cfg_ep_cfg); |
| 661 | |
| 662 | /** |
| 663 | * ipa_cfg_ep_metadata_mask() - IPA end-point meta-data mask configuration |
| 664 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 665 | * @ipa_ep_cfg: [in] IPA end-point configuration params |
| 666 | * |
| 667 | * Returns: 0 on success, negative on failure |
| 668 | * |
| 669 | * Note: Should not be called from atomic context |
| 670 | */ |
| 671 | int ipa_cfg_ep_metadata_mask(u32 clnt_hdl, const struct ipa_ep_cfg_metadata_mask |
| 672 | *metadata_mask) |
| 673 | { |
| 674 | int ret; |
| 675 | |
| 676 | IPA_API_DISPATCH_RETURN(ipa_cfg_ep_metadata_mask, clnt_hdl, |
| 677 | metadata_mask); |
| 678 | |
| 679 | return ret; |
| 680 | } |
| 681 | EXPORT_SYMBOL(ipa_cfg_ep_metadata_mask); |
| 682 | |
| 683 | /** |
| 684 | * ipa_cfg_ep_holb_by_client() - IPA end-point holb configuration |
| 685 | * |
| 686 | * Wrapper function for ipa_cfg_ep_holb() with client name instead of |
| 687 | * client handle. This function is used for clients that does not have |
| 688 | * client handle. |
| 689 | * |
| 690 | * @client: [in] client name |
| 691 | * @ipa_ep_cfg: [in] IPA end-point configuration params |
| 692 | * |
| 693 | * Returns: 0 on success, negative on failure |
| 694 | */ |
| 695 | int ipa_cfg_ep_holb_by_client(enum ipa_client_type client, |
| 696 | const struct ipa_ep_cfg_holb *ep_holb) |
| 697 | { |
| 698 | int ret; |
| 699 | |
| 700 | IPA_API_DISPATCH_RETURN(ipa_cfg_ep_holb_by_client, client, ep_holb); |
| 701 | |
| 702 | return ret; |
| 703 | } |
| 704 | EXPORT_SYMBOL(ipa_cfg_ep_holb_by_client); |
| 705 | |
| 706 | /** |
| 707 | * ipa_cfg_ep_ctrl() - IPA end-point Control configuration |
| 708 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 709 | * @ipa_ep_cfg_ctrl: [in] IPA end-point configuration params |
| 710 | * |
| 711 | * Returns: 0 on success, negative on failure |
| 712 | */ |
| 713 | int ipa_cfg_ep_ctrl(u32 clnt_hdl, const struct ipa_ep_cfg_ctrl *ep_ctrl) |
| 714 | { |
| 715 | int ret; |
| 716 | |
| 717 | IPA_API_DISPATCH_RETURN(ipa_cfg_ep_ctrl, clnt_hdl, ep_ctrl); |
| 718 | |
| 719 | return ret; |
| 720 | } |
| 721 | EXPORT_SYMBOL(ipa_cfg_ep_ctrl); |
| 722 | |
| 723 | /** |
| 724 | * ipa_add_hdr() - add the specified headers to SW and optionally commit them to |
| 725 | * IPA HW |
| 726 | * @hdrs: [inout] set of headers to add |
| 727 | * |
| 728 | * Returns: 0 on success, negative on failure |
| 729 | * |
| 730 | * Note: Should not be called from atomic context |
| 731 | */ |
| 732 | int ipa_add_hdr(struct ipa_ioc_add_hdr *hdrs) |
| 733 | { |
| 734 | int ret; |
| 735 | |
| 736 | IPA_API_DISPATCH_RETURN(ipa_add_hdr, hdrs); |
| 737 | |
| 738 | return ret; |
| 739 | } |
| 740 | EXPORT_SYMBOL(ipa_add_hdr); |
| 741 | |
| 742 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 743 | * ipa_add_hdr_usr() - add the specified headers to SW and optionally |
| 744 | * commit them to IPA HW |
| 745 | * @hdrs: [inout] set of headers to add |
| 746 | * @user_only: [in] indicate rules installed by userspace |
| 747 | * |
| 748 | * Returns: 0 on success, negative on failure |
| 749 | * |
| 750 | * Note: Should not be called from atomic context |
| 751 | */ |
| 752 | int ipa_add_hdr_usr(struct ipa_ioc_add_hdr *hdrs, bool user_only) |
| 753 | { |
| 754 | int ret; |
| 755 | |
| 756 | IPA_API_DISPATCH_RETURN(ipa_add_hdr_usr, hdrs, user_only); |
| 757 | |
| 758 | return ret; |
| 759 | } |
| 760 | EXPORT_SYMBOL(ipa_add_hdr_usr); |
| 761 | |
| 762 | /** |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 763 | * ipa_del_hdr() - Remove the specified headers from SW and optionally |
| 764 | * commit them to IPA HW |
| 765 | * @hdls: [inout] set of headers to delete |
| 766 | * |
| 767 | * Returns: 0 on success, negative on failure |
| 768 | * |
| 769 | * Note: Should not be called from atomic context |
| 770 | */ |
| 771 | int ipa_del_hdr(struct ipa_ioc_del_hdr *hdls) |
| 772 | { |
| 773 | int ret; |
| 774 | |
| 775 | IPA_API_DISPATCH_RETURN(ipa_del_hdr, hdls); |
| 776 | |
| 777 | return ret; |
| 778 | } |
| 779 | EXPORT_SYMBOL(ipa_del_hdr); |
| 780 | |
| 781 | /** |
| 782 | * ipa_commit_hdr() - commit to IPA HW the current header table in SW |
| 783 | * |
| 784 | * Returns: 0 on success, negative on failure |
| 785 | * |
| 786 | * Note: Should not be called from atomic context |
| 787 | */ |
| 788 | int ipa_commit_hdr(void) |
| 789 | { |
| 790 | int ret; |
| 791 | |
| 792 | IPA_API_DISPATCH_RETURN(ipa_commit_hdr); |
| 793 | |
| 794 | return ret; |
| 795 | } |
| 796 | EXPORT_SYMBOL(ipa_commit_hdr); |
| 797 | |
| 798 | /** |
| 799 | * ipa_reset_hdr() - reset the current header table in SW (does not commit to |
| 800 | * HW) |
| 801 | * |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 802 | * @user_only: [in] indicate delete rules installed by userspace |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 803 | * Returns: 0 on success, negative on failure |
| 804 | * |
| 805 | * Note: Should not be called from atomic context |
| 806 | */ |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 807 | int ipa_reset_hdr(bool user_only) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 808 | { |
| 809 | int ret; |
| 810 | |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 811 | IPA_API_DISPATCH_RETURN(ipa_reset_hdr, user_only); |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 812 | |
| 813 | return ret; |
| 814 | } |
| 815 | EXPORT_SYMBOL(ipa_reset_hdr); |
| 816 | |
| 817 | /** |
| 818 | * ipa_get_hdr() - Lookup the specified header resource |
| 819 | * @lookup: [inout] header to lookup and its handle |
| 820 | * |
| 821 | * lookup the specified header resource and return handle if it exists |
| 822 | * |
| 823 | * Returns: 0 on success, negative on failure |
| 824 | * |
| 825 | * Note: Should not be called from atomic context |
| 826 | * Caller should call ipa_put_hdr later if this function succeeds |
| 827 | */ |
| 828 | int ipa_get_hdr(struct ipa_ioc_get_hdr *lookup) |
| 829 | { |
| 830 | int ret; |
| 831 | |
| 832 | IPA_API_DISPATCH_RETURN(ipa_get_hdr, lookup); |
| 833 | |
| 834 | return ret; |
| 835 | } |
| 836 | EXPORT_SYMBOL(ipa_get_hdr); |
| 837 | |
| 838 | /** |
| 839 | * ipa_put_hdr() - Release the specified header handle |
| 840 | * @hdr_hdl: [in] the header handle to release |
| 841 | * |
| 842 | * Returns: 0 on success, negative on failure |
| 843 | * |
| 844 | * Note: Should not be called from atomic context |
| 845 | */ |
| 846 | int ipa_put_hdr(u32 hdr_hdl) |
| 847 | { |
| 848 | int ret; |
| 849 | |
| 850 | IPA_API_DISPATCH_RETURN(ipa_put_hdr, hdr_hdl); |
| 851 | |
| 852 | return ret; |
| 853 | } |
| 854 | EXPORT_SYMBOL(ipa_put_hdr); |
| 855 | |
| 856 | /** |
| 857 | * ipa_copy_hdr() - Lookup the specified header resource and return a copy of it |
| 858 | * @copy: [inout] header to lookup and its copy |
| 859 | * |
| 860 | * lookup the specified header resource and return a copy of it (along with its |
| 861 | * attributes) if it exists, this would be called for partial headers |
| 862 | * |
| 863 | * Returns: 0 on success, negative on failure |
| 864 | * |
| 865 | * Note: Should not be called from atomic context |
| 866 | */ |
| 867 | int ipa_copy_hdr(struct ipa_ioc_copy_hdr *copy) |
| 868 | { |
| 869 | int ret; |
| 870 | |
| 871 | IPA_API_DISPATCH_RETURN(ipa_copy_hdr, copy); |
| 872 | |
| 873 | return ret; |
| 874 | } |
| 875 | EXPORT_SYMBOL(ipa_copy_hdr); |
| 876 | |
| 877 | /** |
| 878 | * ipa_add_hdr_proc_ctx() - add the specified headers to SW |
| 879 | * and optionally commit them to IPA HW |
| 880 | * @proc_ctxs: [inout] set of processing context headers to add |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 881 | * @user_only: [in] indicate rules installed by userspace |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 882 | * |
| 883 | * Returns: 0 on success, negative on failure |
| 884 | * |
| 885 | * Note: Should not be called from atomic context |
| 886 | */ |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 887 | int ipa_add_hdr_proc_ctx(struct ipa_ioc_add_hdr_proc_ctx *proc_ctxs, |
| 888 | bool user_only) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 889 | { |
| 890 | int ret; |
| 891 | |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 892 | IPA_API_DISPATCH_RETURN(ipa_add_hdr_proc_ctx, proc_ctxs, user_only); |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 893 | |
| 894 | return ret; |
| 895 | } |
| 896 | EXPORT_SYMBOL(ipa_add_hdr_proc_ctx); |
| 897 | |
| 898 | /** |
| 899 | * ipa_del_hdr_proc_ctx() - |
| 900 | * Remove the specified processing context headers from SW and |
| 901 | * optionally commit them to IPA HW. |
| 902 | * @hdls: [inout] set of processing context headers to delete |
| 903 | * |
| 904 | * Returns: 0 on success, negative on failure |
| 905 | * |
| 906 | * Note: Should not be called from atomic context |
| 907 | */ |
| 908 | int ipa_del_hdr_proc_ctx(struct ipa_ioc_del_hdr_proc_ctx *hdls) |
| 909 | { |
| 910 | int ret; |
| 911 | |
| 912 | IPA_API_DISPATCH_RETURN(ipa_del_hdr_proc_ctx, hdls); |
| 913 | |
| 914 | return ret; |
| 915 | } |
| 916 | EXPORT_SYMBOL(ipa_del_hdr_proc_ctx); |
| 917 | |
| 918 | /** |
| 919 | * ipa_add_rt_rule() - Add the specified routing rules to SW and optionally |
| 920 | * commit to IPA HW |
| 921 | * @rules: [inout] set of routing rules to add |
| 922 | * |
| 923 | * Returns: 0 on success, negative on failure |
| 924 | * |
| 925 | * Note: Should not be called from atomic context |
| 926 | */ |
| 927 | int ipa_add_rt_rule(struct ipa_ioc_add_rt_rule *rules) |
| 928 | { |
| 929 | int ret; |
| 930 | |
| 931 | IPA_API_DISPATCH_RETURN(ipa_add_rt_rule, rules); |
| 932 | |
| 933 | return ret; |
| 934 | } |
| 935 | EXPORT_SYMBOL(ipa_add_rt_rule); |
| 936 | |
| 937 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 938 | * ipa_add_rt_rule_usr() - Add the specified routing rules to SW and optionally |
| 939 | * commit to IPA HW |
| 940 | * @rules: [inout] set of routing rules to add |
| 941 | * @user_only: [in] indicate rules installed by userspace |
| 942 | * |
| 943 | * Returns: 0 on success, negative on failure |
| 944 | * |
| 945 | * Note: Should not be called from atomic context |
| 946 | */ |
| 947 | int ipa_add_rt_rule_usr(struct ipa_ioc_add_rt_rule *rules, bool user_only) |
| 948 | { |
| 949 | int ret; |
| 950 | |
| 951 | IPA_API_DISPATCH_RETURN(ipa_add_rt_rule_usr, rules, user_only); |
| 952 | |
| 953 | return ret; |
| 954 | } |
| 955 | EXPORT_SYMBOL(ipa_add_rt_rule_usr); |
| 956 | |
| 957 | /** |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 958 | * ipa_del_rt_rule() - Remove the specified routing rules to SW and optionally |
| 959 | * commit to IPA HW |
| 960 | * @hdls: [inout] set of routing rules to delete |
| 961 | * |
| 962 | * Returns: 0 on success, negative on failure |
| 963 | * |
| 964 | * Note: Should not be called from atomic context |
| 965 | */ |
| 966 | int ipa_del_rt_rule(struct ipa_ioc_del_rt_rule *hdls) |
| 967 | { |
| 968 | int ret; |
| 969 | |
| 970 | IPA_API_DISPATCH_RETURN(ipa_del_rt_rule, hdls); |
| 971 | |
| 972 | return ret; |
| 973 | } |
| 974 | EXPORT_SYMBOL(ipa_del_rt_rule); |
| 975 | |
| 976 | /** |
| 977 | * ipa_commit_rt_rule() - Commit the current SW routing table of specified type |
| 978 | * to IPA HW |
| 979 | * @ip: The family of routing tables |
| 980 | * |
| 981 | * Returns: 0 on success, negative on failure |
| 982 | * |
| 983 | * Note: Should not be called from atomic context |
| 984 | */ |
| 985 | int ipa_commit_rt(enum ipa_ip_type ip) |
| 986 | { |
| 987 | int ret; |
| 988 | |
| 989 | IPA_API_DISPATCH_RETURN(ipa_commit_rt, ip); |
| 990 | |
| 991 | return ret; |
| 992 | } |
| 993 | EXPORT_SYMBOL(ipa_commit_rt); |
| 994 | |
| 995 | /** |
| 996 | * ipa_reset_rt() - reset the current SW routing table of specified type |
| 997 | * (does not commit to HW) |
| 998 | * @ip: The family of routing tables |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 999 | * @user_only: [in] indicate delete rules installed by userspace |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1000 | * |
| 1001 | * Returns: 0 on success, negative on failure |
| 1002 | * |
| 1003 | * Note: Should not be called from atomic context |
| 1004 | */ |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 1005 | int ipa_reset_rt(enum ipa_ip_type ip, bool user_only) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1006 | { |
| 1007 | int ret; |
| 1008 | |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 1009 | IPA_API_DISPATCH_RETURN(ipa_reset_rt, ip, user_only); |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1010 | |
| 1011 | return ret; |
| 1012 | } |
| 1013 | EXPORT_SYMBOL(ipa_reset_rt); |
| 1014 | |
| 1015 | /** |
| 1016 | * ipa_get_rt_tbl() - lookup the specified routing table and return handle if it |
| 1017 | * exists, if lookup succeeds the routing table ref cnt is increased |
| 1018 | * @lookup: [inout] routing table to lookup and its handle |
| 1019 | * |
| 1020 | * Returns: 0 on success, negative on failure |
| 1021 | * |
| 1022 | * Note: Should not be called from atomic context |
| 1023 | * Caller should call ipa_put_rt_tbl later if this function succeeds |
| 1024 | */ |
| 1025 | int ipa_get_rt_tbl(struct ipa_ioc_get_rt_tbl *lookup) |
| 1026 | { |
| 1027 | int ret; |
| 1028 | |
| 1029 | IPA_API_DISPATCH_RETURN(ipa_get_rt_tbl, lookup); |
| 1030 | |
| 1031 | return ret; |
| 1032 | } |
| 1033 | EXPORT_SYMBOL(ipa_get_rt_tbl); |
| 1034 | |
| 1035 | /** |
| 1036 | * ipa_put_rt_tbl() - Release the specified routing table handle |
| 1037 | * @rt_tbl_hdl: [in] the routing table handle to release |
| 1038 | * |
| 1039 | * Returns: 0 on success, negative on failure |
| 1040 | * |
| 1041 | * Note: Should not be called from atomic context |
| 1042 | */ |
| 1043 | int ipa_put_rt_tbl(u32 rt_tbl_hdl) |
| 1044 | { |
| 1045 | int ret; |
| 1046 | |
| 1047 | IPA_API_DISPATCH_RETURN(ipa_put_rt_tbl, rt_tbl_hdl); |
| 1048 | |
| 1049 | return ret; |
| 1050 | } |
| 1051 | EXPORT_SYMBOL(ipa_put_rt_tbl); |
| 1052 | |
| 1053 | /** |
| 1054 | * ipa_query_rt_index() - find the routing table index |
| 1055 | * which name and ip type are given as parameters |
| 1056 | * @in: [out] the index of the wanted routing table |
| 1057 | * |
| 1058 | * Returns: the routing table which name is given as parameter, or NULL if it |
| 1059 | * doesn't exist |
| 1060 | */ |
| 1061 | int ipa_query_rt_index(struct ipa_ioc_get_rt_tbl_indx *in) |
| 1062 | { |
| 1063 | int ret; |
| 1064 | |
| 1065 | IPA_API_DISPATCH_RETURN(ipa_query_rt_index, in); |
| 1066 | |
| 1067 | return ret; |
| 1068 | } |
| 1069 | EXPORT_SYMBOL(ipa_query_rt_index); |
| 1070 | |
| 1071 | /** |
| 1072 | * ipa_mdfy_rt_rule() - Modify the specified routing rules in SW and optionally |
| 1073 | * commit to IPA HW |
| 1074 | * |
| 1075 | * Returns: 0 on success, negative on failure |
| 1076 | * |
| 1077 | * Note: Should not be called from atomic context |
| 1078 | */ |
| 1079 | int ipa_mdfy_rt_rule(struct ipa_ioc_mdfy_rt_rule *hdls) |
| 1080 | { |
| 1081 | int ret; |
| 1082 | |
| 1083 | IPA_API_DISPATCH_RETURN(ipa_mdfy_rt_rule, hdls); |
| 1084 | |
| 1085 | return ret; |
| 1086 | } |
| 1087 | EXPORT_SYMBOL(ipa_mdfy_rt_rule); |
| 1088 | |
| 1089 | /** |
| 1090 | * ipa_add_flt_rule() - Add the specified filtering rules to SW and optionally |
| 1091 | * commit to IPA HW |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 1092 | * @rules: [inout] set of filtering rules to add |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1093 | * |
| 1094 | * Returns: 0 on success, negative on failure |
| 1095 | * |
| 1096 | * Note: Should not be called from atomic context |
| 1097 | */ |
| 1098 | int ipa_add_flt_rule(struct ipa_ioc_add_flt_rule *rules) |
| 1099 | { |
| 1100 | int ret; |
| 1101 | |
| 1102 | IPA_API_DISPATCH_RETURN(ipa_add_flt_rule, rules); |
| 1103 | |
| 1104 | return ret; |
| 1105 | } |
| 1106 | EXPORT_SYMBOL(ipa_add_flt_rule); |
| 1107 | |
| 1108 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 1109 | * ipa_add_flt_rule_usr() - Add the specified filtering rules to |
| 1110 | * SW and optionally commit to IPA HW |
| 1111 | * @rules: [inout] set of filtering rules to add |
| 1112 | * @user_only: [in] indicate rules installed by userspace |
| 1113 | * |
| 1114 | * Returns: 0 on success, negative on failure |
| 1115 | * |
| 1116 | * Note: Should not be called from atomic context |
| 1117 | */ |
| 1118 | int ipa_add_flt_rule_usr(struct ipa_ioc_add_flt_rule *rules, bool user_only) |
| 1119 | { |
| 1120 | int ret; |
| 1121 | |
| 1122 | IPA_API_DISPATCH_RETURN(ipa_add_flt_rule_usr, rules, user_only); |
| 1123 | |
| 1124 | return ret; |
| 1125 | } |
| 1126 | EXPORT_SYMBOL(ipa_add_flt_rule_usr); |
| 1127 | |
| 1128 | /** |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1129 | * ipa_del_flt_rule() - Remove the specified filtering rules from SW and |
| 1130 | * optionally commit to IPA HW |
| 1131 | * |
| 1132 | * Returns: 0 on success, negative on failure |
| 1133 | * |
| 1134 | * Note: Should not be called from atomic context |
| 1135 | */ |
| 1136 | int ipa_del_flt_rule(struct ipa_ioc_del_flt_rule *hdls) |
| 1137 | { |
| 1138 | int ret; |
| 1139 | |
| 1140 | IPA_API_DISPATCH_RETURN(ipa_del_flt_rule, hdls); |
| 1141 | |
| 1142 | return ret; |
| 1143 | } |
| 1144 | EXPORT_SYMBOL(ipa_del_flt_rule); |
| 1145 | |
| 1146 | /** |
| 1147 | * ipa_mdfy_flt_rule() - Modify the specified filtering rules in SW and |
| 1148 | * optionally commit to IPA HW |
| 1149 | * |
| 1150 | * Returns: 0 on success, negative on failure |
| 1151 | * |
| 1152 | * Note: Should not be called from atomic context |
| 1153 | */ |
| 1154 | int ipa_mdfy_flt_rule(struct ipa_ioc_mdfy_flt_rule *hdls) |
| 1155 | { |
| 1156 | int ret; |
| 1157 | |
| 1158 | IPA_API_DISPATCH_RETURN(ipa_mdfy_flt_rule, hdls); |
| 1159 | |
| 1160 | return ret; |
| 1161 | } |
| 1162 | EXPORT_SYMBOL(ipa_mdfy_flt_rule); |
| 1163 | |
| 1164 | /** |
| 1165 | * ipa_commit_flt() - Commit the current SW filtering table of specified type to |
| 1166 | * IPA HW |
| 1167 | * @ip: [in] the family of routing tables |
| 1168 | * |
| 1169 | * Returns: 0 on success, negative on failure |
| 1170 | * |
| 1171 | * Note: Should not be called from atomic context |
| 1172 | */ |
| 1173 | int ipa_commit_flt(enum ipa_ip_type ip) |
| 1174 | { |
| 1175 | int ret; |
| 1176 | |
| 1177 | IPA_API_DISPATCH_RETURN(ipa_commit_flt, ip); |
| 1178 | |
| 1179 | return ret; |
| 1180 | } |
| 1181 | EXPORT_SYMBOL(ipa_commit_flt); |
| 1182 | |
| 1183 | /** |
| 1184 | * ipa_reset_flt() - Reset the current SW filtering table of specified type |
| 1185 | * (does not commit to HW) |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 1186 | * @ip: [in] the family of routing tables |
| 1187 | * @user_only: [in] indicate delete rules installed by userspace |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1188 | * |
| 1189 | * Returns: 0 on success, negative on failure |
| 1190 | * |
| 1191 | * Note: Should not be called from atomic context |
| 1192 | */ |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 1193 | int ipa_reset_flt(enum ipa_ip_type ip, bool user_only) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1194 | { |
| 1195 | int ret; |
| 1196 | |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 1197 | IPA_API_DISPATCH_RETURN(ipa_reset_flt, ip, user_only); |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1198 | |
| 1199 | return ret; |
| 1200 | } |
| 1201 | EXPORT_SYMBOL(ipa_reset_flt); |
| 1202 | |
| 1203 | /** |
Amir Levy | 479cfdd | 2017-10-26 12:23:14 +0300 | [diff] [blame] | 1204 | * ipa_allocate_nat_device() - Allocates memory for the NAT device |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1205 | * @mem: [in/out] memory parameters |
| 1206 | * |
| 1207 | * Called by NAT client driver to allocate memory for the NAT entries. Based on |
| 1208 | * the request size either shared or system memory will be used. |
| 1209 | * |
| 1210 | * Returns: 0 on success, negative on failure |
| 1211 | */ |
Amir Levy | 479cfdd | 2017-10-26 12:23:14 +0300 | [diff] [blame] | 1212 | int ipa_allocate_nat_device(struct ipa_ioc_nat_alloc_mem *mem) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1213 | { |
| 1214 | int ret; |
| 1215 | |
Amir Levy | 479cfdd | 2017-10-26 12:23:14 +0300 | [diff] [blame] | 1216 | IPA_API_DISPATCH_RETURN(ipa_allocate_nat_device, mem); |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1217 | |
| 1218 | return ret; |
| 1219 | } |
Amir Levy | 479cfdd | 2017-10-26 12:23:14 +0300 | [diff] [blame] | 1220 | EXPORT_SYMBOL(ipa_allocate_nat_device); |
| 1221 | |
| 1222 | /** |
| 1223 | * ipa_allocate_nat_table() - Allocates memory for the NAT table |
| 1224 | * @table_alloc: [in/out] memory parameters |
| 1225 | * |
| 1226 | * Called by NAT client to allocate memory for the table entries. |
| 1227 | * Based on the request size either shared or system memory will be used. |
| 1228 | * |
| 1229 | * Returns: 0 on success, negative on failure |
| 1230 | */ |
| 1231 | int ipa_allocate_nat_table(struct ipa_ioc_nat_ipv6ct_table_alloc *table_alloc) |
| 1232 | { |
| 1233 | int ret; |
| 1234 | |
| 1235 | IPA_API_DISPATCH_RETURN(ipa_allocate_nat_table, table_alloc); |
| 1236 | |
| 1237 | return ret; |
| 1238 | } |
| 1239 | EXPORT_SYMBOL(ipa_allocate_nat_table); |
| 1240 | |
| 1241 | |
| 1242 | /** |
| 1243 | * ipa_allocate_ipv6ct_table() - Allocates memory for the IPv6CT table |
| 1244 | * @table_alloc: [in/out] memory parameters |
| 1245 | * |
| 1246 | * Called by IPv6CT client to allocate memory for the table entries. |
| 1247 | * Based on the request size either shared or system memory will be used. |
| 1248 | * |
| 1249 | * Returns: 0 on success, negative on failure |
| 1250 | */ |
| 1251 | int ipa_allocate_ipv6ct_table( |
| 1252 | struct ipa_ioc_nat_ipv6ct_table_alloc *table_alloc) |
| 1253 | { |
| 1254 | int ret; |
| 1255 | |
| 1256 | IPA_API_DISPATCH_RETURN(ipa_allocate_ipv6ct_table, table_alloc); |
| 1257 | |
| 1258 | return ret; |
| 1259 | } |
| 1260 | EXPORT_SYMBOL(ipa_allocate_ipv6ct_table); |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1261 | |
| 1262 | /** |
| 1263 | * ipa_nat_init_cmd() - Post IP_V4_NAT_INIT command to IPA HW |
| 1264 | * @init: [in] initialization command attributes |
| 1265 | * |
| 1266 | * Called by NAT client driver to post IP_V4_NAT_INIT command to IPA HW |
| 1267 | * |
| 1268 | * Returns: 0 on success, negative on failure |
| 1269 | */ |
| 1270 | int ipa_nat_init_cmd(struct ipa_ioc_v4_nat_init *init) |
| 1271 | { |
| 1272 | int ret; |
| 1273 | |
| 1274 | IPA_API_DISPATCH_RETURN(ipa_nat_init_cmd, init); |
| 1275 | |
| 1276 | return ret; |
| 1277 | } |
| 1278 | EXPORT_SYMBOL(ipa_nat_init_cmd); |
| 1279 | |
| 1280 | /** |
Amir Levy | 479cfdd | 2017-10-26 12:23:14 +0300 | [diff] [blame] | 1281 | * ipa_ipv6ct_init_cmd() - Post IP_V6_CONN_TRACK_INIT command to IPA HW |
| 1282 | * @init: [in] initialization command attributes |
| 1283 | * |
| 1284 | * Called by IPv6CT client driver to post IP_V6_CONN_TRACK_INIT command |
| 1285 | * to IPA HW. |
| 1286 | * |
| 1287 | * Returns: 0 on success, negative on failure |
| 1288 | */ |
| 1289 | int ipa_ipv6ct_init_cmd(struct ipa_ioc_ipv6ct_init *init) |
| 1290 | { |
| 1291 | int ret; |
| 1292 | |
| 1293 | IPA_API_DISPATCH_RETURN(ipa_ipv6ct_init_cmd, init); |
| 1294 | |
| 1295 | return ret; |
| 1296 | } |
| 1297 | EXPORT_SYMBOL(ipa_ipv6ct_init_cmd); |
| 1298 | |
| 1299 | /** |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1300 | * ipa_nat_dma_cmd() - Post NAT_DMA command to IPA HW |
| 1301 | * @dma: [in] initialization command attributes |
| 1302 | * |
| 1303 | * Called by NAT client driver to post NAT_DMA command to IPA HW |
| 1304 | * |
| 1305 | * Returns: 0 on success, negative on failure |
| 1306 | */ |
| 1307 | int ipa_nat_dma_cmd(struct ipa_ioc_nat_dma_cmd *dma) |
| 1308 | { |
| 1309 | int ret; |
| 1310 | |
| 1311 | IPA_API_DISPATCH_RETURN(ipa_nat_dma_cmd, dma); |
| 1312 | |
| 1313 | return ret; |
| 1314 | } |
| 1315 | EXPORT_SYMBOL(ipa_nat_dma_cmd); |
| 1316 | |
| 1317 | /** |
Amir Levy | 479cfdd | 2017-10-26 12:23:14 +0300 | [diff] [blame] | 1318 | * ipa_table_dma_cmd() - Post TABLE_DMA command to IPA HW |
| 1319 | * @dma: [in] initialization command attributes |
| 1320 | * |
| 1321 | * Called by NAT/IPv6CT client to post TABLE_DMA command to IPA HW |
| 1322 | * |
| 1323 | * Returns: 0 on success, negative on failure |
| 1324 | */ |
| 1325 | int ipa_table_dma_cmd(struct ipa_ioc_nat_dma_cmd *dma) |
| 1326 | { |
| 1327 | int ret; |
| 1328 | |
| 1329 | IPA_API_DISPATCH_RETURN(ipa_table_dma_cmd, dma); |
| 1330 | |
| 1331 | return ret; |
| 1332 | } |
| 1333 | EXPORT_SYMBOL(ipa_table_dma_cmd); |
| 1334 | |
| 1335 | /** |
| 1336 | * ipa_nat_del_cmd() - Delete the NAT table |
| 1337 | * @del: [in] delete NAT table parameters |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1338 | * |
| 1339 | * Called by NAT client driver to delete the nat table |
| 1340 | * |
| 1341 | * Returns: 0 on success, negative on failure |
| 1342 | */ |
| 1343 | int ipa_nat_del_cmd(struct ipa_ioc_v4_nat_del *del) |
| 1344 | { |
| 1345 | int ret; |
| 1346 | |
| 1347 | IPA_API_DISPATCH_RETURN(ipa_nat_del_cmd, del); |
| 1348 | |
| 1349 | return ret; |
| 1350 | } |
| 1351 | EXPORT_SYMBOL(ipa_nat_del_cmd); |
| 1352 | |
| 1353 | /** |
Amir Levy | 479cfdd | 2017-10-26 12:23:14 +0300 | [diff] [blame] | 1354 | * ipa_del_nat_table() - Delete the NAT table |
| 1355 | * @del: [in] delete table parameters |
| 1356 | * |
| 1357 | * Called by NAT client to delete the table |
| 1358 | * |
| 1359 | * Returns: 0 on success, negative on failure |
| 1360 | */ |
| 1361 | int ipa_del_nat_table(struct ipa_ioc_nat_ipv6ct_table_del *del) |
| 1362 | { |
| 1363 | int ret; |
| 1364 | |
| 1365 | IPA_API_DISPATCH_RETURN(ipa_del_nat_table, del); |
| 1366 | |
| 1367 | return ret; |
| 1368 | } |
| 1369 | EXPORT_SYMBOL(ipa_del_nat_table); |
| 1370 | |
| 1371 | /** |
| 1372 | * ipa_del_ipv6ct_table() - Delete the IPv6CT table |
| 1373 | * @del: [in] delete table parameters |
| 1374 | * |
| 1375 | * Called by IPv6CT client to delete the table |
| 1376 | * |
| 1377 | * Returns: 0 on success, negative on failure |
| 1378 | */ |
| 1379 | int ipa_del_ipv6ct_table(struct ipa_ioc_nat_ipv6ct_table_del *del) |
| 1380 | { |
| 1381 | int ret; |
| 1382 | |
| 1383 | IPA_API_DISPATCH_RETURN(ipa_del_ipv6ct_table, del); |
| 1384 | |
| 1385 | return ret; |
| 1386 | } |
| 1387 | EXPORT_SYMBOL(ipa_del_ipv6ct_table); |
| 1388 | |
| 1389 | /** |
| 1390 | * ipa3_nat_mdfy_pdn() - Modify a PDN entry in PDN config table in IPA SRAM |
| 1391 | * @mdfy_pdn: [in] PDN info to be written to SRAM |
| 1392 | * |
| 1393 | * Called by NAT client driver to modify an entry in the PDN config table |
| 1394 | * |
| 1395 | * Returns: 0 on success, negative on failure |
| 1396 | */ |
| 1397 | int ipa_nat_mdfy_pdn(struct ipa_ioc_nat_pdn_entry *mdfy_pdn) |
| 1398 | { |
| 1399 | int ret; |
| 1400 | |
| 1401 | IPA_API_DISPATCH_RETURN(ipa_nat_mdfy_pdn, mdfy_pdn); |
| 1402 | |
| 1403 | return ret; |
| 1404 | } |
| 1405 | EXPORT_SYMBOL(ipa_nat_mdfy_pdn); |
| 1406 | |
| 1407 | /** |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1408 | * ipa_send_msg() - Send "message" from kernel client to IPA driver |
| 1409 | * @meta: [in] message meta-data |
| 1410 | * @buff: [in] the payload for message |
| 1411 | * @callback: [in] free callback |
| 1412 | * |
| 1413 | * Client supplies the message meta-data and payload which IPA driver buffers |
| 1414 | * till read by user-space. After read from user space IPA driver invokes the |
| 1415 | * callback supplied to free the message payload. Client must not touch/free |
| 1416 | * the message payload after calling this API. |
| 1417 | * |
| 1418 | * Returns: 0 on success, negative on failure |
| 1419 | * |
| 1420 | * Note: Should not be called from atomic context |
| 1421 | */ |
| 1422 | int ipa_send_msg(struct ipa_msg_meta *meta, void *buff, |
| 1423 | ipa_msg_free_fn callback) |
| 1424 | { |
| 1425 | int ret; |
| 1426 | |
| 1427 | IPA_API_DISPATCH_RETURN(ipa_send_msg, meta, buff, callback); |
| 1428 | |
| 1429 | return ret; |
| 1430 | } |
| 1431 | EXPORT_SYMBOL(ipa_send_msg); |
| 1432 | |
| 1433 | /** |
| 1434 | * ipa_register_pull_msg() - register pull message type |
| 1435 | * @meta: [in] message meta-data |
| 1436 | * @callback: [in] pull callback |
| 1437 | * |
| 1438 | * Register message callback by kernel client with IPA driver for IPA driver to |
| 1439 | * pull message on-demand. |
| 1440 | * |
| 1441 | * Returns: 0 on success, negative on failure |
| 1442 | * |
| 1443 | * Note: Should not be called from atomic context |
| 1444 | */ |
| 1445 | int ipa_register_pull_msg(struct ipa_msg_meta *meta, ipa_msg_pull_fn callback) |
| 1446 | { |
| 1447 | int ret; |
| 1448 | |
| 1449 | IPA_API_DISPATCH_RETURN(ipa_register_pull_msg, meta, callback); |
| 1450 | |
| 1451 | return ret; |
| 1452 | } |
| 1453 | EXPORT_SYMBOL(ipa_register_pull_msg); |
| 1454 | |
| 1455 | /** |
| 1456 | * ipa_deregister_pull_msg() - De-register pull message type |
| 1457 | * @meta: [in] message meta-data |
| 1458 | * |
| 1459 | * De-register "message" by kernel client from IPA driver |
| 1460 | * |
| 1461 | * Returns: 0 on success, negative on failure |
| 1462 | * |
| 1463 | * Note: Should not be called from atomic context |
| 1464 | */ |
| 1465 | int ipa_deregister_pull_msg(struct ipa_msg_meta *meta) |
| 1466 | { |
| 1467 | int ret; |
| 1468 | |
| 1469 | IPA_API_DISPATCH_RETURN(ipa_deregister_pull_msg, meta); |
| 1470 | |
| 1471 | return ret; |
| 1472 | } |
| 1473 | EXPORT_SYMBOL(ipa_deregister_pull_msg); |
| 1474 | |
| 1475 | /** |
| 1476 | * ipa_register_intf() - register "logical" interface |
| 1477 | * @name: [in] interface name |
| 1478 | * @tx: [in] TX properties of the interface |
| 1479 | * @rx: [in] RX properties of the interface |
| 1480 | * |
| 1481 | * Register an interface and its tx and rx properties, this allows |
| 1482 | * configuration of rules from user-space |
| 1483 | * |
| 1484 | * Returns: 0 on success, negative on failure |
| 1485 | * |
| 1486 | * Note: Should not be called from atomic context |
| 1487 | */ |
| 1488 | int ipa_register_intf(const char *name, const struct ipa_tx_intf *tx, |
| 1489 | const struct ipa_rx_intf *rx) |
| 1490 | { |
| 1491 | int ret; |
| 1492 | |
| 1493 | IPA_API_DISPATCH_RETURN(ipa_register_intf, name, tx, rx); |
| 1494 | |
| 1495 | return ret; |
| 1496 | } |
| 1497 | EXPORT_SYMBOL(ipa_register_intf); |
| 1498 | |
| 1499 | /** |
| 1500 | * ipa_register_intf_ext() - register "logical" interface which has only |
| 1501 | * extended properties |
| 1502 | * @name: [in] interface name |
| 1503 | * @tx: [in] TX properties of the interface |
| 1504 | * @rx: [in] RX properties of the interface |
| 1505 | * @ext: [in] EXT properties of the interface |
| 1506 | * |
| 1507 | * Register an interface and its tx, rx and ext properties, this allows |
| 1508 | * configuration of rules from user-space |
| 1509 | * |
| 1510 | * Returns: 0 on success, negative on failure |
| 1511 | * |
| 1512 | * Note: Should not be called from atomic context |
| 1513 | */ |
| 1514 | int ipa_register_intf_ext(const char *name, const struct ipa_tx_intf *tx, |
| 1515 | const struct ipa_rx_intf *rx, |
| 1516 | const struct ipa_ext_intf *ext) |
| 1517 | { |
| 1518 | int ret; |
| 1519 | |
| 1520 | IPA_API_DISPATCH_RETURN(ipa_register_intf_ext, name, tx, rx, ext); |
| 1521 | |
| 1522 | return ret; |
| 1523 | } |
| 1524 | EXPORT_SYMBOL(ipa_register_intf_ext); |
| 1525 | |
| 1526 | /** |
| 1527 | * ipa_deregister_intf() - de-register previously registered logical interface |
| 1528 | * @name: [in] interface name |
| 1529 | * |
| 1530 | * De-register a previously registered interface |
| 1531 | * |
| 1532 | * Returns: 0 on success, negative on failure |
| 1533 | * |
| 1534 | * Note: Should not be called from atomic context |
| 1535 | */ |
| 1536 | int ipa_deregister_intf(const char *name) |
| 1537 | { |
| 1538 | int ret; |
| 1539 | |
| 1540 | IPA_API_DISPATCH_RETURN(ipa_deregister_intf, name); |
| 1541 | |
| 1542 | return ret; |
| 1543 | } |
| 1544 | EXPORT_SYMBOL(ipa_deregister_intf); |
| 1545 | |
| 1546 | /** |
| 1547 | * ipa_set_aggr_mode() - Set the aggregation mode which is a global setting |
| 1548 | * @mode: [in] the desired aggregation mode for e.g. straight MBIM, QCNCM, |
| 1549 | * etc |
| 1550 | * |
| 1551 | * Returns: 0 on success |
| 1552 | */ |
| 1553 | int ipa_set_aggr_mode(enum ipa_aggr_mode mode) |
| 1554 | { |
| 1555 | int ret; |
| 1556 | |
| 1557 | IPA_API_DISPATCH_RETURN(ipa_set_aggr_mode, mode); |
| 1558 | |
| 1559 | return ret; |
| 1560 | } |
| 1561 | EXPORT_SYMBOL(ipa_set_aggr_mode); |
| 1562 | |
| 1563 | |
| 1564 | /** |
| 1565 | * ipa_set_qcncm_ndp_sig() - Set the NDP signature used for QCNCM aggregation |
| 1566 | * mode |
| 1567 | * @sig: [in] the first 3 bytes of QCNCM NDP signature (expected to be |
| 1568 | * "QND") |
| 1569 | * |
| 1570 | * Set the NDP signature used for QCNCM aggregation mode. The fourth byte |
| 1571 | * (expected to be 'P') needs to be set using the header addition mechanism |
| 1572 | * |
| 1573 | * Returns: 0 on success, negative on failure |
| 1574 | */ |
| 1575 | int ipa_set_qcncm_ndp_sig(char sig[3]) |
| 1576 | { |
| 1577 | int ret; |
| 1578 | |
| 1579 | IPA_API_DISPATCH_RETURN(ipa_set_qcncm_ndp_sig, sig); |
| 1580 | |
| 1581 | return ret; |
| 1582 | } |
| 1583 | EXPORT_SYMBOL(ipa_set_qcncm_ndp_sig); |
| 1584 | |
| 1585 | /** |
| 1586 | * ipa_set_single_ndp_per_mbim() - Enable/disable single NDP per MBIM frame |
| 1587 | * configuration |
| 1588 | * @enable: [in] true for single NDP/MBIM; false otherwise |
| 1589 | * |
| 1590 | * Returns: 0 on success |
| 1591 | */ |
| 1592 | int ipa_set_single_ndp_per_mbim(bool enable) |
| 1593 | { |
| 1594 | int ret; |
| 1595 | |
| 1596 | IPA_API_DISPATCH_RETURN(ipa_set_single_ndp_per_mbim, enable); |
| 1597 | |
| 1598 | return ret; |
| 1599 | } |
| 1600 | EXPORT_SYMBOL(ipa_set_single_ndp_per_mbim); |
| 1601 | |
| 1602 | /** |
| 1603 | * ipa_tx_dp() - Data-path tx handler |
| 1604 | * @dst: [in] which IPA destination to route tx packets to |
| 1605 | * @skb: [in] the packet to send |
| 1606 | * @metadata: [in] TX packet meta-data |
| 1607 | * |
| 1608 | * Data-path tx handler, this is used for both SW data-path which by-passes most |
| 1609 | * IPA HW blocks AND the regular HW data-path for WLAN AMPDU traffic only. If |
| 1610 | * dst is a "valid" CONS type, then SW data-path is used. If dst is the |
| 1611 | * WLAN_AMPDU PROD type, then HW data-path for WLAN AMPDU is used. Anything else |
| 1612 | * is an error. For errors, client needs to free the skb as needed. For success, |
| 1613 | * IPA driver will later invoke client callback if one was supplied. That |
| 1614 | * callback should free the skb. If no callback supplied, IPA driver will free |
| 1615 | * the skb internally |
| 1616 | * |
| 1617 | * The function will use two descriptors for this send command |
| 1618 | * (for A5_WLAN_AMPDU_PROD only one desciprtor will be sent), |
| 1619 | * the first descriptor will be used to inform the IPA hardware that |
| 1620 | * apps need to push data into the IPA (IP_PACKET_INIT immediate command). |
| 1621 | * Once this send was done from SPS point-of-view the IPA driver will |
| 1622 | * get notified by the supplied callback - ipa_sps_irq_tx_comp() |
| 1623 | * |
| 1624 | * ipa_sps_irq_tx_comp will call to the user supplied |
| 1625 | * callback (from ipa_connect) |
| 1626 | * |
| 1627 | * Returns: 0 on success, negative on failure |
| 1628 | */ |
| 1629 | int ipa_tx_dp(enum ipa_client_type dst, struct sk_buff *skb, |
| 1630 | struct ipa_tx_meta *meta) |
| 1631 | { |
| 1632 | int ret; |
| 1633 | |
| 1634 | IPA_API_DISPATCH_RETURN(ipa_tx_dp, dst, skb, meta); |
| 1635 | |
| 1636 | return ret; |
| 1637 | } |
| 1638 | EXPORT_SYMBOL(ipa_tx_dp); |
| 1639 | |
| 1640 | /** |
| 1641 | * ipa_tx_dp_mul() - Data-path tx handler for multiple packets |
| 1642 | * @src: [in] - Client that is sending data |
| 1643 | * @ipa_tx_data_desc: [in] data descriptors from wlan |
| 1644 | * |
| 1645 | * this is used for to transfer data descriptors that received |
| 1646 | * from WLAN1_PROD pipe to IPA HW |
| 1647 | * |
| 1648 | * The function will send data descriptors from WLAN1_PROD (one |
| 1649 | * at a time) using sps_transfer_one. Will set EOT flag for last |
| 1650 | * descriptor Once this send was done from SPS point-of-view the |
| 1651 | * IPA driver will get notified by the supplied callback - |
| 1652 | * ipa_sps_irq_tx_no_aggr_notify() |
| 1653 | * |
| 1654 | * ipa_sps_irq_tx_no_aggr_notify will call to the user supplied |
| 1655 | * callback (from ipa_connect) |
| 1656 | * |
| 1657 | * Returns: 0 on success, negative on failure |
| 1658 | */ |
| 1659 | int ipa_tx_dp_mul(enum ipa_client_type src, |
| 1660 | struct ipa_tx_data_desc *data_desc) |
| 1661 | { |
| 1662 | int ret; |
| 1663 | |
| 1664 | IPA_API_DISPATCH_RETURN(ipa_tx_dp_mul, src, data_desc); |
| 1665 | |
| 1666 | return ret; |
| 1667 | } |
| 1668 | EXPORT_SYMBOL(ipa_tx_dp_mul); |
| 1669 | |
| 1670 | void ipa_free_skb(struct ipa_rx_data *data) |
| 1671 | { |
| 1672 | IPA_API_DISPATCH(ipa_free_skb, data); |
| 1673 | } |
| 1674 | EXPORT_SYMBOL(ipa_free_skb); |
| 1675 | |
| 1676 | /** |
| 1677 | * ipa_setup_sys_pipe() - Setup an IPA end-point in system-BAM mode and perform |
| 1678 | * IPA EP configuration |
| 1679 | * @sys_in: [in] input needed to setup BAM pipe and configure EP |
| 1680 | * @clnt_hdl: [out] client handle |
| 1681 | * |
| 1682 | * - configure the end-point registers with the supplied |
| 1683 | * parameters from the user. |
| 1684 | * - call SPS APIs to create a system-to-bam connection with IPA. |
| 1685 | * - allocate descriptor FIFO |
| 1686 | * - register callback function(ipa_sps_irq_rx_notify or |
| 1687 | * ipa_sps_irq_tx_notify - depends on client type) in case the driver is |
| 1688 | * not configured to pulling mode |
| 1689 | * |
| 1690 | * Returns: 0 on success, negative on failure |
| 1691 | */ |
| 1692 | int ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl) |
| 1693 | { |
| 1694 | int ret; |
| 1695 | |
| 1696 | IPA_API_DISPATCH_RETURN(ipa_setup_sys_pipe, sys_in, clnt_hdl); |
| 1697 | |
| 1698 | return ret; |
| 1699 | } |
| 1700 | EXPORT_SYMBOL(ipa_setup_sys_pipe); |
| 1701 | |
| 1702 | /** |
| 1703 | * ipa_teardown_sys_pipe() - Teardown the system-BAM pipe and cleanup IPA EP |
| 1704 | * @clnt_hdl: [in] the handle obtained from ipa_setup_sys_pipe |
| 1705 | * |
| 1706 | * Returns: 0 on success, negative on failure |
| 1707 | */ |
| 1708 | int ipa_teardown_sys_pipe(u32 clnt_hdl) |
| 1709 | { |
| 1710 | int ret; |
| 1711 | |
| 1712 | IPA_API_DISPATCH_RETURN(ipa_teardown_sys_pipe, clnt_hdl); |
| 1713 | |
| 1714 | return ret; |
| 1715 | } |
| 1716 | EXPORT_SYMBOL(ipa_teardown_sys_pipe); |
| 1717 | |
| 1718 | int ipa_sys_setup(struct ipa_sys_connect_params *sys_in, |
| 1719 | unsigned long *ipa_bam_or_gsi_hdl, |
| 1720 | u32 *ipa_pipe_num, u32 *clnt_hdl, bool en_status) |
| 1721 | |
| 1722 | { |
| 1723 | int ret; |
| 1724 | |
| 1725 | IPA_API_DISPATCH_RETURN(ipa_sys_setup, sys_in, ipa_bam_or_gsi_hdl, |
| 1726 | ipa_pipe_num, clnt_hdl, en_status); |
| 1727 | |
| 1728 | return ret; |
| 1729 | } |
| 1730 | EXPORT_SYMBOL(ipa_sys_setup); |
| 1731 | |
| 1732 | int ipa_sys_teardown(u32 clnt_hdl) |
| 1733 | { |
| 1734 | int ret; |
| 1735 | |
| 1736 | IPA_API_DISPATCH_RETURN(ipa_sys_teardown, clnt_hdl); |
| 1737 | |
| 1738 | return ret; |
| 1739 | } |
| 1740 | EXPORT_SYMBOL(ipa_sys_teardown); |
| 1741 | |
| 1742 | int ipa_sys_update_gsi_hdls(u32 clnt_hdl, unsigned long gsi_ch_hdl, |
| 1743 | unsigned long gsi_ev_hdl) |
| 1744 | { |
| 1745 | int ret; |
| 1746 | |
| 1747 | IPA_API_DISPATCH_RETURN(ipa_sys_update_gsi_hdls, clnt_hdl, |
| 1748 | gsi_ch_hdl, gsi_ev_hdl); |
| 1749 | |
| 1750 | return ret; |
| 1751 | } |
| 1752 | EXPORT_SYMBOL(ipa_sys_update_gsi_hdls); |
| 1753 | |
| 1754 | /** |
| 1755 | * ipa_connect_wdi_pipe() - WDI client connect |
| 1756 | * @in: [in] input parameters from client |
| 1757 | * @out: [out] output params to client |
| 1758 | * |
| 1759 | * Returns: 0 on success, negative on failure |
| 1760 | * |
| 1761 | * Note: Should not be called from atomic context |
| 1762 | */ |
| 1763 | int ipa_connect_wdi_pipe(struct ipa_wdi_in_params *in, |
| 1764 | struct ipa_wdi_out_params *out) |
| 1765 | { |
| 1766 | int ret; |
| 1767 | |
| 1768 | IPA_API_DISPATCH_RETURN(ipa_connect_wdi_pipe, in, out); |
| 1769 | |
| 1770 | return ret; |
| 1771 | } |
| 1772 | EXPORT_SYMBOL(ipa_connect_wdi_pipe); |
| 1773 | |
| 1774 | /** |
| 1775 | * ipa_disconnect_wdi_pipe() - WDI client disconnect |
| 1776 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 1777 | * |
| 1778 | * Returns: 0 on success, negative on failure |
| 1779 | * |
| 1780 | * Note: Should not be called from atomic context |
| 1781 | */ |
| 1782 | int ipa_disconnect_wdi_pipe(u32 clnt_hdl) |
| 1783 | { |
| 1784 | int ret; |
| 1785 | |
| 1786 | IPA_API_DISPATCH_RETURN(ipa_disconnect_wdi_pipe, clnt_hdl); |
| 1787 | |
| 1788 | return ret; |
| 1789 | } |
| 1790 | EXPORT_SYMBOL(ipa_disconnect_wdi_pipe); |
| 1791 | |
| 1792 | /** |
| 1793 | * ipa_enable_wdi_pipe() - WDI client enable |
| 1794 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 1795 | * |
| 1796 | * Returns: 0 on success, negative on failure |
| 1797 | * |
| 1798 | * Note: Should not be called from atomic context |
| 1799 | */ |
| 1800 | int ipa_enable_wdi_pipe(u32 clnt_hdl) |
| 1801 | { |
| 1802 | int ret; |
| 1803 | |
| 1804 | IPA_API_DISPATCH_RETURN(ipa_enable_wdi_pipe, clnt_hdl); |
| 1805 | |
| 1806 | return ret; |
| 1807 | } |
| 1808 | EXPORT_SYMBOL(ipa_enable_wdi_pipe); |
| 1809 | |
| 1810 | /** |
| 1811 | * ipa_disable_wdi_pipe() - WDI client disable |
| 1812 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 1813 | * |
| 1814 | * Returns: 0 on success, negative on failure |
| 1815 | * |
| 1816 | * Note: Should not be called from atomic context |
| 1817 | */ |
| 1818 | int ipa_disable_wdi_pipe(u32 clnt_hdl) |
| 1819 | { |
| 1820 | int ret; |
| 1821 | |
| 1822 | IPA_API_DISPATCH_RETURN(ipa_disable_wdi_pipe, clnt_hdl); |
| 1823 | |
| 1824 | return ret; |
| 1825 | } |
| 1826 | EXPORT_SYMBOL(ipa_disable_wdi_pipe); |
| 1827 | |
| 1828 | /** |
| 1829 | * ipa_resume_wdi_pipe() - WDI client resume |
| 1830 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 1831 | * |
| 1832 | * Returns: 0 on success, negative on failure |
| 1833 | * |
| 1834 | * Note: Should not be called from atomic context |
| 1835 | */ |
| 1836 | int ipa_resume_wdi_pipe(u32 clnt_hdl) |
| 1837 | { |
| 1838 | int ret; |
| 1839 | |
| 1840 | IPA_API_DISPATCH_RETURN(ipa_resume_wdi_pipe, clnt_hdl); |
| 1841 | |
| 1842 | return ret; |
| 1843 | } |
| 1844 | EXPORT_SYMBOL(ipa_resume_wdi_pipe); |
| 1845 | |
| 1846 | /** |
| 1847 | * ipa_suspend_wdi_pipe() - WDI client suspend |
| 1848 | * @clnt_hdl: [in] opaque client handle assigned by IPA to client |
| 1849 | * |
| 1850 | * Returns: 0 on success, negative on failure |
| 1851 | * |
| 1852 | * Note: Should not be called from atomic context |
| 1853 | */ |
| 1854 | int ipa_suspend_wdi_pipe(u32 clnt_hdl) |
| 1855 | { |
| 1856 | int ret; |
| 1857 | |
| 1858 | IPA_API_DISPATCH_RETURN(ipa_suspend_wdi_pipe, clnt_hdl); |
| 1859 | |
| 1860 | return ret; |
| 1861 | } |
| 1862 | EXPORT_SYMBOL(ipa_suspend_wdi_pipe); |
| 1863 | |
| 1864 | /** |
| 1865 | * ipa_get_wdi_stats() - Query WDI statistics from uc |
| 1866 | * @stats: [inout] stats blob from client populated by driver |
| 1867 | * |
| 1868 | * Returns: 0 on success, negative on failure |
| 1869 | * |
| 1870 | * @note Cannot be called from atomic context |
| 1871 | * |
| 1872 | */ |
| 1873 | int ipa_get_wdi_stats(struct IpaHwStatsWDIInfoData_t *stats) |
| 1874 | { |
| 1875 | int ret; |
| 1876 | |
| 1877 | IPA_API_DISPATCH_RETURN(ipa_get_wdi_stats, stats); |
| 1878 | |
| 1879 | return ret; |
| 1880 | } |
| 1881 | EXPORT_SYMBOL(ipa_get_wdi_stats); |
| 1882 | |
| 1883 | /** |
| 1884 | * ipa_get_smem_restr_bytes()- Return IPA smem restricted bytes |
| 1885 | * |
| 1886 | * Return value: u16 - number of IPA smem restricted bytes |
| 1887 | */ |
| 1888 | u16 ipa_get_smem_restr_bytes(void) |
| 1889 | { |
| 1890 | int ret; |
| 1891 | |
| 1892 | IPA_API_DISPATCH_RETURN(ipa_get_smem_restr_bytes); |
| 1893 | |
| 1894 | return ret; |
| 1895 | } |
| 1896 | EXPORT_SYMBOL(ipa_get_smem_restr_bytes); |
| 1897 | |
| 1898 | /** |
Skylar Chang | 6b41f8d | 2016-11-01 12:50:11 -0700 | [diff] [blame] | 1899 | * ipa_broadcast_wdi_quota_reach_ind() - quota reach |
| 1900 | * @uint32_t fid: [in] input netdev ID |
| 1901 | * @uint64_t num_bytes: [in] used bytes |
| 1902 | * |
| 1903 | * Returns: 0 on success, negative on failure |
| 1904 | */ |
| 1905 | int ipa_broadcast_wdi_quota_reach_ind(uint32_t fid, |
| 1906 | uint64_t num_bytes) |
| 1907 | { |
| 1908 | int ret; |
| 1909 | |
| 1910 | IPA_API_DISPATCH_RETURN(ipa_broadcast_wdi_quota_reach_ind, |
| 1911 | fid, num_bytes); |
| 1912 | |
| 1913 | return ret; |
| 1914 | } |
| 1915 | EXPORT_SYMBOL(ipa_broadcast_wdi_quota_reach_ind); |
| 1916 | |
| 1917 | /** |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1918 | * ipa_uc_wdi_get_dbpa() - To retrieve |
| 1919 | * doorbell physical address of wlan pipes |
| 1920 | * @param: [in/out] input/output parameters |
| 1921 | * from/to client |
| 1922 | * |
| 1923 | * Returns: 0 on success, negative on failure |
| 1924 | * |
| 1925 | */ |
| 1926 | int ipa_uc_wdi_get_dbpa( |
| 1927 | struct ipa_wdi_db_params *param) |
| 1928 | { |
| 1929 | int ret; |
| 1930 | |
| 1931 | IPA_API_DISPATCH_RETURN(ipa_uc_wdi_get_dbpa, param); |
| 1932 | |
| 1933 | return ret; |
| 1934 | } |
| 1935 | EXPORT_SYMBOL(ipa_uc_wdi_get_dbpa); |
| 1936 | |
| 1937 | /** |
| 1938 | * ipa_uc_reg_rdyCB() - To register uC |
| 1939 | * ready CB if uC not ready |
| 1940 | * @inout: [in/out] input/output parameters |
| 1941 | * from/to client |
| 1942 | * |
| 1943 | * Returns: 0 on success, negative on failure |
| 1944 | * |
| 1945 | */ |
| 1946 | int ipa_uc_reg_rdyCB( |
| 1947 | struct ipa_wdi_uc_ready_params *inout) |
| 1948 | { |
| 1949 | int ret; |
| 1950 | |
| 1951 | IPA_API_DISPATCH_RETURN(ipa_uc_reg_rdyCB, inout); |
| 1952 | |
| 1953 | return ret; |
| 1954 | } |
| 1955 | EXPORT_SYMBOL(ipa_uc_reg_rdyCB); |
| 1956 | |
| 1957 | /** |
| 1958 | * ipa_uc_dereg_rdyCB() - To de-register uC ready CB |
| 1959 | * |
| 1960 | * Returns: 0 on success, negative on failure |
| 1961 | * |
| 1962 | */ |
| 1963 | int ipa_uc_dereg_rdyCB(void) |
| 1964 | { |
| 1965 | int ret; |
| 1966 | |
| 1967 | IPA_API_DISPATCH_RETURN(ipa_uc_dereg_rdyCB); |
| 1968 | |
| 1969 | return ret; |
| 1970 | } |
| 1971 | EXPORT_SYMBOL(ipa_uc_dereg_rdyCB); |
| 1972 | |
| 1973 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 1974 | * teth_bridge_init() - Initialize the Tethering bridge driver |
| 1975 | * @params - in/out params for USB initialization API (please look at struct |
| 1976 | * definition for more info) |
| 1977 | * |
| 1978 | * USB driver gets a pointer to a callback function (usb_notify_cb) and an |
| 1979 | * associated data. USB driver installs this callback function in the call to |
| 1980 | * ipa_connect(). |
| 1981 | * |
| 1982 | * Builds IPA resource manager dependency graph. |
| 1983 | * |
| 1984 | * Return codes: 0: success, |
| 1985 | * -EINVAL - Bad parameter |
| 1986 | * Other negative value - Failure |
| 1987 | */ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 1988 | int teth_bridge_init(struct teth_bridge_init_params *params) |
| 1989 | { |
| 1990 | int ret; |
| 1991 | |
| 1992 | IPA_API_DISPATCH_RETURN(teth_bridge_init, params); |
| 1993 | |
| 1994 | return ret; |
| 1995 | } |
| 1996 | EXPORT_SYMBOL(teth_bridge_init); |
| 1997 | |
| 1998 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 1999 | * teth_bridge_disconnect() - Disconnect tethering bridge module |
| 2000 | */ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 2001 | int teth_bridge_disconnect(enum ipa_client_type client) |
| 2002 | { |
| 2003 | int ret; |
| 2004 | |
| 2005 | IPA_API_DISPATCH_RETURN(teth_bridge_disconnect, client); |
| 2006 | |
| 2007 | return ret; |
| 2008 | } |
| 2009 | EXPORT_SYMBOL(teth_bridge_disconnect); |
| 2010 | |
| 2011 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 2012 | * teth_bridge_connect() - Connect bridge for a tethered Rmnet / MBIM call |
| 2013 | * @connect_params: Connection info |
| 2014 | * |
| 2015 | * Return codes: 0: success |
| 2016 | * -EINVAL: invalid parameters |
| 2017 | * -EPERM: Operation not permitted as the bridge is already |
| 2018 | * connected |
| 2019 | */ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 2020 | int teth_bridge_connect(struct teth_bridge_connect_params *connect_params) |
| 2021 | { |
| 2022 | int ret; |
| 2023 | |
| 2024 | IPA_API_DISPATCH_RETURN(teth_bridge_connect, connect_params); |
| 2025 | |
| 2026 | return ret; |
| 2027 | } |
| 2028 | EXPORT_SYMBOL(teth_bridge_connect); |
| 2029 | |
| 2030 | /* ipa_set_client() - provide client mapping |
| 2031 | * @client: client type |
| 2032 | * |
| 2033 | * Return value: none |
| 2034 | */ |
| 2035 | |
| 2036 | void ipa_set_client(int index, enum ipacm_client_enum client, bool uplink) |
| 2037 | { |
| 2038 | IPA_API_DISPATCH(ipa_set_client, index, client, uplink); |
| 2039 | } |
| 2040 | EXPORT_SYMBOL(ipa_set_client); |
| 2041 | |
| 2042 | /** |
| 2043 | * ipa_get_client() - provide client mapping |
| 2044 | * @client: client type |
| 2045 | * |
| 2046 | * Return value: none |
| 2047 | */ |
| 2048 | enum ipacm_client_enum ipa_get_client(int pipe_idx) |
| 2049 | { |
| 2050 | int ret; |
| 2051 | |
| 2052 | IPA_API_DISPATCH_RETURN(ipa_get_client, pipe_idx); |
| 2053 | |
| 2054 | return ret; |
| 2055 | } |
| 2056 | EXPORT_SYMBOL(ipa_get_client); |
| 2057 | |
| 2058 | /** |
| 2059 | * ipa_get_client_uplink() - provide client mapping |
| 2060 | * @client: client type |
| 2061 | * |
| 2062 | * Return value: none |
| 2063 | */ |
| 2064 | bool ipa_get_client_uplink(int pipe_idx) |
| 2065 | { |
| 2066 | int ret; |
| 2067 | |
| 2068 | IPA_API_DISPATCH_RETURN(ipa_get_client_uplink, pipe_idx); |
| 2069 | |
| 2070 | return ret; |
| 2071 | } |
| 2072 | EXPORT_SYMBOL(ipa_get_client_uplink); |
| 2073 | |
| 2074 | /** |
| 2075 | * ipa_dma_init() -Initialize IPADMA. |
| 2076 | * |
| 2077 | * This function initialize all IPADMA internal data and connect in dma: |
| 2078 | * MEMCPY_DMA_SYNC_PROD ->MEMCPY_DMA_SYNC_CONS |
| 2079 | * MEMCPY_DMA_ASYNC_PROD->MEMCPY_DMA_SYNC_CONS |
| 2080 | * |
| 2081 | * Return codes: 0: success |
| 2082 | * -EFAULT: IPADMA is already initialized |
| 2083 | * -ENOMEM: allocating memory error |
| 2084 | * -EPERM: pipe connection failed |
| 2085 | */ |
| 2086 | int ipa_dma_init(void) |
| 2087 | { |
| 2088 | int ret; |
| 2089 | |
| 2090 | IPA_API_DISPATCH_RETURN(ipa_dma_init); |
| 2091 | |
| 2092 | return ret; |
| 2093 | } |
| 2094 | EXPORT_SYMBOL(ipa_dma_init); |
| 2095 | |
| 2096 | /** |
| 2097 | * ipa_dma_enable() -Vote for IPA clocks. |
| 2098 | * |
| 2099 | *Return codes: 0: success |
| 2100 | * -EINVAL: IPADMA is not initialized |
| 2101 | * -EPERM: Operation not permitted as ipa_dma is already |
| 2102 | * enabled |
| 2103 | */ |
| 2104 | int ipa_dma_enable(void) |
| 2105 | { |
| 2106 | int ret; |
| 2107 | |
| 2108 | IPA_API_DISPATCH_RETURN(ipa_dma_enable); |
| 2109 | |
| 2110 | return ret; |
| 2111 | } |
| 2112 | EXPORT_SYMBOL(ipa_dma_enable); |
| 2113 | |
| 2114 | /** |
| 2115 | * ipa_dma_disable()- Unvote for IPA clocks. |
| 2116 | * |
| 2117 | * enter to power save mode. |
| 2118 | * |
| 2119 | * Return codes: 0: success |
| 2120 | * -EINVAL: IPADMA is not initialized |
| 2121 | * -EPERM: Operation not permitted as ipa_dma is already |
| 2122 | * diabled |
| 2123 | * -EFAULT: can not disable ipa_dma as there are pending |
| 2124 | * memcopy works |
| 2125 | */ |
| 2126 | int ipa_dma_disable(void) |
| 2127 | { |
| 2128 | int ret; |
| 2129 | |
| 2130 | IPA_API_DISPATCH_RETURN(ipa_dma_disable); |
| 2131 | |
| 2132 | return ret; |
| 2133 | } |
| 2134 | EXPORT_SYMBOL(ipa_dma_disable); |
| 2135 | |
| 2136 | /** |
| 2137 | * ipa_dma_sync_memcpy()- Perform synchronous memcpy using IPA. |
| 2138 | * |
| 2139 | * @dest: physical address to store the copied data. |
| 2140 | * @src: physical address of the source data to copy. |
| 2141 | * @len: number of bytes to copy. |
| 2142 | * |
| 2143 | * Return codes: 0: success |
| 2144 | * -EINVAL: invalid params |
| 2145 | * -EPERM: operation not permitted as ipa_dma isn't enable or |
| 2146 | * initialized |
| 2147 | * -SPS_ERROR: on sps faliures |
| 2148 | * -EFAULT: other |
| 2149 | */ |
| 2150 | int ipa_dma_sync_memcpy(u64 dest, u64 src, int len) |
| 2151 | { |
| 2152 | int ret; |
| 2153 | |
| 2154 | IPA_API_DISPATCH_RETURN(ipa_dma_sync_memcpy, dest, src, len); |
| 2155 | |
| 2156 | return ret; |
| 2157 | } |
| 2158 | EXPORT_SYMBOL(ipa_dma_sync_memcpy); |
| 2159 | |
| 2160 | /** |
| 2161 | * ipa_dma_async_memcpy()- Perform asynchronous memcpy using IPA. |
| 2162 | * |
| 2163 | * @dest: physical address to store the copied data. |
| 2164 | * @src: physical address of the source data to copy. |
| 2165 | * @len: number of bytes to copy. |
| 2166 | * @user_cb: callback function to notify the client when the copy was done. |
| 2167 | * @user_param: cookie for user_cb. |
| 2168 | * |
| 2169 | * Return codes: 0: success |
| 2170 | * -EINVAL: invalid params |
| 2171 | * -EPERM: operation not permitted as ipa_dma isn't enable or |
| 2172 | * initialized |
| 2173 | * -SPS_ERROR: on sps faliures |
| 2174 | * -EFAULT: descr fifo is full. |
| 2175 | */ |
| 2176 | int ipa_dma_async_memcpy(u64 dest, u64 src, int len, |
| 2177 | void (*user_cb)(void *user1), void *user_param) |
| 2178 | { |
| 2179 | int ret; |
| 2180 | |
| 2181 | IPA_API_DISPATCH_RETURN(ipa_dma_async_memcpy, dest, src, len, user_cb, |
| 2182 | user_param); |
| 2183 | |
| 2184 | return ret; |
| 2185 | } |
| 2186 | EXPORT_SYMBOL(ipa_dma_async_memcpy); |
| 2187 | |
| 2188 | /** |
| 2189 | * ipa_dma_uc_memcpy() - Perform a memcpy action using IPA uC |
| 2190 | * @dest: physical address to store the copied data. |
| 2191 | * @src: physical address of the source data to copy. |
| 2192 | * @len: number of bytes to copy. |
| 2193 | * |
| 2194 | * Return codes: 0: success |
| 2195 | * -EINVAL: invalid params |
| 2196 | * -EPERM: operation not permitted as ipa_dma isn't enable or |
| 2197 | * initialized |
| 2198 | * -EBADF: IPA uC is not loaded |
| 2199 | */ |
| 2200 | int ipa_dma_uc_memcpy(phys_addr_t dest, phys_addr_t src, int len) |
| 2201 | { |
| 2202 | int ret; |
| 2203 | |
| 2204 | IPA_API_DISPATCH_RETURN(ipa_dma_uc_memcpy, dest, src, len); |
| 2205 | |
| 2206 | return ret; |
| 2207 | } |
| 2208 | EXPORT_SYMBOL(ipa_dma_uc_memcpy); |
| 2209 | |
| 2210 | /** |
| 2211 | * ipa_dma_destroy() -teardown IPADMA pipes and release ipadma. |
| 2212 | * |
| 2213 | * this is a blocking function, returns just after destroying IPADMA. |
| 2214 | */ |
| 2215 | void ipa_dma_destroy(void) |
| 2216 | { |
| 2217 | IPA_API_DISPATCH(ipa_dma_destroy); |
| 2218 | } |
| 2219 | EXPORT_SYMBOL(ipa_dma_destroy); |
| 2220 | |
| 2221 | int ipa_mhi_init_engine(struct ipa_mhi_init_engine *params) |
| 2222 | { |
| 2223 | int ret; |
| 2224 | |
| 2225 | IPA_API_DISPATCH_RETURN(ipa_mhi_init_engine, params); |
| 2226 | |
| 2227 | return ret; |
| 2228 | } |
| 2229 | EXPORT_SYMBOL(ipa_mhi_init_engine); |
| 2230 | |
| 2231 | /** |
| 2232 | * ipa_connect_mhi_pipe() - Connect pipe to IPA and start corresponding |
| 2233 | * MHI channel |
| 2234 | * @in: connect parameters |
| 2235 | * @clnt_hdl: [out] client handle for this pipe |
| 2236 | * |
| 2237 | * This function is called by IPA MHI client driver on MHI channel start. |
| 2238 | * This function is called after MHI engine was started. |
| 2239 | * This function is doing the following: |
| 2240 | * - Send command to uC to start corresponding MHI channel |
| 2241 | * - Configure IPA EP control |
| 2242 | * |
| 2243 | * Return codes: 0 : success |
| 2244 | * negative : error |
| 2245 | */ |
| 2246 | int ipa_connect_mhi_pipe(struct ipa_mhi_connect_params_internal *in, |
| 2247 | u32 *clnt_hdl) |
| 2248 | { |
| 2249 | int ret; |
| 2250 | |
| 2251 | IPA_API_DISPATCH_RETURN(ipa_connect_mhi_pipe, in, clnt_hdl); |
| 2252 | |
| 2253 | return ret; |
| 2254 | } |
| 2255 | EXPORT_SYMBOL(ipa_connect_mhi_pipe); |
| 2256 | |
| 2257 | /** |
| 2258 | * ipa_disconnect_mhi_pipe() - Disconnect pipe from IPA and reset corresponding |
| 2259 | * MHI channel |
| 2260 | * @in: connect parameters |
| 2261 | * @clnt_hdl: [out] client handle for this pipe |
| 2262 | * |
| 2263 | * This function is called by IPA MHI client driver on MHI channel reset. |
| 2264 | * This function is called after MHI channel was started. |
| 2265 | * This function is doing the following: |
| 2266 | * - Send command to uC to reset corresponding MHI channel |
| 2267 | * - Configure IPA EP control |
| 2268 | * |
| 2269 | * Return codes: 0 : success |
| 2270 | * negative : error |
| 2271 | */ |
| 2272 | int ipa_disconnect_mhi_pipe(u32 clnt_hdl) |
| 2273 | { |
| 2274 | int ret; |
| 2275 | |
| 2276 | IPA_API_DISPATCH_RETURN(ipa_disconnect_mhi_pipe, clnt_hdl); |
| 2277 | |
| 2278 | return ret; |
| 2279 | } |
| 2280 | EXPORT_SYMBOL(ipa_disconnect_mhi_pipe); |
| 2281 | |
| 2282 | bool ipa_mhi_stop_gsi_channel(enum ipa_client_type client) |
| 2283 | { |
| 2284 | bool ret; |
| 2285 | |
| 2286 | IPA_API_DISPATCH_RETURN_BOOL(ipa_mhi_stop_gsi_channel, client); |
| 2287 | |
| 2288 | return ret; |
| 2289 | } |
| 2290 | |
| 2291 | int ipa_uc_mhi_reset_channel(int channelHandle) |
| 2292 | { |
| 2293 | int ret; |
| 2294 | |
| 2295 | IPA_API_DISPATCH_RETURN(ipa_uc_mhi_reset_channel, channelHandle); |
| 2296 | |
| 2297 | return ret; |
| 2298 | } |
| 2299 | |
| 2300 | bool ipa_mhi_sps_channel_empty(enum ipa_client_type client) |
| 2301 | { |
| 2302 | bool ret; |
| 2303 | |
| 2304 | IPA_API_DISPATCH_RETURN_BOOL(ipa_mhi_sps_channel_empty, client); |
| 2305 | |
| 2306 | return ret; |
| 2307 | } |
| 2308 | |
| 2309 | int ipa_qmi_enable_force_clear_datapath_send( |
| 2310 | struct ipa_enable_force_clear_datapath_req_msg_v01 *req) |
| 2311 | { |
| 2312 | int ret; |
| 2313 | |
| 2314 | IPA_API_DISPATCH_RETURN(ipa_qmi_enable_force_clear_datapath_send, req); |
| 2315 | |
| 2316 | return ret; |
| 2317 | } |
| 2318 | |
| 2319 | int ipa_qmi_disable_force_clear_datapath_send( |
| 2320 | struct ipa_disable_force_clear_datapath_req_msg_v01 *req) |
| 2321 | { |
| 2322 | int ret; |
| 2323 | |
| 2324 | IPA_API_DISPATCH_RETURN(ipa_qmi_disable_force_clear_datapath_send, req); |
| 2325 | |
| 2326 | return ret; |
| 2327 | } |
| 2328 | |
| 2329 | int ipa_generate_tag_process(void) |
| 2330 | { |
| 2331 | int ret; |
| 2332 | |
| 2333 | IPA_API_DISPATCH_RETURN(ipa_generate_tag_process); |
| 2334 | |
| 2335 | return ret; |
| 2336 | } |
| 2337 | |
| 2338 | int ipa_disable_sps_pipe(enum ipa_client_type client) |
| 2339 | { |
| 2340 | int ret; |
| 2341 | |
| 2342 | IPA_API_DISPATCH_RETURN(ipa_disable_sps_pipe, client); |
| 2343 | |
| 2344 | return ret; |
| 2345 | } |
| 2346 | |
| 2347 | int ipa_mhi_reset_channel_internal(enum ipa_client_type client) |
| 2348 | { |
| 2349 | int ret; |
| 2350 | |
| 2351 | IPA_API_DISPATCH_RETURN(ipa_mhi_reset_channel_internal, client); |
| 2352 | |
| 2353 | return ret; |
| 2354 | } |
| 2355 | |
| 2356 | int ipa_mhi_start_channel_internal(enum ipa_client_type client) |
| 2357 | { |
| 2358 | int ret; |
| 2359 | |
| 2360 | IPA_API_DISPATCH_RETURN(ipa_mhi_start_channel_internal, client); |
| 2361 | |
| 2362 | return ret; |
| 2363 | } |
| 2364 | |
| 2365 | void ipa_get_holb(int ep_idx, struct ipa_ep_cfg_holb *holb) |
| 2366 | { |
| 2367 | IPA_API_DISPATCH(ipa_get_holb, ep_idx, holb); |
| 2368 | } |
| 2369 | |
| 2370 | void ipa_set_tag_process_before_gating(bool val) |
| 2371 | { |
| 2372 | IPA_API_DISPATCH(ipa_set_tag_process_before_gating, val); |
| 2373 | } |
| 2374 | |
| 2375 | int ipa_mhi_query_ch_info(enum ipa_client_type client, |
| 2376 | struct gsi_chan_info *ch_info) |
| 2377 | { |
| 2378 | int ret; |
| 2379 | |
| 2380 | IPA_API_DISPATCH_RETURN(ipa_mhi_query_ch_info, client, ch_info); |
| 2381 | |
| 2382 | return ret; |
| 2383 | } |
| 2384 | |
| 2385 | int ipa_uc_mhi_suspend_channel(int channelHandle) |
| 2386 | { |
| 2387 | int ret; |
| 2388 | |
| 2389 | IPA_API_DISPATCH_RETURN(ipa_uc_mhi_suspend_channel, channelHandle); |
| 2390 | |
| 2391 | return ret; |
| 2392 | } |
| 2393 | |
| 2394 | int ipa_uc_mhi_stop_event_update_channel(int channelHandle) |
| 2395 | { |
| 2396 | int ret; |
| 2397 | |
| 2398 | IPA_API_DISPATCH_RETURN(ipa_uc_mhi_stop_event_update_channel, |
| 2399 | channelHandle); |
| 2400 | |
| 2401 | return ret; |
| 2402 | } |
| 2403 | |
| 2404 | bool ipa_has_open_aggr_frame(enum ipa_client_type client) |
| 2405 | { |
| 2406 | bool ret; |
| 2407 | |
| 2408 | IPA_API_DISPATCH_RETURN_BOOL(ipa_has_open_aggr_frame, client); |
| 2409 | |
| 2410 | return ret; |
| 2411 | } |
| 2412 | |
| 2413 | int ipa_mhi_resume_channels_internal(enum ipa_client_type client, |
| 2414 | bool LPTransitionRejected, bool brstmode_enabled, |
| 2415 | union __packed gsi_channel_scratch ch_scratch, u8 index) |
| 2416 | { |
| 2417 | int ret; |
| 2418 | |
| 2419 | IPA_API_DISPATCH_RETURN(ipa_mhi_resume_channels_internal, client, |
| 2420 | LPTransitionRejected, brstmode_enabled, ch_scratch, |
| 2421 | index); |
| 2422 | |
| 2423 | return ret; |
| 2424 | } |
| 2425 | |
| 2426 | int ipa_uc_mhi_send_dl_ul_sync_info(union IpaHwMhiDlUlSyncCmdData_t *cmd) |
| 2427 | { |
| 2428 | int ret; |
| 2429 | |
| 2430 | IPA_API_DISPATCH_RETURN(ipa_uc_mhi_send_dl_ul_sync_info, |
| 2431 | cmd); |
| 2432 | |
| 2433 | return ret; |
| 2434 | } |
| 2435 | |
| 2436 | int ipa_mhi_destroy_channel(enum ipa_client_type client) |
| 2437 | { |
| 2438 | int ret; |
| 2439 | |
| 2440 | IPA_API_DISPATCH_RETURN(ipa_mhi_destroy_channel, client); |
| 2441 | |
| 2442 | return ret; |
| 2443 | } |
| 2444 | |
| 2445 | int ipa_uc_mhi_init(void (*ready_cb)(void), |
| 2446 | void (*wakeup_request_cb)(void)) |
| 2447 | { |
| 2448 | int ret; |
| 2449 | |
| 2450 | IPA_API_DISPATCH_RETURN(ipa_uc_mhi_init, ready_cb, wakeup_request_cb); |
| 2451 | |
| 2452 | return ret; |
| 2453 | } |
| 2454 | |
| 2455 | void ipa_uc_mhi_cleanup(void) |
| 2456 | { |
| 2457 | IPA_API_DISPATCH(ipa_uc_mhi_cleanup); |
| 2458 | } |
| 2459 | |
| 2460 | int ipa_uc_mhi_print_stats(char *dbg_buff, int size) |
| 2461 | { |
| 2462 | int ret; |
| 2463 | |
| 2464 | IPA_API_DISPATCH_RETURN(ipa_uc_mhi_print_stats, dbg_buff, size); |
| 2465 | |
| 2466 | return ret; |
| 2467 | } |
| 2468 | |
| 2469 | /** |
| 2470 | * ipa_uc_state_check() - Check the status of the uC interface |
| 2471 | * |
| 2472 | * Return value: 0 if the uC is loaded, interface is initialized |
| 2473 | * and there was no recent failure in one of the commands. |
| 2474 | * A negative value is returned otherwise. |
| 2475 | */ |
| 2476 | int ipa_uc_state_check(void) |
| 2477 | { |
| 2478 | int ret; |
| 2479 | |
| 2480 | IPA_API_DISPATCH_RETURN(ipa_uc_state_check); |
| 2481 | |
| 2482 | return ret; |
| 2483 | } |
| 2484 | |
| 2485 | int ipa_write_qmap_id(struct ipa_ioc_write_qmapid *param_in) |
| 2486 | { |
| 2487 | int ret; |
| 2488 | |
| 2489 | IPA_API_DISPATCH_RETURN(ipa_write_qmap_id, param_in); |
| 2490 | |
| 2491 | return ret; |
| 2492 | } |
| 2493 | EXPORT_SYMBOL(ipa_write_qmap_id); |
| 2494 | |
| 2495 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 2496 | * ipa_add_interrupt_handler() - Adds handler to an interrupt type |
| 2497 | * @interrupt: Interrupt type |
| 2498 | * @handler: The handler to be added |
| 2499 | * @deferred_flag: whether the handler processing should be deferred in |
| 2500 | * a workqueue |
| 2501 | * @private_data: the client's private data |
| 2502 | * |
| 2503 | * Adds handler to an interrupt type and enable the specific bit |
| 2504 | * in IRQ_EN register, associated interrupt in IRQ_STTS register will be enabled |
| 2505 | */ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 2506 | int ipa_add_interrupt_handler(enum ipa_irq_type interrupt, |
| 2507 | ipa_irq_handler_t handler, |
| 2508 | bool deferred_flag, |
| 2509 | void *private_data) |
| 2510 | { |
| 2511 | int ret; |
| 2512 | |
| 2513 | IPA_API_DISPATCH_RETURN(ipa_add_interrupt_handler, interrupt, handler, |
| 2514 | deferred_flag, private_data); |
| 2515 | |
| 2516 | return ret; |
| 2517 | } |
| 2518 | EXPORT_SYMBOL(ipa_add_interrupt_handler); |
| 2519 | |
| 2520 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 2521 | * ipa_remove_interrupt_handler() - Removes handler to an interrupt type |
| 2522 | * @interrupt: Interrupt type |
| 2523 | * |
| 2524 | * Removes the handler and disable the specific bit in IRQ_EN register |
| 2525 | */ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 2526 | int ipa_remove_interrupt_handler(enum ipa_irq_type interrupt) |
| 2527 | { |
| 2528 | int ret; |
| 2529 | |
| 2530 | IPA_API_DISPATCH_RETURN(ipa_remove_interrupt_handler, interrupt); |
| 2531 | |
| 2532 | return ret; |
| 2533 | } |
| 2534 | EXPORT_SYMBOL(ipa_remove_interrupt_handler); |
| 2535 | |
| 2536 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 2537 | * ipa_restore_suspend_handler() - restores the original suspend IRQ handler |
| 2538 | * as it was registered in the IPA init sequence. |
| 2539 | * Return codes: |
| 2540 | * 0: success |
| 2541 | * -EPERM: failed to remove current handler or failed to add original handler |
| 2542 | */ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 2543 | int ipa_restore_suspend_handler(void) |
| 2544 | { |
| 2545 | int ret; |
| 2546 | |
| 2547 | IPA_API_DISPATCH_RETURN(ipa_restore_suspend_handler); |
| 2548 | |
| 2549 | return ret; |
| 2550 | } |
| 2551 | EXPORT_SYMBOL(ipa_restore_suspend_handler); |
| 2552 | |
| 2553 | /** |
| 2554 | * ipa_bam_reg_dump() - Dump selected BAM registers for IPA and DMA-BAM |
| 2555 | * |
| 2556 | * Function is rate limited to avoid flooding kernel log buffer |
| 2557 | */ |
| 2558 | void ipa_bam_reg_dump(void) |
| 2559 | { |
| 2560 | IPA_API_DISPATCH(ipa_bam_reg_dump); |
| 2561 | } |
| 2562 | EXPORT_SYMBOL(ipa_bam_reg_dump); |
| 2563 | |
| 2564 | /** |
| 2565 | * ipa_get_ep_mapping() - provide endpoint mapping |
| 2566 | * @client: client type |
| 2567 | * |
| 2568 | * Return value: endpoint mapping |
| 2569 | */ |
| 2570 | int ipa_get_ep_mapping(enum ipa_client_type client) |
| 2571 | { |
| 2572 | int ret; |
| 2573 | |
| 2574 | IPA_API_DISPATCH_RETURN(ipa_get_ep_mapping, client); |
| 2575 | |
| 2576 | return ret; |
| 2577 | } |
| 2578 | EXPORT_SYMBOL(ipa_get_ep_mapping); |
| 2579 | |
| 2580 | /** |
| 2581 | * ipa_is_ready() - check if IPA module was initialized |
| 2582 | * successfully |
| 2583 | * |
| 2584 | * Return value: true for yes; false for no |
| 2585 | */ |
| 2586 | bool ipa_is_ready(void) |
| 2587 | { |
| 2588 | if (!ipa_api_ctrl || !ipa_api_ctrl->ipa_is_ready) |
| 2589 | return false; |
| 2590 | return ipa_api_ctrl->ipa_is_ready(); |
| 2591 | } |
| 2592 | EXPORT_SYMBOL(ipa_is_ready); |
| 2593 | |
| 2594 | /** |
| 2595 | * ipa_proxy_clk_vote() - called to add IPA clock proxy vote |
| 2596 | * |
| 2597 | * Return value: none |
| 2598 | */ |
| 2599 | void ipa_proxy_clk_vote(void) |
| 2600 | { |
| 2601 | IPA_API_DISPATCH(ipa_proxy_clk_vote); |
| 2602 | } |
| 2603 | EXPORT_SYMBOL(ipa_proxy_clk_vote); |
| 2604 | |
| 2605 | /** |
| 2606 | * ipa_proxy_clk_unvote() - called to remove IPA clock proxy vote |
| 2607 | * |
| 2608 | * Return value: none |
| 2609 | */ |
| 2610 | void ipa_proxy_clk_unvote(void) |
| 2611 | { |
| 2612 | IPA_API_DISPATCH(ipa_proxy_clk_unvote); |
| 2613 | } |
| 2614 | EXPORT_SYMBOL(ipa_proxy_clk_unvote); |
| 2615 | |
| 2616 | /** |
| 2617 | * ipa_get_hw_type() - Return IPA HW version |
| 2618 | * |
| 2619 | * Return value: enum ipa_hw_type |
| 2620 | */ |
| 2621 | enum ipa_hw_type ipa_get_hw_type(void) |
| 2622 | { |
| 2623 | return ipa_api_hw_type; |
| 2624 | } |
| 2625 | EXPORT_SYMBOL(ipa_get_hw_type); |
| 2626 | |
| 2627 | /** |
| 2628 | * ipa_is_client_handle_valid() - check if IPA client handle is valid handle |
| 2629 | * |
| 2630 | * Return value: true for yes; false for no |
| 2631 | */ |
| 2632 | bool ipa_is_client_handle_valid(u32 clnt_hdl) |
| 2633 | { |
| 2634 | if (!ipa_api_ctrl || !ipa_api_ctrl->ipa_is_client_handle_valid) |
| 2635 | return false; |
| 2636 | return ipa_api_ctrl->ipa_is_client_handle_valid(clnt_hdl); |
| 2637 | } |
| 2638 | EXPORT_SYMBOL(ipa_is_client_handle_valid); |
| 2639 | |
| 2640 | /** |
| 2641 | * ipa_get_client_mapping() - provide client mapping |
| 2642 | * @pipe_idx: IPA end-point number |
| 2643 | * |
| 2644 | * Return value: client mapping |
| 2645 | */ |
| 2646 | enum ipa_client_type ipa_get_client_mapping(int pipe_idx) |
| 2647 | { |
| 2648 | int ret; |
| 2649 | |
| 2650 | IPA_API_DISPATCH_RETURN(ipa_get_client_mapping, pipe_idx); |
| 2651 | |
| 2652 | return ret; |
| 2653 | } |
| 2654 | EXPORT_SYMBOL(ipa_get_client_mapping); |
| 2655 | |
| 2656 | /** |
| 2657 | * ipa_get_rm_resource_from_ep() - get the IPA_RM resource which is related to |
| 2658 | * the supplied pipe index. |
| 2659 | * |
| 2660 | * @pipe_idx: |
| 2661 | * |
| 2662 | * Return value: IPA_RM resource related to the pipe, -1 if a resource was not |
| 2663 | * found. |
| 2664 | */ |
| 2665 | enum ipa_rm_resource_name ipa_get_rm_resource_from_ep(int pipe_idx) |
| 2666 | { |
| 2667 | int ret; |
| 2668 | |
| 2669 | IPA_API_DISPATCH_RETURN(ipa_get_rm_resource_from_ep, pipe_idx); |
| 2670 | |
| 2671 | return ret; |
| 2672 | } |
| 2673 | EXPORT_SYMBOL(ipa_get_rm_resource_from_ep); |
| 2674 | |
| 2675 | /** |
| 2676 | * ipa_get_modem_cfg_emb_pipe_flt()- Return ipa_ctx->modem_cfg_emb_pipe_flt |
| 2677 | * |
| 2678 | * Return value: true if modem configures embedded pipe flt, false otherwise |
| 2679 | */ |
| 2680 | bool ipa_get_modem_cfg_emb_pipe_flt(void) |
| 2681 | { |
| 2682 | if (!ipa_api_ctrl || !ipa_api_ctrl->ipa_get_modem_cfg_emb_pipe_flt) |
| 2683 | return false; |
| 2684 | return ipa_api_ctrl->ipa_get_modem_cfg_emb_pipe_flt(); |
| 2685 | } |
| 2686 | EXPORT_SYMBOL(ipa_get_modem_cfg_emb_pipe_flt); |
| 2687 | |
| 2688 | /** |
| 2689 | * ipa_get_transport_type()- Return ipa_ctx->transport_prototype |
| 2690 | * |
| 2691 | * Return value: enum ipa_transport_type |
| 2692 | */ |
| 2693 | enum ipa_transport_type ipa_get_transport_type(void) |
| 2694 | { |
| 2695 | int ret; |
| 2696 | |
| 2697 | IPA_API_DISPATCH_RETURN(ipa_get_transport_type); |
| 2698 | |
| 2699 | return ret; |
| 2700 | } |
| 2701 | EXPORT_SYMBOL(ipa_get_transport_type); |
| 2702 | |
| 2703 | /** |
| 2704 | * ipa_get_smmu_domain()- Return the smmu domain |
| 2705 | * |
| 2706 | * Return value: pointer to iommu domain if smmu_cb valid, NULL otherwise |
| 2707 | */ |
| 2708 | struct iommu_domain *ipa_get_smmu_domain(void) |
| 2709 | { |
| 2710 | struct iommu_domain *ret; |
| 2711 | |
| 2712 | IPA_API_DISPATCH_RETURN_PTR(ipa_get_smmu_domain); |
| 2713 | |
| 2714 | return ret; |
| 2715 | } |
| 2716 | EXPORT_SYMBOL(ipa_get_smmu_domain); |
| 2717 | |
| 2718 | /** |
| 2719 | * ipa_disable_apps_wan_cons_deaggr()- set |
| 2720 | * ipa_ctx->ipa_client_apps_wan_cons_agg_gro |
| 2721 | * |
| 2722 | * Return value: 0 or negative in case of failure |
| 2723 | */ |
| 2724 | int ipa_disable_apps_wan_cons_deaggr(uint32_t agg_size, uint32_t agg_count) |
| 2725 | { |
| 2726 | int ret; |
| 2727 | |
| 2728 | IPA_API_DISPATCH_RETURN(ipa_disable_apps_wan_cons_deaggr, agg_size, |
| 2729 | agg_count); |
| 2730 | |
| 2731 | return ret; |
| 2732 | } |
| 2733 | EXPORT_SYMBOL(ipa_disable_apps_wan_cons_deaggr); |
| 2734 | |
| 2735 | /** |
| 2736 | * ipa_get_dma_dev()- Returns ipa_ctx dma dev pointer |
| 2737 | * |
| 2738 | * Return value: pointer to ipa_ctx dma dev pointer |
| 2739 | */ |
| 2740 | struct device *ipa_get_dma_dev(void) |
| 2741 | { |
| 2742 | struct device *ret; |
| 2743 | |
| 2744 | IPA_API_DISPATCH_RETURN_PTR(ipa_get_dma_dev); |
| 2745 | |
| 2746 | return ret; |
| 2747 | } |
| 2748 | EXPORT_SYMBOL(ipa_get_dma_dev); |
| 2749 | |
| 2750 | /** |
| 2751 | * ipa_release_wdi_mapping() - release iommu mapping |
| 2752 | * |
| 2753 | * |
| 2754 | * @num_buffers: number of buffers to be released |
| 2755 | * |
| 2756 | * @info: pointer to wdi buffers info array |
| 2757 | * |
| 2758 | * Return codes: 0 : success |
| 2759 | * negative : error |
| 2760 | */ |
| 2761 | int ipa_release_wdi_mapping(u32 num_buffers, struct ipa_wdi_buffer_info *info) |
| 2762 | { |
| 2763 | int ret; |
| 2764 | |
| 2765 | IPA_API_DISPATCH_RETURN(ipa_release_wdi_mapping, num_buffers, info); |
| 2766 | |
| 2767 | return ret; |
| 2768 | } |
| 2769 | EXPORT_SYMBOL(ipa_release_wdi_mapping); |
| 2770 | |
| 2771 | /** |
| 2772 | * ipa_create_wdi_mapping() - Perform iommu mapping |
| 2773 | * |
| 2774 | * |
| 2775 | * @num_buffers: number of buffers to be mapped |
| 2776 | * |
| 2777 | * @info: pointer to wdi buffers info array |
| 2778 | * |
| 2779 | * Return codes: 0 : success |
| 2780 | * negative : error |
| 2781 | */ |
| 2782 | int ipa_create_wdi_mapping(u32 num_buffers, struct ipa_wdi_buffer_info *info) |
| 2783 | { |
| 2784 | int ret; |
| 2785 | |
| 2786 | IPA_API_DISPATCH_RETURN(ipa_create_wdi_mapping, num_buffers, info); |
| 2787 | |
| 2788 | return ret; |
| 2789 | } |
| 2790 | EXPORT_SYMBOL(ipa_create_wdi_mapping); |
| 2791 | |
| 2792 | /** |
| 2793 | * ipa_get_gsi_ep_info() - provide gsi ep information |
Amir Levy | 3be373c | 2017-03-05 16:31:30 +0200 | [diff] [blame] | 2794 | * @client: IPA client type |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 2795 | * |
| 2796 | * Return value: pointer to ipa_gsi_ep_info |
| 2797 | */ |
Amir Levy | 3be373c | 2017-03-05 16:31:30 +0200 | [diff] [blame] | 2798 | const struct ipa_gsi_ep_config *ipa_get_gsi_ep_info(enum ipa_client_type client) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 2799 | { |
| 2800 | if (!ipa_api_ctrl || !ipa_api_ctrl->ipa_get_gsi_ep_info) |
| 2801 | return NULL; |
Amir Levy | 3be373c | 2017-03-05 16:31:30 +0200 | [diff] [blame] | 2802 | return ipa_api_ctrl->ipa_get_gsi_ep_info(client); |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 2803 | } |
| 2804 | EXPORT_SYMBOL(ipa_get_gsi_ep_info); |
| 2805 | |
| 2806 | /** |
| 2807 | * ipa_stop_gsi_channel()- Stops a GSI channel in IPA |
| 2808 | * |
| 2809 | * Return value: 0 on success, negative otherwise |
| 2810 | */ |
| 2811 | int ipa_stop_gsi_channel(u32 clnt_hdl) |
| 2812 | { |
| 2813 | int ret; |
| 2814 | |
| 2815 | IPA_API_DISPATCH_RETURN(ipa_stop_gsi_channel, clnt_hdl); |
| 2816 | |
| 2817 | return ret; |
| 2818 | } |
| 2819 | EXPORT_SYMBOL(ipa_stop_gsi_channel); |
| 2820 | |
| 2821 | /** |
Skylar Chang | 9fbce06 | 2017-07-25 16:20:42 -0700 | [diff] [blame] | 2822 | * ipa_start_gsi_channel()- Startsa GSI channel in IPA |
| 2823 | * |
| 2824 | * Return value: 0 on success, negative otherwise |
| 2825 | */ |
| 2826 | int ipa_start_gsi_channel(u32 clnt_hdl) |
| 2827 | { |
| 2828 | int ret; |
| 2829 | |
| 2830 | IPA_API_DISPATCH_RETURN(ipa_start_gsi_channel, clnt_hdl); |
| 2831 | |
| 2832 | return ret; |
| 2833 | } |
| 2834 | EXPORT_SYMBOL(ipa_start_gsi_channel); |
| 2835 | |
| 2836 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 2837 | * ipa_is_vlan_mode - check if a LAN driver should load in VLAN mode |
| 2838 | * @iface - type of vlan capable device |
| 2839 | * @res - query result: true for vlan mode, false for non vlan mode |
| 2840 | * |
| 2841 | * API must be called after ipa_is_ready() returns true, otherwise it will fail |
| 2842 | * |
| 2843 | * Returns: 0 on success, negative on failure |
| 2844 | */ |
Amir Levy | 2da9d45 | 2017-12-12 10:09:46 +0200 | [diff] [blame] | 2845 | int ipa_is_vlan_mode(enum ipa_vlan_ifaces iface, bool *res) |
| 2846 | { |
| 2847 | int ret; |
| 2848 | |
| 2849 | IPA_API_DISPATCH_RETURN(ipa_is_vlan_mode, iface, res); |
| 2850 | |
| 2851 | return ret; |
| 2852 | |
| 2853 | } |
| 2854 | EXPORT_SYMBOL(ipa_is_vlan_mode); |
| 2855 | |
| 2856 | /** |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 2857 | * ipa_get_version_string() - Get string representation of IPA version |
| 2858 | * @ver: IPA version |
| 2859 | * |
| 2860 | * Return: Constant string representation |
| 2861 | */ |
| 2862 | const char *ipa_get_version_string(enum ipa_hw_type ver) |
| 2863 | { |
| 2864 | const char *str; |
| 2865 | |
| 2866 | switch (ver) { |
| 2867 | case IPA_HW_v1_0: |
| 2868 | str = "1.0"; |
| 2869 | break; |
| 2870 | case IPA_HW_v1_1: |
| 2871 | str = "1.1"; |
| 2872 | break; |
| 2873 | case IPA_HW_v2_0: |
| 2874 | str = "2.0"; |
| 2875 | break; |
| 2876 | case IPA_HW_v2_1: |
| 2877 | str = "2.1"; |
| 2878 | break; |
| 2879 | case IPA_HW_v2_5: |
| 2880 | str = "2.5/2.6"; |
| 2881 | break; |
| 2882 | case IPA_HW_v2_6L: |
| 2883 | str = "2.6L"; |
| 2884 | break; |
| 2885 | case IPA_HW_v3_0: |
| 2886 | str = "3.0"; |
| 2887 | break; |
| 2888 | case IPA_HW_v3_1: |
| 2889 | str = "3.1"; |
| 2890 | break; |
| 2891 | case IPA_HW_v3_5: |
| 2892 | str = "3.5"; |
| 2893 | break; |
| 2894 | case IPA_HW_v3_5_1: |
| 2895 | str = "3.5.1"; |
| 2896 | break; |
Michael Adisumarta | 891a4ff | 2017-05-16 16:40:06 -0700 | [diff] [blame] | 2897 | case IPA_HW_v4_0: |
| 2898 | str = "4.0"; |
| 2899 | break; |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 2900 | default: |
| 2901 | str = "Invalid version"; |
| 2902 | break; |
| 2903 | } |
| 2904 | |
| 2905 | return str; |
| 2906 | } |
| 2907 | EXPORT_SYMBOL(ipa_get_version_string); |
| 2908 | |
| 2909 | static const struct of_device_id ipa_plat_drv_match[] = { |
| 2910 | { .compatible = "qcom,ipa", }, |
| 2911 | { .compatible = "qcom,ipa-smmu-ap-cb", }, |
| 2912 | { .compatible = "qcom,ipa-smmu-wlan-cb", }, |
| 2913 | { .compatible = "qcom,ipa-smmu-uc-cb", }, |
| 2914 | { .compatible = "qcom,smp2pgpio-map-ipa-1-in", }, |
| 2915 | { .compatible = "qcom,smp2pgpio-map-ipa-1-out", }, |
| 2916 | {} |
| 2917 | }; |
| 2918 | |
| 2919 | static int ipa_generic_plat_drv_probe(struct platform_device *pdev_p) |
| 2920 | { |
| 2921 | int result; |
| 2922 | |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 2923 | /** |
| 2924 | * IPA probe function can be called for multiple times as the same probe |
| 2925 | * function handles multiple compatibilities |
| 2926 | */ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 2927 | pr_debug("ipa: IPA driver probing started for %s\n", |
| 2928 | pdev_p->dev.of_node->name); |
| 2929 | |
| 2930 | if (!ipa_api_ctrl) { |
| 2931 | ipa_api_ctrl = kzalloc(sizeof(*ipa_api_ctrl), GFP_KERNEL); |
| 2932 | if (!ipa_api_ctrl) |
| 2933 | return -ENOMEM; |
| 2934 | |
| 2935 | /* Get IPA HW Version */ |
| 2936 | result = of_property_read_u32(pdev_p->dev.of_node, |
| 2937 | "qcom,ipa-hw-ver", &ipa_api_hw_type); |
| 2938 | if ((result) || (ipa_api_hw_type == 0)) { |
| 2939 | pr_err("ipa: get resource failed for ipa-hw-ver!\n"); |
| 2940 | kfree(ipa_api_ctrl); |
| 2941 | ipa_api_ctrl = 0; |
| 2942 | return -ENODEV; |
| 2943 | } |
| 2944 | pr_debug("ipa: ipa_api_hw_type = %d", ipa_api_hw_type); |
| 2945 | } |
| 2946 | |
| 2947 | /* call probe based on IPA HW version */ |
| 2948 | switch (ipa_api_hw_type) { |
| 2949 | case IPA_HW_v2_0: |
| 2950 | case IPA_HW_v2_1: |
| 2951 | case IPA_HW_v2_5: |
| 2952 | case IPA_HW_v2_6L: |
| 2953 | result = ipa_plat_drv_probe(pdev_p, ipa_api_ctrl, |
| 2954 | ipa_plat_drv_match); |
| 2955 | break; |
| 2956 | case IPA_HW_v3_0: |
| 2957 | case IPA_HW_v3_1: |
| 2958 | case IPA_HW_v3_5: |
| 2959 | case IPA_HW_v3_5_1: |
Michael Adisumarta | 891a4ff | 2017-05-16 16:40:06 -0700 | [diff] [blame] | 2960 | case IPA_HW_v4_0: |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 2961 | result = ipa3_plat_drv_probe(pdev_p, ipa_api_ctrl, |
| 2962 | ipa_plat_drv_match); |
| 2963 | break; |
| 2964 | default: |
| 2965 | pr_err("ipa: unsupported version %d\n", ipa_api_hw_type); |
| 2966 | return -EPERM; |
| 2967 | } |
| 2968 | |
| 2969 | if (result && result != -EPROBE_DEFER) |
| 2970 | pr_err("ipa: ipa_plat_drv_probe failed\n"); |
| 2971 | |
| 2972 | return result; |
| 2973 | } |
| 2974 | |
| 2975 | static int ipa_ap_suspend(struct device *dev) |
| 2976 | { |
| 2977 | int ret; |
| 2978 | |
| 2979 | IPA_API_DISPATCH_RETURN(ipa_ap_suspend, dev); |
| 2980 | |
| 2981 | return ret; |
| 2982 | } |
| 2983 | |
| 2984 | static int ipa_ap_resume(struct device *dev) |
| 2985 | { |
| 2986 | int ret; |
| 2987 | |
| 2988 | IPA_API_DISPATCH_RETURN(ipa_ap_resume, dev); |
| 2989 | |
| 2990 | return ret; |
| 2991 | } |
| 2992 | |
| 2993 | int ipa_register_ipa_ready_cb(void (*ipa_ready_cb)(void *user_data), |
| 2994 | void *user_data) |
| 2995 | { |
| 2996 | int ret; |
| 2997 | |
| 2998 | IPA_API_DISPATCH_RETURN(ipa_register_ipa_ready_cb, |
| 2999 | ipa_ready_cb, user_data); |
| 3000 | |
| 3001 | return ret; |
| 3002 | } |
| 3003 | EXPORT_SYMBOL(ipa_register_ipa_ready_cb); |
| 3004 | |
| 3005 | /** |
| 3006 | * ipa_inc_client_enable_clks() - Increase active clients counter, and |
| 3007 | * enable ipa clocks if necessary |
| 3008 | * |
| 3009 | * Please do not use this API, use the wrapper macros instead (ipa_i.h) |
| 3010 | * IPA_ACTIVE_CLIENTS_INC_XXX(); |
| 3011 | * |
| 3012 | * Return codes: |
| 3013 | * None |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 3014 | */ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 3015 | void ipa_inc_client_enable_clks(struct ipa_active_client_logging_info *id) |
| 3016 | { |
| 3017 | IPA_API_DISPATCH(ipa_inc_client_enable_clks, id); |
| 3018 | } |
| 3019 | EXPORT_SYMBOL(ipa_inc_client_enable_clks); |
| 3020 | |
| 3021 | /** |
| 3022 | * ipa_dec_client_disable_clks() - Increase active clients counter, and |
| 3023 | * enable ipa clocks if necessary |
| 3024 | * |
| 3025 | * Please do not use this API, use the wrapper macros instead (ipa_i.h) |
| 3026 | * IPA_ACTIVE_CLIENTS_DEC_XXX(); |
| 3027 | * |
| 3028 | * Return codes: |
| 3029 | * None |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 3030 | */ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 3031 | void ipa_dec_client_disable_clks(struct ipa_active_client_logging_info *id) |
| 3032 | { |
| 3033 | IPA_API_DISPATCH(ipa_dec_client_disable_clks, id); |
| 3034 | } |
| 3035 | EXPORT_SYMBOL(ipa_dec_client_disable_clks); |
| 3036 | |
| 3037 | /** |
| 3038 | * ipa_inc_client_enable_clks_no_block() - Only increment the number of active |
| 3039 | * clients if no asynchronous actions should be done.Asynchronous actions are |
| 3040 | * locking a mutex and waking up IPA HW. |
| 3041 | * |
| 3042 | * Please do not use this API, use the wrapper macros instead(ipa_i.h) |
| 3043 | * |
| 3044 | * |
| 3045 | * Return codes : 0 for success |
| 3046 | * -EPERM if an asynchronous action should have been done |
| 3047 | */ |
| 3048 | int ipa_inc_client_enable_clks_no_block( |
| 3049 | struct ipa_active_client_logging_info *id) |
| 3050 | { |
| 3051 | int ret; |
| 3052 | |
| 3053 | IPA_API_DISPATCH_RETURN(ipa_inc_client_enable_clks_no_block, id); |
| 3054 | |
| 3055 | return ret; |
| 3056 | } |
| 3057 | EXPORT_SYMBOL(ipa_inc_client_enable_clks_no_block); |
| 3058 | |
| 3059 | /** |
Skylar Chang | 68c37d8 | 2018-04-07 16:42:36 -0700 | [diff] [blame] | 3060 | * ipa_suspend_resource_no_block() - suspend client endpoints related to the |
| 3061 | * IPA_RM resource and decrement active clients counter. This function is |
| 3062 | * guaranteed to avoid sleeping. |
| 3063 | * |
| 3064 | * @resource: [IN] IPA Resource Manager resource |
| 3065 | * |
| 3066 | * Return codes: 0 on success, negative on failure. |
| 3067 | */ |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 3068 | int ipa_suspend_resource_no_block(enum ipa_rm_resource_name resource) |
| 3069 | { |
| 3070 | int ret; |
| 3071 | |
| 3072 | IPA_API_DISPATCH_RETURN(ipa_suspend_resource_no_block, resource); |
| 3073 | |
| 3074 | return ret; |
| 3075 | } |
| 3076 | EXPORT_SYMBOL(ipa_suspend_resource_no_block); |
| 3077 | /** |
| 3078 | * ipa_resume_resource() - resume client endpoints related to the IPA_RM |
| 3079 | * resource. |
| 3080 | * |
| 3081 | * @resource: [IN] IPA Resource Manager resource |
| 3082 | * |
| 3083 | * Return codes: 0 on success, negative on failure. |
| 3084 | */ |
| 3085 | int ipa_resume_resource(enum ipa_rm_resource_name resource) |
| 3086 | { |
| 3087 | int ret; |
| 3088 | |
| 3089 | IPA_API_DISPATCH_RETURN(ipa_resume_resource, resource); |
| 3090 | |
| 3091 | return ret; |
| 3092 | } |
| 3093 | EXPORT_SYMBOL(ipa_resume_resource); |
| 3094 | |
| 3095 | /** |
| 3096 | * ipa_suspend_resource_sync() - suspend client endpoints related to the IPA_RM |
| 3097 | * resource and decrement active clients counter, which may result in clock |
| 3098 | * gating of IPA clocks. |
| 3099 | * |
| 3100 | * @resource: [IN] IPA Resource Manager resource |
| 3101 | * |
| 3102 | * Return codes: 0 on success, negative on failure. |
| 3103 | */ |
| 3104 | int ipa_suspend_resource_sync(enum ipa_rm_resource_name resource) |
| 3105 | { |
| 3106 | int ret; |
| 3107 | |
| 3108 | IPA_API_DISPATCH_RETURN(ipa_suspend_resource_sync, resource); |
| 3109 | |
| 3110 | return ret; |
| 3111 | } |
| 3112 | EXPORT_SYMBOL(ipa_suspend_resource_sync); |
| 3113 | |
| 3114 | /** |
| 3115 | * ipa_set_required_perf_profile() - set IPA to the specified performance |
| 3116 | * profile based on the bandwidth, unless minimum voltage required is |
| 3117 | * higher. In this case the floor_voltage specified will be used. |
| 3118 | * @floor_voltage: minimum voltage to operate |
| 3119 | * @bandwidth_mbps: needed bandwidth from IPA |
| 3120 | * |
| 3121 | * Return codes: 0 on success, negative on failure. |
| 3122 | */ |
| 3123 | int ipa_set_required_perf_profile(enum ipa_voltage_level floor_voltage, |
| 3124 | u32 bandwidth_mbps) |
| 3125 | { |
| 3126 | int ret; |
| 3127 | |
| 3128 | IPA_API_DISPATCH_RETURN(ipa_set_required_perf_profile, floor_voltage, |
| 3129 | bandwidth_mbps); |
| 3130 | |
| 3131 | return ret; |
| 3132 | } |
| 3133 | EXPORT_SYMBOL(ipa_set_required_perf_profile); |
| 3134 | |
| 3135 | /** |
| 3136 | * ipa_get_ipc_logbuf() - return a pointer to IPA driver IPC log |
| 3137 | */ |
| 3138 | void *ipa_get_ipc_logbuf(void) |
| 3139 | { |
| 3140 | void *ret; |
| 3141 | |
| 3142 | IPA_API_DISPATCH_RETURN_PTR(ipa_get_ipc_logbuf); |
| 3143 | |
| 3144 | return ret; |
| 3145 | } |
| 3146 | EXPORT_SYMBOL(ipa_get_ipc_logbuf); |
| 3147 | |
| 3148 | /** |
| 3149 | * ipa_get_ipc_logbuf_low() - return a pointer to IPA driver IPC low prio log |
| 3150 | */ |
| 3151 | void *ipa_get_ipc_logbuf_low(void) |
| 3152 | { |
| 3153 | void *ret; |
| 3154 | |
| 3155 | IPA_API_DISPATCH_RETURN_PTR(ipa_get_ipc_logbuf_low); |
| 3156 | |
| 3157 | return ret; |
| 3158 | } |
| 3159 | EXPORT_SYMBOL(ipa_get_ipc_logbuf_low); |
| 3160 | |
| 3161 | /** |
| 3162 | * ipa_assert() - general function for assertion |
| 3163 | */ |
| 3164 | void ipa_assert(void) |
| 3165 | { |
| 3166 | pr_err("IPA: unrecoverable error has occurred, asserting\n"); |
| 3167 | BUG(); |
| 3168 | } |
| 3169 | |
| 3170 | /** |
| 3171 | * ipa_rx_poll() - Poll the rx packets from IPA HW in the |
| 3172 | * softirq context |
| 3173 | * |
| 3174 | * @budget: number of packets to be polled in single iteration |
| 3175 | * |
| 3176 | * Return codes: >= 0 : Actual number of packets polled |
| 3177 | * |
| 3178 | */ |
| 3179 | int ipa_rx_poll(u32 clnt_hdl, int budget) |
| 3180 | { |
| 3181 | int ret; |
| 3182 | |
| 3183 | IPA_API_DISPATCH_RETURN(ipa_rx_poll, clnt_hdl, budget); |
| 3184 | |
| 3185 | return ret; |
| 3186 | } |
| 3187 | EXPORT_SYMBOL(ipa_rx_poll); |
| 3188 | |
| 3189 | /** |
| 3190 | * ipa_recycle_wan_skb() - Recycle the Wan skb |
| 3191 | * |
| 3192 | * @skb: skb that needs to recycle |
| 3193 | * |
| 3194 | */ |
| 3195 | void ipa_recycle_wan_skb(struct sk_buff *skb) |
| 3196 | { |
| 3197 | IPA_API_DISPATCH(ipa_recycle_wan_skb, skb); |
| 3198 | } |
| 3199 | EXPORT_SYMBOL(ipa_recycle_wan_skb); |
| 3200 | |
| 3201 | /** |
| 3202 | * ipa_setup_uc_ntn_pipes() - setup uc offload pipes |
| 3203 | */ |
| 3204 | int ipa_setup_uc_ntn_pipes(struct ipa_ntn_conn_in_params *inp, |
| 3205 | ipa_notify_cb notify, void *priv, u8 hdr_len, |
| 3206 | struct ipa_ntn_conn_out_params *outp) |
| 3207 | { |
| 3208 | int ret; |
| 3209 | |
| 3210 | IPA_API_DISPATCH_RETURN(ipa_setup_uc_ntn_pipes, inp, |
| 3211 | notify, priv, hdr_len, outp); |
| 3212 | |
| 3213 | return ret; |
| 3214 | } |
| 3215 | |
| 3216 | /** |
| 3217 | * ipa_tear_down_uc_offload_pipes() - tear down uc offload pipes |
| 3218 | */ |
| 3219 | int ipa_tear_down_uc_offload_pipes(int ipa_ep_idx_ul, |
Michael Adisumarta | b1bafa4 | 2018-04-16 16:48:10 -0700 | [diff] [blame] | 3220 | int ipa_ep_idx_dl, struct ipa_ntn_conn_in_params *params) |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 3221 | { |
| 3222 | int ret; |
| 3223 | |
| 3224 | IPA_API_DISPATCH_RETURN(ipa_tear_down_uc_offload_pipes, ipa_ep_idx_ul, |
Michael Adisumarta | b1bafa4 | 2018-04-16 16:48:10 -0700 | [diff] [blame] | 3225 | ipa_ep_idx_dl, params); |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 3226 | |
| 3227 | return ret; |
| 3228 | } |
| 3229 | |
Amir Levy | c4222c9 | 2016-11-07 16:14:54 +0200 | [diff] [blame] | 3230 | /** |
| 3231 | * ipa_get_pdev() - return a pointer to IPA dev struct |
| 3232 | * |
| 3233 | * Return value: a pointer to IPA dev struct |
| 3234 | * |
| 3235 | */ |
| 3236 | struct device *ipa_get_pdev(void) |
| 3237 | { |
| 3238 | struct device *ret; |
| 3239 | |
| 3240 | IPA_API_DISPATCH_RETURN_PTR(ipa_get_pdev); |
| 3241 | |
| 3242 | return ret; |
| 3243 | } |
| 3244 | EXPORT_SYMBOL(ipa_get_pdev); |
| 3245 | |
Sunil Paidimarri | fbbcd07 | 2017-04-04 17:43:50 -0700 | [diff] [blame] | 3246 | int ipa_ntn_uc_reg_rdyCB(void (*ipauc_ready_cb)(void *user_data), |
| 3247 | void *user_data) |
| 3248 | { |
| 3249 | int ret; |
| 3250 | |
| 3251 | IPA_API_DISPATCH_RETURN(ipa_ntn_uc_reg_rdyCB, |
| 3252 | ipauc_ready_cb, user_data); |
| 3253 | |
| 3254 | return ret; |
| 3255 | } |
| 3256 | EXPORT_SYMBOL(ipa_ntn_uc_reg_rdyCB); |
| 3257 | |
| 3258 | void ipa_ntn_uc_dereg_rdyCB(void) |
| 3259 | { |
| 3260 | IPA_API_DISPATCH(ipa_ntn_uc_dereg_rdyCB); |
| 3261 | } |
| 3262 | EXPORT_SYMBOL(ipa_ntn_uc_dereg_rdyCB); |
| 3263 | |
Michael Adisumarta | d04e6d6 | 2017-11-09 17:46:35 -0800 | [diff] [blame] | 3264 | int ipa_get_smmu_params(struct ipa_smmu_in_params *in, |
| 3265 | struct ipa_smmu_out_params *out) |
| 3266 | { |
| 3267 | int ret; |
| 3268 | |
| 3269 | IPA_API_DISPATCH_RETURN(ipa_get_smmu_params, in, out); |
| 3270 | |
| 3271 | return ret; |
| 3272 | } |
| 3273 | EXPORT_SYMBOL(ipa_get_smmu_params); |
| 3274 | |
Skylar Chang | 852379b | 2016-12-13 14:00:19 -0800 | [diff] [blame] | 3275 | /** |
Shihuan Liu | 105b31f | 2017-11-21 11:43:58 -0800 | [diff] [blame] | 3276 | * ipa_conn_wdi_pipes() - connect wdi pipes |
Skylar Chang | 852379b | 2016-12-13 14:00:19 -0800 | [diff] [blame] | 3277 | */ |
Shihuan Liu | 105b31f | 2017-11-21 11:43:58 -0800 | [diff] [blame] | 3278 | int ipa_conn_wdi_pipes(struct ipa_wdi_conn_in_params *in, |
| 3279 | struct ipa_wdi_conn_out_params *out, |
| 3280 | ipa_wdi_meter_notifier_cb wdi_notify) |
Skylar Chang | 852379b | 2016-12-13 14:00:19 -0800 | [diff] [blame] | 3281 | { |
| 3282 | int ret; |
| 3283 | |
Shihuan Liu | 105b31f | 2017-11-21 11:43:58 -0800 | [diff] [blame] | 3284 | IPA_API_DISPATCH_RETURN(ipa_conn_wdi_pipes, in, out, wdi_notify); |
Skylar Chang | 852379b | 2016-12-13 14:00:19 -0800 | [diff] [blame] | 3285 | |
| 3286 | return ret; |
| 3287 | } |
| 3288 | |
| 3289 | /** |
Shihuan Liu | 105b31f | 2017-11-21 11:43:58 -0800 | [diff] [blame] | 3290 | * ipa_disconn_wdi_pipes() - disconnect wdi pipes |
Skylar Chang | 852379b | 2016-12-13 14:00:19 -0800 | [diff] [blame] | 3291 | */ |
Shihuan Liu | 105b31f | 2017-11-21 11:43:58 -0800 | [diff] [blame] | 3292 | int ipa_disconn_wdi_pipes(int ipa_ep_idx_tx, int ipa_ep_idx_rx) |
Skylar Chang | 852379b | 2016-12-13 14:00:19 -0800 | [diff] [blame] | 3293 | { |
| 3294 | int ret; |
| 3295 | |
Shihuan Liu | 105b31f | 2017-11-21 11:43:58 -0800 | [diff] [blame] | 3296 | IPA_API_DISPATCH_RETURN(ipa_disconn_wdi_pipes, ipa_ep_idx_tx, |
Skylar Chang | 852379b | 2016-12-13 14:00:19 -0800 | [diff] [blame] | 3297 | ipa_ep_idx_rx); |
| 3298 | |
| 3299 | return ret; |
| 3300 | } |
| 3301 | |
| 3302 | /** |
Shihuan Liu | 105b31f | 2017-11-21 11:43:58 -0800 | [diff] [blame] | 3303 | * ipa_enable_wdi_pipes() - enable wdi pipes |
Skylar Chang | 852379b | 2016-12-13 14:00:19 -0800 | [diff] [blame] | 3304 | */ |
Shihuan Liu | 105b31f | 2017-11-21 11:43:58 -0800 | [diff] [blame] | 3305 | int ipa_enable_wdi_pipes(int ipa_ep_idx_tx, int ipa_ep_idx_rx) |
Skylar Chang | 852379b | 2016-12-13 14:00:19 -0800 | [diff] [blame] | 3306 | { |
| 3307 | int ret; |
| 3308 | |
Shihuan Liu | 105b31f | 2017-11-21 11:43:58 -0800 | [diff] [blame] | 3309 | IPA_API_DISPATCH_RETURN(ipa_enable_wdi_pipes, ipa_ep_idx_tx, |
Skylar Chang | 852379b | 2016-12-13 14:00:19 -0800 | [diff] [blame] | 3310 | ipa_ep_idx_rx); |
| 3311 | |
| 3312 | return ret; |
| 3313 | } |
| 3314 | |
| 3315 | /** |
Shihuan Liu | 105b31f | 2017-11-21 11:43:58 -0800 | [diff] [blame] | 3316 | * ipa_disable_wdi_pipes() - disable wdi pipes |
Skylar Chang | 852379b | 2016-12-13 14:00:19 -0800 | [diff] [blame] | 3317 | */ |
Shihuan Liu | 105b31f | 2017-11-21 11:43:58 -0800 | [diff] [blame] | 3318 | int ipa_disable_wdi_pipes(int ipa_ep_idx_tx, int ipa_ep_idx_rx) |
Skylar Chang | 852379b | 2016-12-13 14:00:19 -0800 | [diff] [blame] | 3319 | { |
| 3320 | int ret; |
| 3321 | |
Shihuan Liu | 105b31f | 2017-11-21 11:43:58 -0800 | [diff] [blame] | 3322 | IPA_API_DISPATCH_RETURN(ipa_disable_wdi_pipes, ipa_ep_idx_tx, |
Skylar Chang | 852379b | 2016-12-13 14:00:19 -0800 | [diff] [blame] | 3323 | ipa_ep_idx_rx); |
| 3324 | |
| 3325 | return ret; |
| 3326 | } |
Sunil Paidimarri | fbbcd07 | 2017-04-04 17:43:50 -0700 | [diff] [blame] | 3327 | |
Skylar Chang | 48afa05 | 2017-10-25 09:32:57 -0700 | [diff] [blame] | 3328 | /** |
| 3329 | * ipa_tz_unlock_reg() - Allow AP access to memory regions controlled by TZ |
| 3330 | */ |
| 3331 | int ipa_tz_unlock_reg(struct ipa_tz_unlock_reg_info *reg_info, u16 num_regs) |
| 3332 | { |
| 3333 | int ret; |
| 3334 | |
| 3335 | IPA_API_DISPATCH_RETURN(ipa_tz_unlock_reg, reg_info, num_regs); |
| 3336 | |
| 3337 | return ret; |
| 3338 | } |
| 3339 | |
Skylar Chang | fda3a8e | 2018-01-29 10:54:56 -0800 | [diff] [blame] | 3340 | /** |
| 3341 | * ipa_pm_is_used() - Returns if IPA PM framework is used |
| 3342 | */ |
| 3343 | bool ipa_pm_is_used(void) |
| 3344 | { |
| 3345 | bool ret; |
| 3346 | |
| 3347 | IPA_API_DISPATCH_RETURN(ipa_pm_is_used); |
| 3348 | |
| 3349 | return ret; |
| 3350 | } |
| 3351 | |
Amir Levy | 9659e59 | 2016-10-27 18:08:27 +0300 | [diff] [blame] | 3352 | static const struct dev_pm_ops ipa_pm_ops = { |
| 3353 | .suspend_noirq = ipa_ap_suspend, |
| 3354 | .resume_noirq = ipa_ap_resume, |
| 3355 | }; |
| 3356 | |
| 3357 | static struct platform_driver ipa_plat_drv = { |
| 3358 | .probe = ipa_generic_plat_drv_probe, |
| 3359 | .driver = { |
| 3360 | .name = DRV_NAME, |
| 3361 | .owner = THIS_MODULE, |
| 3362 | .pm = &ipa_pm_ops, |
| 3363 | .of_match_table = ipa_plat_drv_match, |
| 3364 | }, |
| 3365 | }; |
| 3366 | |
| 3367 | static int __init ipa_module_init(void) |
| 3368 | { |
| 3369 | pr_debug("IPA module init\n"); |
| 3370 | |
| 3371 | /* Register as a platform device driver */ |
| 3372 | return platform_driver_register(&ipa_plat_drv); |
| 3373 | } |
| 3374 | subsys_initcall(ipa_module_init); |
| 3375 | |
| 3376 | MODULE_LICENSE("GPL v2"); |
| 3377 | MODULE_DESCRIPTION("IPA HW device driver"); |