Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation; version 2 of |
| 7 | * the License. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 13 | */ |
| 14 | |
| 15 | #include <types.h> |
| 16 | #include <console/console.h> |
| 17 | #include <arch/acpi.h> |
| 18 | #include <arch/acpigen.h> |
| 19 | #include <arch/cpu.h> |
| 20 | #include <cpu/x86/msr.h> |
| 21 | #include <cpu/intel/speedstep.h> |
| 22 | #include <cpu/intel/turbo.h> |
| 23 | #include <device/device.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 24 | #include "haswell.h" |
| 25 | #include "chip.h" |
| 26 | |
Duncan Laurie | 1ad5564 | 2013-03-07 14:08:04 -0800 | [diff] [blame] | 27 | #include <southbridge/intel/lynxpoint/pch.h> |
| 28 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 29 | static int get_cores_per_package(void) |
| 30 | { |
| 31 | struct cpuinfo_x86 c; |
| 32 | struct cpuid_result result; |
| 33 | int cores = 1; |
| 34 | |
| 35 | get_fms(&c, cpuid_eax(1)); |
| 36 | if (c.x86 != 6) |
| 37 | return 1; |
| 38 | |
| 39 | result = cpuid_ext(0xb, 1); |
| 40 | cores = result.ebx & 0xff; |
| 41 | |
| 42 | return cores; |
| 43 | } |
| 44 | |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 45 | static void generate_cstate_entries(acpi_cstate_t *cstates, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 46 | int c1, int c2, int c3) |
| 47 | { |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 48 | int cstate_count = 0; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 49 | |
| 50 | /* Count number of active C-states */ |
| 51 | if (c1 > 0) |
| 52 | ++cstate_count; |
| 53 | if (c2 > 0) |
| 54 | ++cstate_count; |
| 55 | if (c3 > 0) |
| 56 | ++cstate_count; |
| 57 | if (!cstate_count) |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 58 | return; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 59 | |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 60 | acpigen_write_package(cstate_count + 1); |
| 61 | acpigen_write_byte(cstate_count); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 62 | |
| 63 | /* Add an entry if the level is enabled */ |
| 64 | if (c1 > 0) { |
| 65 | cstates[c1].ctype = 1; |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 66 | acpigen_write_CST_package_entry(&cstates[c1]); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 67 | } |
| 68 | if (c2 > 0) { |
| 69 | cstates[c2].ctype = 2; |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 70 | acpigen_write_CST_package_entry(&cstates[c2]); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 71 | } |
| 72 | if (c3 > 0) { |
| 73 | cstates[c3].ctype = 3; |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 74 | acpigen_write_CST_package_entry(&cstates[c3]); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 75 | } |
| 76 | |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 77 | acpigen_pop_len(); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 78 | } |
| 79 | |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 80 | static void generate_C_state_entries(void) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 81 | { |
| 82 | struct cpu_info *info; |
| 83 | struct cpu_driver *cpu; |
Edward O'Callaghan | 2c9d2cf | 2014-10-27 23:29:29 +1100 | [diff] [blame] | 84 | struct device *lapic; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 85 | struct cpu_intel_haswell_config *conf = NULL; |
| 86 | |
| 87 | /* Find the SpeedStep CPU in the device tree using magic APIC ID */ |
| 88 | lapic = dev_find_lapic(SPEEDSTEP_APIC_MAGIC); |
| 89 | if (!lapic) |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 90 | return; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 91 | conf = lapic->chip_info; |
| 92 | if (!conf) |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 93 | return; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 94 | |
| 95 | /* Find CPU map of supported C-states */ |
| 96 | info = cpu_info(); |
| 97 | if (!info) |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 98 | return; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 99 | cpu = find_cpu_driver(info->cpu); |
| 100 | if (!cpu || !cpu->cstates) |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 101 | return; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 102 | |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 103 | acpigen_emit_byte(0x14); /* MethodOp */ |
| 104 | acpigen_write_len_f(); /* PkgLength */ |
| 105 | acpigen_emit_namestring("_CST"); |
| 106 | acpigen_emit_byte(0x00); /* No Arguments */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 107 | |
| 108 | /* If running on AC power */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 109 | acpigen_emit_byte(0xa0); /* IfOp */ |
| 110 | acpigen_write_len_f(); /* PkgLength */ |
| 111 | acpigen_emit_namestring("PWRS"); |
| 112 | acpigen_emit_byte(0xa4); /* ReturnOp */ |
| 113 | generate_cstate_entries(cpu->cstates, conf->c1_acpower, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 114 | conf->c2_acpower, conf->c3_acpower); |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 115 | acpigen_pop_len(); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 116 | |
| 117 | /* Else on battery power */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 118 | acpigen_emit_byte(0xa4); /* ReturnOp */ |
| 119 | generate_cstate_entries(cpu->cstates, conf->c1_battery, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 120 | conf->c2_battery, conf->c3_battery); |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 121 | acpigen_pop_len(); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | static acpi_tstate_t tss_table_fine[] = { |
| 125 | { 100, 1000, 0, 0x00, 0 }, |
| 126 | { 94, 940, 0, 0x1f, 0 }, |
| 127 | { 88, 880, 0, 0x1e, 0 }, |
| 128 | { 82, 820, 0, 0x1d, 0 }, |
| 129 | { 75, 760, 0, 0x1c, 0 }, |
| 130 | { 69, 700, 0, 0x1b, 0 }, |
| 131 | { 63, 640, 0, 0x1a, 0 }, |
| 132 | { 57, 580, 0, 0x19, 0 }, |
| 133 | { 50, 520, 0, 0x18, 0 }, |
| 134 | { 44, 460, 0, 0x17, 0 }, |
| 135 | { 38, 400, 0, 0x16, 0 }, |
| 136 | { 32, 340, 0, 0x15, 0 }, |
| 137 | { 25, 280, 0, 0x14, 0 }, |
| 138 | { 19, 220, 0, 0x13, 0 }, |
| 139 | { 13, 160, 0, 0x12, 0 }, |
| 140 | }; |
| 141 | |
| 142 | static acpi_tstate_t tss_table_coarse[] = { |
| 143 | { 100, 1000, 0, 0x00, 0 }, |
| 144 | { 88, 875, 0, 0x1f, 0 }, |
| 145 | { 75, 750, 0, 0x1e, 0 }, |
| 146 | { 63, 625, 0, 0x1d, 0 }, |
| 147 | { 50, 500, 0, 0x1c, 0 }, |
| 148 | { 38, 375, 0, 0x1b, 0 }, |
| 149 | { 25, 250, 0, 0x1a, 0 }, |
| 150 | { 13, 125, 0, 0x19, 0 }, |
| 151 | }; |
| 152 | |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 153 | static void generate_T_state_entries(int core, int cores_per_package) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 154 | { |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 155 | /* Indicate SW_ALL coordination for T-states */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 156 | acpigen_write_TSD_package(core, cores_per_package, SW_ALL); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 157 | |
| 158 | /* Indicate FFixedHW so OS will use MSR */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 159 | acpigen_write_empty_PTC(); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 160 | |
| 161 | /* Set a T-state limit that can be modified in NVS */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 162 | acpigen_write_TPC("\\TLVL"); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 163 | |
| 164 | /* |
| 165 | * CPUID.(EAX=6):EAX[5] indicates support |
| 166 | * for extended throttle levels. |
| 167 | */ |
| 168 | if (cpuid_eax(6) & (1 << 5)) |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 169 | acpigen_write_TSS_package( |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 170 | ARRAY_SIZE(tss_table_fine), tss_table_fine); |
| 171 | else |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 172 | acpigen_write_TSS_package( |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 173 | ARRAY_SIZE(tss_table_coarse), tss_table_coarse); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 174 | } |
| 175 | |
| 176 | static int calculate_power(int tdp, int p1_ratio, int ratio) |
| 177 | { |
| 178 | u32 m; |
| 179 | u32 power; |
| 180 | |
| 181 | /* |
| 182 | * M = ((1.1 - ((p1_ratio - ratio) * 0.00625)) / 1.1) ^ 2 |
| 183 | * |
| 184 | * Power = (ratio / p1_ratio) * m * tdp |
| 185 | */ |
| 186 | |
| 187 | m = (110000 - ((p1_ratio - ratio) * 625)) / 11; |
| 188 | m = (m * m) / 1000; |
| 189 | |
| 190 | power = ((ratio * 100000 / p1_ratio) / 100); |
| 191 | power *= (m / 100) * (tdp / 1000); |
| 192 | power /= 1000; |
| 193 | |
| 194 | return (int)power; |
| 195 | } |
| 196 | |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 197 | static void generate_P_state_entries(int core, int cores_per_package) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 198 | { |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 199 | int ratio_min, ratio_max, ratio_turbo, ratio_step; |
| 200 | int coord_type, power_max, power_unit, num_entries; |
| 201 | int ratio, power, clock, clock_max; |
| 202 | msr_t msr; |
| 203 | |
| 204 | /* Determine P-state coordination type from MISC_PWR_MGMT[0] */ |
| 205 | msr = rdmsr(MSR_MISC_PWR_MGMT); |
| 206 | if (msr.lo & MISC_PWR_MGMT_EIST_HW_DIS) |
| 207 | coord_type = SW_ANY; |
| 208 | else |
| 209 | coord_type = HW_ALL; |
| 210 | |
| 211 | /* Get bus ratio limits and calculate clock speeds */ |
| 212 | msr = rdmsr(MSR_PLATFORM_INFO); |
| 213 | ratio_min = (msr.hi >> (40-32)) & 0xff; /* Max Efficiency Ratio */ |
| 214 | |
| 215 | /* Determine if this CPU has configurable TDP */ |
| 216 | if (cpu_config_tdp_levels()) { |
| 217 | /* Set max ratio to nominal TDP ratio */ |
| 218 | msr = rdmsr(MSR_CONFIG_TDP_NOMINAL); |
| 219 | ratio_max = msr.lo & 0xff; |
| 220 | } else { |
| 221 | /* Max Non-Turbo Ratio */ |
| 222 | ratio_max = (msr.lo >> 8) & 0xff; |
| 223 | } |
| 224 | clock_max = ratio_max * HASWELL_BCLK; |
| 225 | |
| 226 | /* Calculate CPU TDP in mW */ |
| 227 | msr = rdmsr(MSR_PKG_POWER_SKU_UNIT); |
| 228 | power_unit = 2 << ((msr.lo & 0xf) - 1); |
| 229 | msr = rdmsr(MSR_PKG_POWER_SKU); |
| 230 | power_max = ((msr.lo & 0x7fff) / power_unit) * 1000; |
| 231 | |
| 232 | /* Write _PCT indicating use of FFixedHW */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 233 | acpigen_write_empty_PCT(); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 234 | |
| 235 | /* Write _PPC with no limit on supported P-state */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 236 | acpigen_write_PPC_NVS(); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 237 | |
| 238 | /* Write PSD indicating configured coordination type */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 239 | acpigen_write_PSD_package(core, 1, coord_type); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 240 | |
| 241 | /* Add P-state entries in _PSS table */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 242 | acpigen_write_name("_PSS"); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 243 | |
| 244 | /* Determine ratio points */ |
| 245 | ratio_step = PSS_RATIO_STEP; |
| 246 | num_entries = (ratio_max - ratio_min) / ratio_step; |
| 247 | while (num_entries > PSS_MAX_ENTRIES-1) { |
| 248 | ratio_step <<= 1; |
| 249 | num_entries >>= 1; |
| 250 | } |
| 251 | |
| 252 | /* P[T] is Turbo state if enabled */ |
| 253 | if (get_turbo_state() == TURBO_ENABLED) { |
| 254 | /* _PSS package count including Turbo */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 255 | acpigen_write_package(num_entries + 2); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 256 | |
| 257 | msr = rdmsr(MSR_TURBO_RATIO_LIMIT); |
| 258 | ratio_turbo = msr.lo & 0xff; |
| 259 | |
| 260 | /* Add entry for Turbo ratio */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 261 | acpigen_write_PSS_package( |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 262 | clock_max + 1, /*MHz*/ |
| 263 | power_max, /*mW*/ |
| 264 | PSS_LATENCY_TRANSITION, /*lat1*/ |
| 265 | PSS_LATENCY_BUSMASTER, /*lat2*/ |
| 266 | ratio_turbo << 8, /*control*/ |
| 267 | ratio_turbo << 8); /*status*/ |
| 268 | } else { |
| 269 | /* _PSS package count without Turbo */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 270 | acpigen_write_package(num_entries + 1); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | /* First regular entry is max non-turbo ratio */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 274 | acpigen_write_PSS_package( |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 275 | clock_max, /*MHz*/ |
| 276 | power_max, /*mW*/ |
| 277 | PSS_LATENCY_TRANSITION, /*lat1*/ |
| 278 | PSS_LATENCY_BUSMASTER, /*lat2*/ |
| 279 | ratio_max << 8, /*control*/ |
| 280 | ratio_max << 8); /*status*/ |
| 281 | |
| 282 | /* Generate the remaining entries */ |
| 283 | for (ratio = ratio_min + ((num_entries - 1) * ratio_step); |
| 284 | ratio >= ratio_min; ratio -= ratio_step) { |
| 285 | |
| 286 | /* Calculate power at this ratio */ |
| 287 | power = calculate_power(power_max, ratio_max, ratio); |
| 288 | clock = ratio * HASWELL_BCLK; |
| 289 | |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 290 | acpigen_write_PSS_package( |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 291 | clock, /*MHz*/ |
| 292 | power, /*mW*/ |
| 293 | PSS_LATENCY_TRANSITION, /*lat1*/ |
| 294 | PSS_LATENCY_BUSMASTER, /*lat2*/ |
| 295 | ratio << 8, /*control*/ |
| 296 | ratio << 8); /*status*/ |
| 297 | } |
| 298 | |
| 299 | /* Fix package length */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 300 | acpigen_pop_len(); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 301 | } |
| 302 | |
Elyes HAOUAS | f925c56 | 2018-02-08 13:05:16 +0100 | [diff] [blame] | 303 | void generate_cpu_entries(struct device *device) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 304 | { |
Duncan Laurie | 1ad5564 | 2013-03-07 14:08:04 -0800 | [diff] [blame] | 305 | int coreID, cpuID, pcontrol_blk = get_pmbase(), plen = 6; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 306 | int totalcores = dev_count_cpu(); |
| 307 | int cores_per_package = get_cores_per_package(); |
| 308 | int numcpus = totalcores/cores_per_package; |
| 309 | |
| 310 | printk(BIOS_DEBUG, "Found %d CPU(s) with %d core(s) each.\n", |
| 311 | numcpus, cores_per_package); |
| 312 | |
Martin Roth | 9944b28 | 2014-08-11 11:24:55 -0600 | [diff] [blame] | 313 | for (cpuID = 1; cpuID <= numcpus; cpuID++) { |
Lee Leahy | 9d62e7e | 2017-03-15 17:40:50 -0700 | [diff] [blame] | 314 | for (coreID = 1; coreID <= cores_per_package; coreID++) { |
| 315 | if (coreID > 1) { |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 316 | pcontrol_blk = 0; |
| 317 | plen = 0; |
| 318 | } |
| 319 | |
Christian Walter | be3979c | 2019-12-18 15:07:59 +0100 | [diff] [blame^] | 320 | /* Generate processor \_SB.CPUx */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 321 | acpigen_write_processor( |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 322 | (cpuID-1)*cores_per_package+coreID-1, |
| 323 | pcontrol_blk, plen); |
| 324 | |
| 325 | /* Generate P-state tables */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 326 | generate_P_state_entries( |
Duncan Laurie | 25b8b7b | 2013-04-19 10:02:23 -0700 | [diff] [blame] | 327 | coreID-1, cores_per_package); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 328 | |
| 329 | /* Generate C-state tables */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 330 | generate_C_state_entries(); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 331 | |
| 332 | /* Generate T-state tables */ |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 333 | generate_T_state_entries( |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 334 | cpuID-1, cores_per_package); |
| 335 | |
Vladimir Serbinenko | be0fd0a | 2014-11-04 21:10:59 +0100 | [diff] [blame] | 336 | acpigen_pop_len(); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 337 | } |
| 338 | } |
Arthur Heymans | c54d14f | 2018-11-28 12:09:23 +0100 | [diff] [blame] | 339 | |
| 340 | /* PPKG is usually used for thermal management |
| 341 | of the first and only package. */ |
| 342 | acpigen_write_processor_package("PPKG", 0, cores_per_package); |
| 343 | |
| 344 | /* Add a method to notify processor nodes */ |
| 345 | acpigen_write_processor_cnot(cores_per_package); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 346 | } |
| 347 | |
| 348 | struct chip_operations cpu_intel_haswell_ops = { |
| 349 | CHIP_NAME("Intel Haswell CPU") |
| 350 | }; |