mb/asus/p8z77-m: Drop GPIO by I/O
[coreboot2.git] / src / arch / x86 / acpi.c
blob82cbf205a7b9abb5215a25de9c8204beb4277de5
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpi.h>
4 #include <arch/ioapic.h>
5 #include <cf9_reset.h>
6 #include <cpu/x86/smm.h>
7 #include <pc80/mc146818rtc.h>
9 static u16 acpi_sci_int(void)
11 u8 gsi, irq, flags;
13 ioapic_get_sci_pin(&gsi, &irq, &flags);
15 /* In systems without 8259, the SCI_INT field in the FADT contains the SCI GSI number
16 instead of the 8259 IRQ number */
17 if (!CONFIG(ACPI_HAVE_PCAT_8259))
18 return gsi;
20 assert(irq < 16);
21 return irq;
25 void arch_fill_fadt(acpi_fadt_t *fadt)
27 fadt->sci_int = acpi_sci_int();
29 if (CONFIG(HAVE_CF9_RESET)) {
30 fadt->reset_reg.space_id = ACPI_ADDRESS_SPACE_IO;
31 fadt->reset_reg.bit_width = 8;
32 fadt->reset_reg.bit_offset = 0;
33 fadt->reset_reg.access_size = ACPI_ACCESS_SIZE_BYTE_ACCESS;
34 fadt->reset_reg.addrl = RST_CNT;
35 fadt->reset_reg.addrh = 0;
37 fadt->reset_value = RST_CPU | SYS_RST;
39 fadt->flags |= ACPI_FADT_RESET_REGISTER;
42 if (permanent_smi_handler()) {
43 fadt->smi_cmd = pm_acpi_smi_cmd_port();
44 fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
45 fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
48 if (CONFIG(PC80_SYSTEM)) {
49 /* Currently these are defined to support date alarm only. */
50 fadt->day_alrm = RTC_DATE_ALARM;
51 fadt->mon_alrm = RTC_MONTH_ALARM;
54 /* Careful with USE_OPTION_TABLE. */
55 if (CONFIG(USE_PC_CMOS_ALTCENTURY))
56 fadt->century = RTC_CLK_ALTCENTURY;