Attention is currently required from: Jason Nien, Martin Roth.
Jon Murphy has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/79793?usp=email )
Change subject: mb/google/skyrim: Update DDI descriptor definition ......................................................................
mb/google/skyrim: Update DDI descriptor definition
Update definition to be more intuitive and extensible. Port descriptors will be defined as individual entities and added to the descriptor list as such.
BUG=b:281059446 TEST=builds
Change-Id: Ib4ecbaaab5a21c30a67777a4522dc579cc9fa7e6 Signed-off-by: Jon Murphy jpmurphy@google.com --- M src/mainboard/google/guybrush/port_descriptors.c M src/mainboard/google/guybrush/variants/baseboard/Makefile.inc M src/mainboard/google/guybrush/variants/baseboard/include/baseboard/variants.h M src/mainboard/google/guybrush/variants/baseboard/port_descriptors.c A src/mainboard/google/guybrush/variants/baseboard/variant.c M src/mainboard/google/guybrush/variants/dewatt/variant.c M src/mainboard/google/guybrush/variants/guybrush/variant.c 7 files changed, 68 insertions(+), 44 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/79793/1
diff --git a/src/mainboard/google/guybrush/port_descriptors.c b/src/mainboard/google/guybrush/port_descriptors.c index ea59103..2a636f5 100644 --- a/src/mainboard/google/guybrush/port_descriptors.c +++ b/src/mainboard/google/guybrush/port_descriptors.c @@ -7,45 +7,10 @@ #include <soc/platform_descriptors.h> #include <types.h>
-static fsp_ddi_descriptor guybrush_czn_ddi_descriptors[] = { - { /* DDI0 - eDP */ - .connector_type = DDI_EDP, - .aux_index = DDI_AUX1, - .hdp_index = DDI_HDP1 - }, - { /* DDI1 - HDMI */ - .connector_type = DDI_HDMI, - .aux_index = DDI_AUX2, - .hdp_index = DDI_HDP2 - }, - { /* DDI2 */ - .connector_type = DDI_UNUSED_TYPE, - .aux_index = DDI_AUX3, - .hdp_index = DDI_HDP3, - }, - { /* DDI3 - DP (type C) */ - .connector_type = DDI_DP, - .aux_index = DDI_AUX3, - .hdp_index = DDI_HDP3, - }, - { /* DDI4 - DP (type C) */ - .connector_type = DDI_DP, - .aux_index = DDI_AUX4, - .hdp_index = DDI_HDP4, - } -}; - -void __weak variant_update_ddi_descriptors(fsp_ddi_descriptor *ddi_descriptors) -{ -} - void mainboard_get_dxio_ddi_descriptors( const fsp_dxio_descriptor **dxio_descs, size_t *dxio_num, const fsp_ddi_descriptor **ddi_descs, size_t *ddi_num) { variant_get_dxio_descriptors(dxio_descs, dxio_num); - variant_update_ddi_descriptors(guybrush_czn_ddi_descriptors); - - *ddi_descs = guybrush_czn_ddi_descriptors; - *ddi_num = ARRAY_SIZE(guybrush_czn_ddi_descriptors); + variant_get_ddi_descriptors(ddi_descs, ddi_num); } diff --git a/src/mainboard/google/guybrush/variants/baseboard/Makefile.inc b/src/mainboard/google/guybrush/variants/baseboard/Makefile.inc index 014dfd6..40d871f 100644 --- a/src/mainboard/google/guybrush/variants/baseboard/Makefile.inc +++ b/src/mainboard/google/guybrush/variants/baseboard/Makefile.inc @@ -6,10 +6,12 @@ romstage-y += gpio.c romstage-y += helpers.c romstage-y += port_descriptors.c +romstage-y += variant.c
ramstage-y += gpio.c ramstage-y += helpers.c ramstage-y += port_descriptors.c +ramstage-y += variant.c
verstage-y += gpio.c
diff --git a/src/mainboard/google/guybrush/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/guybrush/variants/baseboard/include/baseboard/variants.h index 9b39003..a945f9d 100644 --- a/src/mainboard/google/guybrush/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/guybrush/variants/baseboard/include/baseboard/variants.h @@ -35,7 +35,10 @@
bool variant_has_pcie_wwan(void);
-void variant_update_ddi_descriptors(fsp_ddi_descriptor *ddi_descriptors); +/* + * This function allows a variant to override ddi descriptors passed to the FSP. + */ +void variant_get_ddi_descriptors(const fsp_ddi_descriptor **ddi_descriptors, size_t *num);
/* * This function allows a variant to override dxio descriptors passed to the FSP. @@ -46,4 +49,7 @@ uint8_t variant_sd_aux_reset_gpio(void);
void variant_devtree_update(void); + +bool variant_has_hdmi(void); + #endif /* __BASEBOARD_VARIANTS_H__ */ diff --git a/src/mainboard/google/guybrush/variants/baseboard/port_descriptors.c b/src/mainboard/google/guybrush/variants/baseboard/port_descriptors.c index b2bea12..bdea910 100644 --- a/src/mainboard/google/guybrush/variants/baseboard/port_descriptors.c +++ b/src/mainboard/google/guybrush/variants/baseboard/port_descriptors.c @@ -23,6 +23,51 @@ [BASEBOARD_DXIO_DUMMY_2] = DUMMY_2_DXIO_DESCRIPTOR, };
+enum baseboard_ddi_port_id { + BASEBOARD_DDI_EDP, + BASEBOARD_DDI_HDMI, + BASEBOARD_DDI_UNUSED, + BASEBOARD_DDI_DP1, + BASEBOARD_DDI_DP2, +}; + +static fsp_ddi_descriptor guybrush_czn_ddi_descriptors[] = { + [BASEBOARD_DDI_EDP] = { + .connector_type = DDI_EDP, + .aux_index = DDI_AUX1, + .hdp_index = DDI_HDP1 + }, + [BASEBOARD_DDI_HDMI] = { + .connector_type = DDI_HDMI, + .aux_index = DDI_AUX2, + .hdp_index = DDI_HDP2 + }, + [BASEBOARD_DDI_UNUSED] = { + .connector_type = DDI_UNUSED_TYPE, + .aux_index = DDI_AUX3, + .hdp_index = DDI_HDP3, + }, + [BASEBOARD_DDI_DP1] = { + .connector_type = DDI_DP, + .aux_index = DDI_AUX3, + .hdp_index = DDI_HDP3, + }, + [BASEBOARD_DDI_DP2] = { + .connector_type = DDI_DP, + .aux_index = DDI_AUX4, + .hdp_index = DDI_HDP4, + } +}; + +__weak void variant_get_ddi_descriptors(const fsp_ddi_descriptor **ddi_descriptors, size_t *num) +{ + if (!variant_has_hdmi()) + guybrush_czn_ddi_descriptors[BASEBOARD_DDI_HDMI].connector_type = DDI_UNUSED_TYPE; + + *ddi_descriptors = guybrush_czn_ddi_descriptors; + *num = ARRAY_SIZE(guybrush_czn_ddi_descriptors); +} + __weak void variant_get_dxio_descriptors(const fsp_dxio_descriptor **dxio_descriptor, size_t *num) { /* Get Variant specific SD AUX Reset GPIO */ diff --git a/src/mainboard/google/guybrush/variants/baseboard/variant.c b/src/mainboard/google/guybrush/variants/baseboard/variant.c new file mode 100644 index 0000000..ead29b6 --- /dev/null +++ b/src/mainboard/google/guybrush/variants/baseboard/variant.c @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <baseboard/variants.h> + +__weak bool variant_has_hdmi(void) +{ + return true; +} diff --git a/src/mainboard/google/guybrush/variants/dewatt/variant.c b/src/mainboard/google/guybrush/variants/dewatt/variant.c index a985b05..610e493 100644 --- a/src/mainboard/google/guybrush/variants/dewatt/variant.c +++ b/src/mainboard/google/guybrush/variants/dewatt/variant.c @@ -3,8 +3,7 @@ #include <baseboard/variants.h> #include <amdblocks/cpu.h>
-void variant_update_ddi_descriptors(fsp_ddi_descriptor *ddi_descriptors) +bool variant_has_hdmi(void) { - if ((get_cpu_count() == 4 && get_threads_per_core() == 2) || get_cpu_count() == 2) - ddi_descriptors[1].connector_type = DDI_UNUSED_TYPE; -} + return ((get_cpu_count() == 4 && get_threads_per_core() == 2) || get_cpu_count() == 2); +} \ No newline at end of file diff --git a/src/mainboard/google/guybrush/variants/guybrush/variant.c b/src/mainboard/google/guybrush/variants/guybrush/variant.c index 394270c..bbc9d11 100644 --- a/src/mainboard/google/guybrush/variants/guybrush/variant.c +++ b/src/mainboard/google/guybrush/variants/guybrush/variant.c @@ -16,8 +16,7 @@ return board_id() == 1 ? GPIO_70 : GPIO_69; }
-void variant_update_ddi_descriptors(fsp_ddi_descriptor *ddi_descriptors) +bool variant_has_hdmi(void) { - if ((get_cpu_count() == 4 && get_threads_per_core() == 2) || get_cpu_count() == 2) - ddi_descriptors[1].connector_type = DDI_UNUSED_TYPE; + return ((get_cpu_count() == 4 && get_threads_per_core() == 2) || get_cpu_count() == 2); }