aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2021-09-14 15:54:41 -0700
committerFurquan Shaikh <furquan@google.com>2021-09-16 06:07:15 +0000
commitd47946e7506f5c919b7a7be78c1f6df110691397 (patch)
tree5d41bafe4441ebd676cd38d93b20e00e0ea55cb3 /src
parent34960d472b874291e788c3f3f687cdd568337c74 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/acpi/device.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/acpi/device.c b/src/acpi/device.c
index 42fa63985b..4b59990e5f 100644
--- a/src/acpi/device.c
+++ b/src/acpi/device.c
@@ -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);