Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | /* TODO: Update for Glinda */ |
| 4 | /* TODO: See what can be made common */ |
| 5 | |
| 6 | /* ACPI - create the Fixed ACPI Description Tables (FADT) */ |
| 7 | |
| 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> |
Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 19 | #include <soc/acpi.h> |
| 20 | #include <soc/iomap.h> |
Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 21 | #include <types.h> |
| 22 | #include "chip.h" |
| 23 | |
| 24 | unsigned long acpi_fill_madt(unsigned long current) |
| 25 | { |
Kyösti Mälkki | 2e65e9c | 2021-06-16 11:00:40 +0300 | [diff] [blame] | 26 | current += acpi_create_madt_ioapic_from_hw((acpi_madt_ioapic_t *)current, |
| 27 | GNB_IO_APIC_ADDR); |
Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 28 | |
Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 29 | return current; |
| 30 | } |
| 31 | |
| 32 | /* |
| 33 | * Reference section 5.2.9 Fixed ACPI Description Table (FADT) |
| 34 | * in the ACPI 3.0b specification. |
| 35 | */ |
| 36 | void acpi_fill_fadt(acpi_fadt_t *fadt) |
| 37 | { |
| 38 | const struct soc_amd_glinda_config *cfg = config_of_soc(); |
| 39 | |
| 40 | printk(BIOS_DEBUG, "pm_base: 0x%04x\n", ACPI_IO_BASE); |
| 41 | |
Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 42 | fadt->pm1a_evt_blk = ACPI_PM_EVT_BLK; |
| 43 | fadt->pm1a_cnt_blk = ACPI_PM1_CNT_BLK; |
| 44 | fadt->pm_tmr_blk = ACPI_PM_TMR_BLK; |
| 45 | fadt->gpe0_blk = ACPI_GPE0_BLK; |
| 46 | |
| 47 | fadt->pm1_evt_len = 4; /* 32 bits */ |
| 48 | fadt->pm1_cnt_len = 2; /* 16 bits */ |
| 49 | fadt->pm_tmr_len = 4; /* 32 bits */ |
| 50 | fadt->gpe0_blk_len = 8; /* 64 bits */ |
| 51 | |
Felix Held | b154949 | 2023-12-13 11:59:39 +0100 | [diff] [blame^] | 52 | fill_fadt_extended_pm_io(fadt); |
Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 53 | |
Martin Roth | f95a11e | 2022-10-21 16:43:08 -0600 | [diff] [blame] | 54 | fadt->iapc_boot_arch = cfg->common_config.fadt_boot_arch; /* legacy free default */ |
| 55 | fadt->flags |= ACPI_FADT_WBINVD | /* See table 5-34 ACPI 6.3 spec */ |
| 56 | ACPI_FADT_C1_SUPPORTED | |
| 57 | ACPI_FADT_S4_RTC_WAKE | |
| 58 | ACPI_FADT_32BIT_TIMER | |
| 59 | ACPI_FADT_PCI_EXPRESS_WAKE | |
| 60 | ACPI_FADT_PLATFORM_CLOCK | |
| 61 | ACPI_FADT_S4_RTC_VALID | |
| 62 | ACPI_FADT_REMOTE_POWER_ON; |
| 63 | if (cfg->s0ix_enable) |
| 64 | fadt->flags |= ACPI_FADT_LOW_PWR_IDLE_S0; |
| 65 | |
| 66 | fadt->flags |= cfg->common_config.fadt_flags; /* additional board-specific flags */ |
| 67 | } |
| 68 | |
Felix Held | 21a5ecd | 2023-03-07 01:15:42 +0100 | [diff] [blame] | 69 | const acpi_cstate_t cstate_cfg_table[] = { |
| 70 | [0] = { |
| 71 | .ctype = 1, |
| 72 | .latency = 1, |
| 73 | .power = 0, |
| 74 | }, |
| 75 | [1] = { |
| 76 | .ctype = 2, |
| 77 | .latency = 0x12, |
| 78 | .power = 0, |
| 79 | }, |
| 80 | [2] = { |
| 81 | .ctype = 3, |
| 82 | .latency = 350, |
| 83 | .power = 0, |
| 84 | }, |
| 85 | }; |
| 86 | |
| 87 | const acpi_cstate_t *get_cstate_config_data(size_t *size) |
| 88 | { |
| 89 | *size = ARRAY_SIZE(cstate_cfg_table); |
| 90 | return cstate_cfg_table; |
| 91 | } |