[edk2] [Patch 1/4] Vlv2TbltDevicePkg/Override/Bds: Add test key notification

2018-08-09 Thread Michael D Kinney
From: "Kinney, Michael D" 

Cc: David Wei 
Cc: Mang Guo 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 .../Library/GenericBdsLib/BdsConsole.c| 11 +++
 .../Library/GenericBdsLib/GenericBdsLib.inf   |  1 +
 2 files changed, 12 insertions(+)

diff --git 
a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
 
b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
index 9c21cfcd59..b8968048f4 100644
--- 
a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
+++ 
b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsConsole.c
@@ -568,6 +568,17 @@ BdsLibConnectAllDefaultConsoles (
   );
   }
 
+  //
+  // If any component set PcdTestKeyUsed to TRUE because use of a test key
+  // was detected, then display a warning message on the debug log and the 
console
+  //
+  if (PcdGetBool (PcdTestKeyUsed) == TRUE) {
+DEBUG ((DEBUG_ERROR, "**\n"));
+DEBUG ((DEBUG_ERROR, "**  WARNING: Test Key is used.  **\n"));
+DEBUG ((DEBUG_ERROR, "**\n"));
+Print (L"**  WARNING: Test Key is used.  **\n");
+  }
+
   return EFI_SUCCESS;
 
 }
diff --git 
a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
 
