diff options
author | Thejaswani Puta thejaswani.putta@intel.com <thejaswani.putta@intel.corp-partner.google.com> | 2021-01-20 15:22:01 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-10 00:33:49 +0000 |
commit | 48ce00b56ce350cbec0e67b1b489aaa145c2b3a4 (patch) | |
tree | f9fda4095887e1d43dbde7744c4174386e5be575 /common/cbi.c | |
parent | 2875dd8dd9920954f8c40621e9453d3b2e4bfc82 (diff) | |
download | chrome-ec-48ce00b56ce350cbec0e67b1b489aaa145c2b3a4.tar.gz |
CBI: Add rework_id field
This field will be used to describe all the reworks performed on
a board which includes the mandatory, optional and feature reworks.
Also modified existing command handlers under ectool and cbi-util tool
to support 64 bit length data.
BUG: b:170385859
TEST: ./cbi-util create --file ~/cbi_image --board_version 1
--oem_id 2 --sku_id 255 --dram_part_num "01654329efghac"
--model_id 15 --rework_id 123456789123456712 --size 256
CBI image is created successfully
TEST: ./cbi-util show --file ~/cbi_image
CBI image: /home/thejaswani/cbi_image
TOTAL_SIZE: 47
Data Field: name: value (hex, tag, size)
BOARD_VERSION: 1 (0x1, 0, 1)
OEM_ID: 2 (0x2, 1, 1)
SKU_ID: 255 (0xff, 2, 1)
MODEL_ID: 15 (0xf, 5, 1)
REWORK_ID: 123456789123456712 (0x1b69b4bacd05ec8, 9, 8)
DRAM_PART_NUM: 01654329efghac (3, 15)
Data validated successfully
TEST: hexdump -C ~/cbi_image
00000000 43 42 49 1e 00 00 2f 00 00 01 01 01 01 02 02 01 |CBI.../.........|
00000010 ff 05 01 0f 09 08 c8 5e d0 ac 4b 9b b6 01 03 0f |.......^..K.....|
00000020 30 31 36 35 34 33 32 39 65 66 67 68 61 63 00 ff |01654329efghac..|
00000030 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
*
00000100
TEST:
localhost ~ # ectool cbi set 9 98765432 8
localhost ~ # ectool cbi get 9
As uint: 98765432 (0x5e30a78)
As binary: 78 0a e3 05 00 00 00 00
localhost ~ # ectool cbi set 9 123456789123456712 8
localhost ~ # ectool cbi get 9
As uint: 123456789123456712 (0x1b69b4bacd05ec8)
As binary: c8 5e d0 ac 4b 9b b6 01
localhost ~ # ectool cbi set 9 1234 2
localhost ~ # ectool cbi get 9
As uint: 1234 (0x4d2)
As binary: d2 04
TEST:
> cbi(from EC Console)
2021-01-19 20:59:56 [80.979692 CBI Reading board info]
2021-01-19 20:59:56 CBI_VERSION: 0x0000
2021-01-19 20:59:56 TOTAL_SIZE: 54
2021-01-19 20:59:56 BOARD_VERSION: 1 (0x1)
2021-01-19 20:59:56 OEM_ID: (Error 1)
2021-01-19 20:59:56 MODEL_ID: (Error 1)
2021-01-19 20:59:56 SKU_ID: 655361 (0xa0001)
2021-01-19 20:59:56 FW_CONFIG: 199683 (0x30c03)
2021-01-19 20:59:56 PCB_SUPPLIER: (Error 1)
2021-01-19 20:59:56 SSFC: (Error 1)
2021-01-19 20:59:56 REWORK_ID: 1234 (0x4d2)
2021-01-19 20:59:56 43 42 49 8c 00 00 36 00 00 01 01 02 04 01 00 0a |CBI...6.........|
2021-01-19 20:59:56 00 06 04 03 0c 03 00 03 19 4d 54 35 33 45 35 31 |.........MT53E51|
2021-01-19 20:59:56 32 4d 36 34 44 34 4e 57 2d 30 34 36 20 57 54 3a |2M64D4NW-046 WT:|
2021-01-19 20:59:56 45 00 09 02 d2 04 ff ff ff ff ff 7f ff ff ff ff |E...............|
2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
2020-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
2021-01-19 20:59:56 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
Change-Id: Ic8163ceaec55c429c9836f9a1e75d0de31ea072b
Signed-off-by: Thejaswani Puta <thejaswani.putta@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2641127
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Thejaswani Putta <thejaswani.putta@intel.corp-partner.google.com>
Tested-by: Thejaswani Putta <thejaswani.putta@intel.corp-partner.google.com>
Diffstat (limited to 'common/cbi.c')
-rw-r--r-- | common/cbi.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/common/cbi.c b/common/cbi.c index 6c98e610ec..97bdbf5a2f 100644 --- a/common/cbi.c +++ b/common/cbi.c @@ -343,6 +343,12 @@ int cbi_get_pcb_supplier(uint32_t *pcb_supplier) &size); } +int cbi_get_rework_id(uint64_t *id) +{ + uint8_t size = sizeof(*id); + return cbi_get_board_info(CBI_TAG_REWORK_ID, (uint8_t *)id, &size); +} + static enum ec_status hc_cbi_get(struct host_cmd_handler_args *args) { const struct __ec_align4 ec_params_get_cbi *p = args->params; @@ -441,9 +447,20 @@ static void print_tag(const char * const tag, int rv, const uint32_t *val) ccprintf(": (Error %d)\n", rv); } +static void print_uint64_tag(const char * const tag, int rv, const uint64_t *lval) +{ + ccprintf("%s", tag); + if(rv == EC_SUCCESS && lval) + ccprintf(": %llu (0x%llx)\n", *(unsigned long long*)lval, + *(unsigned long long*)lval); + else + ccprintf(": (Error %d)\n", rv); +} + static void dump_cbi(void) { uint32_t val; + uint64_t lval; /* Ensure we read the latest data from flash. */ cached_read_result = EC_ERROR_CBI_CACHE_INVALID; @@ -464,6 +481,7 @@ static void dump_cbi(void) print_tag("FW_CONFIG", cbi_get_fw_config(&val), &val); print_tag("PCB_SUPPLIER", cbi_get_pcb_supplier(&val), &val); print_tag("SSFC", cbi_get_ssfc(&val), &val); + print_uint64_tag("REWORK_ID", cbi_get_rework_id(&lval), &lval); } static int cc_cbi(int argc, char **argv) |