[edk2] [PATCH v2 3/4] Platform/Hisilicon: move out dxe runtime lib from common file

2018-02-09 Thread Haojian Zhuang
With the SerialPortLib and DebugLib, Dxe runtime driver can't
be executed well on HiKey. Serial logs are missing.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Haojian Zhuang 
---
 Platform/Hisilicon/D02/Pv660D02.dsc | 2 ++
 Platform/Hisilicon/D03/D03.dsc  | 1 +
 Platform/Hisilicon/D05/D05.dsc  | 1 +
 Silicon/Hisilicon/Hisilicon.dsc.inc | 2 --
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Platform/Hisilicon/D02/Pv660D02.dsc 
b/Platform/Hisilicon/D02/Pv660D02.dsc
index 9e826ae..018e149 100644
--- a/Platform/Hisilicon/D02/Pv660D02.dsc
+++ b/Platform/Hisilicon/D02/Pv660D02.dsc
@@ -80,6 +80,8 @@
 
 [LibraryClasses.common.DXE_RUNTIME_DRIVER]
   I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
+  
SerialPortLib|Silicon/Hisilicon/Library/Dw8250SerialPortRuntimeLib/Dw8250SerialPortRuntimeLib.inf
+  
DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
 
 [BuildOptions]
   GCC:*_*_AARCH64_PLATFORM_FLAGS == 
-I$(WORKSPACE)/Silicon/Hisilicon/Pv660/Include
diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc
index c496306..b9bce66 100644
--- a/Platform/Hisilicon/D03/D03.dsc
+++ b/Platform/Hisilicon/D03/D03.dsc
@@ -97,6 +97,7 @@
 [LibraryClasses.common.DXE_RUNTIME_DRIVER]
   I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
   
SerialPortLib|Silicon/Hisilicon/Hi1610/Library/Uart/LpcSerialPortLib/LpcSerialPortLib.inf
+  
DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
 
 [BuildOptions]
   GCC:*_*_AARCH64_PLATFORM_FLAGS == 
-I$(WORKSPACE)/Silicon/Hisilicon/Hi1610/Include
diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
index 0792b08..dfee09b 100644
--- a/Platform/Hisilicon/D05/D05.dsc
+++ b/Platform/Hisilicon/D05/D05.dsc
@@ -105,6 +105,7 @@
 [LibraryClasses.common.DXE_RUNTIME_DRIVER]
   I2CLib|Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf
   
SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
+  
DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
 
 [BuildOptions]
   GCC:*_*_AARCH64_PLATFORM_FLAGS == 
-I$(WORKSPACE)/Silicon/Hisilicon/Hi1616/Include
diff --git a/Silicon/Hisilicon/Hisilicon.dsc.inc 
b/Silicon/Hisilicon/Hisilicon.dsc.inc
index 5766829..b5b9e7e 100644
--- a/Silicon/Hisilicon/Hisilicon.dsc.inc
+++ b/Silicon/Hisilicon/Hisilicon.dsc.inc
@@ -208,8 +208,6 @@
   
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
   
ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
-  
SerialPortLib|Silicon/Hisilicon/Library/Dw8250SerialPortRuntimeLib/Dw8250SerialPortRuntimeLib.inf
-  
DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
 
 [LibraryClasses.AARCH64]
   
ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
-- 
2.7.4

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


[edk2] [PATCH v2 2/4] Platform/Hisilicon/HiKey: use Hisilicon common file

2018-02-09 Thread Haojian Zhuang
Use common file Hisilicon.dsc.inc/Hisilicon.fdf.inc to reduce
redundant contents in both HiKey.dsc and HiKey.fdf.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Haojian Zhuang 
---
 Platform/Hisilicon/HiKey/HiKey.dsc | 204 +++--
 Platform/Hisilicon/HiKey/HiKey.fdf | 141 ++---
 2 files changed, 19 insertions(+), 326 deletions(-)

diff --git a/Platform/Hisilicon/HiKey/HiKey.dsc 
b/Platform/Hisilicon/HiKey/HiKey.dsc
index c7d931e..b0f8a93 100644
--- a/Platform/Hisilicon/HiKey/HiKey.dsc
+++ b/Platform/Hisilicon/HiKey/HiKey.dsc
@@ -20,152 +20,55 @@
   PLATFORM_GUID  = 8edf1480-da5c-4857-bc02-7530bd8e7b7a
   PLATFORM_VERSION   = 0.2
   DSC_SPECIFICATION  = 0x00010019
-  OUTPUT_DIRECTORY   = Build/HiKey
+  OUTPUT_DIRECTORY   = Build/$(PLATFORM_NAME)
   SUPPORTED_ARCHITECTURES= AARCH64
   BUILD_TARGETS  = DEBUG|RELEASE
   SKUID_IDENTIFIER   = DEFAULT
-  FLASH_DEFINITION   = Platform/Hisilicon/HiKey/HiKey.fdf
+  FLASH_DEFINITION   = 
Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
 
-[LibraryClasses.common]
-!if $(TARGET) == RELEASE
-  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
-!else
-  DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
-!endif
-  
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
-
-  ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
-  ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
-  ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf
-  ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf
-  ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
-  
ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
+!include Silicon/Hisilicon/Hisilicon.dsc.inc
 
+[LibraryClasses.common]
   ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
-  ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
   ArmPlatformLib|Platform/Hisilicon/HiKey/Library/HiKeyLib/HiKeyLib.inf
-  
ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
-
-  BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
-  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
-  
CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
-  
DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
-  CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf
-  CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
-  DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
-  DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
-  
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
-  
ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.inf
-  
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
-  
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
-
-  FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
+
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
   
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+
   
PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
-  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
   
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
 
-  ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
-  FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
-  SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
-
   # UiApp dependencies
   
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
 
-  HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
-  IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
-  HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
-  
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
-  TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
-  
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
-  
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
-  
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
-
-  PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
   
SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
   

[edk2] [PATCH v2 4/4] Platform/Hisilicon/HiKey960: add skeleton of HiKey960

2018-02-09 Thread Haojian Zhuang
Add skeleton of HiKey960 platform.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Haojian Zhuang 
---
 Platform/Hisilicon/HiKey960/HiKey960.dsc   | 260 +
 Platform/Hisilicon/HiKey960/HiKey960.fdf   | 214 +
 .../HiKey960/Library/HiKey960Lib/HiKey960.c| 144 
 .../HiKey960/Library/HiKey960Lib/HiKey960Helper.S  |  52 +
 .../HiKey960/Library/HiKey960Lib/HiKey960Lib.inf   |  44 
 .../HiKey960/Library/HiKey960Lib/HiKey960Mem.c | 163 +
 6 files changed, 877 insertions(+)
 create mode 100644 Platform/Hisilicon/HiKey960/HiKey960.dsc
 create mode 100644 Platform/Hisilicon/HiKey960/HiKey960.fdf
 create mode 100644 Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960.c
 create mode 100644 
Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Helper.S
 create mode 100644 
Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Lib.inf
 create mode 100644 
Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Mem.c

diff --git a/Platform/Hisilicon/HiKey960/HiKey960.dsc 
b/Platform/Hisilicon/HiKey960/HiKey960.dsc
new file mode 100644
index 000..98289c0
--- /dev/null
+++ b/Platform/Hisilicon/HiKey960/HiKey960.dsc
@@ -0,0 +1,260 @@
+#
+#  Copyright (c) 2018, Linaro Limited. All rights reserved.
+#
+#  This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD 
License
+#  which accompanies this distribution.  The full text of the license may be 
found at
+#  http://opensource.org/licenses/bsd-license.php
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
+#
+
+
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+
+[Defines]
+  PLATFORM_NAME  = HiKey960
+  PLATFORM_GUID  = bd1a557e-4423-466a-a462-38439588fd37
+  PLATFORM_VERSION   = 0.2
+  DSC_SPECIFICATION  = 0x00010019
+  OUTPUT_DIRECTORY   = Build/$(PLATFORM_NAME)
+  SUPPORTED_ARCHITECTURES= AARCH64
+  BUILD_TARGETS  = DEBUG|RELEASE
+  SKUID_IDENTIFIER   = DEFAULT
+  FLASH_DEFINITION   = 
Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
+
+!include Silicon/Hisilicon/Hisilicon.dsc.inc
+
+[LibraryClasses.common]
+  ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+  
ArmPlatformLib|Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Lib.inf
+
+  CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+  
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+  
PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+  
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
+
+  # UiApp dependencies
+  
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
+  FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
+  DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+
+  
SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
+  
RealTimeClockLib|ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.inf
+  TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf
+
+  # USB Requirements
+  UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
+
+  # Network Libraries
+  UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
+  NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
+  DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
+  IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
+  UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
+
+[LibraryClasses.common.SEC]
+  PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
+  
ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
+  HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf
+  
MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf
+  MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
+  PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
+  
PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
+
+
+#
+# Pcd Section - list of all EDK II PCD Entries defined by this Platform
+#
+
+
+[PcdsFeatureFlag.common]
+  ## If TRUE, Graphics Output Protocol will be installed on virtual handle 

[edk2] [PATCH v2 1/4] Platform/Hisilicon/HiKey: include DxePcdLib for HiiDatabase

2018-02-09 Thread Haojian Zhuang
Include DxePcdLib for HiiDatabase. Otherwise, PlatformBootManager
can't be launched successfully.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Haojian Zhuang 
---
 Platform/Hisilicon/HiKey/HiKey.dsc | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Platform/Hisilicon/HiKey/HiKey.dsc 
b/Platform/Hisilicon/HiKey/HiKey.dsc
index e8cb957..c7d931e 100644
--- a/Platform/Hisilicon/HiKey/HiKey.dsc
+++ b/Platform/Hisilicon/HiKey/HiKey.dsc
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2014-2017, Linaro Limited. All rights reserved.
+#  Copyright (c) 2014-2018, Linaro Limited. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -422,7 +422,10 @@
   # Bds
   #
   MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
-  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+  MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf {
+
+  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+  }
   MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
   MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
-- 
2.7.4

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


[edk2] [PATCH v2 0/4] support HiKey960

2018-02-09 Thread Haojian Zhuang
v2:
  * Use Hisilicon common file.
  * Move SerialPorLib & DebugLib of DXE_RUNTIME out of Hisilicon.dsc.inc.
  * Remove unused PCD values from HiKey960 dsc file.
  * Fix to enter boot manager on HiKey.

v1:
  * Support the skeleton of HiKey960.

Haojian Zhuang (4):
  Platform/Hisilicon/HiKey: include DxePcdLib for HiiDatabase
  Platform/Hisilicon/HiKey: use Hisilicon common file
  Platform/Hisilicon: move out dxe runtime lib from common file
  Platform/Hisilicon/HiKey960: add skeleton of HiKey960

 Platform/Hisilicon/D02/Pv660D02.dsc|   2 +
 Platform/Hisilicon/D03/D03.dsc |   1 +
 Platform/Hisilicon/D05/D05.dsc |   1 +
 Platform/Hisilicon/HiKey/HiKey.dsc | 211 ++---
 Platform/Hisilicon/HiKey/HiKey.fdf | 141 +--
 Platform/Hisilicon/HiKey960/HiKey960.dsc   | 260 +
 Platform/Hisilicon/HiKey960/HiKey960.fdf   | 214 +
 .../HiKey960/Library/HiKey960Lib/HiKey960.c| 144 
 .../HiKey960/Library/HiKey960Lib/HiKey960Helper.S  |  52 +
 .../HiKey960/Library/HiKey960Lib/HiKey960Lib.inf   |  44 
 .../HiKey960/Library/HiKey960Lib/HiKey960Mem.c | 163 +
 Silicon/Hisilicon/Hisilicon.dsc.inc|   2 -
 12 files changed, 905 insertions(+), 330 deletions(-)
 create mode 100644 Platform/Hisilicon/HiKey960/HiKey960.dsc
 create mode 100644 Platform/Hisilicon/HiKey960/HiKey960.fdf
 create mode 100644 Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960.c
 create mode 100644 
Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Helper.S
 create mode 100644 
Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Lib.inf
 create mode 100644 
Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Mem.c

-- 
2.7.4

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


Re: [edk2] [Linaro-uefi] [issue] Arrow key can't be read on tty terminal in release build

2018-02-09 Thread Jeremy Linton

Hi,

On 02/07/2018 09:50 AM, Haojian Zhuang wrote:

Hi all,

I have an issue on tty terminal. I setup PL011 serial console as the
tty terminal on HiKey platform. When it's built in debug mode, arrow
key works well. When it's built in release mode, arrow key can't work.

For example, DOWN key is gotten in terminal with "~[B" value in debug
build. DOWN key is gotten in terminal with "~" value in release build.
These values are fetched by GetOneKeyFromSerial().

But I can't find any difference on PL011 serial driver between debug
and release mode.

Do you have any idea on this?


Just to add an additional data point.

I see arrow key issue on the hikey as well as the ARM models. The 
problem seems to have shown up sometime late last year and happens in my 
case when the machine directly boots into distro provided grub. 
Strangely, exiting to the BDS and then starting the boot from the BDS 
seems to clear up the problem and the arrow keys work (or pressing 
escape and going to the BDS first, either way poping up the BDS menus 
seem to work around the issue).





Best Regards
Haojian
___
Linaro-uefi mailing list
linaro-u...@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/linaro-uefi



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


Re: [edk2] [PATCH edk2-platforms] Platform/Hisilicon: fix D03/D05 capsule image names

2018-02-09 Thread Leif Lindholm
On Fri, Feb 09, 2018 at 01:20:16PM +, Ard Biesheuvel wrote:
> On 9 February 2018 at 13:16, Leif Lindholm  wrote:
> > Due to copy-paste error, both d03 and d05 ended up with capsule sections
> > named Capsule.StyxFirmwareUpdateCapsuleFmpPkcs7 in their .fdf files.
> > Change these to the actual platform names.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Leif Lindholm 
> 
> Reviewed-by: Ard Biesheuvel 

Thanks - pushed as a235eabe39.

> > ---
> >  Platform/Hisilicon/D03/D03.fdf | 2 +-
> >  Platform/Hisilicon/D05/D05.fdf | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/Platform/Hisilicon/D03/D03.fdf b/Platform/Hisilicon/D03/D03.fdf
> > index e6a4820256..09613fb8f6 100644
> > --- a/Platform/Hisilicon/D03/D03.fdf
> > +++ b/Platform/Hisilicon/D03/D03.fdf
> > @@ -400,7 +400,7 @@ [FmpPayload.FmpPayloadSystemFirmwarePkcs7]
> >
> >FV = SystemFirmwareUpdateCargo
> >
> > -[Capsule.StyxFirmwareUpdateCapsuleFmpPkcs7]
> > +[Capsule.D03FirmwareUpdateCapsuleFmpPkcs7]
> >  CAPSULE_GUID= 6dcbd5ed-e82d-4c44-bda1-7194199ad92a # 
> > gEfiFmpCapsuleGuid
> >  CAPSULE_HEADER_SIZE = 0x20
> >  CAPSULE_HEADER_INIT_VERSION = 0x1
> > diff --git a/Platform/Hisilicon/D05/D05.fdf b/Platform/Hisilicon/D05/D05.fdf
> > index 22609bb588..17a43d8edb 100644
> > --- a/Platform/Hisilicon/D05/D05.fdf
> > +++ b/Platform/Hisilicon/D05/D05.fdf
> > @@ -425,7 +425,7 @@ [FmpPayload.FmpPayloadSystemFirmwarePkcs7]
> >
> >FV = SystemFirmwareUpdateCargo
> >
> > -[Capsule.StyxFirmwareUpdateCapsuleFmpPkcs7]
> > +[Capsule.D05FirmwareUpdateCapsuleFmpPkcs7]
> >  CAPSULE_GUID= 6dcbd5ed-e82d-4c44-bda1-7194199ad92a # 
> > gEfiFmpCapsuleGuid
> >  CAPSULE_HEADER_SIZE = 0x20
> >  CAPSULE_HEADER_INIT_VERSION = 0x1
> > --
> > 2.11.0
> >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH edk2-platforms] Platform/Hisilicon: fix D03/D05 capsule image names

2018-02-09 Thread Leif Lindholm
Due to copy-paste error, both d03 and d05 ended up with capsule sections
named Capsule.StyxFirmwareUpdateCapsuleFmpPkcs7 in their .fdf files.
Change these to the actual platform names.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm 
---
 Platform/Hisilicon/D03/D03.fdf | 2 +-
 Platform/Hisilicon/D05/D05.fdf | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Platform/Hisilicon/D03/D03.fdf b/Platform/Hisilicon/D03/D03.fdf
index e6a4820256..09613fb8f6 100644
--- a/Platform/Hisilicon/D03/D03.fdf
+++ b/Platform/Hisilicon/D03/D03.fdf
@@ -400,7 +400,7 @@ [FmpPayload.FmpPayloadSystemFirmwarePkcs7]
 
   FV = SystemFirmwareUpdateCargo
 
-[Capsule.StyxFirmwareUpdateCapsuleFmpPkcs7]
+[Capsule.D03FirmwareUpdateCapsuleFmpPkcs7]
 CAPSULE_GUID= 6dcbd5ed-e82d-4c44-bda1-7194199ad92a # 
gEfiFmpCapsuleGuid
 CAPSULE_HEADER_SIZE = 0x20
 CAPSULE_HEADER_INIT_VERSION = 0x1
diff --git a/Platform/Hisilicon/D05/D05.fdf b/Platform/Hisilicon/D05/D05.fdf
index 22609bb588..17a43d8edb 100644
--- a/Platform/Hisilicon/D05/D05.fdf
+++ b/Platform/Hisilicon/D05/D05.fdf
@@ -425,7 +425,7 @@ [FmpPayload.FmpPayloadSystemFirmwarePkcs7]
 
   FV = SystemFirmwareUpdateCargo
 
-[Capsule.StyxFirmwareUpdateCapsuleFmpPkcs7]
+[Capsule.D05FirmwareUpdateCapsuleFmpPkcs7]
 CAPSULE_GUID= 6dcbd5ed-e82d-4c44-bda1-7194199ad92a # 
gEfiFmpCapsuleGuid
 CAPSULE_HEADER_SIZE = 0x20
 CAPSULE_HEADER_INIT_VERSION = 0x1
-- 
2.11.0

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


[edk2] [PATCH 1/2] Silicon/NXP: Add Modified SPI protocol stack

2018-02-09 Thread Pankaj Bansal
The PI 1.6 SPI specs are not adequate to handle all type of SPI
communication, specially the QUAD mode read/write comminications
with the periphrals that support it.

Therefore we are modifying the SPI protocol defined in PI 1.6 spec.

Untill these changes are incorporated in PI specs, we are calling it
revised PI 1.6 spec.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pankaj Bansal 
---
 Silicon/NXP/Include/Pi/PiSpi.h   | 233 
 .../NXP/Include/Protocol/SpiConfiguration.h  | 313 +
 Silicon/NXP/Include/Protocol/SpiHc.h | 208 +++
 Silicon/NXP/Include/Protocol/SpiIo.h | 168 +
 Silicon/NXP/Include/Protocol/SpiNorFlash.h   | 269 ++
 5 files changed, 1191 insertions(+)