b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
index bd93847941..a4a2a9db98 100644
--- 
a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
+++ 
b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
@@ -138,6 +138,7 @@ [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderStart ## 
SOMETIMES_CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable  ## CONSUMES
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile  ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed   ## 
CONSUMES
 
 #
 # [BootMode] 
-- 
2.14.2.windows.3

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


[edk2] [Patch 2/4] Vlv2TbltDevicePkg/Feature/Capsule: Add FmpDeviceLib instances

2018-08-09 Thread Michael D Kinney
Cc: David Wei 
Cc: Mang Guo 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 .../Capsule/Library/FmpDeviceLib/FmpDeviceLib.c| 607 +
 .../Capsule/Library/FmpDeviceLib/FmpDeviceLib.inf  |  63 +++
 .../Library/FmpDeviceLibSample/FmpDeviceLib.c  | 429 +++
 .../Library/FmpDeviceLibSample/FmpDeviceLib.inf|  51 ++
 4 files changed, 1150 insertions(+)
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/FmpDeviceLib.c
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/FmpDeviceLib.inf
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLibSample/FmpDeviceLib.c
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLibSample/FmpDeviceLib.inf

diff --git 
a/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/FmpDeviceLib.c 
b/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/FmpDeviceLib.c
new file mode 100644
index 00..6725632664
--- /dev/null
+++ b/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/FmpDeviceLib.c
@@ -0,0 +1,607 @@
+/**
+
+Copyright (c) 2016, Microsoft Corporation
+
+All rights reserved.
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+1. Redistributions of source code must retain the above copyright notice,
+this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 
DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+**/
+
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+//#include 
+
+//#include 
+
+typedef struct {
+  PLATFORM_FIRMWARE_TYPE  FirmwareType;
+  FLASH_ADDRESS_TYPE  AddressType;
+  EFI_PHYSICAL_ADDRESSBaseAddress;
+  UINTN   Length;
+  UINTN   ImageOffset;
+} UPDATE_CONFIG_DATA;
+
+UPDATE_CONFIG_DATA mUpdateConfigData[] = {
+  { PlatformFirmwareTypeSystemFirmware, FlashAddressTypeRelativeAddress, 
0x, 0x0004, 0x },
+  { PlatformFirmwareTypeSystemFirmware, FlashAddressTypeRelativeAddress, 
0x000C, 0x0005, 0x000C },
+  { PlatformFirmwareTypeSystemFirmware, FlashAddressTypeRelativeAddress, 
0x0011, 0x0021, 0x0011 },
+  { PlatformFirmwareTypeSystemFirmware, FlashAddressTypeRelativeAddress, 
0x0032, 0x0007, 0x0032 },
+  { PlatformFirmwareTypeSystemFirmware, FlashAddressTypeRelativeAddress, 
0x0039, 0x0007, 0x0039 },
+  { PlatformFirmwareTypeNvRam,  FlashAddressTypeRelativeAddress, 
0x0004, 0x0008, 0x0004 }
+};
+
+/**
+  Used to pass the FMP install function to this lib.  This allows the library 
to
+  have control of the handle that the FMP instance is installed on.  This 
allows
+  the library to use DriverBinding protocol model to locate its device(s) in 
the
+  system.
+
+  @param[in] Func  Function pointer to FMP install function.
+
+  @retval EFI_SUCCESS   Library has saved function pointer and will call
+function pointer on each DriverBinding Start.
+  @retval EFI_UNSUPPORTED   Library doesn't use driver binding and only 
supports
+a single instance.
+  @retval other error   Error occurred.  Don't install FMP
+
+**/
+EFI_STATUS
+EFIAPI
+RegisterFmpInstaller (
+  IN FMP_DEVICE_LIB_REGISTER_FMP_INSTALLER Func
+  )
+{
+  //
+  // This is a system firmware update that does not use Driver Binding Protocol
+  //
+  return EFI_UNSUPPORTED;
+}
+
+
+/**
+  Returns the size, in bytes, of the firmware image currently stored in the
+  firmware device.  This function is used to by the GetImage() and
+  GetImageInfo() services of the Firmware Management Protocol.  If the image
+  size can not be determined from the firmware device, then 0 must be returned.
+
+  @param[out] Size  Pointer to the size, in bytes, of the firmware image
+currently stored in the firmware device.
+
+  @retval E

[edk2] [Patch 4/4] Vlv2TbltDevicePkg: Update DSC/FDF to use FmpDevicePkg

2018-08-09 Thread Michael D Kinney
Cc: David Wei 
Cc: Mang Guo 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc  | 61 +++
 Vlv2TbltDevicePkg/FmpCertificate.dsc   | 28 +
 Vlv2TbltDevicePkg/FmpGreenSampleDevice.dsc | 61 +++
 Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc   | 65 +
 Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc   | 61 +++
 Vlv2TbltDevicePkg/PlatformCapsule.dsc  |  1 +
 Vlv2TbltDevicePkg/PlatformCapsule.fdf  | 23 ---
 Vlv2TbltDevicePkg/PlatformCapsuleGcc.fdf   | 23 ---
 Vlv2TbltDevicePkg/PlatformPkg.dec  |  5 +++
 Vlv2TbltDevicePkg/PlatformPkg.fdf  | 61 ---
 Vlv2TbltDevicePkg/PlatformPkgConfig.dsc| 19 +++--
 Vlv2TbltDevicePkg/PlatformPkgGcc.fdf   | 61 ---
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc| 66 --
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc  | 64 -
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc   | 62 +++-
 15 files changed, 409 insertions(+), 252 deletions(-)
 create mode 100644 Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc
 create mode 100644 Vlv2TbltDevicePkg/FmpCertificate.dsc
 create mode 100644 Vlv2TbltDevicePkg/FmpGreenSampleDevice.dsc
 create mode 100644 Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc
 create mode 100644 Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc

diff --git a/Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc 
b/Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc
new file mode 100644
index 00..5f59845866
--- /dev/null
+++ b/Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc
@@ -0,0 +1,61 @@
+#/** @file
+# FmpDxe driver for Blue Sample device firmware update.
+#
+# 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 that 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.
+#
+#
+#**/
+
+  FmpDevicePkg/FmpDxe/FmpDxe.inf {
+
+  #
+  # ESRT and FMP GUID for sample device capsule update
+  #
+  FILE_GUID = $(FMP_BLUE_SAMPLE_DEVICE)
+
+  #
+  # Unicode name string that is used to populate FMP Image Descriptor for 
this capsule update module
+  #
+  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageIdName|L"Sample Firmware 
Device"
+
+  #
+  # ESRT and FMP Lowest Support Version for this capsule update module
+  # 000.000.000.000
+  #
+  
gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceBuildTimeLowestSupportedVersion|0x
+
+  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceProgressWatchdogTimeInSeconds|2
+
+  #
+  # Capsule Update Progress Bar Color.  Set to Blue (RGB) (0, 0, 255)
+  #
+  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceProgressColor|0x00FF
+
+  #
+  # Certificates used to authenticate capsule update image
+  #
+  !include Vlv2TbltDevicePkg/FmpCertificate.dsc
+
+
+  #
+  # Generic libraries that are used "as is" by all FMP modules
+  #
+  
FmpPayloadHeaderLib|FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.inf
+  
FmpAuthenticationLib|SecurityPkg/Library/FmpAuthenticationLibPkcs7/FmpAuthenticationLibPkcs7.inf
+  #
+  # Platform specific capsule policy library
+  #
+  
CapsuleUpdatePolicyLib|FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.inf
+  #
+  # Device specific library that processes a capsule and updates the FW 
storage device
+  #
+  
FmpDeviceLib|Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLibSample/FmpDeviceLib.inf
+  }
diff --git a/Vlv2TbltDevicePkg/FmpCertificate.dsc 
b/Vlv2TbltDevicePkg/FmpCertificate.dsc
new file mode 100644
index 00..c510c90582
--- /dev/null
+++ b/Vlv2TbltDevicePkg/FmpCertificate.dsc
@@ -0,0 +1,28 @@
+#/** @file
+# FMP Certificates shared by multiple FmpDxe drivers for firmware update.
+#
+# 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 that 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.
+#
+#
+#**/
+
+!if $(CAPSULE_PKCS7_CERT) == SAMPLE_DEVELOPMENT_SAMPLE_PRODUCTION
+  !include 
Vlv2TbltD

[edk2] [Patch 3/4] Vlv2TbltDevicePkg/Capsule: Add scripts to generate capsules

2018-08-09 Thread Michael D Kinney
Use GenerateCapsule to generate capsules for MinnowMax
debug and release builds and sample devices.

Cc: David Wei 
Cc: Mang Guo 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 .../Capsule/GenerateCapsule/GenCapsuleAll.bat  |  35 +
 .../GenerateCapsule/GenCapsuleMinnowMax.bat| 139 
 .../GenerateCapsule/GenCapsuleMinnowMaxRelease.bat | 139 
 .../GenerateCapsule/GenCapsuleSampleColor.bat  | 145 +
 ...kenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc |   1 +
 ...kenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc |   1 +
 ...kenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc |   1 +
 7 files changed, 461 insertions(+)
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.bat
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMax.bat
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMaxRelease.bat
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleSampleColor.bat
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/NewRoot.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/SAMPLE_DEVELOPMENT.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/SAMPLE_DEVELOPMENT_SAMPLE_PRODUCTION.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc

diff --git 
a/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.bat 
b/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.bat
new file mode 100644
index 00..df326dc3af
--- /dev/null
+++ b/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.bat
@@ -0,0 +1,35 @@
+@REM @file
+@REM   Windows batch file to generate UEFI capsules for system firmware and
+@REM   firmware for sample devices
+@REM
+@REM Copyright (c) 2018, Intel Corporation. All rights reserved.
+@REM This program and the accompanying materials
+@REM are licensed and made available under the terms and conditions of the BSD 
License
+@REM which accompanies this distribution.  The full text of the license may be 
found at
+@REM http://opensource.org/licenses/bsd-license.php
+@REM
+@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+@REM
+
+@echo off
+setlocal
+cd /d %~dp0
+
+rmdir /s /q %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules
+mkdir %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules
+mkdir %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\SampleDevelopment
+mkdir %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\NewCert
+mkdir %WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\TestCert
+copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\DEBUG_VS2015x86\X64\CapsuleApp.efi 
%WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\SampleDevelopment\CapsuleApp.efi
+copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\RELEASE_VS2015x86\X64\CapsuleApp.efi 
%WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\SampleDevelopment\CapsuleAppRelease.efi
+copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\DEBUG_VS2015x86\X64\CapsuleApp.efi 
%WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\NewCert\CapsuleApp.efi
+copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\RELEASE_VS2015x86\X64\CapsuleApp.efi 
%WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\NewCert\CapsuleAppRelease.efi
+copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\DEBUG_VS2015x86\X64\CapsuleApp.efi 
%WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\TestCert\CapsuleApp.efi
+copy %WORKSPACE%\Build\Vlv2TbltDevicePkg\RELEASE_VS2015x86\X64\CapsuleApp.efi 
%WORKSPACE%\Build\Vlv2TbltDevicePkg\Capsules\TestCert\CapsuleAppRelease.efi
+
+call GenCapsuleMinnowMax.bat
+call GenCapsuleMinnowMaxRelease.bat
+call GenCapsuleSampleColor.bat Blue  149DA854-7D19-4FAA-A91E-862EA1324BE6
+call GenCapsuleSampleColor.bat Green 79179BFD-704D-4C90-9E02-0AB8D968C18A
+call GenCapsuleSampleColor.bat Red   72E2945A-00DA-448E-9AA7-075AD840F9D4
diff --git 
a/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMax.bat 
b/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMax.bat
new file mode 100644
index 00..2a049c4c0f
--- /dev/null
+++ b/Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMax.bat
@@ -0,0 +1,139 @@
+@REM @file
+@REM   Windows batch file to generate UEFI capsules for system firmware
+@REM
+@REM Copyright (c) 2018, Intel Corporation. All rights reserved.
+@REM This program and the accompanying materials
+@REM are licensed and made available under the terms and conditions of the BSD 
License
+@REM which accompanies this distribution.  The full text of the license may be 
found at
+@REM http://opensource.org/licenses/bsd-license.php
+@REM
+@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+@RE

[edk2] [Patch 0/4] Vlv2TbltDevicePkg: Add FmpDevicePkg support

2018-08-09 Thread Michael D Kinney
Update Vlv2TbltDevicePkg to build UEFI capsules for system firmare and device
firmware using the GenerateCapsule tool and use the FmpDevicePkg to implement
drivers that produce the Firmware Management Protocol to process UEFI capsules.

* Update Vlv2TbltDevicePkg specific BDS to notify when test key is detected.
* Add FmpDeviceLib instance for Minnow Max FLASH update
* Add FmpDeviceLib instance for sample devices
* Add scripts to generate UEFI Capsules for system and device firmware
* Update Vlv2TbltDevicePkg DSC/FDF to use FmpDevicePkg

Cc: David Wei 
Cc: Mang Guo 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 

Kinney, Michael D (1):
  Vlv2TbltDevicePkg/Override/Bds: Add test key notification

Michael D Kinney (3):
  Vlv2TbltDevicePkg/Feature/Capsule: Add FmpDeviceLib instances
  Vlv2TbltDevicePkg/Capsule: Add scripts to generate capsules
  Vlv2TbltDevicePkg: Update DSC/FDF to use FmpDevicePkg

 .../Capsule/GenerateCapsule/GenCapsuleAll.bat  |  35 ++
 .../GenerateCapsule/GenCapsuleMinnowMax.bat| 139 +
 .../GenerateCapsule/GenCapsuleMinnowMaxRelease.bat | 139 +
 .../GenerateCapsule/GenCapsuleSampleColor.bat  | 145 +
 ...kenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc |   1 +
 ...kenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc |   1 +
 ...kenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc |   1 +
 .../Capsule/Library/FmpDeviceLib/FmpDeviceLib.c| 607 +
 .../Capsule/Library/FmpDeviceLib/FmpDeviceLib.inf  |  63 +++
 .../Library/FmpDeviceLibSample/FmpDeviceLib.c  | 429 +++
 .../Library/FmpDeviceLibSample/FmpDeviceLib.inf|  51 ++
 Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc  |  61 +++
 Vlv2TbltDevicePkg/FmpCertificate.dsc   |  28 +
 Vlv2TbltDevicePkg/FmpGreenSampleDevice.dsc |  61 +++
 Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc   |  65 +++
 Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc   |  61 +++
 .../Library/GenericBdsLib/BdsConsole.c |  11 +
 .../Library/GenericBdsLib/GenericBdsLib.inf|   1 +
 Vlv2TbltDevicePkg/PlatformCapsule.dsc  |   1 +
 Vlv2TbltDevicePkg/PlatformCapsule.fdf  |  23 -
 Vlv2TbltDevicePkg/PlatformCapsuleGcc.fdf   |  23 -
 Vlv2TbltDevicePkg/PlatformPkg.dec  |   5 +
 Vlv2TbltDevicePkg/PlatformPkg.fdf  |  61 +--
 Vlv2TbltDevicePkg/PlatformPkgConfig.dsc|  19 +-
 Vlv2TbltDevicePkg/PlatformPkgGcc.fdf   |  61 +--
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc|  66 +--
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc  |  64 +--
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc   |  62 +--
 28 files changed, 2032 insertions(+), 252 deletions(-)
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.bat
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMax.bat
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleMinnowMaxRelease.bat
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleSampleColor.bat
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/NewRoot.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/SAMPLE_DEVELOPMENT.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/SAMPLE_DEVELOPMENT_SAMPLE_PRODUCTION.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/FmpDeviceLib.c
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib/FmpDeviceLib.inf
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLibSample/FmpDeviceLib.c
 create mode 100644 
Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLibSample/FmpDeviceLib.inf
 create mode 100644 Vlv2TbltDevicePkg/FmpBlueSampleDevice.dsc
 create mode 100644 Vlv2TbltDevicePkg/FmpCertificate.dsc
 create mode 100644 Vlv2TbltDevicePkg/FmpGreenSampleDevice.dsc
 create mode 100644 Vlv2TbltDevicePkg/FmpMinnowMaxSystem.dsc
 create mode 100644 Vlv2TbltDevicePkg/FmpRedSampleDevice.dsc

-- 
2.14.2.windows.3

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


[edk2] [Patch] Maintainers.txt: Add FmpDevicePkg maintainers

2018-08-09 Thread Michael D Kinney
This patch adds maintainers for the FmpDevicePkg.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 Maintainers.txt | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index 7295cd6b83..df7dc48f75 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -132,6 +132,11 @@ M: Ruiyu Ni 
 T: svn - https://svn.code.sf.net/p/edk2-fatdriver2/code/trunk/EnhancedFat
 T: git - https://github.com/tianocore/edk2-FatPkg.git
 
+FmpDevicePkg
+W: https://github.com/tianocore/tianocore.github.io/wiki/FmpDevicePkg
+M: Star Zeng 
+M: Michael D Kinney 
+
 IntelFrameworkModulePkg
 W: 
https://github.com/tianocore/tianocore.github.io/wiki/IntelFrameworkModulePkg
 M: Liming Gao 
-- 
2.14.2.windows.3

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


[edk2] [RFC 0/1] Add Capsule Generation Tools

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

Based on content from the following branch

https://github.com/Microsoft/MS_UEFI/tree/share/beta/CapsuleTools

Command line unit tests for python modules available from following branch:

https://github.com/mdkinney/edk2/tree/Bug_945_StandAloneCapsuleTools_V2

https://github.com/mdkinney/edk2/tree/Bug_945_StandAloneCapsuleTools_V2/BaseToolsUnitTest

* Convert C tools to Python
* Add common python modules to:
BaseTools/Source/Python/Common/Uefi/Capsule
BaseTools/Source/Python/Common/Edk2/Capsule
* Add GenerateCapsule.py to BaseTools/Source/Python/Capsule
* Add Windows and Posix wrappers for GenerateCapsule.py

usage: GenerateCapsule [-h] [-o OUTPUTFILE] (-e | -d | --dump-info)
   [--capflag 
{PersistAcrossReset,PopulateSystemTable,InitiateReset}]
   [--capoemflag CAPSULEOEMFLAG] [--guid GUID]
   [--hardware-instance HARDWAREINSTANCE]
   [--monotonic-count MONOTONICCOUNT]
   [--version FWVERSION] [--lsv LOWESTSUPPORTEDVERSION]
   [--pfx-file SIGNTOOLPFXFILE]
   [--signer-private-cert OPENSSLSIGNERPRIVATECERTFILE]
   [--other-public-cert OPENSSLOTHERPUBLICCERTFILE]
   [--trusted-public-cert OPENSSLTRUSTEDPUBLICCERTFILE]
   [--signing-tool-path SIGNINGTOOLPATH] [-v] [-q]
   [--debug [0-9]]
   InputFile

Generate a capsule. Copyright (c) 2018, Intel Corporation. All rights
reserved.

positional arguments:
  InputFile Input binary payload filename.

optional arguments:
  -h, --helpshow this help message and exit
  -o OUTPUTFILE, --output OUTPUTFILE
Output filename.
  -e, --encode  Encode file
  -d, --decode  Decode file
  --dump-info   Display FMP Payload Header information
  --capflag {PersistAcrossReset,PopulateSystemTable,InitiateReset}
Capsule flag can be PersistAcrossReset, or
PopulateSystemTable or InitiateReset or not set
  --capoemflag CAPSULEOEMFLAG
Capsule OEM Flag is an integer between 0x and
0x.
  --guid GUID   The FMP/ESRT GUID in registry format. Required for
encode operations.
  --hardware-instance HARDWAREINSTANCE
The 64-bit hardware instance. The default is
0x
  --monotonic-count MONOTONICCOUNT
64-bit monotonic count value in header. Default is
0x.
  --version FWVERSION   The 32-bit version of the binary payload (e.g.
0x11223344 or 5678).
  --lsv LOWESTSUPPORTEDVERSION
The 32-bit lowest supported version of the binary
payload (e.g. 0x11223344 or 5678).
  --pfx-file SIGNTOOLPFXFILE
signtool PFX certificate filename.
  --signer-private-cert OPENSSLSIGNERPRIVATECERTFILE
OpenSSL signer private certificate filename.
  --other-public-cert OPENSSLOTHERPUBLICCERTFILE
OpenSSL other public certificate filename.
  --trusted-public-cert OPENSSLTRUSTEDPUBLICCERTFILE
OpenSSL trusted public certificate filename.
  --signing-tool-path SIGNINGTOOLPATH
Path to signtool or Open SLL tool. Optional if path to
tools are already in PATH.
  -v, --verbose Increase output messages
  -q, --quiet   Reduce output messages
  --debug [0-9] Set debug level

Cc: Sean Brogan 
Cc: Jiewen Yao 
Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 

Kinney, Michael D (1):
  BaseTools/Capsule: Add Capsule Generation Tools

 BaseTools/BinWrappers/PosixLike/GenerateCapsule|  14 +
 .../BinWrappers/WindowsLike/GenerateCapsule.bat|   1 +
 BaseTools/Source/Python/Capsule/GenerateCapsule.py | 500 +
 .../Python/Common/Edk2/Capsule/FmpPayloadHeader.py |  91 
 .../Source/Python/Common/Edk2/Capsule/__init__.py  |  15 +
 BaseTools/Source/Python/Common/Edk2/__init__.py|  15 +
 .../Python/Common/Uefi/Capsule/FmpAuthHeader.py| 184 
 .../Python/Common/Uefi/Capsule/FmpCapsuleHeader.py | 302 +
 .../Common/Uefi/Capsule/UefiCapsuleHeader.py   | 136 ++
 .../Source/Python/Common/Uefi/Capsule/__init__.py  |  15 +
 BaseTools/Source/Python/Common/Uefi/__init__.py|  15 +
 11 files changed, 1288 insertions(+)
 create mode 100644 BaseTools/BinWrappers/PosixLike/GenerateCapsule
 create mode 100644 BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat
 create mode 100644 BaseTools/Source/Python/Capsule/GenerateCapsule.py
 create mode 100644 
BaseTools/Source/Python

[edk2] [RFC v3 3/4] FmpDevicePkg: Add FmpDxe module

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

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

The FmpDxe directory contains 2 INF files.  FmpDxe.inf
is a DXE driver that is used in a platform to add a
Firmware Management Protocol for firmware device that
supports firmware updates.

FmpDxeLib.inf is a NULL library instance with the exact
same functionality as FmpDxe.inf, but allows the the
Firmware Management Protocol feature to be added to
an existing device driver.

The FmpDxe component is intended to be used "as is"
with no need for any device specific or platform specific
changes.

Cc: Sean Brogan 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 FmpDevicePkg/FmpDxe/DetectTestKey.c   |  166 
 FmpDevicePkg/FmpDxe/FmpDxe.c  | 1452 +
 FmpDevicePkg/FmpDxe/FmpDxe.inf|   93 +++
 FmpDevicePkg/FmpDxe/FmpDxe.uni|   20 +
 FmpDevicePkg/FmpDxe/FmpDxeExtra.uni   |   18 +
 FmpDevicePkg/FmpDxe/FmpDxeLib.inf |   90 ++
 FmpDevicePkg/FmpDxe/VariableSupport.c |  461 +++
 FmpDevicePkg/FmpDxe/VariableSupport.h |  180 
 8 files changed, 2480 insertions(+)
 create mode 100644 FmpDevicePkg/FmpDxe/DetectTestKey.c
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxe.c
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxe.inf
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxe.uni
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxeExtra.uni
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxeLib.inf
 create mode 100644 FmpDevicePkg/FmpDxe/VariableSupport.c
 create mode 100644 FmpDevicePkg/FmpDxe/VariableSupport.h

diff --git a/FmpDevicePkg/FmpDxe/DetectTestKey.c 
b/FmpDevicePkg/FmpDxe/DetectTestKey.c
new file mode 100644
index 00..0a6e37eded
--- /dev/null
+++ b/FmpDevicePkg/FmpDxe/DetectTestKey.c
@@ -0,0 +1,166 @@
+/**  @file
+  Detects if PcdFmpDevicePkcs7CertBufferXdr contains a test key.
+
+  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 
+
+/**
+  Check to see if any of the keys in PcdFmpDevicePkcs7CertBufferXdr matches
+  the test key.  PcdFmpDeviceTestKeySha256Digest contains the SHA256 hash of
+  the test key.  For each key in PcdFmpDevicePkcs7CertBufferXdr, compute the
+  SHA256 hash and compare it to PcdFmpDeviceTestKeySha256Digest.  If the
+  SHA256 hash matches or there is then error computing the SHA256 hash, then
+  set PcdTestKeyUsed to TRUE.  Skip this check if PcdTestKeyUsed is already
+  TRUE or PcdFmpDeviceTestKeySha256Digest is not exactly SHA256_DIGEST_SIZE
+  bytes.
+**/
+VOID
+DetectTestKey (
+  VOID
+  )
+{
+  BOOLEAN  TestKeyUsed;
+  UINTNPublicKeyDataLength;
+  UINT8*PublicKeyDataXdr;
+  UINT8*PublicKeyDataXdrEnd;
+  VOID *HashContext;
+  UINT8Digest[SHA256_DIGEST_SIZE];
+
+  //
+  // If PcdFmpDeviceTestKeySha256Digest is not exacty SHA256_DIGEST_SIZE bytes,
+  // then skip the test key detection.
+  //
+  if (PcdGetSize (PcdFmpDeviceTestKeySha256Digest) != SHA256_DIGEST_SIZE) {
+return;
+  }
+
+  //
+  // If PcdTestKeyUsed is already TRUE, then skip test key detection
+  //
+  TestKeyUsed = PcdGetBool (PcdTestKeyUsed);
+  if (TestKeyUsed) {
+return;
+  }
+
+  //
+  // If PcdFmpDevicePkcs7CertBufferXdr is invalid, then skip test key detection
+  //
+  PublicKeyDataXdr= PcdGetPtr (PcdFmpDevicePkcs7CertBufferXdr);
+  PublicKeyDataXdrEnd = PublicKeyDataXdr + PcdGetSize 
(PcdFmpDevicePkcs7CertBufferXdr);
+  if (PublicKeyDataXdr == NULL || PublicKey

[edk2] [RFC v3 1/4] FmpDevicePkg: Add package, library classes, and PCDs

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

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

Create FmpDevicePkg with library classes and PCDs used to
customize the behavior of a Firmware Management Protocol
instance.

Library Classes
===
* FmpDeviceLib - Provides firmware device specific services
  to support updates of a firmware image stored in a firmware
  device.
* CapsuleUpdatePolicyLib - Provides platform policy services
  used during a capsule update.
* FmpPayloadHeaderLib - Provides services to retrieve values
  from a capsule's FMP Payload Header.  The structure is not
  included in the library class.  Instead, services are
  provided to retrieve information from the FMP Payload Header.
  If information is added to the FMP Payload Header, then new
  services may be added to this library class to retrieve the
  new information.

PCDs set per module

* PcdFmpDeviceSystemResetRequired - Indicates if a full
  system reset is required before a firmware update to a
  firmware devices takes effect
* PcdFmpDeviceTestKeySha256Digest - The SHA-256 hash of a
  PKCS7 test key that is used to detect if a test key is
  being used to authenticate capsules.  Test key detection
  is disabled by setting the value to {0}.
* PcdFmpDeviceProgressColor - The color of the progress bar
  during a firmware update.
* PcdFmpDeviceImageIdName - The Null-terminated Unicode
  string used to fill in the ImageIdName field of the
  EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned
  by the GetImageInfo() service of the Firmware Management
  Protocol for the firmware device.
* PcdFmpDeviceBuildTimeLowestSupportedVersion - The build
  time value used to fill in the LowestSupportedVersion field
  of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is
  returned by the GetImageInfo() service of the Firmware
  Management Protocol.
* PcdFmpDeviceProgressWatchdogTimeInSeconds - The time in
  seconds to arm a watchdog timer during the update of a
  firmware device.

PCDs set per module or for entire platform
==
* PcdFmpDevicePkcs7CertBufferXdr - One or more PKCS7
  certificates used to verify a firmware device capsule
  update image.
* PcdFmpDeviceLockEventGuid - An event GUID that locks
  the firmware device when the event is signaled.

Cc: Sean Brogan 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 FmpDevicePkg/FmpDevicePkg.dec  | 132 +++
 FmpDevicePkg/FmpDevicePkg.uni  |  80 
 FmpDevicePkg/FmpDevicePkgExtra.uni |  18 +
 .../Include/Library/CapsuleUpdatePolicyLib.h   | 120 ++
 FmpDevicePkg/Include/Library/FmpDeviceLib.h| 405 +
 FmpDevicePkg/Include/Library/FmpPayloadHeaderLib.h | 100 +
 6 files changed, 855 insertions(+)
 create mode 100644 FmpDevicePkg/FmpDevicePkg.dec
 create mode 100644 FmpDevicePkg/FmpDevicePkg.uni
 create mode 100644 FmpDevicePkg/FmpDevicePkgExtra.uni
 create mode 100644 FmpDevicePkg/Include/Library/CapsuleUpdatePolicyLib.h
 create mode 100644 FmpDevicePkg/Include/Library/FmpDeviceLib.h
 create mode 100644 FmpDevicePkg/Include/Library/FmpPayloadHeaderLib.h

diff --git a/FmpDevicePkg/FmpDevicePkg.dec b/FmpDevicePkg/FmpDevicePkg.dec
new file mode 100644
index 00..9ea0d73359
--- /dev/null
+++ b/FmpDevicePkg/FmpDevicePkg.dec
@@ -0,0 +1,132 @@
+## @file
+# Firmware Management Protocol Device Package
+#
+# This package provides an implementation of a Firmware Management Protocol
+# instance that supports the update of firmware storage devices using UEFI
+# Capsules.  The behavior of the Firmware Management Protocol instance is
+# customized using libraries and PCDs.
+#
+# 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, PROCU

[edk2] [RFC v3 4/4] FmpDevicePkg: Add DSC file to build all package components

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

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

Adds a DSC file that is used to verify that all of the
FmpDevicePkg libraries and modules build without error.

Cc: Sean Brogan 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 FmpDevicePkg/FmpDevicePkg.dsc | 134 ++
 1 file changed, 134 insertions(+)
 create mode 100644 FmpDevicePkg/FmpDevicePkg.dsc

diff --git a/FmpDevicePkg/FmpDevicePkg.dsc b/FmpDevicePkg/FmpDevicePkg.dsc
new file mode 100644
index 00..4d08a2cf9e
--- /dev/null
+++ b/FmpDevicePkg/FmpDevicePkg.dsc
@@ -0,0 +1,134 @@
+## @file
+# Firmware Management Protocol Device Package
+#
+# This package provides an implementation of a Firmware Management Protocol
+# instance that supports the update of firmware storage devices using UEFI
+# Capsules.  The behavior of the Firmware Management Protocol instance is
+# customized using libraries and PCDs.
+#
+# 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.
+#
+##
+
+[Defines]
+  PLATFORM_NAME  = FmpDevicePkg
+  PLATFORM_GUID  = 0af3d540-27c6-11e8-828b-f8597177a00a
+  PLATFORM_VERSION   = 0.1
+  DSC_SPECIFICATION  = 0x00010005
+  OUTPUT_DIRECTORY   = Build/FmpDevicePkg
+  SUPPORTED_ARCHITECTURES= IA32|IPF|X64|ARM|AARCH64
+  BUILD_TARGETS  = DEBUG|RELEASE
+  SKUID_IDENTIFIER   = DEFAULT
+
+  #
+  # Define ESRT GUIDs for Firmware Management Protocol instances
+  #
+  DEFINE FMP_GRAPHICS_ESRT_GUID  = B461B3BD-E62A-4A71-841C-50BA4E500267
+  DEFINE FMP_TEXT_ESRT_GUID  = 226034C4-8B67-4536-8653-D6EE7CE5A316
+
+[LibraryClasses]
+  
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+  
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
+  
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+  UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+  
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+  UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
+  
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+  UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
+  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
+  BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+  PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+  DebugLib|MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
+  
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
+  PostCodeLib|MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf
+  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+
+  
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+  UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+  DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+  
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+  

[edk2] [RFC v3 0/4] Add FmpDevicePkg

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

Changes in V3
=
* Change CheckLowestSupportedVersion() to LowestSupportedVersionCheckRequired()
* Change LockFmpDeviceAtLockEventGuid() to 
LockFmpDeviceAtLockEventGuidRequired()
* Set EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL Version field to 1
* Fix description of return values in LowestSupportedVersionCheckRequired()
* Fix description of return values in LockFmpDeviceAtLockEventGuidRequired()

Changes in V2
=
* FmpDevicePkg DEC file
  + Change PcdFmpDeviceSystemResetRequired from FeatureFlag
to FixedAtBuild
  + Add PcdFmpDeviceTestKeySha256Digest for test key detection.
Set to {0} to disable test key detection.
* FmpDevicePkg DSC file
  + Fix ARM and AARCH64 build issues
  + Update DisplayUpdateProgressLib mappings to match patches in
Bug_801_DisplayUpdateProgressLib_V2
* FmpDeviceLib Class and Instance
  + Update FmpDeviceGetSize() to return EFI_STATUS
  + Update FmpDeviceGetAttributes() to return EFI_STATUS
  + Update FmpDeviceGetVersionString() to return EFI_STATUS
* FmpDxe
  + Set depex to Variable Arch Write Protocol and Variable Lock Protocol
  + Break out test key detection in FmpDxe into DetectTestKey.c
  + Change LockAllVars() to LockAllFmpVariables()
  + Update LockAllFmpVariables() to lock each of the UEFI variables used.
  + Always lock UEFI variables when PcdFmpDeviceLockEventGuid is signaled
  + Remove ComputeVersionName().  FmpDeviceLib must provide version string

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

Branch for review:

https://github.com/mdkinney/edk2/tree/Bug_922_FmpDevicePkg_V2

This package provides an implementation of a Firmware Management Protocol
instance that supports the update of firmware storage devices using UEFI
Capsules.  The behavior of the Firmware Management Protocol instance is
customized using libraries and PCDs.

Cc: Sean Brogan 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 

Kinney, Michael D (4):
  FmpDevicePkg: Add package, library classes, and PCDs
  FmpDevicePkg: Add library instances
  FmpDevicePkg: Add FmpDxe module
  FmpDevicePkg: Add DSC file to build all package components

 FmpDevicePkg/FmpDevicePkg.dec  |  132 ++
 FmpDevicePkg/FmpDevicePkg.dsc  |  134 ++
 FmpDevicePkg/FmpDevicePkg.uni  |   80 ++
 FmpDevicePkg/FmpDevicePkgExtra.uni |   18 +
 FmpDevicePkg/FmpDxe/DetectTestKey.c|  166 +++
 FmpDevicePkg/FmpDxe/FmpDxe.c   | 1452 
 FmpDevicePkg/FmpDxe/FmpDxe.inf |   93 ++
 FmpDevicePkg/FmpDxe/FmpDxe.uni |   20 +
 FmpDevicePkg/FmpDxe/FmpDxeExtra.uni|   18 +
 FmpDevicePkg/FmpDxe/FmpDxeLib.inf  |   90 ++
 FmpDevicePkg/FmpDxe/VariableSupport.c  |  461 +++
 FmpDevicePkg/FmpDxe/VariableSupport.h  |  180 +++
 .../Include/Library/CapsuleUpdatePolicyLib.h   |  120 ++
 FmpDevicePkg/Include/Library/FmpDeviceLib.h|  405 ++
 FmpDevicePkg/Include/Library/FmpPayloadHeaderLib.h |  100 ++
 .../CapsuleUpdatePolicyLibNull.c   |  136 ++
 .../CapsuleUpdatePolicyLibNull.inf |   45 +
 .../CapsuleUpdatePolicyLibNull.uni |   17 +
 .../Library/FmpDeviceLibNull/FmpDeviceLib.c|  427 ++
 .../Library/FmpDeviceLibNull/FmpDeviceLibNull.inf  |   48 +
 .../Library/FmpDeviceLibNull/FmpDeviceLibNull.uni  |   18 +
 .../FmpPayloadHeaderLibV1/FmpPayloadHeaderLib.c|  188 +++
 .../FmpPayloadHeaderLibV1.inf  |   48 +
 .../FmpPayloadHeaderLibV1.uni  |   21 +
 24 files changed, 4417 insertions(+)
 create mode 100644 FmpDevicePkg/FmpDevicePkg.dec
 create mode 100644 FmpDevicePkg/FmpDevicePkg.dsc
 create mode 100644 FmpDevicePkg/FmpDevicePkg.uni
 create mode 100644 FmpDevicePkg/FmpDevicePkgExtra.uni
 create mode 100644 FmpDevicePkg/FmpDxe/DetectTestKey.c
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxe.c
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxe.inf
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxe.uni
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxeExtra.uni
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxeLib.inf
 create mode 100644 FmpDevicePkg/FmpDxe/VariableSupport.c
 create mode 100644 FmpDevicePkg/FmpDxe/VariableSupport.h
 create mode 100644 FmpDevicePkg/Include/Library/CapsuleUpdatePolicyLib.h
 create mode 100644 FmpDevicePkg/Include/Library/FmpDeviceLib.h
 create mode 100644 FmpDevicePkg/Include/Library/FmpPayloadHeaderLib.h
 create mode 100644 
FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.c
 create mode 100644 
FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.inf
 create mode 100644 
FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.uni

[edk2] [Patch v3 2/2] SignedCapsulePkg/SystemFirmwareUpdateDxe: Use progress API

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

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

Use PlatformFlashWriteWithProgress() instead of PlatformFLashWrite()
so the user can be informed of the progress as a capsule is used
to update a firmware image in a firmware device.

Cc: Jiewen Yao 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c | 90 --
 1 file changed, 67 insertions(+), 23 deletions(-)

diff --git 
a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c 
b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
index ce6892d6a9..8e66aedf62 100644
--- a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
+++ b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
@@ -65,11 +65,14 @@ ParseUpdateDataFile (
 **/
 EFI_STATUS
 PerformUpdate (
-  IN VOID *SystemFirmwareImage,
-  IN UINTNSystemFirmwareImageSize,
-  IN UPDATE_CONFIG_DATA   *ConfigData,
-  OUT UINT32  *LastAttemptVersion,
-  OUT UINT32  *LastAttemptStatus
+  IN VOID   *SystemFirmwareImage,
+  IN UINTN  SystemFirmwareImageSize,
+  IN UPDATE_CONFIG_DATA *ConfigData,
+  OUT UINT32*LastAttemptVersion,
+  OUT UINT32*LastAttemptStatus,
+  IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS  Progress,
+  IN UINTN  StartPercentage,
+  IN UINTN  EndPercentage
   )
 {
   EFI_STATUS   Status;
@@ -78,13 +81,22 @@ PerformUpdate (
   DEBUG((DEBUG_INFO, "  BaseAddress - 0x%lx,", ConfigData->BaseAddress));
   DEBUG((DEBUG_INFO, "  ImageOffset - 0x%x,", ConfigData->ImageOffset));
   DEBUG((DEBUG_INFO, "  Legnth - 0x%x\n", ConfigData->Length));
-  Status = PerformFlashWrite (
+  if (Progress != NULL) {
+Progress (StartPercentage);
+  }
+  Status = PerformFlashWriteWithProgress (
  ConfigData->FirmwareType,
  ConfigData->BaseAddress,
  ConfigData->AddressType,
  (VOID *)((UINTN)SystemFirmwareImage + 
(UINTN)ConfigData->ImageOffset),
- ConfigData->Length
+ ConfigData->Length,
+ Progress,
+ StartPercentage,
+ EndPercentage
  );
+  if (Progress != NULL) {
+Progress (EndPercentage);
+  }
   if (!EFI_ERROR(Status)) {
 *LastAttemptStatus = LAST_ATTEMPT_STATUS_SUCCESS;
 if (ConfigData->FirmwareType == PlatformFirmwareTypeNvRam) {
@@ -111,12 +123,13 @@ PerformUpdate (
 **/
 EFI_STATUS
 UpdateImage (
-  IN VOID *SystemFirmwareImage,
-  IN UINTNSystemFirmwareImageSize,
-  IN VOID *ConfigImage,
-  IN UINTNConfigImageSize,
-  OUT UINT32  *LastAttemptVersion,
-  OUT UINT32  *LastAttemptStatus
+  IN VOID   *SystemFirmwareImage,
+  IN UINTN  SystemFirmwareImageSize,
+  IN VOID   *ConfigImage,
+  IN UINTN  ConfigImageSize,
+  OUT UINT32*LastAttemptVersion,
+  OUT UINT32*LastAttemptStatus,
+  IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS  Progress
   )
 {
   EFI_STATUSStatus;
@@ -124,19 +137,34 @@ UpdateImage (
   UPDATE_CONFIG_DATA*UpdateConfigData;
   CONFIG_HEADER ConfigHeader;
   UINTN Index;
+  UINTN TotalSize;
+  UINTN BytesWritten;
+  UINTN StartPercentage;
+  UINTN EndPercentage;
 
   if (ConfigImage == NULL) {
 DEBUG((DEBUG_INFO, "PlatformUpdate (NoConfig):"));
 DEBUG((DEBUG_INFO, "  BaseAddress - 0x%x,", 0));
 DEBUG((DEBUG_INFO, "  Length - 0x%x\n", SystemFirmwareImageSize));
 // ASSUME the whole System Firmware include NVRAM region.
-Status = PerformFlashWrite (
+StartPercentage = 0;
+EndPercentage = 100;
+if (Progress != NULL) {
+  Progress (StartPercentage);
+}
+Status = PerformFlashWriteWithProgress (
PlatformFirmwareTypeNvRam,
0,
FlashAddressTypeRelativeAddress,
SystemFirmwareImage,
-   SystemFirmwareImageSize
+   SystemFirmwar

[edk2] [Patch v3 1/2] MdeModulePkg/DxeCapsuleLibFmp: Add progress bar support

2018-05-29 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

* Change Update_Image_Progress() to UpdateImageProcess()
* Call DisplayUpdateProgressLib from UpdateImageProgress().
* Split out a boot service and runtime version of
  UpdateImageProgress() so the DisplayUpdateProgressLib is
  not used at runtime.
* If gEdkiiFirmwareManagementProgressProtocolGuid is present,
  then use its progress bar color and watchdog timer value.
* If gEdkiiFirmwareManagementProgressProtocolGuid is not present,
  then use default progress bar color and 5 min watchdog timer.
* Remove Print() calls during capsule processing.  Instead,
  the DisplayUpdateProgressLib is used to inform the user
  of progress during a capsule update.

Cc: Star Zeng 
Cc: Eric Dong 
Cc: Jiewen Yao 
Cc: Sean Brogan 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c   | 47 +---
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf |  8 ++-
 .../DxeCapsuleLibFmp/DxeCapsuleProcessLib.c| 84 --
 .../DxeCapsuleLibFmp/DxeCapsuleProcessLibNull.c| 21 +-
 .../DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf  |  7 +-
 5 files changed, 131 insertions(+), 36 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c 
b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
index 05fcd92deb..f0226eafa5 100644
--- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
+++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable  = NULL;
@@ -53,6 +54,8 @@ BOOLEAN   mIsVirtualAddrConverted  = 
FALSE;
 BOOLEAN   mDxeCapsuleLibEndOfDxe   = FALSE;
 EFI_EVENT mDxeCapsuleLibEndOfDxeEvent  = NULL;
 
+EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL  *mFmpProgress = NULL;
+
 /**
   Initialize capsule related variables.
 **/
@@ -101,18 +104,17 @@ RecordFmpCapsuleStatusVariable (
   Function indicate the current completion progress of the firmware
   update. Platform may override with own specific progress function.
 
-  @param[in]  CompletionA value between 1 and 100 indicating the current 
completion progress of the firmware update
+  @param[in]  Completion  A value between 1 and 100 indicating the current
+  completion progress of the firmware update
 
-  @retval EFI_SUCESSInput capsule is a correct FMP capsule.
+  @retval EFI_SUCESS The capsule update progress was updated.
+  @retval EFI_INVALID_PARAMETER  Completion is greater than 100%.
 **/
 EFI_STATUS
 EFIAPI
-Update_Image_Progress (
+UpdateImageProgress (
   IN UINTN  Completion
-  )
-{
-  return EFI_SUCCESS;
-}
+  );
 
 /**
   Return if this CapsuleGuid is a FMP capsule GUID or not.
@@ -849,6 +851,19 @@ SetFmpImageData (
 return Status;
   }
 
+  //
+  // Lookup Firmware Management Progress Protocol before SetImage() is called
+  // This is an optional protocol that may not be present on Handle.
+  //
+  Status = gBS->HandleProtocol (
+  Handle,
+  ,
+  (VOID **)
+  );
+  if (EFI_ERROR (Status)) {
+mFmpProgress = NULL;
+  }
+
   if (ImageHeader->Version >= 
EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) {
 Image = (UINT8 *)(ImageHeader + 1);
   } else {
@@ -873,21 +888,37 @@ SetFmpImageData (
 DEBUG((DEBUG_INFO, "(UpdateHardwareInstance - 0x%x)", 
ImageHeader->UpdateHardwareInstance));
   }
   DEBUG((DEBUG_INFO, "\n"));
+
+  //
+  // Before calling SetImage(), reset the progress bar to 0%
+  //
+  UpdateImageProgress (0);
+
   Status = Fmp->SetImage(
   Fmp,
   ImageHeader->UpdateImageIndex,  // ImageIndex
   Image,  // Image
   ImageHeader->UpdateImageSize,   // ImageSize
   VendorCode, // VendorCode
-  Update_Image_Progress,  // Progress
+  UpdateImageProgress,// Progress
   // AbortReason
   );
+  //
+  // Set the progress bar to 100% after returning from SetImage()
+  //
+  UpdateImageProgress (100);
+
   DEBUG((DEBUG_INFO, "Fmp->SetImage - %r\n", Status));
   if (AbortReason != NULL) {
 DEBUG ((DEBUG_ERROR, "%s\n", AbortReason));
 FreePool(AbortReason);
   }
 
+  //
+  // Clear mFmpProgress after SetImage() returns
+  //
+  mFmpProgress = NULL;
+
   return Status;
 }
 
diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf 
b/MdeModuleP

[edk2] [Patch v3 0/2] Use DisplayUpdateProgressLib and PerformFlashWriteWithProgress()

2018-05-29 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: Star Zeng 
Cc: Eric Dong 
Cc: Jiewen Yao 
Cc: Sean Brogan 
Signed-off-by: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1

Kinney, Michael D (2):
  MdeModulePkg/DxeCapsuleLibFmp: Add progress bar support
  SignedCapsulePkg/SystemFirmwareUpdateDxe: Use progress API

 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c   | 47 +--
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf |  8 +-
 .../DxeCapsuleLibFmp/DxeCapsuleProcessLib.c| 84 +++-
 .../DxeCapsuleLibFmp/DxeCapsuleProcessLibNull.c| 21 -
 .../DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf  |  7 +-
 .../SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c | 90 --
 6 files changed, 198 insertions(+), 59 deletions(-)

-- 
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 v4 4/6] Styx/PlatformFlashAccessLib: Add progress API

2018-05-28 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.

This is the minimal update to this library implementation to
keep everything building and preserve any existing progress
indication.  Additional updates are required to use the
Progress() API passed into PerformFlashWriteWithProgress().

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

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

2018-05-28 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 v4 0/6] Add DisplayUpdateProgressLib to platforms

2018-05-28 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 V4
==
* Add following to commit messages based on feedback from:

  https://lists.01.org/pipermail/edk2-devel/2018-April/023737.html

This is the minimal update to this library implementation to
keep everything building and preserve any existing progress
indication.  Additional updates are required to use the
Progress() API passed into PerformFlashWriteWithProgress().


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: Ard Biesheuvel 
Cc: Leif Lindholm 
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] [edk2-platforms Patch v4 5/6] Hisilicon/PlatformFlashAccessLib: Add progress API

2018-05-28 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.

This is the minimal update to this library implementation to
keep everything building and preserve any existing progress
indication.  Additional updates are required to use the
Progress() API passed into PerformFlashWriteWithProgress().

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 fl

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

2018-05-28 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.

This is the minimal update to this library implementation to
keep everything building and preserve any existing progress
indication.  Additional updates are required to use the
Progress() API passed into PerformFlashWriteWithProgress().

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, 

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

2018-05-28 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 v4 2/6] Socionext/DeveloperBox: Add DisplayUpdateProgressLib mapping

2018-05-28 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 4/6] Styx/PlatformFlashAccessLib: Add progress API

2018-05-25 Thread Michael D Kinney
From: "Kinney, Michael D" <michael.d.kin...@intel.com>

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 <ard.biesheu...@linaro.org>
Cc: Leif Lindholm <leif.lindh...@linaro.org>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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 PLATFOR

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

2018-05-25 Thread Michael D Kinney
From: "Kinney, Michael D" <michael.d.kin...@intel.com>

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 <ard.biesheu...@linaro.org>
Cc: Leif Lindholm <leif.lindh...@linaro.org>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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" <michael.d.kin...@intel.com>

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 <ard.biesheu...@linaro.org>
Cc: Leif Lindholm <leif.lindh...@linaro.org>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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 n

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

2018-05-25 Thread Michael D Kinney
From: "Kinney, Michael D" <michael.d.kin...@intel.com>

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 <ard.biesheu...@linaro.org>
Cc: Leif Lindholm <leif.lindh...@linaro.org>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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" <michael.d.kin...@intel.com>

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 <ard.biesheu...@linaro.org>
Cc: Leif Lindholm <leif.lindh...@linaro.org>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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 = Boot

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

2018-05-25 Thread Michael D Kinney
From: "Kinney, Michael D" <michael.d.kin...@intel.com>

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 <ard.biesheu...@linaro.org>
Cc: Leif Lindholm <leif.lindh...@linaro.org>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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 <sean.bro...@microsoft.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Cc: Jiewen Yao <jiewen@intel.com>
Cc: David Wei <david@intel.com>
Cc: Mang Guo <mang@intel.com>
Cc: Kelly Steele <kelly.ste...@intel.com>

Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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 <kelly.ste...@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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 

[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 <sean.bro...@microsoft.com>
Cc: David Wei <david@intel.com>
Cc: Mang Guo <mang@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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 <sean.bro...@microsoft.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Cc: Jiewen Yao <jiewen@intel.com>
Cc: David Wei <david@intel.com>
Cc: Mang Guo <mang@intel.com>
Cc: Kelly Steele <kelly.ste...@intel.com>

Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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" <michael.d.kin...@intel.com>

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 <sean.bro...@microsoft.com>
Cc: Kelly Steele <kelly.ste...@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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 <david@intel.com>
Cc: Mang Guo <mang@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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 upda

[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 <sean.bro...@microsoft.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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,  // B

[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 <sean.bro...@microsoft.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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
+  );
+

[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 <jiewen@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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
--- 
a/SignedCapsulePkg/Library/PlatformFlashA

[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 <sean.bro...@microsoft.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Cc: Jiewen Yao <jiewen@intel.com>
Cc: David Wei <david@intel.com>
Cc: Mang Guo <mang@intel.com>
Cc: Kelly Steele <kelly.ste...@intel.com>

Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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/DisplayUpdateProgressLibT

[edk2] [RFC 3/4] FmpDevicePkg: Add FmpDxe module

2018-04-04 Thread Michael D Kinney
From: "Kinney, Michael D" <michael.d.kin...@intel.com>

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

The FmpDxe directory contains 2 INF files.  FmpDxe.inf
is a DXE driver that is used in a platform to add a
Firmware Management Protocol for firmware device that
supports firmware updates.

FmpDxeLib.inf is a NULL library instance with the exact
same functionality as FmpDxe.inf, but allows the the
Firmware Management Protocol feature to be added to
an existing device driver.

The FmpDxe component is intended to be used "as is"
with no need for any device specific or platform specific
changes.

Cc: Sean Brogan <sean.bro...@microsoft.com>
Cc: Jiewen Yao <jiewen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 FmpDevicePkg/FmpDxe/FmpDxe.c  | 1533 +
 FmpDevicePkg/FmpDxe/FmpDxe.inf|   96 +++
 FmpDevicePkg/FmpDxe/FmpDxe.uni|   20 +
 FmpDevicePkg/FmpDxe/FmpDxeExtra.uni   |   18 +
 FmpDevicePkg/FmpDxe/FmpDxeLib.inf |   93 ++
 FmpDevicePkg/FmpDxe/VariableSupport.c |  431 +
 FmpDevicePkg/FmpDxe/VariableSupport.h |  180 
 7 files changed, 2371 insertions(+)
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxe.c
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxe.inf
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxe.uni
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxeExtra.uni
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxeLib.inf
 create mode 100644 FmpDevicePkg/FmpDxe/VariableSupport.c
 create mode 100644 FmpDevicePkg/FmpDxe/VariableSupport.h

diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c
new file mode 100644
index 00..76a64dd468
--- /dev/null
+++ b/FmpDevicePkg/FmpDxe/FmpDxe.c
@@ -0,0 +1,1533 @@
+/**  @file
+  Produces a Firmware Management Protocol that supports updates to a firmware
+  image stored in a firmware device with platform and firmware device specific
+  information provided through PCDs and libraries.
+
+  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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "VariableSupport.h"
+
+//
+// FILE_GUID from FmpDxe.inf.  When FmpDxe.inf is used in a platform, the
+// FILE_GUID must always be overridden in the  section to provide
+// the ESRT GUID value associated with the updatable firmware image.  A
+// check is made in this module's driver entry point to verify that a
+// new FILE_GUID value has been defined.
+//
+const EFI_GUID  mDefaultModuleFileGuid = {
+  0x78ef0a56, 0x1cf0, 0x4535, { 0xb5, 0xda, 0xf6, 0xfd, 0x2f, 0x40, 0x5a, 0x11 
}
+};
+
+EFI_FIRMWARE_IMAGE_DESCRIPTOR  mDesc;
+BOOLEANmDescriptorPopulated = FALSE;
+BOOLEANmRuntimeVersionSupported = TRUE;
+BOOLEANmFmpInstalled= FALSE;
+
+//
+//Function pointer to progress function
+//
+EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS  mProgressFunc  = NULL;
+BOOLEANmProgressSupported = FALSE;
+
+CHAR16  *mImageIdName = NULL;
+UINT64  mImageId  = 0x1;
+CHAR16  *mVersionName = NULL;
+
+EFI_EVENT  mFmpDeviceLockEvent;
+BOOLEANmFmpDeviceLocked = FALSE;
+
+/**
+  Convert a version value to a Null-

[edk2] [RFC 4/4] FmpDevicePkg: Add DSC file to build all package components

2018-04-04 Thread Michael D Kinney
From: "Kinney, Michael D" <michael.d.kin...@intel.com>

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

Adds a DSC file that is used to verify that all of the
FmpDevicePkg libraries and modules build without error.

Cc: Sean Brogan <sean.bro...@microsoft.com>
Cc: Jiewen Yao <jiewen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 FmpDevicePkg/FmpDevicePkg.dsc | 119 ++
 1 file changed, 119 insertions(+)
 create mode 100644 FmpDevicePkg/FmpDevicePkg.dsc

diff --git a/FmpDevicePkg/FmpDevicePkg.dsc b/FmpDevicePkg/FmpDevicePkg.dsc
new file mode 100644
index 00..779b1ac243
--- /dev/null
+++ b/FmpDevicePkg/FmpDevicePkg.dsc
@@ -0,0 +1,119 @@
+## @file
+# Firmware Management Protocol Device Package
+#
+# This package provides an implementation of a Firmware Management Protocol
+# instance that supports the update of firmware storage devices using UEFI
+# Capsules.  The behavior of the Firmware Management Protocol instance is
+# customized using libraries and PCDs.
+#
+# 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.
+#
+##
+
+[Defines]
+  PLATFORM_NAME  = FmpDevicePkg
+  PLATFORM_GUID  = 0af3d540-27c6-11e8-828b-f8597177a00a
+  PLATFORM_VERSION   = 0.1
+  DSC_SPECIFICATION  = 0x00010005
+  OUTPUT_DIRECTORY   = Build/FmpDevicePkg
+  SUPPORTED_ARCHITECTURES= IA32|IPF|X64|ARM|AARCH64
+  BUILD_TARGETS  = DEBUG|RELEASE
+  SKUID_IDENTIFIER   = DEFAULT
+
+  #
+  # Define ESRT GUIDs for Firmware Management Protocol instances
+  #
+  DEFINE FMP_GRAPHICS_ESRT_GUID  = B461B3BD-E62A-4A71-841C-50BA4E500267
+  DEFINE FMP_TEXT_ESRT_GUID  = 226034C4-8B67-4536-8653-D6EE7CE5A316
+
+[LibraryClasses]
+  
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+  
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
+  
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+  UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+  
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+  UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
+  
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+  DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+  UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
+  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
+  BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+  
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+  PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+  DebugLib|MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
+  
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
+  PostCodeLib|MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf
+  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+
+  
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+  UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+  DevicePathLib|MdePkg/Lib

[edk2] [RFC 1/4] FmpDevicePkg: Add package, library classes, and PCDs

2018-04-04 Thread Michael D Kinney
From: "Kinney, Michael D" <michael.d.kin...@intel.com>

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

Create FmpDevicePkg with library classes and PCDs used to
customize the behavior of a Firmware Management Protocol
instance.

Library Classes
===
* FmpDeviceLib - Provides firmware device specific services
  to support updates of a firmware image stored in a firmware
  device.
* CapsuleUpdatePolicyLib - Provides platform policy services
  used during a capsule update.
* FmpPayloadHeaderLib - Provides services to retrieve values
  from a capsule's FMP Payload Header.  The structure is not
  included in the library class.  Instead, services are
  provided to retrieve information from the FMP Payload Header.
  If information is added to the FMP Payload Header, then new
  services may be added to this library class to retrieve the
  new information.

PCDs set per module

* PcdFmpDeviceSystemResetRequired - Indicates if a full
  system reset is required before a firmware update to a
  firmware devices takes effect
* PcdFmpDeviceProgressColor - The color of the progress bar
  during a firmware update.
* PcdFmpDeviceImageIdName - The Null-terminated Unicode
  string used to fill in the ImageIdName field of the
  EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned
  by the GetImageInfo() service of the Firmware Management
  Protocol for the firmware device.
* PcdFmpDeviceBuildTimeLowestSupportedVersion - The build
  time value used to fill in the LowestSupportedVersion field
  of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is
  returned by the GetImageInfo() service of the Firmware
  Management Protocol.
* PcdFmpDeviceProgressWatchdogTimeInSeconds - The time in
  seconds to arm a watchdog timer during the update of a
  firmware device.

PCDs set per module or for entire platform
==
* PcdFmpDevicePkcs7CertBufferXdr - One or more PKCS7
  certificates used to verify a firmware device capsule
  update image.
* PcdFmpDeviceLockEventGuid - An event GUID that locks
  the firmware device when the event is signaled.

Cc: Sean Brogan <sean.bro...@microsoft.com>
Cc: Jiewen Yao <jiewen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 FmpDevicePkg/FmpDevicePkg.dec  | 126 +++
 FmpDevicePkg/FmpDevicePkg.uni  |  75 
 FmpDevicePkg/FmpDevicePkgExtra.uni |  18 +
 .../Include/Library/CapsuleUpdatePolicyLib.h   | 120 +++
 FmpDevicePkg/Include/Library/FmpDeviceLib.h| 385 +
 FmpDevicePkg/Include/Library/FmpPayloadHeaderLib.h | 100 ++
 6 files changed, 824 insertions(+)
 create mode 100644 FmpDevicePkg/FmpDevicePkg.dec
 create mode 100644 FmpDevicePkg/FmpDevicePkg.uni
 create mode 100644 FmpDevicePkg/FmpDevicePkgExtra.uni
 create mode 100644 FmpDevicePkg/Include/Library/CapsuleUpdatePolicyLib.h
 create mode 100644 FmpDevicePkg/Include/Library/FmpDeviceLib.h
 create mode 100644 FmpDevicePkg/Include/Library/FmpPayloadHeaderLib.h

diff --git a/FmpDevicePkg/FmpDevicePkg.dec b/FmpDevicePkg/FmpDevicePkg.dec
new file mode 100644
index 00..62fb98dbdb
--- /dev/null
+++ b/FmpDevicePkg/FmpDevicePkg.dec
@@ -0,0 +1,126 @@
+## @file
+# Firmware Management Protocol Device Package
+#
+# This package provides an implementation of a Firmware Management Protocol
+# instance that supports the update of firmware storage devices using UEFI
+# Capsules.  The behavior of the Firmware Management Protocol instance is
+# customized using libraries and PCDs.
+#
+# 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 IN

[edk2] [RFC 2/4] FmpDevicePkg: Add library instances

2018-04-04 Thread Michael D Kinney
From: "Kinney, Michael D" <michael.d.kin...@intel.com>

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

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

Add library instances for FmpDeviceLib, CapsuleUpdatePolicyLib,
and FmpPayloadHeaderLib.

Library Classes
===
* FmpDeviceLibNull - Non-functional template of the FmpDeviceLib
  that can be used as a starting point for an FmpDeviceLib for
  a specific firmware storage device.
* CapsuleUpdatePolicyLibNull - Functional template of the
  CapsuleUpdatePolicyLib that can be used as a starting point
  of a platform specific implementation.
* FmpPayloadHeaderLibV1 - Version 1 of the FmpPayloadHeaderLib.
  This library is indented to be used "as is" with no need for
  any device specific or platform specific changes.

Cc: Sean Brogan <sean.bro...@microsoft.com>
Cc: Jiewen Yao <jiewen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 .../CapsuleUpdatePolicyLibNull.c   | 136 +++
 .../CapsuleUpdatePolicyLibNull.inf |  45 +++
 .../CapsuleUpdatePolicyLibNull.uni |  17 +
 .../Library/FmpDeviceLibNull/FmpDeviceLib.c| 395 +
 .../Library/FmpDeviceLibNull/FmpDeviceLibNull.inf  |  48 +++
 .../Library/FmpDeviceLibNull/FmpDeviceLibNull.uni  |  18 +
 .../FmpPayloadHeaderLibV1/FmpPayloadHeaderLib.c| 188 ++
 .../FmpPayloadHeaderLibV1.inf  |  48 +++
 .../FmpPayloadHeaderLibV1.uni  |  21 ++
 9 files changed, 916 insertions(+)
 create mode 100644 
FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.c
 create mode 100644 
FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.inf
 create mode 100644 
FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.uni
 create mode 100644 FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c
 create mode 100644 FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLibNull.inf
 create mode 100644 FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLibNull.uni
 create mode 100644 
FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLib.c
 create mode 100644 
FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.inf
 create mode 100644 
FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.uni

diff --git 
a/FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.c 
b/FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.c
new file mode 100644
index 00..943fe372cb
--- /dev/null
+++ 
b/FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.c
@@ -0,0 +1,136 @@
+/**  @file
+  Provides platform policy services used during a capsule update.
+
+  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 
+
+/**
+  Determine if the system power state supports a capsule update.
+
+  @param[out] Good  Returns TRUE if system power state supports a capsule
+update.  Returns FALSE if system power state does not
+support a capsule update.  Return value is only valid if
+return status is EFI_SUCCESS.
+
+  @retval EFI_SUCCESSGood parameter has been updated with result.
+  @retval EFI_INVALID_PARAMETER  Good is NULL.
+  @retval EFI_DEVICE_ERROR   System power state can not be determined.
+
+**/
+EFI_ST

[edk2] [RFC 0/4] Add FmpDevicePkg

2018-04-04 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=922

Based on content from the following branch:

https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport/MsCapsuleUpdatePkg

Branch for review:

https://github.com/mdkinney/edk2/tree/Bug_922_FmpDevicePkg

This package provides an implementation of a Firmware Management Protocol
instance that supports the update of firmware storage devices using UEFI
Capsules.  The behavior of the Firmware Management Protocol instance is
customized using libraries and PCDs.

Cc: Sean Brogan <sean.bro...@microsoft.com>
Cc: Jiewen Yao <jiewen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>

Kinney, Michael D (4):
  FmpDevicePkg: Add package, library classes, and PCDs
  FmpDevicePkg: Add library instances
  FmpDevicePkg: Add FmpDxe module
  FmpDevicePkg: Add DSC file to build all package components

 FmpDevicePkg/FmpDevicePkg.dec  |  126 ++
 FmpDevicePkg/FmpDevicePkg.dsc  |  119 ++
 FmpDevicePkg/FmpDevicePkg.uni  |   75 +
 FmpDevicePkg/FmpDevicePkgExtra.uni |   18 +
 FmpDevicePkg/FmpDxe/FmpDxe.c   | 1533 
 FmpDevicePkg/FmpDxe/FmpDxe.inf |   96 ++
 FmpDevicePkg/FmpDxe/FmpDxe.uni |   20 +
 FmpDevicePkg/FmpDxe/FmpDxeExtra.uni|   18 +
 FmpDevicePkg/FmpDxe/FmpDxeLib.inf  |   93 ++
 FmpDevicePkg/FmpDxe/VariableSupport.c  |  431 ++
 FmpDevicePkg/FmpDxe/VariableSupport.h  |  180 +++
 .../Include/Library/CapsuleUpdatePolicyLib.h   |  120 ++
 FmpDevicePkg/Include/Library/FmpDeviceLib.h|  385 +
 FmpDevicePkg/Include/Library/FmpPayloadHeaderLib.h |  100 ++
 .../CapsuleUpdatePolicyLibNull.c   |  136 ++
 .../CapsuleUpdatePolicyLibNull.inf |   45 +
 .../CapsuleUpdatePolicyLibNull.uni |   17 +
 .../Library/FmpDeviceLibNull/FmpDeviceLib.c|  395 +
 .../Library/FmpDeviceLibNull/FmpDeviceLibNull.inf  |   48 +
 .../Library/FmpDeviceLibNull/FmpDeviceLibNull.uni  |   18 +
 .../FmpPayloadHeaderLibV1/FmpPayloadHeaderLib.c|  188 +++
 .../FmpPayloadHeaderLibV1.inf  |   48 +
 .../FmpPayloadHeaderLibV1.uni  |   21 +
 23 files changed, 4230 insertions(+)
 create mode 100644 FmpDevicePkg/FmpDevicePkg.dec
 create mode 100644 FmpDevicePkg/FmpDevicePkg.dsc
 create mode 100644 FmpDevicePkg/FmpDevicePkg.uni
 create mode 100644 FmpDevicePkg/FmpDevicePkgExtra.uni
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxe.c
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxe.inf
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxe.uni
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxeExtra.uni
 create mode 100644 FmpDevicePkg/FmpDxe/FmpDxeLib.inf
 create mode 100644 FmpDevicePkg/FmpDxe/VariableSupport.c
 create mode 100644 FmpDevicePkg/FmpDxe/VariableSupport.h
 create mode 100644 FmpDevicePkg/Include/Library/CapsuleUpdatePolicyLib.h
 create mode 100644 FmpDevicePkg/Include/Library/FmpDeviceLib.h
 create mode 100644 FmpDevicePkg/Include/Library/FmpPayloadHeaderLib.h
 create mode 100644 
FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.c
 create mode 100644 
FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.inf
 create mode 100644 
FmpDevicePkg/Library/CapsuleUpdatePolicyLibNull/CapsuleUpdatePolicyLibNull.uni
 create mode 100644 FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c
 create mode 100644 FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLibNull.inf
 create mode 100644 FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLibNull.uni
 create mode 100644 
FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLib.c
 create mode 100644 
FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.inf
 create mode 100644 
FmpDevicePkg/Library/FmpPayloadHeaderLibV1/FmpPayloadHeaderLibV1.uni

-- 
2.14.2.windows.3

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


[edk2] [Patch 2/9] MdeModulePkg: Add DisplayUpdateProgressLib instances

2018-04-04 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 <sean.bro...@microsoft.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../DisplayUpdateProgressGraphicsLib.c | 475 +
 .../DisplayUpdateProgressGraphicsLib.inf   |  60 +++
 .../DisplayUpdateProgressGraphicsLib.uni   |  18 +
 .../DisplayUpdateProgressTextLib.c | 142 ++
 .../DisplayUpdateProgressTextLib.inf   |  53 +++
 .../DisplayUpdateProgressTextLib.uni   |  18 +
 MdeModulePkg/MdeModulePkg.dsc  |   3 +
 7 files changed, 769 insertions(+)
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressGraphicsLib/DisplayUpdateProgressGraphicsLib.c
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressGraphicsLib/DisplayUpdateProgressGraphicsLib.inf
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressGraphicsLib/DisplayUpdateProgressGraphicsLib.uni
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressTextLib/DisplayUpdateProgressTextLib.c
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressTextLib/DisplayUpdateProgressTextLib.inf
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressTextLib/DisplayUpdateProgressTextLib.uni

diff --git 
a/MdeModulePkg/Library/DisplayUpdateProgressGraphicsLib/DisplayUpdateProgressGraphicsLib.c
 
b/MdeModulePkg/Library/DisplayUpdateProgressGraphicsLib/DisplayUpdateProgressGraphicsLib.c
new file mode 100644
index 00..007522cea0
--- /dev/null
+++ 
b/MdeModulePkg/Library/DisplayUpdateProgressGraphicsLib/DisplayUpdateProgressGraphicsLib.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
+

[edk2] [Patch 3/9] Vlv2Tbl2DevicePkg: Add DisplayUpdateProgressLib mapping

2018-04-04 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 <sean.bro...@microsoft.com>
Cc: David Wei <david@intel.com>
Cc: Mang Guo <mang@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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..f43449c588 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/DisplayUpdateProgressGraphicsLib/DisplayUpdateProgressGraphicsLib.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..f69f61ca71 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/DisplayUpdateProgressGraphicsLib/DisplayUpdateProgressGraphicsLib.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..63c23a1689 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/DisplayUpdateProgressGraphicsLib/DisplayUpdateProgressGraphicsLib.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 9/9] SignedCapsulePkg/SystemFirmwareUpdateDxe: Use progress API

2018-04-04 Thread Michael D Kinney
From: "Kinney, Michael D" <michael.d.kin...@intel.com>

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

Use PlatformFlashWriteWithProgress() instead of PlatformFLashWrite()
so the user can be informed of the progress as a capsule is used
to update a firmware image in a firmware device.

Cc: Jiewen Yao <jiewen@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c | 92 --
 1 file changed, 68 insertions(+), 24 deletions(-)

diff --git 
a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c 
b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
index fd6641eb3e..8d2e0df81c 100644
--- a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
+++ b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c
@@ -8,7 +8,7 @@
 
   FmpSetImage() will receive untrusted input and do basic validation.
 
-  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
@@ -65,11 +65,14 @@ ParseUpdateDataFile (
 **/
 EFI_STATUS
 PerformUpdate (
-  IN VOID *SystemFirmwareImage,
-  IN UINTNSystemFirmwareImageSize,
-  IN UPDATE_CONFIG_DATA   *ConfigData,
-  OUT UINT32  *LastAttemptVersion,
-  OUT UINT32  *LastAttemptStatus
+  IN VOID   *SystemFirmwareImage,
+  IN UINTN  SystemFirmwareImageSize,
+  IN UPDATE_CONFIG_DATA *ConfigData,
+  OUT UINT32*LastAttemptVersion,
+  OUT UINT32*LastAttemptStatus,
+  IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS  Progress,
+  IN UINTN  StartPercentage,
+  IN UINTN  EndPercentage
   )
 {
   EFI_STATUS   Status;
@@ -78,12 +81,15 @@ PerformUpdate (
   DEBUG((DEBUG_INFO, "  BaseAddress - 0x%lx,", ConfigData->BaseAddress));
   DEBUG((DEBUG_INFO, "  ImageOffset - 0x%x,", ConfigData->ImageOffset));
   DEBUG((DEBUG_INFO, "  Legnth - 0x%x\n", ConfigData->Length));
-  Status = PerformFlashWrite (
+  Status = PerformFlashWriteWithProgress (
  ConfigData->FirmwareType,
  ConfigData->BaseAddress,
  ConfigData->AddressType,
  (VOID *)((UINTN)SystemFirmwareImage + 
(UINTN)ConfigData->ImageOffset),
- ConfigData->Length
+ ConfigData->Length,
+ Progress,
+ StartPercentage,
+ EndPercentage
  );
   if (!EFI_ERROR(Status)) {
 *LastAttemptStatus = LAST_ATTEMPT_STATUS_SUCCESS;
@@ -111,12 +117,13 @@ PerformUpdate (
 **/
 EFI_STATUS
 UpdateImage (
-  IN VOID *SystemFirmwareImage,
-  IN UINTNSystemFirmwareImageSize,
-  IN VOID *ConfigImage,
-  IN UINTNConfigImageSize,
-  OUT UINT32  *LastAttemptVersion,
-  OUT UINT32  *LastAttemptStatus
+  IN VOID   *SystemFirmwareImage,
+  IN UINTN  SystemFirmwareImageSize,
+  IN VOID   *ConfigImage,
+  IN UINTN  ConfigImageSize,
+  OUT UINT32*LastAttemptVersion,
+  OUT UINT32*LastAttemptStatus,
+  IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS  Progress
   )
 {
   EFI_STATUSStatus;
@@ -124,19 +131,34 @@ UpdateImage (
   UPDATE_CONFIG_DATA*UpdateConfigData;
   CONFIG_HEADER ConfigHeader;
   UINTN Index;
+  UINTN TotalSize;
+  UINTN BytesWritten;
+  UINTN StartPercentage;
+  UINTN EndPercentage;
 
   if (ConfigImage == NULL) {
 DEBUG((DEBUG_INFO, "PlatformUpdate (NoConfig):"));
 DEBUG((DEBUG_INFO, "  BaseAddress - 0x%x,", 0));
 DEBUG((DEBUG_INFO, "  Length - 0x%x\n", SystemFirmwareImageSize));
 // ASSUME the whole System Firmware include NVRAM region.
-Status = PerformFlashWrite (
+StartPercentage = 0;
+EndPercentage = 100;

[edk2] [Patch 6/9] SignedCapsulePkg/PlatformFlashAccessLib: Add progress API

2018-04-04 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 <jiewen@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../Include/Library/PlatformFlashAccessLib.h   | 33 -
 .../PlatformFlashAccessLibNull.c   | 54 +++---
 2 files changed, 78 insertions(+), 9 deletions(-)

diff --git a/SignedCapsulePkg/Include/Library/PlatformFlashAccessLib.h 
b/SignedCapsulePkg/Include/Library/PlatformFlashAccessLib.h
index 0a8858e4c4..a691baccc4 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,31 @@ PerformFlashWrite (
   IN UINTNLength
   );
 
+/**
+  Perform flash write operation with progress indicator.
+
+  @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
+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,
+  IN UINTN  StartPercentage,
+  IN UINTN  EndPercentage
+  );
+
 #endif
diff --git 
a/SignedCapsulePkg/Library/PlatformFlashAccessLibNull/PlatformFlashAccessLibNull.c
 
b/SignedCapsulePkg/Library/PlatformFlashAccessLibNull/PlatformFlashAccessLibNull.c
index b34ebbba1e..19c8f1acd9 100644
--- 
a/SignedCapsulePkg/Library/PlatformFlashAccessLibNull/PlatformFlashAccessLibNull.c
+++ 
b/SignedCapsulePkg/Library/PlatformFlashAccessLibNull/PlatformFlashAccessLibNull.c
@@ -1,7 +1,7 @@
 /** @file
   Platform flash device access library NULL instance.
 
-  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
@@ -20,7 +20,41 @@
 UINT64 mInternalFdAddress;
 
 /**
-  Perform flash write opreation.
+  Perform flash write operation with progress indicator.
+
+  @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 

[edk2] [Patch 7/9] Vlv2TbltDevicePkg/PlatformFlashAccessLib: Add progress API

2018-04-04 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 <david@intel.com>
Cc: Mang Guo <mang@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../PlatformFlashAccessLib.c   | 84 +++---
 .../PlatformFlashAccessLib.inf |  3 +-
 2 files changed, 58 insertions(+), 29 deletions(-)

diff --git 
a/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
 
b/Vlv2TbltDevicePkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLib.c
index 9162e025ed..868e4049bb 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,7 +381,7 @@ InternalWriteBlock (
 }
 
 /**
-  Perform flash write opreation.
+  Perform flash write operation with progress indicator.
 
   @param[in] FirmwareType  The type of firmware.
   @param[in] FlashAddress  The address of flash device to be accessed.
@@ -396,12 +396,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,
+  IN UINTN  StartPercentage,
+  IN UINTN  EndPercentage
   )
 {
   EFI_STATUSStatus = EFI_SUCCESS;
@@ -456,42 +459,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".");
-
 //
 // Make updating process uninterruptable,
 // so that the flash memory area is not accessed by other entities
 // which may interfere with the updating process
 //
 Status  = InternalEraseBlock (Address);
-  if (EFI_ERROR(Status)) {
+if (EFI_ERROR(Status)) {
   gBS->RestoreTPL (OldTpl);
   FlashError = TRUE;
   goto Done;
-  }
+}
 Status = InternalWriteBlock (
   Address,
   Buf,
   (UINT32)(Length > BLOCK_SIZE ? BLOCK_SIZE : Length)
   );
-  if (EFI_ERROR(Status)) {
+if (EFI_ERROR(Status)) {
   gBS->RestoreTPL (OldTpl);
   FlashError = TRUE;
   goto Done;
 }
-  }
+  }
 
   //
   // Move to next block to update.
@@ -506,26 +507,55 @@ PerformFlashWrite (
 }
 gBS->RestoreTPL (OldTpl);
 
-  Done:
+Done:
   if ((BiosCntl & B_PCH_LPC_BIOS_CNTL_SMM_BWP) == B_PCH_LPC_BIOS_CNTL_SMM_BWP) 
{
 //
 // Restore original control setting
 //
 MmioWrite8 (LpcBaseAddress + R_PCH_LPC_BIOS_CNTL, BiosCntl);
-}
-
-  //
-  // Print flash update failure message if error detected.
-  //
-  if (FlashError) {
-Print (L"No %r\n", Status);
   }
 
   return EFI_SUCCESS;
 }
 
 /**
-  Perform microcode write opreation.
+  Perform flash write operation.
+
+  @param[in] FirmwareType  The type of

[edk2] [Patch 4/9] QuarkPlatformPkg: Add DisplayUpdateProgressLib mapping

2018-04-04 Thread Michael D Kinney
From: "Kinney, Michael D" <michael.d.kin...@intel.com>

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 <sean.bro...@microsoft.com>
Cc: Kelly Steele <kelly.ste...@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
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..9926b26a27 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/DisplayUpdateProgressTextLib/DisplayUpdateProgressTextLib.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 8/9] QuarkPlatformPkg/PlatformFlashAccessLib: Add progress API

2018-04-04 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 <kelly.ste...@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../PlatformFlashAccessLibDxe.c| 59 +++---
 1 file changed, 51 insertions(+), 8 deletions(-)

diff --git 
a/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c
 
b/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c
index 839c3a726e..7bc6d20d52 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,7 +112,7 @@ FlashFdErase (
 }
 
 /**
-  Perform flash write opreation.
+  Perform flash write opreration with progress indicator.
 
   @param[in] FirmwareType  The type of firmware.
   @param[in] FlashAddress  The address of flash device to be accessed.
@@ -127,12 +127,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,
+  IN UINTN  StartPercentage,
+  IN UINTN  EndPercentage
   )
 {
   EFI_STATUS  Status;
@@ -150,6 +153,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,
@@ -179,6 +186,42 @@ 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 EFI_PHYSICAL_ADDRESS FlashAddress,
+  IN FLASH_ADDRESS_TYPE   FlashAddressType,
+  IN VOID *Buffer,
+  IN UINTNLength
+  )
+{
+  return PerformFlashWriteWithProgress (
+   FirmwareType,
+   FlashAddress,
+   FlashAddressType,
+   Buffer,
+   Length,
+   NULL,
+   0,
+   0
+   );
+}
+
 /**
   Platform Flash Access Lib Constructor.
 
-- 
2.14.2.windows.3

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


[edk2] [Patch 5/9] MdeModulePkg/DxeCapsuleLibFmp: Add progress bar support

2018-04-04 Thread Michael D Kinney
From: "Kinney, Michael D" <michael.d.kin...@intel.com>

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

* Change Update_Image_Progress() to UpdateImageProcess()
* Call DisplayUpdateProgressLib from UpdateImageProgress().
* Split out a boot service and runtime version of
  UpdateImageProgress() so the DisplayUpdateProgressLib is
  not used at runtime.
* If gEdkiiFirmwareManagementProgressProtocolGuid is present,
  then use its progress bar color and watchdog timer value.
* If gEdkiiFirmwareManagementProgressProtocolGuid is not present,
  then use default progress bar color and 5 min watchdog timer.
* Remove Print() calls during capsule processing.  Instead,
  the DisplayUpdateProgressLib is used to inform the user
  of progress during a capsule update.

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Cc: Jiewen Yao <jiewen@intel.com>
Cc: Sean Brogan <sean.bro...@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c   | 47 +---
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf |  8 ++-
 .../DxeCapsuleLibFmp/DxeCapsuleProcessLib.c| 84 --
 .../DxeCapsuleLibFmp/DxeCapsuleProcessLibNull.c| 21 +-
 .../DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf  |  7 +-
 5 files changed, 131 insertions(+), 36 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c 
b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
index 555c5971d0..5be6bf386e 100644
--- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
+++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 EFI_SYSTEM_RESOURCE_TABLE *mEsrtTable  = NULL;
@@ -53,6 +54,8 @@ BOOLEAN   mIsVirtualAddrConverted  = 
FALSE;
 BOOLEAN   mDxeCapsuleLibEndOfDxe   = FALSE;
 EFI_EVENT mDxeCapsuleLibEndOfDxeEvent  = NULL;
 
+EDKII_FIRMWARE_MANAGEMENT_PROGRESS_PROTOCOL  *mFmpProgress = NULL;
+
 /**
   Initialize capsule related variables.
 **/
@@ -101,18 +104,17 @@ RecordFmpCapsuleStatusVariable (
   Function indicate the current completion progress of the firmware
   update. Platform may override with own specific progress function.
 
-  @param[in]  CompletionA value between 1 and 100 indicating the current 
completion progress of the firmware update
+  @param[in]  Completion  A value between 1 and 100 indicating the current
+  completion progress of the firmware update
 
-  @retval EFI_SUCESSInput capsule is a correct FMP capsule.
+  @retval EFI_SUCESS The capsule update progress was updated.
+  @retval EFI_INVALID_PARAMETER  Completion is greater than 100%.
 **/
 EFI_STATUS
 EFIAPI
-Update_Image_Progress (
+UpdateImageProgress (
   IN UINTN  Completion
-  )
-{
-  return EFI_SUCCESS;
-}
+  );
 
 /**
   Return if this CapsuleGuid is a FMP capsule GUID or not.
@@ -849,6 +851,19 @@ SetFmpImageData (
 return Status;
   }
 
+  //
+  // Lookup Firmware Management Progress Protocol before SetImage() is called
+  // This is an optional protocol that may not be present on Handle.
+  //
+  Status = gBS->HandleProtocol (
+  Handle,
+  ,
+  (VOID **)
+  );
+  if (EFI_ERROR (Status)) {
+mFmpProgress = NULL;
+  }
+
   if (ImageHeader->Version >= 
EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER_INIT_VERSION) {
 Image = (UINT8 *)(ImageHeader + 1);
   } else {
@@ -873,21 +888,37 @@ SetFmpImageData (
 DEBUG((DEBUG_INFO, "(UpdateHardwareInstance - 0x%x)", 
ImageHeader->UpdateHardwareInstance));
   }
   DEBUG((DEBUG_INFO, "\n"));
+
+  //
+  // Before calling SetImage(), reset the progress bar to 0%
+  //
+  UpdateImageProgress (0);
+
   Status = Fmp->SetImage(
   Fmp,
   ImageHeader->UpdateImageIndex,  // ImageIndex
   Image,  // Image
   ImageHeader->UpdateImageSize,   // ImageSize
   VendorCode, // VendorCode
-  Update_Image_Progress,  // Progress
+  UpdateImageProgress,// Progress
   // AbortReason
   );
+  //
+  // Set the progress bar to 100% after returning from SetImage()
+  //
+  UpdateImageProgress (100);
+
   DEBUG((DEBUG_INFO, "Fmp->SetImage - %r\n", Status));
   if (AbortReason != NULL) {
 DEBUG ((DEBUG_ERROR, "%s\n", AbortReason));
 FreePool(AbortReason);
   }
 
+  //
+  //

[edk2] [Patch 1/9] MdeModulePkg: Add DisplayUpdateProgressLib class

2018-04-04 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 <sean.bro...@microsoft.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../Include/Library/DisplayUpdateProgressLib.h | 65 ++
 .../Include/Protocol/FirmwareManagementProgress.h  | 50 +
 MdeModulePkg/MdeModulePkg.dec  | 11 
 3 files changed, 126 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
+  );
+

[edk2] [Patch 0/9] Add DisplayUpdateProgressLib for capsules

2018-04-04 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

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 <sean.bro...@microsoft.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Cc: Jiewen Yao <jiewen@intel.com>
Cc: David Wei <david@intel.com>
Cc: Mang Guo <mang@intel.com>
Cc: Kelly Steele <kelly.ste...@intel.com>

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

Kinney, Michael D (3):
  QuarkPlatformPkg: Add DisplayUpdateProgressLib mapping
  MdeModulePkg/DxeCapsuleLibFmp: Add progress bar support
  SignedCapsulePkg/SystemFirmwareUpdateDxe: Use progress API

Michael D Kinney (6):
  MdeModulePkg: Add DisplayUpdateProgressLib class
  MdeModulePkg: Add DisplayUpdateProgressLib instances
  Vlv2Tbl2DevicePkg: Add DisplayUpdateProgressLib mapping
  SignedCapsulePkg/PlatformFlashAccessLib: Add progress API
  Vlv2TbltDevicePkg/PlatformFlashAccessLib: Add progress API
  QuarkPlatformPkg/PlatformFlashAccessLib: Add progress API

 .../Include/Library/DisplayUpdateProgressLib.h |  65 +++
 .../Include/Protocol/FirmwareManagementProgress.h  |  50 +++
 .../DisplayUpdateProgressGraphicsLib.c | 475 +
 .../DisplayUpdateProgressGraphicsLib.inf   |  60 +++
 .../DisplayUpdateProgressGraphicsLib.uni   |  18 +
 .../DisplayUpdateProgressTextLib.c | 142 ++
 .../DisplayUpdateProgressTextLib.inf   |  53 +++
 .../DisplayUpdateProgressTextLib.uni   |  18 +
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c   |  47 +-
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf |   8 +-
 .../DxeCapsuleLibFmp/DxeCapsuleProcessLib.c|  84 +++-
 .../DxeCapsuleLibFmp/DxeCapsuleProcessLibNull.c|  21 +-
 .../DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf  |   7 +-
 MdeModulePkg/MdeModulePkg.dec  |  11 +
 MdeModulePkg/MdeModulePkg.dsc  |   3 +
 .../PlatformFlashAccessLibDxe.c|  59 ++-
 QuarkPlatformPkg/Quark.dsc |   1 +
 .../Include/Library/PlatformFlashAccessLib.h   |  33 +-
 .../PlatformFlashAccessLibNull.c   |  54 ++-
 .../SystemFirmwareUpdate/SystemFirmwareUpdateDxe.c |  92 ++--
 .../PlatformFlashAccessLib.c   |  84 ++--
 .../PlatformFlashAccessLib.inf |   3 +-
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc|   1 +
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc  |   1 +
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc   |   1 +
 25 files changed, 1285 insertions(+), 106 deletions(-)
 create mode 100644 MdeModulePkg/Include/Library/DisplayUpdateProgressLib.h
 create mode 100644 MdeModulePkg/Include/Protocol/FirmwareManagementProgress.h
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressGraphicsLib/DisplayUpdateProgressGraphicsLib.c
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressGraphicsLib/DisplayUpdateProgressGraphicsLib.inf
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressGraphicsLib/DisplayUpdateProgressGraphicsLib.uni
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressTextLib/DisplayUpdateProgressTextLib.c
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressTextLib/DisplayUpdateProgressTextLib.inf
 create mode 100644 
MdeModulePkg/Library/DisplayUpdateProgressTextLib/DisplayUpdateProgressTextLib.uni

-- 
2.14.2.windows.3

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


[edk2] [Patch V2] BaseTools/BinToPcd: Add support for multiple binary input files

2018-03-21 Thread Michael D Kinney
From: "Kinney, Michael D" <michael.d.kin...@intel.com>

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

There are use cases where a VOID * PCD needs to be generated from multiple
binary input files.  This can be in the form of an array of fixed size
elements or a set of variable sized elements.

Update BinToPcd to support multiple one or more -i INPUTFILE arguments.
By default, the contents of each binary input file are concatenated in
the order provided.  This supports generating a PCD that is an array of
fixed size elements

Add -x, --xdr flags to BinToPcd  to encodes the PCD using the
Variable-Length Opaque Data of RFC 4506 External Data Representation
Standard (XDR).

https://tools.ietf.org/html/rfc4506
https://tools.ietf.org/html/rfc4506#section-4.10

The data format from RFC 4506 meets the requirements for a PCD that is a
set of variable sized elements in the Variable-Length Opaque Data format.
The overhead of this format is a 32-bit length and 0 to 3 bytes of padding
to align the next element at a 32-bit boundary.

Cc: Sean Brogan <sean.bro...@microsoft.com>
Cc: Yonghong Zhu <yonghong@intel.com>
Cc: Liming Gao <liming@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 BaseTools/Scripts/BinToPcd.py | 83 ---
 1 file changed, 54 insertions(+), 29 deletions(-)

diff --git a/BaseTools/Scripts/BinToPcd.py b/BaseTools/Scripts/BinToPcd.py
index 68a7ac652d..f2485a27fa 100644
--- a/BaseTools/Scripts/BinToPcd.py
+++ b/BaseTools/Scripts/BinToPcd.py
@@ -1,7 +1,7 @@
 ## @file
 # Convert a binary file to a VOID* PCD value or DSC file VOID* PCD statement.
 #
-# 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
@@ -18,14 +18,15 @@ BinToPcd
 import sys
 import argparse
 import re
+import xdrlib
 
 #
 # Globals for help information
 #
 __prog__= 'BinToPcd'
-__version__ = '%s Version %s' % (__prog__, '0.9 ')
-__copyright__   = 'Copyright (c) 2016, Intel Corporation. All rights reserved.'
-__description__ = 'Convert a binary file to a VOID* PCD value or DSC file 
VOID* PCD statement.\n'
+__version__ = '%s Version %s' % (__prog__, '0.91 ')
+__copyright__   = 'Copyright (c) 2016 - 2018, Intel Corporation. All rights 
reserved.'
+__description__ = 'Convert one or more binary files to a VOID* PCD value or 
DSC file VOID* PCD statement.\n'
 
 if __name__ == '__main__':
   def ValidateUnsignedInteger (Argument):
@@ -50,21 +51,35 @@ if __name__ == '__main__':
   Message = '%s is not a valid GUID C name' % (Argument)
   raise argparse.ArgumentTypeError(Message)
 return Argument
-
-  def ByteArray (Buffer):
+
+  def ByteArray (Buffer, Xdr = False):
+if Xdr:
+  #
+  # If Xdr flag is set then encode data using the Variable-Length Opaque
+  # Data format of RFC 4506 External Data Representation Standard (XDR).
+  #
+  XdrEncoder = xdrlib.Packer()
+  for Item in Buffer:
+XdrEncoder.pack_bytes(Item)
+  Buffer = XdrEncoder.get_buffer()
+else:
+  #
+  # If Xdr flag is not set, then concatenate all the data
+  #
+  Buffer = ''.join(Buffer)
 #
-# Append byte array of values of the form '{0x01, 0x02, ...}'
+# Return a PCD value of the form '{0x01, 0x02, ...}' along with the PCD 
length in bytes
 #
-return '{%s}' % (', '.join(['0x%02x' % (ord(Item)) for Item in Buffer]))
-
+return '{%s}' % (', '.join(['0x%02x' % (ord(Item)) for Item in Buffer])), 
len (Buffer)
+
   #
   # Create command line argument parser object
   #
   parser = argparse.ArgumentParser(prog = __prog__, version = __version__,
description = __description__ + 
__copyright__,
conflict_handler = 'resolve')
-  parser.add_argument("-i", "--input", dest = 'InputFile', type = 
argparse.FileType('rb'),
-  help = "Input binary filename", required = True)
+  parser.add_argument("-i", "--input", dest = 'InputFile', type = 
argparse.FileType('rb'), action='append', required = True,
+  help = "Input binary filename.  Multiple input files are 
combined into a single PCD.")
   parser.add_argument("-o", "--output", dest = 'OutputFile', type = 
argparse.FileType('wb'),
   help = "Output filename for PCD value or PCD statement")
   parser.add_argument("-p", "--pcd", dest = 'PcdName', type = ValidatePcdName,
@@ -79,6 +94,8 @@ if __name__ == '__main__':

[edk2] [Patch] Vlv2TbltDevicePkg: Remove DxeTcg2PhysicalPresenceLibNull

2018-03-21 Thread Michael D Kinney
From: "Kinney, Michael D" <michael.d.kin...@intel.com>

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

The following commit that to use Tcg2 instead of TrEE breaks the
build of Vlv2TbltDevicePkg\Library\DxeTcg2PhysicalPresenceLibNull

https://github.com/tianocore/edk2/commit/9461604e1490f73fdbcc8e957dbe75f75c73b027#diff-c85873f3649e35873a11936ace983807

The correct fix is to remove the DxeTcg2PhysicalPresenceLibNull
library instance and update library mappings in DSC files.

Cc: Jiewen Yao <jiewen@intel.com>
C: David Wei <david@intel.com>
Cc: Mang Guo <mang@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
---
 .../DxeTcg2PhysicalPresenceLibNull.c   | 242 -
 .../DxeTcg2PhysicalPresenceLibNull.inf |  46 
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc|   4 +-
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc  |   4 +-
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc   |   4 +-
 5 files changed, 3 insertions(+), 297 deletions(-)
 delete mode 100644 
Vlv2TbltDevicePkg/Library/DxeTcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLibNull.c
 delete mode 100644 
Vlv2TbltDevicePkg/Library/DxeTcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLibNull.inf

diff --git 
a/Vlv2TbltDevicePkg/Library/DxeTcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLibNull.c
 
b/Vlv2TbltDevicePkg/Library/DxeTcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLibNull.c
deleted file mode 100644
index 96fad05527..00
--- 
a/Vlv2TbltDevicePkg/Library/DxeTcg2PhysicalPresenceLibNull/DxeTcg2PhysicalPresenceLibNull.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/** @file
-  Execute pending TPM2 requests from OS or BIOS.
-
-  Caution: This module requires additional review when modified.
-  This driver will have external input - variable.
-  This external input must be validated carefully to avoid security issue.
-
-  Tcg2ExecutePendingTpmRequest() will receive untrusted input and do 
validation.
-
-Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
-This program and the accompanying materials 
-are licensed and made available under the terms and conditions of the BSD 
License 
-which accompanies this distribution.  The full text of the license may be 
found at 
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-
-/**
-  Get string by string id from HII Interface.
-
-  @param[in] Id  String ID.
-
-  @retvalCHAR16 *String from ID.
-  @retvalNULLIf error occurs.
-
-**/
-CHAR16 *
-Tcg2PhysicalPresenceGetStringById (
-  IN  EFI_STRING_ID   Id
-  )
-{
-  return NULL;
-}
-
-/**
-  Send ClearControl and Clear command to TPM.
-
-  @param[in]  PlatformAuth  platform auth value. NULL means no platform 
auth change.
-
-  @retval EFI_SUCCESS   Operation completed successfully.
-  @retval EFI_TIMEOUT   The register can't run into the expected 
status in time.
-  @retval EFI_BUFFER_TOO_SMALL  Response data buffer is too small.
-  @retval EFI_DEVICE_ERROR  Unexpected device behavior.
-
-**/
-EFI_STATUS
-EFIAPI
-TpmCommandClear (
-  IN TPM2B_AUTH*PlatformAuth  OPTIONAL
-  )
-{
-  return EFI_SUCCESS;
-}
-
-/**
-  Execute physical presence operation requested by the OS.
-
-  @param[in]  PlatformAuthplatform auth value. NULL means no 
platform auth change.
-  @param[in]  CommandCode Physical presence operation value.
-  @param[in, out] PpiFlagsThe physical presence interface flags.
-  
-  @retval TREE_PP_OPERATION_RESPONSE_BIOS_FAILURE  Unknown physical presence 
operation.
-  @retval TREE_PP_OPERATION_RESPONSE_BIOS_FAILURE  Error occurred during 
sending command to TPM or 
-   receiving response from TPM.
-  @retval Others   Return code from the TPM 
device after command execution.
-**/
-UINT32
-Tcg2ExecutePhysicalPresence (
-  IN  TPM2B_AUTH   *PlatformAuth,  OPTIONAL
-  IN  UINT32   CommandCode,
-  IN OUT  EFI_TREE_PHYSICAL_PRESENCE_FLAGS *PpiFlags
-  )
-{
-  return 0;
-}
-
-
-/**
-  Read the specified key for user confirmation.
-
-  @param[in]  CautionKey  If true,  F12 is used as confirm key;
-  If false, F10 is used as confirm key.
-
-  @retval TRUEUser confirmed the changes by input.
-  @retval FALSE   User discarded the changes.
-**/
-BOOLEAN
-Tcg2ReadUserKey (
-  IN BOOLEANCautionKey
-  )
-{
-  return FALSE;

[edk2] [Patch 2/2] MdeModulePkg/CapsuleApp: Center bitmap at bottom of screen

2018-03-21 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=907

When -G option is used to convert a BMP file to a UX capsule,
the bitmap is centered horizontally and placed in the lower
half of the screen below the boot logo.

This matches examples shown in the following pages:

https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/user-experience-for-uefi-firmware-updates
https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/boot-screen-components

Checks are also made to make sure the bitmap provided
fits in the current GOP mode.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
---
 MdeModulePkg/Application/CapsuleApp/CapsuleApp.c   | 63 --
 MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf |  3 +-
 2 files changed, 61 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c 
b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
index b9ff812179..e1e48befc2 100644
--- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
+++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -173,15 +174,21 @@ CreateBmpFmp (
   EFI_DISPLAY_CAPSULE   *DisplayCapsule;
   EFI_STATUSStatus;
   EFI_GRAPHICS_OUTPUT_PROTOCOL  *Gop;
+  EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *Info;
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *GopBlt;
+  UINTN GopBltSize;
+  UINTN Height;
+  UINTN Width;
 
   Status = gBS->LocateProtocol(, NULL, (VOID 
**));
   if (EFI_ERROR(Status)) {
 Print(L"CapsuleApp: NO GOP is found.\n");
 return EFI_UNSUPPORTED;
   }
+  Info = Gop->Mode->Info;
   Print(L"Current GOP: Mode - %d, ", Gop->Mode->Mode);
-  Print(L"HorizontalResolution - %d, ", Gop->Mode->Info->HorizontalResolution);
-  Print(L"VerticalResolution - %d\n", Gop->Mode->Info->VerticalResolution);
+  Print(L"HorizontalResolution - %d, ", Info->HorizontalResolution);
+  Print(L"VerticalResolution - %d\n", Info->VerticalResolution);
   // HorizontalResolution >= BMP_IMAGE_HEADER.PixelWidth
   // VerticalResolution   >= BMP_IMAGE_HEADER.PixelHeight
 
@@ -207,6 +214,35 @@ CreateBmpFmp (
 goto Done;
   }
 
+  GopBlt = NULL;
+  Status = TranslateBmpToGopBlt (
+ BmpBuffer,
+ FileSize,
+ ,
+ ,
+ ,
+ 
+ );
+  if (EFI_ERROR(Status)) {
+Print(L"CapsuleApp: BMP image (%s) is not valid.\n", BmpName);
+goto Done;
+  }
+  if (GopBlt != NULL) {
+FreePool (GopBlt);
+  }
+  Print(L"BMP image (%s), Width - %d, Height - %d\n", BmpName, Width, Height);
+
+  if (Height > Info->VerticalResolution) {
+Status = EFI_INVALID_PARAMETER;
+Print(L"CapsuleApp: BMP image (%s) height is larger than current 
resolution.\n", BmpName);
+goto Done;
+  }
+  if (Width > Info->HorizontalResolution) {
+Status = EFI_INVALID_PARAMETER;
+Print(L"CapsuleApp: BMP image (%s) width is larger than current 
resolution.\n", BmpName);
+goto Done;
+  }
+
   FullCapsuleBufferSize = sizeof(EFI_DISPLAY_CAPSULE) + FileSize;
   FullCapsuleBuffer = AllocatePool(FullCapsuleBufferSize);
   if (FullCapsuleBuffer == NULL) {
@@ -226,8 +262,27 @@ CreateBmpFmp (
   DisplayCapsule->ImagePayload.ImageType = 0; // BMP
   DisplayCapsule->ImagePayload.Reserved = 0;
   DisplayCapsule->ImagePayload.Mode = Gop->Mode->Mode;
-  DisplayCapsule->ImagePayload.OffsetX = 0;
-  DisplayCapsule->ImagePayload.OffsetY = 0;
+
+  //
+  // Center the bitmap horizontally
+  //
+  DisplayCapsule->ImagePayload.OffsetX = (UINT32)((Info->HorizontalResolution 
- Width) / 2);
+
+  //
+  // Put bitmap 3/4 down the display.  If bitmap is too tall, then align bottom
+  // of bitmap at bottom of display.
+  //
+  DisplayCapsule->ImagePayload.OffsetY =
+MIN (
+  (UINT32)(Info->VerticalResolution - Height),
+  (UINT32)(((3 * Info->VerticalResolution) - (2 * Height)) / 4)
+  );
+
+  Print(L"BMP image (%s), OffsetX - %d, OffsetY - %d\n",
+BmpName,
+DisplayCapsule->ImagePayload.OffsetX,
+DisplayCapsule->ImagePayload.OffsetY
+);
 
   CopyMem((DisplayCapsule + 1), BmpBuffer, FileSize);
 
diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf 
b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf
index b06c4ea1bc..3a67c6b909 100644
--- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf
+++ b/MdeModulePkg/Applicatio

[edk2] [Patch 0/2] MdeModulePkg/CapsuleApp: CleanGatherList() fix and UX enhancements

2018-03-21 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=905
https://bugzilla.tianocore.org/show_bug.cgi?id=907

* Fix logic bug in CleanGatherList()
* Make sure BMP file is valid and fits in current GOP resolution
* Generate UX capsule with BMP centered in lower half of display

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1

Michael D Kinney (2):
  MdeModulePkg/CapsuleApp: Fix logic bug in CleanGatherList()
  MdeModulePkg/CapsuleApp: Center bitmap at bottom of screen

 MdeModulePkg/Application/CapsuleApp/CapsuleApp.c   | 67 --
 MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf |  3 +-
 2 files changed, 63 insertions(+), 7 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 1/2] MdeModulePkg/CapsuleApp: Fix logic bug in CleanGatherList()

2018-03-21 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=905

Fix pointer math when more than one capsule is passed
to the CapsuleApp.  Use the ContinuationPointer from
the last array entry instead of the first array entry.

Cc: Jiewen Yao <jiewen@intel.com>
Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
---
 MdeModulePkg/Application/CapsuleApp/CapsuleApp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c 
b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
index 393cfe5060..b9ff812179 100644
--- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
+++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c
@@ -1,7 +1,7 @@
 /** @file
   A shell application that triggers capsule update process.
 
-  Copyright (c) 2016 - 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
@@ -653,7 +653,7 @@ CleanGatherList (
 break;
   }
 
-  TempBlockPtr2 = (VOID *) ((UINTN) 
TempBlockPtr->Union.ContinuationPointer);
+  TempBlockPtr2 = (VOID *) ((UINTN) 
TempBlockPtr[Index].Union.ContinuationPointer);
   FreePool(TempBlockPtr1);
   TempBlockPtr1 = TempBlockPtr2;
 }
-- 
2.14.2.windows.3

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


[edk2] [Patch V4 1/2] MdeModulePkg/UsbBusDxe: Add UsbControlTransfer() error check

2017-11-17 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=767

The USB I/O Protocol function ControlTransfer() has a DataLength
parameter that specifies the size of the Data buffer.  The
UsbBusDxe module implements the USB I/O Protocol using the
services of the USB2 Host Controller Protocol.  The DataLength
parameter in the USB2 Host Controller Protocol ControlTransfer()
service is an IN OUT parameter so the number of bytes actually
transferred is returned.  Since the USB I/O Protocol
ControlTransfer() service can not return the number of bytes
actually transferred, the only option if the number of bytes
actually transferred is less than the number of bytes requested
is to return EFI_DEVICE_ERROR.

The change fixes an issue with a USB mass storage device that
responds with 0 bytes to the Get MAX LUN command.

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c 
b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
index 78220222f6..7c58fe8d36 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
@@ -2,7 +2,7 @@
 
 Usb Bus Driver Binding and Bus IO Protocol.
 
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -76,6 +76,7 @@ UsbIoControlTransfer (
   USB_ENDPOINT_DESC   *EpDesc;
   EFI_TPL OldTpl;
   EFI_STATUS  Status;
+  UINTN   RequestedDataLength;
 
   if (UsbStatus == NULL) {
 return EFI_INVALID_PARAMETER;
@@ -86,6 +87,7 @@ UsbIoControlTransfer (
   UsbIf  = USB_INTERFACE_FROM_USBIO (This);
   Dev= UsbIf->Device;
 
+  RequestedDataLength = DataLength;
   Status = UsbHcControlTransfer (
  Dev->Bus,
  Dev->Address,
@@ -99,6 +101,18 @@ UsbIoControlTransfer (
  >Translator,
  UsbStatus
  );
+  //
+  // If the request completed sucessfully and the Direction of the request is
+  // EfiUsbDataIn or EfiUsbDataOut, then make sure the actual number of bytes
+  // transfered is the same as the number of bytes requested.  If a different
+  // number of bytes were transfered, then return EFI_DEVICE_ERROR.
+  //
+  if (!EFI_ERROR (Status)) {
+if (Direction != EfiUsbNoData && DataLength != RequestedDataLength) {
+  Status = EFI_DEVICE_ERROR;
+  goto ON_EXIT;
+}
+  }
 
   if (EFI_ERROR (Status) || (*UsbStatus != EFI_USB_NOERROR)) {
 //
-- 
2.14.2.windows.3

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


[edk2] [Patch V4 2/2] MdeModulePkg/UsbMassStorageDxe: Check Get Max LUN status/value

2017-11-17 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=767

If a USB Mass Storage device does not support the Get
Max LUN command, then the USB I/O Protocol ControlTransfer()
service may return an error.  If an error is returned for
this command, then assume that the device does not support
multiple LUNs and return a maximum LUN value of 0.

The USB Mass Storage Class Specification states that a
maximum LUN value larger than 0x0F is invalid.  Add
a check to make sure this maximum LUN value is in this
valid range, and if it is not, then assume that the
device does not support multiple LUNs and return a
maximum LUN value of 0.

This change improves compatibility with USB FLASH drives
that do not support the Get Max LUN command or return
an invalid maximum LUN value.

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 .../Bus/Usb/UsbMassStorageDxe/UsbMassBot.c | 22 ++
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c 
b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c
index 4bb7222b89..477bfa7952 100644
--- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c
+++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c
@@ -2,7 +2,7 @@
   Implementation of the USB mass storage Bulk-Only Transport protocol,
   according to USB Mass Storage Class Bulk-Only Transport, Revision 1.0.
 
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -552,8 +552,10 @@ UsbBotGetMaxLun (
   UINT32  Result;
   UINT32  Timeout;
 
-  ASSERT (Context);
-  
+  if (Context == NULL || MaxLun == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
   UsbBot = (USB_BOT_PROTOCOL *) Context;
 
   //
@@ -576,8 +578,20 @@ UsbBotGetMaxLun (
 1,
 
 );
+  if (EFI_ERROR (Status) || *MaxLun > USB_BOT_MAX_LUN) {
+//
+// If the Get LUN request returns an error or the MaxLun is larger than
+// the maximum LUN value (0x0f) supported by the USB Mass Storage Class
+// Bulk-Only Transport Spec, then set MaxLun to 0.
+//
+// This improves compatibility with USB FLASH drives that have a single LUN
+// and either do not return a max LUN value or return an invalid maximum 
LUN
+// value.
+//
+*MaxLun = 0;
+  }
 
-  return Status;
+  return EFI_SUCCESS;
 }
 
 /**
-- 
2.14.2.windows.3

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


[edk2] [Patch V4 0/2] Add Max LUN status/value checks

2017-11-17 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=767

Changes in V4
* Fix return status from UsbGetMaxLun().

Changes in V3
* Only check number of bytes transfered if Direction is not UsbNoData.

Add error check to USB I/O Protocol UsbControlTransfer() for the
number of bytes actually transfered.  If less than requested, then
return EFI_DEVICE_ERROR.

Check Get Max LUN status/value in USB Mass Storage Driver to handle
cases where USB device does not support Get Max LUN command or
returned an invalud Max LUN value.

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>

Michael D Kinney (2):
  MdeModulePkg/UsbBusDxe: Add UsbControlTransfer() error check
  MdeModulePkg/UsbMassStorageDxe: Check Get Max LUN status/value

 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c| 16 +++-
 .../Bus/Usb/UsbMassStorageDxe/UsbMassBot.c | 22 ++
 2 files changed, 33 insertions(+), 5 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 0/2] Add Max LUN status/value checks

2017-11-15 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=767

Changes in V3
* Only check number of bytes transfered if Direction is not UsbNoData.

Add error check to USB I/O Protocol UsbControlTransfer() for the
number of bytes actually transfered.  If less than requested, then
return EFI_DEVICE_ERROR.

Check Get Max LUN status/value in USB Mass Storage Driver to handle
cases where USB device does not support Get Max LUN command or
returned an invalud Max LUN value.

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>

Michael D Kinney (2):
  MdeModulePkg/UsbBusDxe: Add UsbControlTransfer() error check
  MdeModulePkg/UsbMassStorageDxe: Check Get Max LUN status/value

 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c | 16 +++-
 MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c | 14 +-
 2 files changed, 28 insertions(+), 2 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 1/2] MdeModulePkg/UsbBusDxe: Add UsbControlTransfer() error check

2017-11-15 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=767

The USB I/O Protocol function ControlTransfer() has a DataLength
parameter that specifies the size of the Data buffer.  The
UsbBusDxe module implements the USB I/O Protocol using the
services of the USB2 Host Controller Protocol.  The DataLength
parameter in the USB2 Host Controller Protocol ControlTransfer()
service is an IN OUT parameter so the number of bytes actually
transferred is returned.  Since the USB I/O Protocol
ControlTransfer() service can not return the number of bytes
actually transferred, the only option if the number of bytes
actually transferred is less than the number of bytes requested
is to return EFI_DEVICE_ERROR.

The change fixes an issue with a USB mass storage device that
responds with 0 bytes to the Get MAX LUN command.

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c | 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c 
b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
index 78220222f6..7c58fe8d36 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
@@ -2,7 +2,7 @@
 
 Usb Bus Driver Binding and Bus IO Protocol.
 
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -76,6 +76,7 @@ UsbIoControlTransfer (
   USB_ENDPOINT_DESC   *EpDesc;
   EFI_TPL OldTpl;
   EFI_STATUS  Status;
+  UINTN   RequestedDataLength;
 
   if (UsbStatus == NULL) {
 return EFI_INVALID_PARAMETER;
@@ -86,6 +87,7 @@ UsbIoControlTransfer (
   UsbIf  = USB_INTERFACE_FROM_USBIO (This);
   Dev= UsbIf->Device;
 
+  RequestedDataLength = DataLength;
   Status = UsbHcControlTransfer (
  Dev->Bus,
  Dev->Address,
@@ -99,6 +101,18 @@ UsbIoControlTransfer (
  >Translator,
  UsbStatus
  );
+  //
+  // If the request completed sucessfully and the Direction of the request is
+  // EfiUsbDataIn or EfiUsbDataOut, then make sure the actual number of bytes
+  // transfered is the same as the number of bytes requested.  If a different
+  // number of bytes were transfered, then return EFI_DEVICE_ERROR.
+  //
+  if (!EFI_ERROR (Status)) {
+if (Direction != EfiUsbNoData && DataLength != RequestedDataLength) {
+  Status = EFI_DEVICE_ERROR;
+  goto ON_EXIT;
+}
+  }
 
   if (EFI_ERROR (Status) || (*UsbStatus != EFI_USB_NOERROR)) {
 //
-- 
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/2] MdeModulePkg/UsbMassStorageDxe: Check Get Max LUN status/value

2017-11-15 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=767

If a USB Mass Storage device does not support the Get
Max LUN command, then the USB I/O Protocol ControlTransfer()
service may return an error.  If an error is returned for
this command, then assume that the device does not support
multiple LUNs and return a maximum LUN value of 0.

The USB Mass Storage Class Specification states that a
maximum LUN value larger than 0x0F is invalid.  Add
a check to make sure this maximum LUN value is in this
valid range, and if it is not, then assume that the
device does not support multiple LUNs and return a
maximum LUN value of 0.

This change improves compatibility with USB FLASH drives
that do not support the Get Max LUN command or return
an invalid maximum LUN value.

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c 
b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c
index 4bb7222b89..6afe2ae235 100644
--- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c
+++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c
@@ -2,7 +2,7 @@
   Implementation of the USB mass storage Bulk-Only Transport protocol,
   according to USB Mass Storage Class Bulk-Only Transport, Revision 1.0.
 
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -576,6 +576,18 @@ UsbBotGetMaxLun (
 1,
 
 );
+  if (EFI_ERROR (Status) || *MaxLun > USB_BOT_MAX_LUN) {
+//
+// If the Get LUN request returns an error or the MaxLun is larger than
+// the maximum LUN value (0x0f) supported by the USB Mass Storage Class
+// Bulk-Only Transport Spec, then set MaxLun to 0.
+//
+// This improves compatibility with USB FLASH drives that have a single LUN
+// and either do not return a max LUN value or return an invalid maximum 
LUN
+// value.
+//
+*MaxLun = 0;
+  }
 
   return Status;
 }
-- 
2.14.2.windows.3

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


[edk2] [Patch] MdeModulePkg/UsbMassStorageDxe: Enhance Request Sense Handling

2017-11-14 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=782

Update the Request Sense check for the Request Sense Key of
USB_BOOT_SENSE_UNIT_ATTENTION.  For this Sense Key, the
Additional Sense Key to EFI_STATUS mappings are:

USB_BOOT_ASC_MEDIA_CHANGE -> EFI_MEDIA_CHANGE
USB_BOOT_ASC_NOT_READY-> EFI_NOT_READY
USB_BOOT_ASC_NO_MEDIA -> EFI_NOT_READY
All others-> EFI_DEVICE_ERROR

A USB flash drive is returning Request Sense Key of
USB_BOOT_SENSE_UNIT_ATTENTION and an Additional Sense Key of
USB_BOOT_ASC_NO_MEDIA for a few seconds before returning an
Additional Sense Key of USB_BOOT_ASC_MEDIA_CHANGE.

The current logic treats this initial Request Sense info as an
error and reties the command 5 times before failing completely.

With this change the USB Flash Drive works correctly.

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c 
b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
index 2eb30f0c5f..a8b6a1c5f1 100644
--- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
+++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
@@ -120,6 +120,10 @@ UsbBootRequestSense (
   Status = EFI_MEDIA_CHANGED;
   Media->ReadOnly = FALSE;
   Media->MediaId++;
+} else if (SenseData.Asc == USB_BOOT_ASC_NOT_READY) {
+  Status = EFI_NOT_READY;
+} else if (SenseData.Asc == USB_BOOT_ASC_NO_MEDIA) {
+  Status = EFI_NOT_READY;
 }
 break;
 
-- 
2.14.2.windows.3

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


[edk2] [Patch V2 1/2] MdeModulePkg/UsbBusDxe: Add UsbControlTransfer() error check

2017-11-14 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=767

The USB I/O Protocol function ControlTransfer() has a DataLength
parameter that specifies the size of the Data buffer.  The
UsbBusDxe module implements the USB I/O Protocol using the
services of the USB2 Host Controller Protocol.  The DataLength
parameter in the USB2 Host Controller Protocol ControlTransfer()
service is an IN OUT parameter so the number of bytes actually
transferred is returned.  Since the USB I/O Protocol
ControlTransfer() service can not return the number of bytes
actually transferred, the only option if the number of bytes
actually transferred is less than the number of bytes requested
is to return EFI_DEVICE_ERROR.

The change fixes an issue with a USB mass storage device that
responds with 0 bytes to the Get MAX LUN command.

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c 
b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
index 78220222f6..b0ad7938e9 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c
@@ -2,7 +2,7 @@
 
 Usb Bus Driver Binding and Bus IO Protocol.
 
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -76,6 +76,7 @@ UsbIoControlTransfer (
   USB_ENDPOINT_DESC   *EpDesc;
   EFI_TPL OldTpl;
   EFI_STATUS  Status;
+  UINTN   RequestedDataLength;
 
   if (UsbStatus == NULL) {
 return EFI_INVALID_PARAMETER;
@@ -86,6 +87,7 @@ UsbIoControlTransfer (
   UsbIf  = USB_INTERFACE_FROM_USBIO (This);
   Dev= UsbIf->Device;
 
+  RequestedDataLength = DataLength;
   Status = UsbHcControlTransfer (
  Dev->Bus,
  Dev->Address,
@@ -99,6 +101,10 @@ UsbIoControlTransfer (
  >Translator,
  UsbStatus
  );
+  if (!EFI_ERROR (Status) && DataLength < RequestedDataLength) {
+Status = EFI_DEVICE_ERROR;
+goto ON_EXIT;
+  }
 
   if (EFI_ERROR (Status) || (*UsbStatus != EFI_USB_NOERROR)) {
 //
-- 
2.14.2.windows.3

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


[edk2] [Patch V2 0/2] Add Max LUN status/value checks

2017-11-14 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=767

Add error check to USB I/O Protocol UsbControlTransfer() for the
number of bytes actually transfered.  If less than requested, then
return EFI_DEVICE_ERROR.

Check Get Max LUN status/value in USB Mass Storage Driver to handle
cases where USB device does not support Get Max LUN command or
returned an invalud Max LUN value.

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>

Michael D Kinney (2):
  MdeModulePkg/UsbBusDxe: Add UsbControlTransfer() error check
  MdeModulePkg/UsbMassStorageDxe: Check Get Max LUN status/value

 MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.c |  8 +++-
 MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c | 14 +-
 2 files changed, 20 insertions(+), 2 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 V2 2/2] MdeModulePkg/UsbMassStorageDxe: Check Get Max LUN status/value

2017-11-14 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=767

If a USB Mass Storage device does not support the Get
Max LUN command, then the USB I/O Protocol ControlTransfer()
service may return an error.  If an error is returned for
this command, then assume that the device does not support
multiple LUNs and return a maximum LUN value of 0.

The USB Mass Storage Class Specification states that a
maximum LUN value larger than 0x0F is invalid.  Add
a check to make sure this maximum LUN value is in this
valid range, and if it is not, then assume that the
device does not support multiple LUNs and return a
maximum LUN value of 0.

This change improves compatibility with USB FLASH drives
that o not support the Get Max LUN command or return
an invalid maximum LUN value.

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c 
b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c
index 4bb7222b89..6afe2ae235 100644
--- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c
+++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c
@@ -2,7 +2,7 @@
   Implementation of the USB mass storage Bulk-Only Transport protocol,
   according to USB Mass Storage Class Bulk-Only Transport, Revision 1.0.
 
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -576,6 +576,18 @@ UsbBotGetMaxLun (
 1,
 
 );
+  if (EFI_ERROR (Status) || *MaxLun > USB_BOT_MAX_LUN) {
+//
+// If the Get LUN request returns an error or the MaxLun is larger than
+// the maximum LUN value (0x0f) supported by the USB Mass Storage Class
+// Bulk-Only Transport Spec, then set MaxLun to 0.
+//
+// This improves compatibility with USB FLASH drives that have a single LUN
+// and either do not return a max LUN value or return an invalid maximum 
LUN
+// value.
+//
+*MaxLun = 0;
+  }
 
   return Status;
 }
-- 
2.14.2.windows.3

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


[edk2] [Patch] QuarkPlatformPkg/Readme.md: Fix markdown format issue

2017-11-08 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=769

Remove extra carriage return that causes formatting
issues.

Cc: Kelly Steele <kelly.ste...@intel.com>
Cc: Jiewen Yao <jiewen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 QuarkPlatformPkg/Readme.md | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/QuarkPlatformPkg/Readme.md b/QuarkPlatformPkg/Readme.md
index aa9d9856bd..126de6937b 100644
--- a/QuarkPlatformPkg/Readme.md
+++ b/QuarkPlatformPkg/Readme.md
@@ -244,8 +244,7 @@ Enable UEFI Secure Boot features:
 
 Enable UEFI Secure Boot and Measured Boot using Atmel I2C TPM hardware device:
 
-```build -a IA32 -t VS2015x86 -p QuarkPlatformPkg/Quark.dsc -D UEFI_SECURE_BOOT
--D MEASURED_BOOT_ENABLE -D TPM_12_HARDWARE=ATMEL_I2C```
+```build -a IA32 -t VS2015x86 -p QuarkPlatformPkg/Quark.dsc -D 
UEFI_SECURE_BOOT -D MEASURED_BOOT_ENABLE -D TPM_12_HARDWARE=ATMEL_I2C```
 
 ## **FLASH Update using DediProg SF100**
 
-- 
2.14.2.windows.3

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


[edk2] [Patch] QuarkPlatformPkg/PlatformBootManagerLib: Update boot mode handling

2017-11-08 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=768

Update and simplify boot mode handling logic.  This includes
performing minimum connects for the following boot modes:

  BOOT_ASSUMING_NO_CONFIGURATION_CHANGES
  BOOT_WITH_MINIMAL_CONFIGURATION
  BOOT_ON_S4_RESUME

Cc: Kelly Steele <kelly.ste...@intel.com>
Cc: Jiewen Yao <jiewen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 .../PlatformBootManagerLib/PlatformBootManager.c   | 30 +-
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git 
a/QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index 3c21318069..53391c6077 100644
--- a/QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/QuarkPlatformPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -2,7 +2,7 @@
 This file include all platform action which can be customized
 by IBV/OEM.
 
-Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -354,9 +354,17 @@ PlatformBootManagerAfterConsole (
   }
 
   BootMode = GetBootModeHob();
+
+  DEBUG((DEBUG_INFO, "PlatformBootManagerAfterConsole(): BootMode = %02x\n", 
BootMode));
+
   switch (BootMode) {
+  case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:
+  case BOOT_WITH_MINIMAL_CONFIGURATION:
+  case BOOT_ON_S4_RESUME:
+EfiBootManagerRefreshAllBootOption ();
+break;
+
   case BOOT_ON_FLASH_UPDATE:
-DEBUG((DEBUG_INFO, "Capsule Mode detected\n"));
 if (FeaturePcdGet(PcdSupportUpdateCapsuleReset)) {
   EfiBootManagerConnectAll ();
   EfiBootManagerRefreshAllBootOption ();
@@ -374,15 +382,6 @@ PlatformBootManagerAfterConsole (
 }
 break;
 
-  case BOOT_IN_RECOVERY_MODE:
-DEBUG((DEBUG_INFO, "Recovery Mode detected\n"));
-// Passthrough
-
-  case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:
-  case BOOT_WITH_MINIMAL_CONFIGURATION:
-  case BOOT_WITH_FULL_CONFIGURATION:
-  case BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS:
-  case BOOT_WITH_DEFAULT_SETTINGS:
   default:
 EfiBootManagerConnectAll ();
 EfiBootManagerRefreshAllBootOption ();
@@ -390,14 +389,9 @@ PlatformBootManagerAfterConsole (
 //
 // Sync ESRT Cache from FMP Instance on demand after Connect All
 //
-if ((BootMode != BOOT_ASSUMING_NO_CONFIGURATION_CHANGES) &&
-(BootMode != BOOT_WITH_MINIMAL_CONFIGURATION) &&
-(BootMode != BOOT_ON_S4_RESUME)) {
-  if (EsrtManagement != NULL) {
-EsrtManagement->SyncEsrtFmp();
-  }
+if (EsrtManagement != NULL) {
+  EsrtManagement->SyncEsrtFmp();
 }
-
 break;
   }
 
-- 
2.14.2.windows.3

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


[edk2] [Patch] MdeModulePkg/UsbMassStorageDxe: Verify Get Max LUN value

2017-11-08 Thread Michael D Kinney
The USB Mass Storage Class Specification states that a
maximum LUN value larger than 0x0F is invalid.  Add
a check to make sure this maximum LUN value is in this
valid range, and if it is not, then assume that the
device does not support multiple LUNs and return a
maximum LUN value of 0.

This change improves compatibility with USB FLASH drives
that have a single LUN, but return invalid maximum LUN
values.

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c 
b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c
index 4bb7222b89..c7436cf036 100644
--- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c
+++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c
@@ -2,7 +2,7 @@
   Implementation of the USB mass storage Bulk-Only Transport protocol,
   according to USB Mass Storage Class Bulk-Only Transport, Revision 1.0.
 
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -576,6 +576,14 @@ UsbBotGetMaxLun (
 1,
 
 );
+  if (!EFI_ERROR (Status) && *MaxLun > USB_BOT_MAX_LUN) {
+//
+// If MaxLun is larger than the maximum LUN value (0x0f) supported by the
+// USB Mass Storage Class Bulk-Only Transport Spec, then set MaxLun to 0
+// which means no LUN is associated with the device.
+//
+*MaxLun = 0;
+  }
 
   return Status;
 }
-- 
2.14.2.windows.3

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


[edk2] [Patch] MdeModulePkg/UsbMassStorageDxe: Fix USB Mass Storage detection

2017-11-08 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=766

Update logic to not return an error from UsbBootRequestSense()
if a Request Sense command responds with no sense information.
It is legal for a USB mass storage device to respond to a
Request Sense command with a SenseKey of
USB_BOOT_SENSE_NO_SENSE and an Additional Sense
Code of USB_BOOT_ASC_NO_ADDITIONAL_SENSE_INFORMATION.

This is described in Section 3.3 of the Universal Serial
Bus Mass Storage Specification For Bootability:

http://www.usb.org/developers/docs/devclass_docs/usb_msc_boot_1.0.pdf

The previous logic returned an error of EFI_NO_RESPONSE
and this caused USB mass storage devices such as a USB
floppy drive to not be detected.

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c | 11 +--
 MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h |  9 +
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c 
b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
index 0c46f888eb..2eb30f0c5f 100644
--- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
+++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
@@ -2,7 +2,7 @@
   Implementation of the command set of USB Mass Storage Specification
   for Bootability, Revision 1.0.
 
-Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -80,7 +80,14 @@ UsbBootRequestSense (
   switch (USB_BOOT_SENSE_KEY (SenseData.SenseKey)) {
 
   case USB_BOOT_SENSE_NO_SENSE:
-Status = EFI_NO_RESPONSE;
+if (SenseData.Asc == USB_BOOT_ASC_NO_ADDITIONAL_SENSE_INFORMATION) {
+  //
+  // It is not an error if a device does not have additional sense 
information
+  //
+  Status = EFI_SUCCESS;
+} else {
+  Status = EFI_NO_RESPONSE;
+}
 break;
 
   case USB_BOOT_SENSE_RECOVERED:
diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h 
b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h
index c4082558fa..13a926035c 100644
--- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h
+++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h
@@ -2,7 +2,7 @@
   Definition of the command set of USB Mass Storage Specification
   for Bootability, Revision 1.0.
 
-Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -51,9 +51,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #define USB_BOOT_SENSE_VOLUME_OVERFLOW  0x0D ///< Partition overflow
 #define USB_BOOT_SENSE_MISCOMPARE   0x0E ///< Source data mis-match while 
verfying.
 
-#define USB_BOOT_ASC_NOT_READY  0x04
-#define USB_BOOT_ASC_NO_MEDIA   0x3A
-#define USB_BOOT_ASC_MEDIA_CHANGE   0x28
+#define USB_BOOT_ASC_NO_ADDITIONAL_SENSE_INFORMATION  0x00
+#define USB_BOOT_ASC_NOT_READY0x04
+#define USB_BOOT_ASC_NO_MEDIA 0x3A
+#define USB_BOOT_ASC_MEDIA_CHANGE 0x28
 
 //
 // Supported PDT codes, or Peripheral Device Type
-- 
2.14.2.windows.3

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


[edk2] [Patch] MdeModulePkg/Core/Dxe: Remove extra connects for UEFI Applications

2017-11-08 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=765

The UEFI Specification Boot Services chapter, StartImage() service,
EFF 1.10 Extension requires extra calls to ConnectController()
if a UEFI Driver produces handles. The DXE Core is performing these
extra calls to ConnectController() without evaluating the ImageType.

A filter is added to not make extra calls to ConnectController()
if the ImageType is EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION.

Without this filter, extra calls to ConnectController() may be
performed by UEFI Applications or a UEFI Shell Applications that
also call ConnectController().

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 MdeModulePkg/Core/Dxe/Image/Image.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c 
b/MdeModulePkg/Core/Dxe/Image/Image.c
index 4e22aa6dc7..c6b8ff44b9 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -1703,9 +1703,17 @@ CoreStartImage (
   mCurrentImage = LastImage;
 
   //
-  // Go connect any handles that were created or modified while the image 
executed.
+  // UEFI Specification - StartImage() - EFI 1.10 Extension
+  // To maintain compatibility with UEFI drivers that are written to the EFI
+  // 1.02 Specification, StartImage() must monitor the handle database before
+  // and after each image is started. If any handles are created or modified
+  // when an image is started, then EFI_BOOT_SERVICES.ConnectController() must
+  // be called with the Recursive parameter set to TRUE for each of the newly
+  // created or modified handles before StartImage() returns.
   //
-  CoreConnectHandlesByKey (HandleDatabaseKey);
+  if (Image->ImageContext.ImageType != EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION) {
+CoreConnectHandlesByKey (HandleDatabaseKey);
+  }
 
   //
   // Handle the image's returned ExitData
-- 
2.14.2.windows.3

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


[edk2] [Patch] MdeModulePkg/TerminalDxe: Fix PCANSI mapping for TRIANGLE and ARROW

2017-11-07 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=761

When a TerminalType is set to PCANSI, characters in the range 0x00
to 0x1F are control characters.  The mapping table for PCANSI maps
TRIANGLE glyphs, ARROW_UP glyph, and ARROW_DOWN glyph into this
control character range and that causes no characters to be
displayed by PCANSI compatible terminal emulators.

The mappings are updated so these glyphs are mapped to ANSI
characters in the range 0x20 to 0x7E.

GEOMETRICSHAPE_UP_TRIANGLE '^'
GEOMETRICSHAPE_RIGHT_TRIANGLE  '>'
GEOMETRICSHAPE_DOWN_TRIANGLE   'v'
GEOMETRICSHAPE_LEFT_TRIANGLE   '<'
ARROW_UP   '^'
ARROW_DOWN 'v'

Cc: Star Zeng <star.z...@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 .../Universal/Console/TerminalDxe/TerminalConOut.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c 
b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
index e677a76e6b..5a8343162f 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConOut.c
@@ -66,15 +66,15 @@ UNICODE_TO_CHAR  UnicodeToPcAnsiOrAscii[] = {
   { BLOCKELEMENT_FULL_BLOCK,0xdb, L'*' },
   { BLOCKELEMENT_LIGHT_SHADE,   0xb0, L'+' },
 
-  { GEOMETRICSHAPE_UP_TRIANGLE, 0x1e, L'^' },
-  { GEOMETRICSHAPE_RIGHT_TRIANGLE,  0x10, L'>' },
-  { GEOMETRICSHAPE_DOWN_TRIANGLE,   0x1f, L'v' },
-  { GEOMETRICSHAPE_LEFT_TRIANGLE,   0x11, L'<' },
-
-  { ARROW_LEFT, 0x3c, L'<' },
-  { ARROW_UP,   0x18, L'^' },
-  { ARROW_RIGHT,0x3e, L'>' },
-  { ARROW_DOWN, 0x19, L'v' },
+  { GEOMETRICSHAPE_UP_TRIANGLE, '^', L'^' },
+  { GEOMETRICSHAPE_RIGHT_TRIANGLE,  '>', L'>' },
+  { GEOMETRICSHAPE_DOWN_TRIANGLE,   'v', L'v' },
+  { GEOMETRICSHAPE_LEFT_TRIANGLE,   '<', L'<' },
+
+  { ARROW_LEFT, '<', L'<' },
+  { ARROW_UP,   '^', L'^' },
+  { ARROW_RIGHT,'>', L'>' },
+  { ARROW_DOWN, 'v', L'v' },
 
   { 0x, 0x00, L'\0' }
 };
-- 
2.14.2.windows.3

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


[edk2] [Patch] UefiCpuPkg/PiSmmCpuDxeSmm: Add CPUID MCA support check

2017-08-16 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=674

Add CPUID check to see if the CPU supports the Machine
Check Architecture before accessing the Machine Check
Architecture related MSRs.

Cc: Eric Dong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Kinney 
---
 UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
index 6b66c49085..f086b97c30 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
@@ -27,6 +27,7 @@ SMM_CPU_SEMAPHORES  mSmmCpuSemaphores;
 UINTN   mSemaphoreSize;
 SPIN_LOCK   *mPFLock = NULL;
 SMM_CPU_SYNC_MODE   mCpuSmmSyncMode;
+BOOLEAN mMachineCheckSupported = FALSE;
 
 /**
   Performs an atomic compare exchange operation to get semaphore.
@@ -264,8 +265,12 @@ SmmWaitForApArrival (
 
   ASSERT (*mSmmMpSyncData->Counter <= mNumberOfCpus);
 
-  LmceEn = IsLmceOsEnabled ();
-  LmceSignal = IsLmceSignaled();
+  LmceEn = FALSE;
+  LmceSignal = FALSE;
+  if (mMachineCheckSupported) {
+LmceEn = IsLmceOsEnabled ();
+LmceSignal = IsLmceSignaled();
+  }
 
   //
   // Platform implementor should choose a timeout value appropriately:
@@ -1366,6 +1371,13 @@ InitializeMpServiceData (
   UINTN Index;
   UINT8 *GdtTssTables;
   UINTN GdtTableStepSize;
+  CPUID_VERSION_INFO_EDXRegEdx;
+
+  //
+  // Determine if this CPU supports machine check
+  //
+  AsmCpuid (CPUID_VERSION_INFO, NULL, NULL, NULL, );
+  mMachineCheckSupported = (BOOLEAN)(RegEdx.Bits.MCA == 1);
 
   //
   // Allocate memory for all locks and semaphores
-- 
2.13.1.windows.2

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


[edk2] [edk2-staging/edk2-test Patch V3] Test*Pkg: Replace POSTBUILD batch files with a python script

2017-08-15 Thread Michael D Kinney
Update the POSTBUILD step to use a python script to create
and/or update the installer for the test framework and test
cases.  This expands the OS compatibility to include Windows,
Linux, and Mac OS X.

The python script TestFrameworkPkg/GenFramework.py is used by
the TestFrameworkPkg to generate the installer with the test
framework. This same python script is also used by packages that
provide test cases (e.g. TestCasePkg) to add the test cases to the
installer. The --package flag may be listed more than once for DSC
files that build test cases from more than one package.  The -v
flag shows messages for all the directory and file operations. The
usage for GenFramework.py is as follows:

usage: GenFramework [-h] [--version] -a ARCH [ARCH ...] -t TOOLCHAIN -p
PLATFORMFILE -b BUILDTARGET --conf= CONFDIRECTORY
[-D [DEFINE [DEFINE ...]]] [-v]
[--package [PACKAGE [PACKAGE ...]]]

Create EDK II Test Framework installer in build output directory. Copyright
(c) 2017, Intel Corporation. All rights reserved.

optional arguments:
  -h, --helpshow this help message and exit
  --version show program's version number and exit
  -a ARCH [ARCH ...], --arch ARCH [ARCH ...]
ARCHS is one of list: IA32, X64, IPF, ARM, AARCH64
or EBC, which overrides target.txt's TARGET_ARCH
definition. To specify more archs, please repeat
this option.
  -t TOOLCHAIN, --tagname TOOLCHAIN
Using the Tool Chain Tagname to build the platform,
overriding target.txt's TOOL_CHAIN_TAG definition.
  -p PLATFORMFILE, --platform PLATFORMFILE
Build the platform specified by the DSC file name
argument, overriding target.txt's ACTIVE_PLATFORM
definition.
  -b BUILDTARGET, --buildtarget BUILDTARGET
Using the TARGET to build the platform, overriding
target.txt's TARGET definition.
  --conf= CONFDIRECTORY
Specify the customized Conf directory.
  -D [DEFINE [DEFINE ...]], --define [DEFINE [DEFINE ...]]
Macro: "Name [= Value]".
  -v, --verbose Turn on verbose output with informational messages
printed
  --package [PACKAGE [PACKAGE ...]]
The directory name of a package of tests to copy

Cc: Andrew Fish 
Cc: Supreeth Venkatesh 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Kinney 
---
 TestCasePkg/GenFramework.cmd  |  86 
 TestCasePkg/TestCasePkg.dsc   |   2 +-
 TestFrameworkPkg/GenFramework.cmd | 111 
 TestFrameworkPkg/GenFramework.py  | 239 ++
 TestFrameworkPkg/TestFrameworkPkg.dsc |   2 +-
 5 files changed, 241 insertions(+), 199 deletions(-)
 delete mode 100644 TestCasePkg/GenFramework.cmd
 delete mode 100644 TestFrameworkPkg/GenFramework.cmd
 create mode 100644 TestFrameworkPkg/GenFramework.py

diff --git a/TestCasePkg/GenFramework.cmd b/TestCasePkg/GenFramework.cmd
deleted file mode 100644
index 280ca70aa..0
--- a/TestCasePkg/GenFramework.cmd
+++ /dev/null
@@ -1,86 +0,0 @@
-@REM @file
-@REM Windows batch file used to create installer in build output directory
-@REM
-@REM Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
-@REM This program and the accompanying materials
-@REM are licensed and made available under the terms and conditions of the BSD 
License
-@REM which accompanies this distribution.  The full text of the license may be 
found at
-@REM http://opensource.org/licenses/bsd-license.php
-@REM
-@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
-@REM
-
-@echo off
-
-::**
-:: Parse command line arguments
-::**
-set ARCHLIST=
-set CLEAN=""
-:ArgLoop
-if /i "%~1"=="" (goto Done)
-if /i "%~1"=="clean" (
-set CLEAN=%~1
-shift
-goto ArgLoop
-)
-if /i "%~2"=="" (goto Done)
-if /i "%~1"=="-a" (
-set ARCHLIST=%ARCHLIST% %~2
-shift
-shift
-goto ArgLoop
-)
-if /i "%~1"=="-b" (
-set TARGET=%~2
-shift
-shift
-goto ArgLoop
-)
-if /i "%~1"=="-t" (
-set TOOLCHAIN=%~2
-shift
-shift
-goto ArgLoop
-)
-shift
-goto ArgLoop
-:Done
-
-for %%G in (%ARCHLIST%) do (
-  set ARCH=%%G
-  call :CopyFiles
-)
-
-goto Finished
-
-:CopyFiles
-set Framework=%WORKSPACE%\Build\SctPackage\%ARCH%
-set BuildOutput=%WORKSPACE%\Build\TestCasePkg\%TARGET%_%TOOLCHAIN%\%ARCH%
-
-if not %CLEAN%=="" (
-  if exist %Framework%\Test rmdir /s/q 

[edk2] [edk2-staging/edk2-test Patch V2] Test*Pkg: Replace POSTBUILD batch file with python script

2017-08-14 Thread Michael D Kinney
Update the POSTBUILD step that creates the installer for the
test framework to use a python script.  This expands the OS
compatibility to include Windows, Linux, and Mac OS X.

Cc: Andrew Fish 
Cc: Supreeth Venkatesh 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Kinney 
---
 TestCasePkg/GenFramework.cmd  |  86 ---
 TestCasePkg/GenFramework.py   | 179 ++
 TestCasePkg/TestCasePkg.dsc   |   2 +-
 TestFrameworkPkg/GenFramework.cmd | 111 ---
 TestFrameworkPkg/GenFramework.py  | 199 ++
 TestFrameworkPkg/TestFrameworkPkg.dsc |   2 +-
 6 files changed, 380 insertions(+), 199 deletions(-)
 delete mode 100644 TestCasePkg/GenFramework.cmd
 create mode 100644 TestCasePkg/GenFramework.py
 delete mode 100644 TestFrameworkPkg/GenFramework.cmd
 create mode 100644 TestFrameworkPkg/GenFramework.py

diff --git a/TestCasePkg/GenFramework.cmd b/TestCasePkg/GenFramework.cmd
deleted file mode 100644
index 280ca70aa..0
--- a/TestCasePkg/GenFramework.cmd
+++ /dev/null
@@ -1,86 +0,0 @@
-@REM @file
-@REM Windows batch file used to create installer in build output directory
-@REM
-@REM Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
-@REM This program and the accompanying materials
-@REM are licensed and made available under the terms and conditions of the BSD 
License
-@REM which accompanies this distribution.  The full text of the license may be 
found at
-@REM http://opensource.org/licenses/bsd-license.php
-@REM
-@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
-@REM
-
-@echo off
-
-::**
-:: Parse command line arguments
-::**
-set ARCHLIST=
-set CLEAN=""
-:ArgLoop
-if /i "%~1"=="" (goto Done)
-if /i "%~1"=="clean" (
-set CLEAN=%~1
-shift
-goto ArgLoop
-)
-if /i "%~2"=="" (goto Done)
-if /i "%~1"=="-a" (
-set ARCHLIST=%ARCHLIST% %~2
-shift
-shift
-goto ArgLoop
-)
-if /i "%~1"=="-b" (
-set TARGET=%~2
-shift
-shift
-goto ArgLoop
-)
-if /i "%~1"=="-t" (
-set TOOLCHAIN=%~2
-shift
-shift
-goto ArgLoop
-)
-shift
-goto ArgLoop
-:Done
-
-for %%G in (%ARCHLIST%) do (
-  set ARCH=%%G
-  call :CopyFiles
-)
-
-goto Finished
-
-:CopyFiles
-set Framework=%WORKSPACE%\Build\SctPackage\%ARCH%
-set BuildOutput=%WORKSPACE%\Build\TestCasePkg\%TARGET%_%TOOLCHAIN%\%ARCH%
-
-if not %CLEAN%=="" (
-  if exist %Framework%\Test rmdir /s/q %Framework%\Test
-  exit /b
-)
-
-rem *
-rem Create target directories
-rem *
-
-if not exist %Framework% mkdir %Framework%
-for %%G in (Data, Dependency, Support, Test, Sequence, Report, Proxy) do (
-  if not exist %Framework%\%%G mkdir %Framework%\%%G
-)
-
-::*
-:: Copy all test cases
-::*
-
-copy %BuildOutput%\*.efi   %Framework%\Test  > NUL
-exit /b
-
-:Finished
-
-
-
diff --git a/TestCasePkg/GenFramework.py b/TestCasePkg/GenFramework.py
new file mode 100644
index 0..affac89cf
--- /dev/null
+++ b/TestCasePkg/GenFramework.py
@@ -0,0 +1,179 @@
+## @file
+# Create EDK II Test Framework installer in build output directory
+#
+# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD 
License
+# which accompanies this distribution.  The full text of the license may be 
found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+
+'''
+GenFramework
+'''
+
+import os
+import sys
+import argparse
+import glob
+import shutil
+
+#
+# Globals for help information
+#
+__prog__= 'GenFramework'
+__version__ = '%s Version %s' % (__prog__, '1.0')
+__copyright__   = 'Copyright (c) 2017, Intel Corporation. All rights reserved.'
+__description__ = 'Create EDK II Test Framework installer in build output 
directory.\n'
+
+#
+# Globals
+#
+gWorkspace = ''
+gArgs  = None
+
+def Log(Message):
+  if not gArgs.Verbose:
+return
+  sys.stdout.write (__prog__ + ': ' + Message + '\n')
+
+def Error(Message, ExitValue=1):
+  sys.stderr.write (__prog__ + ': ERROR: ' + Message + '\n')
+  sys.exit (ExitValue)
+
+def RelativePath(target):
+  return os.path.relpath (target, gWorkspace)
+
+def NormalizePath(target):
+  if isinstance(target, tuple):
+return os.path.normpath (os.path.join 

[edk2] [edk2-staging/edk2-test Patch V2 1/2] Test*Pkg: Update DSC files to improve debug

2017-08-14 Thread Michael D Kinney
Update the DSC files to improve debug of the TestFrameworkPkg
and TestCasePkg.

* If -b DEBUG build, then enable DEBUG() messages on the standard
  error console device with messages of type DEBUG_ERROR,
  DEBUG_VERBOSE, DEBUG_INFO, DEBUG_WARN, and DEBUG_INIT enabled.
* If -b DEBUG build, then enable ASSERT() macros and configure
  ASSERT() macros to generate a break point when triggered.
* If -b DEBUG build, then generated mixed C/ASM output for MSFT
  builds to help find and fix source code that causes memcpy() and
  memset() instrinsics to be used.
* If -b RELEASE build, then disable all DEBUG() messages and
  ASSERT() macros and do not generated mixed C/ASM output files.
* Add NT32 define that builds the TestFrameworkPkg and TestCasePkg
  components so they are compatible with NT32 environment debuggers.

Cc: Felix Polyudov 
Cc: Andrew Fish 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Kinney 
---
 TestCasePkg/TestCasePkg.dsc   | 65 +++
 TestFrameworkPkg/TestFrameworkPkg.dsc | 62 +
 2 files changed, 127 insertions(+)

diff --git a/TestCasePkg/TestCasePkg.dsc b/TestCasePkg/TestCasePkg.dsc
index c2f1832ae..e7e32d4e0 100644
--- a/TestCasePkg/TestCasePkg.dsc
+++ b/TestCasePkg/TestCasePkg.dsc
@@ -24,6 +24,18 @@
   SKUID_IDENTIFIER   = DEFAULT
   POSTBUILD  = TestCasePkg/GenFramework.cmd
 
+  #
+  # Platform On/Off features are defined here
+  #
+  DEFINE LOGGING  = FALSE
+  DEFINE SOURCE_DEBUG_ENABLE  = FALSE
+  DEFINE NT32 = FALSE
+
+  !if $(TARGET) == "DEBUG"
+DEFINE LOGGING = TRUE
+DEFINE SOURCE_DEBUG_ENABLE = TRUE
+  !endif
+
 [LibraryClasses]
   
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
   
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
@@ -39,11 +51,64 @@
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
   
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
   PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+!if $(LOGGING)
   DebugLib|MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
+!else
+  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+!endif
   
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
   PostCodeLib|MdePkg/Library/BasePostCodeLibPort80/BasePostCodeLibPort80.inf
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   EfiTestLib|TestFrameworkPkg/Library/EfiTestLib/EfiTestLib.inf
 
+[PcdsFixedAtBuild]
+!if $(LOGGING)
+  !if $(SOURCE_DEBUG_ENABLE)
+#
+# Enabled ASSERT(), DEBUG(), and DEBUG_CODE() and configure ASSERT() to
+# generate a breakpoint.
+#
+gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17
+  !else
+#
+# Enabled ASSERT(), DEBUG(), and DEBUG_CODE() and configure ASSERT() to
+# generate a deadloop.
+#
+gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x27
+  !endif
+!else
+  #
+  # Disable ASSERT(), DEBUG(), DEBUG_CODE(), and DEBUG_CLEAR_MEMORY()
+  #
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0
+!endif
+
+[PcdsPatchableInModule]
+!if $(LOGGING)
+  #
+  # Enable DEBUG() messages of type DEBUG_ERROR, DEBUG_VERBOSE, DEBUG_INFO,
+  # DEBUG_WARN, and DEBUG_INIT
+  #
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80400043
+!endif
+
 [Components]
   TestCasePkg/Timer/ArchTimerBBTest.inf
+
+[BuildOptions]
+!if $(TARGET) == "DEBUG"
+  #
+  # Generate mixed C/ASM files for debug builds
+  #
+  MSFT:*_*_*_CC_FLAGS = /FAsc
+!endif
+
+!if $(NT32)
+  #
+  # If -D NT32 is set on command line to build, then build all components to be
+  # compatible with NT32 environment debuggers.
+  #
+  DEBUG_*_*_DLINK_FLAGS   = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) 
/BASE:0x1 /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
+  NOOPT_*_*_DLINK_FLAGS   = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) 
/BASE:0x1 /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
+  RELEASE_*_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096
+!endif
diff --git a/TestFrameworkPkg/TestFrameworkPkg.dsc 
b/TestFrameworkPkg/TestFrameworkPkg.dsc
index 93c8886af..ebf866e39 100644
--- a/TestFrameworkPkg/TestFrameworkPkg.dsc
+++ b/TestFrameworkPkg/TestFrameworkPkg.dsc
@@ -24,6 +24,18 @@
   SKUID_IDENTIFIER   = DEFAULT
   POSTBUILD  = TestFrameworkPkg/GenFramework.cmd
 
+  #
+  # Platform On/Off features are defined here
+  #
+  DEFINE LOGGING  = FALSE
+  DEFINE SOURCE_DEBUG_ENABLE  = FALSE
+  DEFINE NT32 = FALSE
+
+  !if $(TARGET) == "DEBUG"
+DEFINE LOGGING = TRUE
+DEFINE SOURCE_DEBUG_ENABLE = TRUE
+  !endif
+
 [LibraryClasses]
   
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
   

[edk2] [edk2-staging/edk2-test Patch V2 2/2] TestFrameworkPkg/TestProfile: Fix overlapping buffer ASSERT()

2017-08-14 Thread Michael D Kinney
The patch is a bug fix for TestFrameworkPkg/Support/TestProfile
driver. AsciiStrCpy() function was used to copy overlapping
strings, which triggered an ASSERT().

The function was used on overlapping strings in a couple of places:
1. _alltrim(): AsciiStrCpy() is replaced with CopyMem(), which can
   handle overlapping buffers.
2. _prosessLine(): AsciiStrCpy() at the beginning of the function
   is removed. The call was redundant. The function was trying to
   move the data that have already been moved by _alltrim().

Cc: Andrew Fish 
Cc: Michael Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Felix Polyudov 
---
 TestFrameworkPkg/Support/TestProfile/TestProfile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/TestFrameworkPkg/Support/TestProfile/TestProfile.c 
b/TestFrameworkPkg/Support/TestProfile/TestProfile.c
index f02e9dfef..2476c5740 100644
--- a/TestFrameworkPkg/Support/TestProfile/TestProfile.c
+++ b/TestFrameworkPkg/Support/TestProfile/TestProfile.c
@@ -269,7 +269,7 @@ Routine Description:
   }
 
   tmp[Index] = '\0';
-  AsciiStrCpy (ptrStr, tmp);
+  CopyMem(ptrStr, tmp, Index + 1);
 
   return ptrStr;
 }
@@ -419,7 +419,7 @@ Routine Description:
   CHAR8 ptrValue[MAX_STRING_LEN + 1];
   INI   *ptrItem;
 
-  AsciiStrCpy (ptrLine, _alltrim (ptrLine));
+  _alltrim (ptrLine);
 
   if (*ptrLine == '#') {
 // it's a comment line
-- 
2.13.1.windows.2

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


[edk2] [edk2-staging/edk2-test Patch V2 0/2] TestFrameworkPkg/TestProfile: Fix overlapping buffer ASSERT()

2017-08-14 Thread Michael D Kinney
New in V2
* Update the DSC files to improve debug of the TestFrameworkPkg
  and TestCasePkg.

The patch is a bug fix for TestFrameworkPkg/Support/TestProfile
driver. AsciiStrCpy() function was used to copy overlapping
strings, which triggered an ASSERT().

Cc: Andrew Fish <af...@apple.com>
Cc: Michael Kinney <michael.d.kin...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Felix Polyudov <fel...@ami.com>

Michael D Kinney (2):
  Test*Pkg: Update DSC files to improve debug
  TestFrameworkPkg/TestProfile: Fix overlapping buffer ASSERT()

 TestCasePkg/TestCasePkg.dsc| 65 ++
 TestFrameworkPkg/Support/TestProfile/TestProfile.c |  4 +-
 TestFrameworkPkg/TestFrameworkPkg.dsc  | 62 +
 3 files changed, 129 insertions(+), 2 deletions(-)

-- 
2.13.1.windows.2

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


[edk2] [Patch] Nt32/PlatformBootManagerLib: Enable STD_ERROR on all consoles

2017-08-14 Thread Michael D Kinney
Add STD_ERROR flag to all output consoles that the Nt32
platform supports so all messages sent to the standard
error console device(s) are visible by default.

The Boot Maintenance Manager can be used to manually disable
standard error output to specific console devices.

UEFI Applications and UEFI Drivers are recommended to be
built with DEBUG() and ASSERT() messages sent to the standard
error device using MdePkg/Library/UefiDebugLibStdErr. Prior
to this change, a user would have to use the Boot Maintenance
Manager to configure a standard error console device to make
these messages visible.

Cc: Ruiyu Ni 
Cc: Hao Wu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Kinney 
---
 Nt32Pkg/Library/PlatformBootManagerLib/PlatformData.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformData.c 
b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformData.c
index e92f377bd1..e4b400b4a3 100644
--- a/Nt32Pkg/Library/PlatformBootManagerLib/PlatformData.c
+++ b/Nt32Pkg/Library/PlatformBootManagerLib/PlatformData.c
@@ -2,7 +2,7 @@
   Defined the platform specific device path which will be filled to
   ConIn/ConOut variables.

-Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials  
 are licensed and made available under the terms and conditions of the BSD 
License 
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -137,19 +137,19 @@ NT_ISA_SERIAL_DEVICE_PATH   gNtSerialDevicePath1 = {
 PLATFORM_CONSOLE_CONNECT_ENTRY   gPlatformConsole[] = {
   {
 (EFI_DEVICE_PATH_PROTOCOL *) ,
-(CONSOLE_OUT | CONSOLE_IN)
+(CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
   },
   {
 (EFI_DEVICE_PATH_PROTOCOL *) ,
-(CONSOLE_OUT | CONSOLE_IN)
+(CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
   },
   {
 (EFI_DEVICE_PATH_PROTOCOL *) ,
-(CONSOLE_OUT | CONSOLE_IN)
+(CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
   },
   {
 (EFI_DEVICE_PATH_PROTOCOL *) ,
-(CONSOLE_OUT | CONSOLE_IN)
+(CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
   },
   {
 NULL,
-- 
2.13.1.windows.2

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


[edk2] [edk2-staging/edk2-test Patch] TestFrameworkPkg: Replace POSTBUILD batch file with python script

2017-08-11 Thread Michael D Kinney
Update the POSTBUILD step that creates the installer for the
test framework to use a python script.  This expands the OS
compatibility to include Windows, Linux, and Mac OS X.

Cc: Andrew Fish 
Cc: Supreeth Venkatesh 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael Kinney 
Reviewed-by: Andrew Fish 
---
 TestFrameworkPkg/GenFramework.cmd | 111 ---
 TestFrameworkPkg/GenFramework.py  | 199 ++
 TestFrameworkPkg/TestFrameworkPkg.dsc |   2 +-
 3 files changed, 200 insertions(+), 112 deletions(-)
 delete mode 100644 TestFrameworkPkg/GenFramework.cmd
 create mode 100644 TestFrameworkPkg/GenFramework.py

diff --git a/TestFrameworkPkg/GenFramework.cmd 
b/TestFrameworkPkg/GenFramework.cmd
deleted file mode 100644
index 256294801..0
--- a/TestFrameworkPkg/GenFramework.cmd
+++ /dev/null
@@ -1,111 +0,0 @@
-@REM @file
-@REM Windows batch file used to create installer in build output directory
-@REM
-@REM Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
-@REM This program and the accompanying materials
-@REM are licensed and made available under the terms and conditions of the BSD 
License
-@REM which accompanies this distribution.  The full text of the license may be 
found at
-@REM http://opensource.org/licenses/bsd-license.php
-@REM
-@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
-@REM
-
-@echo off
-
-::**
-:: Parse command line arguments
-::**
-set ARCHLIST=
-set CLEAN=""
-:ArgLoop
-if /i "%~1"=="" (goto Done)
-if /i "%~1"=="clean" (
-set CLEAN=%~1
-shift
-goto ArgLoop
-)
-if /i "%~2"=="" (goto Done)
-if /i "%~1"=="-a" (
-set ARCHLIST=%ARCHLIST% %~2
-shift
-shift
-goto ArgLoop
-)
-if /i "%~1"=="-b" (
-set TARGET=%~2
-shift
-shift
-goto ArgLoop
-)
-if /i "%~1"=="-t" (
-set TOOLCHAIN=%~2
-shift
-shift
-goto ArgLoop
-)
-shift
-goto ArgLoop
-:Done
-
-
-@set TEST_FRAMEWORK_PKG_PATH=%WORKSPACE%\TestFrameworkPkg
-@if defined PACKAGES_PATH (
-  @for %%i IN (%PACKAGES_PATH%) DO (
-@if exist %%~fi\TestFrameworkPkg (
-  @set TEST_FRAMEWORK_PKG_PATH=%%~fi\TestFrameworkPkg
-  @goto ProcessArchList
-)
-  )
-)
-
-:ProcessArchList
-for %%G in (%ARCHLIST%) do (
-  set ARCH=%%G
-  call :CopyFiles
-)
-
-goto Finished
-
-:CopyFiles
-set Framework=%WORKSPACE%\Build\SctPackage\%ARCH%
-set BuildOutput=%WORKSPACE%\Build\TestFrameworkPkg\%TARGET%_%TOOLCHAIN%\%ARCH%
-if not %CLEAN%=="" (
-  if exist %Framework%\..  rmdir /s/q %Framework%\..
-  exit /b
-)
-
-rem *
-rem Create target directories
-rem *
-
-if not exist %Framework% mkdir %Framework%
-for %%G in (Data, Dependency, Support, Test, Sequence, Report, Proxy) do (
-  if not exist %Framework%\%%G mkdir %Framework%\%%G
-)
-
-::*
-:: Copy the SCT framework and the related application
-::*
-
-copy %BuildOutput%\InstallSct.efi   %Framework%  > NUL
-copy %BuildOutput%\StallForKey.efi  %Framework%  > NUL
-
-copy %BuildOutput%\SCT.efi  %Framework%  > NUL
-
-copy %BuildOutput%\StandardTest.efi %Framework%\Support  > NUL
-copy %BuildOutput%\TestProfile.efi  %Framework%\Support  > NUL
-copy %BuildOutput%\TestRecovery.efi %Framework%\Support  > NUL
-copy %BuildOutput%\TestLogging.efi  %Framework%\Support  > NUL
-
-
-::*
-:: Copy the SCT configuration data
-::*
-
-copy %TEST_FRAMEWORK_PKG_PATH%\Scripts\SctStartup.nsh  %Framework%\..
-copy %TEST_FRAMEWORK_PKG_PATH%\Data\Category.ini   %Framework%\Data  > NUL
-copy %TEST_FRAMEWORK_PKG_PATH%\Data\GuidFile.txt   %Framework%\Data  > NUL
-exit /b
-
-:Finished
diff --git a/TestFrameworkPkg/GenFramework.py b/TestFrameworkPkg/GenFramework.py
new file mode 100644
index 0..c16820a45
--- /dev/null
+++ b/TestFrameworkPkg/GenFramework.py
@@ -0,0 +1,199 @@
+## @file
+# Create EDK II Test Framework installer in build output directory
+#
+# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD 
License
+# which accompanies this distribution.  The full text of the license may be 
found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, 

[edk2] [Patch 1/2] QuarkSocPkg/MemoryInit: Remove use of memset()/memcpy()

2017-08-09 Thread Michael D Kinney
Map the use of memset() and memcpy() to the BaseMemoryLib
functions ZeroMem(), SetMem(), and CopyMem().  This fixes
GCC build issues with this module.

With the remap of the functions, the [BuildOptions] MSFT
CC_FLAGS to enable /Oi can also be removed, so the MSFT
and GCC builds behave the same.

Cc: Kelly Steele <kelly.ste...@intel.com>
Cc: Liming Gao <liming@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/MemoryInitPei.inf |  6 +-
 QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit_utils.h   | 10 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/MemoryInitPei.inf 
b/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/MemoryInitPei.inf
index 78821f59a3..05766133ed 100644
--- a/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/MemoryInitPei.inf
+++ b/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/MemoryInitPei.inf
@@ -1,7 +1,7 @@
 ## @file
 # This is the Memory Initialization Driver for Quark
 #
-# Copyright (c) 2013-2015 Intel Corporation.
+# Copyright (c) 2013-2017 Intel Corporation.
 #
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD 
License
@@ -74,7 +74,3 @@
 
 [Depex]
   TRUE
-
-[BuildOptions]
-  # /Oi option to use the intrinsic memset function in source code.
-  MSFT:*_*_*_CC_FLAGS = /Oi
diff --git a/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit_utils.h 
b/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit_utils.h
index 04c59f5af0..dcc40c7782 100644
--- a/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit_utils.h
+++ b/QuarkSocPkg/QuarkNorthCluster/MemoryInit/Pei/meminit_utils.h
@@ -1,6 +1,6 @@
 /
  *
- * Copyright (c) 2013-2015 Intel Corporation.
+ * Copyright (c) 2013-2017 Intel Corporation.
  *
 * This program and the accompanying materials
 * are licensed and made available under the terms and conditions of the BSD 
License
@@ -90,8 +90,12 @@ void restore_timings(MRCParams_t *mrc_params);
 void default_timings(MRCParams_t *mrc_params);
 
 #ifndef SIM
-void *memset(void *d, int c, size_t n);
-void *memcpy(void *d, const void *s, size_t n);
+//
+// Map memset() and memcpy() to BaseMemoryLib functions
+//
+#include 
+#define memset(d,c,n) ((c) == 0) ? ZeroMem ((d), (n)) : SetMem ((d), (n), (c))
+#define memcpy(d,s,n) CopyMem ((d), (s), (n))
 #endif
 
 #endif // _MEMINIT_UTILS_H_
-- 
2.13.1.windows.2

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


[edk2] [Patch 0/2] Update Quark for edk2-non-osi changes

2017-08-09 Thread Michael D Kinney
Update PACKAGES_PATH requirements Readme.md to match the new directory 
structure in the edk2-non-osi repository and update instructions to run
python-based build tools from sources and remove edk2-FatPkg repository.

Also fix GCC compatibility issues from use of memset() in the MemoryInit
module in the QuarkSocPkg that were discovered when verifying the Linux/GCC
build instructions.

Cc: Leif Lindholm <leif.lindh...@linaro.org>
Cc: Kelly Steele <kelly.ste...@intel.com>
Cc: Liming Gao <liming@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>

Michael D Kinney (2):
  QuarkSocPkg/MemoryInit: Remove use of memset()/memcpy()
  QuarkPlatformPkg/Readme.md: edk2-non-osi directory layout

 QuarkPlatformPkg/Readme.md | 34 --
 .../MemoryInit/Pei/MemoryInitPei.inf   |  6 +---
 .../MemoryInit/Pei/meminit_utils.h | 10 +--
 3 files changed, 26 insertions(+), 24 deletions(-)

-- 
2.13.1.windows.2

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


[edk2] [RFC Patch 2/3] BaseTools/Scripts: Add python script to run a makefile

2017-08-03 Thread Michael D Kinney
Add the python script RunMakefile.py that can be used
in a PREBUILD/POSTBUIILD action to invoke a makefile
passing in context as makefile defines.  The command
line arguments passed into RunMakefile.py are converted
to the following set of defines.

* ACTIVE_PLATFORM
* TARGET_ARCH
* TOOL_CHAIN_TAG
* CONF_DIRECTORY
* TARGET
* EXTRA_FLAGS

In addition, a makefile can access the system environment
variables including WORKSPACE and PACKAGES_PATH.

The makefile target from the following set is also passed
into the makefile.  If no target is passed into build, then
the 'all' target is used.

[all|fds|genc|genmake|clean|cleanall|cleanlib|modules|libraries|run]

A platform DSC file can use a statements in the [Defines]
section of the following form to use this script.  MAKEFILE
is a WORKSPACE or PACKAGES_PATH relative path to the makefile
to run.

[Defines]
  PREBUILD  = python BaseTools/Script/RunMakefile.py --makefile MAKEFILE
  POSTBUILD = python BaseTools/Script/RunMakefile.py --makefile MAKEFILE

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney 
---
 BaseTools/Scripts/RunMakefile.py | 178 +++
 1 file changed, 178 insertions(+)
 create mode 100644 BaseTools/Scripts/RunMakefile.py

diff --git a/BaseTools/Scripts/RunMakefile.py b/BaseTools/Scripts/RunMakefile.py
new file mode 100644
index 00..48bc198c76
--- /dev/null
+++ b/BaseTools/Scripts/RunMakefile.py
@@ -0,0 +1,178 @@
+## @file
+# Run a makefile as part of a PREBUILD or POSTBUILD action.
+#
+# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD 
License
+# which accompanies this distribution.  The full text of the license may be 
found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+
+'''
+RunMakefile.py
+'''
+
+import os
+import sys
+import argparse
+import subprocess
+
+#
+# Globals for help information
+#
+__prog__= 'RunMakefile'
+__version__ = '%s Version %s' % (__prog__, '1.0')
+__copyright__   = 'Copyright (c) 2017, Intel Corporation. All rights reserved.'
+__description__ = 'Run a makefile as part of a PREBUILD or POSTBUILD action.\n'
+
+#
+# Globals
+#
+gArgs = None
+
+def Log(Message):
+  if not gArgs.Verbose:
+return
+  sys.stdout.write (__prog__ + ': ' + Message + '\n')
+
+def Error(Message, ExitValue=1):
+  sys.stderr.write (__prog__ + ': ERROR: ' + Message + '\n')
+  sys.exit (ExitValue)
+
+def RelativePath(target):
+  return os.path.relpath (target, gWorkspace)
+
+def NormalizePath(target):
+  if isinstance(target, tuple):
+return os.path.normpath (os.path.join (*target))
+  else:
+return os.path.normpath (target)
+
+if __name__ == '__main__':
+  #
+  # Create command line argument parser object
+  #
+  parser = argparse.ArgumentParser (
+  prog = __prog__,
+  version = __version__,
+  description = __description__ + __copyright__,
+  conflict_handler = 'resolve'
+  )
+  parser.add_argument (
+   '-a', '--arch', dest = 'Arch', nargs = '+', action = 'append',
+   required = True,
+   help = '''ARCHS is one of list: IA32, X64, IPF, ARM, AARCH64 or EBC,
+ which overrides target.txt's TARGET_ARCH definition. To
+ specify more archs, please repeat this option.'''
+   )
+  parser.add_argument (
+   '-t', '--tagname', dest = 'ToolChain', required = True,
+   help = '''Using the Tool Chain Tagname to build the platform,
+ overriding target.txt's TOOL_CHAIN_TAG definition.'''
+   )
+  parser.add_argument (
+   '-p', '--platform', dest = 'PlatformFile', required = True,
+   help = '''Build the platform specified by the DSC file name 
argument,
+ overriding target.txt's ACTIVE_PLATFORM definition.'''
+   )
+  parser.add_argument (
+   '-b', '--buildtarget', dest = 'BuildTarget', required = True,
+   help = '''Using the TARGET to build the platform, overriding
+ target.txt's TARGET definition.'''
+   )
+  parser.add_argument (
+   '--conf=', dest = 'ConfDirectory', required = True,
+   help = '''Specify the customized Conf directory.'''
+   )
+  parser.add_argument (
+   '-D', '--define', dest = 'Define', nargs='*', action = 'append',
+   help = '''Macro: "Name [= Value]".'''
+   )
+  parser.add_argument (
+   '--makefile', dest = 'Makefile', required = True,
+   help = '''Makefile to run 

[edk2] [RFC Patch 1/3] BaseTools/build: Expand PREBUILD/POSTBUILD DSC actions

2017-08-03 Thread Michael D Kinney
* Extend PREBUILD/POSTBUILD define values to support more than
  one argument.
* Delay normalization of PREBUILD/POSTBUILD define values
  until all arguments in the define values can be processed.
* Convert PREBUILD/POSTBUILD build define value arguments
  that are WORKSPACE or PACKAGES_PATH relative paths to
  absolute paths.
* Append -p PlatformFile, --conf=ConfDirectory, and build target
  flags to command line used to execute PREBUILD/POSTBUILD
  actions.
* Remove PrebuildScript and PostbuildScript fields from the
  Build class and use Prebuild and Postbuild fields instead.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney 
---
 .../Source/Python/Workspace/WorkspaceDatabase.py   |   4 +-
 BaseTools/Source/Python/build/build.py | 108 +++--
 2 files changed, 82 insertions(+), 30 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py 
b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
index 73b3fe7134..fe2c7c17c4 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -237,7 +237,7 @@ class DscBuildData(PlatformBuildClassObject):
 EdkLogger.error('build', FORMAT_INVALID, 'Missing 
double quotes in the end of %s statement.' % TAB_DSC_PREBUILD,
 File=self.MetaFile, Line=Record[-1])
 PrebuildValue = Record[2][1:-1]
-self._Prebuild = PathClass(NormPath(PrebuildValue, 
self._Macros), GlobalData.gWorkspace)
+self._Prebuild = PrebuildValue
 elif Name == TAB_DSC_POSTBUILD:
 PostbuildValue = Record[2]
 if Record[2][0] == '"':
@@ -245,7 +245,7 @@ class DscBuildData(PlatformBuildClassObject):
 EdkLogger.error('build', FORMAT_INVALID, 'Missing 
double quotes in the end of %s statement.' % TAB_DSC_POSTBUILD,
 File=self.MetaFile, Line=Record[-1])
 PostbuildValue = Record[2][1:-1]
-self._Postbuild = PathClass(NormPath(PostbuildValue, 
self._Macros), GlobalData.gWorkspace)
+self._Postbuild = PostbuildValue
 elif Name == TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES:
 self._SupArchList = GetSplitValueList(Record[2], 
TAB_VALUE_SPLIT)
 elif Name == TAB_DSC_DEFINES_BUILD_TARGETS:
diff --git a/BaseTools/Source/Python/build/build.py 
b/BaseTools/Source/Python/build/build.py
index 4d05ee2761..7436453582 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -796,8 +796,6 @@ class Build():
 self.BuildModules = []
 self.Db_Flag = False
 self.LaunchPrebuildFlag = False
-self.PrebuildScript = ''
-self.PostbuildScript = ''
 self.PlatformBuildPath = 
os.path.join(GlobalData.gConfDirectory,'.cache', '.PlatformBuild')
 if BuildOptions.CommandLength:
 GlobalData.gCommandMaxLength = BuildOptions.CommandLength
@@ -819,11 +817,11 @@ class Build():
 EdkLogger.quiet("%-16s = %s" % ("CONF_PATH", 
GlobalData.gConfDirectory))
 self.InitPreBuild()
 self.InitPostBuild()
-if self.PrebuildScript:
-EdkLogger.quiet("%-16s = %s" % ("PREBUILD", self.PrebuildScript))
-if self.PostbuildScript:
-EdkLogger.quiet("%-16s = %s" % ("POSTBUILD", self.PostbuildScript))
-if self.PrebuildScript:
+if self.Prebuild:
+EdkLogger.quiet("%-16s = %s" % ("PREBUILD", self.Prebuild))
+if self.Postbuild:
+EdkLogger.quiet("%-16s = %s" % ("POSTBUILD", self.Postbuild))
+if self.Prebuild:
 self.LaunchPrebuild()
 self.TargetTxt = TargetTxtClassObject()
 self.ToolDef   = ToolDefClassObject()
@@ -964,16 +962,37 @@ class Build():
 Platform = self.Db._MapPlatform(str(self.PlatformFile))
 self.Prebuild = str(Platform.Prebuild)
 if self.Prebuild:
-PrebuildList = self.Prebuild.split()
-if not os.path.isabs(PrebuildList[0]):
-PrebuildList[0] = mws.join(self.WorkspaceDir, PrebuildList[0])
-if os.path.isfile(PrebuildList[0]):
-self.PrebuildScript = PrebuildList[0]
-self.Prebuild = ' '.join(PrebuildList)
-self.Prebuild += self.PassCommandOption(self.BuildTargetList, 
self.ArchList, self.ToolChainList)
-#self.LaunchPrebuild()
-else:
-EdkLogger.error("Prebuild", PREBUILD_ERROR, "the prebuild 
script %s is not exist.\n If you'd like to disable the Prebuild process, please 
use the format: -D PREBUILD=\"\" " %(PrebuildList[0]))
+PrebuildList = []
+#
+ 

[edk2] [RFC Patch 3/3] BaseTools/Scripts: Add sample makefile for use with RunMakefile.py

2017-08-03 Thread Michael D Kinney
Add sample makefile that can be used to test RunMakefile.py
script and can also be used as a template to start a new
PREBUILD/POSTBUILD makefile.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney 
---
 BaseTools/Scripts/RunMakefileSample.mak | 43 +
 1 file changed, 43 insertions(+)
 create mode 100644 BaseTools/Scripts/RunMakefileSample.mak

diff --git a/BaseTools/Scripts/RunMakefileSample.mak 
b/BaseTools/Scripts/RunMakefileSample.mak
new file mode 100644
index 00..b0947b7644
--- /dev/null
+++ b/BaseTools/Scripts/RunMakefileSample.mak
@@ -0,0 +1,43 @@
+## @file
+# Sample makefile for PREBUILD or POSTBUILD action.
+#
+# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD 
License
+# which accompanies this distribution. The full text of the license may be 
found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+
+all: show
+   @echo $@
+genc: show
+   @echo $@
+genmake: show
+   @echo $@
+modules: show
+   @echo $@
+libraries: show
+   @echo $@
+fds: show
+   @echo $@
+clean: show
+   @echo $@
+cleanall: show
+   @echo $@
+cleanlib: show
+   @echo $@
+run: show
+   @echo $@
+
+show:
+   @echo WORKSPACE $(WORKSPACE)
+   @echo PACKAGES_PATH $(PACKAGES_PATH)
+   @echo ACTIVE_PLATFORM.. $(ACTIVE_PLATFORM)
+   @echo TARGET_ARCH.. $(TARGET_ARCH)
+   @echo TOOL_CHAIN_TAG... $(TOOL_CHAIN_TAG)
+   @echo CONF_DIRECTORY... $(CONF_DIRECTORY)
+   @echo TARGET... $(TARGET)
+   @echo EXTRA_FLAGS.. $(EXTRA_FLAGS)
-- 
2.13.1.windows.2

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


[edk2] [RFC Patch 0/3] Expand PREBUILD/POSTBUILD actions

2017-08-03 Thread Michael D Kinney
A platform DSC file can provide PREBUILD and POSTBUILD actions in the 
[Defines] section of the DSC file.  The EDK II DSC specification only allows
a single argument for these two defines, which means the PREBUILD and 
POSTBUILD actions are limited to simple batch files, shell scripts, or
applications with no additional arguments.  This also means that a platform
DSC file that uses the PREBUILD/POSTBUILD feature is typically limited to single
OS development environment.

This RFC and associated patch series expands the PREBUILD and POSTBUILD 
define syntax to support multiple arguments.  All arguments are scanned.
Arguments that are WORKSPACE or PACKAGES_PATH relative file paths are converted
to absolute paths.  Supporting multiple arguments allows PREBUILD and POSTBUILD
actions to be implemented in OS independent scripts such as Python. The 
following is an example of a PREBUILD action that runs the python interpreter
on a python script provided in a platform package:

[Defines]
  PREBUILD = python MyPlatformPackage/MyPreBuildScript.py

Supporting multiple arguments also allows additional platform arguments to be
passed into the script:

[Defines]
  PREBUILD = python MyPlatformPackage/MyPreBuildScript.py --FlashSize 4MB

In addition, the EDK II Build Specification states that TARGET, ARCH, and
TOOL_CHAIN_TAG are passed to the PREBUILD and POSTBUILD commands.  The path
to the platform DSC file being build, the path to the Conf directory, and the 
build target form the following set are not provided:

  [all|fds|genc|genmake|clean|cleanall|cleanlib|modules|libraries|run]
  
It is important for the PREBUILD and POSTBUILD actions to receive the same 
context that is provided to the build command. 

This RFC and associated patch series expands the context passed into the
PREBUILD and POSTBUILD actions to include the -p ,
--conf=, and build target arguments.

I have also seen requests to support makefiles in the PREBUILD and POSTBUILD
actions.  Makefiles receive context from system environment and define values
passed in on the command line.  In order to support makefiles, a generic python
script called /BaseTools/Scripts/RunMakefile.py is also included in this patch
series.  This python script converts command line arguments to makefile defines
and runs a makefile specified with the --makefile flag. A sample makefile that
echos the relevant system environment variables and defines is provided in
BaseTools/Scripts/RunMakefileSample.mak.  An example PREBUIILD action that runs
a makefile is as follows:

[Defines]
  PREBUILD = python BaseTools/Script/RunMakefile.py --makefile 
BaseTools/Scripts/RunMakefileSample.mak

The example above contains 4 arguments.  2 of these arguments are WORKSPACE or
PACKAGES_PATH relative paths that must be converted to absolute paths.  This
is a use case that justifies expanding the PREBUILD and POSTBUILD define
statements to support multiple arguments.

Cc: Liming Gao <liming@intel.com>
Cc: Yonghong Zhu <yonghong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kin...@intel.com>

Michael D Kinney (3):
  BaseTools/build: Expand PREBUILD/POSTBUILD DSC actions
  BaseTools/Scripts: Add python script to run a makefile
  BaseTools/Scripts: Add sample makefile for use with RunMakefile.py

 BaseTools/Scripts/RunMakefile.py   | 178 +
 BaseTools/Scripts/RunMakefileSample.mak|  43 +
 .../Source/Python/Workspace/WorkspaceDatabase.py   |   4 +-
 BaseTools/Source/Python/build/build.py | 108 +
 4 files changed, 303 insertions(+), 30 deletions(-)
 create mode 100644 BaseTools/Scripts/RunMakefile.py
 create mode 100644 BaseTools/Scripts/RunMakefileSample.mak

-- 
2.13.1.windows.2

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


[edk2] [Patch v4 6/6] edk2: Add Readme.md to root of edk2 repository

2017-07-24 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=643

Add Readme.md with a brief description of the EDK II
open source project along with links to contribution
agreement, licenses, and resources.

Cc: Leif Lindholm <leif.lindh...@linaro.org>
Cc: Andrew Fish <af...@apple.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 Readme.md | 28 
 1 file changed, 28 insertions(+)
 create mode 100644 Readme.md

diff --git a/Readme.md b/Readme.md
new file mode 100644
index 00..f779e8d458
--- /dev/null
+++ b/Readme.md
@@ -0,0 +1,28 @@
+# EDK II Project
+
+A modern, feature-rich, cross-platform firmware development environment
+for the UEFI and PI specifications from www.uefi.org.
+
+Contributions to the EDK II open source project are covered by the
+[TianoCore Contribution Agreement 1.1](Contributions.txt)
+
+The majority of the content in the EDK II open source project uses a
+[BSD 2-Clause License](License.txt).  The EDK II open source project contains
+the following components that are covered by additional licenses:
+* 
[AppPkg/Applications/Python/Python-2.7.2/Tools/pybench](AppPkg/Applications/Python/Python-2.7.2/Tools/pybench/LICENSE)
+* 
[AppPkg/Applications/Python/Python-2.7.2](AppPkg/Applications/Python/Python-2.7.2/LICENSE)
+* 
[AppPkg/Applications/Python/Python-2.7.10](AppPkg/Applications/Python/Python-2.7.10/LICENSE)
+* 
[BaseTools/Source/C/BrotliCompress](BaseTools/Source/C/BrotliCompress/LICENSE)
+* 
[MdeModulePkg/Library/BrotliCustomDecompressLib](MdeModulePkg/Library/BrotliCustomDecompressLib/LICENSE)
+* [OvmfPkg/Include/IndustryStandard/Xen](OvmfPkg/License.txt)
+* [OvmfPkg/XenBusDxe](OvmfPkg/License.txt)
+* [OvmfPkg/XenPvBlkDxe](OvmfPkg/License.txt)
+* 
[CryptoPkg/Library/OpensslLib/openssl](CryptoPkg/Library/OpensslLib/openssl/LICENSE)
+
+# Resources
+* [TianoCore](http://www.tianocore.org)
+* [EDK II](https://github.com/tianocore/tianocore.github.io/wiki/EDK-II)
+* [Getting Started with EDK 
II](https://github.com/tianocore/tianocore.github.io/wiki/Getting-Started-with-EDK-II)
+* [Mailing 
Lists](https://github.com/tianocore/tianocore.github.io/wiki/Mailing-Lists)
+* [TianoCore Bugzilla](https://bugzilla.tianocore.org)
+* [How To 
Contribute](https://github.com/tianocore/tianocore.github.io/wiki/How-To-Contribute)
-- 
2.13.1.windows.2

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


[edk2] [Patch v4 5/6] edk2: Move License.txt file to root

2017-07-24 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=642

Add top level License.txt file with the BSD 2-Clause
License that is used by the majority of the EKD II open
source project content.  Merge copyright statements
from the BSD 2-Clause License files in each package
directory and remove the duplication License.txt
file from package directories.

Cc: Leif Lindholm <leif.lindh...@linaro.org>
Cc: Andrew Fish <af...@apple.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 AppPkg/License.txt | 25 -
 ArmPkg/License.txt | 26 --
 ArmPlatformPkg/License.txt | 25 -
 BaseTools/License.txt  | 25 -
 BeagleBoardPkg/License.txt | 26 --
 CorebootModulePkg/License.txt  | 25 -
 CorebootPayloadPkg/License.txt | 25 -
 CryptoPkg/License.txt  | 25 -
 DuetPkg/License.txt| 25 -
 EdkCompatibilityPkg/License.txt| 29 
 EdkShellBinPkg/License.txt | 25 -
 EdkShellPkg/License.txt| 25 -
 EmbeddedPkg/License.txt| 26 --
 EmulatorPkg/License.txt| 25 -
 FatBinPkg/License.txt  | 25 -
 FatPkg/License.txt | 25 -
 IntelFrameworkModulePkg/License.txt| 25 -
 IntelFrameworkPkg/License.txt  | 25 -
 IntelFsp2Pkg/License.txt   | 25 -
 IntelFsp2WrapperPkg/License.txt| 25 -
 IntelFspPkg/License.txt| 25 -
 IntelFspWrapperPkg/License.txt | 25 -
 IntelSiliconPkg/License.txt| 25 -
 ArmVirtPkg/License.txt => License.txt  |  6 ++--
 MdeModulePkg/License.txt   | 25 -
 MdePkg/License.txt | 25 -
 NetworkPkg/License.txt | 25 -
 Nt32Pkg/License.txt| 25 -
 Omap35xxPkg/License.txt| 26 --
 OptionRomPkg/License.txt   | 25 -
 OvmfPkg/License.txt| 50 --
 PcAtChipsetPkg/License.txt | 25 -
 PerformancePkg/License.txt | 25 -
 QuarkPlatformPkg/License.txt   | 25 -
 QuarkSocPkg/License.txt| 25 -
 SecurityPkg/License.txt| 25 -
 ShellBinPkg/License.txt| 25 -
 ShellPkg/License.txt   | 25 -
 SignedCapsulePkg/License.txt   | 25 -
 SourceLevelDebugPkg/License.txt| 25 -
 StdLib/License.txt | 25 -
 StdLibPrivateInternalFiles/License.txt | 25 -
 UefiCpuPkg/License.txt | 25 -
 Vlv2DeviceRefCodePkg/License.txt   | 25 -
 Vlv2TbltDevicePkg/License.txt  | 25 -
 45 files changed, 3 insertions(+), 1136 deletions(-)
 delete mode 100644 AppPkg/License.txt
 delete mode 100644 ArmPkg/License.txt
 delete mode 100644 ArmPlatformPkg/License.txt
 delete mode 100644 BaseTools/License.txt
 delete mode 100644 BeagleBoardPkg/License.txt
 delete mode 100644 CorebootModulePkg/License.txt
 delete mode 100644 CorebootPayloadPkg/License.txt
 delete mode 100644 CryptoPkg/License.txt
 delete mode 100644 DuetPkg/License.txt
 delete mode 100644 EdkCompatibilityPkg/License.txt
 delete mode 100644 EdkShellBinPkg/License.txt
 delete mode 100644 EdkShellPkg/License.txt
 delete mode 100644 EmbeddedPkg/License.txt
 delete mode 100644 EmulatorPkg/License.txt
 delete mode 100644 FatBinPkg/License.txt
 delete mode 100644 FatPkg/License.txt
 delete mode 100644 IntelFrameworkModulePkg/License.txt
 delete mode 100644 IntelFrameworkPkg/License.txt
 delete mode 100644 IntelFsp2Pkg/License.txt
 delete mode 100644 IntelFsp2WrapperPkg/License.txt
 delete mode 100644 IntelFspPkg/License.txt
 delete mode 100644 IntelFspWrapperPkg/License.txt
 delete mode 100644 IntelSiliconPkg/License.txt
 rename ArmVirtPkg/License.txt => License.txt (94%)
 delete mode 100644 MdeModulePkg/License.txt
 delete mode 100644 MdePkg/License.txt
 delete mode 100644 NetworkPkg/License.txt
 delete mode 100644 Nt32Pkg/License.txt
 delete mode 100644 Omap35xxPkg/License.txt
 delete mode 100644 OptionRomPkg/License.txt
 delete mode 100644 OvmfPkg/License.txt
 delete mode 100644 PcAtChipsetPkg/License.txt
 delete mode 100644 Perf

[edk2] [Patch v4 3/6] edk2: Update to TianoCore Contribution Agreement 1.1

2017-07-24 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=629

Update the TianoCore Contribution Agreement from Version 1.0
to Version 1.1 to cover open source documentation associated
with the TianoCore project.

Version 1.0 covers source code files.  Version 1.1 is a
backwards compatible extension that adds support for document
files in both source form and compiled form.

The edk2 repository is updated so the same contribution
agreement is used by developers that work on TianoCore
related source code or TianoCore related documents.

Links to RFC and Wiki on the GitBook documentation process
* https://lists.01.org/pipermail/edk2-devel/2017-March/008654.html
* https://github.com/tianocore-docs/edk2-TemplateSpecification/wiki

Cc: Leif Lindholm <leif.lindh...@linaro.org>
Cc: Andrew Fish <af...@apple.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 Contributions.txt | 43 ++-
 1 file changed, 30 insertions(+), 13 deletions(-)

diff --git a/Contributions.txt b/Contributions.txt
index f87cbd73c6..e52fd1adcc 100644
--- a/Contributions.txt
+++ b/Contributions.txt
@@ -1,4 +1,3 @@
-
 ==
 = Code Contributions =
 ==
@@ -12,7 +11,7 @@ To make a contribution to a TianoCore project, follow these 
steps.
contribution is made under the terms of the specified
contribution agreement.  Your "Contributed-under" message
must include the name of contribution agreement and version.
-   For example: Contributed-under: TianoCore Contribution Agreement 1.0
+   For example: Contributed-under: TianoCore Contribution Agreement 1.1
The "TianoCore Contribution Agreement" is included below in
this document.
 4. Submit your code to the TianoCore project using the process
@@ -28,6 +27,10 @@ To make a contribution to a TianoCore project, follow these 
steps.
* Python-2.0: http://opensource.org/licenses/Python-2.0
* Zlib: http://opensource.org/licenses/Zlib
 
+   For documentation:
+   * FreeBSD Documentation License
+ https://www.freebsd.org/copyright/freebsd-doc-license.html
+
Contributions of code put into the public domain can also be
accepted.
 
@@ -47,11 +50,11 @@ and the "Contributed-under" message.
 === Start of sample patch email message ===
 
 From: Contributor Name <contribu...@example.com>
-Subject: [PATCH] CodeModule: Brief-single-line-summary
+Subject: [Repository/Branch PATCH] CodeModule: Brief-single-line-summary
 
 Full-commit-message
 
-Contributed-under: TianoCore Contribution Agreement 1.0
+Contributed-under: TianoCore Contribution Agreement 1.1
 Signed-off-by: Contributor Name <contribu...@example.com>
 ---
 
@@ -65,29 +68,37 @@ Patch content inline or attached
 === Notes for sample patch email ===
 
 * The first line of commit message is taken from the email's subject
-  line following [PATCH]. The remaining portion of the commit message
+  line following [Repository/Branch PATCH]. The remaining portion of the 
commit message
   is the email's content until the '---' line.
 * git format-patch is one way to create this format
 
 === Definitions for sample patch email ===
 
-* "CodeModule" is a short idenfier for the affected code.  For
-  example MdePkg, or MdeModulePkg UsbBusDxe.
+* "Repository" is the identifier of the repository the patch applies.
+  This identifier should only be provided for repositories other than
+  'edk2'. For example 'edk2-BuildSpecification' or 'staging'.
+* "Branch" is the identifier of the branch the patch applies. This
+  identifier should only be provided for branches other than 'edk2/master'.
+  For example 'edk2/UDK2015', 'edk2-BuildSpecification/release/1.27', or
+  'staging/edk2-test'.
+* "CodeModule" is a short identifier for the affected code. This identifier
+  should not be provided for documentation patches. For example 'MdePkg',
+  or 'MdeModulePkg/UsbBusDxe'
 * "Brief-single-line-summary" is a short summary of the change.
 * The entire first line should be less than ~70 characters.
 * "Full-commit-message" a verbose multiple line comment describing
   the change.  Each line should be less than ~70 characters.
-* "Contributed-under" explicitely states that the contribution is
-  made under the terms of the contribtion agreement.  This
+* "Contributed-under" explicitly states that the contribution is
+  made under the terms of the contribution agreement. This
   agreement is included below in this document.
 * "Signed-off-by" is the contributor's signature identifying them
   by their real/legal name and their email address.
 
 
-= TianoCore Contribution Agreement 1.0 =
+= TianoCore Contribution Agreement 1.1 =
 
 

[edk2] [Patch v4 4/6] edk2: Reformat TianoCore Contribution Agreement 1.1

2017-07-24 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=629

Update formatting of Contributions.txt to line wrap
at 80 columns.

Cc: Leif Lindholm <leif.lindh...@linaro.org>
Cc: Andrew Fish <af...@apple.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 Contributions.txt | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/Contributions.txt b/Contributions.txt
index e52fd1adcc..44b3787550 100644
--- a/Contributions.txt
+++ b/Contributions.txt
@@ -68,8 +68,8 @@ Patch content inline or attached
 === Notes for sample patch email ===
 
 * The first line of commit message is taken from the email's subject
-  line following [Repository/Branch PATCH]. The remaining portion of the 
commit message
-  is the email's content until the '---' line.
+  line following [Repository/Branch PATCH]. The remaining portion of the
+  commit message is the email's content until the '---' line.
 * git format-patch is one way to create this format
 
 === Definitions for sample patch email ===
@@ -98,22 +98,22 @@ Patch content inline or attached
 = TianoCore Contribution Agreement 1.1 =
 
 
-INTEL CORPORATION ("INTEL") MAKES AVAILABLE SOFTWARE, DOCUMENTATION 
("DOCUMENTATION"),
-INFORMATION AND/OR OTHER MATERIALS FOR USE IN THE TIANOCORE OPEN SOURCE
-PROJECT (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE
-TERMS AND CONDITIONS OF THIS AGREEMENT BETWEEN YOU AND INTEL AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR
-REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE
-CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS
+INTEL CORPORATION ("INTEL") MAKES AVAILABLE SOFTWARE, DOCUMENTATION
+("DOCUMENTATION"), INFORMATION AND/OR OTHER MATERIALS FOR USE IN THE
+TIANOCORE OPEN SOURCE PROJECT (COLLECTIVELY "CONTENT"). USE OF THE CONTENT
+IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT BETWEEN YOU AND
+INTEL AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES
+INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR
+USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND
+CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR
+REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS
 AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
 AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
 USE THE CONTENT.
 
-Unless otherwise indicated, all Content (except Documentation) made available 
on the TianoCore
-site is provided to you under the terms and conditions of the BSD
-License ("BSD"). A copy of the BSD License is available at
+Unless otherwise indicated, all Content (except Documentation) made available
+on the TianoCore site is provided to you under the terms and conditions of the
+BSD License ("BSD"). A copy of the BSD License is available at
 http://opensource.org/licenses/bsd-license.php
 or when applicable, in the associated License.txt file.
 
-- 
2.13.1.windows.2

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


[edk2] [Patch v4 1/6] BaseTools/PatchCheck: Support Contribution Agreement 1.1

2017-07-24 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=628

Update PatchCheck.py to support either
"Contributed-under: TianoCore Contribution Agreement 1.0"
or "Contributed-under: TianoCore Contribution Agreement 1.1"
in the commit message.

Temporarily continue to allow the TianoCore Contribution
Agreement 1.0 agreement.

Cc: Leif Lindholm <leif.lindh...@linaro.org>
Cc: Andrew Fish <af...@apple.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Liming Gao <liming@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 BaseTools/Scripts/PatchCheck.py | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 7bc5736dbf..43bfc2495c 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -75,10 +75,13 @@ class CommitMessageCheck:
 count += 1
 
 def check_contributed_under(self):
-cu_msg='Contributed-under: TianoCore Contribution Agreement 1.0'
+cu_msg='Contributed-under: TianoCore Contribution Agreement 1.1'
 if self.msg.find(cu_msg) < 0:
-self.error('Missing Contributed-under! (Note: this must be ' +
-   'added by the code contributor!)')
+# Allow 1.0 for now while EDK II community transitions to 1.1
+cu_msg='Contributed-under: TianoCore Contribution Agreement 1.0'
+if self.msg.find(cu_msg) < 0:
+self.error('Missing Contributed-under! (Note: this must be ' +
+   'added by the code contributor!)')
 
 @staticmethod
 def make_signature_re(sig, re_input=False):
-- 
2.13.1.windows.2

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


[edk2] [Patch V4 0/6] Update to Tiano Contribution Agreement 1.1

2017-07-24 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=628
https://bugzilla.tianocore.org/show_bug.cgi?id=629
https://bugzilla.tianocore.org/show_bug.cgi?id=642
https://bugzilla.tianocore.org/show_bug.cgi?id=643

New in V4
* Revert changes to OvmfPkg License.txt files.  OvmfPkg is back to its
  original state with MIT license for XEN content in OvmfPkg/License.txt.
* Revert change to remove commit message details from Contributions.txt.
  Instead, this section has been updated to support both code and documentation
  patches.
* Remove commit message details from Readme.md.

New in V3
* Merge patch that moves Contribution.txt to root with patch that deletes
  Contribution.txt from packages. 
* Add Readme.md with commit message content that was removed from
  Contributions.txt
* Add MIT License.txt files for XEN related components in OvmfPkg to those
  components.
* Add BSD 2-Clause License.txt file to root of edk2 repo so it can be referenced
  from Readme.md in root of edk2 repo.
* Remove duplicate BSD 2-Clause License.txt from packages.  
  
New in V2
* Reorder checks in PatchCheck.py and add comments
* Split patch series up into more patches
* Add more detailed reason for change to commit messages 
* Rename CONTRIBUTIONS.TXT to Contributions.txt
* Reformat Contributions.txt to wrap at 80 columns

This series updates the contribution agreement from the
Tiano Contribution Agreement 1.0 to the Tiano Contribution
Agreement 1.1.  In addition, the duplication of the 
Contributions.txt file is removed and a single version of
Contributions.txt is added to the root of the edk2 repository.

The BaseTools/Scripts/PatchCheck.py tool is also updated to 
support the Tiano Contribution Agreement 1.1.

The RFC email discussion that covers the new contribution
agreement can be found here:

https://lists.01.org/pipermail/edk2-devel/2017-March/008924.html

This new agreement does not have any changes for code contributions.
It adds content to cover open source documentation contributions.

Cc: Leif Lindholm <leif.lindh...@linaro.org>
Cc: Andrew Fish <af...@apple.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Laszlo Ersek <ler...@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>

Michael D Kinney (6):
  BaseTools/PatchCheck: Support Contribution Agreement 1.1
  edk2: Move TianoCore Contribution Agreement to root
  edk2: Update to TianoCore Contribution Agreement 1.1
  edk2: Reformat TianoCore Contribution Agreement 1.1
  edk2: Move License.txt file to root
  edk2: Add Readme.md to root of edk2 repository

 AppPkg/License.txt|  25 ---
 ArmPkg/Contributions.txt  | 218 --
 ArmPkg/License.txt|  26 ---
 ArmPlatformPkg/Contributions.txt  | 218 --
 ArmPlatformPkg/License.txt|  25 ---
 ArmVirtPkg/Contributions.txt  | 218 --
 BaseTools/Contributions.txt   | 218 --
 BaseTools/License.txt |  25 ---
 BaseTools/Scripts/PatchCheck.py   |   9 +-
 BeagleBoardPkg/Contributions.txt  | 218 --
 BeagleBoardPkg/License.txt|  26 ---
 AppPkg/Contributions.txt => Contributions.txt |  65 +---
 CorebootModulePkg/Contributions.txt   | 218 --
 CorebootModulePkg/License.txt |  25 ---
 CorebootPayloadPkg/Contributions.txt  | 218 --
 CorebootPayloadPkg/License.txt|  25 ---
 CryptoPkg/Contributions.txt   | 218 --
 CryptoPkg/License.txt |  25 ---
 DuetPkg/Contributions.txt | 218 --
 DuetPkg/License.txt   |  25 ---
 EdkCompatibilityPkg/Contributions.txt | 218 --
 EdkCompatibilityPkg/License.txt   |  29 
 EdkShellBinPkg/Contributions.txt  | 218 --
 EdkShellBinPkg/License.txt|  25 ---
 EdkShellPkg/Contributions.txt | 218 --
 EdkShellPkg/License.txt   |  25 ---
 EmbeddedPkg/Contributions.txt | 218 --
 EmbeddedPkg/License.txt   |  26 ---
 EmulatorPkg/Contributions.txt | 218 --
 EmulatorPkg/License.txt   |  25 ---
 FatBinPkg/Contributions.txt   | 218 --
 FatBinPkg/License.txt |  25 ---
 FatPkg/Contributions.txt  | 218 --
 FatPkg/License.txt|  25 ---
 IntelFrameworkModu

[edk2] [Patch V3 3/8] edk2: Remove commit message details from Contributions.txt

2017-07-19 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=629

Remove the change description, commit message, and
patch email section from Contributions.txt.  This
section is not part of the TianoCore Contribution
Agreement.  The information is very important and is
provided on the TianoCore web site and wiki and will
be added to Readme.md in the root of the edk2
repository.

Cc: Leif Lindholm <leif.lindh...@linaro.org>
Cc: Andrew Fish <af...@apple.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 Contributions.txt | 49 -
 1 file changed, 49 deletions(-)

diff --git a/Contributions.txt b/Contributions.txt
index f87cbd73c6..06c60d8e17 100644
--- a/Contributions.txt
+++ b/Contributions.txt
@@ -34,55 +34,6 @@ To make a contribution to a TianoCore project, follow these 
steps.
Contributions using other licenses might be accepted, but further
review will be required.
 
-=
-= Change Description / Commit Message / Patch Email =
-=
-
-Your change description should use the standard format for a
-commit message, and must include your "Signed-off-by" signature
-and the "Contributed-under" message.
-
-== Sample Change Description / Commit Message =
-
-=== Start of sample patch email message ===
-
-From: Contributor Name <contribu...@example.com>
-Subject: [PATCH] CodeModule: Brief-single-line-summary
-
-Full-commit-message
-
-Contributed-under: TianoCore Contribution Agreement 1.0
-Signed-off-by: Contributor Name <contribu...@example.com>

-
-An extra message for the patch email which will not be considered part
-of the commit message can be added here.
-
-Patch content inline or attached
-
-=== End of sample patch email message ===
-
-=== Notes for sample patch email ===
-
-* The first line of commit message is taken from the email's subject
-  line following [PATCH]. The remaining portion of the commit message
-  is the email's content until the '---' line.
-* git format-patch is one way to create this format
-
-=== Definitions for sample patch email ===
-
-* "CodeModule" is a short idenfier for the affected code.  For
-  example MdePkg, or MdeModulePkg UsbBusDxe.
-* "Brief-single-line-summary" is a short summary of the change.
-* The entire first line should be less than ~70 characters.
-* "Full-commit-message" a verbose multiple line comment describing
-  the change.  Each line should be less than ~70 characters.
-* "Contributed-under" explicitely states that the contribution is
-  made under the terms of the contribtion agreement.  This
-  agreement is included below in this document.
-* "Signed-off-by" is the contributor's signature identifying them
-  by their real/legal name and their email address.
-
 
 = TianoCore Contribution Agreement 1.0 =
 
-- 
2.13.1.windows.2

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


[edk2] [Patch V3 0/8] Update to Tiano Contribution Agreement 1.1

2017-07-19 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=628
https://bugzilla.tianocore.org/show_bug.cgi?id=629
https://bugzilla.tianocore.org/show_bug.cgi?id=642
https://bugzilla.tianocore.org/show_bug.cgi?id=643

New in V3
* Merge patch that moves Contribution.txt to root with patch that deletes
  Contribution.txt from packages. 
* Add Readme.md with commit message content that was removed from
  Contributions.txt
* Add MIT License.txt files for XEN related components in OvmfPkg to those
  components.
* Add BSD 2-Clause License.txt file to root of edk2 repo so it can be referenced
  from Readme.md in root of edk2 repo.
* Remove duplicate BSD 2-Clause License.txt from packages.  
  
New in V2
* Reorder checks in PatchCheck.py and add comments
* Split patch series up into more patches
* Add more detailed reason for change to commit messages 
* Rename CONTRIBUTIONS.TXT to Contributions.txt
* Reformat Contributions.txt to wrap at 80 columns

This series updates the contribution agreement from the
Tiano Contribution Agreement 1.0 to the Tiano Contribution
Agreement 1.1.  In addition, the duplication of the 
Contributions.txt file is removed and a single version of
Contributions.txt is added to the root of the edk2 repository.

The BaseTools/Scripts/PatchCheck.py tool is also updated to 
support the Tiano Contribution Agreement 1.1.

The RFC email discussion that covers the new contribution
agreement can be found here:

https://lists.01.org/pipermail/edk2-devel/2017-March/008924.html

This new agreement does not have any changes for code contributions.
It adds content to cover open source documentation contributions.

Cc: Leif Lindholm <leif.lindh...@linaro.org>
Cc: Andrew Fish <af...@apple.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Laszlo Ersek <ler...@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>

Michael D Kinney (8):
  BaseTools/PatchCheck: Support Contribution Agreement 1.1
  edk2: Move TianoCore Contribution Agreement to root
  edk2: Remove commit message details from Contributions.txt
  edk2: Update to TianoCore Contribution Agreement 1.1
  edk2: Reformat TianoCore Contribution Agreement 1.1
  edk2/OvmfPkg: Add MIT license files
  edk2: Move License.txt file to root
  edk2: Add Readme.md to root of edk2 repository

 AppPkg/License.txt   |  25 ---
 ArmPkg/Contributions.txt | 218 ---
 ArmPkg/License.txt   |  26 ---
 ArmPlatformPkg/Contributions.txt | 218 ---
 ArmPlatformPkg/License.txt   |  25 ---
 ArmVirtPkg/Contributions.txt | 218 ---
 BaseTools/Contributions.txt  | 218 ---
 BaseTools/License.txt|  25 ---
 BaseTools/Scripts/PatchCheck.py  |   9 +-
 BeagleBoardPkg/Contributions.txt | 218 ---
 BeagleBoardPkg/License.txt   |  26 ---
 AppPkg/Contributions.txt => Contributions.txt|  88 +++--
 CorebootModulePkg/Contributions.txt  | 218 ---
 CorebootModulePkg/License.txt|  25 ---
 CorebootPayloadPkg/Contributions.txt | 218 ---
 CorebootPayloadPkg/License.txt   |  25 ---
 CryptoPkg/Contributions.txt  | 218 ---
 CryptoPkg/License.txt|  25 ---
 DuetPkg/Contributions.txt| 218 ---
 DuetPkg/License.txt  |  25 ---
 EdkCompatibilityPkg/Contributions.txt| 218 ---
 EdkCompatibilityPkg/License.txt  |  29 ---
 EdkShellBinPkg/Contributions.txt | 218 ---
 EdkShellBinPkg/License.txt   |  25 ---
 EdkShellPkg/Contributions.txt| 218 ---
 EdkShellPkg/License.txt  |  25 ---
 EmbeddedPkg/Contributions.txt| 218 ---
 EmbeddedPkg/License.txt  |  26 ---
 EmulatorPkg/Contributions.txt| 218 ---
 EmulatorPkg/License.txt  |  25 ---
 FatBinPkg/Contributions.txt  | 218 ---
 FatBinPkg/License.txt|  25 ---
 FatPkg/Contributions.txt | 218 ---
 FatPkg/License.txt   |  25 ---
 IntelFrameworkModulePkg/Contributions.txt| 218 ---
 IntelFrameworkModulePkg/License.txt  |  25 ---
 IntelFrameworkPkg/Contributions.txt  | 218 ---
 IntelFrameworkPkg/Lic

[edk2] [Patch V3 4/8] edk2: Update to TianoCore Contribution Agreement 1.1

2017-07-19 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=629

Update the TianoCore Contribution Agreement from Version 1.0
to Version 1.1 to cover open source documentation associated
with the TianoCore project.

Version 1.0 covers source code files.  Version 1.1 is a
backwards compatible extension that add support for document
files in both source form and compiled form.

The edk2 repository is updated so the same contribution
agreement is used by developers that work on TianoCore
related source code or TianoCore related documents.

Links to RFC and Wiki on the GitBook documentation process
* https://lists.01.org/pipermail/edk2-devel/2017-March/008654.html
* https://github.com/tianocore-docs/edk2-TemplateSpecification/wiki

Cc: Leif Lindholm <leif.lindh...@linaro.org>
Cc: Andrew Fish <af...@apple.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 Contributions.txt | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/Contributions.txt b/Contributions.txt
index 06c60d8e17..a6bf0103f8 100644
--- a/Contributions.txt
+++ b/Contributions.txt
@@ -1,4 +1,3 @@
-
 ==
 = Code Contributions =
 ==
@@ -28,6 +27,10 @@ To make a contribution to a TianoCore project, follow these 
steps.
* Python-2.0: http://opensource.org/licenses/Python-2.0
* Zlib: http://opensource.org/licenses/Zlib
 
+   For documentation:
+   * FreeBSD Documentation License
+ https://www.freebsd.org/copyright/freebsd-doc-license.html
+
Contributions of code put into the public domain can also be
accepted.
 
@@ -35,10 +38,10 @@ To make a contribution to a TianoCore project, follow these 
steps.
review will be required.
 
 
-= TianoCore Contribution Agreement 1.0 =
+= TianoCore Contribution Agreement 1.1 =
 
 
-INTEL CORPORATION ("INTEL") MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
+INTEL CORPORATION ("INTEL") MAKES AVAILABLE SOFTWARE, DOCUMENTATION 
("DOCUMENTATION"),
 INFORMATION AND/OR OTHER MATERIALS FOR USE IN THE TIANOCORE OPEN SOURCE
 PROJECT (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE
 TERMS AND CONDITIONS OF THIS AGREEMENT BETWEEN YOU AND INTEL AND/OR THE
@@ -51,14 +54,20 @@ AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE 
LICENSE
 AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
 USE THE CONTENT.
 
-Unless otherwise indicated, all Content made available on the TianoCore
+Unless otherwise indicated, all Content (except Documentation) made available 
on the TianoCore
 site is provided to you under the terms and conditions of the BSD
 License ("BSD"). A copy of the BSD License is available at
 http://opensource.org/licenses/bsd-license.php
 or when applicable, in the associated License.txt file.
 
+Unless otherwise indicated, all Documentation made available on the
+TianoCore site is provided to you under the terms and conditions of the
+FreeBSD Documentation License ("FreeBSD"). A copy of the BSD License is
+available at https://www.freebsd.org/copyright/freebsd-doc-license.html or,
+when applicable, in the associated License.txt file.
+
 Certain other content may be made available under other licenses as
-indicated in or with such Content. (For example, in a License.txt file.)
+indicated in or with such Content (for example, in a License.txt file).
 
 You accept and agree to the following terms and conditions for Your
 present and future Contributions submitted to TianoCore site. Except
-- 
2.13.1.windows.2

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


[edk2] [Patch V3 6/8] edk2/OvmfPkg: Add MIT license files

2017-07-19 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=642

Add an MIT License.txt files to the OvmfPkg components
* XenBusDxe
* XenPvBlkDxe
* Include/IndustryStandard/Xen

This will allow the OvmfPkg License.txt file to
be merged into a License.txt file at the root of
the edk2 repository.

Cc: Leif Lindholm <leif.lindh...@linaro.org>
Cc: Andrew Fish <af...@apple.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Laszlo Ersek <ler...@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 OvmfPkg/Include/IndustryStandard/Xen/License.txt | 19 +++
 OvmfPkg/XenBusDxe/License.txt| 19 +++
 OvmfPkg/XenPvBlkDxe/License.txt  | 19 +++
 3 files changed, 57 insertions(+)
 create mode 100644 OvmfPkg/Include/IndustryStandard/Xen/License.txt
 create mode 100644 OvmfPkg/XenBusDxe/License.txt
 create mode 100644 OvmfPkg/XenPvBlkDxe/License.txt

diff --git a/OvmfPkg/Include/IndustryStandard/Xen/License.txt 
b/OvmfPkg/Include/IndustryStandard/Xen/License.txt
new file mode 100644
index 00..1b47f47fe3
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/Xen/License.txt
@@ -0,0 +1,19 @@
+Copyright (c) 2012, Intel Corporation. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/OvmfPkg/XenBusDxe/License.txt b/OvmfPkg/XenBusDxe/License.txt
new file mode 100644
index 00..1b47f47fe3
--- /dev/null
+++ b/OvmfPkg/XenBusDxe/License.txt
@@ -0,0 +1,19 @@
+Copyright (c) 2012, Intel Corporation. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/OvmfPkg/XenPvBlkDxe/License.txt b/OvmfPkg/XenPvBlkDxe/License.txt
new file mode 100644
index 00..1b47f47fe3
--- /dev/null
+++ b/OvmfPkg/XenPvBlkDxe/License.txt
@@ -0,0 +1,19 @@
+Copyright (c) 2012, Intel Corporation. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNEC

[edk2] [Patch V3 7/8] edk2: Move License.txt file to root

2017-07-19 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=642

Add top level License.txt file with the BSD 2-Clause
License that is used by the majority of the EKD II open
source project content.  Merge copyright statements
from the BSD 2-Clause License files in each package
directory and remove the duplication License.txt
file from package directories.

Cc: Leif Lindholm <leif.lindh...@linaro.org>
Cc: Andrew Fish <af...@apple.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 AppPkg/License.txt | 25 -
 ArmPkg/License.txt | 26 --
 ArmPlatformPkg/License.txt | 25 -
 BaseTools/License.txt  | 25 -
 BeagleBoardPkg/License.txt | 26 --
 CorebootModulePkg/License.txt  | 25 -
 CorebootPayloadPkg/License.txt | 25 -
 CryptoPkg/License.txt  | 25 -
 DuetPkg/License.txt| 25 -
 EdkCompatibilityPkg/License.txt| 29 
 EdkShellBinPkg/License.txt | 25 -
 EdkShellPkg/License.txt| 25 -
 EmbeddedPkg/License.txt| 26 --
 EmulatorPkg/License.txt| 25 -
 FatBinPkg/License.txt  | 25 -
 FatPkg/License.txt | 25 -
 IntelFrameworkModulePkg/License.txt| 25 -
 IntelFrameworkPkg/License.txt  | 25 -
 IntelFsp2Pkg/License.txt   | 25 -
 IntelFsp2WrapperPkg/License.txt| 25 -
 IntelFspPkg/License.txt| 25 -
 IntelFspWrapperPkg/License.txt | 25 -
 IntelSiliconPkg/License.txt| 25 -
 ArmVirtPkg/License.txt => License.txt  |  6 ++--
 MdeModulePkg/License.txt   | 25 -
 MdePkg/License.txt | 25 -
 NetworkPkg/License.txt | 25 -
 Nt32Pkg/License.txt| 25 -
 Omap35xxPkg/License.txt| 26 --
 OptionRomPkg/License.txt   | 25 -
 OvmfPkg/License.txt| 50 --
 PcAtChipsetPkg/License.txt | 25 -
 PerformancePkg/License.txt | 25 -
 QuarkPlatformPkg/License.txt   | 25 -
 QuarkSocPkg/License.txt| 25 -
 SecurityPkg/License.txt| 25 -
 ShellBinPkg/License.txt| 25 -
 ShellPkg/License.txt   | 25 -
 SignedCapsulePkg/License.txt   | 25 -
 SourceLevelDebugPkg/License.txt| 25 -
 StdLib/License.txt | 25 -
 StdLibPrivateInternalFiles/License.txt | 25 -
 UefiCpuPkg/License.txt | 25 -
 Vlv2DeviceRefCodePkg/License.txt   | 25 -
 Vlv2TbltDevicePkg/License.txt  | 25 -
 45 files changed, 3 insertions(+), 1136 deletions(-)
 delete mode 100644 AppPkg/License.txt
 delete mode 100644 ArmPkg/License.txt
 delete mode 100644 ArmPlatformPkg/License.txt
 delete mode 100644 BaseTools/License.txt
 delete mode 100644 BeagleBoardPkg/License.txt
 delete mode 100644 CorebootModulePkg/License.txt
 delete mode 100644 CorebootPayloadPkg/License.txt
 delete mode 100644 CryptoPkg/License.txt
 delete mode 100644 DuetPkg/License.txt
 delete mode 100644 EdkCompatibilityPkg/License.txt
 delete mode 100644 EdkShellBinPkg/License.txt
 delete mode 100644 EdkShellPkg/License.txt
 delete mode 100644 EmbeddedPkg/License.txt
 delete mode 100644 EmulatorPkg/License.txt
 delete mode 100644 FatBinPkg/License.txt
 delete mode 100644 FatPkg/License.txt
 delete mode 100644 IntelFrameworkModulePkg/License.txt
 delete mode 100644 IntelFrameworkPkg/License.txt
 delete mode 100644 IntelFsp2Pkg/License.txt
 delete mode 100644 IntelFsp2WrapperPkg/License.txt
 delete mode 100644 IntelFspPkg/License.txt
 delete mode 100644 IntelFspWrapperPkg/License.txt
 delete mode 100644 IntelSiliconPkg/License.txt
 rename ArmVirtPkg/License.txt => License.txt (94%)
 delete mode 100644 MdeModulePkg/License.txt
 delete mode 100644 MdePkg/License.txt
 delete mode 100644 NetworkPkg/License.txt
 delete mode 100644 Nt32Pkg/License.txt
 delete mode 100644 Omap35xxPkg/License.txt
 delete mode 100644 OptionRomPkg/License.txt
 delete mode 100644 OvmfPkg/License.txt
 delete mode 100644 PcAtChipsetPkg/License.txt
 delete mode 100644 Perf

[edk2] [Patch V3 1/8] BaseTools/PatchCheck: Support Contribution Agreement 1.1

2017-07-19 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=628

Update PatchCheck.py to support either
"Contributed-under: TianoCore Contribution Agreement 1.0"
or "Contributed-under: TianoCore Contribution Agreement 1.1"
in the commit message.

Temporarily continue to allow the TianoCore Contribution
Agreement 1.0 agreement.

Cc: Leif Lindholm <leif.lindh...@linaro.org>
Cc: Andrew Fish <af...@apple.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Cc: Liming Gao <liming@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 BaseTools/Scripts/PatchCheck.py | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 7bc5736dbf..43bfc2495c 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -75,10 +75,13 @@ class CommitMessageCheck:
 count += 1
 
 def check_contributed_under(self):
-cu_msg='Contributed-under: TianoCore Contribution Agreement 1.0'
+cu_msg='Contributed-under: TianoCore Contribution Agreement 1.1'
 if self.msg.find(cu_msg) < 0:
-self.error('Missing Contributed-under! (Note: this must be ' +
-   'added by the code contributor!)')
+# Allow 1.0 for now while EDK II community transitions to 1.1
+cu_msg='Contributed-under: TianoCore Contribution Agreement 1.0'
+if self.msg.find(cu_msg) < 0:
+self.error('Missing Contributed-under! (Note: this must be ' +
+   'added by the code contributor!)')
 
 @staticmethod
 def make_signature_re(sig, re_input=False):
-- 
2.13.1.windows.2

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


[edk2] [Patch V3 5/8] edk2: Reformat TianoCore Contribution Agreement 1.1

2017-07-19 Thread Michael D Kinney
https://bugzilla.tianocore.org/show_bug.cgi?id=629

Update formatting of Contributions.txt to line wrap
at 80 columns.

Cc: Leif Lindholm <leif.lindh...@linaro.org>
Cc: Andrew Fish <af...@apple.com>
Cc: Jordan Justen <jordan.l.jus...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kin...@intel.com>
---
 Contributions.txt | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/Contributions.txt b/Contributions.txt
index a6bf0103f8..bae86c335c 100644
--- a/Contributions.txt
+++ b/Contributions.txt
@@ -41,22 +41,22 @@ To make a contribution to a TianoCore project, follow these 
steps.
 = TianoCore Contribution Agreement 1.1 =
 
 
-INTEL CORPORATION ("INTEL") MAKES AVAILABLE SOFTWARE, DOCUMENTATION 
("DOCUMENTATION"),
-INFORMATION AND/OR OTHER MATERIALS FOR USE IN THE TIANOCORE OPEN SOURCE
-PROJECT (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE
-TERMS AND CONDITIONS OF THIS AGREEMENT BETWEEN YOU AND INTEL AND/OR THE
-TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR
-REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE
-CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS
+INTEL CORPORATION ("INTEL") MAKES AVAILABLE SOFTWARE, DOCUMENTATION
+("DOCUMENTATION"), INFORMATION AND/OR OTHER MATERIALS FOR USE IN THE
+TIANOCORE OPEN SOURCE PROJECT (COLLECTIVELY "CONTENT"). USE OF THE CONTENT
+IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT BETWEEN YOU AND
+INTEL AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES
+INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR
+USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND
+CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR
+REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS
 AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE
 AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT
 USE THE CONTENT.
 
-Unless otherwise indicated, all Content (except Documentation) made available 
on the TianoCore
-site is provided to you under the terms and conditions of the BSD
-License ("BSD"). A copy of the BSD License is available at
+Unless otherwise indicated, all Content (except Documentation) made available
+on the TianoCore site is provided to you under the terms and conditions of
+the BSD License ("BSD"). A copy of the BSD License is available at
 http://opensource.org/licenses/bsd-license.php
 or when applicable, in the associated License.txt file.
 
-- 
2.13.1.windows.2

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


  1   2   >