From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=david.wei@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B5F682095B08C for ; Thu, 12 Oct 2017 00:17:35 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP; 12 Oct 2017 00:21:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,364,1503385200"; d="scan'208";a="137712740" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga004.jf.intel.com with ESMTP; 12 Oct 2017 00:21:04 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 12 Oct 2017 00:21:04 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 12 Oct 2017 00:21:04 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.159]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.213]) with mapi id 14.03.0319.002; Thu, 12 Oct 2017 15:21:01 +0800 From: "Wei, David" To: "Liu, XianhuiX" , "edk2-devel@lists.01.org" CC: "Wu, Mike" , "Lu, ShifeiX A" , "Guo, Mang" , "Wei, David" , "Lee, Keerock" , "Ottaway, Brian R" Thread-Topic: [edk2] [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] QR code display under EFI Shell Thread-Index: AQHTQydTtV8bnf1kikyhD38Nw7f35aLfztOw Date: Thu, 12 Oct 2017 07:21:01 +0000 Message-ID: <89954A0B46707A448411A627AD4EEE3468F9C363@SHSMSX101.ccr.corp.intel.com> References: <20171012065257.12672-1-xianhuix.liu@intel.com> In-Reply-To: <20171012065257.12672-1-xianhuix.liu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] QR code display under EFI Shell X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Oct 2017 07:17:35 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: zwei4 =20 Thanks, David Wei Intel SSG/STO/UEFI BIOS =20 > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > xianhu2x > Sent: Thursday, October 12, 2017 2:53 PM > To: edk2-devel@lists.01.org > Subject: [edk2] [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] QR > code display under EFI Shell > Importance: High >=20 > Showing QR code and website link to screen under EFI shell for > MinnowBoard. Output website link to serial port too. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 >=20 > Signed-off-by: xianhu2x > --- > .../MinnowBoard3/BoardInitPostMem/BoardInit.c | 5 + > .../BoardInitPostMem/BoardInitPostMem.inf | 1 + > .../Board/MinnowBoard3/Logo/MinnowBoardLogo.bmp | Bin 0 -> 54670 > bytes > .../Common/PlatformSettings/PlatformDxe/Logo.c | 520 > +++++++++++++++++++++ > .../Common/PlatformSettings/PlatformDxe/Logo.h | 27 ++ > .../Common/PlatformSettings/PlatformDxe/Platform.c | 21 +- > .../PlatformSettings/PlatformDxe/PlatformDxe.inf | 10 + > Platform/BroxtonPlatformPkg/PlatformPkg.dec | 3 + > Platform/BroxtonPlatformPkg/PlatformPkg.fdf | 3 + > 9 files changed, 589 insertions(+), 1 deletion(-) > create mode 100644 > Platform/BroxtonPlatformPkg/Board/MinnowBoard3/Logo/MinnowBoardLo > go.bmp > create mode 100644 > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Log > o.c > create mode 100644 > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Log > o.h >=20 > diff --git > Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/Bo > ardInit.c > Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/Bo > ardInit.c > index 0aa9246f4..fc8250fd3 100644 > --- > Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/Bo > ardInit.c > +++ > Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/Bo > ardInit.c > @@ -101,6 +101,11 @@ MinnowBoard3PostMemInitCallback ( > // Set PcdSueCreek > // > PcdSetBool (PcdSueCreek, FALSE); > + > + // > + //Set PcdLogoDisplay > + // > + PcdSetBool (PcdLogoDisplay, TRUE); >=20 > // > // Add init steps here > diff --git > Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/Bo > ardInitPostMem.inf > Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/Bo > ardInitPostMem.inf > index 8fa5ffa64..7651103d1 100644 > --- > Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/Bo > ardInitPostMem.inf > +++ > Platform/BroxtonPlatformPkg/Board/MinnowBoard3/BoardInitPostMem/Bo > ardInitPostMem.inf > @@ -60,6 +60,7 @@ > gPlatformModuleTokenSpaceGuid.PcdResetType > gPlatformModuleTokenSpaceGuid.PcdBoardVbtFileGuid > gPlatformModuleTokenSpaceGuid.PcdSueCreek > + gPlatformModuleTokenSpaceGuid.PcdLogoDisplay >=20 > [Guids] > gEfiPlatformInfoGuid > diff --git > Platform/BroxtonPlatformPkg/Board/MinnowBoard3/Logo/MinnowBoardLo > go.bmp > Platform/BroxtonPlatformPkg/Board/MinnowBoard3/Logo/MinnowBoardLo > go.bmp > new file mode 100644 > index > 0000000000000000000000000000000000000000..7d7796e18777e34b802728bfe > 8ac7815da05256e > GIT binary patch > literal 54670 > zcmeI4Ka%H25rstr1{P >w! > zs(XeA?bgh^Exr8nGApxs*4T*s)1UwPui^REAAdUxf6&)|0>2r4_iX>mKZoJ(zd! > J7 > zc=3D^XN4Ei%H%W>$R`W&`x8@7LM!_WWt+c1oiFbi^wtFQ_CFie9m3i_C4VG& > kg6ZT=3D4 > z2VoQ@L1bQpRoH|*>W(@mVHOr)6*gfX27M0eC``gEEW#>m!mcI YR@HenwI > z{TcRAn1oqagjLvteV7KdIgG;7?^#%cRoI06xY{`CoP=3D3egjLvt{kZlt>YRjGScFyB > zg#8%FJnEc;Sy+Ts*o6HU*D~sygjraGRoI06809+ZoP=3D3egjLvt{TTB$>YRjGScFyB > zg#CF1(?05)gjraGRoH}mSakno7=3D@>s&%)F1RoH}mSjIsZg- > Mu&MOcMR*pIbMqs~c~ > zg+*9}P1ui>&ZEvrn1w}Hg-zIxb*sp- > Ou{TI!YXXSemsSB)Hw;Wun4QL3H$L(wo&IK > z%)%n9!Y1s`PiWakos%#Ni?9ltun(K=3DzYU`>3A3;WtMK%DKc3b&>YRjGScFyBg# > CDS > z)2MS2W?>OlVH5V_NzS9rNtlI2ScOg4kLS9KIwxTk7GV`OVLzVoI_jK+Sy+Ts*o6 > If > z=3DG&-q5@ul$*5T*>ej9#L+# Z%7{Ob4oW$n4|v+whc6X@^u > zj$3=3D&bKmFV+1%07_j$*yJ?^>h^YLu%=3D;`~s Hh1*&eco|vk9+R>d_0>w > zdip- > ^xV6VU_kBK|%^f{`pLg8aOaL?`xSK}=3D`za_3XMFz z3t=3DJ4`aSzTpWlFe9hotEcm-b;l9df#q}!waJ*2S|X2_6iAq8I+!a|lsx;-lUw23rE > z-7vBX8_9$$k78LK3z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t?^B~F%qa%O$c!- > |B6%<*Saz_UjqLl> > zSPFBB;W08}Oo&Jx3<;JUtY;%H?32ww%LYQYYDMr@ssd?C`aj=3D{=3DX > J~yk > zJ&UBzrn67qgtbze>~bY`VbfV5V>X=3D?BArKnx0(m%#8FxwXBf;z(wIfk$0q0tW{< > v4 > zjfF$!D6Nn4EreW7U=3DvIaW{)4T&q6bH2G+>C6r}q- > ?F3}B^DRuY9%7e8BUwQ@5_t4? > zt9kT&zC0hkDl$7JhL9B!UJ5^dFg=3D((e#pCJdE1(8hDLj9E5=3DBwv|g;WIS&D{dL>2{ > znqeKg#)9- > wjFE+AY&t7YlRl=3DC^>?dza0MKt^_^zuG8mFETY-|1 > z&Pc1- > _o=3DaPP8_B6agT^kUXp&$p3TGwjJmTFo!^dEwpGE7|Vr#(vKS > zqvjj2L4BVZOJPp- > jn$v1jkKC}OZCXUPtEFAwog8;jPY^R$7J7MR>=3DBToviY1t*AAg > zw2v4XGZvZ=3DVk>0ER62ELs?JBTh@dfJOmGEKTPmG8Q(5DrSOn0RF(w%O+>}b > E&RqAs > zmtx_kF=3DI@4FaLohl}?=3D>2)}bvEZj6^j0x}5KQg4!sq-V{v!7z&r7>enIE#PCQ|Zk4 > z3-YD^Ug`I|- > 30nRZ@03v;l9swJhyZ9eco3DAE?EAdk%F>4WKGX5s&e`{Q > tyOpI4_kE`0xt+7`^L8ss8}9o|$8$Sp-{=20 > literal 0 > HcmV?d00001 >=20 > diff --git > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Log > o.c > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Log > o.c > new file mode 100644 > index 000000000..15efd6677 > --- /dev/null > +++ > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Log > o.c > @@ -0,0 +1,520 @@ > +/** @file > + Platform Initialization Driver. > + > + Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.
> + > + This program and the accompanying materials > + are licensed and made available under the terms and conditions of the = BSD > License > + which accompanies this distribution. The full text of the license may= be > found at > + http://opensource.org/licenses/bsd-license.php. > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > + > +**/ > + > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "Logo.h" > + > + > +/** > + Convert a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buff= er > + is passed in a GopBlt buffer will be allocated by this routine. If a G= opBlt > + buffer is passed in it will be used if it is big enough. > + > + @param BmpImage Pointer to BMP file > + @param BmpImageSize Number of bytes in BmpImage > + @param GopBlt Buffer containing GOP version of BmpImage. > + @param GopBltSize Size of GopBlt in bytes. > + @param PixelHeight Height of GopBlt/BmpImage in pixels > + @param PixelWidth Width of GopBlt/BmpImage in pixels > + > + @retval EFI_SUCCESS GopBlt and GopBltSize are returned. > + @retval EFI_UNSUPPORTED BmpImage is not a valid *.BMP image > + @retval EFI_BUFFER_TOO_SMALL The passed in GopBlt buffer is not big > enough. > + GopBltSize will contain the required= size. > + @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate. > + > +**/ > +EFI_STATUS > +EfiShellConvertBmpToGopBlt ( > + IN VOID *BmpImage, > + IN UINTN BmpImageSize, > + IN OUT VOID **GopBlt, > + IN OUT UINTN *GopBltSize, > + OUT UINTN *PixelHeight, > + OUT UINTN *PixelWidth > + ) > +{ > + UINT8 *Image; > + UINT8 *ImageHeader; > + BMP_IMAGE_HEADER *BmpHeader; > + BMP_COLOR_MAP *BmpColorMap; > + EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer; > + EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt; > + UINT64 BltBufferSize; > + UINTN Index; > + UINTN Height; > + UINTN Width; > + UINTN ImageIndex; > + UINT32 DataSizePerLine; > + BOOLEAN IsAllocated; > + UINT32 ColorMapNum; > + > + if (sizeof (BMP_IMAGE_HEADER) > BmpImageSize) { > + return EFI_INVALID_PARAMETER; > + } > + > +BmpHeader =3D (BMP_IMAGE_HEADER *) BmpImage; > + > +if (BmpHeader->CharB !=3D 'B' || BmpHeader->CharM !=3D 'M') { > + return EFI_UNSUPPORTED; > +} > + > +// > +// Doesn't support compress. > +// > +if (BmpHeader->CompressionType !=3D 0) { > + return EFI_UNSUPPORTED; > +} > + > +// > +// Only support BITMAPINFOHEADER format. > +// BITMAPFILEHEADER + BITMAPINFOHEADER =3D BMP_IMAGE_HEADER > +// > +if (BmpHeader->HeaderSize !=3D sizeof (BMP_IMAGE_HEADER) - > OFFSET_OF(BMP_IMAGE_HEADER, HeaderSize)) { > + return EFI_UNSUPPORTED; > +} > + > +// > +// The data size in each line must be 4 byte alignment. > +// > +DataSizePerLine =3D ((BmpHeader->PixelWidth * BmpHeader->BitPerPixel + > 31) >> 3) & (~0x3); > +BltBufferSize =3D MultU64x32 (DataSizePerLine, BmpHeader->PixelHeight); > +if (BltBufferSize > (UINT32) ~0) { > + return EFI_INVALID_PARAMETER; > +} > + > +if ((BmpHeader->Size !=3D BmpImageSize) || > + (BmpHeader->Size < BmpHeader->ImageOffset) || > + (BmpHeader->Size - BmpHeader->ImageOffset !=3D BmpHeader- > >PixelHeight * DataSizePerLine)) { > + return EFI_INVALID_PARAMETER; > +} > + > +// > +// Calculate Color Map offset in the image. > +// > +Image =3D BmpImage; > +BmpColorMap =3D (BMP_COLOR_MAP *) (Image + sizeof > (BMP_IMAGE_HEADER)); > +if (BmpHeader->ImageOffset < sizeof (BMP_IMAGE_HEADER)) { > + return EFI_INVALID_PARAMETER; > +} > + > +if (BmpHeader->ImageOffset > sizeof (BMP_IMAGE_HEADER)) { > + switch (BmpHeader->BitPerPixel) { > + case 1: > + ColorMapNum =3D 2; > + break; > + case 4: > + ColorMapNum =3D 16; > + break; > + case 8: > + ColorMapNum =3D 256; > + break; > + default: > + ColorMapNum =3D 0; > + break; > + } > + // > + // BMP file may has padding data between the bmp header section and > the bmp data section. > + // > + if (BmpHeader->ImageOffset - sizeof (BMP_IMAGE_HEADER) < sizeof > (BMP_COLOR_MAP) * ColorMapNum) { > + return EFI_INVALID_PARAMETER; > + } > + } > + > + // > + // Calculate graphics image data address in the image > + // > + Image =3D ((UINT8 *) BmpImage) + BmpHeader->ImageOffset; > + ImageHeader =3D Image; > + > + // > + // Calculate the BltBuffer needed size. > + // > + BltBufferSize =3D MultU64x32 ((UINT64) BmpHeader->PixelWidth, > BmpHeader->PixelHeight); > + // > + // Ensure the BltBufferSize * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) > doesn't overflow > + // > + if (BltBufferSize > DivU64x32 ((UINTN) ~0, sizeof > (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) { > + return EFI_UNSUPPORTED; > + } > + BltBufferSize =3D MultU64x32 (BltBufferSize, sizeof > (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)); > + > + IsAllocated =3D FALSE; > + if (*GopBlt =3D=3D NULL) { > + // > + // GopBlt is not allocated by caller. > + // > + *GopBltSize =3D (UINTN) BltBufferSize; > + *GopBlt =3D AllocatePool (*GopBltSize); > + IsAllocated =3D TRUE; > + if (*GopBlt =3D=3D NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + } else { > + // > + // GopBlt has been allocated by caller. > + // > + if (*GopBltSize < (UINTN) BltBufferSize) { > + *GopBltSize =3D (UINTN) BltBufferSize; > + return EFI_BUFFER_TOO_SMALL; > + } > + } > + > + *PixelWidth =3D BmpHeader->PixelWidth; > + *PixelHeight =3D BmpHeader->PixelHeight; > + > + // > + // Convert image from BMP to Blt buffer format > + // > + BltBuffer =3D *GopBlt; > + for (Height =3D 0; Height < BmpHeader->PixelHeight; Height++) { > + Blt =3D &BltBuffer[(BmpHeader->PixelHeight - Height - 1) * BmpHeader- > >PixelWidth]; > + for (Width =3D 0; Width < BmpHeader->PixelWidth; Width++, Image++, > Blt++) { > + switch (BmpHeader->BitPerPixel) { > + case 1: > + // > + // Convert 1-bit (2 colors) BMP to 24-bit color > + // > + for (Index =3D 0; Index < 8 && Width < BmpHeader->PixelWidth; Ind= ex++) > { > + Blt->Red =3D BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Red= ; > + Blt->Green =3D BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Gr= een; > + Blt->Blue =3D BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Bl= ue; > + Blt++; > + Width++; > + } > + > + Blt--; > + Width--; > + break; > + > + case 4: > + // > + // Convert 4-bit (16 colors) BMP Palette to 24-bit color > + // > + Index =3D (*Image) >> 4; > + Blt->Red =3D BmpColorMap[Index].Red; > + Blt->Green =3D BmpColorMap[Index].Green; > + Blt->Blue =3D BmpColorMap[Index].Blue; > + if (Width < (BmpHeader->PixelWidth - 1)) { > + Blt++; > + Width++; > + Index =3D (*Image) & 0x0f; > + Blt->Red =3D BmpColorMap[Index].Red; > + Blt->Green =3D BmpColorMap[Index].Green; > + Blt->Blue =3D BmpColorMap[Index].Blue; > + } > + break; > + > + case 8: > + // > + // Convert 8-bit (256 colors) BMP Palette to 24-bit color > + // > + Blt->Red =3D BmpColorMap[*Image].Red; > + Blt->Green =3D BmpColorMap[*Image].Green; > + Blt->Blue =3D BmpColorMap[*Image].Blue; > + break; > + > + case 24: > + // > + // It is 24-bit BMP. > + // > + Blt->Blue =3D *Image++; > + Blt->Green =3D *Image++; > + Blt->Red =3D *Image; > + break; > + > + default: > + // > + // Other bit format BMP is not supported. > + // > + if (IsAllocated) { > + FreePool (*GopBlt); > + *GopBlt =3D NULL; > + } > + return EFI_UNSUPPORTED; > + }; > + > + } > + > + ImageIndex =3D (UINTN)Image - (UINTN)ImageHeader; > + if ((ImageIndex % 4) !=3D 0) { > + // > + // Bmp Image starts each row on a 32-bit boundary! > + // > + Image =3D Image + (4 - (ImageIndex % 4)); > + } > + } > + > + return EFI_SUCCESS; > +} > + > + > +EFI_STATUS > +EFIAPI > +WelcomeLineDisplay ( > + IN CHAR16 * WelcomeLine > + ) > +{ > + UINTN Length; > + UINTN Line; > + UINTN Columns; > + UINTN Rows; > + UINTN Column; > + EFI_STATUS Status; > + EFI_SIMPLE_TEXT_OUTPUT_MODE SavedConMode; > + > + Length =3D StrLen(WelcomeLine); > + Line =3D 1; > + CopyMem(&SavedConMode, gST->ConOut->Mode, sizeof > (SavedConMode)); > + gST->ConOut->QueryMode(gST->ConOut, SavedConMode.Mode, > &Columns, &Rows); > + Column =3D (Columns-Length)/2; > + gST->ConOut->SetAttribute(gST->ConOut, EFI_YELLOW); > + gST->ConOut->SetCursorPosition(gST->ConOut, Column, > SavedConMode.CursorRow); > + gST->ConOut->OutputString(gST->ConOut, WelcomeLine); > + gST->ConOut->EnableCursor (gST->ConOut, > SavedConMode.CursorVisible); > + gST->ConOut->SetCursorPosition (gST->ConOut, > SavedConMode.CursorColumn, (SavedConMode.CursorRow+1)); > + Status =3D gST->ConOut->SetAttribute (gST->ConOut, > SavedConMode.Attribute); > + return Status; > +} > + > +EFI_STATUS > +EFIAPI > +LogoDisplay ( > + IN EFI_GUID *LogoFile > + ) > +{ > + EFI_STATUS Status; > + UINT32 SizeOfX; > + UINT32 SizeOfY; > + INTN DestX; > + INTN DestY; > + UINT8 *ImageData; > + UINTN ImageSize; > + UINTN BltSize; > + EFI_BADGING_DISPLAY_ATTRIBUTE Attribute; > + UINTN CoordinateX; > + UINTN CoordinateY; > + UINTN Height; > + UINTN Width; > + EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt; > + EFI_UGA_DRAW_PROTOCOL *UgaDraw; > + UINT32 ColorDepth; > + UINT32 RefreshRate; > + EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; > + UINTN LogoDestX; > + UINTN LogoDestY; > + UINTN LogoHeight; > + UINTN LogoWidth; > + > + UgaDraw =3D NULL; > + // > + // Try to open GOP first > + // > + Status =3D gBS->LocateProtocol (&gEfiGraphicsOutputProtocolGuid, NULL, > (VOID **) &GraphicsOutput); > + if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) { > + GraphicsOutput =3D NULL; > + // > + // Open GOP failed, try to open UGA > + // > + Status =3D gBS->HandleProtocol (gST->ConsoleOutHandle, > &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw); > + } > + if (EFI_ERROR (Status)) { > + return EFI_UNSUPPORTED; > + } > + > + // > + // Try to open Boot Logo Protocol. > + // > + > + if (GraphicsOutput !=3D NULL) { > + SizeOfX =3D GraphicsOutput->Mode->Info->HorizontalResolution; > + SizeOfY =3D GraphicsOutput->Mode->Info->VerticalResolution; > + > + } else if (UgaDraw !=3D NULL && FeaturePcdGet (PcdUgaConsumeSupport)) > { > + Status =3D UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, > &ColorDepth, &RefreshRate); > + if (EFI_ERROR (Status)) { > + return EFI_UNSUPPORTED; > + } > + } else { > + return EFI_UNSUPPORTED; > + } > + > + Blt =3D NULL; > + LogoDestX =3D 0; > + LogoDestY =3D 0; > + LogoHeight =3D 0; > + LogoWidth =3D 0; > + > + ImageData =3D NULL; > + ImageSize =3D 0; > + > + // > + // Get the specified image from FV. > + // > + Status =3D GetSectionFromAnyFv (LogoFile, EFI_SECTION_RAW, 0, (VOID **= ) > &ImageData, &ImageSize); > + if (EFI_ERROR (Status)) { > + return EFI_UNSUPPORTED; > + } > + > + CoordinateX =3D 0; > + CoordinateY =3D 0; > + Attribute =3D EfiBadgingDisplayAttributeRightTop; > + > + if (Blt !=3D NULL) { > + FreePool (Blt); > + } > + > + // > + // Try BMP decoder > + // > + Blt =3D NULL; > + Status =3D EfiShellConvertBmpToGopBlt ( > + ImageData, > + ImageSize, > + (VOID **) &Blt, > + &BltSize, > + &Height, > + &Width > + ); > + > + if (EFI_ERROR (Status)) { > + FreePool (ImageData); > + } > + > + // > + // Calculate the display position according to Attribute. > + // > + switch (Attribute) { > + case EfiBadgingDisplayAttributeLeftTop: > + DestX =3D CoordinateX; > + DestY =3D CoordinateY; > + break; > + > + case EfiBadgingDisplayAttributeCenterTop: > + DestX =3D (SizeOfX - Width) / 2; > + DestY =3D CoordinateY; > + break; > + > + case EfiBadgingDisplayAttributeRightTop: > + DestX =3D (SizeOfX - Width - CoordinateX); > + DestY =3D CoordinateY;; > + break; > + > + case EfiBadgingDisplayAttributeCenterRight: > + DestX =3D (SizeOfX - Width - CoordinateX); > + DestY =3D (SizeOfY - Height) / 2; > + break; > + > + case EfiBadgingDisplayAttributeRightBottom: > + DestX =3D (SizeOfX - Width - CoordinateX); > + DestY =3D (SizeOfY - Height - CoordinateY); > + break; > + > + case EfiBadgingDisplayAttributeCenterBottom: > + DestX =3D (SizeOfX - Width) / 2; > + DestY =3D (SizeOfY - Height - CoordinateY); > + break; > + > + case EfiBadgingDisplayAttributeLeftBottom: > + DestX =3D CoordinateX; > + DestY =3D (SizeOfY - Height - CoordinateY); > + break; > + > + case EfiBadgingDisplayAttributeCenterLeft: > + DestX =3D CoordinateX; > + DestY =3D (SizeOfY - Height) / 2; > + break; > + > + case EfiBadgingDisplayAttributeCenter: > + DestX =3D (SizeOfX - Width) / 2; > + DestY =3D (SizeOfY - Height) / 2; > + break; > + > + default: > + DestX =3D CoordinateX; > + DestY =3D CoordinateY; > + break; > + } > + > + if ((DestX >=3D 0) && (DestY >=3D 0)) { > + if (GraphicsOutput !=3D NULL) { > + Status =3D GraphicsOutput->Blt ( > + GraphicsOutput, > + Blt, > + EfiBltBufferToVideo, > + 0, > + 0, > + (UINTN) DestX, > + (UINTN) DestY, > + Width, > + Height, > + Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT= _PIXEL) > + ); > + } else if (UgaDraw !=3D NULL && FeaturePcdGet (PcdUgaConsumeSupport)= ) > { > + Status =3D UgaDraw->Blt ( > + UgaDraw, > + (EFI_UGA_PIXEL *) Blt, > + EfiUgaBltBufferToVideo, > + 0, > + 0, > + (UINTN) DestX, > + (UINTN) DestY, > + Width, > + Height, > + Width * sizeof (EFI_UGA_PIXEL) > + ); > + } else { > + Status =3D EFI_UNSUPPORTED; > + } > + > + } > + > + FreePool (ImageData); > + > + FreePool (Blt); > + > + return Status; > + } > + > + > +VOID > +EFIAPI > +EfiShellProtocolCallback ( > + IN EFI_EVENT Event, > + IN VOID *Context > +) > +{ > + CHAR16 *Welcome; > + Welcome =3D L"Welcome to https://minnowboard.org/setup"; > + WelcomeLineDisplay(Welcome); > + LogoDisplay(PcdGetPtr (PcdLogoFileGuid)); > + return; > +} > + > diff --git > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Log > o.h > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Log > o.h > new file mode 100644 > index 000000000..62cb1e588 > --- /dev/null > +++ > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Log > o.h > @@ -0,0 +1,27 @@ > +/** @file > + Driver configuration include file. > + > + Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.
> + > + This program and the accompanying materials > + are licensed and made available under the terms and conditions of the = BSD > License > + which accompanies this distribution. The full text of the license may= be > found at > + http://opensource.org/licenses/bsd-license.php. > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > + > +**/ > + > +#ifndef _LOGO_H > +#define _LOGO_H > + > +VOID > +EFIAPI > +EfiShellProtocolCallback ( > + IN EFI_EVENT Event, > + IN VOID *Context > +); > + > +#endif // #ifndef _CONFIGURATION_H > + > diff --git > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platf > orm.c > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platf > orm.c > index a6d251ded..87268e8fd 100644 > --- > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platf > orm.c > +++ > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platf > orm.c > @@ -15,6 +15,7 @@ >=20 > #include "PlatformDxe.h" > #include "Platform.h" > +#include "Logo.h" >=20 > #include > #include > @@ -254,7 +255,6 @@ EnableAcpiCallback ( > IoWrite16 (AcpiBaseAddr + R_ACPI_PM1_CNT, Pm1Cnt); > } >=20 > - > VOID > PlatformScInitBeforeBoot ( > VOID > @@ -699,6 +699,8 @@ InitializePlatform ( > EFI_HOB_GUID_TYPE *FdoEnabledGuidHob =3D NULL; > EFI_PLATFORM_INFO_HOB *PlatformInfoHob; > EFI_PEI_HOB_POINTERS Hob; > + EFI_EVENT EfiShellEvent =3D NULL; > + VOID *mEfiShellProtocolRegistration; >=20 > mImageHandle =3D ImageHandle; >=20 > @@ -900,6 +902,23 @@ InitializePlatform ( >=20 > OverrideSdCardPresence(); >=20 > + // > + //QR code showing under EFI Shell > + // > + if (PcdGetBool(PcdLogoDisplay)) { > + Status =3D gBS->CreateEvent ( > + EVT_NOTIFY_SIGNAL, > + TPL_CALLBACK, > + EfiShellProtocolCallback, > + NULL, > + &EfiShellEvent > + ); > + Status =3D gBS->RegisterProtocolNotify ( > + &gEfiShellProtocolGuid, > + EfiShellEvent, > + &mEfiShellProtocolRegistration > + ); > + } > return EFI_SUCCESS; > } >=20 > diff --git > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platf > ormDxe.inf > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platf > ormDxe.inf > index ee8fd5a68..b98d32c73 100644 > --- > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platf > ormDxe.inf > +++ > Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/Platf > ormDxe.inf > @@ -34,6 +34,7 @@ > IchTcoReset.c > SensorVar.c > Rtc.c > + Logo.c >=20 > [Packages] > MdePkg/MdePkg.dec > @@ -66,6 +67,7 @@ > DxeSaPolicyLib > ConfigBlockLib > GpioLib > + DxeServicesLib >=20 > [Guids] > gEfiBiosIdGuid > @@ -116,6 +118,9 @@ > gDxePlatformTdtPolicyGuid > gDxePlatformSeCPolicyGuid > gEfiSeCOperationProtocolGuid > + gEfiUgaDrawProtocolGuid > + gEfiUgaDrawProtocolGuid |PcdUgaConsumeSupport > + gEfiShellProtocolGuid >=20 > [Pcd] > gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress > @@ -127,6 +132,11 @@ > gPlatformModuleTokenSpaceGuid.PcdPBTNDisableInterval > gEfiMdeModulePkgTokenSpaceGuid.PcdFastPS2Detection > gEfiBxtTokenSpaceGuid.PcdP2SBBaseAddress > + gPlatformModuleTokenSpaceGuid.PcdLogoFileGuid > + gPlatformModuleTokenSpaceGuid.PcdLogoDisplay > + > +[FeaturePcd] > + gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport >=20 > [Depex] > gEfiPciRootBridgeIoProtocolGuid AND > diff --git Platform/BroxtonPlatformPkg/PlatformPkg.dec > Platform/BroxtonPlatformPkg/PlatformPkg.dec > index f37ceafe3..52c05d976 100644 > --- Platform/BroxtonPlatformPkg/PlatformPkg.dec > +++ Platform/BroxtonPlatformPkg/PlatformPkg.dec > @@ -184,6 +184,8 @@ > gPlatformModuleTokenSpaceGuid.PcdBoardVbtFileGuid|{ 0x00, 0x00, 0x00, > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, > 0x00 }|VOID*|0x80000014 > ## This PCD used to enable or disable SueCreek >=20 > gPlatformModuleTokenSpaceGuid.PcdSueCreek|FALSE|BOOLEAN|0x800000 > 15 > + ## This PCD used for QR code display under EFI Shell > + > gPlatformModuleTokenSpaceGuid.PcdLogoDisplay|FALSE|BOOLEAN|0x8000 > 0016 >=20 > ## MemoryCheck value for checking memory before boot OS. > ## To save the boot performance, the default MemoryCheck is set to 0. > @@ -319,6 +321,7 @@ >=20 > gPlatformModuleTokenSpaceGuid.PcdTemporaryRamSize|0x2000|UINT32|0 > x10001002 > # @Prompt Stack size in the temporary RAM. >=20 > gPlatformModuleTokenSpaceGuid.PcdPeiTemporaryRamStackSize|0|UINT3 > 2|0x10001003 > + gPlatformModuleTokenSpaceGuid.PcdLogoFileGuid|{0x1b, 0x9a, 0x3d, > 0x71, 0x49, 0x88, 0x47, 0xc5, 0xb7, 0x2a, 0xb0, 0x7d, 0xc5, 0x10, 0x60, > 0xc4 }|VOID*|0x10001004 >=20 > [PcdsFixedAtBuild] > ## Specifies maximum number of PPIs provided by SecCore. > diff --git Platform/BroxtonPlatformPkg/PlatformPkg.fdf > Platform/BroxtonPlatformPkg/PlatformPkg.fdf > index 1c1eb475f..32c389268 100644 > --- Platform/BroxtonPlatformPkg/PlatformPkg.fdf > +++ Platform/BroxtonPlatformPkg/PlatformPkg.fdf > @@ -582,6 +582,9 @@ APRIORI DXE { > FILE FREEFORM =3D > PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) { > SECTION RAW =3D > $(PLATFORM_PACKAGE_COMMON)/Binaries/Logo/Logo.bmp > } > + FILE FREEFORM =3D PCD(gPlatformModuleTokenSpaceGuid.PcdLogoFileGuid) > { > + SECTION RAW =3D > $(PLATFORM_NAME)/Board/MinnowBoard3/Logo/MinnowBoardLogo.bmp > +} >=20 > INF $(PLATFORM_PACKAGE_COMMON)/PnpDxe/PnpDxe.inf > INF > $(PLATFORM_PACKAGE_COMMON)/PlatformSettings/PlatformGpio/Platfor > mGpio.inf > -- > 2.14.1.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel