Edward O'Callaghan has uploaded this change for review.

View Change

libflashrom: Allow flashrom_flashchip_info to contain model id's

Some users wish to work with numerical values over strings.
Include both parts of the story within the flashrom_flashchip_info
structure reported back via the API surface.

BUG=b:276981092
TEST=put `printf("XXX %x , %x\n", info.manufacture_id, info.model_id);`
into cli_classic and ran './flashrom -p internal --flash-name' then
verified data with include/flashchips.h is indeed correct.

Change-Id: I9742bbac8424ec9cca4b6e85cd6baa521c3d0f56
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
---
M include/libflashrom.h
M libflashrom.c
2 files changed, 25 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/10/74210/1
diff --git a/include/libflashrom.h b/include/libflashrom.h
index f844aaa..e2ed611 100644
--- a/include/libflashrom.h
+++ b/include/libflashrom.h
@@ -115,6 +115,8 @@
struct flashrom_flashchip_info {
const char *vendor;
const char *name;
+ uint32_t manufacture_id;
+ uint32_t model_id;
unsigned int total_size;
struct flashrom_tested {
enum flashrom_test_state probe;
diff --git a/libflashrom.c b/libflashrom.c
index 7edf05e..dd9edf3 100644
--- a/libflashrom.c
+++ b/libflashrom.c
@@ -102,6 +102,8 @@
for (unsigned int i = 0; i < flashchips_size; ++i) {
supported_flashchips[i].vendor = flashchips[i].vendor;
supported_flashchips[i].name = flashchips[i].name;
+ supported_flashchips[i].manufacture_id = flashchips[i].manufacture_id;
+ supported_flashchips[i].model_id = flashchips[i].model_id;
supported_flashchips[i].tested.erase =
(enum flashrom_test_state)flashchips[i].tested.erase;
supported_flashchips[i].tested.probe =
@@ -257,6 +259,8 @@

info->vendor = flashctx->chip->vendor;
info->name = flashctx->chip->name;
+ info->manufacture_id = flashctx->chip->manufacture_id;
+ info->model_id = flashctx->chip->model_id;

info->total_size = flashctx->chip->total_size;


To view, visit change 74210. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I9742bbac8424ec9cca4b6e85cd6baa521c3d0f56
Gerrit-Change-Number: 74210
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-MessageType: newchange