summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDimitry Andric <dim@cvs.openbsd.org>2007-06-07 11:20:59 +0000
committerDimitry Andric <dim@cvs.openbsd.org>2007-06-07 11:20:59 +0000
commite1b5ef6fb8c3f49623b8349ddd399463a0513928 (patch)
treee2e84639fb894956df6113467bd8eccea0440cff /sys
parentb35c1d8a0edb7ae2e36d3a6fad696a77cdfc505b (diff)
Replace magic bus clock constants in est related files with defines.
ok jsg
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/est.c30
-rw-r--r--sys/arch/i386/i386/est.c8
-rw-r--r--sys/arch/i386/i386/machdep.c46
-rw-r--r--sys/arch/i386/include/cpu.h12
4 files changed, 51 insertions, 45 deletions
diff --git a/sys/arch/amd64/amd64/est.c b/sys/arch/amd64/amd64/est.c
index dacf99d7c84..2670cd35dd3 100644
--- a/sys/arch/amd64/amd64/est.c
+++ b/sys/arch/amd64/amd64/est.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: est.c,v 1.4 2007/06/04 06:57:57 jsg Exp $ */
+/* $OpenBSD: est.c,v 1.5 2007/06/07 11:20:58 dim Exp $ */
/*
* Copyright (c) 2003 Michael Eriksson.
* All rights reserved.
@@ -72,8 +72,10 @@
/* Possible bus speeds (multiplied by 100 for rounding) */
#define BUS100 10000
#define BUS133 13333
-#define BUS166 16666
+#define BUS166 16667
#define BUS200 20000
+#define BUS266 26667
+#define BUS333 33333
#define MSR2MHZ(msr, bus) \
(((((int) (msr) >> 8) & 0xff) * (bus) + 50) / 100)
@@ -112,10 +114,10 @@ p4_get_bus_clock(struct cpu_info *ci)
bus = (msr >> 21) & 0x7;
switch (bus) {
case 0:
- bus_clock = 10000;
+ bus_clock = BUS100;
break;
case 1:
- bus_clock = 13333;
+ bus_clock = BUS133;
break;
default:
printf("%s: unknown Pentium 4 (model %d) "
@@ -127,16 +129,16 @@ p4_get_bus_clock(struct cpu_info *ci)
bus = (msr >> 16) & 0x7;
switch (bus) {
case 0:
- bus_clock = (model == 2) ? 10000 : 26666;
+ bus_clock = (model == 2) ? BUS100 : BUS266;
break;
case 1:
- bus_clock = 13333;
+ bus_clock = BUS133;
break;
case 2:
- bus_clock = 20000;
+ bus_clock = BUS200;
break;
case 3:
- bus_clock = 16666;
+ bus_clock = BUS166;
break;
default:
printf("%s: unknown Pentium 4 (model %d) "
@@ -161,22 +163,22 @@ p3_get_bus_clock(struct cpu_info *ci)
bus = (msr >> 0) & 0x7;
switch (bus) {
case 5:
- bus_clock = 10000;
+ bus_clock = BUS100;
break;
case 1:
- bus_clock = 13333;
+ bus_clock = BUS133;
break;
case 3:
- bus_clock = 16667;
+ bus_clock = BUS166;
break;
case 2:
- bus_clock = 20000;
+ bus_clock = BUS200;
break;
case 0:
- bus_clock = 26667;
+ bus_clock = BUS266;
break;
case 4:
- bus_clock = 33333;
+ bus_clock = BUS333;
break;
default:
printf("%s: unknown Core FSB_FREQ value %d",
diff --git a/sys/arch/i386/i386/est.c b/sys/arch/i386/i386/est.c
index 32f4f766705..dfc27c6fd43 100644
--- a/sys/arch/i386/i386/est.c
+++ b/sys/arch/i386/i386/est.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: est.c,v 1.29 2007/06/07 10:24:30 dim Exp $ */
+/* $OpenBSD: est.c,v 1.30 2007/06/07 11:20:58 dim Exp $ */
/*
* Copyright (c) 2003 Michael Eriksson.
* All rights reserved.
@@ -66,12 +66,6 @@
#define ID16(MHz, mV, bus_clk) \
((((MHz * 100 + 50) / bus_clk) << 8) | ((mV ? mV - 700 : 0) >> 4))
-/* Possible bus speeds (multiplied by 100 for rounding) */
-#define BUS100 10000
-#define BUS133 13333
-#define BUS166 16666
-#define BUS200 20000
-
/* Ultra Low Voltage Intel Pentium M processor 900 MHz */
static const u_int16_t pm130_900_ulv[] = {
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 2db15f2b8fd..a941f9ededd 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.401 2007/06/06 17:15:12 deraadt Exp $ */
+/* $OpenBSD: machdep.c,v 1.402 2007/06/07 11:20:58 dim Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -1904,16 +1904,16 @@ cyrix3_get_bus_clock(struct cpu_info *ci)
bus = (msr >> 18) & 0x3;
switch (bus) {
case 0:
- bus_clock = 10000;
+ bus_clock = BUS100;
break;
case 1:
- bus_clock = 13333;
+ bus_clock = BUS133;
break;
case 2:
- bus_clock = 20000;
+ bus_clock = BUS200;
break;
case 3:
- bus_clock = 16666;
+ bus_clock = BUS166;
break;
}
}
@@ -1930,10 +1930,10 @@ p4_get_bus_clock(struct cpu_info *ci)
bus = (msr >> 21) & 0x7;
switch (bus) {
case 0:
- bus_clock = 10000;
+ bus_clock = BUS100;
break;
case 1:
- bus_clock = 13333;
+ bus_clock = BUS133;
break;
default:
printf("%s: unknown Pentium 4 (model %d) "
@@ -1945,16 +1945,16 @@ p4_get_bus_clock(struct cpu_info *ci)
bus = (msr >> 16) & 0x7;
switch (bus) {
case 0:
- bus_clock = (model == 2) ? 10000 : 26666;
+ bus_clock = (model == 2) ? BUS100 : BUS266;
break;
case 1:
- bus_clock = 13333;
+ bus_clock = BUS133;
break;
case 2:
- bus_clock = 20000;
+ bus_clock = BUS200;
break;
case 3:
- bus_clock = 16666;
+ bus_clock = BUS166;
break;
default:
printf("%s: unknown Pentium 4 (model %d) "
@@ -1974,17 +1974,17 @@ p3_get_bus_clock(struct cpu_info *ci)
model = (ci->ci_signature >> 4) & 15;
switch (model) {
case 0x9: /* Pentium M (130 nm, Banias) */
- bus_clock = 10000;
+ bus_clock = BUS100;
break;
case 0xd: /* Pentium M (90 nm, Dothan) */
msr = rdmsr(MSR_FSB_FREQ);
bus = (msr >> 0) & 0x7;
switch (bus) {
case 0:
- bus_clock = 10000;
+ bus_clock = BUS100;
break;
case 1:
- bus_clock = 13333;
+ bus_clock = BUS133;
break;
default:
printf("%s: unknown Pentium M FSB_FREQ value %d",
@@ -1998,22 +1998,22 @@ p3_get_bus_clock(struct cpu_info *ci)
bus = (msr >> 0) & 0x7;
switch (bus) {
case 5:
- bus_clock = 10000;
+ bus_clock = BUS100;
break;
case 1:
- bus_clock = 13333;
+ bus_clock = BUS133;
break;
case 3:
- bus_clock = 16667;
+ bus_clock = BUS166;
break;
case 2:
- bus_clock = 20000;
+ bus_clock = BUS200;
break;
case 0:
- bus_clock = 26667;
+ bus_clock = BUS266;
break;
case 4:
- bus_clock = 33333;
+ bus_clock = BUS333;
break;
default:
printf("%s: unknown Core FSB_FREQ value %d",
@@ -2033,13 +2033,13 @@ p3_get_bus_clock(struct cpu_info *ci)
bus = (msr >> 18) & 0x3;
switch (bus) {
case 0:
- bus_clock = 6666;
+ bus_clock = BUS66;
break;
case 1:
- bus_clock = 13333;
+ bus_clock = BUS133;
break;
case 2:
- bus_clock = 10000;
+ bus_clock = BUS100;
break;
default:
printf("%s: unknown i686 EBL_CR_POWERON value %d",
diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h
index 7f4dfae2fc8..3997c8fd758 100644
--- a/sys/arch/i386/include/cpu.h
+++ b/sys/arch/i386/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.94 2007/05/29 21:01:56 tedu Exp $ */
+/* $OpenBSD: cpu.h,v 1.95 2007/06/07 11:20:58 dim Exp $ */
/* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */
/*-
@@ -324,6 +324,16 @@ extern int cpu_apmwarn;
#if defined(I586_CPU) || defined(I686_CPU)
extern int cpuspeed;
+#endif
+
+#if !defined(SMALL_KERNEL)
+#define BUS66 6667
+#define BUS100 10000
+#define BUS133 13333
+#define BUS166 16667
+#define BUS200 20000
+#define BUS266 26667
+#define BUS333 33333
extern int bus_clock;
#endif