2021-01-28 23:40:52 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
|
2021-02-03 21:38:14 +01:00
|
|
|
#include <amdblocks/acpimmio.h>
|
2021-02-09 22:55:04 +01:00
|
|
|
#include <amdblocks/smi.h>
|
2021-02-03 21:38:14 +01:00
|
|
|
#include <assert.h>
|
2021-02-09 22:55:04 +01:00
|
|
|
#include <cpu/x86/smm.h>
|
2021-02-03 21:38:14 +01:00
|
|
|
#include <soc/iomap.h>
|
2021-02-09 22:55:04 +01:00
|
|
|
#include <soc/smi.h>
|
2021-01-28 23:40:52 +01:00
|
|
|
#include <soc/southbridge.h>
|
|
|
|
|
2021-02-03 21:38:14 +01:00
|
|
|
static void fch_init_acpi_ports(void)
|
|
|
|
{
|
2021-02-09 22:55:04 +01:00
|
|
|
u32 reg;
|
|
|
|
|
2021-02-03 21:38:14 +01:00
|
|
|
/* We use some of these ports in SMM regardless of whether or not
|
|
|
|
* ACPI tables are generated. Enable these ports indiscriminately.
|
|
|
|
*/
|
|
|
|
|
|
|
|
pm_write16(PM_EVT_BLK, ACPI_PM_EVT_BLK);
|
|
|
|
pm_write16(PM1_CNT_BLK, ACPI_PM1_CNT_BLK);
|
|
|
|
pm_write16(PM_TMR_BLK, ACPI_PM_TMR_BLK);
|
|
|
|
pm_write16(PM_GPE0_BLK, ACPI_GPE0_BLK);
|
|
|
|
|
|
|
|
if (CONFIG(HAVE_SMI_HANDLER)) {
|
2021-02-09 22:55:04 +01:00
|
|
|
/* APMC - SMI Command Port */
|
|
|
|
pm_write16(PM_ACPI_SMI_CMD, APM_CNT);
|
|
|
|
configure_smi(SMITYPE_SMI_CMD_PORT, SMI_MODE_SMI);
|
|
|
|
|
|
|
|
/* SMI on SlpTyp requires sending SMI before completion
|
|
|
|
response of the I/O write. */
|
|
|
|
reg = pm_read32(PM_PCI_CTRL);
|
|
|
|
reg |= FORCE_SLPSTATE_RETRY;
|
|
|
|
pm_write32(PM_PCI_CTRL, reg);
|
|
|
|
|
|
|
|
/* Disable SlpTyp feature */
|
|
|
|
reg = pm_read8(PM_RST_CTRL1);
|
|
|
|
reg &= ~SLPTYPE_CONTROL_EN;
|
|
|
|
pm_write8(PM_RST_CTRL1, reg);
|
|
|
|
|
|
|
|
configure_smi(SMITYPE_SLP_TYP, SMI_MODE_SMI);
|
2021-02-03 21:38:14 +01:00
|
|
|
} else {
|
|
|
|
pm_write16(PM_ACPI_SMI_CMD, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Decode ACPI registers and enable standard features */
|
|
|
|
pm_write8(PM_ACPI_CONF, PM_ACPI_DECODE_STD |
|
|
|
|
PM_ACPI_GLOBAL_EN |
|
|
|
|
PM_ACPI_RTC_EN_EN |
|
|
|
|
PM_ACPI_TIMER_EN_EN);
|
|
|
|
}
|
|
|
|
|
2021-01-28 23:40:52 +01:00
|
|
|
void fch_init(void *chip_info)
|
|
|
|
{
|
2021-02-03 21:38:14 +01:00
|
|
|
fch_init_acpi_ports();
|
2021-01-28 23:40:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void fch_final(void *chip_info)
|
|
|
|
{
|
|
|
|
}
|