/* If requested (and not already sent) send the INIT_COMPLETE indication */ staticvoid ipa_qmi_indication(struct ipa_qmi *ipa_qmi)
{ if (!ipa_qmi->indication_requested) return;
if (ipa_qmi->indication_sent) return;
ipa_server_init_complete(ipa_qmi);
}
/* Determine whether everything is ready to start normal operation. *Weknoweverything(else)isreadywhenweknowtheIPAdriveron *themodemisready,andthemicrocontrollerisready. * *Whenthemodemboots(orreboots),thehandshakesequencestarts *withtheAPsendingthemodemanINIT_DRIVERrequest.Within *thatrequest,theuc_loadedflagwillbezero(false)foran *initialboot,non-zero(true)forasubsequent(SSR)boot.
*/ staticvoid ipa_qmi_ready(struct ipa_qmi *ipa_qmi)
{ struct ipa *ipa; int ret;
/* We aren't ready until the modem and microcontroller are */ if (!ipa_qmi->modem_ready || !ipa_qmi->uc_ready) return;
/* Send the indication message if it was requested */
ipa_qmi_indication(ipa_qmi);
/* The initial boot requires us to send the indication. */ if (ipa_qmi->initial_boot) { if (!ipa_qmi->indication_sent) return;
/* We're ready. Start up normal operation */
ipa = container_of(ipa_qmi, struct ipa, qmi);
ret = ipa_modem_start(ipa); if (ret)
dev_err(ipa->dev, "error %d starting modem\n", ret);
}
/* All QMI clients from the modem node are gone (modem shut down or crashed). */ staticvoid ipa_server_bye(struct qmi_handle *qmi, unsignedint node)
{ struct ipa_qmi *ipa_qmi;
mem = ipa_mem_find(ipa, IPA_MEM_V4_FILTER_HASHED); if (mem->size) {
req.v4_hash_filter_tbl_start_valid = 1;
req.v4_hash_filter_tbl_start = ipa->mem_offset + mem->offset;
}
mem = ipa_mem_find(ipa, IPA_MEM_V6_FILTER_HASHED); if (mem->size) {
req.v6_hash_filter_tbl_start_valid = 1;
req.v6_hash_filter_tbl_start = ipa->mem_offset + mem->offset;
}
/* The stats fields are only valid for IPA v4.0+ */ if (ipa->version >= IPA_VERSION_4_0) {
mem = ipa_mem_find(ipa, IPA_MEM_STATS_QUOTA_MODEM); if (mem->size) {
req.hw_stats_quota_base_addr_valid = 1;
req.hw_stats_quota_base_addr =
ipa->mem_offset + mem->offset;
req.hw_stats_quota_size_valid = 1;
req.hw_stats_quota_size = ipa->mem_offset + mem->size;
}
/* If the DROP stats region is defined, include it */
mem = ipa_mem_find(ipa, IPA_MEM_STATS_DROP); if (mem && mem->size) {
req.hw_stats_drop_base_addr_valid = 1;
req.hw_stats_drop_base_addr =
ipa->mem_offset + mem->offset;
req.hw_stats_drop_size_valid = 1;
req.hw_stats_drop_size = ipa->mem_offset + mem->size;
}
}
return &req;
}
/* Send an INIT_DRIVER request to the modem, and wait for it to complete. */ staticvoid ipa_client_init_driver_work(struct work_struct *work)
{ unsignedlong timeout = msecs_to_jiffies(QMI_INIT_DRIVER_TIMEOUT); conststruct ipa_init_modem_driver_req *req; struct ipa_qmi *ipa_qmi; struct qmi_handle *qmi; struct qmi_txn txn; struct device *dev; struct ipa *ipa; int ret;
/* Send the request, and if successful wait for its response */
req = init_modem_driver_req(ipa_qmi);
ret = qmi_send_request(qmi, &ipa_qmi->modem_sq, &txn,
IPA_QMI_INIT_DRIVER, IPA_QMI_INIT_DRIVER_REQ_SZ,
ipa_init_modem_driver_req_ei, req); if (ret)
dev_err(dev, "error %d sending init driver request\n", ret); elseif ((ret = qmi_txn_wait(&txn, timeout)))
dev_err(dev, "error %d awaiting init driver response\n", ret);
if (!ret) {
ipa_qmi->modem_ready = true;
ipa_qmi_ready(ipa_qmi); /* We might be ready now */
} else { /* If any error occurs we need to cancel the transaction */
qmi_txn_cancel(&txn);
}
}
/* The modem server is now available. We will send an INIT_DRIVER request *tothemodem,butcan'twaitforittocompleteinthiscallbackthread. *Scheduleaworkerontheglobalworkqueuetodothatforus.
*/ staticint
ipa_client_new_server(struct qmi_handle *qmi, struct qmi_service *svc)
{ struct ipa_qmi *ipa_qmi;
/* Set up for QMI message exchange */ int ipa_qmi_setup(struct ipa *ipa)
{ struct ipa_qmi *ipa_qmi = &ipa->qmi; int ret;
ipa_qmi->initial_boot = true;
/* The server handle is used to handle the DRIVER_INIT_COMPLETE *requestonthefirstmodemboot.Italsoreceivesthe *INDICATION_REGISTERrequestonthefirstbootand(optionally) *subsequentboots.TheINIT_COMPLETEindicationmessageis *sentovertheserverhandleifrequested.
*/
ret = qmi_handle_init(&ipa_qmi->server_handle,
IPA_QMI_SERVER_MAX_RCV_SZ, &ipa_server_ops,
ipa_server_msg_handlers); if (ret) return ret;
ret = qmi_add_server(&ipa_qmi->server_handle, IPA_HOST_SERVICE_SVC_ID,
IPA_HOST_SVC_VERS, IPA_HOST_SERVICE_INS_ID); if (ret) goto err_server_handle_release;
/* The client handle is only used for sending an INIT_DRIVER request *tothemodem,andreceivingitsresponsemessage.
*/
ret = qmi_handle_init(&ipa_qmi->client_handle,
IPA_QMI_CLIENT_MAX_RCV_SZ, &ipa_client_ops,
ipa_client_msg_handlers); if (ret) goto err_server_handle_release;
/* We need this ready before the service lookup is added */
INIT_WORK(&ipa_qmi->init_driver_work, ipa_client_init_driver_work);
ret = qmi_add_lookup(&ipa_qmi->client_handle, IPA_MODEM_SERVICE_SVC_ID,
IPA_MODEM_SVC_VERS, IPA_MODEM_SERVICE_INS_ID); if (ret) goto err_client_handle_release;
return0;
err_client_handle_release: /* Releasing the handle also removes registered lookups */
qmi_handle_release(&ipa_qmi->client_handle);
memset(&ipa_qmi->client_handle, 0, sizeof(ipa_qmi->client_handle));
err_server_handle_release: /* Releasing the handle also removes registered services */
qmi_handle_release(&ipa_qmi->server_handle);
memset(&ipa_qmi->server_handle, 0, sizeof(ipa_qmi->server_handle));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.