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>
This commit is contained in:
Nico Huber 2014-07-08 15:07:19 +02:00 committed by Patrick Georgi
parent 6a058904d9
commit 322794243a
1 changed files with 8 additions and 5 deletions

View File

@ -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();