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.
- 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/auxiliary_bus.hlinux/bitfield.hlinux/bits.hlinux/bug.hlinux/cleanup.hlinux/container_of.hlinux/device.hlinux/err.hlinux/io.hlinux/ioport.hlinux/kdev_t.hlinux/kobject.hlinux/list.hlinux/module.hlinux/mutex.hlinux/overflow.hlinux/pci.hlinux/slab.hlinux/string_choices.hlinux/sysfs.hlinux/types.hlinux/uaccess.hlinux/intel_pmt_features.hlinux/intel_vsec.hclass.h
Detected Declarations
struct feature_discovery_tablestruct feature_headerstruct capsstruct commandstruct watcherstruct rmidstruct feature_tablestruct pmt_features_privstruct featurestruct pmt_features_privfunction pmt_feature_releasefunction num_rmids_showfunction min_watcher_period_ms_showfunction max_stream_size_showfunction max_command_size_showfunction guids_showfunction pmt_feature_get_disc_tablefunction pmt_feature_get_feature_tablefunction pmt_features_add_featfunction pmt_features_remove_featfunction pmt_features_discoveryfunction pmt_features_removefunction pmt_features_probefunction pmt_get_featuresfunction intel_pmt_get_features
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
- Immediate include surface: `linux/auxiliary_bus.h`, `linux/bitfield.h`, `linux/bits.h`, `linux/bug.h`, `linux/cleanup.h`, `linux/container_of.h`, `linux/device.h`, `linux/err.h`.
- Detected declarations: `struct feature_discovery_table`, `struct feature_header`, `struct caps`, `struct command`, `struct watcher`, `struct rmid`, `struct feature_table`, `struct pmt_features_priv`, `struct feature`, `struct pmt_features_priv`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: integration 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.