public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 00/10] Add BmpSupportLib class and instance
@ 2018-02-07 22:58 Kinney, Michael D
  2018-02-07 22:58 ` [Patch 01/10] MdeModulePkg: " Kinney, Michael D
                   ` (11 more replies)
  0 siblings, 12 replies; 25+ messages in thread
From: Kinney, Michael D @ 2018-02-07 22:58 UTC (permalink / raw)
  To: edk2-devel
  Cc: Sean Brogan, Jiewen Yao, Star Zeng, Eric Dong, Ruiyu Ni,
	Laszlo Ersek, Ard Biesheuvel, Jordan Justen, David Wei, Mang Guo,
	Kelly Steele, Hao Wu, Andrew Fish, Michael D Kinney

https://bugzilla.tianocore.org/show_bug.cgi?id=800

Branch for review:
https://github.com/mdkinney/edk2/commits/Bug_800_BmpSupportLib_V2

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

Add BmpSupportLib class and instances that provides services to
convert a BMP graphics image to a GOP BLT buffer and to convert
a GOP BLT buffer to a BMP graphics image.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Andrew Fish <afish@apple.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>

Kinney, Michael D (1):
  MdeModulePkg: Add BmpSupportLib class and instance

Michael D Kinney (9):
  MdeModulePkg/DxeCapsuleLibFmp: Use BmpSupportLib
  MdeModulePkg/BootGraphicsResourceTableDxe: Use BmpSupportLib
  IntelFrameworkModulePkg/GenericBdsLib: Use BmpSupportLib
  OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files
  Vlv2TbltDevicePkg/Override/GenericBdsLib: Use BmpSupportLib
  QuarkPlatformPkg: Add SafeIntLib and BmpSupportLib to DSC files
  DuetPkg: Add SafeIntLib and BmpSupportLib to DSC files
  EmulatorPkg: Add SafeIntLib and BmpSupportLib to DSC files
  ArmVirtPkg: Add SafeIntLib and BmpSupportLib to DSC files

 ArmVirtPkg/ArmVirt.dsc.inc                         |   4 +-
 DuetPkg/DuetPkgIa32.dsc                            |   4 +-
 DuetPkg/DuetPkgX64.dsc                             |   4 +-
 EmulatorPkg/EmulatorPkg.dsc                        |   2 +
 .../IntelFrameworkModulePkg.dsc                    |   4 +-
 .../Library/GenericBdsLib/BdsConsole.c             | 250 +--------
 .../Library/GenericBdsLib/GenericBdsLib.inf        |   3 +-
 .../Library/GenericBdsLib/InternalBdsLib.h         |   3 +-
 MdeModulePkg/Include/Library/BmpSupportLib.h       | 105 ++++
 .../BaseBmpSupportLib/BaseBmpSupportLib.inf        |  49 ++
 .../BaseBmpSupportLib/BaseBmpSupportLib.uni        |  20 +
 .../Library/BaseBmpSupportLib/BmpSupportLib.c      | 583 +++++++++++++++++++++
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c       | 268 +---------
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf     |   3 +-
 .../DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf      |   3 +-
 MdeModulePkg/MdeModulePkg.dec                      |   6 +-
 MdeModulePkg/MdeModulePkg.dsc                      |   3 +
 .../BootGraphicsResourceTableDxe.c                 | 425 +++++++--------
 .../BootGraphicsResourceTableDxe.inf               |   4 +-
 OvmfPkg/OvmfPkgIa32.dsc                            |   2 +
 OvmfPkg/OvmfPkgIa32X64.dsc                         |   2 +
 OvmfPkg/OvmfPkgX64.dsc                             |   2 +
 QuarkPlatformPkg/Quark.dsc                         |   4 +-
 .../Library/GenericBdsLib/BdsConsole.c             | 251 +--------
 .../Library/GenericBdsLib/GenericBdsLib.inf        |   3 +-
 .../Library/GenericBdsLib/InternalBdsLib.h         |   3 +-
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc            |   4 +-
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc              |   4 +-
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc               |   4 +-
 29 files changed, 1018 insertions(+), 1004 deletions(-)
 create mode 100644 MdeModulePkg/Include/Library/BmpSupportLib.h
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.uni
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c

-- 
2.14.2.windows.3



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [Patch 01/10] MdeModulePkg: Add BmpSupportLib class and instance
  2018-02-07 22:58 [Patch 00/10] Add BmpSupportLib class and instance Kinney, Michael D
@ 2018-02-07 22:58 ` Kinney, Michael D
  2018-02-08  5:10   ` Zeng, Star
  2018-02-07 22:58 ` [Patch 02/10] MdeModulePkg/DxeCapsuleLibFmp: Use BmpSupportLib Kinney, Michael D
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 25+ messages in thread
From: Kinney, Michael D @ 2018-02-07 22:58 UTC (permalink / raw)
  To: edk2-devel
  Cc: Sean Brogan, Jiewen Yao, Star Zeng, Eric Dong, Ruiyu Ni,
	Michael D Kinney

https://bugzilla.tianocore.org/show_bug.cgi?id=800

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

Add BmpSupportLib class and instances that provides services to
convert a BMP graphics image to a GOP BLT buffer and to convert
a GOP BLT buffer to a BMP graphics image.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 MdeModulePkg/Include/Library/BmpSupportLib.h       | 105 ++++
 .../BaseBmpSupportLib/BaseBmpSupportLib.inf        |  49 ++
 .../BaseBmpSupportLib/BaseBmpSupportLib.uni        |  20 +
 .../Library/BaseBmpSupportLib/BmpSupportLib.c      | 583 +++++++++++++++++++++
 MdeModulePkg/MdeModulePkg.dec                      |   6 +-
 MdeModulePkg/MdeModulePkg.dsc                      |   1 +
 6 files changed, 763 insertions(+), 1 deletion(-)
 create mode 100644 MdeModulePkg/Include/Library/BmpSupportLib.h
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.uni
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c

diff --git a/MdeModulePkg/Include/Library/BmpSupportLib.h b/MdeModulePkg/Include/Library/BmpSupportLib.h
new file mode 100644
index 0000000000..3406aa3fca
--- /dev/null
+++ b/MdeModulePkg/Include/Library/BmpSupportLib.h
@@ -0,0 +1,105 @@
+/** @file
+
+Provides services to convert a BMP graphics image to a GOP BLT buffer.
+
+Copyright (c) 2016, Microsoft Corporation
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+
+All rights reserved.
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+1. Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#ifndef __BMP_SUPPORT_LIB_H__
+#define __BMP_SUPPORT_LIB_H__
+
+#include <Protocol/GraphicsOutput.h>
+
+/**
+  Translate a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
+  is passed in a GopBlt buffer will be allocated by this routine using
+  EFI_BOOT_SERVICES.AllocatePool(). If a GopBlt buffer is passed in it will be
+  used if it is big enough.
+
+  @param [in]      BmpImage      Pointer to BMP file.
+  @param [in]      BmpImageSize  Number of bytes in BmpImage.
+  @param [in, out] GopBlt        Buffer containing GOP version of BmpImage.
+  @param [in, out] GopBltSize    Size of GopBlt in bytes.
+  @param [out]     PixelHeight   Height of GopBlt/BmpImage in pixels.
+  @param [out]     PixelWidth    Width of GopBlt/BmpImage in pixels.
+
+  @retval RETURN_SUCCESS            GopBlt and GopBltSize are returned.
+  @retval RETURN_INVALID_PARAMETER  BmpImage is NULL.
+  @retval RETURN_INVALID_PARAMETER  GopBlt is NULL.
+  @retval RETURN_INVALID_PARAMETER  GopBltSize is NULL.
+  @retval RETURN_INVALID_PARAMETER  PixelHeight is NULL.
+  @retval RETURN_INVALID_PARAMETER  PixelWidth is NULL.
+  @retval RETURN_UNSUPPORTED        BmpImage is not a valid *.BMP image.
+  @retval RETURN_BUFFER_TOO_SMALL   The passed in GopBlt buffer is not big
+                                    enough.  The required size is returned in
+                                    GopBltSize.
+  @retval RETURN_OUT_OF_RESOURCES   The GopBlt buffer could not be allocated.
+
+**/
+RETURN_STATUS
+EFIAPI
+TranslateBmpToGopBlt (
+  IN     VOID                           *BmpImage,
+  IN     UINTN                          BmpImageSize,
+  IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL  **GopBlt,
+  IN OUT UINTN                          *GopBltSize,
+  OUT    UINTN                          *PixelHeight,
+  OUT    UINTN                          *PixelWidth
+  );
+
+/**
+  Translate a GOP blt buffer to an uncompressed 24-bit per pixel BMP graphics
+  image. If a NULL BmpImage is passed in a BmpImage buffer will be allocated by
+  this routine using EFI_BOOT_SERVICES.AllocatePool(). If a BmpImage buffer is
+  passed in it will be used if it is big enough.
+
+  @param [in]      GopBlt        Pointer to GOP blt buffer.
+  @param [in]      PixelHeight   Height of GopBlt/BmpImage in pixels.
+  @param [in]      PixelWidth    Width of GopBlt/BmpImage in pixels.
+  @param [in, out] BmpImage      Buffer containing BMP version of GopBlt.
+  @param [in, out] BmpImageSize  Size of BmpImage in bytes.
+
+  @retval RETURN_SUCCESS            BmpImage and BmpImageSize are returned.
+  @retval RETURN_INVALID_PARAMETER  GopBlt is NULL.
+  @retval RETURN_INVALID_PARAMETER  BmpImage is NULL.
+  @retval RETURN_INVALID_PARAMETER  BmpImageSize is NULL.
+  @retval RETURN_UNSUPPORTED        GopBlt cannot be converted to a *.BMP image.
+  @retval RETURN_BUFFER_TOO_SMALL   The passed in BmpImage buffer is not big
+                                    enough.  The required size is returned in
+                                    BmpImageSize.
+  @retval RETURN_OUT_OF_RESOURCES   The BmpImage buffer could not be allocated.
+
+**/
+RETURN_STATUS
+EFIAPI
+TranslateGopBltToBmp (
+  IN     EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *GopBlt,
+  IN     UINT32                         PixelHeight,
+  IN     UINT32                         PixelWidth,
+  IN OUT VOID                           **BmpImage,
+  IN OUT UINT32                         *BmpImageSize
+  );
+
+#endif
diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf b/MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
new file mode 100644
index 0000000000..02c3fae0b4
--- /dev/null
+++ b/MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
@@ -0,0 +1,49 @@
+## @file
+#
+# Provides services to convert a BMP graphics image to a GOP BLT buffer and
+# from a GOP BLT buffer to a BMP graphics image.
+#
+# Copyright (c) 2017, Microsoft Corporation
+#
+# All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+
+[Defines]
+  INF_VERSION     = 0x00010017
+  BASE_NAME       = BaseBmpSupportLib
+  MODULE_UNI_FILE = BaseBmpSupportLib.uni
+  FILE_GUID       = CF5F650B-C208-409A-B889-0755172E2B0C
+  VERSION_STRING  = 1.0
+  MODULE_TYPE     = BASE
+  LIBRARY_CLASS   = BmpSupportLib
+
+[LibraryClasses]
+  DebugLib
+  BaseMemoryLib
+  MemoryAllocationLib
+  SafeIntLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+
+[Sources]
+  BmpSupportLib.c
diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.uni b/MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.uni
new file mode 100644
index 0000000000..f24e2d246f
--- /dev/null
+++ b/MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.uni
@@ -0,0 +1,20 @@
+// /** @file
+//
+// Provides services to convert a BMP graphics image to a GOP BLT buffer and
+// from a GOP BLT buffer to a BMP graphics image.
+//
+// Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+//
+// 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.
+//
+// **/
+
+#string STR_MODULE_ABSTRACT             #language en-US "BmpSupportLib instance"
+
+#string STR_MODULE_DESCRIPTION          #language en-US "BmpSupportLib instance."
+
diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
new file mode 100644
index 0000000000..2c95e91ecc
--- /dev/null
+++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
@@ -0,0 +1,583 @@
+/** @file
+
+  Provides services to convert a BMP graphics image to a GOP BLT buffer and
+  from a GOP BLT buffer to a BMP graphics image.
+
+  Caution: This module requires additional review when modified.
+  This module processes external input - BMP image.
+  This external input must be validated carefully to avoid security issue such
+  as buffer overflow, integer overflow.
+
+  TranslateBmpToGopBlt() receives untrusted input and performs basic validation.
+
+  Copyright (c) 2016-2017, Microsoft Corporation
+  Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
+
+  All rights reserved.
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions are met:
+  1. Redistributions of source code must retain the above copyright notice,
+  this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#include <PiDxe.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/SafeIntLib.h>
+#include <IndustryStandard/Bmp.h>
+
+#include <Library/BmpSupportLib.h>
+
+//
+// BMP Image header for an uncompressed 24-bit per pixel BMP image.
+//
+const BMP_IMAGE_HEADER  mBmpImageHeaderTemplate = {
+  'B',    // CharB
+  'M',    // CharM
+  0,      // Size will be updated at runtime
+  {0, 0}, // Reserved
+  sizeof (BMP_IMAGE_HEADER), // ImageOffset
+  sizeof (BMP_IMAGE_HEADER) - OFFSET_OF (BMP_IMAGE_HEADER, HeaderSize), // HeaderSize
+  0,      // PixelWidth will be updated at runtime
+  0,      // PixelHeight will be updated at runtime
+  1,      // Planes
+  24,     // BitPerPixel
+  0,      // CompressionType
+  0,      // ImageSize will be updated at runtime
+  0,      // XPixelsPerMeter
+  0,      // YPixelsPerMeter
+  0,      // NumberOfColors
+  0       // ImportantColors
+};
+
+/**
+  Translate a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
+  is passed in a GopBlt buffer will be allocated by this routine using
+  EFI_BOOT_SERVICES.AllocatePool(). If a GopBlt buffer is passed in it will be
+  used if it is big enough.
+
+  @param[in]       BmpImage      Pointer to BMP file.
+  @param[in]       BmpImageSize  Number of bytes in BmpImage.
+  @param[in, out]  GopBlt        Buffer containing GOP version of BmpImage.
+  @param[in, out]  GopBltSize    Size of GopBlt in bytes.
+  @param[out]      PixelHeight   Height of GopBlt/BmpImage in pixels.
+  @param[out]      PixelWidth    Width of GopBlt/BmpImage in pixels.
+
+  @retval  RETURN_SUCCESS            GopBlt and GopBltSize are returned.
+  @retval  RETURN_INVALID_PARAMETER  BmpImage is NULL.
+  @retval  RETURN_INVALID_PARAMETER  GopBlt is NULL.
+  @retval  RETURN_INVALID_PARAMETER  GopBltSize is NULL.
+  @retval  RETURN_INVALID_PARAMETER  PixelHeight is NULL.
+  @retval  RETURN_INVALID_PARAMETER  PixelWidth is NULL.
+  @retval  RETURN_UNSUPPORTED        BmpImage is not a valid *.BMP image.
+  @retval  RETURN_BUFFER_TOO_SMALL   The passed in GopBlt buffer is not big
+                                     enough.  The required size is returned in
+                                     GopBltSize.
+  @retval  RETURN_OUT_OF_RESOURCES   The GopBlt buffer could not be allocated.
+
+**/
+RETURN_STATUS
+EFIAPI
+TranslateBmpToGopBlt (
+  IN     VOID                           *BmpImage,
+  IN     UINTN                          BmpImageSize,
+  IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL  **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;
+  UINT32                         BltBufferSize;
+  UINTN                          Index;
+  UINTN                          Height;
+  UINTN                          Width;
+  UINTN                          ImageIndex;
+  UINT32                         DataSizePerLine;
+  BOOLEAN                        IsAllocated;
+  UINT32                         ColorMapNum;
+  RETURN_STATUS                  Status;
+  UINT32                         DataSize;
+  UINT32                         Temp;
+
+  if (BmpImage == NULL || GopBlt == NULL || GopBltSize == NULL) {
+    return RETURN_INVALID_PARAMETER;
+  }
+  if (PixelHeight == NULL || PixelWidth == NULL) {
+    return RETURN_INVALID_PARAMETER;
+  }
+
+  if (BmpImageSize < sizeof (BMP_IMAGE_HEADER)) {
+    DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpImageSize too small\n"));
+    return RETURN_UNSUPPORTED;
+  }
+
+  BmpHeader = (BMP_IMAGE_HEADER *)BmpImage;
+
+  if (BmpHeader->CharB != 'B' || BmpHeader->CharM != 'M') {
+    DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpHeader->Char fields incorrect\n"));
+    return RETURN_UNSUPPORTED;
+  }
+
+  //
+  // Doesn't support compress.
+  //
+  if (BmpHeader->CompressionType != 0) {
+    DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: Compression Type unsupported.\n"));
+    return RETURN_UNSUPPORTED;
+  }
+
+  //
+  // Only support BITMAPINFOHEADER format.
+  // BITMAPFILEHEADER + BITMAPINFOHEADER = BMP_IMAGE_HEADER
+  //
+  if (BmpHeader->HeaderSize != sizeof (BMP_IMAGE_HEADER) - OFFSET_OF (BMP_IMAGE_HEADER, HeaderSize)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateBmpToGopBlt: BmpHeader->Headership is not as expected.  Headersize is 0x%x\n",
+      BmpHeader->HeaderSize
+      ));
+    return RETURN_UNSUPPORTED;
+  }
+
+  //
+  // The data size in each line must be 4 byte alignment.
+  //
+  Status = SafeUint32Mult (
+             BmpHeader->PixelWidth,
+             BmpHeader->BitPerPixel,
+             &DataSizePerLine
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateBmpToGopBlt: invalid BmpImage... PixelWidth:0x%x BitPerPixel:0x%x\n",
+      BmpHeader->PixelWidth,
+      BmpHeader->BitPerPixel
+      ));
+    return RETURN_UNSUPPORTED;
+  }
+
+  Status = SafeUint32Add (DataSizePerLine, 31, &DataSizePerLine);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateBmpToGopBlt: invalid BmpImage... DataSizePerLine:0x%x\n",
+      DataSizePerLine
+      ));
+
+    return RETURN_UNSUPPORTED;
+  }
+
+  DataSizePerLine = (DataSizePerLine >> 3) &(~0x3);
+  Status = SafeUint32Mult (
+             DataSizePerLine,
+             BmpHeader->PixelHeight,
+             &BltBufferSize
+             );
+
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateBmpToGopBlt: invalid BmpImage... DataSizePerLine:0x%x PixelHeight:0x%x\n",
+      DataSizePerLine, BmpHeader->PixelHeight
+      ));
+
+    return RETURN_UNSUPPORTED;
+  }
+
+  Status = SafeUint32Mult (
+             BmpHeader->PixelHeight,
+             DataSizePerLine,
+             &DataSize
+             );
+
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateBmpToGopBlt: invalid BmpImage... PixelHeight:0x%x DataSizePerLine:0x%x\n",
+      BmpHeader->PixelHeight, DataSizePerLine
+      ));
+
+    return RETURN_UNSUPPORTED;
+  }
+
+  if ((BmpHeader->Size != BmpImageSize) ||
+      (BmpHeader->Size < BmpHeader->ImageOffset) ||
+      (BmpHeader->Size - BmpHeader->ImageOffset != DataSize)) {
+
+    DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n"));
+    DEBUG ((DEBUG_ERROR, "   BmpHeader->Size: 0x%x\n", BmpHeader->Size));
+    DEBUG ((DEBUG_ERROR, "   BmpHeader->ImageOffset: 0x%x\n", BmpHeader->ImageOffset));
+    DEBUG ((DEBUG_ERROR, "   BmpImageSize: 0x%lx\n", (UINTN)BmpImageSize));
+    DEBUG ((DEBUG_ERROR, "   DataSize: 0x%lx\n", (UINTN)DataSize));
+
+    return RETURN_UNSUPPORTED;
+  }
+
+  //
+  // Calculate Color Map offset in the image.
+  //
+  Image = BmpImage;
+  BmpColorMap = (BMP_COLOR_MAP *)(Image + sizeof (BMP_IMAGE_HEADER));
+  if (BmpHeader->ImageOffset < sizeof (BMP_IMAGE_HEADER)) {
+    return RETURN_UNSUPPORTED;
+  }
+
+  if (BmpHeader->ImageOffset > sizeof (BMP_IMAGE_HEADER)) {
+    switch (BmpHeader->BitPerPixel) {
+    case 1:
+      ColorMapNum = 2;
+      break;
+    case 4:
+      ColorMapNum = 16;
+      break;
+    case 8:
+      ColorMapNum = 256;
+      break;
+    default:
+      ColorMapNum = 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 RETURN_UNSUPPORTED;
+    }
+  }
+
+  //
+  // Calculate graphics image data address in the image
+  //
+  Image = ((UINT8 *)BmpImage) + BmpHeader->ImageOffset;
+  ImageHeader = Image;
+
+  //
+  // Calculate the BltBuffer needed size.
+  //
+  Status = SafeUint32Mult (
+             BmpHeader->PixelWidth,
+             BmpHeader->PixelHeight,
+             &BltBufferSize
+             );
+
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateBmpToGopBlt: invalid BltBuffer needed size... PixelWidth:0x%x PixelHeight:0x%x\n",
+      BltBufferSize
+      ));
+
+    return RETURN_UNSUPPORTED;
+  }
+
+  Temp = BltBufferSize;
+  Status = SafeUint32Mult (
+             BltBufferSize,
+             sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL),
+             &BltBufferSize
+             );
+
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateBmpToGopBlt: invalid BltBuffer needed size... BltBufferSize:0x%lx struct size:0x%x\n",
+      Temp, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+      ));
+
+    return RETURN_UNSUPPORTED;
+  }
+
+  IsAllocated = FALSE;
+  if (*GopBlt == NULL) {
+    //
+    // GopBlt is not allocated by caller.
+    //
+    DEBUG ((DEBUG_INFO, "Bmp Support: Allocating 0x%X bytes of memory\n", BltBufferSize));
+    *GopBltSize = (UINTN)BltBufferSize;
+    *GopBlt = AllocatePool (*GopBltSize);
+    IsAllocated = TRUE;
+    if (*GopBlt == NULL) {
+      return RETURN_OUT_OF_RESOURCES;
+    }
+  } else {
+    //
+    // GopBlt has been allocated by caller.
+    //
+    if (*GopBltSize < (UINTN)BltBufferSize) {
+      *GopBltSize = (UINTN)BltBufferSize;
+      return RETURN_BUFFER_TOO_SMALL;
+    }
+  }
+
+  *PixelWidth  = BmpHeader->PixelWidth;
+  *PixelHeight = BmpHeader->PixelHeight;
+  DEBUG ((DEBUG_INFO, "BmpHeader->ImageOffset 0x%X\n", BmpHeader->ImageOffset));
+  DEBUG ((DEBUG_INFO, "BmpHeader->PixelWidth 0x%X\n", BmpHeader->PixelWidth));
+  DEBUG ((DEBUG_INFO, "BmpHeader->PixelHeight 0x%X\n", BmpHeader->PixelHeight));
+  DEBUG ((DEBUG_INFO, "BmpHeader->BitPerPixel 0x%X\n", BmpHeader->BitPerPixel));
+  DEBUG ((DEBUG_INFO, "BmpHeader->ImageSize 0x%X\n", BmpHeader->ImageSize));
+  DEBUG ((DEBUG_INFO, "BmpHeader->HeaderSize 0x%X\n", BmpHeader->HeaderSize));
+  DEBUG ((DEBUG_INFO, "BmpHeader->Size 0x%X\n", BmpHeader->Size));
+
+  //
+  // Translate image from BMP to Blt buffer format
+  //
+  BltBuffer = *GopBlt;
+  for (Height = 0; Height < BmpHeader->PixelHeight; Height++) {
+    Blt = &BltBuffer[ (BmpHeader->PixelHeight - Height - 1) * BmpHeader->PixelWidth];
+    for (Width = 0; Width < BmpHeader->PixelWidth; Width++, Image++, Blt++) {
+      switch (BmpHeader->BitPerPixel) {
+      case 1:
+        //
+        // Translate 1-bit (2 colors) BMP to 24-bit color
+        //
+        for (Index = 0; Index < 8 && Width < BmpHeader->PixelWidth; Index++) {
+          Blt->Red   = BmpColorMap[ ((*Image) >> (7 - Index)) & 0x1].Red;
+          Blt->Green = BmpColorMap[ ((*Image) >> (7 - Index)) & 0x1].Green;
+          Blt->Blue  = BmpColorMap[ ((*Image) >> (7 - Index)) & 0x1].Blue;
+          Blt++;
+          Width++;
+        }
+
+        Blt--;
+        Width--;
+        break;
+
+      case 4:
+        //
+        // Translate 4-bit (16 colors) BMP Palette to 24-bit color
+        //
+        Index = (*Image) >> 4;
+        Blt->Red   = BmpColorMap[Index].Red;
+        Blt->Green = BmpColorMap[Index].Green;
+        Blt->Blue  = BmpColorMap[Index].Blue;
+        if (Width < (BmpHeader->PixelWidth - 1)) {
+          Blt++;
+          Width++;
+          Index = (*Image) & 0x0f;
+          Blt->Red   = BmpColorMap[Index].Red;
+          Blt->Green = BmpColorMap[Index].Green;
+          Blt->Blue  = BmpColorMap[Index].Blue;
+        }
+        break;
+
+      case 8:
+        //
+        // Translate 8-bit (256 colors) BMP Palette to 24-bit color
+        //
+        Blt->Red   = BmpColorMap[*Image].Red;
+        Blt->Green = BmpColorMap[*Image].Green;
+        Blt->Blue  = BmpColorMap[*Image].Blue;
+        break;
+
+      case 24:
+        //
+        // It is 24-bit BMP.
+        //
+        Blt->Blue  = *Image++;
+        Blt->Green = *Image++;
+        Blt->Red   = *Image;
+        break;
+
+      case 32:
+        //
+        //Conver 32 bit to 24bit bmp - just ignore the final byte of each pixel
+        Blt->Blue  = *Image++;
+        Blt->Green = *Image++;
+        Blt->Red   = *Image++;
+        break;
+
+      default:
+        //
+        // Other bit format BMP is not supported.
+        //
+        if (IsAllocated) {
+          FreePool (*GopBlt);
+          *GopBlt = NULL;
+        }
+        DEBUG ((DEBUG_ERROR, "Bmp Bit format not supported.  0x%X\n", BmpHeader->BitPerPixel));
+        return RETURN_UNSUPPORTED;
+        break;
+      };
+
+    }
+
+    ImageIndex = (UINTN)(Image - ImageHeader);
+    if ((ImageIndex % 4) != 0) {
+      //
+      // Bmp Image starts each row on a 32-bit boundary!
+      //
+      Image = Image + (4 - (ImageIndex % 4));
+    }
+  }
+
+  return RETURN_SUCCESS;
+}
+
+/**
+  Translate a GOP blt buffer to an uncompressed 24-bit per pixel BMP graphics
+  image. If a NULL BmpImage is passed in a BmpImage buffer will be allocated by
+  this routine using EFI_BOOT_SERVICES.AllocatePool(). If a BmpImage buffer is
+  passed in it will be used if it is big enough.
+
+  @param [in]      GopBlt        Pointer to GOP blt buffer.
+  @param [in]      PixelHeight   Height of GopBlt/BmpImage in pixels.
+  @param [in]      PixelWidth    Width of GopBlt/BmpImage in pixels.
+  @param [in, out] BmpImage      Buffer containing BMP version of GopBlt.
+  @param [in, out] BmpImageSize  Size of BmpImage in bytes.
+
+  @retval RETURN_SUCCESS            BmpImage and BmpImageSize are returned.
+  @retval RETURN_INVALID_PARAMETER  GopBlt is NULL.
+  @retval RETURN_INVALID_PARAMETER  BmpImage is NULL.
+  @retval RETURN_INVALID_PARAMETER  BmpImageSize is NULL.
+  @retval RETURN_UNSUPPORTED        GopBlt cannot be converted to a *.BMP image.
+  @retval RETURN_BUFFER_TOO_SMALL   The passed in BmpImage buffer is not big
+                                    enough.  The required size is returned in
+                                    BmpImageSize.
+  @retval RETURN_OUT_OF_RESOURCES   The BmpImage buffer could not be allocated.
+
+**/
+RETURN_STATUS
+EFIAPI
+TranslateGopBltToBmp (
+  IN     EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *GopBlt,
+  IN     UINT32                         PixelHeight,
+  IN     UINT32                         PixelWidth,
+  IN OUT VOID                           **BmpImage,
+  IN OUT UINT32                         *BmpImageSize
+  )
+{
+  RETURN_STATUS                  Status;
+  UINT32                         PaddingSize;
+  UINT32                         BmpSize;
+  BMP_IMAGE_HEADER               *BmpImageHeader;
+  UINT8                          *Image;
+  UINTN                          Col;
+  UINTN                          Row;
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *BltPixel;
+
+  if (GopBlt == NULL || BmpImage == NULL || BmpImageSize == NULL) {
+    return RETURN_INVALID_PARAMETER;
+  }
+
+  //
+  // Allocate memory for BMP file.
+  //
+  PaddingSize = PixelWidth & 0x3;
+
+  //
+  // First check PixelWidth * 3 + PaddingSize doesn't overflow
+  //
+  Status = SafeUint32Mult (PixelWidth, 3, &BmpSize);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateGopBltToBmp: GopBlt is too large. PixelHeight:0x%x PixelWidth:0x%x\n",
+      PixelHeight,
+      PixelWidth
+      ));
+    return RETURN_UNSUPPORTED;
+  }
+  Status = SafeUint32Add (BmpSize, PaddingSize, &BmpSize);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateGopBltToBmp: GopBlt is too large. PixelHeight:0x%x PixelWidth:0x%x\n",
+      PixelHeight,
+      PixelWidth
+      ));
+    return RETURN_UNSUPPORTED;
+  }
+
+  //
+  // Second check (mLogoWidth * 3 + PaddingSize) * mLogoHeight + sizeof (BMP_IMAGE_HEADER) doesn't overflow
+  //
+  Status = SafeUint32Mult (BmpSize, PixelHeight, &BmpSize);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateGopBltToBmp: GopBlt is too large. PixelHeight:0x%x PixelWidth:0x%x\n",
+      PixelHeight,
+      PixelWidth
+      ));
+    return RETURN_UNSUPPORTED;
+  }
+  Status = SafeUint32Add (BmpSize, sizeof (BMP_IMAGE_HEADER), &BmpSize);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateGopBltToBmp: GopBlt is too large. PixelHeight:0x%x PixelWidth:0x%x\n",
+      PixelHeight,
+      PixelWidth
+      ));
+    return RETURN_UNSUPPORTED;
+  }
+
+  //
+  // The image should be stored in EfiBootServicesData, allowing the system to
+  // reclaim the memory
+  //
+  if (*BmpImage == NULL) {
+    *BmpImage = AllocateZeroPool (BmpSize);
+    if (*BmpImage == NULL) {
+      return EFI_OUT_OF_RESOURCES;
+    }
+    *BmpImageSize = BmpSize;
+  } else if (*BmpImageSize < BmpSize) {
+    *BmpImageSize = BmpSize;
+    return RETURN_BUFFER_TOO_SMALL;
+  }
+
+  BmpImageHeader = (BMP_IMAGE_HEADER *)*BmpImage;
+  CopyMem (BmpImageHeader, &mBmpImageHeaderTemplate, sizeof (BMP_IMAGE_HEADER));
+  BmpImageHeader->Size        = *BmpImageSize;
+  BmpImageHeader->ImageSize   = *BmpImageSize - sizeof (BMP_IMAGE_HEADER);
+  BmpImageHeader->PixelWidth  = PixelWidth;
+  BmpImageHeader->PixelHeight = PixelHeight;
+
+  //
+  // Convert BLT buffer to BMP file.
+  //
+  Image = (UINT8 *)BmpImageHeader + sizeof (BMP_IMAGE_HEADER);
+  for (Row = 0; Row < PixelHeight; Row++) {
+    BltPixel = &GopBlt[(PixelHeight - Row - 1) * PixelWidth];
+
+    for (Col = 0; Col < PixelWidth; Col++) {
+      *Image++ = BltPixel->Blue;
+      *Image++ = BltPixel->Green;
+      *Image++ = BltPixel->Red;
+      BltPixel++;
+    }
+
+    //
+    // Padding for 4 byte alignment.
+    //
+    Image += PaddingSize;
+  }
+
+  return RETURN_SUCCESS;
+}
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 61d034fba8..e3f87a4d28 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -7,7 +7,7 @@
 # Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
 # (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
 # Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
-#
+# Copyright (c) 2016, Microsoft Corporation<BR>
 # This program and the accompanying materials are licensed and made available under
 # the terms and conditions of the BSD License that accompanies this distribution.
 # The full text of the license may be found at
@@ -167,6 +167,10 @@
   ##
   NonDiscoverableDeviceRegistrationLib|Include/Library/NonDiscoverableDeviceRegistrationLib.h
 
+  ## @libraryclass  Provides services to convert a BMP graphics image to a GOP BLT buffer.
+  #
+  BmpSupportLib|Include/Library/BmpSupportLib.h
+
 [Guids]
   ## MdeModule package token space guid
   # Include/Guid/MdeModulePkgTokenSpace.h
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index 1c0085aee6..efd33f4b82 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -321,6 +321,7 @@
   MdeModulePkg/Library/SmmIpmiLibSmmIpmiProtocol/SmmIpmiLibSmmIpmiProtocol.inf
   MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
   MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.inf
+  MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
 
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
   MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Patch 02/10] MdeModulePkg/DxeCapsuleLibFmp: Use BmpSupportLib
  2018-02-07 22:58 [Patch 00/10] Add BmpSupportLib class and instance Kinney, Michael D
  2018-02-07 22:58 ` [Patch 01/10] MdeModulePkg: " Kinney, Michael D
