From b77001b8ef3f7dcea3128dfe3a48fcdd67b9421b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kope=C4=87?= Date: Thu, 2 May 2024 13:21:01 +0200 Subject: [PATCH] UefiPayloadPkg/GraphicsOutputDxe: accept framebuffer BAR offsets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some platforms place the linear framebuffer at an offset within the PCI BAR (for example, Meteor Lake can use BAR2 + 0x800000). The existing GraphicsOutputDxe validation requires the framebuffer base to match the BAR base exactly, which rejects these configurations. Relax the check to accept a framebuffer base within the BAR window, and use the provided framebuffer base address when it falls within that range. Signed-off-by: Michał Kopeć Signed-off-by: Sean Rhodes --- UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c b/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c index 39ad03fe32..894647c347 100644 --- a/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c +++ b/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c @@ -435,8 +435,11 @@ GraphicsOutputDriverBindingStart ( } if (DeviceInfo->BarIndex == MAX_UINT8) { - if (Resources->AddrRangeMin == GraphicsInfo->FrameBufferBase) { - FrameBufferBase = Resources->AddrRangeMin; + if ( (GraphicsInfo->FrameBufferBase >= Resources->AddrRangeMin) + && (GraphicsInfo->FrameBufferBase - Resources->AddrRangeMin <= + Resources->AddrLen - GraphicsInfo->FrameBufferSize)) + { + FrameBufferBase = GraphicsInfo->FrameBufferBase; break; } } else {