summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2020-01-16 13:08:18 +0100
committerPatrick Georgi <pgeorgi@google.com>2020-03-09 08:09:30 +0000
commite61241822160d9a3e4ce26464798a590fac22a91 (patch)
tree27bc32f4f9207f3d4f0f42113adafdb4440dfadc /payloads/libpayload/drivers
parentc97bf6fdb4882f3cee9e6b72dbee1899036f7ecc (diff)
libpayload/corebootfb: Keep local copy of framebuffer info
Keeping a local copy of the framebuffer info allows us to make changes, e.g. add offsets. It also avoids trouble with relocation. Change-Id: I852c4eb229dd0724114acb302ab2ed7164712b64 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/38537 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'payloads/libpayload/drivers')
-rw-r--r--payloads/libpayload/drivers/video/corebootfb.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/payloads/libpayload/drivers/video/corebootfb.c b/payloads/libpayload/drivers/video/corebootfb.c
index 11397ba905..c4b50480dd 100644
--- a/payloads/libpayload/drivers/video/corebootfb.c
+++ b/payloads/libpayload/drivers/video/corebootfb.c
@@ -61,13 +61,12 @@ static const u32 vga_colors[] = {
(0xFF << 16) | (0xFF << 8) | 0xFF,
};
-/* Addresses for the various components */
-static unsigned long fbinfo;
-static unsigned long fbaddr;
+struct cb_framebuffer fbinfo;
static unsigned short *chars;
-#define FI ((struct cb_framebuffer *) phys_to_virt(fbinfo))
-#define FB ((unsigned char *) phys_to_virt(fbaddr))
+/* Addresses for the various components */
+#define FI (&fbinfo)
+#define FB ((unsigned char *) phys_to_virt(FI->physical_address))
#define CHARS (chars)
static void corebootfb_scroll_up(void)
@@ -230,12 +229,9 @@ static int corebootfb_init(void)
if (lib_sysinfo.framebuffer == NULL)
return -1;
- /* 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);
+ fbinfo = *lib_sysinfo.framebuffer;
- fbaddr = FI->physical_address;
- if (fbaddr == 0)
+ if (FI->physical_address == 0)
return -1;
font_init(FI->x_resolution);