EricR Lai has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/61391 )
Change subject: drivers/intel/usb4/retimer: Replace HR with acpi name ......................................................................
drivers/intel/usb4/retimer: Replace HR with acpi name
Uses acpi name to replace hard code "HR".
BUG=b:215742472 TEST=check acpi table is no "HR"
Signed-off-by: Eric Lai ericr_lai@compal.corp-partner.google.com Change-Id: I15b439b58eee916f977775226e492aeb17343c3d --- M src/drivers/intel/usb4/retimer/retimer.c 1 file changed, 12 insertions(+), 11 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/61391/1
diff --git a/src/drivers/intel/usb4/retimer/retimer.c b/src/drivers/intel/usb4/retimer/retimer.c index f180f8f..3b2b65a 100644 --- a/src/drivers/intel/usb4/retimer/retimer.c +++ b/src/drivers/intel/usb4/retimer/retimer.c @@ -173,7 +173,7 @@ * Arg3: A package containing parameters for the function specified * by the UUID, revision ID, function index and port index. */ -static void usb4_retimer_cb_standard_query(uint8_t port, void *arg) +static void usb4_retimer_cb_standard_query(uint8_t port, void *arg, const char *name) { /* * ToInteger (Arg1, Local1) @@ -193,12 +193,12 @@ acpigen_write_return_singleton_buffer(0x1); }
-static void usb4_retimer_cb_get_power_state(uint8_t port, void *arg) +static void usb4_retimer_cb_get_power_state(uint8_t port, void *arg, const char *name) { const char *PWR; char pwr[DEVICE_PATH_MAX];
- snprintf(pwr, sizeof(pwr), "HR.DFP%1d.PWR", port); + snprintf(pwr, sizeof(pwr), "%s.DFP%1d.PWR", name, port); PWR = usb4_retimer_path_arg(pwr);
/* @@ -222,13 +222,13 @@ acpigen_pop_len(); }
-static void usb4_retimer_cb_set_power_state(uint8_t port, void *arg) +static void usb4_retimer_cb_set_power_state(uint8_t port, void *arg, const char *name) { struct acpi_gpio *power_gpio = arg; const char *PWR; char pwr[DEVICE_PATH_MAX];
- snprintf(pwr, sizeof(pwr), "HR.DFP%1d.PWR", port); + snprintf(pwr, sizeof(pwr), "%s.DFP%1d.PWR", name, port); PWR = usb4_retimer_path_arg(pwr);
/* @@ -308,13 +308,13 @@ acpigen_pop_len(); }
-static void (*usb4_retimer_callbacks[3])(uint8_t port, void *) = { +static void (*usb4_retimer_callbacks[3])(uint8_t port, void *, const char *name) = { usb4_retimer_cb_standard_query, /* Function 0 */ usb4_retimer_cb_get_power_state, /* Function 1 */ usb4_retimer_cb_set_power_state, /* Function 2 */ };
-static void usb4_retimer_write_dsm(uint8_t port, const char *uuid, +static void usb4_retimer_write_dsm(uint8_t port, const char *uuid, const char *name, void (**callbacks)(uint8_t port, void *), size_t count, void *arg) { struct usb4_retimer_dsm_uuid id = DSM_UUID(uuid, callbacks, count, arg); @@ -328,7 +328,7 @@
/* Callback to write if handler. */ if (id.callbacks[i]) - id.callbacks[i](port, id.arg); + id.callbacks[i](port, id.arg, name);
acpigen_pop_len(); /* If */ } @@ -339,19 +339,20 @@ struct drivers_intel_usb4_retimer_config *config = dev->chip_info; const struct device *usb_device; static char dfp[DEVICE_PATH_MAX]; + const char *name = acpi_device_name(dev); struct acpi_pld pld; uint8_t dfp_port, usb_port; int ec_port = 0;
usb4_retimer_scope = acpi_device_scope(dev); - if (!usb4_retimer_scope || !config) + if (!usb4_retimer_scope || !config || !name) return;
/* Scope */ acpigen_write_scope(usb4_retimer_scope);
/* Host router */ - acpigen_write_device("HR"); + acpigen_write_device(name); acpigen_write_ADR(0); acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
@@ -403,7 +404,7 @@ /* Return (Buffer (One) { 0x0 }) */ acpigen_write_return_singleton_buffer(0x0); acpigen_pop_len(); - usb4_retimer_write_dsm(ec_port, INTEL_USB4_RETIMER_DSM_UUID, + usb4_retimer_write_dsm(ec_port, INTEL_USB4_RETIMER_DSM_UUID, name, usb4_retimer_callbacks, ARRAY_SIZE(usb4_retimer_callbacks), (void *)&config->dfp[dfp_port].power_gpio); /* Default case: Return (Buffer (One) { 0x0 }) */