Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/80738?usp=email )
Change subject: vc/google/chromeos: Refactor bmp_logo_filename() for product segment ......................................................................
vc/google/chromeos: Refactor bmp_logo_filename() for product segment
* Differentiate boot splash logos for Chromebook, Chromebook-Plus (hard-branded), and Chromebook-Plus (soft-branded) devices. * Logic depends on hardware compliance and VPD product requirements.
BUG=b:324107408 TEST=Verified logo selection based on compliance and product requirements.
Change-Id: I9bb1e868764738333977bd8c990bea4253c9d37b Signed-off-by: Subrata Banik subratabanik@google.com --- M src/vendorcode/google/chromeos/Makefile.mk M src/vendorcode/google/chromeos/chromeos.h M src/vendorcode/google/chromeos/splash.c M src/vendorcode/google/chromeos/tpm_factory_config.c A src/vendorcode/google/chromeos/vpd_device_feature.c 5 files changed, 91 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/38/80738/1
diff --git a/src/vendorcode/google/chromeos/Makefile.mk b/src/vendorcode/google/chromeos/Makefile.mk index af37a09..1ff1e18 100644 --- a/src/vendorcode/google/chromeos/Makefile.mk +++ b/src/vendorcode/google/chromeos/Makefile.mk @@ -10,6 +10,7 @@ ramstage-$(CONFIG_USE_SAR) += sar.c ramstage-$(CONFIG_TPM_GOOGLE) += cr50_enable_update.c ramstage-$(CONFIG_TPM_GOOGLE) += tpm_factory_config.c +ramstage-$(CONFIG_VPD) += vpd_device_feature.c
romstage-$(CONFIG_CHROMEOS_CSE_BOARD_RESET_OVERRIDE) += cse_board_reset.c ramstage-$(CONFIG_CHROMEOS_CSE_BOARD_RESET_OVERRIDE) += cse_board_reset.c diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h index a4315c3..7689a2f 100644 --- a/src/vendorcode/google/chromeos/chromeos.h +++ b/src/vendorcode/google/chromeos/chromeos.h @@ -43,9 +43,25 @@ * - Bits 3-0 (0x1): Must be 0x1 to signify compliance with Chromebook Plus * hardware specifications. * - * To be considered a Chromebook Plus, either of these conditions needs to be met. + * To be considered a Chromebook Plus, both of these conditions needs to be met. */ -bool chromeos_device_branded_plus(void); +bool chromeos_device_branded_plus_hard(void); + +/* + * Determines whether a ChromeOS device is soft-branded as a Chromebook Plus + * after meeting below conditions: + * + * - Device is compliant to the Chromebook-Plus Hardware Specification. + * - Business decision makes this device qualified as Chromebook-Plus. + * + * To be considered a soft-branded Chromebook Plus, both of these conditions needs to be met. + */ +bool chromeos_device_branded_plus_soft(void); + +/* + * Return the value after reading the VPD key named "feature_device_info". + */ +const char *chromeos_get_feature_device_info(void);
/* * Declaration for mainboards to use to generate ACPI-specific ChromeOS needs. diff --git a/src/vendorcode/google/chromeos/splash.c b/src/vendorcode/google/chromeos/splash.c index 3532fb8..f63f526 100644 --- a/src/vendorcode/google/chromeos/splash.c +++ b/src/vendorcode/google/chromeos/splash.c @@ -5,7 +5,9 @@
const char *bmp_logo_filename(void) { - if (chromeos_device_branded_plus()) + if (chromeos_device_branded_plus_hard()) + return "cb_plus_logo.bmp"; + else if (chromeos_device_branded_plus_soft()) return "cb_plus_logo.bmp"; else return "cb_logo.bmp"; diff --git a/src/vendorcode/google/chromeos/tpm_factory_config.c b/src/vendorcode/google/chromeos/tpm_factory_config.c index 44fb9f0..4c17d69 100644 --- a/src/vendorcode/google/chromeos/tpm_factory_config.c +++ b/src/vendorcode/google/chromeos/tpm_factory_config.c @@ -3,12 +3,13 @@ #include <assert.h> #include <console/console.h> #include <security/tpm/tss.h> +#include <string.h> #include <types.h> #include <vendorcode/google/chromeos/chromeos.h>
#define CHROMEBOOK_PLUS_HARD_BRANDED BIT(4) -#define CHROMEBOOK_PLUS_SOFT_BRANDED BIT(0) -#define CHROMEBOOK_PLUS_DEVICE (CHROMEBOOK_PLUS_HARD_BRANDED | CHROMEBOOK_PLUS_SOFT_BRANDED) +#define CHROMEBOOK_PLUS_HW_COMPLIANCE BIT(0) +#define CHROMEBOOK_PLUS_DEVICE (CHROMEBOOK_PLUS_HARD_BRANDED & CHROMEBOOK_PLUS_HW_COMPLIANCE)
uint64_t chromeos_get_factory_config(void) { @@ -47,9 +48,9 @@ * - Bits 3-0 (0x1): Must be 0x1 to signify compliance with Chromebook Plus * hardware specifications. * - * To be considered a Chromebook Plus, either of these conditions needs to be met. + * To be considered a hard-branded Chromebook Plus, both of these conditions needs to be met. */ -bool chromeos_device_branded_plus(void) +bool chromeos_device_branded_plus_hard(void) { uint64_t factory_config = chromeos_get_factory_config();
@@ -58,3 +59,51 @@
return factory_config & CHROMEBOOK_PLUS_DEVICE; } + +/* + * Determines whether a ChromeOS device is compliant to the Chromebook Plus + * hardware specific: + * + * - Bits 3-0 (0x1): Must be 0x1 to signify compliance with Chromebook Plus + * hardware specifications. + * + * A ChromeOS device that compliant to the Chromebook Plus hardware specification + * (but don't have "chromebook-plus" branding on the chassis) can be often branded + * as "Regular Chromebook" or "Soft-branded Chromebook-Plus" depending on the product + * requirement. + */ +static bool chromeos_device_plus_hw_compliant(void) +{ + uint64_t factory_config = chromeos_get_factory_config(); + + if (factory_config == UNDEFINED_FACTORY_CONFIG) + return false; + + return factory_config & CHROMEBOOK_PLUS_HW_COMPLIANCE; +} + +/* + * Determines whether a ChromeOS device is soft-branded as a Chromebook Plus + * after meeting below conditions: + * + * - Device is compliant to the Chromebook-Plus Hardware Specification. + * - Product requirement makes this device qualified as Chromebook-Plus. + * + * To be considered a soft-branded Chromebook Plus, both of these conditions needs to be met. + */ +bool chromeos_device_branded_plus_soft(void) +{ + if (!chromeos_device_plus_hw_compliant()) + return false; + + const char *device_info = chromeos_get_feature_device_info(); + + /* + * Feature level: First 3 character from `feature_device_info` VPD + * If `Feature level` = 'CAI` then chromebook-plus. + */ + if (strncmp((char *)device_info, "CAI", 3) == 0) + return true; + else + return false; +} diff --git a/src/vendorcode/google/chromeos/vpd_device_feature.c b/src/vendorcode/google/chromeos/vpd_device_feature.c new file mode 100644 index 0000000..8ecbf56 --- /dev/null +++ b/src/vendorcode/google/chromeos/vpd_device_feature.c @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <drivers/vpd/vpd.h> +#include <drivers/vpd/vpd_tables.h> +#include <vendorcode/google/chromeos/chromeos.h> + +#define VPD_KEY_FEATURE_DEVICE_INFO "feature_device_info" +#define VPD_DEVICE_INFO_LEN 64 + +const char *chromeos_get_feature_device_info(void) +{ + static char device_info[VPD_DEVICE_INFO_LEN]; + if (vpd_gets(VPD_KEY_FEATURE_DEVICE_INFO, device_info, VPD_DEVICE_INFO_LEN, VPD_RW)) + return device_info; + return ""; +}