mb/google/poppy/variants/nami: change type of board_sku_id() to uint32_t
Tools/scripts, like mosys/arc-setup, use int (4 bytes) to read the sku id. In order to support "-1", we need to use uint32_t (4 bytes) instead of using uint16_t (2 bytes) data type. Otherwise, tools/scripts will read 65535 instead of -1. Another reason to change this is that sku_id can be supported by ec up to 4 bytes. BUG=b:73792190 TEST=mosys output "Platform not supported" for -1 sku id arc-setup read -1 sku id Change-Id: Ib3baa8419f138abeb412ac09c2e7dc608e3b758b Signed-off-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-on: https://review.coreboot.org/25252 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
parent
c293496f41
commit
f7b5955b36
|
@ -53,7 +53,7 @@ struct memory_params {
|
||||||
void variant_memory_params(struct memory_params *p);
|
void variant_memory_params(struct memory_params *p);
|
||||||
int variant_memory_sku(void);
|
int variant_memory_sku(void);
|
||||||
void variant_devtree_update(void);
|
void variant_devtree_update(void);
|
||||||
uint16_t variant_board_sku(void);
|
uint32_t variant_board_sku(void);
|
||||||
|
|
||||||
struct nhlt;
|
struct nhlt;
|
||||||
void variant_nhlt_init(struct nhlt *nhlt);
|
void variant_nhlt_init(struct nhlt *nhlt);
|
||||||
|
|
|
@ -398,7 +398,7 @@ static const struct pad_config vayne_sku_gpio_table[] = {
|
||||||
|
|
||||||
const struct pad_config *variant_sku_gpio_table(size_t *num)
|
const struct pad_config *variant_sku_gpio_table(size_t *num)
|
||||||
{
|
{
|
||||||
uint16_t sku_id = variant_board_sku();
|
uint32_t sku_id = variant_board_sku();
|
||||||
const struct pad_config *board_gpio_tables;
|
const struct pad_config *board_gpio_tables;
|
||||||
switch (sku_id) {
|
switch (sku_id) {
|
||||||
case SKU_1_VAYNE:
|
case SKU_1_VAYNE:
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#ifndef __MAINBOARD_SKU_H__
|
#ifndef __MAINBOARD_SKU_H__
|
||||||
#define __MAINBOARD_SKU_H__
|
#define __MAINBOARD_SKU_H__
|
||||||
|
|
||||||
#define SKU_UNKNOWN 0xFFFF
|
#define SKU_UNKNOWN 0xFFFFFFFF
|
||||||
#define SKU_0_NAMI 0x3A7B
|
#define SKU_0_NAMI 0x3A7B
|
||||||
#define SKU_1_VAYNE 0x3A63
|
#define SKU_1_VAYNE 0x3A63
|
||||||
#define SKU_2_VAYNE 0x3A7F
|
#define SKU_2_VAYNE 0x3A7F
|
||||||
|
|
|
@ -24,22 +24,24 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <variant/sku.h>
|
#include <variant/sku.h>
|
||||||
|
|
||||||
uint16_t variant_board_sku(void)
|
uint32_t variant_board_sku(void)
|
||||||
{
|
{
|
||||||
static int sku_id = -1;
|
static uint32_t sku_id = SKU_UNKNOWN;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
if (sku_id >= 0)
|
|
||||||
|
if (sku_id != SKU_UNKNOWN)
|
||||||
return sku_id;
|
return sku_id;
|
||||||
if (google_chromeec_cbi_get_sku_id(&id))
|
if (google_chromeec_cbi_get_sku_id(&id))
|
||||||
return SKU_UNKNOWN;
|
return SKU_UNKNOWN;
|
||||||
sku_id = id;
|
sku_id = id;
|
||||||
|
|
||||||
return sku_id;
|
return sku_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void variant_devtree_update(void)
|
void variant_devtree_update(void)
|
||||||
{
|
{
|
||||||
/* Override dev tree settings per board */
|
/* Override dev tree settings per board */
|
||||||
uint16_t sku_id = variant_board_sku();
|
uint32_t sku_id = variant_board_sku();
|
||||||
device_t root = SA_DEV_ROOT;
|
device_t root = SA_DEV_ROOT;
|
||||||
config_t *cfg = root->chip_info;
|
config_t *cfg = root->chip_info;
|
||||||
switch (sku_id) {
|
switch (sku_id) {
|
||||||
|
@ -53,9 +55,9 @@ void variant_devtree_update(void)
|
||||||
|
|
||||||
const char *smbios_mainboard_sku(void)
|
const char *smbios_mainboard_sku(void)
|
||||||
{
|
{
|
||||||
static char sku_str[9]; /* sku{0..65535} (basically up to FFFF) */
|
static char sku_str[14]; /* sku{0..4294967295} */
|
||||||
|
|
||||||
snprintf(sku_str, sizeof(sku_str), "sku%d", variant_board_sku());
|
snprintf(sku_str, sizeof(sku_str), "sku%u", variant_board_sku());
|
||||||
|
|
||||||
return sku_str;
|
return sku_str;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue