diff --git a/src/mainboard/google/reef/mainboard.c b/src/mainboard/google/reef/mainboard.c index 4425c0184c..e350df226e 100644 --- a/src/mainboard/google/reef/mainboard.c +++ b/src/mainboard/google/reef/mainboard.c @@ -19,9 +19,12 @@ #include #include #include +#include #include +#include #include #include +#include #include #include #include @@ -41,6 +44,35 @@ static void mainboard_init(void *chip_info) mainboard_ec_init(); } +/* + * There are 2 pins on reef-like boards that can be used for SKU'ing + * board differences. They each have optional stuffing for a pullup and + * a pulldown. This way we can generate 9 different values with the + * 2 pins. + */ +static int board_sku(void) +{ + static int board_sku_num = -1; + gpio_t board_sku_gpios[] = { + [1] = GPIO_17, [0] = GPIO_16, + }; + const size_t num = ARRAY_SIZE(board_sku_gpios); + + if (board_sku_num < 0) + board_sku_num = gpio_base3_value(board_sku_gpios, num); + + return board_sku_num; +} + +const char *smbios_mainboard_sku(void) +{ + static char sku_str[5]; /* sku[0-8] */ + + snprintf(sku_str, sizeof(sku_str), "sku%d", board_sku()); + + return sku_str; +} + void __attribute__((weak)) variant_nhlt_oem_overrides(const char **oem_id, const char **oem_table_id, uint32_t *oem_revision)