@ 2018-02-07 22:58 ` Kinney, Michael D
  2018-02-07 22:58 ` [Patch 03/10] MdeModulePkg/BootGraphicsResourceTableDxe: " Kinney, Michael D
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 25+ messages in thread
From: Kinney, Michael D @ 2018-02-07 22:58 UTC (permalink / raw)
  To: edk2-devel
  Cc: Michael D Kinney, Sean Brogan, Jiewen Yao, Star Zeng, Eric Dong,
	Ruiyu Ni

From: Michael D Kinney <michael.d.kinney@intel.com>

https://bugzilla.tianocore.org/show_bug.cgi?id=800

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

Use BmpSupportLib to convert a BMP graphics image to a
GOP BLT buffer.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c       | 268 +--------------------
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf     |   3 +-
 .../DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf      |   3 +-
 MdeModulePkg/MdeModulePkg.dsc                      |   2 +
 4 files changed, 12 insertions(+), 264 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
index 2f397789b5..56c8e98b84 100644
--- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
+++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
@@ -7,10 +7,10 @@
   buffer overflow, integer overflow.
 
   SupportCapsuleImage(), ProcessCapsuleImage(), IsValidCapsuleHeader(),
-  ValidateFmpCapsule(), DisplayCapsuleImage(), ConvertBmpToGopBlt() will
-  receive untrusted input and do basic validation.
+  ValidateFmpCapsule(), and DisplayCapsuleImage() receives untrusted input and
+  performs basic validation.
 
-  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
   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
@@ -23,7 +23,6 @@
 
 #include <PiDxe.h>
 
-#include <IndustryStandard/Bmp.h>
 #include <IndustryStandard/WindowsUxCapsule.h>
 
 #include <Guid/FmpCapsule.h>
@@ -41,6 +40,7 @@
 #include <Library/DevicePathLib.h>
 #include <Library/UefiLib.h>
 #include <Library/PcdLib.h>
+#include <Library/BmpSupportLib.h>
 
 #include <Protocol/GraphicsOutput.h>
 #include <Protocol/EsrtManagement.h>
@@ -306,262 +306,6 @@ ValidateFmpCapsule (
   return EFI_SUCCESS;
 }
 
