diff options
author | Dimitry Andric <dim@cvs.openbsd.org> | 2006-05-19 19:43:42 +0000 |
---|---|---|
committer | Dimitry Andric <dim@cvs.openbsd.org> | 2006-05-19 19:43:42 +0000 |
commit | 3e51a11d950e38614a87079be7136f45b7c65d21 (patch) | |
tree | ebcddf0a8e948770a21394272b27b7c3c195859c /sys/arch | |
parent | 439f511d167e44582850d991636b880b03a8d02d (diff) |
Reimplement the Enhanced SpeedStep CPU detection by using the
quintuplet { vendor, MHz_hi, mV_hi, MHz_lo, mV_lo }, which works much
better than parsing the branding string. It also makes it easier to add
new models later.
Shouldn't break any CPU's which previously worked okay with EST; if
there's any trouble, please let me know!
Also adds quite a number of VIA C7-M models, and a few more Pentium M
models, all from FreeBSD.
"go for it" deraadt@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/i386/i386/est.c | 752 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/include/cpu.h | 4 |
3 files changed, 639 insertions, 123 deletions
diff --git a/sys/arch/i386/i386/est.c b/sys/arch/i386/i386/est.c index b84cfb0b427..fe1d92bb758 100644 --- a/sys/arch/i386/i386/est.c +++ b/sys/arch/i386/i386/est.c @@ -1,4 +1,4 @@ -/* $OpenBSD: est.c,v 1.14 2006/05/11 13:21:11 mickey Exp $ */ +/* $OpenBSD: est.c,v 1.15 2006/05/19 19:43:41 dim Exp $ */ /* * Copyright (c) 2003 Michael Eriksson. * All rights reserved. @@ -68,22 +68,31 @@ struct fq_info { }; /* Ultra Low Voltage Intel Pentium M processor 900 MHz */ -static const struct fq_info pentium_m_900[] = { +static const struct fq_info pm130_900_ulv[] = { { 900, 1004 }, { 800, 988 }, { 600, 844 }, }; /* Ultra Low Voltage Intel Pentium M processor 1.00 GHz */ -static const struct fq_info pentium_m_1000[] = { +static const struct fq_info pm130_1000_ulv[] = { { 1000, 1004 }, { 900, 988 }, { 800, 972 }, { 600, 844 }, }; +/* Ultra Low Voltage Intel Pentium M processor 1.10 GHz */ +static const struct fq_info pm130_1100_ulv[] = { + { 1100, 1004 }, + { 1000, 988 }, + { 900, 972 }, + { 800, 956 }, + { 600, 844 }, +}; + /* Low Voltage Intel Pentium M processor 1.10 GHz */ -static const struct fq_info pentium_m_1100[] = { +static const struct fq_info pm130_1100_lv[] = { { 1100, 1180 }, { 1000, 1164 }, { 900, 1100 }, @@ -92,7 +101,7 @@ static const struct fq_info pentium_m_1100[] = { }; /* Low Voltage Intel Pentium M processor 1.20 GHz */ -static const struct fq_info pentium_m_1200[] = { +static const struct fq_info pm130_1200_lv[] = { { 1200, 1180 }, { 1100, 1164 }, { 1000, 1100 }, @@ -101,8 +110,19 @@ static const struct fq_info pentium_m_1200[] = { { 600, 956 }, }; +/* Low Voltage Intel Pentium M processor 1.30 GHz */ +static const struct fq_info pm130_1300_lv[] = { + { 1300, 1180 }, + { 1200, 1164 }, + { 1100, 1100 }, + { 1000, 1020 }, + { 900, 1004 }, + { 800, 988 }, + { 600, 956 }, +}; + /* Intel Pentium M processor 1.30 GHz */ -static const struct fq_info pentium_m_1300[] = { +static const struct fq_info pm130_1300[] = { { 1300, 1388 }, { 1200, 1356 }, { 1000, 1292 }, @@ -111,7 +131,7 @@ static const struct fq_info pentium_m_1300[] = { }; /* Intel Pentium M processor 1.40 GHz */ -static const struct fq_info pentium_m_1400[] = { +static const struct fq_info pm130_1400[] = { { 1400, 1484 }, { 1200, 1436 }, { 1000, 1308 }, @@ -120,7 +140,7 @@ static const struct fq_info pentium_m_1400[] = { }; /* Intel Pentium M processor 1.50 GHz */ -static const struct fq_info pentium_m_1500[] = { +static const struct fq_info pm130_1500[] = { { 1500, 1484 }, { 1400, 1452 }, { 1200, 1356 }, @@ -130,7 +150,7 @@ static const struct fq_info pentium_m_1500[] = { }; /* Intel Pentium M processor 1.60 GHz */ -static const struct fq_info pentium_m_1600[] = { +static const struct fq_info pm130_1600[] = { { 1600, 1484 }, { 1400, 1420 }, { 1200, 1276 }, @@ -140,7 +160,7 @@ static const struct fq_info pentium_m_1600[] = { }; /* Intel Pentium M processor 1.70 GHz */ -static const struct fq_info pentium_m_1700[] = { +static const struct fq_info pm130_1700[] = { { 1700, 1484 }, { 1400, 1308 }, { 1200, 1228 }, @@ -150,7 +170,7 @@ static const struct fq_info pentium_m_1700[] = { }; /* Intel Pentium M processor 723 1.0 GHz */ -static const struct fq_info pentium_m_n723[] = { +static const struct fq_info pm90_n723[] = { { 1000, 940 }, { 900, 908 }, { 800, 876 }, @@ -158,7 +178,25 @@ static const struct fq_info pentium_m_n723[] = { }; /* Intel Pentium M processor 733 1.1 GHz */ -static const struct fq_info pentium_m_n733[] = { +static const struct fq_info pm90_n733[] = { + { 1100, 940 }, + { 1000, 924 }, + { 900, 892 }, + { 800, 876 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 733 1.1 GHz, VID #G */ +static const struct fq_info pm90_n733g[] = { + { 1100, 956 }, + { 1000, 940 }, + { 900, 908 }, + { 800, 876 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 733 1.1 GHz, VID #H */ +static const struct fq_info pm90_n733h[] = { { 1100, 940 }, { 1000, 924 }, { 900, 892 }, @@ -166,8 +204,54 @@ static const struct fq_info pentium_m_n733[] = { { 600, 812 } }; -/* Intel Pentium M processor 753 1.2 GHz */ -static const struct fq_info pentium_m_n753[] = { +/* Intel Pentium M processor 733 1.1 GHz, VID #I */ +static const struct fq_info pm90_n733i[] = { + { 1100, 924 }, + { 1000, 908 }, + { 900, 892 }, + { 800, 860 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 733 1.1 GHz, VID #J */ +static const struct fq_info pm90_n733j[] = { + { 1100, 908 }, + { 1000, 892 }, + { 900, 876 }, + { 800, 860 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 733 1.1 GHz, VID #K */ +static const struct fq_info pm90_n733k[] = { + { 1100, 892 }, + { 1000, 876 }, + { 900, 860 }, + { 800, 844 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 733 1.1 GHz, VID #L */ +static const struct fq_info pm90_n733l[] = { + { 1100, 876 }, + { 1000, 876 }, + { 900, 860 }, + { 800, 844 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 753 1.2 GHz, VID #G */ +static const struct fq_info pm90_n753g[] = { + { 1200, 956 }, + { 1100, 940 }, + { 1000, 908 }, + { 900, 892 }, + { 800, 860 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 753 1.2 GHz, VID #H */ +static const struct fq_info pm90_n753h[] = { { 1200, 940 }, { 1100, 924 }, { 1000, 908 }, @@ -176,8 +260,59 @@ static const struct fq_info pentium_m_n753[] = { { 600, 812 } }; -/* Intel Pentium M processor 773 1.3 GHz */ -static const struct fq_info pentium_m_n773[] = { +/* Intel Pentium M processor 753 1.2 GHz, VID #I */ +static const struct fq_info pm90_n753i[] = { + { 1200, 924 }, + { 1100, 908 }, + { 1000, 892 }, + { 900, 876 }, + { 800, 860 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 753 1.2 GHz, VID #J */ +static const struct fq_info pm90_n753j[] = { + { 1200, 908 }, + { 1100, 892 }, + { 1000, 876 }, + { 900, 860 }, + { 800, 844 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 753 1.2 GHz, VID #K */ +static const struct fq_info pm90_n753k[] = { + { 1200, 892 }, + { 1100, 892 }, + { 1000, 876 }, + { 900, 860 }, + { 800, 844 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 753 1.2 GHz, VID #L */ +static const struct fq_info pm90_n753l[] = { + { 1200, 876 }, + { 1100, 876 }, + { 1000, 860 }, + { 900, 844 }, + { 800, 844 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 773 1.3 GHz, VID #G */ +static const struct fq_info pm90_n773g[] = { + { 1300, 956 }, + { 1200, 940 }, + { 1100, 924 }, + { 1000, 908 }, + { 900, 876 }, + { 800, 860 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 773 1.3 GHz, VID #H */ +static const struct fq_info pm90_n773h[] = { { 1300, 940 }, { 1200, 924 }, { 1100, 908 }, @@ -187,8 +322,52 @@ static const struct fq_info pentium_m_n773[] = { { 600, 812 } }; +/* Intel Pentium M processor 773 1.3 GHz, VID #I */ +static const struct fq_info pm90_n773i[] = { + { 1300, 924 }, + { 1200, 908 }, + { 1100, 892 }, + { 1000, 876 }, + { 900, 860 }, + { 800, 844 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 773 1.3 GHz, VID #J */ +static const struct fq_info pm90_n773j[] = { + { 1300, 908 }, + { 1200, 908 }, + { 1100, 892 }, + { 1000, 876 }, + { 900, 860 }, + { 800, 844 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 773 1.3 GHz, VID #K */ +static const struct fq_info pm90_n773k[] = { + { 1300, 892 }, + { 1200, 892 }, + { 1100, 876 }, + { 1000, 860 }, + { 900, 860 }, + { 800, 844 }, + { 600, 812 } +}; + +/* Intel Pentium M processor 773 1.3 GHz, VID #L */ +static const struct fq_info pm90_n773l[] = { + { 1300, 876 }, + { 1200, 876 }, + { 1100, 860 }, + { 1000, 860 }, + { 900, 844 }, + { 800, 844 }, + { 600, 812 } +}; + /* Intel Pentium M processor 738 1.4 GHz */ -static const struct fq_info pentium_m_n738[] = { +static const struct fq_info pm90_n738[] = { { 1400, 1116 }, { 1300, 1116 }, { 1200, 1100 }, @@ -200,7 +379,7 @@ static const struct fq_info pentium_m_n738[] = { }; /* Intel Pentium M processor 758 1.5 GHz */ -static const struct fq_info pentium_m_n758[] = { +static const struct fq_info pm90_n758[] = { { 1500, 1116 }, { 1400, 1116 }, { 1300, 1100 }, @@ -213,7 +392,7 @@ static const struct fq_info pentium_m_n758[] = { }; /* Intel Pentium M processor 778 1.6 GHz */ -static const struct fq_info pentium_m_n778[] = { +static const struct fq_info pm90_n778[] = { { 1600, 1116 }, { 1500, 1116 }, { 1400, 1100 }, @@ -226,8 +405,8 @@ static const struct fq_info pentium_m_n778[] = { { 600, 988 } }; -/* Intel Pentium M processor 715 1.5 GHz */ -static const struct fq_info pentium_m_n715[] = { +/* Intel Pentium M processor 715 1.5 GHz, VID #A */ +static const struct fq_info pm90_n715a[] = { { 1500, 1340 }, { 1200, 1228 }, { 1000, 1148 }, @@ -235,8 +414,35 @@ static const struct fq_info pentium_m_n715[] = { { 600, 988 } }; -/* Intel Pentium M processor 725 1.6 GHz */ -static const struct fq_info pentium_m_n725[] = { +/* Intel Pentium M processor 715 1.5 GHz, VID #B */ +static const struct fq_info pm90_n715b[] = { + { 1500, 1324 }, + { 1200, 1212 }, + { 1000, 1148 }, + { 800, 1068 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 715 1.5 GHz, VID #C */ +static const struct fq_info pm90_n715c[] = { + { 1500, 1308 }, + { 1200, 1212 }, + { 1000, 1132 }, + { 800, 1068 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 715 1.5 GHz, VID #D */ +static const struct fq_info pm90_n715d[] = { + { 1500, 1276 }, + { 1200, 1180 }, + { 1000, 1116 }, + { 800, 1052 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 725 1.6 GHz, VID #A */ +static const struct fq_info pm90_n725a[] = { { 1600, 1340 }, { 1400, 1276 }, { 1200, 1212 }, @@ -245,8 +451,38 @@ static const struct fq_info pentium_m_n725[] = { { 600, 988 } }; -/* Intel Pentium M processor 735 1.7 GHz */ -static const struct fq_info pentium_m_n735[] = { +/* Intel Pentium M processor 725 1.6 GHz, VID #B */ +static const struct fq_info pm90_n725b[] = { + { 1600, 1324 }, + { 1400, 1260 }, + { 1200, 1196 }, + { 1000, 1132 }, + { 800, 1068 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 725 1.6 GHz, VID #C */ +static const struct fq_info pm90_n725c[] = { + { 1600, 1308 }, + { 1400, 1244 }, + { 1200, 1180 }, + { 1000, 1116 }, + { 800, 1052 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 725 1.6 GHz, VID #D */ +static const struct fq_info pm90_n725d[] = { + { 1600, 1276 }, + { 1400, 1228 }, + { 1200, 1164 }, + { 1000, 1116 }, + { 800, 1052 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 735 1.7 GHz, VID #A */ +static const struct fq_info pm90_n735a[] = { { 1700, 1340 }, { 1400, 1244 }, { 1200, 1180 }, @@ -255,8 +491,38 @@ static const struct fq_info pentium_m_n735[] = { { 600, 988 } }; -/* Intel Pentium M processor 745 1.8 GHz */ -static const struct fq_info pentium_m_n745[] = { +/* Intel Pentium M processor 735 1.7 GHz, VID #B */ +static const struct fq_info pm90_n735b[] = { + { 1700, 1324 }, + { 1400, 1244 }, + { 1200, 1180 }, + { 1000, 1116 }, + { 800, 1052 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 735 1.7 GHz, VID #C */ +static const struct fq_info pm90_n735c[] = { + { 1700, 1308 }, + { 1400, 1228 }, + { 1200, 1164 }, + { 1000, 1116 }, + { 800, 1052 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 735 1.7 GHz, VID #D */ +static const struct fq_info pm90_n735d[] = { + { 1700, 1276 }, + { 1400, 1212 }, + { 1200, 1148 }, + { 1000, 1100 }, + { 800, 1052 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 745 1.8 GHz, VID #A */ +static const struct fq_info pm90_n745a[] = { { 1800, 1340 }, { 1600, 1292 }, { 1400, 1228 }, @@ -266,8 +532,41 @@ static const struct fq_info pentium_m_n745[] = { { 600, 988 } }; -/* Intel Pentium M processor 755 2.0 GHz */ -static const struct fq_info pentium_m_n755[] = { +/* Intel Pentium M processor 745 1.8 GHz, VID #B */ +static const struct fq_info pm90_n745b[] = { + { 1800, 1324 }, + { 1600, 1276 }, + { 1400, 1212 }, + { 1200, 1164 }, + { 1000, 1116 }, + { 800, 1052 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 745 1.8 GHz, VID #C */ +static const struct fq_info pm90_n745c[] = { + { 1800, 1308 }, + { 1600, 1260 }, + { 1400, 1212 }, + { 1200, 1148 }, + { 1000, 1100 }, + { 800, 1052 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 745 1.8 GHz, VID #D */ +static const struct fq_info pm90_n745d[] = { + { 1800, 1276 }, + { 1600, 1228 }, + { 1400, 1180 }, + { 1200, 1132 }, + { 1000, 1084 }, + { 800, 1036 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 755 2.0 GHz, VID #A */ +static const struct fq_info pm90_n755a[] = { { 2000, 1340 }, { 1800, 1292 }, { 1600, 1244 }, @@ -278,8 +577,44 @@ static const struct fq_info pentium_m_n755[] = { { 600, 988 } }; -/* Intel Pentium M processor 765 2.1 GHz */ -static const struct fq_info pentium_m_n765[] = { +/* Intel Pentium M processor 755 2.0 GHz, VID #B */ +static const struct fq_info pm90_n755b[] = { + { 2000, 1324 }, + { 1800, 1276 }, + { 1600, 1228 }, + { 1400, 1180 }, + { 1200, 1132 }, + { 1000, 1084 }, + { 800, 1036 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 755 2.0 GHz, VID #C */ +static const struct fq_info pm90_n755c[] = { + { 2000, 1308 }, + { 1800, 1276 }, + { 1600, 1228 }, + { 1400, 1180 }, + { 1200, 1132 }, + { 1000, 1084 }, + { 800, 1036 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 755 2.0 GHz, VID #D */ +static const struct fq_info pm90_n755d[] = { + { 2000, 1276 }, + { 1800, 1244 }, + { 1600, 1196 }, + { 1400, 1164 }, + { 1200, 1116 }, + { 1000, 1084 }, + { 800, 1036 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 765 2.1 GHz, VID #A */ +static const struct fq_info pm90_n765a[] = { { 2100, 1340 }, { 1800, 1276 }, { 1600, 1228 }, @@ -290,8 +625,44 @@ static const struct fq_info pentium_m_n765[] = { { 600, 988 } }; +/* Intel Pentium M processor 765 2.1 GHz, VID #B */ +static const struct fq_info pm90_n765b[] = { + { 2100, 1324 }, + { 1800, 1260 }, + { 1600, 1212 }, + { 1400, 1180 }, + { 1200, 1132 }, + { 1000, 1084 }, + { 800, 1036 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 765 2.1 GHz, VID #C */ +static const struct fq_info pm90_n765c[] = { + { 2100, 1308 }, + { 1800, 1244 }, + { 1600, 1212 }, + { 1400, 1164 }, + { 1200, 1116 }, + { 1000, 1084 }, + { 800, 1036 }, + { 600, 988 } +}; + +/* Intel Pentium M processor 765 2.1 GHz, VID #E */ +static const struct fq_info pm90_n765e[] = { + { 2100, 1356 }, + { 1800, 1292 }, + { 1600, 1244 }, + { 1400, 1196 }, + { 1200, 1148 }, + { 1000, 1100 }, + { 800, 1052 }, + { 600, 988 } +}; + /* Intel Pentium M processor 770 2.13 GHz */ -static const struct fq_info pentium_m_n770[] = { +static const struct fq_info pm90_n770[] = { { 2130, 1551 }, { 1800, 1429 }, { 1600, 1356 }, @@ -299,73 +670,232 @@ static const struct fq_info pentium_m_n770[] = { { 1200, 1132 }, { 1000, 1084 }, { 800, 1036 }, - { 600, 988 } + { 600, 988 } +}; + +/* + * VIA C7-M 500 MHz FSB, 400 MHz FSB, and ULV variants. + * Data from the "VIA C7-M Processor BIOS Writer's Guide (v2.17)" datasheet. + */ + +/* 1.00GHz Centaur C7-M ULV */ +static const struct fq_info C7M_770_ULV[] = { + { 1000, 844 }, + { 800, 796 }, + { 600, 796 }, + { 400, 796 }, +}; + +/* 1.00GHz Centaur C7-M ULV */ +static const struct fq_info C7M_779_ULV[] = { + { 1000, 796 }, + { 800, 796 }, + { 600, 796 }, + { 400, 796 }, +}; + +/* 1.20GHz Centaur C7-M ULV */ +static const struct fq_info C7M_772_ULV[] = { + { 1200, 844 }, + { 1000, 844 }, + { 800, 828 }, + { 600, 796 }, + { 400, 796 }, +}; + +/* 1.50GHz Centaur C7-M ULV */ +static const struct fq_info C7M_775_ULV[] = { + { 1500, 956 }, + { 1400, 940 }, + { 1000, 860 }, + { 800, 828 }, + { 600, 796 }, + { 400, 796 }, +}; + +/* 1.20GHz Centaur C7-M 400 Mhz FSB */ +static const struct fq_info C7M_771[] = { + { 1200, 860 }, + { 1000, 860 }, + { 800, 844 }, + { 600, 844 }, + { 400, 844 }, +}; + +/* 1.50GHz Centaur C7-M 400 Mhz FSB */ +static const struct fq_info C7M_754[] = { + { 1500, 1004 }, + { 1400, 988 }, + { 1000, 940 }, + { 800, 844 }, + { 600, 844 }, + { 400, 844 }, +}; + +/* 1.60GHz Centaur C7-M 400 Mhz FSB */ +static const struct fq_info C7M_764[] = { + { 1600, 1084 }, + { 1400, 1052 }, + { 1000, 1004 }, + { 800, 844 }, + { 600, 844 }, + { 400, 844 }, +}; + +/* 1.80GHz Centaur C7-M 400 Mhz FSB */ +static const struct fq_info C7M_784[] = { + { 1800, 1148 }, + { 1600, 1100 }, + { 1400, 1052 }, + { 1000, 1004 }, + { 800, 844 }, + { 600, 844 }, + { 400, 844 }, }; +/* 2.00GHz Centaur C7-M 400 Mhz FSB */ +static const struct fq_info C7M_794[] = { + { 2000, 1148 }, + { 1800, 1132 }, + { 1600, 1100 }, + { 1400, 1052 }, + { 1000, 1004 }, + { 800, 844 }, + { 600, 844 }, + { 400, 844 }, +}; + +/* 1.60GHz Centaur C7-M 533 Mhz FSB */ +static const struct fq_info C7M_765[] = { + { 1600, 1084 }, + { 1467, 1052 }, + { 1200, 1004 }, + { 800, 844 }, + { 667, 844 }, + { 533, 844 }, +}; + +/* 2.00GHz Centaur C7-M 533 Mhz FSB */ +static const struct fq_info C7M_785[] = { + { 1867, 1148 }, + { 1600, 1100 }, + { 1467, 1052 }, + { 1200, 1004 }, + { 800, 844 }, + { 667, 844 }, + { 533, 844 }, +}; + +/* 2.00GHz Centaur C7-M 533 Mhz FSB */ +static const struct fq_info C7M_795[] = { + { 2000, 1148 }, + { 1867, 1132 }, + { 1600, 1100 }, + { 1467, 1052 }, + { 1200, 1004 }, + { 800, 844 }, + { 667, 844 }, + { 533, 844 }, +}; + +/* Convert MHz and mV into IDs for passing to the MSR. */ +#define ID16(MHz, mV, bus_clk) \ + (((MHz / bus_clk) << 8) | ((mV ? mV - 700 : 0) >> 4)) +#define ID32(MHz_hi, mV_hi, MHz_lo, mV_lo, bus_clk) \ + ((ID16(MHz_lo, mV_lo, bus_clk) << 16) | (ID16(MHz_hi, mV_hi, bus_clk))) + struct fqlist { - const char *brand_tag; - const int cpu_id; + int vendor; + u_int32_t id32; + u_int32_t bus_clk; const struct fq_info *table; - u_int n; -}; - -static const struct fqlist pentium_m[] = { -#define ENTRY(s, i, v) { s, i, v, sizeof(v) / sizeof((v)[0]) } - ENTRY(" 900", 0, pentium_m_900), - ENTRY("1000", 0, pentium_m_1000), - ENTRY("1100", 0, pentium_m_1100), - ENTRY("1200", 0, pentium_m_1200), - ENTRY("1300", 0, pentium_m_1300), - ENTRY("1400", 0, pentium_m_1400), - ENTRY("1500", 0, pentium_m_1500), - ENTRY("1600", 0, pentium_m_1600), - ENTRY("1700", 0, pentium_m_1700), -#undef ENTRY -}; - -static const struct fqlist pentium_m_dothan[] = { -#define ENTRY(s, i, v) { s, i, v, sizeof(v) / sizeof((v)[0]) } - ENTRY("1.00", 0, pentium_m_n723), - ENTRY("1.10", 0, pentium_m_n733), - ENTRY("1.20", 0, pentium_m_n753), - ENTRY("1.30", 0, pentium_m_n773), - ENTRY("1.40", 0, pentium_m_n738), - ENTRY("1.50", 0x06d6, pentium_m_n715), - ENTRY("1.50", 0x06d8, pentium_m_n758), - ENTRY("1.60", 0x06d6, pentium_m_n725), - ENTRY("1.60", 0x06d8, pentium_m_n778), - ENTRY("1.70", 0, pentium_m_n735), - ENTRY("1.80", 0, pentium_m_n745), - ENTRY("2.00", 0, pentium_m_n755), - ENTRY("2.10", 0, pentium_m_n765), - ENTRY("2.13", 0, pentium_m_n770), -#undef ENTRY -}; - -struct est_cpu { - const char *brand_prefix; - const char *brand_suffix; - const struct fqlist *list; - int n; -}; - -static const struct est_cpu est_cpus[] = { - { - "Intel(R) Pentium(R) M processor ", "MHz", - pentium_m, - (sizeof(pentium_m) / sizeof(pentium_m[0])) - }, - { - "Intel(R) Pentium(R) M processor ", "GHz", - pentium_m_dothan, - (sizeof(pentium_m_dothan) / sizeof(pentium_m_dothan[0])) - }, + unsigned n; +}; + +#define ENTRY(ven, tab, zhi, vhi, zlo, vlo, bus_clk) \ + { CPUVENDOR_##ven, ID32(zhi, vhi, zlo, vlo, bus_clk), bus_clk, tab, \ + sizeof(tab) / sizeof((tab)[0]) } + +static const struct fqlist est_cpus[] = { + ENTRY(INTEL, pm130_900_ulv, 900, 1004, 600, 844, 100), + ENTRY(INTEL, pm130_1000_ulv, 1000, 1004, 600, 844, 100), + ENTRY(INTEL, pm130_1100_ulv, 1100, 1004, 600, 844, 100), + ENTRY(INTEL, pm130_1100_lv, 1100, 1180, 600, 956, 100), + ENTRY(INTEL, pm130_1200_lv, 1200, 1180, 600, 956, 100), + ENTRY(INTEL, pm130_1300_lv, 1300, 1180, 600, 956, 100), + ENTRY(INTEL, pm130_1300, 1300, 1388, 600, 956, 100), + ENTRY(INTEL, pm130_1400, 1400, 1484, 600, 956, 100), + ENTRY(INTEL, pm130_1500, 1500, 1484, 600, 956, 100), + ENTRY(INTEL, pm130_1600, 1600, 1484, 600, 956, 100), + ENTRY(INTEL, pm130_1700, 1700, 1484, 600, 956, 100), + + ENTRY(INTEL, pm90_n723, 1000, 940, 600, 812, 100), + ENTRY(INTEL, pm90_n733, 1100, 940, 600, 812, 100), + ENTRY(INTEL, pm90_n733g, 1100, 956, 600, 812, 100), + ENTRY(INTEL, pm90_n733h, 1100, 940, 600, 812, 100), + ENTRY(INTEL, pm90_n733i, 1100, 924, 600, 812, 100), + ENTRY(INTEL, pm90_n733j, 1100, 908, 600, 812, 100), + ENTRY(INTEL, pm90_n733k, 1100, 892, 600, 812, 100), + ENTRY(INTEL, pm90_n733l, 1100, 876, 600, 812, 100), + ENTRY(INTEL, pm90_n753g, 1200, 956, 600, 812, 100), + ENTRY(INTEL, pm90_n753h, 1200, 940, 600, 812, 100), + ENTRY(INTEL, pm90_n753i, 1200, 924, 600, 812, 100), + ENTRY(INTEL, pm90_n753j, 1200, 908, 600, 812, 100), + ENTRY(INTEL, pm90_n753k, 1200, 892, 600, 812, 100), + ENTRY(INTEL, pm90_n753l, 1200, 876, 600, 812, 100), + ENTRY(INTEL, pm90_n773g, 1300, 956, 600, 812, 100), + ENTRY(INTEL, pm90_n773h, 1300, 940, 600, 812, 100), + ENTRY(INTEL, pm90_n773i, 1300, 924, 600, 812, 100), + ENTRY(INTEL, pm90_n773j, 1300, 908, 600, 812, 100), + ENTRY(INTEL, pm90_n773k, 1300, 892, 600, 812, 100), + ENTRY(INTEL, pm90_n773l, 1300, 876, 600, 812, 100), + ENTRY(INTEL, pm90_n738, 1400, 1116, 600, 988, 100), + ENTRY(INTEL, pm90_n758, 1500, 1116, 600, 988, 100), + ENTRY(INTEL, pm90_n778, 1600, 1116, 600, 988, 100), + ENTRY(INTEL, pm90_n715a, 1500, 1340, 600, 988, 100), + ENTRY(INTEL, pm90_n715b, 1500, 1324, 600, 988, 100), + ENTRY(INTEL, pm90_n715c, 1500, 1308, 600, 988, 100), + ENTRY(INTEL, pm90_n715d, 1500, 1276, 600, 988, 100), + ENTRY(INTEL, pm90_n725a, 1600, 1340, 600, 988, 100), + ENTRY(INTEL, pm90_n725b, 1600, 1324, 600, 988, 100), + ENTRY(INTEL, pm90_n725c, 1600, 1308, 600, 988, 100), + ENTRY(INTEL, pm90_n725d, 1600, 1276, 600, 988, 100), + ENTRY(INTEL, pm90_n735a, 1700, 1340, 600, 988, 100), + ENTRY(INTEL, pm90_n735b, 1700, 1324, 600, 988, 100), + ENTRY(INTEL, pm90_n735c, 1700, 1308, 600, 988, 100), + ENTRY(INTEL, pm90_n735d, 1700, 1276, 600, 988, 100), + ENTRY(INTEL, pm90_n745a, 1800, 1340, 600, 988, 100), + ENTRY(INTEL, pm90_n745b, 1800, 1324, 600, 988, 100), + ENTRY(INTEL, pm90_n745c, 1800, 1308, 600, 988, 100), + ENTRY(INTEL, pm90_n745d, 1800, 1276, 600, 988, 100), + ENTRY(INTEL, pm90_n755a, 2000, 1340, 600, 988, 100), + ENTRY(INTEL, pm90_n755b, 2000, 1324, 600, 988, 100), + ENTRY(INTEL, pm90_n755c, 2000, 1308, 600, 988, 100), + ENTRY(INTEL, pm90_n755d, 2000, 1276, 600, 988, 100), + ENTRY(INTEL, pm90_n765a, 2100, 1340, 600, 988, 100), + ENTRY(INTEL, pm90_n765b, 2100, 1324, 600, 988, 100), + ENTRY(INTEL, pm90_n765c, 2100, 1308, 600, 988, 100), + ENTRY(INTEL, pm90_n765e, 2100, 1356, 600, 988, 100), + ENTRY(INTEL, pm90_n770, 2130, 1551, 600, 988, 100), + + ENTRY(VIA, C7M_770_ULV, 1000, 844, 400, 796, 100), + ENTRY(VIA, C7M_779_ULV, 1000, 796, 400, 796, 100), + ENTRY(VIA, C7M_772_ULV, 1200, 844, 400, 796, 100), + ENTRY(VIA, C7M_771, 1200, 860, 400, 844, 100), + ENTRY(VIA, C7M_775_ULV, 1500, 956, 400, 796, 100), + ENTRY(VIA, C7M_754, 1500, 1004, 400, 844, 100), + ENTRY(VIA, C7M_764, 1600, 1084, 400, 844, 100), + ENTRY(VIA, C7M_765, 1600, 1084, 533, 844, 133), + ENTRY(VIA, C7M_784, 1800, 1148, 400, 844, 100), + ENTRY(VIA, C7M_785, 1867, 1148, 533, 844, 133), + ENTRY(VIA, C7M_794, 2000, 1148, 400, 844, 100), + ENTRY(VIA, C7M_795, 2000, 1148, 533, 844, 133), }; #define NESTCPUS (sizeof(est_cpus) / sizeof(est_cpus[0])) -#define MSRVALUE(mhz, mv) ((((mhz) / 100) << 8) | (((mv) - 700) / 16)) +#define MSRVALUE(mhz, mv, bus) ((((mhz) / (bus)) << 8) | (((mv) - 700) / 16)) #define MSR2MHZ(msr) ((((int) (msr) >> 8) & 0xff) * 100) #define MSR2MV(msr) (((int) (msr) & 0xff) * 16 + 700) @@ -375,16 +905,11 @@ extern int setperf_prio; extern int perflevel; void -est_init(const char *cpu_device) +est_init(const char *cpu_device, int vendor) { - int i, j, n, mhz, mv; - const struct est_cpu *cpu; + int i, mhz, mv, low, high; + u_int32_t id; u_int64_t msr; - char *tag; - const struct fqlist *fql; - extern char cpu_brandstr[]; - extern int cpu_id; - int low, high; if (setperf_prio > 3) return; @@ -396,30 +921,20 @@ est_init(const char *cpu_device) mhz = MSR2MHZ(msr); mv = MSR2MV(msr); printf("%s: Enhanced SpeedStep %d MHz (%d mV)", - cpu_device, mhz, mv); + cpu_device, mhz, mv); /* - * Look for a CPU matching cpu_brandstr. + * Find an entry which matches (vendor, id32) */ - for (i = 0; est_fqlist == NULL && i < NESTCPUS; i++) { - cpu = &est_cpus[i]; - n = strlen(cpu->brand_prefix); - if (strncmp(cpu->brand_prefix, cpu_brandstr, n) != 0) - continue; - tag = cpu_brandstr + n; - for (j = 0; j < cpu->n; j++) { - fql = &cpu->list[j]; - n = strlen(fql->brand_tag); - if (!strncmp(fql->brand_tag, tag, n) && - !strcmp(cpu->brand_suffix, tag + n) && - (fql->cpu_id == 0 || fql->cpu_id == cpu_id)) { - est_fqlist = fql; - break; - } + id = msr >> 32; + for (i = 0; i < NESTCPUS; i++) { + if (est_cpus[i].vendor == vendor && est_cpus[i].id32 == id) { + est_fqlist = &est_cpus[i]; + break; } } if (est_fqlist == NULL) { - printf(": unknown EST cpu, no changes possible\n"); + printf(": unknown EST cpu, msr %016llx\n", msr); return; } @@ -467,9 +982,10 @@ est_setperf(int level) if (est_fqlist->table[i].mhz >= fq) break; msr = (rdmsr(MSR_PERF_CTL) & ~0xffffULL) | - MSRVALUE(est_fqlist->table[i].mhz, est_fqlist->table[i].mv); + MSRVALUE(est_fqlist->table[i].mhz, est_fqlist->table[i].mv, + est_fqlist->bus_clk); wrmsr(MSR_PERF_CTL, msr); pentium_mhz = est_fqlist->table[i].mhz; - + return (0); } diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index aa7da3554bc..9547b343606 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.355 2006/05/18 17:36:31 dim Exp $ */ +/* $OpenBSD: machdep.c,v 1.356 2006/05/19 19:43:41 dim Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -1180,7 +1180,7 @@ cyrix3_cpu_setup(struct cpu_info *ci) if (cpu_ecxfeature & CPUIDECX_EST) { if (rdmsr(MSR_MISC_ENABLE) & (1 << 16)) - est_init(ci->ci_dev.dv_xname); + est_init(ci->ci_dev.dv_xname, CPUVENDOR_VIA); else printf("%s: Enhanced SpeedStep disabled by BIOS\n", ci->ci_dev.dv_xname); @@ -1460,7 +1460,7 @@ intel686_common_cpu_setup(struct cpu_info *ci) if (cpu_ecxfeature & CPUIDECX_EST) { if (rdmsr(MSR_MISC_ENABLE) & (1 << 16)) - est_init(ci->ci_dev.dv_xname); + est_init(ci->ci_dev.dv_xname, CPUVENDOR_INTEL); else printf("%s: Enhanced SpeedStep disabled by BIOS\n", ci->ci_dev.dv_xname); diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h index 9e7082860f6..10ce69a46ea 100644 --- a/sys/arch/i386/include/cpu.h +++ b/sys/arch/i386/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.76 2006/05/09 09:38:35 otto Exp $ */ +/* $OpenBSD: cpu.h,v 1.77 2006/05/19 19:43:41 dim Exp $ */ /* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */ /*- @@ -355,7 +355,7 @@ void i8254_initclocks(void); /* est.c */ #if !defined(SMALL_KERNEL) && defined(I686_CPU) -void est_init(const char *); +void est_init(const char *, int); int est_setperf(int); #endif |