Maulik V Vaghela has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/59577 )
Change subject: WIP: drivers/intel/retimer: Map correct physical port to EC port ......................................................................
WIP: drivers/intel/retimer: Map correct physical port to EC port
Change-Id: I2f9cb544d60dbb3450bd5bcd22a85c193de212cc Signed-off-by: MAULIK V VAGHELA maulik.v.vaghela@intel.com --- M src/drivers/intel/usb4/retimer/retimer.c 1 file changed, 30 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/77/59577/1
diff --git a/src/drivers/intel/usb4/retimer/retimer.c b/src/drivers/intel/usb4/retimer/retimer.c index e549525..34d1831 100644 --- a/src/drivers/intel/usb4/retimer/retimer.c +++ b/src/drivers/intel/usb4/retimer/retimer.c @@ -334,13 +334,39 @@ } }
+static uint8_t map_physical_port_to_ec_port(uint8_t usb_port) +{ + struct device *dev = NULL; + uint8_t ec_port = 0; + + const struct device *tcss_port_arr[] = { + DEV_PTR(tcss_usb3_port1), + DEV_PTR(tcss_usb3_port2), + DEV_PTR(tcss_usb3_port3), + DEV_PTR(tcss_usb3_port4), + }; + + for (uint8_t i = 0; i < MAX_TYPE_C_PORTS; i++) + { + if (i == usb_port) { + printk(BIOS_ERR, "USB Type-C %d mapped to EC port %d\n", i, ec_port); + return ec_port; + } + + if (is_dev_enabled(tcss_port_arr[i])) + ec_port++; + } + + return 0xFF; +} + static void usb4_retimer_fill_ssdt(const struct device *dev) { struct drivers_intel_usb4_retimer_config *config = dev->chip_info; const struct device *usb_device; static char dfp[DEVICE_PATH_MAX]; struct acpi_pld pld; - uint8_t dfp_port, usb_port; + uint8_t dfp_port, usb_port, ec_port;
usb4_retimer_scope = acpi_device_scope(dev); if (!usb4_retimer_scope || !config) @@ -364,6 +390,7 @@
usb_device = config->dfp[dfp_port].typec_port; usb_port = usb_device->path.usb.port_id; + ec_port = map_physical_port_to_ec_port(usb_port);
/* DFPx */ snprintf(dfp, sizeof(dfp), "DFP%1d", usb_port); @@ -408,8 +435,8 @@ acpigen_pop_len(); /* Host Router */ acpigen_pop_len(); /* Scope */
- printk(BIOS_INFO, "%s: %s at %s\n", acpi_device_path(dev), dev->chip_ops->name, - dev_path(dev)); + printk(BIOS_INFO, "%s: %s at %s with %d\n", acpi_device_path(dev), dev->chip_ops->name, + dev_path(dev), ec_port); }
static struct device_operations usb4_retimer_dev_ops = {