-/**
-  Convert a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
-  is passed in a GopBlt buffer will be allocated by this routine. If a GopBlt
-  buffer is passed in it will be used if it is big enough.
-
-  Caution: This function may receive untrusted input.
-
-  @param[in]       BmpImage      Pointer to BMP file
-  @param[in]       BmpImageSize  Number of bytes in BmpImage
-  @param[in, out]  GopBlt        Buffer containing GOP version of BmpImage.
-  @param[in, out]  GopBltSize    Size of GopBlt in bytes.
-  @param[out]      PixelHeight   Height of GopBlt/BmpImage in pixels
-  @param[out]      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.
-
-**/
-STATIC
-EFI_STATUS
-ConvertBmpToGopBlt (
-  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 = (BMP_IMAGE_HEADER *) BmpImage;
-
-  if (BmpHeader->CharB != 'B' || BmpHeader->CharM != 'M') {
-    return EFI_UNSUPPORTED;
-  }
-
-  //
-  // Doesn't support compress.
-  //
-  if (BmpHeader->CompressionType != 0) {
-    return EFI_UNSUPPORTED;
-  }
-
-  //
-  // Only support BITMAPINFOHEADER format.
-  // BITMAPFILEHEADER + BITMAPINFOHEADER = BMP_IMAGE_HEADER
-  //
-  if (BmpHeader->HeaderSize != 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 = ((BmpHeader->PixelWidth * BmpHeader->BitPerPixel + 31) >> 3) & (~0x3);
-  BltBufferSize = MultU64x32 (DataSizePerLine, BmpHeader->PixelHeight);
-  if (BltBufferSize > (UINT32) ~0) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  if ((BmpHeader->Size != BmpImageSize) ||
-      (BmpHeader->Size < BmpHeader->ImageOffset) ||
-      (BmpHeader->Size - BmpHeader->ImageOffset !=  BmpHeader->PixelHeight * DataSizePerLine)) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  //
-  // Calculate Color Map offset in the image.
-  //
-  Image       = BmpImage;
-  BmpColorMap = (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 = 2;
-        break;
-      case 4:
-        ColorMapNum = 16;
-        break;
-      case 8:
-        ColorMapNum = 256;
-        break;
-      default:
-        ColorMapNum = 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         = ((UINT8 *) BmpImage) + BmpHeader->ImageOffset;
-  ImageHeader   = Image;
-
-  //
-  // Calculate the BltBuffer needed size.
-  //
-  BltBufferSize = 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 = MultU64x32 (BltBufferSize, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
-
-  IsAllocated   = FALSE;
-  if (*GopBlt == NULL) {
-    //
-    // GopBlt is not allocated by caller.
-    //
-    *GopBltSize = (UINTN) BltBufferSize;
-    *GopBlt     = AllocatePool (*GopBltSize);
-    IsAllocated = TRUE;
-    if (*GopBlt == NULL) {
-      return EFI_OUT_OF_RESOURCES;
-    }
-  } else {
-    //
-    // GopBlt has been allocated by caller.
-    //
-    if (*GopBltSize < (UINTN) BltBufferSize) {
-      *GopBltSize = (UINTN) BltBufferSize;
-      return EFI_BUFFER_TOO_SMALL;
-    }
-  }
-
-  *PixelWidth   = BmpHeader->PixelWidth;
-  *PixelHeight  = BmpHeader->PixelHeight;
-
-  //
-  // Convert image from BMP to Blt buffer format
-  //
-  BltBuffer = *GopBlt;
-  for (Height = 0; Height < BmpHeader->PixelHeight; Height++) {
-    Blt = &BltBuffer[(BmpHeader->PixelHeight - Height - 1) * BmpHeader->PixelWidth];
-    for (Width = 0; Width < BmpHeader->PixelWidth; Width++, Image++, Blt++) {
-      switch (BmpHeader->BitPerPixel) {
-      case 1:
-        //
-        // Convert 1-bit (2 colors) BMP to 24-bit color
-        //
-        for (Index = 0; Index < 8 && Width < BmpHeader->PixelWidth; Index++) {
-          Blt->Red    = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Red;
-          Blt->Green  = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Green;
-          Blt->Blue   = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Blue;
-          Blt++;
-          Width++;
-        }
-
-        Blt--;
-        Width--;
-        break;
-
-      case 4:
-        //
-        // Convert 4-bit (16 colors) BMP Palette to 24-bit color
-        //
-        Index       = (*Image) >> 4;
-        Blt->Red    = BmpColorMap[Index].Red;
-        Blt->Green  = BmpColorMap[Index].Green;
-        Blt->Blue   = BmpColorMap[Index].Blue;
-        if (Width < (BmpHeader->PixelWidth - 1)) {
-          Blt++;
-          Width++;
-          Index       = (*Image) & 0x0f;
-          Blt->Red    = BmpColorMap[Index].Red;
-          Blt->Green  = BmpColorMap[Index].Green;
-          Blt->Blue   = BmpColorMap[Index].Blue;
-        }
-        break;
-
-      case 8:
-        //
-        // Convert 8-bit (256 colors) BMP Palette to 24-bit color
-        //
-        Blt->Red    = BmpColorMap[*Image].Red;
-        Blt->Green  = BmpColorMap[*Image].Green;
-        Blt->Blue   = BmpColorMap[*Image].Blue;
-        break;
-
-      case 24:
-        //
-        // It is 24-bit BMP.
-        //
-        Blt->Blue   = *Image++;
-        Blt->Green  = *Image++;
-        Blt->Red    = *Image;
-        break;
-
-      case 32:
-        //
-        // it is 32-bit BMP. Skip pixel's highest byte
-        //
-        Blt->Blue  = *Image++;
-        Blt->Green = *Image++;
-        Blt->Red   = *Image++;
-        break;
-
-      default:
-        //
-        // Other bit format BMP is not supported.
-        //
-        if (IsAllocated) {
-          FreePool (*GopBlt);
-          *GopBlt = NULL;
-        }
-        return EFI_UNSUPPORTED;
-      };
-
-    }
-
-    ImageIndex = (UINTN) Image - (UINTN) ImageHeader;
-    if ((ImageIndex % 4) != 0) {
-      //
-      // Bmp Image starts each row on a 32-bit boundary!
-      //
-      Image = Image + (4 - (ImageIndex % 4));
-    }
-  }
-
-  return EFI_SUCCESS;
-}
-
-
 /**
   Those capsules supported by the firmwares.
 
@@ -620,10 +364,10 @@ DisplayCapsuleImage (
   Blt = NULL;
   Width = 0;
   Height = 0;
-  Status = ConvertBmpToGopBlt (
+  Status = TranslateBmpToGopBlt (
              ImagePayload + 1,
              PayloadSize - sizeof(DISPLAY_DISPLAY_PAYLOAD),
-             (VOID **)&Blt,
+             &Blt,
              &BltSize,
              &Height,
              &Width
diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
index a7c36993c4..9eb50337a2 100644
--- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
+++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
@@ -3,7 +3,7 @@
 #
 #  Capsule library instance for DXE_DRIVER module types.
 #
-#  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
 #  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
@@ -51,6 +51,7 @@
   ReportStatusCodeLib
   PrintLib
   HobLib
+  BmpSupportLib
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleMax                               ## CONSUMES
diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
index 41916755da..1659b13ef4 100644
--- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
+++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
@@ -3,7 +3,7 @@
 #
 #  Capsule library instance for DXE_RUNTIME_DRIVER module types.
 #
-#  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
 #  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
@@ -54,6 +54,7 @@
   ReportStatusCodeLib
   PrintLib
   HobLib
+  BmpSupportLib
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleMax                               ## CONSUMES
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index efd33f4b82..a7c3dded8b 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -106,6 +106,8 @@
 
   FmpAuthenticationLib|MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.inf
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
 
 [LibraryClasses.EBC.PEIM]
   IoLib|MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Patch 03/10] MdeModulePkg/BootGraphicsResourceTableDxe: Use BmpSupportLib
  2018-02-07 22:58 [Patch 00/10] Add BmpSupportLib class and instance Kinney, Michael D
  2018-02-07 22:58 ` [Patch 01/10] MdeModulePkg: " Kinney, Michael D
  2018-02-07 22:58 ` [Patch 02/10] MdeModulePkg/DxeCapsuleLibFmp: Use BmpSupportLib Kinney, Michael D
@ 2018-02-07 22:58 ` Kinney, Michael D
  2018-02-07 22:58 ` [Patch 04/10] IntelFrameworkModulePkg/GenericBdsLib: " Kinney, Michael D
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 25+ messages in thread
From: Kinney, Michael D @ 2018-02-07 22:58 UTC (permalink / raw)
  To: edk2-devel
  Cc: Michael D Kinney, Sean Brogan, Jiewen Yao, Star Zeng, Eric Dong,
	Ruiyu Ni

From: Michael D Kinney <michael.d.kinney@intel.com>

https://bugzilla.tianocore.org/show_bug.cgi?id=800

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

Use BmpSupportLib to convert a GOP BLT Buffer to the BMP graphics
image that is published in an ACPI BGRT table.

* Remove use of IndustryStandard/Bmp.h include file
* Remove mBmpImageHeaderTemplate.  This is handled by BmpSupportLib
* Clean up code style with function prototypes at top
  and all module global variables together
* Update SetBootLogo() to use SafeIntLib to check input parameters
  for overflows.
* Remove internal function BgrtAcpiTableChecksum().  Use
  CalculateCheckSum8() directly from BgrtReadyToBootEventNotify()
* Remove InstallBootGraphicsResourceTable().  Move all the code into
  BgrtReadyToBootEventNotify() that is signaled at ready to boot.
* Remove all logic that converts a GOP BLT buffer to a BMP graphics image
  and use BmpSupportLib function TranslateGopBltToBmp() instead.
* Use AllocatePool() instead of AllocatePages() to allocate copy of
  BMP image that is provided by BGRT.  This is required to be compatible
  with BmpSupportLib function TranslateGopBltToBmp() that uses
  AllocatePool().
* Zero OemId in BGRT header before filling in value from PCD.
* Get size of PcdAcpiDefaultOemId and only copy the the size of the PCD
  if it is smaller than the size of the OemId field in the BGRT header.
* Use WriteUnaligned24() instead of CopyMem() for the OemTableId field
  of the BGRT header.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../BootGraphicsResourceTableDxe.c                 | 425 ++++++++++-----------
 .../BootGraphicsResourceTableDxe.inf               |   4 +-
 2 files changed, 197 insertions(+), 232 deletions(-)

diff --git a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c
index 6a7165a954..118fb4a922 100644
--- a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c
+++ b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c
@@ -1,7 +1,7 @@
 /** @file
   This module install ACPI Boot Graphics Resource Table (BGRT).
 
-  Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
   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
@@ -14,7 +14,6 @@
 #include <Uefi.h>
 
 #include <IndustryStandard/Acpi.h>
-#include <IndustryStandard/Bmp.h>
 
 #include <Protocol/AcpiTable.h>
 #include <Protocol/GraphicsOutput.h>
@@ -28,44 +27,65 @@
 #include <Library/UefiBootServicesTableLib.h>
 #include <Library/DebugLib.h>
 #include <Library/PcdLib.h>
+#include <Library/SafeIntLib.h>
+#include <Library/BmpSupportLib.h>
 
+/**
+  Update information of logo image drawn on screen.
+
+  @param  This           The pointer to the Boot Logo protocol instance.
+  @param  BltBuffer      The BLT buffer for logo drawn on screen. If BltBuffer
+                         is set to NULL, it indicates that logo image is no
+                         longer on the screen.
+  @param  DestinationX   X coordinate of destination for the BltBuffer.
+  @param  DestinationY   Y coordinate of destination for the BltBuffer.
+  @param  Width          Width of rectangle in BltBuffer in pixels.
+  @param  Height         Hight of rectangle in BltBuffer in pixels.
+
+  @retval EFI_SUCCESS             The boot logo information was updated.
+  @retval EFI_INVALID_PARAMETER   One of the parameters has an invalid value.
+  @retval EFI_OUT_OF_RESOURCES    The logo information was not updated due to
+                                  insufficient memory resources.
+
+**/
+EFI_STATUS
+EFIAPI
+SetBootLogo (
+  IN EFI_BOOT_LOGO_PROTOCOL         *This,
+  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *BltBuffer       OPTIONAL,
+  IN UINTN                          DestinationX,
+  IN UINTN                          DestinationY,
+  IN UINTN                          Width,
+  IN UINTN                          Height
+  );
+
+//
+// Boot Logo Protocol Handle
 //
-// Module globals.
+EFI_HANDLE  mBootLogoHandle = NULL;
+
+//
+// Boot Logo Protocol Instance
 //
-EFI_EVENT  mBootGraphicsReadyToBootEvent;
-UINTN      mBootGraphicsResourceTableKey = 0;
+EFI_BOOT_LOGO_PROTOCOL  mBootLogoProtocolTemplate = {
+  SetBootLogo
+};
 
-EFI_HANDLE                     mBootLogoHandle = NULL;
+EFI_EVENT                      mBootGraphicsReadyToBootEvent;
+UINTN                          mBootGraphicsResourceTableKey = 0;
 BOOLEAN                        mIsLogoValid = FALSE;
 EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *mLogoBltBuffer = NULL;
-UINTN                          mLogoDestX = 0;
-UINTN                          mLogoDestY = 0;
-UINTN                          mLogoWidth = 0;
+UINTN                          mLogoDestX  = 0;
+UINTN                          mLogoDestY  = 0;
+UINTN                          mLogoWidth  = 0;
 UINTN                          mLogoHeight = 0;
+BOOLEAN                        mAcpiBgrtInstalled     = FALSE;
+BOOLEAN                        mAcpiBgrtStatusChanged = FALSE;
+BOOLEAN                        mAcpiBgrtBufferChanged = FALSE;
 
-BMP_IMAGE_HEADER  mBmpImageHeaderTemplate = {
-  'B',    // CharB
-  'M',    // CharM
-  0,      // Size will be updated at runtime
-  {0, 0}, // Reserved
-  sizeof (BMP_IMAGE_HEADER), // ImageOffset
-  sizeof (BMP_IMAGE_HEADER) - OFFSET_OF (BMP_IMAGE_HEADER, HeaderSize), // HeaderSize
-  0,      // PixelWidth will be updated at runtime
-  0,      // PixelHeight will be updated at runtime
-  1,      // Planes
-  24,     // BitPerPixel
-  0,      // CompressionType
-  0,      // ImageSize will be updated at runtime
-  0,      // XPixelsPerMeter
-  0,      // YPixelsPerMeter
-  0,      // NumberOfColors
-  0       // ImportantColors
-};
-
-BOOLEAN  mAcpiBgrtInstalled = FALSE;
-BOOLEAN  mAcpiBgrtStatusChanged = FALSE;
-BOOLEAN  mAcpiBgrtBufferChanged = FALSE;
-
+//
+// ACPI Boot Graphics Resource Table template
+//
 EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE mBootGraphicsResourceTableTemplate = {
   {
     EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE,
@@ -89,37 +109,6 @@ EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE mBootGraphicsResourceTableTemplate = {
   0                                  // Image Offset Y
 };
 
-/**
-  Update information of logo image drawn on screen.
-
-  @param  This           The pointer to the Boot Logo protocol instance.
-  @param  BltBuffer      The BLT buffer for logo drawn on screen. If BltBuffer
-                         is set to NULL, it indicates that logo image is no
-                         longer on the screen.
-  @param  DestinationX   X coordinate of destination for the BltBuffer.
-  @param  DestinationY   Y coordinate of destination for the BltBuffer.
-  @param  Width          Width of rectangle in BltBuffer in pixels.
-  @param  Height         Hight of rectangle in BltBuffer in pixels.
-
-  @retval EFI_SUCCESS             The boot logo information was updated.
-  @retval EFI_INVALID_PARAMETER   One of the parameters has an invalid value.
-  @retval EFI_OUT_OF_RESOURCES    The logo information was not updated due to
-                                  insufficient memory resources.
-
-**/
-EFI_STATUS
-EFIAPI
-SetBootLogo (
-  IN EFI_BOOT_LOGO_PROTOCOL            *This,
-  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL     *BltBuffer       OPTIONAL,
-  IN UINTN                             DestinationX,
-  IN UINTN                             DestinationY,
-  IN UINTN                             Width,
-  IN UINTN                             Height
-  );
-
-EFI_BOOT_LOGO_PROTOCOL  mBootLogoProtocolTemplate = { SetBootLogo };
-
 /**
   Update information of logo image drawn on screen.
 
@@ -149,7 +138,9 @@ SetBootLogo (
   IN UINTN                             Height
   )
 {
-  UINT64                        BufferSize;
+  EFI_STATUS  Status;
+  UINTN       BufferSize;
+  UINT32      Result32;
 
   if (BltBuffer == NULL) {
     mIsLogoValid = FALSE;
@@ -157,103 +148,115 @@ SetBootLogo (
     return EFI_SUCCESS;
   }
 
+  //
+  // Width and height are not allowed to be zero.
+  //
   if (Width == 0 || Height == 0) {
     return EFI_INVALID_PARAMETER;
   }
-  
-  mAcpiBgrtBufferChanged = TRUE;
-  if (mLogoBltBuffer != NULL) {
-    FreePool (mLogoBltBuffer);
-    mLogoBltBuffer = NULL;
+
+  //
+  // Verify destination, width, and height do not overflow 32-bit values.
+  // The Boot Graphics Resource Table only has 32-bit fields for these values.
+  //
+  Status = SafeUintnToUint32 (DestinationX, &Result32);
+  if (EFI_ERROR (Status)) {
+    return EFI_INVALID_PARAMETER;
   }
-  
+  Status = SafeUintnToUint32 (DestinationY, &Result32);
+  if (EFI_ERROR (Status)) {
+    return EFI_INVALID_PARAMETER;
+  }
+  Status = SafeUintnToUint32 (Width, &Result32);
+  if (EFI_ERROR (Status)) {
+    return EFI_INVALID_PARAMETER;
+  }
+  Status = SafeUintnToUint32 (Height, &Result32);
+  if (EFI_ERROR (Status)) {
+    return EFI_INVALID_PARAMETER;
+  }
+
   //
-  // Ensure the Height * Width doesn't overflow
+  // Ensure the Height * Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) does
+  // not overflow UINTN
   //
-  if (Height > DivU64x64Remainder ((UINTN) ~0, Width, NULL)) {
+  Status = SafeUintnMult (
+             Width,
+             Height,
+             &BufferSize
+             );
+  if (EFI_ERROR (Status)) {
+    return EFI_UNSUPPORTED;
+  }
+  Status = SafeUintnMult (
+             BufferSize,
+             sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL),
+             &BufferSize
+             );
+  if (EFI_ERROR (Status)) {
     return EFI_UNSUPPORTED;
   }
-  BufferSize = MultU64x64 (Width, Height);
-  
+
   //
-  // Ensure the BufferSize * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow
+  // Update state
   //
-  if (BufferSize > DivU64x32 ((UINTN) ~0, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {
-    return EFI_UNSUPPORTED;
+  mAcpiBgrtBufferChanged = TRUE;
+
+  //
+  // Free old logo buffer
+  //
+  if (mLogoBltBuffer != NULL) {
+    FreePool (mLogoBltBuffer);
+    mLogoBltBuffer = NULL;
   }
 
-  mLogoBltBuffer = AllocateCopyPool (
-                     (UINTN)BufferSize * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL),
-                     BltBuffer
-                     );
+  //
+  // Allocate new logo buffer
+  //
+  mLogoBltBuffer = AllocateCopyPool (BufferSize, BltBuffer);
   if (mLogoBltBuffer == NULL) {
     return EFI_OUT_OF_RESOURCES;
   }
-  mLogoDestX = DestinationX;
-  mLogoDestY = DestinationY;
-  mLogoWidth = Width;
-  mLogoHeight = Height;
+
+  mLogoDestX   = DestinationX;
+  mLogoDestY   = DestinationY;
+  mLogoWidth   = Width;
+  mLogoHeight  = Height;
   mIsLogoValid = TRUE;
 
   return EFI_SUCCESS;
 }
 
 /**
-  This function calculates and updates an UINT8 checksum.
+  Notify function for event group EFI_EVENT_GROUP_READY_TO_BOOT. This is used to
+  install the Boot Graphics Resource Table.
 
-  @param[in]  Buffer          Pointer to buffer to checksum.
-  @param[in]  Size            Number of bytes to checksum.
+  @param[in]  Event   The Event that is being processed.
+  @param[in]  Context The Event Context.
 
 **/
 VOID
-BgrtAcpiTableChecksum (
-  IN UINT8      *Buffer,
-  IN UINTN      Size
-  )
-{
-  UINTN ChecksumOffset;
-
-  ChecksumOffset = OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Checksum);
-
-  //
-  // Set checksum to 0 first.
-  //
-  Buffer[ChecksumOffset] = 0;
-
-  //
-  // Update checksum value.
-  //
-  Buffer[ChecksumOffset] = CalculateCheckSum8 (Buffer, Size);
-}
-
-/**
-  Install Boot Graphics Resource Table to ACPI table.
-
-  @return Status code.
-
-**/
-EFI_STATUS
-InstallBootGraphicsResourceTable (
-  VOID
+EFIAPI
+BgrtReadyToBootEventNotify (
+  IN EFI_EVENT  Event,
+  IN VOID       *Context
   )
 {
-  EFI_STATUS                    Status;
-  EFI_ACPI_TABLE_PROTOCOL       *AcpiTableProtocol;
-  UINT8                         *ImageBuffer;
-  UINTN                         PaddingSize;
-  UINTN                         BmpSize;
-  UINTN                         OrigBmpSize;
-  UINT8                         *Image;
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltPixel;
-  UINTN                         Col;
-  UINTN                         Row;
+  EFI_STATUS               Status;
+  EFI_ACPI_TABLE_PROTOCOL  *AcpiTableProtocol;
+  VOID                     *ImageBuffer;
+  UINT32                   BmpSize;
 
   //
   // Get ACPI Table protocol.
   //
-  Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTableProtocol);
+  Status = gBS->LocateProtocol (
+                  &gEfiAcpiTableProtocolGuid,
+                  NULL,
+                  (VOID **) &AcpiTableProtocol
+                  );
   if (EFI_ERROR (Status)) {
-    return Status;
+    return;
   }
 
   //
@@ -264,109 +267,85 @@ InstallBootGraphicsResourceTable (
       //
       // Nothing has changed
       //
-      return EFI_SUCCESS;
+      return;
     } else {
       //
-      // If BGRT data change happens. Uninstall Orignal AcpiTable first
+      // If BGRT data change happens, then uninstall orignal AcpiTable first
       //
       Status = AcpiTableProtocol->UninstallAcpiTable (
                                     AcpiTableProtocol,
                                     mBootGraphicsResourceTableKey
                                     );
       if (EFI_ERROR (Status)) {
-        return Status;
-      } 
+        return;
+      }
     }
   } else {
     //
-    // Check whether Logo exist.
+    // Check whether Logo exists
     //
-    if ( mLogoBltBuffer == NULL) {
-      return EFI_NOT_FOUND;
+    if (mLogoBltBuffer == NULL) {
+      return;
     }
   }
 
   if (mAcpiBgrtBufferChanged) {
     //
-    // reserve original BGRT buffer size
+    // Free the old BMP image buffer
     //
-    OrigBmpSize = mBmpImageHeaderTemplate.ImageSize + sizeof (BMP_IMAGE_HEADER);
-    //
-    // Free orignal BMP memory 
-    // 
-    if (mBootGraphicsResourceTableTemplate.ImageAddress) {
-      gBS->FreePages(mBootGraphicsResourceTableTemplate.ImageAddress, EFI_SIZE_TO_PAGES(OrigBmpSize));
+    ImageBuffer = (UINT8 *)(UINTN)mBootGraphicsResourceTableTemplate.ImageAddress;
+    if (ImageBuffer != NULL) {
+      FreePool (ImageBuffer);
     }
 
     //
-    // Allocate memory for BMP file.
+    // Convert GOP Blt buffer to BMP image.  Pass in ImageBuffer set to NULL
+    // so the BMP image is allocated by TranslateGopBltToBmp().
     //
-    PaddingSize = mLogoWidth & 0x3;
-
-    //
-    // First check mLogoWidth * 3 + PaddingSize doesn't overflow
-    //
-    if (mLogoWidth > (((UINT32) ~0) - PaddingSize) / 3 ) {
-      return EFI_UNSUPPORTED;
-    }
-
-    //
-    // Second check (mLogoWidth * 3 + PaddingSize) * mLogoHeight + sizeof (BMP_IMAGE_HEADER) doesn't overflow
-    //
-    if (mLogoHeight > (((UINT32) ~0) - sizeof (BMP_IMAGE_HEADER)) / (mLogoWidth * 3 + PaddingSize)) {
-      return EFI_UNSUPPORTED;
+    ImageBuffer = NULL;
+    Status = TranslateGopBltToBmp (
+               mLogoBltBuffer,
+               (UINT32)mLogoHeight,
+               (UINT32)mLogoWidth,
+               &ImageBuffer,
+               &BmpSize
+               );
+    if (EFI_ERROR (Status)) {
+      return;
     }
 
     //
-    // The image should be stored in EfiBootServicesData, allowing the system to reclaim the memory
-    //
-    BmpSize = (mLogoWidth * 3 + PaddingSize) * mLogoHeight + sizeof (BMP_IMAGE_HEADER);
-    ImageBuffer = AllocatePages (EFI_SIZE_TO_PAGES (BmpSize));
-    if (ImageBuffer == NULL) {
-      return EFI_OUT_OF_RESOURCES;
-    }
-
-    ZeroMem (ImageBuffer, BmpSize);
-
-    mBmpImageHeaderTemplate.Size = (UINT32) BmpSize;
-    mBmpImageHeaderTemplate.ImageSize = (UINT32) BmpSize - sizeof (BMP_IMAGE_HEADER);
-    mBmpImageHeaderTemplate.PixelWidth = (UINT32) mLogoWidth;
-    mBmpImageHeaderTemplate.PixelHeight = (UINT32) mLogoHeight;
-    CopyMem (ImageBuffer, &mBmpImageHeaderTemplate, sizeof (BMP_IMAGE_HEADER));
-    
-    //
-    // Convert BLT buffer to BMP file.
+    // Free the logo buffer
     //
-    Image = ImageBuffer + sizeof (BMP_IMAGE_HEADER);
-    for (Row = 0; Row < mLogoHeight; Row++) {
-    BltPixel = &mLogoBltBuffer[(mLogoHeight - Row - 1) * mLogoWidth];
-
-    for (Col = 0; Col < mLogoWidth; Col++) {
-      *Image++ = BltPixel->Blue;
-      *Image++ = BltPixel->Green;
-      *Image++ = BltPixel->Red;
-      BltPixel++;
-    }
-
-      //
-      // Padding for 4 byte alignment.
-      //
-      Image += PaddingSize;
-    }
     FreePool (mLogoBltBuffer);
     mLogoBltBuffer = NULL;
 
-    mBootGraphicsResourceTableTemplate.ImageAddress = (UINT64) (UINTN) ImageBuffer;
-    mBootGraphicsResourceTableTemplate.ImageOffsetX = (UINT32) mLogoDestX;
-    mBootGraphicsResourceTableTemplate.ImageOffsetY = (UINT32) mLogoDestY;
+    //
+    // Update BMP image fields of the Boot Graphics Resource Table
+    //
+    mBootGraphicsResourceTableTemplate.ImageAddress = (UINT64)(UINTN)ImageBuffer;
+    mBootGraphicsResourceTableTemplate.ImageOffsetX = (UINT32)mLogoDestX;
+    mBootGraphicsResourceTableTemplate.ImageOffsetY = (UINT32)mLogoDestY;
   }
 
-  mBootGraphicsResourceTableTemplate.Status = (UINT8) (mIsLogoValid ? EFI_ACPI_5_0_BGRT_STATUS_VALID : EFI_ACPI_5_0_BGRT_STATUS_INVALID);
+  //
+  // Update Status field of Boot Graphics Resource Table
+  //
+  if (mIsLogoValid) {
+    mBootGraphicsResourceTableTemplate.Status = EFI_ACPI_5_0_BGRT_STATUS_VALID;
+  } else {
+    mBootGraphicsResourceTableTemplate.Status = EFI_ACPI_5_0_BGRT_STATUS_INVALID;
+  }
 
   //
-  // Update Checksum.
+  // Update Checksum of Boot Graphics Resource Table
   //
-  BgrtAcpiTableChecksum ((UINT8 *) &mBootGraphicsResourceTableTemplate, sizeof (EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE));
+  mBootGraphicsResourceTableTemplate.Header.Checksum = 0;
+  mBootGraphicsResourceTableTemplate.Header.Checksum =
+    CalculateCheckSum8 (
+      (UINT8 *)&mBootGraphicsResourceTableTemplate,
+      sizeof (EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE)
+      );
 
   //
   // Publish Boot Graphics Resource Table.
@@ -378,32 +357,12 @@ InstallBootGraphicsResourceTable (
                                 &mBootGraphicsResourceTableKey
                                 );
   if (EFI_ERROR (Status)) {
-    return Status;
+    return;
   }
 
-  mAcpiBgrtInstalled = TRUE;
+  mAcpiBgrtInstalled     = TRUE;
   mAcpiBgrtStatusChanged = FALSE;
   mAcpiBgrtBufferChanged = FALSE;
-  
-  return Status;
-}
-
-/**
-  Notify function for event group EFI_EVENT_GROUP_READY_TO_BOOT. This is used to
-  install the Boot Graphics Resource Table.
-
-  @param[in]  Event   The Event that is being processed.
-  @param[in]  Context The Event Context.
-
-**/
-VOID
-EFIAPI
-BgrtReadyToBootEventNotify (
-  IN EFI_EVENT        Event,
-  IN VOID             *Context
-  )
-{
-  InstallBootGraphicsResourceTable ();
 }
 
 /**
@@ -419,23 +378,27 @@ BgrtReadyToBootEventNotify (
 EFI_STATUS
 EFIAPI
 BootGraphicsDxeEntryPoint (
-  IN EFI_HANDLE          ImageHandle,
-  IN EFI_SYSTEM_TABLE    *SystemTable
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
   )
 {
-  EFI_STATUS  Status;
-  UINT64      OemTableId;
+  EFI_STATUS                   Status;
+  EFI_ACPI_DESCRIPTION_HEADER  *Header;
 
+  //
+  // Update Header fields of Boot Graphics Resource Table from PCDs
+  //
+  Header = &mBootGraphicsResourceTableTemplate.Header;
+  ZeroMem (Header->OemId, sizeof (Header->OemId));
   CopyMem (
-    mBootGraphicsResourceTableTemplate.Header.OemId,
+    Header->OemId,
     PcdGetPtr (PcdAcpiDefaultOemId),
-    sizeof (mBootGraphicsResourceTableTemplate.Header.OemId)
+    MIN (PcdGetSize (PcdAcpiDefaultOemId), sizeof (Header->OemId))
     );
-  OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
-  CopyMem (&mBootGraphicsResourceTableTemplate.Header.OemTableId, &OemTableId, sizeof (UINT64));
-  mBootGraphicsResourceTableTemplate.Header.OemRevision      = PcdGet32 (PcdAcpiDefaultOemRevision);
-  mBootGraphicsResourceTableTemplate.Header.CreatorId        = PcdGet32 (PcdAcpiDefaultCreatorId);
-  mBootGraphicsResourceTableTemplate.Header.CreatorRevision  = PcdGet32 (PcdAcpiDefaultCreatorRevision);
+  WriteUnaligned64 (&Header->OemTableId, PcdGet64 (PcdAcpiDefaultOemTableId));
+  Header->OemRevision     = PcdGet32 (PcdAcpiDefaultOemRevision);
+  Header->CreatorId       = PcdGet32 (PcdAcpiDefaultCreatorId);
+  Header->CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
 
   //
   // Install Boot Logo protocol.
diff --git a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
index 9fd1da448c..ff33405acd 100644
--- a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
+++ b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf
@@ -1,7 +1,7 @@
 ## @file
 #  This module install ACPI Boot Graphics Resource Table (BGRT).
 #
-#  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
 #  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
@@ -43,6 +43,8 @@
   UefiBootServicesTableLib
   DebugLib
   PcdLib
+  SafeIntLib
+  BmpSupportLib
 
 [Protocols]
   gEfiAcpiTableProtocolGuid                     ## CONSUMES
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Patch 04/10] IntelFrameworkModulePkg/GenericBdsLib: Use BmpSupportLib
  2018-02-07 22:58 [Patch 00/10] Add BmpSupportLib class and instance Kinney, Michael D
                   ` (2 preceding siblings ...)
  2018-02-07 22:58 ` [Patch 03/10] MdeModulePkg/BootGraphicsResourceTableDxe: " Kinney, Michael D
@ 2018-02-07 22:58 ` Kinney, Michael D
  2018-02-07 22:58 ` [Patch 05/10] OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files Kinney, Michael D
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 25+ messages in thread
From: Kinney, Michael D @ 2018-02-07 22:58 UTC (permalink / raw)
  To: edk2-devel; +Cc: Michael D Kinney, Sean Brogan, Jiewen Yao, Liming Gao

From: Michael D Kinney <michael.d.kinney@intel.com>

https://bugzilla.tianocore.org/show_bug.cgi?id=800

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

Update GenericBdsLib to use BmpSupportLib to convert a BMP
graphics image to a GOP BLT Buffer to display the boot logo.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../IntelFrameworkModulePkg.dsc                    |   4 +-
 .../Library/GenericBdsLib/BdsConsole.c             | 250 +--------------------
 .../Library/GenericBdsLib/GenericBdsLib.inf        |   3 +-
 .../Library/GenericBdsLib/InternalBdsLib.h         |   3 +-
 4 files changed, 10 insertions(+), 250 deletions(-)

diff --git a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc
index a9a01aa647..6c6c3d802a 100644
--- a/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc
+++ b/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc
@@ -3,7 +3,7 @@
 #
 # This file is used to build all modules in IntelFrameworkModulePkg.
 #
-#Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+#Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
 #This program and the accompanying materials are licensed and made available under 
 #the terms and conditions of the BSD License that accompanies this distribution.  
 #The full text of the license may be found at
@@ -54,6 +54,8 @@
   SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
   UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
   PlatformBdsLib|IntelFrameworkModulePkg/Library/PlatformBdsLibNull/PlatformBdsLibNull.inf
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
index 8f273ff1b1..9c21cfcd59 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
@@ -1,7 +1,7 @@
 /** @file
   BDS Lib functions which contain all the code to connect console device
 
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
 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
@@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/
 
 #include "InternalBdsLib.h"
-#include <IndustryStandard/Bmp.h>
 
 
 /**
@@ -642,249 +641,6 @@ BdsLibConnectAllDefaultConsolesWithOutConIn (
 
 }
 
-/**
-  Convert a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
-  is passed in a GopBlt buffer will be allocated by this routine. If a GopBlt
-  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
-ConvertBmpToGopBlt (
-  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 = (BMP_IMAGE_HEADER *) BmpImage;
-
-  if (BmpHeader->CharB != 'B' || BmpHeader->CharM != 'M') {
-    return EFI_UNSUPPORTED;
-  }
-
-  //
-  // Doesn't support compress.
-  //
-  if (BmpHeader->CompressionType != 0) {
-    return EFI_UNSUPPORTED;
-  }
-
-  //
-  // Only support BITMAPINFOHEADER format.
-  // BITMAPFILEHEADER + BITMAPINFOHEADER = BMP_IMAGE_HEADER
-  //
-  if (BmpHeader->HeaderSize != 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 = ((BmpHeader->PixelWidth * BmpHeader->BitPerPixel + 31) >> 3) & (~0x3);
-  BltBufferSize = MultU64x32 (DataSizePerLine, BmpHeader->PixelHeight);
-  if (BltBufferSize > (UINT32) ~0) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  if ((BmpHeader->Size != BmpImageSize) || 
-      (BmpHeader->Size < BmpHeader->ImageOffset) ||
-      (BmpHeader->Size - BmpHeader->ImageOffset !=  BmpHeader->PixelHeight * DataSizePerLine)) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  //
-  // Calculate Color Map offset in the image.
-  //
-  Image       = BmpImage;
-  BmpColorMap = (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 = 2;
-        break;
-      case 4:
-        ColorMapNum = 16;
-        break;
-      case 8:
-        ColorMapNum = 256;
-        break;
-      default:
-        ColorMapNum = 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         = ((UINT8 *) BmpImage) + BmpHeader->ImageOffset;
-  ImageHeader   = Image;
-
-  //
-  // Calculate the BltBuffer needed size.
-  //
-  BltBufferSize = 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 = MultU64x32 (BltBufferSize, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
-
-  IsAllocated   = FALSE;
-  if (*GopBlt == NULL) {
-    //
-    // GopBlt is not allocated by caller.
-    //
-    *GopBltSize = (UINTN) BltBufferSize;
-    *GopBlt     = AllocatePool (*GopBltSize);
-    IsAllocated = TRUE;
-    if (*GopBlt == NULL) {
-      return EFI_OUT_OF_RESOURCES;
-    }
-  } else {
-    //
-    // GopBlt has been allocated by caller.
-    //
-    if (*GopBltSize < (UINTN) BltBufferSize) {
-      *GopBltSize = (UINTN) BltBufferSize;
-      return EFI_BUFFER_TOO_SMALL;
-    }
-  }
-
-  *PixelWidth   = BmpHeader->PixelWidth;
-  *PixelHeight  = BmpHeader->PixelHeight;
-
-  //
-  // Convert image from BMP to Blt buffer format
-  //
-  BltBuffer = *GopBlt;
-  for (Height = 0; Height < BmpHeader->PixelHeight; Height++) {
-    Blt = &BltBuffer[(BmpHeader->PixelHeight - Height - 1) * BmpHeader->PixelWidth];
-    for (Width = 0; Width < BmpHeader->PixelWidth; Width++, Image++, Blt++) {
-      switch (BmpHeader->BitPerPixel) {
-      case 1:
-        //
-        // Convert 1-bit (2 colors) BMP to 24-bit color
-        //
-        for (Index = 0; Index < 8 && Width < BmpHeader->PixelWidth; Index++) {
-          Blt->Red    = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Red;
-          Blt->Green  = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Green;
-          Blt->Blue   = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Blue;
-          Blt++;
-          Width++;
-        }
-
-        Blt--;
-        Width--;
-        break;
-
-      case 4:
-        //
-        // Convert 4-bit (16 colors) BMP Palette to 24-bit color
-        //
-        Index       = (*Image) >> 4;
-        Blt->Red    = BmpColorMap[Index].Red;
-        Blt->Green  = BmpColorMap[Index].Green;
-        Blt->Blue   = BmpColorMap[Index].Blue;
-        if (Width < (BmpHeader->PixelWidth - 1)) {
-          Blt++;
-          Width++;
-          Index       = (*Image) & 0x0f;
-          Blt->Red    = BmpColorMap[Index].Red;
-          Blt->Green  = BmpColorMap[Index].Green;
-          Blt->Blue   = BmpColorMap[Index].Blue;
-        }
-        break;
-
-      case 8:
-        //
-        // Convert 8-bit (256 colors) BMP Palette to 24-bit color
-        //
-        Blt->Red    = BmpColorMap[*Image].Red;
-        Blt->Green  = BmpColorMap[*Image].Green;
-        Blt->Blue   = BmpColorMap[*Image].Blue;
-        break;
-
-      case 24:
-        //
-        // It is 24-bit BMP.
-        //
-        Blt->Blue   = *Image++;
-        Blt->Green  = *Image++;
-        Blt->Red    = *Image;
-        break;
-
-      default:
-        //
-        // Other bit format BMP is not supported.
-        //
-        if (IsAllocated) {
-          FreePool (*GopBlt);
-          *GopBlt = NULL;
-        }
-        return EFI_UNSUPPORTED;
-      };
-
-    }
-
-    ImageIndex = (UINTN)Image - (UINTN)ImageHeader;
-    if ((ImageIndex % 4) != 0) {
-      //
-      // Bmp Image starts each row on a 32-bit boundary!
-      //
-      Image = Image + (4 - (ImageIndex % 4));
-    }
-  }
-
-  return EFI_SUCCESS;
-}
-
 /**
   Use SystemTable Conout to stop video based Simple Text Out consoles from going
   to the video device. Put up LogoFile on every video device that is a console.
@@ -1042,10 +798,10 @@ EnableQuietBoot (
       FreePool (Blt);
     }
     Blt = NULL;
-    Status = ConvertBmpToGopBlt (
+    Status = TranslateBmpToGopBlt (
               ImageData,
               ImageSize,
-              (VOID **) &Blt,
+              &Blt,
               &BltSize,
               &Height,
               &Width
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf b/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
index 9d879c20e1..eba0cff200 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
@@ -6,7 +6,7 @@
 #  2) BDS boot device connect interface;
 #  3) BDS Misc interfaces for mainting boot variable, ouput string, etc.
 #  
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
 #  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
@@ -70,6 +70,7 @@
   DxeServicesLib
   HiiLib
   ReportStatusCodeLib
+  BmpSupportLib
 
 [Guids]
   ## SOMETIMES_CONSUMES ## HOB         # The hob holding memory type information
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h b/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
index 7201d8a335..9492117fb9 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
@@ -1,7 +1,7 @@
 /** @file
   BDS library definition, include the file and data structure
 
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
 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
@@ -71,6 +71,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/PcdLib.h>
 #include <Library/DxeServicesLib.h>
 #include <Library/ReportStatusCodeLib.h>
+#include <Library/BmpSupportLib.h>
 
 #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
     #if defined (MDE_CPU_EBC)
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Patch 05/10] OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-07 22:58 [Patch 00/10] Add BmpSupportLib class and instance Kinney, Michael D
                   ` (3 preceding siblings ...)
  2018-02-07 22:58 ` [Patch 04/10] IntelFrameworkModulePkg/GenericBdsLib: " Kinney, Michael D
@ 2018-02-07 22:58 ` Kinney, Michael D
  2018-02-07 23:17   ` Laszlo Ersek
  2018-02-07 22:58 ` [Patch 06/10] Vlv2TbltDevicePkg/Override/GenericBdsLib: Use BmpSupportLib Kinney, Michael D
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 25+ messages in thread
From: Kinney, Michael D @ 2018-02-07 22:58 UTC (permalink / raw)
  To: edk2-devel
  Cc: Michael D Kinney, Sean Brogan, Jiewen Yao, Jordan Justen,
	Laszlo Ersek, Ard Biesheuvel

From: Michael D Kinney <michael.d.kinney@intel.com>

https://bugzilla.tianocore.org/show_bug.cgi?id=800

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

The BootGraphicsResourceTableDxe module uses the BmpSupportLib
and SafeIntLib to convert a GOP BLT buffer to a BMP graphics image.
Add library mappings for these new library classes.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 OvmfPkg/OvmfPkgIa32.dsc    | 2 ++
 OvmfPkg/OvmfPkgIa32X64.dsc | 2 ++
 OvmfPkg/OvmfPkgX64.dsc     | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index d762955c5d..e10f898607 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -104,6 +104,8 @@
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
   SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 6bcbe70d64..a31c7919ad 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -109,6 +109,8 @@
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
   SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 70fcdcba11..bc433a9724 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -109,6 +109,8 @@
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
   SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Patch 06/10] Vlv2TbltDevicePkg/Override/GenericBdsLib: Use BmpSupportLib
  2018-02-07 22:58 [Patch 00/10] Add BmpSupportLib class and instance Kinney, Michael D
                   ` (4 preceding siblings ...)
  2018-02-07 22:58 ` [Patch 05/10] OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files Kinney, Michael D
@ 2018-02-07 22:58 ` Kinney, Michael D
  2018-02-07 22:58 ` [Patch 07/10] QuarkPlatformPkg: Add SafeIntLib and BmpSupportLib to DSC files Kinney, Michael D
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 25+ messages in thread
From: Kinney, Michael D @ 2018-02-07 22:58 UTC (permalink / raw)
  To: edk2-devel; +Cc: Michael D Kinney, Sean Brogan, Jiewen Yao, David Wei, Mang Guo

From: Michael D Kinney <michael.d.kinney@intel.com>

https://bugzilla.tianocore.org/show_bug.cgi?id=800

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

Update GenericBdsLib to use BmpSupportLib to convert a BMP
graphics image to a GOP BLT buffer to display the boot logo.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../Library/GenericBdsLib/BdsConsole.c             | 251 +--------------------
 .../Library/GenericBdsLib/GenericBdsLib.inf        |   3 +-
 .../Library/GenericBdsLib/InternalBdsLib.h         |   3 +-
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc            |   4 +-
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc              |   4 +-
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc               |   4 +-
 6 files changed, 16 insertions(+), 253 deletions(-)

diff --git a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
index eefec0642a..9c21cfcd59 100644
--- a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
+++ b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
@@ -1,7 +1,7 @@
 /** @file
   BDS Lib functions which contain all the code to connect console device
 
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
 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
@@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/
 
 #include "InternalBdsLib.h"
-#include <IndustryStandard/Bmp.h>
 
 
 /**
@@ -642,250 +641,6 @@ BdsLibConnectAllDefaultConsolesWithOutConIn (
 
 }
 
-/**
-  Convert a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer
-  is passed in a GopBlt buffer will be allocated by this routine. If a GopBlt
-  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
-ConvertBmpToGopBlt (
-  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 = (BMP_IMAGE_HEADER *) BmpImage;
-
-  if (BmpHeader->CharB != 'B' || BmpHeader->CharM != 'M') {
-    return EFI_UNSUPPORTED;
-  }
-
-  //
-  // Doesn't support compress.
-  //
-  if (BmpHeader->CompressionType != 0) {
-    return EFI_UNSUPPORTED;
-  }
-
-  //
-  // Only support BITMAPINFOHEADER format.
-  // BITMAPFILEHEADER + BITMAPINFOHEADER = BMP_IMAGE_HEADER
-  //
-  if (BmpHeader->HeaderSize != 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 = ((BmpHeader->PixelWidth * BmpHeader->BitPerPixel + 31) >> 3) & (~0x3);
-  BltBufferSize = MultU64x32 (DataSizePerLine, BmpHeader->PixelHeight);
-  if (BltBufferSize > (UINT32) ~0) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  if ((BmpHeader->Size != BmpImageSize) || 
-      (BmpHeader->Size < BmpHeader->ImageOffset) ||
-      (BmpHeader->Size - BmpHeader->ImageOffset !=  BmpHeader->PixelHeight * DataSizePerLine)) {
-    return EFI_INVALID_PARAMETER;
-  }
-
-  //
-  // Calculate Color Map offset in the image.
-  //
-  Image       = BmpImage;
-  BmpColorMap = (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 = 2;
-        break;
-      case 4:
-        ColorMapNum = 16;
-        break;
-      case 8:
-        ColorMapNum = 256;
-        break;
-      default:
-        ColorMapNum = 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         = ((UINT8 *) BmpImage) + BmpHeader->ImageOffset;
-  ImageHeader   = Image;
-
-  //
-  // Calculate the BltBuffer needed size.
-  //
-  BltBufferSize = 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 = MultU64x32 (BltBufferSize, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
-
-  IsAllocated   = FALSE;
-  if (*GopBlt == NULL) {
-    //
-    // GopBlt is not allocated by caller.
-    //
-    *GopBltSize = (UINTN) BltBufferSize;
-    *GopBlt     = AllocatePool (*GopBltSize);
-    IsAllocated = TRUE;
-    if (*GopBlt == NULL) {
-      return EFI_OUT_OF_RESOURCES;
-    }
-  } else {
-    //
-    // GopBlt has been allocated by caller.
-    //
-    if (*GopBltSize < (UINTN) BltBufferSize) {
-      *GopBltSize = (UINTN) BltBufferSize;
-      return EFI_BUFFER_TOO_SMALL;
-    }
-  }
-
-  *PixelWidth   = BmpHeader->PixelWidth;
-  *PixelHeight  = BmpHeader->PixelHeight;
-
-  //
-  // Convert image from BMP to Blt buffer format
-  //
-  BltBuffer = *GopBlt;
-  for (Height = 0; Height < BmpHeader->PixelHeight; Height++) {
-    Blt = &BltBuffer[(BmpHeader->PixelHeight - Height - 1) * BmpHeader->PixelWidth];
-    for (Width = 0; Width < BmpHeader->PixelWidth; Width++, Image++, Blt++) {
-      switch (BmpHeader->BitPerPixel) {
-      case 1:
-        //
-        // Convert 1-bit (2 colors) BMP to 24-bit color
-        //
-        for (Index = 0; Index < 8 && Width < BmpHeader->PixelWidth; Index++) {
-          Blt->Red    = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Red;
-          Blt->Green  = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Green;
-          Blt->Blue   = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Blue;
-          Blt++;
-          Width++;
-        }
-
-        Blt--;
-        Width--;
-        break;
-
-      case 4:
-        //
-        // Convert 4-bit (16 colors) BMP Palette to 24-bit color
-        //
-        Index       = (*Image) >> 4;
-        Blt->Red    = BmpColorMap[Index].Red;
-        Blt->Green  = BmpColorMap[Index].Green;
-        Blt->Blue   = BmpColorMap[Index].Blue;
-        if (Width < (BmpHeader->PixelWidth - 1)) {
-          Blt++;
-          Width++;
-          Index       = (*Image) & 0x0f;
-          Blt->Red    = BmpColorMap[Index].Red;
-          Blt->Green  = BmpColorMap[Index].Green;
-          Blt->Blue   = BmpColorMap[Index].Blue;
-        }
-        break;
-
-      case 8:
-        //
-        // Convert 8-bit (256 colors) BMP Palette to 24-bit color
-        //
-        Blt->Red    = BmpColorMap[*Image].Red;
-        Blt->Green  = BmpColorMap[*Image].Green;
-        Blt->Blue   = BmpColorMap[*Image].Blue;
-        break;
-
-      case 24:
-        //
-        // It is 24-bit BMP.
-        //
-        Blt->Blue   = *Image++;
-        Blt->Green  = *Image++;
-        Blt->Red    = *Image;
-        break;
-
-      default:
-        //
-        // Other bit format BMP is not supported.
-        //
-        if (IsAllocated) {
-          FreePool (*GopBlt);
-          *GopBlt = NULL;
-        }
-        return EFI_UNSUPPORTED;
-        break;
-      };
-
-    }
-
-    ImageIndex = (UINTN) (Image - ImageHeader);
-    if ((ImageIndex % 4) != 0) {
-      //
-      // Bmp Image starts each row on a 32-bit boundary!
-      //
-      Image = Image + (4 - (ImageIndex % 4));
-    }
-  }
-
-  return EFI_SUCCESS;
-}
-
 /**
   Use SystemTable Conout to stop video based Simple Text Out consoles from going
   to the video device. Put up LogoFile on every video device that is a console.
@@ -1043,10 +798,10 @@ EnableQuietBoot (
       FreePool (Blt);
     }
     Blt = NULL;
-    Status = ConvertBmpToGopBlt (
+    Status = TranslateBmpToGopBlt (
               ImageData,
               ImageSize,
-              (VOID **) &Blt,
+              &Blt,
               &BltSize,
               &Height,
               &Width
diff --git a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
index 33ca29835d..75bff59fda 100644
--- a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
+++ b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
@@ -6,7 +6,7 @@
 #  2) BDS boot device connect interface;
 #  3) BDS Misc interfaces for mainting boot variable, ouput string, etc.
 #  
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
 #  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
@@ -71,6 +71,7 @@
   HiiLib
   ReportStatusCodeLib
   NetLib
+  BmpSupportLib
 
 [Guids]
   ## SOMETIMES_CONSUMES ## HOB         # The hob holding memory type information
diff --git a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
index c32579bfc5..b964f41425 100644
--- a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
+++ b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
@@ -1,7 +1,7 @@
 /** @file
   BDS library definition, include the file and data structure
 
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
 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
@@ -72,6 +72,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/PcdLib.h>
 #include <Library/DxeServicesLib.h>
 #include <Library/ReportStatusCodeLib.h>
+#include <Library/BmpSupportLib.h>
 
 #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
     #if defined (MDE_CPU_EBC)
diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
index f98263d8a5..7467642e8b 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
@@ -1,7 +1,7 @@
 #/** @file
 # Platform description.
 #
-# Copyright (c) 2012  - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2012  - 2018, Intel Corporation. All rights reserved.<BR>
 #
 # This program and the accompanying materials are licensed and made available under
 # the terms and conditions of the BSD License that accompanies this distribution.
@@ -146,6 +146,8 @@
   UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   GenericBdsLib|$(PLATFORM_PACKAGE)/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
   PlatformBdsLib|$(PLATFORM_PACKAGE)/Library/PlatformBdsLib/PlatformBdsLib.inf
   NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
index c755df2fe2..94fe744e2b 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
@@ -1,7 +1,7 @@
 #/** @file
 # Platform description.
 #
-# Copyright (c) 2012  - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2012  - 2018, Intel Corporation. All rights reserved.<BR>
 #
 # This program and the accompanying materials are licensed and made available under
 # the terms and conditions of the BSD License that accompanies this distribution.
@@ -146,6 +146,8 @@
   UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   GenericBdsLib|$(PLATFORM_PACKAGE)/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
   PlatformBdsLib|$(PLATFORM_PACKAGE)/Library/PlatformBdsLib/PlatformBdsLib.inf
   NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
index dda8216e6a..59e75326d9 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
@@ -1,7 +1,7 @@
 #/** @file
 # Platform description.
 #
-# Copyright (c) 2012  - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2012  - 2018, Intel Corporation. All rights reserved.<BR>
 #
 # This program and the accompanying materials are licensed and made available under
 # the terms and conditions of the BSD License that accompanies this distribution.
@@ -146,6 +146,8 @@
   UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
   GenericBdsLib|$(PLATFORM_PACKAGE)/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
   PlatformBdsLib|$(PLATFORM_PACKAGE)/Library/PlatformBdsLib/PlatformBdsLib.inf
   NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Patch 07/10] QuarkPlatformPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-07 22:58 [Patch 00/10] Add BmpSupportLib class and instance Kinney, Michael D
                   ` (5 preceding siblings ...)
  2018-02-07 22:58 ` [Patch 06/10] Vlv2TbltDevicePkg/Override/GenericBdsLib: Use BmpSupportLib Kinney, Michael D
@ 2018-02-07 22:58 ` Kinney, Michael D
  2018-02-07 22:58 ` [Patch 08/10] DuetPkg: " Kinney, Michael D
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 25+ messages in thread
From: Kinney, Michael D @ 2018-02-07 22:58 UTC (permalink / raw)
  To: edk2-devel; +Cc: Michael D Kinney, Sean Brogan, Jiewen Yao, Kelly Steele

From: Michael D Kinney <michael.d.kinney@intel.com>

https://bugzilla.tianocore.org/show_bug.cgi?id=800

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

Add BmpSupportLib and SafeIntLib mappings that are required
by the DxeCapsuleLib when CAPSULE_ENABLE is set.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Kelly Steele <kelly.steele@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 QuarkPlatformPkg/Quark.dsc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/QuarkPlatformPkg/Quark.dsc b/QuarkPlatformPkg/Quark.dsc
index 5624451e12..7365a3a1bf 100644
--- a/QuarkPlatformPkg/Quark.dsc
+++ b/QuarkPlatformPkg/Quark.dsc
@@ -2,7 +2,7 @@
 # Clanton Peak CRB platform with 32-bit DXE for 4MB/8MB flash devices.
 #
 # This package provides Clanton Peak CRB platform specific modules.
-# Copyright (c) 2013 - 2017 Intel Corporation.
+# Copyright (c) 2013 - 2018 Intel Corporation.
 #
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
@@ -231,6 +231,8 @@
 
 !if $(CAPSULE_ENABLE)
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
 !else
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
 !endif
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Patch 08/10] DuetPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-07 22:58 [Patch 00/10] Add BmpSupportLib class and instance Kinney, Michael D
                   ` (6 preceding siblings ...)
  2018-02-07 22:58 ` [Patch 07/10] QuarkPlatformPkg: Add SafeIntLib and BmpSupportLib to DSC files Kinney, Michael D
@ 2018-02-07 22:58 ` Kinney, Michael D
  2018-02-07 22:58 ` [Patch 09/10] EmulatorPkg: " Kinney, Michael D
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 25+ messages in thread
From: Kinney, Michael D @ 2018-02-07 22:58 UTC (permalink / raw)
  To: edk2-devel; +Cc: Michael D Kinney, Sean Brogan, Jiewen Yao, Ruiyu Ni, Hao Wu

From: Michael D Kinney <michael.d.kinney@intel.com>

https://bugzilla.tianocore.org/show_bug.cgi?id=800

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

Add BmpSupportLib and SafeIntLib mappings that are required
by GenericBdsLib.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 DuetPkg/DuetPkgIa32.dsc | 4 +++-
 DuetPkg/DuetPkgX64.dsc  | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/DuetPkg/DuetPkgIa32.dsc b/DuetPkg/DuetPkgIa32.dsc
index ca3fbc2662..06cc61deb6 100644
--- a/DuetPkg/DuetPkgIa32.dsc
+++ b/DuetPkg/DuetPkgIa32.dsc
@@ -4,7 +4,7 @@
 #  Developer's UEFI Emulation. DUET provides an EFI/UEFI IA32/X64 environment on legacy BIOS,
 #  to help developing and debugging native EFI/UEFI drivers.
 #
-#  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -87,6 +87,8 @@
   UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
   OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
   GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
   PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
diff --git a/DuetPkg/DuetPkgX64.dsc b/DuetPkg/DuetPkgX64.dsc
index c41b9fbe8d..ee97dc2da2 100644
--- a/DuetPkg/DuetPkgX64.dsc
+++ b/DuetPkg/DuetPkgX64.dsc
@@ -4,7 +4,7 @@
 #  Developer's UEFI Emulation. DUET provides an EFI/UEFI IA32/X64 environment on legacy BIOS,
 #  to help developing and debugging native EFI/UEFI drivers.
 #
-#  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -87,6 +87,8 @@
   UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
   OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
   GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
   PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Patch 09/10] EmulatorPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-07 22:58 [Patch 00/10] Add BmpSupportLib class and instance Kinney, Michael D
                   ` (7 preceding siblings ...)
  2018-02-07 22:58 ` [Patch 08/10] DuetPkg: " Kinney, Michael D
@ 2018-02-07 22:58 ` Kinney, Michael D
  2018-02-08  8:33   ` Jordan Justen
  2018-02-07 22:58 ` [Patch 10/10] ArmVirtPkg: " Kinney, Michael D
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 25+ messages in thread
From: Kinney, Michael D @ 2018-02-07 22:58 UTC (permalink / raw)
  To: edk2-devel
  Cc: Michael D Kinney, Sean Brogan, Jiewen Yao, Jordan Justen,
	Andrew Fish

From: Michael D Kinney <michael.d.kinney@intel.com>

https://bugzilla.tianocore.org/show_bug.cgi?id=800

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

Add BmpSupportLib and SafeIntLib mappings that are required
by GenericBdsLib.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 EmulatorPkg/EmulatorPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index 818691ce3a..1c274cb723 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -83,6 +83,8 @@
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
   OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
   GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
   CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [Patch 10/10] ArmVirtPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-07 22:58 [Patch 00/10] Add BmpSupportLib class and instance Kinney, Michael D
                   ` (8 preceding siblings ...)
  2018-02-07 22:58 ` [Patch 09/10] EmulatorPkg: " Kinney, Michael D
@ 2018-02-07 22:58 ` Kinney, Michael D
  2018-02-07 23:25   ` Laszlo Ersek
  2018-02-11  0:16 ` [Patch 00/10] Add BmpSupportLib class and instance Bret Barkelew
  2018-02-11  0:19 ` Bret Barkelew
  11 siblings, 1 reply; 25+ messages in thread
From: Kinney, Michael D @ 2018-02-07 22:58 UTC (permalink / raw)
  To: edk2-devel
  Cc: Michael D Kinney, Sean Brogan, Jiewen Yao, Laszlo Ersek,
	Ard Biesheuvel

From: Michael D Kinney <michael.d.kinney@intel.com>

https://bugzilla.tianocore.org/show_bug.cgi?id=800

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

The BootGraphicsResourceTableDxe module uses the BmpSupportLib
and SafeIntLib to convert a GOP BLT buffer to a BMP graphics image.
Add library mappings for these new library classes.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 ArmVirtPkg/ArmVirt.dsc.inc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 5144bb10df..0cb48f08e9 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -1,7 +1,7 @@
 #
 #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
-#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
+#  Copyright (c) 2015 - 2018, 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
@@ -34,6 +34,8 @@
   DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
 
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
   SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
-- 
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [Patch 05/10] OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-07 22:58 ` [Patch 05/10] OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files Kinney, Michael D
@ 2018-02-07 23:17   ` Laszlo Ersek
  2018-02-07 23:48     ` Kinney, Michael D
  0 siblings, 1 reply; 25+ messages in thread
From: Laszlo Ersek @ 2018-02-07 23:17 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel
  Cc: Sean Brogan, Jiewen Yao, Jordan Justen, Ard Biesheuvel

Hi Mike,

On 02/07/18 23:58, Kinney, Michael D wrote:
> From: Michael D Kinney <michael.d.kinney@intel.com>
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=800
> 
> Based on content from the following branch/commits:
> https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
> https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
> https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
> https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

These commits look capsule-related, but the paragraph below speaks about
BootGraphicsResourceTableDxe and image format conversion. Should the
references be updated?

Also, if part of the code is from Sean, do we need an S-o-b from him,
above yours?

The DSC file changes look fine; I'm ready to R-b once the above is
clarified.

(For the future, please consider the "xfuncname" setting from
<https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers#contrib-05>,
together with
<https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers#contrib-09>.

Those settings help with the review of DSC and similar files -- the @@
hunk headers in the patch will state the [LibraryClasses] file section,
for example.)

Thanks,
Laszlo

> The BootGraphicsResourceTableDxe module uses the BmpSupportLib
> and SafeIntLib to convert a GOP BLT buffer to a BMP graphics image.
> Add library mappings for these new library classes.
> 
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  OvmfPkg/OvmfPkgIa32.dsc    | 2 ++
>  OvmfPkg/OvmfPkgIa32X64.dsc | 2 ++
>  OvmfPkg/OvmfPkgX64.dsc     | 2 ++
>  3 files changed, 6 insertions(+)
> 
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index d762955c5d..e10f898607 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -104,6 +104,8 @@
>    PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
>    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
> +  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
> +  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
>    SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
>    CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
>    PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 6bcbe70d64..a31c7919ad 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -109,6 +109,8 @@
>    PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
>    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
> +  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
> +  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
>    SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
>    CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
>    PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index 70fcdcba11..bc433a9724 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -109,6 +109,8 @@
>    PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>    BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
>    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
> +  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
> +  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
>    SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
>    CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
>    PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
> 



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Patch 10/10] ArmVirtPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-07 22:58 ` [Patch 10/10] ArmVirtPkg: " Kinney, Michael D
@ 2018-02-07 23:25   ` Laszlo Ersek
  0 siblings, 0 replies; 25+ messages in thread
From: Laszlo Ersek @ 2018-02-07 23:25 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel; +Cc: Sean Brogan, Jiewen Yao, Ard Biesheuvel

On 02/07/18 23:58, Kinney, Michael D wrote:
> From: Michael D Kinney <michael.d.kinney@intel.com>
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=800
> 
> Based on content from the following branch/commits:
> https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
> https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
> https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
> https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b
> 
> The BootGraphicsResourceTableDxe module uses the BmpSupportLib
> and SafeIntLib to convert a GOP BLT buffer to a BMP graphics image.
> Add library mappings for these new library classes.
> 
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  ArmVirtPkg/ArmVirt.dsc.inc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
> index 5144bb10df..0cb48f08e9 100644
> --- a/ArmVirtPkg/ArmVirt.dsc.inc
> +++ b/ArmVirtPkg/ArmVirt.dsc.inc
> @@ -1,7 +1,7 @@
>  #
>  #  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
>  #  Copyright (c) 2014, Linaro Limited. All rights reserved.
> -#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2015 - 2018, 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
> @@ -34,6 +34,8 @@
>    DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
>  
>    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
> +  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
> +  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
>    SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
>    PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
>    PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> 

I have similar comments to those I made on patch #5.

(BootGraphicsResourceTableDxe is not included in the Xen builds, only in
the QEMU builds, but adding the library resolutions to the central DSC
include file under ArmVirtPkg is good, IMO.)

Thanks!
Laszlo


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Patch 05/10] OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-07 23:17   ` Laszlo Ersek
@ 2018-02-07 23:48     ` Kinney, Michael D
  2018-02-08  0:35       ` Laszlo Ersek
  0 siblings, 1 reply; 25+ messages in thread
From: Kinney, Michael D @ 2018-02-07 23:48 UTC (permalink / raw)
  To: Laszlo Ersek, edk2-devel@lists.01.org, Kinney, Michael D
  Cc: Sean Brogan, Yao, Jiewen, Justen, Jordan L, Ard Biesheuvel

Laszlo,

The BmpSupportLib content was from contributions from 
a capsule related branch.  However, the BmpSupportLib 
can be used for UX capsules as well as other places that
conversions between BMP and GOP BLT buffers are needed,
so it is a more generic feature.  The SafeIntLib was also
based on content from the same capsule related branch but
also has uses other than capsules.

Yes.  I need to add Signed-off-by for Sean.

Thanks for the "xfuncname" tip.  I will add that to my
notes for sending patch emails so it is always enabled.

Mike

> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Wednesday, February 7, 2018 3:17 PM
> To: Kinney, Michael D <michael.d.kinney@intel.com>; edk2-
> devel@lists.01.org
> Cc: Sean Brogan <sean.brogan@microsoft.com>; Yao, Jiewen
> <jiewen.yao@intel.com>; Justen, Jordan L
> <jordan.l.justen@intel.com>; Ard Biesheuvel
> <ard.biesheuvel@linaro.org>
> Subject: Re: [Patch 05/10] OvmfPkg: Add SafeIntLib and
> BmpSupportLib to DSC files
> 
> Hi Mike,
> 
> On 02/07/18 23:58, Kinney, Michael D wrote:
> > From: Michael D Kinney <michael.d.kinney@intel.com>
> >
> > https://bugzilla.tianocore.org/show_bug.cgi?id=800
> >
> > Based on content from the following branch/commits:
> >
> https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsule
> Support
> >
> https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417
> d7d5a7d356c15a14c2e60302b2d
> >
> https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315
> c2d823f453e12d2135098f53d61
> >
> https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a
> 4c2ef4c4e32379e111f016dbd9b
> 
> These commits look capsule-related, but the paragraph
> below speaks about
> BootGraphicsResourceTableDxe and image format conversion.
> Should the
> references be updated?
> 
> Also, if part of the code is from Sean, do we need an S-
> o-b from him,
> above yours?
> 
> The DSC file changes look fine; I'm ready to R-b once the
> above is
> clarified.
> 
> (For the future, please consider the "xfuncname" setting
> from
> <https://github.com/tianocore/tianocore.github.io/wiki/La
> szlo's-unkempt-git-guide-for-edk2-contributors-and-
> maintainers#contrib-05>,
> together with
> <https://github.com/tianocore/tianocore.github.io/wiki/La
> szlo's-unkempt-git-guide-for-edk2-contributors-and-
> maintainers#contrib-09>.
> 
> Those settings help with the review of DSC and similar
> files -- the @@
> hunk headers in the patch will state the [LibraryClasses]
> file section,
> for example.)
> 
> Thanks,
> Laszlo
> 
> > The BootGraphicsResourceTableDxe module uses the
> BmpSupportLib
> > and SafeIntLib to convert a GOP BLT buffer to a BMP
> graphics image.
> > Add library mappings for these new library classes.
> >
> > Cc: Sean Brogan <sean.brogan@microsoft.com>
> > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > Cc: Jordan Justen <jordan.l.justen@intel.com>
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Michael D Kinney
> <michael.d.kinney@intel.com>
> > ---
> >  OvmfPkg/OvmfPkgIa32.dsc    | 2 ++
> >  OvmfPkg/OvmfPkgIa32X64.dsc | 2 ++
> >  OvmfPkg/OvmfPkgX64.dsc     | 2 ++
> >  3 files changed, 6 insertions(+)
> >
> > diff --git a/OvmfPkg/OvmfPkgIa32.dsc
> b/OvmfPkg/OvmfPkgIa32.dsc
> > index d762955c5d..e10f898607 100644
> > --- a/OvmfPkg/OvmfPkgIa32.dsc
> > +++ b/OvmfPkg/OvmfPkgIa32.dsc
> > @@ -104,6 +104,8 @@
> >
> PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> >
> BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemo
> ryLibRepStr.inf
> >    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
> > +
> SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.i
> nf
> > +
> BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/Base
> BmpSupportLib.inf
> >
> SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/
> BaseSynchronizationLib.inf
> >    CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> >
> PerformanceLib|MdePkg/Library/BasePerformanceLibNull/Base
> PerformanceLibNull.inf
> > diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc
> b/OvmfPkg/OvmfPkgIa32X64.dsc
> > index 6bcbe70d64..a31c7919ad 100644
> > --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> > +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> > @@ -109,6 +109,8 @@
> >
> PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> >
> BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemo
> ryLibRepStr.inf
> >    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
> > +
> SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.i
> nf
> > +
> BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/Base
> BmpSupportLib.inf
> >
> SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/
> BaseSynchronizationLib.inf
> >    CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> >
> PerformanceLib|MdePkg/Library/BasePerformanceLibNull/Base
> PerformanceLibNull.inf
> > diff --git a/OvmfPkg/OvmfPkgX64.dsc
> b/OvmfPkg/OvmfPkgX64.dsc
> > index 70fcdcba11..bc433a9724 100644
> > --- a/OvmfPkg/OvmfPkgX64.dsc
> > +++ b/OvmfPkg/OvmfPkgX64.dsc
> > @@ -109,6 +109,8 @@
> >
> PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> >
> BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemo
> ryLibRepStr.inf
> >    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
> > +
> SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.i
> nf
> > +
> BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/Base
> BmpSupportLib.inf
> >
> SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/
> BaseSynchronizationLib.inf
> >    CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> >
> PerformanceLib|MdePkg/Library/BasePerformanceLibNull/Base
> PerformanceLibNull.inf
> >


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Patch 05/10] OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-07 23:48     ` Kinney, Michael D
@ 2018-02-08  0:35       ` Laszlo Ersek
  2018-02-08  7:43         ` Ard Biesheuvel
  0 siblings, 1 reply; 25+ messages in thread
From: Laszlo Ersek @ 2018-02-08  0:35 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org
  Cc: Sean Brogan, Yao, Jiewen, Justen, Jordan L, Ard Biesheuvel

On 02/08/18 00:48, Kinney, Michael D wrote:
> Laszlo,
> 
> The BmpSupportLib content was from contributions from 
> a capsule related branch.  However, the BmpSupportLib 
> can be used for UX capsules as well as other places that
> conversions between BMP and GOP BLT buffers are needed,
> so it is a more generic feature.  The SafeIntLib was also
> based on content from the same capsule related branch but
> also has uses other than capsules.
> 
> Yes.  I need to add Signed-off-by for Sean.

OK, with the S-o-b updated, for patches #5 and #10:

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thank you,
Laszlo

> Thanks for the "xfuncname" tip.  I will add that to my
> notes for sending patch emails so it is always enabled.
> 
> Mike
> 
>> -----Original Message-----
>> From: Laszlo Ersek [mailto:lersek@redhat.com]
>> Sent: Wednesday, February 7, 2018 3:17 PM
>> To: Kinney, Michael D <michael.d.kinney@intel.com>; edk2-
>> devel@lists.01.org
>> Cc: Sean Brogan <sean.brogan@microsoft.com>; Yao, Jiewen
>> <jiewen.yao@intel.com>; Justen, Jordan L
>> <jordan.l.justen@intel.com>; Ard Biesheuvel
>> <ard.biesheuvel@linaro.org>
>> Subject: Re: [Patch 05/10] OvmfPkg: Add SafeIntLib and
>> BmpSupportLib to DSC files
>>
>> Hi Mike,
>>
>> On 02/07/18 23:58, Kinney, Michael D wrote:
>>> From: Michael D Kinney <michael.d.kinney@intel.com>
>>>
>>> https://bugzilla.tianocore.org/show_bug.cgi?id=800
>>>
>>> Based on content from the following branch/commits:
>>>
>> https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsule
>> Support
>>>
>> https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417
>> d7d5a7d356c15a14c2e60302b2d
>>>
>> https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315
>> c2d823f453e12d2135098f53d61
>>>
>> https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a
>> 4c2ef4c4e32379e111f016dbd9b
>>
>> These commits look capsule-related, but the paragraph
>> below speaks about
>> BootGraphicsResourceTableDxe and image format conversion.
>> Should the
>> references be updated?
>>
>> Also, if part of the code is from Sean, do we need an S-
>> o-b from him,
>> above yours?
>>
>> The DSC file changes look fine; I'm ready to R-b once the
>> above is
>> clarified.
>>
>> (For the future, please consider the "xfuncname" setting
>> from
>> <https://github.com/tianocore/tianocore.github.io/wiki/La
>> szlo's-unkempt-git-guide-for-edk2-contributors-and-
>> maintainers#contrib-05>,
>> together with
>> <https://github.com/tianocore/tianocore.github.io/wiki/La
>> szlo's-unkempt-git-guide-for-edk2-contributors-and-
>> maintainers#contrib-09>.
>>
>> Those settings help with the review of DSC and similar
>> files -- the @@
>> hunk headers in the patch will state the [LibraryClasses]
>> file section,
>> for example.)
>>
>> Thanks,
>> Laszlo
>>
>>> The BootGraphicsResourceTableDxe module uses the
>> BmpSupportLib
>>> and SafeIntLib to convert a GOP BLT buffer to a BMP
>> graphics image.
>>> Add library mappings for these new library classes.
>>>
>>> Cc: Sean Brogan <sean.brogan@microsoft.com>
>>> Cc: Jiewen Yao <jiewen.yao@intel.com>
>>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>>> Cc: Laszlo Ersek <lersek@redhat.com>
>>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>> Signed-off-by: Michael D Kinney
>> <michael.d.kinney@intel.com>
>>> ---
>>>  OvmfPkg/OvmfPkgIa32.dsc    | 2 ++
>>>  OvmfPkg/OvmfPkgIa32X64.dsc | 2 ++
>>>  OvmfPkg/OvmfPkgX64.dsc     | 2 ++
>>>  3 files changed, 6 insertions(+)
>>>
>>> diff --git a/OvmfPkg/OvmfPkgIa32.dsc
>> b/OvmfPkg/OvmfPkgIa32.dsc
>>> index d762955c5d..e10f898607 100644
>>> --- a/OvmfPkg/OvmfPkgIa32.dsc
>>> +++ b/OvmfPkg/OvmfPkgIa32.dsc
>>> @@ -104,6 +104,8 @@
>>>
>> PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>>>
>> BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemo
>> ryLibRepStr.inf
>>>    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
>>> +
>> SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.i
>> nf
>>> +
>> BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/Base
>> BmpSupportLib.inf
>>>
>> SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/
>> BaseSynchronizationLib.inf
>>>    CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
>>>
>> PerformanceLib|MdePkg/Library/BasePerformanceLibNull/Base
>> PerformanceLibNull.inf
>>> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc
>> b/OvmfPkg/OvmfPkgIa32X64.dsc
>>> index 6bcbe70d64..a31c7919ad 100644
>>> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
>>> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
>>> @@ -109,6 +109,8 @@
>>>
>> PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>>>
>> BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemo
>> ryLibRepStr.inf
>>>    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
>>> +
>> SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.i
>> nf
>>> +
>> BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/Base
>> BmpSupportLib.inf
>>>
>> SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/
>> BaseSynchronizationLib.inf
>>>    CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
>>>
>> PerformanceLib|MdePkg/Library/BasePerformanceLibNull/Base
>> PerformanceLibNull.inf
>>> diff --git a/OvmfPkg/OvmfPkgX64.dsc
>> b/OvmfPkg/OvmfPkgX64.dsc
>>> index 70fcdcba11..bc433a9724 100644
>>> --- a/OvmfPkg/OvmfPkgX64.dsc
>>> +++ b/OvmfPkg/OvmfPkgX64.dsc
>>> @@ -109,6 +109,8 @@
>>>
>> PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
>>>
>> BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemo
>> ryLibRepStr.inf
>>>    BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
>>> +
>> SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.i
>> nf
>>> +
>> BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/Base
>> BmpSupportLib.inf
>>>
>> SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/
>> BaseSynchronizationLib.inf
>>>    CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
>>>
>> PerformanceLib|MdePkg/Library/BasePerformanceLibNull/Base
>> PerformanceLibNull.inf
>>>
> 



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Patch 01/10] MdeModulePkg: Add BmpSupportLib class and instance
  2018-02-07 22:58 ` [Patch 01/10] MdeModulePkg: " Kinney, Michael D
@ 2018-02-08  5:10   ` Zeng, Star
  0 siblings, 0 replies; 25+ messages in thread
From: Zeng, Star @ 2018-02-08  5:10 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org
  Cc: Sean Brogan, Yao, Jiewen, Dong, Eric, Ni, Ruiyu, Zeng, Star

Reviewed-by: Star Zeng <star.zeng@intel.com> to MdeModulePkg change with a minor comment below.

Update the comments in MdeModulePkg/Include/Library/BmpSupportLib.h and MdeModulePkg.dec?

Provides services to convert a BMP graphics image to a GOP BLT buffer.
->
Provides services to convert a BMP graphics image to a GOP BLT buffer and to convert a GOP BLT buffer to a BMP graphics image.


Thanks,
Star
-----Original Message-----
From: Kinney, Michael D 
Sent: Thursday, February 8, 2018 6:58 AM
To: edk2-devel@lists.01.org
Cc: Sean Brogan <sean.brogan@microsoft.com>; Yao, Jiewen <jiewen.yao@intel.com>; Zeng, Star <star.zeng@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>
Subject: [Patch 01/10] MdeModulePkg: Add BmpSupportLib class and instance

https://bugzilla.tianocore.org/show_bug.cgi?id=800

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

Add BmpSupportLib class and instances that provides services to convert a BMP graphics image to a GOP BLT buffer and to convert a GOP BLT buffer to a BMP graphics image.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 MdeModulePkg/Include/Library/BmpSupportLib.h       | 105 ++++
 .../BaseBmpSupportLib/BaseBmpSupportLib.inf        |  49 ++
 .../BaseBmpSupportLib/BaseBmpSupportLib.uni        |  20 +
 .../Library/BaseBmpSupportLib/BmpSupportLib.c      | 583 +++++++++++++++++++++
 MdeModulePkg/MdeModulePkg.dec                      |   6 +-
 MdeModulePkg/MdeModulePkg.dsc                      |   1 +
 6 files changed, 763 insertions(+), 1 deletion(-)  create mode 100644 MdeModulePkg/Include/Library/BmpSupportLib.h
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.uni
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c

diff --git a/MdeModulePkg/Include/Library/BmpSupportLib.h b/MdeModulePkg/Include/Library/BmpSupportLib.h
new file mode 100644
index 0000000000..3406aa3fca
--- /dev/null
+++ b/MdeModulePkg/Include/Library/BmpSupportLib.h
@@ -0,0 +1,105 @@
+/** @file
+
+Provides services to convert a BMP graphics image to a GOP BLT buffer.
+
+Copyright (c) 2016, Microsoft Corporation Copyright (c) 2018, Intel 
+Corporation. All rights reserved.<BR>
+
+All rights reserved.
+Redistribution and use in source and binary forms, with or without 
+modification, are permitted provided that the following conditions are met:
+1. Redistributions of source code must retain the above copyright 
+notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright 
+notice, this list of conditions and the following disclaimer in the 
+documentation  and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#ifndef __BMP_SUPPORT_LIB_H__
+#define __BMP_SUPPORT_LIB_H__
+
+#include <Protocol/GraphicsOutput.h>
+
+/**
+  Translate a *.BMP graphics image to a GOP blt buffer. If a NULL Blt 
+buffer
+  is passed in a GopBlt buffer will be allocated by this routine using
+  EFI_BOOT_SERVICES.AllocatePool(). If a GopBlt buffer is passed in it 
+will be
+  used if it is big enough.
+
+  @param [in]      BmpImage      Pointer to BMP file.
+  @param [in]      BmpImageSize  Number of bytes in BmpImage.
+  @param [in, out] GopBlt        Buffer containing GOP version of BmpImage.
+  @param [in, out] GopBltSize    Size of GopBlt in bytes.
+  @param [out]     PixelHeight   Height of GopBlt/BmpImage in pixels.
+  @param [out]     PixelWidth    Width of GopBlt/BmpImage in pixels.
+
+  @retval RETURN_SUCCESS            GopBlt and GopBltSize are returned.
+  @retval RETURN_INVALID_PARAMETER  BmpImage is NULL.
+  @retval RETURN_INVALID_PARAMETER  GopBlt is NULL.
+  @retval RETURN_INVALID_PARAMETER  GopBltSize is NULL.
+  @retval RETURN_INVALID_PARAMETER  PixelHeight is NULL.
+  @retval RETURN_INVALID_PARAMETER  PixelWidth is NULL.
+  @retval RETURN_UNSUPPORTED        BmpImage is not a valid *.BMP image.
+  @retval RETURN_BUFFER_TOO_SMALL   The passed in GopBlt buffer is not big
+                                    enough.  The required size is returned in
+                                    GopBltSize.
+  @retval RETURN_OUT_OF_RESOURCES   The GopBlt buffer could not be allocated.
+
+**/
+RETURN_STATUS
+EFIAPI
+TranslateBmpToGopBlt (
+  IN     VOID                           *BmpImage,
+  IN     UINTN                          BmpImageSize,
+  IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL  **GopBlt,
+  IN OUT UINTN                          *GopBltSize,
+  OUT    UINTN                          *PixelHeight,
+  OUT    UINTN                          *PixelWidth
+  );
+
+/**
+  Translate a GOP blt buffer to an uncompressed 24-bit per pixel BMP 
+graphics
+  image. If a NULL BmpImage is passed in a BmpImage buffer will be 
+allocated by
+  this routine using EFI_BOOT_SERVICES.AllocatePool(). If a BmpImage 
+buffer is
+  passed in it will be used if it is big enough.
+
+  @param [in]      GopBlt        Pointer to GOP blt buffer.
+  @param [in]      PixelHeight   Height of GopBlt/BmpImage in pixels.
+  @param [in]      PixelWidth    Width of GopBlt/BmpImage in pixels.
+  @param [in, out] BmpImage      Buffer containing BMP version of GopBlt.
+  @param [in, out] BmpImageSize  Size of BmpImage in bytes.
+
+  @retval RETURN_SUCCESS            BmpImage and BmpImageSize are returned.
+  @retval RETURN_INVALID_PARAMETER  GopBlt is NULL.
+  @retval RETURN_INVALID_PARAMETER  BmpImage is NULL.
+  @retval RETURN_INVALID_PARAMETER  BmpImageSize is NULL.
+  @retval RETURN_UNSUPPORTED        GopBlt cannot be converted to a *.BMP image.
+  @retval RETURN_BUFFER_TOO_SMALL   The passed in BmpImage buffer is not big
+                                    enough.  The required size is returned in
+                                    BmpImageSize.
+  @retval RETURN_OUT_OF_RESOURCES   The BmpImage buffer could not be allocated.
+
+**/
+RETURN_STATUS
+EFIAPI
+TranslateGopBltToBmp (
+  IN     EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *GopBlt,
+  IN     UINT32                         PixelHeight,
+  IN     UINT32                         PixelWidth,
+  IN OUT VOID                           **BmpImage,
+  IN OUT UINT32                         *BmpImageSize
+  );
+
+#endif
diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf b/MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
new file mode 100644
index 0000000000..02c3fae0b4
--- /dev/null
+++ b/MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
@@ -0,0 +1,49 @@
+## @file
+#
+# Provides services to convert a BMP graphics image to a GOP BLT buffer 
+and # from a GOP BLT buffer to a BMP graphics image.
+#
+# Copyright (c) 2017, Microsoft Corporation # # All rights reserved.
+# Redistribution and use in source and binary forms, with or without # 
+modification, are permitted provided that the following conditions are met:
+# 1. Redistributions of source code must retain the above copyright 
+notice, # this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright 
+notice, # this list of conditions and the following disclaimer in the 
+documentation # and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+"AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 
+ANY DIRECT, # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF 
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR 
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, 
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE # 
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+
+[Defines]
+  INF_VERSION     = 0x00010017
+  BASE_NAME       = BaseBmpSupportLib
+  MODULE_UNI_FILE = BaseBmpSupportLib.uni
+  FILE_GUID       = CF5F650B-C208-409A-B889-0755172E2B0C
+  VERSION_STRING  = 1.0
+  MODULE_TYPE     = BASE
+  LIBRARY_CLASS   = BmpSupportLib
+
+[LibraryClasses]
+  DebugLib
+  BaseMemoryLib
+  MemoryAllocationLib
+  SafeIntLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+
+[Sources]
+  BmpSupportLib.c
diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.uni b/MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.uni
new file mode 100644
index 0000000000..f24e2d246f
--- /dev/null
+++ b/MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.uni
@@ -0,0 +1,20 @@
+// /** @file
+//
+// Provides services to convert a BMP graphics image to a GOP BLT 
+buffer and // from a GOP BLT buffer to a BMP graphics image.
+//
+// Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> // 
+// 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.
+//
+// **/
+
+#string STR_MODULE_ABSTRACT             #language en-US "BmpSupportLib instance"
+
+#string STR_MODULE_DESCRIPTION          #language en-US "BmpSupportLib instance."
+
diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
new file mode 100644
index 0000000000..2c95e91ecc
--- /dev/null
+++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c
@@ -0,0 +1,583 @@
+/** @file
+
+  Provides services to convert a BMP graphics image to a GOP BLT buffer 
+ and  from a GOP BLT buffer to a BMP graphics image.
+
+  Caution: This module requires additional review when modified.
+  This module processes external input - BMP image.
+  This external input must be validated carefully to avoid security 
+ issue such  as buffer overflow, integer overflow.
+
+  TranslateBmpToGopBlt() receives untrusted input and performs basic validation.
+
+  Copyright (c) 2016-2017, Microsoft Corporation  Copyright (c) 2018, 
+ Intel Corporation. All rights reserved.<BR>
+
+  All rights reserved.
+  Redistribution and use in source and binary forms, with or without  
+ modification, are permitted provided that the following conditions are met:
+  1. Redistributions of source code must retain the above copyright 
+ notice,  this list of conditions and the following disclaimer.
+  2. Redistributions in binary form must reproduce the above copyright 
+ notice,  this list of conditions and the following disclaimer in the 
+ documentation  and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ "AS IS" AND  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ LIMITED TO, THE IMPLIED  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 
+ ANY DIRECT,  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ CONSEQUENTIAL DAMAGES (INCLUDING,  BUT NOT LIMITED TO, PROCUREMENT OF 
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,  DATA, OR PROFITS; OR 
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  LIABILITY, 
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE  
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#include <PiDxe.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h> #include 
+<Library/SafeIntLib.h> #include <IndustryStandard/Bmp.h>
+
+#include <Library/BmpSupportLib.h>
+
+//
+// BMP Image header for an uncompressed 24-bit per pixel BMP image.
+//
+const BMP_IMAGE_HEADER  mBmpImageHeaderTemplate = {
+  'B',    // CharB
+  'M',    // CharM
+  0,      // Size will be updated at runtime
+  {0, 0}, // Reserved
+  sizeof (BMP_IMAGE_HEADER), // ImageOffset
+  sizeof (BMP_IMAGE_HEADER) - OFFSET_OF (BMP_IMAGE_HEADER, HeaderSize), // HeaderSize
+  0,      // PixelWidth will be updated at runtime
+  0,      // PixelHeight will be updated at runtime
+  1,      // Planes
+  24,     // BitPerPixel
+  0,      // CompressionType
+  0,      // ImageSize will be updated at runtime
+  0,      // XPixelsPerMeter
+  0,      // YPixelsPerMeter
+  0,      // NumberOfColors
+  0       // ImportantColors
+};
+
+/**
+  Translate a *.BMP graphics image to a GOP blt buffer. If a NULL Blt 
+buffer
+  is passed in a GopBlt buffer will be allocated by this routine using
+  EFI_BOOT_SERVICES.AllocatePool(). If a GopBlt buffer is passed in it 
+will be
+  used if it is big enough.
+
+  @param[in]       BmpImage      Pointer to BMP file.
+  @param[in]       BmpImageSize  Number of bytes in BmpImage.
+  @param[in, out]  GopBlt        Buffer containing GOP version of BmpImage.
+  @param[in, out]  GopBltSize    Size of GopBlt in bytes.
+  @param[out]      PixelHeight   Height of GopBlt/BmpImage in pixels.
+  @param[out]      PixelWidth    Width of GopBlt/BmpImage in pixels.
+
+  @retval  RETURN_SUCCESS            GopBlt and GopBltSize are returned.
+  @retval  RETURN_INVALID_PARAMETER  BmpImage is NULL.
+  @retval  RETURN_INVALID_PARAMETER  GopBlt is NULL.
+  @retval  RETURN_INVALID_PARAMETER  GopBltSize is NULL.
+  @retval  RETURN_INVALID_PARAMETER  PixelHeight is NULL.
+  @retval  RETURN_INVALID_PARAMETER  PixelWidth is NULL.
+  @retval  RETURN_UNSUPPORTED        BmpImage is not a valid *.BMP image.
+  @retval  RETURN_BUFFER_TOO_SMALL   The passed in GopBlt buffer is not big
+                                     enough.  The required size is returned in
+                                     GopBltSize.
+  @retval  RETURN_OUT_OF_RESOURCES   The GopBlt buffer could not be allocated.
+
+**/
+RETURN_STATUS
+EFIAPI
+TranslateBmpToGopBlt (
+  IN     VOID                           *BmpImage,
+  IN     UINTN                          BmpImageSize,
+  IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL  **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;
+  UINT32                         BltBufferSize;
+  UINTN                          Index;
+  UINTN                          Height;
+  UINTN                          Width;
+  UINTN                          ImageIndex;
+  UINT32                         DataSizePerLine;
+  BOOLEAN                        IsAllocated;
+  UINT32                         ColorMapNum;
+  RETURN_STATUS                  Status;
+  UINT32                         DataSize;
+  UINT32                         Temp;
+
+  if (BmpImage == NULL || GopBlt == NULL || GopBltSize == NULL) {
+    return RETURN_INVALID_PARAMETER;
+  }
+  if (PixelHeight == NULL || PixelWidth == NULL) {
+    return RETURN_INVALID_PARAMETER;
+  }
+
+  if (BmpImageSize < sizeof (BMP_IMAGE_HEADER)) {
+    DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpImageSize too small\n"));
+    return RETURN_UNSUPPORTED;
+  }
+
+  BmpHeader = (BMP_IMAGE_HEADER *)BmpImage;
+
+  if (BmpHeader->CharB != 'B' || BmpHeader->CharM != 'M') {
+    DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpHeader->Char fields incorrect\n"));
+    return RETURN_UNSUPPORTED;
+  }
+
+  //
+  // Doesn't support compress.
+  //
+  if (BmpHeader->CompressionType != 0) {
+    DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: Compression Type unsupported.\n"));
+    return RETURN_UNSUPPORTED;
+  }
+
+  //
+  // Only support BITMAPINFOHEADER format.
+  // BITMAPFILEHEADER + BITMAPINFOHEADER = BMP_IMAGE_HEADER  //  if 
+ (BmpHeader->HeaderSize != sizeof (BMP_IMAGE_HEADER) - OFFSET_OF (BMP_IMAGE_HEADER, HeaderSize)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateBmpToGopBlt: BmpHeader->Headership is not as expected.  Headersize is 0x%x\n",
+      BmpHeader->HeaderSize
+      ));
+    return RETURN_UNSUPPORTED;
+  }
+
+  //
+  // The data size in each line must be 4 byte alignment.
+  //
+  Status = SafeUint32Mult (
+             BmpHeader->PixelWidth,
+             BmpHeader->BitPerPixel,
+             &DataSizePerLine
+             );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateBmpToGopBlt: invalid BmpImage... PixelWidth:0x%x BitPerPixel:0x%x\n",
+      BmpHeader->PixelWidth,
+      BmpHeader->BitPerPixel
+      ));
+    return RETURN_UNSUPPORTED;
+  }
+
+  Status = SafeUint32Add (DataSizePerLine, 31, &DataSizePerLine);  if 
+ (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateBmpToGopBlt: invalid BmpImage... DataSizePerLine:0x%x\n",
+      DataSizePerLine
+      ));
+
+    return RETURN_UNSUPPORTED;
+  }
+
+  DataSizePerLine = (DataSizePerLine >> 3) &(~0x3);  Status = 
+ SafeUint32Mult (
+             DataSizePerLine,
+             BmpHeader->PixelHeight,
+             &BltBufferSize
+             );
+
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateBmpToGopBlt: invalid BmpImage... DataSizePerLine:0x%x PixelHeight:0x%x\n",
+      DataSizePerLine, BmpHeader->PixelHeight
+      ));
+
+    return RETURN_UNSUPPORTED;
+  }
+
+  Status = SafeUint32Mult (
+             BmpHeader->PixelHeight,
+             DataSizePerLine,
+             &DataSize
+             );
+
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateBmpToGopBlt: invalid BmpImage... PixelHeight:0x%x DataSizePerLine:0x%x\n",
+      BmpHeader->PixelHeight, DataSizePerLine
+      ));
+
+    return RETURN_UNSUPPORTED;
+  }
+
+  if ((BmpHeader->Size != BmpImageSize) ||
+      (BmpHeader->Size < BmpHeader->ImageOffset) ||
+      (BmpHeader->Size - BmpHeader->ImageOffset != DataSize)) {
+
+    DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n"));
+    DEBUG ((DEBUG_ERROR, "   BmpHeader->Size: 0x%x\n", BmpHeader->Size));
+    DEBUG ((DEBUG_ERROR, "   BmpHeader->ImageOffset: 0x%x\n", BmpHeader->ImageOffset));
+    DEBUG ((DEBUG_ERROR, "   BmpImageSize: 0x%lx\n", (UINTN)BmpImageSize));
+    DEBUG ((DEBUG_ERROR, "   DataSize: 0x%lx\n", (UINTN)DataSize));
+
+    return RETURN_UNSUPPORTED;
+  }
+
+  //
+  // Calculate Color Map offset in the image.
+  //
+  Image = BmpImage;
+  BmpColorMap = (BMP_COLOR_MAP *)(Image + sizeof (BMP_IMAGE_HEADER));  
+ if (BmpHeader->ImageOffset < sizeof (BMP_IMAGE_HEADER)) {
+    return RETURN_UNSUPPORTED;
+  }
+
+  if (BmpHeader->ImageOffset > sizeof (BMP_IMAGE_HEADER)) {
+    switch (BmpHeader->BitPerPixel) {
+    case 1:
+      ColorMapNum = 2;
+      break;
+    case 4:
+      ColorMapNum = 16;
+      break;
+    case 8:
+      ColorMapNum = 256;
+      break;
+    default:
+      ColorMapNum = 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 RETURN_UNSUPPORTED;
+    }
+  }
+
+  //
+  // Calculate graphics image data address in the image  //  Image = 
+ ((UINT8 *)BmpImage) + BmpHeader->ImageOffset;  ImageHeader = Image;
+
+  //
+  // Calculate the BltBuffer needed size.
+  //
+  Status = SafeUint32Mult (
+             BmpHeader->PixelWidth,
+             BmpHeader->PixelHeight,
+             &BltBufferSize
+             );
+
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateBmpToGopBlt: invalid BltBuffer needed size... PixelWidth:0x%x PixelHeight:0x%x\n",
+      BltBufferSize
+      ));
+
+    return RETURN_UNSUPPORTED;
+  }
+
+  Temp = BltBufferSize;
+  Status = SafeUint32Mult (
+             BltBufferSize,
+             sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL),
+             &BltBufferSize
+             );
+
+  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateBmpToGopBlt: invalid BltBuffer needed size... BltBufferSize:0x%lx struct size:0x%x\n",
+      Temp, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+      ));
+
+    return RETURN_UNSUPPORTED;
+  }
+
+  IsAllocated = FALSE;
+  if (*GopBlt == NULL) {
+    //
+    // GopBlt is not allocated by caller.
+    //
+    DEBUG ((DEBUG_INFO, "Bmp Support: Allocating 0x%X bytes of memory\n", BltBufferSize));
+    *GopBltSize = (UINTN)BltBufferSize;
+    *GopBlt = AllocatePool (*GopBltSize);
+    IsAllocated = TRUE;
+    if (*GopBlt == NULL) {
+      return RETURN_OUT_OF_RESOURCES;
+    }
+  } else {
+    //
+    // GopBlt has been allocated by caller.
+    //
+    if (*GopBltSize < (UINTN)BltBufferSize) {
+      *GopBltSize = (UINTN)BltBufferSize;
+      return RETURN_BUFFER_TOO_SMALL;
+    }
+  }
+
+  *PixelWidth  = BmpHeader->PixelWidth;  *PixelHeight = 
+ BmpHeader->PixelHeight;  DEBUG ((DEBUG_INFO, "BmpHeader->ImageOffset 
+ 0x%X\n", BmpHeader->ImageOffset));  DEBUG ((DEBUG_INFO, 
+ "BmpHeader->PixelWidth 0x%X\n", BmpHeader->PixelWidth));  DEBUG 
+ ((DEBUG_INFO, "BmpHeader->PixelHeight 0x%X\n", 
+ BmpHeader->PixelHeight));  DEBUG ((DEBUG_INFO, "BmpHeader->BitPerPixel 
+ 0x%X\n", BmpHeader->BitPerPixel));  DEBUG ((DEBUG_INFO, 
+ "BmpHeader->ImageSize 0x%X\n", BmpHeader->ImageSize));  DEBUG 
+ ((DEBUG_INFO, "BmpHeader->HeaderSize 0x%X\n", BmpHeader->HeaderSize));  
+ DEBUG ((DEBUG_INFO, "BmpHeader->Size 0x%X\n", BmpHeader->Size));
+
+  //
+  // Translate image from BMP to Blt buffer format  //  BltBuffer = 
+ *GopBlt;  for (Height = 0; Height < BmpHeader->PixelHeight; Height++) 
+ {
+    Blt = &BltBuffer[ (BmpHeader->PixelHeight - Height - 1) * BmpHeader->PixelWidth];
+    for (Width = 0; Width < BmpHeader->PixelWidth; Width++, Image++, Blt++) {
+      switch (BmpHeader->BitPerPixel) {
+      case 1:
+        //
+        // Translate 1-bit (2 colors) BMP to 24-bit color
+        //
+        for (Index = 0; Index < 8 && Width < BmpHeader->PixelWidth; Index++) {
+          Blt->Red   = BmpColorMap[ ((*Image) >> (7 - Index)) & 0x1].Red;
+          Blt->Green = BmpColorMap[ ((*Image) >> (7 - Index)) & 0x1].Green;
+          Blt->Blue  = BmpColorMap[ ((*Image) >> (7 - Index)) & 0x1].Blue;
+          Blt++;
+          Width++;
+        }
+
+        Blt--;
+        Width--;
+        break;
+
+      case 4:
+        //
+        // Translate 4-bit (16 colors) BMP Palette to 24-bit color
+        //
+        Index = (*Image) >> 4;
+        Blt->Red   = BmpColorMap[Index].Red;
+        Blt->Green = BmpColorMap[Index].Green;
+        Blt->Blue  = BmpColorMap[Index].Blue;
+        if (Width < (BmpHeader->PixelWidth - 1)) {
+          Blt++;
+          Width++;
+          Index = (*Image) & 0x0f;
+          Blt->Red   = BmpColorMap[Index].Red;
+          Blt->Green = BmpColorMap[Index].Green;
+          Blt->Blue  = BmpColorMap[Index].Blue;
+        }
+        break;
+
+      case 8:
+        //
+        // Translate 8-bit (256 colors) BMP Palette to 24-bit color
+        //
+        Blt->Red   = BmpColorMap[*Image].Red;
+        Blt->Green = BmpColorMap[*Image].Green;
+        Blt->Blue  = BmpColorMap[*Image].Blue;
+        break;
+
+      case 24:
+        //
+        // It is 24-bit BMP.
+        //
+        Blt->Blue  = *Image++;
+        Blt->Green = *Image++;
+        Blt->Red   = *Image;
+        break;
+
+      case 32:
+        //
+        //Conver 32 bit to 24bit bmp - just ignore the final byte of each pixel
+        Blt->Blue  = *Image++;
+        Blt->Green = *Image++;
+        Blt->Red   = *Image++;
+        break;
+
+      default:
+        //
+        // Other bit format BMP is not supported.
+        //
+        if (IsAllocated) {
+          FreePool (*GopBlt);
+          *GopBlt = NULL;
+        }
+        DEBUG ((DEBUG_ERROR, "Bmp Bit format not supported.  0x%X\n", BmpHeader->BitPerPixel));
+        return RETURN_UNSUPPORTED;
+        break;
+      };
+
+    }
+
+    ImageIndex = (UINTN)(Image - ImageHeader);
+    if ((ImageIndex % 4) != 0) {
+      //
+      // Bmp Image starts each row on a 32-bit boundary!
+      //
+      Image = Image + (4 - (ImageIndex % 4));
+    }
+  }
+
+  return RETURN_SUCCESS;
+}
+
+/**
+  Translate a GOP blt buffer to an uncompressed 24-bit per pixel BMP 
+graphics
+  image. If a NULL BmpImage is passed in a BmpImage buffer will be 
+allocated by
+  this routine using EFI_BOOT_SERVICES.AllocatePool(). If a BmpImage 
+buffer is
+  passed in it will be used if it is big enough.
+
+  @param [in]      GopBlt        Pointer to GOP blt buffer.
+  @param [in]      PixelHeight   Height of GopBlt/BmpImage in pixels.
+  @param [in]      PixelWidth    Width of GopBlt/BmpImage in pixels.
+  @param [in, out] BmpImage      Buffer containing BMP version of GopBlt.
+  @param [in, out] BmpImageSize  Size of BmpImage in bytes.
+
+  @retval RETURN_SUCCESS            BmpImage and BmpImageSize are returned.
+  @retval RETURN_INVALID_PARAMETER  GopBlt is NULL.
+  @retval RETURN_INVALID_PARAMETER  BmpImage is NULL.
+  @retval RETURN_INVALID_PARAMETER  BmpImageSize is NULL.
+  @retval RETURN_UNSUPPORTED        GopBlt cannot be converted to a *.BMP image.
+  @retval RETURN_BUFFER_TOO_SMALL   The passed in BmpImage buffer is not big
+                                    enough.  The required size is returned in
+                                    BmpImageSize.
+  @retval RETURN_OUT_OF_RESOURCES   The BmpImage buffer could not be allocated.
+
+**/
+RETURN_STATUS
+EFIAPI
+TranslateGopBltToBmp (
+  IN     EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *GopBlt,
+  IN     UINT32                         PixelHeight,
+  IN     UINT32                         PixelWidth,
+  IN OUT VOID                           **BmpImage,
+  IN OUT UINT32                         *BmpImageSize
+  )
+{
+  RETURN_STATUS                  Status;
+  UINT32                         PaddingSize;
+  UINT32                         BmpSize;
+  BMP_IMAGE_HEADER               *BmpImageHeader;
+  UINT8                          *Image;
+  UINTN                          Col;
+  UINTN                          Row;
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *BltPixel;
+
+  if (GopBlt == NULL || BmpImage == NULL || BmpImageSize == NULL) {
+    return RETURN_INVALID_PARAMETER;
+  }
+
+  //
+  // Allocate memory for BMP file.
+  //
+  PaddingSize = PixelWidth & 0x3;
+
+  //
+  // First check PixelWidth * 3 + PaddingSize doesn't overflow  //  
+ Status = SafeUint32Mult (PixelWidth, 3, &BmpSize);  if (EFI_ERROR 
+ (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateGopBltToBmp: GopBlt is too large. PixelHeight:0x%x PixelWidth:0x%x\n",
+      PixelHeight,
+      PixelWidth
+      ));
+    return RETURN_UNSUPPORTED;
+  }
+  Status = SafeUint32Add (BmpSize, PaddingSize, &BmpSize);  if 
+ (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateGopBltToBmp: GopBlt is too large. PixelHeight:0x%x PixelWidth:0x%x\n",
+      PixelHeight,
+      PixelWidth
+      ));
+    return RETURN_UNSUPPORTED;
+  }
+
+  //
+  // Second check (mLogoWidth * 3 + PaddingSize) * mLogoHeight + sizeof 
+ (BMP_IMAGE_HEADER) doesn't overflow  //  Status = SafeUint32Mult 
+ (BmpSize, PixelHeight, &BmpSize);  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateGopBltToBmp: GopBlt is too large. PixelHeight:0x%x PixelWidth:0x%x\n",
+      PixelHeight,
+      PixelWidth
+      ));
+    return RETURN_UNSUPPORTED;
+  }
+  Status = SafeUint32Add (BmpSize, sizeof (BMP_IMAGE_HEADER), 
+ &BmpSize);  if (EFI_ERROR (Status)) {
+    DEBUG ((
+      DEBUG_ERROR,
+      "TranslateGopBltToBmp: GopBlt is too large. PixelHeight:0x%x PixelWidth:0x%x\n",
+      PixelHeight,
+      PixelWidth
+      ));
+    return RETURN_UNSUPPORTED;
+  }
+
+  //
+  // The image should be stored in EfiBootServicesData, allowing the 
+ system to  // reclaim the memory  //  if (*BmpImage == NULL) {
+    *BmpImage = AllocateZeroPool (BmpSize);
+    if (*BmpImage == NULL) {
+      return EFI_OUT_OF_RESOURCES;
+    }
+    *BmpImageSize = BmpSize;
+  } else if (*BmpImageSize < BmpSize) {
+    *BmpImageSize = BmpSize;
+    return RETURN_BUFFER_TOO_SMALL;
+  }
+
+  BmpImageHeader = (BMP_IMAGE_HEADER *)*BmpImage;  CopyMem 
+ (BmpImageHeader, &mBmpImageHeaderTemplate, sizeof (BMP_IMAGE_HEADER));
+  BmpImageHeader->Size        = *BmpImageSize;
+  BmpImageHeader->ImageSize   = *BmpImageSize - sizeof (BMP_IMAGE_HEADER);
+  BmpImageHeader->PixelWidth  = PixelWidth;  
+ BmpImageHeader->PixelHeight = PixelHeight;
+
+  //
+  // Convert BLT buffer to BMP file.
+  //
+  Image = (UINT8 *)BmpImageHeader + sizeof (BMP_IMAGE_HEADER);  for 
+ (Row = 0; Row < PixelHeight; Row++) {
+    BltPixel = &GopBlt[(PixelHeight - Row - 1) * PixelWidth];
+
+    for (Col = 0; Col < PixelWidth; Col++) {
+      *Image++ = BltPixel->Blue;
+      *Image++ = BltPixel->Green;
+      *Image++ = BltPixel->Red;
+      BltPixel++;
+    }
+
+    //
+    // Padding for 4 byte alignment.
+    //
+    Image += PaddingSize;
+  }
+
+  return RETURN_SUCCESS;
+}
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 61d034fba8..e3f87a4d28 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -7,7 +7,7 @@
 # Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>  # (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>  # Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR> -#
