vboot: cgpt: fix my_lba of the secondary GPT

Previously, my_lba of the secondary GPT was recorded as if that
GPT was written at the end of the device. This patch tweaks
my_lba to report where it is in the random-access GPT address space,
namely at the end of that space.

TEST=Compiled it into the firmware and observed the firmware to update
the my_lba field of the secondary GPT.
BRANCH=none
BUG=chromium:425677

Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org>

Change-Id: I88791fb2cff1086351ca8a3adeef675c4a88cc9a
Reviewed-on: https://chromium-review.googlesource.com/228942
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Daniel Ehrenberg <dehrenberg@chromium.org>
Tested-by: Daniel Ehrenberg <dehrenberg@chromium.org>
This commit is contained in:
Dan Ehrenberg
2014-11-06 16:22:24 -08:00
committed by chrome-internal-fetch
parent 837b408c92
commit a524a3a515
6 changed files with 77 additions and 63 deletions

View File

@@ -48,7 +48,8 @@ int AllocAndReadGptData(VbExDiskHandle_t disk_handle, GptData *gptdata)
/* Only read primary GPT if the primary header is valid */
GptHeader* primary_header = (GptHeader*)gptdata->primary_header;
if (0 == CheckHeader(primary_header, 0, gptdata->gpt_drive_sectors,
if (0 == CheckHeader(primary_header, 0, gptdata->drive_sectors,
gptdata->gpt_drive_sectors,
gptdata->stored_on_device)) {
primary_valid = 1;
if (0 != VbExDiskRead(disk_handle,
@@ -67,7 +68,8 @@ int AllocAndReadGptData(VbExDiskHandle_t disk_handle, GptData *gptdata)
/* Only read secondary GPT if the secondary header is valid */
GptHeader* secondary_header = (GptHeader*)gptdata->secondary_header;
if (0 == CheckHeader(secondary_header, 1, gptdata->gpt_drive_sectors,
if (0 == CheckHeader(secondary_header, 1, gptdata->drive_sectors,
gptdata->gpt_drive_sectors,
gptdata->stored_on_device)) {
secondary_valid = 1;
if (0 != VbExDiskRead(disk_handle,