summaryrefslogtreecommitdiff
path: root/src/soc/amd/common/block
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd/common/block')
-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
4 files changed, 23 insertions, 0 deletions
diff --git a/src/soc/amd/common/block/acpi/Kconfig b/src/soc/amd/common/block/acpi/Kconfig
index 716610e370..846db889d8 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 e14dba2175..9f774d4770 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 0000000000..5e1e8fb443
--- /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 5e929248fd..b9d34c5860 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 */