ACPI: Make FADT entries for SMI architectural
[coreboot.git] / src / soc / amd / glinda / acpi.c
blobdf8629644729aa9ec52fc4dd1ffa075fe843fffe
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 /* TODO: Update for Glinda */
4 /* TODO: See what can be made common */
6 /* ACPI - create the Fixed ACPI Description Tables (FADT) */
8 #include <acpi/acpi.h>
9 #include <acpi/acpigen.h>
10 #include <amdblocks/acpi.h>
11 #include <amdblocks/cppc.h>
12 #include <amdblocks/cpu.h>
13 #include <amdblocks/acpimmio.h>
14 #include <amdblocks/ioapic.h>
15 #include <arch/ioapic.h>
16 #include <arch/smp/mpspec.h>
17 #include <console/console.h>
18 #include <cpu/amd/cpuid.h>
19 #include <cpu/x86/smm.h>
20 #include <soc/acpi.h>
21 #include <soc/iomap.h>
22 #include <types.h>
23 #include "chip.h"
25 unsigned long acpi_fill_madt(unsigned long current)
27 current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current,
28 GNB_IO_APIC_ADDR);
30 return current;
34 * Reference section 5.2.9 Fixed ACPI Description Table (FADT)
35 * in the ACPI 3.0b specification.
37 void acpi_fill_fadt(acpi_fadt_t *fadt)
39 const struct soc_amd_glinda_config *cfg = config_of_soc();
41 printk(BIOS_DEBUG, "pm_base: 0x%04x\n", ACPI_IO_BASE);
43 fadt->pm1a_evt_blk = ACPI_PM_EVT_BLK;
44 fadt->pm1a_cnt_blk = ACPI_PM1_CNT_BLK;
45 fadt->pm_tmr_blk = ACPI_PM_TMR_BLK;
46 fadt->gpe0_blk = ACPI_GPE0_BLK;
48 fadt->pm1_evt_len = 4; /* 32 bits */
49 fadt->pm1_cnt_len = 2; /* 16 bits */
50 fadt->pm_tmr_len = 4; /* 32 bits */
51 fadt->gpe0_blk_len = 8; /* 64 bits */
53 fill_fadt_extended_pm_regs(fadt);
55 fadt->day_alrm = RTC_DATE_ALARM;
56 fadt->century = RTC_ALT_CENTURY;
57 fadt->iapc_boot_arch = cfg->common_config.fadt_boot_arch; /* legacy free default */
58 fadt->flags |= ACPI_FADT_WBINVD | /* See table 5-34 ACPI 6.3 spec */
59 ACPI_FADT_C1_SUPPORTED |
60 ACPI_FADT_S4_RTC_WAKE |
61 ACPI_FADT_32BIT_TIMER |
62 ACPI_FADT_PCI_EXPRESS_WAKE |
63 ACPI_FADT_PLATFORM_CLOCK |
64 ACPI_FADT_S4_RTC_VALID |
65 ACPI_FADT_REMOTE_POWER_ON;
66 if (cfg->s0ix_enable)
67 fadt->flags |= ACPI_FADT_LOW_PWR_IDLE_S0;
69 fadt->flags |= cfg->common_config.fadt_flags; /* additional board-specific flags */
72 const acpi_cstate_t cstate_cfg_table[] = {
73 [0] = {
74 .ctype = 1,
75 .latency = 1,
76 .power = 0,
78 [1] = {
79 .ctype = 2,
80 .latency = 0x12,
81 .power = 0,
83 [2] = {
84 .ctype = 3,
85 .latency = 350,
86 .power = 0,
90 const acpi_cstate_t *get_cstate_config_data(size_t *size)
92 *size = ARRAY_SIZE(cstate_cfg_table);
93 return cstate_cfg_table;