public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dominik Brodowski <devel@brodo.de>
To: torvalds@transmeta.com
Cc: cpufreq@www.linux.org.uk, linux-kernel@vger.kernel.org
Subject: [PATCH][2.5.32] CPUfreq i386 core (2/4)
Date: Wed, 28 Aug 2002 13:47:01 +0200	[thread overview]
Message-ID: <20020828134701.C19189@brodo.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 3709 bytes --]

CPUFreq i386 core for 2.5.32:
arch/i386/kernel/i386_ksyms.c	export cpu_khz
arch/i386/kernel/time.c		update various i386 values on frequency
				changes
include/asm-i386/msr.h		add various MSR defines


diff -ruN linux-2531orig/arch/i386/kernel/i386_ksyms.c linux/arch/i386/kernel/i386_ksyms.c
--- linux-2531orig/arch/i386/kernel/i386_ksyms.c	Wed Aug 28 10:06:00 2002
+++ linux/arch/i386/kernel/i386_ksyms.c	Wed Aug 28 10:29:59 2002
@@ -50,6 +50,7 @@
 EXPORT_SYMBOL(drive_info);
 #endif
 
+extern unsigned long cpu_khz;
 extern unsigned long get_cmos_time(void);
 
 /* platform dependent support */
@@ -73,6 +74,7 @@
 EXPORT_SYMBOL(pm_idle);
 EXPORT_SYMBOL(pm_power_off);
 EXPORT_SYMBOL(get_cmos_time);
+EXPORT_SYMBOL(cpu_khz);
 EXPORT_SYMBOL(apm_info);
 
 #ifdef CONFIG_DEBUG_IOVIRT
diff -ruN linux-2531orig/arch/i386/kernel/time.c linux/arch/i386/kernel/time.c
--- linux-2531orig/arch/i386/kernel/time.c	Wed Aug 28 10:06:00 2002
+++ linux/arch/i386/kernel/time.c	Wed Aug 28 10:29:59 2002
@@ -43,6 +43,7 @@
 #include <linux/smp.h>
 #include <linux/module.h>
 #include <linux/device.h>
+#include <linux/cpufreq.h>
 
 #include <asm/io.h>
 #include <asm/smp.h>
@@ -650,6 +651,50 @@
 
 __initcall(time_init_driverfs);
 
+
+#ifdef CONFIG_CPU_FREQ
+
+static int
+time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
+		       void *data)
+{
+	struct cpufreq_freqs *freq = data;
+	unsigned int i;
+
+	if (!cpu_has_tsc)
+		return 0;
+
+	switch (val) {
+	case CPUFREQ_PRECHANGE:
+		if (freq->cur < freq->new) {
+			cpu_khz = cpufreq_scale(cpu_khz, freq->cur, freq->new);
+		        fast_gettimeoffset_quotient = cpufreq_scale(cpu_khz, freq->new, freq->cur);
+		}
+		for (i=0; i<NR_CPUS; i++)
+			if ((freq->cpu == CPUFREQ_ALL_CPUS) || (freq->cpu == i))
+				cpu_data[i].loops_per_jiffy = cpufreq_scale(loops_per_jiffy, freq->cur, freq->new);
+		break;
+
+	case CPUFREQ_POSTCHANGE:
+		if (freq->new < freq->cur) {
+			cpu_khz = cpufreq_scale(cpu_khz, freq->cur, freq->new);
+		        fast_gettimeoffset_quotient = cpufreq_scale(cpu_khz, freq->new, freq->cur);
+		}
+		for (i=0; i<NR_CPUS; i++)
+			if ((freq->cpu == CPUFREQ_ALL_CPUS) || (freq->cpu == i))
+				cpu_data[i].loops_per_jiffy = cpufreq_scale(loops_per_jiffy, freq->cur, freq->new);
+		break;
+	}
+
+	return 0;
+}
+
+static struct notifier_block time_cpufreq_notifier_block = {
+	notifier_call:	time_cpufreq_notifier
+};
+#endif
+
+
 void __init time_init(void)
 {
 	extern int x86_udelay_tsc;
@@ -709,6 +754,10 @@
 	                	"0" (eax), "1" (edx));
 				printk("Detected %lu.%03lu MHz processor.\n", cpu_khz / 1000, cpu_khz % 1000);
 			}
+#ifdef CONFIG_CPU_FREQ
+			cpufreq_register_notifier(&time_cpufreq_notifier_block);
+#endif
+
 		}
 	}
 
diff -ruN linux-2531orig/include/asm-i386/msr.h linux/include/asm-i386/msr.h
--- linux-2531orig/include/asm-i386/msr.h	Wed Aug 28 10:01:02 2002
+++ linux/include/asm-i386/msr.h	Wed Aug 28 10:33:54 2002
@@ -94,12 +94,15 @@
 #define MSR_K6_STAR			0xC0000081
 #define MSR_K6_WHCR			0xC0000082
 #define MSR_K6_UWCCR			0xC0000085
+#define MSR_K6_EPMR			0xC0000086
 #define MSR_K6_PSOR			0xC0000087
 #define MSR_K6_PFIR			0xC0000088
 
 #define MSR_K7_EVNTSEL0			0xC0010000
 #define MSR_K7_PERFCTR0			0xC0010004
 #define MSR_K7_HWCR			0xC0010015
+#define MSR_K7_FID_VID_CTL		0xC0010041
+#define MSR_K7_VID_STATUS		0xC0010042
 
 /* Centaur-Hauls/IDT defined MSRs. */
 #define MSR_IDT_FCR1			0x107
@@ -119,5 +122,7 @@
 
 /* VIA Cyrix defined MSRs*/
 #define MSR_VIA_FCR			0x1107
+#define MSR_VIA_LONGHAUL		0x110a
+#define MSR_VIA_BCR2			0x1147
 
 #endif /* __ASM_MSR_H */

[-- Attachment #2: Type: application/pgp-signature, Size: 240 bytes --]

                 reply	other threads:[~2002-08-28 11:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020828134701.C19189@brodo.de \
    --to=devel@brodo.de \
    --cc=cpufreq@www.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox