Debian Codegraph @

src/soc/amd/picasso/acpi.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 /*
4 * ACPI - create the Fixed ACPI Description Tables (FADT)
5 */
6
7 #include <console/console.h>
8 #include <acpi/acpi.h>
9 #include <acpi/acpigen.h>
10 #include <device/pci_ops.h>
11 #include <arch/ioapic.h>
12 #include <arch/smp/mpspec.h>
13 #include <cpu/amd/cpuid.h>
14 #include <device/device.h>
15 #include <device/pci.h>
16 #include <gpio.h>
17 #include <amdblocks/acpimmio.h>
18 #include <amdblocks/acpi.h>
19 #include <amdblocks/chip.h>
20 #include <amdblocks/cpu.h>
21 #include <amdblocks/ioapic.h>
22 #include <soc/pci_devs.h>
23 #include <soc/southbridge.h>
24 #include "chip.h"
25
26 /*
27 * Reference section 5.2.9 Fixed ACPI Description Table (FADT)
28 * in the ACPI 3.0b specification.
29 */
30 void acpi_fill_fadt(acpi_fadt_t *fadt)
31 {
32 const struct soc_amd_common_config *cfg = soc_get_common_config();
33
34 printk(BIOS_DEBUG, "pm_base: 0x%04x\n", ACPI_IO_BASE);
35
36
37 fadt->pm1a_evt_blk = ACPI_PM_EVT_BLK;
38 fadt->pm1a_cnt_blk = ACPI_PM1_CNT_BLK;
39 fadt->pm_tmr_blk = ACPI_PM_TMR_BLK;
40 fadt->gpe0_blk = ACPI_GPE0_BLK;
41
42 fadt->pm1_evt_len = 4; /* 32 bits */
43 fadt->pm1_cnt_len = 2; /* 16 bits */
44 fadt->pm_tmr_len = 4; /* 32 bits */
45 fadt->gpe0_blk_len = 8; /* 64 bits */
46
47 fill_fadt_extended_pm_io(fadt);
48
49 fadt->iapc_boot_arch = cfg->fadt_boot_arch; /* legacy free default */
50 fadt->flags |= ACPI_FADT_WBINVD | /* See table 5-34 ACPI 6.3 spec */
51 ACPI_FADT_C1_SUPPORTED |
52 ACPI_FADT_S4_RTC_WAKE |
53 ACPI_FADT_32BIT_TIMER |
54 ACPI_FADT_PCI_EXPRESS_WAKE |
55 ACPI_FADT_PLATFORM_CLOCK |
56 ACPI_FADT_S4_RTC_VALID |
57 ACPI_FADT_REMOTE_POWER_ON;
58 fadt->flags |= cfg->fadt_flags; /* additional board-specific flags */
59 }
60
61 unsigned long soc_acpi_write_tables(const struct device *device, unsigned long current,
62 acpi_rsdp_t *rsdp)
63 {
64 /* CRAT */
65 current = acpi_add_crat_table(current, rsdp);
66
67 /* IVRS */
68 current = acpi_add_ivrs_table(current, rsdp);
69
70 /* Add SRAT, MSCT, SLIT if needed in the future */
71
72 if (CONFIG(PLATFORM_USES_FSP2_0))
73 current = acpi_add_fsp_tables(current, rsdp);
74
75 return current;
76 }
77
78 const acpi_cstate_t cstate_cfg_table[] = {
79 [0] = {
80 .ctype = 1,
81 .latency = 1,
82 .power = 0,
83 },
84 [1] = {
85 .ctype = 2,
86 .latency = 400,
87 .power = 0,
88 },
89 };
90
91 const acpi_cstate_t *get_cstate_config_data(size_t *size)
92 {
93 *size = ARRAY_SIZE(cstate_cfg_table);
94 return cstate_cfg_table;
95 }