drivers/firmware/arm_scmi/driver.c
Source file repositories/reference/linux-study-clean/drivers/firmware/arm_scmi/driver.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/firmware/arm_scmi/driver.c- Extension
.c- Size
- 101389 bytes
- Lines
- 3564
- Domain
- Driver Families
- Bucket
- drivers/firmware
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/cleanup.hlinux/debugfs.hlinux/device.hlinux/export.hlinux/idr.hlinux/io.hlinux/io-64-nonatomic-hi-lo.hlinux/kernel.hlinux/kmod.hlinux/ktime.hlinux/hashtable.hlinux/list.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/processor.hlinux/refcount.hlinux/slab.hlinux/xarray.hcommon.hnotify.hquirks.hraw_mode.htrace/events/scmi.h
Detected Declarations
struct scmi_xfers_infostruct scmi_protocol_instancestruct scmi_infostruct scmi_msg_resp_domain_name_getstruct scmi_iteratorstruct scmi_msg_get_fc_infostruct scmi_msg_resp_desc_fcstruct scmi_protocol_devresfunction scmi_vendor_protocol_signaturefunction scmi_protocol_key_calculatefunction __scmi_vendor_protocol_lookupfunction scmi_vendor_protocol_lookupfunction scmi_vendor_protocol_getfunction scmi_protocol_getfunction scmi_protocol_putfunction scmi_vendor_protocol_checkfunction scmi_protocol_registerfunction scmi_protocol_unregisterfunction scmi_create_protocol_devicesfunction scmi_destroy_protocol_devicesfunction scmi_notification_instance_data_setfunction find_next_zero_bitfunction scmi_xfer_token_clearfunction scmi_xfer_inflight_register_unlockedfunction scmi_xfer_inflight_registerfunction scmi_xfer_raw_inflight_registerfunction scmi_xfer_pending_setfunction scmi_xfer_getfunction scmi_xfer_raw_channel_getfunction __scmi_xfer_putfunction xfer_putfunction scmi_xfer_lookup_unlockedfunction scmi_bad_message_tracefunction responsefunction scmi_xfer_state_updatefunction scmi_xfer_acquiredfunction scmi_xfer_command_acquirefunction scmi_xfer_command_releasefunction scmi_clear_channelfunction scmi_handle_notificationfunction scmi_handle_responsefunction scmi_rx_callbackfunction xfer_putfunction scmi_xfer_done_no_timeoutfunction scmi_wait_for_replyfunction strategyfunction scmi_xfer_raw_wait_for_message_responsefunction do_xfer
Annotated Snippet
static const struct file_operations fops_reset_counts = {
.owner = THIS_MODULE,
.open = simple_open,
.write = reset_all_on_write,
};
static void scmi_debugfs_counters_setup(struct scmi_debug_info *dbg,
struct dentry *trans)
{
struct dentry *counters;
int idx;
counters = debugfs_create_dir("counters", trans);
for (idx = 0; idx < SCMI_DEBUG_COUNTERS_LAST; idx++)
debugfs_create_atomic_t(dbg_counter_strs[idx], 0600, counters,
&dbg->counters[idx]);
debugfs_create_file("reset", 0200, counters, dbg, &fops_reset_counts);
}
static void scmi_debugfs_common_cleanup(void *d)
{
struct scmi_debug_info *dbg = d;
if (!dbg)
return;
debugfs_remove_recursive(dbg->top_dentry);
kfree(dbg->name);
kfree(dbg->type);
}
static struct scmi_debug_info *scmi_debugfs_common_setup(struct scmi_info *info)
{
char top_dir[16];
struct dentry *trans, *top_dentry;
struct scmi_debug_info *dbg;
const char *c_ptr = NULL;
dbg = devm_kzalloc(info->dev, sizeof(*dbg), GFP_KERNEL);
if (!dbg)
return NULL;
dbg->name = kstrdup(of_node_full_name(info->dev->of_node), GFP_KERNEL);
if (!dbg->name) {
devm_kfree(info->dev, dbg);
return NULL;
}
of_property_read_string(info->dev->of_node, "compatible", &c_ptr);
dbg->type = kstrdup(c_ptr, GFP_KERNEL);
if (!dbg->type) {
kfree(dbg->name);
devm_kfree(info->dev, dbg);
return NULL;
}
snprintf(top_dir, 16, "%d", info->id);
top_dentry = debugfs_create_dir(top_dir, scmi_top_dentry);
trans = debugfs_create_dir("transport", top_dentry);
dbg->is_atomic = info->desc->atomic_enabled &&
is_transport_polling_capable(info->desc);
debugfs_create_str("instance_name", 0400, top_dentry,
(char **)&dbg->name);
debugfs_create_u32("atomic_threshold_us", 0400, top_dentry,
(u32 *)&info->desc->atomic_threshold);
debugfs_create_str("type", 0400, trans, (char **)&dbg->type);
debugfs_create_bool("is_atomic", 0400, trans, &dbg->is_atomic);
debugfs_create_u32("max_rx_timeout_ms", 0400, trans,
(u32 *)&info->desc->max_rx_timeout_ms);
debugfs_create_u32("max_msg_size", 0400, trans,
(u32 *)&info->desc->max_msg_size);
debugfs_create_u32("tx_max_msg", 0400, trans,
(u32 *)&info->tx_minfo.max_msg);
debugfs_create_u32("rx_max_msg", 0400, trans,
(u32 *)&info->rx_minfo.max_msg);
if (IS_ENABLED(CONFIG_ARM_SCMI_DEBUG_COUNTERS))
scmi_debugfs_counters_setup(dbg, trans);
Annotation
- Immediate include surface: `linux/bitmap.h`, `linux/cleanup.h`, `linux/debugfs.h`, `linux/device.h`, `linux/export.h`, `linux/idr.h`, `linux/io.h`, `linux/io-64-nonatomic-hi-lo.h`.
- Detected declarations: `struct scmi_xfers_info`, `struct scmi_protocol_instance`, `struct scmi_info`, `struct scmi_msg_resp_domain_name_get`, `struct scmi_iterator`, `struct scmi_msg_get_fc_info`, `struct scmi_msg_resp_desc_fc`, `struct scmi_protocol_devres`, `function scmi_vendor_protocol_signature`, `function scmi_protocol_key_calculate`.
- Atlas domain: Driver Families / drivers/firmware.
- Implementation status: pattern 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.