Felix Held submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Patrick Rudolph: Looks good to me, approved
arch/x86: introduce HAVE_CONFIGURABLE_APMC_SMI_PORT

Introduce the HAVE_CONFIGURABLE_APMC_SMI_PORT Kconfig option that when
not selected will result in a default implementation of
pm_acpi_smi_cmd_port to be included in the build that returns APM_CNT.
SoCs that provide their own pm_acpi_smi_cmd_port implementation, need to
select this Kconfig option.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: Iaceb61b0f2a630d7afe2e0780b6a2a9806ea62f9
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79566
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com>
---
M src/arch/x86/Kconfig
M src/arch/x86/Makefile.inc
A src/arch/x86/apmc_smi_port.c
M src/mainboard/emulation/qemu-q35/Makefile.inc
D src/mainboard/emulation/qemu-q35/smi.c
M src/soc/amd/common/block/smi/Kconfig
6 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig
index e149f08..0c11653 100644
--- a/src/arch/x86/Kconfig
+++ b/src/arch/x86/Kconfig
@@ -316,6 +316,13 @@
bool
depends on HAVE_CF9_RESET

+config HAVE_CONFIGURABLE_APMC_SMI_PORT
+ bool
+ help
+ SoCs that have a configurable APMC SMI command port, should select
+ this option and implement pm_acpi_smi_cmd_port() that returns the IO
+ port.
+
config PIRQ_ROUTE
bool
default n
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 62294a6..04a0e58 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -336,3 +336,8 @@
smm-$(CONFIG_DEBUG_NULL_DEREF_BREAKPOINTS_IN_ALL_STAGES) += null_breakpoint.c

smm-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/smihandler.c)
+
+ifneq ($(CONFIG_HAVE_CONFIGURABLE_APMC_SMI_PORT),y)
+ramstage-y += apmc_smi_port.c
+smm-y += apmc_smi_port.c
+endif
diff --git a/src/arch/x86/apmc_smi_port.c b/src/arch/x86/apmc_smi_port.c
new file mode 100644
index 0000000..ac8f336
--- /dev/null
+++ b/src/arch/x86/apmc_smi_port.c
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <cpu/x86/smm.h>
+
+/* default implementation of the !HAVE_CONFIGURABLE_APMC_SMI_PORT case */
+uint16_t pm_acpi_smi_cmd_port(void)
+{
+ return APM_CNT;
+}
diff --git a/src/mainboard/emulation/qemu-q35/Makefile.inc b/src/mainboard/emulation/qemu-q35/Makefile.inc
index f4a89be..bc73edc 100644
--- a/src/mainboard/emulation/qemu-q35/Makefile.inc
+++ b/src/mainboard/emulation/qemu-q35/Makefile.inc
@@ -20,5 +20,4 @@

ramstage-$(CONFIG_CHROMEOS) += chromeos.c

-smm-y += smi.c
smm-y += memmap.c
diff --git a/src/mainboard/emulation/qemu-q35/smi.c b/src/mainboard/emulation/qemu-q35/smi.c
deleted file mode 100644
index 5d8d482..0000000
--- a/src/mainboard/emulation/qemu-q35/smi.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#include <cpu/x86/smm.h>
-
-/* The X86 qemu target uses AMD64 save states but the APM port is not configurable. */
-uint16_t pm_acpi_smi_cmd_port(void)
-{
- return APM_CNT;
-}
diff --git a/src/soc/amd/common/block/smi/Kconfig b/src/soc/amd/common/block/smi/Kconfig
index b205437..5a3f42d 100644
--- a/src/soc/amd/common/block/smi/Kconfig
+++ b/src/soc/amd/common/block/smi/Kconfig
@@ -1,5 +1,6 @@
config SOC_AMD_COMMON_BLOCK_SMI
bool
+ select HAVE_CONFIGURABLE_APMC_SMI_PORT
help
Select this option to add the common functions for setting up the SMI
configuration to the build.

To view, visit change 79566. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Iaceb61b0f2a630d7afe2e0780b6a2a9806ea62f9
Gerrit-Change-Number: 79566
Gerrit-PatchSet: 7
Gerrit-Owner: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Fred Reitberger <reitbergerfred@gmail.com>
Gerrit-Reviewer: Jason Glenesk <jason.glenesk@gmail.com>
Gerrit-Reviewer: Jérémy Compostella <jeremy.compostella@intel.com>
Gerrit-Reviewer: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Gerrit-Reviewer: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged