// SPDX-License-Identifier: GPL-2.0 /* * System Control and Management Interface (SCMI) Message Mailbox Transport * driver. * * Copyright (C) 2019-2024 ARM Ltd.
*/
/* * An A2P IRQ is NOT valid when received while the platform still has * the ownership of the channel, because the platform at first releases * the SMT channel and then sends the completion interrupt. * * This addresses a possible race condition in which a spurious IRQ from * a previous timed-out reply which arrived late could be wrongly * associated with the next pending transaction.
*/ if (cl->knows_txdone &&
!core->shmem->channel_free(smbox->shmem)) {
dev_warn(smbox->cinfo->dev, "Ignoring spurious A2P IRQ !\n");
core->bad_message_trace(smbox->cinfo,
core->shmem->read_header(smbox->shmem),
MSG_MBOX_SPURIOUS); return;
}
staticbool mailbox_chan_available(struct device_node *of_node, int idx)
{ int num_mb;
/* * Just check if bidirrectional channels are involved, and check the * index accordingly; proper full validation will be made later * in mailbox_chan_setup().
*/
num_mb = of_count_phandle_with_args(of_node, "mboxes", "#mbox-cells"); if (num_mb == 3 && idx == 1)
idx = 2;
/** * mailbox_chan_validate - Validate transport configuration and map channels * * @cdev: Reference to the underlying transport device carrying the * of_node descriptor to analyze. * @a2p_rx_chan: A reference to an optional unidirectional channel to use * for replies on the a2p channel. Set as zero if not present. * @p2a_chan: A reference to the optional p2a channel. * Set as zero if not present. * @p2a_rx_chan: A reference to the optional p2a completion channel. * Set as zero if not present. * * At first, validate the transport configuration as described in terms of * 'mboxes' and 'shmem', then determin which mailbox channel indexes are * appropriate to be use in the current configuration. * * Return: 0 on Success or error
*/ staticint mailbox_chan_validate(struct device *cdev, int *a2p_rx_chan, int *p2a_chan, int *p2a_rx_chan)
{ int num_mb, num_sh, ret = 0; struct device_node *np = cdev->of_node;
/* * The mailbox layer has its own queue. However the mailbox queue * confuses the per message SCMI timeouts since the clock starts when * the message is submitted into the mailbox queue. So when multiple * messages are queued up the clock starts on all messages instead of * only the one inflight.
*/
mutex_lock(&smbox->chan_lock);
ret = mbox_send_message(smbox->chan, xfer); /* mbox_send_message returns non-negative value on success */ if (ret < 0) {
mutex_unlock(&smbox->chan_lock); return ret;
}
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.