+# Copyright (c) 2016, Microsoft Corporation<BR>
 # This program and the accompanying materials are licensed and made available under  # the terms and conditions of the BSD License that accompanies this distribution.
 # The full text of the license may be found at @@ -167,6 +167,10 @@
   ##
   NonDiscoverableDeviceRegistrationLib|Include/Library/NonDiscoverableDeviceRegistrationLib.h
 
+  ## @libraryclass  Provides services to convert a BMP graphics image to a GOP BLT buffer.
+  #
+  BmpSupportLib|Include/Library/BmpSupportLib.h
+
 [Guids]
   ## MdeModule package token space guid
   # Include/Guid/MdeModulePkgTokenSpace.h
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index 1c0085aee6..efd33f4b82 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -321,6 +321,7 @@
   MdeModulePkg/Library/SmmIpmiLibSmmIpmiProtocol/SmmIpmiLibSmmIpmiProtocol.inf
   MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
   MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.inf
+  MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
 
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
   MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
--
2.14.2.windows.3



^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [Patch 05/10] OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-08  0:35       ` Laszlo Ersek
@ 2018-02-08  7:43         ` Ard Biesheuvel
  2018-02-08  8:32           ` Jordan Justen
  2018-02-08  8:55           ` Laszlo Ersek
  0 siblings, 2 replies; 25+ messages in thread
