summaryrefslogtreecommitdiff
path: root/payloads/libpayload/arch
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2020-07-18 15:20:00 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-08-24 09:13:16 +0000
commit5e0db58533c1d796129a0a29e03f1ca8e0e81063 (patch)
tree1a6054dfdffc72d145c5e28bae8835d7f6efe94e /payloads/libpayload/arch
parentbe842cb72d83b347bbc1c3308909f4eac286b47a (diff)
libpayload: Cache copy of `cb_framebuffer` struct
Our AArch64 code supports dynamic framebuffer allocation which makes it necessary to change the framebuffer information during runtime. Having a pointer inside `libsysinfo` made a mess of it as the pointer would either refer to the original struct inside the coreboot table or to a new struct inside payload space. The latter would be unaffected by a relocation of the payload. Instead of the pointer, we'll always keep a copy of the whole struct, which can be altered on demand without affecting the coreboot table. To align the `video/graphics` driver with the console driver, we also replace `fbaddr` with a macro `FB` that calls phys_to_virt(). Change-Id: I3edc09cdb502a71516c1ee71457c1f8dcd01c119 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/43578 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'payloads/libpayload/arch')
-rw-r--r--payloads/libpayload/arch/arm64/mmu.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/payloads/libpayload/arch/arm64/mmu.c b/payloads/libpayload/arch/arm64/mmu.c
index 1fa9ced1be..cb0081b789 100644
--- a/payloads/libpayload/arch/arm64/mmu.c
+++ b/payloads/libpayload/arch/arm64/mmu.c
@@ -625,14 +625,10 @@ 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;
+ struct cb_framebuffer *framebuffer = &lib_sysinfo.framebuffer;
uint32_t fb_size;
/* Check whether framebuffer is needed */
- if (framebuffer == NULL)
- return;
-
fb_size = framebuffer->bytes_per_line * framebuffer->y_resolution;
if (!fb_size)
return;
@@ -652,16 +648,7 @@ static void mmu_add_fb_range(struct mmu_ranges *mmu_ranges)
if (fb_range == NULL)
mmu_error();
- /*
- * 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;
+ framebuffer->physical_address = fb_range->base;
}
/*