arm: v8: mmu: Use the framebuffer info in the FWDB and not the sysinfo struct.

Change-Id: I7b8d162795d015bf4f6abad5763e0a7f2630fb35
diff --git a/src/arch/arm/v8/mmu.c b/src/arch/arm/v8/mmu.c
index e5bb3cf..e5d95b6 100644
--- a/src/arch/arm/v8/mmu.c
+++ b/src/arch/arm/v8/mmu.c
@@ -38,6 +38,7 @@
 #include "arch/mmu.h"
 #include "base/algorithm.h"
 #include "base/physmem.h"
+#include "drivers/framebuffer/framebuffer.h"
 
 /* Maximum number of XLAT Tables available based on ttb buffer size */
 static unsigned int max_tables;
@@ -644,38 +645,21 @@
 
 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;
+	FrameBuffer buf;
+	if (framebuffer_read_from_fwdb(&buf))
+		return;
 
-	/*
-	 * Check whether framebuffer is needed
-	 * or framebuffer address has been set already
-	 */
-	if (framebuffer == NULL)
-		return;
-	if (framebuffer->physical_address)
-		return;
-	fb_size = framebuffer->bytes_per_line * framebuffer->y_resolution;
+	uint32_t fb_size = buf.bytes_per_line * buf.resolution.y;
 	if (!fb_size)
 		return;
 
-	/* Allocate framebuffer */
-	fb_range = _mmu_add_fb_range(fb_size, mmu_ranges);
+	// Allocate framebuffer.
+	struct mmu_memrange *fb_range = _mmu_add_fb_range(fb_size, 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;
+	buf.buffer = (void *)(uintptr_t)fb_range->base;
+	framebuffer_write_to_fwdb(&buf);
 }
 
 /*