1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2004 Colin Percival 5 * Copyright (c) 2005 Nate Lawson 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted providing that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 #include <sys/cdefs.h> 31 __FBSDID("$FreeBSD$"); 32 33 #include <sys/param.h> 34 #include <sys/bus.h> 35 #include <sys/cpu.h> 36 #include <sys/kernel.h> 37 #include <sys/malloc.h> 38 #include <sys/module.h> 39 #include <sys/smp.h> 40 #include <sys/systm.h> 41 42 #include "cpufreq_if.h" 43 #include <machine/clock.h> 44 #include <machine/cputypes.h> 45 #include <machine/md_var.h> 46 #include <machine/specialreg.h> 47 48 #include <contrib/dev/acpica/include/acpi.h> 49 50 #include <dev/acpica/acpivar.h> 51 #include "acpi_if.h" 52 53 #include <x86/cpufreq/hwpstate_intel_internal.h> 54 55 /* Status/control registers (from the IA-32 System Programming Guide). */ 56 #define MSR_PERF_STATUS 0x198 57 #define MSR_PERF_CTL 0x199 58 59 /* Register and bit for enabling SpeedStep. */ 60 #define MSR_MISC_ENABLE 0x1a0 61 #define MSR_SS_ENABLE (1<<16) 62 63 /* Frequency and MSR control values. */ 64 typedef struct { 65 uint16_t freq; 66 uint16_t volts; 67 uint16_t id16; 68 int power; 69 } freq_info; 70 71 /* Identifying characteristics of a processor and supported frequencies. */ 72 typedef struct { 73 const u_int vendor_id; 74 uint32_t id32; 75 freq_info *freqtab; 76 size_t tablen; 77 } cpu_info; 78 79 struct est_softc { 80 device_t dev; 81 int acpi_settings; 82 int msr_settings; 83 freq_info *freq_list; 84 size_t flist_len; 85 }; 86 87 /* Convert MHz and mV into IDs for passing to the MSR. */ 88 #define ID16(MHz, mV, bus_clk) \ 89 (((MHz / bus_clk) << 8) | ((mV ? mV - 700 : 0) >> 4)) 90 #define ID32(MHz_hi, mV_hi, MHz_lo, mV_lo, bus_clk) \ 91 ((ID16(MHz_lo, mV_lo, bus_clk) << 16) | (ID16(MHz_hi, mV_hi, bus_clk))) 92 93 /* Format for storing IDs in our table. */ 94 #define FREQ_INFO_PWR(MHz, mV, bus_clk, mW) \ 95 { MHz, mV, ID16(MHz, mV, bus_clk), mW } 96 #define FREQ_INFO(MHz, mV, bus_clk) \ 97 FREQ_INFO_PWR(MHz, mV, bus_clk, CPUFREQ_VAL_UNKNOWN) 98 #define INTEL(tab, zhi, vhi, zlo, vlo, bus_clk) \ 99 { CPU_VENDOR_INTEL, ID32(zhi, vhi, zlo, vlo, bus_clk), tab, nitems(tab) } 100 #define CENTAUR(tab, zhi, vhi, zlo, vlo, bus_clk) \ 101 { CPU_VENDOR_CENTAUR, ID32(zhi, vhi, zlo, vlo, bus_clk), tab, nitems(tab) } 102 103 static int msr_info_enabled = 0; 104 TUNABLE_INT("hw.est.msr_info", &msr_info_enabled); 105 static int strict = -1; 106 TUNABLE_INT("hw.est.strict", &strict); 107 108 /* Default bus clock value for Centrino processors. */ 109 #define INTEL_BUS_CLK 100 110 111 /* XXX Update this if new CPUs have more settings. */ 112 #define EST_MAX_SETTINGS 10 113 CTASSERT(EST_MAX_SETTINGS <= MAX_SETTINGS); 114 115 /* Estimate in microseconds of latency for performing a transition. */ 116 #define EST_TRANS_LAT 1000 117 118 /* 119 * Frequency (MHz) and voltage (mV) settings. 120 * 121 * Dothan processors have multiple VID#s with different settings for 122 * each VID#. Since we can't uniquely identify this info 123 * without undisclosed methods from Intel, we can't support newer 124 * processors with this table method. If ACPI Px states are supported, 125 * we get info from them. 126 * 127 * Data from the "Intel Pentium M Processor Datasheet", 128 * Order Number 252612-003, Table 5. 129 */ 130 static freq_info PM17_130[] = { 131 /* 130nm 1.70GHz Pentium M */ 132 FREQ_INFO(1700, 1484, INTEL_BUS_CLK), 133 FREQ_INFO(1400, 1308, INTEL_BUS_CLK), 134 FREQ_INFO(1200, 1228, INTEL_BUS_CLK), 135 FREQ_INFO(1000, 1116, INTEL_BUS_CLK), 136 FREQ_INFO( 800, 1004, INTEL_BUS_CLK), 137 FREQ_INFO( 600, 956, INTEL_BUS_CLK), 138 }; 139 static freq_info PM16_130[] = { 140 /* 130nm 1.60GHz Pentium M */ 141 FREQ_INFO(1600, 1484, INTEL_BUS_CLK), 142 FREQ_INFO(1400, 1420, INTEL_BUS_CLK), 143 FREQ_INFO(1200, 1276, INTEL_BUS_CLK), 144 FREQ_INFO(1000, 1164, INTEL_BUS_CLK), 145 FREQ_INFO( 800, 1036, INTEL_BUS_CLK), 146 FREQ_INFO( 600, 956, INTEL_BUS_CLK), 147 }; 148 static freq_info PM15_130[] = { 149 /* 130nm 1.50GHz Pentium M */ 150 FREQ_INFO(1500, 1484, INTEL_BUS_CLK), 151 FREQ_INFO(1400, 1452, INTEL_BUS_CLK), 152 FREQ_INFO(1200, 1356, INTEL_BUS_CLK), 153 FREQ_INFO(1000, 1228, INTEL_BUS_CLK), 154 FREQ_INFO( 800, 1116, INTEL_BUS_CLK), 155 FREQ_INFO( 600, 956, INTEL_BUS_CLK), 156 }; 157 static freq_info PM14_130[] = { 158 /* 130nm 1.40GHz Pentium M */ 159 FREQ_INFO(1400, 1484, INTEL_BUS_CLK), 160 FREQ_INFO(1200, 1436, INTEL_BUS_CLK), 161 FREQ_INFO(1000, 1308, INTEL_BUS_CLK), 162 FREQ_INFO( 800, 1180, INTEL_BUS_CLK), 163 FREQ_INFO( 600, 956, INTEL_BUS_CLK), 164 }; 165 static freq_info PM13_130[] = { 166 /* 130nm 1.30GHz Pentium M */ 167 FREQ_INFO(1300, 1388, INTEL_BUS_CLK), 168 FREQ_INFO(1200, 1356, INTEL_BUS_CLK), 169 FREQ_INFO(1000, 1292, INTEL_BUS_CLK), 170 FREQ_INFO( 800, 1260, INTEL_BUS_CLK), 171 FREQ_INFO( 600, 956, INTEL_BUS_CLK), 172 }; 173 static freq_info PM13_LV_130[] = { 174 /* 130nm 1.30GHz Low Voltage Pentium M */ 175 FREQ_INFO(1300, 1180, INTEL_BUS_CLK), 176 FREQ_INFO(1200, 1164, INTEL_BUS_CLK), 177 FREQ_INFO(1100, 1100, INTEL_BUS_CLK), 178 FREQ_INFO(1000, 1020, INTEL_BUS_CLK), 179 FREQ_INFO( 900, 1004, INTEL_BUS_CLK), 180 FREQ_INFO( 800, 988, INTEL_BUS_CLK), 181 FREQ_INFO( 600, 956, INTEL_BUS_CLK), 182 }; 183 static freq_info PM12_LV_130[] = { 184 /* 130 nm 1.20GHz Low Voltage Pentium M */ 185 FREQ_INFO(1200, 1180, INTEL_BUS_CLK), 186 FREQ_INFO(1100, 1164, INTEL_BUS_CLK), 187 FREQ_INFO(1000, 1100, INTEL_BUS_CLK), 188 FREQ_INFO( 900, 1020, INTEL_BUS_CLK), 189 FREQ_INFO( 800, 1004, INTEL_BUS_CLK), 190 FREQ_INFO( 600, 956, INTEL_BUS_CLK), 191 }; 192 static freq_info PM11_LV_130[] = { 193 /* 130 nm 1.10GHz Low Voltage Pentium M */ 194 FREQ_INFO(1100, 1180, INTEL_BUS_CLK), 195 FREQ_INFO(1000, 1164, INTEL_BUS_CLK), 196 FREQ_INFO( 900, 1100, INTEL_BUS_CLK), 197 FREQ_INFO( 800, 1020, INTEL_BUS_CLK), 198 FREQ_INFO( 600, 956, INTEL_BUS_CLK), 199 }; 200 static freq_info PM11_ULV_130[] = { 201 /* 130 nm 1.10GHz Ultra Low Voltage Pentium M */ 202 FREQ_INFO(1100, 1004, INTEL_BUS_CLK), 203 FREQ_INFO(1000, 988, INTEL_BUS_CLK), 204 FREQ_INFO( 900, 972, INTEL_BUS_CLK), 205 FREQ_INFO( 800, 956, INTEL_BUS_CLK), 206 FREQ_INFO( 600, 844, INTEL_BUS_CLK), 207 }; 208 static freq_info PM10_ULV_130[] = { 209 /* 130 nm 1.00GHz Ultra Low Voltage Pentium M */ 210 FREQ_INFO(1000, 1004, INTEL_BUS_CLK), 211 FREQ_INFO( 900, 988, INTEL_BUS_CLK), 212 FREQ_INFO( 800, 972, INTEL_BUS_CLK), 213 FREQ_INFO( 600, 844, INTEL_BUS_CLK), 214 }; 215 216 /* 217 * Data from "Intel Pentium M Processor on 90nm Process with 218 * 2-MB L2 Cache Datasheet", Order Number 302189-008, Table 5. 219 */ 220 static freq_info PM_765A_90[] = { 221 /* 90 nm 2.10GHz Pentium M, VID #A */ 222 FREQ_INFO(2100, 1340, INTEL_BUS_CLK), 223 FREQ_INFO(1800, 1276, INTEL_BUS_CLK), 224 FREQ_INFO(1600, 1228, INTEL_BUS_CLK), 225 FREQ_INFO(1400, 1180, INTEL_BUS_CLK), 226 FREQ_INFO(1200, 1132, INTEL_BUS_CLK), 227 FREQ_INFO(1000, 1084, INTEL_BUS_CLK), 228 FREQ_INFO( 800, 1036, INTEL_BUS_CLK), 229 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 230 }; 231 static freq_info PM_765B_90[] = { 232 /* 90 nm 2.10GHz Pentium M, VID #B */ 233 FREQ_INFO(2100, 1324, INTEL_BUS_CLK), 234 FREQ_INFO(1800, 1260, INTEL_BUS_CLK), 235 FREQ_INFO(1600, 1212, INTEL_BUS_CLK), 236 FREQ_INFO(1400, 1180, INTEL_BUS_CLK), 237 FREQ_INFO(1200, 1132, INTEL_BUS_CLK), 238 FREQ_INFO(1000, 1084, INTEL_BUS_CLK), 239 FREQ_INFO( 800, 1036, INTEL_BUS_CLK), 240 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 241 }; 242 static freq_info PM_765C_90[] = { 243 /* 90 nm 2.10GHz Pentium M, VID #C */ 244 FREQ_INFO(2100, 1308, INTEL_BUS_CLK), 245 FREQ_INFO(1800, 1244, INTEL_BUS_CLK), 246 FREQ_INFO(1600, 1212, INTEL_BUS_CLK), 247 FREQ_INFO(1400, 1164, INTEL_BUS_CLK), 248 FREQ_INFO(1200, 1116, INTEL_BUS_CLK), 249 FREQ_INFO(1000, 1084, INTEL_BUS_CLK), 250 FREQ_INFO( 800, 1036, INTEL_BUS_CLK), 251 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 252 }; 253 static freq_info PM_765E_90[] = { 254 /* 90 nm 2.10GHz Pentium M, VID #E */ 255 FREQ_INFO(2100, 1356, INTEL_BUS_CLK), 256 FREQ_INFO(1800, 1292, INTEL_BUS_CLK), 257 FREQ_INFO(1600, 1244, INTEL_BUS_CLK), 258 FREQ_INFO(1400, 1196, INTEL_BUS_CLK), 259 FREQ_INFO(1200, 1148, INTEL_BUS_CLK), 260 FREQ_INFO(1000, 1100, INTEL_BUS_CLK), 261 FREQ_INFO( 800, 1052, INTEL_BUS_CLK), 262 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 263 }; 264 static freq_info PM_755A_90[] = { 265 /* 90 nm 2.00GHz Pentium M, VID #A */ 266 FREQ_INFO(2000, 1340, INTEL_BUS_CLK), 267 FREQ_INFO(1800, 1292, INTEL_BUS_CLK), 268 FREQ_INFO(1600, 1244, INTEL_BUS_CLK), 269 FREQ_INFO(1400, 1196, INTEL_BUS_CLK), 270 FREQ_INFO(1200, 1148, INTEL_BUS_CLK), 271 FREQ_INFO(1000, 1100, INTEL_BUS_CLK), 272 FREQ_INFO( 800, 1052, INTEL_BUS_CLK), 273 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 274 }; 275 static freq_info PM_755B_90[] = { 276 /* 90 nm 2.00GHz Pentium M, VID #B */ 277 FREQ_INFO(2000, 1324, INTEL_BUS_CLK), 278 FREQ_INFO(1800, 1276, INTEL_BUS_CLK), 279 FREQ_INFO(1600, 1228, INTEL_BUS_CLK), 280 FREQ_INFO(1400, 1180, INTEL_BUS_CLK), 281 FREQ_INFO(1200, 1132, INTEL_BUS_CLK), 282 FREQ_INFO(1000, 1084, INTEL_BUS_CLK), 283 FREQ_INFO( 800, 1036, INTEL_BUS_CLK), 284 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 285 }; 286 static freq_info PM_755C_90[] = { 287 /* 90 nm 2.00GHz Pentium M, VID #C */ 288 FREQ_INFO(2000, 1308, INTEL_BUS_CLK), 289 FREQ_INFO(1800, 1276, INTEL_BUS_CLK), 290 FREQ_INFO(1600, 1228, INTEL_BUS_CLK), 291 FREQ_INFO(1400, 1180, INTEL_BUS_CLK), 292 FREQ_INFO(1200, 1132, INTEL_BUS_CLK), 293 FREQ_INFO(1000, 1084, INTEL_BUS_CLK), 294 FREQ_INFO( 800, 1036, INTEL_BUS_CLK), 295 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 296 }; 297 static freq_info PM_755D_90[] = { 298 /* 90 nm 2.00GHz Pentium M, VID #D */ 299 FREQ_INFO(2000, 1276, INTEL_BUS_CLK), 300 FREQ_INFO(1800, 1244, INTEL_BUS_CLK), 301 FREQ_INFO(1600, 1196, INTEL_BUS_CLK), 302 FREQ_INFO(1400, 1164, INTEL_BUS_CLK), 303 FREQ_INFO(1200, 1116, INTEL_BUS_CLK), 304 FREQ_INFO(1000, 1084, INTEL_BUS_CLK), 305 FREQ_INFO( 800, 1036, INTEL_BUS_CLK), 306 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 307 }; 308 static freq_info PM_745A_90[] = { 309 /* 90 nm 1.80GHz Pentium M, VID #A */ 310 FREQ_INFO(1800, 1340, INTEL_BUS_CLK), 311 FREQ_INFO(1600, 1292, INTEL_BUS_CLK), 312 FREQ_INFO(1400, 1228, INTEL_BUS_CLK), 313 FREQ_INFO(1200, 1164, INTEL_BUS_CLK), 314 FREQ_INFO(1000, 1116, INTEL_BUS_CLK), 315 FREQ_INFO( 800, 1052, INTEL_BUS_CLK), 316 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 317 }; 318 static freq_info PM_745B_90[] = { 319 /* 90 nm 1.80GHz Pentium M, VID #B */ 320 FREQ_INFO(1800, 1324, INTEL_BUS_CLK), 321 FREQ_INFO(1600, 1276, INTEL_BUS_CLK), 322 FREQ_INFO(1400, 1212, INTEL_BUS_CLK), 323 FREQ_INFO(1200, 1164, INTEL_BUS_CLK), 324 FREQ_INFO(1000, 1116, INTEL_BUS_CLK), 325 FREQ_INFO( 800, 1052, INTEL_BUS_CLK), 326 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 327 }; 328 static freq_info PM_745C_90[] = { 329 /* 90 nm 1.80GHz Pentium M, VID #C */ 330 FREQ_INFO(1800, 1308, INTEL_BUS_CLK), 331 FREQ_INFO(1600, 1260, INTEL_BUS_CLK), 332 FREQ_INFO(1400, 1212, INTEL_BUS_CLK), 333 FREQ_INFO(1200, 1148, INTEL_BUS_CLK), 334 FREQ_INFO(1000, 1100, INTEL_BUS_CLK), 335 FREQ_INFO( 800, 1052, INTEL_BUS_CLK), 336 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 337 }; 338 static freq_info PM_745D_90[] = { 339 /* 90 nm 1.80GHz Pentium M, VID #D */ 340 FREQ_INFO(1800, 1276, INTEL_BUS_CLK), 341 FREQ_INFO(1600, 1228, INTEL_BUS_CLK), 342 FREQ_INFO(1400, 1180, INTEL_BUS_CLK), 343 FREQ_INFO(1200, 1132, INTEL_BUS_CLK), 344 FREQ_INFO(1000, 1084, INTEL_BUS_CLK), 345 FREQ_INFO( 800, 1036, INTEL_BUS_CLK), 346 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 347 }; 348 static freq_info PM_735A_90[] = { 349 /* 90 nm 1.70GHz Pentium M, VID #A */ 350 FREQ_INFO(1700, 1340, INTEL_BUS_CLK), 351 FREQ_INFO(1400, 1244, INTEL_BUS_CLK), 352 FREQ_INFO(1200, 1180, INTEL_BUS_CLK), 353 FREQ_INFO(1000, 1116, INTEL_BUS_CLK), 354 FREQ_INFO( 800, 1052, INTEL_BUS_CLK), 355 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 356 }; 357 static freq_info PM_735B_90[] = { 358 /* 90 nm 1.70GHz Pentium M, VID #B */ 359 FREQ_INFO(1700, 1324, INTEL_BUS_CLK), 360 FREQ_INFO(1400, 1244, INTEL_BUS_CLK), 361 FREQ_INFO(1200, 1180, INTEL_BUS_CLK), 362 FREQ_INFO(1000, 1116, INTEL_BUS_CLK), 363 FREQ_INFO( 800, 1052, INTEL_BUS_CLK), 364 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 365 }; 366 static freq_info PM_735C_90[] = { 367 /* 90 nm 1.70GHz Pentium M, VID #C */ 368 FREQ_INFO(1700, 1308, INTEL_BUS_CLK), 369 FREQ_INFO(1400, 1228, INTEL_BUS_CLK), 370 FREQ_INFO(1200, 1164, INTEL_BUS_CLK), 371 FREQ_INFO(1000, 1116, INTEL_BUS_CLK), 372 FREQ_INFO( 800, 1052, INTEL_BUS_CLK), 373 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 374 }; 375 static freq_info PM_735D_90[] = { 376 /* 90 nm 1.70GHz Pentium M, VID #D */ 377 FREQ_INFO(1700, 1276, INTEL_BUS_CLK), 378 FREQ_INFO(1400, 1212, INTEL_BUS_CLK), 379 FREQ_INFO(1200, 1148, INTEL_BUS_CLK), 380 FREQ_INFO(1000, 1100, INTEL_BUS_CLK), 381 FREQ_INFO( 800, 1052, INTEL_BUS_CLK), 382 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 383 }; 384 static freq_info PM_725A_90[] = { 385 /* 90 nm 1.60GHz Pentium M, VID #A */ 386 FREQ_INFO(1600, 1340, INTEL_BUS_CLK), 387 FREQ_INFO(1400, 1276, INTEL_BUS_CLK), 388 FREQ_INFO(1200, 1212, INTEL_BUS_CLK), 389 FREQ_INFO(1000, 1132, INTEL_BUS_CLK), 390 FREQ_INFO( 800, 1068, INTEL_BUS_CLK), 391 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 392 }; 393 static freq_info PM_725B_90[] = { 394 /* 90 nm 1.60GHz Pentium M, VID #B */ 395 FREQ_INFO(1600, 1324, INTEL_BUS_CLK), 396 FREQ_INFO(1400, 1260, INTEL_BUS_CLK), 397 FREQ_INFO(1200, 1196, INTEL_BUS_CLK), 398 FREQ_INFO(1000, 1132, INTEL_BUS_CLK), 399 FREQ_INFO( 800, 1068, INTEL_BUS_CLK), 400 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 401 }; 402 static freq_info PM_725C_90[] = { 403 /* 90 nm 1.60GHz Pentium M, VID #C */ 404 FREQ_INFO(1600, 1308, INTEL_BUS_CLK), 405 FREQ_INFO(1400, 1244, INTEL_BUS_CLK), 406 FREQ_INFO(1200, 1180, INTEL_BUS_CLK), 407 FREQ_INFO(1000, 1116, INTEL_BUS_CLK), 408 FREQ_INFO( 800, 1052, INTEL_BUS_CLK), 409 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 410 }; 411 static freq_info PM_725D_90[] = { 412 /* 90 nm 1.60GHz Pentium M, VID #D */ 413 FREQ_INFO(1600, 1276, INTEL_BUS_CLK), 414 FREQ_INFO(1400, 1228, INTEL_BUS_CLK), 415 FREQ_INFO(1200, 1164, INTEL_BUS_CLK), 416 FREQ_INFO(1000, 1116, INTEL_BUS_CLK), 417 FREQ_INFO( 800, 1052, INTEL_BUS_CLK), 418 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 419 }; 420 static freq_info PM_715A_90[] = { 421 /* 90 nm 1.50GHz Pentium M, VID #A */ 422 FREQ_INFO(1500, 1340, INTEL_BUS_CLK), 423 FREQ_INFO(1200, 1228, INTEL_BUS_CLK), 424 FREQ_INFO(1000, 1148, INTEL_BUS_CLK), 425 FREQ_INFO( 800, 1068, INTEL_BUS_CLK), 426 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 427 }; 428 static freq_info PM_715B_90[] = { 429 /* 90 nm 1.50GHz Pentium M, VID #B */ 430 FREQ_INFO(1500, 1324, INTEL_BUS_CLK), 431 FREQ_INFO(1200, 1212, INTEL_BUS_CLK), 432 FREQ_INFO(1000, 1148, INTEL_BUS_CLK), 433 FREQ_INFO( 800, 1068, INTEL_BUS_CLK), 434 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 435 }; 436 static freq_info PM_715C_90[] = { 437 /* 90 nm 1.50GHz Pentium M, VID #C */ 438 FREQ_INFO(1500, 1308, INTEL_BUS_CLK), 439 FREQ_INFO(1200, 1212, INTEL_BUS_CLK), 440 FREQ_INFO(1000, 1132, INTEL_BUS_CLK), 441 FREQ_INFO( 800, 1068, INTEL_BUS_CLK), 442 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 443 }; 444 static freq_info PM_715D_90[] = { 445 /* 90 nm 1.50GHz Pentium M, VID #D */ 446 FREQ_INFO(1500, 1276, INTEL_BUS_CLK), 447 FREQ_INFO(1200, 1180, INTEL_BUS_CLK), 448 FREQ_INFO(1000, 1116, INTEL_BUS_CLK), 449 FREQ_INFO( 800, 1052, INTEL_BUS_CLK), 450 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 451 }; 452 static freq_info PM_778_90[] = { 453 /* 90 nm 1.60GHz Low Voltage Pentium M */ 454 FREQ_INFO(1600, 1116, INTEL_BUS_CLK), 455 FREQ_INFO(1500, 1116, INTEL_BUS_CLK), 456 FREQ_INFO(1400, 1100, INTEL_BUS_CLK), 457 FREQ_INFO(1300, 1084, INTEL_BUS_CLK), 458 FREQ_INFO(1200, 1068, INTEL_BUS_CLK), 459 FREQ_INFO(1100, 1052, INTEL_BUS_CLK), 460 FREQ_INFO(1000, 1052, INTEL_BUS_CLK), 461 FREQ_INFO( 900, 1036, INTEL_BUS_CLK), 462 FREQ_INFO( 800, 1020, INTEL_BUS_CLK), 463 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 464 }; 465 static freq_info PM_758_90[] = { 466 /* 90 nm 1.50GHz Low Voltage Pentium M */ 467 FREQ_INFO(1500, 1116, INTEL_BUS_CLK), 468 FREQ_INFO(1400, 1116, INTEL_BUS_CLK), 469 FREQ_INFO(1300, 1100, INTEL_BUS_CLK), 470 FREQ_INFO(1200, 1084, INTEL_BUS_CLK), 471 FREQ_INFO(1100, 1068, INTEL_BUS_CLK), 472 FREQ_INFO(1000, 1052, INTEL_BUS_CLK), 473 FREQ_INFO( 900, 1036, INTEL_BUS_CLK), 474 FREQ_INFO( 800, 1020, INTEL_BUS_CLK), 475 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 476 }; 477 static freq_info PM_738_90[] = { 478 /* 90 nm 1.40GHz Low Voltage Pentium M */ 479 FREQ_INFO(1400, 1116, INTEL_BUS_CLK), 480 FREQ_INFO(1300, 1116, INTEL_BUS_CLK), 481 FREQ_INFO(1200, 1100, INTEL_BUS_CLK), 482 FREQ_INFO(1100, 1068, INTEL_BUS_CLK), 483 FREQ_INFO(1000, 1052, INTEL_BUS_CLK), 484 FREQ_INFO( 900, 1036, INTEL_BUS_CLK), 485 FREQ_INFO( 800, 1020, INTEL_BUS_CLK), 486 FREQ_INFO( 600, 988, INTEL_BUS_CLK), 487 }; 488 static freq_info PM_773G_90[] = { 489 /* 90 nm 1.30GHz Ultra Low Voltage Pentium M, VID #G */ 490 FREQ_INFO(1300, 956, INTEL_BUS_CLK), 491 FREQ_INFO(1200, 940, INTEL_BUS_CLK), 492 FREQ_INFO(1100, 924, INTEL_BUS_CLK), 493 FREQ_INFO(1000, 908, INTEL_BUS_CLK), 494 FREQ_INFO( 900, 876, INTEL_BUS_CLK), 495 FREQ_INFO( 800, 860, INTEL_BUS_CLK), 496 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 497 }; 498 static freq_info PM_773H_90[] = { 499 /* 90 nm 1.30GHz Ultra Low Voltage Pentium M, VID #H */ 500 FREQ_INFO(1300, 940, INTEL_BUS_CLK), 501 FREQ_INFO(1200, 924, INTEL_BUS_CLK), 502 FREQ_INFO(1100, 908, INTEL_BUS_CLK), 503 FREQ_INFO(1000, 892, INTEL_BUS_CLK), 504 FREQ_INFO( 900, 876, INTEL_BUS_CLK), 505 FREQ_INFO( 800, 860, INTEL_BUS_CLK), 506 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 507 }; 508 static freq_info PM_773I_90[] = { 509 /* 90 nm 1.30GHz Ultra Low Voltage Pentium M, VID #I */ 510 FREQ_INFO(1300, 924, INTEL_BUS_CLK), 511 FREQ_INFO(1200, 908, INTEL_BUS_CLK), 512 FREQ_INFO(1100, 892, INTEL_BUS_CLK), 513 FREQ_INFO(1000, 876, INTEL_BUS_CLK), 514 FREQ_INFO( 900, 860, INTEL_BUS_CLK), 515 FREQ_INFO( 800, 844, INTEL_BUS_CLK), 516 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 517 }; 518 static freq_info PM_773J_90[] = { 519 /* 90 nm 1.30GHz Ultra Low Voltage Pentium M, VID #J */ 520 FREQ_INFO(1300, 908, INTEL_BUS_CLK), 521 FREQ_INFO(1200, 908, INTEL_BUS_CLK), 522 FREQ_INFO(1100, 892, INTEL_BUS_CLK), 523 FREQ_INFO(1000, 876, INTEL_BUS_CLK), 524 FREQ_INFO( 900, 860, INTEL_BUS_CLK), 525 FREQ_INFO( 800, 844, INTEL_BUS_CLK), 526 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 527 }; 528 static freq_info PM_773K_90[] = { 529 /* 90 nm 1.30GHz Ultra Low Voltage Pentium M, VID #K */ 530 FREQ_INFO(1300, 892, INTEL_BUS_CLK), 531 FREQ_INFO(1200, 892, INTEL_BUS_CLK), 532 FREQ_INFO(1100, 876, INTEL_BUS_CLK), 533 FREQ_INFO(1000, 860, INTEL_BUS_CLK), 534 FREQ_INFO( 900, 860, INTEL_BUS_CLK), 535 FREQ_INFO( 800, 844, INTEL_BUS_CLK), 536 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 537 }; 538 static freq_info PM_773L_90[] = { 539 /* 90 nm 1.30GHz Ultra Low Voltage Pentium M, VID #L */ 540 FREQ_INFO(1300, 876, INTEL_BUS_CLK), 541 FREQ_INFO(1200, 876, INTEL_BUS_CLK), 542 FREQ_INFO(1100, 860, INTEL_BUS_CLK), 543 FREQ_INFO(1000, 860, INTEL_BUS_CLK), 544 FREQ_INFO( 900, 844, INTEL_BUS_CLK), 545 FREQ_INFO( 800, 844, INTEL_BUS_CLK), 546 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 547 }; 548 static freq_info PM_753G_90[] = { 549 /* 90 nm 1.20GHz Ultra Low Voltage Pentium M, VID #G */ 550 FREQ_INFO(1200, 956, INTEL_BUS_CLK), 551 FREQ_INFO(1100, 940, INTEL_BUS_CLK), 552 FREQ_INFO(1000, 908, INTEL_BUS_CLK), 553 FREQ_INFO( 900, 892, INTEL_BUS_CLK), 554 FREQ_INFO( 800, 860, INTEL_BUS_CLK), 555 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 556 }; 557 static freq_info PM_753H_90[] = { 558 /* 90 nm 1.20GHz Ultra Low Voltage Pentium M, VID #H */ 559 FREQ_INFO(1200, 940, INTEL_BUS_CLK), 560 FREQ_INFO(1100, 924, INTEL_BUS_CLK), 561 FREQ_INFO(1000, 908, INTEL_BUS_CLK), 562 FREQ_INFO( 900, 876, INTEL_BUS_CLK), 563 FREQ_INFO( 800, 860, INTEL_BUS_CLK), 564 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 565 }; 566 static freq_info PM_753I_90[] = { 567 /* 90 nm 1.20GHz Ultra Low Voltage Pentium M, VID #I */ 568 FREQ_INFO(1200, 924, INTEL_BUS_CLK), 569 FREQ_INFO(1100, 908, INTEL_BUS_CLK), 570 FREQ_INFO(1000, 892, INTEL_BUS_CLK), 571 FREQ_INFO( 900, 876, INTEL_BUS_CLK), 572 FREQ_INFO( 800, 860, INTEL_BUS_CLK), 573 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 574 }; 575 static freq_info PM_753J_90[] = { 576 /* 90 nm 1.20GHz Ultra Low Voltage Pentium M, VID #J */ 577 FREQ_INFO(1200, 908, INTEL_BUS_CLK), 578 FREQ_INFO(1100, 892, INTEL_BUS_CLK), 579 FREQ_INFO(1000, 876, INTEL_BUS_CLK), 580 FREQ_INFO( 900, 860, INTEL_BUS_CLK), 581 FREQ_INFO( 800, 844, INTEL_BUS_CLK), 582 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 583 }; 584 static freq_info PM_753K_90[] = { 585 /* 90 nm 1.20GHz Ultra Low Voltage Pentium M, VID #K */ 586 FREQ_INFO(1200, 892, INTEL_BUS_CLK), 587 FREQ_INFO(1100, 892, INTEL_BUS_CLK), 588 FREQ_INFO(1000, 876, INTEL_BUS_CLK), 589 FREQ_INFO( 900, 860, INTEL_BUS_CLK), 590 FREQ_INFO( 800, 844, INTEL_BUS_CLK), 591 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 592 }; 593 static freq_info PM_753L_90[] = { 594 /* 90 nm 1.20GHz Ultra Low Voltage Pentium M, VID #L */ 595 FREQ_INFO(1200, 876, INTEL_BUS_CLK), 596 FREQ_INFO(1100, 876, INTEL_BUS_CLK), 597 FREQ_INFO(1000, 860, INTEL_BUS_CLK), 598 FREQ_INFO( 900, 844, INTEL_BUS_CLK), 599 FREQ_INFO( 800, 844, INTEL_BUS_CLK), 600 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 601 }; 602 603 static freq_info PM_733JG_90[] = { 604 /* 90 nm 1.10GHz Ultra Low Voltage Pentium M, VID #G */ 605 FREQ_INFO(1100, 956, INTEL_BUS_CLK), 606 FREQ_INFO(1000, 940, INTEL_BUS_CLK), 607 FREQ_INFO( 900, 908, INTEL_BUS_CLK), 608 FREQ_INFO( 800, 876, INTEL_BUS_CLK), 609 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 610 }; 611 static freq_info PM_733JH_90[] = { 612 /* 90 nm 1.10GHz Ultra Low Voltage Pentium M, VID #H */ 613 FREQ_INFO(1100, 940, INTEL_BUS_CLK), 614 FREQ_INFO(1000, 924, INTEL_BUS_CLK), 615 FREQ_INFO( 900, 892, INTEL_BUS_CLK), 616 FREQ_INFO( 800, 876, INTEL_BUS_CLK), 617 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 618 }; 619 static freq_info PM_733JI_90[] = { 620 /* 90 nm 1.10GHz Ultra Low Voltage Pentium M, VID #I */ 621 FREQ_INFO(1100, 924, INTEL_BUS_CLK), 622 FREQ_INFO(1000, 908, INTEL_BUS_CLK), 623 FREQ_INFO( 900, 892, INTEL_BUS_CLK), 624 FREQ_INFO( 800, 860, INTEL_BUS_CLK), 625 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 626 }; 627 static freq_info PM_733JJ_90[] = { 628 /* 90 nm 1.10GHz Ultra Low Voltage Pentium M, VID #J */ 629 FREQ_INFO(1100, 908, INTEL_BUS_CLK), 630 FREQ_INFO(1000, 892, INTEL_BUS_CLK), 631 FREQ_INFO( 900, 876, INTEL_BUS_CLK), 632 FREQ_INFO( 800, 860, INTEL_BUS_CLK), 633 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 634 }; 635 static freq_info PM_733JK_90[] = { 636 /* 90 nm 1.10GHz Ultra Low Voltage Pentium M, VID #K */ 637 FREQ_INFO(1100, 892, INTEL_BUS_CLK), 638 FREQ_INFO(1000, 876, INTEL_BUS_CLK), 639 FREQ_INFO( 900, 860, INTEL_BUS_CLK), 640 FREQ_INFO( 800, 844, INTEL_BUS_CLK), 641 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 642 }; 643 static freq_info PM_733JL_90[] = { 644 /* 90 nm 1.10GHz Ultra Low Voltage Pentium M, VID #L */ 645 FREQ_INFO(1100, 876, INTEL_BUS_CLK), 646 FREQ_INFO(1000, 876, INTEL_BUS_CLK), 647 FREQ_INFO( 900, 860, INTEL_BUS_CLK), 648 FREQ_INFO( 800, 844, INTEL_BUS_CLK), 649 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 650 }; 651 static freq_info PM_733_90[] = { 652 /* 90 nm 1.10GHz Ultra Low Voltage Pentium M */ 653 FREQ_INFO(1100, 940, INTEL_BUS_CLK), 654 FREQ_INFO(1000, 924, INTEL_BUS_CLK), 655 FREQ_INFO( 900, 892, INTEL_BUS_CLK), 656 FREQ_INFO( 800, 876, INTEL_BUS_CLK), 657 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 658 }; 659 static freq_info PM_723_90[] = { 660 /* 90 nm 1.00GHz Ultra Low Voltage Pentium M */ 661 FREQ_INFO(1000, 940, INTEL_BUS_CLK), 662 FREQ_INFO( 900, 908, INTEL_BUS_CLK), 663 FREQ_INFO( 800, 876, INTEL_BUS_CLK), 664 FREQ_INFO( 600, 812, INTEL_BUS_CLK), 665 }; 666 667 /* 668 * VIA C7-M 500 MHz FSB, 400 MHz FSB, and ULV variants. 669 * Data from the "VIA C7-M Processor BIOS Writer's Guide (v2.17)" datasheet. 670 */ 671 static freq_info C7M_795[] = { 672 /* 2.00GHz Centaur C7-M 533 Mhz FSB */ 673 FREQ_INFO_PWR(2000, 1148, 133, 20000), 674 FREQ_INFO_PWR(1867, 1132, 133, 18000), 675 FREQ_INFO_PWR(1600, 1100, 133, 15000), 676 FREQ_INFO_PWR(1467, 1052, 133, 13000), 677 FREQ_INFO_PWR(1200, 1004, 133, 10000), 678 FREQ_INFO_PWR( 800, 844, 133, 7000), 679 FREQ_INFO_PWR( 667, 844, 133, 6000), 680 FREQ_INFO_PWR( 533, 844, 133, 5000), 681 }; 682 static freq_info C7M_785[] = { 683 /* 1.80GHz Centaur C7-M 533 Mhz FSB */ 684 FREQ_INFO_PWR(1867, 1148, 133, 18000), 685 FREQ_INFO_PWR(1600, 1100, 133, 15000), 686 FREQ_INFO_PWR(1467, 1052, 133, 13000), 687 FREQ_INFO_PWR(1200, 1004, 133, 10000), 688 FREQ_INFO_PWR( 800, 844, 133, 7000), 689 FREQ_INFO_PWR( 667, 844, 133, 6000), 690 FREQ_INFO_PWR( 533, 844, 133, 5000), 691 }; 692 static freq_info C7M_765[] = { 693 /* 1.60GHz Centaur C7-M 533 Mhz FSB */ 694 FREQ_INFO_PWR(1600, 1084, 133, 15000), 695 FREQ_INFO_PWR(1467, 1052, 133, 13000), 696 FREQ_INFO_PWR(1200, 1004, 133, 10000), 697 FREQ_INFO_PWR( 800, 844, 133, 7000), 698 FREQ_INFO_PWR( 667, 844, 133, 6000), 699 FREQ_INFO_PWR( 533, 844, 133, 5000), 700 }; 701 702 static freq_info C7M_794[] = { 703 /* 2.00GHz Centaur C7-M 400 Mhz FSB */ 704 FREQ_INFO_PWR(2000, 1148, 100, 20000), 705 FREQ_INFO_PWR(1800, 1132, 100, 18000), 706 FREQ_INFO_PWR(1600, 1100, 100, 15000), 707 FREQ_INFO_PWR(1400, 1052, 100, 13000), 708 FREQ_INFO_PWR(1000, 1004, 100, 10000), 709 FREQ_INFO_PWR( 800, 844, 100, 7000), 710 FREQ_INFO_PWR( 600, 844, 100, 6000), 711 FREQ_INFO_PWR( 400, 844, 100, 5000), 712 }; 713 static freq_info C7M_784[] = { 714 /* 1.80GHz Centaur C7-M 400 Mhz FSB */ 715 FREQ_INFO_PWR(1800, 1148, 100, 18000), 716 FREQ_INFO_PWR(1600, 1100, 100, 15000), 717 FREQ_INFO_PWR(1400, 1052, 100, 13000), 718 FREQ_INFO_PWR(1000, 1004, 100, 10000), 719 FREQ_INFO_PWR( 800, 844, 100, 7000), 720 FREQ_INFO_PWR( 600, 844, 100, 6000), 721 FREQ_INFO_PWR( 400, 844, 100, 5000), 722 }; 723 static freq_info C7M_764[] = { 724 /* 1.60GHz Centaur C7-M 400 Mhz FSB */ 725 FREQ_INFO_PWR(1600, 1084, 100, 15000), 726 FREQ_INFO_PWR(1400, 1052, 100, 13000), 727 FREQ_INFO_PWR(1000, 1004, 100, 10000), 728 FREQ_INFO_PWR( 800, 844, 100, 7000), 729 FREQ_INFO_PWR( 600, 844, 100, 6000), 730 FREQ_INFO_PWR( 400, 844, 100, 5000), 731 }; 732 static freq_info C7M_754[] = { 733 /* 1.50GHz Centaur C7-M 400 Mhz FSB */ 734 FREQ_INFO_PWR(1500, 1004, 100, 12000), 735 FREQ_INFO_PWR(1400, 988, 100, 11000), 736 FREQ_INFO_PWR(1000, 940, 100, 9000), 737 FREQ_INFO_PWR( 800, 844, 100, 7000), 738 FREQ_INFO_PWR( 600, 844, 100, 6000), 739 FREQ_INFO_PWR( 400, 844, 100, 5000), 740 }; 741 static freq_info C7M_771[] = { 742 /* 1.20GHz Centaur C7-M 400 Mhz FSB */ 743 FREQ_INFO_PWR(1200, 860, 100, 7000), 744 FREQ_INFO_PWR(1000, 860, 100, 6000), 745 FREQ_INFO_PWR( 800, 844, 100, 5500), 746 FREQ_INFO_PWR( 600, 844, 100, 5000), 747 FREQ_INFO_PWR( 400, 844, 100, 4000), 748 }; 749 750 static freq_info C7M_775_ULV[] = { 751 /* 1.50GHz Centaur C7-M ULV */ 752 FREQ_INFO_PWR(1500, 956, 100, 7500), 753 FREQ_INFO_PWR(1400, 940, 100, 6000), 754 FREQ_INFO_PWR(1000, 860, 100, 5000), 755 FREQ_INFO_PWR( 800, 828, 100, 2800), 756 FREQ_INFO_PWR( 600, 796, 100, 2500), 757 FREQ_INFO_PWR( 400, 796, 100, 2000), 758 }; 759 static freq_info C7M_772_ULV[] = { 760 /* 1.20GHz Centaur C7-M ULV */ 761 FREQ_INFO_PWR(1200, 844, 100, 5000), 762 FREQ_INFO_PWR(1000, 844, 100, 4000), 763 FREQ_INFO_PWR( 800, 828, 100, 2800), 764 FREQ_INFO_PWR( 600, 796, 100, 2500), 765 FREQ_INFO_PWR( 400, 796, 100, 2000), 766 }; 767 static freq_info C7M_779_ULV[] = { 768 /* 1.00GHz Centaur C7-M ULV */ 769 FREQ_INFO_PWR(1000, 796, 100, 3500), 770 FREQ_INFO_PWR( 800, 796, 100, 2800), 771 FREQ_INFO_PWR( 600, 796, 100, 2500), 772 FREQ_INFO_PWR( 400, 796, 100, 2000), 773 }; 774 static freq_info C7M_770_ULV[] = { 775 /* 1.00GHz Centaur C7-M ULV */ 776 FREQ_INFO_PWR(1000, 844, 100, 5000), 777 FREQ_INFO_PWR( 800, 796, 100, 2800), 778 FREQ_INFO_PWR( 600, 796, 100, 2500), 779 FREQ_INFO_PWR( 400, 796, 100, 2000), 780 }; 781 782 static cpu_info ESTprocs[] = { 783 INTEL(PM17_130, 1700, 1484, 600, 956, INTEL_BUS_CLK), 784 INTEL(PM16_130, 1600, 1484, 600, 956, INTEL_BUS_CLK), 785 INTEL(PM15_130, 1500, 1484, 600, 956, INTEL_BUS_CLK), 786 INTEL(PM14_130, 1400, 1484, 600, 956, INTEL_BUS_CLK), 787 INTEL(PM13_130, 1300, 1388, 600, 956, INTEL_BUS_CLK), 788 INTEL(PM13_LV_130, 1300, 1180, 600, 956, INTEL_BUS_CLK), 789 INTEL(PM12_LV_130, 1200, 1180, 600, 956, INTEL_BUS_CLK), 790 INTEL(PM11_LV_130, 1100, 1180, 600, 956, INTEL_BUS_CLK), 791 INTEL(PM11_ULV_130, 1100, 1004, 600, 844, INTEL_BUS_CLK), 792 INTEL(PM10_ULV_130, 1000, 1004, 600, 844, INTEL_BUS_CLK), 793 INTEL(PM_765A_90, 2100, 1340, 600, 988, INTEL_BUS_CLK), 794 INTEL(PM_765B_90, 2100, 1324, 600, 988, INTEL_BUS_CLK), 795 INTEL(PM_765C_90, 2100, 1308, 600, 988, INTEL_BUS_CLK), 796 INTEL(PM_765E_90, 2100, 1356, 600, 988, INTEL_BUS_CLK), 797 INTEL(PM_755A_90, 2000, 1340, 600, 988, INTEL_BUS_CLK), 798 INTEL(PM_755B_90, 2000, 1324, 600, 988, INTEL_BUS_CLK), 799 INTEL(PM_755C_90, 2000, 1308, 600, 988, INTEL_BUS_CLK), 800 INTEL(PM_755D_90, 2000, 1276, 600, 988, INTEL_BUS_CLK), 801 INTEL(PM_745A_90, 1800, 1340, 600, 988, INTEL_BUS_CLK), 802 INTEL(PM_745B_90, 1800, 1324, 600, 988, INTEL_BUS_CLK), 803 INTEL(PM_745C_90, 1800, 1308, 600, 988, INTEL_BUS_CLK), 804 INTEL(PM_745D_90, 1800, 1276, 600, 988, INTEL_BUS_CLK), 805 INTEL(PM_735A_90, 1700, 1340, 600, 988, INTEL_BUS_CLK), 806 INTEL(PM_735B_90, 1700, 1324, 600, 988, INTEL_BUS_CLK), 807 INTEL(PM_735C_90, 1700, 1308, 600, 988, INTEL_BUS_CLK), 808 INTEL(PM_735D_90, 1700, 1276, 600, 988, INTEL_BUS_CLK), 809 INTEL(PM_725A_90, 1600, 1340, 600, 988, INTEL_BUS_CLK), 810 INTEL(PM_725B_90, 1600, 1324, 600, 988, INTEL_BUS_CLK), 811 INTEL(PM_725C_90, 1600, 1308, 600, 988, INTEL_BUS_CLK), 812 INTEL(PM_725D_90, 1600, 1276, 600, 988, INTEL_BUS_CLK), 813 INTEL(PM_715A_90, 1500, 1340, 600, 988, INTEL_BUS_CLK), 814 INTEL(PM_715B_90, 1500, 1324, 600, 988, INTEL_BUS_CLK), 815 INTEL(PM_715C_90, 1500, 1308, 600, 988, INTEL_BUS_CLK), 816 INTEL(PM_715D_90, 1500, 1276, 600, 988, INTEL_BUS_CLK), 817 INTEL(PM_778_90, 1600, 1116, 600, 988, INTEL_BUS_CLK), 818 INTEL(PM_758_90, 1500, 1116, 600, 988, INTEL_BUS_CLK), 819 INTEL(PM_738_90, 1400, 1116, 600, 988, INTEL_BUS_CLK), 820 INTEL(PM_773G_90, 1300, 956, 600, 812, INTEL_BUS_CLK), 821 INTEL(PM_773H_90, 1300, 940, 600, 812, INTEL_BUS_CLK), 822 INTEL(PM_773I_90, 1300, 924, 600, 812, INTEL_BUS_CLK), 823 INTEL(PM_773J_90, 1300, 908, 600, 812, INTEL_BUS_CLK), 824 INTEL(PM_773K_90, 1300, 892, 600, 812, INTEL_BUS_CLK), 825 INTEL(PM_773L_90, 1300, 876, 600, 812, INTEL_BUS_CLK), 826 INTEL(PM_753G_90, 1200, 956, 600, 812, INTEL_BUS_CLK), 827 INTEL(PM_753H_90, 1200, 940, 600, 812, INTEL_BUS_CLK), 828 INTEL(PM_753I_90, 1200, 924, 600, 812, INTEL_BUS_CLK), 829 INTEL(PM_753J_90, 1200, 908, 600, 812, INTEL_BUS_CLK), 830 INTEL(PM_753K_90, 1200, 892, 600, 812, INTEL_BUS_CLK), 831 INTEL(PM_753L_90, 1200, 876, 600, 812, INTEL_BUS_CLK), 832 INTEL(PM_733JG_90, 1100, 956, 600, 812, INTEL_BUS_CLK), 833 INTEL(PM_733JH_90, 1100, 940, 600, 812, INTEL_BUS_CLK), 834 INTEL(PM_733JI_90, 1100, 924, 600, 812, INTEL_BUS_CLK), 835 INTEL(PM_733JJ_90, 1100, 908, 600, 812, INTEL_BUS_CLK), 836 INTEL(PM_733JK_90, 1100, 892, 600, 812, INTEL_BUS_CLK), 837 INTEL(PM_733JL_90, 1100, 876, 600, 812, INTEL_BUS_CLK), 838 INTEL(PM_733_90, 1100, 940, 600, 812, INTEL_BUS_CLK), 839 INTEL(PM_723_90, 1000, 940, 600, 812, INTEL_BUS_CLK), 840 841 CENTAUR(C7M_795, 2000, 1148, 533, 844, 133), 842 CENTAUR(C7M_794, 2000, 1148, 400, 844, 100), 843 CENTAUR(C7M_785, 1867, 1148, 533, 844, 133), 844 CENTAUR(C7M_784, 1800, 1148, 400, 844, 100), 845 CENTAUR(C7M_765, 1600, 1084, 533, 844, 133), 846 CENTAUR(C7M_764, 1600, 1084, 400, 844, 100), 847 CENTAUR(C7M_754, 1500, 1004, 400, 844, 100), 848 CENTAUR(C7M_775_ULV, 1500, 956, 400, 796, 100), 849 CENTAUR(C7M_771, 1200, 860, 400, 844, 100), 850 CENTAUR(C7M_772_ULV, 1200, 844, 400, 796, 100), 851 CENTAUR(C7M_779_ULV, 1000, 796, 400, 796, 100), 852 CENTAUR(C7M_770_ULV, 1000, 844, 400, 796, 100), 853 { 0, 0, NULL }, 854 }; 855 856 static void est_identify(driver_t *driver, device_t parent); 857 static int est_features(driver_t *driver, u_int *features); 858 static int est_probe(device_t parent); 859 static int est_attach(device_t parent); 860 static int est_detach(device_t parent); 861 static int est_get_info(device_t dev); 862 static int est_acpi_info(device_t dev, freq_info **freqs, 863 size_t *freqslen); 864 static int est_table_info(device_t dev, uint64_t msr, freq_info **freqs, 865 size_t *freqslen); 866 static int est_msr_info(device_t dev, uint64_t msr, freq_info **freqs, 867 size_t *freqslen); 868 static freq_info *est_get_current(freq_info *freq_list, size_t tablen); 869 static int est_settings(device_t dev, struct cf_setting *sets, int *count); 870 static int est_set(device_t dev, const struct cf_setting *set); 871 static int est_get(device_t dev, struct cf_setting *set); 872 static int est_type(device_t dev, int *type); 873 static int est_set_id16(device_t dev, uint16_t id16, int need_check); 874 static void est_get_id16(uint16_t *id16_p); 875 876 static device_method_t est_methods[] = { 877 /* Device interface */ 878 DEVMETHOD(device_identify, est_identify), 879 DEVMETHOD(device_probe, est_probe), 880 DEVMETHOD(device_attach, est_attach), 881 DEVMETHOD(device_detach, est_detach), 882 883 /* cpufreq interface */ 884 DEVMETHOD(cpufreq_drv_set, est_set), 885 DEVMETHOD(cpufreq_drv_get, est_get), 886 DEVMETHOD(cpufreq_drv_type, est_type), 887 DEVMETHOD(cpufreq_drv_settings, est_settings), 888 889 /* ACPI interface */ 890 DEVMETHOD(acpi_get_features, est_features), 891 892 {0, 0} 893 }; 894 895 static driver_t est_driver = { 896 "est", 897 est_methods, 898 sizeof(struct est_softc), 899 }; 900 901 static devclass_t est_devclass; 902 DRIVER_MODULE(est, cpu, est_driver, est_devclass, 0, 0); 903 MODULE_DEPEND(est, hwpstate_intel, 1, 1, 1); 904 905 static int 906 est_features(driver_t *driver, u_int *features) 907 { 908 909 /* 910 * Notify the ACPI CPU that we support direct access to MSRs. 911 * XXX C1 "I/O then Halt" seems necessary for some broken BIOS. 912 */ 913 *features = ACPI_CAP_PERF_MSRS | ACPI_CAP_C1_IO_HALT; 914 return (0); 915 } 916 917 static void 918 est_identify(driver_t *driver, device_t parent) 919 { 920 device_t child; 921 922 /* 923 * Defer to hwpstate if it is present. This priority logic 924 * should be replaced with normal newbus probing in the 925 * future. 926 */ 927 intel_hwpstate_identify(NULL, parent); 928 if (device_find_child(parent, "hwpstate_intel", -1) != NULL) 929 return; 930 931 /* Make sure we're not being doubly invoked. */ 932 if (device_find_child(parent, "est", -1) != NULL) 933 return; 934 935 /* Check that CPUID is supported and the vendor is Intel.*/ 936 if (cpu_high == 0 || (cpu_vendor_id != CPU_VENDOR_INTEL && 937 cpu_vendor_id != CPU_VENDOR_CENTAUR)) 938 return; 939 940 /* 941 * Check if the CPU supports EST. 942 */ 943 if (!(cpu_feature2 & CPUID2_EST)) 944 return; 945 946 /* 947 * We add a child for each CPU since settings must be performed 948 * on each CPU in the SMP case. 949 */ 950 child = BUS_ADD_CHILD(parent, 10, "est", -1); 951 if (child == NULL) 952 device_printf(parent, "add est child failed\n"); 953 } 954 955 static int 956 est_probe(device_t dev) 957 { 958 device_t perf_dev; 959 uint64_t msr; 960 int error, type; 961 962 if (resource_disabled("est", 0)) 963 return (ENXIO); 964 965 /* 966 * If the ACPI perf driver has attached and is not just offering 967 * info, let it manage things. 968 */ 969 perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", -1); 970 if (perf_dev && device_is_attached(perf_dev)) { 971 error = CPUFREQ_DRV_TYPE(perf_dev, &type); 972 if (error == 0 && (type & CPUFREQ_FLAG_INFO_ONLY) == 0) 973 return (ENXIO); 974 } 975 976 /* Attempt to enable SpeedStep if not currently enabled. */ 977 msr = rdmsr(MSR_MISC_ENABLE); 978 if ((msr & MSR_SS_ENABLE) == 0) { 979 wrmsr(MSR_MISC_ENABLE, msr | MSR_SS_ENABLE); 980 if (bootverbose) 981 device_printf(dev, "enabling SpeedStep\n"); 982 983 /* Check if the enable failed. */ 984 msr = rdmsr(MSR_MISC_ENABLE); 985 if ((msr & MSR_SS_ENABLE) == 0) { 986 device_printf(dev, "failed to enable SpeedStep\n"); 987 return (ENXIO); 988 } 989 } 990 991 device_set_desc(dev, "Enhanced SpeedStep Frequency Control"); 992 return (0); 993 } 994 995 static int 996 est_attach(device_t dev) 997 { 998 struct est_softc *sc; 999 1000 sc = device_get_softc(dev); 1001 sc->dev = dev; 1002 1003 /* On SMP system we can't guarantie independent freq setting. */ 1004 if (strict == -1 && mp_ncpus > 1) 1005 strict = 0; 1006 /* Check CPU for supported settings. */ 1007 if (est_get_info(dev)) 1008 return (ENXIO); 1009 1010 cpufreq_register(dev); 1011 return (0); 1012 } 1013 1014 static int 1015 est_detach(device_t dev) 1016 { 1017 struct est_softc *sc; 1018 int error; 1019 1020 error = cpufreq_unregister(dev); 1021 if (error) 1022 return (error); 1023 1024 sc = device_get_softc(dev); 1025 if (sc->acpi_settings || sc->msr_settings) 1026 free(sc->freq_list, M_DEVBUF); 1027 return (0); 1028 } 1029 1030 /* 1031 * Probe for supported CPU settings. First, check our static table of 1032 * settings. If no match, try using the ones offered by acpi_perf 1033 * (i.e., _PSS). We use ACPI second because some systems (IBM R/T40 1034 * series) export both legacy SMM IO-based access and direct MSR access 1035 * but the direct access specifies invalid values for _PSS. 1036 */ 1037 static int 1038 est_get_info(device_t dev) 1039 { 1040 struct est_softc *sc; 1041 uint64_t msr; 1042 int error; 1043 1044 sc = device_get_softc(dev); 1045 msr = rdmsr(MSR_PERF_STATUS); 1046 error = est_table_info(dev, msr, &sc->freq_list, &sc->flist_len); 1047 if (error) 1048 error = est_acpi_info(dev, &sc->freq_list, &sc->flist_len); 1049 if (error) 1050 error = est_msr_info(dev, msr, &sc->freq_list, &sc->flist_len); 1051 1052 if (error) { 1053 printf( 1054 "est: CPU supports Enhanced Speedstep, but is not recognized.\n" 1055 "est: cpu_vendor %s, msr %0jx\n", cpu_vendor, msr); 1056 return (ENXIO); 1057 } 1058 1059 return (0); 1060 } 1061 1062 static int 1063 est_acpi_info(device_t dev, freq_info **freqs, size_t *freqslen) 1064 { 1065 struct est_softc *sc; 1066 struct cf_setting *sets; 1067 freq_info *table; 1068 device_t perf_dev; 1069 int count, error, i, j; 1070 uint16_t saved_id16; 1071 1072 perf_dev = device_find_child(device_get_parent(dev), "acpi_perf", -1); 1073 if (perf_dev == NULL || !device_is_attached(perf_dev)) 1074 return (ENXIO); 1075 1076 /* Fetch settings from acpi_perf. */ 1077 sc = device_get_softc(dev); 1078 table = NULL; 1079 sets = malloc(MAX_SETTINGS * sizeof(*sets), M_TEMP, M_NOWAIT); 1080 if (sets == NULL) 1081 return (ENOMEM); 1082 count = MAX_SETTINGS; 1083 error = CPUFREQ_DRV_SETTINGS(perf_dev, sets, &count); 1084 if (error) 1085 goto out; 1086 1087 /* Parse settings into our local table format. */ 1088 table = malloc(count * sizeof(*table), M_DEVBUF, M_NOWAIT); 1089 if (table == NULL) { 1090 error = ENOMEM; 1091 goto out; 1092 } 1093 est_get_id16(&saved_id16); 1094 for (i = 0, j = 0; i < count; i++) { 1095 /* 1096 * Confirm id16 value is correct. 1097 */ 1098 if (sets[i].freq > 0) { 1099 error = est_set_id16(dev, sets[i].spec[0], strict); 1100 if (error != 0) { 1101 if (bootverbose) 1102 device_printf(dev, "Invalid freq %u, " 1103 "ignored.\n", sets[i].freq); 1104 continue; 1105 } 1106 table[j].freq = sets[i].freq; 1107 table[j].volts = sets[i].volts; 1108 table[j].id16 = sets[i].spec[0]; 1109 table[j].power = sets[i].power; 1110 ++j; 1111 } 1112 } 1113 /* restore saved setting */ 1114 est_set_id16(dev, saved_id16, 0); 1115 1116 sc->acpi_settings = TRUE; 1117 *freqs = table; 1118 *freqslen = j; 1119 error = 0; 1120 1121 out: 1122 if (sets) 1123 free(sets, M_TEMP); 1124 if (error && table) 1125 free(table, M_DEVBUF); 1126 return (error); 1127 } 1128 1129 static int 1130 est_table_info(device_t dev, uint64_t msr, freq_info **freqs, size_t *freqslen) 1131 { 1132 cpu_info *p; 1133 uint32_t id; 1134 1135 /* Find a table which matches (vendor, id32). */ 1136 id = msr >> 32; 1137 for (p = ESTprocs; p->id32 != 0; p++) { 1138 if (p->vendor_id == cpu_vendor_id && p->id32 == id) 1139 break; 1140 } 1141 if (p->id32 == 0) 1142 return (EOPNOTSUPP); 1143 1144 /* Make sure the current setpoint is valid. */ 1145 if (est_get_current(p->freqtab, p->tablen) == NULL) { 1146 device_printf(dev, "current setting not found in table\n"); 1147 return (EOPNOTSUPP); 1148 } 1149 1150 *freqs = p->freqtab; 1151 *freqslen = p->tablen; 1152 return (0); 1153 } 1154 1155 static int 1156 bus_speed_ok(int bus) 1157 { 1158 1159 switch (bus) { 1160 case 100: 1161 case 133: 1162 case 333: 1163 return (1); 1164 default: 1165 return (0); 1166 } 1167 } 1168 1169 /* 1170 * Flesh out a simple rate table containing the high and low frequencies 1171 * based on the current clock speed and the upper 32 bits of the MSR. 1172 */ 1173 static int 1174 est_msr_info(device_t dev, uint64_t msr, freq_info **freqs, size_t *freqslen) 1175 { 1176 struct est_softc *sc; 1177 freq_info *fp; 1178 int bus, freq, volts; 1179 uint16_t id; 1180 1181 if (!msr_info_enabled) 1182 return (EOPNOTSUPP); 1183 1184 /* Figure out the bus clock. */ 1185 freq = atomic_load_acq_64(&tsc_freq) / 1000000; 1186 id = msr >> 32; 1187 bus = freq / (id >> 8); 1188 device_printf(dev, "Guessed bus clock (high) of %d MHz\n", bus); 1189 if (!bus_speed_ok(bus)) { 1190 /* We may be running on the low frequency. */ 1191 id = msr >> 48; 1192 bus = freq / (id >> 8); 1193 device_printf(dev, "Guessed bus clock (low) of %d MHz\n", bus); 1194 if (!bus_speed_ok(bus)) 1195 return (EOPNOTSUPP); 1196 1197 /* Calculate high frequency. */ 1198 id = msr >> 32; 1199 freq = ((id >> 8) & 0xff) * bus; 1200 } 1201 1202 /* Fill out a new freq table containing just the high and low freqs. */ 1203 sc = device_get_softc(dev); 1204 fp = malloc(sizeof(freq_info) * 2, M_DEVBUF, M_WAITOK | M_ZERO); 1205 1206 /* First, the high frequency. */ 1207 volts = id & 0xff; 1208 if (volts != 0) { 1209 volts <<= 4; 1210 volts += 700; 1211 } 1212 fp[0].freq = freq; 1213 fp[0].volts = volts; 1214 fp[0].id16 = id; 1215 fp[0].power = CPUFREQ_VAL_UNKNOWN; 1216 device_printf(dev, "Guessed high setting of %d MHz @ %d Mv\n", freq, 1217 volts); 1218 1219 /* Second, the low frequency. */ 1220 id = msr >> 48; 1221 freq = ((id >> 8) & 0xff) * bus; 1222 volts = id & 0xff; 1223 if (volts != 0) { 1224 volts <<= 4; 1225 volts += 700; 1226 } 1227 fp[1].freq = freq; 1228 fp[1].volts = volts; 1229 fp[1].id16 = id; 1230 fp[1].power = CPUFREQ_VAL_UNKNOWN; 1231 device_printf(dev, "Guessed low setting of %d MHz @ %d Mv\n", freq, 1232 volts); 1233 1234 /* Table is already terminated due to M_ZERO. */ 1235 sc->msr_settings = TRUE; 1236 *freqs = fp; 1237 *freqslen = 2; 1238 return (0); 1239 } 1240 1241 static void 1242 est_get_id16(uint16_t *id16_p) 1243 { 1244 *id16_p = rdmsr(MSR_PERF_STATUS) & 0xffff; 1245 } 1246 1247 static int 1248 est_set_id16(device_t dev, uint16_t id16, int need_check) 1249 { 1250 uint64_t msr; 1251 uint16_t new_id16; 1252 int ret = 0; 1253 1254 /* Read the current register, mask out the old, set the new id. */ 1255 msr = rdmsr(MSR_PERF_CTL); 1256 msr = (msr & ~0xffff) | id16; 1257 wrmsr(MSR_PERF_CTL, msr); 1258 1259 if (need_check) { 1260 /* Wait a short while and read the new status. */ 1261 DELAY(EST_TRANS_LAT); 1262 est_get_id16(&new_id16); 1263 if (new_id16 != id16) { 1264 if (bootverbose) 1265 device_printf(dev, "Invalid id16 (set, cur) " 1266 "= (%u, %u)\n", id16, new_id16); 1267 ret = ENXIO; 1268 } 1269 } 1270 return (ret); 1271 } 1272 1273 static freq_info * 1274 est_get_current(freq_info *freq_list, size_t tablen) 1275 { 1276 freq_info *f; 1277 int i; 1278 uint16_t id16; 1279 1280 /* 1281 * Try a few times to get a valid value. Sometimes, if the CPU 1282 * is in the middle of an asynchronous transition (i.e., P4TCC), 1283 * we get a temporary invalid result. 1284 */ 1285 for (i = 0; i < 5; i++) { 1286 est_get_id16(&id16); 1287 for (f = freq_list; f < freq_list + tablen; f++) { 1288 if (f->id16 == id16) 1289 return (f); 1290 } 1291 DELAY(100); 1292 } 1293 return (NULL); 1294 } 1295 1296 static int 1297 est_settings(device_t dev, struct cf_setting *sets, int *count) 1298 { 1299 struct est_softc *sc; 1300 freq_info *f; 1301 int i; 1302 1303 sc = device_get_softc(dev); 1304 if (*count < EST_MAX_SETTINGS) 1305 return (E2BIG); 1306 1307 i = 0; 1308 for (f = sc->freq_list; f < sc->freq_list + sc->flist_len; f++, i++) { 1309 sets[i].freq = f->freq; 1310 sets[i].volts = f->volts; 1311 sets[i].power = f->power; 1312 sets[i].lat = EST_TRANS_LAT; 1313 sets[i].dev = dev; 1314 } 1315 *count = i; 1316 1317 return (0); 1318 } 1319 1320 static int 1321 est_set(device_t dev, const struct cf_setting *set) 1322 { 1323 struct est_softc *sc; 1324 freq_info *f; 1325 1326 /* Find the setting matching the requested one. */ 1327 sc = device_get_softc(dev); 1328 for (f = sc->freq_list; f < sc->freq_list + sc->flist_len; f++) { 1329 if (f->freq == set->freq) 1330 break; 1331 } 1332 if (f->freq == 0) 1333 return (EINVAL); 1334 1335 /* Read the current register, mask out the old, set the new id. */ 1336 est_set_id16(dev, f->id16, 0); 1337 1338 return (0); 1339 } 1340 1341 static int 1342 est_get(device_t dev, struct cf_setting *set) 1343 { 1344 struct est_softc *sc; 1345 freq_info *f; 1346 1347 sc = device_get_softc(dev); 1348 f = est_get_current(sc->freq_list, sc->flist_len); 1349 if (f == NULL) 1350 return (ENXIO); 1351 1352 set->freq = f->freq; 1353 set->volts = f->volts; 1354 set->power = f->power; 1355 set->lat = EST_TRANS_LAT; 1356 set->dev = dev; 1357 return (0); 1358 } 1359 1360 static int 1361 est_type(device_t dev, int *type) 1362 { 1363 1364 if (type == NULL) 1365 return (EINVAL); 1366 1367 *type = CPUFREQ_TYPE_ABSOLUTE; 1368 return (0); 1369 } 1370