summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/soc/amd/cezanne/root_complex.c24
-rw-r--r--src/soc/amd/common/block/acpi/alib.c28
-rw-r--r--src/soc/amd/common/block/include/amdblocks/alib.h3
-rw-r--r--src/soc/amd/picasso/root_complex.c23
4 files changed, 33 insertions, 45 deletions
diff --git a/src/soc/amd/cezanne/root_complex.c b/src/soc/amd/cezanne/root_complex.c
index 3ed137ce19..f101680228 100644
--- a/src/soc/amd/cezanne/root_complex.c
+++ b/src/soc/amd/cezanne/root_complex.c
@@ -195,29 +195,9 @@ static void acipgen_dptci(void)
config->sustained_power_limit_tablet_mode_mW,
config->fast_ppt_limit_tablet_mode_mW,
config->slow_ppt_limit_tablet_mode_mW);
- /* Scope (\_SB) */
- acpigen_write_scope("\\_SB");
- /* Method(DPTC, 0, Serialized) */
- acpigen_write_method_serialized("DPTC", 0);
-
- /* TODO: The code assumes that if DPTC gets called the following object exists */
- /* If (LEqual ("\_SB.PCI0.LPCB.EC0.TBMD", 1)) */
- acpigen_write_if_lequal_namestr_int("\\_SB.PCI0.LPCB.EC0.TBMD", 1);
-
- acpigen_dptc_call_alib("TABB", (uint8_t *)(void *)&tablet_mode_input,
- sizeof(tablet_mode_input));
-
- /* Else */
- acpigen_write_else();
-
- acpigen_dptc_call_alib("DEFB", (uint8_t *)(void *)&default_input,
- sizeof(default_input));
-
- acpigen_pop_len(); /* Else */
-
- acpigen_pop_len(); /* Method DPTC */
- acpigen_pop_len(); /* Scope \_SB */
+ acpigen_write_alib_dptc((uint8_t *)&default_input, sizeof(default_input),
+ (uint8_t *)&tablet_mode_input, sizeof(tablet_mode_input));
}
static void root_complex_fill_ssdt(const struct device *device)
diff --git a/src/soc/amd/common/block/acpi/alib.c b/src/soc/amd/common/block/acpi/alib.c
index 5e1e8fb443..7dbb9b8407 100644
--- a/src/soc/amd/common/block/acpi/alib.c
+++ b/src/soc/amd/common/block/acpi/alib.c
@@ -4,7 +4,7 @@
#include <amdblocks/alib.h>
#include <types.h>
-void acpigen_dptc_call_alib(const char *buf_name, uint8_t *buffer, size_t size)
+static 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);
@@ -15,3 +15,29 @@ void acpigen_dptc_call_alib(const char *buf_name, uint8_t *buffer, size_t size)
acpigen_write_integer(ALIB_FUNCTION_DYNAMIC_POWER_THERMAL_CONFIG);
acpigen_emit_namestring(buf_name);
}
+
+void acpigen_write_alib_dptc(uint8_t *default_param, size_t default_param_len,
+ uint8_t *tablet_param, size_t tablet_param_len)
+{
+ /* Scope (\_SB) */
+ acpigen_write_scope("\\_SB");
+
+ /* Method(DPTC, 0, Serialized) */
+ acpigen_write_method_serialized("DPTC", 0);
+
+ /* TODO: The code assumes that if DPTC gets called the following object exists */
+ /* If (LEqual ("\_SB.PCI0.LPCB.EC0.TBMD", 1)) */
+ acpigen_write_if_lequal_namestr_int("\\_SB.PCI0.LPCB.EC0.TBMD", 1);
+
+ acpigen_dptc_call_alib("TABB", tablet_param, tablet_param_len);
+
+ /* Else */
+ acpigen_write_else();
+
+ acpigen_dptc_call_alib("DEFB", default_param, default_param_len);
+
+ acpigen_pop_len(); /* Else */
+
+ acpigen_pop_len(); /* Method DPTC */
+ acpigen_pop_len(); /* Scope \_SB */
+}
diff --git a/src/soc/amd/common/block/include/amdblocks/alib.h b/src/soc/amd/common/block/include/amdblocks/alib.h
index b9d34c5860..61608d5679 100644
--- a/src/soc/amd/common/block/include/amdblocks/alib.h
+++ b/src/soc/amd/common/block/include/amdblocks/alib.h
@@ -21,7 +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);
+void acpigen_write_alib_dptc(uint8_t *default_param, size_t default_param_len,
+ uint8_t *tablet_param, size_t tablet_param_len);
#endif /* !__ACPI__ */
diff --git a/src/soc/amd/picasso/root_complex.c b/src/soc/amd/picasso/root_complex.c
index 3517e3d666..eee203684b 100644
--- a/src/soc/amd/picasso/root_complex.c
+++ b/src/soc/amd/picasso/root_complex.c
@@ -193,28 +193,9 @@ static void acipgen_dptci(void)
config->sustained_power_limit_tablet_mode_mW,
config->fast_ppt_limit_tablet_mode_mW,
config->slow_ppt_limit_tablet_mode_mW);
- /* Scope (\_SB) */
- acpigen_write_scope("\\_SB");
- /* Method(DPTC, 0, Serialized) */
- acpigen_write_method_serialized("DPTC", 0);
-
- /* If (LEqual ("\_SB.PCI0.LPCB.EC0.TBMD", 1)) */
- acpigen_write_if_lequal_namestr_int("\\_SB.PCI0.LPCB.EC0.TBMD", 1);
-
- acpigen_dptc_call_alib("TABB", (uint8_t *)(void *)&tablet_mode_input,
- sizeof(tablet_mode_input));
-
- /* Else */
- acpigen_write_else();
-
- acpigen_dptc_call_alib("DEFB", (uint8_t *)(void *)&default_input,
- sizeof(default_input));
-
- acpigen_pop_len(); /* Else */
-
- acpigen_pop_len(); /* Method DPTC */
- acpigen_pop_len(); /* Scope \_SB */
+ acpigen_write_alib_dptc((uint8_t *)&default_input, sizeof(default_input),
+ (uint8_t *)&tablet_mode_input, sizeof(tablet_mode_input));
}
static void root_complex_fill_ssdt(const struct device *device)