Angel Pons | ae59387 | 2020-04-04 18:50:57 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 2 | |
| 3 | /* |
| 4 | * ACPI - create the Fixed ACPI Description Tables (FADT) |
| 5 | */ |
| 6 | |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 7 | #include <console/console.h> |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 8 | #include <acpi/acpi.h> |
| 9 | #include <acpi/acpigen.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 10 | #include <device/pci_ops.h> |
Marc Jones | 5ebc865 | 2017-06-19 23:34:04 -0600 | [diff] [blame] | 11 | #include <arch/ioapic.h> |
Felix Held | 69a957f | 2021-06-17 15:48:25 +0200 | [diff] [blame] | 12 | #include <arch/smp/mpspec.h> |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 13 | #include <device/device.h> |
Marc Jones | 6bfcf66 | 2017-08-06 17:42:35 -0600 | [diff] [blame] | 14 | #include <device/pci.h> |
Elyes Haouas | 5e2602a | 2023-01-14 05:46:25 +0100 | [diff] [blame] | 15 | #include <gpio.h> |
Marshall Dawson | 69486ca | 2019-05-02 12:03:45 -0600 | [diff] [blame] | 16 | #include <amdblocks/acpimmio.h> |
Marshall Dawson | 4ee83b2 | 2019-05-03 11:44:22 -0600 | [diff] [blame] | 17 | #include <amdblocks/acpi.h> |
Felix Held | 15024e0 | 2023-02-16 20:34:46 +0100 | [diff] [blame] | 18 | #include <amdblocks/cpu.h> |
Felix Held | 604ffa6 | 2021-02-12 00:43:20 +0100 | [diff] [blame] | 19 | #include <amdblocks/ioapic.h> |
Marc Jones | 257db58 | 2017-06-18 17:33:30 -0600 | [diff] [blame] | 20 | #include <soc/acpi.h> |
Chris Ching | 6a35fab | 2017-10-19 11:45:30 -0600 | [diff] [blame] | 21 | #include <soc/pci_devs.h> |
Marc Jones | dfeb1c4 | 2017-08-07 19:08:24 -0600 | [diff] [blame] | 22 | #include <soc/southbridge.h> |
Patrick Georgi | 4fbefc5 | 2018-10-23 14:35:37 +0200 | [diff] [blame] | 23 | #include <soc/northbridge.h> |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 24 | |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 25 | /* |
| 26 | * Reference section 5.2.9 Fixed ACPI Description Table (FADT) |
| 27 | * in the ACPI 3.0b specification. |
| 28 | */ |
Kyösti Mälkki | 61ef71b | 2020-05-30 18:54:39 +0300 | [diff] [blame] | 29 | void acpi_fill_fadt(acpi_fadt_t *fadt) |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 30 | { |
Felix Held | 2f8228d | 2021-02-05 01:03:45 +0100 | [diff] [blame] | 31 | printk(BIOS_DEBUG, "pm_base: 0x%04x\n", ACPI_IO_BASE); |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 32 | |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 33 | |
| 34 | fadt->pm1a_evt_blk = ACPI_PM_EVT_BLK; |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 35 | fadt->pm1a_cnt_blk = ACPI_PM1_CNT_BLK; |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 36 | fadt->pm_tmr_blk = ACPI_PM_TMR_BLK; |
| 37 | fadt->gpe0_blk = ACPI_GPE0_BLK; |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 38 | |
| 39 | fadt->pm1_evt_len = 4; /* 32 bits */ |
| 40 | fadt->pm1_cnt_len = 2; /* 16 bits */ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 41 | fadt->pm_tmr_len = 4; /* 32 bits */ |
| 42 | fadt->gpe0_blk_len = 8; /* 64 bits */ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 43 | |
Felix Held | b154949 | 2023-12-13 11:59:39 +0100 | [diff] [blame] | 44 | fill_fadt_extended_pm_io(fadt); |
Felix Held | 164c5ed | 2022-10-18 00:11:48 +0200 | [diff] [blame] | 45 | |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 46 | fadt->duty_offset = 1; /* CLK_VAL bits 3:1 */ |
| 47 | fadt->duty_width = 3; /* CLK_VAL bits 3:1 */ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 48 | fadt->iapc_boot_arch = FADT_BOOT_ARCH; /* See table 5-10 */ |
Angel Pons | a208c6c | 2020-07-13 00:02:34 +0200 | [diff] [blame] | 49 | fadt->flags |= ACPI_FADT_WBINVD | /* See table 5-10 ACPI 3.0a spec */ |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 50 | ACPI_FADT_C1_SUPPORTED | |
| 51 | ACPI_FADT_SLEEP_BUTTON | |
| 52 | ACPI_FADT_S4_RTC_WAKE | |
| 53 | ACPI_FADT_32BIT_TIMER | |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 54 | ACPI_FADT_PCI_EXPRESS_WAKE | |
| 55 | ACPI_FADT_PLATFORM_CLOCK | |
| 56 | ACPI_FADT_S4_RTC_VALID | |
| 57 | ACPI_FADT_REMOTE_POWER_ON; |
Marc Jones | 2448484 | 2017-05-04 21:17:45 -0600 | [diff] [blame] | 58 | } |
Marc Jones | 257db58 | 2017-06-18 17:33:30 -0600 | [diff] [blame] | 59 | |
Felix Held | 3ee7453 | 2023-03-07 02:57:54 +0100 | [diff] [blame] | 60 | const acpi_cstate_t cstate_cfg_table[] = { |
| 61 | [0] = { |
| 62 | .ctype = 1, |
| 63 | .latency = 1, |
| 64 | .power = 0, |
| 65 | }, |
| 66 | [1] = { |
| 67 | .ctype = 2, |
| 68 | .latency = 400, |
| 69 | .power = 0, |
| 70 | }, |
| 71 | }; |
| 72 | |
| 73 | const acpi_cstate_t *get_cstate_config_data(size_t *size) |
| 74 | { |
| 75 | *size = ARRAY_SIZE(cstate_cfg_table); |
| 76 | return cstate_cfg_table; |
| 77 | } |