diff options
author | Jett Rink <jettrink@chromium.org> | 2022-03-08 10:52:06 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2022-03-08 19:30:21 +0000 |
commit | 8f0ac179f8550ab4939f2a23d0a6ac62b98ca243 (patch) | |
tree | ffe68af7798b03372c9a0bf856b2603c788de768 | |
parent | ffa5254316cbbafa0c6a1a20fb20016ab7868441 (diff) | |
download | chrome-ec-8f0ac179f8550ab4939f2a23d0a6ac62b98ca243.tar.gz |
gsctool: search on 2KB boundary instead of 16KB boundary for header
We relaxed the RW header alignment search in RO to be on the 2KB
boundary instead of 16KB. This gives us more room if RO grows. ti50
already supports this.
Also 2KB is the lowest is would every go since that is a hardware page
boundary.
BUG=b:217564005
TEST=see that gsctool can upgrade with an image that isn't align on 16KB
boundary but it aligned on 2KB boundary.
Change-Id: I0b05de6191d566a01b629d09d95f3d214282e454
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3508830
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
-rw-r--r-- | extra/usb_updater/gsctool.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/extra/usb_updater/gsctool.c b/extra/usb_updater/gsctool.c index cf28976755..16a83025bb 100644 --- a/extra/usb_updater/gsctool.c +++ b/extra/usb_updater/gsctool.c @@ -995,10 +995,10 @@ static bool valid_header(const struct SignedHeader *const h, const size_t size) return true; } -/* Rounds and address up to the next 16KB boundary if not one already */ -static inline uint32_t round_up_16kb(const uint32_t addr) +/* Rounds and address up to the next 2KB boundary if not one already */ +static inline uint32_t round_up_2kb(const uint32_t addr) { - const uint32_t mask = (16 * 1024) - 1; + const uint32_t mask = (2 * 1024) - 1; return (addr + mask) & ~mask; } @@ -1012,12 +1012,12 @@ static const struct SignedHeader *as_header(const void *image, uint32_t offset) static int32_t find_rw_header(const void *image, uint32_t offset, const uint32_t end) { - offset = round_up_16kb(offset); + offset = round_up_2kb(offset); while (offset < end) { if (valid_header(as_header(image, offset), end - offset)) return offset; - offset = round_up_16kb(offset + 1); + offset = round_up_2kb(offset + 1); } return -1; |