From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by mx.groups.io with SMTP id smtpd.web11.8675.1688721687130179105 for ; Fri, 07 Jul 2023 02:21:27 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@posteo.net header.s=2017 header.b=qrYDG0x5; spf=pass (domain: posteo.net, ip: 185.67.36.65, mailfrom: michael.buechler@posteo.net) Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 5B867240027 for ; Fri, 7 Jul 2023 11:21:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1688721685; bh=alQ4HOIKVq8H/pXCKA4czUa7oLHe/SfMUnTmTHOabyA=; h=From:To:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding:From; b=qrYDG0x5zQJ2qrVpJX3BqLJiF+BP6Wst9oXm76d8/XO0IPiytDnUgv14iKrlsdr6K exVLQOCc9+NQWyxgTQbaEtc8Bf6jwFuuI+r5l5bQR+i03mke8Ll25gwJ30luaAqHo7 huHmlI9yjrGlTuHmcseOwaiSxdoLfFhF3duQ/UEJEZTdnKdyOjpwrKsOPSTkCgG8oG DHtOdgkXc5TG/QDzx0OhLBsr1Q0m4z/0+NwZnPn2PCdlpLj4gLK18qo3Y2PITdlcD/ gJ4+feDioZen2dqZMurhJ8cKaNxcQs5hCa1uw3yESHTe2+lnhRqRJmLMFO1jUwr4dc /2u1jhMBFZfZw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Qy7F05gqtz6txj for ; Fri, 7 Jul 2023 11:21:24 +0200 (CEST) From: =?UTF-8?B?TWljaGFlbCBCw7xjaGxlcg==?= To: devel@edk2.groups.io Subject: [PATCH 1/1] UefiPayloadPkg: Match BAR if framebuffer is at an offset Date: Fri, 7 Jul 2023 09:20:45 +0000 Message-Id: <6deb621a0ab0123cf533876f2d2ff7037e2becca.1688720660.git.michael.buechler@posteo.net> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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=C3=BCchler --- UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c b/UefiPayloa= dPkg/GraphicsOutputDxe/GraphicsOutput.c index 39ad03fe32..eb657b46b5 100644 --- a/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c +++ b/UefiPayloadPkg/GraphicsOutputDxe/GraphicsOutput.c @@ -435,9 +435,12 @@ GraphicsOutputDriverBindingStart ( }=0D =0D if (DeviceInfo->BarIndex =3D=3D MAX_UINT8) {=0D - if (Resources->AddrRangeMin =3D=3D GraphicsInfo->FrameBuffer= Base) {=0D - FrameBufferBase =3D Resources->AddrRangeMin;=0D - break;=0D + if (GraphicsInfo->FrameBufferBase >=3D Resources->AddrRangeM= in) {=0D + if ((GraphicsInfo->FrameBufferBase + GraphicsInfo->FrameBu= fferSize) <=3D (Resources->AddrRangeMin + Resources->AddrLen))=0D + {=0D + FrameBufferBase =3D GraphicsInfo->FrameBufferBase;=0D + break;=0D + }=0D }=0D } else {=0D break;=0D --=20 2.39.3