| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
#include <acpi/acpi.h> |
| 8 |
#include <acpi/acpigen.h> |
| 9 |
#include <amdblocks/acpi.h> |
| 10 |
#include <amdblocks/cppc.h> |
| 11 |
#include <amdblocks/cpu.h> |
| 12 |
#include <amdblocks/acpimmio.h> |
| 13 |
#include <amdblocks/ioapic.h> |
| 14 |
#include <arch/ioapic.h> |
| 15 |
#include <arch/smp/mpspec.h> |
| 16 |
#include <console/console.h> |
| 17 |
#include <cpu/amd/cpuid.h> |
| 18 |
#include <device/device.h> |
| 19 |
#include <drivers/amd/opensil/opensil.h> |
| 20 |
#include <soc/iomap.h> |
| 21 |
#include <static.h> |
| 22 |
#include <types.h> |
| 23 |
#include "chip.h" |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
void acpi_fill_fadt(acpi_fadt_t *fadt) |
| 30 |
{ |
| 31 |
const struct soc_amd_phoenix_config *cfg = config_of_soc(); |
| 32 |
|
| 33 |
if (CONFIG(PLATFORM_USES_FSP2_0)) { |
| 34 |
printk(BIOS_DEBUG, "pm_base: 0x%04x\n", ACPI_IO_BASE); |
| 35 |
|
| 36 |
fadt->pm1a_evt_blk = ACPI_PM_EVT_BLK; |
| 37 |
fadt->pm1a_cnt_blk = ACPI_PM1_CNT_BLK; |
| 38 |
fadt->pm_tmr_blk = ACPI_PM_TMR_BLK; |
| 39 |
fadt->gpe0_blk = ACPI_GPE0_BLK; |
| 40 |
} else { |
| 41 |
|
| 42 |
amd_opensil_fill_fadt_io_ports(fadt); |
| 43 |
} |
| 44 |
|
| 45 |
fadt->pm1_evt_len = 4; |
| 46 |
fadt->pm1_cnt_len = 2; |
| 47 |
fadt->pm_tmr_len = 4; |
| 48 |
fadt->gpe0_blk_len = 8; |
| 49 |
|
| 50 |
fill_fadt_extended_pm_io(fadt); |
| 51 |
|
| 52 |
fadt->iapc_boot_arch = cfg->common_config.fadt_boot_arch; |
| 53 |
fadt->flags |= ACPI_FADT_WBINVD | |
| 54 |
ACPI_FADT_C1_SUPPORTED | |
| 55 |
ACPI_FADT_S4_RTC_WAKE | |
| 56 |
ACPI_FADT_32BIT_TIMER | |
| 57 |
ACPI_FADT_PCI_EXPRESS_WAKE | |
| 58 |
ACPI_FADT_PLATFORM_CLOCK | |
| 59 |
ACPI_FADT_S4_RTC_VALID | |
| 60 |
ACPI_FADT_REMOTE_POWER_ON; |
| 61 |
if (cfg->s0ix_enable) |
| 62 |
fadt->flags |= ACPI_FADT_LOW_PWR_IDLE_S0; |
| 63 |
|
| 64 |
fadt->flags |= cfg->common_config.fadt_flags; |
| 65 |
} |
| 66 |
|
| 67 |
unsigned long soc_acpi_write_tables(const struct device *device, unsigned long current, |
| 68 |
acpi_rsdp_t *rsdp) |
| 69 |
{ |
| 70 |
|
| 71 |
current = acpi_add_ivrs_table(current, rsdp); |
| 72 |
|
| 73 |
if (CONFIG(PLATFORM_USES_FSP2_0)) |
| 74 |
current = acpi_add_fsp_tables(current, rsdp); |
| 75 |
else |
| 76 |
current = acpi_add_opensil_tables(current, rsdp); |
| 77 |
|
| 78 |
return current; |
| 79 |
} |
| 80 |
|
| 81 |
const acpi_cstate_t cstate_cfg_table[] = { |
| 82 |
[0] = { |
| 83 |
.ctype = 1, |
| 84 |
.latency = 1, |
| 85 |
.power = 0, |
| 86 |
}, |
| 87 |
[1] = { |
| 88 |
.ctype = 2, |
| 89 |
.latency = 0x12, |
| 90 |
.power = 0, |
| 91 |
}, |
| 92 |
[2] = { |
| 93 |
.ctype = 3, |
| 94 |
.latency = 350, |
| 95 |
.power = 0, |
| 96 |
}, |
| 97 |
}; |
| 98 |
|
| 99 |
const acpi_cstate_t *get_cstate_config_data(size_t *size) |
| 100 |
{ |
| 101 |
*size = ARRAY_SIZE(cstate_cfg_table); |
| 102 |
return cstate_cfg_table; |
| 103 |
} |