/* Set the number of protocols to be skipped/already read */
*num_skip = cpu_to_le32(tot_num_ret);
ret = ph->xops->do_xfer(ph, t); if (ret) break;
loop_num_ret = le32_to_cpu(*num_ret); if (!loop_num_ret) break;
if (loop_num_ret > rev->num_protocols - tot_num_ret) {
dev_err(dev, "No. Returned protocols > Total protocols.\n"); break;
}
if (t->rx.len < (sizeof(u32) * 2)) {
dev_err(dev, "Truncated reply - rx.len:%zd\n",
t->rx.len);
ret = -EPROTO; break;
}
real_list_sz = t->rx.len - sizeof(u32);
calc_list_sz = (1 + (loop_num_ret - 1) / sizeof(u32)) * sizeof(u32); if (calc_list_sz != real_list_sz) {
dev_warn(dev, "Malformed reply - real_sz:%zd calc_sz:%u (loop_num_ret:%d)\n",
real_list_sz, calc_list_sz, loop_num_ret); /* * Bail out if the expected list size is bigger than the * total payload size of the received reply.
*/ if (calc_list_sz > real_list_sz) {
ret = -EPROTO; break;
}
}
ph->xops->reset_rx_to_maxsz(ph, t);
} while (tot_num_ret < rev->num_protocols);
ph->xops->xfer_put(ph, t);
return ret;
}
/** * scmi_base_discover_agent_get() - discover the name of an agent * * @ph: SCMI protocol handle * @id: Agent identifier * @name: Agent identifier ASCII string * * An agent id of 0 is reserved to identify the platform itself. * Generally operating system is represented as "OSPM" * * Return: 0 on success, else appropriate SCMI error.
*/ staticint scmi_base_discover_agent_get(conststruct scmi_protocol_handle *ph, int id, char *name)
{ int ret; struct scmi_msg_resp_base_discover_agent *agent_info; struct scmi_xfer *t;
ret = ph->xops->xfer_get_init(ph, BASE_DISCOVER_AGENT, sizeof(__le32), sizeof(*agent_info), &t); if (ret) return ret;
put_unaligned_le32(id, t->tx.buf);
ret = ph->xops->do_xfer(ph, t); if (!ret) {
agent_info = t->rx.buf;
strscpy(name, agent_info->name, SCMI_SHORT_NAME_MAX_SIZE);
}
/* * BaseError notification payload is variable in size but * up to a maximum length determined by the struct ponted by p. * Instead payld_sz is the effective length of this notification * payload so cannot be greater of the maximum allowed size as * pointed by p.
*/ if (evt_id != SCMI_EVENT_BASE_ERROR_EVENT || sizeof(*p) < payld_sz) return NULL;
r->timestamp = timestamp;
r->agent_id = le32_to_cpu(p->agent_id);
r->fatal = IS_FATAL_ERROR(le32_to_cpu(p->error_status));
r->cmd_count = ERROR_CMD_COUNT(le32_to_cpu(p->error_status)); for (i = 0; i < r->cmd_count; i++)
r->reports[i] = le64_to_cpu(p->msg_reports[i]);
*src_id = 0;
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.