diff options
author | Dan Ehrenberg <dehrenberg@chromium.org> | 2014-12-02 08:21:57 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-12-15 22:44:33 +0000 |
commit | 3f4d8d05ba4e32990c8584bd47cdf082d4604232 (patch) | |
tree | a9c9b82c4ad25192f3ecbe921795c0961d0cbbfa /utility/load_kernel_test.c | |
parent | 3200401242aec1521e7c4a8b1906366fcabfb1a2 (diff) | |
download | vboot-3f4d8d05ba4e32990c8584bd47cdf082d4604232.tar.gz |
vboot: Plumb the two disk sizes and external GPT param through
This patch reinstates the external GPT support which was previously
committed and reverted. Improvements since last time include:
- Cleaned-up internal interface based on code review
- Function correctly on legacy bootloaders (e.g., depthcharge before
NAND-related patches are added)
- Better comments
- Treat new field values = 0 -> not use new feature
- Tests are added to ensure external GPT flag is passed down properly
The original commit had change-id
I5a77e417aea8ee9442d18c200d1b073aa5375ecf
Its commit message is reproduced below, and then an additional test.
----
To support an external GPT, disks have two new attributes:
- A binary flag indicating whether the GPT is in the same address
space as the payloads or a separate one.
- The number of sectors of the streaming portion of storage, as
opposed to the portion containing the GPT.
These have been added elsewhere to GptData (in cgptlib) and BlockDev
(in depthcharge). This patch adds the plumbing between those, including
in the DiskInfo interface between the firmware and vboot.
BUG=chromium:425677
BRANCH=none
TEST=Interactively wrote the GPT with cgpt and observed the following
boot with depthcharge to read the GPT from SPI and then read from
the proper locations in NAND flash.
TEST=make runalltests passes.
TEST=boots from USB with depthcharge from HEAD.
Change-Id: Ia7956517a7b9da0301f01fac5a10204f6d78cf4f
Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/234640
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'utility/load_kernel_test.c')
-rw-r--r-- | utility/load_kernel_test.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/utility/load_kernel_test.c b/utility/load_kernel_test.c index 8e6c5191..d8efd786 100644 --- a/utility/load_kernel_test.c +++ b/utility/load_kernel_test.c @@ -37,10 +37,10 @@ VbError_t VbExDiskRead(VbExDiskHandle_t handle, uint64_t lba_start, uint64_t lba_count, void *buffer) { printf("Read(%" PRIu64 ", %" PRIu64 ")\n", lba_start, lba_count); - if (lba_start > lkp.ending_lba || - lba_start + lba_count - 1 > lkp.ending_lba) { + if (lba_start >= lkp.streaming_lba_count || + lba_start + lba_count > lkp.streaming_lba_count) { fprintf(stderr, "Read overrun: %" PRIu64 " + %" PRIu64 " > %" PRIu64 "\n", - lba_start, lba_count, lkp.ending_lba); + lba_start, lba_count, lkp.streaming_lba_count); return 1; } @@ -57,10 +57,10 @@ VbError_t VbExDiskWrite(VbExDiskHandle_t handle, uint64_t lba_start, uint64_t lba_count, const void *buffer) { printf("Write(%" PRIu64 ", %" PRIu64 ")\n", lba_start, lba_count); - if (lba_start > lkp.ending_lba || - lba_start + lba_count - 1 > lkp.ending_lba) { + if (lba_start >= lkp.streaming_lba_count || + lba_start + lba_count > lkp.streaming_lba_count) { fprintf(stderr, "Read overrun: %" PRIu64 " + %" PRIu64 " > %" PRIu64 "\n", - lba_start, lba_count, lkp.ending_lba); + lba_start, lba_count, lkp.streaming_lba_count); return 1; } @@ -204,9 +204,10 @@ int main(int argc, char* argv[]) { return 1; } fseek(image_file, 0, SEEK_END); - lkp.ending_lba = (ftell(image_file) / LBA_BYTES) - 1; + lkp.streaming_lba_count = (ftell(image_file) / LBA_BYTES); + lkp.gpt_lba_count = lkp.streaming_lba_count; rewind(image_file); - printf("Ending LBA: %" PRIu64 "\n", lkp.ending_lba); + printf("Streaming LBA count: %" PRIu64 "\n", lkp.streaming_lba_count); /* Allocate a buffer for the kernel */ lkp.kernel_buffer = malloc(KERNEL_BUFFER_SIZE); |