mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 07:21:22 +01:00
lib: utils/mailbox: Parse P2A doorbell system MSI index from DT
The P2A doorbell system MSI index is expected to be discovered from device tree instead of RPMI system MSI service group attribute. This is based on ARC feedback before RPMI spec was frozen. Let's parse P2A doorbell system MSI index from device tree and also expose it as rpmi channel attribute to RPMI client drivers. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Link: https://lore.kernel.org/r/20250512083827.804151-3-apatel@ventanamicro.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
@@ -193,6 +193,7 @@ struct rpmi_message_args {
|
||||
enum rpmi_channel_attribute_id {
|
||||
RPMI_CHANNEL_ATTR_PROTOCOL_VERSION = 0,
|
||||
RPMI_CHANNEL_ATTR_MAX_DATA_LEN,
|
||||
RPMI_CHANNEL_ATTR_P2A_DOORBELL_SYSMSI_INDEX,
|
||||
RPMI_CHANNEL_ATTR_TX_TIMEOUT,
|
||||
RPMI_CHANNEL_ATTR_RX_TIMEOUT,
|
||||
RPMI_CHANNEL_ATTR_SERVICEGROUP_ID,
|
||||
|
@@ -133,6 +133,7 @@ struct rpmi_shmem_mbox_controller {
|
||||
/* Driver specific members */
|
||||
u32 slot_size;
|
||||
u32 queue_count;
|
||||
u32 p2a_doorbell_sysmsi_index;
|
||||
struct rpmi_mb_regs *mb_regs;
|
||||
struct smq_queue_ctx queue_ctx_tbl[RPMI_QUEUE_IDX_MAX_COUNT];
|
||||
/* Mailbox framework related members */
|
||||
@@ -505,6 +506,9 @@ static int rpmi_shmem_mbox_get_attribute(struct mbox_chan *chan,
|
||||
case RPMI_CHANNEL_ATTR_MAX_DATA_LEN:
|
||||
*((u32 *)out_value) = RPMI_MSG_DATA_SIZE(mctl->slot_size);
|
||||
break;
|
||||
case RPMI_CHANNEL_ATTR_P2A_DOORBELL_SYSMSI_INDEX:
|
||||
*((u32 *)out_value) = mctl->p2a_doorbell_sysmsi_index;
|
||||
break;
|
||||
case RPMI_CHANNEL_ATTR_TX_TIMEOUT:
|
||||
*((u32 *)out_value) = RPMI_DEF_TX_TIMEOUT;
|
||||
break;
|
||||
@@ -574,9 +578,9 @@ static int rpmi_shmem_transport_init(struct rpmi_shmem_mbox_controller *mctl,
|
||||
const void *fdt, int nodeoff)
|
||||
{
|
||||
const char *name;
|
||||
const fdt32_t *prop;
|
||||
int count, len, ret, qid;
|
||||
uint64_t reg_addr, reg_size;
|
||||
const fdt32_t *prop_slotsz;
|
||||
struct smq_queue_ctx *qctx;
|
||||
|
||||
ret = fdt_node_check_compatible(fdt, nodeoff,
|
||||
@@ -585,17 +589,21 @@ static int rpmi_shmem_transport_init(struct rpmi_shmem_mbox_controller *mctl,
|
||||
return ret;
|
||||
|
||||
/* get queue slot size in bytes */
|
||||
prop_slotsz = fdt_getprop(fdt, nodeoff, "riscv,slot-size", &len);
|
||||
if (!prop_slotsz)
|
||||
prop = fdt_getprop(fdt, nodeoff, "riscv,slot-size", &len);
|
||||
if (!prop)
|
||||
return SBI_ENOENT;
|
||||
|
||||
mctl->slot_size = fdt32_to_cpu(*prop_slotsz);
|
||||
mctl->slot_size = fdt32_to_cpu(*prop);
|
||||
if (mctl->slot_size < RPMI_SLOT_SIZE_MIN) {
|
||||
sbi_printf("%s: slot_size < mimnum required message size\n",
|
||||
__func__);
|
||||
mctl->slot_size = RPMI_SLOT_SIZE_MIN;
|
||||
}
|
||||
|
||||
/* get p2a doorbell system MSI index */
|
||||
prop = fdt_getprop(fdt, nodeoff, "riscv,p2a-doorbell-sysmsi-index", &len);
|
||||
mctl->p2a_doorbell_sysmsi_index = prop ? fdt32_to_cpu(*prop) : -1U;
|
||||
|
||||
/*
|
||||
* queue names count is taken as the number of queues
|
||||
* supported which make it mandatory to provide the
|
||||
|
Reference in New Issue
Block a user