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