drivers/mailbox/riscv-sbi-mpxy-mbox.c
Source file repositories/reference/linux-study-clean/drivers/mailbox/riscv-sbi-mpxy-mbox.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mailbox/riscv-sbi-mpxy-mbox.c- Extension
.c- Size
- 26930 bytes
- Lines
- 1020
- Domain
- Driver Families
- Bucket
- drivers/mailbox
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/cpu.hlinux/errno.hlinux/init.hlinux/irqchip/riscv-imsic.hlinux/mailbox_controller.hlinux/mailbox/riscv-rpmi-message.hlinux/minmax.hlinux/mm.hlinux/module.hlinux/msi.hlinux/of_irq.hlinux/percpu.hlinux/platform_device.hlinux/smp.hlinux/string.hlinux/types.hasm/byteorder.hasm/sbi.h
Detected Declarations
struct sbi_mpxy_msi_infostruct sbi_mpxy_channel_attrsstruct sbi_mpxy_rpmi_channel_attrsstruct sbi_mpxy_channel_ids_datastruct sbi_mpxy_notification_datastruct mpxy_localstruct mpxy_mbox_channelstruct mpxy_mboxfunction mpxy_get_channel_countfunction mpxy_get_channel_idsfunction mpxy_read_attrsfunction mpxy_write_attrsfunction mpxy_send_message_with_respfunction mpxy_send_message_without_respfunction mpxy_get_notificationsfunction mpxy_get_shmem_sizefunction mpxy_setup_shmemfunction mpxy_mbox_send_rpmi_datafunction mpxy_mbox_peek_rpmi_datafunction mpxy_mbox_read_rpmi_attrsfunction mpxy_mbox_send_datafunction mpxy_mbox_peek_datafunction mpxy_mbox_irq_threadfunction mpxy_mbox_setup_msifunction mpxy_mbox_cleanup_msifunction mpxy_mbox_setup_eventsfunction mpxy_mbox_cleanup_eventsfunction mpxy_mbox_startupfunction mpxy_mbox_shutdownfunction mpxy_mbox_msi_writefunction mpxy_mbox_populate_channelsfunction mpxy_mbox_probefunction sbi_probe_extensionfunction mpxy_mbox_remove
Annotated Snippet
struct sbi_mpxy_msi_info {
/* Lower 32-bits of the MSI target address */
u32 msi_addr_lo;
/* Upper 32-bits of the MSI target address */
u32 msi_addr_hi;
/* MSI data value */
u32 msi_data;
};
/*
* SBI MPXY standard channel attributes.
*
* NOTE: The sequence of attribute fields are as-per the
* defined sequence in the attribute table in spec (or
* as-per the enum sbi_mpxy_attribute_id).
*/
struct sbi_mpxy_channel_attrs {
/* Message protocol ID */
u32 msg_proto_id;
/* Message protocol version */
u32 msg_proto_version;
/* Message protocol maximum message length */
u32 msg_max_len;
/* Message protocol message send timeout in microseconds */
u32 msg_send_timeout;
/* Message protocol message completion timeout in microseconds */
u32 msg_completion_timeout;
/* Bit array for channel capabilities */
u32 capability;
/* SSE event ID */
u32 sse_event_id;
/* MSI enable/disable control knob */
u32 msi_control;
/* Channel MSI info */
struct sbi_mpxy_msi_info msi_info;
/* Events state control */
u32 events_state_ctrl;
};
/*
* RPMI specific SBI MPXY channel attributes.
*
* NOTE: The sequence of attribute fields are as-per the
* defined sequence in the attribute table in spec (or
* as-per the enum sbi_mpxy_rpmi_attribute_id).
*/
struct sbi_mpxy_rpmi_channel_attrs {
/* RPMI service group ID */
u32 servicegroup_id;
/* RPMI service group version */
u32 servicegroup_version;
/* RPMI implementation ID */
u32 impl_id;
/* RPMI implementation version */
u32 impl_version;
};
/* SBI MPXY channel IDs data in shared memory */
struct sbi_mpxy_channel_ids_data {
/* Remaining number of channel ids */
__le32 remaining;
/* Returned channel ids in current function call */
__le32 returned;
/* Returned channel id array */
__le32 channel_array[];
};
/* SBI MPXY notification data in shared memory */
struct sbi_mpxy_notification_data {
/* Remaining number of notification events */
__le32 remaining;
/* Number of notification events returned */
__le32 returned;
/* Number of notification events lost */
__le32 lost;
/* Reserved for future use */
__le32 reserved;
/* Returned channel id array */
u8 events_data[];
};
/* ====== MPXY data structures & helper routines ====== */
/* MPXY Per-CPU or local context */
struct mpxy_local {
/* Shared memory base address */
void *shmem;
/* Shared memory physical address */
phys_addr_t shmem_phys_addr;
/* Flag representing whether shared memory is active or not */
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/cpu.h`, `linux/errno.h`, `linux/init.h`, `linux/irqchip/riscv-imsic.h`, `linux/mailbox_controller.h`, `linux/mailbox/riscv-rpmi-message.h`, `linux/minmax.h`.
- Detected declarations: `struct sbi_mpxy_msi_info`, `struct sbi_mpxy_channel_attrs`, `struct sbi_mpxy_rpmi_channel_attrs`, `struct sbi_mpxy_channel_ids_data`, `struct sbi_mpxy_notification_data`, `struct mpxy_local`, `struct mpxy_mbox_channel`, `struct mpxy_mbox`, `function mpxy_get_channel_count`, `function mpxy_get_channel_ids`.
- Atlas domain: Driver Families / drivers/mailbox.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.