drivers/cpufreq/speedstep-centrino.c
Source file repositories/reference/linux-study-clean/drivers/cpufreq/speedstep-centrino.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/cpufreq/speedstep-centrino.c- Extension
.c- Size
- 14058 bytes
- Lines
- 558
- Domain
- Driver Families
- Bucket
- drivers/cpufreq
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/init.hlinux/cpufreq.hlinux/sched.hlinux/delay.hlinux/compiler.hlinux/gfp.hasm/msr.hasm/processor.hasm/cpufeature.hasm/cpu_device_id.h
Detected Declarations
struct cpu_idstruct cpu_modelfunction centrino_cpu_init_tablefunction centrino_cpu_init_tablefunction centrino_verify_cpu_idfunction extract_clockfunction get_cur_freqfunction centrino_cpu_initfunction centrino_cpu_exitfunction centrino_targetfunction centrino_initfunction centrino_exit
Annotated Snippet
if (!(l & MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP)) {
pr_info("couldn't enable Enhanced SpeedStep\n");
return -ENODEV;
}
}
policy->cpuinfo.transition_latency = 10000;
/* 10uS transition latency */
policy->freq_table = per_cpu(centrino_model, policy->cpu)->op_points;
return 0;
}
static void centrino_cpu_exit(struct cpufreq_policy *policy)
{
unsigned int cpu = policy->cpu;
if (per_cpu(centrino_model, cpu))
per_cpu(centrino_model, cpu) = NULL;
}
/**
* centrino_target - set a new CPUFreq policy
* @policy: new policy
* @index: index of target frequency
*
* Sets a new CPUFreq policy.
*/
static int centrino_target(struct cpufreq_policy *policy, unsigned int index)
{
unsigned int msr, cpu = policy->cpu;
struct msr oldmsr = { .q = 0 };
int retval = 0;
unsigned int j, first_cpu;
struct cpufreq_frequency_table *op_points;
cpumask_var_t covered_cpus;
if (unlikely(!zalloc_cpumask_var(&covered_cpus, GFP_KERNEL)))
return -ENOMEM;
if (unlikely(per_cpu(centrino_model, cpu) == NULL)) {
retval = -ENODEV;
goto out;
}
first_cpu = 1;
op_points = &per_cpu(centrino_model, cpu)->op_points[index];
for_each_cpu(j, policy->cpus) {
int good_cpu;
/*
* Support for SMP systems.
* Make sure we are running on CPU that wants to change freq
*/
if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
good_cpu = cpumask_any_and(policy->cpus,
cpu_online_mask);
else
good_cpu = j;
if (good_cpu >= nr_cpu_ids) {
pr_debug("couldn't limit to CPUs in this domain\n");
retval = -EAGAIN;
if (first_cpu) {
/* We haven't started the transition yet. */
goto out;
}
break;
}
msr = op_points->driver_data;
if (first_cpu) {
rdmsrq_on_cpu(good_cpu, MSR_IA32_PERF_CTL, &oldmsr.q);
if (msr == (oldmsr.l & 0xffff)) {
pr_debug("no change needed - msr was and needs "
"to be %x\n", oldmsr.l);
retval = 0;
goto out;
}
first_cpu = 0;
/* all but 16 LSB are reserved, treat them with care */
oldmsr.l &= ~0xffff;
msr &= 0xffff;
oldmsr.l |= msr;
}
wrmsrq_on_cpu(good_cpu, MSR_IA32_PERF_CTL, oldmsr.q);
if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `linux/cpufreq.h`, `linux/sched.h`, `linux/delay.h`, `linux/compiler.h`, `linux/gfp.h`.
- Detected declarations: `struct cpu_id`, `struct cpu_model`, `function centrino_cpu_init_table`, `function centrino_cpu_init_table`, `function centrino_verify_cpu_id`, `function extract_clock`, `function get_cur_freq`, `function centrino_cpu_init`, `function centrino_cpu_exit`, `function centrino_target`.
- Atlas domain: Driver Families / drivers/cpufreq.
- 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.