drivers/platform/x86/intel/pmt/discovery.c

Source file repositories/reference/linux-study-clean/drivers/platform/x86/intel/pmt/discovery.c

File Facts

System
Linux kernel
Corpus path
drivers/platform/x86/intel/pmt/discovery.c
Extension
.c
Size
16124 bytes
Lines
638
Domain
Driver Families
Bucket
drivers/platform
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct feature_discovery_table {
	u32	access_type:4;
	u32	version:8;
	u32	size:16;
	u32	reserved:4;
	u32	id;
	u32	offset;
	u32	reserved2;
};

/* Common feature table header */
struct feature_header {
	u32	attr_size:8;
	u32	num_guids:8;
	u32	reserved:16;
};

/* Feature attribute fields */
struct caps {
	u32		caps;
};

struct command {
	u32		max_stream_size:16;
	u32		max_command_size:16;
};

struct watcher {
	u32		reserved:21;
	u32		period:11;
	struct command	command;
};

struct rmid {
	u32		num_rmids:16;	/* Number of Resource Monitoring IDs */
	u32		reserved:16;
	struct watcher	watcher;
};

struct feature_table {
	struct feature_header	header;
	struct caps		caps;
	union {
		struct command command;
		struct watcher watcher;
		struct rmid rmid;
	};
	u32			*guids;
};

/* For backreference in struct feature */
struct pmt_features_priv;

struct feature {
	struct feature_table		table;
	struct kobject			kobj;
	struct pmt_features_priv	*priv;
	struct list_head		list;
	const struct attribute_group	*attr_group;
	enum pmt_feature_id		id;
};

struct pmt_features_priv {
	struct device		*parent;
	struct device		*dev;
	int			count;
	u32			mask;
	struct feature		feature[];
};

static LIST_HEAD(pmt_feature_list);
static DEFINE_MUTEX(feature_list_lock);

#define to_pmt_feature(x) container_of(x, struct feature, kobj)
static void pmt_feature_release(struct kobject *kobj)
{
}

static ssize_t caps_show(struct kobject *kobj, struct kobj_attribute *attr,
			 char *buf)
{
	struct feature *feature = to_pmt_feature(kobj);
	struct pmt_cap **pmt_caps;
	u32 caps = feature->table.caps.caps;
	ssize_t ret = 0;

	switch (feature->id) {
	case FEATURE_PER_CORE_PERF_TELEM:
		pmt_caps = pmt_caps_pcpt;
		break;

Annotation

Implementation Notes