mb/google/rex: Enhance power limit override mechanism

This patch expands the power limit override capability to include
variants directories, enabling them to modify power limit settings
configured by the baseboard.

Previously, only the baseboard could override power limit settings.
For instance, while the google/rex baseboard sets the PL1 max power
limit to 15W, the google/screebo variant couldn't override this value.

This enhancement empowers variants directories to override baseboard-
configured power limit settings, allowing for greater flexibility and
control over power limits.

BUG=b:313667378
TEST=Able to call into _weak implementation of `variant_devtree_update`
unless there is one override.

[DEBUG]  WEAK: src/mainboard/google/rex/variants/baseboard/rex/
         ramstage.c/variant_devtree_update called
[INFO ]  Overriding power limits PL1 (mW) (10000, 15000) PL2 (mW)
         (40000, 40000) PL4 (W) (84)

Change-Id: Ib07691625e075b0fbab42271512322ffc60ba13b
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79329
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
This commit is contained in:
Subrata Banik 2023-11-29 00:25:58 +05:30
parent 73c918c590
commit faf2779959
4 changed files with 22 additions and 6 deletions

View File

@ -41,12 +41,12 @@ static void mainboard_init(void *chip_info)
fw_config_gpio_padbased_override(padbased_table);
gpio_configure_pads_with_padbased(padbased_table);
free(padbased_table);
variant_devtree_update();
baseboard_devtree_update();
}
void __weak variant_devtree_update(void)
void __weak baseboard_devtree_update(void)
{
/* Override dev tree settings per board */
/* Override dev tree settings per baseboard */
}
void __weak variant_generate_s0ix_hook(enum s0ix_entry entry)

View File

@ -31,7 +31,9 @@ enum s0ix_entry {
void variant_generate_s0ix_hook(enum s0ix_entry entry);
/* Modify devictree settings during ramstage */
/* Modify devictree settings during ramstage by baseboard */
void baseboard_devtree_update(void);
/* Modify devictree settings during ramstage by dedicated variant */
void variant_devtree_update(void);
#endif /*__BASEBOARD_VARIANTS_H__ */

View File

@ -21,8 +21,15 @@ const struct cpu_tdp_power_limits limits[] = {
},
};
void variant_devtree_update(void)
void __weak variant_devtree_update(void)
{
printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);
size_t total_entries = ARRAY_SIZE(limits);
variant_update_cpu_power_limits(limits, total_entries);
}
void baseboard_devtree_update(void)
{
variant_devtree_update();
}

View File

@ -96,8 +96,10 @@ const struct cpu_tdp_power_limits power_optimized_limits[] = {
};
#endif
void variant_devtree_update(void)
void __weak variant_devtree_update(void)
{
printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);
const struct cpu_tdp_power_limits *limits = performance_efficient_limits;
size_t limits_size = ARRAY_SIZE(performance_efficient_limits);
@ -115,3 +117,8 @@ void variant_devtree_update(void)
variant_update_cpu_power_limits(limits, limits_size);
}
void baseboard_devtree_update(void)
{
variant_devtree_update();
}