diff --git a/Silicon/NXP/Include/Pi/PiSpi.h b/Silicon/NXP/Include/Pi/PiSpi.h
new file mode 100644
index 000..8c35d86
--- /dev/null
+++ b/Silicon/NXP/Include/Pi/PiSpi.h
@@ -0,0 +1,233 @@
+/** @file
+  Include file matches things in PI.
+
+  Copyright (c) 2017, Intel Corporation. All rights reserved.
+  Copyright 2017-2018 NXP
+
+  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.
+
+  @par Revision Reference:
+This Protocol was introduced in revised UEFI PI Specification 1.6.
+
+**/
+
+#ifndef __PI_SPI_H__
+#define __PI_SPI_H__
+
+///
+/// Define the SPI flags
+///
+
+/// The SPI peripheral/controller supports only half duplex transactions
+#define SPI_HALF_DUPLEX   BIT0
+/// The SPI peripheral/controller supports write only transactions.
+#define SPI_SUPPORTS_WRITE_ONLY_OPERATIONSBIT1
+/// The SPI peripheral/controller supports Read only transactions.
+#define SPI_SUPPORTS_READ_ONLY_OPERATIONS BIT2
+/// The SPI peripheral/controller supports Double Transfer Rate (DTR).
+/// DTR : Transfer may be input or output on both the
+/// rising and falling edges of the clock.
+#define SPI_SUPPORTS_DTR_OPERATIONS   BIT3
+/// The SPI peripheral/controller supports a 2-bit data bus
+#define SPI_SUPPORTS_2_BIT_DATA_BUS_WIDTH BIT4
+/// The SPI peripheral/controller supports a 4-bit data bus
+#define SPI_SUPPORTS_4_BIT_DATA_BUS_WIDTH BIT5
+/// The SPI peripheral/controller supports a 8-bit data bus
+#define SPI_SUPPORTS_8_BIT_DATA_BUS_WIDTH BIT6
+/// Transfer size includes the opcode byte
+#define SPI_TRANSFER_SIZE_INCLUDES_OPCODE BIT7
+/// Transfer size includes the 4 address bytes
+#define SPI_TRANSFER_SIZE_INCLUDES_ADDRESSBIT8
+
+///
+/// SPI Frame Size supported Mask
+///
+#define  SPI_FRAME_MASK(FrameSize)   (1U << FrameSize)
+
+///
+/// Calculate the Clock cycles from number of bytes and BusWidth
+///
+#define SPI_BYTES_TO_CYCLES(Bytes, BusWidth) ( ( (Bytes << sizeof (UINT8)) 
+ BusWidth - 1) / BusWidth)
+///
+/// Calculate the number of bytes from Clock cycles and BusWidth
+///
+#define SPI_CYCLES_TO_BYTES(Cycles, BusWidth)( (Cycles * BusWidth) >> 
sizeof (UINT8))
+
+///
+/// SPI Device Path can be used to describe the device path of both SPI 
controller
+/// and SPI Peripheral.
+///
+typedef struct {
+  ///
+  /// Vendor device path specifying Vendor GUID for SPI Host controller or SPI 
Peripheral.
+  ///
+  VENDOR_DEVICE_PATHVendor;
+  ///
+  /// Controller device path to distinguish between two instances of SPI 
controller or SPI Peripheral.
+  ///
+  CONTROLLER_DEVICE_PATHController;
+  ///
+  /// Signify the end of Device Path.
+  ///
+  EFI_DEVICE_PATH_PROTOCOL  End;
+} EFI_SPI_DEVICE_PATH;
+
+///
+/// Note: The revised UEFI PI 1.6 specification does not specify values for the
+///   members below. The order matches the specification.
+///
+typedef enum {
+  ///
+  /// Data flowing from the host to the SPI peripheral
+  /// or Data flowing from the SPI peripheral to the host
+  ///
+  SPI_TRANSACTION_DATA = 0,
+
+  ///
+  /// Command to send to SPI Peripheral
+  ///
+  SPI_TRANSACTION_COMMAND,
+
+  ///
+  /// Offset in SPI Peripheral from/to which data is to be read/written
+  ///
+  SPI_TRANSACTION_ADDRESS,
+
+  ///
+  /// Optional control bits that follow the address bits.
+  /// These bits are driven by the controller if they are specified.
+  ///
+  /// NOTE This field should be counted in clocks not number of bits received 
by the
+  /// serial flash. The SPI master drives the bus during "mode bits" cycles;
+  /// Example: If 8 mode bits are needed with a quad input 

[edk2] [PATCH 2/2] NXP/SpiBusDxe: Add SPI Bus driver.

2018-02-09 Thread Pankaj Bansal
This Driver is based on revised PI 1.6 SPI specs.

This driver is DXE_RUNTIME_DRIVER, so that the SPI peripherals that
are needed to support runtime services can be used with this driver.

This driver follows UEFI driver model and its a Bus Driver that creates
all of its child handles on the first call to Start.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pankaj Bansal 
---
 Silicon/NXP/Drivers/SpiBusDxe/SpiBusDxe.c   | 1548 +
 Silicon/NXP/Drivers/SpiBusDxe/SpiBusDxe.h   |  510 ++
 Silicon/NXP/Drivers/SpiBusDxe/SpiBusDxe.inf |   53 +
 3 files changed, 2111 insertions(+)

diff --git a/Silicon/NXP/Drivers/SpiBusDxe/SpiBusDxe.c 
b/Silicon/NXP/Drivers/SpiBusDxe/SpiBusDxe.c
new file mode 100644
index 000..70c0aba
--- /dev/null
+++ b/Silicon/NXP/Drivers/SpiBusDxe/SpiBusDxe.c
@@ -0,0 +1,1548 @@
+/** @file
+  This file implements SPI IO Protocol which enables the user to manipulate a 
single
+  SPI device independent of the host controller and SPI design.
+
+  Based on MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c
+
+  Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.
+  Copyright 2018 NXP
+
+  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.
+
+ @par Specification Reference:
+  - UEFI 2.7 errata A, Chapter 8, Runtime Services
+  - UEFI 2.7 errata A, Chapter 10, Device Path Protocol
+  - UEFI 2.7 errata A, Chapter 11, UEFI Driver Model
+  - PI 1.6, Volume 5, Chapter 18 SPI Protocol Stack
+**/
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "SpiBusDxe.h"
+
+//
+// Global Variables
+//
+extern EFI_COMPONENT_NAME_PROTOCOLgSpiBusComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL   gSpiBusComponentName2;
+extern EFI_DRIVER_BINDING_PROTOCOLgSpiBusDriverBinding;
+
+//
+//  EFI_DRIVER_BINDING_PROTOCOL instance
+//
+EFI_DRIVER_BINDING_PROTOCOL gSpiBusDriverBinding = {
+  .Supported = SpiBusDriverSupported,
+  .Start = SpiBusDriverStart,
+  .Stop = SpiBusDriverStop,
+  .Version = 0x10,
+  .ImageHandle = NULL,
+  .DriverBindingHandle = NULL
+};
+
+//
+// Template for SPI Bus Context
+//
+SPI_BUS_CONTEXT gEfiSpiBusContextTemplate = {
+  .Signature = SPI_BUS_SIGNATURE,
+  .SpiHost = NULL,
+  .SpiBus = NULL,
+  .Link = {
+.ForwardLink = NULL,
+.BackLink = NULL
+  }
+};
+
+//
+// Template for SPI Device Context
+//
+SPI_DEVICE_CONTEXT gEfiSpiDeviceContextTemplate = {
+  .Signature = SPI_DEVICE_SIGNATURE,
+  .Handle = NULL,
+  .SpiIo = {
+.SpiPeripheral = NULL,
+.OriginalSpiPeripheral = NULL,
+.FrameSizeSupportMask = 0,
+.MaximumTransferBytes = 1,
+.Attributes = 0,
+.LegacySpiProtocol = NULL,
+.Transaction = SpiBusTransaction,
+.UpdateSpiPeripheral = SpiBusUpdateSpiPeripheral
+  },
+  .SpiBusContext = NULL,
+  .Link = {
+.ForwardLink = NULL,
+.BackLink = NULL
+  }
+};
+
+STATIC EFI_EVENT mSpiBusVirtualAddrChangeEvent;
+
+// Link list of SPI Buses that are runtime
+STATIC LIST_ENTRYmSpiBusList = INITIALIZE_LIST_HEAD_VARIABLE (mSpiBusList);
+
+// Link list of SPI Devices that are runtime
+STATIC LIST_ENTRYmSpiDeviceList = INITIALIZE_LIST_HEAD_VARIABLE 
(mSpiDeviceList);
+
+//
+// Driver name table
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE 
mSpiBusDriverNameTable[] = {
+  { "eng;en", (CHAR16 *) L"SPI Bus Driver" },
+  { NULL , NULL }
+};
+
+//
+// EFI Component Name Protocol
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL  
gSpiBusComponentName = {
+  (EFI_COMPONENT_NAME_GET_DRIVER_NAME) SpiBusComponentNameGetDriverName,
+  (EFI_COMPONENT_NAME_GET_CONTROLLER_NAME) 
SpiBusComponentNameGetControllerName,
+  "eng"
+};
+
+//
+// EFI Component Name 2 Protocol
+//
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL 
gSpiBusComponentName2 = {
+  SpiBusComponentNameGetDriverName,
+  SpiBusComponentNameGetControllerName,
+  "en"
+};
+
+/**
+  Retrieves a Unicode string that is the user readable name of the driver.
+
+  This function retrieves the user readable name of a driver in the form of a
+  Unicode string. If the driver specified by This has a user readable name in
+  the language specified by Language, then a pointer to the driver name is
+  returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
+  by This does not support the language specified by Language,
+  then EFI_UNSUPPORTED is returned.
+
+  @param  This[in]  A pointer to the 

[edk2] [RFC] MdePkg/BaseLib: Change BitField functions.

2018-02-09 Thread Pankaj Bansal
The bit field functions in MdePkg are not working as expected.
The restrictions on Value parameter such that Value should not be
greater than the bitmask value range specified by StartBit and EndBit
doesn't seem to make sense.

Also the restriction on End bit to not be equal to start bit prohibits
single bit change.

This is an attempt to correct these limitations.

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Pankaj Bansal 
---

Notes:
This is a RFC patch.

 MdePkg/Library/BaseLib/BitField.c | 179 ++--
 1 file changed, 89 insertions(+), 90 deletions(-)

diff --git a/MdePkg/Library/BaseLib/BitField.c 
b/MdePkg/Library/BaseLib/BitField.c
index eb9e276..2b5be52 100644
--- a/MdePkg/Library/BaseLib/BitField.c
+++ b/MdePkg/Library/BaseLib/BitField.c
@@ -2,6 +2,8 @@
   Bit field functions of BaseLib.
 
   Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+  Copyright 2018 NXP
+
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -14,6 +16,12 @@
 
 #include "BaseLibInternals.h"
 
+#define BITMASK_UNITN(StartBit, EndBit) \
+(((MAX_UINTN) << (StartBit)) & (MAX_UINTN >> ((sizeof (UINTN) * 8) - 1 - 
(EndBit
+
+#define BITMASK_UNIT64(StartBit, EndBit) \
+(((MAX_UINT64) << (StartBit)) & (MAX_UINT64 >> ((sizeof (UINT64) * 8) - 1 
- (EndBit
+
 /**
   Worker function that returns a bit field from Operand.
 
@@ -34,11 +42,9 @@ InternalBaseLibBitFieldReadUint (
   IN  UINTN EndBit
   )
 {
-  //
-  // ~((UINTN)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]
-  // are 1's while bit[EndBit + 1] thru the most significant bit are 0's.
-  //
-  return (Operand & ~((UINTN)-2 << EndBit)) >> StartBit;
+  UINTN  Mask = BITMASK_UNITN (StartBit, EndBit);
+
+  return ( (Operand & Mask) >> StartBit);
 }
 
 /**
@@ -68,19 +74,9 @@ InternalBaseLibBitFieldOrUint (
   IN  UINTN OrData
   )
 {
-  //
-  // Higher bits in OrData those are not used must be zero. 
-  //
-  // EndBit - StartBit + 1 might be 32 while the result right shifting 32 on a 
32bit integer is undefined,
-  // So the logic is updated to right shift (EndBit - StartBit) bits and 
compare the last bit directly.
-  //
-  ASSERT ((OrData >> (EndBit - StartBit)) == ((OrData >> (EndBit - StartBit)) 
& 1));
-  
-  //
-  // ~((UINTN)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]
-  // are 1's while bit[EndBit + 1] thru the most significant bit are 0's.
-  //
-  return Operand | ((OrData << StartBit) & ~((UINTN) -2 << EndBit));
+  UINTN  Mask = BITMASK_UNITN (StartBit, EndBit);
+
+  return ( ( (Operand | OrData) & Mask) | (Operand & ~Mask));
 }
 
 /**
@@ -110,19 +106,38 @@ InternalBaseLibBitFieldAndUint (
   IN  UINTN AndData
   )
 {
-  //
-  // Higher bits in AndData those are not used must be zero. 
-  //
-  // EndBit - StartBit + 1 might be 32 while the result right shifting 32 on a 
32bit integer is undefined,
-  // So the logic is updated to right shift (EndBit - StartBit) bits and 
compare the last bit directly.
-  //
-  ASSERT ((AndData >> (EndBit - StartBit)) == ((AndData >> (EndBit - 
StartBit)) & 1));
-
-  //
-  // ~((UINTN)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]
-  // are 1's while bit[EndBit + 1] thru the most significant bit are 0's.
-  //
-  return Operand & ~((~AndData << StartBit) & ~((UINTN)-2 << EndBit));
+  UINTN  Mask = BITMASK_UNITN (StartBit, EndBit);
+
+  return  ( ( (Operand & AndData) & Mask) | (Operand & ~Mask));
+}
+
+/**
+  Worker function that writes a bit field to an value, and returns the result.
+
+  Writes Value to the bit field specified by the StartBit and the EndBit in
+  Operand. All other bits in Operand are preserved. The new 8-bit value is
+  returned.
+
+  @param  Operand   Operand on which to perform the bitfield operation.
+  @param  StartBit  The ordinal of the least significant bit in the bit field.
+  @param  EndBitThe ordinal of the most significant bit in the bit field.
+  @param  Value The new value of the bit field.
+
+  @return The new value.
+
+**/
+UINTN
+EFIAPI
+InternalBaseLibBitFieldWriteUint (
+  IN  UINTN Operand,
+  IN  UINTN StartBit,
+  IN  UINTN EndBit,
+  IN  UINTN Value
+  )
+{
+  UINTN  Mask = BITMASK_UNITN (StartBit, EndBit);
+
+  return  ( (Value & Mask) | (Operand & ~Mask));
 }
 
 /**
@@ -153,7 +168,7 @@ BitFieldRead8 (
   )
 {
   ASSERT (EndBit < 8);
-  ASSERT (StartBit <= EndBit);
+  ASSERT (StartBit < EndBit);
   return (UINT8)InternalBaseLibBitFieldReadUint (Operand, StartBit, EndBit);
 }
 
@@ -190,8 +205,8 @@ BitFieldWrite8 (
   )
 {
   

Re: [edk2] [Patch 2/2] NetworkPkg: Read TlsCipherList variable and configure it for HTTPS session.

2018-02-09 Thread Laszlo Ersek
On 02/09/18 04:59, Jiaxin Wu wrote:
> This patch is to read the TlsCipherList variable and configure it for the
> later HTTPS session.
> 
> If the variable is not set by any platform, EFI_NOT_FOUND will be returned
> from GetVariable service. In such a case, the default CipherList created in
> TlsDxe driver will be used.
> 
> Cc: Laszlo Ersek 
> Cc: Kinney Michael D 
> Cc: Zimmer Vincent 
> Cc: Yao Jiewen 
> Cc: Ye Ting 
> Cc: Fu Siyuan 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Wu Jiaxin 
> ---
>  NetworkPkg/HttpDxe/HttpDriver.h   |  3 +-
>  NetworkPkg/HttpDxe/HttpDxe.inf|  3 +-
>  NetworkPkg/HttpDxe/HttpsSupport.c | 92 
> ++-
>  3 files changed, 95 insertions(+), 3 deletions(-)
> 
> diff --git a/NetworkPkg/HttpDxe/HttpDriver.h b/NetworkPkg/HttpDxe/HttpDriver.h
> index 93a412a..eba7d32 100644
> --- a/NetworkPkg/HttpDxe/HttpDriver.h
> +++ b/NetworkPkg/HttpDxe/HttpDriver.h
> @@ -1,9 +1,9 @@
>  /** @file
>The header files of the driver binding and service binding protocol for 
> HttpDxe driver.
>  
> -  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
>(C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  
>This program and the accompanying materials
>are licensed and made available under the terms and conditions of the BSD 
> License
>which accompanies this distribution.  The full text of the license may be 
> found at
> @@ -59,10 +59,11 @@
>  // Produced Protocols
>  //
>  #include 
>  
>  #include 
> +#include 
>  
>  #include 
>  
>  //
>  // Driver Version
> diff --git a/NetworkPkg/HttpDxe/HttpDxe.inf b/NetworkPkg/HttpDxe/HttpDxe.inf
> index 20075f5..b1d7bd2 100644
> --- a/NetworkPkg/HttpDxe/HttpDxe.inf
> +++ b/NetworkPkg/HttpDxe/HttpDxe.inf
> @@ -1,9 +1,9 @@
>  ## @file
>  #  Implementation of EFI HTTP protocol interfaces.
>  #
> -#  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
>  #
>  #  This program and the accompanying materials
>  #  are licensed and made available under the terms and conditions of the BSD 
> License
>  #  which accompanies this distribution. The full text of the license may be 
> found at
>  #  http://opensource.org/licenses/bsd-license.php.
> @@ -72,10 +72,11 @@
>gEfiTlsProtocolGuid  ## SOMETIMES_CONSUMES
>gEfiTlsConfigurationProtocolGuid ## SOMETIMES_CONSUMES
>  
>  [Guids]
>gEfiTlsCaCertificateGuid ## SOMETIMES_CONSUMES  ## 
> Variable:L"TlsCaCertificate"
> +  gTlsCipherListGuid   ## SOMETIMES_CONSUMES  ## 
> Variable:L"TlsCipherList"
>  
>  [Pcd]
>gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections   ## CONSUMES
>gEfiNetworkPkgTokenSpaceGuid.PcdHttpsAuthenticationMode## 
> SOMETIMES_CONSUMES
>gEfiNetworkPkgTokenSpaceGuid.PcdHttpsHostPublicCert## 
> SOMETIMES_CONSUMES
> diff --git a/NetworkPkg/HttpDxe/HttpsSupport.c 
> b/NetworkPkg/HttpDxe/HttpsSupport.c
> index 288082a..62cb867 100644
> --- a/NetworkPkg/HttpDxe/HttpsSupport.c
> +++ b/NetworkPkg/HttpDxe/HttpsSupport.c
> @@ -1,9 +1,9 @@
>  /** @file
>Miscellaneous routines specific to Https for HttpDxe driver.
>  
> -Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
>  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD 
> License
>  which accompanies this distribution.  The full text of the license may be 
> found at
>  http://opensource.org/licenses/bsd-license.php
> @@ -492,10 +492,91 @@ TlsConfigCertificate (
>
>return Status;
>  }
>  
>  /**
> +  Read the TlsCipherList variable and configure it for HTTPS session.
> +
> +  @param[in, out]  HttpInstance   The HTTP instance private data.
> +
> +  @retval EFI_SUCCESSThe prefered TLS CipherList is configured.
> +  @retval EFI_NOT_FOUND  Fail to get 'TlsCipherList' variable.
> +  @retval EFI_INVALID_PARAMETER  The contents of variable are invalid.
> +  @retval EFI_OUT_OF_RESOURCES   Can't allocate memory resources.
> +
> +  @retval Others Other error as indicated.
> +
> +**/
> +EFI_STATUS
> +TlsConfigCipherList (
> +  IN OUT HTTP_PROTOCOL  *HttpInstance
> +  )
> +{
> +  EFI_STATUS  Status;
> +  UINT8   *CipherList;
> +  UINTN   CipherListSize;
> +
> +  CipherList = NULL;
> +  CipherListSize = 0;
> +
> +  //
> +  // Try to read the TlsCipherList variable.
> +  //
> +  Status  = gRT->GetVariable (
> + 

Re: [edk2] [Patch 0/2] NetworkPkg: Support the platform to configure TLS CipherList.

2018-02-09 Thread Laszlo Ersek
On 02/09/18 06:22, Fu, Siyuan wrote:
> Hi, Jiaxin
> 
> I think we can remove the "TlsCipherList.h" to another name like
> "HttpTlsCipherListVariable.h" to  highlight that the variable is only
> used for HTTP configuration. And also the variable name and GUID
> name.
If we are renaming gEfiTlsCaCertificateGuid, can we pick a generic term
as new name, something like "gHttpTlsVariableGuid"? And then put both
variables, the CA List and the Cipher List, in that (same) namespace GUID?

It's not that we'll run out of GUIDs any time soon :) , but I think
these variables belong closely together.

Thanks,
Laszlo

>> -Original Message-
>> From: Wu, Jiaxin
>> Sent: Friday, February 9, 2018 12:00 PM
>> To: edk2-devel@lists.01.org
>> Cc: Laszlo Ersek ; Kinney, Michael D
>> ; Zimmer, Vincent ;
>> Yao, Jiewen ; Ye, Ting ; Fu,
>> Siyuan ; Wu, Jiaxin 
>> Subject: [Patch 0/2] NetworkPkg: Support the platform to configure TLS
>> CipherList.
>>
>> Cc: Laszlo Ersek 
>> Cc: Kinney Michael D 
>> Cc: Zimmer Vincent 
>> Cc: Yao Jiewen 
>> Cc: Ye Ting 
>> Cc: Fu Siyuan 
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Wu Jiaxin 
>>
>> Jiaxin Wu (2):
>>   NetworkPkg: Define one private variable for TLS CipherList
>> configuration.
>>   NetworkPkg: Read TlsCipherList variable and configure it for HTTPS
>> session.
>>
>>  NetworkPkg/HttpDxe/HttpDriver.h |  3 +-
>>  NetworkPkg/HttpDxe/HttpDxe.inf  |  3 +-
>>  NetworkPkg/HttpDxe/HttpsSupport.c   | 92
>> -
>>  NetworkPkg/Include/Guid/TlsCipherList.h | 38 ++
>>  NetworkPkg/NetworkPkg.dec   |  3 ++
>>  5 files changed, 136 insertions(+), 3 deletions(-)
>>  create mode 100644 NetworkPkg/Include/Guid/TlsCipherList.h
>>
>> --
>> 1.9.5.msysgit.1
> 

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


Re: [edk2] [PATCH 1/2] BeagleBoardPkg: drop unused PcdCacheEnabled dependency

2018-02-09 Thread Leif Lindholm
On Thu, Feb 08, 2018 at 07:22:33PM +, Ard Biesheuvel wrote:
> On 8 February 2018 at 19:19, Leif Lindholm  wrote:
> > Commit f72df138 got rid of the use of PcdCacheEnabled, but failed to
> > actually drop it as a dependency for BeagleBoardLib.
> >
> > Get rid of it, so the module will still build when the Pcd is _really_
> > removed.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Leif Lindholm 
> 
> For the series:
> Reviewed-by: Ard Biesheuvel 

Thanks!
Pushed as ce2818e418..6791175f05.

> > ---
> >  BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf | 3 ---
> >  1 file changed, 3 deletions(-)
> >
> > diff --git a/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf 
> > b/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf
> > index e004d6f10b..3b62f3cbf7 100644
> > --- a/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf
> > +++ b/BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardLib.inf
> > @@ -44,9 +44,6 @@ [Sources.common]
> >BeagleBoardHelper.S| GCC
> >BeagleBoardHelper.asm  | RVCT
> >
> > -[FeaturePcd]
> > -  gEmbeddedTokenSpaceGuid.PcdCacheEnable
> > -
> >  [FixedPcd]
> >gArmTokenSpaceGuid.PcdFdBaseAddress
> >gArmTokenSpaceGuid.PcdFdSize
> > --
> > 2.11.0
> >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms 1/3] Platform/(AMD|LeMaker|SoftIron), Silicon/AMD: drop unused PcdCacheEnabled

2018-02-09 Thread Leif Lindholm
On Thu, Feb 08, 2018 at 07:46:49PM +, Ard Biesheuvel wrote:
> On 8 February 2018 at 19:30, Leif Lindholm  wrote:
> > PcdCacheEnabled was never useful for these platforms, but they copied it
> > over from other platforms used as templates.
> > Delete it here to keep the platforms building once the Pcd is removed
> > from EmbeddedPkg.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Leif Lindholm 
> 
> For the series:
> Reviewed-by: Ard Biesheuvel 

Thanks!
Pushed as 69f992e854..ebe08785ae.

> > ---
> >  Platform/AMD/OverdriveBoard/OverdriveBoard.dsc  | 3 ---
> >  Platform/LeMaker/CelloBoard/CelloBoard.dsc  | 3 ---
> >  Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc | 3 ---
> >  Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLib.inf  | 3 ---
> >  Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf   | 3 ---
> >  Silicon/AMD/Styx/Library/AmdStyxLib/StyxMem.c   | 6 +-
> >  6 files changed, 1 insertion(+), 20 deletions(-)
> >
> > diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
> > b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > index 21edcc8798..48018abc69 100644
> > --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > @@ -282,9 +282,6 @@ 
> > [BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,Buil
> >  
> > 
> >
> >  [PcdsFeatureFlag.common]
> > -  # All pages are cached by default
> > -  gEmbeddedTokenSpaceGuid.PcdCacheEnable|TRUE
> > -
> ># Use the Vector Table location in CpuDxe. We will not copy the Vector 
> > Table at PcdCpuVectorBaseAddress
> >gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE
> >
> > diff --git a/Platform/LeMaker/CelloBoard/CelloBoard.dsc 
> > b/Platform/LeMaker/CelloBoard/CelloBoard.dsc
> > index cf3df86514..2468583c0d 100644
> > --- a/Platform/LeMaker/CelloBoard/CelloBoard.dsc
> > +++ b/Platform/LeMaker/CelloBoard/CelloBoard.dsc
> > @@ -270,9 +270,6 @@ 
> > [BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,Buil
> >  
> > 
> >
> >  [PcdsFeatureFlag.common]
> > -  # All pages are cached by default
> > -  gEmbeddedTokenSpaceGuid.PcdCacheEnable|TRUE
> > -
> ># Use the Vector Table location in CpuDxe. We will not copy the Vector 
> > Table at PcdCpuVectorBaseAddress
> >gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE
> >
> > diff --git a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc 
> > b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
> > index 0abec8120a..f0a7e97941 100644
> > --- a/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
> > +++ b/Platform/SoftIron/Overdrive1000Board/Overdrive1000Board.dsc
> > @@ -272,9 +272,6 @@ [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
> >  
> > 
> >
> >  [PcdsFeatureFlag.common]
> > -  # All pages are cached by default
> > -  gEmbeddedTokenSpaceGuid.PcdCacheEnable|TRUE
> > -
> ># Use the Vector Table location in CpuDxe. We will not copy the Vector 
> > Table at PcdCpuVectorBaseAddress
> >gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE
> >
> > diff --git a/Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLib.inf 
> > b/Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLib.inf
> > index 6b7481ec6d..3a38f294eb 100644
> > --- a/Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLib.inf
> > +++ b/Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLib.inf
> > @@ -53,9 +53,6 @@ [Guids]
> >  [Ppis]
> >gArmMpCoreInfoPpiGuid
> >
> > -[FeaturePcd]
> > -  gEmbeddedTokenSpaceGuid.PcdCacheEnable
> > -
> >  [Pcd]
> >gArmTokenSpaceGuid.PcdSystemMemoryBase
> >gArmTokenSpaceGuid.PcdSystemMemorySize
> > diff --git a/Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf 
> > b/Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf
> > index b313d4baad..b24ffd469a 100644
> > --- a/Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf
> > +++ b/Silicon/AMD/Styx/Library/AmdStyxLib/AmdStyxLibSec.inf
> > @@ -49,9 +49,6 @@ [Sources.AARCH64]
> >  [Guids]
> >gAmdStyxMpCoreInfoGuid   ## CONSUMER
> >
> > -[FeaturePcd]
> > -  gEmbeddedTokenSpaceGuid.PcdCacheEnable
> > -
> >  [Ppis]
> >gArmMpCoreInfoPpiGuid
> >
> > diff --git a/Silicon/AMD/Styx/Library/AmdStyxLib/StyxMem.c 
> > b/Silicon/AMD/Styx/Library/AmdStyxLib/StyxMem.c
> > index 3b82132d08..479a40627d 100644
> > --- a/Silicon/AMD/Styx/Library/AmdStyxLib/StyxMem.c
> > +++ b/Silicon/AMD/Styx/Library/AmdStyxLib/StyxMem.c
> > @@ -78,11 +78,7 @@ ArmPlatformGetVirtualMemoryMap (
> >return;
> >}
> >
> > -  if (FeaturePcdGet(PcdCacheEnable) == TRUE) {
> > -  CacheAttributes = DDR_ATTRIBUTES_CACHED;
> > -  } else {
> 

Re: [edk2] [patch] MdeModulePkg/PerfLib: Add NULL pointer check for "Token"

2018-02-09 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>Dandan Bi
>Sent: Friday, February 09, 2018 4:04 PM
>To: edk2-devel@lists.01.org
>Cc: Yao, Jiewen ; Zeng, Star ;
>Gao, Liming 
>Subject: [edk2] [patch] MdeModulePkg/PerfLib: Add NULL pointer check for
>"Token"
>
>"Token" is passed through the perf entry, it's may be NULL.
>So we need to add NULL pointer check before reference it.
>
>Cc: Liming Gao 
>Cc: Star Zeng 
>Cc: Jiewen Yao 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Dandan Bi 
>---
> MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
>| 6 +-
> MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c | 6
>+-
>
>MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.
>c | 6 +-
> 3 files changed, 15 insertions(+), 3 deletions(-)
>
>diff --git
>a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.
>c
>b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.
>c
>index 8363b0e..9b3224e 100644
>---
>a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.
>c
>+++
>b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.
>c
>@@ -113,10 +113,14 @@ Check whether the Token is a known one which is
>uesed by core.
> BOOLEAN
> IsKnownTokens (
>   IN CONST CHAR8  *Token
>   )
> {
>+  if (Token == NULL) {
>+return FALSE;
>+  }
>+
>   if (AsciiStrCmp (Token, SEC_TOK) == 0 ||
>   AsciiStrCmp (Token, PEI_TOK) == 0 ||
>   AsciiStrCmp (Token, DXE_TOK) == 0 ||
>   AsciiStrCmp (Token, BDS_TOK) == 0 ||
>   AsciiStrCmp (Token, DRIVERBINDING_START_TOK) == 0 ||
>@@ -845,11 +849,11 @@ InsertFpdtMeasurement (
> return Status;
>   }
>
>   //
>   // If PERF_START()/PERF_END() have specified the ProgressID,it has high
>priority.
>-  // !!! Note: If the Pref is not the known Token used in the core but have
>same
>+  // !!! Note: If the Perf is not the known Token used in the core but have
>same
>   // ID with the core Token, this case will not be supported.
>   // And in currtnt usage mode, for the unkown ID, there is a general rule:
>   // If it is start pref: the lower 4 bits of the ID should be 0.
>   // If it is end pref: the lower 4 bits of the ID should not be 0.
>   // If input ID doesn't follow the rule, we will adjust it.
>diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
>b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
>index 79b67e8..f770a35 100644
>--- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
>+++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
>@@ -47,10 +47,14 @@ Check whether the Token is a known one which is
>uesed by core.
> BOOLEAN
> IsKnownTokens (
>   IN CONST CHAR8  *Token
>   )
> {
>+  if (Token == NULL) {
>+return FALSE;
>+  }
>+
>   if (AsciiStrCmp (Token, SEC_TOK) == 0 ||
>   AsciiStrCmp (Token, PEI_TOK) == 0 ||
>   AsciiStrCmp (Token, DXE_TOK) == 0 ||
>   AsciiStrCmp (Token, BDS_TOK) == 0 ||
>   AsciiStrCmp (Token, DRIVERBINDING_START_TOK) == 0 ||
>@@ -264,11 +268,11 @@ InsertPeiFpdtMeasurement (
> return Status;
>   }
>
>   //
>   // If PERF_START()/PERF_END() have specified the ProgressID,it has high
>priority.
>-  // !!! Note: If the Pref is not the known Token used in the core but have
>same
>+  // !!! Note: If the Perf is not the known Token used in the core but have
>same
>   // ID with the core Token, this case will not be supported.
>   // And in currtnt usage mode, for the unkown ID, there is a general rule:
>   // If it is start pref: the lower 4 bits of the ID should be 0.
>   // If it is end pref: the lower 4 bits of the ID should not be 0.
>   // If input ID doesn't follow the rule, we will adjust it.
>diff --git
>a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL
>ib.c
>b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL
>ib.c
>index 2834a68..dbc1166 100644
>---
>a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL
>ib.c
>+++
>b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceL
>ib.c
>@@ -83,10 +83,14 @@ Check whether the Token is a known one which is
>uesed by core.
> BOOLEAN
> IsKnownTokens (
>   IN CONST CHAR8  *Token
>   )
> {
>+  if (Token == NULL) {
>+return FALSE;
>+  }
>+
>   if (AsciiStrCmp (Token, SEC_TOK) == 0 ||
>   AsciiStrCmp (Token, PEI_TOK) == 0 ||
>   AsciiStrCmp (Token, DXE_TOK) == 0 ||
>   AsciiStrCmp (Token, BDS_TOK) == 0 ||
>   AsciiStrCmp (Token, DRIVERBINDING_START_TOK) == 0 ||
>@@ -495,11 +499,11 @@ InsertFpdtMeasurement (
> return Status;
>   }
>
>   //
>   // If PERF_START()/PERF_END() have specified the ProgressID,it has high
>priority.
>-  // !!! Note: If the Pref is not the known Token used in the core but 

Re: [edk2] [PATCH] BaseTool: correct the generate compress section process

2018-02-09 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Feng, YunhuaX
>Sent: Friday, February 09, 2018 4:06 PM
>To: edk2-devel@lists.01.org
>Cc: Zhu, Yonghong ; Gao, Liming
>
>Subject: [PATCH] BaseTool: correct the generate compress section process
>
>First generate a dummy file with section alignment,
>then compress the dummy file to generate the compress file
>
>Cc: Liming Gao 
>Cc: Yonghong Zhu 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Yunhua Feng 
>---
> BaseTools/Source/Python/GenFds/CompressSection.py | 13 +
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
>diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py
>b/BaseTools/Source/Python/GenFds/CompressSection.py
>index 98532ed8e6..56e71a3545 100644
>--- a/BaseTools/Source/Python/GenFds/CompressSection.py
>+++ b/BaseTools/Source/Python/GenFds/CompressSection.py
>@@ -58,10 +58,11 @@ class CompressSection (CompressSectionClassObject) :
> if FfsInf != None:
> self.CompType = FfsInf.__ExtendMacro__(self.CompType)
> self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
>
> SectFiles = tuple()
>+SectAlign = []
> Index = 0
> MaxAlign = None
> for Sect in self.SectionList:
> Index = Index + 1
> SecIndex = '%s.%d' %(SecNum, Index)
>@@ -74,27 +75,23 @@ class CompressSection (CompressSectionClassObject) :
> if ReturnSectList != []:
> if AlignValue == None:
> AlignValue = "1"
> for FileData in ReturnSectList:
> SectFiles += (FileData,)
>-
>-if MaxAlign != None:
>-if self.Alignment == None:
>-self.Alignment = MaxAlign
>-else:
>-if GenFdsGlobalVariable.GetAlignment (MaxAlign) >
>GenFdsGlobalVariable.GetAlignment (self.Alignment):
>-self.Alignment = MaxAlign
>+SectAlign.append(AlignValue)
>
> OutputFile = OutputPath + \
>  os.sep + \
>  ModuleName + \
>  'SEC'  + \
>  SecNum + \
>  Ffs.SectionSuffix['COMPRESS']
> OutputFile = os.path.normpath(OutputFile)
>+DummyFile = OutputFile + '.dummy'
>+GenFdsGlobalVariable.GenerateSection(DummyFile, SectFiles,
>InputAlign=SectAlign, IsMakefile=IsMakefile)
>
>-GenFdsGlobalVariable.GenerateSection(OutputFile, SectFiles,
>Section.Section.SectionType['COMPRESS'],
>+GenFdsGlobalVariable.GenerateSection(OutputFile, [DummyFile],
>Section.Section.SectionType['COMPRESS'],
>  
> CompressionType=self.CompTypeDict[self.CompType],
>IsMakefile=IsMakefile)
> OutputFileList = []
> OutputFileList.append(OutputFile)
> return OutputFileList, self.Alignment
>
>--
>2.12.2.windows.2

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


Re: [edk2] [PATCH v2 0/7] Remove the useless pref codes

2018-02-09 Thread Bi, Dandan
Thank you star. I will update them before committing the patches.

Thanks,
Dandan

-Original Message-
From: Zeng, Star 
Sent: Friday, February 9, 2018 4:31 PM
To: Bi, Dandan ; edk2-devel@lists.01.org
Cc: Ni, Ruiyu ; Dong, Eric ; Gao, 
Liming ; Laszlo Ersek ; Wei, David 
; Zeng, Star 
Subject: RE: [edk2] [PATCH v2 0/7] Remove the useless pref codes

Hi Dandan,

Two minor comments, with them handled, Reviewed-by: Star Zeng 
 to the patch series. :) 1. Put the first patch to the 
last patch as it is to remove the definition and should be done at last.
2. Fix typo 'pref' to 'perf', and 'new new' to 'new'.


Thanks,
Star
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dandan Bi
Sent: Friday, February 9, 2018 4:05 PM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu ; Dong, Eric ; Gao, 
Liming ; Laszlo Ersek ; Zeng, Star 
; Wei, David 
Subject: [edk2] [PATCH v2 0/7] Remove the useless pref codes

V2:
a. Remove defintions related to old perf code and clean all useless perf codes 
in edk2 code base.
b.Update commit message.

Our new performance infrastructure (edk2 trunk commit hash value:
SHA-1: 73fef64f14d1b97ae9bd4705df3becc022391eba ~
SHA-1: 115eae650bfd2be2c2bc37360f4a755065e774c4) can support to dump 
performance date form ACPI table in OS. So we can remove the old pref code to 
write performance data to OS and related definitions.

Cc: Star Zeng 
Cc: Liming Gao 
Cc: Ruiyu Ni 
Cc: Eric Dong 
Cc: Laszlo Ersek 
Cc: David Wei 
Cc: Mang Guo 
Dandan Bi (7):
  MdeModulePkg/Performance.h: Remove the useless definition
  UefiCpuPkg/S3Resume: Remove useless pref code
  MdeModulePkg/BdsDxe: Remove useless Pref Code
  MdeModulePkg/UefiBootManagerLib: Remove the useless pref codes
  IntelFrameworkModulePkg/BdsDxe: Remove the useless Perf codes
  IntelFrameworkModulePkg/GenericBdsLib: Remove the useless Perf codes
  Vlv2TbltDevicePkg/Override/GenericBdsLib:Remove useless Perf code

 .../Library/GenericBdsLib/BdsBoot.c|  29 +-
 .../Library/GenericBdsLib/GenericBdsLib.inf|   4 +-
 .../Library/GenericBdsLib/InternalBdsLib.h |  19 +-
 .../Library/GenericBdsLib/Performance.c| 313 --
 IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h |   3 +-
 .../Universal/BdsDxe/BdsDxe.inf|   3 +-
 .../Universal/BdsDxe/BdsEntry.c|  57 +---
 MdeModulePkg/Include/Guid/Performance.h|  27 +-
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   |  27 +-
 .../Library/UefiBootManagerLib/BmPerformance.c | 317 --
 .../Library/UefiBootManagerLib/InternalBm.h|  17 -
 .../UefiBootManagerLib/UefiBootManagerLib.inf  |   4 +-
 MdeModulePkg/Universal/BdsDxe/Bds.h|   3 +-
 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf   |   3 +-
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c   |  57 +---
 UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c  | 131 
 .../Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf   |   3 +-
 .../Library/GenericBdsLib/BdsBoot.c|  29 +-
 .../Library/GenericBdsLib/GenericBdsLib.inf|   4 +-
 .../Library/GenericBdsLib/InternalBdsLib.h |  19 +-
 .../Library/GenericBdsLib/Performance.c| 358 -
 21 files changed, 90 insertions(+), 1337 deletions(-)  delete mode 100644 
IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c
 delete mode 100644 MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c
 delete mode 100644 
Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c

--
1.9.5.msysgit.1

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


Re: [edk2] [PATCH v2 0/7] Remove the useless pref codes

2018-02-09 Thread Zeng, Star
Hi Dandan,

Two minor comments, with them handled, Reviewed-by: Star Zeng 
 to the patch series. :)
1. Put the first patch to the last patch as it is to remove the definition and 
should be done at last.
2. Fix typo 'pref' to 'perf', and 'new new' to 'new'.


Thanks,
Star
-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dandan Bi
Sent: Friday, February 9, 2018 4:05 PM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu ; Dong, Eric ; Gao, 
Liming ; Laszlo Ersek ; Zeng, Star 
; Wei, David 
Subject: [edk2] [PATCH v2 0/7] Remove the useless pref codes

V2:
a. Remove defintions related to old perf code and clean all useless perf codes 
in edk2 code base.
b.Update commit message.

Our new performance infrastructure (edk2 trunk commit hash value:
SHA-1: 73fef64f14d1b97ae9bd4705df3becc022391eba ~
SHA-1: 115eae650bfd2be2c2bc37360f4a755065e774c4) can support to dump 
performance date form ACPI table in OS. So we can remove the old pref code to 
write performance data to OS and related definitions.

Cc: Star Zeng 
Cc: Liming Gao 
Cc: Ruiyu Ni 
Cc: Eric Dong 
Cc: Laszlo Ersek 
Cc: David Wei 
Cc: Mang Guo 
Dandan Bi (7):
  MdeModulePkg/Performance.h: Remove the useless definition
  UefiCpuPkg/S3Resume: Remove useless pref code
  MdeModulePkg/BdsDxe: Remove useless Pref Code
  MdeModulePkg/UefiBootManagerLib: Remove the useless pref codes
  IntelFrameworkModulePkg/BdsDxe: Remove the useless Perf codes
  IntelFrameworkModulePkg/GenericBdsLib: Remove the useless Perf codes
  Vlv2TbltDevicePkg/Override/GenericBdsLib:Remove useless Perf code

 .../Library/GenericBdsLib/BdsBoot.c|  29 +-
 .../Library/GenericBdsLib/GenericBdsLib.inf|   4 +-
 .../Library/GenericBdsLib/InternalBdsLib.h |  19 +-
 .../Library/GenericBdsLib/Performance.c| 313 --
 IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h |   3 +-
 .../Universal/BdsDxe/BdsDxe.inf|   3 +-
 .../Universal/BdsDxe/BdsEntry.c|  57 +---
 MdeModulePkg/Include/Guid/Performance.h|  27 +-
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   |  27 +-
 .../Library/UefiBootManagerLib/BmPerformance.c | 317 --
 .../Library/UefiBootManagerLib/InternalBm.h|  17 -
 .../UefiBootManagerLib/UefiBootManagerLib.inf  |   4 +-
 MdeModulePkg/Universal/BdsDxe/Bds.h|   3 +-
 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf   |   3 +-
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c   |  57 +---
 UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c  | 131 
 .../Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf   |   3 +-
 .../Library/GenericBdsLib/BdsBoot.c|  29 +-
 .../Library/GenericBdsLib/GenericBdsLib.inf|   4 +-
 .../Library/GenericBdsLib/InternalBdsLib.h |  19 +-
 .../Library/GenericBdsLib/Performance.c| 358 -
 21 files changed, 90 insertions(+), 1337 deletions(-)  delete mode 100644 
IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c
 delete mode 100644 MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c
 delete mode 100644 
Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c

--
1.9.5.msysgit.1

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


[edk2] [PATCH v2 4/7] MdeModulePkg/UefiBootManagerLib: Remove the useless pref codes

2018-02-09 Thread Dandan Bi
V2: Just update the commit message to reference the hash value of
new new performance infrastructure.

Our new performance infrastructure (edk2 trunk commit hash value:
SHA-1: 73fef64f14d1b97ae9bd4705df3becc022391eba ~
SHA-1: 115eae650bfd2be2c2bc37360f4a755065e774c4) can support to
dump performance date form ACPI table in OS. So we can remove
the old pref code to write performance data to OS.

Cc: Liming Gao 
Cc: Ruiyu Ni 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
Reviewed-by: Ruiyu Ni 
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   |  27 +-
 .../Library/UefiBootManagerLib/BmPerformance.c | 317 -
 .../Library/UefiBootManagerLib/InternalBm.h|  17 --
 .../UefiBootManagerLib/UefiBootManagerLib.inf  |   4 +-
 4 files changed, 26 insertions(+), 339 deletions(-)
 delete mode 100644 MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 6404233..ce19ae4 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -26,10 +26,33 @@ EFI_BOOT_MANAGER_LEGACY_BOOT mBmLegacyBoot  
= NULL;
 ///
 EFI_GUID mBmHardDriveBootVariableGuid = { 0xfab7e9e1, 0x39dd, 0x4f2b, { 0x84, 
0x08, 0xe2, 0x0e, 0x90, 0x6c, 0xb6, 0xde } };
 EFI_GUID mBmAutoCreateBootOptionGuid  = { 0x8108ac4e, 0x9f11, 0x4d59, { 0x85, 
0x0e, 0xe2, 0x1a, 0x52, 0x2c, 0x59, 0xb2 } };
 
 /**
+
+  End Perf entry of BDS
+
+  @param  Event The triggered event.
+  @param  Context   Context for this event.
+
+**/
+VOID
+EFIAPI
+BmEndOfBdsPerfCode (
+  IN EFI_EVENT  Event,
+  IN VOID   *Context
+  )
+{
+  //
+  // Record the performance data for End of BDS
+  //
+  PERF_END(NULL, "BDS", NULL, 0);
+
+  return ;
+}
+
+/**
   The function registers the legacy boot support capabilities.
 
   @param RefreshLegacyBootOption The function pointer to create all the legacy 
boot options.
   @param LegacyBoot  The function pointer to boot the legacy boot 
option.
 **/
@@ -1828,11 +1851,11 @@ EfiBootManagerBoot (
 //
 // Create an event to be signalled when Legacy Boot occurs to write 
performance data.
 //
 Status = EfiCreateEventLegacyBootEx(
TPL_NOTIFY,
-   BmWriteBootToOsPerformanceData,
+   BmEndOfBdsPerfCode,
NULL, 

);
 ASSERT_EFI_ERROR (Status);
   );
@@ -1869,11 +1892,11 @@ EfiBootManagerBoot (
 
   //
   // Write boot to OS performance data for UEFI boot
   //
   PERF_CODE (
-BmWriteBootToOsPerformanceData (NULL, NULL);
+BmEndOfBdsPerfCode (NULL, NULL);
   );
 
   REPORT_STATUS_CODE (EFI_PROGRESS_CODE, PcdGet32 
(PcdProgressCodeOsLoaderStart));
 
   Status = gBS->StartImage (ImageHandle, >ExitDataSize, 
>ExitData);
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c
deleted file mode 100644
index 4d4495b..000
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/** @file
-  This file include the file which can help to get the system
-  performance, all the function will only include if the performance
-  switch is set.
-
-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
-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 "InternalBm.h"
-
-PERF_HEADER   mBmPerfHeader;
-PERF_DATA mBmPerfData;
-EFI_PHYSICAL_ADDRESS  mBmAcpiLowMemoryBase = 0x0ULL;
-
-/**
-  Get the short verion of PDB file name to be
-  used in performance data logging.
-
-  @param PdbFileName The long PDB file name.
-  @param GaugeString The output string to be logged by performance logger.
-  @param StringSize  The buffer size of GaugeString in bytes.
-
-**/
-VOID
-BmGetShortPdbFileName (
-  IN  CONST CHAR8  *PdbFileName,
-  OUT   CHAR8  *GaugeString,
-  INUINTN   StringSize
-  )
-{
-  UINTN Index;
-  UINTN Index1;
-  UINTN StartIndex;
-  UINTN EndIndex;
-
-  if (PdbFileName == NULL) {
-AsciiStrCpyS (GaugeString, StringSize, " ");
-  } else {
-StartIndex = 0;
-for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)
-  ;
-
-for (Index = 0; PdbFileName[Index] != 0; Index++) {
-  if 

[edk2] [PATCH v2 2/7] UefiCpuPkg/S3Resume: Remove useless pref code

2018-02-09 Thread Dandan Bi
V2: Just update the commit message to reference the hash value of
new new performance infrastructure.

Our new performance infrastructure (edk2 trunk commit hash value:
SHA-1: 73fef64f14d1b97ae9bd4705df3becc022391eba ~
SHA-1: 115eae650bfd2be2c2bc37360f4a755065e774c4)can support to
dump performance date form ACPI table in OS. So we can remove
the old pref code to write performance data to OS.

Cc: Eric Dong 
Cc: Laszlo Ersek 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
Reviewed-by: Laszlo Ersek 
---
 UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c  | 131 -
 .../Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf   |   3 +-
 2 files changed, 1 insertion(+), 133 deletions(-)

diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c 
b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
index d7d2a4d..4d77689 100644
--- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
+++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c
@@ -20,11 +20,10 @@
 
 #include 
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
@@ -284,136 +283,10 @@ GLOBAL_REMOVE_IF_UNREFERENCED IA32_GDT mGdtEntries[] = {
 GLOBAL_REMOVE_IF_UNREFERENCED CONST IA32_DESCRIPTOR mGdt = {
   sizeof (mGdtEntries) - 1,
   (UINTN) mGdtEntries
   };
 
-/**
-  Performance measure function to get S3 detailed performance data.
-
-  This function will getS3 detailed performance data and saved in pre-reserved 
ACPI memory.
-**/
-VOID
-WriteToOsS3PerformanceData (
-  VOID
-  )
-{
-  EFI_STATUSStatus;
-  EFI_PHYSICAL_ADDRESS  mAcpiLowMemoryBase;
-  PERF_HEADER   *PerfHeader;
-  PERF_DATA *PerfData;
-  UINT64Ticker;
-  UINTN Index;
-  EFI_PEI_READ_ONLY_VARIABLE2_PPI   *VariableServices;
-  UINTN VarSize;
-  UINTN LogEntryKey;
-  CONST VOID*Handle;
-  CONST CHAR8   *Token;
-  CONST CHAR8   *Module;
-  UINT64StartTicker;
-  UINT64EndTicker;
-  UINT64StartValue;
-  UINT64EndValue;
-  BOOLEAN   CountUp;
-  UINT64Freq;
-
-  //
-  // Retrieve time stamp count as early as possible
-  //
-  Ticker = GetPerformanceCounter ();
-
-  Freq   = GetPerformanceCounterProperties (, );
-
-  Freq   = DivU64x32 (Freq, 1000);
-
-  Status = PeiServicesLocatePpi (
- ,
- 0,
- NULL,
- (VOID **) 
- );
-  if (EFI_ERROR (Status)) {
-return;
-  }
-
-  VarSize   = sizeof (EFI_PHYSICAL_ADDRESS);
-  Status = VariableServices->GetVariable (
-   VariableServices,
-   L"PerfDataMemAddr",
-   ,
-   NULL,
-   ,
-   
-   );
-  if (EFI_ERROR (Status)) {
-DEBUG ((EFI_D_ERROR, "Fail to retrieve variable to log S3 performance data 
\n"));
-return;
-  }
-
-  PerfHeader = (PERF_HEADER *) (UINTN) mAcpiLowMemoryBase;
-
-  if (PerfHeader->Signiture != PERFORMANCE_SIGNATURE) {
-DEBUG ((EFI_D_ERROR, "Performance data in ACPI memory get corrupted! \n"));
-return;
-  }
-
-  //
-  // Record total S3 resume time.
-  //
-  if (EndValue >= StartValue) {
-PerfHeader->S3Resume = Ticker - StartValue;
-CountUp  = TRUE;
-  } else {
-PerfHeader->S3Resume = StartValue - Ticker;
-CountUp  = FALSE;
-  }
-
-  //
-  // Get S3 detailed performance data
-  //
-  Index = 0;
-  LogEntryKey = 0;
-  while ((LogEntryKey = GetPerformanceMeasurement (
-  LogEntryKey,
-  ,
-  ,
-  ,
-  ,
-  )) != 0) {
-if (EndTicker != 0) {
-  PerfData = >S3Entry[Index];
-
-  //
-  // Use File Handle to specify the different performance log for PEIM.
-  // File Handle is the base address of PEIM FFS file.
-  //
-  if ((AsciiStrnCmp (Token, "PEIM", PEI_PERFORMANCE_STRING_SIZE) == 0) && 
(Handle != NULL)) {
-AsciiSPrint (PerfData->Token, PERF_TOKEN_LENGTH, "0x%11p", Handle);
-  } else {
-AsciiStrnCpyS (PerfData->Token, PERF_TOKEN_SIZE, Token, 
PERF_TOKEN_LENGTH);
-  }
-  if (StartTicker == 1) {
-StartTicker 

[edk2] [PATCH v2 3/7] MdeModulePkg/BdsDxe: Remove useless Pref Code

2018-02-09 Thread Dandan Bi
V2: Just update the commit message to reference the hash value of
new new performance infrastructure.

Our new performance infrastructure (edk2 trunk commit hash value:
SHA-1: 73fef64f14d1b97ae9bd4705df3becc022391eba ~
SHA-1: 115eae650bfd2be2c2bc37360f4a755065e774c4) can support to
dump performance date form ACPI table in OS. So we can remove
the old pref code to write performance data to OS.

Cc: Liming Gao 
Cc: Ruiyu Ni 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
Reviewed-by: Ruiyu Ni 
---
 MdeModulePkg/Universal/BdsDxe/Bds.h  |  3 +-
 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  3 +-
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 57 +---
 3 files changed, 3 insertions(+), 60 deletions(-)

diff --git a/MdeModulePkg/Universal/BdsDxe/Bds.h 
b/MdeModulePkg/Universal/BdsDxe/Bds.h
index 5658e61..63d961f 100644
--- a/MdeModulePkg/Universal/BdsDxe/Bds.h
+++ b/MdeModulePkg/Universal/BdsDxe/Bds.h
@@ -1,9 +1,9 @@
 /** @file
   Head file for BDS Architectural Protocol implementation
 
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 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
 http://opensource.org/licenses/bsd-license.php
 
@@ -16,11 +16,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #define _BDS_MODULE_H_
 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
 #include 
 #include 
diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf 
b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
index a00b442..b8c5aa9 100644
--- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
@@ -3,11 +3,11 @@
 #
 #  When DxeCore dispatching all DXE driver, this module will produce 
architecture protocol 
 #  gEfiBdsArchProtocolGuid. After DxeCore finish dispatching, DxeCore will 
invoke Entry
 #  interface of protocol gEfiBdsArchProtocolGuid, then BDS phase is entered.
 #  
-#  Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2008 - 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
 #  http://opensource.org/licenses/bsd-license.php
 #
@@ -76,11 +76,10 @@
 ## SOMETIMES_CONSUMES ## 
Variable:L"ConIn" (The device path of console in device)
 ## SOMETIMES_CONSUMES ## 
Variable:L"ConOut" (The device path of console out device)
 ## SOMETIMES_CONSUMES ## 
Variable:L"ErrOut" (The device path of error out device)
   gConnectConInEventGuid## SOMETIMES_CONSUMES ## Event
   gEdkiiStatusCodeDataTypeVariableGuid  ## SOMETIMES_CONSUMES ## GUID
-  gPerformanceProtocolGuid  ## SOMETIMES_PRODUCES ## 
Variable:L"PerfDataMemAddr" (The ACPI address of performance data)
   gEfiEventReadyToBootGuid  ## CONSUMES   ## Event
 
 [Protocols]
   gEfiBdsArchProtocolGuid   ## PRODUCES
   gEfiSimpleTextInputExProtocolGuid ## CONSUMES
diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c 
b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
index 2b24755..3191a98 100644
--- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
+++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
@@ -3,11 +3,11 @@
   When this module was dispatched by DxeCore, gEfiBdsArchProtocolGuid will be 
installed
   which contains interface of BdsEntry.
   After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will be 
invoked
   to enter BDS phase.
 
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP
 (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
 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
@@ -633,61 +633,10 @@ BdsFormalizeEfiGlobalVariable (
   //
   BdsFormalizeOSIndicationVariable ();
 }
 
 /**
-
-  Allocate a block of memory that will contain performance data to OS.
-
-**/
-VOID
-BdsAllocateMemoryForPerformanceData (
-  VOID
-  )
-{
-  EFI_STATUSStatus;
-  EFI_PHYSICAL_ADDRESS  AcpiLowMemoryBase;
-  EDKII_VARIABLE_LOCK_PROTOCOL  

[edk2] [PATCH v2 5/7] IntelFrameworkModulePkg/BdsDxe: Remove the useless Perf codes

2018-02-09 Thread Dandan Bi
Our new performance infrastructure (edk2 trunk commit hash value:
SHA-1: 73fef64f14d1b97ae9bd4705df3becc022391eba ~
SHA-1: 115eae650bfd2be2c2bc37360f4a755065e774c4) can support to
dump performance date form ACPI table in OS. So we can remove
the old pref code to write performance data to OS.

Cc: Liming Gao 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h |  3 +-
 .../Universal/BdsDxe/BdsDxe.inf|  3 +-
 .../Universal/BdsDxe/BdsEntry.c| 57 +-
 3 files changed, 3 insertions(+), 60 deletions(-)

diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h 
b/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h
index 93bafd2..beb9226 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h
@@ -1,9 +1,9 @@
 /** @file
   Head file for BDS Architectural Protocol implementation
 
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 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
 http://opensource.org/licenses/bsd-license.php
 
@@ -34,11 +34,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf 
b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
index 95a707c..92a4737 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
@@ -12,11 +12,11 @@
 #  EFI\BOOT\BOOTIA64.EFI file from selected boot device and transfer control 
to boot loader.
 #
 #  BDSDxe also maintain the UI for "Boot Manager, Boot Maintaince Manager, 
Device Manager" which
 #  is used for user to configure boot option or maintain hardware device.
 #  
-#  Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.
+#  Copyright (c) 2008 - 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
 #  http://opensource.org/licenses/bsd-license.php
 #  
@@ -155,11 +155,10 @@
   ## SOMETIMES_CONSUMES ## Event
   gConnectConInEventGuid
   gEfiFmpCapsuleGuid## SOMETIMES_CONSUMES ## GUID 
# FMP Capsule
   gEdkiiStatusCodeDataTypeVariableGuid  ## SOMETIMES_CONSUMES ## GUID
   gEfiUartDevicePathGuid## SOMETIMES_CONSUMES ## GUID 
(Identify the device path for UARD device)
-  gPerformanceProtocolGuid  ## SOMETIMES_PRODUCES ## 
Variable:L"PerfDataMemAddr" (The ACPI address of performance data)
 
 [Protocols]
   gEfiSimpleFileSystemProtocolGuid  ## SOMETIMES_CONSUMES
   gEfiLoadFileProtocolGuid  ## SOMETIMES_CONSUMES
   gEfiBdsArchProtocolGuid   ## PRODUCES
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c 
b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
index 6e3e5b0..9c5a91b 100644
--- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
+++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c
@@ -3,11 +3,11 @@
   When this module was dispatched by DxeCore, gEfiBdsArchProtocolGuid will be 
installed
   which contains interface of BdsEntry.
   After DxeCore finish DXE phase, gEfiBdsArchProtocolGuid->BdsEntry will be 
invoked
   to enter BDS phase.
 
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 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
 http://opensource.org/licenses/bsd-license.php
 
@@ -443,61 +443,10 @@ BdsFormalizeEfiGlobalVariable (
 
 }
 
 /**
 
-  Allocate a block of memory that will contain performance data to OS.
-
-**/
-VOID
-BdsAllocateMemoryForPerformanceData (
-  VOID
-  )
-{
-  EFI_STATUSStatus;
-  EFI_PHYSICAL_ADDRESS  AcpiLowMemoryBase;
-  EDKII_VARIABLE_LOCK_PROTOCOL  *VariableLock;
-
-  AcpiLowMemoryBase = 0x0ULL;
-
-  //
-  // Allocate a block of memory that will contain performance data to OS.
-  //
-  Status = gBS->AllocatePages (
-  AllocateMaxAddress,
-  EfiReservedMemoryType,
-  EFI_SIZE_TO_PAGES (PERF_DATA_MAX_LENGTH),
-   

[edk2] [PATCH] BaseTool: correct the generate compress section process

2018-02-09 Thread Feng, YunhuaX
First generate a dummy file with section alignment,
then compress the dummy file to generate the compress file

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/GenFds/CompressSection.py | 13 +
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py 
b/BaseTools/Source/Python/GenFds/CompressSection.py
index 98532ed8e6..56e71a3545 100644
--- a/BaseTools/Source/Python/GenFds/CompressSection.py
+++ b/BaseTools/Source/Python/GenFds/CompressSection.py
@@ -58,10 +58,11 @@ class CompressSection (CompressSectionClassObject) :
 if FfsInf != None:
 self.CompType = FfsInf.__ExtendMacro__(self.CompType)
 self.Alignment = FfsInf.__ExtendMacro__(self.Alignment)
 
 SectFiles = tuple()
+SectAlign = []
 Index = 0
 MaxAlign = None
 for Sect in self.SectionList:
 Index = Index + 1
 SecIndex = '%s.%d' %(SecNum, Index)
@@ -74,27 +75,23 @@ class CompressSection (CompressSectionClassObject) :
 if ReturnSectList != []:
 if AlignValue == None:
 AlignValue = "1"
 for FileData in ReturnSectList:
 SectFiles += (FileData,)
-
-if MaxAlign != None:
-if self.Alignment == None:
-self.Alignment = MaxAlign
-else:
-if GenFdsGlobalVariable.GetAlignment (MaxAlign) > 
GenFdsGlobalVariable.GetAlignment (self.Alignment):
-self.Alignment = MaxAlign
+SectAlign.append(AlignValue)
 
 OutputFile = OutputPath + \
  os.sep + \
  ModuleName + \
  'SEC'  + \
  SecNum + \
  Ffs.SectionSuffix['COMPRESS']
 OutputFile = os.path.normpath(OutputFile)
+DummyFile = OutputFile + '.dummy'
+GenFdsGlobalVariable.GenerateSection(DummyFile, SectFiles, 
InputAlign=SectAlign, IsMakefile=IsMakefile)
 
-GenFdsGlobalVariable.GenerateSection(OutputFile, SectFiles, 
Section.Section.SectionType['COMPRESS'],
+GenFdsGlobalVariable.GenerateSection(OutputFile, [DummyFile], 
Section.Section.SectionType['COMPRESS'],
  
CompressionType=self.CompTypeDict[self.CompType], IsMakefile=IsMakefile)
 OutputFileList = []
 OutputFileList.append(OutputFile)
 return OutputFileList, self.Alignment
 
-- 
2.12.2.windows.2

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


[edk2] [PATCH v2 6/7] IntelFrameworkModulePkg/GenericBdsLib: Remove the useless Perf codes

2018-02-09 Thread Dandan Bi
Our new performance infrastructure (edk2 trunk commit hash value:
SHA-1: 73fef64f14d1b97ae9bd4705df3becc022391eba ~
SHA-1: 115eae650bfd2be2c2bc37360f4a755065e774c4) can support to
dump performance date form ACPI table in OS. So we can remove
the old pref code to write performance data to OS.

Cc: Liming Gao 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 .../Library/GenericBdsLib/BdsBoot.c|  29 +-
 .../Library/GenericBdsLib/GenericBdsLib.inf|   4 +-
 .../Library/GenericBdsLib/InternalBdsLib.h |  19 +-
 .../Library/GenericBdsLib/Performance.c| 313 -
 4 files changed, 28 insertions(+), 337 deletions(-)
 delete mode 100644 IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c

diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c 
b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
index d1da635..9c2d592 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
@@ -1,9 +1,9 @@
 /** @file
   BDS Lib functions which relate with create or process the boot option.
 
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 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
 http://opensource.org/licenses/bsd-license.php
 
@@ -17,10 +17,33 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 
 BOOLEAN mEnumBootDevice = FALSE;
 EFI_HII_HANDLE gBdsLibStringPackHandle = NULL;
 
 /**
+
+  End Perf entry of BDS
+
+  @param  Event The triggered event.
+  @param  Context   Context for this event.
+
+**/
+VOID
+EFIAPI
+BmEndOfBdsPerfCode (
+  IN EFI_EVENT  Event,
+  IN VOID   *Context
+  )
+{
+  //
+  // Record the performance data for End of BDS
+  //
+  PERF_END(NULL, "BDS", NULL, 0);
+
+  return ;
+}
+
+/**
   The constructor function register UNI strings into imageHandle.
   
   It will ASSERT() if that operation fails and it will always return 
EFI_SUCCESS. 
 
   @param  ImageHandle   The firmware allocated handle for the EFI image.
@@ -1693,11 +1716,11 @@ BdsLibDoLegacyBoot (
 //
 // Create an event to be signalled when Legacy Boot occurs to write 
performance data.
 //
 Status = EfiCreateEventLegacyBootEx(
TPL_NOTIFY,
-   WriteBootToOsPerformanceData,
+   BmEndOfBdsPerfCode,
NULL, 

);
 ASSERT_EFI_ERROR (Status);
   );
@@ -2423,11 +2446,11 @@ BdsLibBootViaBootOption (
 
   //
   // Write boot to OS performance data for UEFI boot
   //
   PERF_CODE (
-WriteBootToOsPerformanceData (NULL, NULL);
+BmEndOfBdsPerfCode (NULL, NULL);
   );
 
   //
   // Report status code for OS Loader StartImage.
   //
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf 
b/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
index 9d879c2..a9e0f51 100644
--- a/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
+++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
@@ -4,11 +4,11 @@
 #  General BDS defines and produce general interfaces for platform BDS driver 
including:
 #  1) BDS boot policy interface;
 #  2) BDS boot device connect interface;
 #  3) BDS Misc interfaces for mainting boot variable, ouput string, etc.
 #  
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+#  Copyright (c) 2007 - 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
 #  http://opensource.org/licenses/bsd-license.php
 #  
@@ -33,11 +33,10 @@
 #  VALID_ARCHITECTURES   = IA32 X64 IPF EBC
 #
 
 [Sources]
   DevicePath.c
-  Performance.c
   BdsConnect.c
   BdsMisc.c
   BdsConsole.c
   BdsBoot.c
   InternalBdsLib.h
@@ -94,11 +93,10 @@
   ## SOMETIMES_PRODUCES ## Variable:L"ErrOut"  # The device path of error 
out device
   ## SOMETIMES_PRODUCES ## Variable:L"BootCurrent" # The boot option of 
current boot
   ## SOMETIMES_PRODUCES ## Variable:L"BootNext"# The number of next boot 
option
   gEfiGlobalVariableGuid
   gEfiFileInfoGuid  ## SOMETIMES_CONSUMES ## GUID
-  gPerformanceProtocolGuid  ## SOMETIMES_CONSUMES ## 
Variable:L"PerfDataMemAddr" # The ACPI address of performance data
   gLastEnumLangGuid ## SOMETIMES_PRODUCES ## 
Variable:L"LastEnumLang" # Platform language at last time 

[edk2] [PATCH v2 0/7] Remove the useless pref codes

2018-02-09 Thread Dandan Bi
V2:
a. Remove defintions related to old perf code and clean all
useless perf codes in edk2 code base.
b.Update commit message.

Our new performance infrastructure (edk2 trunk commit hash value:
SHA-1: 73fef64f14d1b97ae9bd4705df3becc022391eba ~
SHA-1: 115eae650bfd2be2c2bc37360f4a755065e774c4) can support to
dump performance date form ACPI table in OS. So we can remove the
old pref code to write performance data to OS and related definitions.

Cc: Star Zeng 
Cc: Liming Gao 
Cc: Ruiyu Ni 
Cc: Eric Dong 
Cc: Laszlo Ersek 
Cc: David Wei 
Cc: Mang Guo 
Dandan Bi (7):
  MdeModulePkg/Performance.h: Remove the useless definition
  UefiCpuPkg/S3Resume: Remove useless pref code
  MdeModulePkg/BdsDxe: Remove useless Pref Code
  MdeModulePkg/UefiBootManagerLib: Remove the useless pref codes
  IntelFrameworkModulePkg/BdsDxe: Remove the useless Perf codes
  IntelFrameworkModulePkg/GenericBdsLib: Remove the useless Perf codes
  Vlv2TbltDevicePkg/Override/GenericBdsLib:Remove useless Perf code

 .../Library/GenericBdsLib/BdsBoot.c|  29 +-
 .../Library/GenericBdsLib/GenericBdsLib.inf|   4 +-
 .../Library/GenericBdsLib/InternalBdsLib.h |  19 +-
 .../Library/GenericBdsLib/Performance.c| 313 --
 IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h |   3 +-
 .../Universal/BdsDxe/BdsDxe.inf|   3 +-
 .../Universal/BdsDxe/BdsEntry.c|  57 +---
 MdeModulePkg/Include/Guid/Performance.h|  27 +-
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c   |  27 +-
 .../Library/UefiBootManagerLib/BmPerformance.c | 317 --
 .../Library/UefiBootManagerLib/InternalBm.h|  17 -
 .../UefiBootManagerLib/UefiBootManagerLib.inf  |   4 +-
 MdeModulePkg/Universal/BdsDxe/Bds.h|   3 +-
 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf   |   3 +-
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c   |  57 +---
 UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c  | 131 
 .../Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf   |   3 +-
 .../Library/GenericBdsLib/BdsBoot.c|  29 +-
 .../Library/GenericBdsLib/GenericBdsLib.inf|   4 +-
 .../Library/GenericBdsLib/InternalBdsLib.h |  19 +-
 .../Library/GenericBdsLib/Performance.c| 358 -
 21 files changed, 90 insertions(+), 1337 deletions(-)
 delete mode 100644 IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c
 delete mode 100644 MdeModulePkg/Library/UefiBootManagerLib/BmPerformance.c
 delete mode 100644 
Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/Performance.c

-- 
1.9.5.msysgit.1

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


[edk2] [PATCH v2 1/7] MdeModulePkg/Performance.h: Remove the useless definition

2018-02-09 Thread Dandan Bi
Remove the definitions related to old perf codes.

Cc: Star Zeng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 MdeModulePkg/Include/Guid/Performance.h | 27 +--
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/MdeModulePkg/Include/Guid/Performance.h 
b/MdeModulePkg/Include/Guid/Performance.h
index df40c6c..6e21ed0 100644
--- a/MdeModulePkg/Include/Guid/Performance.h
+++ b/MdeModulePkg/Include/Guid/Performance.h
@@ -2,11 +2,11 @@
   This file defines performance-related definitions, including the format of:
   * performance GUID HOB.
   * performance protocol interfaces.
   * performance variables.  
 
-Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2009 - 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.

 
@@ -49,35 +49,10 @@ typedef struct {
   UINT32NumberOfEntries;  ///< The number of all performance 
log entries.
   UINT32Reserved;
 } PEI_PERFORMANCE_LOG_HEADER;
 
 
-//
-// The data structure for performance data in ACPI memory.
-//
-#define PERFORMANCE_SIGNATURE   SIGNATURE_32 ('P', 'e', 'r', 'f')
-#define PERF_TOKEN_SIZE 28
-#define PERF_TOKEN_LENGTH   (PERF_TOKEN_SIZE - 1)
-#define PERF_PEI_ENTRY_MAX_NUM  50
-#define PERF_DATA_MAX_LENGTH0x4000
-
-typedef struct {
-  CHAR8   Token[PERF_TOKEN_SIZE];
-  UINT32  Duration;
-} PERF_DATA;
-
-typedef struct {
-  UINT64BootToOs;
-  UINT64S3Resume;
-  UINT32S3EntryNum;
-  PERF_DATA S3Entry[PERF_PEI_ENTRY_MAX_NUM];
-  UINT64CpuFreq;
-  UINT64BDSRaw;
-  UINT32Count;
-  UINT32Signiture;
-} PERF_HEADER;
-
 #define PERFORMANCE_PROTOCOL_GUID \
   { 0x76b6bdfa, 0x2acd, 0x4462, { 0x9E, 0x3F, 0xcb, 0x58, 0xC9, 0x69, 0xd9, 
0x37 } }
 
 #define PERFORMANCE_EX_PROTOCOL_GUID \
   { 0x1ea81bec, 0xf01a, 0x4d98, { 0xa2, 0x1,  0x4a, 0x61, 0xce, 0x2f, 0xc0, 
0x22 } }
-- 
1.9.5.msysgit.1

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


[edk2] [patch] MdeModulePkg/PerfLib: Add NULL pointer check for "Token"

2018-02-09 Thread Dandan Bi
"Token" is passed through the perf entry, it's may be NULL.
So we need to add NULL pointer check before reference it.

Cc: Liming Gao 
Cc: Star Zeng 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi 
---
 MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 6 +-
 MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c | 6 +-
 MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c | 6 +-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index 8363b0e..9b3224e 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
@@ -113,10 +113,14 @@ Check whether the Token is a known one which is uesed by 
core.
 BOOLEAN
 IsKnownTokens (
   IN CONST CHAR8  *Token
   )
 {
+  if (Token == NULL) {
+return FALSE;
+  }
+
   if (AsciiStrCmp (Token, SEC_TOK) == 0 ||
   AsciiStrCmp (Token, PEI_TOK) == 0 ||
   AsciiStrCmp (Token, DXE_TOK) == 0 ||
   AsciiStrCmp (Token, BDS_TOK) == 0 ||
   AsciiStrCmp (Token, DRIVERBINDING_START_TOK) == 0 ||
@@ -845,11 +849,11 @@ InsertFpdtMeasurement (
 return Status;
   }
 
   //
   // If PERF_START()/PERF_END() have specified the ProgressID,it has high 
priority.
-  // !!! Note: If the Pref is not the known Token used in the core but have 
same
+  // !!! Note: If the Perf is not the known Token used in the core but have 
same
   // ID with the core Token, this case will not be supported.
   // And in currtnt usage mode, for the unkown ID, there is a general rule:
   // If it is start pref: the lower 4 bits of the ID should be 0.
   // If it is end pref: the lower 4 bits of the ID should not be 0.
   // If input ID doesn't follow the rule, we will adjust it.
diff --git a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c 
b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
index 79b67e8..f770a35 100644
--- a/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
+++ b/MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.c
@@ -47,10 +47,14 @@ Check whether the Token is a known one which is uesed by 
core.
 BOOLEAN
 IsKnownTokens (
   IN CONST CHAR8  *Token
   )
 {
+  if (Token == NULL) {
+return FALSE;
+  }
+
   if (AsciiStrCmp (Token, SEC_TOK) == 0 ||
   AsciiStrCmp (Token, PEI_TOK) == 0 ||
   AsciiStrCmp (Token, DXE_TOK) == 0 ||
   AsciiStrCmp (Token, BDS_TOK) == 0 ||
   AsciiStrCmp (Token, DRIVERBINDING_START_TOK) == 0 ||
@@ -264,11 +268,11 @@ InsertPeiFpdtMeasurement (
 return Status;
   }
 
   //
   // If PERF_START()/PERF_END() have specified the ProgressID,it has high 
priority.
-  // !!! Note: If the Pref is not the known Token used in the core but have 
same
+  // !!! Note: If the Perf is not the known Token used in the core but have 
same
   // ID with the core Token, this case will not be supported.
   // And in currtnt usage mode, for the unkown ID, there is a general rule:
   // If it is start pref: the lower 4 bits of the ID should be 0.
   // If it is end pref: the lower 4 bits of the ID should not be 0.
   // If input ID doesn't follow the rule, we will adjust it.
diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c 
b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
index 2834a68..dbc1166 100644
--- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
+++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c
@@ -83,10 +83,14 @@ Check whether the Token is a known one which is uesed by 
core.
 BOOLEAN
 IsKnownTokens (
   IN CONST CHAR8  *Token
   )
 {
+  if (Token == NULL) {
+return FALSE;
+  }
+
   if (AsciiStrCmp (Token, SEC_TOK) == 0 ||
   AsciiStrCmp (Token, PEI_TOK) == 0 ||
   AsciiStrCmp (Token, DXE_TOK) == 0 ||
   AsciiStrCmp (Token, BDS_TOK) == 0 ||
   AsciiStrCmp (Token, DRIVERBINDING_START_TOK) == 0 ||
@@ -495,11 +499,11 @@ InsertFpdtMeasurement (
 return Status;
   }
 
   //
   // If PERF_START()/PERF_END() have specified the ProgressID,it has high 
priority.
-  // !!! Note: If the Pref is not the known Token used in the core but have 
same
+  // !!! Note: If the Perf is not the known Token used in the core but have 
same
   // ID with the core Token, this case will not be supported.
   // And in currtnt usage mode, for the unkown ID, there is a general rule:
   // If it is start pref: the lower 4 bits of the ID should be 0.
   // If it is end pref: the lower 4 bits of the ID should not be 0.
   // If input ID doesn't follow the rule, we will adjust it.
-- 
1.9.5.msysgit.1

___
edk2-devel mailing list
edk2-devel@lists.01.org