From 52191d4f83fe9e3fa47ec2f9ee98aec83304a8f6 Mon Sep 17 00:00:00 2001
From: Matt DeVillier <matt.devillier@puri.sm>
Date: Tue, 11 Sep 2018 16:54:53 -0500
Subject: [PATCH 1/1] SeaVGABios/cbvga: Fix bpp for coreboot framebuffer

Commit 4b42cc4 [SeaVGABios/cbvga: Advertise correct pixel format] neglected
to wrap the cbfb mask size components in GET_FARVAR(), which resulted in a
bogus value for bpp, breaking output on most/all devices.  Fix this by
adding GET_FARVAR() as appropriate.

TEST: build/boot a variety of devices (google/fizz, purism/librem_skl) using
coreboot for display init, verify SeaBIOS banner and boot menu prompt visible.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
---
 vgasrc/cbvga.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c
index 859524c..d64625e 100644
--- a/vgasrc/cbvga.c
+++ b/vgasrc/cbvga.c
@@ -312,8 +312,10 @@ cbvga_setup(void)
     }
 
     u64 addr = GET_FARVAR(0, cbfb->physical_address);
-    u8 bpp = cbfb->blue_mask_size + cbfb->green_mask_size
-             + cbfb->red_mask_size + cbfb->reserved_mask_size;
+    u8 bpp = GET_FARVAR(0, cbfb->blue_mask_size)
+             + GET_FARVAR(0, cbfb->green_mask_size)
+             + GET_FARVAR(0, cbfb->red_mask_size)
+             + GET_FARVAR(0, cbfb->reserved_mask_size);
     u32 xlines = GET_FARVAR(0, cbfb->x_resolution);
     u32 ylines = GET_FARVAR(0, cbfb->y_resolution);
     u32 linelength = GET_FARVAR(0, cbfb->bytes_per_line);
-- 
2.17.1