summaryrefslogtreecommitdiff
path: root/src/soc/amd/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd/common')
-rw-r--r--src/soc/amd/common/block/cpu/smm/Makefile.inc2
-rw-r--r--src/soc/amd/common/block/cpu/smm/smi_apmc.c (renamed from src/soc/amd/common/block/cpu/smm/smi_apmc_helper.c)32
-rw-r--r--src/soc/amd/common/block/include/amdblocks/smm.h1
3 files changed, 34 insertions, 1 deletions
diff --git a/src/soc/amd/common/block/cpu/smm/Makefile.inc b/src/soc/amd/common/block/cpu/smm/Makefile.inc
index 5694d1d9ca..3b6fb807e5 100644
--- a/src/soc/amd/common/block/cpu/smm/Makefile.inc
+++ b/src/soc/amd/common/block/cpu/smm/Makefile.inc
@@ -5,7 +5,7 @@ postcar-y += smm_helper.c
ramstage-y += finalize.c
ramstage-y += smm_relocate.c
ramstage-y += smm_helper.c
-smm-y += smi_apmc_helper.c
+smm-y += smi_apmc.c
smm-y += smi_handler.c
endif # CONFIG_SOC_AMD_COMMON_BLOCK_SMM
diff --git a/src/soc/amd/common/block/cpu/smm/smi_apmc_helper.c b/src/soc/amd/common/block/cpu/smm/smi_apmc.c
index 7b3afc2b81..0eab86c9da 100644
--- a/src/soc/amd/common/block/cpu/smm/smi_apmc_helper.c
+++ b/src/soc/amd/common/block/cpu/smm/smi_apmc.c
@@ -1,6 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <acpi/acpi.h>
+#include <amdblocks/acpi.h>
+#include <amdblocks/psp.h>
#include <amdblocks/smm.h>
+#include <arch/io.h>
#include <cpu/amd/amd64_save_state.h>
#include <cpu/x86/smm.h>
#include <elog.h>
@@ -84,3 +88,31 @@ void handle_smi_store(void)
/* drivers/smmstore/smi.c */
io_smi->rax = smmstore_exec(sub_command, (void *)(uintptr_t)reg_ebx);
}
+
+void fch_apmc_smi_handler(void)
+{
+ const uint8_t cmd = inb(pm_acpi_smi_cmd_port());
+
+ switch (cmd) {
+ case APM_CNT_ACPI_ENABLE:
+ acpi_clear_pm_gpe_status();
+ acpi_enable_sci();
+ break;
+ case APM_CNT_ACPI_DISABLE:
+ acpi_disable_sci();
+ break;
+ case APM_CNT_ELOG_GSMI:
+ if (CONFIG(ELOG_GSMI))
+ handle_smi_gsmi();
+ break;
+ case APM_CNT_SMMSTORE:
+ if (CONFIG(SMMSTORE))
+ handle_smi_store();
+ break;
+ case APM_CNT_SMMINFO:
+ psp_notify_smm();
+ break;
+ }
+
+ mainboard_smi_apmc(cmd);
+}
diff --git a/src/soc/amd/common/block/include/amdblocks/smm.h b/src/soc/amd/common/block/include/amdblocks/smm.h
index 2218385477..fb2e488922 100644
--- a/src/soc/amd/common/block/include/amdblocks/smm.h
+++ b/src/soc/amd/common/block/include/amdblocks/smm.h
@@ -9,6 +9,7 @@
void *get_smi_source_handler(int source);
void handle_smi_gsmi(void);
void handle_smi_store(void);
+void fch_apmc_smi_handler(void);
void clear_tvalid(void);
void lock_smm(void);
/* See SMITYPE_* for list possible of events. GEVENTS are handled with mainboard_smi_gpi. */