diff options
author | Bill Richardson <wfrichar@chromium.org> | 2016-07-24 23:58:05 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-26 12:27:33 -0700 |
commit | 20a6d75aee99c50a1646b73e11e7bb84276439c6 (patch) | |
tree | 9588552acafe7f29da2f3c3622c0207337d42659 /include/system.h | |
parent | 0564276033dd2615b95fa3f85152b9cc56c166d3 (diff) | |
download | chrome-ec-20a6d75aee99c50a1646b73e11e7bb84276439c6.tar.gz |
g: Improve version info for dual RO & RW images
The SoC looks for two RO images at reset, and is typically
configured for two RW images as well. This CL reports version
strings for all those images, as well as identifying the active
RO and RW copies.
Since the RO image doesn't contain a version string, we create
one using the epoch_, major_, minor_, and img_chk_ members of its
signed header.
BUG=chrome-os-partner:55558
BRANCH=none
TEST=make buildall; run on Cr50 hardware
The "version" command now includes information like this:
RO_A: * 0.0.2/a3c3d5ea
RO_B: 0.0.2/8895c9eb
RW_A: cr50_v1.1.4965-a6c1c73-dirty
RW_B: * cr50_v1.1.4959-2f49d5c
The '*' indicates the active image.
The test/tpm_test/tpmtest.py program has been updated to request
the version information at startup, and it also now reports
similar information, just all on one line:
RO_A:* 0.0.2/a3c3d5ea RO_B: 0.0.2/8895c9eb RW_A: cr50_v1.1 ...
The active images are marked with a '*' following the ':', so
that the same regexp can match either format:
($ro, $rw) = m/RO_[AB]:\s*\*\s+(\S+).*RW_[AB]:\s*\*\s+(\S+)/s;
Change-Id: Ic27e295d9122045b2ec5a638933924b65ecc8e43
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/362861
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'include/system.h')
-rw-r--r-- | include/system.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/include/system.h b/include/system.h index 4362097345..39bdb95cd0 100644 --- a/include/system.h +++ b/include/system.h @@ -38,9 +38,9 @@ enum system_image_copy_t { SYSTEM_IMAGE_UNKNOWN = 0, SYSTEM_IMAGE_RO, SYSTEM_IMAGE_RW, -#ifdef CONFIG_RW_B + /* Some systems may have these too */ + SYSTEM_IMAGE_RO_B, SYSTEM_IMAGE_RW_B, -#endif }; /** @@ -105,6 +105,21 @@ void system_disable_jump(void); enum system_image_copy_t system_get_image_copy(void); /** + * Return the active RO image copy so that if we're in RW, we can know how we + * got there. Only needed when there are multiple RO images. + */ +enum system_image_copy_t system_get_ro_image_copy(void); + +/** + * Return the program memory address where the image copy begins or should + * begin. In the case of external storage, the image may or may not currently + * reside at the location returned. Returns INVALID_ADDR if the image copy is + * not supported. + */ +uintptr_t get_program_memory_addr(enum system_image_copy_t copy); +#define INVALID_ADDR ((uintptr_t)0xffffffff) + +/** * Return non-zero if the system has switched between image copies at least * once since the last real boot. */ |