Lines Matching +full:everything +full:- +full:else

1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2018-2020 Linaro Ltd.
24 * both sides know when everything is ready to begin operating. The AP
53 * - Whenever the AP learns the modem has booted and its IPA QMI service
56 * - On the initial boot, the modem sets up the IPA microcontroller, and
58 * - When the modem is ready to receive an INIT_COMPLETE indication from
60 * - On the initial modem boot, everything is ready when:
61 * - AP has received a success response from its INIT_DRIVER request
62 * - AP has responded to a DRIVER_INIT_COMPLETE request
63 * - AP has responded to an INDICATION_REGISTER request from the modem
64 * - AP has sent an INIT_COMPLETE indication to the modem
65 * - On subsequent modem boots, everything is ready when:
66 * - AP has received a success response from its INIT_DRIVER request
67 * - AP has responded to a DRIVER_INIT_COMPLETE request
68 * - The INDICATION_REGISTER request and INIT_COMPLETE indication are
69 * optional for non-initial modem boots, and have no bearing on the
87 struct qmi_handle *qmi = &ipa_qmi->server_handle; in ipa_server_init_complete()
88 struct sockaddr_qrtr *sq = &ipa_qmi->modem_sq; in ipa_server_init_complete()
99 dev_err(&ipa->pdev->dev, in ipa_server_init_complete()
101 else in ipa_server_init_complete()
102 ipa_qmi->indication_sent = true; in ipa_server_init_complete()
108 if (!ipa_qmi->indication_requested) in ipa_qmi_indication()
111 if (ipa_qmi->indication_sent) in ipa_qmi_indication()
117 /* Determine whether everything is ready to start normal operation.
118 * We know everything (else) is ready when we know the IPA driver on
124 * initial boot, non-zero (true) for a subsequent (SSR) boot.
132 if (!ipa_qmi->modem_ready || !ipa_qmi->uc_ready) in ipa_qmi_ready()
139 if (ipa_qmi->initial_boot) { in ipa_qmi_ready()
140 if (!ipa_qmi->indication_sent) in ipa_qmi_ready()
144 ipa_qmi->initial_boot = false; in ipa_qmi_ready()
151 dev_err(&ipa->pdev->dev, "error %d starting modem\n", ret); in ipa_qmi_ready()
162 memset(&ipa_qmi->modem_sq, 0, sizeof(ipa_qmi->modem_sq)); in ipa_server_bye()
166 ipa_qmi->modem_ready = false; in ipa_server_bye()
167 ipa_qmi->indication_requested = false; in ipa_server_bye()
168 ipa_qmi->indication_sent = false; in ipa_server_bye()
199 ipa_qmi->indication_requested = true; in ipa_server_indication_register()
201 } else { in ipa_server_indication_register()
202 dev_err(&ipa->pdev->dev, in ipa_server_indication_register()
228 ipa_qmi->uc_ready = true; in ipa_server_driver_init_complete()
230 } else { in ipa_server_driver_init_complete()
231 dev_err(&ipa->pdev->dev, in ipa_server_driver_init_complete()
259 txn->result = 0; /* IPA_QMI_INIT_DRIVER request was successful */ in ipa_client_init_driver()
260 complete(&txn->completion); in ipa_client_init_driver()
290 req.skip_uc_load = ipa->uc_loaded ? 1 : 0; in init_modem_driver_req()
299 mem = &ipa->mem[IPA_MEM_MODEM_HEADER]; in init_modem_driver_req()
300 if (mem->size) { in init_modem_driver_req()
302 req.hdr_tbl_info.start = ipa->mem_offset + mem->offset; in init_modem_driver_req()
303 req.hdr_tbl_info.end = req.hdr_tbl_info.start + mem->size - 1; in init_modem_driver_req()
306 mem = &ipa->mem[IPA_MEM_V4_ROUTE]; in init_modem_driver_req()
308 req.v4_route_tbl_info.start = ipa->mem_offset + mem->offset; in init_modem_driver_req()
309 req.v4_route_tbl_info.count = mem->size / IPA_TABLE_ENTRY_SIZE; in init_modem_driver_req()
311 mem = &ipa->mem[IPA_MEM_V6_ROUTE]; in init_modem_driver_req()
313 req.v6_route_tbl_info.start = ipa->mem_offset + mem->offset; in init_modem_driver_req()
314 req.v6_route_tbl_info.count = mem->size / IPA_TABLE_ENTRY_SIZE; in init_modem_driver_req()
316 mem = &ipa->mem[IPA_MEM_V4_FILTER]; in init_modem_driver_req()
318 req.v4_filter_tbl_start = ipa->mem_offset + mem->offset; in init_modem_driver_req()
320 mem = &ipa->mem[IPA_MEM_V6_FILTER]; in init_modem_driver_req()
322 req.v6_filter_tbl_start = ipa->mem_offset + mem->offset; in init_modem_driver_req()
324 mem = &ipa->mem[IPA_MEM_MODEM]; in init_modem_driver_req()
325 if (mem->size) { in init_modem_driver_req()
327 req.modem_mem_info.start = ipa->mem_offset + mem->offset; in init_modem_driver_req()
328 req.modem_mem_info.size = mem->size; in init_modem_driver_req()
333 ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]->endpoint_id; in init_modem_driver_req()
337 mem = &ipa->mem[IPA_MEM_MODEM_PROC_CTX]; in init_modem_driver_req()
338 if (mem->size) { in init_modem_driver_req()
341 ipa->mem_offset + mem->offset; in init_modem_driver_req()
343 req.hdr_proc_ctx_tbl_info.start + mem->size - 1; in init_modem_driver_req()
348 mem = &ipa->mem[IPA_MEM_V4_ROUTE_HASHED]; in init_modem_driver_req()
349 if (mem->size) { in init_modem_driver_req()
352 ipa->mem_offset + mem->offset; in init_modem_driver_req()
354 mem->size / IPA_TABLE_ENTRY_SIZE; in init_modem_driver_req()
357 mem = &ipa->mem[IPA_MEM_V6_ROUTE_HASHED]; in init_modem_driver_req()
358 if (mem->size) { in init_modem_driver_req()
361 ipa->mem_offset + mem->offset; in init_modem_driver_req()
363 mem->size / IPA_TABLE_ENTRY_SIZE; in init_modem_driver_req()
366 mem = &ipa->mem[IPA_MEM_V4_FILTER_HASHED]; in init_modem_driver_req()
367 if (mem->size) { in init_modem_driver_req()
369 req.v4_hash_filter_tbl_start = ipa->mem_offset + mem->offset; in init_modem_driver_req()
372 mem = &ipa->mem[IPA_MEM_V6_FILTER_HASHED]; in init_modem_driver_req()
373 if (mem->size) { in init_modem_driver_req()
375 req.v6_hash_filter_tbl_start = ipa->mem_offset + mem->offset; in init_modem_driver_req()
380 if (ipa->version != IPA_VERSION_3_5_1) { in init_modem_driver_req()
381 mem = &ipa->mem[IPA_MEM_STATS_QUOTA]; in init_modem_driver_req()
382 if (mem->size) { in init_modem_driver_req()
385 ipa->mem_offset + mem->offset; in init_modem_driver_req()
387 req.hw_stats_quota_size = ipa->mem_offset + mem->size; in init_modem_driver_req()
390 mem = &ipa->mem[IPA_MEM_STATS_DROP]; in init_modem_driver_req()
391 if (mem->size) { in init_modem_driver_req()
394 ipa->mem_offset + mem->offset; in init_modem_driver_req()
396 req.hw_stats_drop_size = ipa->mem_offset + mem->size; in init_modem_driver_req()
416 qmi = &ipa_qmi->client_handle, in ipa_client_init_driver_work()
419 dev = &ipa->pdev->dev; in ipa_client_init_driver_work()
429 ret = qmi_send_request(qmi, &ipa_qmi->modem_sq, &txn, in ipa_client_init_driver_work()
434 else if ((ret = qmi_txn_wait(&txn, timeout))) in ipa_client_init_driver_work()
438 ipa_qmi->modem_ready = true; in ipa_client_init_driver_work()
440 } else { in ipa_client_init_driver_work()
457 ipa_qmi->modem_sq.sq_family = AF_QIPCRTR; in ipa_client_new_server()
458 ipa_qmi->modem_sq.sq_node = svc->node; in ipa_client_new_server()
459 ipa_qmi->modem_sq.sq_port = svc->port; in ipa_client_new_server()
461 schedule_work(&ipa_qmi->init_driver_work); in ipa_client_new_server()
476 struct ipa_qmi *ipa_qmi = &ipa->qmi; in ipa_qmi_setup()
479 ipa_qmi->initial_boot = true; in ipa_qmi_setup()
487 ret = qmi_handle_init(&ipa_qmi->server_handle, in ipa_qmi_setup()
493 ret = qmi_add_server(&ipa_qmi->server_handle, IPA_HOST_SERVICE_SVC_ID, in ipa_qmi_setup()
501 ret = qmi_handle_init(&ipa_qmi->client_handle, in ipa_qmi_setup()
508 INIT_WORK(&ipa_qmi->init_driver_work, ipa_client_init_driver_work); in ipa_qmi_setup()
510 ret = qmi_add_lookup(&ipa_qmi->client_handle, IPA_MODEM_SERVICE_SVC_ID, in ipa_qmi_setup()
519 qmi_handle_release(&ipa_qmi->client_handle); in ipa_qmi_setup()
520 memset(&ipa_qmi->client_handle, 0, sizeof(ipa_qmi->client_handle)); in ipa_qmi_setup()
523 qmi_handle_release(&ipa_qmi->server_handle); in ipa_qmi_setup()
524 memset(&ipa_qmi->server_handle, 0, sizeof(ipa_qmi->server_handle)); in ipa_qmi_setup()
531 cancel_work_sync(&ipa->qmi.init_driver_work); in ipa_qmi_teardown()
533 qmi_handle_release(&ipa->qmi.client_handle); in ipa_qmi_teardown()
534 memset(&ipa->qmi.client_handle, 0, sizeof(ipa->qmi.client_handle)); in ipa_qmi_teardown()
536 qmi_handle_release(&ipa->qmi.server_handle); in ipa_qmi_teardown()
537 memset(&ipa->qmi.server_handle, 0, sizeof(ipa->qmi.server_handle)); in ipa_qmi_teardown()