diff options
-rw-r--r-- | src/ec/google/chromeec/ec.c | 25 | ||||
-rw-r--r-- | src/ec/google/chromeec/ec.h | 1 | ||||
-rw-r--r-- | src/ec/google/chromeec/ec_commands.h | 1 |
3 files changed, 27 insertions, 0 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 21949d10df..449eaf307c 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -607,6 +607,31 @@ int google_chromeec_cbi_get_oem_id(uint32_t *id) return cbi_get_uint32(id, CBI_TAG_OEM_ID); } +int google_chromeec_cbi_get_dram_part_num(char *buf, size_t bufsize) +{ + struct ec_params_get_cbi p = { + .tag = CBI_TAG_DRAM_PART_NUM, + }; + struct chromeec_command cmd = { + .cmd_code = EC_CMD_GET_CROS_BOARD_INFO, + .cmd_version = 0, + .cmd_data_in = &p, + .cmd_data_out = buf, + .cmd_size_in = sizeof(p), + .cmd_size_out = bufsize, + }; + int rv; + + rv = google_chromeec_command(&cmd); + if (rv < 0) + return rv; + + /* Ensure NUL termination. */ + buf[bufsize - 1] = '\0'; + + return 0; +} + #ifndef __SMM__ u16 google_chromeec_get_board_version(void) { diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index 7310ade09d..2c6f1d6b8c 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -74,6 +74,7 @@ int google_chromeec_reboot(int dev_idx, enum ec_reboot_cmd type, uint8_t flags); */ int google_chromeec_cbi_get_oem_id(uint32_t *id); int google_chromeec_cbi_get_sku_id(uint32_t *id); +int google_chromeec_cbi_get_dram_part_num(char *buf, size_t bufsize); /* MEC uses 0x800/0x804 as register/index pair, thus an 8-byte resource. */ #define MEC_EMI_BASE 0x800 diff --git a/src/ec/google/chromeec/ec_commands.h b/src/ec/google/chromeec/ec_commands.h index 730be09abc..2962354f9c 100644 --- a/src/ec/google/chromeec/ec_commands.h +++ b/src/ec/google/chromeec/ec_commands.h @@ -4780,6 +4780,7 @@ enum cbi_data_tag { CBI_TAG_BOARD_VERSION = 0, /* uint16_t or uint8_t[] = {minor,major} */ CBI_TAG_OEM_ID = 1, /* uint8_t */ CBI_TAG_SKU_ID = 2, /* uint8_t */ + CBI_TAG_DRAM_PART_NUM = 3, /* variable length ascii, nul terminated. */ CBI_TAG_COUNT, }; |