| 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright (C) 2020 The Linux Foundation. All rights reserved. |
| 4 | */ |
| 5 | |
| 6 | #include <linux/module.h> |
| 7 | #include <linux/soc/qcom/qmi.h> |
| 8 | |
| 9 | #include "pdr_internal.h" |
| 10 | |
| 11 | static const struct qmi_elem_info servreg_location_entry_ei[] = { |
| 12 | { |
| 13 | .data_type = QMI_STRING, |
| 14 | .elem_len = SERVREG_NAME_LENGTH + 1, |
| 15 | .elem_size = sizeof(char), |
| 16 | .array_type = NO_ARRAY, |
| 17 | .tlv_type = 0, |
| 18 | .offset = offsetof(struct servreg_location_entry, |
| 19 | name), |
| 20 | }, |
| 21 | { |
| 22 | .data_type = QMI_UNSIGNED_4_BYTE, |
| 23 | .elem_len = 1, |
| 24 | .elem_size = sizeof(u32), |
| 25 | .array_type = NO_ARRAY, |
| 26 | .tlv_type = 0, |
| 27 | .offset = offsetof(struct servreg_location_entry, |
| 28 | instance), |
| 29 | }, |
| 30 | { |
| 31 | .data_type = QMI_UNSIGNED_1_BYTE, |
| 32 | .elem_len = 1, |
| 33 | .elem_size = sizeof(u8), |
| 34 | .array_type = NO_ARRAY, |
| 35 | .tlv_type = 0, |
| 36 | .offset = offsetof(struct servreg_location_entry, |
| 37 | service_data_valid), |
| 38 | }, |
| 39 | { |
| 40 | .data_type = QMI_UNSIGNED_4_BYTE, |
| 41 | .elem_len = 1, |
| 42 | .elem_size = sizeof(u32), |
| 43 | .array_type = NO_ARRAY, |
| 44 | .tlv_type = 0, |
| 45 | .offset = offsetof(struct servreg_location_entry, |
| 46 | service_data), |
| 47 | }, |
| 48 | {} |
| 49 | }; |
| 50 | |
| 51 | const struct qmi_elem_info servreg_get_domain_list_req_ei[] = { |
| 52 | { |
| 53 | .data_type = QMI_STRING, |
| 54 | .elem_len = SERVREG_NAME_LENGTH + 1, |
| 55 | .elem_size = sizeof(char), |
| 56 | .array_type = NO_ARRAY, |
| 57 | .tlv_type = 0x01, |
| 58 | .offset = offsetof(struct servreg_get_domain_list_req, |
| 59 | service_name), |
| 60 | }, |
| 61 | { |
| 62 | .data_type = QMI_OPT_FLAG, |
| 63 | .elem_len = 1, |
| 64 | .elem_size = sizeof(u8), |
| 65 | .array_type = NO_ARRAY, |
| 66 | .tlv_type = 0x10, |
| 67 | .offset = offsetof(struct servreg_get_domain_list_req, |
| 68 | domain_offset_valid), |
| 69 | }, |
| 70 | { |
| 71 | .data_type = QMI_UNSIGNED_4_BYTE, |
| 72 | .elem_len = 1, |
| 73 | .elem_size = sizeof(u32), |
| 74 | .array_type = NO_ARRAY, |
| 75 | .tlv_type = 0x10, |
| 76 | .offset = offsetof(struct servreg_get_domain_list_req, |
| 77 | domain_offset), |
| 78 | }, |
| 79 | {} |
| 80 | }; |
| 81 | EXPORT_SYMBOL_GPL(servreg_get_domain_list_req_ei); |
| 82 | |
| 83 | const struct qmi_elem_info servreg_get_domain_list_resp_ei[] = { |
| 84 | { |
| 85 | .data_type = QMI_STRUCT, |
| 86 | .elem_len = 1, |
| 87 | .elem_size = sizeof(struct qmi_response_type_v01), |
| 88 | .array_type = NO_ARRAY, |
| 89 | .tlv_type = 0x02, |
| 90 | .offset = offsetof(struct servreg_get_domain_list_resp, |
| 91 | resp), |
| 92 | .ei_array = qmi_response_type_v01_ei, |
| 93 | }, |
| 94 | { |
| 95 | .data_type = QMI_OPT_FLAG, |
| 96 | .elem_len = 1, |
| 97 | .elem_size = sizeof(u8), |
| 98 | .array_type = NO_ARRAY, |
| 99 | .tlv_type = 0x10, |
| 100 | .offset = offsetof(struct servreg_get_domain_list_resp, |
| 101 | total_domains_valid), |
| 102 | }, |
| 103 | { |
| 104 | .data_type = QMI_UNSIGNED_2_BYTE, |
| 105 | .elem_len = 1, |
| 106 | .elem_size = sizeof(u16), |
| 107 | .array_type = NO_ARRAY, |
| 108 | .tlv_type = 0x10, |
| 109 | .offset = offsetof(struct servreg_get_domain_list_resp, |
| 110 | total_domains), |
| 111 | }, |
| 112 | { |
| 113 | .data_type = QMI_OPT_FLAG, |
| 114 | .elem_len = 1, |
| 115 | .elem_size = sizeof(u8), |
| 116 | .array_type = NO_ARRAY, |
| 117 | .tlv_type = 0x11, |
| 118 | .offset = offsetof(struct servreg_get_domain_list_resp, |
| 119 | db_rev_count_valid), |
| 120 | }, |
| 121 | { |
| 122 | .data_type = QMI_UNSIGNED_2_BYTE, |
| 123 | .elem_len = 1, |
| 124 | .elem_size = sizeof(u16), |
| 125 | .array_type = NO_ARRAY, |
| 126 | .tlv_type = 0x11, |
| 127 | .offset = offsetof(struct servreg_get_domain_list_resp, |
| 128 | db_rev_count), |
| 129 | }, |
| 130 | { |
| 131 | .data_type = QMI_OPT_FLAG, |
| 132 | .elem_len = 1, |
| 133 | .elem_size = sizeof(u8), |
| 134 | .array_type = NO_ARRAY, |
| 135 | .tlv_type = 0x12, |
| 136 | .offset = offsetof(struct servreg_get_domain_list_resp, |
| 137 | domain_list_valid), |
| 138 | }, |
| 139 | { |
| 140 | .data_type = QMI_DATA_LEN, |
| 141 | .elem_len = 1, |
| 142 | .elem_size = sizeof(u8), |
| 143 | .array_type = NO_ARRAY, |
| 144 | .tlv_type = 0x12, |
| 145 | .offset = offsetof(struct servreg_get_domain_list_resp, |
| 146 | domain_list_len), |
| 147 | }, |
| 148 | { |
| 149 | .data_type = QMI_STRUCT, |
| 150 | .elem_len = SERVREG_DOMAIN_LIST_LENGTH, |
| 151 | .elem_size = sizeof(struct servreg_location_entry), |
| 152 | .array_type = VAR_LEN_ARRAY, |
| 153 | .tlv_type = 0x12, |
| 154 | .offset = offsetof(struct servreg_get_domain_list_resp, |
| 155 | domain_list), |
| 156 | .ei_array = servreg_location_entry_ei, |
| 157 | }, |
| 158 | {} |
| 159 | }; |
| 160 | EXPORT_SYMBOL_GPL(servreg_get_domain_list_resp_ei); |
| 161 | |
| 162 | const struct qmi_elem_info servreg_register_listener_req_ei[] = { |
| 163 | { |
| 164 | .data_type = QMI_UNSIGNED_1_BYTE, |
| 165 | .elem_len = 1, |
| 166 | .elem_size = sizeof(u8), |
| 167 | .array_type = NO_ARRAY, |
| 168 | .tlv_type = 0x01, |
| 169 | .offset = offsetof(struct servreg_register_listener_req, |
| 170 | enable), |
| 171 | }, |
| 172 | { |
| 173 | .data_type = QMI_STRING, |
| 174 | .elem_len = SERVREG_NAME_LENGTH + 1, |
| 175 | .elem_size = sizeof(char), |
| 176 | .array_type = NO_ARRAY, |
| 177 | .tlv_type = 0x02, |
| 178 | .offset = offsetof(struct servreg_register_listener_req, |
| 179 | service_path), |
| 180 | }, |
| 181 | {} |
| 182 | }; |
| 183 | EXPORT_SYMBOL_GPL(servreg_register_listener_req_ei); |
| 184 | |
| 185 | const struct qmi_elem_info servreg_register_listener_resp_ei[] = { |
| 186 | { |
| 187 | .data_type = QMI_STRUCT, |
| 188 | .elem_len = 1, |
| 189 | .elem_size = sizeof(struct qmi_response_type_v01), |
| 190 | .array_type = NO_ARRAY, |
| 191 | .tlv_type = 0x02, |
| 192 | .offset = offsetof(struct servreg_register_listener_resp, |
| 193 | resp), |
| 194 | .ei_array = qmi_response_type_v01_ei, |
| 195 | }, |
| 196 | { |
| 197 | .data_type = QMI_OPT_FLAG, |
| 198 | .elem_len = 1, |
| 199 | .elem_size = sizeof(u8), |
| 200 | .array_type = NO_ARRAY, |
| 201 | .tlv_type = 0x10, |
| 202 | .offset = offsetof(struct servreg_register_listener_resp, |
| 203 | curr_state_valid), |
| 204 | }, |
| 205 | { |
| 206 | .data_type = QMI_SIGNED_4_BYTE_ENUM, |
| 207 | .elem_len = 1, |
| 208 | .elem_size = sizeof(enum servreg_service_state), |
| 209 | .array_type = NO_ARRAY, |
| 210 | .tlv_type = 0x10, |
| 211 | .offset = offsetof(struct servreg_register_listener_resp, |
| 212 | curr_state), |
| 213 | }, |
| 214 | {} |
| 215 | }; |
| 216 | EXPORT_SYMBOL_GPL(servreg_register_listener_resp_ei); |
| 217 | |
| 218 | const struct qmi_elem_info servreg_restart_pd_req_ei[] = { |
| 219 | { |
| 220 | .data_type = QMI_STRING, |
| 221 | .elem_len = SERVREG_NAME_LENGTH + 1, |
| 222 | .elem_size = sizeof(char), |
| 223 | .array_type = NO_ARRAY, |
| 224 | .tlv_type = 0x01, |
| 225 | .offset = offsetof(struct servreg_restart_pd_req, |
| 226 | service_path), |
| 227 | }, |
| 228 | {} |
| 229 | }; |
| 230 | EXPORT_SYMBOL_GPL(servreg_restart_pd_req_ei); |
| 231 | |
| 232 | const struct qmi_elem_info servreg_restart_pd_resp_ei[] = { |
| 233 | { |
| 234 | .data_type = QMI_STRUCT, |
| 235 | .elem_len = 1, |
| 236 | .elem_size = sizeof(struct qmi_response_type_v01), |
| 237 | .array_type = NO_ARRAY, |
| 238 | .tlv_type = 0x02, |
| 239 | .offset = offsetof(struct servreg_restart_pd_resp, |
| 240 | resp), |
| 241 | .ei_array = qmi_response_type_v01_ei, |
| 242 | }, |
| 243 | {} |
| 244 | }; |
| 245 | EXPORT_SYMBOL_GPL(servreg_restart_pd_resp_ei); |
| 246 | |
| 247 | const struct qmi_elem_info servreg_state_updated_ind_ei[] = { |
| 248 | { |
| 249 | .data_type = QMI_SIGNED_4_BYTE_ENUM, |
| 250 | .elem_len = 1, |
| 251 | .elem_size = sizeof(u32), |
| 252 | .array_type = NO_ARRAY, |
| 253 | .tlv_type = 0x01, |
| 254 | .offset = offsetof(struct servreg_state_updated_ind, |
| 255 | curr_state), |
| 256 | }, |
| 257 | { |
| 258 | .data_type = QMI_STRING, |
| 259 | .elem_len = SERVREG_NAME_LENGTH + 1, |
| 260 | .elem_size = sizeof(char), |
| 261 | .array_type = NO_ARRAY, |
| 262 | .tlv_type = 0x02, |
| 263 | .offset = offsetof(struct servreg_state_updated_ind, |
| 264 | service_path), |
| 265 | }, |
| 266 | { |
| 267 | .data_type = QMI_UNSIGNED_2_BYTE, |
| 268 | .elem_len = 1, |
| 269 | .elem_size = sizeof(u16), |
| 270 | .array_type = NO_ARRAY, |
| 271 | .tlv_type = 0x03, |
| 272 | .offset = offsetof(struct servreg_state_updated_ind, |
| 273 | transaction_id), |
| 274 | }, |
| 275 | {} |
| 276 | }; |
| 277 | EXPORT_SYMBOL_GPL(servreg_state_updated_ind_ei); |
| 278 | |
| 279 | const struct qmi_elem_info servreg_set_ack_req_ei[] = { |
| 280 | { |
| 281 | .data_type = QMI_STRING, |
| 282 | .elem_len = SERVREG_NAME_LENGTH + 1, |
| 283 | .elem_size = sizeof(char), |
| 284 | .array_type = NO_ARRAY, |
| 285 | .tlv_type = 0x01, |
| 286 | .offset = offsetof(struct servreg_set_ack_req, |
| 287 | service_path), |
| 288 | }, |
| 289 | { |
| 290 | .data_type = QMI_UNSIGNED_2_BYTE, |
| 291 | .elem_len = 1, |
| 292 | .elem_size = sizeof(u16), |
| 293 | .array_type = NO_ARRAY, |
| 294 | .tlv_type = 0x02, |
| 295 | .offset = offsetof(struct servreg_set_ack_req, |
| 296 | transaction_id), |
| 297 | }, |
| 298 | {} |
| 299 | }; |
| 300 | EXPORT_SYMBOL_GPL(servreg_set_ack_req_ei); |
| 301 | |
| 302 | const struct qmi_elem_info servreg_set_ack_resp_ei[] = { |
| 303 | { |
| 304 | .data_type = QMI_STRUCT, |
| 305 | .elem_len = 1, |
| 306 | .elem_size = sizeof(struct qmi_response_type_v01), |
| 307 | .array_type = NO_ARRAY, |
| 308 | .tlv_type = 0x02, |
| 309 | .offset = offsetof(struct servreg_set_ack_resp, |
| 310 | resp), |
| 311 | .ei_array = qmi_response_type_v01_ei, |
| 312 | }, |
| 313 | {} |
| 314 | }; |
| 315 | EXPORT_SYMBOL_GPL(servreg_set_ack_resp_ei); |
| 316 | |
| 317 | const struct qmi_elem_info servreg_loc_pfr_req_ei[] = { |
| 318 | { |
| 319 | .data_type = QMI_STRING, |
| 320 | .elem_len = SERVREG_NAME_LENGTH + 1, |
| 321 | .elem_size = sizeof(char), |
| 322 | .array_type = VAR_LEN_ARRAY, |
| 323 | .tlv_type = 0x01, |
| 324 | .offset = offsetof(struct servreg_loc_pfr_req, service) |
| 325 | }, |
| 326 | { |
| 327 | .data_type = QMI_STRING, |
| 328 | .elem_len = SERVREG_NAME_LENGTH + 1, |
| 329 | .elem_size = sizeof(char), |
| 330 | .array_type = VAR_LEN_ARRAY, |
| 331 | .tlv_type = 0x02, |
| 332 | .offset = offsetof(struct servreg_loc_pfr_req, reason) |
| 333 | }, |
| 334 | {} |
| 335 | }; |
| 336 | EXPORT_SYMBOL_GPL(servreg_loc_pfr_req_ei); |
| 337 | |
| 338 | const struct qmi_elem_info servreg_loc_pfr_resp_ei[] = { |
| 339 | { |
| 340 | .data_type = QMI_STRUCT, |
| 341 | .elem_len = 1, |
| 342 | .elem_size = sizeof_field(struct servreg_loc_pfr_resp, rsp), |
| 343 | .tlv_type = 0x02, |
| 344 | .offset = offsetof(struct servreg_loc_pfr_resp, rsp), |
| 345 | .ei_array = qmi_response_type_v01_ei, |
| 346 | }, |
| 347 | {} |
| 348 | }; |
| 349 | EXPORT_SYMBOL_GPL(servreg_loc_pfr_resp_ei); |
| 350 | |
| 351 | MODULE_LICENSE("GPL" ); |
| 352 | MODULE_DESCRIPTION("Qualcomm Protection Domain messages data" ); |
| 353 | |