prevent infinite loop when accessing uninitialized NVMEM
Attempts by Cr50 code to access FWMP and FW rollback indices before
tpm reset ever happened cause watchdog timeouts. This happens because
when NVMEM is not initialized NvNext() keeps pointing at the location
which reads 0xffffffff, and this is considered the start of the loop
(the value of NV_ITER_INIT).
The fix is to consider both values of zero and 0xffffffff as
indication of pointing at the end of the list of values stored in
NVMEM.
BRANCH=cr50, cr50-mp
BUG=none
TEST=running 'ccd' on a brand new devices where the AP does not yet
boot does not cause a watchdog timeout any more.
An initialized Chrome OS device still boots fine, and 'ccd' on it
also succeeds.
Change-Id: I6dd39c043b89b8f832d874a2fe276fac6c321303
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1200226
Reviewed-by: Andrey Pronin <apronin@chromium.org>
1 file changed