[coreboot-gerrit] New patch to review for coreboot: e08037e libpayload: Keep physical addresses in console drivers

Nico Huber (nico.h@gmx.de) gerrit at coreboot.org
Thu Jul 10 10:22:14 CEST 2014


Nico Huber (nico.h at gmx.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6247

-gerrit

commit e08037ee6caa1013126bc1fe50a747976b9d4d25
Author: Nico Huber <nico.huber at secunet.com>
Date:   Tue Jul 8 15:07:19 2014 +0200

    libpayload: Keep physical addresses in console drivers
    
    Like done in FILO, libpayload's console drivers might be initialized
    before a relocation. So keep physical pointers in there which won't
    break on relocation.
    
    Change-Id: I52e5d9d26801a53fd6a5f3c7ee03f61d6941d736
    Signed-off-by: Nico Huber <nico.huber at secunet.com>
---
 payloads/libpayload/drivers/video/corebootfb.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/payloads/libpayload/drivers/video/corebootfb.c b/payloads/libpayload/drivers/video/corebootfb.c
index faf9e2c..d661466 100644
--- a/payloads/libpayload/drivers/video/corebootfb.c
+++ b/payloads/libpayload/drivers/video/corebootfb.c
@@ -62,11 +62,11 @@ static const u32 vga_colors[] = {
 };
 
 /* Addresses for the various components */
-static struct cb_framebuffer *fbinfo;
+static unsigned long fbinfo;
 static unsigned long fbaddr;
 static unsigned long chars;
 
-#define FI (fbinfo)
+#define FI ((struct cb_framebuffer *) phys_to_virt(fbinfo))
 #define FB ((unsigned char *) phys_to_virt(fbaddr))
 #define CHARS ((unsigned short *) phys_to_virt(chars))
 
@@ -232,15 +232,18 @@ static int corebootfb_init(void)
 	if (lib_sysinfo.framebuffer == NULL)
 		return -1;
 
-	fbinfo = lib_sysinfo.framebuffer;
+	/* We might have been called before relocation (like FILO does). So
+	   just keep the physical address which won't break on relocation. */
+	fbinfo = virt_to_phys(lib_sysinfo.framebuffer);
 
 	fbaddr = FI->physical_address;
 
 	coreboot_video_console.columns = FI->x_resolution / FONT_WIDTH;
 	coreboot_video_console.rows = FI->y_resolution / FONT_HEIGHT;
 
-	chars = (unsigned long) malloc(coreboot_video_console.rows *
-			coreboot_video_console.columns * 2);
+	/* See setting of fbinfo above. */
+	chars = virt_to_phys(malloc(coreboot_video_console.rows *
+				    coreboot_video_console.columns * 2));
 
 	// clear boot splash screen if there is one.
 	corebootfb_clear();



More information about the coreboot-gerrit mailing list