drivers/hwtracing/coresight/coresight-core.c
Source file repositories/reference/linux-study-clean/drivers/hwtracing/coresight/coresight-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hwtracing/coresight/coresight-core.c- Extension
.c- Size
- 48822 bytes
- Lines
- 1810
- Domain
- Driver Families
- Bucket
- drivers/hwtracing
- 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/acpi.hlinux/bitfield.hlinux/build_bug.hlinux/kernel.hlinux/init.hlinux/types.hlinux/device.hlinux/io.hlinux/err.hlinux/export.hlinux/slab.hlinux/stringhash.hlinux/mutex.hlinux/clk.hlinux/coresight.hlinux/property.hlinux/delay.hlinux/pm_runtime.hlinux/panic_notifier.hcoresight-etm-perf.hcoresight-priv.hcoresight-syscfg.hcoresight-trace-id.h
Detected Declarations
struct coresight_nodefunction coresight_set_cti_opsfunction coresight_remove_cti_opsfunction coresight_set_percpu_sinkfunction coresight_blocks_sourcefunction coresight_find_out_connectionfunction coresight_read_claim_tags_unlockedfunction coresight_set_self_claim_tag_unlockedfunction coresight_clear_self_claim_tagfunction coresight_clear_self_claim_tag_unlockedfunction coresight_claim_device_unlockedfunction coresight_claim_devicefunction coresight_disclaim_device_unlockedfunction coresight_disclaim_devicefunction coresight_add_helperfunction coresight_enable_sinkfunction coresight_disable_sinkfunction coresight_enable_linkfunction coresight_disable_linkfunction coresight_is_helperfunction coresight_enable_helperfunction coresight_disable_helperfunction coresight_disable_helpersfunction source_opsfunction coresight_pause_sourcefunction coresight_resume_sourcefunction coresight_disable_path_fromfunction list_for_each_entry_continuefunction coresight_disable_pathfunction coresight_enable_helpersfunction coresight_enable_pathfunction coresight_get_sink_idfunction coresight_sink_by_idfunction coresight_get_reffunction coresight_put_reffunction coresight_grab_devicefunction coresight_drop_devicefunction coresight_get_trace_idfunction coresight_path_assign_trace_idfunction list_for_each_entryfunction _coresight_build_pathfunction coresight_release_pathfunction list_for_each_entry_safefunction coresight_is_def_sink_typefunction usedfunction sourcefunction userfunction coresight_remove_sink_ref
Annotated Snippet
const struct bus_type coresight_bustype = {
.name = "coresight",
};
static int coresight_panic_sync(struct device *dev, void *data)
{
int mode;
struct coresight_device *csdev;
/* Run through panic sync handlers for all enabled devices */
csdev = container_of(dev, struct coresight_device, dev);
mode = coresight_get_mode(csdev);
if ((mode == CS_MODE_SYSFS) || (mode == CS_MODE_PERF)) {
if (panic_ops(csdev))
panic_ops(csdev)->sync(csdev);
}
return 0;
}
static int coresight_panic_cb(struct notifier_block *self,
unsigned long v, void *p)
{
bus_for_each_dev(&coresight_bustype, NULL, NULL,
coresight_panic_sync);
return 0;
}
static struct notifier_block coresight_notifier = {
.notifier_call = coresight_panic_cb,
};
static int __init coresight_init(void)
{
int ret;
ret = bus_register(&coresight_bustype);
if (ret)
return ret;
ret = etm_perf_init();
if (ret)
goto exit_bus_unregister;
/* Register function to be called for panic */
ret = atomic_notifier_chain_register(&panic_notifier_list,
&coresight_notifier);
if (ret)
goto exit_perf;
/* initialise the coresight syscfg API */
ret = cscfg_init();
if (!ret)
return 0;
atomic_notifier_chain_unregister(&panic_notifier_list,
&coresight_notifier);
exit_perf:
etm_perf_exit();
exit_bus_unregister:
bus_unregister(&coresight_bustype);
return ret;
}
static void __exit coresight_exit(void)
{
cscfg_exit();
atomic_notifier_chain_unregister(&panic_notifier_list,
&coresight_notifier);
etm_perf_exit();
bus_unregister(&coresight_bustype);
coresight_release_device_list();
}
module_init(coresight_init);
module_exit(coresight_exit);
int coresight_init_driver_with_owner(const char *drv, struct amba_driver *amba_drv,
struct platform_driver *pdev_drv, struct module *owner,
const char *mod_name)
{
int ret;
ret = __amba_driver_register(amba_drv, owner);
if (ret) {
pr_err("%s: error registering AMBA driver\n", drv);
return ret;
}
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/bitfield.h`, `linux/build_bug.h`, `linux/kernel.h`, `linux/init.h`, `linux/types.h`, `linux/device.h`, `linux/io.h`.
- Detected declarations: `struct coresight_node`, `function coresight_set_cti_ops`, `function coresight_remove_cti_ops`, `function coresight_set_percpu_sink`, `function coresight_blocks_source`, `function coresight_find_out_connection`, `function coresight_read_claim_tags_unlocked`, `function coresight_set_self_claim_tag_unlocked`, `function coresight_clear_self_claim_tag`, `function coresight_clear_self_claim_tag_unlocked`.
- Atlas domain: Driver Families / drivers/hwtracing.
- 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.