From: Ard Biesheuvel @ 2018-02-08  7:43 UTC (permalink / raw)
  To: Laszlo Ersek
  Cc: Kinney, Michael D, edk2-devel@lists.01.org, Sean Brogan,
	Yao, Jiewen, Justen, Jordan L

On 8 February 2018 at 01:35, Laszlo Ersek <lersek@redhat.com> wrote:
> On 02/08/18 00:48, Kinney, Michael D wrote:
>> Laszlo,
>>
>> The BmpSupportLib content was from contributions from
>> a capsule related branch.  However, the BmpSupportLib
>> can be used for UX capsules as well as other places that
>> conversions between BMP and GOP BLT buffers are needed,
>> so it is a more generic feature.  The SafeIntLib was also
>> based on content from the same capsule related branch but
>> also has uses other than capsules.
>>
>> Yes.  I need to add Signed-off-by for Sean.

I will note once again that our signed off by deviates from other
usage in the industry.

Usually, a sign off is not an assertion of authorship. It means that
the submitter is able to submit the code under the license that covers
it.

In our case, it means authorship, which is why we as
reviewers/maintainers add 'reviewed-by' not 'signed-off-by' like we do
in the linux kernel.

So what if I want to merge code that is available under a suitable
license, but the author is not available to give his sign off, or
there are many (hundreds) of authors etc etc? The whole point of open
source licensing is that we don't *need* the explicit sign off of the
authors, because the license tells us what we can and cannot do with
the code.

I guess this is also related to the DCO vs contributed-under tags, but
in general, I think adding the sign off of people who are not involved
in the actual upstreaming of the code is wrong, and it is perfectly
fine for the author not to be in a s-o-b line.

-- 
Ard.


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Patch 05/10] OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-08  7:43         ` Ard Biesheuvel
@ 2018-02-08  8:32           ` Jordan Justen
  2018-02-08  9:25             ` Laszlo Ersek
  2018-02-08  8:55           ` Laszlo Ersek
  1 sibling, 1 reply; 25+ messages in thread
From: Jordan Justen @ 2018-02-08  8:32 UTC (permalink / raw)
  To: Ard Biesheuvel, Laszlo Ersek
  Cc: Kinney, Michael D, edk2-devel@lists.01.org, Sean Brogan,
	Yao, Jiewen

On 2018-02-07 23:43:44, Ard Biesheuvel wrote:
> On 8 February 2018 at 01:35, Laszlo Ersek <lersek@redhat.com> wrote:
> > On 02/08/18 00:48, Kinney, Michael D wrote:
> >> Laszlo,
> >>
> >> The BmpSupportLib content was from contributions from
> >> a capsule related branch.  However, the BmpSupportLib
> >> can be used for UX capsules as well as other places that
> >> conversions between BMP and GOP BLT buffers are needed,
> >> so it is a more generic feature.  The SafeIntLib was also
> >> based on content from the same capsule related branch but
> >> also has uses other than capsules.
> >>
> >> Yes.  I need to add Signed-off-by for Sean.
> 
> I will note once again that our signed off by deviates from other
> usage in the industry.
> 
> Usually, a sign off is not an assertion of authorship. It means that
> the submitter is able to submit the code under the license that covers
> it.
> 
> In our case, it means authorship,

From "TianoCore Contribution Agreement 1.1":

  "You" or "Contributor" shall mean the copyright owner or legal
  entity authorized by the copyright owner that is making a
  Contribution hereunder.

For reference, the kernel DCO:

https://www.kernel.org/doc/html/latest/process/submitting-patches.html#developer-s-certificate-of-origin-1-1

Maybe the kernel does make it clearer in some ways, but I don't think
it has to be the actual author for EDK II.

One argument for following the kernel process might be that more
people that work on open source are familiar with it.

> which is why we as
> reviewers/maintainers add 'reviewed-by' not 'signed-off-by' like we do
> in the linux kernel.

Maybe this is more about the fact that sub-systems don't do pull
requests in EDK II, but just push the changes directly?

> So what if I want to merge code that is available under a suitable
> license, but the author is not available to give his sign off, or
> there are many (hundreds) of authors etc etc? The whole point of open
> source licensing is that we don't *need* the explicit sign off of the
> authors, because the license tells us what we can and cannot do with
> the code.
> 
> I guess this is also related to the DCO vs contributed-under tags, but
> in general, I think adding the sign off of people who are not involved
> in the actual upstreaming of the code is wrong, and it is perfectly
> fine for the author not to be in a s-o-b line.

It does seem like it would be preferable (or simpler?) for the author
to publicly note that they wrote it and give their Signed-off-by under
the contribution agreement.

Given the wording from the contribution agreement, it appears that it
would also be fine to just use Mike's Signed-off-by if he is
authorized to contribute the code even though he didn't author it.

-Jordan


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Patch 09/10] EmulatorPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-07 22:58 ` [Patch 09/10] EmulatorPkg: " Kinney, Michael D
@ 2018-02-08  8:33   ` Jordan Justen
  0 siblings, 0 replies; 25+ messages in thread
From: Jordan Justen @ 2018-02-08  8:33 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel
  Cc: Michael D Kinney, Sean Brogan, Jiewen Yao, Andrew Fish

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>

On 2018-02-07 14:58:21, Kinney, Michael D wrote:
> From: Michael D Kinney <michael.d.kinney@intel.com>
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=800
> 
> Based on content from the following branch/commits:
> https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
> https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
> https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
> https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b
> 
> Add BmpSupportLib and SafeIntLib mappings that are required
> by GenericBdsLib.
> 
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Andrew Fish <afish@apple.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  EmulatorPkg/EmulatorPkg.dsc | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
> index 818691ce3a..1c274cb723 100644
> --- a/EmulatorPkg/EmulatorPkg.dsc
> +++ b/EmulatorPkg/EmulatorPkg.dsc
> @@ -83,6 +83,8 @@
>    DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
>    OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
>    GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
> +  BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
> +  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
>    CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
>    SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
>    TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
> -- 
> 2.14.2.windows.3
> 


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Patch 05/10] OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-08  7:43         ` Ard Biesheuvel
  2018-02-08  8:32           ` Jordan Justen
@ 2018-02-08  8:55           ` Laszlo Ersek
  1 sibling, 0 replies; 25+ messages in thread
From: Laszlo Ersek @ 2018-02-08  8:55 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Kinney, Michael D, edk2-devel@lists.01.org, Sean Brogan,
	Yao, Jiewen, Justen, Jordan L

On 02/08/18 08:43, Ard Biesheuvel wrote:
> On 8 February 2018 at 01:35, Laszlo Ersek <lersek@redhat.com> wrote:
>> On 02/08/18 00:48, Kinney, Michael D wrote:
>>> Laszlo,
>>>
>>> The BmpSupportLib content was from contributions from
>>> a capsule related branch.  However, the BmpSupportLib
>>> can be used for UX capsules as well as other places that
>>> conversions between BMP and GOP BLT buffers are needed,
>>> so it is a more generic feature.  The SafeIntLib was also
>>> based on content from the same capsule related branch but
>>> also has uses other than capsules.
>>>
>>> Yes.  I need to add Signed-off-by for Sean.
> 
> I will note once again that our signed off by deviates from other
> usage in the industry.
> 
> Usually, a sign off is not an assertion of authorship. It means that
> the submitter is able to submit the code under the license that covers
> it.

I think a license is not really interpretable unless the identity of the
licensor can be established. I'd just like something in the commit
message and/or the git metadata to spell out the shared authorship
between Microsoft and Intel.

> In our case, it means authorship, which is why we as
> reviewers/maintainers add 'reviewed-by' not 'signed-off-by' like we do
> in the linux kernel.
> 
> So what if I want to merge code that is available under a suitable
> license, but the author is not available to give his sign off, or
> there are many (hundreds) of authors etc etc? The whole point of open
> source licensing is that we don't *need* the explicit sign off of the
> authors, because the license tells us what we can and cannot do with
> the code.

We may not need an explicit sign-off from the original author, agreed,
but we need *something* that states that it was the original author that
put the original work under the license in question.

Patch #5 starts with:

"From: Michael D Kinney <michael.d.kinney@intel.com>"

which means the git meta-datum for authorship will not credit Microsoft.
Then, we also don't see a @microsoft.com email address anywhere at the
end of the commit message. Finally, the code changes themselves don't
add a Microsoft (C) to the DSC files. So we have a patch that is derived
from original Microsoft work (at this point it is shared work between
Intel and Microsoft), with none of the common attribution methods
mentioning Microsoft.

I don't insist on either form specifically, but *something* needs to be
added, in my opinion.

> I guess this is also related to the DCO vs contributed-under tags, but
> in general, I think adding the sign off of people who are not involved
> in the actual upstreaming of the code is wrong, and it is perfectly
> fine for the author not to be in a s-o-b line.

Fine by me; but please let us find another semi-formal method then that
states that the original (non-upstreamimg) author has put the patch
under the license that actually *permits* upstreaming now, without the
original author's active participation.

I thought the best method for this would be:

    """
    Contributed-under: TianoCore Contribution Agreement 1.1
    Signed-off-by: Sean Brogan <sean.brogan@microsoft.com>
    Contributed-under: TianoCore Contribution Agreement 1.1
    Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
    """

I may well be wrong about the specifics, but I feel that *something*
should spell out Microsoft's co-authorship on this patch.

Thanks
Laszlo


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Patch 05/10] OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-08  8:32           ` Jordan Justen
@ 2018-02-08  9:25             ` Laszlo Ersek
  2018-02-08  9:32               ` Ard Biesheuvel
  0 siblings, 1 reply; 25+ messages in thread
