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.

Dependency Surface

Detected Declarations

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

Implementation Notes