blob: 0b32388117bdfbd47566047f587bc070b60e9006 [file] [log] [blame]
York Yangd7cba282016-03-09 10:54:26 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2009 coresystems GmbH
5 * Copyright (C) 2013 Google Inc.
6 * Copyright (C) 2015-2016 Intel Corp.
Werner Zeh1cfb5552016-07-27 08:22:50 +02007 * Copyright (C) 2016 Siemens AG
York Yangd7cba282016-03-09 10:54:26 -08008 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <string.h>
20#include <types.h>
21#include <arch/acpigen.h>
22#include <arch/cpu.h>
23#include <arch/io.h>
24#include <arch/smp/mpspec.h>
25#include <console/console.h>
26#include <cpu/x86/msr.h>
27#include <cpu/intel/speedstep.h>
28#include <cpu/intel/turbo.h>
29#include <device/device.h>
30#include <device/pci.h>
31#include <device/pci_ids.h>
32#include <soc/acpi.h>
33#include <soc/iomap.h>
34#include <soc/irq.h>
35#include <soc/lpc.h>
36#include <soc/msr.h>
37#include <soc/pattrs.h>
38#include <soc/pci_devs.h>
Werner Zeh1cfb5552016-07-27 08:22:50 +020039#include <soc/broadwell_de.h>
York Yangd7cba282016-03-09 10:54:26 -080040#include <chip.h>
41
42uint16_t get_pmbase(void)
43{
44 return ACPI_BASE_ADDRESS;
45}
46
47#define MWAIT_RES(state, sub_state) \
48 { \
49 .addrl = (((state) << 4) | (sub_state)), \
50 .space_id = ACPI_ADDRESS_SPACE_FIXED, \
51 .bit_width = ACPI_FFIXEDHW_VENDOR_INTEL, \
52 .bit_offset = ACPI_FFIXEDHW_CLASS_MWAIT, \
53 .access_size = ACPI_FFIXEDHW_FLAG_HW_COORD, \
54 }
55
56/* C-state map */
57static acpi_cstate_t cstate_map[] = {
58 {
59 /* C1 */
60 .ctype = 1, /* ACPI C1 */
61 .latency = 1,
62 .power = 1000,
63 .resource = MWAIT_RES(0, 0),
64 },
65 {
66 /* C3 */
67 .ctype = 2, /* ACPI C2 */
68 .latency = 15,
69 .power = 500,
70 .resource = MWAIT_RES(1, 0),
71 },
72 {
73 /* C6 */
74 .ctype = 3, /* ACPI C3 */
75 .latency = 41,
76 .power = 350,
77 .resource = MWAIT_RES(2, 0),
78 }
79};
80
81static int acpi_sci_irq(void)
82{
Werner Zeh93db5a52016-07-06 12:58:57 +020083 uint8_t actl = 0;
84 static uint8_t sci_irq = 0;
Elyes HAOUAS15a487a2018-05-27 17:58:57 +020085 struct device *dev = dev_find_slot(0, PCI_DEVFN(LPC_DEV, LPC_FUNC));
Werner Zeh93db5a52016-07-06 12:58:57 +020086
87 /* If this function was already called, just return the stored value. */
88 if (sci_irq)
89 return sci_irq;
90 /* Get contents of ACPI control register. */
91 actl = pci_read_config8(dev, ACPI_CNTL_OFFSET) & SCIS_MASK;
92 /* Determine how SCI is routed. */
93 switch (actl) {
94 case SCIS_IRQ9:
95 case SCIS_IRQ10:
96 case SCIS_IRQ11:
97 sci_irq = actl + 9;
98 break;
99 case SCIS_IRQ20:
100 case SCIS_IRQ21:
101 case SCIS_IRQ22:
102 case SCIS_IRQ23:
103 sci_irq = actl - SCIS_IRQ20 + 20;
104 break;
105 default:
106 printk(BIOS_DEBUG, "Invalid SCI route! Defaulting to IRQ9.\n");
107 sci_irq = 9;
108 break;
109 }
110 printk(BIOS_DEBUG, "SCI is IRQ%d\n", sci_irq);
111 return sci_irq;
York Yangd7cba282016-03-09 10:54:26 -0800112}
113
114void acpi_create_intel_hpet(acpi_hpet_t *hpet)
115{
116 acpi_header_t *header = &(hpet->header);
117 acpi_addr_t *addr = &(hpet->addr);
118
119 memset((void *) hpet, 0, sizeof(acpi_hpet_t));
120
121 /* fill out header fields */
122 memcpy(header->signature, "HPET", 4);
123 memcpy(header->oem_id, OEM_ID, 6);
124 memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
125 memcpy(header->asl_compiler_id, ASLC, 4);
126
127 header->length = sizeof(acpi_hpet_t);
128 header->revision = 1;
129
130 /* fill out HPET address */
131 addr->space_id = 0; /* Memory */
132 addr->bit_width = 64;
133 addr->bit_offset = 0;
134 addr->addrl = (unsigned long long)HPET_BASE_ADDRESS & 0xffffffff;
135 addr->addrh = (unsigned long long)HPET_BASE_ADDRESS >> 32;
136
137 hpet->id = 0x8086a201; /* Intel */
138 hpet->number = 0x00;
139 hpet->min_tick = 0x0080;
140
141 header->checksum = acpi_checksum((void *) hpet, sizeof(acpi_hpet_t));
142}
143
144unsigned long acpi_fill_mcfg(unsigned long current)
145{
146 current += acpi_create_mcfg_mmconfig((acpi_mcfg_mmconfig_t *)current,
147 MCFG_BASE_ADDRESS, 0, 0, 255);
148 return current;
149}
150
151/**
152 * Fill in the fadt with generic values that can be overridden later.
153 */
154
155void acpi_fill_in_fadt(acpi_fadt_t *fadt, acpi_facs_t *facs, void *dsdt)
156{
157 acpi_header_t *header = &(fadt->header);
158 u16 pmbase = get_pmbase();
159
160 memset((void *) fadt, 0, sizeof(acpi_fadt_t));
161
162 /*
163 * Reference section 5.2.9 Fixed ACPI Description Table (FADT)
164 * in the ACPI 3.0b specification.
165 */
166
167 /* FADT Header Structure */
168 memcpy(header->signature, "FACP", 4);
169 header->length = sizeof(acpi_fadt_t);
170 header->revision = ACPI_FADT_REV_ACPI_3_0;
171 memcpy(header->oem_id, OEM_ID, 6);
172 memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
173 memcpy(header->asl_compiler_id, ASLC, 4);
174 header->asl_compiler_revision = 1;
175
176 /* ACPI Pointers */
177 fadt->firmware_ctrl = (unsigned long) facs;
178 fadt->dsdt = (unsigned long) dsdt;
179
180 fadt->model = 0; /* reserved, should be 0 ACPI 3.0 */
181 fadt->preferred_pm_profile = 0;
182 fadt->sci_int = acpi_sci_irq();
183
184 /* System Management */
185 fadt->smi_cmd = 0x00; /* disable SMM */
186 fadt->acpi_enable = 0x00; /* unused if SMI_CMD = 0 */
187 fadt->acpi_disable = 0x00; /* unused if SMI_CMD = 0 */
188
189 /* Enable ACPI */
190 outl(inl(pmbase + 4) | 0x01, pmbase + 4);
191
192 /* Power Control */
193 fadt->s4bios_req = 0x00;
194 fadt->pstate_cnt = 0x00;
195
196 /* Control Registers - Base Address */
197 fadt->pm1a_evt_blk = pmbase + PM1_STS;
198 fadt->pm1b_evt_blk = 0x00; /* Not Used */
199 fadt->pm1a_cnt_blk = pmbase + PM1_CNT;
200 fadt->pm1b_cnt_blk = 0x00; /* Not Used */
201 fadt->pm2_cnt_blk = pmbase + PM2A_CNT_BLK;
202 fadt->pm_tmr_blk = pmbase + PM1_TMR;
203 fadt->gpe0_blk = pmbase + GPE0_STS;
204 fadt->gpe1_blk = 0x00; /* Not Used */
205
206 /* Control Registers - Length */
207 fadt->pm1_evt_len = 4; /* 32 bits */
208 fadt->pm1_cnt_len = 2; /* 32 bit register, 16 bits used */
209 fadt->pm2_cnt_len = 1; /* 8 bits */
210 fadt->pm_tmr_len = 4; /* 32 bits */
211 fadt->gpe0_blk_len = 8; /* 64 bits */
212 fadt->gpe1_blk_len = 0;
213 fadt->gpe1_base = 0;
214 fadt->cst_cnt = 0;
215 fadt->p_lvl2_lat = ACPI_FADT_C2_NOT_SUPPORTED;
216 fadt->p_lvl3_lat = ACPI_FADT_C3_NOT_SUPPORTED;
217 fadt->flush_size = 0; /* set to 0 if WBINVD is 1 in flags */
218 fadt->flush_stride = 0; /* set to 0 if WBINVD is 1 in flags */
219 fadt->duty_offset = 1;
220 fadt->duty_width = 0;
221
222 /* RTC Registers */
223 fadt->day_alrm = 0x0D;
224 fadt->mon_alrm = 0x00;
225 fadt->century = 0x00;
226 fadt->iapc_boot_arch = 0;
227
228 fadt->flags = ACPI_FADT_WBINVD | ACPI_FADT_C1_SUPPORTED |
229 ACPI_FADT_C2_MP_SUPPORTED | ACPI_FADT_SLEEP_BUTTON |
230 ACPI_FADT_RESET_REGISTER | ACPI_FADT_SLEEP_TYPE |
231 ACPI_FADT_S4_RTC_WAKE | ACPI_FADT_PLATFORM_CLOCK;
232
233 /* Reset Register */
234 fadt->reset_reg.space_id = ACPI_ADDRESS_SPACE_IO;
235 fadt->reset_reg.bit_width = 8;
236 fadt->reset_reg.bit_offset = 0;
237 fadt->reset_reg.access_size = ACPI_ACCESS_SIZE_BYTE_ACCESS;
238 fadt->reset_reg.addrl = 0xCF9;
239 fadt->reset_reg.addrh = 0x00;
240 fadt->reset_value = 6;
241
242 /* Reserved Bits */
243 fadt->res3 = 0x00; /* reserved, MUST be 0 ACPI 3.0 */
244 fadt->res4 = 0x00; /* reserved, MUST be 0 ACPI 3.0 */
245 fadt->res5 = 0x00; /* reserved, MUST be 0 ACPI 3.0 */
246
247 /* Extended ACPI Pointers */
248 fadt->x_firmware_ctl_l = (unsigned long)facs;
249 fadt->x_firmware_ctl_h = 0x00;
250 fadt->x_dsdt_l = (unsigned long)dsdt;
251 fadt->x_dsdt_h = 0x00;
252
253 /* PM1 Status & PM1 Enable */
254 fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
255 fadt->x_pm1a_evt_blk.bit_width = fadt->pm1_evt_len * 8;
256 fadt->x_pm1a_evt_blk.bit_offset = 0;
257 fadt->x_pm1a_evt_blk.access_size = ACPI_ACCESS_SIZE_DWORD_ACCESS;
258 fadt->x_pm1a_evt_blk.addrl = fadt->pm1a_evt_blk;
259 fadt->x_pm1a_evt_blk.addrh = 0x00;
260
261 fadt->x_pm1b_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
262 fadt->x_pm1b_evt_blk.bit_width = 0;
263 fadt->x_pm1b_evt_blk.bit_offset = 0;
264 fadt->x_pm1b_evt_blk.access_size = 0;
265 fadt->x_pm1b_evt_blk.addrl = fadt->pm1b_evt_blk;
266 fadt->x_pm1b_evt_blk.addrh = 0x00;
267
268 /* PM1 Control Registers */
269 fadt->x_pm1a_cnt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
270 fadt->x_pm1a_cnt_blk.bit_width = 16;
271 fadt->x_pm1a_cnt_blk.bit_offset = 0;
272 fadt->x_pm1a_cnt_blk.access_size = ACPI_ACCESS_SIZE_WORD_ACCESS;
273 fadt->x_pm1a_cnt_blk.addrl = fadt->pm1a_cnt_blk;
274 fadt->x_pm1a_cnt_blk.addrh = 0x00;
275
276 fadt->x_pm1b_cnt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
277 fadt->x_pm1b_cnt_blk.bit_width = 0;
278 fadt->x_pm1b_cnt_blk.bit_offset = 0;
279 fadt->x_pm1b_cnt_blk.access_size = 0;
280 fadt->x_pm1b_cnt_blk.addrl = fadt->pm1b_cnt_blk;
281 fadt->x_pm1b_cnt_blk.addrh = 0x00;
282
283 /* PM2 Control Registers */
284 fadt->x_pm2_cnt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
285 fadt->x_pm2_cnt_blk.bit_width = 8;
286 fadt->x_pm2_cnt_blk.bit_offset = 0;
287 fadt->x_pm2_cnt_blk.access_size = ACPI_ACCESS_SIZE_BYTE_ACCESS;
288 fadt->x_pm2_cnt_blk.addrl = fadt->pm2_cnt_blk;
289 fadt->x_pm2_cnt_blk.addrh = 0x00;
290
291 /* PM1 Timer Register */
292 fadt->x_pm_tmr_blk.space_id = ACPI_ADDRESS_SPACE_IO;
293 fadt->x_pm_tmr_blk.bit_width = 32;
294 fadt->x_pm_tmr_blk.bit_offset = 0;
295 fadt->x_pm_tmr_blk.access_size = ACPI_ACCESS_SIZE_DWORD_ACCESS;
296 fadt->x_pm_tmr_blk.addrl = fadt->pm_tmr_blk;
297 fadt->x_pm_tmr_blk.addrh = 0x00;
298
299 /* General-Purpose Event Registers */
300 fadt->x_gpe0_blk.space_id = ACPI_ADDRESS_SPACE_IO;
301 fadt->x_gpe0_blk.bit_width = 64; /* EventStatus + EventEnable */
302 fadt->x_gpe0_blk.bit_offset = 0;
303 fadt->x_gpe0_blk.access_size = ACPI_ACCESS_SIZE_DWORD_ACCESS;
304 fadt->x_gpe0_blk.addrl = fadt->gpe0_blk;
305 fadt->x_gpe0_blk.addrh = 0x00;
306
307 fadt->x_gpe1_blk.space_id = ACPI_ADDRESS_SPACE_IO;
308 fadt->x_gpe1_blk.bit_width = 0;
309 fadt->x_gpe1_blk.bit_offset = 0;
310 fadt->x_gpe1_blk.access_size = 0;
311 fadt->x_gpe1_blk.addrl = fadt->gpe1_blk;
312 fadt->x_gpe1_blk.addrh = 0x00;
313
314 header->checksum = acpi_checksum((void *) fadt, sizeof(acpi_fadt_t));
315}
316
Werner Zeh1cfb5552016-07-27 08:22:50 +0200317static unsigned long acpi_fill_dmar(unsigned long current)
318{
319 uint32_t vtbar, tmp = current;
320 struct device *dev = dev_find_slot(0, VTD_DEV_FUNC);
321 uint16_t bdf, hpet_bdf[8];
322 uint8_t i, j;
323
324 if (!dev)
325 return current;
326
327 vtbar = pci_read_config32(dev, VTBAR_OFFSET) & VTBAR_MASK;
328 if (!vtbar)
329 return current;
330
331 current += acpi_create_dmar_drhd(current,
332 DRHD_INCLUDE_PCI_ALL, 0, vtbar);
333 /* The IIO I/O APIC is fixed on PCI 00:05.4 on Broadwell-DE */
334 current += acpi_create_dmar_drhd_ds_ioapic(current,
335 9, 0, 5, 4);
336 /* Get the PCI BDF for the PCH I/O APIC */
337 dev = dev_find_slot(0, LPC_DEV_FUNC);
338 bdf = pci_read_config16(dev, 0x6c);
339 current += acpi_create_dmar_drhd_ds_ioapic(current,
340 8, (bdf >> 8), PCI_SLOT(bdf), PCI_FUNC(bdf));
341
342 /*
343 * Check if there are different PCI paths for the 8 HPET timers
344 * and add every different PCI path as a separate HPET entry.
345 * Although the DMAR specification talks about HPET block for this
346 * entry, it is possible to assign a unique PCI BDF to every single
347 * timer within a HPET block which will result in different source
348 * IDs reported by a generated MSI.
349 * In default configuration every single timer will have the same
350 * PCI BDF which will result in a single HPET entry in DMAR table.
351 * I have checked several different systems and all of them had one
352 * single entry for HPET in DMAR.
353 */
354 memset(hpet_bdf, 0, sizeof(hpet_bdf));
355 /* Get all unique HPET paths. */
356 for (i = 0; i < ARRAY_SIZE(hpet_bdf); i++) {
357 bdf = pci_read_config16(dev, 0x70 + (i * 2));
358 for (j = 0; j < i; j++) {
359 if (hpet_bdf[j] == bdf)
360 break;
361 }
362 if (j == i)
363 hpet_bdf[i] = bdf;
364 }
365 /* Create one HPET entry in DMAR for every unique HPET PCI path. */
366 for (i = 0; i < ARRAY_SIZE(hpet_bdf); i++) {
367 if (hpet_bdf[i])
368 current += acpi_create_dmar_drhd_ds_msi_hpet(current,
369 0, (hpet_bdf[i] >> 8), PCI_SLOT(hpet_bdf[i]),
370 PCI_FUNC(hpet_bdf[i]));
371 }
372 acpi_dmar_drhd_fixup(tmp, current);
373
374 /* Create root port ATSR capability */
375 tmp = current;
376 current += acpi_create_dmar_atsr(current, 0, 0);
377 /* Add one entry to ATSR for each PCI root port */
378 dev = all_devices;
379 do {
380 dev = dev_find_class(PCI_CLASS_BRIDGE_PCI << 8, dev);
381 if (dev && dev->bus->secondary == 0 &&
382 PCI_SLOT(dev->path.pci.devfn) <= 3)
383 current += acpi_create_dmar_drhd_ds_pci_br(current,
384 dev->bus->secondary,
385 PCI_SLOT(dev->path.pci.devfn),
386 PCI_FUNC(dev->path.pci.devfn));
387 } while (dev);
388 acpi_dmar_atsr_fixup(tmp, current);
389
390 return current;
391}
392
393unsigned long northcluster_write_acpi_tables(struct device *const dev,
394 unsigned long current,
395 struct acpi_rsdp *const rsdp)
396{
397 acpi_dmar_t *const dmar = (acpi_dmar_t *)current;
Elyes HAOUAS15a487a2018-05-27 17:58:57 +0200398 struct device *vtdev = dev_find_slot(0, PCI_DEVFN(5, 0));
Werner Zeh1cfb5552016-07-27 08:22:50 +0200399
400 /* Create DMAR table only if virtualization is enabled */
401 if (!(pci_read_config32(vtdev, 0x180) & 0x01))
402 return current;
403
404 printk(BIOS_DEBUG, "ACPI: * DMAR\n");
405 acpi_create_dmar(dmar, DMAR_INTR_REMAP, acpi_fill_dmar);
406 current += dmar->header.length;
407 current = acpi_align_current(current);
408 acpi_add_table(rsdp, dmar);
409 current = acpi_align_current(current);
410
411 return current;
412}
413
York Yangd7cba282016-03-09 10:54:26 -0800414static int calculate_power(int tdp, int p1_ratio, int ratio)
415{
416 u32 m;
417 u32 power;
418
419 /*
420 * M = ((1.1 - ((p1_ratio - ratio) * 0.00625)) / 1.1) ^ 2
421 *
422 * Power = (ratio / p1_ratio) * m * tdp
423 */
424
425 m = (110000 - ((p1_ratio - ratio) * 625)) / 11;
426 m = (m * m) / 1000;
427
428 power = ((ratio * 100000 / p1_ratio) / 100);
429 power *= (m / 100) * (tdp / 1000);
430 power /= 1000;
431
432 return (int)power;
433}
434
435static void generate_P_state_entries(int core, int cores_per_package)
436{
437 int ratio_min, ratio_max, ratio_step;
438 int coord_type, power_max, power_unit, num_entries;
439 int ratio, power, clock, clock_max;
440 int turbo;
441 u32 control_status;
442 msr_t msr;
443
444 /* Hardware coordination of P-states */
445 coord_type = HW_ALL;
446
447 /* Check for Turbo Mode */
448 turbo = get_turbo_state() == TURBO_ENABLED;
449
450 /* CPU attributes */
451 msr = rdmsr(MSR_PLATFORM_INFO);
452 ratio_min = (msr.hi >> 8) & 0xff; // LFM
453 ratio_max = (msr.lo >> 8) & 0xff; // HFM
454 clock_max = (ratio_max * 100);
455
456 /* Calculate CPU TDP in mW */
457 msr = rdmsr(MSR_PKG_POWER_SKU_UNIT);
458 power_unit = 1 << (msr.lo & 0xf);
459 msr = rdmsr(MSR_PKG_POWER_LIMIT);
460 power_max = ((msr.lo & 0x7fff) / power_unit) * 1000;
461
462 /* Write _PCT indicating use of FFixedHW */
463 acpigen_write_empty_PCT();
464
465 /* Write _PPC starting from first supported P-state */
466 acpigen_write_PPC(0);
467
468 /* Write PSD indicating configured coordination type */
469 acpigen_write_PSD_package(core, 1, coord_type);
470
471 /* Add P-state entries in _PSS table */
472 acpigen_write_name("_PSS");
473
474 /* Determine ratio points */
475 /* Note: There should be at most 16 performance states. If Turbo Mode
476 is enabled, the Max Turbo Ratio will occupy one of these states. */
477 ratio_step = 1;
478 num_entries = (ratio_max - ratio_min) / ratio_step;
479 while (num_entries > (15-turbo)) {
480 ratio_step <<= 1;
481 num_entries >>= 1;
482 }
483
484 if (turbo) {
485 /* _PSS package count (with turbo) */
486 acpigen_write_package(num_entries + 2);
487
488 /* Get Max Turbo Ratio */
489 msr = rdmsr(MSR_TURBO_RATIO_LIMIT);
490 ratio = msr.lo & 0xff;
491
492 acpigen_write_PSS_package(
493 ratio * 100, /* MHz */
494 power_max, /* mW */
495 10, /* lat1 */
496 10, /* lat2 */
497 ratio << 8, /* control */
498 ratio << 8); /* status */
499 } else {
500 /* _PSS package count (without turbo) */
501 acpigen_write_package(num_entries + 1);
502 }
503
504 /* Generate the _PSS entries */
505 for (ratio = ratio_min + (num_entries * ratio_step);
506 ratio >= ratio_min; ratio -= ratio_step) {
507
508 /* Calculate power at this ratio */
509 power = calculate_power(power_max, ratio_max, ratio);
510 clock = ratio * 100;
511 control_status = ratio << 8;
512
513 acpigen_write_PSS_package(
514 clock, /* MHz */
515 power, /* mW */
516 10, /* lat1 */
517 10, /* lat2 */
518 control_status, /* control */
519 control_status); /* status */
520 }
521
522 /* Fix package length */
523 acpigen_pop_len();
524}
525
Elyes HAOUAS15a487a2018-05-27 17:58:57 +0200526void generate_cpu_entries(struct device *device)
York Yangd7cba282016-03-09 10:54:26 -0800527{
528 int core;
529 int pcontrol_blk = get_pmbase(), plen = 6;
530 const struct pattrs *pattrs = pattrs_get();
531
532 for (core = 0; core < pattrs->num_cpus; core++) {
533 if (core > 0) {
534 pcontrol_blk = 0;
535 plen = 0;
536 }
537
538 /* Generate processor \_PR.CP0x */
539 acpigen_write_processor(core, pcontrol_blk, plen);
540
541 /* Generate P-state tables */
542 generate_P_state_entries(core, pattrs->num_cpus);
543
544 /* Generate C-state tables */
545 acpigen_write_CST_package(cstate_map, ARRAY_SIZE(cstate_map));
546
547 acpigen_pop_len();
548 }
549}
550
551unsigned long acpi_madt_irq_overrides(unsigned long current)
552{
553 int sci_irq = acpi_sci_irq();
554 acpi_madt_irqoverride_t *irqovr;
555 uint16_t sci_flags = MP_IRQ_TRIGGER_LEVEL;
556
557 /* INT_SRC_OVR */
558 irqovr = (void *)current;
559 current += acpi_create_madt_irqoverride(irqovr, 0, 0, 2, 0);
560
561 if (sci_irq >= 20)
562 sci_flags |= MP_IRQ_POLARITY_LOW;
563 else
564 sci_flags |= MP_IRQ_POLARITY_HIGH;
565
566 irqovr = (void *)current;
567 current += acpi_create_madt_irqoverride(irqovr, 0, sci_irq, sci_irq,
568 sci_flags);
569
York Yangd7cba282016-03-09 10:54:26 -0800570 return current;
571}