summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2014-07-08 15:07:19 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2014-07-10 20:55:41 +0200
commit322794243a98a47fe6e3b270277dd049e7d4f22e (patch)
tree3db83d6d850f365c274db37f3e2a3d1a58fd3926
parent6a058904d9fc55975689981cad3d65e84e0501d7 (diff)
downloadcoreboot-322794243a98a47fe6e3b270277dd049e7d4f22e.tar.xz
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@secunet.com> Reviewed-on: http://review.coreboot.org/6247 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
-rw-r--r--payloads/libpayload/drivers/video/corebootfb.c13
1 files changed, 8 insertions, 5 deletions
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();