drivers/remoteproc/st_remoteproc.c
Source file repositories/reference/linux-study-clean/drivers/remoteproc/st_remoteproc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/remoteproc/st_remoteproc.c- Extension
.c- Size
- 11384 bytes
- Lines
- 459
- Domain
- Driver Families
- Bucket
- drivers/remoteproc
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk.hlinux/dma-mapping.hlinux/err.hlinux/interrupt.hlinux/kernel.hlinux/mailbox_client.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/of_reserved_mem.hlinux/platform_device.hlinux/property.hlinux/regmap.hlinux/remoteproc.hlinux/reset.hremoteproc_internal.h
Detected Declarations
struct st_rproc_configstruct st_rprocfunction st_rproc_mbox_callbackfunction st_rproc_mbox_callback_vq0function st_rproc_mbox_callback_vq1function st_rproc_kickfunction st_rproc_mem_allocfunction st_rproc_mem_releasefunction st_rproc_parse_fwfunction st_rproc_startfunction st_rproc_stopfunction st_rproc_statefunction st_rproc_parse_dtfunction st_rproc_probefunction st_rproc_remove
Annotated Snippet
struct st_rproc_config {
bool sw_reset;
bool pwr_reset;
unsigned long bootaddr_mask;
};
struct st_rproc {
struct st_rproc_config *config;
struct reset_control *sw_reset;
struct reset_control *pwr_reset;
struct clk *clk;
u32 clk_rate;
struct regmap *boot_base;
u32 boot_offset;
struct mbox_chan *mbox_chan[ST_RPROC_MAX_VRING * MBOX_MAX];
struct mbox_client mbox_client_vq0;
struct mbox_client mbox_client_vq1;
};
static void st_rproc_mbox_callback(struct device *dev, u32 msg)
{
struct rproc *rproc = dev_get_drvdata(dev);
if (rproc_vq_interrupt(rproc, msg) == IRQ_NONE)
dev_dbg(dev, "no message was found in vqid %d\n", msg);
}
static
void st_rproc_mbox_callback_vq0(struct mbox_client *mbox_client, void *data)
{
st_rproc_mbox_callback(mbox_client->dev, 0);
}
static
void st_rproc_mbox_callback_vq1(struct mbox_client *mbox_client, void *data)
{
st_rproc_mbox_callback(mbox_client->dev, 1);
}
static void st_rproc_kick(struct rproc *rproc, int vqid)
{
struct st_rproc *ddata = rproc->priv;
struct device *dev = rproc->dev.parent;
int ret;
/* send the index of the triggered virtqueue in the mailbox payload */
if (WARN_ON(vqid >= ST_RPROC_MAX_VRING))
return;
ret = mbox_send_message(ddata->mbox_chan[vqid * MBOX_MAX + MBOX_TX],
(void *)&vqid);
if (ret < 0)
dev_err(dev, "failed to send message via mbox: %d\n", ret);
}
static int st_rproc_mem_alloc(struct rproc *rproc,
struct rproc_mem_entry *mem)
{
struct device *dev = rproc->dev.parent;
void *va;
va = ioremap_wc(mem->dma, mem->len);
if (!va) {
dev_err(dev, "Unable to map memory region: %pa+%zx\n",
&mem->dma, mem->len);
return -ENOMEM;
}
/* Update memory entry va */
mem->va = va;
return 0;
}
static int st_rproc_mem_release(struct rproc *rproc,
struct rproc_mem_entry *mem)
{
iounmap(mem->va);
return 0;
}
static int st_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw)
{
struct device *dev = rproc->dev.parent;
struct device_node *np = dev->of_node;
struct rproc_mem_entry *mem;
int entries;
entries = of_reserved_mem_region_count(np);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/dma-mapping.h`, `linux/err.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/mailbox_client.h`, `linux/mfd/syscon.h`, `linux/module.h`.
- Detected declarations: `struct st_rproc_config`, `struct st_rproc`, `function st_rproc_mbox_callback`, `function st_rproc_mbox_callback_vq0`, `function st_rproc_mbox_callback_vq1`, `function st_rproc_kick`, `function st_rproc_mem_alloc`, `function st_rproc_mem_release`, `function st_rproc_parse_fw`, `function st_rproc_start`.
- Atlas domain: Driver Families / drivers/remoteproc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.