drivers/firmware/arm_scpi.c
Source file repositories/reference/linux-study-clean/drivers/firmware/arm_scpi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/arm_scpi.c- Extension
.c- Size
- 27029 bytes
- Lines
- 1060
- Domain
- Driver Families
- Bucket
- drivers/firmware
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/bitmap.hlinux/bitfield.hlinux/cleanup.hlinux/device.hlinux/err.hlinux/export.hlinux/io.hlinux/kernel.hlinux/list.hlinux/mailbox_client.hlinux/module.hlinux/of.hlinux/of_address.hlinux/of_platform.hlinux/platform_device.hlinux/printk.hlinux/property.hlinux/pm_opp.hlinux/scpi_protocol.hlinux/slab.hlinux/sort.hlinux/spinlock.h
Detected Declarations
struct scpi_xferstruct scpi_chanstruct scpi_drvinfostruct scpi_shared_memstruct legacy_scpi_shared_memstruct scp_capabilitiesstruct clk_get_infostruct clk_set_valuestruct legacy_clk_set_valuestruct dvfs_infostruct dvfs_setstruct _scpi_sensor_infostruct dev_pstate_setenum scpi_error_codesenum scpi_std_cmdenum legacy_scpi_std_cmdenum scpi_drv_cmdsfunction scpi_to_linux_errnofunction scpi_process_cmdfunction list_for_each_entryfunction scpi_handle_remote_msgfunction scpi_tx_preparefunction put_scpi_xferfunction scpi_send_messagefunction scpi_get_versionfunction scpi_clk_get_rangefunction scpi_clk_get_valfunction scpi_clk_set_valfunction legacy_scpi_clk_set_valfunction scpi_dvfs_get_idxfunction scpi_dvfs_set_idxfunction opp_cmp_funcfunction scpi_dev_domain_idfunction scpi_dvfs_get_transition_latencyfunction scpi_dvfs_add_opps_to_devicefunction scpi_sensor_get_capabilityfunction scpi_sensor_get_infofunction scpi_sensor_get_valuefunction scpi_device_get_power_statefunction scpi_device_set_power_statefunction scpi_init_versionsfunction protocol_version_showfunction firmware_version_showfunction scpi_free_channelsfunction scpi_removefunction scpi_alloc_xfer_listfunction scpi_probeexport get_scpi_ops
Annotated Snippet
struct scpi_xfer {
u32 slot; /* has to be first element */
u32 cmd;
u32 status;
const void *tx_buf;
void *rx_buf;
unsigned int tx_len;
unsigned int rx_len;
struct list_head node;
struct completion done;
};
struct scpi_chan {
struct mbox_client cl;
struct mbox_chan *chan;
void __iomem *tx_payload;
void __iomem *rx_payload;
struct list_head rx_pending;
struct list_head xfers_list;
struct scpi_xfer *xfers;
spinlock_t rx_lock; /* locking for the rx pending list */
struct mutex xfers_lock;
u8 token;
};
struct scpi_drvinfo {
u32 protocol_version;
u32 firmware_version;
bool is_legacy;
int num_chans;
int *commands;
DECLARE_BITMAP(cmd_priority, LEGACY_SCPI_CMD_COUNT);
atomic_t next_chan;
struct scpi_ops *scpi_ops;
struct scpi_chan *channels;
struct scpi_dvfs_info *dvfs[MAX_DVFS_DOMAINS];
};
/*
* The SCP firmware only executes in little-endian mode, so any buffers
* shared through SCPI should have their contents converted to little-endian
*/
struct scpi_shared_mem {
__le32 command;
__le32 status;
u8 payload[];
} __packed;
struct legacy_scpi_shared_mem {
__le32 status;
u8 payload[];
} __packed;
struct scp_capabilities {
__le32 protocol_version;
__le32 event_version;
__le32 platform_version;
__le32 commands[4];
} __packed;
struct clk_get_info {
__le16 id;
__le16 flags;
__le32 min_rate;
__le32 max_rate;
u8 name[20];
} __packed;
struct clk_set_value {
__le16 id;
__le16 reserved;
__le32 rate;
} __packed;
struct legacy_clk_set_value {
__le32 rate;
__le16 id;
__le16 reserved;
} __packed;
struct dvfs_info {
u8 domain;
u8 opp_count;
__le16 latency;
struct {
__le32 freq;
__le32 m_volt;
} opps[MAX_DVFS_OPPS];
} __packed;
Annotation
- Immediate include surface: `linux/bitmap.h`, `linux/bitfield.h`, `linux/cleanup.h`, `linux/device.h`, `linux/err.h`, `linux/export.h`, `linux/io.h`, `linux/kernel.h`.
- Detected declarations: `struct scpi_xfer`, `struct scpi_chan`, `struct scpi_drvinfo`, `struct scpi_shared_mem`, `struct legacy_scpi_shared_mem`, `struct scp_capabilities`, `struct clk_get_info`, `struct clk_set_value`, `struct legacy_clk_set_value`, `struct dvfs_info`.
- Atlas domain: Driver Families / drivers/firmware.
- Implementation status: integration 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.