drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/intel/uncore-frequency/uncore-frequency-tpmi.c- Extension
.c- Size
- 22095 bytes
- Lines
- 772
- 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/auxiliary_bus.hlinux/bitfield.hlinux/bits.hlinux/intel_tpmi.hlinux/intel_vsec.hlinux/io.hlinux/module.h../tpmi_power_domains.huncore-frequency-common.h
Detected Declarations
struct tpmi_uncore_structstruct tpmi_uncore_cluster_infostruct tpmi_uncore_power_domain_infostruct tpmi_uncore_structfunction read_control_freqfunction read_eff_lat_ctrlfunction uncore_read_control_freqfunction write_eff_lat_ctrlfunction write_control_freqfunction uncore_write_control_freqfunction uncore_read_freqfunction uncore_set_agent_typefunction set_domain_idfunction uncore_readfunction uncore_writefunction remove_cluster_entriesfunction set_cdie_idfunction uncore_probefunction uncore_remove
Annotated Snippet
struct tpmi_uncore_cluster_info {
bool root_domain;
bool elc_supported;
u8 __iomem *cluster_base;
u16 cdie_id;
struct uncore_data uncore_data;
struct tpmi_uncore_struct *uncore_root;
};
/* Information for each power domain */
struct tpmi_uncore_power_domain_info {
u8 __iomem *uncore_base;
int ufs_header_ver;
int cluster_count;
struct tpmi_uncore_cluster_info *cluster_infos;
};
/* Information for all power domains in a package */
struct tpmi_uncore_struct {
int power_domain_count;
int max_ratio;
int min_ratio;
struct tpmi_uncore_power_domain_info *pd_info;
struct tpmi_uncore_cluster_info root_cluster;
bool write_blocked;
};
/* Bit definitions for STATUS register */
#define UNCORE_CURRENT_RATIO_MASK GENMASK_ULL(6, 0)
/* Bit definitions for CONTROL register */
#define UNCORE_MAX_RATIO_MASK GENMASK_ULL(14, 8)
#define UNCORE_MIN_RATIO_MASK GENMASK_ULL(21, 15)
#define UNCORE_EFF_LAT_CTRL_RATIO_MASK GENMASK_ULL(28, 22)
#define UNCORE_EFF_LAT_CTRL_LOW_THRESHOLD_MASK GENMASK_ULL(38, 32)
#define UNCORE_EFF_LAT_CTRL_HIGH_THRESHOLD_ENABLE BIT(39)
#define UNCORE_EFF_LAT_CTRL_HIGH_THRESHOLD_MASK GENMASK_ULL(46, 40)
/* Helper function to read MMIO offset for max/min control frequency */
static void read_control_freq(struct tpmi_uncore_cluster_info *cluster_info,
unsigned int *value, enum uncore_index index)
{
u64 control;
control = readq(cluster_info->cluster_base + UNCORE_CONTROL_INDEX);
if (index == UNCORE_INDEX_MAX_FREQ)
*value = FIELD_GET(UNCORE_MAX_RATIO_MASK, control) * UNCORE_FREQ_KHZ_MULTIPLIER;
else
*value = FIELD_GET(UNCORE_MIN_RATIO_MASK, control) * UNCORE_FREQ_KHZ_MULTIPLIER;
}
/* Helper function to read efficiency latency control values over MMIO */
static int read_eff_lat_ctrl(struct uncore_data *data, unsigned int *val, enum uncore_index index)
{
struct tpmi_uncore_cluster_info *cluster_info;
u64 ctrl;
cluster_info = container_of(data, struct tpmi_uncore_cluster_info, uncore_data);
if (cluster_info->root_domain)
return -ENODATA;
if (!cluster_info->elc_supported)
return -EOPNOTSUPP;
ctrl = readq(cluster_info->cluster_base + UNCORE_CONTROL_INDEX);
switch (index) {
case UNCORE_INDEX_EFF_LAT_CTRL_LOW_THRESHOLD:
*val = FIELD_GET(UNCORE_EFF_LAT_CTRL_LOW_THRESHOLD_MASK, ctrl);
*val *= 100;
*val = DIV_ROUND_UP(*val, FIELD_MAX(UNCORE_EFF_LAT_CTRL_LOW_THRESHOLD_MASK));
break;
case UNCORE_INDEX_EFF_LAT_CTRL_HIGH_THRESHOLD:
*val = FIELD_GET(UNCORE_EFF_LAT_CTRL_HIGH_THRESHOLD_MASK, ctrl);
*val *= 100;
*val = DIV_ROUND_UP(*val, FIELD_MAX(UNCORE_EFF_LAT_CTRL_HIGH_THRESHOLD_MASK));
break;
case UNCORE_INDEX_EFF_LAT_CTRL_HIGH_THRESHOLD_ENABLE:
*val = FIELD_GET(UNCORE_EFF_LAT_CTRL_HIGH_THRESHOLD_ENABLE, ctrl);
break;
case UNCORE_INDEX_EFF_LAT_CTRL_FREQ:
*val = FIELD_GET(UNCORE_EFF_LAT_CTRL_RATIO_MASK, ctrl) * UNCORE_FREQ_KHZ_MULTIPLIER;
break;
default:
return -EOPNOTSUPP;
}
Annotation
- Immediate include surface: `linux/auxiliary_bus.h`, `linux/bitfield.h`, `linux/bits.h`, `linux/intel_tpmi.h`, `linux/intel_vsec.h`, `linux/io.h`, `linux/module.h`, `../tpmi_power_domains.h`.
- Detected declarations: `struct tpmi_uncore_struct`, `struct tpmi_uncore_cluster_info`, `struct tpmi_uncore_power_domain_info`, `struct tpmi_uncore_struct`, `function read_control_freq`, `function read_eff_lat_ctrl`, `function uncore_read_control_freq`, `function write_eff_lat_ctrl`, `function write_control_freq`, `function uncore_write_control_freq`.
- 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.