From 584e048185f2e456bc67a86cb54feac4dda8084c Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Tue, 18 Nov 2014 11:55:33 -0600 Subject: libpayload arm64: don't modify cbtable entries The framebuffer structure lives in the coreboot tables. Those tables have a checksum calculation applied over all the entries. Therefore, one shouldnot be modifying fields within the coreboot table entries because the calculated checksum would be wrong. BRANCH=none BUG=chrome-os-partner:31936 TEST=On ryu, confirmed dev screen still works as well as cbmem utility once booted. Change-Id: I93830a8efe98aa848f2b0f8388688de0e93b2f82 Signed-off-by: Patrick Georgi Original-Commit-Id: 6026ca5ad0254c14c30412882dc63550656c7d16 Original-Change-Id: Ic9c164ded03d10d6f6f3ce15e9b38b1f6ce61a91 Original-Signed-off-by: Aaron Durbin Original-Reviewed-on: https://chromium-review.googlesource.com/230471 Original-Reviewed-by: Furquan Shaikh Original-Commit-Queue: Furquan Shaikh Reviewed-on: http://review.coreboot.org/8797 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- payloads/libpayload/arch/arm64/mmu.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'payloads') diff --git a/payloads/libpayload/arch/arm64/mmu.c b/payloads/libpayload/arch/arm64/mmu.c index 41fb10b54d..86d9fc5ee5 100644 --- a/payloads/libpayload/arch/arm64/mmu.c +++ b/payloads/libpayload/arch/arm64/mmu.c @@ -675,6 +675,7 @@ static void mmu_extract_ranges(struct memrange *cb_ranges, static void mmu_add_fb_range(struct mmu_ranges *mmu_ranges) { struct mmu_memrange *fb_range; + static struct cb_framebuffer modified_fb; struct cb_framebuffer *framebuffer = lib_sysinfo.framebuffer; uint32_t fb_size; @@ -695,8 +696,16 @@ static void mmu_add_fb_range(struct mmu_ranges *mmu_ranges) if (fb_range == NULL) mmu_error(); - /* Set framebuffer address */ - framebuffer->physical_address = fb_range->base; + /* + * Set framebuffer address. However, one needs to use a freshly + * allocated framebuffer structure because the one in the coreboot + * table is part of a checksum calculation. Therefore, one cannot + * modify a field without recomputing the necessary checksum + * calcuation. + */ + modified_fb = *framebuffer; + modified_fb.physical_address = fb_range->base; + lib_sysinfo.framebuffer = &modified_fb; } /* -- cgit v1.2.3