Re: [edk2] [PATCH v6 edk2-platforms 6/6] Platform/HiKey: enable virtual keyboard

2018-05-25 Thread Leif Lindholm
On Thu, May 24, 2018 at 08:46:30AM +0800, Haojian Zhuang wrote:
> Enable virtual keyboard on HiKey platform. It detects the pattern
> in memory and GPIO pin setting, and simulates them into virtual
> key.
> 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Haojian Zhuang 

I think I already gave you a reviewed-by for this one for v4.

/
Leif

> ---
>  Platform/Hisilicon/HiKey/HiKey.dsc |  5 ++
>  Platform/Hisilicon/HiKey/HiKey.fdf |  5 ++
>  Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf |  5 ++
>  Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.h   |  5 ++
>  Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c   | 93 
>  5 files changed, 113 insertions(+)
> 
> diff --git a/Platform/Hisilicon/HiKey/HiKey.dsc 
> b/Platform/Hisilicon/HiKey/HiKey.dsc
> index 5cc4ff27f01b..83dd68a820b1 100644
> --- a/Platform/Hisilicon/HiKey/HiKey.dsc
> +++ b/Platform/Hisilicon/HiKey/HiKey.dsc
> @@ -192,6 +192,11 @@ [Components.common]
>Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf
>ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
>  
> +  #
> +  # Virtual Keyboard
> +  #
> +  EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboardDxe.inf
> +
>Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
>  
>#
> diff --git a/Platform/Hisilicon/HiKey/HiKey.fdf 
> b/Platform/Hisilicon/HiKey/HiKey.fdf
> index 39020d27dbcd..2bca7232b6e5 100644
> --- a/Platform/Hisilicon/HiKey/HiKey.fdf
> +++ b/Platform/Hisilicon/HiKey/HiKey.fdf
> @@ -123,6 +123,11 @@ [FV.FvMain]
>INF Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf
>INF ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
>  
> +  #
> +  # Virtual Keyboard
> +  #
> +  INF EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboardDxe.inf
> +
>INF Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
>  
>#
> diff --git a/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf 
> b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
> index 34734391b45a..41aa7f8081ed 100644
> --- a/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
> +++ b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
> @@ -28,11 +28,16 @@ [Packages]
>MdePkg/MdePkg.dec
>  
>  [LibraryClasses]
> +  CacheMaintenanceLib
>DebugLib
>IoLib
>UefiLib
>UefiDriverEntryPoint
>  
> +[Protocols]
> +  gEmbeddedGpioProtocolGuid
> +  gPlatformVirtualKeyboardProtocolGuid
> +
>  [Guids]
>gEfiEndOfDxeEventGroupGuid
>  
> diff --git a/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.h 
> b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.h
> index 07f9ae6a949a..3d608183fa58 100644
> --- a/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.h
> +++ b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.h
> @@ -15,10 +15,15 @@
>  #ifndef __HIKEYDXE_H__
>  #define __HIKEYDXE_H__
>  
> +#include 
>  #include 
>  #include 
> +#include 
>  #include 
>  
> +#include 
> +#include 
> +
>  #include 
>  #include 
>  
> diff --git a/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c 
> b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c
> index b812f8bd483d..afd2f050896a 100644
> --- a/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c
> +++ b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c
> @@ -43,6 +43,8 @@ UartInit (
>MmioWrite32 (PMUSSI_ONOFF8_REG, Val);
>  }
>  
> +STATIC EMBEDDED_GPIO*mGpio;
> +
>  STATIC
>  VOID
>  MtcmosInit (
> @@ -87,6 +89,90 @@ HiKeyInitPeripherals (
>  
>  EFI_STATUS
>  EFIAPI
> +VirtualKeyboardRegister (
> +  IN VOID
> +  )
> +{
> +  EFI_STATUS   Status;
> +
> +  Status = gBS->LocateProtocol (
> +  ,
> +  NULL,
> +  (VOID **) 
> +  );
> +  if (EFI_ERROR (Status)) {
> +return Status;
> +  }
> +  return EFI_SUCCESS;
> +}
> +
> +EFI_STATUS
> +EFIAPI
> +VirtualKeyboardReset (
> +  IN VOID
> +  )
> +{
> +  EFI_STATUS   Status;
> +
> +  if (mGpio == NULL) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +  Status = mGpio->Set (mGpio, DETECT_J15_FASTBOOT, GPIO_MODE_INPUT);
> +  return Status;
> +}
> +
> +BOOLEAN
> +EFIAPI
> +VirtualKeyboardQuery (
> +  IN VIRTUAL_KBD_KEY *VirtualKey
> +  )
> +{
> +  EFI_STATUS   Status;
> +  UINTNValue = 0;
> +
> +  if ((VirtualKey == NULL) || (mGpio == NULL)) {
> +return FALSE;
> +  }
> +  if (MmioRead32 (ADB_REBOOT_ADDRESS) == ADB_REBOOT_BOOTLOADER) {
> +goto Done;
> +  } else {
> +Status = mGpio->Get (mGpio, DETECT_J15_FASTBOOT, );
> +if (EFI_ERROR (Status) || (Value != 0)) {
> +  return FALSE;
> +}
> +  }
> +Done:
> +  VirtualKey->Signature = VIRTUAL_KEYBOARD_KEY_SIGNATURE;
> +  VirtualKey->Key.ScanCode = SCAN_NULL;
> +  VirtualKey->Key.UnicodeChar = L'f';
> +  return TRUE;
> +}
> +
> +EFI_STATUS
> +EFIAPI
> +VirtualKeyboardClear (
> +  IN VIRTUAL_KBD_KEY*VirtualKey
> +  )
> +{
> +  if (VirtualKey == NULL) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +  if 

Re: [edk2] [PATCH v6 edk2-platforms 5/6] Platform/HiKey: do basic initialization on hikey

2018-05-25 Thread Leif Lindholm
On Thu, May 24, 2018 at 08:46:29AM +0800, Haojian Zhuang wrote:
> Do some basic initialization on HiKey platform, such as pin
> setting, regulators and making peripherals out of reset mode.
> 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Haojian Zhuang 
> ---
>  Platform/Hisilicon/HiKey/HiKey.dsc|   3 +
>  Platform/Hisilicon/HiKey/HiKey.fdf|   3 +
>  Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf|  40 
>  Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.h  |  31 ++
>  Silicon/Hisilicon/Hi6220/Include/Hi6220.h |   6 ++
>  Silicon/Hisilicon/Hi6220/Include/Hi6220RegsPeri.h |  50 ++
>  Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c  | 102 
>  7 files changed, 235 insertions(+)
> 
> diff --git a/Platform/Hisilicon/HiKey/HiKey.dsc 
> b/Platform/Hisilicon/HiKey/HiKey.dsc
> index 5c1604d7f689..5cc4ff27f01b 100644
> --- a/Platform/Hisilicon/HiKey/HiKey.dsc
> +++ b/Platform/Hisilicon/HiKey/HiKey.dsc
> @@ -189,8 +189,11 @@ [Components.common]
>#
># GPIO
>#
> +  Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf
>ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
>  
> +  Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
> +
>#
># MMC/SD
>#
> diff --git a/Platform/Hisilicon/HiKey/HiKey.fdf 
> b/Platform/Hisilicon/HiKey/HiKey.fdf
> index 2a5c5a4d6e79..39020d27dbcd 100644
> --- a/Platform/Hisilicon/HiKey/HiKey.fdf
> +++ b/Platform/Hisilicon/HiKey/HiKey.fdf
> @@ -120,8 +120,11 @@ [FV.FvMain]
>#
># GPIO
>#
> +  INF Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf
>INF ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
>  
> +  INF Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
> +
>#
># Multimedia Card Interface
>#
> diff --git a/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf 
> b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
> new file mode 100644
> index ..34734391b45a
> --- /dev/null
> +++ b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
> @@ -0,0 +1,40 @@
> +#
> +#  Copyright (c) 2013 - 2014, ARM Ltd. All rights reserved.
> +#  Copyright (c) 2018, Linaro Ltd. All rights reserved.
> +#
> +#  This program and the accompanying materials
> +#  are licensed and made available under the terms and conditions of the BSD 
> License
> +#  which accompanies this distribution.  The full text of the license may be 
> found at
> +#  http://opensource.org/licenses/bsd-license.php
> +#
> +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> +#
> +
> +[Defines]
> +  INF_VERSION= 0x0001001a
> +  BASE_NAME  = HiKeyDxe
> +  FILE_GUID  = f567684b-1089-4214-8881-d64b20cbda2f
> +  MODULE_TYPE= DXE_DRIVER
> +  VERSION_STRING = 1.0
> +  ENTRY_POINT= HiKeyEntryPoint
> +
> +[Sources.common]
> +  HiKeyDxe.c
> +
> +[Packages]
> +  EmbeddedPkg/EmbeddedPkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  MdePkg/MdePkg.dec
> +
> +[LibraryClasses]
> +  DebugLib
> +  IoLib
> +  UefiLib
> +  UefiDriverEntryPoint
> +
> +[Guids]
> +  gEfiEndOfDxeEventGroupGuid
> +
> +[Depex]
> +  TRUE
> diff --git a/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.h 
> b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.h
> new file mode 100644
> index ..07f9ae6a949a
> --- /dev/null
> +++ b/Platform/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.h
> @@ -0,0 +1,31 @@
> +/** @file
> +*
> +*  Copyright (c) 2018, Linaro Ltd. All rights reserved.
> +*
> +*  This program and the accompanying materials
> +*  are licensed and made available under the terms and conditions of the BSD 
> License
> +*  which accompanies this distribution.  The full text of the license may be 
> found at
> +*  http://opensource.org/licenses/bsd-license.php
> +*
> +*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> +*
> +**/
> +
> +#ifndef __HIKEYDXE_H__
> +#define __HIKEYDXE_H__
> +
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 

Like 2/6 please include only files needed by declarations in the
.h file itself, let the .c file make its own includes.

/
Leif

> +
> +#define DETECT_J15_FASTBOOT  24   // GPIO3_0
> +
> +#define ADB_REBOOT_ADDRESS   0x05F01000
> +#define ADB_REBOOT_BOOTLOADER0x77665500
> +#define ADB_REBOOT_NONE  0x77665501
> +
> +#endif /* __HIKEYDXE_H__ */
> diff --git a/Silicon/Hisilicon/Hi6220/Include/Hi6220.h 
> b/Silicon/Hisilicon/Hi6220/Include/Hi6220.h
> index 203424adfc8b..9b2508955772 100644
> --- a/Silicon/Hisilicon/Hi6220/Include/Hi6220.h
> +++ 

Re: [edk2] [PATCH v6 edk2-platforms 3/6] Platform/HiKey960: enable virtual keyboard

2018-05-25 Thread Leif Lindholm
On Thu, May 24, 2018 at 08:46:27AM +0800, Haojian Zhuang wrote:
> Enable virtual keyboard on HiKey960 platform. It checks two
> conditions, such as pattern in memory and GPIO pin setting.
> Since code is ported from non-open
> 
> The hardcoding code is taken from non-open reference code.
> Can't fix it for lack of documents.
> 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Haojian Zhuang 

Reviewed-by: Leif Lindholm 

> ---
>  Platform/Hisilicon/HiKey960/HiKey960.dsc|  5 +
>  Platform/Hisilicon/HiKey960/HiKey960.fdf|  5 +
>  Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf |  1 +
>  Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.h   | 10 ++
>  Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c   | 97 
> 
>  5 files changed, 118 insertions(+)
> 
> diff --git a/Platform/Hisilicon/HiKey960/HiKey960.dsc 
> b/Platform/Hisilicon/HiKey960/HiKey960.dsc
> index 6cc1c1edf453..79e68754976d 100644
> --- a/Platform/Hisilicon/HiKey960/HiKey960.dsc
> +++ b/Platform/Hisilicon/HiKey960/HiKey960.dsc
> @@ -182,6 +182,11 @@ [Components.common]
>Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
>ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
>  
> +  #
> +  # Virtual Keyboard
> +  #
> +  EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboardDxe.inf
> +
>Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf
>  
>#
> diff --git a/Platform/Hisilicon/HiKey960/HiKey960.fdf 
> b/Platform/Hisilicon/HiKey960/HiKey960.fdf
> index b7d70b010598..d65f77878575 100644
> --- a/Platform/Hisilicon/HiKey960/HiKey960.fdf
> +++ b/Platform/Hisilicon/HiKey960/HiKey960.fdf
> @@ -123,6 +123,11 @@ [FV.FvMain]
>INF Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
>INF ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
>  
> +  #
> +  # Virtual Keyboard
> +  #
> +  INF EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboardDxe.inf
> +
>INF Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf
>  
>#
> diff --git a/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf 
> b/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf
> index a1a7d005ce8b..46a9a5803e3d 100644
> --- a/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf
> +++ b/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf
> @@ -39,6 +39,7 @@ [LibraryClasses]
>  
>  [Protocols]
>gEmbeddedGpioProtocolGuid
> +  gPlatformVirtualKeyboardProtocolGuid
>  
>  [Guids]
>gEfiEndOfDxeEventGroupGuid
> diff --git a/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.h 
> b/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.h
> index 9a4c66f42c50..211eea55aa54 100644
> --- a/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.h
> +++ b/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.h
> @@ -21,6 +21,7 @@
>  
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -29,6 +30,15 @@
>  #include 
>  #include 
>  
> +#include 
> +#include 
> +
> +#define ADB_REBOOT_ADDRESS   0x3210
> +#define ADB_REBOOT_BOOTLOADER0x77665500
> +#define ADB_REBOOT_NONE  0x77665501
> +
> +#define DETECT_SW_FASTBOOT   68// GPIO8_4
> +
>  enum {
>BOOT_MODE_RECOVERY  = 0,
>BOOT_MODE_MASK = 1,
> diff --git a/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c 
> b/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c
> index 7c1705241e88..7ff2f118128d 100644
> --- a/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c
> +++ b/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c
> @@ -14,6 +14,8 @@
>  
>  #include "HiKey960Dxe.h"
>  
> +STATIC EMBEDDED_GPIO   *mGpio;
> +
>  STATIC
>  VOID
>  InitSdCard (
> @@ -166,6 +168,94 @@ OnEndOfDxe (
>  
>  EFI_STATUS
>  EFIAPI
> +VirtualKeyboardRegister (
> +  IN VOID
> +  )
> +{
> +  EFI_STATUS   Status;
> +
> +  Status = gBS->LocateProtocol (
> +  ,
> +  NULL,
> +  (VOID **) 
> +  );
> +  if (EFI_ERROR (Status)) {
> +return Status;
> +  }
> +  return EFI_SUCCESS;
> +}
> +
> +EFI_STATUS
> +EFIAPI
> +VirtualKeyboardReset (
> +  IN VOID
> +  )
> +{
> +  EFI_STATUS   Status;
> +
> +  if (mGpio == NULL) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +  //
> +  // Configure GPIO68 as GPIO function
> +  //
> +  MmioWrite32 (0xe896c108, 0);
> +  Status = mGpio->Set (mGpio, DETECT_SW_FASTBOOT, GPIO_MODE_INPUT);
> +  return Status;
> +}
> +
> +BOOLEAN
> +EFIAPI
> +VirtualKeyboardQuery (
> +  IN VIRTUAL_KBD_KEY *VirtualKey
> +  )
> +{
> +  EFI_STATUS   Status;
> +  UINTNValue = 0;
> +
> +  if ((VirtualKey == NULL) || (mGpio == NULL)) {
> +return FALSE;
> +  }
> +  if (MmioRead32 (ADB_REBOOT_ADDRESS) == ADB_REBOOT_BOOTLOADER) {
> +goto Done;

Re: [edk2] [PATCH v6 edk2-platforms 2/6] Platform/HiKey960: do basic initialization

2018-05-25 Thread Leif Lindholm
On Thu, May 24, 2018 at 08:46:26AM +0800, Haojian Zhuang wrote:
> Do some basic initliazation on peripherals, such as pins and
> regulators.
> 
> The hardcoding code is taken from non-open reference code.
> Can't fix it for lack of documents.
> 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Haojian Zhuang 
> ---
>  Silicon/Hisilicon/Hi3660/Hi3660.dec |  32 
>  Platform/Hisilicon/HiKey960/HiKey960.dsc|   2 +
>  Platform/Hisilicon/HiKey960/HiKey960.fdf|   2 +
>  Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf |  47 +
>  Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.h   |  37 
>  Silicon/Hisilicon/Hi3660/Include/Hi3660.h   | 195 
> +++
>  Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.c   | 198 
> 
>  7 files changed, 513 insertions(+)
> 

> diff --git a/Silicon/Hisilicon/Hi3660/Hi3660.dec 
> b/Silicon/Hisilicon/Hi3660/Hi3660.dec
> new file mode 100644
> index ..72de61e0635c
> --- /dev/null
> +++ b/Silicon/Hisilicon/Hi3660/Hi3660.dec
> @@ -0,0 +1,32 @@
> +#
> +#  Copyright (c) 2018, Linaro Limited. All rights reserved.
> +#
> +#  This program and the accompanying materials
> +#  are licensed and made available under the terms and conditions of the BSD 
> License
> +#  which accompanies this distribution.  The full text of the license may be 
> found at
> +#  http://opensource.org/licenses/bsd-license.php
> +#
> +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> +#
> +
> +[Defines]
> +  DEC_SPECIFICATION  = 0x0001001a
> +  PACKAGE_NAME   = Hi3660
> +  PACKAGE_GUID   = e457ba7c-faba-4dea-b274-f5962d016c79
> +  PACKAGE_VERSION= 0.1
> +
> +
> +#
> +# Include Section - list of Include Paths that are provided by this package.
> +#   Comments are used for Keywords and Module Types.
> +#
> +# Supported Module Types:
> +#  BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER 
> DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
> +#
> +
> +[Includes.common]
> +  Include# Root include for the package
> +
> +[Guids.common]
> +  gHi3660TokenSpaceGuid  =  { 0x4abc73fa, 0x8a49, 0x4d2c, { 0x95, 0x44, 
> 0x17, 0x87, 0x29, 0x06, 0x20, 0xb4 } }
> diff --git a/Platform/Hisilicon/HiKey960/HiKey960.dsc 
> b/Platform/Hisilicon/HiKey960/HiKey960.dsc
> index 3da1b8556321..6cc1c1edf453 100644
> --- a/Platform/Hisilicon/HiKey960/HiKey960.dsc
> +++ b/Platform/Hisilicon/HiKey960/HiKey960.dsc
> @@ -182,6 +182,8 @@ [Components.common]
>Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
>ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
>  
> +  Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf
> +
>#
># USB Host Support
>#
> diff --git a/Platform/Hisilicon/HiKey960/HiKey960.fdf 
> b/Platform/Hisilicon/HiKey960/HiKey960.fdf
> index 162dbaaf2646..b7d70b010598 100644
> --- a/Platform/Hisilicon/HiKey960/HiKey960.fdf
> +++ b/Platform/Hisilicon/HiKey960/HiKey960.fdf
> @@ -123,6 +123,8 @@ [FV.FvMain]
>INF Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
>INF ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
>  
> +  INF Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf
> +
>#
># USB Host Support
>#
> diff --git a/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf 
> b/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf
> new file mode 100644
> index ..a1a7d005ce8b
> --- /dev/null
> +++ b/Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf
> @@ -0,0 +1,47 @@
> +#
> +#  Copyright (c) 2018, Linaro Limited. All rights reserved.
> +#
> +#  This program and the accompanying materials
> +#  are licensed and made available under the terms and conditions of the BSD 
> License
> +#  which accompanies this distribution.  The full text of the license may be 
> found at
> +#  http://opensource.org/licenses/bsd-license.php
> +#
> +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
> IMPLIED.
> +#
> +
> +[Defines]
> +  INF_VERSION= 0x0001001a
> +  BASE_NAME  = HiKey960Dxe
> +  FILE_GUID  = 6d824b2c-640e-4643-b9f2-9c09e8bff429
> +  MODULE_TYPE= DXE_DRIVER
> +  VERSION_STRING = 1.0
> +  ENTRY_POINT= HiKey960EntryPoint
> +
> +[Sources.common]
> +  HiKey960Dxe.c
> +
> 

Re: [edk2] [PATCH v2] EmulatorPkg/SmbiosLib: Declare the correct library class.

2018-05-25 Thread Gao, Liming
BaseTools has no such check before. To avoid build break, I suggest to report 
the warning message if library class in DSC doesn't match one in library INF 
[Defines] section. 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Carsey, Jaben
> Sent: Friday, May 25, 2018 10:19 PM
> To: Marvin Häuser ; edk2-devel@lists.01.org; 
> Laszlo Ersek 
> Cc: Justen, Jordan L ; af...@apple.com
> Subject: Re: [edk2] [PATCH v2] EmulatorPkg/SmbiosLib: Declare the correct 
> library class.
> 
> 
> 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> > Marvin Häuser
> > Sent: Thursday, May 24, 2018 1:57 PM
> > To: edk2-devel@lists.01.org; Laszlo Ersek 
> > Cc: Justen, Jordan L ; af...@apple.com
> > Subject: Re: [edk2] [PATCH v2] EmulatorPkg/SmbiosLib: Declare the correct
> > library class.
> >
> > > -Original Message-
> > > From: Laszlo Ersek 
> > > Sent: Thursday, May 24, 2018 10:51 PM
> > > To: Jordan Justen ; edk2-devel@lists.01.org;
> > > Marvin Häuser 
> > > Cc: af...@apple.com
> > > Subject: Re: [edk2] [PATCH v2] EmulatorPkg/SmbiosLib: Declare the correct
> > > library class.
> > >
> > > On 05/24/18 22:36, Jordan Justen wrote:
> > > > Reviewed-by: Jordan Justen 
> > > >
> > > > Pushed as 7dc7c7435e.
> > > >
> > > > On 2018-05-17 05:43:30, Marvin Häuser wrote:
> > > >> Currently, SmbiosLib declares the PcdLib library class. Update the
> > > >> declaration to declare SmbiosLib.
> > > >>
> > > >> V2:
> > > >>   - Do not change the copyright date as requested.
> > > >>
> > > >> Contributed-under: TianoCore Contribution Agreement 1.1
> > > >> Signed-off-by: Marvin Haeuser 
> > > >> ---
> > > >>  EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf | 2 +-
> > > >>  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >>
> > > >> diff --git a/EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf
> > > >> b/EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf
> > > >> index adcd7ef08e20..36d5c350f51a 100644
> > > >> --- a/EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf
> > > >> +++ b/EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf
> > > >> @@ -20,7 +20,7 @@ [Defines]
> > > >>FILE_GUID  = 
> > > >> 881863A2-09FD-3E44-8D62-7AE038D03747
> > > >>MODULE_TYPE= DXE_DRIVER
> > > >>VERSION_STRING = 1.0
> > > >> -  LIBRARY_CLASS  = PcdLib|DXE_CORE DXE_DRIVER
> > > DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER SMM_CORE
> > > UEFI_APPLICATION UEFI_DRIVER
> > > >> +  LIBRARY_CLASS  = SmbiosLib|DXE_CORE DXE_DRIVER
> > > DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER SMM_CORE
> > > UEFI_APPLICATION UEFI_DRIVER
> > > >>
> > > >>CONSTRUCTOR= SmbiosLibConstructor
> > >
> > > (Just because I pondered the question a few days ago, independently, I'll
> > > voice it here:)
> > >
> > > Should BaseTools catch this? "EmulatorPkg/EmulatorPkg.dsc" contains the
> > > following library resolution:
> > >
> > >   SmbiosLib|EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf
> > >
> > > I think it should be possible to flag that the class of the lib instance 
> > > doesn't
> > > match the lib class that the platform DSC is resolving.
> >
> > I think it definitely should, there is no case (known to me) where those two
> > values diverging would be a supported or making any sense.
> 
> There is a corner case: A single module with a single INF may satisfy 2 
> library class definitions and as such may have 2 lines.  As long as
> we flag instances where no LIBRARY_CLASS line in the INF matches the library 
> class in the DSC, I think a warning or error would be
> valid.
> 
> >
> > >
> > > (Or is Marvin's patch the result of such an error message already?)
> >
> > No, I was just checking the library for reference and noticed the mistake. I
> > did not actually build EmulatorPkg though.
> >
> > Regards,
> > Marvin
> >
> > >
> > > Thanks!
> > > Laszlo
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2] EmulatorPkg/SmbiosLib: Declare the correct library class.

2018-05-25 Thread Carsey, Jaben


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Marvin Häuser
> Sent: Thursday, May 24, 2018 1:57 PM
> To: edk2-devel@lists.01.org; Laszlo Ersek 
> Cc: Justen, Jordan L ; af...@apple.com
> Subject: Re: [edk2] [PATCH v2] EmulatorPkg/SmbiosLib: Declare the correct
> library class.
> 
> > -Original Message-
> > From: Laszlo Ersek 
> > Sent: Thursday, May 24, 2018 10:51 PM
> > To: Jordan Justen ; edk2-devel@lists.01.org;
> > Marvin Häuser 
> > Cc: af...@apple.com
> > Subject: Re: [edk2] [PATCH v2] EmulatorPkg/SmbiosLib: Declare the correct
> > library class.
> >
> > On 05/24/18 22:36, Jordan Justen wrote:
> > > Reviewed-by: Jordan Justen 
> > >
> > > Pushed as 7dc7c7435e.
> > >
> > > On 2018-05-17 05:43:30, Marvin Häuser wrote:
> > >> Currently, SmbiosLib declares the PcdLib library class. Update the
> > >> declaration to declare SmbiosLib.
> > >>
> > >> V2:
> > >>   - Do not change the copyright date as requested.
> > >>
> > >> Contributed-under: TianoCore Contribution Agreement 1.1
> > >> Signed-off-by: Marvin Haeuser 
> > >> ---
> > >>  EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf | 2 +-
> > >>  1 file changed, 1 insertion(+), 1 deletion(-)
> > >>
> > >> diff --git a/EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf
> > >> b/EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf
> > >> index adcd7ef08e20..36d5c350f51a 100644
> > >> --- a/EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf
> > >> +++ b/EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf
> > >> @@ -20,7 +20,7 @@ [Defines]
> > >>FILE_GUID  = 881863A2-09FD-3E44-8D62-7AE038D03747
> > >>MODULE_TYPE= DXE_DRIVER
> > >>VERSION_STRING = 1.0
> > >> -  LIBRARY_CLASS  = PcdLib|DXE_CORE DXE_DRIVER
> > DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER SMM_CORE
> > UEFI_APPLICATION UEFI_DRIVER
> > >> +  LIBRARY_CLASS  = SmbiosLib|DXE_CORE DXE_DRIVER
> > DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER SMM_CORE
> > UEFI_APPLICATION UEFI_DRIVER
> > >>
> > >>CONSTRUCTOR= SmbiosLibConstructor
> >
> > (Just because I pondered the question a few days ago, independently, I'll
> > voice it here:)
> >
> > Should BaseTools catch this? "EmulatorPkg/EmulatorPkg.dsc" contains the
> > following library resolution:
> >
> >   SmbiosLib|EmulatorPkg/Library/SmbiosLib/SmbiosLib.inf
> >
> > I think it should be possible to flag that the class of the lib instance 
> > doesn't
> > match the lib class that the platform DSC is resolving.
> 
> I think it definitely should, there is no case (known to me) where those two
> values diverging would be a supported or making any sense.

There is a corner case: A single module with a single INF may satisfy 2 library 
class definitions and as such may have 2 lines.  As long as we flag instances 
where no LIBRARY_CLASS line in the INF matches the library class in the DSC, I 
think a warning or error would be valid.

> 
> >
> > (Or is Marvin's patch the result of such an error message already?)
> 
> No, I was just checking the library for reference and noticed the mistake. I
> did not actually build EmulatorPkg though.
> 
> Regards,
> Marvin
> 
> >
> > Thanks!
> > Laszlo
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg/Library/BaseSerialPortLib16550: Ensure FIFO Polled Mode

2018-05-25 Thread Duran, Leo
Don''t have access to test platform at this time.
But will report IER value if I,m able to.

Leo

Get Outlook for iOS

From: Zeng, Star 
Sent: Friday, May 25, 2018 6:13:16 AM
To: Duran, Leo; edk2-devel@lists.01.org
Cc: Dong, Eric; Zeng, Star
Subject: RE: [edk2] [PATCH] MdeModulePkg/Library/BaseSerialPortLib16550: Ensure 
FIFO Polled Mode

Reviewed-by: Star Zeng 

Just a little curious about
1. Did you meet real issue without this patch?
2. what is the default value of IER in your case?


Thanks,
Star
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Leo Duran
Sent: Friday, May 25, 2018 3:08 AM
To: edk2-devel@lists.01.org
Cc: Dong, Eric ; Zeng, Star 
Subject: [edk2] [PATCH] MdeModulePkg/Library/BaseSerialPortLib16550: Ensure 
FIFO Polled Mode

Put the UART in FIFO Polled Mode by clearing IER after setting FCR.
Also, add comments to show DLAB state for registers 0 and 1.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leo Duran 
Cc: Star Zeng 
CC: Eric Dong 
---
 .../BaseSerialPortLib16550/BaseSerialPortLib16550.c  | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git 
a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c 
b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
index 0ccac96..6532c4d 100644
--- a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
+++ b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
@@ -3,6 +3,8 @@

   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
   Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2018, AMD Incorporated. All rights reserved.
+
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -30,10 +32,11 @@
 //
 // 16550 UART register offsets and bitfields
 //
-#define R_UART_RXBUF  0
-#define R_UART_TXBUF  0
-#define R_UART_BAUD_LOW   0
-#define R_UART_BAUD_HIGH  1
+#define R_UART_RXBUF  0   // LCR_DLAB = 0
+#define R_UART_TXBUF  0   // LCR_DLAB = 0
+#define R_UART_BAUD_LOW   0   // LCR_DLAB = 1
+#define R_UART_BAUD_HIGH  1   // LCR_DLAB = 1
+#define R_UART_IER1   // LCR_DLAB = 0
 #define R_UART_FCR2
 #define   B_UART_FCR_FIFOEBIT0
 #define   B_UART_FCR_FIFO64   BIT5
@@ -554,6 +557,11 @@ SerialPortInitialize (
   SerialPortWriteRegister (SerialRegisterBase, R_UART_FCR, (UINT8)(PcdGet8 
(PcdSerialFifoControl) & (B_UART_FCR_FIFOE | B_UART_FCR_FIFO64)));

   //
+  // Set FIFO Polled Mode by clearing IER after setting FCR
+  //
+  SerialPortWriteRegister (SerialRegisterBase, R_UART_IER, 0x00);
+
+  //
   // Put Modem Control Register(MCR) into its reset state of 0x00.
   //
   SerialPortWriteRegister (SerialRegisterBase, R_UART_MCR, 0x00);
--
2.7.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] CpuS3DataDxe / DxeRegisterCpuFeaturesLib dependency.

2018-05-25 Thread Marvin Häuser
Hey Laszlo and thanks once again for your detailed response.
Comments are inline.

Regards,
Marvin.

> -Original Message-
> From: Laszlo Ersek 
> Sent: Friday, May 25, 2018 1:41 PM
> To: Marvin Häuser 
> Cc: edk2-devel@lists.01.org; eric.d...@intel.com
> Subject: Re: CpuS3DataDxe / DxeRegisterCpuFeaturesLib dependency.
> 
> On 05/25/18 12:54, Marvin H?user wrote:
> > Good day,
> >
> > While I was inspecting CpuS3DataDxe and the modules depending on its
> > PCD PcdCpuS3DataAddress,
> 
> (Side remark: see e.g. the commit message on 92b87f1c8c0b, "OvmfPkg:
> build CpuS3DataDxe for -D SMM_REQUIRE", 2015-11-30.)
> 
> > I noticed that DxeRegisterCpuFeaturesLib seemingly has an asserted
> > dependency on the PCD being ready when it its executed. I did neither
> > see a Depex entry, nor an event callback ensuring CpuS3DataDxe has
> > been loaded, neither exposed by CpuS3DataDxe, nor consumed by this
> > library.
> >
> https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/Library/Regis
> > terCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c#L211
> 
> "DxeRegisterCpuFeaturesLib.inf" has a depex on
> "gEdkiiCpuFeaturesSetDoneGuid".
> 
> No module in the open source edk2 tree produces this protocol GUID, thus I
> think this library instance is unusable without other, out-of-tree, modules. I
> assume that one of those modules satisfies the dependency somehow.
>

While this of course can be used to control the dependency flow, this GUID is 
documented as follows:
"CPU Features Set Done PPI/Protocol should be installed after CPU features 
configuration are set."
If it is really supposed to ensure the ACPI CPU Data PCD availability too, I 
think it should be documented.
However I do not think that would be a great idea in the first place because 
other modules might depend on it as well.
I get your point is just that an out-of-tree module is needed, however if it 
exists and whatever it does, I don't think it should rely on this GUID for this 
purpose.

> Note that CpuS3DataDxe is a platform driver [1]; it is possible that the
> platform that includes DxeRegisterCpuFeaturesLib in a driver *also* includes
> such a CpuS3DataDxe variant that populates the PCD and then installs
> gEdkiiCpuFeaturesSetDoneGuid.

That was one of the reasons I asked whether a dedicated signal protocol dummy 
would be a good idea.
I don't think it is likely that this is the case, but it is not impossible and 
would need to be discussed internally, if it is the case, I guess.

> 
> [1] I suggest reviewing the message of commit bfec5efa56ca
> ("UefiCpuPkg/CpuS3DataDxe: Add module to initialize ACPI_CPU_DATA for
> S3", 2015-11-25).
> 
> In fact, the series that added "DxeRegisterCpuFeaturesLib.inf" (with the
> depex mentioned above) *also* modified CpuS3DataDxe: see [2] and [3].
> 
> [2] 8b371e93f206 ("UefiCpuPkg/CpuS3DataDxe: Consume the existing
> PcdCpuS3DataAddress", 2017-03-22)

This commit indicates to me that there is no proper dependency resolve, to be 
honest.
If the "main" PCD exposer has code to handle already present data, it means 
that every consumer not executing dependent code very late,
as you have shown PiSmmCpuDxeSmm does, has to have an allocation routine or 
some kind of implicit dependency.

> 
> [3] "[edk2] [PATCH 00/11] Add CPU features driver"
> https://bugzilla.tianocore.org/show_bug.cgi?id=421
> http://mid.mail-archive.com/20170309083553.6016-1-jeff.fan@intel.com
> 
> This suggests that there is an out-of-tree module that populates
> PcdCpuS3DataAddress before *both* CpuS3DataDxe and
> DxeRegisterCpuFeaturesLib access the PCD. For achieving this kind of
> ordering, it would be enough for a driver to first populate the PCD, and then
> install "gEfiMpServiceProtocolGuid", as both
> "DxeRegisterCpuFeaturesLib.inf" and "CpuS3DataDxe.inf" depend on that.

gEfiMpServiceProtocolGuid is populated by CpuDxe, so I hope this is not 
actually the case.
And yet again it would be only a dangerous implicit dependency.

> 
> > Is there anything I'm missing that ensures the execution of
> > CpuS3DataDxe prior to executing the dependent code? If not, should
> > there be a dummy protocol exposed? PiSmmCpuDxeSmm also retrieves
> this
> > PCD, however safely quits when it has not been set. However, this
> > could cause unexpected behavior when the PCD is set after this code
> > has been executed. I did not notice any dependency satisfaction
> > actions here either.
> 
> The ordering between CpuS3DataDxe and PiSmmCpuDxeSmm is safe; it's
> orchestrated by Platform BDS. See commit 92b87f1c8c0b above.

I only noticed PiSmmCpuDxeSmm while grep'ing for the PCD name and didn't check 
it in detail, sorry for the trouble.

> 
> > Furthermore, not directly related to this dependency issue, the DXE
> > code obviously does not implement AllocateAcpiCpuData() entirely.
> 
> More precisely, the DXE code expects AllocateAcpiCpuData() never to be
> called; i.e., when the common 

Re: [edk2] CpuS3DataDxe / DxeRegisterCpuFeaturesLib dependency.

2018-05-25 Thread Laszlo Ersek
On 05/25/18 12:54, Marvin H?user wrote:
> Good day,
>
> While I was inspecting CpuS3DataDxe and the modules depending on its
> PCD PcdCpuS3DataAddress,

(Side remark: see e.g. the commit message on 92b87f1c8c0b, "OvmfPkg:
build CpuS3DataDxe for -D SMM_REQUIRE", 2015-11-30.)

> I noticed that DxeRegisterCpuFeaturesLib seemingly has an asserted
> dependency on the PCD being ready when it its executed. I did neither
> see a Depex entry, nor an event callback ensuring CpuS3DataDxe has
> been loaded, neither exposed by CpuS3DataDxe, nor consumed by this
> library.
> https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c#L211

"DxeRegisterCpuFeaturesLib.inf" has a depex on
"gEdkiiCpuFeaturesSetDoneGuid".

No module in the open source edk2 tree produces this protocol GUID, thus
I think this library instance is unusable without other, out-of-tree,
modules. I assume that one of those modules satisfies the dependency
somehow.

Note that CpuS3DataDxe is a platform driver [1]; it is possible that the
platform that includes DxeRegisterCpuFeaturesLib in a driver *also*
includes such a CpuS3DataDxe variant that populates the PCD and then
installs gEdkiiCpuFeaturesSetDoneGuid.

[1] I suggest reviewing the message of commit bfec5efa56ca
("UefiCpuPkg/CpuS3DataDxe: Add module to initialize ACPI_CPU_DATA for
S3", 2015-11-25).

In fact, the series that added "DxeRegisterCpuFeaturesLib.inf" (with the
depex mentioned above) *also* modified CpuS3DataDxe: see [2] and [3].

[2] 8b371e93f206 ("UefiCpuPkg/CpuS3DataDxe: Consume the existing
PcdCpuS3DataAddress", 2017-03-22)

[3] "[edk2] [PATCH 00/11] Add CPU features driver"
https://bugzilla.tianocore.org/show_bug.cgi?id=421
http://mid.mail-archive.com/20170309083553.6016-1-jeff.fan@intel.com

This suggests that there is an out-of-tree module that populates
PcdCpuS3DataAddress before *both* CpuS3DataDxe and
DxeRegisterCpuFeaturesLib access the PCD. For achieving this kind of
ordering, it would be enough for a driver to first populate the PCD, and
then install "gEfiMpServiceProtocolGuid", as both
"DxeRegisterCpuFeaturesLib.inf" and "CpuS3DataDxe.inf" depend on that.

> Is there anything I'm missing that ensures the execution of
> CpuS3DataDxe prior to executing the dependent code? If not, should
> there be a dummy protocol exposed? PiSmmCpuDxeSmm also retrieves this
> PCD, however safely quits when it has not been set. However, this
> could cause unexpected behavior when the PCD is set after this code
> has been executed. I did not notice any dependency satisfaction
> actions here either.

The ordering between CpuS3DataDxe and PiSmmCpuDxeSmm is safe; it's
orchestrated by Platform BDS. See commit 92b87f1c8c0b above.

> Furthermore, not directly related to this dependency issue, the DXE
> code obviously does not implement AllocateAcpiCpuData() entirely.

More precisely, the DXE code expects AllocateAcpiCpuData() never to be
called; i.e., when the common "RegisterCpuFeaturesLib.c" source file is
executed in DXE, the expectation is that it never reaches the call to
AllocateAcpiCpuData().

> Hence, the if-branch following its call, will either add another layer
> of firing ASSERTs, or it will plainly do nothing. Maybe it could be
> moved into the current AllocateAcpiCpuData() function and it be
> renamed accordingly?
> https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c#L526

Sorry, I don't understand your point -- CpuRegisterTableWriteWorker() is
used in both PEI and DXE, and it's implemented for the general case.
When it runs in DXE, the expectation is apparently that
AllocateAcpiCpuData() will never be needed / reached, hence the
ASSERT(FALSE) stub implementation for the latter, in
"DxeRegisterCpuFeaturesLib.c".

Oh wait, I think you mistyped your point. The "if" that you refer to
does not *follow* the call to AllocateAcpiCpuData(). It *precedes*
(guards) it. What the "if" follows is the PcdGet64() call, for
PcdCpuS3DataAddress. In DXE, that PcdGet64() is expected to return a
nonzero value, hence AllocateAcpiCpuData() is never called, and the
assertions about the return value of AllocateAcpiCpuData() are
irrelevant (unreached).

Thanks
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg/Library/BaseSerialPortLib16550: Ensure FIFO Polled Mode

2018-05-25 Thread Zeng, Star
Reviewed-by: Star Zeng 

Just a little curious about
1. Did you meet real issue without this patch?
2. what is the default value of IER in your case?


Thanks,
Star
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Leo Duran
Sent: Friday, May 25, 2018 3:08 AM
To: edk2-devel@lists.01.org
Cc: Dong, Eric ; Zeng, Star 
Subject: [edk2] [PATCH] MdeModulePkg/Library/BaseSerialPortLib16550: Ensure 
FIFO Polled Mode

Put the UART in FIFO Polled Mode by clearing IER after setting FCR.
Also, add comments to show DLAB state for registers 0 and 1.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leo Duran 
Cc: Star Zeng 
CC: Eric Dong 
---
 .../BaseSerialPortLib16550/BaseSerialPortLib16550.c  | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git 
a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c 
b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
index 0ccac96..6532c4d 100644
--- a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
+++ b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
@@ -3,6 +3,8 @@
 
   (C) Copyright 2014 Hewlett-Packard Development Company, L.P.
   Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2018, AMD Incorporated. All rights reserved.
+
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -30,10 +32,11 @@
 //
 // 16550 UART register offsets and bitfields
 //
-#define R_UART_RXBUF  0
-#define R_UART_TXBUF  0
-#define R_UART_BAUD_LOW   0
-#define R_UART_BAUD_HIGH  1
+#define R_UART_RXBUF  0   // LCR_DLAB = 0
+#define R_UART_TXBUF  0   // LCR_DLAB = 0
+#define R_UART_BAUD_LOW   0   // LCR_DLAB = 1
+#define R_UART_BAUD_HIGH  1   // LCR_DLAB = 1
+#define R_UART_IER1   // LCR_DLAB = 0
 #define R_UART_FCR2
 #define   B_UART_FCR_FIFOEBIT0
 #define   B_UART_FCR_FIFO64   BIT5
@@ -554,6 +557,11 @@ SerialPortInitialize (
   SerialPortWriteRegister (SerialRegisterBase, R_UART_FCR, (UINT8)(PcdGet8 
(PcdSerialFifoControl) & (B_UART_FCR_FIFOE | B_UART_FCR_FIFO64)));
 
   //
+  // Set FIFO Polled Mode by clearing IER after setting FCR
+  //
+  SerialPortWriteRegister (SerialRegisterBase, R_UART_IER, 0x00);
+
+  //
   // Put Modem Control Register(MCR) into its reset state of 0x00.
   //  
   SerialPortWriteRegister (SerialRegisterBase, R_UART_MCR, 0x00);
-- 
2.7.4

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch v3 2/3] MdeModulePkg: Add DisplayUpdateProgressLib instances

2018-05-25 Thread Zeng, Star
Reviewed-by: Star Zeng 


Thanks,
Star
-Original Message-
From: Kinney, Michael D 
Sent: Friday, May 25, 2018 2:16 PM
To: edk2-devel@lists.01.org
Cc: Sean Brogan ; Zeng, Star ; 
Dong, Eric 
Subject: [Patch v3 2/3] MdeModulePkg: Add DisplayUpdateProgressLib instances

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

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport

Add DisplayUpdateProgressLib instances for text consoles and graphical consoles.

Cc: Sean Brogan 
Cc: Star Zeng 
Cc: Eric Dong 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../DisplayUpdateProgressLibGraphics.c | 475 +
 .../DisplayUpdateProgressLibGraphics.inf   |  60 +++
 .../DisplayUpdateProgressLibGraphics.uni   |  18 +
 .../DisplayUpdateProgressLibText.c | 174 
 .../DisplayUpdateProgressLibText.inf   |  53 +++
 .../DisplayUpdateProgressLibText.uni   |  18 +
 MdeModulePkg/MdeModulePkg.dsc  |   3 +
 7 files changed, 801 insertions(+)
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.c
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.uni
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressLibText.c
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressLibText.inf
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressLibText.uni

diff --git 
a/MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.c
 
b/MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.c
new file mode 100644
index 00..007522cea0
--- /dev/null
+++ b/MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdat
+++ eProgressLibGraphics.c
@@ -0,0 +1,475 @@
+/**  @file
+  Provides services to display completion progress of a firmware update 
+on a
+  graphical console that supports the Graphics Output Protocol.
+
+  Copyright (c) 2016, Microsoft Corporation. All rights reserved.  
+ Copyright (c) 2018, Intel 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.
+
+**/
+
+#include 
+#include 
+#include  #include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+//
+// Values in percent of of logo height.
+//
+#define LOGO_BOTTOM_PADDING20
+#define PROGRESS_BLOCK_HEIGHT  10
+
+//
+// Graphics Output Protocol instance to display progress bar // 
+EFI_GRAPHICS_OUTPUT_PROTOCOL  *mGop = NULL;
+
+//
+// Set to 100 percent so it is reset on first call.
+//
+UINTN mPreviousProgress = 100;
+
+//
+// Display coordinates for the progress bar.
+//
+UINTN  mStartX = 0;
+UINTN  mStartY = 0;
+
+//
+// Width and height of the progress bar.
+//
+UINTN  mBlockWidth  = 0;
+UINTN  mBlockHeight = 0;
+
+//
+// GOP bitmap of the progress bar. Initialized on every new progress of 
+100% // EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *mBlockBitmap;
+
+//
+// GOP bitmap of the progress bar backround.  Initialized once.
+//
+EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *mProgressBarBackground;
+
+//
+// Default mask used to detect the left, right , top, and bottom of 
+logo.  Only // green and blue pixels are used for 

Re: [edk2] [PATCH v2 1/1] BaseTools: loop to retry remove when it fails.

2018-05-25 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: Carsey, Jaben 
Sent: Thursday, May 10, 2018 11:15 PM
To: edk2-devel@lists.01.org
Cc: Kinney, Michael D ; Gao, Liming 
; Zhu, Yonghong 
Subject: [PATCH v2 1/1] BaseTools: loop to retry remove when it fails.

There is a common race condition when the OS fails to release a file fast 
enough.  this adds a retry loop.

v2 - Add a timeout.

Cc: Mike Kinney 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/LongFilePathOs.py | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Common/LongFilePathOs.py 
b/BaseTools/Source/Python/Common/LongFilePathOs.py
index 2e530f9dd774..2cebbb276b19 100644
--- a/BaseTools/Source/Python/Common/LongFilePathOs.py
+++ b/BaseTools/Source/Python/Common/LongFilePathOs.py
@@ -1,7 +1,7 @@
 ## @file
 # Override built in module os to provide support for long file path  # -# 
Copyright (c) 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 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  # which 
accompanies this distribution.  The full text of the license may be found at @@ 
-15,6 +15,7 @@ import os  import LongFilePathOsPath  from 
Common.LongFilePathSupport import LongFilePath  from Common.LongFilePathSupport 
import UniToStr
+import time
 
 path = LongFilePathOsPath
 
@@ -22,7 +23,14 @@ def access(path, mode):
 return os.access(LongFilePath(path), mode)
 
 def remove(path):
-return os.remove(LongFilePath(path))
+   Timeout = 0.0
+   while Timeout < 5.0:
+   try:
+   return os.remove(LongFilePath(path))
+   except:
+   time.sleep(0.1)
+   Timeout = Timeout + 0.1
+   return os.remove(LongFilePath(path))
 
 def removedirs(name):
 return os.removedirs(LongFilePath(name))
--
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch v3 1/3] MdeModulePkg: Add DisplayUpdateProgressLib class

2018-05-25 Thread Zeng, Star
Reviewed-by: Star Zeng  after fixing typo ' custoimize ' 
to ' customize '.

Thanks,
Star

-Original Message-
From: Kinney, Michael D 
Sent: Friday, May 25, 2018 2:16 PM
To: edk2-devel@lists.01.org
Cc: Sean Brogan ; Zeng, Star ; 
Dong, Eric 
Subject: [Patch v3 1/3] MdeModulePkg: Add DisplayUpdateProgressLib class

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

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport

Add the DisplayUpdateProgressLib class that is used to inform the user of 
progress during updates of firmware images in firmware devices.  A platform 
specific instance of this library can be used to customize how the user is 
informed of progress.

Add the EDK II Firmware Management Progress Protocol.
This is an optional protocol that must be installed onto the same handle as a 
Firmware Management Protocol.
This new protocol provides the color of a progress bar that allows different 
firmware devices to use different colors during a firmware update.  It also 
provides a watchdog timer value in seconds that is armed each time the 
Progress() service passed into Firmware Management Protocol SetImage() is 
called.

Cc: Sean Brogan 
Cc: Star Zeng 
Cc: Eric Dong 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../Include/Library/DisplayUpdateProgressLib.h | 65 ++
 .../Include/Protocol/FirmwareManagementProgress.h  | 55 ++
 MdeModulePkg/MdeModulePkg.dec  | 11 
 3 files changed, 131 insertions(+)
 create mode 100644 MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h
 create mode 100644 MdeModulePkg/Include/Protocol/FirmwareManagementProgress.h

diff --git a/MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h 
b/MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h
new file mode 100644
index 00..ad1f2cae38
--- /dev/null
+++ b/MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h
@@ -0,0 +1,65 @@
+/** @file
+  Provides services to display completion progress when processing a
+  firmware update that updates the firmware image in a firmware device.
+  A platform may provide its own instance of this library class to 
+custoimize
+  how a user is informed of completion progress.
+
+  Copyright (c) 2016, Microsoft Corporation  Copyright (c) 2018, Intel 
+ Corporation. All rights reserved.
+
+  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 __DISPLAY_PROGRESS_LIB__
+#define __DISPLAY_PROGRESS_LIB__
+
+#include 
+
+/**
+  Indicates the current completion progress of a firmware update.
+
+  @param[in] Completion  A value between 0 and 100 indicating the current
+ completion progress of a firmware update.  This
+ value must the the same or higher than previous
+ calls to this service.  The first call of 0 or a
+ value of 0 after reaching a value of 100 resets
+ the progress indicator to 0.
+  @param[in] Color   Color of the progress indicator.  Only used when
+ Completion is 0 to set the color of the progress
+ indicator.  If Color is NULL, then the default color
+ is used.
+
+  @retval EFI_SUCCESSProgress displayed successfully.
+  @retval EFI_INVALID_PARAMETER  Completion is not in range 0..100.
+  @retval EFI_INVALID_PARAMETER  Completion is less 

[edk2] CpuS3DataDxe / DxeRegisterCpuFeaturesLib dependency.

2018-05-25 Thread Marvin H?user
Good day,

While I was inspecting CpuS3DataDxe and the modules depending on its PCD 
PcdCpuS3DataAddress, I noticed that DxeRegisterCpuFeaturesLib seemingly has an 
asserted dependency on the PCD being ready when it its executed. I did neither 
see a Depex entry, nor an event callback ensuring CpuS3DataDxe has been loaded, 
neither exposed by CpuS3DataDxe, nor consumed by this library.
https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c#L211

Is there anything I'm missing that ensures the execution of CpuS3DataDxe prior 
to executing the dependent code? If not, should there be a dummy protocol 
exposed? PiSmmCpuDxeSmm also retrieves this PCD, however safely quits when it 
has not been set. However, this could cause unexpected behavior when the PCD is 
set after this code has been executed. I did not notice any dependency 
satisfaction actions here either.

Furthermore, not directly related to this dependency issue, the DXE code 
obviously does not implement AllocateAcpiCpuData() entirely. Hence, the 
if-branch following its call, will either add another layer of firing ASSERTs, 
or it will plainly do nothing. Maybe it could be moved into the current 
AllocateAcpiCpuData() function and it be renamed accordingly?
https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c#L526

Thanks for your time.

Best regards,
Marvin.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch][edk2-platforms/devel-MinnowBoardMax-UDK2017] Capsule Update

2018-05-25 Thread Guo, Mang
1. Fix ESRT issue
2. Add support for Capsule update processing between x64 and IA32 BIOS image

Contributed-under: TianoCore Contribution Agreement 1.1

Signed-off-by: Guo Mang 
---
 .../Library/PlatformBdsLib/BdsPlatform.c   |  7 +-
 Vlv2TbltDevicePkg/PlatformPkg.fdf  |  3 ++-
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc  | 27 +-
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc   | 24 +++
 Vlv2TbltDevicePkg/bld_vlv.bat  |  2 +-
 5 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c 
b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
index e7aa3b3..847254a 100644
--- a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
+++ b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
@@ -2031,9 +2031,11 @@ PlatformBdsPolicyBehavior (
 //
 if (EsrtManagement != NULL) {
   EsrtManagement->SyncEsrtFmp();
-  PcdSetBool(PcdEsrtSyncFmp, FALSE);
 }
 
+DEBUG((DEBUG_INFO, "ProcessCapsules After ConnectAll..\n"));
+ProcessCapsules();
+DEBUG((DEBUG_INFO, "ProcessCapsules Done\n"));
 
 
 PlatformBdsLockNonUpdatableFlash ();
@@ -2089,6 +2091,9 @@ FULL_CONFIGURATION:
 TrEEPhysicalPresenceLibProcessRequest(NULL);
 #endif
 
+if (EsrtManagement != NULL) {
+  EsrtManagement->SyncEsrtFmp();
+}
 //
 // Close boot script and install ready to lock
 //
diff --git a/Vlv2TbltDevicePkg/PlatformPkg.fdf 
b/Vlv2TbltDevicePkg/PlatformPkg.fdf
index 1942cf5..d651833 100644
--- a/Vlv2TbltDevicePkg/PlatformPkg.fdf
+++ b/Vlv2TbltDevicePkg/PlatformPkg.fdf
@@ -840,7 +840,8 @@ READ_STATUS= TRUE
 READ_LOCK_CAP  = TRUE
 READ_LOCK_STATUS   = TRUE
 
-INF  
SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.inf
+INF FILE_GUID=232393E2-185F-4212-A986-2B01F529EED9 USE=IA32 
SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.inf
+INF FILE_GUID=F1E68873-DA37-4AA0-A12F-F0F8EBA2B24E USE=X64 
SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.inf
 
 
 !endif
diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
index cc6f27e..a9a14d3 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
@@ -34,7 +34,7 @@
   DEFINE  PLATFORM_RC_PACKAGE = Vlv2DeviceRefCodePkg
   DEFINE  PLATFORM_BINARY_PACKAGE = Vlv2BinaryPkg
   OUTPUT_DIRECTORY= Build/$(PLATFORM_PACKAGE)
-  SUPPORTED_ARCHITECTURES = IA32
+  SUPPORTED_ARCHITECTURES = IA32|X64
   BUILD_TARGETS   = DEBUG|RELEASE
   SKUID_IDENTIFIER= DEFAULT
 
@@ -361,6 +361,18 @@
   
Tpm2DeviceLib|Vlv2TbltDevicePkg/Library/Tpm2DeviceLibSeCPei/Tpm2DeviceLibSeC.inf
 !endif
 
+
+
+[LibraryClasses.X64]
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  !if $(TPM_ENABLED) == TRUE
+BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+  !endif
+
+  !if $(SECURE_BOOT_ENABLE) == TRUE
+BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+  !endif
 [LibraryClasses.IA32]
   #
   # DXE phase common
@@ -1597,9 +1609,22 @@ 
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmmDxe.inf
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   }
 
+[Components.IA32]
+  SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.inf {
+
+  FILE_GUID = 232393E2-185F-4212-A986-2B01F529EED9
+
+  
FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibRsa2048Sha256/FmpAuthenticationLibRsa2048Sha256.inf
+  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+  }
+
+[Components.X64]
   SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.inf {
+
+  FILE_GUID = F1E68873-DA37-4AA0-A12F-F0F8EBA2B24E
 
   
FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibRsa2048Sha256/FmpAuthenticationLibRsa2048Sha256.inf
+  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
   DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   }
 
diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
index 50f168f..b66f285 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
@@ -361,6 +361,17 @@
   
Tpm2DeviceLib|Vlv2TbltDevicePkg/Library/Tpm2DeviceLibSeCPei/Tpm2DeviceLibSeC.inf
 !endif
 
+[LibraryClasses.IA32]
+  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+  
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  !if $(TPM_ENABLED) == TRUE
+BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+  !endif
+
+  !if $(SECURE_BOOT_ENABLE) == TRUE
+

[edk2] [PATCH 0/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE

2018-05-25 Thread Ruiyu Ni
Per PCIE spec, Memory Write and Invalidate is hardwired to 0b so
PciBus driver shouldn't write 1b to it.
Patch #1 cleans up some unnecessary code.

Ruiyu Ni (2):
  MdeModulePkg/PciBus: Remove unnecessary PCIE detection
  MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE

 MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 17 +
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 10 ++
 2 files changed, 7 insertions(+), 20 deletions(-)

-- 
2.16.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 1/2] MdeModulePkg/PciBus: Remove unnecessary PCIE detection

2018-05-25 Thread Ruiyu Ni
CreatePciIoDevice() detects whether the PCI device is a PCI Express
device and remembers the device type in PciIoDevice->IsPciExp.

RegisterPciDevice() detects the device type again which is
unnecessary. The detection logic can be removed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Star Zeng 
Cc: Hao A Wu 
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 17 +
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
index e76c8f0046..f69fe938da 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
@@ -1,7 +1,7 @@
 /** @file
   Supporting functions implementaion for PCI devices management.
 
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 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
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -211,7 +211,6 @@ RegisterPciDevice (
   EFI_STATUS  Status;
   VOID*PlatformOpRomBuffer;
   UINTN   PlatformOpRomSize;
-  UINT8   PciExpressCapRegOffset;
   EFI_PCI_IO_PROTOCOL *PciIo;
   UINT8   Data8;
   BOOLEAN HasEfiImage;
@@ -231,20 +230,6 @@ RegisterPciDevice (
 return Status;
   }
 
-  //
-  // Detect if PCI Express Device
-  //
-  PciExpressCapRegOffset = 0;
-  Status = LocateCapabilityRegBlock (
- PciIoDevice,
- EFI_PCI_CAPABILITY_ID_PCIEXP,
- ,
- NULL
- );
-  if (!EFI_ERROR (Status)) {
-PciIoDevice->IsPciExp = TRUE;
-  }
-
   //
   // Force Interrupt line to "Unknown" or "No Connection"
   //
-- 
2.16.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 2/2] MdeModulePkg/PciBus: Do not enable MemWriteAndInvalidate bit for PCIE

2018-05-25 Thread Ruiyu Ni
Per PCIE spec, Memory Write and Invalidate is hardwired to 0b so
PciBus driver shouldn't write 1b to it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Star Zeng 
Cc: Chasel Chiu 
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index 81171c82d9..6f3d1bebc6 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -1,7 +1,7 @@
 /** @file
   PCI emumeration support functions implementation for PCI Bus module.
 
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 (C) Copyright 2015 Hewlett Packard Enterprise Development LP
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
@@ -1254,9 +1254,11 @@ DetermineDeviceAttribute (
 PciSetDeviceAttribute (PciIoDevice, OldCommand, OldBridgeControl, 
EFI_SET_ATTRIBUTES);
 
 //
-// Enable other supported attributes but not defined in PCI_IO_PROTOCOL
-//
-PCI_ENABLE_COMMAND_REGISTER (PciIoDevice, 
EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE);
+// Enable other PCI supported attributes but not defined in PCI_IO_PROTOCOL
+// For PCI Express devices, Memory Write and Invalidate is hardwired to 0b 
so only enable it for PCI devices.
+if (!PciIoDevice->IsPciExp) {
+  PCI_ENABLE_COMMAND_REGISTER (PciIoDevice, 
EFI_PCI_COMMAND_MEMORY_WRITE_AND_INVALIDATE);
+}
   }
 
   FastB2BSupport = TRUE;
-- 
2.16.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] PcAtChipsetPkg/PcRtc: Add two new PCD for RTC Index/Target registers

2018-05-25 Thread Ni, Ruiyu
Star,
Thanks for the comments.
I will take #1.
For #2, I prefer to remove the macro

Thanks/Ray

> -Original Message-
> From: Zeng, Star
> Sent: Friday, May 25, 2018 5:06 PM
> To: Ni, Ruiyu ; edk2-devel@lists.01.org
> Cc: Zeng, Star 
> Subject: RE: [PATCH] PcAtChipsetPkg/PcRtc: Add two new PCD for RTC
> Index/Target registers
> 
> Two minor comments:
> 
> 1. PcAtChipsetPkg.uni also needs to be updated for the new PCDs.
> 
> 2. Update all the places of the two macros, or just update like below? Just 
> for
> you to consider. :) I do not insist.
> 
> #define PCAT_RTC_ADDRESS_REGISTER PcdGet8 (PcdRtcIndexRegister)
> #define PCAT_RTC_DATA_REGISTERPcdGet8 (PcdRtcTargetRegister))
> 
> 
> 
> Thanks,
> Star
> -Original Message-
> From: Ni, Ruiyu
> Sent: Friday, May 25, 2018 4:46 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star 
> Subject: [PATCH] PcAtChipsetPkg/PcRtc: Add two new PCD for RTC
> Index/Target registers
> 
> In certain HW implementation, the BIT7 of RTC Index register(0x70) is for
> NMI sources enable/disable but the BIT7 of 0x70 cannot be read before
> writing. Software which doesn't want to change the NMI sources
> enable/disable setting can write to the alias register 0x74, through which 
> only
> BIT0 ~ BIT6 of 0x70 is modified.
> So two new PCDs are added so that platform can have the flexibility to
> change the default RTC register addresses from 0x70/0x71 to 0x74/0x75.
> With the new PCDs added, it can also support special HW that provides RTC
> storage in a different register pairs.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Star Zeng 
> ---
>  PcAtChipsetPkg/PcAtChipsetPkg.dec  | 10 
> +-
>  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 10 +
> -
>  PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h |  5 +
>  .../PcatRealTimeClockRuntimeDxe.inf|  4 +++-
>  4 files changed, 18 insertions(+), 11 deletions(-)
> 
> diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dec
> b/PcAtChipsetPkg/PcAtChipsetPkg.dec
> index f11d2045a4..ace7fb7e88 100644
> --- a/PcAtChipsetPkg/PcAtChipsetPkg.dec
> +++ b/PcAtChipsetPkg/PcAtChipsetPkg.dec
> @@ -4,7 +4,7 @@
>  # This package is designed to public interfaces and implementation which
> follows  # PcAt defacto standard.
>  #
> -# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
> +# Copyright (c) 2009 - 2018, Intel Corporation. All rights
> +reserved.
>  # Copyright (c) 2017, AMD Inc. All rights reserved.  #  # This program
> and the accompanying materials @@ -194,5 +194,13 @@ [PcdsFixedAtBuild,
> PcdsPatchableInModule]
># @Prompt Initial value for Register_D in RTC.
> 
> gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterD|0x00|UINT8|
> 0x001D
> 
> +  ## Specifies RTC Index Register address in I/O space.
> +  # @Prompt RTC Index Register address
> +
> +
> gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|0x70|UINT8|0x
> 001
> + E
> +
> +  ## Specifies RTC Target Register address in I/O space.
> +  # @Prompt RTC Target Register address
> +
> gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister|0x71|UINT8|0x
> 00
> + 1F
> +
>  [UserExtensions.TianoCore."ExtraFiles"]
>PcAtChipsetPkgExtra.uni
> diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> index c032e16217..caecd0ac1e 100644
> --- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> +++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
> @@ -1,7 +1,7 @@
>  /** @file
>RTC Architectural Protocol GUID as defined in DxeCis 0.96.
> 
> -Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
>  Copyright (c) 2017, AMD Inc. All rights reserved.
> 
>  This program and the accompanying materials @@ -72,8 +72,8 @@ RtcRead (
>IN  UINT8 Address
>)
>  {
> -  IoWrite8 (PCAT_RTC_ADDRESS_REGISTER, (UINT8) (Address | (UINT8)
> (IoRead8 (PCAT_RTC_ADDRESS_REGISTER) & 0x80)));
> -  return IoRead8 (PCAT_RTC_DATA_REGISTER);
> +  IoWrite8 (PcdGet8 (PcdRtcIndexRegister), (UINT8) (Address | (UINT8)
> + (IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80)));  return IoRead8
> + (PcdGet8 (PcdRtcTargetRegister));
>  }
> 
>  /**
> @@ -90,8 +90,8 @@ RtcWrite (
>IN  UINT8   Data
>)
>  {
> -  IoWrite8 (PCAT_RTC_ADDRESS_REGISTER, (UINT8) (Address | (UINT8)
> (IoRead8 (PCAT_RTC_ADDRESS_REGISTER) & 0x80)));
> -  IoWrite8 (PCAT_RTC_DATA_REGISTER, Data);
> +  IoWrite8 (PcdGet8 (PcdRtcIndexRegister), (UINT8) (Address | (UINT8)
> + (IoRead8 (PcdGet8 (PcdRtcIndexRegister)) & 0x80)));
> +  IoWrite8 (PcdGet8 (PcdRtcTargetRegister), Data);
>  }
> 
>  /**
> diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
> b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
> 

Re: [edk2] [PATCH] PcAtChipsetPkg/PcRtc: Add two new PCD for RTC Index/Target registers

2018-05-25 Thread Zeng, Star
Two minor comments:

1. PcAtChipsetPkg.uni also needs to be updated for the new PCDs.

2. Update all the places of the two macros, or just update like below? Just for 
you to consider. :) I do not insist.

#define PCAT_RTC_ADDRESS_REGISTER PcdGet8 (PcdRtcIndexRegister)
#define PCAT_RTC_DATA_REGISTERPcdGet8 (PcdRtcTargetRegister))



Thanks,
Star
-Original Message-
From: Ni, Ruiyu 
Sent: Friday, May 25, 2018 4:46 PM
To: edk2-devel@lists.01.org
Cc: Zeng, Star 
Subject: [PATCH] PcAtChipsetPkg/PcRtc: Add two new PCD for RTC Index/Target 
registers

In certain HW implementation, the BIT7 of RTC Index register(0x70) is
for NMI sources enable/disable but the BIT7 of 0x70 cannot be read
before writing. Software which doesn't want to change the NMI sources
enable/disable setting can write to the alias register 0x74, through
which only BIT0 ~ BIT6 of 0x70 is modified.
So two new PCDs are added so that platform can have the flexibility
to change the default RTC register addresses from 0x70/0x71 to
0x74/0x75.
With the new PCDs added, it can also support special HW that provides
RTC storage in a different register pairs.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Star Zeng 
---
 PcAtChipsetPkg/PcAtChipsetPkg.dec  | 10 +-
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 10 +-
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h |  5 +
 .../PcatRealTimeClockRuntimeDxe.inf|  4 +++-
 4 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dec 
b/PcAtChipsetPkg/PcAtChipsetPkg.dec
index f11d2045a4..ace7fb7e88 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.dec
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.dec
@@ -4,7 +4,7 @@
 # This package is designed to public interfaces and implementation which 
follows
 # PcAt defacto standard.
 #
-# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
 # Copyright (c) 2017, AMD Inc. All rights reserved.
 #
 # This program and the accompanying materials
@@ -194,5 +194,13 @@ [PcdsFixedAtBuild, PcdsPatchableInModule]
   # @Prompt Initial value for Register_D in RTC.
   
gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterD|0x00|UINT8|0x001D
 
+  ## Specifies RTC Index Register address in I/O space.
+  # @Prompt RTC Index Register address
+  gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|0x70|UINT8|0x001E
+
+  ## Specifies RTC Target Register address in I/O space.
+  # @Prompt RTC Target Register address
+  gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister|0x71|UINT8|0x001F
+
 [UserExtensions.TianoCore."ExtraFiles"]
   PcAtChipsetPkgExtra.uni
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index c032e16217..caecd0ac1e 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -1,7 +1,7 @@
 /** @file
   RTC Architectural Protocol GUID as defined in DxeCis 0.96.
 
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 Copyright (c) 2017, AMD Inc. All rights reserved.
 
 This program and the accompanying materials
@@ -72,8 +72,8 @@ RtcRead (
   IN  UINT8 Address
   )
 {
-  IoWrite8 (PCAT_RTC_ADDRESS_REGISTER, (UINT8) (Address | (UINT8) (IoRead8 
(PCAT_RTC_ADDRESS_REGISTER) & 0x80)));
-  return IoRead8 (PCAT_RTC_DATA_REGISTER);
+  IoWrite8 (PcdGet8 (PcdRtcIndexRegister), (UINT8) (Address | (UINT8) (IoRead8 
(PcdGet8 (PcdRtcIndexRegister)) & 0x80)));
+  return IoRead8 (PcdGet8 (PcdRtcTargetRegister));
 }
 
 /**
@@ -90,8 +90,8 @@ RtcWrite (
   IN  UINT8   Data
   )
 {
-  IoWrite8 (PCAT_RTC_ADDRESS_REGISTER, (UINT8) (Address | (UINT8) (IoRead8 
(PCAT_RTC_ADDRESS_REGISTER) & 0x80)));
-  IoWrite8 (PCAT_RTC_DATA_REGISTER, Data);
+  IoWrite8 (PcdGet8 (PcdRtcIndexRegister), (UINT8) (Address | (UINT8) (IoRead8 
(PcdGet8 (PcdRtcIndexRegister)) & 0x80)));
+  IoWrite8 (PcdGet8 (PcdRtcTargetRegister), Data);
 }
 
 /**
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
index 8aeb12c88a..3b68f8cc9e 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
@@ -1,7 +1,7 @@
 /** @file
   Header file for real time clock driver.
 
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 Copyright (c) 2017, AMD Inc. All rights reserved.
 
 This program and the accompanying materials
@@ -47,9 +47,6 @@ typedef struct {
 
 extern PC_RTC_MODULE_GLOBALS  mModuleGlobal;
 
-#define PCAT_RTC_ADDRESS_REGISTER 0x70
-#define PCAT_RTC_DATA_REGISTER0x71
-
 //
 

[edk2] [PATCH] UefiCpuPkg/CpuCommonFeatures: Follow SDM for MAX CPUID feature detect

2018-05-25 Thread Ruiyu Ni
According to IA manual:
"Before setting this bit (MSR_IA32_MISC_ENABLE[22]) , BIOS must
execute the CPUID.0H and examine the maximum value returned in
EAX[7:0]. If the maximum value is greater than 2, this bit is
supported."

We need to fix our current detection logic to compare against 2.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Eric Dong 
Cc: Ming Shao 
---
 UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c 
b/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c
index 40cc9d5fe0..3d41efe9e9 100644
--- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c
@@ -1,7 +1,7 @@
 /** @file
   LimitCpuidMaxval Feature.
 
-  Copyright (c) 2017, Intel Corporation. All rights reserved.
+  Copyright (c) 2017 - 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
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -41,7 +41,7 @@ LimitCpuidMaxvalSupport (
   UINT32  Eax;
 
   AsmCpuid (CPUID_SIGNATURE, , NULL, NULL, NULL);
-  return (Eax > 3);
+  return (Eax > 2);
 }
 
 /**
-- 
2.16.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] PcAtChipsetPkg/PcRtc: Add two new PCD for RTC Index/Target registers

2018-05-25 Thread Ruiyu Ni
In certain HW implementation, the BIT7 of RTC Index register(0x70) is
for NMI sources enable/disable but the BIT7 of 0x70 cannot be read
before writing. Software which doesn't want to change the NMI sources
enable/disable setting can write to the alias register 0x74, through
which only BIT0 ~ BIT6 of 0x70 is modified.
So two new PCDs are added so that platform can have the flexibility
to change the default RTC register addresses from 0x70/0x71 to
0x74/0x75.
With the new PCDs added, it can also support special HW that provides
RTC storage in a different register pairs.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Star Zeng 
---
 PcAtChipsetPkg/PcAtChipsetPkg.dec  | 10 +-
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 10 +-
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h |  5 +
 .../PcatRealTimeClockRuntimeDxe.inf|  4 +++-
 4 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dec 
b/PcAtChipsetPkg/PcAtChipsetPkg.dec
index f11d2045a4..ace7fb7e88 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.dec
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.dec
@@ -4,7 +4,7 @@
 # This package is designed to public interfaces and implementation which 
follows
 # PcAt defacto standard.
 #
-# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
 # Copyright (c) 2017, AMD Inc. All rights reserved.
 #
 # This program and the accompanying materials
@@ -194,5 +194,13 @@ [PcdsFixedAtBuild, PcdsPatchableInModule]
   # @Prompt Initial value for Register_D in RTC.
   
gPcAtChipsetPkgTokenSpaceGuid.PcdInitialValueRtcRegisterD|0x00|UINT8|0x001D
 
+  ## Specifies RTC Index Register address in I/O space.
+  # @Prompt RTC Index Register address
+  gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|0x70|UINT8|0x001E
+
+  ## Specifies RTC Target Register address in I/O space.
+  # @Prompt RTC Target Register address
+  gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister|0x71|UINT8|0x001F
+
 [UserExtensions.TianoCore."ExtraFiles"]
   PcAtChipsetPkgExtra.uni
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index c032e16217..caecd0ac1e 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -1,7 +1,7 @@
 /** @file
   RTC Architectural Protocol GUID as defined in DxeCis 0.96.
 
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 Copyright (c) 2017, AMD Inc. All rights reserved.
 
 This program and the accompanying materials
@@ -72,8 +72,8 @@ RtcRead (
   IN  UINT8 Address
   )
 {
-  IoWrite8 (PCAT_RTC_ADDRESS_REGISTER, (UINT8) (Address | (UINT8) (IoRead8 
(PCAT_RTC_ADDRESS_REGISTER) & 0x80)));
-  return IoRead8 (PCAT_RTC_DATA_REGISTER);
+  IoWrite8 (PcdGet8 (PcdRtcIndexRegister), (UINT8) (Address | (UINT8) (IoRead8 
(PcdGet8 (PcdRtcIndexRegister)) & 0x80)));
+  return IoRead8 (PcdGet8 (PcdRtcTargetRegister));
 }
 
 /**
@@ -90,8 +90,8 @@ RtcWrite (
   IN  UINT8   Data
   )
 {
-  IoWrite8 (PCAT_RTC_ADDRESS_REGISTER, (UINT8) (Address | (UINT8) (IoRead8 
(PCAT_RTC_ADDRESS_REGISTER) & 0x80)));
-  IoWrite8 (PCAT_RTC_DATA_REGISTER, Data);
+  IoWrite8 (PcdGet8 (PcdRtcIndexRegister), (UINT8) (Address | (UINT8) (IoRead8 
(PcdGet8 (PcdRtcIndexRegister)) & 0x80)));
+  IoWrite8 (PcdGet8 (PcdRtcTargetRegister), Data);
 }
 
 /**
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
index 8aeb12c88a..3b68f8cc9e 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
@@ -1,7 +1,7 @@
 /** @file
   Header file for real time clock driver.
 
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 Copyright (c) 2017, AMD Inc. All rights reserved.
 
 This program and the accompanying materials
@@ -47,9 +47,6 @@ typedef struct {
 
 extern PC_RTC_MODULE_GLOBALS  mModuleGlobal;
 
-#define PCAT_RTC_ADDRESS_REGISTER 0x70
-#define PCAT_RTC_DATA_REGISTER0x71
-
 //
 // Dallas DS12C887 Real Time Clock
 //
diff --git 
a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
index 1b2b063623..4d1360744d 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
@@ -4,7 +4,7 @@
 # This driver provides GetTime, SetTime, GetWakeupTime, SetWakeupTime services 
to Runtime Service Table.
 # It will install a tagging protocol with 

Re: [edk2] [PATCH] MdeModulePkg/Library/BaseSerialPortLib16550: Ensure FIFO Polled Mode

2018-05-25 Thread Ni, Ruiyu
Reviewed-by: Ruiyu Ni 

Thanks/Ray

> -Original Message-
> From: edk2-devel  On Behalf Of Leo
> Duran
> Sent: Friday, May 25, 2018 3:08 AM
> To: edk2-devel@lists.01.org
> Cc: Dong, Eric ; Zeng, Star 
> Subject: [edk2] [PATCH] MdeModulePkg/Library/BaseSerialPortLib16550:
> Ensure FIFO Polled Mode
> 
> Put the UART in FIFO Polled Mode by clearing IER after setting FCR.
> Also, add comments to show DLAB state for registers 0 and 1.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Leo Duran 
> Cc: Star Zeng 
> CC: Eric Dong 
> ---
>  .../BaseSerialPortLib16550/BaseSerialPortLib16550.c  | 16 --
> --
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git
> a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
> b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
> index 0ccac96..6532c4d 100644
> ---
> a/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
> +++
> b/MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.c
> @@ -3,6 +3,8 @@
> 
>(C) Copyright 2014 Hewlett-Packard Development Company, L.P.
>Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
> +  Copyright (c) 2018, AMD Incorporated. All rights reserved.
> +
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of the BSD
> License
>which accompanies this distribution.  The full text of the license may be
> found at
> @@ -30,10 +32,11 @@
>  //
>  // 16550 UART register offsets and bitfields
>  //
> -#define R_UART_RXBUF  0
> -#define R_UART_TXBUF  0
> -#define R_UART_BAUD_LOW   0
> -#define R_UART_BAUD_HIGH  1
> +#define R_UART_RXBUF  0   // LCR_DLAB = 0
> +#define R_UART_TXBUF  0   // LCR_DLAB = 0
> +#define R_UART_BAUD_LOW   0   // LCR_DLAB = 1
> +#define R_UART_BAUD_HIGH  1   // LCR_DLAB = 1
> +#define R_UART_IER1   // LCR_DLAB = 0
>  #define R_UART_FCR2
>  #define   B_UART_FCR_FIFOEBIT0
>  #define   B_UART_FCR_FIFO64   BIT5
> @@ -554,6 +557,11 @@ SerialPortInitialize (
>SerialPortWriteRegister (SerialRegisterBase, R_UART_FCR,
> (UINT8)(PcdGet8 (PcdSerialFifoControl) & (B_UART_FCR_FIFOE |
> B_UART_FCR_FIFO64)));
> 
>//
> +  // Set FIFO Polled Mode by clearing IER after setting FCR
> +  //
> +  SerialPortWriteRegister (SerialRegisterBase, R_UART_IER, 0x00);
> +
> +  //
>// Put Modem Control Register(MCR) into its reset state of 0x00.
>//
>SerialPortWriteRegister (SerialRegisterBase, R_UART_MCR, 0x00);
> --
> 2.7.4
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [edk2-platforms Patch v3 4/6] Styx/PlatformFlashAccessLib: Add progress API

2018-05-25 Thread Michael D Kinney
From: "Kinney, Michael D" 

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

Add PerformFlashWriteWithProgress() to the PlatformFlashAccessLib.
This allows the platform to inform the user of progress when a
firmware storage device is being updated with a new firmware
image.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../StyxPlatformFlashAccessLib.c   | 70 +++---
 1 file changed, 63 insertions(+), 7 deletions(-)

diff --git 
a/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c
 
b/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c
index a94373bb4b..38f1830b5c 100644
--- 
a/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c
+++ 
b/Silicon/AMD/Styx/Library/StyxPlatformFlashAccessLib/StyxPlatformFlashAccessLib.c
@@ -2,6 +2,7 @@
   Platform flash device access library for AMD Styx
 
   Copyright (c) 2017, Linaro, Ltd. All rights reserved.
+  Copyright (c) 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
@@ -27,13 +28,29 @@ STATIC CONST UINT64 mFlashMaxSize = FixedPcdGet64 
(PcdFdSize);
 STATIC CONST UINTN mBlockSize = SIZE_64KB;
 
 /**
-  Perform flash write operation.
+  Perform flash write operation with progress indicator.  The start and end
+  completion percentage values are passed into this function.  If the requested
+  flash write operation is broken up, then completion percentage between the
+  start and end values may be passed to the provided Progress function.  The
+  caller of this function is required to call the Progress function for the
+  start and end completion percentage values.  This allows the Progress,
+  StartPercentage, and EndPercentage parameters to be ignored if the requested
+  flash write operation can not be broken up
 
   @param[in] FirmwareType  The type of firmware.
   @param[in] FlashAddress  The address of flash device to be accessed.
   @param[in] FlashAddressType  The type of flash device address.
   @param[in] BufferThe pointer to the data buffer.
   @param[in] LengthThe length of data buffer in bytes.
+  @param[in] Progress  A function used report the progress of the
+   firmware update.  This is an optional parameter
+   that may be NULL.
+  @param[in] StartPercentage   The start completion percentage value that may
+   be used to report progress during the flash
+   write operation.
+  @param[in] EndPercentage The end completion percentage value that may
+   be used to report progress during the flash
+   write operation.
 
   @retval EFI_SUCCESS   The operation returns successfully.
   @retval EFI_WRITE_PROTECTED   The flash device is read only.
@@ -42,12 +59,15 @@ STATIC CONST UINTN mBlockSize = SIZE_64KB;
 **/
 EFI_STATUS
 EFIAPI
-PerformFlashWrite (
-  IN PLATFORM_FIRMWARE_TYPE   FirmwareType,
-  IN EFI_PHYSICAL_ADDRESS FlashAddress,
-  IN FLASH_ADDRESS_TYPE   FlashAddressType,
-  IN VOID *Buffer,
-  IN UINTNLength
+PerformFlashWriteWithProgress (
+  IN PLATFORM_FIRMWARE_TYPE FirmwareType,
+  IN EFI_PHYSICAL_ADDRESS   FlashAddress,
+  IN FLASH_ADDRESS_TYPE FlashAddressType,
+  IN VOID   *Buffer,
+  IN UINTN  Length,
+  IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS  Progress,OPTIONAL
+  IN UINTN  StartPercentage,
+  IN UINTN  EndPercentage
   )
 {
   EFI_STATUS  Status;
@@ -122,3 +142,39 @@ PerformFlashWrite (
 
   return EFI_SUCCESS;
 }
+
+/**
+  Perform flash write operation.
+
+  @param[in] FirmwareType  The type of firmware.
+  @param[in] FlashAddress  The address of flash device to be accessed.
+  @param[in] FlashAddressType  The type of flash device address.
+  @param[in] BufferThe pointer to the data buffer.
+  @param[in] LengthThe length of data buffer in bytes.
+
+  @retval EFI_SUCCESS   The operation returns successfully.
+  @retval EFI_WRITE_PROTECTED   The flash device is read only.
+  @retval EFI_UNSUPPORTED   The flash device access is unsupported.
+  @retval EFI_INVALID_PARAMETER The input parameter is not valid.
+**/
+EFI_STATUS
+EFIAPI
+PerformFlashWrite (
+  IN PLATFORM_FIRMWARE_TYPE   FirmwareType,
+  IN 

[edk2] [edk2-platforms Patch v3 1/6] AMD/OverdriveBoard: Add DisplayUpdateProgressLib mapping

2018-05-25 Thread Michael D Kinney
From: "Kinney, Michael D" 

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

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
index 5e564f66b8..aad5f472e4 100644
--- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
+++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
@@ -125,6 +125,7 @@ [LibraryClasses.common]
   
RealTimeClockLib|Silicon/AMD/Styx/Library/RealTimeClockLib/RealTimeClockLib.inf
 
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
+  
DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
 !if $(DO_CAPSULE) == TRUE
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
-- 
2.14.2.windows.3

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [edk2-platforms Patch v3 5/6] Hisilicon/PlatformFlashAccessLib: Add progress API

2018-05-25 Thread Michael D Kinney
From: "Kinney, Michael D" 

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

Add PerformFlashWriteWithProgress() to the PlatformFlashAccessLib.
This allows the platform to inform the user of progress when a
firmware storage device is being updated with a new firmware
image.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../PlatformFlashAccessLibDxe.c| 71 +++---
 1 file changed, 63 insertions(+), 8 deletions(-)

diff --git 
a/Silicon/Hisilicon/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c 
b/Silicon/Hisilicon/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c
index 62da61c79b..585f7ef0e8 100644
--- 
a/Silicon/Hisilicon/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c
+++ 
b/Silicon/Hisilicon/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c
@@ -3,7 +3,7 @@
 
   Copyright (c) 2018, Hisilicon Limited. All rights reserved.
   Copyright (c) 2018, Linaro Limited. All rights reserved.
-  Copyright (c) 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2016 - 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
@@ -30,13 +30,29 @@ STATIC EFI_PHYSICAL_ADDRESS mSFCMEM0BaseAddress;
 STATIC HISI_SPI_FLASH_PROTOCOL *mSpiProtocol;
 
 /**
-  Perform flash write opreation.
+  Perform flash write operation with progress indicator.  The start and end
+  completion percentage values are passed into this function.  If the requested
+  flash write operation is broken up, then completion percentage between the
+  start and end values may be passed to the provided Progress function.  The
+  caller of this function is required to call the Progress function for the
+  start and end completion percentage values.  This allows the Progress,
+  StartPercentage, and EndPercentage parameters to be ignored if the requested
+  flash write operation can not be broken up
 
   @param[in] FirmwareType  The type of firmware.
   @param[in] FlashAddress  The address of flash device to be accessed.
   @param[in] FlashAddressType  The type of flash device address.
   @param[in] BufferThe pointer to the data buffer.
   @param[in] LengthThe length of data buffer in bytes.
+  @param[in] Progress  A function used report the progress of the
+   firmware update.  This is an optional parameter
+   that may be NULL.
+  @param[in] StartPercentage   The start completion percentage value that may
+   be used to report progress during the flash
+   write operation.
+  @param[in] EndPercentage The end completion percentage value that may
+   be used to report progress during the flash
+   write operation.
 
   @retval EFI_SUCCESS   The operation returns successfully.
   @retval EFI_WRITE_PROTECTED   The flash device is read only.
@@ -45,12 +61,15 @@ STATIC HISI_SPI_FLASH_PROTOCOL *mSpiProtocol;
 **/
 EFI_STATUS
 EFIAPI
-PerformFlashWrite (
-  IN PLATFORM_FIRMWARE_TYPE   FirmwareType,
-  IN EFI_PHYSICAL_ADDRESS FlashAddress,
-  IN FLASH_ADDRESS_TYPE   FlashAddressType,
-  IN VOID *Buffer,
-  IN UINTNLength
+PerformFlashWriteWithProgress (
+  IN PLATFORM_FIRMWARE_TYPE FirmwareType,
+  IN EFI_PHYSICAL_ADDRESS   FlashAddress,
+  IN FLASH_ADDRESS_TYPE FlashAddressType,
+  IN VOID   *Buffer,
+  IN UINTN  Length,
+  IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS  Progress,OPTIONAL
+  IN UINTN  StartPercentage,
+  IN UINTN  EndPercentage
   )
 {
   UINT32   RomAddress;
@@ -83,6 +102,42 @@ PerformFlashWrite (
   return Status;
 }
 
+/**
+  Perform flash write operation.
+
+  @param[in] FirmwareType  The type of firmware.
+  @param[in] FlashAddress  The address of flash device to be accessed.
+  @param[in] FlashAddressType  The type of flash device address.
+  @param[in] BufferThe pointer to the data buffer.
+  @param[in] LengthThe length of data buffer in bytes.
+
+  @retval EFI_SUCCESS   The operation returns successfully.
+  @retval EFI_WRITE_PROTECTED   The flash device is read only.
+  @retval EFI_UNSUPPORTED   The flash device access is unsupported.
+  @retval EFI_INVALID_PARAMETER The input parameter is not valid.
+**/
+EFI_STATUS
+EFIAPI

[edk2] [edk2-platforms Patch v3 3/6] Socionext/SynQuacerEvalBoard: Add DisplayUpdateProgressLib mapping

2018-05-25 Thread Michael D Kinney
From: "Kinney, Michael D" 

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

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc 
b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
index aa34fb075d..402319bdfe 100644
--- a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
+++ b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
@@ -171,6 +171,7 @@ [LibraryClasses.common.DXE_DRIVER]
   # Firmware update
   #
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
+  
DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
   
EdkiiSystemCapsuleLib|SignedCapsulePkg/Library/EdkiiSystemCapsuleLib/EdkiiSystemCapsuleLib.inf
   
FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf
   
PlatformFlashAccessLib|Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf
-- 
2.14.2.windows.3

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [edk2-platforms Patch v3 6/6] SynQuacer/PlatformFlashAccessLib: Add progress API

2018-05-25 Thread Michael D Kinney
From: "Kinney, Michael D" 

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

Add PerformFlashWriteWithProgress() to the PlatformFlashAccessLib.
This allows the platform to inform the user of progress when a
firmware storage device is being updated with a new firmware
image.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../SynQuacerPlatformFlashAccessLib.c  | 78 +++---
 1 file changed, 67 insertions(+), 11 deletions(-)

diff --git 
a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c
 
b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c
index fbb8f1f9e4..4cf8318a93 100644
--- 
a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c
+++ 
b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c
@@ -2,6 +2,7 @@
   Platform flash device access library for Socionext SynQuacer
 
   Copyright (c) 2016, Linaro, Ltd. All rights reserved.
+  Copyright (c) 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
@@ -117,13 +118,29 @@ GetFvbByAddress (
 }
 
 /**
-  Perform flash write operation.
+  Perform flash write operation with progress indicator.  The start and end
+  completion percentage values are passed into this function.  If the requested
+  flash write operation is broken up, then completion percentage between the
+  start and end values may be passed to the provided Progress function.  The
+  caller of this function is required to call the Progress function for the
+  start and end completion percentage values.  This allows the Progress,
+  StartPercentage, and EndPercentage parameters to be ignored if the requested
+  flash write operation can not be broken up
 
   @param[in] FirmwareType  The type of firmware.
   @param[in] FlashAddress  The address of flash device to be accessed.
   @param[in] FlashAddressType  The type of flash device address.
   @param[in] BufferThe pointer to the data buffer.
   @param[in] LengthThe length of data buffer in bytes.
+  @param[in] Progress  A function used report the progress of the
+   firmware update.  This is an optional parameter
+   that may be NULL.
+  @param[in] StartPercentage   The start completion percentage value that may
+   be used to report progress during the flash
+   write operation.
+  @param[in] EndPercentage The end completion percentage value that may
+   be used to report progress during the flash
+   write operation.
 
   @retval EFI_SUCCESS   The operation returns successfully.
   @retval EFI_WRITE_PROTECTED   The flash device is read only.
@@ -132,12 +149,15 @@ GetFvbByAddress (
 **/
 EFI_STATUS
 EFIAPI
-PerformFlashWrite (
-  IN PLATFORM_FIRMWARE_TYPE   FirmwareType,
-  IN EFI_PHYSICAL_ADDRESS FlashAddress,
-  IN FLASH_ADDRESS_TYPE   FlashAddressType,
-  IN VOID *Buffer,
-  IN UINTNLength
+PerformFlashWriteWithProgress (
+  IN PLATFORM_FIRMWARE_TYPE FirmwareType,
+  IN EFI_PHYSICAL_ADDRESS   FlashAddress,
+  IN FLASH_ADDRESS_TYPE FlashAddressType,
+  IN VOID   *Buffer,
+  IN UINTN  Length,
+  IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS  Progress,OPTIONAL
+  IN UINTN  StartPercentage,
+  IN UINTN  EndPercentage
   )
 {
   EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *Fvb;
@@ -150,7 +170,7 @@ PerformFlashWrite (
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black;
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White;
   UINTN   Resolution;
-  UINTN   Progress;
+  UINTN   CurrentProgress;
   BOOLEAN HaveBootGraphics;
 
   Black.Raw = 0x;
@@ -228,7 +248,7 @@ PerformFlashWrite (
 
   if (HaveBootGraphics) {
 Resolution = (BlockSize * 100) / Length + 1;
-Progress = 0;
+CurrentProgress = 0;
 
 Status = BootLogoUpdateProgress (White.Pixel, Black.Pixel,
L"Updating firmware - please wait", Black.Pixel, 100, 0);
@@ -268,8 +288,8 @@ PerformFlashWrite (
 if (HaveBootGraphics) {
   Status = BootLogoUpdateProgress (White.Pixel, Black.Pixel,
 

[edk2] [edk2-platforms Patch v3 2/6] Socionext/DeveloperBox: Add DisplayUpdateProgressLib mapping

2018-05-25 Thread Michael D Kinney
From: "Kinney, Michael D" 

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

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 Platform/Socionext/DeveloperBox/DeveloperBox.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc 
b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
index 24b2925bf9..b4f87deb5b 100644
--- a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
+++ b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
@@ -174,6 +174,7 @@ [LibraryClasses.common.DXE_DRIVER]
   # Firmware update
   #
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
+  
DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
   
EdkiiSystemCapsuleLib|SignedCapsulePkg/Library/EdkiiSystemCapsuleLib/EdkiiSystemCapsuleLib.inf
   
FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf
   
PlatformFlashAccessLib|Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.inf
-- 
2.14.2.windows.3

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [edk2-platforms Patch v3 0/6] Add DisplayUpdateProgressLib to platforms

2018-05-25 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=801

Based on content from:

https://github.com/Microsoft/MS_UEFI/blob/share/MsCapsuleSupport/MsCapsuleUpdatePkg/Include/Library/DisplayUpdateProgressLib.h
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg/Library/DisplayUpdateProgressGraphicsLib
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg/Library/DisplayUpdateProgressTextLib

Updates for V3
==
* Add Version field to EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL
* Break up patch series into 4 smaller patch series to handle dependencies
  between the edk2 repository and the edk2-platforms repository.
  + Patch series for edk2 repo that adds DisplayUpdateProgressLib class and 
instances.  Defines the EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL.
Adds PerformFlashWriteWithProgress() API to the PlatformFlashAccessLib.
  + Patch series for platforms in edk2-platforms that use capsules to add the
DisplayUpdateProgressLib mapping to the DSC files and add the
PerformFlashWriteWithProgress() API implementation to the
PlatformFlashAccessLib implementations.
  + Patch series for platforms in edk2 that use capsules to add the
DisplayUpdateProgressLib mapping to the DSC files and add the
PerformFlashWriteWithProgress() API implementation to the
PlatformFlashAccessLib implementations.
  + Patch for edk2 that adds the use of the DisplayUpateProgressLib and the 
PerformFlashWriteWithProgress() API .

Updates for V2
==
* Change DisplayUpdateProgressGraphicsLib to DisplayUpdateProgressLibGraphics
* Change DisplayUpdateProgressTextLib to DisplayUpdateProgressLibText
* Clarify that color in Firmware Management Progress Protocol is the foreground 
color
* Add missing parameters to PerformFlashWriteWithProgress() function header.
* Update PerformFlashWriteWithProgress() function header describing the use of
  the start and end percentage values.
* Update QuarkPlatformPkg PerformFlashWriteWithProgress() to call Progress() for
  the end precentage.
* Update Vlv2Tbl2DevicePkg PerformFlashWriteWithProgress() to call Progress()
  for the end precentage.

Add DisplayUpdateProgressLib class along implementations for both graphical
(Graphics Output Protocol based) and text (Simple Text Output Protocol based)
consoles.  Also add the EDK II Firmware Management Progress Protocol that is an
optional protocol that provides the progress bar color and a watchdog timeout
value thaty can be used when a firmware image is updated in a firmware device.

* Add progress support to DxeCapsuleLibFmp
* Add progress support to SystemFirmwareUpdateDxe
* Add progress support to PlatformFlashAccessLib class and instances.
* Reduce Print() calls during a firmware update.

Cc: Sean Brogan 
Cc: Star Zeng 
Cc: Eric Dong 
Cc: Jiewen Yao 
Cc: David Wei 
Cc: Mang Guo 
Cc: Kelly Steele 

Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1

Kinney, Michael D (6):
  AMD/OverdriveBoard: Add DisplayUpdateProgressLib mapping
  Socionext/DeveloperBox: Add DisplayUpdateProgressLib mapping
  Socionext/SynQuacerEvalBoard: Add DisplayUpdateProgressLib mapping
  Styx/PlatformFlashAccessLib: Add progress API
  Hisilicon/PlatformFlashAccessLib: Add progress API
  SynQuacer/PlatformFlashAccessLib: Add progress API

 Platform/AMD/OverdriveBoard/OverdriveBoard.dsc |  1 +
 Platform/Socionext/DeveloperBox/DeveloperBox.dsc   |  1 +
 .../SynQuacerEvalBoard/SynQuacerEvalBoard.dsc  |  1 +
 .../StyxPlatformFlashAccessLib.c   | 70 +--
 .../PlatformFlashAccessLibDxe.c| 71 +---
 .../SynQuacerPlatformFlashAccessLib.c  | 78 +++---
 6 files changed, 196 insertions(+), 26 deletions(-)

-- 
2.14.2.windows.3

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch v3 4/4] QuarkPlatformPkg/PlatformFlashAccessLib: Add progress API

2018-05-25 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=801

Add PerformFlashWriteWithProgress() to the PlatformFlashAccessLib.
This allows the platform to inform the user of progress when a
firmware storage device is being updated with a new firmware
image.

Cc: Kelly Steele 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../PlatformFlashAccessLibDxe.c| 78 +++---
 1 file changed, 70 insertions(+), 8 deletions(-)

diff --git 
a/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c
 
b/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c
index 839c3a726e..69d76df785 100644
--- 
a/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c
+++ 
b/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c
@@ -1,7 +1,7 @@
 /** @file
   Platform Flash Access library.
 
-  Copyright (c) 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2016 - 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
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -112,13 +112,29 @@ FlashFdErase (
 }
 
 /**
-  Perform flash write opreation.
+  Perform flash write operation with progress indicator.  The start and end
+  completion percentage values are passed into this function.  If the requested
+  flash write operation is broken up, then completion percentage between the
+  start and end values may be passed to the provided Progress function.  The
+  caller of this function is required to call the Progress function for the
+  start and end completion percentage values.  This allows the Progress,
+  StartPercentage, and EndPercentage parameters to be ignored if the requested
+  flash write operation can not be broken up
 
   @param[in] FirmwareType  The type of firmware.
   @param[in] FlashAddress  The address of flash device to be accessed.
   @param[in] FlashAddressType  The type of flash device address.
   @param[in] BufferThe pointer to the data buffer.
   @param[in] LengthThe length of data buffer in bytes.
+  @param[in] Progress  A function used report the progress of the
+   firmware update.  This is an optional parameter
+   that may be NULL.
+  @param[in] StartPercentage   The start completion percentage value that may
+   be used to report progress during the flash
+   write operation.
+  @param[in] EndPercentage The end completion percentage value that may
+   be used to report progress during the flash
+   write operation.
 
   @retval EFI_SUCCESS   The operation returns successfully.
   @retval EFI_WRITE_PROTECTED   The flash device is read only.
@@ -127,12 +143,15 @@ FlashFdErase (
 **/
 EFI_STATUS
 EFIAPI
-PerformFlashWrite (
-  IN PLATFORM_FIRMWARE_TYPE   FirmwareType,
-  IN EFI_PHYSICAL_ADDRESS FlashAddress,
-  IN FLASH_ADDRESS_TYPE   FlashAddressType,
-  IN VOID *Buffer,
-  IN UINTNLength
+PerformFlashWriteWithProgress (
+  IN PLATFORM_FIRMWARE_TYPE FirmwareType,
+  IN EFI_PHYSICAL_ADDRESS   FlashAddress,
+  IN FLASH_ADDRESS_TYPE FlashAddressType,
+  IN VOID   *Buffer,
+  IN UINTN  Length,
+  IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS  Progress,OPTIONAL
+  IN UINTN  StartPercentage,
+  IN UINTN  EndPercentage
   )
 {
   EFI_STATUS  Status;
@@ -150,6 +169,10 @@ PerformFlashWrite (
   //
   SectorNum = Length / SPI_ERASE_SECTOR_SIZE;
   for (Index = 0; Index < SectorNum; Index++){
+if (Progress != NULL) {
+  Progress (StartPercentage + ((Index * (EndPercentage - StartPercentage)) 
/ SectorNum));
+}
+
 if (CompareMem(
   (UINT8 *)(UINTN)(FlashAddress + mInternalFdAddress) + Index * 
SPI_ERASE_SECTOR_SIZE,
   (UINT8 *)Buffer + Index * SPI_ERASE_SECTOR_SIZE,
@@ -175,10 +198,49 @@ PerformFlashWrite (
   break;
 }
   }
+  if (Progress != NULL) {
+Progress (EndPercentage);
+  }
 
   return EFI_SUCCESS;
 }
 
+/**
+  Perform flash write operation.
+
+  @param[in] FirmwareType  The type of firmware.
+  @param[in] FlashAddress  The address of flash device to be accessed.
+  @param[in] FlashAddressType  The type of flash device address.
+  @param[in] BufferThe pointer to the data buffer.
+ 

[edk2] [Patch v3 1/4] Vlv2Tbl2DevicePkg: Add DisplayUpdateProgressLib mapping

2018-05-25 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=801

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport

Cc: Sean Brogan 
Cc: David Wei 
Cc: Mang Guo 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 1 +
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 1 +
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc| 1 +
 3 files changed, 3 insertions(+)

diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
index f918e44851..b6741257e7 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
@@ -195,6 +195,7 @@ [LibraryClasses.common]
   IniParsingLib|SignedCapsulePkg/Library/IniParsingLib/IniParsingLib.inf
   
PlatformFlashAccessLib|Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.inf
   
MicrocodeFlashAccessLib|Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.inf
+  
DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
   
LanguageLib|EdkCompatibilityPkg/Compatibility/Library/UefiLanguageLib/UefiLanguageLib.inf
   
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
   
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
diff --git a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
index 0a95d95557..bd276f0643 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
@@ -195,6 +195,7 @@ [LibraryClasses.common]
   IniParsingLib|SignedCapsulePkg/Library/IniParsingLib/IniParsingLib.inf
   
PlatformFlashAccessLib|Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.inf
   
MicrocodeFlashAccessLib|Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.inf
+  
DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
   
LanguageLib|EdkCompatibilityPkg/Compatibility/Library/UefiLanguageLib/UefiLanguageLib.inf
   
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
   
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
diff --git a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
index fb2743c727..042a35b2b7 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
@@ -195,6 +195,7 @@ [LibraryClasses.common]
   IniParsingLib|SignedCapsulePkg/Library/IniParsingLib/IniParsingLib.inf
   
PlatformFlashAccessLib|Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.inf
   
MicrocodeFlashAccessLib|Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.inf
+  
DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
   
LanguageLib|EdkCompatibilityPkg/Compatibility/Library/UefiLanguageLib/UefiLanguageLib.inf
   
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
   
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
-- 
2.14.2.windows.3

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch v3 0/4] Add DisplayUpdateProgressLib to platforms

2018-05-25 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=801

Based on content from:

https://github.com/Microsoft/MS_UEFI/blob/share/MsCapsuleSupport/MsCapsuleUpdatePkg/Include/Library/DisplayUpdateProgressLib.h
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg/Library/DisplayUpdateProgressGraphicsLib
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg/Library/DisplayUpdateProgressTextLib

Updates for V3
==
* Add Version field to EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL
* Break up patch series into 4 smaller patch series to handle dependencies
  between the edk2 repository and the edk2-platforms repository.
  + Patch series for edk2 repo that adds DisplayUpdateProgressLib class and 
instances.  Defines the EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL.
Adds PerformFlashWriteWithProgress() API to the PlatformFlashAccessLib.
  + Patch series for platforms in edk2-platforms that use capsules to add the
DisplayUpdateProgressLib mapping to the DSC files and add the
PerformFlashWriteWithProgress() API implementation to the
PlatformFlashAccessLib implementations.
  + Patch series for platforms in edk2 that use capsules to add the
DisplayUpdateProgressLib mapping to the DSC files and add the
PerformFlashWriteWithProgress() API implementation to the
PlatformFlashAccessLib implementations.
  + Patch for edk2 that adds the use of the DisplayUpateProgressLib and the 
PerformFlashWriteWithProgress() API .

Updates for V2
==
* Change DisplayUpdateProgressGraphicsLib to DisplayUpdateProgressLibGraphics
* Change DisplayUpdateProgressTextLib to DisplayUpdateProgressLibText
* Clarify that color in Firmware Management Progress Protocol is the foreground 
color
* Add missing parameters to PerformFlashWriteWithProgress() function header.
* Update PerformFlashWriteWithProgress() function header describing the use of
  the start and end percentage values.
* Update QuarkPlatformPkg PerformFlashWriteWithProgress() to call Progress() for
  the end precentage.
* Update Vlv2Tbl2DevicePkg PerformFlashWriteWithProgress() to call Progress()
  for the end precentage.

Add DisplayUpdateProgressLib class along implementations for both graphical
(Graphics Output Protocol based) and text (Simple Text Output Protocol based)
consoles.  Also add the EDK II Firmware Management Progress Protocol that is an
optional protocol that provides the progress bar color and a watchdog timeout
value thaty can be used when a firmware image is updated in a firmware device.

* Add progress support to DxeCapsuleLibFmp
* Add progress support to SystemFirmwareUpdateDxe
* Add progress support to PlatformFlashAccessLib class and instances.
* Reduce Print() calls during a firmware update.

Cc: Sean Brogan 
Cc: Star Zeng 
Cc: Eric Dong 
Cc: Jiewen Yao 
Cc: David Wei 
Cc: Mang Guo 
Cc: Kelly Steele 

Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1

Kinney, Michael D (1):
  QuarkPlatformPkg: Add DisplayUpdateProgressLib mapping

Michael D Kinney (3):
  Vlv2Tbl2DevicePkg: Add DisplayUpdateProgressLib mapping
  Vlv2TbltDevicePkg/PlatformFlashAccessLib: Add progress API
  QuarkPlatformPkg/PlatformFlashAccessLib: Add progress API

 .../PlatformFlashAccessLibDxe.c|  78 ++--
 QuarkPlatformPkg/Quark.dsc |   1 +
 .../PlatformFlashAccessLib.c   | 102 +++--
 .../PlatformFlashAccessLib.inf |   3 +-
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc|   1 +
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc  |   1 +
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc   |   1 +
 7 files changed, 151 insertions(+), 36 deletions(-)

-- 
2.14.2.windows.3

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch v3 3/4] QuarkPlatformPkg: Add DisplayUpdateProgressLib mapping

2018-05-25 Thread Michael D Kinney
From: "Kinney, Michael D" 

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

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport

Cc: Sean Brogan 
Cc: Kelly Steele 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 QuarkPlatformPkg/Quark.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/QuarkPlatformPkg/Quark.dsc b/QuarkPlatformPkg/Quark.dsc
index a43a5595d4..14142087bd 100644
--- a/QuarkPlatformPkg/Quark.dsc
+++ b/QuarkPlatformPkg/Quark.dsc
@@ -241,6 +241,7 @@ [LibraryClasses]
   
FmpAuthenticationLib|MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.inf
   IniParsingLib|SignedCapsulePkg/Library/IniParsingLib/IniParsingLib.inf
   
PlatformFlashAccessLib|QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.inf
+  
DisplayUpdateProgressLib|MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressLibText.inf
 
 [LibraryClasses.common.SEC]
   #
-- 
2.14.2.windows.3

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch v3 2/4] Vlv2TbltDevicePkg/PlatformFlashAccessLib: Add progress API

2018-05-25 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=801

Add PerformFlashWriteWithProgress() to the PlatformFlashAccessLib.
This allows the platform to inform the user of progress when a
firmware storage device is being updated with a new firmware
image.

Cc: David Wei 
Cc: Mang Guo 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../PlatformFlashAccessLib.c   | 102 +++--
 .../PlatformFlashAccessLib.inf |   3 +-
 2 files changed, 77 insertions(+), 28 deletions(-)

diff --git 
a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
 
b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
index 9162e025ed..06278d202a 100644
--- 
a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
+++ 
b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
@@ -1,7 +1,7 @@
 /** @file
   Platform Flash Access library.
 
-  Copyright (c) 2017, Intel Corporation. All rights reserved.
+  Copyright (c) 2016 - 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
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -381,13 +381,29 @@ InternalWriteBlock (
 }
 
 /**
-  Perform flash write opreation.
+  Perform flash write operation with progress indicator.  The start and end
+  completion percentage values are passed into this function.  If the requested
+  flash write operation is broken up, then completion percentage between the
+  start and end values may be passed to the provided Progress function.  The
+  caller of this function is required to call the Progress function for the
+  start and end completion percentage values.  This allows the Progress,
+  StartPercentage, and EndPercentage parameters to be ignored if the requested
+  flash write operation can not be broken up
 
   @param[in] FirmwareType  The type of firmware.
   @param[in] FlashAddress  The address of flash device to be accessed.
   @param[in] FlashAddressType  The type of flash device address.
   @param[in] BufferThe pointer to the data buffer.
   @param[in] LengthThe length of data buffer in bytes.
+  @param[in] Progress  A function used report the progress of the
+   firmware update.  This is an optional parameter
+   that may be NULL.
+  @param[in] StartPercentage   The start completion percentage value that may
+   be used to report progress during the flash
+   write operation.
+  @param[in] EndPercentage The end completion percentage value that may
+   be used to report progress during the flash
+   write operation.
 
   @retval EFI_SUCCESS   The operation returns successfully.
   @retval EFI_WRITE_PROTECTED   The flash device is read only.
@@ -396,12 +412,15 @@ InternalWriteBlock (
 **/
 EFI_STATUS
 EFIAPI
-PerformFlashWrite (
-  IN PLATFORM_FIRMWARE_TYPE   FirmwareType,
-  IN EFI_PHYSICAL_ADDRESS FlashAddress,
-  IN FLASH_ADDRESS_TYPE   FlashAddressType,
-  IN VOID *Buffer,
-  IN UINTNLength
+PerformFlashWriteWithProgress (
+  IN PLATFORM_FIRMWARE_TYPE FirmwareType,
+  IN EFI_PHYSICAL_ADDRESS   FlashAddress,
+  IN FLASH_ADDRESS_TYPE FlashAddressType,
+  IN VOID   *Buffer,
+  IN UINTN  Length,
+  IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS  Progress,OPTIONAL
+  IN UINTN  StartPercentage,
+  IN UINTN  EndPercentage
   )
 {
   EFI_STATUSStatus = EFI_SUCCESS;
@@ -456,42 +475,40 @@ PerformFlashWrite (
 // Raise TPL to TPL_NOTIFY to block any event handler,
 // while still allowing RaiseTPL(TPL_NOTIFY) within
 // output driver during Print()
-  //
+//
 OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
 for (Index = 0; Index < CountOfBlocks; Index++) {
+  if (Progress != NULL) {
+Progress (StartPercentage + ((Index * (EndPercentage - 
StartPercentage)) / CountOfBlocks));
+  }
   //
   // Handle block based on address and contents.
   //
   if (!EFI_ERROR (InternalCompareBlock (Address, Buf))) {
 DEBUG((DEBUG_INFO, "Skipping block at 0x%lx (already programmed)\n", 
Address));
   } else {
-//
-// Display a dot for each block being updated.
-//
-Print (L".");
-
 

[edk2] [Patch v3 2/3] MdeModulePkg: Add DisplayUpdateProgressLib instances

2018-05-25 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=801

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport

Add DisplayUpdateProgressLib instances for text consoles
and graphical consoles.

Cc: Sean Brogan 
Cc: Star Zeng 
Cc: Eric Dong 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../DisplayUpdateProgressLibGraphics.c | 475 +
 .../DisplayUpdateProgressLibGraphics.inf   |  60 +++
 .../DisplayUpdateProgressLibGraphics.uni   |  18 +
 .../DisplayUpdateProgressLibText.c | 174 
 .../DisplayUpdateProgressLibText.inf   |  53 +++
 .../DisplayUpdateProgressLibText.uni   |  18 +
 MdeModulePkg/MdeModulePkg.dsc  |   3 +
 7 files changed, 801 insertions(+)
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.c
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.uni
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressLibText.c
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressLibText.inf
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressLibText.uni

diff --git 
a/MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.c
 
b/MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.c
new file mode 100644
index 00..007522cea0
--- /dev/null
+++ 
b/MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.c
@@ -0,0 +1,475 @@
+/**  @file
+  Provides services to display completion progress of a firmware update on a
+  graphical console that supports the Graphics Output Protocol.
+
+  Copyright (c) 2016, Microsoft Corporation. All rights reserved.
+  Copyright (c) 2018, Intel 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.
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+//
+// Values in percent of of logo height.
+//
+#define LOGO_BOTTOM_PADDING20
+#define PROGRESS_BLOCK_HEIGHT  10
+
+//
+// Graphics Output Protocol instance to display progress bar
+//
+EFI_GRAPHICS_OUTPUT_PROTOCOL  *mGop = NULL;
+
+//
+// Set to 100 percent so it is reset on first call.
+//
+UINTN mPreviousProgress = 100;
+
+//
+// Display coordinates for the progress bar.
+//
+UINTN  mStartX = 0;
+UINTN  mStartY = 0;
+
+//
+// Width and height of the progress bar.
+//
+UINTN  mBlockWidth  = 0;
+UINTN  mBlockHeight = 0;
+
+//
+// GOP bitmap of the progress bar. Initialized on every new progress of 100%
+//
+EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *mBlockBitmap;
+
+//
+// GOP bitmap of the progress bar backround.  Initialized once.
+//
+EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *mProgressBarBackground;
+
+//
+// Default mask used to detect the left, right , top, and bottom of logo.  Only
+// green and blue pixels are used for logo detection.
+//
+const EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION  mLogoDetectionColorMask = {
+  {
+0xFF,  // Blue
+0xFF,  // Green
+0x00,  // Red
+0x00   // Reserved
+  }
+};
+
+//
+// Background color of progress bar.  Grey.
+//
+const EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION  mProgressBarBackgroundColor = {
+  {
+0x80,  // Blue
+0x80,  // Green
+0x80,  // 

[edk2] [Patch v3 1/3] MdeModulePkg: Add DisplayUpdateProgressLib class

2018-05-25 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=801

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport

Add the DisplayUpdateProgressLib class that is used
to inform the user of progress during updates of
firmware images in firmware devices.  A platform
specific instance of this library can be used to
customize how the user is informed of progress.

Add the EDK II Firmware Management Progress Protocol.
This is an optional protocol that must be installed
onto the same handle as a Firmware Management Protocol.
This new protocol provides the color of a progress
bar that allows different firmware devices to use
different colors during a firmware update.  It also
provides a watchdog timer value in seconds that is
armed each time the Progress() service passed
into Firmware Management Protocol SetImage()
is called.

Cc: Sean Brogan 
Cc: Star Zeng 
Cc: Eric Dong 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../Include/Library/DisplayUpdateProgressLib.h | 65 ++
 .../Include/Protocol/FirmwareManagementProgress.h  | 55 ++
 MdeModulePkg/MdeModulePkg.dec  | 11 
 3 files changed, 131 insertions(+)
 create mode 100644 MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h
 create mode 100644 MdeModulePkg/Include/Protocol/FirmwareManagementProgress.h

diff --git a/MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h 
b/MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h
new file mode 100644
index 00..ad1f2cae38
--- /dev/null
+++ b/MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h
@@ -0,0 +1,65 @@
+/** @file
+  Provides services to display completion progress when processing a
+  firmware update that updates the firmware image in a firmware device.
+  A platform may provide its own instance of this library class to custoimize
+  how a user is informed of completion progress.
+
+  Copyright (c) 2016, Microsoft Corporation
+  Copyright (c) 2018, Intel Corporation. All rights reserved.
+
+  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 __DISPLAY_PROGRESS_LIB__
+#define __DISPLAY_PROGRESS_LIB__
+
+#include 
+
+/**
+  Indicates the current completion progress of a firmware update.
+
+  @param[in] Completion  A value between 0 and 100 indicating the current
+ completion progress of a firmware update.  This
+ value must the the same or higher than previous
+ calls to this service.  The first call of 0 or a
+ value of 0 after reaching a value of 100 resets
+ the progress indicator to 0.
+  @param[in] Color   Color of the progress indicator.  Only used when
+ Completion is 0 to set the color of the progress
+ indicator.  If Color is NULL, then the default color
+ is used.
+
+  @retval EFI_SUCCESSProgress displayed successfully.
+  @retval EFI_INVALID_PARAMETER  Completion is not in range 0..100.
+  @retval EFI_INVALID_PARAMETER  Completion is less than Completion value from
+ a previous call to this service.
+  @retval EFI_NOT_READY  The device used to indicate progress is not
+ available.
+**/
+EFI_STATUS
+EFIAPI
+DisplayUpdateProgress (
+  IN UINTNCompletion,
+  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION  *Color   OPTIONAL
+  );
+
+#endif
diff --git 

[edk2] [Patch v3 3/3] SignedCapsulePkg/PlatformFlashAccessLib: Add progress API

2018-05-25 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=801

Add a new API to the PlatformFlashAccessLib that passes
in an optional Progress() function along with a start and
end percentage to call the Progress() function with.
If the Progress() function is not NULL, then it is the
Progress() function that was passed into the Firmware
Management Protocol SetImage() services and is used
to update the user on the progress as a firmware device
is updated with a firmware image.

Implementations of the PlatformFlashAccessLib are
recommended to call the Progress() function as work
is performed to update to contents of a firmware
storage device.

Cc: Jiewen Yao 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../Include/Library/PlatformFlashAccessLib.h   | 49 ++-
 .../PlatformFlashAccessLibNull.c   | 70 +++---
 2 files changed, 110 insertions(+), 9 deletions(-)

diff --git a/SignedCapsulePkg/Include/Library/PlatformFlashAccessLib.h 
b/SignedCapsulePkg/Include/Library/PlatformFlashAccessLib.h
index 0a8858e4c4..e3308251c2 100644
--- a/SignedCapsulePkg/Include/Library/PlatformFlashAccessLib.h
+++ b/SignedCapsulePkg/Include/Library/PlatformFlashAccessLib.h
@@ -1,7 +1,7 @@
 /** @file
   Platform flash device access library.
 
-  Copyright (c) 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2016 - 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
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -16,6 +16,8 @@
 #ifndef __PLATFORM_FLASH_ACCESS_LIB_H__
 #define __PLATFORM_FLASH_ACCESS_LIB_H__
 
+#include 
+
 typedef enum {
   FlashAddressTypeRelativeAddress,
   FlashAddressTypeAbsoluteAddress,
@@ -31,7 +33,7 @@ typedef enum {
 } PLATFORM_FIRMWARE_TYPE;
 
 /**
-  Perform flash write opreation.
+  Perform flash write operation.
 
   @param[in] FirmwareType  The type of firmware.
   @param[in] FlashAddress  The address of flash device to be accessed.
@@ -54,4 +56,47 @@ PerformFlashWrite (
   IN UINTNLength
   );
 
+/**
+  Perform flash write operation with progress indicator.  The start and end
+  completion percentage values are passed into this function.  If the requested
+  flash write operation is broken up, then completion percentage between the
+  start and end values may be passed to the provided Progress function.  The
+  caller of this function is required to call the Progress function for the
+  start and end completion percentage values.  This allows the Progress,
+  StartPercentage, and EndPercentage parameters to be ignored if the requested
+  flash write operation can not be broken up
+
+  @param[in] FirmwareType  The type of firmware.
+  @param[in] FlashAddress  The address of flash device to be accessed.
+  @param[in] FlashAddressType  The type of flash device address.
+  @param[in] BufferThe pointer to the data buffer.
+  @param[in] LengthThe length of data buffer in bytes.
+  @param[in] Progress  A function used report the progress of the
+   firmware update.  This is an optional parameter
+   that may be NULL.
+  @param[in] StartPercentage   The start completion percentage value that may
+   be used to report progress during the flash
+   write operation.
+  @param[in] EndPercentage The end completion percentage value that may
+   be used to report progress during the flash
+   write operation.
+
+  @retval EFI_SUCCESS   The operation returns successfully.
+  @retval EFI_WRITE_PROTECTED   The flash device is read only.
+  @retval EFI_UNSUPPORTED   The flash device access is unsupported.
+  @retval EFI_INVALID_PARAMETER The input parameter is not valid.
+**/
+EFI_STATUS
+EFIAPI
+PerformFlashWriteWithProgress (
+  IN PLATFORM_FIRMWARE_TYPE FirmwareType,
+  IN EFI_PHYSICAL_ADDRESS   FlashAddress,
+  IN FLASH_ADDRESS_TYPE FlashAddressType,
+  IN VOID   *Buffer,
+  IN UINTN  Length,
+  IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS  Progress,OPTIONAL
+  IN UINTN  StartPercentage,
+  IN UINTN  EndPercentage
+  );
+
 #endif
diff --git 
a/SignedCapsulePkg/Library/PlatformFlashAccessLibNull/PlatformFlashAccessLibNull.c
 
b/SignedCapsulePkg/Library/PlatformFlashAccessLibNull/PlatformFlashAccessLibNull.c
index b34ebbba1e..854f108cf4 100644
--- 

[edk2] [Patch v3 0/3] Add DisplayUpdateProgressLib for capsules

2018-05-25 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=801

Based on content from:

https://github.com/Microsoft/MS_UEFI/blob/share/MsCapsuleSupport/MsCapsuleUpdatePkg/Include/Library/DisplayUpdateProgressLib.h
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg/Library/DisplayUpdateProgressGraphicsLib
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg/Library/DisplayUpdateProgressTextLib

Updates for V3
==
* Add Version field to EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL
* Break up patch series into 4 smaller patch series to handle dependencies
  between the edk2 repository and the edk2-platforms repository.
  + Patch series for edk2 repo that adds DisplayUpdateProgressLib class and 
instances.  Defines the EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL.
Adds PerformFlashWriteWithProgress() API to the PlatformFlashAccessLib.
  + Patch series for platforms in edk2-platforms that use capsules to add the
DisplayUpdateProgressLib mapping to the DSC files and add the
PerformFlashWriteWithProgress() API implementation to the
PlatformFlashAccessLib implementations.
  + Patch series for platforms in edk2 that use capsules to add the
DisplayUpdateProgressLib mapping to the DSC files and add the
PerformFlashWriteWithProgress() API implementation to the
PlatformFlashAccessLib implementations.
  + Patch for edk2 that adds the use of the DisplayUpateProgressLib and the 
PerformFlashWriteWithProgress() API .

Updates for V2
==
* Change DisplayUpdateProgressGraphicsLib to DisplayUpdateProgressLibGraphics
* Change DisplayUpdateProgressTextLib to DisplayUpdateProgressLibText
* Clarify that color in Firmware Management Progress Protocol is the foreground 
color
* Add missing parameters to PerformFlashWriteWithProgress() function header.
* Update PerformFlashWriteWithProgress() function header describing the use of
  the start and end percentage values.
* Update QuarkPlatformPkg PerformFlashWriteWithProgress() to call Progress() for
  the end precentage.
* Update Vlv2Tbl2DevicePkg PerformFlashWriteWithProgress() to call Progress()
  for the end precentage.

Add DisplayUpdateProgressLib class along implementations for both graphical
(Graphics Output Protocol based) and text (Simple Text Output Protocol based)
consoles.  Also add the EDK II Firmware Management Progress Protocol that is an
optional protocol that provides the progress bar color and a watchdog timeout
value thaty can be used when a firmware image is updated in a firmware device.

* Add progress support to DxeCapsuleLibFmp
* Add progress support to SystemFirmwareUpdateDxe
* Add progress support to PlatformFlashAccessLib class and instances.
* Reduce Print() calls during a firmware update.

Cc: Sean Brogan 
Cc: Star Zeng 
Cc: Eric Dong 
Cc: Jiewen Yao 
Cc: David Wei 
Cc: Mang Guo 
Cc: Kelly Steele 

Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1

Michael D Kinney (3):
  MdeModulePkg: Add DisplayUpdateProgressLib class
  MdeModulePkg: Add DisplayUpdateProgressLib instances
  SignedCapsulePkg/PlatformFlashAccessLib: Add progress API

 .../Include/Library/DisplayUpdateProgressLib.h |  65 +++
 .../Include/Protocol/FirmwareManagementProgress.h  |  55 +++
 .../DisplayUpdateProgressLibGraphics.c | 475 +
 .../DisplayUpdateProgressLibGraphics.inf   |  60 +++
 .../DisplayUpdateProgressLibGraphics.uni   |  18 +
 .../DisplayUpdateProgressLibText.c | 174 
 .../DisplayUpdateProgressLibText.inf   |  53 +++
 .../DisplayUpdateProgressLibText.uni   |  18 +
 MdeModulePkg/MdeModulePkg.dec  |  11 +
 MdeModulePkg/MdeModulePkg.dsc  |   3 +
 .../Include/Library/PlatformFlashAccessLib.h   |  49 ++-
 .../PlatformFlashAccessLibNull.c   |  70 ++-
 12 files changed, 1042 insertions(+), 9 deletions(-)
 create mode 100644 MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h
 create mode 100644 MdeModulePkg/Include/Protocol/FirmwareManagementProgress.h
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.c
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.inf
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibGraphics/DisplayUpdateProgressLibGraphics.uni
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressLibText.c
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressLibText.inf
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressLibText/DisplayUpdateProgressLibText.uni

--