drivers/cpufreq/pcc-cpufreq.c
Source file repositories/reference/linux-study-clean/drivers/cpufreq/pcc-cpufreq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/cpufreq/pcc-cpufreq.c- Extension
.c- Size
- 16324 bytes
- Lines
- 640
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/init.hlinux/smp.hlinux/sched.hlinux/cpufreq.hlinux/compiler.hlinux/slab.hlinux/platform_device.hlinux/acpi.hlinux/io.hlinux/spinlock.hlinux/uaccess.hacpi/processor.h
Detected Declarations
struct pcc_register_resourcestruct pcc_memory_resourcestruct pcc_headerstruct pcc_cpufunction pcc_cpufreq_verifyfunction pcc_cmdfunction pcc_clear_mappingfunction pcc_get_freqfunction pcc_cpufreq_targetfunction pcc_get_offsetfunction pcc_cpufreq_do_oscfunction pcc_cpufreq_evaluatefunction pcc_cpufreq_cpu_initfunction pcc_cpufreq_probefunction pcc_cpufreq_removefunction pcc_cpufreq_initfunction pcc_cpufreq_exit
Annotated Snippet
struct pcc_register_resource {
u8 descriptor;
u16 length;
u8 space_id;
u8 bit_width;
u8 bit_offset;
u8 access_size;
u64 address;
} __attribute__ ((packed));
struct pcc_memory_resource {
u8 descriptor;
u16 length;
u8 space_id;
u8 resource_usage;
u8 type_specific;
u64 granularity;
u64 minimum;
u64 maximum;
u64 translation_offset;
u64 address_length;
} __attribute__ ((packed));
static struct cpufreq_driver pcc_cpufreq_driver;
struct pcc_header {
u32 signature;
u16 length;
u8 major;
u8 minor;
u32 features;
u16 command;
u16 status;
u32 latency;
u32 minimum_time;
u32 maximum_time;
u32 nominal;
u32 throttled_frequency;
u32 minimum_frequency;
};
static void __iomem *pcch_virt_addr;
static struct pcc_header __iomem *pcch_hdr;
static DEFINE_SPINLOCK(pcc_lock);
static struct acpi_generic_address doorbell;
static u64 doorbell_preserve;
static u64 doorbell_write;
static u8 OSC_UUID[16] = {0x9F, 0x2C, 0x9B, 0x63, 0x91, 0x70, 0x1f, 0x49,
0xBB, 0x4F, 0xA5, 0x98, 0x2F, 0xA1, 0xB5, 0x46};
struct pcc_cpu {
u32 input_offset;
u32 output_offset;
};
static struct pcc_cpu __percpu *pcc_cpu_info;
static int pcc_cpufreq_verify(struct cpufreq_policy_data *policy)
{
cpufreq_verify_within_cpu_limits(policy);
return 0;
}
static inline void pcc_cmd(void)
{
u64 doorbell_value;
int i;
acpi_read(&doorbell_value, &doorbell);
acpi_write((doorbell_value & doorbell_preserve) | doorbell_write,
&doorbell);
for (i = 0; i < POLL_LOOPS; i++) {
if (ioread16(&pcch_hdr->status) & CMD_COMPLETE)
break;
}
}
static inline void pcc_clear_mapping(void)
{
if (pcch_virt_addr)
iounmap(pcch_virt_addr);
pcch_virt_addr = NULL;
}
static unsigned int pcc_get_freq(unsigned int cpu)
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `linux/smp.h`, `linux/sched.h`, `linux/cpufreq.h`, `linux/compiler.h`, `linux/slab.h`.
- Detected declarations: `struct pcc_register_resource`, `struct pcc_memory_resource`, `struct pcc_header`, `struct pcc_cpu`, `function pcc_cpufreq_verify`, `function pcc_cmd`, `function pcc_clear_mapping`, `function pcc_get_freq`, `function pcc_cpufreq_target`, `function pcc_get_offset`.
- Atlas domain: Driver Families / drivers/cpufreq.
- Implementation status: source 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.