[edk2-devel] [PATCH 1/1] UefiPayloadPkg: Match BAR if framebuffer is at an offset

Michael Büchler michael.buechler at posteo.net
Fri Jul 7 09:20:45 UTC 2023


When the framebuffer region (starting address and address range) from
the GraphicsInfo HOB is fully enclosed within a BAR region, but does not
start on the same address as the BAR, it does not get matched to that
BAR. The driver fails to bind to the graphics device and no graphics
output is possible until the OS initializes its own driver.

This was encountered on a PC with an Intel DQ67SW mainboard and a
discrete GPU (Nvidia GTX 670) that is running coreboot with UefiPayload
from the 'mrchromebox' or 'starlabsltd' fork of EDK II.

coreboot runs the VGA BIOS which reports an address range for the
framebuffer to coreboot. It is within one of its BAR regions, but not
at the starting address (BAR2 at 0xE8000000 vs framebuffer at 0xE9000000).

EDK II finds the framebuffer information provided by coreboot and later
fails to find the correspondig BAR due to the behavior described above.
With this patch, graphics output is working.

Signed-off-by: Michael Büchler <michael.buechler at posteo.net>
---
 UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c b/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c
index 39ad03fe32..eb657b46b5 100644
--- a/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c
+++ b/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c
@@ -435,9 +435,12 @@ GraphicsOutputDriverBindingStart (
             }

 

             if (DeviceInfo->BarIndex == MAX_UINT8) {

-              if (Resources->AddrRangeMin == GraphicsInfo->FrameBufferBase) {

-                FrameBufferBase = Resources->AddrRangeMin;

-                break;

+              if (GraphicsInfo->FrameBufferBase >= Resources->AddrRangeMin) {

+                if ((GraphicsInfo->FrameBufferBase + GraphicsInfo->FrameBufferSize) <= (Resources->AddrRangeMin + Resources->AddrLen))

+                {

+                  FrameBufferBase = GraphicsInfo->FrameBufferBase;

+                  break;

+                }

               }

             } else {

               break;

-- 
2.39.3



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#106744): https://edk2.groups.io/g/devel/message/106744
Mute This Topic: https://groups.io/mt/100011247/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list