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