drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c
Source file repositories/reference/linux-study-clean/drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c- Extension
.c- Size
- 6128 bytes
- Lines
- 259
- Domain
- Driver Families
- Bucket
- drivers/firmware
- 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.
- 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/bits.hlinux/io.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/scmi_protocol.hlinux/scmi_imx_protocol.h../../protocols.h../../notify.h
Detected Declarations
struct scmi_imx_lmm_privstruct scmi_msg_imx_lmm_protocol_attributesstruct scmi_msg_imx_lmm_attributes_outstruct scmi_imx_lmm_reset_vector_set_instruct scmi_imx_lmm_shutdown_inenum scmi_imx_lmm_protocol_cmdfunction scmi_imx_lmm_validate_lmidfunction scmi_imx_lmm_attributesfunction scmi_imx_lmm_power_bootfunction scmi_imx_lmm_reset_vector_setfunction scmi_imx_lmm_shutdownfunction scmi_imx_lmm_protocol_attributes_getfunction scmi_imx_lmm_protocol_init
Annotated Snippet
struct scmi_imx_lmm_priv {
u32 nr_lmm;
};
#define SCMI_IMX_LMM_NR_LM_MASK GENMASK(5, 0)
#define SCMI_IMX_LMM_NR_MAX 16
struct scmi_msg_imx_lmm_protocol_attributes {
__le32 attributes;
};
struct scmi_msg_imx_lmm_attributes_out {
__le32 lmid;
__le32 attributes;
__le32 state;
__le32 errstatus;
u8 name[LMM_MAX_NAME];
};
struct scmi_imx_lmm_reset_vector_set_in {
__le32 lmid;
__le32 cpuid;
__le32 flags; /* reserved for future extension */
__le32 resetvectorlow;
__le32 resetvectorhigh;
};
struct scmi_imx_lmm_shutdown_in {
__le32 lmid;
#define SCMI_IMX_LMM_SHUTDOWN_GRACEFUL BIT(0)
__le32 flags;
};
static int scmi_imx_lmm_validate_lmid(const struct scmi_protocol_handle *ph, u32 lmid)
{
struct scmi_imx_lmm_priv *priv = ph->get_priv(ph);
if (lmid >= priv->nr_lmm)
return -EINVAL;
return 0;
}
static int scmi_imx_lmm_attributes(const struct scmi_protocol_handle *ph,
u32 lmid, struct scmi_imx_lmm_info *info)
{
struct scmi_msg_imx_lmm_attributes_out *out;
struct scmi_xfer *t;
int ret;
ret = ph->xops->xfer_get_init(ph, SCMI_IMX_LMM_ATTRIBUTES, sizeof(u32), 0, &t);
if (ret)
return ret;
put_unaligned_le32(lmid, t->tx.buf);
ret = ph->xops->do_xfer(ph, t);
if (!ret) {
out = t->rx.buf;
info->lmid = le32_to_cpu(out->lmid);
info->state = le32_to_cpu(out->state);
info->errstatus = le32_to_cpu(out->errstatus);
strscpy(info->name, out->name);
dev_dbg(ph->dev, "i.MX LMM: Logical Machine(%d), name: %s\n",
info->lmid, info->name);
} else {
dev_err(ph->dev, "i.MX LMM: Failed to get info of Logical Machine(%u)\n", lmid);
}
ph->xops->xfer_put(ph, t);
return ret;
}
static int
scmi_imx_lmm_power_boot(const struct scmi_protocol_handle *ph, u32 lmid, bool boot)
{
struct scmi_xfer *t;
u8 msg_id;
int ret;
ret = scmi_imx_lmm_validate_lmid(ph, lmid);
if (ret)
return ret;
if (boot)
msg_id = SCMI_IMX_LMM_BOOT;
else
msg_id = SCMI_IMX_LMM_POWER_ON;
ret = ph->xops->xfer_get_init(ph, msg_id, sizeof(u32), 0, &t);
if (ret)
Annotation
- Immediate include surface: `linux/bits.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/scmi_protocol.h`, `linux/scmi_imx_protocol.h`, `../../protocols.h`.
- Detected declarations: `struct scmi_imx_lmm_priv`, `struct scmi_msg_imx_lmm_protocol_attributes`, `struct scmi_msg_imx_lmm_attributes_out`, `struct scmi_imx_lmm_reset_vector_set_in`, `struct scmi_imx_lmm_shutdown_in`, `enum scmi_imx_lmm_protocol_cmd`, `function scmi_imx_lmm_validate_lmid`, `function scmi_imx_lmm_attributes`, `function scmi_imx_lmm_power_boot`, `function scmi_imx_lmm_reset_vector_set`.
- Atlas domain: Driver Families / drivers/firmware.
- Implementation status: source implementation candidate.
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.