drivers/mailbox/bcm74110-mailbox.c
Source file repositories/reference/linux-study-clean/drivers/mailbox/bcm74110-mailbox.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mailbox/bcm74110-mailbox.c- Extension
.c- Size
- 16614 bytes
- Lines
- 657
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/list.hlinux/types.hlinux/workqueue.hlinux/io-64-nonatomic-hi-lo.hlinux/interrupt.hlinux/module.hlinux/platform_device.hlinux/of.hlinux/delay.hlinux/mailbox_controller.hlinux/bitfield.hlinux/slab.h
Detected Declarations
struct bcm74110_mbox_msgstruct bcm74110_mbox_chanstruct bcm74110_mboxfunction bcm74110_rx_push_init_msgfunction bcm74110_rx_process_msgfunction bcm74110_mbox_isrfunction bcm74110_mbox_mask_and_clearfunction bcm74110_rx_pop_init_msgfunction bcm74110_rx_flush_msgfunction list_for_each_entry_safefunction bcm74110_rx_pop_init_msg_blockfunction bcm74110_mbox_create_msgfunction bcm74110_mbox_tx_msgfunction bcm74110_mbox_link_trainingfunction bcm74110_mbox_tx_msg_and_wait_ackfunction bcm74110_mbox_shmem_initfunction bcm74110_mbox_initfunction bcm74110_mbox_send_datafunction bcm74110_mbox_chan_startupfunction bcm74110_mbox_chan_shutdownfunction bcm74110_mbox_shutdownfunction bcm74110_mbox_probe
Annotated Snippet
struct bcm74110_mbox_msg {
struct list_head list_entry;
#define BCM_MSG_VERSION_MASK GENMASK(31, 29)
#define BCM_MSG_VERSION 0x1
#define BCM_MSG_REQ_MASK BIT(28)
#define BCM_MSG_RPLY_MASK BIT(27)
#define BCM_MSG_SVC_MASK GENMASK(26, 24)
#define BCM_MSG_FUNC_MASK GENMASK(23, 16)
#define BCM_MSG_LENGTH_MASK GENMASK(15, 4)
#define BCM_MSG_SLOT_MASK GENMASK(3, 0)
#define BCM_MSG_SET_FIELD(hdr, field, val) \
do { \
hdr &= ~BCM_MSG_##field##_MASK; \
hdr |= FIELD_PREP(BCM_MSG_##field##_MASK, val); \
} while (0)
#define BCM_MSG_GET_FIELD(hdr, field) \
FIELD_GET(BCM_MSG_##field##_MASK, hdr)
u32 msg;
};
struct bcm74110_mbox_chan {
struct bcm74110_mbox *mbox;
bool en;
int slot;
int type;
};
struct bcm74110_mbox {
struct platform_device *pdev;
void __iomem *base;
int tx_chan;
int rx_chan;
int rx_irq;
struct list_head rx_svc_init_list;
spinlock_t rx_svc_list_lock;
struct mbox_controller controller;
struct bcm74110_mbox_chan *mbox_chan;
};
#define BCM74110_OFFSET_IO_WRITEL_MACRO(name, offset_base) \
static void bcm74110_##name##_writel(struct bcm74110_mbox *mbox,\
u32 val, u32 off) \
{ \
writel_relaxed(val, mbox->base + offset_base + off); \
}
BCM74110_OFFSET_IO_WRITEL_MACRO(tx, BCM_MBOX_BASE(mbox->tx_chan));
BCM74110_OFFSET_IO_WRITEL_MACRO(irq, BCM_MBOX_IRQ_BASE(mbox->rx_chan));
#define BCM74110_OFFSET_IO_READL_MACRO(name, offset_base) \
static u32 bcm74110_##name##_readl(struct bcm74110_mbox *mbox, \
u32 off) \
{ \
return readl_relaxed(mbox->base + offset_base + off); \
}
BCM74110_OFFSET_IO_READL_MACRO(tx, BCM_MBOX_BASE(mbox->tx_chan));
BCM74110_OFFSET_IO_READL_MACRO(rx, BCM_MBOX_BASE(mbox->rx_chan));
BCM74110_OFFSET_IO_READL_MACRO(irq, BCM_MBOX_IRQ_BASE(mbox->rx_chan));
static inline struct bcm74110_mbox *bcm74110_mbox_from_cntrl(
struct mbox_controller *cntrl)
{
return container_of(cntrl, struct bcm74110_mbox, controller);
}
static void bcm74110_rx_push_init_msg(struct bcm74110_mbox *mbox, u32 val)
{
struct bcm74110_mbox_msg *msg;
msg = kzalloc_obj(*msg, GFP_ATOMIC);
if (!msg)
return;
INIT_LIST_HEAD(&msg->list_entry);
msg->msg = val;
spin_lock(&mbox->rx_svc_list_lock);
list_add_tail(&msg->list_entry, &mbox->rx_svc_init_list);
spin_unlock(&mbox->rx_svc_list_lock);
}
static void bcm74110_rx_process_msg(struct bcm74110_mbox *mbox)
{
struct device *dev = &mbox->pdev->dev;
struct bcm74110_mbox_chan *chan_priv;
struct mbox_chan *chan;
u32 msg, status;
Annotation
- Immediate include surface: `linux/list.h`, `linux/types.h`, `linux/workqueue.h`, `linux/io-64-nonatomic-hi-lo.h`, `linux/interrupt.h`, `linux/module.h`, `linux/platform_device.h`, `linux/of.h`.
- Detected declarations: `struct bcm74110_mbox_msg`, `struct bcm74110_mbox_chan`, `struct bcm74110_mbox`, `function bcm74110_rx_push_init_msg`, `function bcm74110_rx_process_msg`, `function bcm74110_mbox_isr`, `function bcm74110_mbox_mask_and_clear`, `function bcm74110_rx_pop_init_msg`, `function bcm74110_rx_flush_msg`, `function list_for_each_entry_safe`.
- Atlas domain: Driver Families / drivers/mailbox.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.