drivers/mailbox/mailbox-mchp-ipc-sbi.c
Source file repositories/reference/linux-study-clean/drivers/mailbox/mailbox-mchp-ipc-sbi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mailbox/mailbox-mchp-ipc-sbi.c- Extension
.c- Size
- 13980 bytes
- Lines
- 502
- 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/io.hlinux/err.hlinux/smp.hlinux/init.hlinux/module.hlinux/kernel.hlinux/of_device.hlinux/interrupt.hlinux/dma-mapping.hlinux/platform_device.hlinux/mailbox/mchp-ipc.hasm/sbi.hasm/vendorid_list.h
Detected Declarations
struct mchp_ipc_mbox_infostruct mchp_ipc_initstruct mchp_ipc_statusstruct mchp_ipc_sbi_msgstruct mchp_ipc_cluster_cfgstruct mchp_ipc_sbi_mboxenum ipc_hwfunction mchp_ipc_sbi_chan_sendfunction mchp_ipc_sbi_sendfunction mchp_ipc_prepare_receive_reqfunction mchp_ipc_process_received_datafunction mchp_ipc_cluster_aggr_isrfunction registerfunction mchp_ipc_send_datafunction mchp_ipc_startupfunction mchp_ipc_shutdownfunction mchp_ipc_get_cluster_aggr_irqfunction for_each_online_cpufunction mchp_ipc_probe
Annotated Snippet
struct mchp_ipc_mbox_info {
enum ipc_hw hw_type;
u8 num_channels;
};
/**
* struct mchp_ipc_init - IPC channel init message format
*
* @max_msg_size: maxmimum message size in bytes of a given channel
*
* struct used by the SBI_EXT_IPC_CH_INIT SBI function id to get
* the max message size in bytes of the initialized channel.
*/
struct mchp_ipc_init {
u16 max_msg_size;
};
/**
* struct mchp_ipc_status - IPC status message format
*
* @status: interrupt status for all channels associated to a cluster
* @cluster: specifies the cluster instance that originated an irq
*
* struct used by the SBI_EXT_IPC_STATUS SBI function id to get
* the message present and message clear interrupt status for all the
* channels associated to a cluster.
*/
struct mchp_ipc_status {
u32 status;
u8 cluster;
};
/**
* struct mchp_ipc_sbi_msg - IPC SBI payload message
*
* @buf_addr: physical address where the received data should be copied to
* @size: maximum size(in bytes) that can be stored in the buffer pointed to by `buf`
* @irq_type: mask representing the irq types that triggered an irq
*
* struct used by the SBI_EXT_IPC_SEND/SBI_EXT_IPC_RECEIVE SBI function
* ids to send/receive a message from an associated processor using
* the IPC.
*/
struct mchp_ipc_sbi_msg {
u64 buf_addr;
u16 size;
u8 irq_type;
};
struct mchp_ipc_cluster_cfg {
void *buf_base;
phys_addr_t buf_base_addr;
int irq;
};
struct mchp_ipc_sbi_mbox {
struct device *dev;
struct mbox_chan *chans;
struct mchp_ipc_cluster_cfg *cluster_cfg;
void *buf_base;
unsigned long buf_base_addr;
struct mbox_controller controller;
enum ipc_hw hw_type;
};
static int mchp_ipc_sbi_chan_send(u32 command, u32 channel, unsigned long address)
{
struct sbiret ret;
ret = sbi_ecall(SBI_EXT_MICROCHIP_TECHNOLOGY, command, channel,
address, 0, 0, 0, 0);
if (ret.error)
return sbi_err_map_linux_errno(ret.error);
else
return ret.value;
}
static int mchp_ipc_sbi_send(u32 command, unsigned long address)
{
struct sbiret ret;
ret = sbi_ecall(SBI_EXT_MICROCHIP_TECHNOLOGY, command, address,
0, 0, 0, 0, 0);
if (ret.error)
return sbi_err_map_linux_errno(ret.error);
else
return ret.value;
}
Annotation
- Immediate include surface: `linux/io.h`, `linux/err.h`, `linux/smp.h`, `linux/init.h`, `linux/module.h`, `linux/kernel.h`, `linux/of_device.h`, `linux/interrupt.h`.
- Detected declarations: `struct mchp_ipc_mbox_info`, `struct mchp_ipc_init`, `struct mchp_ipc_status`, `struct mchp_ipc_sbi_msg`, `struct mchp_ipc_cluster_cfg`, `struct mchp_ipc_sbi_mbox`, `enum ipc_hw`, `function mchp_ipc_sbi_chan_send`, `function mchp_ipc_sbi_send`, `function mchp_ipc_prepare_receive_req`.
- 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.