drivers/cpufreq/powernow-k7.c
Source file repositories/reference/linux-study-clean/drivers/cpufreq/powernow-k7.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/cpufreq/powernow-k7.c- Extension
.c- Size
- 16198 bytes
- Lines
- 696
- 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.
- 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/kernel.hlinux/module.hlinux/moduleparam.hlinux/init.hlinux/cpufreq.hlinux/slab.hlinux/string.hlinux/dmi.hlinux/timex.hlinux/io.hasm/timer.hasm/msr.hasm/cpu_device_id.hasm/cpuid/api.hlinux/acpi.hacpi/processor.hpowernow-k7.h
Detected Declarations
struct psb_sstruct pst_sfunction check_fsbfunction check_powernowfunction invalidate_entryfunction get_rangesfunction change_FIDfunction change_VIDfunction powernow_targetfunction powernow_acpi_initfunction powernow_acpi_initfunction print_pst_entryfunction powernow_decode_biosfunction fixup_sgtcfunction powernow_getfunction acer_cpufreq_pstfunction powernow_cpu_initfunction powernow_cpu_exitfunction powernow_initfunction powernow_exit
Annotated Snippet
struct psb_s {
u8 signature[10];
u8 tableversion;
u8 flags;
u16 settlingtime;
u8 reserved1;
u8 numpst;
};
struct pst_s {
u32 cpuid;
u8 fsbspeed;
u8 maxfid;
u8 startvid;
u8 numpstates;
};
#ifdef CONFIG_X86_POWERNOW_K7_ACPI
union powernow_acpi_control_t {
struct {
unsigned long fid:5,
vid:5,
sgtc:20,
res1:2;
} bits;
unsigned long val;
};
#endif
/* divide by 1000 to get VCore voltage in V. */
static const int mobile_vid_table[32] = {
2000, 1950, 1900, 1850, 1800, 1750, 1700, 1650,
1600, 1550, 1500, 1450, 1400, 1350, 1300, 0,
1275, 1250, 1225, 1200, 1175, 1150, 1125, 1100,
1075, 1050, 1025, 1000, 975, 950, 925, 0,
};
/* divide by 10 to get FID. */
static const int fid_codes[32] = {
110, 115, 120, 125, 50, 55, 60, 65,
70, 75, 80, 85, 90, 95, 100, 105,
30, 190, 40, 200, 130, 135, 140, 210,
150, 225, 160, 165, 170, 180, -1, -1,
};
/* This parameter is used in order to force ACPI instead of legacy method for
* configuration purpose.
*/
static int acpi_force;
static struct cpufreq_frequency_table *powernow_table;
static unsigned int can_scale_bus;
static unsigned int can_scale_vid;
static unsigned int minimum_speed = -1;
static unsigned int maximum_speed;
static unsigned int number_scales;
static unsigned int fsb;
static unsigned int latency;
static char have_a0;
static int check_fsb(unsigned int fsbspeed)
{
int delta;
unsigned int f = fsb / 1000;
delta = (fsbspeed > f) ? fsbspeed - f : f - fsbspeed;
return delta < 5;
}
static const struct x86_cpu_id powernow_k7_cpuids[] = {
X86_MATCH_VENDOR_FAM(AMD, 6, NULL),
{}
};
MODULE_DEVICE_TABLE(x86cpu, powernow_k7_cpuids);
static int check_powernow(void)
{
struct cpuinfo_x86 *c = &cpu_data(0);
unsigned int maxei, eax, ebx, ecx, edx;
if (!x86_match_cpu(powernow_k7_cpuids))
return 0;
/* Get maximum capabilities */
maxei = cpuid_eax(0x80000000);
if (maxei < 0x80000007) { /* Any powernow info ? */
#ifdef MODULE
pr_info("No powernow capabilities detected\n");
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/cpufreq.h`, `linux/slab.h`, `linux/string.h`, `linux/dmi.h`.
- Detected declarations: `struct psb_s`, `struct pst_s`, `function check_fsb`, `function check_powernow`, `function invalidate_entry`, `function get_ranges`, `function change_FID`, `function change_VID`, `function powernow_target`, `function powernow_acpi_init`.
- 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.