drivers/hwtracing/coresight/coresight-tmc.h
Source file repositories/reference/linux-study-clean/drivers/hwtracing/coresight/coresight-tmc.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/hwtracing/coresight/coresight-tmc.h- Extension
.h- Size
- 14125 bytes
- Lines
- 452
- Domain
- Driver Families
- Bucket
- drivers/hwtracing
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dma-mapping.hlinux/idr.hlinux/miscdevice.hlinux/mutex.hlinux/refcount.hlinux/crc32.h
Detected Declarations
struct tmc_crash_metadatastruct etr_buf_operationsstruct etr_bufstruct tmc_resrv_bufstruct tmc_drvdatastruct etr_buf_operationsstruct tmc_pagesstruct tmc_sg_tableenum tmc_config_typeenum tmc_modeenum tmc_mem_intf_widthenum etr_modefunction tmc_etr_init_capsfunction tmc_etr_set_capfunction tmc_etr_has_capfunction tmc_sg_table_buf_sizefunction tmc_has_reserved_bufferfunction tmc_has_crash_mdata_bufferfunction tmc_crashdata_set_invalidfunction find_crash_metadata_crcfunction find_crash_tracedata_crc
Annotated Snippet
struct tmc_crash_metadata {
uint32_t crc32_mdata; /* crc of metadata */
uint32_t crc32_tdata; /* crc of tracedata */
uint32_t version; /* 31:16 Major version, 15:0 Minor version */
uint32_t valid; /* Indicate if this ETF/ETR was enabled */
uint32_t tmc_ram_size; /* Ram Size register */
uint32_t tmc_sts; /* Status register */
uint32_t tmc_mode; /* Mode register */
uint32_t tmc_ffcr; /* Formatter and flush control register */
uint32_t tmc_ffsr; /* Formatter and flush status register */
uint32_t reserved32;
uint64_t tmc_rrp; /* Ram Read pointer register */
uint64_t tmc_rwp; /* Ram Write pointer register */
uint64_t tmc_dba; /* Data buffer address register */
uint64_t trace_paddr; /* Phys address of trace buffer */
uint64_t reserved64[3];
};
enum etr_mode {
ETR_MODE_FLAT, /* Uses contiguous flat buffer */
ETR_MODE_ETR_SG, /* Uses in-built TMC ETR SG mechanism */
ETR_MODE_CATU, /* Use SG mechanism in CATU */
ETR_MODE_RESRV, /* Use reserved region contiguous buffer */
ETR_MODE_AUTO, /* Use the default mechanism */
};
struct etr_buf_operations;
/**
* struct etr_buf - Details of the buffer used by ETR
* refcount ; Number of sources currently using this etr_buf.
* @mode : Mode of the ETR buffer, contiguous, Scatter Gather etc.
* @full : Trace data overflow
* @size : Size of the buffer.
* @hwaddr : Address to be programmed in the TMC:DBA{LO,HI}
* @offset : Offset of the trace data in the buffer for consumption.
* @len : Available trace data @buf (may round up to the beginning).
* @ops : ETR buffer operations for the mode.
* @private : Backend specific information for the buf
*/
struct etr_buf {
refcount_t refcount;
enum etr_mode mode;
bool full;
ssize_t size;
dma_addr_t hwaddr;
unsigned long offset;
s64 len;
const struct etr_buf_operations *ops;
void *private;
};
/**
* @paddr : Start address of reserved memory region.
* @vaddr : Corresponding CPU virtual address.
* @size : Size of reserved memory region.
* @offset : Offset of the trace data in the buffer for consumption.
* @reading : Flag to indicate if reading is active
* @len : Available trace data @buf (may round up to the beginning).
*/
struct tmc_resrv_buf {
phys_addr_t paddr;
void *vaddr;
size_t size;
unsigned long offset;
bool reading;
s64 len;
};
/**
* struct tmc_drvdata - specifics associated to an TMC component
* @atclk: optional clock for the core parts of the TMC.
* @pclk: APB clock if present, otherwise NULL
* @base: memory mapped base address for this component.
* @csdev: component vitals needed by the framework.
* @miscdev: specifics to handle "/dev/xyz.tmc" entry.
* @crashdev: specifics to handle "/dev/crash_tmc_xyz" entry for reading
* crash tracedata.
* @spinlock: only one at a time pls.
* @pid: Process ID of the process that owns the session that is using
* this component. For example this would be the pid of the Perf
* process.
* @reading: buffer's in the reading through "/dev/xyz.tmc" entry
* @stop_on_flush: Stop on flush trigger user configuration.
* @buf: Snapshot of the trace data for ETF/ETB.
* @etr_buf: details of buffer used in TMC-ETR
* @len: size of the available trace for ETF/ETB.
* @size: trace buffer size for this TMC (common for all modes).
* @max_burst_size: The maximum burst size that can be initiated by
* TMC-ETR on AXI bus.
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `linux/idr.h`, `linux/miscdevice.h`, `linux/mutex.h`, `linux/refcount.h`, `linux/crc32.h`.
- Detected declarations: `struct tmc_crash_metadata`, `struct etr_buf_operations`, `struct etr_buf`, `struct tmc_resrv_buf`, `struct tmc_drvdata`, `struct etr_buf_operations`, `struct tmc_pages`, `struct tmc_sg_table`, `enum tmc_config_type`, `enum tmc_mode`.
- Atlas domain: Driver Families / drivers/hwtracing.
- 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.