Attention is currently required from: Patrick Rudolph. Nick Vaccaro has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/57345 )
Change subject: driver/intel/pmc_mux/conn: add conn_get_type_c_list() ......................................................................
driver/intel/pmc_mux/conn: add conn_get_type_c_list()
Add conn_get_type_c_list() helper routine that returns a pointer to the start of a verified list of type-c connectors.
BUG=b:149830546 TEST='emerge-volteer coreboot chromeos-bootimage' and verify it builds successfully.
Change-Id: Ic56a1ad1b617e3af000664147d21165e6ea3a742 Signed-off-by: Nick Vaccaro nvaccaro@google.com --- M src/drivers/intel/pmc_mux/conn/chip.h M src/drivers/intel/pmc_mux/conn/conn.c 2 files changed, 36 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/45/57345/1
diff --git a/src/drivers/intel/pmc_mux/conn/chip.h b/src/drivers/intel/pmc_mux/conn/chip.h index 461916e..9ef3121 100644 --- a/src/drivers/intel/pmc_mux/conn/chip.h +++ b/src/drivers/intel/pmc_mux/conn/chip.h @@ -31,4 +31,11 @@ bool intel_pmc_mux_conn_get_ports(const struct device *conn, unsigned int *usb2_port, unsigned int *usb3_port);
+/* + * Method gets the first Type-C port. + * Caller can walk the sibling list to get subsequent ports. + */ + +const struct device *conn_get_type_c_list(void); + #endif /* __DRIVERS_INTEL_PMC_MUX_CONN_H__ */ diff --git a/src/drivers/intel/pmc_mux/conn/conn.c b/src/drivers/intel/pmc_mux/conn/conn.c index b6bf371..8c1ca1d 100644 --- a/src/drivers/intel/pmc_mux/conn/conn.c +++ b/src/drivers/intel/pmc_mux/conn/conn.c @@ -3,6 +3,8 @@ #include <acpi/acpigen.h> #include <console/console.h> #include <intelblocks/acpi.h> +#include <soc/pci_devs.h> + #include "chip.h"
static const char *conn_acpi_name(const struct device *dev) @@ -100,3 +102,30 @@
return true; }; + +const struct device *conn_get_type_c_list(void) +{ + const struct device *pmc; + const struct device *mux; + + pmc = pcidev_path_on_root(PCH_DEVFN_PMC); + if (!pmc || !pmc->link_list->children) { + printk(BIOS_ERR, "%s: unable to find PMC device or its mux\n", __func__); + return NULL; + } + + mux = pmc->link_list->children; + if (mux && mux->link_list->children) { + const struct device *child = mux->link_list->children; + + /* Verify each child has a drivers_intel_pmc_mux_conn_config chip_info */ + while (child != NULL) { + if (child->chip_ops != &drivers_intel_pmc_mux_conn_ops) + return NULL; + child = child->sibling; + } + return mux->link_list->children; + } + + return NULL; +}