Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-2009 coresystems GmbH |
| 5 | * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License as |
| 9 | * published by the Free Software Foundation; version 2 of |
| 10 | * the License. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
| 20 | * MA 02110-1301 USA |
| 21 | */ |
| 22 | |
| 23 | #include <console/console.h> |
| 24 | #include <device/device.h> |
| 25 | #include <device/pci.h> |
| 26 | #include <string.h> |
| 27 | #include <arch/acpi.h> |
| 28 | #include <cpu/cpu.h> |
| 29 | #include <cpu/x86/mtrr.h> |
| 30 | #include <cpu/x86/msr.h> |
| 31 | #include <cpu/x86/lapic.h> |
| 32 | #include <cpu/intel/microcode.h> |
| 33 | #include <cpu/intel/speedstep.h> |
| 34 | #include <cpu/intel/turbo.h> |
| 35 | #include <cpu/x86/cache.h> |
| 36 | #include <cpu/x86/name.h> |
| 37 | #include <pc80/mc146818rtc.h> |
| 38 | #include <usbdebug.h> |
| 39 | #include "model_206ax.h" |
| 40 | |
| 41 | /* |
| 42 | * List of suported C-states in this processor |
| 43 | * |
| 44 | * Latencies are typical worst-case package exit time in uS |
| 45 | * taken from the SandyBridge BIOS specification. |
| 46 | */ |
| 47 | static acpi_cstate_t cstate_map[] = { |
| 48 | { /* 0: C0 */ |
| 49 | },{ /* 1: C1 */ |
| 50 | .latency = 1, |
| 51 | .power = 1000, |
| 52 | .resource = { |
| 53 | .addrl = 0x00, /* MWAIT State 0 */ |
| 54 | .space_id = ACPI_ADDRESS_SPACE_FIXED, |
| 55 | .bit_width = ACPI_FFIXEDHW_VENDOR_INTEL, |
| 56 | .bit_offset = ACPI_FFIXEDHW_CLASS_MWAIT, |
| 57 | .resv = ACPI_FFIXEDHW_FLAG_HW_COORD, |
| 58 | } |
| 59 | }, |
| 60 | { /* 2: C1E */ |
| 61 | .latency = 1, |
| 62 | .power = 1000, |
| 63 | .resource = { |
| 64 | .addrl = 0x01, /* MWAIT State 0 Sub-state 1 */ |
| 65 | .space_id = ACPI_ADDRESS_SPACE_FIXED, |
| 66 | .bit_width = ACPI_FFIXEDHW_VENDOR_INTEL, |
| 67 | .bit_offset = ACPI_FFIXEDHW_CLASS_MWAIT, |
| 68 | .resv = ACPI_FFIXEDHW_FLAG_HW_COORD, |
| 69 | } |
| 70 | }, |
| 71 | { /* 3: C3 */ |
| 72 | .latency = 63, |
| 73 | .power = 500, |
| 74 | .resource = { |
| 75 | .addrl = 0x10, /* MWAIT State 1 */ |
| 76 | .space_id = ACPI_ADDRESS_SPACE_FIXED, |
| 77 | .bit_width = ACPI_FFIXEDHW_VENDOR_INTEL, |
| 78 | .bit_offset = ACPI_FFIXEDHW_CLASS_MWAIT, |
| 79 | .resv = ACPI_FFIXEDHW_FLAG_HW_COORD, |
| 80 | } |
| 81 | }, |
| 82 | { /* 4: C6 */ |
| 83 | .latency = 87, |
| 84 | .power = 350, |
| 85 | .resource = { |
| 86 | .addrl = 0x20, /* MWAIT State 2 */ |
| 87 | .space_id = ACPI_ADDRESS_SPACE_FIXED, |
| 88 | .bit_width = ACPI_FFIXEDHW_VENDOR_INTEL, |
| 89 | .bit_offset = ACPI_FFIXEDHW_CLASS_MWAIT, |
| 90 | .resv = ACPI_FFIXEDHW_FLAG_HW_COORD, |
| 91 | } |
| 92 | }, |
| 93 | { /* 5: C7 */ |
| 94 | .latency = 90, |
| 95 | .power = 200, |
| 96 | .resource = { |
| 97 | .addrl = 0x30, /* MWAIT State 3 */ |
| 98 | .space_id = ACPI_ADDRESS_SPACE_FIXED, |
| 99 | .bit_width = ACPI_FFIXEDHW_VENDOR_INTEL, |
| 100 | .bit_offset = ACPI_FFIXEDHW_CLASS_MWAIT, |
| 101 | .resv = ACPI_FFIXEDHW_FLAG_HW_COORD, |
| 102 | } |
| 103 | }, |
| 104 | { /* 6: C7S */ |
| 105 | .latency = 90, |
| 106 | .power = 200, |
| 107 | .resource = { |
| 108 | .addrl = 0x31, /* MWAIT State 3 Sub-state 1 */ |
| 109 | .space_id = ACPI_ADDRESS_SPACE_FIXED, |
| 110 | .bit_width = ACPI_FFIXEDHW_VENDOR_INTEL, |
| 111 | .bit_offset = ACPI_FFIXEDHW_CLASS_MWAIT, |
| 112 | .resv = ACPI_FFIXEDHW_FLAG_HW_COORD, |
| 113 | } |
| 114 | }, |
| 115 | { 0 } |
| 116 | }; |
| 117 | |
Vadim Bendebury | 537b4e0 | 2012-06-19 12:56:57 -0700 | [diff] [blame] | 118 | #if !CONFIG_MICROCODE_IN_CBFS |
Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 119 | static const uint32_t microcode_updates[] = { |
Vadim Bendebury | df0c822 | 2012-06-19 05:25:41 +0000 | [diff] [blame] | 120 | #include "microcode_blob.h" |
Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 121 | }; |
Vadim Bendebury | 537b4e0 | 2012-06-19 12:56:57 -0700 | [diff] [blame] | 122 | #endif |
Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 123 | |
Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 124 | /* Convert time in seconds to POWER_LIMIT_1_TIME MSR value */ |
| 125 | static const u8 power_limit_time_sec_to_msr[] = { |
| 126 | [0] = 0x00, |
| 127 | [1] = 0x0a, |
| 128 | [2] = 0x0b, |
| 129 | [3] = 0x4b, |
| 130 | [4] = 0x0c, |
| 131 | [5] = 0x2c, |
| 132 | [6] = 0x4c, |
| 133 | [7] = 0x6c, |
| 134 | [8] = 0x0d, |
| 135 | [10] = 0x2d, |
| 136 | [12] = 0x4d, |
| 137 | [14] = 0x6d, |
| 138 | [16] = 0x0e, |
| 139 | [20] = 0x2e, |
| 140 | [24] = 0x4e, |
| 141 | [28] = 0x6e, |
| 142 | [32] = 0x0f, |
| 143 | [40] = 0x2f, |
| 144 | [48] = 0x4f, |
| 145 | [56] = 0x6f, |
| 146 | [64] = 0x10, |
| 147 | [80] = 0x30, |
| 148 | [96] = 0x50, |
| 149 | [112] = 0x70, |
| 150 | [128] = 0x11, |
| 151 | }; |
| 152 | |
| 153 | /* Convert POWER_LIMIT_1_TIME MSR value to seconds */ |
| 154 | static const u8 power_limit_time_msr_to_sec[] = { |
| 155 | [0x00] = 0, |
| 156 | [0x0a] = 1, |
| 157 | [0x0b] = 2, |
| 158 | [0x4b] = 3, |
| 159 | [0x0c] = 4, |
| 160 | [0x2c] = 5, |
| 161 | [0x4c] = 6, |
| 162 | [0x6c] = 7, |
| 163 | [0x0d] = 8, |
| 164 | [0x2d] = 10, |
| 165 | [0x4d] = 12, |
| 166 | [0x6d] = 14, |
| 167 | [0x0e] = 16, |
| 168 | [0x2e] = 20, |
| 169 | [0x4e] = 24, |
| 170 | [0x6e] = 28, |
| 171 | [0x0f] = 32, |
| 172 | [0x2f] = 40, |
| 173 | [0x4f] = 48, |
| 174 | [0x6f] = 56, |
| 175 | [0x10] = 64, |
| 176 | [0x30] = 80, |
| 177 | [0x50] = 96, |
| 178 | [0x70] = 112, |
| 179 | [0x11] = 128, |
| 180 | }; |
| 181 | |
Duncan Laurie | 77dbbac | 2012-06-25 09:51:59 -0700 | [diff] [blame^] | 182 | int cpu_config_tdp_levels(void) |
| 183 | { |
| 184 | msr_t platform_info; |
| 185 | |
| 186 | /* Minimum CPU revision */ |
| 187 | if (cpuid_eax(1) < IVB_CONFIG_TDP_MIN_CPUID) |
| 188 | return 0; |
| 189 | |
| 190 | /* Bits 34:33 indicate how many levels supported */ |
| 191 | platform_info = rdmsr(MSR_PLATFORM_INFO); |
| 192 | return (platform_info.hi >> 1) & 3; |
| 193 | } |
| 194 | |
Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 195 | /* |
| 196 | * Configure processor power limits if possible |
| 197 | * This must be done AFTER set of BIOS_RESET_CPL |
| 198 | */ |
| 199 | void set_power_limits(u8 power_limit_1_time) |
| 200 | { |
| 201 | msr_t msr = rdmsr(MSR_PLATFORM_INFO); |
| 202 | msr_t limit; |
| 203 | unsigned power_unit; |
| 204 | unsigned tdp, min_power, max_power, max_time; |
| 205 | u8 power_limit_1_val; |
| 206 | |
| 207 | if (power_limit_1_time > ARRAY_SIZE(power_limit_time_sec_to_msr)) |
| 208 | return; |
| 209 | |
| 210 | if (!(msr.lo & PLATFORM_INFO_SET_TDP)) |
| 211 | return; |
| 212 | |
| 213 | /* Get units */ |
| 214 | msr = rdmsr(MSR_PKG_POWER_SKU_UNIT); |
| 215 | power_unit = 2 << ((msr.lo & 0xf) - 1); |
| 216 | |
| 217 | /* Get power defaults for this SKU */ |
| 218 | msr = rdmsr(MSR_PKG_POWER_SKU); |
| 219 | tdp = msr.lo & 0x7fff; |
| 220 | min_power = (msr.lo >> 16) & 0x7fff; |
| 221 | max_power = msr.hi & 0x7fff; |
| 222 | max_time = (msr.hi >> 16) & 0x7f; |
| 223 | |
| 224 | printk(BIOS_DEBUG, "CPU TDP: %u Watts\n", tdp / power_unit); |
| 225 | |
| 226 | if (power_limit_time_msr_to_sec[max_time] > power_limit_1_time) |
| 227 | power_limit_1_time = power_limit_time_msr_to_sec[max_time]; |
| 228 | |
| 229 | if (min_power > 0 && tdp < min_power) |
| 230 | tdp = min_power; |
| 231 | |
| 232 | if (max_power > 0 && tdp > max_power) |
| 233 | tdp = max_power; |
| 234 | |
| 235 | power_limit_1_val = power_limit_time_sec_to_msr[power_limit_1_time]; |
| 236 | |
| 237 | /* Set long term power limit to TDP */ |
| 238 | limit.lo = 0; |
| 239 | limit.lo |= tdp & PKG_POWER_LIMIT_MASK; |
| 240 | limit.lo |= PKG_POWER_LIMIT_EN; |
| 241 | limit.lo |= (power_limit_1_val & PKG_POWER_LIMIT_TIME_MASK) << |
| 242 | PKG_POWER_LIMIT_TIME_SHIFT; |
| 243 | |
| 244 | /* Set short term power limit to 1.25 * TDP */ |
| 245 | limit.hi = 0; |
| 246 | limit.hi |= ((tdp * 125) / 100) & PKG_POWER_LIMIT_MASK; |
| 247 | limit.hi |= PKG_POWER_LIMIT_EN; |
| 248 | /* Power limit 2 time is only programmable on SNB EP/EX */ |
| 249 | |
| 250 | wrmsr(MSR_PKG_POWER_LIMIT, limit); |
Duncan Laurie | 77dbbac | 2012-06-25 09:51:59 -0700 | [diff] [blame^] | 251 | |
| 252 | /* Use nominal TDP values for CPUs with configurable TDP */ |
| 253 | if (cpu_config_tdp_levels()) { |
| 254 | msr = rdmsr(MSR_CONFIG_TDP_NOMINAL); |
| 255 | limit.hi = 0; |
| 256 | limit.lo = msr.lo & 0xff; |
| 257 | wrmsr(MSR_TURBO_ACTIVATION_RATIO, limit); |
| 258 | } |
Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 259 | } |
| 260 | |
| 261 | static void configure_c_states(void) |
| 262 | { |
| 263 | msr_t msr; |
| 264 | |
| 265 | msr = rdmsr(MSR_PMG_CST_CONFIG_CONTROL); |
| 266 | msr.lo |= (1 << 28); // C1 Auto Undemotion Enable |
| 267 | msr.lo |= (1 << 27); // C3 Auto Undemotion Enable |
| 268 | msr.lo |= (1 << 26); // C1 Auto Demotion Enable |
| 269 | msr.lo |= (1 << 25); // C3 Auto Demotion Enable |
| 270 | msr.lo &= ~(1 << 10); // Disable IO MWAIT redirection |
| 271 | msr.lo |= 7; // No package C-state limit |
| 272 | wrmsr(MSR_PMG_CST_CONFIG_CONTROL, msr); |
| 273 | |
| 274 | msr = rdmsr(MSR_PMG_IO_CAPTURE_BASE); |
| 275 | msr.lo &= ~0x7ffff; |
| 276 | msr.lo |= (PMB0_BASE + 4); // LVL_2 base address |
| 277 | msr.lo |= (2 << 16); // CST Range: C7 is max C-state |
| 278 | wrmsr(MSR_PMG_IO_CAPTURE_BASE, msr); |
| 279 | |
| 280 | msr = rdmsr(MSR_MISC_PWR_MGMT); |
| 281 | msr.lo &= ~(1 << 0); // Enable P-state HW_ALL coordination |
| 282 | wrmsr(MSR_MISC_PWR_MGMT, msr); |
| 283 | |
| 284 | msr = rdmsr(MSR_POWER_CTL); |
| 285 | msr.lo |= (1 << 18); // Enable Energy Perf Bias MSR 0x1b0 |
| 286 | msr.lo |= (1 << 1); // C1E Enable |
| 287 | msr.lo |= (1 << 0); // Bi-directional PROCHOT# |
| 288 | wrmsr(MSR_POWER_CTL, msr); |
| 289 | |
| 290 | /* C3 Interrupt Response Time Limit */ |
| 291 | msr.hi = 0; |
| 292 | msr.lo = IRTL_VALID | IRTL_1024_NS | 0x50; |
| 293 | wrmsr(MSR_PKGC3_IRTL, msr); |
| 294 | |
| 295 | /* C6 Interrupt Response Time Limit */ |
| 296 | msr.hi = 0; |
| 297 | msr.lo = IRTL_VALID | IRTL_1024_NS | 0x68; |
| 298 | wrmsr(MSR_PKGC6_IRTL, msr); |
| 299 | |
| 300 | /* C7 Interrupt Response Time Limit */ |
| 301 | msr.hi = 0; |
| 302 | msr.lo = IRTL_VALID | IRTL_1024_NS | 0x6D; |
| 303 | wrmsr(MSR_PKGC7_IRTL, msr); |
| 304 | |
| 305 | /* Primary Plane Current Limit */ |
| 306 | msr = rdmsr(MSR_PP0_CURRENT_CONFIG); |
| 307 | msr.lo &= ~0x1fff; |
| 308 | msr.lo |= PP0_CURRENT_LIMIT; |
| 309 | wrmsr(MSR_PP0_CURRENT_CONFIG, msr); |
| 310 | |
| 311 | /* Secondary Plane Current Limit */ |
| 312 | msr = rdmsr(MSR_PP1_CURRENT_CONFIG); |
| 313 | msr.lo &= ~0x1fff; |
| 314 | msr.lo |= PP1_CURRENT_LIMIT; |
| 315 | wrmsr(MSR_PP1_CURRENT_CONFIG, msr); |
| 316 | } |
| 317 | |
| 318 | static void configure_misc(void) |
| 319 | { |
| 320 | msr_t msr; |
| 321 | |
| 322 | msr = rdmsr(IA32_MISC_ENABLE); |
| 323 | msr.lo |= (1 << 0); /* Fast String enable */ |
| 324 | msr.lo |= (1 << 3); /* TM1/TM2/EMTTM enable */ |
| 325 | msr.lo |= (1 << 16); /* Enhanced SpeedStep Enable */ |
| 326 | wrmsr(IA32_MISC_ENABLE, msr); |
| 327 | |
| 328 | /* Disable Thermal interrupts */ |
| 329 | msr.lo = 0; |
| 330 | msr.hi = 0; |
| 331 | wrmsr(IA32_THERM_INTERRUPT, msr); |
| 332 | |
| 333 | /* Enable package critical interrupt only */ |
| 334 | msr.lo = 1 << 4; |
| 335 | msr.hi = 0; |
| 336 | wrmsr(IA32_PACKAGE_THERM_INTERRUPT, msr); |
| 337 | } |
| 338 | |
| 339 | static void enable_lapic_tpr(void) |
| 340 | { |
| 341 | msr_t msr; |
| 342 | |
| 343 | msr = rdmsr(MSR_PIC_MSG_CONTROL); |
| 344 | msr.lo &= ~(1 << 10); /* Enable APIC TPR updates */ |
| 345 | wrmsr(MSR_PIC_MSG_CONTROL, msr); |
| 346 | } |
| 347 | |
| 348 | static void configure_dca_cap(void) |
| 349 | { |
| 350 | struct cpuid_result cpuid_regs; |
| 351 | msr_t msr; |
| 352 | |
| 353 | /* Check feature flag in CPUID.(EAX=1):ECX[18]==1 */ |
| 354 | cpuid_regs = cpuid(1); |
| 355 | if (cpuid_regs.ecx & (1 << 18)) { |
| 356 | msr = rdmsr(IA32_PLATFORM_DCA_CAP); |
| 357 | msr.lo |= 1; |
| 358 | wrmsr(IA32_PLATFORM_DCA_CAP, msr); |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | static void set_max_ratio(void) |
| 363 | { |
Duncan Laurie | 77dbbac | 2012-06-25 09:51:59 -0700 | [diff] [blame^] | 364 | msr_t msr, perf_ctl; |
Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 365 | |
Duncan Laurie | 77dbbac | 2012-06-25 09:51:59 -0700 | [diff] [blame^] | 366 | perf_ctl.hi = 0; |
| 367 | |
| 368 | /* Check for configurable TDP option */ |
| 369 | if (cpu_config_tdp_levels()) { |
| 370 | /* Set to nominal TDP ratio */ |
| 371 | msr = rdmsr(MSR_CONFIG_TDP_NOMINAL); |
| 372 | perf_ctl.lo = (msr.lo & 0xff) << 8; |
| 373 | } else { |
| 374 | /* Platform Info bits 15:8 give max ratio */ |
| 375 | msr = rdmsr(MSR_PLATFORM_INFO); |
| 376 | perf_ctl.lo = msr.lo & 0xff00; |
| 377 | } |
| 378 | wrmsr(IA32_PERF_CTL, perf_ctl); |
Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 379 | |
| 380 | printk(BIOS_DEBUG, "model_x06ax: frequency set to %d\n", |
Duncan Laurie | 77dbbac | 2012-06-25 09:51:59 -0700 | [diff] [blame^] | 381 | ((perf_ctl.lo >> 8) & 0xff) * SANDYBRIDGE_BCLK); |
Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 382 | } |
| 383 | |
| 384 | static void set_energy_perf_bias(u8 policy) |
| 385 | { |
| 386 | msr_t msr; |
| 387 | |
| 388 | /* Energy Policy is bits 3:0 */ |
| 389 | msr = rdmsr(IA32_ENERGY_PERFORMANCE_BIAS); |
| 390 | msr.lo &= ~0xf; |
| 391 | msr.lo |= policy & 0xf; |
| 392 | wrmsr(IA32_ENERGY_PERFORMANCE_BIAS, msr); |
| 393 | |
| 394 | printk(BIOS_DEBUG, "model_x06ax: energy policy set to %u\n", |
| 395 | policy); |
| 396 | } |
| 397 | |
| 398 | static void configure_mca(void) |
| 399 | { |
| 400 | msr_t msr; |
| 401 | int i; |
| 402 | |
| 403 | msr.lo = msr.hi = 0; |
| 404 | /* This should only be done on a cold boot */ |
| 405 | for (i = 0; i < 7; i++) |
| 406 | wrmsr(IA32_MC0_STATUS + (i * 4), msr); |
| 407 | } |
| 408 | |
| 409 | #if CONFIG_USBDEBUG |
| 410 | static unsigned ehci_debug_addr; |
| 411 | #endif |
| 412 | |
Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 413 | static void model_206ax_init(device_t cpu) |
| 414 | { |
| 415 | char processor_name[49]; |
| 416 | struct cpuid_result cpuid_regs; |
| 417 | |
| 418 | /* Turn on caching if we haven't already */ |
| 419 | x86_enable_cache(); |
| 420 | |
Vadim Bendebury | 537b4e0 | 2012-06-19 12:56:57 -0700 | [diff] [blame] | 421 | #if CONFIG_MICROCODE_IN_CBFS |
| 422 | intel_update_microcode_from_cbfs(); |
| 423 | #else |
Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 424 | intel_update_microcode(microcode_updates); |
Vadim Bendebury | 537b4e0 | 2012-06-19 12:56:57 -0700 | [diff] [blame] | 425 | #endif |
Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 426 | |
| 427 | /* Clear out pending MCEs */ |
| 428 | configure_mca(); |
| 429 | |
| 430 | /* Print processor name */ |
| 431 | fill_processor_name(processor_name); |
| 432 | printk(BIOS_INFO, "CPU: %s.\n", processor_name); |
| 433 | |
| 434 | #if CONFIG_USBDEBUG |
| 435 | // Is this caution really needed? |
| 436 | if(!ehci_debug_addr) |
| 437 | ehci_debug_addr = get_ehci_debug(); |
| 438 | set_ehci_debug(0); |
| 439 | #endif |
| 440 | |
| 441 | /* Setup MTRRs based on physical address size */ |
| 442 | cpuid_regs = cpuid(0x80000008); |
| 443 | x86_setup_fixed_mtrrs(); |
| 444 | x86_setup_var_mtrrs(cpuid_regs.eax & 0xff, 2); |
| 445 | x86_mtrr_check(); |
| 446 | |
| 447 | /* Setup Page Attribute Tables (PAT) */ |
| 448 | // TODO set up PAT |
| 449 | |
| 450 | #if CONFIG_USBDEBUG |
| 451 | set_ehci_debug(ehci_debug_addr); |
| 452 | #endif |
| 453 | |
| 454 | /* Enable the local cpu apics */ |
| 455 | enable_lapic_tpr(); |
| 456 | setup_lapic(); |
| 457 | |
Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 458 | /* Configure C States */ |
| 459 | configure_c_states(); |
| 460 | |
| 461 | /* Configure Enhanced SpeedStep and Thermal Sensors */ |
| 462 | configure_misc(); |
| 463 | |
| 464 | /* Enable Direct Cache Access */ |
| 465 | configure_dca_cap(); |
| 466 | |
| 467 | /* Set energy policy */ |
| 468 | set_energy_perf_bias(ENERGY_POLICY_NORMAL); |
| 469 | |
| 470 | /* Set Max Ratio */ |
| 471 | set_max_ratio(); |
| 472 | |
| 473 | /* Enable Turbo */ |
| 474 | enable_turbo(); |
Stefan Reinauer | 5c55463 | 2012-04-04 00:09:50 +0200 | [diff] [blame] | 475 | } |
| 476 | |
| 477 | static struct device_operations cpu_dev_ops = { |
| 478 | .init = model_206ax_init, |
| 479 | }; |
| 480 | |
| 481 | static struct cpu_device_id cpu_table[] = { |
| 482 | { X86_VENDOR_INTEL, 0x206a0 }, /* Intel Sandybridge */ |
| 483 | { X86_VENDOR_INTEL, 0x206a6 }, /* Intel Sandybridge D1 */ |
| 484 | { X86_VENDOR_INTEL, 0x206a7 }, /* Intel Sandybridge D2/J1 */ |
| 485 | { X86_VENDOR_INTEL, 0x306a2 }, /* Intel IvyBridge */ |
| 486 | { X86_VENDOR_INTEL, 0x306a4 }, /* Intel IvyBridge */ |
| 487 | { X86_VENDOR_INTEL, 0x306a5 }, /* Intel IvyBridge */ |
| 488 | { X86_VENDOR_INTEL, 0x306a6 }, /* Intel IvyBridge */ |
| 489 | { X86_VENDOR_INTEL, 0x306a8 }, /* Intel IvyBridge */ |
| 490 | { X86_VENDOR_INTEL, 0x306a9 }, /* Intel IvyBridge */ |
| 491 | { 0, 0 }, |
| 492 | }; |
| 493 | |
| 494 | static const struct cpu_driver driver __cpu_driver = { |
| 495 | .ops = &cpu_dev_ops, |
| 496 | .id_table = cpu_table, |
| 497 | .cstates = cstate_map, |
| 498 | }; |
| 499 | |