Kevin Chiu has uploaded this change for review. ( https://review.coreboot.org/21533
Change subject: google/snappy: Override SKU ID by VPD ......................................................................
google/snappy: Override SKU ID by VPD
since snappy PCB may have over 9 SKU and current GPIO board ID GP16/GP17 is insufficient to use. Using VPD to control could prevent H/W change.
BUG=b:65339688 BRANCH=reef TEST=emerge-snappy coreboot Change-Id: I55ab741354797e022dd945da9c8499ee5e041316 signed-off-by: Kevin Chiu Kevin.Chiu@quantatw.com --- M src/mainboard/google/reef/variants/snappy/mainboard.c 1 file changed, 21 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/21533/1
diff --git a/src/mainboard/google/reef/variants/snappy/mainboard.c b/src/mainboard/google/reef/variants/snappy/mainboard.c index a04f61a..9633faa 100644 --- a/src/mainboard/google/reef/variants/snappy/mainboard.c +++ b/src/mainboard/google/reef/variants/snappy/mainboard.c @@ -15,8 +15,29 @@
#include <baseboard/variants.h> #include <ec/google/chromeec/ec.h> +#include <vendorcode/google/chromeos/cros_vpd.h>
void variant_board_ec_set_skuid(void) { google_chromeec_set_sku_id(variant_board_sku()); } + +/* + * override SKU ID by VPD definition + */ +uint8_t variant_board_sku(void) +{ + static int board_sku_num = -1; + char vpd_skuid[] = "skuid"; + char vpd_skuid_buffer[2]; + + if(!cros_vpd_gets(vpd_skuid, vpd_skuid_buffer, + ARRAY_SIZE(vpd_skuid_buffer))) { + board_sku_num = 8; + } + else { + board_sku_num = vpd_skuid_buffer[0] - '0'; + } + + return board_sku_num; +}