From: Laszlo Ersek @ 2018-02-08  9:25 UTC (permalink / raw)
  To: Jordan Justen, Ard Biesheuvel
  Cc: Kinney, Michael D, edk2-devel@lists.01.org, Yao, Jiewen

On 02/08/18 09:32, Jordan Justen wrote:

> Given the wording from the contribution agreement, it appears that it
> would also be fine to just use Mike's Signed-off-by if he is
> authorized to contribute the code even though he didn't author it.

So basically just

  """
  Contributed-under: TianoCore Contribution Agreement 1.1
  Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
  """

implies Mike saying, "trust me guys, I got Microsoft's authorization (or
whoever the original authors were) to contribute their code under the
2-clause BSDL". Is that right?

Dunno why but this concept is hard for me to accept. :) "whoever the
original authors were" is super vague to me. Let's say I want to verify
that authorization myself: whom do I contact? Are the
"https://github.com/Microsoft/MS_UEFI/..." references considered
sufficient origin information?

Thanks,
Laszlo


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Patch 05/10] OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-08  9:25             ` Laszlo Ersek
@ 2018-02-08  9:32               ` Ard Biesheuvel
  2018-02-08  9:47                 ` Laszlo Ersek
  0 siblings, 1 reply; 25+ messages in thread
From: Ard Biesheuvel @ 2018-02-08  9:32 UTC (permalink / raw)
  To: Laszlo Ersek
  Cc: Jordan Justen, Kinney, Michael D, edk2-devel@lists.01.org,
	Yao, Jiewen

On 8 February 2018 at 09:25, Laszlo Ersek <lersek@redhat.com> wrote:
> On 02/08/18 09:32, Jordan Justen wrote:
>
>> Given the wording from the contribution agreement, it appears that it
>> would also be fine to just use Mike's Signed-off-by if he is
>> authorized to contribute the code even though he didn't author it.
>
> So basically just
>
>   """
>   Contributed-under: TianoCore Contribution Agreement 1.1
>   Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
>   """
>
> implies Mike saying, "trust me guys, I got Microsoft's authorization (or
> whoever the original authors were) to contribute their code under the
> 2-clause BSDL". Is that right?
>
> Dunno why but this concept is hard for me to accept. :) "whoever the
> original authors were" is super vague to me. Let's say I want to verify
> that authorization myself: whom do I contact? Are the
> "https://github.com/Microsoft/MS_UEFI/..." references considered
> sufficient origin information?
>

This is exactly the reason: if someone contributes code under a
suitable license, they should take full responsibility that the code
in question is actually covered by that license.

I refuse any responsibility for verifying the origin of code that
others contribute, and I'm sure your workload doesn't allow it either.


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Patch 05/10] OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files
  2018-02-08  9:32               ` Ard Biesheuvel
@ 2018-02-08  9:47                 ` Laszlo Ersek
  0 siblings, 0 replies; 25+ messages in thread
From: Laszlo Ersek @ 2018-02-08  9:47 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Jordan Justen, Kinney, Michael D, edk2-devel@lists.01.org,
	Yao, Jiewen

On 02/08/18 10:32, Ard Biesheuvel wrote:
> On 8 February 2018 at 09:25, Laszlo Ersek <lersek@redhat.com> wrote:
>> On 02/08/18 09:32, Jordan Justen wrote:
>>
>>> Given the wording from the contribution agreement, it appears that it
>>> would also be fine to just use Mike's Signed-off-by if he is
>>> authorized to contribute the code even though he didn't author it.
>>
>> So basically just
>>
>>   """
>>   Contributed-under: TianoCore Contribution Agreement 1.1
>>   Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
>>   """
>>
>> implies Mike saying, "trust me guys, I got Microsoft's authorization (or
>> whoever the original authors were) to contribute their code under the
>> 2-clause BSDL". Is that right?
>>
>> Dunno why but this concept is hard for me to accept. :) "whoever the
>> original authors were" is super vague to me. Let's say I want to verify
>> that authorization myself: whom do I contact? Are the
>> "https://github.com/Microsoft/MS_UEFI/..." references considered
>> sufficient origin information?
>>
> 
> This is exactly the reason: if someone contributes code under a
> suitable license, they should take full responsibility that the code
> in question is actually covered by that license.

OK. If that works, then patches #5 and #10 are

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

as they are in this series.

(This keeps boggling my mind -- I honestly wonder whether responsibility
*can* stop at the submitter, as opposed to "catching up" with the whole
project --, so I'm pretty sure I'll forget about this interpretation
again, and you'll have to remind me again. Please bear with me. :( )

> I refuse any responsibility for verifying the origin of code that
> others contribute, and I'm sure your workload doesn't allow it either.

It's definitely not that I'd take any responsibility for origin
verification; I just figured that contributors could (or should)
semi-formally support such efforts, *should* someone in the future feel
like verifying the origin.

Thanks
Laszlo


^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Patch 00/10] Add BmpSupportLib class and instance
  2018-02-07 22:58 [Patch 00/10] Add BmpSupportLib class and instance Kinney, Michael D
                   ` (9 preceding siblings ...)
  2018-02-07 22:58 ` [Patch 10/10] ArmVirtPkg: " Kinney, Michael D
@ 2018-02-11  0:16 ` Bret Barkelew
  2018-02-11  0:19 ` Bret Barkelew
  11 siblings, 0 replies; 25+ messages in thread
From: Bret Barkelew @ 2018-02-11  0:16 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org
  Cc: Ruiyu Ni, Eric Dong, Ard Biesheuvel, Hao Wu, Jordan Justen,
	Andrew Fish, Jiewen Yao, Michael D Kinney, Laszlo Ersek,
	Star Zeng, David Wei

Approved.
Reviewd-By: Bret Barkelew Bret.Barkelew@microsoft.com

- Bret

From: Kinney, Michael D<mailto:michael.d.kinney@intel.com>
Sent: Wednesday, February 7, 2018 2:58 PM
To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
Cc: Ruiyu Ni<mailto:ruiyu.ni@intel.com>; Eric Dong<mailto:eric.dong@intel.com>; Ard Biesheuvel<mailto:ard.biesheuvel@linaro.org>; Hao Wu<mailto:hao.a.wu@intel.com>; Jordan Justen<mailto:jordan.l.justen@intel.com>; Andrew Fish<mailto:afish@apple.com>; Jiewen Yao<mailto:jiewen.yao@intel.com>; Michael D Kinney<mailto:michael.d.kinney@intel.com>; Laszlo Ersek<mailto:lersek@redhat.com>; Star Zeng<mailto:star.zeng@intel.com>; David Wei<mailto:david.wei@intel.com>
Subject: [edk2] [Patch 00/10] Add BmpSupportLib class and instance

https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D800&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C8f2b7148ac5c4d774a9f08d56e7e4fd2%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536411170052762%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=E96biwS3Q8OTee365hQJScLXa%2Fb7yBGC7IiVxO5A9aM%3D&reserved=0

Branch for review:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmdkinney%2Fedk2%2Fcommits%2FBug_800_BmpSupportLib_V2&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C8f2b7148ac5c4d774a9f08d56e7e4fd2%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536411170052762%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=6qpw0S0fJ9pOARdFzlE8p15OKZGKTTOkZOb%2BjD9FutI%3D&reserved=0

Based on content from the following branch/commits:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2FMS_UEFI%2Ftree%2Fshare%2FMsCapsuleSupport&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C8f2b7148ac5c4d774a9f08d56e7e4fd2%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536411170052762%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=WTOBgpOsBidzuSJVVDtc691afJ%2BMDANyaMHEFBCWl14%3D&reserved=0
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2FMS_UEFI%2Fcommit%2F33bab4031a417d7d5a7d356c15a14c2e60302b2d&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C8f2b7148ac5c4d774a9f08d56e7e4fd2%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536411170052762%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=uQiy6y4TpMcOBU0uFvQOL21j7Hk7vJrShwcZQARzFXQ%3D&reserved=0
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2FMS_UEFI%2Fcommit%2Fca516b1a61315c2d823f453e12d2135098f53d61&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C8f2b7148ac5c4d774a9f08d56e7e4fd2%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536411170052762%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=jlakW5VAPCJ9l0TS6xyCA0HO6nTj555FOi7bh5VGKow%3D&reserved=0
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2FMS_UEFI%2Fcommit%2F2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C8f2b7148ac5c4d774a9f08d56e7e4fd2%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536411170052762%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=BuD2uK61vuVRagd12PXDWQAvaf%2BBuU2e3jP3NjFZOKo%3D&reserved=0

Add BmpSupportLib class and instances that provides services to
convert a BMP graphics image to a GOP BLT buffer and to convert
a GOP BLT buffer to a BMP graphics image.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Andrew Fish <afish@apple.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>

Kinney, Michael D (1):
  MdeModulePkg: Add BmpSupportLib class and instance

Michael D Kinney (9):
  MdeModulePkg/DxeCapsuleLibFmp: Use BmpSupportLib
  MdeModulePkg/BootGraphicsResourceTableDxe: Use BmpSupportLib
  IntelFrameworkModulePkg/GenericBdsLib: Use BmpSupportLib
  OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files
  Vlv2TbltDevicePkg/Override/GenericBdsLib: Use BmpSupportLib
  QuarkPlatformPkg: Add SafeIntLib and BmpSupportLib to DSC files
  DuetPkg: Add SafeIntLib and BmpSupportLib to DSC files
  EmulatorPkg: Add SafeIntLib and BmpSupportLib to DSC files
  ArmVirtPkg: Add SafeIntLib and BmpSupportLib to DSC files

 ArmVirtPkg/ArmVirt.dsc.inc                         |   4 +-
 DuetPkg/DuetPkgIa32.dsc                            |   4 +-
 DuetPkg/DuetPkgX64.dsc                             |   4 +-
 EmulatorPkg/EmulatorPkg.dsc                        |   2 +
 .../IntelFrameworkModulePkg.dsc                    |   4 +-
 .../Library/GenericBdsLib/BdsConsole.c             | 250 +--------
 .../Library/GenericBdsLib/GenericBdsLib.inf        |   3 +-
 .../Library/GenericBdsLib/InternalBdsLib.h         |   3 +-
 MdeModulePkg/Include/Library/BmpSupportLib.h       | 105 ++++
 .../BaseBmpSupportLib/BaseBmpSupportLib.inf        |  49 ++
 .../BaseBmpSupportLib/BaseBmpSupportLib.uni        |  20 +
 .../Library/BaseBmpSupportLib/BmpSupportLib.c      | 583 +++++++++++++++++++++
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c       | 268 +---------
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf     |   3 +-
 .../DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf      |   3 +-
 MdeModulePkg/MdeModulePkg.dec                      |   6 +-
 MdeModulePkg/MdeModulePkg.dsc                      |   3 +
 .../BootGraphicsResourceTableDxe.c                 | 425 +++++++--------
 .../BootGraphicsResourceTableDxe.inf               |   4 +-
 OvmfPkg/OvmfPkgIa32.dsc                            |   2 +
 OvmfPkg/OvmfPkgIa32X64.dsc                         |   2 +
 OvmfPkg/OvmfPkgX64.dsc                             |   2 +
 QuarkPlatformPkg/Quark.dsc                         |   4 +-
 .../Library/GenericBdsLib/BdsConsole.c             | 251 +--------
 .../Library/GenericBdsLib/GenericBdsLib.inf        |   3 +-
 .../Library/GenericBdsLib/InternalBdsLib.h         |   3 +-
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc            |   4 +-
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc              |   4 +-
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc               |   4 +-
 29 files changed, 1018 insertions(+), 1004 deletions(-)
 create mode 100644 MdeModulePkg/Include/Library/BmpSupportLib.h
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.uni
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c

--
2.14.2.windows.3

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fmailman%2Flistinfo%2Fedk2-devel&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C8f2b7148ac5c4d774a9f08d56e7e4fd2%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536411170052762%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=%2FU%2B%2FtWTELfUVLVfOv5iEzYX%2Bsla09a2GUVrAqcZfQUU%3D&reserved=0



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Patch 00/10] Add BmpSupportLib class and instance
  2018-02-07 22:58 [Patch 00/10] Add BmpSupportLib class and instance Kinney, Michael D
                   ` (10 preceding siblings ...)
  2018-02-11  0:16 ` [Patch 00/10] Add BmpSupportLib class and instance Bret Barkelew
@ 2018-02-11  0:19 ` Bret Barkelew
  11 siblings, 0 replies; 25+ messages in thread
From: Bret Barkelew @ 2018-02-11  0:19 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org
  Cc: Ruiyu Ni, Eric Dong, Ard Biesheuvel, Hao Wu, Jordan Justen,
	Andrew Fish, Jiewen Yao, Michael D Kinney, Laszlo Ersek,
	Star Zeng, David Wei

Approved.
Reviewed-By: Bret Barkelew Bret.Barkelew@microsoft.com

- Bret

From: Kinney, Michael D<mailto:michael.d.kinney@intel.com>
Sent: Wednesday, February 7, 2018 2:58 PM
To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
Cc: Ruiyu Ni<mailto:ruiyu.ni@intel.com>; Eric Dong<mailto:eric.dong@intel.com>; Ard Biesheuvel<mailto:ard.biesheuvel@linaro.org>; Hao Wu<mailto:hao.a.wu@intel.com>; Jordan Justen<mailto:jordan.l.justen@intel.com>; Andrew Fish<mailto:afish@apple.com>; Jiewen Yao<mailto:jiewen.yao@intel.com>; Michael D Kinney<mailto:michael.d.kinney@intel.com>; Laszlo Ersek<mailto:lersek@redhat.com>; Star Zeng<mailto:star.zeng@intel.com>; David Wei<mailto:david.wei@intel.com>
Subject: [edk2] [Patch 00/10] Add BmpSupportLib class and instance

https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D800&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C8f2b7148ac5c4d774a9f08d56e7e4fd2%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536411170052762%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=E96biwS3Q8OTee365hQJScLXa%2Fb7yBGC7IiVxO5A9aM%3D&reserved=0

Branch for review:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmdkinney%2Fedk2%2Fcommits%2FBug_800_BmpSupportLib_V2&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C8f2b7148ac5c4d774a9f08d56e7e4fd2%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536411170052762%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=6qpw0S0fJ9pOARdFzlE8p15OKZGKTTOkZOb%2BjD9FutI%3D&reserved=0

Based on content from the following branch/commits:
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2FMS_UEFI%2Ftree%2Fshare%2FMsCapsuleSupport&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C8f2b7148ac5c4d774a9f08d56e7e4fd2%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536411170052762%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=WTOBgpOsBidzuSJVVDtc691afJ%2BMDANyaMHEFBCWl14%3D&reserved=0
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2FMS_UEFI%2Fcommit%2F33bab4031a417d7d5a7d356c15a14c2e60302b2d&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C8f2b7148ac5c4d774a9f08d56e7e4fd2%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536411170052762%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=uQiy6y4TpMcOBU0uFvQOL21j7Hk7vJrShwcZQARzFXQ%3D&reserved=0
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2FMS_UEFI%2Fcommit%2Fca516b1a61315c2d823f453e12d2135098f53d61&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C8f2b7148ac5c4d774a9f08d56e7e4fd2%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536411170052762%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=jlakW5VAPCJ9l0TS6xyCA0HO6nTj555FOi7bh5VGKow%3D&reserved=0
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMicrosoft%2FMS_UEFI%2Fcommit%2F2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C8f2b7148ac5c4d774a9f08d56e7e4fd2%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536411170052762%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=BuD2uK61vuVRagd12PXDWQAvaf%2BBuU2e3jP3NjFZOKo%3D&reserved=0

Add BmpSupportLib class and instances that provides services to
convert a BMP graphics image to a GOP BLT buffer and to convert
a GOP BLT buffer to a BMP graphics image.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Andrew Fish <afish@apple.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>

Kinney, Michael D (1):
  MdeModulePkg: Add BmpSupportLib class and instance

Michael D Kinney (9):
  MdeModulePkg/DxeCapsuleLibFmp: Use BmpSupportLib
  MdeModulePkg/BootGraphicsResourceTableDxe: Use BmpSupportLib
  IntelFrameworkModulePkg/GenericBdsLib: Use BmpSupportLib
  OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files
  Vlv2TbltDevicePkg/Override/GenericBdsLib: Use BmpSupportLib
  QuarkPlatformPkg: Add SafeIntLib and BmpSupportLib to DSC files
  DuetPkg: Add SafeIntLib and BmpSupportLib to DSC files
  EmulatorPkg: Add SafeIntLib and BmpSupportLib to DSC files
  ArmVirtPkg: Add SafeIntLib and BmpSupportLib to DSC files

 ArmVirtPkg/ArmVirt.dsc.inc                         |   4 +-
 DuetPkg/DuetPkgIa32.dsc                            |   4 +-
 DuetPkg/DuetPkgX64.dsc                             |   4 +-
 EmulatorPkg/EmulatorPkg.dsc                        |   2 +
 .../IntelFrameworkModulePkg.dsc                    |   4 +-
 .../Library/GenericBdsLib/BdsConsole.c             | 250 +--------
 .../Library/GenericBdsLib/GenericBdsLib.inf        |   3 +-
 .../Library/GenericBdsLib/InternalBdsLib.h         |   3 +-
 MdeModulePkg/Include/Library/BmpSupportLib.h       | 105 ++++
 .../BaseBmpSupportLib/BaseBmpSupportLib.inf        |  49 ++
 .../BaseBmpSupportLib/BaseBmpSupportLib.uni        |  20 +
 .../Library/BaseBmpSupportLib/BmpSupportLib.c      | 583 +++++++++++++++++++++
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c       | 268 +---------
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf     |   3 +-
 .../DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf      |   3 +-
 MdeModulePkg/MdeModulePkg.dec                      |   6 +-
 MdeModulePkg/MdeModulePkg.dsc                      |   3 +
 .../BootGraphicsResourceTableDxe.c                 | 425 +++++++--------
 .../BootGraphicsResourceTableDxe.inf               |   4 +-
 OvmfPkg/OvmfPkgIa32.dsc                            |   2 +
 OvmfPkg/OvmfPkgIa32X64.dsc                         |   2 +
 OvmfPkg/OvmfPkgX64.dsc                             |   2 +
 QuarkPlatformPkg/Quark.dsc                         |   4 +-
 .../Library/GenericBdsLib/BdsConsole.c             | 251 +--------
 .../Library/GenericBdsLib/GenericBdsLib.inf        |   3 +-
 .../Library/GenericBdsLib/InternalBdsLib.h         |   3 +-
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc            |   4 +-
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc              |   4 +-
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc               |   4 +-
 29 files changed, 1018 insertions(+), 1004 deletions(-)
 create mode 100644 MdeModulePkg/Include/Library/BmpSupportLib.h
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.uni
 create mode 100644 MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c

--
2.14.2.windows.3

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fmailman%2Flistinfo%2Fedk2-devel&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C8f2b7148ac5c4d774a9f08d56e7e4fd2%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536411170052762%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=%2FU%2B%2FtWTELfUVLVfOv5iEzYX%2Bsla09a2GUVrAqcZfQUU%3D&reserved=0



^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2018-02-11  0:13 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-07 22:58 [Patch 00/10] Add BmpSupportLib class and instance Kinney, Michael D
2018-02-07 22:58 ` [Patch 01/10] MdeModulePkg: " Kinney, Michael D
2018-02-08  5:10   ` Zeng, Star
2018-02-07 22:58 ` [Patch 02/10] MdeModulePkg/DxeCapsuleLibFmp: Use BmpSupportLib Kinney, Michael D
2018-02-07 22:58 ` [Patch 03/10] MdeModulePkg/BootGraphicsResourceTableDxe: " Kinney, Michael D
2018-02-07 22:58 ` [Patch 04/10] IntelFrameworkModulePkg/GenericBdsLib: " Kinney, Michael D
2018-02-07 22:58 ` [Patch 05/10] OvmfPkg: Add SafeIntLib and BmpSupportLib to DSC files Kinney, Michael D
2018-02-07 23:17   ` Laszlo Ersek
2018-02-07 23:48     ` Kinney, Michael D
2018-02-08  0:35       ` Laszlo Ersek
2018-02-08  7:43         ` Ard Biesheuvel
2018-02-08  8:32           ` Jordan Justen
2018-02-08  9:25             ` Laszlo Ersek
2018-02-08  9:32               ` Ard Biesheuvel
2018-02-08  9:47                 ` Laszlo Ersek
2018-02-08  8:55           ` Laszlo Ersek
2018-02-07 22:58 ` [Patch 06/10] Vlv2TbltDevicePkg/Override/GenericBdsLib: Use BmpSupportLib Kinney, Michael D
2018-02-07 22:58 ` [Patch 07/10] QuarkPlatformPkg: Add SafeIntLib and BmpSupportLib to DSC files Kinney, Michael D
2018-02-07 22:58 ` [Patch 08/10] DuetPkg: " Kinney, Michael D
2018-02-07 22:58 ` [Patch 09/10] EmulatorPkg: " Kinney, Michael D
2018-02-08  8:33   ` Jordan Justen
2018-02-07 22:58 ` [Patch 10/10] ArmVirtPkg: " Kinney, Michael D
2018-02-07 23:25   ` Laszlo Ersek
2018-02-11  0:16 ` [Patch 00/10] Add BmpSupportLib class and instance Bret Barkelew
2018-02-11  0:19 ` Bret Barkelew

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox