diff options
Diffstat (limited to 'arch/i386/kernel')
| -rw-r--r-- | arch/i386/kernel/cpu/amd.c | 12 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/common.c | 4 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/cpufreq/Kconfig | 14 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/cpufreq/Makefile | 1 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/cpufreq/longhaul.c | 58 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/cpufreq/powernow-k7.c | 11 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 113 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/cpufreq/powernow-k8.h | 15 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/cpufreq/sc520_freq.c | 186 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | 6 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-lib.c | 6 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/cpufreq/speedstep-smi.c | 3 | ||||
| -rw-r--r-- | arch/i386/kernel/cpu/intel_cacheinfo.c | 2 | ||||
| -rw-r--r-- | arch/i386/kernel/setup.c | 2 | ||||
| -rw-r--r-- | arch/i386/kernel/smpboot.c | 5 | ||||
| -rw-r--r-- | arch/i386/kernel/timers/common.c | 6 | ||||
| -rw-r--r-- | arch/i386/kernel/timers/timer_tsc.c | 20 |
17 files changed, 406 insertions, 58 deletions
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c index 16dbc4151be4..73aeaf5a9d4e 100644 --- a/arch/i386/kernel/cpu/amd.c +++ b/arch/i386/kernel/cpu/amd.c | |||
| @@ -24,9 +24,6 @@ __asm__(".align 4\nvide: ret"); | |||
| 24 | 24 | ||
| 25 | static void __init init_amd(struct cpuinfo_x86 *c) | 25 | static void __init init_amd(struct cpuinfo_x86 *c) |
| 26 | { | 26 | { |
| 27 | #ifdef CONFIG_X86_SMP | ||
| 28 | int cpu = c == &boot_cpu_data ? 0 : c - cpu_data; | ||
| 29 | #endif | ||
| 30 | u32 l, h; | 27 | u32 l, h; |
| 31 | int mbytes = num_physpages >> (20-PAGE_SHIFT); | 28 | int mbytes = num_physpages >> (20-PAGE_SHIFT); |
| 32 | int r; | 29 | int r; |
| @@ -198,14 +195,19 @@ static void __init init_amd(struct cpuinfo_x86 *c) | |||
| 198 | c->x86_num_cores = 1; | 195 | c->x86_num_cores = 1; |
| 199 | } | 196 | } |
| 200 | 197 | ||
| 201 | #ifdef CONFIG_X86_SMP | 198 | #ifdef CONFIG_X86_HT |
| 202 | /* | 199 | /* |
| 203 | * On a AMD dual core setup the lower bits of the APIC id | 200 | * On a AMD dual core setup the lower bits of the APIC id |
| 204 | * distingush the cores. Assumes number of cores is a power | 201 | * distingush the cores. Assumes number of cores is a power |
| 205 | * of two. | 202 | * of two. |
| 206 | */ | 203 | */ |
| 207 | if (c->x86_num_cores > 1) { | 204 | if (c->x86_num_cores > 1) { |
| 208 | cpu_core_id[cpu] = cpu >> hweight32(c->x86_num_cores - 1); | 205 | int cpu = smp_processor_id(); |
| 206 | unsigned bits = 0; | ||
| 207 | while ((1 << bits) < c->x86_num_cores) | ||
| 208 | bits++; | ||
| 209 | cpu_core_id[cpu] = phys_proc_id[cpu] & ((1<<bits)-1); | ||
| 210 | phys_proc_id[cpu] >>= bits; | ||
| 209 | printk(KERN_INFO "CPU %d(%d) -> Core %d\n", | 211 | printk(KERN_INFO "CPU %d(%d) -> Core %d\n", |
| 210 | cpu, c->x86_num_cores, cpu_core_id[cpu]); | 212 | cpu, c->x86_num_cores, cpu_core_id[cpu]); |
| 211 | } | 213 | } |
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 6be0310e3cd3..d199e525680a 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
| @@ -243,6 +243,10 @@ static void __init early_cpu_detect(void) | |||
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | early_intel_workaround(c); | 245 | early_intel_workaround(c); |
| 246 | |||
| 247 | #ifdef CONFIG_X86_HT | ||
| 248 | phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff; | ||
| 249 | #endif | ||
| 246 | } | 250 | } |
| 247 | 251 | ||
| 248 | void __init generic_identify(struct cpuinfo_x86 * c) | 252 | void __init generic_identify(struct cpuinfo_x86 * c) |
diff --git a/arch/i386/kernel/cpu/cpufreq/Kconfig b/arch/i386/kernel/cpu/cpufreq/Kconfig index f25ffd74235c..0f1eb507233b 100644 --- a/arch/i386/kernel/cpu/cpufreq/Kconfig +++ b/arch/i386/kernel/cpu/cpufreq/Kconfig | |||
| @@ -23,7 +23,7 @@ config X86_ACPI_CPUFREQ | |||
| 23 | If in doubt, say N. | 23 | If in doubt, say N. |
| 24 | 24 | ||
| 25 | config ELAN_CPUFREQ | 25 | config ELAN_CPUFREQ |
| 26 | tristate "AMD Elan" | 26 | tristate "AMD Elan SC400 and SC410" |
| 27 | select CPU_FREQ_TABLE | 27 | select CPU_FREQ_TABLE |
| 28 | depends on X86_ELAN | 28 | depends on X86_ELAN |
| 29 | ---help--- | 29 | ---help--- |
| @@ -38,6 +38,18 @@ config ELAN_CPUFREQ | |||
| 38 | 38 | ||
| 39 | If in doubt, say N. | 39 | If in doubt, say N. |
| 40 | 40 | ||
| 41 | config SC520_CPUFREQ | ||
| 42 | tristate "AMD Elan SC520" | ||
| 43 | select CPU_FREQ_TABLE | ||
| 44 | depends on X86_ELAN | ||
| 45 | ---help--- | ||
| 46 | This adds the CPUFreq driver for AMD Elan SC520 processor. | ||
| 47 | |||
| 48 | For details, take a look at <file:Documentation/cpu-freq/>. | ||
| 49 | |||
| 50 | If in doubt, say N. | ||
| 51 | |||
| 52 | |||
| 41 | config X86_POWERNOW_K6 | 53 | config X86_POWERNOW_K6 |
| 42 | tristate "AMD Mobile K6-2/K6-3 PowerNow!" | 54 | tristate "AMD Mobile K6-2/K6-3 PowerNow!" |
| 43 | select CPU_FREQ_TABLE | 55 | select CPU_FREQ_TABLE |
diff --git a/arch/i386/kernel/cpu/cpufreq/Makefile b/arch/i386/kernel/cpu/cpufreq/Makefile index a922e97aeedd..2e894f1c8910 100644 --- a/arch/i386/kernel/cpu/cpufreq/Makefile +++ b/arch/i386/kernel/cpu/cpufreq/Makefile | |||
| @@ -3,6 +3,7 @@ obj-$(CONFIG_X86_POWERNOW_K7) += powernow-k7.o | |||
| 3 | obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o | 3 | obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o |
| 4 | obj-$(CONFIG_X86_LONGHAUL) += longhaul.o | 4 | obj-$(CONFIG_X86_LONGHAUL) += longhaul.o |
| 5 | obj-$(CONFIG_ELAN_CPUFREQ) += elanfreq.o | 5 | obj-$(CONFIG_ELAN_CPUFREQ) += elanfreq.o |
| 6 | obj-$(CONFIG_SC520_CPUFREQ) += sc520_freq.o | ||
| 6 | obj-$(CONFIG_X86_LONGRUN) += longrun.o | 7 | obj-$(CONFIG_X86_LONGRUN) += longrun.o |
| 7 | obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o | 8 | obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o |
| 8 | obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o | 9 | obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o |
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c index ab0f9f5aac11..04e3563da4fe 100644 --- a/arch/i386/kernel/cpu/cpufreq/longhaul.c +++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/cpufreq.h> | 29 | #include <linux/cpufreq.h> |
| 30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
| 31 | #include <linux/string.h> | 31 | #include <linux/string.h> |
| 32 | #include <linux/pci.h> | ||
| 32 | 33 | ||
| 33 | #include <asm/msr.h> | 34 | #include <asm/msr.h> |
| 34 | #include <asm/timex.h> | 35 | #include <asm/timex.h> |
| @@ -119,7 +120,13 @@ static int longhaul_get_cpu_mult(void) | |||
| 119 | static void do_powersaver(union msr_longhaul *longhaul, | 120 | static void do_powersaver(union msr_longhaul *longhaul, |
| 120 | unsigned int clock_ratio_index) | 121 | unsigned int clock_ratio_index) |
| 121 | { | 122 | { |
| 123 | struct pci_dev *dev; | ||
| 124 | unsigned long flags; | ||
| 125 | unsigned int tmp_mask; | ||
| 122 | int version; | 126 | int version; |
| 127 | int i; | ||
| 128 | u16 pci_cmd; | ||
| 129 | u16 cmd_state[64]; | ||
| 123 | 130 | ||
| 124 | switch (cpu_model) { | 131 | switch (cpu_model) { |
| 125 | case CPU_EZRA_T: | 132 | case CPU_EZRA_T: |
| @@ -137,17 +144,58 @@ static void do_powersaver(union msr_longhaul *longhaul, | |||
| 137 | longhaul->bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4; | 144 | longhaul->bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4; |
| 138 | longhaul->bits.EnableSoftBusRatio = 1; | 145 | longhaul->bits.EnableSoftBusRatio = 1; |
| 139 | longhaul->bits.RevisionKey = 0; | 146 | longhaul->bits.RevisionKey = 0; |
| 140 | local_irq_disable(); | 147 | |
| 141 | wrmsrl(MSR_VIA_LONGHAUL, longhaul->val); | 148 | preempt_disable(); |
| 149 | local_irq_save(flags); | ||
| 150 | |||
| 151 | /* | ||
| 152 | * get current pci bus master state for all devices | ||
| 153 | * and clear bus master bit | ||
| 154 | */ | ||
| 155 | dev = NULL; | ||
| 156 | i = 0; | ||
| 157 | do { | ||
| 158 | dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev); | ||
| 159 | if (dev != NULL) { | ||
| 160 | pci_read_config_word(dev, PCI_COMMAND, &pci_cmd); | ||
| 161 | cmd_state[i++] = pci_cmd; | ||
| 162 | pci_cmd &= ~PCI_COMMAND_MASTER; | ||
| 163 | pci_write_config_word(dev, PCI_COMMAND, pci_cmd); | ||
| 164 | } | ||
| 165 | } while (dev != NULL); | ||
| 166 | |||
| 167 | tmp_mask=inb(0x21); /* works on C3. save mask. */ | ||
| 168 | outb(0xFE,0x21); /* TMR0 only */ | ||
| 169 | outb(0xFF,0x80); /* delay */ | ||
| 170 | |||
| 142 | local_irq_enable(); | 171 | local_irq_enable(); |
| 172 | |||
| 173 | __hlt(); | ||
| 174 | wrmsrl(MSR_VIA_LONGHAUL, longhaul->val); | ||
| 143 | __hlt(); | 175 | __hlt(); |
| 144 | 176 | ||
| 177 | local_irq_disable(); | ||
| 178 | |||
| 179 | outb(tmp_mask,0x21); /* restore mask */ | ||
| 180 | |||
| 181 | /* restore pci bus master state for all devices */ | ||
| 182 | dev = NULL; | ||
| 183 | i = 0; | ||
| 184 | do { | ||
| 185 | dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev); | ||
| 186 | if (dev != NULL) { | ||
| 187 | pci_cmd = cmd_state[i++]; | ||
| 188 | pci_write_config_byte(dev, PCI_COMMAND, pci_cmd); | ||
| 189 | } | ||
| 190 | } while (dev != NULL); | ||
| 191 | local_irq_restore(flags); | ||
| 192 | preempt_enable(); | ||
| 193 | |||
| 194 | /* disable bus ratio bit */ | ||
| 145 | rdmsrl(MSR_VIA_LONGHAUL, longhaul->val); | 195 | rdmsrl(MSR_VIA_LONGHAUL, longhaul->val); |
| 146 | longhaul->bits.EnableSoftBusRatio = 0; | 196 | longhaul->bits.EnableSoftBusRatio = 0; |
| 147 | longhaul->bits.RevisionKey = version; | 197 | longhaul->bits.RevisionKey = version; |
| 148 | local_irq_disable(); | ||
| 149 | wrmsrl(MSR_VIA_LONGHAUL, longhaul->val); | 198 | wrmsrl(MSR_VIA_LONGHAUL, longhaul->val); |
| 150 | local_irq_enable(); | ||
| 151 | } | 199 | } |
| 152 | 200 | ||
| 153 | /** | 201 | /** |
| @@ -578,7 +626,7 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy) | |||
| 578 | longhaul_setup_voltagescaling(); | 626 | longhaul_setup_voltagescaling(); |
| 579 | 627 | ||
| 580 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | 628 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; |
| 581 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 629 | policy->cpuinfo.transition_latency = 200000; /* nsec */ |
| 582 | policy->cur = calc_speed(longhaul_get_cpu_mult()); | 630 | policy->cur = calc_speed(longhaul_get_cpu_mult()); |
| 583 | 631 | ||
| 584 | ret = cpufreq_frequency_table_cpuinfo(policy, longhaul_table); | 632 | ret = cpufreq_frequency_table_cpuinfo(policy, longhaul_table); |
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c index 913f652623d9..5c530064eb74 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k7.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k7.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/dmi.h> | 23 | #include <linux/dmi.h> |
| 24 | 24 | ||
| 25 | #include <asm/msr.h> | 25 | #include <asm/msr.h> |
| 26 | #include <asm/timer.h> | ||
| 26 | #include <asm/timex.h> | 27 | #include <asm/timex.h> |
| 27 | #include <asm/io.h> | 28 | #include <asm/io.h> |
| 28 | #include <asm/system.h> | 29 | #include <asm/system.h> |
| @@ -586,13 +587,17 @@ static int __init powernow_cpu_init (struct cpufreq_policy *policy) | |||
| 586 | 587 | ||
| 587 | rdmsrl (MSR_K7_FID_VID_STATUS, fidvidstatus.val); | 588 | rdmsrl (MSR_K7_FID_VID_STATUS, fidvidstatus.val); |
| 588 | 589 | ||
| 589 | /* A K7 with powernow technology is set to max frequency by BIOS */ | 590 | /* recalibrate cpu_khz */ |
| 590 | fsb = (10 * cpu_khz) / fid_codes[fidvidstatus.bits.MFID]; | 591 | result = recalibrate_cpu_khz(); |
| 592 | if (result) | ||
| 593 | return result; | ||
| 594 | |||
| 595 | fsb = (10 * cpu_khz) / fid_codes[fidvidstatus.bits.CFID]; | ||
| 591 | if (!fsb) { | 596 | if (!fsb) { |
| 592 | printk(KERN_WARNING PFX "can not determine bus frequency\n"); | 597 | printk(KERN_WARNING PFX "can not determine bus frequency\n"); |
| 593 | return -EINVAL; | 598 | return -EINVAL; |
| 594 | } | 599 | } |
| 595 | dprintk("FSB: %3d.%03d MHz\n", fsb/1000, fsb%1000); | 600 | dprintk("FSB: %3dMHz\n", fsb/1000); |
| 596 | 601 | ||
| 597 | if (dmi_check_system(powernow_dmi_table) || acpi_force) { | 602 | if (dmi_check_system(powernow_dmi_table) || acpi_force) { |
| 598 | printk (KERN_INFO PFX "PSB/PST known to be broken. Trying ACPI instead\n"); | 603 | printk (KERN_INFO PFX "PSB/PST known to be broken. Trying ACPI instead\n"); |
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index a65ff7e32e5d..10cc096c0ade 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * GNU general public license version 2. See "COPYING" or | 4 | * GNU general public license version 2. See "COPYING" or |
| 5 | * http://www.gnu.org/licenses/gpl.html | 5 | * http://www.gnu.org/licenses/gpl.html |
| 6 | * | 6 | * |
| 7 | * Support : paul.devriendt@amd.com | 7 | * Support : mark.langsdorf@amd.com |
| 8 | * | 8 | * |
| 9 | * Based on the powernow-k7.c module written by Dave Jones. | 9 | * Based on the powernow-k7.c module written by Dave Jones. |
| 10 | * (C) 2003 Dave Jones <davej@codemonkey.org.uk> on behalf of SuSE Labs | 10 | * (C) 2003 Dave Jones <davej@codemonkey.org.uk> on behalf of SuSE Labs |
| @@ -15,12 +15,13 @@ | |||
| 15 | * | 15 | * |
| 16 | * Valuable input gratefully received from Dave Jones, Pavel Machek, | 16 | * Valuable input gratefully received from Dave Jones, Pavel Machek, |
| 17 | * Dominik Brodowski, and others. | 17 | * Dominik Brodowski, and others. |
| 18 | * Originally developed by Paul Devriendt. | ||
| 18 | * Processor information obtained from Chapter 9 (Power and Thermal Management) | 19 | * Processor information obtained from Chapter 9 (Power and Thermal Management) |
| 19 | * of the "BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD | 20 | * of the "BIOS and Kernel Developer's Guide for the AMD Athlon 64 and AMD |
| 20 | * Opteron Processors" available for download from www.amd.com | 21 | * Opteron Processors" available for download from www.amd.com |
| 21 | * | 22 | * |
| 22 | * Tables for specific CPUs can be infrerred from | 23 | * Tables for specific CPUs can be infrerred from |
| 23 | * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/30430.pdf | 24 | * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/30430.pdf |
| 24 | */ | 25 | */ |
| 25 | 26 | ||
| 26 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
| @@ -30,6 +31,7 @@ | |||
| 30 | #include <linux/cpufreq.h> | 31 | #include <linux/cpufreq.h> |
| 31 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
| 32 | #include <linux/string.h> | 33 | #include <linux/string.h> |
| 34 | #include <linux/cpumask.h> | ||
| 33 | 35 | ||
| 34 | #include <asm/msr.h> | 36 | #include <asm/msr.h> |
| 35 | #include <asm/io.h> | 37 | #include <asm/io.h> |
| @@ -42,7 +44,7 @@ | |||
| 42 | 44 | ||
| 43 | #define PFX "powernow-k8: " | 45 | #define PFX "powernow-k8: " |
| 44 | #define BFX PFX "BIOS error: " | 46 | #define BFX PFX "BIOS error: " |
| 45 | #define VERSION "version 1.00.09e" | 47 | #define VERSION "version 1.40.2" |
| 46 | #include "powernow-k8.h" | 48 | #include "powernow-k8.h" |
| 47 | 49 | ||
| 48 | /* serialize freq changes */ | 50 | /* serialize freq changes */ |
| @@ -50,6 +52,10 @@ static DECLARE_MUTEX(fidvid_sem); | |||
| 50 | 52 | ||
| 51 | static struct powernow_k8_data *powernow_data[NR_CPUS]; | 53 | static struct powernow_k8_data *powernow_data[NR_CPUS]; |
| 52 | 54 | ||
| 55 | #ifndef CONFIG_SMP | ||
| 56 | static cpumask_t cpu_core_map[1]; | ||
| 57 | #endif | ||
| 58 | |||
| 53 | /* Return a frequency in MHz, given an input fid */ | 59 | /* Return a frequency in MHz, given an input fid */ |
| 54 | static u32 find_freq_from_fid(u32 fid) | 60 | static u32 find_freq_from_fid(u32 fid) |
| 55 | { | 61 | { |
| @@ -274,11 +280,18 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data, u32 reqvid | |||
| 274 | { | 280 | { |
| 275 | u32 rvosteps = data->rvo; | 281 | u32 rvosteps = data->rvo; |
| 276 | u32 savefid = data->currfid; | 282 | u32 savefid = data->currfid; |
| 283 | u32 maxvid, lo; | ||
| 277 | 284 | ||
| 278 | dprintk("ph1 (cpu%d): start, currfid 0x%x, currvid 0x%x, reqvid 0x%x, rvo 0x%x\n", | 285 | dprintk("ph1 (cpu%d): start, currfid 0x%x, currvid 0x%x, reqvid 0x%x, rvo 0x%x\n", |
| 279 | smp_processor_id(), | 286 | smp_processor_id(), |
| 280 | data->currfid, data->currvid, reqvid, data->rvo); | 287 | data->currfid, data->currvid, reqvid, data->rvo); |
| 281 | 288 | ||
| 289 | rdmsr(MSR_FIDVID_STATUS, lo, maxvid); | ||
| 290 | maxvid = 0x1f & (maxvid >> 16); | ||
| 291 | dprintk("ph1 maxvid=0x%x\n", maxvid); | ||
| 292 | if (reqvid < maxvid) /* lower numbers are higher voltages */ | ||
| 293 | reqvid = maxvid; | ||
| 294 | |||
| 282 | while (data->currvid > reqvid) { | 295 | while (data->currvid > reqvid) { |
| 283 | dprintk("ph1: curr 0x%x, req vid 0x%x\n", | 296 | dprintk("ph1: curr 0x%x, req vid 0x%x\n", |
| 284 | data->currvid, reqvid); | 297 | data->currvid, reqvid); |
| @@ -286,8 +299,8 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data, u32 reqvid | |||
| 286 | return 1; | 299 | return 1; |
| 287 | } | 300 | } |
| 288 | 301 | ||
| 289 | while ((rvosteps > 0) && ((data->rvo + data->currvid) > reqvid)) { | 302 | while ((rvosteps > 0) && ((data->rvo + data->currvid) > reqvid)) { |
| 290 | if (data->currvid == 0) { | 303 | if (data->currvid == maxvid) { |
| 291 | rvosteps = 0; | 304 | rvosteps = 0; |
| 292 | } else { | 305 | } else { |
| 293 | dprintk("ph1: changing vid for rvo, req 0x%x\n", | 306 | dprintk("ph1: changing vid for rvo, req 0x%x\n", |
| @@ -671,7 +684,7 @@ static int find_psb_table(struct powernow_k8_data *data) | |||
| 671 | * BIOS and Kernel Developer's Guide, which is available on | 684 | * BIOS and Kernel Developer's Guide, which is available on |
| 672 | * www.amd.com | 685 | * www.amd.com |
| 673 | */ | 686 | */ |
| 674 | printk(KERN_ERR PFX "BIOS error - no PSB\n"); | 687 | printk(KERN_INFO PFX "BIOS error - no PSB or ACPI _PSS objects\n"); |
| 675 | return -ENODEV; | 688 | return -ENODEV; |
| 676 | } | 689 | } |
| 677 | 690 | ||
| @@ -695,7 +708,7 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) | |||
| 695 | struct cpufreq_frequency_table *powernow_table; | 708 | struct cpufreq_frequency_table *powernow_table; |
| 696 | 709 | ||
| 697 | if (acpi_processor_register_performance(&data->acpi_data, data->cpu)) { | 710 | if (acpi_processor_register_performance(&data->acpi_data, data->cpu)) { |
| 698 | dprintk("register performance failed\n"); | 711 | dprintk("register performance failed: bad ACPI data\n"); |
| 699 | return -EIO; | 712 | return -EIO; |
| 700 | } | 713 | } |
| 701 | 714 | ||
| @@ -746,22 +759,23 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) | |||
| 746 | continue; | 759 | continue; |
| 747 | } | 760 | } |
| 748 | 761 | ||
| 749 | if (fid < HI_FID_TABLE_BOTTOM) { | 762 | /* verify only 1 entry from the lo frequency table */ |
| 750 | if (cntlofreq) { | 763 | if (fid < HI_FID_TABLE_BOTTOM) { |
| 751 | /* if both entries are the same, ignore this | 764 | if (cntlofreq) { |
| 752 | * one... | 765 | /* if both entries are the same, ignore this |
| 753 | */ | 766 | * one... |
| 754 | if ((powernow_table[i].frequency != powernow_table[cntlofreq].frequency) || | 767 | */ |
| 755 | (powernow_table[i].index != powernow_table[cntlofreq].index)) { | 768 | if ((powernow_table[i].frequency != powernow_table[cntlofreq].frequency) || |
| 756 | printk(KERN_ERR PFX "Too many lo freq table entries\n"); | 769 | (powernow_table[i].index != powernow_table[cntlofreq].index)) { |
| 757 | goto err_out_mem; | 770 | printk(KERN_ERR PFX "Too many lo freq table entries\n"); |
| 758 | } | 771 | goto err_out_mem; |
| 759 | 772 | } | |
| 760 | dprintk("double low frequency table entry, ignoring it.\n"); | 773 | |
| 761 | powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID; | 774 | dprintk("double low frequency table entry, ignoring it.\n"); |
| 762 | continue; | 775 | powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID; |
| 763 | } else | 776 | continue; |
| 764 | cntlofreq = i; | 777 | } else |
| 778 | cntlofreq = i; | ||
| 765 | } | 779 | } |
| 766 | 780 | ||
| 767 | if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) { | 781 | if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) { |
| @@ -816,7 +830,7 @@ static int transition_frequency(struct powernow_k8_data *data, unsigned int inde | |||
| 816 | { | 830 | { |
| 817 | u32 fid; | 831 | u32 fid; |
| 818 | u32 vid; | 832 | u32 vid; |
| 819 | int res; | 833 | int res, i; |
| 820 | struct cpufreq_freqs freqs; | 834 | struct cpufreq_freqs freqs; |
| 821 | 835 | ||
| 822 | dprintk("cpu %d transition to index %u\n", smp_processor_id(), index); | 836 | dprintk("cpu %d transition to index %u\n", smp_processor_id(), index); |
| @@ -841,7 +855,8 @@ static int transition_frequency(struct powernow_k8_data *data, unsigned int inde | |||
| 841 | } | 855 | } |
| 842 | 856 | ||
| 843 | if ((fid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) { | 857 | if ((fid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) { |
| 844 | printk("ignoring illegal change in lo freq table-%x to 0x%x\n", | 858 | printk(KERN_ERR PFX |
| 859 | "ignoring illegal change in lo freq table-%x to 0x%x\n", | ||
| 845 | data->currfid, fid); | 860 | data->currfid, fid); |
| 846 | return 1; | 861 | return 1; |
| 847 | } | 862 | } |
| @@ -850,18 +865,20 @@ static int transition_frequency(struct powernow_k8_data *data, unsigned int inde | |||
| 850 | smp_processor_id(), fid, vid); | 865 | smp_processor_id(), fid, vid); |
| 851 | 866 | ||
| 852 | freqs.cpu = data->cpu; | 867 | freqs.cpu = data->cpu; |
| 853 | |||
| 854 | freqs.old = find_khz_freq_from_fid(data->currfid); | 868 | freqs.old = find_khz_freq_from_fid(data->currfid); |
| 855 | freqs.new = find_khz_freq_from_fid(fid); | 869 | freqs.new = find_khz_freq_from_fid(fid); |
| 856 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 870 | for_each_cpu_mask(i, cpu_core_map[data->cpu]) { |
| 871 | freqs.cpu = i; | ||
| 872 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
| 873 | } | ||
| 857 | 874 | ||
| 858 | down(&fidvid_sem); | ||
| 859 | res = transition_fid_vid(data, fid, vid); | 875 | res = transition_fid_vid(data, fid, vid); |
| 860 | up(&fidvid_sem); | ||
| 861 | 876 | ||
| 862 | freqs.new = find_khz_freq_from_fid(data->currfid); | 877 | freqs.new = find_khz_freq_from_fid(data->currfid); |
| 863 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 878 | for_each_cpu_mask(i, cpu_core_map[data->cpu]) { |
| 864 | 879 | freqs.cpu = i; | |
| 880 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
| 881 | } | ||
| 865 | return res; | 882 | return res; |
| 866 | } | 883 | } |
| 867 | 884 | ||
| @@ -874,6 +891,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
| 874 | u32 checkvid = data->currvid; | 891 | u32 checkvid = data->currvid; |
| 875 | unsigned int newstate; | 892 | unsigned int newstate; |
| 876 | int ret = -EIO; | 893 | int ret = -EIO; |
| 894 | int i; | ||
| 877 | 895 | ||
| 878 | /* only run on specific CPU from here on */ | 896 | /* only run on specific CPU from here on */ |
| 879 | oldmask = current->cpus_allowed; | 897 | oldmask = current->cpus_allowed; |
| @@ -902,22 +920,41 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
| 902 | data->currfid, data->currvid); | 920 | data->currfid, data->currvid); |
| 903 | 921 | ||
| 904 | if ((checkvid != data->currvid) || (checkfid != data->currfid)) { | 922 | if ((checkvid != data->currvid) || (checkfid != data->currfid)) { |
| 905 | printk(KERN_ERR PFX | 923 | printk(KERN_INFO PFX |
| 906 | "error - out of sync, fid 0x%x 0x%x, vid 0x%x 0x%x\n", | 924 | "error - out of sync, fix 0x%x 0x%x, vid 0x%x 0x%x\n", |
| 907 | checkfid, data->currfid, checkvid, data->currvid); | 925 | checkfid, data->currfid, checkvid, data->currvid); |
| 908 | } | 926 | } |
| 909 | 927 | ||
| 910 | if (cpufreq_frequency_table_target(pol, data->powernow_table, targfreq, relation, &newstate)) | 928 | if (cpufreq_frequency_table_target(pol, data->powernow_table, targfreq, relation, &newstate)) |
| 911 | goto err_out; | 929 | goto err_out; |
| 912 | 930 | ||
| 931 | down(&fidvid_sem); | ||
| 932 | |||
| 933 | for_each_cpu_mask(i, cpu_core_map[pol->cpu]) { | ||
| 934 | /* make sure the sibling is initialized */ | ||
| 935 | if (!powernow_data[i]) { | ||
| 936 | ret = 0; | ||
| 937 | up(&fidvid_sem); | ||
| 938 | goto err_out; | ||
| 939 | } | ||
| 940 | } | ||
| 941 | |||
| 913 | powernow_k8_acpi_pst_values(data, newstate); | 942 | powernow_k8_acpi_pst_values(data, newstate); |
| 914 | 943 | ||
| 915 | if (transition_frequency(data, newstate)) { | 944 | if (transition_frequency(data, newstate)) { |
| 916 | printk(KERN_ERR PFX "transition frequency failed\n"); | 945 | printk(KERN_ERR PFX "transition frequency failed\n"); |
| 917 | ret = 1; | 946 | ret = 1; |
| 947 | up(&fidvid_sem); | ||
| 918 | goto err_out; | 948 | goto err_out; |
| 919 | } | 949 | } |
| 920 | 950 | ||
| 951 | /* Update all the fid/vids of our siblings */ | ||
| 952 | for_each_cpu_mask(i, cpu_core_map[pol->cpu]) { | ||
| 953 | powernow_data[i]->currvid = data->currvid; | ||
| 954 | powernow_data[i]->currfid = data->currfid; | ||
| 955 | } | ||
| 956 | up(&fidvid_sem); | ||
| 957 | |||
| 921 | pol->cur = find_khz_freq_from_fid(data->currfid); | 958 | pol->cur = find_khz_freq_from_fid(data->currfid); |
| 922 | ret = 0; | 959 | ret = 0; |
| 923 | 960 | ||
| @@ -962,7 +999,7 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
| 962 | */ | 999 | */ |
| 963 | 1000 | ||
| 964 | if ((num_online_cpus() != 1) || (num_possible_cpus() != 1)) { | 1001 | if ((num_online_cpus() != 1) || (num_possible_cpus() != 1)) { |
| 965 | printk(KERN_INFO PFX "MP systems not supported by PSB BIOS structure\n"); | 1002 | printk(KERN_ERR PFX "MP systems not supported by PSB BIOS structure\n"); |
| 966 | kfree(data); | 1003 | kfree(data); |
| 967 | return -ENODEV; | 1004 | return -ENODEV; |
| 968 | } | 1005 | } |
| @@ -1003,6 +1040,7 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
| 1003 | schedule(); | 1040 | schedule(); |
| 1004 | 1041 | ||
| 1005 | pol->governor = CPUFREQ_DEFAULT_GOVERNOR; | 1042 | pol->governor = CPUFREQ_DEFAULT_GOVERNOR; |
| 1043 | pol->cpus = cpu_core_map[pol->cpu]; | ||
| 1006 | 1044 | ||
| 1007 | /* Take a crude guess here. | 1045 | /* Take a crude guess here. |
| 1008 | * That guess was in microseconds, so multiply with 1000 */ | 1046 | * That guess was in microseconds, so multiply with 1000 */ |
| @@ -1069,7 +1107,7 @@ static unsigned int powernowk8_get (unsigned int cpu) | |||
| 1069 | return 0; | 1107 | return 0; |
| 1070 | } | 1108 | } |
| 1071 | preempt_disable(); | 1109 | preempt_disable(); |
| 1072 | 1110 | ||
| 1073 | if (query_current_values_with_pending_wait(data)) | 1111 | if (query_current_values_with_pending_wait(data)) |
| 1074 | goto out; | 1112 | goto out; |
| 1075 | 1113 | ||
| @@ -1127,9 +1165,10 @@ static void __exit powernowk8_exit(void) | |||
| 1127 | cpufreq_unregister_driver(&cpufreq_amd64_driver); | 1165 | cpufreq_unregister_driver(&cpufreq_amd64_driver); |
| 1128 | } | 1166 | } |
| 1129 | 1167 | ||
| 1130 | MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com>"); | 1168 | MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and Mark Langsdorf <mark.langsdorf@amd.com."); |
| 1131 | MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver."); | 1169 | MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver."); |
| 1132 | MODULE_LICENSE("GPL"); | 1170 | MODULE_LICENSE("GPL"); |
| 1133 | 1171 | ||
| 1134 | late_initcall(powernowk8_init); | 1172 | late_initcall(powernowk8_init); |
| 1135 | module_exit(powernowk8_exit); | 1173 | module_exit(powernowk8_exit); |
| 1174 | |||
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h index 63ebc8470f52..9ed5bf221cb7 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h | |||
| @@ -174,3 +174,18 @@ static int core_voltage_post_transition(struct powernow_k8_data *data, u32 reqvi | |||
| 174 | static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid); | 174 | static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid); |
| 175 | 175 | ||
| 176 | static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index); | 176 | static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index); |
| 177 | |||
| 178 | #ifndef for_each_cpu_mask | ||
| 179 | #define for_each_cpu_mask(i,mask) for (i=0;i<1;i++) | ||
| 180 | #endif | ||
| 181 | |||
| 182 | #ifdef CONFIG_SMP | ||
| 183 | static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[]) | ||
| 184 | { | ||
| 185 | } | ||
| 186 | #else | ||
| 187 | static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[]) | ||
| 188 | { | ||
| 189 | cpu_set(0, cpu_sharedcore_mask[0]); | ||
| 190 | } | ||
| 191 | #endif | ||
diff --git a/arch/i386/kernel/cpu/cpufreq/sc520_freq.c b/arch/i386/kernel/cpu/cpufreq/sc520_freq.c new file mode 100644 index 000000000000..ef457d50f4ac --- /dev/null +++ b/arch/i386/kernel/cpu/cpufreq/sc520_freq.c | |||
| @@ -0,0 +1,186 @@ | |||
| 1 | /* | ||
| 2 | * sc520_freq.c: cpufreq driver for the AMD Elan sc520 | ||
| 3 | * | ||
| 4 | * Copyright (C) 2005 Sean Young <sean@mess.org> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU General Public License | ||
| 8 | * as published by the Free Software Foundation; either version | ||
| 9 | * 2 of the License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * Based on elanfreq.c | ||
| 12 | * | ||
| 13 | * 2005-03-30: - initial revision | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <linux/kernel.h> | ||
| 17 | #include <linux/module.h> | ||
| 18 | #include <linux/init.h> | ||
| 19 | |||
| 20 | #include <linux/delay.h> | ||
| 21 | #include <linux/cpufreq.h> | ||
| 22 | |||
| 23 | #include <asm/msr.h> | ||
| 24 | #include <asm/timex.h> | ||
| 25 | #include <asm/io.h> | ||
| 26 | |||
| 27 | #define MMCR_BASE 0xfffef000 /* The default base address */ | ||
| 28 | #define OFFS_CPUCTL 0x2 /* CPU Control Register */ | ||
| 29 | |||
| 30 | static __u8 __iomem *cpuctl; | ||
| 31 | |||
| 32 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "sc520_freq", msg) | ||
| 33 | |||
| 34 | static struct cpufreq_frequency_table sc520_freq_table[] = { | ||
| 35 | {0x01, 100000}, | ||
| 36 | {0x02, 133000}, | ||
| 37 | {0, CPUFREQ_TABLE_END}, | ||
| 38 | }; | ||
| 39 | |||
| 40 | static unsigned int sc520_freq_get_cpu_frequency(unsigned int cpu) | ||
| 41 | { | ||
| 42 | u8 clockspeed_reg = *cpuctl; | ||
| 43 | |||
| 44 | switch (clockspeed_reg & 0x03) { | ||
| 45 | default: | ||
| 46 | printk(KERN_ERR "sc520_freq: error: cpuctl register has unexpected value %02x\n", clockspeed_reg); | ||
| 47 | case 0x01: | ||
| 48 | return 100000; | ||
| 49 | case 0x02: | ||
| 50 | return 133000; | ||
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 54 | static void sc520_freq_set_cpu_state (unsigned int state) | ||
| 55 | { | ||
| 56 | |||
| 57 | struct cpufreq_freqs freqs; | ||
| 58 | u8 clockspeed_reg; | ||
| 59 | |||
| 60 | freqs.old = sc520_freq_get_cpu_frequency(0); | ||
| 61 | freqs.new = sc520_freq_table[state].frequency; | ||
| 62 | freqs.cpu = 0; /* AMD Elan is UP */ | ||
| 63 | |||
| 64 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
| 65 | |||
| 66 | dprintk("attempting to set frequency to %i kHz\n", | ||
| 67 | sc520_freq_table[state].frequency); | ||
| 68 | |||
| 69 | local_irq_disable(); | ||
| 70 | |||
| 71 | clockspeed_reg = *cpuctl & ~0x03; | ||
| 72 | *cpuctl = clockspeed_reg | sc520_freq_table[state].index; | ||
| 73 | |||
| 74 | local_irq_enable(); | ||
| 75 | |||
| 76 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
| 77 | }; | ||
| 78 | |||
| 79 | static int sc520_freq_verify (struct cpufreq_policy *policy) | ||
| 80 | { | ||
| 81 | return cpufreq_frequency_table_verify(policy, &sc520_freq_table[0]); | ||
| 82 | } | ||
| 83 | |||
| 84 | static int sc520_freq_target (struct cpufreq_policy *policy, | ||
| 85 | unsigned int target_freq, | ||
| 86 | unsigned int relation) | ||
| 87 | { | ||
| 88 | unsigned int newstate = 0; | ||
| 89 | |||
| 90 | if (cpufreq_frequency_table_target(policy, sc520_freq_table, target_freq, relation, &newstate)) | ||
| 91 | return -EINVAL; | ||
| 92 | |||
| 93 | sc520_freq_set_cpu_state(newstate); | ||
| 94 | |||
| 95 | return 0; | ||
| 96 | } | ||
| 97 | |||
| 98 | |||
| 99 | /* | ||
| 100 | * Module init and exit code | ||
| 101 | */ | ||
| 102 | |||
| 103 | static int sc520_freq_cpu_init(struct cpufreq_policy *policy) | ||
| 104 | { | ||
| 105 | struct cpuinfo_x86 *c = cpu_data; | ||
| 106 | int result; | ||
| 107 | |||
| 108 | /* capability check */ | ||
| 109 | if (c->x86_vendor != X86_VENDOR_AMD || | ||
| 110 | c->x86 != 4 || c->x86_model != 9) | ||
| 111 | return -ENODEV; | ||
| 112 | |||
| 113 | /* cpuinfo and default policy values */ | ||
| 114 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 115 | policy->cpuinfo.transition_latency = 1000000; /* 1ms */ | ||
| 116 | policy->cur = sc520_freq_get_cpu_frequency(0); | ||
| 117 | |||
| 118 | result = cpufreq_frequency_table_cpuinfo(policy, sc520_freq_table); | ||
| 119 | if (result) | ||
| 120 | return (result); | ||
| 121 | |||
| 122 | cpufreq_frequency_table_get_attr(sc520_freq_table, policy->cpu); | ||
| 123 | |||
| 124 | return 0; | ||
| 125 | } | ||
| 126 | |||
| 127 | |||
| 128 | static int sc520_freq_cpu_exit(struct cpufreq_policy *policy) | ||
| 129 | { | ||
| 130 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
| 131 | return 0; | ||
| 132 | } | ||
| 133 | |||
| 134 | |||
| 135 | static struct freq_attr* sc520_freq_attr[] = { | ||
| 136 | &cpufreq_freq_attr_scaling_available_freqs, | ||
| 137 | NULL, | ||
| 138 | }; | ||
| 139 | |||
| 140 | |||
| 141 | static struct cpufreq_driver sc520_freq_driver = { | ||
| 142 | .get = sc520_freq_get_cpu_frequency, | ||
| 143 | .verify = sc520_freq_verify, | ||
| 144 | .target = sc520_freq_target, | ||
| 145 | .init = sc520_freq_cpu_init, | ||
| 146 | .exit = sc520_freq_cpu_exit, | ||
| 147 | .name = "sc520_freq", | ||
| 148 | .owner = THIS_MODULE, | ||
| 149 | .attr = sc520_freq_attr, | ||
| 150 | }; | ||
| 151 | |||
| 152 | |||
| 153 | static int __init sc520_freq_init(void) | ||
| 154 | { | ||
| 155 | struct cpuinfo_x86 *c = cpu_data; | ||
| 156 | |||
| 157 | /* Test if we have the right hardware */ | ||
| 158 | if(c->x86_vendor != X86_VENDOR_AMD || | ||
| 159 | c->x86 != 4 || c->x86_model != 9) { | ||
| 160 | dprintk("no Elan SC520 processor found!\n"); | ||
| 161 | return -ENODEV; | ||
| 162 | } | ||
| 163 | cpuctl = ioremap((unsigned long)(MMCR_BASE + OFFS_CPUCTL), 1); | ||
| 164 | if(!cpuctl) { | ||
| 165 | printk(KERN_ERR "sc520_freq: error: failed to remap memory\n"); | ||
| 166 | return -ENOMEM; | ||
| 167 | } | ||
| 168 | |||
| 169 | return cpufreq_register_driver(&sc520_freq_driver); | ||
| 170 | } | ||
| 171 | |||
| 172 | |||
| 173 | static void __exit sc520_freq_exit(void) | ||
| 174 | { | ||
| 175 | cpufreq_unregister_driver(&sc520_freq_driver); | ||
| 176 | iounmap(cpuctl); | ||
| 177 | } | ||
| 178 | |||
| 179 | |||
| 180 | MODULE_LICENSE("GPL"); | ||
| 181 | MODULE_AUTHOR("Sean Young <sean@mess.org>"); | ||
| 182 | MODULE_DESCRIPTION("cpufreq driver for AMD's Elan sc520 CPU"); | ||
| 183 | |||
| 184 | module_init(sc520_freq_init); | ||
| 185 | module_exit(sc520_freq_exit); | ||
| 186 | |||
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c index 07d5612dc00f..7dcbf70fc16f 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c | |||
| @@ -54,6 +54,8 @@ enum { | |||
| 54 | CPU_DOTHAN_A1, | 54 | CPU_DOTHAN_A1, |
| 55 | CPU_DOTHAN_A2, | 55 | CPU_DOTHAN_A2, |
| 56 | CPU_DOTHAN_B0, | 56 | CPU_DOTHAN_B0, |
| 57 | CPU_MP4HT_D0, | ||
| 58 | CPU_MP4HT_E0, | ||
| 57 | }; | 59 | }; |
| 58 | 60 | ||
| 59 | static const struct cpu_id cpu_ids[] = { | 61 | static const struct cpu_id cpu_ids[] = { |
| @@ -61,6 +63,8 @@ static const struct cpu_id cpu_ids[] = { | |||
| 61 | [CPU_DOTHAN_A1] = { 6, 13, 1 }, | 63 | [CPU_DOTHAN_A1] = { 6, 13, 1 }, |
| 62 | [CPU_DOTHAN_A2] = { 6, 13, 2 }, | 64 | [CPU_DOTHAN_A2] = { 6, 13, 2 }, |
| 63 | [CPU_DOTHAN_B0] = { 6, 13, 6 }, | 65 | [CPU_DOTHAN_B0] = { 6, 13, 6 }, |
| 66 | [CPU_MP4HT_D0] = {15, 3, 4 }, | ||
| 67 | [CPU_MP4HT_E0] = {15, 4, 1 }, | ||
| 64 | }; | 68 | }; |
| 65 | #define N_IDS (sizeof(cpu_ids)/sizeof(cpu_ids[0])) | 69 | #define N_IDS (sizeof(cpu_ids)/sizeof(cpu_ids[0])) |
| 66 | 70 | ||
| @@ -226,6 +230,8 @@ static struct cpu_model models[] = | |||
| 226 | { &cpu_ids[CPU_DOTHAN_A1], NULL, 0, NULL }, | 230 | { &cpu_ids[CPU_DOTHAN_A1], NULL, 0, NULL }, |
| 227 | { &cpu_ids[CPU_DOTHAN_A2], NULL, 0, NULL }, | 231 | { &cpu_ids[CPU_DOTHAN_A2], NULL, 0, NULL }, |
| 228 | { &cpu_ids[CPU_DOTHAN_B0], NULL, 0, NULL }, | 232 | { &cpu_ids[CPU_DOTHAN_B0], NULL, 0, NULL }, |
| 233 | { &cpu_ids[CPU_MP4HT_D0], NULL, 0, NULL }, | ||
| 234 | { &cpu_ids[CPU_MP4HT_E0], NULL, 0, NULL }, | ||
| 229 | 235 | ||
| 230 | { NULL, } | 236 | { NULL, } |
| 231 | }; | 237 | }; |
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c index 8ba430a9c3a2..d368b3f5fce8 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c | |||
| @@ -336,7 +336,7 @@ unsigned int speedstep_get_freqs(unsigned int processor, | |||
| 336 | if (!prev_speed) | 336 | if (!prev_speed) |
| 337 | return -EIO; | 337 | return -EIO; |
| 338 | 338 | ||
| 339 | dprintk("previous seped is %u\n", prev_speed); | 339 | dprintk("previous speed is %u\n", prev_speed); |
| 340 | 340 | ||
| 341 | local_irq_save(flags); | 341 | local_irq_save(flags); |
| 342 | 342 | ||
| @@ -348,7 +348,7 @@ unsigned int speedstep_get_freqs(unsigned int processor, | |||
| 348 | goto out; | 348 | goto out; |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | dprintk("low seped is %u\n", *low_speed); | 351 | dprintk("low speed is %u\n", *low_speed); |
| 352 | 352 | ||
| 353 | /* switch to high state */ | 353 | /* switch to high state */ |
| 354 | set_state(SPEEDSTEP_HIGH); | 354 | set_state(SPEEDSTEP_HIGH); |
| @@ -358,7 +358,7 @@ unsigned int speedstep_get_freqs(unsigned int processor, | |||
| 358 | goto out; | 358 | goto out; |
| 359 | } | 359 | } |
| 360 | 360 | ||
| 361 | dprintk("high seped is %u\n", *high_speed); | 361 | dprintk("high speed is %u\n", *high_speed); |
| 362 | 362 | ||
| 363 | if (*low_speed == *high_speed) { | 363 | if (*low_speed == *high_speed) { |
| 364 | ret = -ENODEV; | 364 | ret = -ENODEV; |
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c index 79440b3f087e..b25fb6b635ae 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c | |||
| @@ -357,6 +357,9 @@ static int __init speedstep_init(void) | |||
| 357 | case SPEEDSTEP_PROCESSOR_PIII_C: | 357 | case SPEEDSTEP_PROCESSOR_PIII_C: |
| 358 | case SPEEDSTEP_PROCESSOR_PIII_C_EARLY: | 358 | case SPEEDSTEP_PROCESSOR_PIII_C_EARLY: |
| 359 | break; | 359 | break; |
| 360 | case SPEEDSTEP_PROCESSOR_P4M: | ||
| 361 | printk(KERN_INFO "speedstep-smi: you're trying to use this cpufreq driver on a Pentium 4-based CPU. Most likely it will not work.\n"); | ||
| 362 | break; | ||
| 360 | default: | 363 | default: |
| 361 | speedstep_processor = 0; | 364 | speedstep_processor = 0; |
| 362 | } | 365 | } |
diff --git a/arch/i386/kernel/cpu/intel_cacheinfo.c b/arch/i386/kernel/cpu/intel_cacheinfo.c index aeb5b4ef8c8b..a710dc4eb20e 100644 --- a/arch/i386/kernel/cpu/intel_cacheinfo.c +++ b/arch/i386/kernel/cpu/intel_cacheinfo.c | |||
| @@ -118,7 +118,7 @@ struct _cpuid4_info { | |||
| 118 | }; | 118 | }; |
| 119 | 119 | ||
| 120 | #define MAX_CACHE_LEAVES 4 | 120 | #define MAX_CACHE_LEAVES 4 |
| 121 | static unsigned short __devinitdata num_cache_leaves; | 121 | static unsigned short num_cache_leaves; |
| 122 | 122 | ||
| 123 | static int __devinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf) | 123 | static int __devinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf) |
| 124 | { | 124 | { |
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index 945ec73163c8..2bfbddebdbf8 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
| @@ -1502,11 +1502,13 @@ void __init setup_arch(char **cmdline_p) | |||
| 1502 | if (efi_enabled) | 1502 | if (efi_enabled) |
| 1503 | efi_map_memmap(); | 1503 | efi_map_memmap(); |
| 1504 | 1504 | ||
| 1505 | #ifdef CONFIG_ACPI_BOOT | ||
| 1505 | /* | 1506 | /* |
| 1506 | * Parse the ACPI tables for possible boot-time SMP configuration. | 1507 | * Parse the ACPI tables for possible boot-time SMP configuration. |
| 1507 | */ | 1508 | */ |
| 1508 | acpi_boot_table_init(); | 1509 | acpi_boot_table_init(); |
| 1509 | acpi_boot_init(); | 1510 | acpi_boot_init(); |
| 1511 | #endif | ||
| 1510 | 1512 | ||
| 1511 | #ifdef CONFIG_X86_LOCAL_APIC | 1513 | #ifdef CONFIG_X86_LOCAL_APIC |
| 1512 | if (smp_found_config) | 1514 | if (smp_found_config) |
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index cbea7ac582e5..bc1bb6919e6a 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
| @@ -888,6 +888,7 @@ void *xquad_portio; | |||
| 888 | 888 | ||
| 889 | cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned; | 889 | cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned; |
| 890 | cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned; | 890 | cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned; |
| 891 | EXPORT_SYMBOL(cpu_core_map); | ||
| 891 | 892 | ||
| 892 | static void __init smp_boot_cpus(unsigned int max_cpus) | 893 | static void __init smp_boot_cpus(unsigned int max_cpus) |
| 893 | { | 894 | { |
| @@ -1073,8 +1074,10 @@ static void __init smp_boot_cpus(unsigned int max_cpus) | |||
| 1073 | cpu_set(cpu, cpu_sibling_map[cpu]); | 1074 | cpu_set(cpu, cpu_sibling_map[cpu]); |
| 1074 | } | 1075 | } |
| 1075 | 1076 | ||
| 1076 | if (siblings != smp_num_siblings) | 1077 | if (siblings != smp_num_siblings) { |
| 1077 | printk(KERN_WARNING "WARNING: %d siblings found for CPU%d, should be %d\n", siblings, cpu, smp_num_siblings); | 1078 | printk(KERN_WARNING "WARNING: %d siblings found for CPU%d, should be %d\n", siblings, cpu, smp_num_siblings); |
| 1079 | smp_num_siblings = siblings; | ||
| 1080 | } | ||
| 1078 | 1081 | ||
| 1079 | if (c->x86_num_cores > 1) { | 1082 | if (c->x86_num_cores > 1) { |
| 1080 | for (i = 0; i < NR_CPUS; i++) { | 1083 | for (i = 0; i < NR_CPUS; i++) { |
diff --git a/arch/i386/kernel/timers/common.c b/arch/i386/kernel/timers/common.c index f7f90005e22e..8e201219f525 100644 --- a/arch/i386/kernel/timers/common.c +++ b/arch/i386/kernel/timers/common.c | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | #include <linux/timex.h> | 6 | #include <linux/timex.h> |
| 7 | #include <linux/errno.h> | 7 | #include <linux/errno.h> |
| 8 | #include <linux/jiffies.h> | 8 | #include <linux/jiffies.h> |
| 9 | #include <linux/module.h> | ||
| 9 | 10 | ||
| 10 | #include <asm/io.h> | 11 | #include <asm/io.h> |
| 11 | #include <asm/timer.h> | 12 | #include <asm/timer.h> |
| @@ -24,7 +25,7 @@ | |||
| 24 | 25 | ||
| 25 | #define CALIBRATE_TIME (5 * 1000020/HZ) | 26 | #define CALIBRATE_TIME (5 * 1000020/HZ) |
| 26 | 27 | ||
| 27 | unsigned long __init calibrate_tsc(void) | 28 | unsigned long calibrate_tsc(void) |
| 28 | { | 29 | { |
| 29 | mach_prepare_counter(); | 30 | mach_prepare_counter(); |
| 30 | 31 | ||
| @@ -139,7 +140,7 @@ bad_calibration: | |||
| 139 | #endif | 140 | #endif |
| 140 | 141 | ||
| 141 | /* calculate cpu_khz */ | 142 | /* calculate cpu_khz */ |
| 142 | void __init init_cpu_khz(void) | 143 | void init_cpu_khz(void) |
| 143 | { | 144 | { |
| 144 | if (cpu_has_tsc) { | 145 | if (cpu_has_tsc) { |
| 145 | unsigned long tsc_quotient = calibrate_tsc(); | 146 | unsigned long tsc_quotient = calibrate_tsc(); |
| @@ -158,3 +159,4 @@ void __init init_cpu_khz(void) | |||
| 158 | } | 159 | } |
| 159 | } | 160 | } |
| 160 | } | 161 | } |
| 162 | |||
diff --git a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c index 7926d967be00..180444d87824 100644 --- a/arch/i386/kernel/timers/timer_tsc.c +++ b/arch/i386/kernel/timers/timer_tsc.c | |||
| @@ -320,6 +320,26 @@ core_initcall(cpufreq_tsc); | |||
| 320 | static inline void cpufreq_delayed_get(void) { return; } | 320 | static inline void cpufreq_delayed_get(void) { return; } |
| 321 | #endif | 321 | #endif |
| 322 | 322 | ||
| 323 | int recalibrate_cpu_khz(void) | ||
| 324 | { | ||
| 325 | #ifndef CONFIG_SMP | ||
| 326 | unsigned long cpu_khz_old = cpu_khz; | ||
| 327 | |||
| 328 | if (cpu_has_tsc) { | ||
| 329 | init_cpu_khz(); | ||
| 330 | cpu_data[0].loops_per_jiffy = | ||
| 331 | cpufreq_scale(cpu_data[0].loops_per_jiffy, | ||
| 332 | cpu_khz_old, | ||
| 333 | cpu_khz); | ||
| 334 | return 0; | ||
| 335 | } else | ||
| 336 | return -ENODEV; | ||
| 337 | #else | ||
| 338 | return -ENODEV; | ||
| 339 | #endif | ||
| 340 | } | ||
| 341 | EXPORT_SYMBOL(recalibrate_cpu_khz); | ||
| 342 | |||
| 323 | static void mark_offset_tsc(void) | 343 | static void mark_offset_tsc(void) |
| 324 | { | 344 | { |
| 325 | unsigned long lost,delay; | 345 | unsigned long lost,delay; |
