Felix Held | 8602495 | 2021-02-03 23:44:28 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | /* ACPI - create the Fixed ACPI Description Tables (FADT) */ |
| 4 | |
| 5 | #include <acpi/acpi.h> |
Jason Glenesk | 79542fa | 2021-03-10 03:50:57 -0800 | [diff] [blame] | 6 | #include <acpi/acpigen.h> |
Raul E Rangel | 12c6a58 | 2021-02-10 16:45:49 -0700 | [diff] [blame] | 7 | #include <amdblocks/acpi.h> |
Felix Held | 8f7f4bf | 2022-08-03 22:10:05 +0200 | [diff] [blame] | 8 | #include <amdblocks/cppc.h> |
Jason Glenesk | 79542fa | 2021-03-10 03:50:57 -0800 | [diff] [blame] | 9 | #include <amdblocks/cpu.h> |
Raul E Rangel | 12c6a58 | 2021-02-10 16:45:49 -0700 | [diff] [blame] | 10 | #include <amdblocks/acpimmio.h> |
Raul E Rangel | 65819cd | 2021-02-16 10:37:46 -0700 | [diff] [blame] | 11 | #include <amdblocks/ioapic.h> |
| 12 | #include <arch/ioapic.h> |
Raul E Rangel | 12c6a58 | 2021-02-10 16:45:49 -0700 | [diff] [blame] | 13 | #include <arch/smp/mpspec.h> |
| 14 | #include <console/console.h> |
Jason Glenesk | 79542fa | 2021-03-10 03:50:57 -0800 | [diff] [blame] | 15 | #include <cpu/amd/cpuid.h> |
Raul E Rangel | 12c6a58 | 2021-02-10 16:45:49 -0700 | [diff] [blame] | 16 | #include <soc/acpi.h> |
| 17 | #include <soc/iomap.h> |
| 18 | #include <types.h> |
| 19 | #include "chip.h" |
Felix Held | 8602495 | 2021-02-03 23:44:28 +0100 | [diff] [blame] | 20 | |
Felix Held | 8602495 | 2021-02-03 23:44:28 +0100 | [diff] [blame] | 21 | /* |
| 22 | * Reference section 5.2.9 Fixed ACPI Description Table (FADT) |
| 23 | * in the ACPI 3.0b specification. |
| 24 | */ |
| 25 | void acpi_fill_fadt(acpi_fadt_t *fadt) |
| 26 | { |
Jason Glenesk | fff318f | 2021-03-10 02:47:05 -0800 | [diff] [blame] | 27 | const struct soc_amd_cezanne_config *cfg = config_of_soc(); |
Raul E Rangel | 12c6a58 | 2021-02-10 16:45:49 -0700 | [diff] [blame] | 28 | |
| 29 | printk(BIOS_DEBUG, "pm_base: 0x%04x\n", ACPI_IO_BASE); |
| 30 | |
Raul E Rangel | 12c6a58 | 2021-02-10 16:45:49 -0700 | [diff] [blame] | 31 | fadt->pm1a_evt_blk = ACPI_PM_EVT_BLK; |
| 32 | fadt->pm1a_cnt_blk = ACPI_PM1_CNT_BLK; |
| 33 | fadt->pm_tmr_blk = ACPI_PM_TMR_BLK; |
| 34 | fadt->gpe0_blk = ACPI_GPE0_BLK; |
| 35 | |
| 36 | fadt->pm1_evt_len = 4; /* 32 bits */ |
| 37 | fadt->pm1_cnt_len = 2; /* 16 bits */ |
| 38 | fadt->pm_tmr_len = 4; /* 32 bits */ |
| 39 | fadt->gpe0_blk_len = 8; /* 64 bits */ |
| 40 | |
Felix Held | b154949 | 2023-12-13 11:59:39 +0100 | [diff] [blame] | 41 | fill_fadt_extended_pm_io(fadt); |
Felix Held | 164c5ed | 2022-10-18 00:11:48 +0200 | [diff] [blame] | 42 | |
Jason Glenesk | fff318f | 2021-03-10 02:47:05 -0800 | [diff] [blame] | 43 | fadt->iapc_boot_arch = cfg->common_config.fadt_boot_arch; /* legacy free default */ |
Raul E Rangel | 12c6a58 | 2021-02-10 16:45:49 -0700 | [diff] [blame] | 44 | fadt->flags |= ACPI_FADT_WBINVD | /* See table 5-34 ACPI 6.3 spec */ |
| 45 | ACPI_FADT_C1_SUPPORTED | |
| 46 | ACPI_FADT_S4_RTC_WAKE | |
| 47 | ACPI_FADT_32BIT_TIMER | |
| 48 | ACPI_FADT_PCI_EXPRESS_WAKE | |
| 49 | ACPI_FADT_PLATFORM_CLOCK | |
| 50 | ACPI_FADT_S4_RTC_VALID | |
| 51 | ACPI_FADT_REMOTE_POWER_ON; |
Jason Glenesk | fff318f | 2021-03-10 02:47:05 -0800 | [diff] [blame] | 52 | if (cfg->s0ix_enable) |
| 53 | fadt->flags |= ACPI_FADT_LOW_PWR_IDLE_S0; |
| 54 | |
| 55 | fadt->flags |= cfg->common_config.fadt_flags; /* additional board-specific flags */ |
Felix Held | 8602495 | 2021-02-03 23:44:28 +0100 | [diff] [blame] | 56 | } |
Jason Glenesk | 79542fa | 2021-03-10 03:50:57 -0800 | [diff] [blame] | 57 | |
Felix Held | ceafcae | 2023-03-07 00:00:15 +0100 | [diff] [blame] | 58 | const acpi_cstate_t cstate_cfg_table[] = { |
| 59 | [0] = { |
| 60 | .ctype = 1, |
| 61 | .latency = 1, |
| 62 | .power = 0, |
| 63 | }, |
| 64 | [1] = { |
| 65 | .ctype = 2, |
| 66 | .latency = 0x12, |
| 67 | .power = 0, |
| 68 | }, |
| 69 | [2] = { |
| 70 | .ctype = 3, |
| 71 | .latency = 350, |
| 72 | .power = 0, |
| 73 | }, |
| 74 | }; |
| 75 | |
| 76 | const acpi_cstate_t *get_cstate_config_data(size_t *size) |
| 77 | { |
| 78 | *size = ARRAY_SIZE(cstate_cfg_table); |
| 79 | return cstate_cfg_table; |
| 80 | } |