crossystem: Binary search RW_NVRAM to find the active entry
The FMAP RW_NVRAM region contains multiple VBNV entries, and
theoretically they should be used sequentially. The firmware code (in
both coreboot and depthcharge) performs binary search to find the last
used entry, while crossystem currently does linear search. A problem of
this inconsistency is, when the FMAP region is corrupted (i.e., with
intermittent used and blank entries), the found active entry would be
different in firmware and crossystem.
Also fix up the function comment of vb2_nv_index().
BUG=b:172340350, b:295040078
TEST=make runtests
TEST=emerge-geralt vboot_reference
BRANCH=none
Change-Id: I4c66d1f8e77702b3d6d1bc0e0629fca32beb852e
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4782351
Reviewed-by: Yidi Lin <yidilin@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Commit-Queue: Julius Werner <jwerner@chromium.org>
1 file changed