^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * AMD K7 Powernow driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * (C) 2003 Dave Jones on behalf of SuSE Labs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Based upon datasheets & sample CPUs kindly provided by AMD.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Errata 5:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * CPU may fail to execute a FID/VID change in presence of interrupt.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * - We cli/sti on stepping A0 CPUs around the FID/VID transition.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * Errata 15:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * CPU with half frequency multipliers may hang upon wakeup from disconnect.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * - We disable half multipliers if ACPI is used on A0 stepping CPUs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/moduleparam.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/cpufreq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/dmi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <linux/timex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include <asm/timer.h> /* Needed for recalibrate_cpu_khz() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include <asm/msr.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #include <asm/cpu_device_id.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #ifdef CONFIG_X86_POWERNOW_K7_ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #include <linux/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #include <acpi/processor.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #include "powernow-k7.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct psb_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) u8 signature[10];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) u8 tableversion;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) u8 flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) u16 settlingtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) u8 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) u8 numpst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) struct pst_s {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) u32 cpuid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) u8 fsbspeed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) u8 maxfid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) u8 startvid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) u8 numpstates;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #ifdef CONFIG_X86_POWERNOW_K7_ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) union powernow_acpi_control_t {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) unsigned long fid:5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) vid:5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) sgtc:20,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) res1:2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) } bits;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) unsigned long val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) /* divide by 1000 to get VCore voltage in V. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) static const int mobile_vid_table[32] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 2000, 1950, 1900, 1850, 1800, 1750, 1700, 1650,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 1600, 1550, 1500, 1450, 1400, 1350, 1300, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 1275, 1250, 1225, 1200, 1175, 1150, 1125, 1100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 1075, 1050, 1025, 1000, 975, 950, 925, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) /* divide by 10 to get FID. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) static const int fid_codes[32] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 110, 115, 120, 125, 50, 55, 60, 65,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 70, 75, 80, 85, 90, 95, 100, 105,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 30, 190, 40, 200, 130, 135, 140, 210,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 150, 225, 160, 165, 170, 180, -1, -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) /* This parameter is used in order to force ACPI instead of legacy method for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * configuration purpose.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) static int acpi_force;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) static struct cpufreq_frequency_table *powernow_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) static unsigned int can_scale_bus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) static unsigned int can_scale_vid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) static unsigned int minimum_speed = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) static unsigned int maximum_speed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) static unsigned int number_scales;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) static unsigned int fsb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) static unsigned int latency;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) static char have_a0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) static int check_fsb(unsigned int fsbspeed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) int delta;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) unsigned int f = fsb / 1000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) delta = (fsbspeed > f) ? fsbspeed - f : f - fsbspeed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) return delta < 5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) static const struct x86_cpu_id powernow_k7_cpuids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) X86_MATCH_VENDOR_FAM(AMD, 6, NULL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) MODULE_DEVICE_TABLE(x86cpu, powernow_k7_cpuids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) static int check_powernow(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) struct cpuinfo_x86 *c = &cpu_data(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) unsigned int maxei, eax, ebx, ecx, edx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) if (!x86_match_cpu(powernow_k7_cpuids))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) /* Get maximum capabilities */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) maxei = cpuid_eax(0x80000000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) if (maxei < 0x80000007) { /* Any powernow info ? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) #ifdef MODULE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) pr_info("No powernow capabilities detected\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) if ((c->x86_model == 6) && (c->x86_stepping == 0)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) pr_info("K7 660[A0] core detected, enabling errata workarounds\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) have_a0 = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) cpuid(0x80000007, &eax, &ebx, &ecx, &edx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) /* Check we can actually do something before we say anything.*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) if (!(edx & (1 << 1 | 1 << 2)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) pr_info("PowerNOW! Technology present. Can scale: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) if (edx & 1 << 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) pr_cont("frequency");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) can_scale_bus = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) if ((edx & (1 << 1 | 1 << 2)) == 0x6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) pr_cont(" and ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) if (edx & 1 << 2) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) pr_cont("voltage");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) can_scale_vid = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) pr_cont("\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) #ifdef CONFIG_X86_POWERNOW_K7_ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) static void invalidate_entry(unsigned int entry)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) powernow_table[entry].frequency = CPUFREQ_ENTRY_INVALID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) static int get_ranges(unsigned char *pst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) unsigned int j;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) unsigned int speed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) u8 fid, vid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) powernow_table = kzalloc((sizeof(*powernow_table) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) (number_scales + 1)), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) if (!powernow_table)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) for (j = 0 ; j < number_scales; j++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) fid = *pst++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) powernow_table[j].frequency = (fsb * fid_codes[fid]) / 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) powernow_table[j].driver_data = fid; /* lower 8 bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) speed = powernow_table[j].frequency;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) if ((fid_codes[fid] % 10) == 5) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) #ifdef CONFIG_X86_POWERNOW_K7_ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) if (have_a0 == 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) invalidate_entry(j);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) if (speed < minimum_speed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) minimum_speed = speed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) if (speed > maximum_speed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) maximum_speed = speed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) vid = *pst++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) powernow_table[j].driver_data |= (vid << 8); /* upper 8 bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) pr_debug(" FID: 0x%x (%d.%dx [%dMHz]) "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) "VID: 0x%x (%d.%03dV)\n", fid, fid_codes[fid] / 10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) fid_codes[fid] % 10, speed/1000, vid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) mobile_vid_table[vid]/1000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) mobile_vid_table[vid]%1000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) powernow_table[number_scales].frequency = CPUFREQ_TABLE_END;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) powernow_table[number_scales].driver_data = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) static void change_FID(int fid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) union msr_fidvidctl fidvidctl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) rdmsrl(MSR_K7_FID_VID_CTL, fidvidctl.val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) if (fidvidctl.bits.FID != fid) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) fidvidctl.bits.SGTC = latency;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) fidvidctl.bits.FID = fid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) fidvidctl.bits.VIDC = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) fidvidctl.bits.FIDC = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) wrmsrl(MSR_K7_FID_VID_CTL, fidvidctl.val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) static void change_VID(int vid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) union msr_fidvidctl fidvidctl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) rdmsrl(MSR_K7_FID_VID_CTL, fidvidctl.val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) if (fidvidctl.bits.VID != vid) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) fidvidctl.bits.SGTC = latency;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) fidvidctl.bits.VID = vid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) fidvidctl.bits.FIDC = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) fidvidctl.bits.VIDC = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) wrmsrl(MSR_K7_FID_VID_CTL, fidvidctl.val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) static int powernow_target(struct cpufreq_policy *policy, unsigned int index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) u8 fid, vid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) struct cpufreq_freqs freqs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) union msr_fidvidstatus fidvidstatus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) int cfid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) /* fid are the lower 8 bits of the index we stored into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) * the cpufreq frequency table in powernow_decode_bios,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) * vid are the upper 8 bits.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) fid = powernow_table[index].driver_data & 0xFF;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) vid = (powernow_table[index].driver_data & 0xFF00) >> 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) rdmsrl(MSR_K7_FID_VID_STATUS, fidvidstatus.val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) cfid = fidvidstatus.bits.CFID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) freqs.old = fsb * fid_codes[cfid] / 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) freqs.new = powernow_table[index].frequency;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) /* Now do the magic poking into the MSRs. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) if (have_a0 == 1) /* A0 errata 5 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) local_irq_disable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) if (freqs.old > freqs.new) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) /* Going down, so change FID first */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) change_FID(fid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) change_VID(vid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) /* Going up, so change VID first */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) change_VID(vid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) change_FID(fid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) if (have_a0 == 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) local_irq_enable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) #ifdef CONFIG_X86_POWERNOW_K7_ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) static struct acpi_processor_performance *acpi_processor_perf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) static int powernow_acpi_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) int retval = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) union powernow_acpi_control_t pc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) if (acpi_processor_perf != NULL && powernow_table != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) retval = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) goto err0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) acpi_processor_perf = kzalloc(sizeof(*acpi_processor_perf), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) if (!acpi_processor_perf) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) retval = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) goto err0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) if (!zalloc_cpumask_var(&acpi_processor_perf->shared_cpu_map,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) GFP_KERNEL)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) retval = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) goto err05;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) if (acpi_processor_register_performance(acpi_processor_perf, 0)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) retval = -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) goto err1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) if (acpi_processor_perf->control_register.space_id !=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) ACPI_ADR_SPACE_FIXED_HARDWARE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) retval = -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) goto err2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) if (acpi_processor_perf->status_register.space_id !=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) ACPI_ADR_SPACE_FIXED_HARDWARE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) retval = -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) goto err2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) number_scales = acpi_processor_perf->state_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) if (number_scales < 2) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) retval = -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) goto err2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) powernow_table = kzalloc((sizeof(*powernow_table) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) (number_scales + 1)), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) if (!powernow_table) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) retval = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) goto err2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) pc.val = (unsigned long) acpi_processor_perf->states[0].control;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) for (i = 0; i < number_scales; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) u8 fid, vid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) struct acpi_processor_px *state =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) &acpi_processor_perf->states[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) unsigned int speed, speed_mhz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) pc.val = (unsigned long) state->control;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) pr_debug("acpi: P%d: %d MHz %d mW %d uS control %08x SGTC %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) i,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) (u32) state->core_frequency,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) (u32) state->power,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) (u32) state->transition_latency,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) (u32) state->control,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) pc.bits.sgtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) vid = pc.bits.vid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) fid = pc.bits.fid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) powernow_table[i].frequency = fsb * fid_codes[fid] / 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) powernow_table[i].driver_data = fid; /* lower 8 bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) powernow_table[i].driver_data |= (vid << 8); /* upper 8 bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) speed = powernow_table[i].frequency;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) speed_mhz = speed / 1000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) /* processor_perflib will multiply the MHz value by 1000 to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) * get a KHz value (e.g. 1266000). However, powernow-k7 works
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) * with true KHz values (e.g. 1266768). To ensure that all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) * powernow frequencies are available, we must ensure that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) * ACPI doesn't restrict them, so we round up the MHz value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) * to ensure that perflib's computed KHz value is greater than
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) * or equal to powernow's KHz value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) if (speed % 1000 > 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) speed_mhz++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) if ((fid_codes[fid] % 10) == 5) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) if (have_a0 == 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) invalidate_entry(i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) pr_debug(" FID: 0x%x (%d.%dx [%dMHz]) "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) "VID: 0x%x (%d.%03dV)\n", fid, fid_codes[fid] / 10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) fid_codes[fid] % 10, speed_mhz, vid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) mobile_vid_table[vid]/1000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) mobile_vid_table[vid]%1000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) if (state->core_frequency != speed_mhz) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) state->core_frequency = speed_mhz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) pr_debug(" Corrected ACPI frequency to %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) speed_mhz);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) if (latency < pc.bits.sgtc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) latency = pc.bits.sgtc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) if (speed < minimum_speed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) minimum_speed = speed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) if (speed > maximum_speed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) maximum_speed = speed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) powernow_table[i].frequency = CPUFREQ_TABLE_END;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) powernow_table[i].driver_data = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) /* notify BIOS that we exist */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) acpi_processor_notify_smm(THIS_MODULE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) err2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) acpi_processor_unregister_performance(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) err1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) free_cpumask_var(acpi_processor_perf->shared_cpu_map);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) err05:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) kfree(acpi_processor_perf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) err0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) pr_warn("ACPI perflib can not be used on this platform\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) acpi_processor_perf = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) return retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) static int powernow_acpi_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) pr_info("no support for ACPI processor found - please recompile your kernel with ACPI processor\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) static void print_pst_entry(struct pst_s *pst, unsigned int j)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) pr_debug("PST:%d (@%p)\n", j, pst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) pr_debug(" cpuid: 0x%x fsb: %d maxFID: 0x%x startvid: 0x%x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) pst->cpuid, pst->fsbspeed, pst->maxfid, pst->startvid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) static int powernow_decode_bios(int maxfid, int startvid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) struct psb_s *psb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) struct pst_s *pst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) unsigned int i, j;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) unsigned char *p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) unsigned int etuple;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) unsigned int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) etuple = cpuid_eax(0x80000001);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) for (i = 0xC0000; i < 0xffff0 ; i += 16) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) p = phys_to_virt(i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) if (memcmp(p, "AMDK7PNOW!", 10) == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) pr_debug("Found PSB header at %p\n", p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) psb = (struct psb_s *) p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) pr_debug("Table version: 0x%x\n", psb->tableversion);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) if (psb->tableversion != 0x12) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) pr_info("Sorry, only v1.2 tables supported right now\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) pr_debug("Flags: 0x%x\n", psb->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) if ((psb->flags & 1) == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) pr_debug("Mobile voltage regulator\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) pr_debug("Desktop voltage regulator\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) latency = psb->settlingtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) if (latency < 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) pr_info("BIOS set settling time to %d microseconds. Should be at least 100. Correcting.\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) latency);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) latency = 100;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) pr_debug("Settling Time: %d microseconds.\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) psb->settlingtime);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) pr_debug("Has %d PST tables. (Only dumping ones "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) "relevant to this CPU).\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) psb->numpst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) p += sizeof(*psb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) pst = (struct pst_s *) p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) for (j = 0; j < psb->numpst; j++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) pst = (struct pst_s *) p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) number_scales = pst->numpstates;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) if ((etuple == pst->cpuid) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) check_fsb(pst->fsbspeed) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) (maxfid == pst->maxfid) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) (startvid == pst->startvid)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) print_pst_entry(pst, j);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) p = (char *)pst + sizeof(*pst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) ret = get_ranges(p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) unsigned int k;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) p = (char *)pst + sizeof(*pst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) for (k = 0; k < number_scales; k++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) p += 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) pr_info("No PST tables match this cpuid (0x%x)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) etuple);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) pr_info("This is indicative of a broken BIOS\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) p++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) * We use the fact that the bus frequency is somehow
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) * a multiple of 100000/3 khz, then we compute sgtc according
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) * to this multiple.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) * That way, we match more how AMD thinks all of that work.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) * We will then get the same kind of behaviour already tested under
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) * the "well-known" other OS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) static int fixup_sgtc(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) unsigned int sgtc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) unsigned int m;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) m = fsb / 3333;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) if ((m % 10) >= 5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) m += 5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) m /= 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) sgtc = 100 * m * latency;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) sgtc = sgtc / 3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) if (sgtc > 0xfffff) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) pr_warn("SGTC too large %d\n", sgtc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) sgtc = 0xfffff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) return sgtc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) static unsigned int powernow_get(unsigned int cpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) union msr_fidvidstatus fidvidstatus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) unsigned int cfid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) if (cpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) rdmsrl(MSR_K7_FID_VID_STATUS, fidvidstatus.val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) cfid = fidvidstatus.bits.CFID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) return fsb * fid_codes[cfid] / 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) static int acer_cpufreq_pst(const struct dmi_system_id *d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) pr_warn("%s laptop with broken PST tables in BIOS detected\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) d->ident);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) pr_warn("You need to downgrade to 3A21 (09/09/2002), or try a newer BIOS than 3A71 (01/20/2003)\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) pr_warn("cpufreq scaling has been disabled as a result of this\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) * Some Athlon laptops have really fucked PST tables.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) * A BIOS update is all that can save them.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) * Mention this, and disable cpufreq.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) static const struct dmi_system_id powernow_dmi_table[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) .callback = acer_cpufreq_pst,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) .ident = "Acer Aspire",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) .matches = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) DMI_MATCH(DMI_SYS_VENDOR, "Insyde Software"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) DMI_MATCH(DMI_BIOS_VERSION, "3A71"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) static int powernow_cpu_init(struct cpufreq_policy *policy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) union msr_fidvidstatus fidvidstatus;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) int result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) if (policy->cpu != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) rdmsrl(MSR_K7_FID_VID_STATUS, fidvidstatus.val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) recalibrate_cpu_khz();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) fsb = (10 * cpu_khz) / fid_codes[fidvidstatus.bits.CFID];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) if (!fsb) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) pr_warn("can not determine bus frequency\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) pr_debug("FSB: %3dMHz\n", fsb/1000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) if (dmi_check_system(powernow_dmi_table) || acpi_force) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) pr_info("PSB/PST known to be broken - trying ACPI instead\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) result = powernow_acpi_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) result = powernow_decode_bios(fidvidstatus.bits.MFID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) fidvidstatus.bits.SVID);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) if (result) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) pr_info("Trying ACPI perflib\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) maximum_speed = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) minimum_speed = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) latency = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) result = powernow_acpi_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) if (result) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) pr_info("ACPI and legacy methods failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) /* SGTC use the bus clock as timer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) latency = fixup_sgtc();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) pr_info("SGTC: %d\n", latency);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) if (result)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) pr_info("Minimum speed %d MHz - Maximum speed %d MHz\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) minimum_speed/1000, maximum_speed/1000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) policy->cpuinfo.transition_latency =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) cpufreq_scale(2000000UL, fsb, latency);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) policy->freq_table = powernow_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) static int powernow_cpu_exit(struct cpufreq_policy *policy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) #ifdef CONFIG_X86_POWERNOW_K7_ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) if (acpi_processor_perf) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) acpi_processor_unregister_performance(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) free_cpumask_var(acpi_processor_perf->shared_cpu_map);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) kfree(acpi_processor_perf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) kfree(powernow_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) static struct cpufreq_driver powernow_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) .verify = cpufreq_generic_frequency_table_verify,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) .target_index = powernow_target,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) .get = powernow_get,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) #ifdef CONFIG_X86_POWERNOW_K7_ACPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) .bios_limit = acpi_processor_get_bios_limit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) .init = powernow_cpu_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) .exit = powernow_cpu_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) .name = "powernow-k7",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) .attr = cpufreq_generic_attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) static int __init powernow_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) if (check_powernow() == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) return cpufreq_register_driver(&powernow_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) static void __exit powernow_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) cpufreq_unregister_driver(&powernow_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) module_param(acpi_force, int, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) MODULE_PARM_DESC(acpi_force, "Force ACPI to be used.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) MODULE_AUTHOR("Dave Jones");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) MODULE_DESCRIPTION("Powernow driver for AMD K7 processors.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) late_initcall(powernow_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) module_exit(powernow_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696)