diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2023-01-12 23:06:41 +0100 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-01-13 23:35:48 +0000 |
commit | 4a973324da513a54c8e7fbeb5d1b8dd2ea27b927 (patch) | |
tree | 30d5689800ed24e10345cd1b81569f3263463d13 | |
parent | e18d45cdf73845a41cc7f0333fd0f5e6aa3fed1d (diff) |
soc/amd: introduce common SMU S3/4/5 entry message code
The smu_sx_entry function is identical for all AMD SoCs, so introduce it
as common code that can be selected to be included in the build via the
SOC_AMD_COMMON_BLOCK_SMU_SX_ENTRY Kconfig option. The only SoC-specific
difference in this function is the ID of the SMC_MSG_S3ENTRY message
which is defined in each SoC's soc/smu.h include file.
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Suggested-by: Elyes Haouas <ehaouas@noos.fr>
Change-Id: I49758e9333a351d8e50e8f1b53a7f00fbe89866c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/71875
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
-rw-r--r-- | src/soc/amd/common/block/smu/Kconfig | 7 | ||||
-rw-r--r-- | src/soc/amd/common/block/smu/Makefile.inc | 2 | ||||
-rw-r--r-- | src/soc/amd/common/block/smu/smu_sx_entry.c | 17 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/soc/amd/common/block/smu/Kconfig b/src/soc/amd/common/block/smu/Kconfig index 40195c9db3..4a76edb6f8 100644 --- a/src/soc/amd/common/block/smu/Kconfig +++ b/src/soc/amd/common/block/smu/Kconfig @@ -3,3 +3,10 @@ config SOC_AMD_COMMON_BLOCK_SMU select SOC_AMD_COMMON_BLOCK_SMN help Select this option to add functions to communicate with the SMU to the build. + +config SOC_AMD_COMMON_BLOCK_SMU_SX_ENTRY + bool + depends on SOC_AMD_COMMON_BLOCK_SMU + help + Select this option to add the function to send the S3/4/5 entry + message to the SMU. diff --git a/src/soc/amd/common/block/smu/Makefile.inc b/src/soc/amd/common/block/smu/Makefile.inc index 65ad6a7bcc..42bdf7006a 100644 --- a/src/soc/amd/common/block/smu/Makefile.inc +++ b/src/soc/amd/common/block/smu/Makefile.inc @@ -3,3 +3,5 @@ smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_SMU) += smu.c bootblock-$(CONFIG_SOC_AMD_COMMON_BLOCK_SMU) += smu.c romstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_SMU) += smu.c ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_SMU) += smu.c + +smm-$(CONFIG_SOC_AMD_COMMON_BLOCK_SMU_SX_ENTRY) += smu_sx_entry.c diff --git a/src/soc/amd/common/block/smu/smu_sx_entry.c b/src/soc/amd/common/block/smu/smu_sx_entry.c new file mode 100644 index 0000000000..1496957117 --- /dev/null +++ b/src/soc/amd/common/block/smu/smu_sx_entry.c @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <console/console.h> +#include <amdblocks/smu.h> +#include <soc/smu.h> + +/* + * Request the SMU to put system into S3, S4, or S5. On entry, SlpTyp determines S-State and + * SlpTypeEn gets set by the SMU. Function does not return if successful. + */ +void smu_sx_entry(void) +{ + struct smu_payload msg = { 0 }; /* Unused for SMC_MSG_S3ENTRY */ + + printk(BIOS_DEBUG, "SMU: Put system into S3/S4/S5\n"); + send_smu_message(SMC_MSG_S3ENTRY, &msg); +} |