summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2021-05-08 01:30:30 +0200
committerMartin Roth <martinroth@google.com>2021-05-10 04:21:18 +0000
commit18b51e93ac5a772e60a46d7dd6236e70429a1e91 (patch)
tree22ee1d33dc0926543d1f4c92e6abe469c791025f
parentdcec409e95703b7a99600187e4b56c0b458114eb (diff)
downloadcoreboot-18b51e93ac5a772e60a46d7dd6236e70429a1e91.tar.gz
coreboot-18b51e93ac5a772e60a46d7dd6236e70429a1e91.tar.bz2
coreboot-18b51e93ac5a772e60a46d7dd6236e70429a1e91.zip
soc/amd/picasso: move acpigen_dptc_call_alib to new common alib
Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: Ib0f7da12429b6278d1e4bc5d6650c7ee0f3b5209 Reviewed-on: https://review.coreboot.org/c/coreboot/+/53940 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
-rw-r--r--src/soc/amd/common/block/acpi/Kconfig3
-rw-r--r--src/soc/amd/common/block/acpi/Makefile.inc1
-rw-r--r--src/soc/amd/common/block/acpi/alib.c17
-rw-r--r--src/soc/amd/common/block/include/amdblocks/alib.h2
-rw-r--r--src/soc/amd/picasso/Kconfig1
-rw-r--r--src/soc/amd/picasso/root_complex.c17
6 files changed, 27 insertions, 14 deletions
diff --git a/src/soc/amd/common/block/acpi/Kconfig b/src/soc/amd/common/block/acpi/Kconfig
index 716610e37084..846db889d8c0 100644
--- a/src/soc/amd/common/block/acpi/Kconfig
+++ b/src/soc/amd/common/block/acpi/Kconfig
@@ -5,5 +5,8 @@ config SOC_AMD_COMMON_BLOCK_ACPI
help
Select this option to use the AcpiMmio ACPI registers.
+config SOC_AMD_COMMON_BLOCK_ACPI_ALIB
+ bool
+
config SOC_AMD_COMMON_BLOCK_ACPI_GPIO
bool
diff --git a/src/soc/amd/common/block/acpi/Makefile.inc b/src/soc/amd/common/block/acpi/Makefile.inc
index e14dba217515..9f774d477091 100644
--- a/src/soc/amd/common/block/acpi/Makefile.inc
+++ b/src/soc/amd/common/block/acpi/Makefile.inc
@@ -9,6 +9,7 @@ smm-y += acpi.c
ramstage-y += pm_state.c
ramstage-y += tables.c
+ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI_ALIB) += alib.c
ramstage-$(CONFIG_SOC_AMD_COMMON_BLOCK_ACPI_GPIO) += gpio.c
endif # CONFIG_SOC_AMD_COMMON_BLOCK_ACPI
diff --git a/src/soc/amd/common/block/acpi/alib.c b/src/soc/amd/common/block/acpi/alib.c
new file mode 100644
index 000000000000..5e1e8fb443d7
--- /dev/null
+++ b/src/soc/amd/common/block/acpi/alib.c
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <acpi/acpigen.h>
+#include <amdblocks/alib.h>
+#include <types.h>
+
+void acpigen_dptc_call_alib(const char *buf_name, uint8_t *buffer, size_t size)
+{
+ /* Name (buf_name, Buffer(size) {...} */
+ acpigen_write_name(buf_name);
+ acpigen_write_byte_buffer(buffer, size);
+
+ /* \_SB.ALIB(0xc, buf_name) */
+ acpigen_emit_namestring("\\_SB.ALIB");
+ acpigen_write_integer(ALIB_FUNCTION_DYNAMIC_POWER_THERMAL_CONFIG);
+ acpigen_emit_namestring(buf_name);
+}
diff --git a/src/soc/amd/common/block/include/amdblocks/alib.h b/src/soc/amd/common/block/include/amdblocks/alib.h
index 5e929248fdbd..b9d34c58600a 100644
--- a/src/soc/amd/common/block/include/amdblocks/alib.h
+++ b/src/soc/amd/common/block/include/amdblocks/alib.h
@@ -21,6 +21,8 @@ struct alib_dptc_param {
uint32_t value;
} __packed;
+void acpigen_dptc_call_alib(const char *buf_name, uint8_t *buffer, size_t size);
+
#endif /* !__ACPI__ */
#endif /* AMD_COMMON_ALIB_H */
diff --git a/src/soc/amd/picasso/Kconfig b/src/soc/amd/picasso/Kconfig
index 2f36f2e4ab09..e69fb62c19c9 100644
--- a/src/soc/amd/picasso/Kconfig
+++ b/src/soc/amd/picasso/Kconfig
@@ -28,6 +28,7 @@ config CPU_SPECIFIC_OPTIONS
select SOC_AMD_COMMON_BLOCK_ACP
select SOC_AMD_COMMON_BLOCK_ACPI
select SOC_AMD_COMMON_BLOCK_ACPIMMIO
+ select SOC_AMD_COMMON_BLOCK_ACPI_ALIB
select SOC_AMD_COMMON_BLOCK_ACPI_GPIO
select SOC_AMD_COMMON_BLOCK_AOAC
select SOC_AMD_COMMON_BLOCK_APOB
diff --git a/src/soc/amd/picasso/root_complex.c b/src/soc/amd/picasso/root_complex.c
index 979da3ec255b..3517e3d66662 100644
--- a/src/soc/amd/picasso/root_complex.c
+++ b/src/soc/amd/picasso/root_complex.c
@@ -177,18 +177,6 @@ static void root_complex_init(struct device *dev)
setup_ioapic((u8 *)GNB_IO_APIC_ADDR, GNB_IOAPIC_ID);
}
-static void dptc_call_alib(const char *buf_name, uint8_t *buffer, size_t size)
-{
- /* Name (buf_name, Buffer(size) {...} */
- acpigen_write_name(buf_name);
- acpigen_write_byte_buffer(buffer, size);
-
- /* \_SB.ALIB(0xc, buf_name) */
- acpigen_emit_namestring("\\_SB.ALIB");
- acpigen_write_integer(ALIB_FUNCTION_DYNAMIC_POWER_THERMAL_CONFIG);
- acpigen_emit_namestring(buf_name);
-}
-
static void acipgen_dptci(void)
{
const struct soc_amd_picasso_config *config = config_of_soc();
@@ -214,13 +202,14 @@ static void acipgen_dptci(void)
/* If (LEqual ("\_SB.PCI0.LPCB.EC0.TBMD", 1)) */
acpigen_write_if_lequal_namestr_int("\\_SB.PCI0.LPCB.EC0.TBMD", 1);
- dptc_call_alib("TABB", (uint8_t *)(void *)&tablet_mode_input,
+ acpigen_dptc_call_alib("TABB", (uint8_t *)(void *)&tablet_mode_input,
sizeof(tablet_mode_input));
/* Else */
acpigen_write_else();
- dptc_call_alib("DEFB", (uint8_t *)(void *)&default_input, sizeof(default_input));
+ acpigen_dptc_call_alib("DEFB", (uint8_t *)(void *)&default_input,
+ sizeof(default_input));
acpigen_pop_len(); /* Else */