tree: Remove unused <assert.h>
[coreboot.git] / src / soc / amd / cezanne / acpi.c
blob4481c46ae853235346e52a51f384310bbb9b79e0
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 /* ACPI - create the Fixed ACPI Description Tables (FADT) */
5 #include <acpi/acpi.h>
6 #include <acpi/acpigen.h>
7 #include <amdblocks/acpi.h>
8 #include <amdblocks/cppc.h>
9 #include <amdblocks/cpu.h>
10 #include <amdblocks/acpimmio.h>
11 #include <amdblocks/ioapic.h>
12 #include <arch/ioapic.h>
13 #include <arch/smp/mpspec.h>
14 #include <console/console.h>
15 #include <cpu/amd/cpuid.h>
16 #include <device/device.h>
17 #include <soc/iomap.h>
18 #include <static.h>
19 #include <types.h>
20 #include "chip.h"
23 * Reference section 5.2.9 Fixed ACPI Description Table (FADT)
24 * in the ACPI 3.0b specification.
26 void acpi_fill_fadt(acpi_fadt_t *fadt)
28 const struct soc_amd_cezanne_config *cfg = config_of_soc();
30 printk(BIOS_DEBUG, "pm_base: 0x%04x\n", ACPI_IO_BASE);
32 fadt->pm1a_evt_blk = ACPI_PM_EVT_BLK;
33 fadt->pm1a_cnt_blk = ACPI_PM1_CNT_BLK;
34 fadt->pm_tmr_blk = ACPI_PM_TMR_BLK;
35 fadt->gpe0_blk = ACPI_GPE0_BLK;
37 fadt->pm1_evt_len = 4; /* 32 bits */
38 fadt->pm1_cnt_len = 2; /* 16 bits */
39 fadt->pm_tmr_len = 4; /* 32 bits */
40 fadt->gpe0_blk_len = 8; /* 64 bits */
42 fill_fadt_extended_pm_io(fadt);
44 fadt->iapc_boot_arch = cfg->common_config.fadt_boot_arch; /* legacy free default */
45 fadt->flags |= ACPI_FADT_WBINVD | /* See table 5-34 ACPI 6.3 spec */
46 ACPI_FADT_C1_SUPPORTED |
47 ACPI_FADT_S4_RTC_WAKE |
48 ACPI_FADT_32BIT_TIMER |
49 ACPI_FADT_PCI_EXPRESS_WAKE |
50 ACPI_FADT_PLATFORM_CLOCK |
51 ACPI_FADT_S4_RTC_VALID |
52 ACPI_FADT_REMOTE_POWER_ON;
53 if (cfg->s0ix_enable)
54 fadt->flags |= ACPI_FADT_LOW_PWR_IDLE_S0;
56 fadt->flags |= cfg->common_config.fadt_flags; /* additional board-specific flags */
59 unsigned long soc_acpi_write_tables(const struct device *device, unsigned long current,
60 acpi_rsdp_t *rsdp)
62 /* IVRS */
63 current = acpi_add_ivrs_table(current, rsdp);
65 if (CONFIG(PLATFORM_USES_FSP2_0))
66 current = acpi_add_fsp_tables(current, rsdp);
68 return current;
71 const acpi_cstate_t cstate_cfg_table[] = {
72 [0] = {
73 .ctype = 1,
74 .latency = 1,
75 .power = 0,
77 [1] = {
78 .ctype = 2,
79 .latency = 0x12,
80 .power = 0,
82 [2] = {
83 .ctype = 3,
84 .latency = 350,
85 .power = 0,
89 const acpi_cstate_t *get_cstate_config_data(size_t *size)
91 *size = ARRAY_SIZE(cstate_cfg_table);
92 return cstate_cfg_table;