acpi: Generate power resource name instead of default "PRIC"
This change uses a static 8-bit counter in `acpi_device_add_power_res()` to generate the name of power resource object rather using a default name "PRIC". This makes it easier to identify which power resource Linux kernel logs are referring to. If more than 256 power resources are used in the system, then the counter will wrap around to 0. However, 256 seems to be a large enough number for the power resource count. TEST=Verified that Power Resources are named as expected: ``` dmesg | grep ACPI | grep PR [ 0.550921] ACPI: Power Resource [PR00] (on) [ 0.869960] ACPI: Power Resource [PR01] (on) [ 1.013973] ACPI: Power Resource [PR02] (on) ``` No new ACPI errors are seen in dmesg on brya. Change-Id: Ia18f7177b03821ce0f8c989ae5d258f2f83517a5 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/57650 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
parent
34960d472b
commit
d47946e750
|
@ -645,16 +645,20 @@ static void acpigen_write_power_res_STA(const struct acpi_power_res_params *para
|
|||
/* PowerResource() with Enable and/or Reset control */
|
||||
void acpi_device_add_power_res(const struct acpi_power_res_params *params)
|
||||
{
|
||||
static uint8_t id;
|
||||
static const char * const power_res_dev_states[] = { "_PR0", "_PR3" };
|
||||
unsigned int reset_gpio = params->reset_gpio ? params->reset_gpio->pins[0] : 0;
|
||||
unsigned int enable_gpio = params->enable_gpio ? params->enable_gpio->pins[0] : 0;
|
||||
unsigned int stop_gpio = params->stop_gpio ? params->stop_gpio->pins[0] : 0;
|
||||
char pr_name[ACPI_NAME_BUFFER_SIZE];
|
||||
|
||||
if (!reset_gpio && !enable_gpio && !stop_gpio)
|
||||
return;
|
||||
|
||||
/* PowerResource (PRIC, 0, 0) */
|
||||
acpigen_write_power_res("PRIC", 0, 0, power_res_dev_states,
|
||||
snprintf(pr_name, sizeof(pr_name), "PR%02X", id++);
|
||||
|
||||
/* PowerResource (PR##, 0, 0) */
|
||||
acpigen_write_power_res(pr_name, 0, 0, power_res_dev_states,
|
||||
ARRAY_SIZE(power_res_dev_states));
|
||||
|
||||
if (params->use_gpio_for_status) {
|
||||
|
@ -704,7 +708,7 @@ void acpi_device_add_power_res(const struct acpi_power_res_params *params)
|
|||
}
|
||||
acpigen_pop_len(); /* _OFF method */
|
||||
|
||||
acpigen_pop_len(); /* PowerResource PRIC */
|
||||
acpigen_pop_len(); /* PowerResource PR## */
|
||||
}
|
||||
|
||||
static void acpi_dp_write_array(const struct acpi_dp *array);
|
||||
|
|
Loading…
Reference in New Issue