From 322794243a98a47fe6e3b270277dd049e7d4f22e Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Tue, 8 Jul 2014 15:07:19 +0200 Subject: 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 Reviewed-on: http://review.coreboot.org/6247 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan Reviewed-by: Paul Menzel --- payloads/libpayload/drivers/video/corebootfb.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'payloads') diff --git a/payloads/libpayload/drivers/video/corebootfb.c b/payloads/libpayload/drivers/video/corebootfb.c index faf9e2c0f8..d661466f14 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(); -- cgit v1.2.3