public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Huangming (Mark)" <huangming23@huawei.com>
To: Leif Lindholm <leif.lindholm@linaro.org>,
	Ming Huang <heyi.guo@linaro.org>
Cc: <linaro-uefi@lists.linaro.org>, <edk2-devel@lists.01.org>,
	<graeme.gregory@linaro.org>, <ard.biesheuvel@linaro.org>,
	<guoheyi@huawei.com>, <wanghuiqiang@huawei.com>,
	<zhangjinsong2@huawei.com>, <mengfanrong@huawei.com>,
	<waip23@126.com>
Subject: Re: [PATCH edk2-platforms v1 02/14] Hisilicon D03/D05:Switch to Generic BDS driver
Date: Tue, 23 Jan 2018 14:03:47 +0800	[thread overview]
Message-ID: <5e897ca9-d05d-7f7a-1089-094f0530dc17@huawei.com> (raw)
In-Reply-To: <20180122183812.eqd4gmitmvipiwjk@bivouac.eciton.net>



On 2018/1/23 2:38, Leif Lindholm wrote:
> Please provide a detailed commit message.
> For example, explain that:
> - Generic BDS use configurable build-time, enabled by default.
>   (Why? Is this intended to be temporary?)
> - Hisilicon-specific PlatformBootManagerLib added.
>   (Why? What features are added compared to default one?)
> 
> Minor comments below.
> 
> On Thu, Jan 18, 2018 at 11:01:31PM +0800, Ming Huang wrote:
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Ming Huang <huangming23@huawei.com>
>> Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
>> Signed-off-by: Jason Zhang <zhangjinsong2@huawei.com>
>> ---
>>  Platform/Hisilicon/D03/D03.dsc                                              |  24 +
>>  Platform/Hisilicon/D03/D03.fdf                                              |   7 +
>>  Platform/Hisilicon/D05/D05.dsc                                              |  27 +-
>>  Platform/Hisilicon/D05/D05.fdf                                              |   7 +
>>  Silicon/Hisilicon/Hisilicon.dsc.inc                                         |   1 +
>>  Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c               | 588 +++++++++++++++++
>>  Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.h               |  59 ++
>>  Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf |  89 +++
>>  Silicon/Hisilicon/Library/PlatformBootManagerLib/QuietBoot.c                | 681 ++++++++++++++++++++
>>  9 files changed, 1481 insertions(+), 2 deletions(-)
>>
>> diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc
>> index b434f68..f7efff5 100644
>> --- a/Platform/Hisilicon/D03/D03.dsc
>> +++ b/Platform/Hisilicon/D03/D03.dsc
>> @@ -28,6 +28,7 @@
>>    BUILD_TARGETS                  = DEBUG|RELEASE
>>    SKUID_IDENTIFIER               = DEFAULT
>>    FLASH_DEFINITION               = Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
>> +  DEFINE GENERIC_BDS             = TRUE
>>  
>>  !include Silicon/Hisilicon/Hisilicon.dsc.inc
>>  
>> @@ -68,6 +69,14 @@
>>    CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
>>    GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
>>    PlatformBdsLib|Silicon/Hisilicon/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
>> +!if $(GENERIC_BDS) == TRUE
>> +  UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
>> +  SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
>> +  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
>> +  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
>> +  PlatformBootManagerLib|Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
>> +  FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
>> +!endif
>>    CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
>>  
>>    # USB Requirements
>> @@ -188,6 +197,9 @@
>>  
>>    gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
>>    gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
>> +!if $(GENERIC_BDS) == TRUE
>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }|VOID*|0x0001006b
>> +!endif
>>  
>>    gHisiTokenSpaceGuid.PcdSysControlBaseAddress|0x40010000
>>    gHisiTokenSpaceGuid.PcdMailBoxAddress|0x0000FFF8
>> @@ -405,6 +417,14 @@
>>    MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>>    MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
>>  
>> +!if $(GENERIC_BDS) == TRUE
>> +  MdeModulePkg/Application/UiApp/UiApp.inf {
>> +    <LibraryClasses>
>> +      NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
>> +      NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
>> +      NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
>> +  }
>> +!endif
>>    MdeModulePkg/Application/HelloWorld/HelloWorld.inf
>>    #
>>    # Bds
>> @@ -457,7 +477,11 @@
>>  
>>    MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
>>    MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
>> +!if $(GENERIC_BDS) == TRUE
>> +  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>> +!else
>>    IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
>> +!endif
>>  
>>    #
>>    # UEFI application (Shell Embedded Boot Loader)
>> diff --git a/Platform/Hisilicon/D03/D03.fdf b/Platform/Hisilicon/D03/D03.fdf
>> index 0b38eb4..0d704b5 100644
>> --- a/Platform/Hisilicon/D03/D03.fdf
>> +++ b/Platform/Hisilicon/D03/D03.fdf
>> @@ -283,6 +283,9 @@ READ_LOCK_STATUS   = TRUE
>>    INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
>>  !endif #$(INCLUDE_TFTP_COMMAND)
>>  
>> +!if $(GENERIC_BDS) == TRUE
>> +  INF MdeModulePkg/Application/UiApp/UiApp.inf
>> +!endif
>>    #
>>    # Bds
>>    #
>> @@ -291,7 +294,11 @@ READ_LOCK_STATUS   = TRUE
>>    INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
>>    INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
>>    INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
>> +!if $(GENERIC_BDS) == TRUE
>> +  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>> +!else
>>    INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
>> +!endif
>>  
>>  [FV.FVMAIN_COMPACT]
>>  FvAlignment        = 16
>> diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
>> index 710339c..57370dc 100644
>> --- a/Platform/Hisilicon/D05/D05.dsc
>> +++ b/Platform/Hisilicon/D05/D05.dsc
>> @@ -31,7 +31,7 @@
>>    DEFINE EDK2_SKIP_PEICORE=0
>>    DEFINE NETWORK_IP6_ENABLE      = FALSE
>>    DEFINE HTTP_BOOT_ENABLE        = FALSE
>> -
>> +  DEFINE GENERIC_BDS             = TRUE
> 
> Please don't randomly drop whitespace or move it around.
> 
>>  !include Silicon/Hisilicon/Hisilicon.dsc.inc
>>  
>>  [LibraryClasses.common]
>> @@ -84,6 +84,14 @@
>>    CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
>>    GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
>>    PlatformBdsLib|Silicon/Hisilicon/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf
>> +!if $(GENERIC_BDS) == TRUE
>> +  UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
>> +  SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
>> +  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
>> +  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
>> +  PlatformBootManagerLib|Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
>> +  FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
>> +!endif
>>    CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
>>  
>>    # USB Requirements
>> @@ -119,6 +127,7 @@
>>    #  It could be set FALSE to save size.
>>    gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
>>    gHisiTokenSpaceGuid.PcdIsItsSupported|TRUE
>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdHiiOsRuntimeSupport|FALSE
>>  
>>  [PcdsFixedAtBuild.common]
>>    gArmPlatformTokenSpaceGuid.PcdCoreCount|8
>> @@ -203,7 +212,9 @@
>>  
>>    gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
>>    gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
>> -
> 
> Please don't randomly drop whitespace or move it around.
> 
>> +!if $(GENERIC_BDS) == TRUE
>> +  gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }|VOID*|0x0001006b
>> +!endif
>>    gHisiTokenSpaceGuid.PcdSysControlBaseAddress|0x40010000
>>    gHisiTokenSpaceGuid.PcdMailBoxAddress|0x0000FFF8
>>  
>> @@ -560,6 +571,14 @@
>>    MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
>>    MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
>>  
>> +!if $(GENERIC_BDS) == TRUE
>> +  MdeModulePkg/Application/UiApp/UiApp.inf {
>> +    <LibraryClasses>
>> +      NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
>> +      NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
>> +      NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
>> +  }
>> +!endif
>>    #
>>    # Bds
>>    #
>> @@ -610,7 +629,11 @@
>>    MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
>>    MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
>>    MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
>> +!if $(GENERIC_BDS) == TRUE
>> +  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>> +!else
>>    IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
>> +!endif
>>    #
>>    # UEFI application (Shell Embedded Boot Loader)
>>    #
>> diff --git a/Platform/Hisilicon/D05/D05.fdf b/Platform/Hisilicon/D05/D05.fdf
>> index 97de4d2..d209210 100644
>> --- a/Platform/Hisilicon/D05/D05.fdf
>> +++ b/Platform/Hisilicon/D05/D05.fdf
>> @@ -305,6 +305,9 @@ READ_LOCK_STATUS   = TRUE
>>    INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
>>  !endif #$(INCLUDE_TFTP_COMMAND)
>>  
>> +!if $(GENERIC_BDS) == TRUE
>> +  INF MdeModulePkg/Application/UiApp/UiApp.inf
>> +!endif
>>    #
>>    # Bds
>>    #
>> @@ -313,7 +316,11 @@ READ_LOCK_STATUS   = TRUE
>>    INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
>>    INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
>>    INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
>> +!if $(GENERIC_BDS) == TRUE
>> +  INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>> +!else
>>    INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
>> +!endif
>>  
>>  [FV.FVMAIN_COMPACT]
>>  FvAlignment        = 16
>> diff --git a/Silicon/Hisilicon/Hisilicon.dsc.inc b/Silicon/Hisilicon/Hisilicon.dsc.inc
>> index cc23673..308064b 100644
>> --- a/Silicon/Hisilicon/Hisilicon.dsc.inc
>> +++ b/Silicon/Hisilicon/Hisilicon.dsc.inc
>> @@ -263,6 +263,7 @@
>>    gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1
>>    gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0
>>    gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320
>> +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
>>  
>>    # DEBUG_ASSERT_ENABLED       0x01
>>    # DEBUG_PRINT_ENABLED        0x02
>> diff --git a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c
>> new file mode 100644
>> index 0000000..5d8d58e
>> --- /dev/null
>> +++ b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.c
>> @@ -0,0 +1,588 @@
>> +/** @file
>> +  Implementation for PlatformBootManagerLib library class interfaces.
>> +
>> +  Copyright (c) 2018, ARM Ltd. All rights reserved.<BR>
>> +  Copyright (c) 2018, Hisilicon Limited. All rights reserved.
>> +  Copyright (c) 2018, Linaro Ltd. 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.
>> +
>> +**/
>> +
>> +#include <IndustryStandard/Pci22.h>
>> +#include <Library/DevicePathLib.h>
>> +#include <Library/PcdLib.h>
>> +#include <Library/UefiBootManagerLib.h>
>> +#include <Library/UefiLib.h>
>> +#include <Protocol/DevicePath.h>
>> +#include <Protocol/EsrtManagement.h>
>> +#include <Protocol/GenericMemoryTest.h>
>> +#include <Protocol/GraphicsOutput.h>
>> +#include <Protocol/LoadedImage.h>
>> +#include <Protocol/PciIo.h>
>> +#include <Protocol/PciRootBridgeIo.h>
>> +#include <Guid/EventGroup.h>
>> +#include <Guid/TtyTerm.h>
>> +
>> +#include "PlatformBm.h"
>> +
>> +#define DP_NODE_LEN(Type) { (UINT8)sizeof (Type), (UINT8)(sizeof (Type) >> 8) }
>> +
>> +
>> +#pragma pack (1)
>> +typedef struct {
>> +  VENDOR_DEVICE_PATH         SerialDxe;
>> +  UART_DEVICE_PATH           Uart;
>> +  VENDOR_DEFINED_DEVICE_PATH TermType;
>> +  EFI_DEVICE_PATH_PROTOCOL   End;
>> +} PLATFORM_SERIAL_CONSOLE;
>> +#pragma pack ()
>> +
>> +#define SERIAL_DXE_FILE_GUID { \
>> +          0xD3987D4B, 0x971A, 0x435F, \
>> +          { 0x8C, 0xAF, 0x49, 0x67, 0xEB, 0x62, 0x72, 0x41 } \
>> +          }
>> +
>> +EFI_GUID   EblAppGuid2 = {0x3CEF354A,0x3B7A,0x4519,{0xAD,0x70,0x72,0xA1,0x34,0x69,0x83,0x11}};
>> +
>> +STATIC PLATFORM_SERIAL_CONSOLE mSerialConsole = {
>> +  //
>> +  // VENDOR_DEVICE_PATH SerialDxe
>> +  //
>> +  {
>> +    { HARDWARE_DEVICE_PATH, HW_VENDOR_DP, DP_NODE_LEN (VENDOR_DEVICE_PATH) },
>> +    SERIAL_DXE_FILE_GUID
>> +  },
>> +
>> +  //
>> +  // UART_DEVICE_PATH Uart
>> +  //
>> +  {
>> +    { MESSAGING_DEVICE_PATH, MSG_UART_DP, DP_NODE_LEN (UART_DEVICE_PATH) },
>> +    0,                                      // Reserved
>> +    FixedPcdGet64 (PcdUartDefaultBaudRate), // BaudRate
>> +    FixedPcdGet8 (PcdUartDefaultDataBits),  // DataBits
>> +    FixedPcdGet8 (PcdUartDefaultParity),    // Parity
>> +    FixedPcdGet8 (PcdUartDefaultStopBits)   // StopBits
>> +  },
>> +
>> +  //
>> +  // VENDOR_DEFINED_DEVICE_PATH TermType
>> +  //
>> +  {
>> +    {
>> +      MESSAGING_DEVICE_PATH, MSG_VENDOR_DP,
>> +      DP_NODE_LEN (VENDOR_DEFINED_DEVICE_PATH)
>> +    }
>> +    //
>> +    // Guid to be filled in dynamically
>> +    //
>> +  },
>> +
>> +  //
>> +  // EFI_DEVICE_PATH_PROTOCOL End
>> +  //
>> +  {
>> +    END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
>> +    DP_NODE_LEN (EFI_DEVICE_PATH_PROTOCOL)
>> +  }
>> +};
>> +
>> +
>> +#pragma pack (1)
>> +typedef struct {
>> +  USB_CLASS_DEVICE_PATH    Keyboard;
>> +  EFI_DEVICE_PATH_PROTOCOL End;
>> +} PLATFORM_USB_KEYBOARD;
>> +#pragma pack ()
>> +
>> +STATIC PLATFORM_USB_KEYBOARD mUsbKeyboard = {
>> +  //
>> +  // USB_CLASS_DEVICE_PATH Keyboard
>> +  //
>> +  {
>> +    {
>> +      MESSAGING_DEVICE_PATH, MSG_USB_CLASS_DP,
>> +      DP_NODE_LEN (USB_CLASS_DEVICE_PATH)
>> +    },
>> +    0xFFFF, // VendorId: any
>> +    0xFFFF, // ProductId: any
>> +    3,      // DeviceClass: HID
>> +    1,      // DeviceSubClass: boot
>> +    1       // DeviceProtocol: keyboard
>> +  },
>> +
>> +  //
>> +  // EFI_DEVICE_PATH_PROTOCOL End
>> +  //
>> +  {
>> +    END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
>> +    DP_NODE_LEN (EFI_DEVICE_PATH_PROTOCOL)
>> +  }
>> +};
>> +
>> +
>> +/**
>> +  Check if the handle satisfies a particular condition.
>> +
>> +  @param[in] Handle      The handle to check.
>> +  @param[in] ReportText  A caller-allocated string passed in for reporting
>> +                         purposes. It must never be NULL.
>> +
>> +  @retval TRUE   The condition is satisfied.
>> +  @retval FALSE  Otherwise. This includes the case when the condition could not
>> +                 be fully evaluated due to an error.
>> +**/
>> +typedef
>> +BOOLEAN
>> +(EFIAPI *FILTER_FUNCTION) (
>> +  IN EFI_HANDLE   Handle,
>> +  IN CONST CHAR16 *ReportText
>> +  );
>> +
>> +
>> +/**
>> +  Process a handle.
>> +
>> +  @param[in] Handle      The handle to process.
>> +  @param[in] ReportText  A caller-allocated string passed in for reporting
>> +                         purposes. It must never be NULL.
>> +**/
>> +typedef
>> +VOID
>> +(EFIAPI *CALLBACK_FUNCTION)  (
>> +  IN EFI_HANDLE   Handle,
>> +  IN CONST CHAR16 *ReportText
>> +  );
>> +
>> +/**
>> +  Locate all handles that carry the specified protocol, filter them with a
>> +  callback function, and pass each handle that passes the filter to another
>> +  callback.
>> +
>> +  @param[in] ProtocolGuid  The protocol to look for.
>> +
>> +  @param[in] Filter        The filter function to pass each handle to. If this
>> +                           parameter is NULL, then all handles are processed.
>> +
>> +  @param[in] Process       The callback function to pass each handle to that
>> +                           clears the filter.
>> +**/
>> +STATIC
>> +VOID
>> +FilterAndProcess (
>> +  IN EFI_GUID          *ProtocolGuid,
>> +  IN FILTER_FUNCTION   Filter         OPTIONAL,
>> +  IN CALLBACK_FUNCTION Process
>> +  )
>> +{
>> +  EFI_STATUS Status;
>> +  EFI_HANDLE *Handles;
>> +  UINTN      NoHandles;
>> +  UINTN      Idx;
>> +
>> +  Status = gBS->LocateHandleBuffer (ByProtocol, ProtocolGuid,
>> +                  NULL /* SearchKey */, &NoHandles, &Handles);
>> +  if (EFI_ERROR (Status)) {
>> +    //
>> +    // This is not an error, just an informative condition.
>> +    //
>> +    DEBUG ((DEBUG_VERBOSE, "%a: %g: %r\n", __FUNCTION__, ProtocolGuid,
>> +      Status));
>> +    return;
>> +  }
>> +
>> +  ASSERT (NoHandles > 0);
>> +  for (Idx = 0; Idx < NoHandles; ++Idx) {
>> +    CHAR16        *DevicePathText;
>> +    STATIC CHAR16 Fallback[] = L"<device path unavailable>";
>> +
>> +    //
>> +    // The ConvertDevicePathToText() function handles NULL input transparently.
>> +    //
>> +    DevicePathText = ConvertDevicePathToText (
>> +                       DevicePathFromHandle (Handles[Idx]),
>> +                       FALSE, // DisplayOnly
>> +                       FALSE  // AllowShortcuts
>> +                       );
>> +    if (DevicePathText == NULL) {
>> +      DevicePathText = Fallback;
>> +    }
>> +
>> +    if (Filter == NULL || Filter (Handles[Idx], DevicePathText)) {
>> +      Process (Handles[Idx], DevicePathText);
>> +    }
>> +
>> +    if (DevicePathText != Fallback) {
>> +      FreePool (DevicePathText);
>> +    }
>> +  }
>> +  gBS->FreePool (Handles);
>> +}
>> +
>> +
>> +/**
>> +  This FILTER_FUNCTION checks if a handle corresponds to a PCI display device.
>> +**/
>> +STATIC
>> +BOOLEAN
>> +EFIAPI
>> +IsPciDisplay (
>> +  IN EFI_HANDLE   Handle,
>> +  IN CONST CHAR16 *ReportText
>> +  )
>> +{
>> +  EFI_STATUS          Status;
>> +  EFI_PCI_IO_PROTOCOL *PciIo;
>> +  PCI_TYPE00          Pci;
>> +
>> +  Status = gBS->HandleProtocol (Handle, &gEfiPciIoProtocolGuid,
>> +                  (VOID**)&PciIo);
>> +  if (EFI_ERROR (Status)) {
>> +    //
>> +    // This is not an error worth reporting.
>> +    //
>> +    return FALSE;
>> +  }
>> +
>> +  Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, 0 /* Offset */,
>> +                        sizeof Pci / sizeof (UINT32), &Pci);
>> +  if (EFI_ERROR (Status)) {
>> +    DEBUG ((DEBUG_ERROR, "%a: %s: %r\n", __FUNCTION__, ReportText, Status));
>> +    return FALSE;
>> +  }
>> +
>> +  return IS_PCI_DISPLAY (&Pci);
>> +}
>> +
>> +
>> +/**
>> +  This CALLBACK_FUNCTION attempts to connect a handle non-recursively, asking
>> +  the matching driver to produce all first-level child handles.
>> +**/
>> +STATIC
>> +VOID
>> +EFIAPI
>> +Connect (
>> +  IN EFI_HANDLE   Handle,
>> +  IN CONST CHAR16 *ReportText
>> +  )
>> +{
>> +  EFI_STATUS Status;
>> +
>> +  Status = gBS->ConnectController (
>> +                  Handle, // ControllerHandle
>> +                  NULL,   // DriverImageHandle
>> +                  NULL,   // RemainingDevicePath -- produce all children
>> +                  FALSE   // Recursive
>> +                  );
>> +  DEBUG ((EFI_ERROR (Status) ? DEBUG_ERROR : DEBUG_VERBOSE, "%a: %s: %r\n",
>> +    __FUNCTION__, ReportText, Status));
>> +}
>> +
>> +
>> +/**
>> +  This CALLBACK_FUNCTION retrieves the EFI_DEVICE_PATH_PROTOCOL from the
>> +  handle, and adds it to ConOut and ErrOut.
>> +**/
>> +STATIC
>> +VOID
>> +EFIAPI
>> +AddOutput (
>> +  IN EFI_HANDLE   Handle,
>> +  IN CONST CHAR16 *ReportText
>> +  )
>> +{
>> +  EFI_STATUS               Status;
>> +  EFI_DEVICE_PATH_PROTOCOL *DevicePath;
>> +
>> +  DevicePath = DevicePathFromHandle (Handle);
>> +  if (DevicePath == NULL) {
>> +    DEBUG ((DEBUG_ERROR, "%a: %s: handle %p: device path not found\n",
>> +      __FUNCTION__, ReportText, Handle));
>> +    return;
>> +  }
>> +
>> +  Status = EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);
>> +  if (EFI_ERROR (Status)) {
>> +    DEBUG ((DEBUG_ERROR, "%a: %s: adding to ConOut: %r\n", __FUNCTION__,
>> +      ReportText, Status));
>> +    return;
>> +  }
>> +
>> +  Status = EfiBootManagerUpdateConsoleVariable (ErrOut, DevicePath, NULL);
>> +  if (EFI_ERROR (Status)) {
>> +    DEBUG ((DEBUG_ERROR, "%a: %s: adding to ErrOut: %r\n", __FUNCTION__,
>> +      ReportText, Status));
>> +    return;
>> +  }
>> +
>> +  DEBUG ((DEBUG_VERBOSE, "%a: %s: added to ConOut and ErrOut\n", __FUNCTION__,
>> +    ReportText));
>> +}
>> +
>> +STATIC
>> +VOID
>> +PlatformRegisterFvBootOption (
>> +  EFI_GUID                         *FileGuid,
>> +  CHAR16                           *Description,
>> +  UINT32                           Attributes
>> +  )
>> +{
>> +  EFI_STATUS                        Status;
>> +  INTN                              OptionIndex;
>> +  EFI_BOOT_MANAGER_LOAD_OPTION      NewOption;
>> +  EFI_BOOT_MANAGER_LOAD_OPTION      *BootOptions;
>> +  UINTN                             BootOptionCount;
>> +  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;
>> +  EFI_LOADED_IMAGE_PROTOCOL         *LoadedImage;
>> +  EFI_DEVICE_PATH_PROTOCOL          *DevicePath;
>> +
>> +  Status = gBS->HandleProtocol (
>> +                  gImageHandle,
>> +                  &gEfiLoadedImageProtocolGuid,
>> +                  (VOID **) &LoadedImage
>> +                  );
>> +  ASSERT_EFI_ERROR (Status);
>> +
>> +  EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid);
>> +  DevicePath = DevicePathFromHandle (LoadedImage->DeviceHandle);
>> +  ASSERT (DevicePath != NULL);
>> +  DevicePath = AppendDevicePathNode (
>> +                 DevicePath,
>> +                 (EFI_DEVICE_PATH_PROTOCOL *) &FileNode
>> +                 );
>> +  ASSERT (DevicePath != NULL);
>> +
>> +  Status = EfiBootManagerInitializeLoadOption (
>> +             &NewOption,
>> +             LoadOptionNumberUnassigned,
>> +             LoadOptionTypeBoot,
>> +             Attributes,
>> +             Description,
>> +             DevicePath,
>> +             NULL,
>> +             0
>> +             );
>> +  ASSERT_EFI_ERROR (Status);
>> +  FreePool (DevicePath);
>> +
>> +  BootOptions = EfiBootManagerGetLoadOptions (
>> +                  &BootOptionCount, LoadOptionTypeBoot
>> +                  );
>> +
>> +  OptionIndex = EfiBootManagerFindLoadOption (
>> +                  &NewOption, BootOptions, BootOptionCount
>> +                  );
>> +
>> +  if (OptionIndex == -1) {
>> +    Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN);
>> +    ASSERT_EFI_ERROR (Status);
>> +  }
>> +  EfiBootManagerFreeLoadOption (&NewOption);
>> +  EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);
>> +}
>> +
>> +
>> +STATIC
>> +VOID
>> +PlatformRegisterOptionsAndKeys (
>> +  VOID
>> +  )
>> +{
>> +  EFI_STATUS                   Status;
>> +  EFI_INPUT_KEY                Enter;
>> +  EFI_INPUT_KEY                F2;
>> +  EFI_INPUT_KEY                Esc;
>> +  EFI_BOOT_MANAGER_LOAD_OPTION BootOption;
>> +
>> +  //
>> +  // Register ENTER as CONTINUE key
>> +  //
>> +  Enter.ScanCode    = SCAN_NULL;
>> +  Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;
>> +  Status = EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);
>> +  ASSERT_EFI_ERROR (Status);
>> +
>> +  //
>> +  // Map F2 and ESC to Boot Manager Menu
>> +  //
>> +  F2.ScanCode     = SCAN_F2;
>> +  F2.UnicodeChar  = CHAR_NULL;
>> +  Esc.ScanCode    = SCAN_ESC;
>> +  Esc.UnicodeChar = CHAR_NULL;
>> +
>> +  Status = EfiBootManagerGetBootManagerMenu (&BootOption);
>> +  ASSERT_EFI_ERROR (Status);
>> +  Status = EfiBootManagerAddKeyOptionVariable (
>> +             NULL, (UINT16) BootOption.OptionNumber, 0, &F2, NULL
>> +             );
>> +  ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
>> +  Status = EfiBootManagerAddKeyOptionVariable (
>> +             NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL
>> +             );
>> +  ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);
>> +}
>> +
>> +VOID
>> +UpdateMemory (
>> +  )
>> +{
>> +  EFI_STATUS                          Status;
>> +  EFI_GENERIC_MEMORY_TEST_PROTOCOL*   MemoryTest;
>> +  BOOLEAN                             RequireSoftECCInit = FALSE;
>> +
>> +  //Add MemoryTest for memmap add above 4G memory.
>> +  Status = gBS->LocateProtocol (&gEfiGenericMemTestProtocolGuid, NULL, (VOID**)&MemoryTest);
> 
> Line length.
> 
>> +  if (!EFI_ERROR (Status)) {
>> +    (VOID)MemoryTest->MemoryTestInit (MemoryTest, IGNORE, &RequireSoftECCInit);
>> +  } else {
>> +    DEBUG ((DEBUG_ERROR, "LocateProtocol for GenericMemTestProtocol fail(%r)\n", Status));
> 
> Line length.
> 
>> +  }
>> +
>> +  return;
>> +}
>> +
>> +//
>> +// BDS Platform Functions
>> +//
>> +/**
>> +  Do the platform init, can be customized by OEM/IBV
>> +  Possible things that can be done in PlatformBootManagerBeforeConsole:
>> +  > Update console variable: 1. include hot-plug devices;
>> +  >                          2. Clear ConIn and add SOL for AMT
>> +  > Register new Driver#### or Boot####
>> +  > Register new Key####: e.g.: F12
>> +  > Signal ReadyToLock event
>> +  > Authentication action: 1. connect Auth devices;
>> +  >                        2. Identify auto logon user.
> 
> Please don't use ">" in this way, it confuses review (at least for me).
> 
>> +**/
>> +VOID
>> +EFIAPI
>> +PlatformBootManagerBeforeConsole (
>> +  VOID
>> +  )
>> +{
>> +  //
>> +  // Signal EndOfDxe PI Event
>> +  //
>> +  EfiEventGroupSignal (&gEfiEndOfDxeEventGroupGuid);
>> +
>> +  UpdateMemory ();
>> +
>> +  //
>> +  // Locate the PCI root bridges and make the PCI bus driver connect each,
>> +  // non-recursively. This will produce a number of child handles with PciIo on
>> +  // them.
>> +  //
>> +  FilterAndProcess (&gEfiPciRootBridgeIoProtocolGuid, NULL, Connect);
>> +
>> +  //
>> +  // Find all display class PCI devices (using the handles from the previous
>> +  // step), and connect them non-recursively. This should produce a number of
>> +  // child handles with GOPs on them.
>> +  //
>> +  FilterAndProcess (&gEfiPciIoProtocolGuid, IsPciDisplay, Connect);
>> +
>> +  //
>> +  // Now add the device path of all handles with GOP on them to ConOut and
>> +  // ErrOut.
>> +  //
>> +  FilterAndProcess (&gEfiGraphicsOutputProtocolGuid, NULL, AddOutput);
>> +
>> +  //
>> +  // Add the hardcoded short-form USB keyboard device path to ConIn.
>> +  //
>> +  EfiBootManagerUpdateConsoleVariable (ConIn,
>> +    (EFI_DEVICE_PATH_PROTOCOL *)&mUsbKeyboard, NULL);
>> +
>> +  //
>> +  // Add the hardcoded serial console device path to ConIn, ConOut, ErrOut.
>> +  //
>> +  ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) == 4);
>> +  CopyGuid (&mSerialConsole.TermType.Guid, &gEfiTtyTermGuid);
>> +
>> +  EfiBootManagerUpdateConsoleVariable (ConIn,
>> +    (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL);
>> +  EfiBootManagerUpdateConsoleVariable (ConOut,
>> +    (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL);
>> +  EfiBootManagerUpdateConsoleVariable (ErrOut,
>> +    (EFI_DEVICE_PATH_PROTOCOL *)&mSerialConsole, NULL);
>> +
>> +  //
>> +  // Register platform-specific boot options and keyboard shortcuts.
>> +  //
>> +  PlatformRegisterOptionsAndKeys ();
>> +}
>> +
>> +/**
>> +  Do the platform specific action after the console is ready
>> +  Possible things that can be done in PlatformBootManagerAfterConsole:
>> +  > Console post action:
>> +    > Dynamically switch output mode from 100x31 to 80x25 for certain senarino
>> +    > Signal console ready platform customized event
>> +  > Run diagnostics like memory testing
>> +  > Connect certain devices
>> +  > Dispatch aditional option roms
>> +  > Special boot: e.g.: USB boot, enter UI
> 
> Please don't use ">" in this way, it confuses review (at least for me).
> 
>> +**/
>> +VOID
>> +EFIAPI
>> +PlatformBootManagerAfterConsole (
>> +  VOID
>> +  )
>> +{
>> +  EFI_STATUS Status;
>> +  ESRT_MANAGEMENT_PROTOCOL           *EsrtManagement = NULL;
>> +
>> +  //
>> +  // Show the splash screen.
>> +  //
>> +  EnableQuietBoot (PcdGetPtr (PcdLogoFile));
>> +
>> +  //
>> +  // Connect the rest of the devices.
>> +  //
>> +  EfiBootManagerConnectAll ();
>> +
>> +  //
>> +  // Enumerate all possible boot options.
>> +  //
>> +  EfiBootManagerRefreshAllBootOption ();
>> +
>> +  //
>> +  //Sync Esrt Table
>> +  //
>> +  Status = gBS->LocateProtocol (&gEsrtManagementProtocolGuid, NULL, (VOID **)&EsrtManagement);
> 
> Line length.
> 
>> +  if (!EFI_ERROR (Status)) {
>> +    Status = EsrtManagement->SyncEsrtFmp ();
>> +  }
>> +
>> +  //
>> +  // Register UEFI Shell
>> +  //
>> +  PlatformRegisterFvBootOption (
>> +    PcdGetPtr (PcdShellFile), L"UEFI Shell", LOAD_OPTION_ACTIVE
>> +    );
>> +}
>> +
>> +/**
>> +  This function is called each second during the boot manager waits the
>> +  timeout.
>> +
>> +  @param TimeoutRemain  The remaining timeout.
>> +**/
>> +VOID
>> +EFIAPI
>> +PlatformBootManagerWaitCallback (
>> +  UINT16          TimeoutRemain
>> +  )
>> +{
>> +  Print(L"\r%-2d seconds left, Press Esc or F2 to enter Setup.", TimeoutRemain);
> 
> Space before (.
> 
>> +}
>> diff --git a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.h b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.h
>> new file mode 100644
>> index 0000000..0a3c626
>> --- /dev/null
>> +++ b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBm.h
>> @@ -0,0 +1,59 @@
>> +/** @file
>> +  Head file for BDS Platform specific code
>> +
>> +  Copyright (C) 2015-2016, Red Hat, Inc.
>> +  Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
>> +  Copyright (c) 2016, Linaro Ltd. 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.
>> +
>> +**/
>> +
>> +#ifndef _PLATFORM_BM_H_
>> +#define _PLATFORM_BM_H_
>> +
>> +#include <Library/BaseLib.h>
>> +#include <Library/BaseMemoryLib.h>
>> +#include <Library/DebugLib.h>
>> +#include <Library/DevicePathLib.h>
>> +#include <Library/MemoryAllocationLib.h>
>> +#include <Library/UefiBootServicesTableLib.h>
>> +#include <Library/UefiLib.h>
>> +#include <Library/UefiRuntimeServicesTableLib.h>
>> +
>> +/**
>> +  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.
>> +
>> +  @param[in]  LogoFile   File name of logo to display on the center of the
>> +                         screen.
>> +
>> +  @retval EFI_SUCCESS     ConsoleControl has been flipped to graphics and logo
>> +                          displayed.
>> +  @retval EFI_UNSUPPORTED Logo not found
>> +**/
>> +EFI_STATUS
>> +EnableQuietBoot (
>> +  IN  EFI_GUID  *LogoFile
>> +  );
>> +
>> +/**
>> +  Use SystemTable Conout to turn on video based Simple Text Out consoles. The
>> +  Simple Text Out screens will now be synced up with all non video output
>> +  devices
>> +
>> +  @retval EFI_SUCCESS     UGA devices are back in text mode and synced up.
>> +**/
>> +EFI_STATUS
>> +DisableQuietBoot (
>> +  VOID
>> +  );
>> +
>> +#endif // _PLATFORM_BM_H_
>> diff --git a/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
>> new file mode 100644
>> index 0000000..ae274f3
>> --- /dev/null
>> +++ b/Silicon/Hisilicon/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
>> @@ -0,0 +1,89 @@
>> +## @file
>> +#  Implementation for PlatformBootManagerLib library class interfaces.
>> +#
>> +#  Copyright (C) 2015-2016, Red Hat, Inc.
>> +#  Copyright (c) 2014, ARM Ltd. All rights reserved.<BR>
>> +#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
>> +#  Copyright (c) 2016, Linaro Ltd. 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.
>> +#
>> +##
>> +
>> +[Defines]
>> +  INF_VERSION                    = 0x00010005
> 
> 0x0001001a
> 
>> +  BASE_NAME                      = PlatformBootManagerLib
>> +  FILE_GUID                      = 92FD2DE3-B9CB-4B35-8141-42AD34D73C9F
>> +  MODULE_TYPE                    = DXE_DRIVER
>> +  VERSION_STRING                 = 1.0
>> +  LIBRARY_CLASS                  = PlatformBootManagerLib|DXE_DRIVER
>> +
>> +#
>> +# The following information is for reference only and not required by the build tools.
>> +#
>> +#  VALID_ARCHITECTURES           = ARM AARCH64
>> +#
>> +
>> +[Sources]
>> +  PlatformBm.c
>> +  QuietBoot.c
>> +
>> +[Packages]
>> +  IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
>> +  MdeModulePkg/MdeModulePkg.dec
>> +  MdePkg/MdePkg.dec
>> +  Silicon/Hisilicon/HisiPkg.dec
>> +
>> +[LibraryClasses]
>> +  BaseLib
>> +  BaseMemoryLib
>> +  DebugLib
>> +  DevicePathLib
>> +  DxeServicesLib
>> +  MemoryAllocationLib
>> +  PcdLib
>> +  PrintLib
>> +  UefiBootManagerLib
>> +  UefiBootServicesTableLib
>> +  UefiLib
>> +
>> +[FeaturePcd]
>> +  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBootlogoOnlyEnable
>> +  gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
>> +
>> +[FixedPcd]
>> +  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile
>> +  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile
>> +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate
>> +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits
>> +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
>> +  gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits
>> +  gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType
>> +
>> +[Pcd]
>> +  gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
>> +
>> +[Guids]
>> +  gEfiFileInfoGuid
>> +  gEfiFileSystemInfoGuid
>> +  gEfiFileSystemVolumeLabelInfoIdGuid
>> +  gEfiEndOfDxeEventGroupGuid
> 
> Please sort alphabetically (move gEfiEndOfDxeEventGroupGuid first).
> 
>> +  gEfiTtyTermGuid
>> +
>> +[Protocols]
>> +  gEfiDevicePathProtocolGuid
>> +  gEfiFirmwareVolume2ProtocolGuid
>> +  gEfiGenericMemTestProtocolGuid
>> +  gEfiGraphicsOutputProtocolGuid
>> +  gEfiLoadedImageProtocolGuid
>> +  gEfiOEMBadgingProtocolGuid
>> +  gEfiPciRootBridgeIoProtocolGuid
>> +  gEfiSimpleFileSystemProtocolGuid
>> +  gEsrtManagementProtocolGuid
>> diff --git a/Silicon/Hisilicon/Library/PlatformBootManagerLib/QuietBoot.c b/Silicon/Hisilicon/Library/PlatformBootManagerLib/QuietBoot.c
>> new file mode 100644
>> index 0000000..0bd15da
>> --- /dev/null
>> +++ b/Silicon/Hisilicon/Library/PlatformBootManagerLib/QuietBoot.c
>> @@ -0,0 +1,681 @@
>> +/** @file
>> +Platform BDS function for quiet boot support.
>> +
>> +Copyright (c) 2018, ARM Ltd. All rights reserved.<BR>
>> +Copyright (c) 2018, Hisilicon Limited. All rights reserved.
>> +Copyright (c) 2018, Linaro Ltd. 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.
>> +
>> +**/
>> +
>> +#include <IndustryStandard/Bmp.h>
>> +#include <Library/DxeServicesLib.h>
>> +#include <Protocol/BootLogo.h>
>> +#include <Protocol/OEMBadging.h>
>> +#include <Protocol/UgaDraw.h>
>> +
>> +#include "PlatformBm.h"
>> +
>> +/**
>> +  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.
>> +
>> +**/
>> +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)) {
> 
> Line length.
> 
>> +    return EFI_UNSUPPORTED;
>> +  }
>> +
>> +  //
>> +  // The data size in each line must be 4 byte alignment.
>> +  //
>> +  DataSizePerLine = ((BmpHeader->PixelWidth * BmpHeader->BitPerPixel + 31) >> 3) & (~0x3);
> 
> Line length.
> 
>> +  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)) {
> 
> Line length.
> 
> In general, this file seems to mainly duplicate generically useful
> functions found in various locations in the edk2 tree.
> Could this instead be broken out into one or several helper libraries
> to keep in edk2?
> 
> /
>     Leif
> 

Yes, this file QuietBoot.c will be deleted and replace with BootLogoLib in edk2 as Ard suggested.

>> +    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 - 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.
>> +
>> +  @param[in]  LogoFile   File name of logo to display on the center of the screen.
>> +
>> +  @retval EFI_SUCCESS     ConsoleControl has been flipped to graphics and logo displayed.
>> +  @retval EFI_UNSUPPORTED Logo not found
>> +
>> +**/
>> +EFI_STATUS
>> +EnableQuietBoot (
>> +  IN  EFI_GUID  *LogoFile
>> +  )
>> +{
>> +  EFI_STATUS                    Status;
>> +  EFI_OEM_BADGING_PROTOCOL      *Badging;
>> +  UINT32                        SizeOfX;
>> +  UINT32                        SizeOfY;
>> +  INTN                          DestX;
>> +  INTN                          DestY;
>> +  UINT8                         *ImageData;
>> +  UINTN                         ImageSize;
>> +  UINTN                         BltSize;
>> +  UINT32                        Instance;
>> +  EFI_BADGING_FORMAT            Format;
>> +  EFI_BADGING_DISPLAY_ATTRIBUTE Attribute;
>> +  UINTN                         CoordinateX;
>> +  UINTN                         CoordinateY;
>> +  UINTN                         Height;
>> +  UINTN                         Width;
>> +  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
>> +  EFI_UGA_DRAW_PROTOCOL         *UgaDraw;
>> +  UINT32                        ColorDepth;
>> +  UINT32                        RefreshRate;
>> +  EFI_GRAPHICS_OUTPUT_PROTOCOL  *GraphicsOutput;
>> +  EFI_BOOT_LOGO_PROTOCOL        *BootLogo;
>> +  UINTN                         NumberOfLogos;
>> +  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LogoBlt;
>> +  UINTN                         LogoDestX;
>> +  UINTN                         LogoDestY;
>> +  UINTN                         LogoHeight;
>> +  UINTN                         LogoWidth;
>> +  UINTN                         NewDestX;
>> +  UINTN                         NewDestY;
>> +  UINTN                         NewHeight;
>> +  UINTN                         NewWidth;
>> +  UINT64                        BufferSize;
>> +
>> +  UgaDraw = NULL;
>> +  //
>> +  // Try to open GOP first
>> +  //
>> +  Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput);
>> +  if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {
>> +    GraphicsOutput = NULL;
>> +    //
>> +    // Open GOP failed, try to open UGA
>> +    //
>> +    Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw);
>> +  }
>> +  if (EFI_ERROR (Status)) {
>> +    return EFI_UNSUPPORTED;
>> +  }
>> +
>> +  //
>> +  // Try to open Boot Logo Protocol.
>> +  //
>> +  BootLogo = NULL;
>> +  gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **) &BootLogo);
>> +
>> +  //
>> +  // Erase Cursor from screen
>> +  //
>> +  gST->ConOut->EnableCursor (gST->ConOut, FALSE);
>> +
>> +  Badging = NULL;
>> +  Status  = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID **) &Badging);
>> +
>> +  if (GraphicsOutput != NULL) {
>> +    SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;
>> +    SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;
>> +
>> +  } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
>> +    Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate);
>> +    if (EFI_ERROR (Status)) {
>> +      return EFI_UNSUPPORTED;
>> +    }
>> +  } else {
>> +    return EFI_UNSUPPORTED;
>> +  }
>> +
>> +  Blt = NULL;
>> +  NumberOfLogos = 0;
>> +  LogoDestX = 0;
>> +  LogoDestY = 0;
>> +  LogoHeight = 0;
>> +  LogoWidth = 0;
>> +  NewDestX = 0;
>> +  NewDestY = 0;
>> +  NewHeight = 0;
>> +  NewWidth = 0;
>> +  Instance = 0;
>> +  Height = 0;
>> +  Width = 0;
>> +  while (1) {
>> +    ImageData = NULL;
>> +    ImageSize = 0;
>> +
>> +    if (Badging != NULL) {
>> +      //
>> +      // Get image from OEMBadging protocol.
>> +      //
>> +      Status = Badging->GetImage (
>> +                          Badging,
>> +                          &Instance,
>> +                          &Format,
>> +                          &ImageData,
>> +                          &ImageSize,
>> +                          &Attribute,
>> +                          &CoordinateX,
>> +                          &CoordinateY
>> +                          );
>> +      if (EFI_ERROR (Status)) {
>> +        goto Done;
>> +      }
>> +
>> +      //
>> +      // Currently only support BMP format.
>> +      //
>> +      if (Format != EfiBadgingFormatBMP) {
>> +        if (ImageData != NULL) {
>> +          FreePool (ImageData);
>> +        }
>> +        continue;
>> +      }
>> +    } else {
>> +      //
>> +      // Get the specified image from FV.
>> +      //
>> +      Status = GetSectionFromAnyFv (LogoFile, EFI_SECTION_RAW, 0, (VOID **) &ImageData, &ImageSize);
>> +      if (EFI_ERROR (Status)) {
>> +        return EFI_UNSUPPORTED;
>> +      }
>> +
>> +      CoordinateX = 0;
>> +      CoordinateY = 0;
>> +      if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {
>> +        Attribute   = EfiBadgingDisplayAttributeCenter;
>> +      } else {
>> +        Attribute   = EfiBadgingDisplayAttributeCustomized;
>> +      }
>> +    }
>> +
>> +    if (Blt != NULL) {
>> +      FreePool (Blt);
>> +    }
>> +    Blt = NULL;
>> +    Status = ConvertBmpToGopBlt (
>> +              ImageData,
>> +              ImageSize,
>> +              (VOID **) &Blt,
>> +              &BltSize,
>> +              &Height,
>> +              &Width
>> +              );
>> +    if (EFI_ERROR (Status)) {
>> +      FreePool (ImageData);
>> +
>> +      if (Badging == NULL) {
>> +        return Status;
>> +      } else {
>> +        continue;
>> +      }
>> +    }
>> +
>> +    //
>> +    // Calculate the display position according to Attribute.
>> +    //
>> +    switch (Attribute) {
>> +    case EfiBadgingDisplayAttributeLeftTop:
>> +      DestX = CoordinateX;
>> +      DestY = CoordinateY;
>> +      break;
>> +
>> +    case EfiBadgingDisplayAttributeCenterTop:
>> +      DestX = (SizeOfX - Width) / 2;
>> +      DestY = CoordinateY;
>> +      break;
>> +
>> +    case EfiBadgingDisplayAttributeRightTop:
>> +      DestX = (SizeOfX - Width - CoordinateX);
>> +      DestY = CoordinateY;;
>> +      break;
>> +
>> +    case EfiBadgingDisplayAttributeCenterRight:
>> +      DestX = (SizeOfX - Width - CoordinateX);
>> +      DestY = (SizeOfY - Height) / 2;
>> +      break;
>> +
>> +    case EfiBadgingDisplayAttributeRightBottom:
>> +      DestX = (SizeOfX - Width - CoordinateX);
>> +      DestY = (SizeOfY - Height - CoordinateY);
>> +      break;
>> +
>> +    case EfiBadgingDisplayAttributeCenterBottom:
>> +      DestX = (SizeOfX - Width) / 2;
>> +      DestY = (SizeOfY - Height - CoordinateY);
>> +      break;
>> +
>> +    case EfiBadgingDisplayAttributeLeftBottom:
>> +      DestX = CoordinateX;
>> +      DestY = (SizeOfY - Height - CoordinateY);
>> +      break;
>> +
>> +    case EfiBadgingDisplayAttributeCenterLeft:
>> +      DestX = CoordinateX;
>> +      DestY = (SizeOfY - Height) / 2;
>> +      break;
>> +
>> +    case EfiBadgingDisplayAttributeCenter:
>> +      DestX = (SizeOfX - Width) / 2;
>> +      DestY = (SizeOfY - Height) / 2;
>> +      break;
>> +
>> +    case EfiBadgingDisplayAttributeCustomized:
>> +      DestX = (SizeOfX - Width) / 2;
>> +      DestY = ((SizeOfY * 382) / 1000) - Height / 2;
>> +      break;
>> +
>> +    default:
>> +      DestX = CoordinateX;
>> +      DestY = CoordinateY;
>> +      break;
>> +    }
>> +
>> +    if ((DestX >= 0) && (DestY >= 0)) {
>> +      if (GraphicsOutput != NULL) {
>> +        Status = GraphicsOutput->Blt (
>> +                            GraphicsOutput,
>> +                            Blt,
>> +                            EfiBltBufferToVideo,
>> +                            0,
>> +                            0,
>> +                            (UINTN) DestX,
>> +                            (UINTN) DestY,
>> +                            Width,
>> +                            Height,
>> +                            Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
>> +                            );
>> +      } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
>> +        Status = UgaDraw->Blt (
>> +                            UgaDraw,
>> +                            (EFI_UGA_PIXEL *) Blt,
>> +                            EfiUgaBltBufferToVideo,
>> +                            0,
>> +                            0,
>> +                            (UINTN) DestX,
>> +                            (UINTN) DestY,
>> +                            Width,
>> +                            Height,
>> +                            Width * sizeof (EFI_UGA_PIXEL)
>> +                            );
>> +      } else {
>> +        Status = EFI_UNSUPPORTED;
>> +      }
>> +
>> +      //
>> +      // Report displayed Logo information.
>> +      //
>> +      if (!EFI_ERROR (Status)) {
>> +        NumberOfLogos++;
>> +
>> +        if (LogoWidth == 0) {
>> +          //
>> +          // The first Logo.
>> +          //
>> +          LogoDestX = (UINTN) DestX;
>> +          LogoDestY = (UINTN) DestY;
>> +          LogoWidth = Width;
>> +          LogoHeight = Height;
>> +        } else {
>> +          //
>> +          // Merge new logo with old one.
>> +          //
>> +          NewDestX = MIN ((UINTN) DestX, LogoDestX);
>> +          NewDestY = MIN ((UINTN) DestY, LogoDestY);
>> +          NewWidth = MAX ((UINTN) DestX + Width, LogoDestX + LogoWidth) - NewDestX;
>> +          NewHeight = MAX ((UINTN) DestY + Height, LogoDestY + LogoHeight) - NewDestY;
>> +
>> +          LogoDestX = NewDestX;
>> +          LogoDestY = NewDestY;
>> +          LogoWidth = NewWidth;
>> +          LogoHeight = NewHeight;
>> +        }
>> +      }
>> +    }
>> +
>> +    FreePool (ImageData);
>> +
>> +    if (Badging == NULL) {
>> +      break;
>> +    }
>> +  }
>> +
>> +Done:
>> +  if (BootLogo == NULL || NumberOfLogos == 0) {
>> +    //
>> +    // No logo displayed.
>> +    //
>> +    if (Blt != NULL) {
>> +      FreePool (Blt);
>> +    }
>> +
>> +    return Status;
>> +  }
>> +
>> +  //
>> +  // Advertise displayed Logo information.
>> +  //
>> +  if (NumberOfLogos == 1) {
>> +    //
>> +    // Only one logo displayed, use its Blt buffer directly for BootLogo protocol.
>> +    //
>> +    LogoBlt = Blt;
>> +    Status = EFI_SUCCESS;
>> +  } else {
>> +    //
>> +    // More than one Logo displayed, get merged BltBuffer using VideoToBuffer operation.
>> +    //
>> +    if (Blt != NULL) {
>> +      FreePool (Blt);
>> +    }
>> +
>> +    //
>> +    // Ensure the LogoHeight * LogoWidth doesn't overflow
>> +    //
>> +    if (LogoHeight > DivU64x64Remainder ((UINTN) ~0, LogoWidth, NULL)) {
>> +      return EFI_UNSUPPORTED;
>> +    }
>> +    BufferSize = MultU64x64 (LogoWidth, LogoHeight);
>> +
>> +    //
>> +    // Ensure the BufferSize * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow
>> +    //
>> +    if (BufferSize > DivU64x32 ((UINTN) ~0, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {
>> +      return EFI_UNSUPPORTED;
>> +    }
>> +
>> +    LogoBlt = AllocateZeroPool ((UINTN)BufferSize * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
>> +    if (LogoBlt == NULL) {
>> +      return EFI_OUT_OF_RESOURCES;
>> +    }
>> +
>> +    if (GraphicsOutput != NULL) {
>> +      Status = GraphicsOutput->Blt (
>> +                          GraphicsOutput,
>> +                          LogoBlt,
>> +                          EfiBltVideoToBltBuffer,
>> +                          LogoDestX,
>> +                          LogoDestY,
>> +                          0,
>> +                          0,
>> +                          LogoWidth,
>> +                          LogoHeight,
>> +                          LogoWidth * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
>> +                          );
>> +    } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {
>> +      Status = UgaDraw->Blt (
>> +                          UgaDraw,
>> +                          (EFI_UGA_PIXEL *) LogoBlt,
>> +                          EfiUgaVideoToBltBuffer,
>> +                          LogoDestX,
>> +                          LogoDestY,
>> +                          0,
>> +                          0,
>> +                          LogoWidth,
>> +                          LogoHeight,
>> +                          LogoWidth * sizeof (EFI_UGA_PIXEL)
>> +                          );
>> +    } else {
>> +      Status = EFI_UNSUPPORTED;
>> +    }
>> +  }
>> +
>> +  if (!EFI_ERROR (Status)) {
>> +    BootLogo->SetBootLogo (BootLogo, LogoBlt, LogoDestX, LogoDestY, LogoWidth, LogoHeight);
>> +  }
>> +  FreePool (LogoBlt);
>> +
>> +  return Status;
>> +}
>> +
>> +/**
>> +  Use SystemTable Conout to turn on video based Simple Text Out consoles. The
>> +  Simple Text Out screens will now be synced up with all non video output devices
>> +
>> +  @retval EFI_SUCCESS     UGA devices are back in text mode and synced up.
>> +
>> +**/
>> +EFI_STATUS
>> +DisableQuietBoot (
>> +  VOID
>> +  )
>> +{
>> +
>> +  //
>> +  // Enable Cursor on Screen
>> +  //
>> +  gST->ConOut->EnableCursor (gST->ConOut, TRUE);
>> +  return EFI_SUCCESS;
>> +}
>> +
>> -- 
>> 1.9.1
>>
> 
> .
> 

-- 
Best Regards,

Ming



  reply	other threads:[~2018-01-23  5:58 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18 15:01 [PATCH edk2-platforms v1 00/14] Improve D0x platforms and bug fix Ming Huang
2018-01-18 15:01 ` [PATCH edk2-platforms v1 01/14] Hisilicon/D05: Add PPTT support Ming Huang
2018-01-20 10:16   ` Ard Biesheuvel
2018-01-22  9:16     ` Huangming (Mark)
2018-01-23  6:00     ` Huangming (Mark)
2018-01-22 13:53   ` Leif Lindholm
2018-01-22 14:15     ` Leif Lindholm
2018-01-24 13:49     ` graeme.gregory
2018-01-23 21:29   ` Jeremy Linton
2018-01-24  7:57     ` Huangming (Mark)
2018-01-25  5:56     ` Huangming (Mark)
2018-01-25 15:27       ` Jeremy Linton
2018-01-18 15:01 ` [PATCH edk2-platforms v1 02/14] Hisilicon D03/D05:Switch to Generic BDS driver Ming Huang
2018-01-20 10:27   ` Ard Biesheuvel
2018-01-22 18:38   ` Leif Lindholm
2018-01-23  6:03     ` Huangming (Mark) [this message]
2018-01-18 15:01 ` [PATCH edk2-platforms v1 03/14] Hisilicon D03/D05: Optimize the feature of BMC set boot option Ming Huang
2018-01-20 10:41   ` Ard Biesheuvel
2018-01-23  8:28     ` Huangming (Mark)
2018-01-23 10:28   ` Leif Lindholm
2018-01-23 10:51     ` Huangming (Mark)
2018-01-18 15:01 ` [PATCH edk2-platforms v1 04/14] Hisilicon D03/D05: Add capsule upgrade support Ming Huang
2018-01-20 10:50   ` Ard Biesheuvel
2018-01-23  8:53     ` Huangming (Mark)
2018-01-23  9:33       ` Ard Biesheuvel
2018-01-24 11:10     ` Huangming (Mark)
2018-01-24 11:21       ` Ard Biesheuvel
2018-01-25  0:53         ` Huangming (Mark)
2018-01-23 14:06   ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 05/14] Hisilicon D03/D05: Open SasPlatform source code Ming Huang
2018-01-20 10:57   ` Ard Biesheuvel
2018-01-23 11:01     ` Huangming (Mark)
2018-01-23 14:04   ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 06/14] Hisilicon D03/D05: Open SnpPlatform " Ming Huang
2018-01-20 11:00   ` Ard Biesheuvel
2018-01-23 11:01     ` Huangming (Mark)
2018-01-23 14:07   ` Leif Lindholm
2018-01-24 12:31     ` Huangming (Mark)
2018-01-24 13:47       ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 07/14] Hisilicon/Smbios: modify type 4 Ming Huang
2018-01-20 11:01   ` Ard Biesheuvel
2018-01-23 14:15   ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 08/14] Hisilicon/PCIe: Disable PCIe ASPM Ming Huang
2018-01-20 11:04   ` Ard Biesheuvel
2018-01-18 15:01 ` [PATCH edk2-platforms v1 09/14] Hisilicon/D05: Replace SP805Watchdog by WatchdogTimer driver Ming Huang
2018-01-20 11:05   ` Ard Biesheuvel
2018-01-23 14:21   ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 10/14] Hisilicon/D03: " Ming Huang
2018-01-20 11:05   ` Ard Biesheuvel
2018-01-23 14:21   ` Leif Lindholm
2018-01-18 15:01 ` [PATCH edk2-platforms v1 11/14] Hisilicon/D05/ACPI: Add ITS PXM Ming Huang
2018-01-20 11:06   ` Ard Biesheuvel
2018-01-18 15:01 ` [PATCH edk2-platforms v1 12/14] Hisilicon/D05/ACPI: Add Pcie, HNS and SAS PXM Ming Huang
2018-01-20 11:08   ` Ard Biesheuvel
2018-01-18 15:01 ` [PATCH edk2-platforms v1 13/14] Hisilicon/Library: Add OsBootLib Ming Huang
2018-01-20 11:11   ` Ard Biesheuvel
2018-01-23 10:23   ` Leif Lindholm
2018-01-27  1:47     ` Huangming (Mark)
2018-01-27 10:37       ` Ard Biesheuvel
2018-01-29  8:55         ` Huangming (Mark)
2018-01-29 10:19           ` Ard Biesheuvel
2018-01-29 11:16       ` Leif Lindholm
2018-02-07 21:16         ` Peter Jones
2018-02-11  6:03           ` Huangming (Mark)
2018-02-26  1:12           ` Guo Heyi
2018-01-18 15:01 ` [PATCH edk2-platforms v1 14/14] Hisilicon D03/D05: Update firmware version to 18.02 Ming Huang
2018-01-20 11:11   ` Ard Biesheuvel
2018-01-23 10:18   ` Leif Lindholm
2018-01-24  1:17     ` Huangming (Mark)
2018-01-24  7:54       ` Leif Lindholm
2018-01-22 13:26 ` [PATCH edk2-platforms v1 00/14] Improve D0x platforms and bug fix Leif Lindholm
2018-01-23 14:24 ` Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e897ca9-d05d-7f7a-1089-094f0530dc17@huawei.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox