drivers/platform/x86/intel/plr_tpmi.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/intel/plr_tpmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/intel/plr_tpmi.c- Extension
.c- Size
- 8982 bytes
- Lines
- 397
- Domain
- Driver Families
- Bucket
- drivers/platform
- 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.
- 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/array_size.hlinux/auxiliary_bus.hlinux/bitfield.hlinux/bitmap.hlinux/debugfs.hlinux/device.hlinux/err.hlinux/gfp_types.hlinux/intel_tpmi.hlinux/intel_vsec.hlinux/io.hlinux/iopoll.hlinux/kstrtox.hlinux/lockdep.hlinux/module.hlinux/mod_devicetable.hlinux/mutex.hlinux/notifier.hlinux/seq_file.hlinux/sprintf.hlinux/types.htpmi_power_domains.h
Detected Declarations
struct tpmi_plrstruct tpmi_plr_diestruct tpmi_plrfunction plr_readfunction plr_writefunction plr_read_cpu_statusfunction plr_clear_cpu_statusfunction plr_print_bitsfunction for_each_set_bitfunction plr_status_showfunction plr_status_writefunction intel_plr_notifyfunction intel_plr_register_notifierfunction intel_plr_unregister_notifierfunction intel_plr_probefunction intel_plr_remove
Annotated Snippet
struct tpmi_plr_die {
void __iomem *base;
struct mutex lock; /* Protect access to PLR mailbox */
int package_id;
int die_id;
struct tpmi_plr *plr;
};
struct tpmi_plr {
struct dentry *dbgfs_dir;
struct tpmi_plr_die *die_info;
int num_dies;
struct auxiliary_device *auxdev;
struct notifier_block nb;
struct mutex lock; /* Protect access to dbgfs_dir */
};
static const char * const plr_coarse_reasons[] = {
"FREQUENCY",
"CURRENT",
"POWER",
"THERMAL",
"PLATFORM",
"MCP",
"RAS",
"MISC",
"QOS",
"DFC",
};
static const char * const plr_fine_reasons[] = {
"FREQUENCY_CDYN0",
"FREQUENCY_CDYN1",
"FREQUENCY_CDYN2",
"FREQUENCY_CDYN3",
"FREQUENCY_CDYN4",
"FREQUENCY_CDYN5",
"FREQUENCY_FCT",
"FREQUENCY_PCS_TRL",
"CURRENT_MTPMAX",
"POWER_FAST_RAPL",
"POWER_PKG_PL1_MSR_TPMI",
"POWER_PKG_PL1_MMIO",
"POWER_PKG_PL1_PCS",
"POWER_PKG_PL2_MSR_TPMI",
"POWER_PKG_PL2_MMIO",
"POWER_PKG_PL2_PCS",
"POWER_PLATFORM_PL1_MSR_TPMI",
"POWER_PLATFORM_PL1_MMIO",
"POWER_PLATFORM_PL1_PCS",
"POWER_PLATFORM_PL2_MSR_TPMI",
"POWER_PLATFORM_PL2_MMIO",
"POWER_PLATFORM_PL2_PCS",
"UNKNOWN(22)",
"THERMAL_PER_CORE",
"DFC_UFS",
"PLATFORM_PROCHOT",
"PLATFORM_HOT_VR",
"UNKNOWN(27)",
"UNKNOWN(28)",
"MISC_PCS_PSTATE",
};
static u64 plr_read(struct tpmi_plr_die *plr_die, int offset)
{
return readq(plr_die->base + offset);
}
static void plr_write(u64 val, struct tpmi_plr_die *plr_die, int offset)
{
writeq(val, plr_die->base + offset);
}
static int plr_read_cpu_status(struct tpmi_plr_die *plr_die, int cpu,
u64 *status)
{
u64 regval;
int ret;
lockdep_assert_held(&plr_die->lock);
regval = FIELD_PREP(PLR_MODULE_ID_MASK, tpmi_get_punit_core_number(cpu));
regval |= PLR_RUN_BUSY;
plr_write(regval, plr_die, PLR_MAILBOX_INTERFACE);
ret = readq_poll_timeout(plr_die->base + PLR_MAILBOX_INTERFACE, regval,
!(regval & PLR_RUN_BUSY), PLR_TIMEOUT_US,
PLR_TIMEOUT_MAX_US);
if (ret)
Annotation
- Immediate include surface: `linux/array_size.h`, `linux/auxiliary_bus.h`, `linux/bitfield.h`, `linux/bitmap.h`, `linux/debugfs.h`, `linux/device.h`, `linux/err.h`, `linux/gfp_types.h`.
- Detected declarations: `struct tpmi_plr`, `struct tpmi_plr_die`, `struct tpmi_plr`, `function plr_read`, `function plr_write`, `function plr_read_cpu_status`, `function plr_clear_cpu_status`, `function plr_print_bits`, `function for_each_set_bit`, `function plr_status_show`.
- Atlas domain: Driver Families / drivers/platform.
- 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.