Re: [edk2] [edk2-test] SctPkg compilation is failing

2019-03-19 Thread Supreeth Venkatesh
Hi Meenakshi,

I was able to reproduce this error.
This is because a change in the edk2 file 
BaseTools/Source/C/Makefiles/app.makefile
which was using relative path to make it work with absolute path.
This fix is present in latest edk2 versions already.
Hence, as indicated earlier I will update build instructions so as to point to 
edk2-stable201903 tag in the next few days.

Assuming you are using UDK2017 still, please replace relative path to absolute 
path in your edk2 source and you will be able to compile.

Diff details below.

tmp/sct_workspace/edk2$ git diff

diff --git a/BaseTools/Source/C/Makefiles/app.makefile 
b/BaseTools/Source/C/Makefiles/app.makefile
index e414551b4a..6017b2dd59 100644
--- a/BaseTools/Source/C/Makefiles/app.makefile
+++ b/BaseTools/Source/C/Makefiles/app.makefile
@@ -23,6 +23,6 @@ all: $(MAKEROOT)/bin $(APPLICATION)
$(APPLICATION): $(OBJECTS)
$(LINKER) -o $(APPLICATION) $(BUILD_LFLAGS) $(OBJECTS) 
-L$(MAKEROOT)/libs $(LIBS)

-$(OBJECTS): ../Include/Common/BuildVersion.h
+$(OBJECTS): $(MAKEROOT)/Include/Common/BuildVersion.h

Thanks,
Supreeth
From: Meenakshi Aggarwal 
Sent: Tuesday, March 19, 2019 12:19 AM
To: Supreeth Venkatesh ; edk2-devel@lists.01.org
Cc: Dong Wei ; Jin, Eric ; Udit Kumar 
; Varun Sethi 
Subject: RE: [edk2-test] SctPkg compilation is failing

Hi Supreeth,

I tried the step suggested by you, but still facing error:

meenakshi@uefi-OptiPlex-790:~/SCT/edk2/SctPkg$ export 
EDK_TOOLS_PATH="/home/meenakshi/SCT/edk2/BaseTools"
meenakshi@uefi-OptiPlex-790:~/SCT/edk2/SctPkg$ rm -f 
$EDK_TOOLS_PATH/Source/C/bin/GenBin
meenakshi@uefi-OptiPlex-790:~/SCT/edk2/SctPkg$ cd ..
meenakshi@uefi-OptiPlex-790:~/SCT/edk2$ ./SctPkg/build.sh AARCH64 GCC
Target: AARCH64
Build: other
TOOLCHAIN is GCC49
Toolchain prefix: GCC49_AARCH64_PREFIX=aarch64-linux-gnu-
Building from: /home/meenakshi/SCT/edk2
using prebuilt tools
Building GenBin
make: Entering directory 
`/home/meenakshi/SCT/edk2-test/uefi-sct/SctPkg/Tools/Source/GenBin'
make: *** No rule to make target `../Include/Common/BuildVersion.h', needed by 
`GenBin.o'.  Stop.
make: Leaving directory 
`/home/meenakshi/SCT/edk2-test/uefi-sct/SctPkg/Tools/Source/GenBin'
Error while building GenBin


Also, i can't see any update in compilation steps in edk2-test repository.
Please update latest steps.


Thanks,
Meenakshi

From: Supreeth Venkatesh 
mailto:supreeth.venkat...@arm.com>>
Sent: Monday, March 18, 2019 9:37 PM
To: Meenakshi Aggarwal 
mailto:meenakshi.aggar...@nxp.com>>; 
edk2-devel@lists.01.org
Cc: Dong Wei mailto:dong@arm.com>>; Jin, Eric 
mailto:eric@intel.com>>
Subject: RE:[edk2-test] SctPkg compilation is failing

Changing Subject line to append [edk2-test].

If the source code for edk2 and/or edk2-test is stale, this may happen,
as GenBin is no longer a pre-built binary but it is getting built from the 
source.

Please try this with the existing build and recompile.
rm -f $EDK_TOOLS_PATH/Source/C/bin/GenBin

Also,
Build instructions need update, since UTWG decided to use edk2 stable releases 
tag.
I will update the instructions today.

Thanks,
Supreeth
From: Meenakshi Aggarwal 
mailto:meenakshi.aggar...@nxp.com>>
Sent: Monday, March 18, 2019 1:42 AM
To: edk2-devel@lists.01.org; Supreeth Venkatesh 
mailto:supreeth.venkat...@arm.com>>
Subject: SctPkg compilation is failing

Hi,


I followed below steps to compile SctPkg:

Refer to SctPkg/Tools/Source/GenBin/HowTo.txt to gen the GenBin and copy it to 
Home/Dev/SctWorkspace/Bin/BaseTools/BinWrappers/PosixLike

Build Instructions for UEFI SCTII AARCH64 (Linux)
   1) mkdir "sct_workspace"
   2) cd sct_workspace
   3) git clone 
https://github.com/tianocore/edk2-test.git
   4) git clone 
https://github.com/tianocore/edk2
   5) cd edk2
   6) git checkout UDK2017
   7) ln -s ../edk2-test/uefi-sct/SctPkg SctPkg
   8) cd ..
   9) mkdir -p "tools/gcc"
  10) cd "tools/gcc"
  11) wget -nv 

[edk2] [Patch V2][edk2-platforms/devel-MinnowBoardMax-UDK2017] Vlv2TbltDevicePkg: Enable USB3.0 source debug

2019-03-19 Thread Zailiang Sun
In V2: Track the bug in Bugzilla instead of HSD

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

Added a boolean macro SOURCE_DEBUG_USE_USB3 to dsc file in order to
build a BIOS image with USB3.0 source level debugging libraries.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zailiang Sun 
Cc: David Wei 
Cc: Yi Qian 
---
 Vlv2TbltDevicePkg/PlatformPkgConfig.dsc |  1 +
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 60 

 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 76 

 Vlv2TbltDevicePkg/PlatformPkgX64.dsc| 76 

 4 files changed, 161 insertions(+), 52 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
index a73f881b79..632c8885f0 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
@@ -93,5 +93,6 @@ DEFINE ESRT_ENABLE   = TRUE
 #
  DEFINE SOURCE_DEBUG_ENABLE = FALSE
 
+DEFINE SOURCE_DEBUG_USE_USB3   = FALSE
 DEFINE HTTP_BOOT_SUPPORT = FALSE
 DEFINE NETWORK_TLS_ENABLE = FALSE
\ No newline at end of file
diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
index 1daf7137ee..2ed72437e4 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
@@ -261,9 +261,13 @@
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   
PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
+!if $(SOURCE_DEBUG_USE_USB3) == TRUE
+   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Pei.inf
+!else
   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.inf
   
PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
   
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
+!endif
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgentLib.inf
 !else
   
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
@@ -359,8 +363,12 @@
   
HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   
PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
+!if $(SOURCE_DEBUG_USE_USB3) == TRUE
+
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Pei.inf
+!else
   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.inf
   
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
+!endif
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgentLib.inf 
 !else
   
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
@@ -409,6 +417,9 @@
 !endif
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
+!if $(SOURCE_DEBUG_USE_USB3) == TRUE
+   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.inf
+!endif
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
 !endif
 
@@ -422,6 +433,9 @@
 !endif
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
+!if $(SOURCE_DEBUG_USE_USB3) == TRUE
+   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.inf
+!endif
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
 !endif
 
@@ -436,10 +450,13 @@
 
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
   !if $(TARGET) != RELEASE
-  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   !endif
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
+!if $(SOURCE_DEBUG_USE_USB3) == TRUE
+   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.inf
+!endif
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgentLib.inf
   
TimerLib|$(PLATFORM_PACKAGE)/Library/IntelPchAcpiTimerLib/IntelPchAcpiTimerLib.inf
 !endif
@@ -459,10 +476,13 @@
   
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
 
 !if $(TARGET) != RELEASE
-  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
 !endif
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
+!if $(SOURCE_DEBUG_USE_USB3) == TRUE
+   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.inf
+!endif
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
   

[edk2] [Patch V2][edk2-platforms/devel-MinnowBoardMax-UDK2017] Vlv2TbltDevicePkg: SPI lock

2019-03-19 Thread Zailiang Sun
In V2: Track the bug in Bugzilla instead of HSD

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

Set protection bit such as BCR, PR0, PR1 and HSFS bits in SPI registers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zailiang Sun 
Cc: David Wei 
Cc: Yi Qian 
---
 Vlv2TbltDevicePkg/PlatformDxe/Platform.c  | 74 
+++---
 Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf |  8 
 2 files changed, 75 insertions(+), 7 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformDxe/Platform.c 
b/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
index ad18da5c61..02538fd6f0 100644
--- a/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
+++ b/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
@@ -51,7 +51,8 @@ Abstract:
 #include 
 #include 
 #include 
-
+#include 
+#include 
 
 //
 // VLV2 GPIO GROUP OFFSET
@@ -441,6 +442,21 @@ SpiBiosProtectionFunction(
   UINTN BiosFlaLower1;
   UINTN BiosFlaLimit1;  
   
+  EFI_SMM_BASE2_PROTOCOL*SmmBase2;
+  EFI_STATUSStatus;
+  UINT32Data32;
+  UINT16Data16;
+
+  //
+  // This feature requires smm stack. check whether smm stack is ready. if 
not, just return
+  //
+  Status = gBS->LocateProtocol (, NULL, (VOID**) 
);
+  if (EFI_ERROR (Status)) {
+DEBUG((EFI_D_INFO, "smm stack is not ready\n"));
+return;
+  } else {
+DEBUG((EFI_D_INFO, "smm stack is ready\n"));
+  }
 
   BiosFlaLower0 = 
PcdGet32(PcdFlashMicroCodeAddress)-PcdGet32(PcdBiosImageBase);
   BiosFlaLimit0 = PcdGet32(PcdFlashMicroCodeSize)-1;  
@@ -461,6 +477,7 @@ SpiBiosProtectionFunction(
);
   SpiBase  = MmioRead32(mPciD31F0RegBase + R_PCH_LPC_SPI_BASE) & 
B_PCH_LPC_SPI_BASE_BAR;
 
+  DEBUG((EFI_D_INFO, "SpiBase = 0x%x\n", (UINTN)SpiBase));
   //
   //Set SMM_BWP, WPD and LE bit
   //
@@ -468,6 +485,16 @@ SpiBiosProtectionFunction(
   MmioAnd32 ((UINTN) (SpiBase + R_PCH_SPI_BCR), 
(UINT8)(~B_PCH_SPI_BCR_BIOSWE));
   MmioOr32 ((UINTN) (SpiBase + R_PCH_SPI_BCR), (UINT8) B_PCH_SPI_BCR_BLE);
 
+  Data32 = MmioRead32 (SpiBase + R_PCH_SPI_BCR);
+  S3BootScriptSaveMemWrite (
+  S3BootScriptWidthUint32,
+  (UINTN)(SpiBase + R_PCH_SPI_BCR),
+  1,
+  
+  );
+  DEBUG((EFI_D_INFO, "R_PCH_SPI_BCR \n"));
+  DEBUG((EFI_D_INFO, "MmioRead32 (0x%x, 0x%x) = 0x%x \n", (UINTN) SpiBase, 
(UINT8) R_PCH_SPI_BCR, (UINT32) Data32));
+  
   //
   //First check if FLOCKDN or PR0FLOCKDN is set. No action if either of them 
set already.
   //
@@ -487,6 +514,16 @@ SpiBiosProtectionFunction(
 B_PCH_SPI_PR0_RPE|B_PCH_SPI_PR0_WPE|\
 
(B_PCH_SPI_PR0_PRB_MASK&(BiosFlaLower0>>12))|(B_PCH_SPI_PR0_PRL_MASK&(BiosFlaLimit0>>12)<<16));
 
+  Data32 = MmioRead32 (SpiBase + R_PCH_SPI_PR0);  
+  S3BootScriptSaveMemWrite (
+S3BootScriptWidthUint32,
+(UINTN)(SpiBase + R_PCH_SPI_PR0),
+1,
+
+  );
+  DEBUG((EFI_D_INFO, "R_PCH_SPI_PR0 \n"));
+  DEBUG((EFI_D_INFO, "MmioRead32 (0x%x, 0x%x) = 0x%x \n", (UINTN) SpiBase, 
(UINT8) R_PCH_SPI_PR0, (UINT32) Data32));
+  
   //
   //Set PR1
   //
@@ -494,12 +531,31 @@ SpiBiosProtectionFunction(
   MmioOr32((UINTN)(SpiBase + R_PCH_SPI_PR1),
 B_PCH_SPI_PR1_RPE|B_PCH_SPI_PR1_WPE|\
 
(B_PCH_SPI_PR1_PRB_MASK&(BiosFlaLower1>>12))|(B_PCH_SPI_PR1_PRL_MASK&(BiosFlaLimit1>>12)<<16));
+  Data32 = MmioRead32 (SpiBase + R_PCH_SPI_PR1);  
+  S3BootScriptSaveMemWrite (
+S3BootScriptWidthUint32,
+(UINTN)(SpiBase + R_PCH_SPI_PR1),
+1,
+
+  );
+  DEBUG((EFI_D_INFO, "R_PCH_SPI_PR1 \n"));
+  DEBUG((EFI_D_INFO, "MmioRead32 (0x%x, 0x%x) = 0x%x \n", (UINTN) SpiBase, 
(UINT8) R_PCH_SPI_PR1, (UINT32) Data32));
 
   //
   //Lock down PRx
   //
   MmioOr16 ((UINTN) (SpiBase + R_PCH_SPI_HSFS), (UINT16) 
(B_PCH_SPI_HSFS_FLOCKDN));
 
+  Data16 = MmioRead16 (SpiBase + R_PCH_SPI_HSFS); 
+  S3BootScriptSaveMemWrite (
+S3BootScriptWidthUint16,
+(UINTN)(SpiBase + R_PCH_SPI_HSFS),
+1,
+
+  );
+  DEBUG((EFI_D_INFO, "R_PCH_SPI_HSFS \n"));
+  DEBUG((EFI_D_INFO, "MmioRead16 (0x%x, 0x%x) = 0x%x \n", (UINTN) SpiBase, 
(UINT8) R_PCH_SPI_HSFS, (UINT16) Data16));
+  
   //
   // Verify if it's really locked.
   //
@@ -783,6 +839,7 @@ InitializePlatform (
   EFI_HANDLE  Handle = NULL;
   EFI_EVENT   mEfiExitBootServicesEvent;
   EFI_EVENT   RtcEvent;
+  EFI_EVENT   mEndOfExeEvent;
   VOID*RtcCallbackReg = NULL;
   
   mImageHandle = ImageHandle;
@@ -879,12 +936,15 @@ InitializePlatform (
   // Create a ReadyToBoot Event to run enable PR0/PR1 and lock down,unlock 
variable region
   //
   if(mSystemConfiguration.SpiRwProtect==1) {
-Status = EfiCreateEventReadyToBootEx (
-   TPL_CALLBACK,
-   SpiBiosProtectionFunction,
-   NULL,
-   
-   

[edk2] SerialDxe with BaseSerialPortLib16550 and standard PC com port

2019-03-19 Thread Jacob Burkholder
Greetings!

I had trouble using SerialDxe.efi with BaseSerialPortLib16550 on a standard
PC com port (com1).  The PC is an asrock motherboard running whatever EFI
bios it came with.  I changed MdeModulePkg.dsc so that
BaseSerialPortLib16550 would be used instead of BaseSerialPortLibNull and
then rebuilt SerialDxe.efi and loaded and started it using
BootServices->{LoadImage,StartImage}.

Output works but input doesn't work, typed characters aren't received by
the uart.  I looked at the code briefly and it seems like the uart isn't
initialized properly.  I used this script to get input working (the
commands should be self explanatory, they're not efi shell commands though):

image SerialDxe.efi
outb 0x3fb 0x83
outw 0x3f8 1
outb 0x3fb 0x3
outb 0x3fc 0x3

Any chance it can be fixed upstream?

Thanks,

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


[edk2] [PATCH 0/2] Change reset logic related on capsule

2019-03-19 Thread Zhichao Gao
Add CapsuleCacheWriteBack for IA ARCH.
Remove DoS3 in ResetSystemRuntimeDxe.

Zhichao Gao (2):
  MdeModulePkg/CapsuleRuntimeDxe: Merge changes form arm to all ARCH
  MdeModulePkg/ResetSystemRuntimeDxe: Remove DoS3 in warm reset

 .../Universal/CapsuleRuntimeDxe/CapsuleReset.c | 21 
 .../{Arm/CapsuleReset.c => CapsuleResetNull.c} | 29 ++---
 .../CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf| 14 
 .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 38 --
 4 files changed, 30 insertions(+), 72 deletions(-)
 rename MdeModulePkg/Universal/CapsuleRuntimeDxe/{Arm/CapsuleReset.c => 
CapsuleResetNull.c} (51%)

-- 
2.16.2.windows.1

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


[edk2] [PATCH 2/2] MdeModulePkg/ResetSystemRuntimeDxe: Remove DoS3 in warm reset

2019-03-19 Thread Zhichao Gao
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1462

Original logic is that checking the CapsuleUpdate variable
and do the EnterS3WithImmediateWake if the system require a
capsule update. The EnterS3WithImmediateWake is usually
implemented in Platform ResetSystemLib instance and it may
do some operation for capsule update. For now, thess preparations
of capsule are platform reset notify functions' duty. Most
platforms need flush cache to memory before warm reset during
capsule update and this operation is added to capsule flow.
So it is safe to remove it and do not affect the capsule update
function.

Change-Id: I7af8221528c7baee6d16daee79837c7e9584b232
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
---
 .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 38 --
 1 file changed, 38 deletions(-)

diff --git a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c 
b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
index 4c7107faea..36234f4d5b 100644
--- a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
+++ b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c
@@ -206,22 +206,6 @@ InitializeResetSystem (
   return Status;
 }
 
-/**
-  Put the system into S3 power state.
-**/
-VOID
-DoS3 (
-  VOID
-  )
-{
-  EnterS3WithImmediateWake ();
-
-  //
-  // Should not return
-  //
-  CpuDeadLoop ();
-}
-
 /**
   Resets the entire platform.
 
@@ -249,9 +233,6 @@ RuntimeServiceResetSystem (
   IN VOID *ResetData OPTIONAL
   )
 {
-  EFI_STATUS  Status;
-  UINTN   Size;
-  UINTN   CapsuleDataPtr;
   LIST_ENTRY  *Link;
   RESET_NOTIFY_ENTRY  *Entry;
 
@@ -315,25 +296,6 @@ RuntimeServiceResetSystem (
   switch (ResetType) {
   case EfiResetWarm:
 
-//
-//Check if there are pending capsules to process
-//
-Size = sizeof (CapsuleDataPtr);
-Status =  EfiGetVariable (
- EFI_CAPSULE_VARIABLE_NAME,
- ,
- NULL,
- ,
- (VOID *) 
- );
-
-if (Status == EFI_SUCCESS) {
-  //
-  //Process capsules across a system reset.
-  //
-  DoS3();
-}
-
 ResetWarm ();
 break;
 
-- 
2.16.2.windows.1

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


[edk2] [PATCH 1/2] MdeModulePkg/CapsuleRuntimeDxe: Merge changes form arm to all ARCH

2019-03-19 Thread Zhichao Gao
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1462

The arm ARCH has already to add a function CapsuleCacheWriteBack to
flush the cache data to DRAM. That is also required in IA32 ARCH. So
merge the changes. And this function do not support in runtime phase.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
---
 .../Universal/CapsuleRuntimeDxe/CapsuleReset.c | 21 
 .../{Arm/CapsuleReset.c => CapsuleResetNull.c} | 29 +++---
 .../CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf| 14 +--
 3 files changed, 30 insertions(+), 34 deletions(-)
 rename MdeModulePkg/Universal/CapsuleRuntimeDxe/{Arm/CapsuleReset.c => 
CapsuleResetNull.c} (51%)

diff --git a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleReset.c 
b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleReset.c
index 353f6f2090..8c45f6665e 100644
--- a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleReset.c
+++ b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleReset.c
@@ -16,6 +16,8 @@
 
 #include "CapsuleService.h"
 
+#include 
+
 /**
   Whether the platform supports capsules that persist across reset. Note that
   some platforms only support such capsules at boot time.
@@ -46,4 +48,23 @@ CapsuleCacheWriteBack (
   IN  EFI_PHYSICAL_ADDRESSScatterGatherList
   )
 {
+  EFI_CAPSULE_BLOCK_DESCRIPTOR*Desc;
+
+  if (!EfiAtRuntime()) {
+Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR *)(UINTN)ScatterGatherList;
+do {
+  WriteBackDataCacheRange (Desc, sizeof *Desc);
+
+  if (Desc->Length > 0) {
+WriteBackDataCacheRange ((VOID *)(UINTN)Desc->Union.DataBlock,
+ Desc->Length
+ );
+Desc++;
+  } else if (Desc->Union.ContinuationPointer > 0) {
+Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR 
*)(UINTN)Desc->Union.ContinuationPointer;
+  }
+} while (Desc->Length > 0 || Desc->Union.ContinuationPointer > 0);
+
+WriteBackDataCacheRange (Desc, sizeof *Desc);
+  }
 }
diff --git a/MdeModulePkg/Universal/CapsuleRuntimeDxe/Arm/CapsuleReset.c 
b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleResetNull.c
similarity index 51%
rename from MdeModulePkg/Universal/CapsuleRuntimeDxe/Arm/CapsuleReset.c
rename to MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleResetNull.c
index d79d2fc693..3c5cfc1a16 100644
--- a/MdeModulePkg/Universal/CapsuleRuntimeDxe/Arm/CapsuleReset.c
+++ b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleResetNull.c
@@ -1,8 +1,9 @@
 /** @file
-  ARM implementation of architecture specific routines related to
+  Default implementation of architecture specific routines related to
   PersistAcrossReset capsules
 
   Copyright (c) 2018, Linaro, Ltd. All rights reserved.
+  Copyright (c) 2019, 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
@@ -31,14 +32,7 @@ IsPersistAcrossResetCapsuleSupported (
   VOID
   )
 {
-  //
-  // ARM requires the capsule payload to be cleaned to the point of coherency
-  // (PoC), but only permits doing so using cache maintenance instructions that
-  // operate on virtual addresses. Since at runtime, we don't know the virtual
-  // addresses of the data structures that make up the scatter/gather list, we
-  // cannot perform the maintenance, and all we can do is give up.
-  //
-  return FeaturePcdGet (PcdSupportUpdateCapsuleReset) && !EfiAtRuntime ();
+  return FeaturePcdGet (PcdSupportUpdateCapsuleReset);
 }
 
 /**
@@ -55,21 +49,4 @@ CapsuleCacheWriteBack (
   IN  EFI_PHYSICAL_ADDRESSScatterGatherList
   )
 {
-  EFI_CAPSULE_BLOCK_DESCRIPTOR*Desc;
-
-  Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR *)(UINTN)ScatterGatherList;
-  do {
-WriteBackDataCacheRange (Desc, sizeof *Desc);
-
-if (Desc->Length > 0) {
-  WriteBackDataCacheRange ((VOID *)(UINTN)Desc->Union.DataBlock,
-   Desc->Length
-   );
-  Desc++;
-} else if (Desc->Union.ContinuationPointer > 0) {
-  Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR 
*)(UINTN)Desc->Union.ContinuationPointer;
-}
-  } while (Desc->Length > 0 || Desc->Union.ContinuationPointer > 0);
-
-  WriteBackDataCacheRange (Desc, sizeof *Desc);
 }
diff --git a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf 
b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
index ad7af5fe62..c0bdf6db3d 100644
--- a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+++ b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
@@ -36,15 +36,15 @@
 
 [Sources.Ia32, Sources.EBC, Sources.ARM, Sources.AARCH64]
   SaveLongModeContext.c
+
+[Sources.Ia32, Sources.X64, Sources.ARM, Sources.AARCH64]
   CapsuleReset.c
 
+[Sources.EBC]
+  CapsuleResetNull.c
+
 [Sources.X64]
   X64/SaveLongModeContext.c
-  CapsuleReset.c
-

Re: [edk2] [PATCH V3 10/17] IntelFsp2Pkg/BaseFspDebugLibSerialPort: Add new APIs

2019-03-19 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

> -Original Message-
> From: Gao, Zhichao
> Sent: Tuesday, March 19, 2019 11:26 PM
> To: edk2-devel@lists.01.org
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> ; Zeng, Star ; Gao,
> Liming ; Sean Brogan ;
> Michael Turner ; Bret Barkelew
> 
> Subject: [PATCH V3 10/17] IntelFsp2Pkg/BaseFspDebugLibSerialPort: Add new
> APIs
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395
> 
> Add new APIs' implementation (DebugVPrint, DebugBPrint) in the DebugLib
> instance. These APIs would expose print routines with VaList parameter and
> BaseList parameter.
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhichao Gao 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Star Zeng 
> Cc: Liming Gao 
> Cc: Sean Brogan 
> Cc: Michael Turner 
> Cc: Bret Barkelew 
> ---
>  .../Library/BaseFspDebugLibSerialPort/DebugLib.c   | 103
> -
>  1 file changed, 98 insertions(+), 5 deletions(-)
> 
> diff --git a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
> b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
> index 73bb08e357..8b322c038e 100644
> --- a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
> +++ b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
> @@ -1,6 +1,6 @@
>  /** @file
> 
> -  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
> +  Copyright (c) 2014 - 2019, 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 @@ -28,6 +28,12 @@
> 
>  CONST CHAR8  *mHexTable = "0123456789ABCDEF";
> 
> +//
> +// VA_LIST can not initialize to NULL for all compiler, so we use this
> +to // indicate a null VA_LIST //
> +VA_LIST mVaListNull;
> +
>  /**
>Get stack frame pointer of function call.
> 
> @@ -62,9 +68,40 @@ DebugPrint (
>IN  CONST CHAR8  *Format,
>...
>)
> +{
> +  VA_LIST Marker;
> +
> +  VA_START (Marker, Format);
> +  DebugVPrint (ErrorLevel, Format, Marker);
> +  VA_END (Marker);
> +}
> +
> +/**
> +  Prints a debug message to the debug output device if the specified
> +  error level is enabled base on Null-terminated format string and a
> +  VA_LIST argument list or a BASE_LIST argument list.
> +
> +  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib
> + function  GetDebugPrintErrorLevel (), then print the message specified
> + by Format and  the associated variable argument list to the debug output
> device.
> +
> +  If Format is NULL, then ASSERT().
> +
> +  @param  ErrorLevel  The error level of the debug message.
> +  @param  Format  Format string for the debug message to print.
> +  @param  VaListMarkerVA_LIST marker for the variable argument list.
> +  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
> +
> +**/
> +VOID
> +DebugPrintMarker (
> +  IN  UINTN ErrorLevel,
> +  IN  CONST CHAR8   *Format,
> +  IN  VA_LIST   VaListMarker,
> +  IN  BASE_LIST BaseListMarker
> +  )
>  {
>CHAR8Buffer[MAX_DEBUG_MESSAGE_LENGTH];
> -  VA_LIST  Marker;
> 
>//
>// If Format is NULL, then ASSERT().
> @@ -88,9 +125,11 @@ DebugPrint (
>//
>// Convert the DEBUG() message to an ASCII String
>//
> -  VA_START (Marker, Format);
> -  AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);
> -  VA_END (Marker);
> +  if (BaseListMarker == NULL) {
> +AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker);  }
> + else {
> +AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMarker);  }
> 
>//
>// Send the print string to a Serial Port @@ -98,6 +137,60 @@ DebugPrint (
>SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer));  }
> 
> +/**
> +  Prints a debug message to the debug output device if the specified
> +  error level is enabled.
> +
> +  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib
> + function  GetDebugPrintErrorLevel (), then print the message specified
> + by Format and  the associated variable argument list to the debug output
> device.
> +
> +  If Format is NULL, then ASSERT().
> +
> +  @param  ErrorLevelThe error level of the debug message.
> +  @param  FormatFormat string for the debug message to print.
> +  @param  VaListMarker  VA_LIST marker for the variable argument list.
> +
> +**/
> +VOID
> +EFIAPI
> +DebugVPrint (
> +  IN  UINTN ErrorLevel,
> +  IN  CONST CHAR8   *Format,
> +  IN  VA_LIST   VaListMarker
> +  )
> +{
> +  DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL); }
> +
> +/**
> +  Prints a debug message to the debug output device if the specified
> +  error level is enabled.
> +  This function use BASE_LIST which would provide a more compatible
> +  service than VA_LIST.
> +
> +  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib
> + function  

Re: [edk2] [PATCH V3 11/17] IntelFspPkg/BaseFspDebugLibSerialPort: Add new APIs

2019-03-19 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

> -Original Message-
> From: Gao, Zhichao
> Sent: Tuesday, March 19, 2019 11:26 PM
> To: edk2-devel@lists.01.org
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> ; Zeng, Star ; Gao,
> Liming ; Sean Brogan ;
> Michael Turner ; Bret Barkelew
> 
> Subject: [PATCH V3 11/17] IntelFspPkg/BaseFspDebugLibSerialPort: Add new
> APIs
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395
> 
> Add new APIs' implementation (DebugVPrint, DebugBPrint) in the DebugLib
> instance. These APIs would expose print routines with VaList parameter and
> BaseList parameter.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhichao Gao 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Star Zeng 
> Cc: Liming Gao 
> Cc: Sean Brogan 
> Cc: Michael Turner 
> Cc: Bret Barkelew 
> ---
>  .../Library/BaseFspDebugLibSerialPort/DebugLib.c   | 103
> -
>  1 file changed, 98 insertions(+), 5 deletions(-)
> 
> diff --git a/IntelFspPkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
> b/IntelFspPkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
> index 73bb08e357..8b322c038e 100644
> --- a/IntelFspPkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
> +++ b/IntelFspPkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
> @@ -1,6 +1,6 @@
>  /** @file
> 
> -  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
> +  Copyright (c) 2014 - 2019, 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 @@ -28,6 +28,12 @@
> 
>  CONST CHAR8  *mHexTable = "0123456789ABCDEF";
> 
> +//
> +// VA_LIST can not initialize to NULL for all compiler, so we use this
> +to // indicate a null VA_LIST //
> +VA_LIST mVaListNull;
> +
>  /**
>Get stack frame pointer of function call.
> 
> @@ -62,9 +68,40 @@ DebugPrint (
>IN  CONST CHAR8  *Format,
>...
>)
> +{
> +  VA_LIST Marker;
> +
> +  VA_START (Marker, Format);
> +  DebugVPrint (ErrorLevel, Format, Marker);
> +  VA_END (Marker);
> +}
> +
> +/**
> +  Prints a debug message to the debug output device if the specified
> +  error level is enabled base on Null-terminated format string and a
> +  VA_LIST argument list or a BASE_LIST argument list.
> +
> +  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib
> + function  GetDebugPrintErrorLevel (), then print the message specified
> + by Format and  the associated variable argument list to the debug output
> device.
> +
> +  If Format is NULL, then ASSERT().
> +
> +  @param  ErrorLevel  The error level of the debug message.
> +  @param  Format  Format string for the debug message to print.
> +  @param  VaListMarkerVA_LIST marker for the variable argument list.
> +  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
> +
> +**/
> +VOID
> +DebugPrintMarker (
> +  IN  UINTN ErrorLevel,
> +  IN  CONST CHAR8   *Format,
> +  IN  VA_LIST   VaListMarker,
> +  IN  BASE_LIST BaseListMarker
> +  )
>  {
>CHAR8Buffer[MAX_DEBUG_MESSAGE_LENGTH];
> -  VA_LIST  Marker;
> 
>//
>// If Format is NULL, then ASSERT().
> @@ -88,9 +125,11 @@ DebugPrint (
>//
>// Convert the DEBUG() message to an ASCII String
>//
> -  VA_START (Marker, Format);
> -  AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);
> -  VA_END (Marker);
> +  if (BaseListMarker == NULL) {
> +AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker);  }
> + else {
> +AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMarker);  }
> 
>//
>// Send the print string to a Serial Port @@ -98,6 +137,60 @@ DebugPrint (
>SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer));  }
> 
> +/**
> +  Prints a debug message to the debug output device if the specified
> +  error level is enabled.
> +
> +  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib
> + function  GetDebugPrintErrorLevel (), then print the message specified
> + by Format and  the associated variable argument list to the debug output
> device.
> +
> +  If Format is NULL, then ASSERT().
> +
> +  @param  ErrorLevelThe error level of the debug message.
> +  @param  FormatFormat string for the debug message to print.
> +  @param  VaListMarker  VA_LIST marker for the variable argument list.
> +
> +**/
> +VOID
> +EFIAPI
> +DebugVPrint (
> +  IN  UINTN ErrorLevel,
> +  IN  CONST CHAR8   *Format,
> +  IN  VA_LIST   VaListMarker
> +  )
> +{
> +  DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL); }
> +
> +/**
> +  Prints a debug message to the debug output device if the specified
> +  error level is enabled.
> +  This function use BASE_LIST which would provide a more compatible
> +  service than VA_LIST.
> +
> +  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib
> + function  

Re: [edk2] [PATCH 0/2] DynamicTablesPkg: add package .dsc

2019-03-19 Thread Sami Mujawar
Pushed as 7681a891cec6..fbdfef35cb82

-Original Message-
From: Sami Mujawar 
Sent: 19 March 2019 05:25 PM
To: Leif Lindholm ; edk2-devel@lists.01.org
Cc: Alexei Fedorov ; nd 
Subject: RE: [PATCH 0/2] DynamicTablesPkg: add package .dsc

Reviewed-by: Sami Mujawar 

-Original Message-
From: Leif Lindholm  
Sent: 18 March 2019 03:57 PM
To: edk2-devel@lists.01.org
Cc: Sami Mujawar ; Alexei Fedorov 
Subject: [PATCH 0/2] DynamicTablesPkg: add package .dsc

Having a top-level .dsc simplifies automated builds of core modules in 
isolation from any final platforms. As demonstrated by 1/2, discovered while 
putting the .dsc together.

Leif Lindholm (2):
  DynamicTablesPkg: correct LibraryClass dependencies for Arm/DBG2
  DynamicTablesPkg: add package .dsc file

 DynamicTablesPkg/DynamicTablesPkg.dsc  | 44 ++
 .../Acpi/Arm/AcpiDbg2LibArm/AcpiDbg2LibArm.inf |  2 +-
 2 files changed, 45 insertions(+), 1 deletion(-)  create mode 100644 
DynamicTablesPkg/DynamicTablesPkg.dsc

--
2.11.0

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


Re: [edk2] PATCH] Change EDK II to BSD+Patent License

2019-03-19 Thread Leif Lindholm
A starting proposal for my end would be:

---
In order to keep track of who did what, all patches contributed need
to include a statement that to the best of the contributor's
knowledge they have the right to contribute it under the specified
license.

The test for this is as specified in the [Developer's Certificate of
Origin (DCO) 1.1](https://developercertificate.org/). The contributor
certifies compliance by adding a line saying

  Signed-off-by: Developer Name 

where "Developer Name" is the contributor's real name, and the email
address is one the developer is reachable through at the time of
contributing.
---

We could also do what Linux does and include the DCO v1.1 verbatim in
the Readme.md instead of using the link.

Best Regards,

Leif

On Tue, Mar 19, 2019 at 07:09:41PM +, Kinney, Michael D wrote:
> Leif and Jordan,
> 
> Would you mind putting together a specific proposal
> and perhaps some links to other projects that use
> the same approach?
> 
> I am happy to update the RFC to V3 to address this 
> topic if we can close on it quickly.
> 
> Thanks,
> 
> Mike
> 
> 
> > -Original Message-
> > From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> > Sent: Tuesday, March 19, 2019 10:59 AM
> > To: Kinney, Michael D 
> > Cc: Justen, Jordan L ; edk2-
> > de...@lists.01.org
> > Subject: Re: [edk2] PATCH] Change EDK II to BSD+Patent
> > License
> > 
> > Hi Mike,
> > 
> > I see where Jordan is coming from here.
> > 
> > It isn't just about losing the comment in
> > Contriutions.txt - there are
> > bits in the actual TianoCore Contribution Agreement that
> > cover the
> > same things as https://developercertificate.org/ (that
> > are not
> > explicitly called out elsewhere in the existing
> > Contributions.txt).
> > 
> > Like Jordan says, we wouldn't be the first project that
> > use
> > Signed-off-by without specifying exactly what it means,
> > but I think
> > we're one of the ones that actually care quite a bit.
> > 
> > I could live with us not resolving this at the same time
> > as the
> > license change, but I would prefer if we did...
> > 
> > Best Regards,
> > 
> > Leif
> > 
> > On Mon, Mar 18, 2019 at 06:25:54PM +, Kinney, Michael
> > D wrote:
> > > Hi Jordan,
> > >
> > > No proposed changes to the Signed-off-by tags.  If you
> > have
> > > a proposal, please provide an RFC or bring to the
> > monthly
> > > EDK II community meeting.
> > >
> > > This series is focused on the license change, the use
> > of SPDX
> > > identifiers, and removing the Contributed-under tag
> > from
> > > commit messages.
> > >
> > > I will update the V2 version of the patch series in to
> > make
> > > sure the content from Contributions.txt that is not
> > part of
> > > the TianoCore Contribution Agreement is added to
> > Readme.md.
> > >
> > > The RFC mentioned the need to update documentation.  I
> > will
> > > send that out as a separate Wiki patch series for
> > review.
> > >
> > > Best regards,
> > >
> > > Mike
> > >
> > > > -Original Message-
> > > > From: Justen, Jordan L
> > > > Sent: Thursday, March 14, 2019 11:04 AM
> > > > To: Kinney, Michael D ;
> > > > edk2-devel@lists.01.org
> > > > Subject: Re: [edk2] PATCH] Change EDK II to
> > BSD+Patent
> > > > License
> > > >
> > > > On 2019-03-13 10:54:22, Kinney, Michael D wrote:
> > > > >
> > > > > 84141eacac edk2: Remove Contributions.txt and
> > update
> > > > Readme.md
> > > >
> > > > I guess this removes the requirement for the
> > > > 'Contributed-under' tag
> > > > in commit messages?
> > > >
> > > > But, what about Signed-off-by? Is it desirable to
> > > > remove that
> > > > requirement?
> > > >
> > > > Relatedly, some open source projects have
> > standardized
> > > > on tying the
> > > > Signed-off-by to this text:
> > > >
> > > > https://developercertificate.org/
> > > >
> > > > So, the contributor doesn't have to agree to give the
> > > > project the
> > > > contribution under the Contributed-under terms, but
> > > > they still
> > > > indicate that they believe that the project can use
> > the
> > > > code under the
> > > > project's indicated license.
> > > >
> > > > There is also other information in Contributions.txt
> > > > that appears to
> > > > have been deleted, rather than moved. I guess it is
> > > > mostly duplicated
> > > > on the wiki. That doesn't mean it's not a good idea
> > to
> > > > duplicate it in
> > > > the source tree, or at least provide a web-link. It
> > > > seems like the
> > > > first place devs might look for such information is
> > > > either the readme,
> > > > or Contributions.txt.
> > > >
> > > > Regarding the wiki, I guess it has to be updated
> > after
> > > > this change is
> > > > made. It might be good to add that to the bug so it
> > > > can't be closed
> > > > until that is fixed.
> > > >
> > > > How about updating BaseTools/Scripts/PatchCheck.py?
> > > >
> > > > -Jordan
> > > ___
> > > edk2-devel mailing list
> > > edk2-devel@lists.01.org
> 

Re: [edk2] PATCH] Change EDK II to BSD+Patent License

2019-03-19 Thread Jordan Justen
On 2019-03-19 12:09:41, Kinney, Michael D wrote:
> Leif and Jordan,
> 
> Would you mind putting together a specific proposal

I would propose adding the exact text from that site into a
DeveloperCertificate.txt in the root of the tree. Then reference when
documenting how to contribute a patch, near the Signed-off-by part.

Optionally, the https://developercertificate.org/ site could be
referenced to show where the text came from.

> and perhaps some links to other projects that use
> the same approach?

* linux kernel [1] (where DCO started)

* eclipse [2]

-Jordan

[1]: 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v5.1-rc1#n431

[2]: https://www.eclipse.org/legal/DCO.php
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] PATCH] Change EDK II to BSD+Patent License

2019-03-19 Thread Kinney, Michael D
Leif and Jordan,

Would you mind putting together a specific proposal
and perhaps some links to other projects that use
the same approach?

I am happy to update the RFC to V3 to address this 
topic if we can close on it quickly.

Thanks,

Mike


> -Original Message-
> From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> Sent: Tuesday, March 19, 2019 10:59 AM
> To: Kinney, Michael D 
> Cc: Justen, Jordan L ; edk2-
> de...@lists.01.org
> Subject: Re: [edk2] PATCH] Change EDK II to BSD+Patent
> License
> 
> Hi Mike,
> 
> I see where Jordan is coming from here.
> 
> It isn't just about losing the comment in
> Contriutions.txt - there are
> bits in the actual TianoCore Contribution Agreement that
> cover the
> same things as https://developercertificate.org/ (that
> are not
> explicitly called out elsewhere in the existing
> Contributions.txt).
> 
> Like Jordan says, we wouldn't be the first project that
> use
> Signed-off-by without specifying exactly what it means,
> but I think
> we're one of the ones that actually care quite a bit.
> 
> I could live with us not resolving this at the same time
> as the
> license change, but I would prefer if we did...
> 
> Best Regards,
> 
> Leif
> 
> On Mon, Mar 18, 2019 at 06:25:54PM +, Kinney, Michael
> D wrote:
> > Hi Jordan,
> >
> > No proposed changes to the Signed-off-by tags.  If you
> have
> > a proposal, please provide an RFC or bring to the
> monthly
> > EDK II community meeting.
> >
> > This series is focused on the license change, the use
> of SPDX
> > identifiers, and removing the Contributed-under tag
> from
> > commit messages.
> >
> > I will update the V2 version of the patch series in to
> make
> > sure the content from Contributions.txt that is not
> part of
> > the TianoCore Contribution Agreement is added to
> Readme.md.
> >
> > The RFC mentioned the need to update documentation.  I
> will
> > send that out as a separate Wiki patch series for
> review.
> >
> > Best regards,
> >
> > Mike
> >
> > > -Original Message-
> > > From: Justen, Jordan L
> > > Sent: Thursday, March 14, 2019 11:04 AM
> > > To: Kinney, Michael D ;
> > > edk2-devel@lists.01.org
> > > Subject: Re: [edk2] PATCH] Change EDK II to
> BSD+Patent
> > > License
> > >
> > > On 2019-03-13 10:54:22, Kinney, Michael D wrote:
> > > >
> > > > 84141eacac edk2: Remove Contributions.txt and
> update
> > > Readme.md
> > >
> > > I guess this removes the requirement for the
> > > 'Contributed-under' tag
> > > in commit messages?
> > >
> > > But, what about Signed-off-by? Is it desirable to
> > > remove that
> > > requirement?
> > >
> > > Relatedly, some open source projects have
> standardized
> > > on tying the
> > > Signed-off-by to this text:
> > >
> > > https://developercertificate.org/
> > >
> > > So, the contributor doesn't have to agree to give the
> > > project the
> > > contribution under the Contributed-under terms, but
> > > they still
> > > indicate that they believe that the project can use
> the
> > > code under the
> > > project's indicated license.
> > >
> > > There is also other information in Contributions.txt
> > > that appears to
> > > have been deleted, rather than moved. I guess it is
> > > mostly duplicated
> > > on the wiki. That doesn't mean it's not a good idea
> to
> > > duplicate it in
> > > the source tree, or at least provide a web-link. It
> > > seems like the
> > > first place devs might look for such information is
> > > either the readme,
> > > or Contributions.txt.
> > >
> > > Regarding the wiki, I guess it has to be updated
> after
> > > this change is
> > > made. It might be good to add that to the bug so it
> > > can't be closed
> > > until that is fixed.
> > >
> > > How about updating BaseTools/Scripts/PatchCheck.py?
> > >
> > > -Jordan
> > ___
> > 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] Change EDK II to BSD+Patent License

2019-03-19 Thread Leif Lindholm
Hi Mike,

I see where Jordan is coming from here.

It isn't just about losing the comment in Contriutions.txt - there are
bits in the actual TianoCore Contribution Agreement that cover the
same things as https://developercertificate.org/ (that are not
explicitly called out elsewhere in the existing Contributions.txt).

Like Jordan says, we wouldn't be the first project that use
Signed-off-by without specifying exactly what it means, but I think
we're one of the ones that actually care quite a bit.

I could live with us not resolving this at the same time as the
license change, but I would prefer if we did...

Best Regards,

Leif

On Mon, Mar 18, 2019 at 06:25:54PM +, Kinney, Michael D wrote:
> Hi Jordan,
> 
> No proposed changes to the Signed-off-by tags.  If you have 
> a proposal, please provide an RFC or bring to the monthly
> EDK II community meeting.
> 
> This series is focused on the license change, the use of SPDX
> identifiers, and removing the Contributed-under tag from
> commit messages.
> 
> I will update the V2 version of the patch series in to make
> sure the content from Contributions.txt that is not part of
> the TianoCore Contribution Agreement is added to Readme.md.
> 
> The RFC mentioned the need to update documentation.  I will
> send that out as a separate Wiki patch series for review.
> 
> Best regards,
> 
> Mike
> 
> > -Original Message-
> > From: Justen, Jordan L
> > Sent: Thursday, March 14, 2019 11:04 AM
> > To: Kinney, Michael D ;
> > edk2-devel@lists.01.org
> > Subject: Re: [edk2] PATCH] Change EDK II to BSD+Patent
> > License
> > 
> > On 2019-03-13 10:54:22, Kinney, Michael D wrote:
> > >
> > > 84141eacac edk2: Remove Contributions.txt and update
> > Readme.md
> > 
> > I guess this removes the requirement for the
> > 'Contributed-under' tag
> > in commit messages?
> > 
> > But, what about Signed-off-by? Is it desirable to
> > remove that
> > requirement?
> > 
> > Relatedly, some open source projects have standardized
> > on tying the
> > Signed-off-by to this text:
> > 
> > https://developercertificate.org/
> > 
> > So, the contributor doesn't have to agree to give the
> > project the
> > contribution under the Contributed-under terms, but
> > they still
> > indicate that they believe that the project can use the
> > code under the
> > project's indicated license.
> > 
> > There is also other information in Contributions.txt
> > that appears to
> > have been deleted, rather than moved. I guess it is
> > mostly duplicated
> > on the wiki. That doesn't mean it's not a good idea to
> > duplicate it in
> > the source tree, or at least provide a web-link. It
> > seems like the
> > first place devs might look for such information is
> > either the readme,
> > or Contributions.txt.
> > 
> > Regarding the wiki, I guess it has to be updated after
> > this change is
> > made. It might be good to add that to the bug so it
> > can't be closed
> > until that is fixed.
> > 
> > How about updating BaseTools/Scripts/PatchCheck.py?
> > 
> > -Jordan
> ___
> 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 01/17] MdePkg/DebugLib.h: Add a new api DebugVPrint for DebugLib

2019-03-19 Thread stephano

On 3/19/2019 7:45 AM, Gao, Liming wrote:

Jordan:
   I suggest to add the line length discussion in edk2 community meeting. Which 
length is better, 80 or 120? If we expect every patch follows this rule, do we 
need update PatchCheck to add the checker, and notify the developer know this 
requirement?



I've added this discussion to the list for next month's community meeting:

https://www.tianocore.org/community-meeting/

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


[edk2] [PATCH V3 17/17] MdeModulePkg: Add PEIM and lib to dsc file

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add the new PEIM DebugServicePei and library instance
PeiDebugLibDebugPpi to dsc file to verify it can build
correctly.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 MdeModulePkg/MdeModulePkg.dsc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index 6cd1727a0d..dec441e23e 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -297,6 +297,7 @@
   
MdeModulePkg/Library/PlatformHookLibSerialPortPpi/PlatformHookLibSerialPortPpi.inf
   MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
   
MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
+  MdeModulePkg/Library/PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf
   MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
   
MdeModulePkg/Library/PlatformBootManagerLibNull/PlatformBootManagerLibNull.inf
   MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
@@ -423,6 +424,8 @@
   MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
   MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.inf
 
+  MdeModulePkg/Universal/DebugServicePei/DebugServicePei.inf
+
   MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf
   MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.inf
   MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
-- 
2.16.2.windows.1

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


[edk2] [PATCH V3 16/17] MdeModulePkg/PeiDebugLibDebugPpi: Add PEI debug lib

2019-03-19 Thread Zhichao Gao
From: Liming Gao 

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

Add a PEI debug library instance PeiDebugLibDebugPpi base on
DebugPpi. Using the combination of the DebugServicePei and
this lib instance can reduce the image size of PEI drivers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 .../Library/PeiDebugLibDebugPpi/DebugLib.c | 469 +
 .../PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf|  55 +++
 2 files changed, 524 insertions(+)
 create mode 100644 MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c
 create mode 100644 
MdeModulePkg/Library/PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf

diff --git a/MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c 
b/MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c
new file mode 100644
index 00..839dff5268
--- /dev/null
+++ b/MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c
@@ -0,0 +1,469 @@
+/** @file
+  PEI debug lib instance base on DebugPpi to save size
+
+  Copyright (c) 2019, Intel Corporation. All rights reserved.
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+EDKII_DEBUG_PPI *mDebugPpi = NULL;
+CONST EFI_PEI_SERVICES  **mPeiServicesTablePointer = NULL;
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevelThe error level of the debug message.
+  @param  FormatFormat string for the debug message to print.
+  @param  VaListMarker  VA_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugPrint (
+  IN  UINTNErrorLevel,
+  IN  CONST CHAR8  *Format,
+  ...
+  )
+{
+  VA_LIST Marker;
+
+  VA_START (Marker, Format);
+  DebugVPrint (ErrorLevel, Format, Marker);
+  VA_END (Marker);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+  This function use BASE_LIST which would provide a more compatible
+  service than VA_LIST.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugBPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  BASE_LIST BaseListMarker
+  )
+{
+  EFI_STATUS  Status;
+
+  //
+  // If Format is NULL, then ASSERT().
+  //
+  ASSERT (Format != NULL);
+
+  //
+  // Check driver Debug Level value and global debug level
+  //
+  if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {
+return;
+  }
+
+  if (mDebugPpi == NULL) {
+Status = PeiServicesLocatePpi (
+,
+0,
+NULL,
+(VOID **)
+);
+if (EFI_ERROR (Status)) {
+  CpuDeadLoop();
+}
+  }
+
+  if (mPeiServicesTablePointer == NULL) {
+mPeiServicesTablePointer = GetPeiServicesTablePointer ();
+  }
+
+  mDebugPpi->DebugBPrint (
+  mPeiServicesTablePointer,
+  mDebugPpi,
+  ErrorLevel,
+  Format,
+  BaseListMarker
+  );
+}
+
+
+/**
+  Worker function that convert a VA_LIST to a BASE_LIST based on a
+  Null-terminated format string.
+
+  @param  Format  Null-terminated format string.
+  @param  VaListMarkerVA_LIST style variable argument list consumed
+  by processing Format.
+  @param  BaseListMarker  BASE_LIST style variable argument list consumed
+  by processing Format.
+  @param  SizeThe size, in bytes, of the BaseListMarker buffer.
+
+  @return TRUE   The VA_LIST has been converted to BASE_LIST.
+  @return FALSE  The VA_LIST has not been converted to BASE_LIST.
+
+**/
+BOOLEAN
+VaListToBaseList (
+  IN  CONST CHAR8  *Format,
+  IN  VA_LIST 

[edk2] [PATCH V3 15/17] MdeModulePkg: Add a PEIM to install Debug PPI

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add a PEIM to install Debug PPI so that PEI debug library
instance can locate gEdkiiDebugPpiGuid to implement the
debug functions. Using this PPI can reduce the size of
PEIMs which consume the debug library.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 .../Universal/DebugServicePei/DebugService.c   | 68 ++
 .../Universal/DebugServicePei/DebugService.h   | 64 
 .../Universal/DebugServicePei/DebugServicePei.c| 54 +
 .../Universal/DebugServicePei/DebugServicePei.inf  | 51 
 .../Universal/DebugServicePei/DebugServicePei.uni  | 20 +++
 5 files changed, 257 insertions(+)
 create mode 100644 MdeModulePkg/Universal/DebugServicePei/DebugService.c
 create mode 100644 MdeModulePkg/Universal/DebugServicePei/DebugService.h
 create mode 100644 MdeModulePkg/Universal/DebugServicePei/DebugServicePei.c
 create mode 100644 MdeModulePkg/Universal/DebugServicePei/DebugServicePei.inf
 create mode 100644 MdeModulePkg/Universal/DebugServicePei/DebugServicePei.uni

diff --git a/MdeModulePkg/Universal/DebugServicePei/DebugService.c 
b/MdeModulePkg/Universal/DebugServicePei/DebugService.c
new file mode 100644
index 00..54ae6974d1
--- /dev/null
+++ b/MdeModulePkg/Universal/DebugServicePei/DebugService.c
@@ -0,0 +1,68 @@
+/** @file
+  Debug services instances for PEI phase.
+
+  Copyright (c) 2019, Intel Corporation. All rights reserved.
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  which accompanies this distribution.  The full text of the license may be 
found at
+  http://opensource.org/licenses/bsd-license.php
+
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include 
+#include 
+
+/**
+  Print a debug message to debug output device if the specified error level
+  is enabled.
+
+  @param[in] PeiServices  The pointer to the PEI Services Table.
+  @param[in] This The pointer to this instance of 
EDKII_DEBUG_PPI
+  @param[in] ErrorLevel   The error level of the debug message.
+  @param[in] Format   Format string for the debug message to 
print.
+  @param[in] Marker   BASE_LIST marker for the variable 
argument list.
+
+**/
+VOID
+EFIAPI
+PeiDebugBPrint(
+  IN CONST EFI_PEI_SERVICES **PeiServices,
+  IN EDKII_DEBUG_PPI*This,
+  IN UINTN  ErrorLevel,
+  IN CONST CHAR8*Format,
+  IN BASE_LIST  Marker
+  )
+{
+  DebugBPrint(ErrorLevel, Format, Marker);
+}
+
+/**
+  Print an assert message containing a filename, line number, and description.
+  This may be followed by a breakpoint or a dead loop.
+
+  @param[in] PeiServices  The pointer to the PEI Services Table.
+  @param[in] This The pointer to this instance of 
EDKII_DEBUG_PPI
+  @param[in] FileName The pointer to the name of the source 
file that
+  generated the assert condition.
+  @param[in] LineNumber   The line number in the source file that 
generated
+  the assert condition
+  @param[in] Description  The pointer to the description of the 
assert condition.
+
+**/
+VOID
+EFIAPI
+PeiDebugAssert(
+  IN CONST EFI_PEI_SERVICES **PeiServices,
+  IN EDKII_DEBUG_PPI*This,
+  IN CONST CHAR8*FileName,
+  IN UINTN  LineNumber,
+  IN CONST CHAR8*Description
+  )
+{
+  DebugAssert(FileName, LineNumber, Description);
+}
+
diff --git a/MdeModulePkg/Universal/DebugServicePei/DebugService.h 
b/MdeModulePkg/Universal/DebugServicePei/DebugService.h
new file mode 100644
index 00..21b44248bb
--- /dev/null
+++ b/MdeModulePkg/Universal/DebugServicePei/DebugService.h
@@ -0,0 +1,64 @@
+/** @file
+  Header file of Debug services instances.
+
+  Copyright (c) 2019, 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.
+
+**/
+#ifndef __DEBUG_SERVICE_H__
+#define __DEBUG_SERVICE_H__
+
+#include 
+
+/**
+  Print a debug message to debug output device if the specified error 

[edk2] [PATCH V3 13/17] MdeModulePkg/PeiDxeDebugLibReportStatusCode: Add new APIs

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add new APIs' implementation (DebugVPrint, DebugBPrint)
in the DebugLib instance. These APIs would expose print
routines with VaList parameter and BaseList parameter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 .../PeiDxeDebugLibReportStatusCode/DebugLib.c  | 144 ++---
 1 file changed, 128 insertions(+), 16 deletions(-)

diff --git a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c 
b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
index 6f0f416273..f1d31cb619 100644
--- a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
+++ b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
@@ -4,7 +4,7 @@
   Note that if the debug message length is larger than the maximum allowable
   record length, then the debug message will be ignored directly.
 
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2019, 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
@@ -27,6 +27,12 @@
 #include 
 #include 
 
+//
+// VA_LIST can not initialize to NULL for all compiler, so we use this to
+// indicate a null VA_LIST
+//
+VA_LIST mVaListNull;
+
 /**
   Prints a debug message to the debug output device if the specified error 
level is enabled.
 
@@ -52,12 +58,43 @@ DebugPrint (
   IN  CONST CHAR8  *Format,
   ...
   )
+{
+  VA_LIST Marker;
+
+  VA_START (Marker, Format);
+  DebugVPrint (ErrorLevel, Format, Marker);
+  VA_END (Marker);
+}
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled base on Null-terminated format string and a
+  VA_LIST argument list or a BASE_LIST argument list.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  VaListMarkerVA_LIST marker for the variable argument list.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+DebugPrintMarker (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker,
+  IN  BASE_LIST BaseListMarker
+  )
 {
   UINT64  Buffer[(EFI_STATUS_CODE_DATA_MAX_SIZE / sizeof (UINT64)) + 
1];
   EFI_DEBUG_INFO  *DebugInfo;
   UINTN   TotalSize;
-  VA_LIST VaListMarker;
-  BASE_LIST   BaseListMarker;
+  BASE_LIST   BaseListMarkerPointer;
   CHAR8   *FormatString;
   BOOLEAN Long;
 
@@ -96,7 +133,7 @@ DebugPrint (
   // If the TotalSize is larger than the maximum record size, then return
   //
   if (TotalSize > sizeof (Buffer)) {
-TotalSize = sizeof (Buffer);
+return;
   }
 
   //
@@ -109,7 +146,7 @@ DebugPrint (
   //
   DebugInfo = (EFI_DEBUG_INFO *)(Buffer) + 1;
   DebugInfo->ErrorLevel = (UINT32)ErrorLevel;
-  BaseListMarker= (BASE_LIST)(DebugInfo + 1);
+  BaseListMarkerPointer = (BASE_LIST)(DebugInfo + 1);
   FormatString  = (CHAR8 *)((UINT64 *)(DebugInfo + 1) + 12);
 
   //
@@ -125,7 +162,6 @@ DebugPrint (
   // of format in DEBUG string, which is followed by the DEBUG format string.
   // Here we will process the variable arguments and pack them in this area.
   //
-  VA_START (VaListMarker, Format);
 
   //
   // Use the actual format string.
@@ -167,7 +203,11 @@ DebugPrint (
 // '*' in format field means the precision of the field is specified by
 // a UINTN argument in the argument list.
 //
-BASE_ARG (BaseListMarker, UINTN) = VA_ARG (VaListMarker, UINTN);
+if (BaseListMarker == NULL) {
+  BASE_ARG (BaseListMarkerPointer, UINTN) = VA_ARG (VaListMarker, 
UINTN);
+} else {
+  BASE_ARG (BaseListMarkerPointer, UINTN) = BASE_ARG (BaseListMarker, 
UINTN);
+}
 continue;
   }
   if (*Format == '\0') {
@@ -192,16 +232,36 @@ DebugPrint (
 }
 if (*Format == 'p' || *Format == 'X' || *Format == 'x' || *Format == 'd' 
|| *Format == 'u') {
   if (Long) {
-BASE_ARG (BaseListMarker, INT64) = VA_ARG (VaListMarker, INT64);
+if (BaseListMarker == NULL) {
+  BASE_ARG (BaseListMarkerPointer, INT64) = VA_ARG (VaListMarker, 
INT64);
+} else {
+  BASE_ARG (BaseListMarkerPointer, INT64) = BASE_ARG (BaseListMarker, 
INT64);
+}
  

[edk2] [PATCH V3 14/17] MdeModulePkg: Add definitions for EDKII DEBUG PPI

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add a debug PPI for PEI phase. This PPI will provide basic
services of debug. PEI debug lib instance can use these
services to implement debug function to reduce the PEIMs
which consume the debug lib.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 MdeModulePkg/Include/Ppi/Debug.h | 90 
 MdeModulePkg/MdeModulePkg.dec|  3 ++
 2 files changed, 93 insertions(+)
 create mode 100644 MdeModulePkg/Include/Ppi/Debug.h

diff --git a/MdeModulePkg/Include/Ppi/Debug.h b/MdeModulePkg/Include/Ppi/Debug.h
new file mode 100644
index 00..40db304f3d
--- /dev/null
+++ b/MdeModulePkg/Include/Ppi/Debug.h
@@ -0,0 +1,90 @@
+/** @file
+  Define the EDKII_DEBUG_PPI that PEIMs can use to dump info to debug port.
+
+  Copyright (c) 2019, 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.
+
+**/
+
+#ifndef __EDKII_DEBUG_PPI_H__
+#define __EDKII_DEBUG_PPI_H__
+
+#include 
+
+//
+// Global ID for the EDKII_DEBUG_PPI
+//
+#define EDKII_DEBUG_PPI_GUID \
+  { \
+0x999e699c, 0xb013, 0x475e, {0xb1, 0x7b, 0xf3, 0xa8, 0xae, 0x5c, 0x48, 
0x75} \
+  }
+
+///
+/// Forward declaration for the PEI_DEBUG_LIB_DEBUG_PPI EDKII_DEBUG_PPI
+///
+typedef struct _EDKII_DEBUG_PPI EDKII_DEBUG_PPI;
+
+/**
+  Print a debug message to debug output device if the specified error level
+  is enabled.
+
+  @param[in] PeiServices  The pointer to the PEI Services Table.
+  @param[in] This The pointer to this instance of 
EDKII_DEBUG_PPI
+  @param[in] ErrorLevel   The error level of the debug message.
+  @param[in] Format   Format string for the debug message to 
print.
+  @param[in] Marker   BASE_LIST marker for the variable 
argument list.
+
+**/
+typedef
+VOID
+(EFIAPI *EDKII_DEBUG_BPRINT)(
+  IN CONST EFI_PEI_SERVICES **PeiServices,
+  IN EDKII_DEBUG_PPI*This,
+  IN UINTN  ErrorLevel,
+  IN CONST CHAR8*Format,
+  IN BASE_LIST  Marker
+  );
+
+/**
+  Print an assert message containing a filename, line number, and description.
+  This may be followed by a breakpoint or a dead loop.
+
+  @param[in] PeiServices  The pointer to the PEI Services Table.
+  @param[in] This The pointer to this instance of 
EDKII_DEBUG_PPI
+  @param[in] FileName The pointer to the name of the source 
file that
+  generated the assert condition.
+  @param[in] LineNumber   The line number in the source file that 
generated
+  the assert condition
+  @param[in] Description  The pointer to the description of the 
assert condition.
+
+**/
+typedef
+VOID
+(EFIAPI *EDKII_DEBUG_ASSERT)(
+  IN CONST EFI_PEI_SERVICES **PeiServices,
+  IN EDKII_DEBUG_PPI*This,
+  IN CONST CHAR8*FileName,
+  IN UINTN  LineNumber,
+  IN CONST CHAR8*Description
+  );
+
+///
+/// This PPI contains a set of services to print message to debug output device
+///
+struct _EDKII_DEBUG_PPI {
+  EDKII_DEBUG_BPRINTDebugBPrint;
+  EDKII_DEBUG_ASSERTDebugAssert;
+};
+
+extern EFI_GUID gEdkiiDebugPpiGuid;
+
+#endif
+
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index a2130bc439..9bbd0572f5 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -492,6 +492,9 @@
   ## Include/Ppi/AtaPassThru.h
   gEdkiiPeiAtaPassThruPpiGuid   = { 0xa16473fd, 0xd474, 0x4c89, { 
0xae, 0xc7, 0x90, 0xb8, 0x3c, 0x73, 0x86, 0x9  } }
 
+  ## Include/Ppi/Debug.h
+  gEdkiiDebugPpiGuid= { 0x999e699c, 0xb013, 0x475e, { 
0xb1, 0x7b, 0xf3, 0xa8, 0xae, 0x5c, 0x48, 0x75 } }
+
 [Protocols]
   ## Load File protocol provides capability to load and unload EFI image into 
memory and execute it.
   #  Include/Protocol/LoadPe32Image.h
-- 
2.16.2.windows.1

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


[edk2] [PATCH V3 09/17] OvmfPkg/PlatformDebugLibIoPort: Add new APIs

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add new APIs' implementation (DebugVPrint, DebugBPrint)
in the DebugLib instance. These APIs would expose print
routines with VaList parameter and BaseList parameter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Ard Biesheuvel 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c | 106 +-
 1 file changed, 101 insertions(+), 5 deletions(-)

diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c 
b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
index 36cde54976..cda35faf66 100644
--- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
+++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
@@ -2,7 +2,7 @@
   Base Debug library instance for QEMU debug port.
   It uses PrintLib to send debug messages to a fixed I/O port.
 
-  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
   Copyright (c) 2012, Red Hat, Inc.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
@@ -29,6 +29,12 @@
 //
 #define MAX_DEBUG_MESSAGE_LENGTH  0x100
 
+//
+// VA_LIST can not initialize to NULL for all compiler, so we use this to
+// indicate a null VA_LIST
+//
+VA_LIST mVaListNull;
+
 /**
   Prints a debug message to the debug output device if the specified error 
level is enabled.
 
@@ -51,9 +57,41 @@ DebugPrint (
   IN  CONST CHAR8  *Format,
   ...
   )
+{
+  VA_LIST Marker;
+
+  VA_START (Marker, Format);
+  DebugVPrint (ErrorLevel, Format, Marker);
+  VA_END (Marker);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled base on Null-terminated format string and a
+  VA_LIST argument list or a BASE_LIST argument list.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  VaListMarkerVA_LIST marker for the variable argument list.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+DebugPrintMarker (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker,
+  IN  BASE_LIST BaseListMarker
+  )
 {
   CHAR8Buffer[MAX_DEBUG_MESSAGE_LENGTH];
-  VA_LIST  Marker;
   UINTNLength;
 
   //
@@ -72,9 +110,11 @@ DebugPrint (
   //
   // Convert the DEBUG() message to an ASCII String
   //
-  VA_START (Marker, Format);
-  Length = AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);
-  VA_END (Marker);
+  if (BaseListMarker == NULL) {
+Length = AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker);
+  } else {
+Length = AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMarker);
+  }
 
   //
   // Send the print string to the debug I/O port
@@ -83,6 +123,62 @@ DebugPrint (
 }
 
 
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevelThe error level of the debug message.
+  @param  FormatFormat string for the debug message to print.
+  @param  VaListMarker  VA_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugVPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+  This function use BASE_LIST which would provide a more compatible
+  service than VA_LIST.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugBPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  BASE_LIST BaseListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, mVaListNull, 

[edk2] [PATCH V3 08/17] ArmPkg/SemiHostingDebugLib: Add new APIs

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add new APIs' implementation (DebugVPrint, DebugBPrint)
in the DebugLib instance. These APIs would expose print
routines with VaList parameter and BaseList parameter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 ArmPkg/Library/SemiHostingDebugLib/DebugLib.c | 106 --
 1 file changed, 101 insertions(+), 5 deletions(-)

diff --git a/ArmPkg/Library/SemiHostingDebugLib/DebugLib.c 
b/ArmPkg/Library/SemiHostingDebugLib/DebugLib.c
index ec03edb774..a368dd43b8 100644
--- a/ArmPkg/Library/SemiHostingDebugLib/DebugLib.c
+++ b/ArmPkg/Library/SemiHostingDebugLib/DebugLib.c
@@ -1,7 +1,7 @@
 /** @file
   UEFI Debug Library that uses PrintLib to send messages to STDERR.
 
-  Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
   Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
@@ -27,6 +27,12 @@
 //
 #define MAX_DEBUG_MESSAGE_LENGTH  0x100
 
+//
+// VA_LIST can not initialize to NULL for all compiler, so we use this to
+// indicate a null VA_LIST
+//
+VA_LIST mVaListNull;
+
 /**
 
   Prints a debug message to the debug output device if the specified error 
level is enabled.
@@ -48,9 +54,41 @@ DebugPrint (
   IN  CONST CHAR8  *Format,
   ...
   )
+{
+  VA_LIST Marker;
+
+  VA_START (Marker, Format);
+  DebugVPrint (ErrorLevel, Format, Marker);
+  VA_END (Marker);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled base on Null-terminated format string and a
+  VA_LIST argument list or a BASE_LIST argument list.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  VaListMarkerVA_LIST marker for the variable argument list.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+DebugPrintMarker (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker,
+  IN  BASE_LIST BaseListMarker
+  )
 {
   CHAR8AsciiBuffer[MAX_DEBUG_MESSAGE_LENGTH];
-  VA_LIST  Marker;
 
   //
   // If Format is NULL, then ASSERT().
@@ -67,14 +105,72 @@ DebugPrint (
   //
   // Convert the DEBUG() message to a Unicode String
   //
-  VA_START (Marker, Format);
-  AsciiVSPrint (AsciiBuffer, sizeof (AsciiBuffer), Format, Marker);
-  VA_END (Marker);
+  if (BaseListMarker == NULL) {
+AsciiVSPrint (AsciiBuffer, sizeof (AsciiBuffer), Format, VaListMarker);
+  } else {
+AsciiBSPrint (AsciiBuffer, sizeof (AsciiBuffer), Format, BaseListMarker);
+  }
 
   SemihostWriteString (AsciiBuffer);
 }
 
 
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevelThe error level of the debug message.
+  @param  FormatFormat string for the debug message to print.
+  @param  VaListMarker  VA_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugVPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+  This function use BASE_LIST which would provide a more compatible
+  service than VA_LIST.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugBPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  BASE_LIST BaseListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, mVaListNull, BaseListMarker);
+}
+
+
 /**
 
   Prints an assert message 

[edk2] [PATCH V3 11/17] IntelFspPkg/BaseFspDebugLibSerialPort: Add new APIs

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add new APIs' implementation (DebugVPrint, DebugBPrint)
in the DebugLib instance. These APIs would expose print
routines with VaList parameter and BaseList parameter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 .../Library/BaseFspDebugLibSerialPort/DebugLib.c   | 103 -
 1 file changed, 98 insertions(+), 5 deletions(-)

diff --git a/IntelFspPkg/Library/BaseFspDebugLibSerialPort/DebugLib.c 
b/IntelFspPkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
index 73bb08e357..8b322c038e 100644
--- a/IntelFspPkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
+++ b/IntelFspPkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2014 - 2019, 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
@@ -28,6 +28,12 @@
 
 CONST CHAR8  *mHexTable = "0123456789ABCDEF";
 
+//
+// VA_LIST can not initialize to NULL for all compiler, so we use this to
+// indicate a null VA_LIST
+//
+VA_LIST mVaListNull;
+
 /**
   Get stack frame pointer of function call.
 
@@ -62,9 +68,40 @@ DebugPrint (
   IN  CONST CHAR8  *Format,
   ...
   )
+{
+  VA_LIST Marker;
+
+  VA_START (Marker, Format);
+  DebugVPrint (ErrorLevel, Format, Marker);
+  VA_END (Marker);
+}
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled base on Null-terminated format string and a
+  VA_LIST argument list or a BASE_LIST argument list.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  VaListMarkerVA_LIST marker for the variable argument list.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+DebugPrintMarker (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker,
+  IN  BASE_LIST BaseListMarker
+  )
 {
   CHAR8Buffer[MAX_DEBUG_MESSAGE_LENGTH];
-  VA_LIST  Marker;
 
   //
   // If Format is NULL, then ASSERT().
@@ -88,9 +125,11 @@ DebugPrint (
   //
   // Convert the DEBUG() message to an ASCII String
   //
-  VA_START (Marker, Format);
-  AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);
-  VA_END (Marker);
+  if (BaseListMarker == NULL) {
+AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker);
+  } else {
+AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMarker);
+  }
 
   //
   // Send the print string to a Serial Port
@@ -98,6 +137,60 @@ DebugPrint (
   SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer));
 }
 
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevelThe error level of the debug message.
+  @param  FormatFormat string for the debug message to print.
+  @param  VaListMarker  VA_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugVPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
+}
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+  This function use BASE_LIST which would provide a more compatible
+  service than VA_LIST.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugBPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  BASE_LIST BaseListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, mVaListNull, BaseListMarker);
+}
+
 /**
   Convert an 

[edk2] [PATCH V3 12/17] IntelFramworkModulePkg/PeiDxeDebugLibReportStatusCode: Add new APIs

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add new APIs' implementation (DebugVPrint, DebugBPrint)
in the DebugLib instance. These APIs would expose print
routines with VaList parameter and BaseList parameter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 .../PeiDxeDebugLibReportStatusCode/DebugLib.c  | 142 ++---
 1 file changed, 127 insertions(+), 15 deletions(-)

diff --git 
a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c 
b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
index b0445115a9..e020e3c207 100644
--- a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
+++ b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
@@ -4,7 +4,7 @@
   Note that if the debug message length is larger than the maximum allowable
   record length, then the debug message will be ignored directly.
 
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2019, 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
@@ -27,6 +27,12 @@
 #include 
 #include 
 
+//
+// VA_LIST can not initialize to NULL for all compiler, so we use this to
+// indicate a null VA_LIST
+//
+VA_LIST mVaListNull;
+
 /**
   Prints a debug message to the debug output device if the specified error 
level is enabled.
 
@@ -52,13 +58,44 @@ DebugPrint (
   IN  CONST CHAR8  *Format,
   ...
   )
+{
+  VA_LIST Marker;
+
+  VA_START (Marker, Format);
+  DebugVPrint (ErrorLevel, Format, Marker);
+  VA_END (Marker);
+}
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled base on Null-terminated format string and a
+  VA_LIST argument list or a BASE_LIST argument list.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  VaListMarkerVA_LIST marker for the variable argument list.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+DebugPrintMarker (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker,
+  IN  BASE_LIST BaseListMarker
+  )
 {
   UINT64  Buffer[(EFI_STATUS_CODE_DATA_MAX_SIZE / sizeof (UINT64)) + 
1];
   EFI_DEBUG_INFO  *DebugInfo;
   UINTN   TotalSize;
   UINTN   DestBufferSize;
-  VA_LIST VaListMarker;
-  BASE_LIST   BaseListMarker;
+  BASE_LIST   BaseListMarkerPointer;
   CHAR8   *FormatString;
   BOOLEAN Long;
 
@@ -110,7 +147,7 @@ DebugPrint (
   //
   DebugInfo = (EFI_DEBUG_INFO *)(Buffer) + 1;
   DebugInfo->ErrorLevel = (UINT32)ErrorLevel;
-  BaseListMarker= (BASE_LIST)(DebugInfo + 1);
+  BaseListMarkerPointer = (BASE_LIST)(DebugInfo + 1);
   FormatString  = (CHAR8 *)((UINT64 *)(DebugInfo + 1) + 12);
 
   //
@@ -129,7 +166,6 @@ DebugPrint (
   // of format in DEBUG string, which is followed by the DEBUG format string.
   // Here we will process the variable arguments and pack them in this area.
   //
-  VA_START (VaListMarker, Format);
   for (; *Format != '\0'; Format++) {
 //
 // Only format with prefix % is processed.
@@ -166,7 +202,11 @@ DebugPrint (
 // '*' in format field means the precision of the field is specified by
 // a UINTN argument in the argument list.
 //
-BASE_ARG (BaseListMarker, UINTN) = VA_ARG (VaListMarker, UINTN);
+if (BaseListMarker == NULL) {
+  BASE_ARG (BaseListMarkerPointer, UINTN) = VA_ARG (VaListMarker, 
UINTN);
+} else {
+  BASE_ARG (BaseListMarkerPointer, UINTN) = BASE_ARG (BaseListMarker, 
UINTN);
+}
 continue;
   }
   if (*Format == '\0') {
@@ -191,16 +231,36 @@ DebugPrint (
 }
 if (*Format == 'p' || *Format == 'X' || *Format == 'x' || *Format == 'd' 
|| *Format == 'u') {
   if (Long) {
-BASE_ARG (BaseListMarker, INT64) = VA_ARG (VaListMarker, INT64);
+if (BaseListMarker == NULL) {
+  BASE_ARG (BaseListMarkerPointer, INT64) = VA_ARG (VaListMarker, 
INT64);
+} else {
+  BASE_ARG (BaseListMarkerPointer, INT64) = BASE_ARG (BaseListMarker, 
INT64);
+}
   } else {
-BASE_ARG (BaseListMarker, int) = VA_ARG (VaListMarker, int);
+if (BaseListMarker == NULL) {
+  

[edk2] [PATCH V3 10/17] IntelFsp2Pkg/BaseFspDebugLibSerialPort: Add new APIs

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add new APIs' implementation (DebugVPrint, DebugBPrint)
in the DebugLib instance. These APIs would expose print
routines with VaList parameter and BaseList parameter.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 .../Library/BaseFspDebugLibSerialPort/DebugLib.c   | 103 -
 1 file changed, 98 insertions(+), 5 deletions(-)

diff --git a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c 
b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
index 73bb08e357..8b322c038e 100644
--- a/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
+++ b/IntelFsp2Pkg/Library/BaseFspDebugLibSerialPort/DebugLib.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2014 - 2019, 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
@@ -28,6 +28,12 @@
 
 CONST CHAR8  *mHexTable = "0123456789ABCDEF";
 
+//
+// VA_LIST can not initialize to NULL for all compiler, so we use this to
+// indicate a null VA_LIST
+//
+VA_LIST mVaListNull;
+
 /**
   Get stack frame pointer of function call.
 
@@ -62,9 +68,40 @@ DebugPrint (
   IN  CONST CHAR8  *Format,
   ...
   )
+{
+  VA_LIST Marker;
+
+  VA_START (Marker, Format);
+  DebugVPrint (ErrorLevel, Format, Marker);
+  VA_END (Marker);
+}
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled base on Null-terminated format string and a
+  VA_LIST argument list or a BASE_LIST argument list.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  VaListMarkerVA_LIST marker for the variable argument list.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+DebugPrintMarker (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker,
+  IN  BASE_LIST BaseListMarker
+  )
 {
   CHAR8Buffer[MAX_DEBUG_MESSAGE_LENGTH];
-  VA_LIST  Marker;
 
   //
   // If Format is NULL, then ASSERT().
@@ -88,9 +125,11 @@ DebugPrint (
   //
   // Convert the DEBUG() message to an ASCII String
   //
-  VA_START (Marker, Format);
-  AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);
-  VA_END (Marker);
+  if (BaseListMarker == NULL) {
+AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker);
+  } else {
+AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMarker);
+  }
 
   //
   // Send the print string to a Serial Port
@@ -98,6 +137,60 @@ DebugPrint (
   SerialPortWrite ((UINT8 *)Buffer, AsciiStrLen (Buffer));
 }
 
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevelThe error level of the debug message.
+  @param  FormatFormat string for the debug message to print.
+  @param  VaListMarker  VA_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugVPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
+}
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+  This function use BASE_LIST which would provide a more compatible
+  service than VA_LIST.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugBPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  BASE_LIST BaseListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, mVaListNull, BaseListMarker);
+}
+
 /**
   Convert 

[edk2] [PATCH V3 07/17] MdePkg/UefiDebuglibDebugPortProtocol: Add new APIs

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add new APIs' implementation (DebugVPrint, DebugBPrint)
in the DebugLib instance. These APIs would expose print
routines with VaList parameter and BaseList parameter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 .../UefiDebugLibDebugPortProtocol/DebugLib.c   | 106 -
 1 file changed, 101 insertions(+), 5 deletions(-)

diff --git a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c 
b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
index c2209f4123..b1ad2af20a 100644
--- a/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibDebugPortProtocol/DebugLib.c
@@ -1,7 +1,7 @@
 /** @file
   UEFI Debug Library that sends messages to EFI_DEBUGPORT_PROTOCOL.Write.
 
-  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2015 - 2019, 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
@@ -37,6 +37,12 @@
 
 EFI_DEBUGPORT_PROTOCOL *mDebugPort = NULL;
 
+//
+// VA_LIST can not initialize to NULL for all compiler, so we use this to
+// indicate a null VA_LIST
+//
+VA_LIST mVaListNull;
+
 /**
   Send message to DebugPort Protocol.
 
@@ -106,9 +112,41 @@ DebugPrint (
   IN  CONST CHAR8  *Format,
   ...
   )
+{
+  VA_LIST Marker;
+
+  VA_START (Marker, Format);
+  DebugVPrint (ErrorLevel, Format, Marker);
+  VA_END (Marker);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled base on Null-terminated format string and a
+  VA_LIST argument list or a BASE_LIST argument list.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  VaListMarkerVA_LIST marker for the variable argument list.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+DebugPrintMarker (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker,
+  IN  BASE_LIST BaseListMarker
+  )
 {
   CHAR8  Buffer[MAX_DEBUG_MESSAGE_LENGTH];
-  VA_LISTMarker;
 
   //
   // If Format is NULL, then ASSERT().
@@ -125,9 +163,11 @@ DebugPrint (
   //
   // Convert the DEBUG() message to an ASCII String
   //
-  VA_START (Marker, Format);
-  AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);
-  VA_END (Marker);
+  if (BaseListMarker == NULL) {
+AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker);
+  } else {
+AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMarker);
+  }
 
   //
   // Send the print string to EFI_DEBUGPORT_PROTOCOL.Write.
@@ -136,6 +176,62 @@ DebugPrint (
 }
 
 
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevelThe error level of the debug message.
+  @param  FormatFormat string for the debug message to print.
+  @param  VaListMarker  VA_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugVPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+  This function use BASE_LIST which would provide a more compatible
+  service than VA_LIST.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugBPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  BASE_LIST BaseListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, mVaListNull, BaseListMarker);
+}
+
+
 /**
   

[edk2] [PATCH V3 03/17] MdePkg/BaseDebugLibSerialPort: Add new APIs

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add new APIs' implementation (DebugVPrint, DebugBPrint)
in the DebugLib instance. These APIs would expose print
routines with VaList parameter and BaseList parameter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c | 106 +--
 1 file changed, 101 insertions(+), 5 deletions(-)

diff --git a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c 
b/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
index ffb84b39e5..d875050371 100644
--- a/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
+++ b/MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c
@@ -7,7 +7,7 @@
   being blocked.  This may occur if a key(s) are pressed in a terminal emulator
   used to monitor the DEBUG() and ASSERT() messages.
 
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2019, 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
@@ -32,6 +32,12 @@
 //
 #define MAX_DEBUG_MESSAGE_LENGTH  0x100
 
+//
+// VA_LIST can not initialize to NULL for all compiler, so we use this to
+// indicate a null VA_LIST
+//
+VA_LIST mVaListNull;
+
 /**
   The constructor function initialize the Serial Port Library
 
@@ -70,9 +76,41 @@ DebugPrint (
   ...
   )
 {
-  CHAR8Buffer[MAX_DEBUG_MESSAGE_LENGTH];
   VA_LIST  Marker;
 
+  VA_START (Marker, Format);
+  DebugVPrint (ErrorLevel, Format, Marker);
+  VA_END (Marker);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled base on Null-terminated format string and a
+  VA_LIST argument list or a BASE_LIST argument list.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  VaListMarkerVA_LIST marker for the variable argument list.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+DebugPrintMarker (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker,
+  IN  BASE_LIST BaseListMarker
+  )
+{
+  CHAR8Buffer[MAX_DEBUG_MESSAGE_LENGTH];
+
   //
   // If Format is NULL, then ASSERT().
   //
@@ -88,9 +126,11 @@ DebugPrint (
   //
   // Convert the DEBUG() message to an ASCII String
   //
-  VA_START (Marker, Format);
-  AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);
-  VA_END (Marker);
+  if (BaseListMarker == NULL) {
+AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker);
+  } else {
+AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMarker);
+  }
 
   //
   // Send the print string to a Serial Port
@@ -99,6 +139,62 @@ DebugPrint (
 }
 
 
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevelThe error level of the debug message.
+  @param  FormatFormat string for the debug message to print.
+  @param  VaListMarker  VA_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugVPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+  This function use BASE_LIST which would provide a more compatible
+  service than VA_LIST.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugBPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  BASE_LIST BaseListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, mVaListNull, BaseListMarker);
+}
+

[edk2] [PATCH V3 05/17] MdePkg/UefiDebugLibStdErr: Add new APIs

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add new APIs' implementation (DebugVPrint, DebugBPrint)
in the DebugLib instance. These APIs would expose print
routines with VaList parameter and BaseList parameter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 MdePkg/Library/UefiDebugLibStdErr/DebugLib.c | 107 +--
 1 file changed, 102 insertions(+), 5 deletions(-)

diff --git a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c 
b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
index 6830a3caa1..81fcf168e5 100644
--- a/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
@@ -1,7 +1,7 @@
 /** @file
   UEFI Debug Lib that sends messages to the Standard Error Device in the EFI 
System Table.
 
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2019, 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
@@ -29,6 +29,13 @@
 #define MAX_DEBUG_MESSAGE_LENGTH  0x100
 
 
+//
+// VA_LIST can not initialize to NULL for all compiler, so we use this to
+// indicate a null VA_LIST
+//
+VA_LIST mVaListNull;
+
+
 /**
   Prints a debug message to the debug output device if the specified error 
level is enabled.
 
@@ -51,9 +58,41 @@ DebugPrint (
   IN  CONST CHAR8  *Format,
   ...
   )
+{
+  VA_LIST Marker;
+
+  VA_START (Marker, Format);
+  DebugVPrint (ErrorLevel, Format, Marker);
+  VA_END (Marker);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled base on Null-terminated format string and a
+  VA_LIST argument list or a BASE_LIST argument list.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  VaListMarkerVA_LIST marker for the variable argument list.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+DebugPrintMarker (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker,
+  IN  BASE_LIST BaseListMarker
+  )
 {
   CHAR16   Buffer[MAX_DEBUG_MESSAGE_LENGTH];
-  VA_LIST  Marker;
 
   //
   // If Format is NULL, then ASSERT().
@@ -70,9 +109,11 @@ DebugPrint (
   //
   // Convert the DEBUG() message to a Unicode String
   //
-  VA_START (Marker, Format);
-  UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, Marker);
-  VA_END (Marker);
+  if (BaseListMarker == NULL) {
+UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, 
VaListMarker);
+  } else {
+UnicodeBSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH, Format, 
BaseListMarker);
+  }
 
   //
   // Send the print string to the Standard Error device
@@ -83,6 +124,62 @@ DebugPrint (
 }
 
 
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevelThe error level of the debug message.
+  @param  FormatFormat string for the debug message to print.
+  @param  VaListMarker  VA_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugVPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+  This function use BASE_LIST which would provide a more compatible
+  service than VA_LIST.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugBPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  BASE_LIST BaseListMarker
+  )
+{
+  

[edk2] [PATCH V3 06/17] MdePkg/DxeRuntimeDebugLibSerialPort: Add new APIs

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add new APIs' implementation (DebugVPrint, DebugBPrint)
in the DebugLib instance. These APIs would expose print
routines with VaList parameter and BaseList parameter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 .../DxeRuntimeDebugLibSerialPort/DebugLib.c| 106 -
 1 file changed, 101 insertions(+), 5 deletions(-)

diff --git a/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c 
b/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
index e1266f77fa..4af1cde488 100644
--- a/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
+++ b/MdePkg/Library/DxeRuntimeDebugLibSerialPort/DebugLib.c
@@ -4,7 +4,7 @@
   been called, to prevent touching hardware that is no longer owned by the
   firmware.
 
-  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
   Copyright (c) 2018, Linaro, Ltd. All rights reserved.
 
   This program and the accompanying materials
@@ -34,6 +34,12 @@ STATIC BOOLEANmEfiAtRuntime = FALSE;
 //
 #define MAX_DEBUG_MESSAGE_LENGTH  0x100
 
+//
+// VA_LIST can not initialize to NULL for all compiler, so we use this to
+// indicate a null VA_LIST
+//
+VA_LIST mVaListNull;
+
 /**
   Set AtRuntime flag as TRUE after ExitBootServices.
 
@@ -125,9 +131,41 @@ DebugPrint (
   IN  CONST CHAR8  *Format,
   ...
   )
+{
+  VA_LIST Marker;
+
+  VA_START (Marker, Format);
+  DebugVPrint (ErrorLevel, Format, Marker);
+  VA_END (Marker);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled base on Null-terminated format string and a
+  VA_LIST argument list or a BASE_LIST argument list.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  VaListMarkerVA_LIST marker for the variable argument list.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+DebugPrintMarker (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker,
+  IN  BASE_LIST BaseListMarker
+  )
 {
   CHAR8Buffer[MAX_DEBUG_MESSAGE_LENGTH];
-  VA_LIST  Marker;
 
   if (mEfiAtRuntime) {
 return;
@@ -148,9 +186,11 @@ DebugPrint (
   //
   // Convert the DEBUG() message to an ASCII String
   //
-  VA_START (Marker, Format);
-  AsciiVSPrint (Buffer, sizeof (Buffer), Format, Marker);
-  VA_END (Marker);
+  if (BaseListMarker == NULL) {
+AsciiVSPrint (Buffer, sizeof (Buffer), Format, VaListMarker);
+  } else {
+AsciiBSPrint (Buffer, sizeof (Buffer), Format, BaseListMarker);
+  }
 
   //
   // Send the print string to a Serial Port
@@ -159,6 +199,62 @@ DebugPrint (
 }
 
 
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevelThe error level of the debug message.
+  @param  FormatFormat string for the debug message to print.
+  @param  VaListMarker  VA_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugVPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+  This function use BASE_LIST which would provide a more compatible
+  service than VA_LIST.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugBPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  BASE_LIST BaseListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, mVaListNull, BaseListMarker);
+}
+
+
 /**
   Prints an assert message containing a filename, line number, and description.
   This may 

[edk2] [PATCH V3 04/17] MdePkg/UefidebugLibConOut: Add new APIs

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add new APIs' implementation (DebugVPrint, DebugBPrint)
in the DebugLib instance. These APIs would expose print
routines with VaList parameter and BaseList parameter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 MdePkg/Library/UefiDebugLibConOut/DebugLib.c | 106 +--
 1 file changed, 101 insertions(+), 5 deletions(-)

diff --git a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c 
b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
index f04207c93f..c60ac04a24 100644
--- a/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
+++ b/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
@@ -1,7 +1,7 @@
 /** @file
   UEFI Debug Library that sends messages to the Console Output Device in the 
EFI System Table.
 
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2019, 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
@@ -27,6 +27,12 @@
 //
 #define MAX_DEBUG_MESSAGE_LENGTH  0x100
 
+//
+// VA_LIST can not initialize to NULL for all compiler, so we use this to
+// indicate a null VA_LIST
+//
+VA_LIST mVaListNull;
+
 /**
   Prints a debug message to the debug output device if the specified error 
level is enabled.
 
@@ -50,9 +56,41 @@ DebugPrint (
   ...
   )
 {
-  CHAR16   Buffer[MAX_DEBUG_MESSAGE_LENGTH];
   VA_LIST  Marker;
 
+  VA_START (Marker, Format);
+  DebugVPrint (ErrorLevel, Format, Marker);
+  VA_END (Marker);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled base on Null-terminated format string and a
+  VA_LIST argument list or a BASE_LIST argument list.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  VaListMarkerVA_LIST marker for the variable argument list.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+DebugPrintMarker (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker,
+  IN  BASE_LIST BaseListMarker
+  )
+{
+  CHAR16   Buffer[MAX_DEBUG_MESSAGE_LENGTH];
+
   //
   // If Format is NULL, then ASSERT().
   //
@@ -68,9 +106,11 @@ DebugPrint (
   //
   // Convert the DEBUG() message to a Unicode String
   //
-  VA_START (Marker, Format);
-  UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,  Format, 
Marker);
-  VA_END (Marker);
+  if (BaseListMarker == NULL) {
+UnicodeVSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,  Format, 
VaListMarker);
+  } else {
+UnicodeBSPrintAsciiFormat (Buffer, MAX_DEBUG_MESSAGE_LENGTH,  Format, 
BaseListMarker);
+  }
 
 
   //
@@ -82,6 +122,62 @@ DebugPrint (
 }
 
 
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevelThe error level of the debug message.
+  @param  FormatFormat string for the debug message to print.
+  @param  VaListMarker  VA_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugVPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+  This function use BASE_LIST which would provide a more compatible
+  service than VA_LIST.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugBPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  BASE_LIST BaseListMarker
+  )
+{
+  DebugPrintMarker (ErrorLevel, Format, mVaListNull, 

[edk2] [PATCH V3 02/17] MdePkg/BaseDebugLibNull: Add new APIs for DebugLib

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add new APIs' implementation (DebugVPrint, DebugBPrint)
in the DebugLib instance. These APIs would expose print
routines with VaList parameter and BaseList parameter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 MdePkg/Library/BaseDebugLibNull/DebugLib.c | 56 +-
 1 file changed, 55 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Library/BaseDebugLibNull/DebugLib.c 
b/MdePkg/Library/BaseDebugLibNull/DebugLib.c
index 1a7d4aba79..f9c9ac7189 100644
--- a/MdePkg/Library/BaseDebugLibNull/DebugLib.c
+++ b/MdePkg/Library/BaseDebugLibNull/DebugLib.c
@@ -1,7 +1,7 @@
 /** @file
   Null Base Debug Library instance with empty functions.
 
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -41,6 +41,60 @@ DebugPrint (
 }
 
 
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevelThe error level of the debug message.
+  @param  FormatFormat string for the debug message to print.
+  @param  VaListMarker  VA_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugVPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker
+  )
+{
+}
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+  This function use BASE_LIST which would provide a more compatible
+  service than VA_LIST.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugBPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  BASE_LIST BaseListMarker
+  )
+{
+}
+
+
 /**
   Prints an assert message containing a filename, line number, and description.
   This may be followed by a breakpoint or a dead loop.
-- 
2.16.2.windows.1

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


[edk2] [PATCH V3 00/17] Add new APIs DebugVPrint for DebugLib

2019-03-19 Thread Zhichao Gao
Add a new API DebugVPrint to all the instances of DebugLib.
This API is added to provide a function who want to implement
special debug function with '...' parameter.
Add a PEIM to install gEdkiiDebugPpiGuid, and implement a PEI
debug library instance base on it. All PEIMs except pei core
type can use the PeiDebugLibDebugPpi to reduce its image size.

V2: 
Remove redundant code in DebugPrint.
Fix some coding sytle issues.
Remove some unenforced descirption in the comments of DebugVPrint.

V3:
Add the new API DebugBPrint, it is more useful for consumers which
are care of compatible issue.
Change the interface in gEdkiiDebugPpiGuid. VA_LIST is inappropriate
to appeared in protocol or ppi because different compilers compile
it to different type. It may be a pointer or a structure.

Liming Gao (1):
  MdeModulePkg/PeiDebugLibDebugPpi: Add PEI debug lib

Zhichao Gao (16):
  MdePkg/DebugLib.h: Add new APIs for DebugLib
  MdePkg/BaseDebugLibNull: Add new APIs for DebugLib
  MdePkg/BaseDebugLibSerialPort: Add new APIs
  MdePkg/UefidebugLibConOut: Add new APIs
  MdePkg/UefiDebugLibStdErr: Add new APIs
  MdePkg/DxeRuntimeDebugLibSerialPort: Add new APIs
  MdePkg/UefiDebuglibDebugPortProtocol: Add new APIs
  ArmPkg/SemiHostingDebugLib: Add new APIs
  OvmfPkg/PlatformDebugLibIoPort: Add new APIs
  IntelFsp2Pkg/BaseFspDebugLibSerialPort: Add new APIs
  IntelFspPkg/BaseFspDebugLibSerialPort: Add new APIs
  IntelFramworkModulePkg/PeiDxeDebugLibReportStatusCode: Add new APIs
  MdeModulePkg/PeiDxeDebugLibReportStatusCode: Add new APIs
  MdeModulePkg: Add definitions for EDKII DEBUG PPI
  MdeModulePkg: Add a PEIM to install Debug PPI
  MdeModulePkg: Add PEIM and lib to dsc file

 ArmPkg/Library/SemiHostingDebugLib/DebugLib.c  | 106 -
 .../PeiDxeDebugLibReportStatusCode/DebugLib.c  | 142 ++-
 .../Library/BaseFspDebugLibSerialPort/DebugLib.c   | 103 -
 .../Library/BaseFspDebugLibSerialPort/DebugLib.c   | 103 -
 MdeModulePkg/Include/Ppi/Debug.h   |  90 
 .../Library/PeiDebugLibDebugPpi/DebugLib.c | 469 +
 .../PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf|  55 +++
 .../PeiDxeDebugLibReportStatusCode/DebugLib.c  | 144 ++-
 MdeModulePkg/MdeModulePkg.dec  |   3 +
 MdeModulePkg/MdeModulePkg.dsc  |   3 +
 .../Universal/DebugServicePei/DebugService.c   |  68 +++
 .../Universal/DebugServicePei/DebugService.h   |  64 +++
 .../Universal/DebugServicePei/DebugServicePei.c|  54 +++
 .../Universal/DebugServicePei/DebugServicePei.inf  |  51 +++
 .../Universal/DebugServicePei/DebugServicePei.uni  |  20 +
 MdePkg/Include/Library/DebugLib.h  |  52 ++-
 MdePkg/Library/BaseDebugLibNull/DebugLib.c |  56 ++-
 MdePkg/Library/BaseDebugLibSerialPort/DebugLib.c   | 106 -
 .../DxeRuntimeDebugLibSerialPort/DebugLib.c| 106 -
 MdePkg/Library/UefiDebugLibConOut/DebugLib.c   | 106 -
 .../UefiDebugLibDebugPortProtocol/DebugLib.c   | 106 -
 MdePkg/Library/UefiDebugLibStdErr/DebugLib.c   | 107 -
 OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c  | 106 -
 23 files changed, 2142 insertions(+), 78 deletions(-)
 create mode 100644 MdeModulePkg/Include/Ppi/Debug.h
 create mode 100644 MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c
 create mode 100644 
MdeModulePkg/Library/PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf
 create mode 100644 MdeModulePkg/Universal/DebugServicePei/DebugService.c
 create mode 100644 MdeModulePkg/Universal/DebugServicePei/DebugService.h
 create mode 100644 MdeModulePkg/Universal/DebugServicePei/DebugServicePei.c
 create mode 100644 MdeModulePkg/Universal/DebugServicePei/DebugServicePei.inf
 create mode 100644 MdeModulePkg/Universal/DebugServicePei/DebugServicePei.uni

-- 
2.16.2.windows.1

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


[edk2] [PATCH V3 01/17] MdePkg/DebugLib.h: Add new APIs for DebugLib

2019-03-19 Thread Zhichao Gao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395

Add new APIs DebugVPrint and DebugBPrint prototype
definition in the DebugLib header file. These APIs
would expose a print routine with VaList parameter
and BaseList parameter.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
---
 MdePkg/Include/Library/DebugLib.h | 52 ++-
 1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/Library/DebugLib.h 
b/MdePkg/Include/Library/DebugLib.h
index e6a7a357b2..77fb1ee259 100644
--- a/MdePkg/Include/Library/DebugLib.h
+++ b/MdePkg/Include/Library/DebugLib.h
@@ -8,7 +8,7 @@
   of size reduction when compiler optimization is disabled. If MDEPKG_NDEBUG is
   defined, then debug and assert related macros wrapped by it are the NULL 
implementations.
 
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2019, 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
@@ -101,6 +101,56 @@ DebugPrint (
   );
 
 
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevelThe error level of the debug message.
+  @param  FormatFormat string for the debug message to print.
+  @param  VaListMarker  VA_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugVPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  VA_LIST   VaListMarker
+  );
+
+
+/**
+  Prints a debug message to the debug output device if the specified
+  error level is enabled.
+  This function use BASE_LIST which would provide a more compatible
+  service than VA_LIST.
+
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
+  GetDebugPrintErrorLevel (), then print the message specified by Format and
+  the associated variable argument list to the debug output device.
+
+  If Format is NULL, then ASSERT().
+
+  @param  ErrorLevel  The error level of the debug message.
+  @param  Format  Format string for the debug message to print.
+  @param  BaseListMarker  BASE_LIST marker for the variable argument list.
+
+**/
+VOID
+EFIAPI
+DebugBPrint (
+  IN  UINTN ErrorLevel,
+  IN  CONST CHAR8   *Format,
+  IN  BASE_LIST BaseListMarker
+  );
+
+
 /**
   Prints an assert message containing a filename, line number, and description.
   This may be followed by a breakpoint or a dead loop.
-- 
2.16.2.windows.1

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


Re: [edk2] [PATCH RESEND 1/3] OvmfPkg/XenSupport: remove usage of prefetchable PCI host bridge aperture

2019-03-19 Thread Anthony PERARD
On Thu, Mar 14, 2019 at 07:45:56PM +, Igor Druzhinin wrote:
> On 14/03/2019 17:41, Anthony PERARD wrote:
> > Hi,
> > 
> > On Wed, Mar 06, 2019 at 12:40:54PM +, Igor Druzhinin wrote:
> >> This aperture doesn't exist in OVMF and trying to use it causes
> > 
> > I'm trying to understand what you mean by writing "doesn't exist in
> > OVMF". Are prefetchable BAR not handled by ScanForRootBridges() ?
> > Or is it the emulation of the config space that isn't correct?
> > Maybe QEMU should lies about a BAR been prefetchable?
> 
> The problem here is: hvmloader places BARs initially disregarding
> prefetchable bit in an arbitrary order because essentially there is only
> 1 aperture for the host bridge in emulated system under Xen (and KVM as
> well). In PcatPciRootBridgeParseBars() we construct apertures for high
> level OVMF code by reading the BAR placement information after
> hvmloader. It often appears that there are prefetchable and
> non-prefetchable BARs coexist with each other and make prefetchable and
> non-prefetchable apertures overlap. This eventually triggers an
> assertion in high level OVMF code because that shouldn't happen.

Thanks for the explanation. Could you add it to the patch description?

> OVMF for KVM is not using prefetchable BAR at all - see
> PciHostBridgeGetRootBridges() in which it passes mNonExistAperture dummy
> object to high level code. I think it's wrong to construct a
> prefetchable aperture for Xen and this code should be removed as it's
> done for QEMU-KVM. Do you think this patch needs to do that?

It would be nice to remove the code that isn't useful so feel free to do
it and/or keep the current patch with the description updated.

Thanks,

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


Re: [edk2] [PATCH V2 01/17] MdePkg/DebugLib.h: Add a new api DebugVPrint for DebugLib

2019-03-19 Thread Gao, Liming
Jordan:
  I suggest to add the line length discussion in edk2 community meeting. Which 
length is better, 80 or 120? If we expect every patch follows this rule, do we 
need update PatchCheck to add the checker, and notify the developer know this 
requirement?

  For now, I suggest that the developer bases on current process, pass 
PatchCheck and code review. 

Thanks
Liming
>-Original Message-
>From: Justen, Jordan L
>Sent: Tuesday, March 19, 2019 2:34 AM
>To: Gao, Liming ; Gao, Zhichao
>; edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Bret Barkelew
>; Michael Turner
>; Gao, Liming 
>Subject: RE: [edk2] [PATCH V2 01/17] MdePkg/DebugLib.h: Add a new api
>DebugVPrint for DebugLib
>
>On 2019-03-18 08:09:36, Gao, Liming wrote:
>> Jordan:
>>   Coding style document CCS_2_1_Draft.pdf 5.1 General Rules, 5.1.1
>>   Lines shall be 120 columns, or less. Preferably, limit line
>>   lengths to 80 columns or less. So, I don't think the line length
>>   bigger than 80 and less than 120 violates coding style documents.
>
>I think this is clarified as an "exception" base: "When this doesn’t
>leave sufficient space for a good postfix style comment, extend the
>line to a total of 120 columns."
>
>That doesn't apply to this case.
>
>I have never seen a case where I thought this exception was useful in
>EDK II. I think the exception should be removed, because if a true
>exceptional case ever did arise, it would be so obvious, no one would
>need to question it.
>
>The only case I've seen (not in EDK II) where going beyond 80 columns
>seemed to make some sense was a table processed by a build tool. In
>that case the table has so many columns that line went beyond 80
>columns.
>
>There a good code-readability reasons for this limit. For one, we can
>be almost certain that everyone will have 80 columns visible in their
>editor. But, just as importantly, as the line gets too long, it
>becomes more challenging to track back to the start of the next line.
>(Think of newspaper columns, and imagine if they ran all the way
>across the page.) I'm not sure 80 columns is the "perfect" number, but
>it does seem that most agree it is probably close.
>
>>   We should update wiki
>>   https://github.com/tianocore/tianocore.github.io/wiki/Code-Style-C
>>   to match the documentation. Limit line length to 120 characters
>>   instead of 80 characters.
>
>Since this is an "exception", and not normally helpful, I don't think
>we should add it do the wiki. It will only add confusion and lead to
>more code that doesn't follow the preferred limit.
>
>-Jordan
>
>>
>> > -Original Message-
>> > From: Justen, Jordan L
>> > Sent: Monday, March 18, 2019 2:21 PM
>> > To: Gao, Zhichao ; edk2-devel@lists.01.org
>> > Cc: Kinney, Michael D ; Bret Barkelew
>; Michael Turner
>> > ; Gao, Liming 
>> > Subject: RE: [edk2] [PATCH V2 01/17] MdePkg/DebugLib.h: Add a new api
>DebugVPrint for DebugLib
>> >
>> > On 2019-03-17 17:14:40, Gao, Zhichao wrote:
>> > > > -Original Message-
>> > > > From: Justen, Jordan L
>> > > > Sent: Friday, March 15, 2019 2:16 PM
>> > > >
>> > > > On 2019-03-14 22:17:33, Zhichao Gao wrote:
>> > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1395
>> > > > >
>> > > > > Add a new api DebugVPrint prototype definition in the
>> > > > > DebugLib header file. This api would expose a print
>> > > > > routine with VaList parameter.
>> > > >
>> > > > These lines seem to be fairly short, with the longest be 54 chars. I
>guess not a
>> > > > problem, but by the recommendation says they could be up to 75 in
>length.
>> > > >
>> > > > https://github.com/tianocore/tianocore.github.io/wiki/Commit-
>Message-
>> > > > Format
>> > > >
>> > >
>> > > It is hard for someone to control the characters in a line.
>> >
>> > I guess that depends on your editor. :)
>> >
>> > > Making the text massage readable base on the rules make more sense.
>> > > It is easier to control the chars number within 75. Line length less
>> > > than 76 characters is legal.
>> >
>> > Yes, I mentioned it is legal, but it is noticably short. I don't think
>> > it is so short that it is really a problem, so feel free to leave it
>> > if you prefer.
>> >
>> > > >
>> > > > According to the style guide:
>> > > >
>> > > >   "Preferably, limit line lengths to 80 columns or less."
>> > > >
>> > > > https://github.com/tianocore/tianocore.github.io/wiki/Code-Style-C
>> > > >
>> > > > https://github.com/tianocore-
>> > > > docs/Docs/raw/master/Specifications/CCS_2_1_Draft.pdf
>> > > >
>> > > > But, this line uses 92 columns.
>> > > >
>> > > > I think there are similar cases in other patches.
>> > >
>> > > Right. This sentence I copied from the comment of DebugPrint
>> > > function which might be designed for a long time. The CCS might not
>> > > be designed as such style at that time. For this, it's better to
>> > > change both of the two sentences.
>> > > By the way, the whole edk2 repo may contain a lot of lines violated
>> > > this rule. It takes effort to fix 

[edk2] [PATCH v2 6/6] DynamicTablesPkg: Minor updates and fix typos

2019-03-19 Thread Sami Mujawar
This patch was originally merged in edk2 master at
07f4e26eb6fe5203028ecfe9bad90d3b67dc72c8. However, this was
later reverted at 4c20a791fdbd3b4c83dba060fefa84027313
as it was merged during the Soft Feature Freeze for
edk2-stable201903.

Resubmitting this patch as the edk2 merge window is now open.

Minor updates to comments and typo fixes. Also removed
unused structure CM_ARM_CPU_INFO_LIST.

Cc: Laszlo Ersek 
Cc: Alexei Fedorov 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar 
Reviewed-by: Alexei Fedorov 
---
 DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 66 
 1 file changed, 55 insertions(+), 11 deletions(-)

diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h 
b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
index 
73139eb3273e89205ef9e6bee67b1b842f7f516b..ec31c40449d0658f98a89ce0bb6f604b491f1f34
 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -59,6 +59,8 @@ typedef enum ArmObjectID {
 
 /** A structure that describes the
 ARM Boot Architecture flags.
+
+ID: EArmObjBootArchInfo
 */
 typedef struct CmArmBootArchInfo {
   /** This is the ARM_BOOT_ARCH flags field of the FADT Table
@@ -71,13 +73,10 @@ typedef struct CmArmCpuInfo {
   // Reserved for use when SMBIOS tables are implemented
 } CM_ARM_CPU_INFO;
 
-typedef struct CmArmCpuInfoList {
-  UINT32 CpuCount;
-  CM_ARM_CPU_INFO  * CpuInfo;
-} CM_ARM_CPU_INFO_LIST;
-
 /** A structure that describes the
 Power Management Profile Information for the Platform.
+
+ID: EArmObjPowerManagementProfileInfo
 */
 typedef struct CmArmPowerManagementProfileInfo {
   /** This is the Preferred_PM_Profile field of the FADT Table
@@ -88,6 +87,8 @@ typedef struct CmArmPowerManagementProfileInfo {
 
 /** A structure that describes the
 GIC CPU Interface for the Platform.
+
+ID: EArmObjGicCInfo
 */
 typedef struct CmArmGicCInfo {
   /// The GIC CPU Interface number.
@@ -164,6 +165,8 @@ typedef struct CmArmGicCInfo {
 
 /** A structure that describes the
 GIC Distributor information for the Platform.
+
+ID: EArmObjGicDInfo
 */
 typedef struct CmArmGicDInfo {
   /// The Physical Base address for the GIC Distributor.
@@ -184,6 +187,8 @@ typedef struct CmArmGicDInfo {
 
 /** A structure that describes the
 GIC MSI Frame information for the Platform.
+
+ID: EArmObjGicMsiFrameInfo
 */
 typedef struct CmArmGicMsiFrameInfo {
   /// The GIC MSI Frame ID
@@ -207,6 +212,8 @@ typedef struct CmArmGicMsiFrameInfo {
 
 /** A structure that describes the
 GIC Redistributor information for the Platform.
+
+ID: EArmObjGicRedistributorInfo
 */
 typedef struct CmArmGicRedistInfo {
   /** The physical address of a page range
@@ -220,6 +227,8 @@ typedef struct CmArmGicRedistInfo {
 
 /** A structure that describes the
 GIC Interrupt Translation Service information for the Platform.
+
+ID: EArmObjGicItsInfo
 */
 typedef struct CmArmGicItsInfo {
   /// The GIC ITS ID
@@ -231,6 +240,9 @@ typedef struct CmArmGicItsInfo {
 
 /** A structure that describes the
 Serial Port information for the Platform.
+
+ID: EArmObjSerialConsolePortInfo or
+EArmObjSerialDebugPortInfo
 */
 typedef struct CmArmSerialPortInfo {
   /// The physical base address for the serial port
@@ -251,6 +263,8 @@ typedef struct CmArmSerialPortInfo {
 
 /** A structure that describes the
 Generic Timer information for the Platform.
+
+ID: EArmObjGenericTimerInfo
 */
 typedef struct CmArmGenericTimerInfo {
   /// The physical base address for the counter control frame
@@ -286,6 +300,8 @@ typedef struct CmArmGenericTimerInfo {
 
 /** A structure that describes the
 Platform Generic Block Timer Frame information for the Platform.
+
+ID: EArmObjGTBlockTimerFrameInfo
 */
 typedef struct CmArmGTBlockTimerFrameInfo {
   /// The Generic Timer frame number
@@ -321,6 +337,8 @@ typedef struct CmArmGTBlockTimerFrameInfo {
 
 /** A structure that describes the
 Platform Generic Block Timer information for the Platform.
+
+ID: EArmObjPlatformGTBlockInfo
 */
 typedef struct CmArmGTBlockInfo {
   /// The physical base address for the GT Block Timer structure
@@ -335,6 +353,8 @@ typedef struct CmArmGTBlockInfo {
 
 /** A structure that describes the
 SBSA Generic Watchdog information for the Platform.
+
+ID: EArmObjPlatformGenericWatchdogInfo
 */
 typedef struct CmArmGenericWatchdogInfo {
   /// The physical base address of the SBSA Watchdog control frame
@@ -354,6 +374,8 @@ typedef struct CmArmGenericWatchdogInfo {
 
 /** A structure that describes the
 PCI Configuration Space information for the Platform.
+
+ID: EArmObjPciConfigSpaceInfo
 */
 typedef struct CmArmPciConfigSpaceInfo {
   /// The physical base address for the PCI segment
@@ -371,6 +393,8 @@ typedef struct CmArmPciConfigSpaceInfo {
 
 /** A structure that describes the
 Hypervisor Vendor ID information for the Platform.
+

[edk2] [PATCH v2 3/6] DynamicTablesPkg: Add OEM Info

2019-03-19 Thread Sami Mujawar
This patch originally merged in edk2 master at
c788bdaba47536447ae37518a96d92e0da54aad7. However, this was
later reverted at bdbbedea949eb4b10d24110c0e559b03c7a6bce4
as it was merged during the Soft Feature Freeze for
edk2-stable201903.

Resubmitting this patch as the edk2 merge window is now open.

Added option for OEMs to provide OEM Table ID and
OEM Revision for ACPI tables.

Cc: Laszlo Ersek 
Cc: Alexei Fedorov 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar 
Reviewed-by: Alexei Fedorov 
---
 DynamicTablesPkg/Include/Library/TableHelperLib.h|  4 +--
 DynamicTablesPkg/Include/StandardNameSpaceObjects.h  | 18 
++
 DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c |  2 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c |  2 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c |  2 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c |  2 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c |  2 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c |  2 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c |  2 +-
 DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c | 26 
++--
 10 files changed, 46 insertions(+), 16 deletions(-)

diff --git a/DynamicTablesPkg/Include/Library/TableHelperLib.h 
b/DynamicTablesPkg/Include/Library/TableHelperLib.h
index 
3c4e1d23d2e6955388ab0b51fb57779f2225beb2..0f872bc3d08bf78e33bd8dab866e7bf57e00cb8c
 100644
--- a/DynamicTablesPkg/Include/Library/TableHelperLib.h
+++ b/DynamicTablesPkg/Include/Library/TableHelperLib.h
@@ -45,7 +45,7 @@ GetCgfMgrInfo (
   @param [in] Generator  Pointer to the ACPI table Generator.
   @param [in,out] AcpiHeader Pointer to the ACPI table header to be
  updated.
-  @param [in] Revision   Revision of the ACPI table.
+  @param [in] AcpiTableInfo  Pointer to the ACPI table info structure.
   @param [in] Length Length of the ACPI table.
 
   @retval EFI_SUCCESS   The ACPI table is updated successfully.
@@ -61,7 +61,7 @@ AddAcpiHeader (
   IN  CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
   IN  CONST ACPI_TABLE_GENERATOR  * CONST Generator,
   IN OUT  EFI_ACPI_DESCRIPTION_HEADER * CONST AcpiHeader,
-  IN  CONST UINT32Revision,
+  IN  CONST CM_STD_OBJ_ACPI_TABLE_INFO* CONST AcpiTableInfo,
   IN  CONST UINT32Length
   );
 
diff --git a/DynamicTablesPkg/Include/StandardNameSpaceObjects.h 
b/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
index 
4377ee8f785399b02fec824f3a34d2f4ed3b1c01..58503858b27141cf7647a410c4b0b3fa574033de
 100644
--- a/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
@@ -93,6 +93,24 @@ typedef struct CmAStdObjAcpiTableInfo {
   /// Optional pointer to the ACPI table data
   EFI_ACPI_DESCRIPTION_HEADER  * AcpiTableData;
 
+  /// An OEM-supplied string that the OEM uses to identify the particular
+  /// data table. This field is particularly useful when defining a definition
+  /// block to distinguish definition block functions. The OEM assigns each
+  /// dissimilar table a new OEM Table ID.
+  /// This field could be constructed using the SIGNATURE_64() macro.
+  ///   e.g. SIGNATURE_64 ('A','R','M','H','G','T','D','T')
+  /// Note: If this field is not populated (has value of Zero), then the
+  /// Generators shall populate this information using part of the
+  /// CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.OemId field and the
+  /// ACPI table signature.
+  UINT64 OemTableId;
+
+  /// An OEM-supplied revision number. Larger numbers are assumed to be
+  /// newer revisions.
+  /// Note: If this field is not populated (has value of Zero), then the
+  /// Generators shall populate this information using the revision of the
+  /// Configuration Manager (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.Revision).
+  UINT32 OemRevision;
 } CM_STD_OBJ_ACPI_TABLE_INFO;
 
 /** A structure used to describe the SMBIOS table generators to be invoked.
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
index 
e21e2b660634b1aedce8167b74573694d6df2a3b..697cfc46abaedf34d30abf26e7ebb2b4d271822a
 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
@@ -342,7 +342,7 @@ BuildDbg2Table (
  CfgMgrProtocol,
  This,
  (EFI_ACPI_DESCRIPTION_HEADER*),
- AcpiTableInfo->AcpiTableRevision,
+ AcpiTableInfo,
  sizeof (DBG2_TABLE)
  );
   if 

[edk2] [PATCH v2 5/6] DynamicTablesPkg: Remove GIC Distributor Id field

2019-03-19 Thread Sami Mujawar
This patch was originally merged in edk2 master at
d3a15f435f9716aa2f2ea5e9b35fcda04f267ab4. However, this was
later reverted at 82c4426a176c271d24915b403b267a431bdc52f5
as it was merged during the Soft Feature Freeze for
edk2-stable201903.

Resubmitting this patch as the edk2 merge window is now open.

According to ACPI 6.2 Specification - Errata A, 'One,
and only one, GIC distributor structure must be present
in the MADT for an ARM based system'. Therefore,
the GIC Distributor ID field in the ACPI MADT GICD
substructure can be set to zero and there is no need
for the Configuration Manager to provide this information.

Update the CM_ARM_GICD_INFO structure to remove the GicId
field. Similarly update the MADT Generator to set the GicId
field in the GICD substructure to zero.

Cc: Laszlo Ersek 
Cc: Alexei Fedorov 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar 
Reviewed-by: Alexei Fedorov 
---
 DynamicTablesPkg/Include/ArmNameSpaceObjects.h   | 5 +
 DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c | 4 +++-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h 
b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
index 
2adaa788083e4e15d049f5f6b6312f77f3c02488..73139eb3273e89205ef9e6bee67b1b842f7f516b
 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+  Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
@@ -166,9 +166,6 @@ typedef struct CmArmGicCInfo {
 GIC Distributor information for the Platform.
 */
 typedef struct CmArmGicDInfo {
-  /// The GIC Distributor ID.
-  UINT32  GicId;
-
   /// The Physical Base address for the GIC Distributor.
   UINT64  PhysicalBaseAddress;
 
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
index 
1ee0b9e006bfa00ea5bbf6aa64209dac244c90a0..6b89c3f65d36ff35fcfc81cdffdeae8e4306c976
 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
@@ -192,7 +192,9 @@ AddGICD (
   // UINT16 Reserved
   Gicd->Reserved1 = EFI_ACPI_RESERVED_WORD;
   // UINT32 Identifier
-  Gicd->GicId = GicDInfo->GicId;
+  // One, and only one, GIC distributor structure must be present
+  // in the MADT for an ARM based system
+  Gicd->GicId = 0;
   // UINT64 PhysicalBaseAddress
   Gicd->PhysicalBaseAddress = GicDInfo->PhysicalBaseAddress;
   // UINT32 VectorBase
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


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


[edk2] [PATCH v2 4/6] DynamicTablesPkg: DGB2: Update DBG2_DEBUG_PORT_DDI

2019-03-19 Thread Sami Mujawar
This patch was originally merged in edk2 master at
6814256083a90ef218e7ae240e51922045175df1. However, this was
later reverted at db8382ef5e44bd07654fb4726b77f3c329210561
as it was merged during the Soft Feature Freeze for
edk2-stable201903.

Resubmitting this patch as the edk2 merge window is now open.

The DBG2_DEBUG_PORT_DDI() macro supports adding only one
Generic Base Address Register. Therefore, removed the
superfluous parameter NumReg and updated the macro to
use DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS which has
a value 1.

Cc: Laszlo Ersek 
Cc: Alexei Fedorov 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar 
Reviewed-by: Alexei Fedorov 
---
 DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
index 
697cfc46abaedf34d30abf26e7ebb2b4d271822a..90380f48da017b257476ee63bcc1beae5efe1d65
 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
@@ -97,14 +97,12 @@ typedef struct {
 /** A helper macro used for initializing the debug port device
 information structure.
 
-  @param [in]  NumReg   The number of generic address registers.
   @param [in]  SubType  The DBG Port SubType.
   @param [in]  UartBase The UART port base address.
   @param [in]  UartAddrLen  The UART port address range length.
   @param [in]  UartNameStr  The UART port name string.
 **/
 #define DBG2_DEBUG_PORT_DDI(  \
-  NumReg, \
   SubType,\
   UartBase,   \
   UartAddrLen,\
@@ -116,7 +114,7 @@ typedef struct {
   /* UINT16Length */  \
   sizeof (DBG2_DEBUG_DEVICE_INFORMATION), \
   /* UINT8 NumberofGenericAddressRegisters */ \
-  NumReg, \
+  DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS,   \
   /* UINT16NameSpaceStringLength */   \
   DBG2_NAMESPACESTRING_FIELD_SIZE,\
   /* UINT16NameSpaceStringOffset */   \
@@ -164,7 +162,6 @@ DBG2_TABLE AcpiDbg2 = {
  * Debug port 1
  */
 DBG2_DEBUG_PORT_DDI (
-  DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS,
   0,// {Template}: Serial Port Subtype
   0,// {Template}: Serial Port Base Address
   PL011_UART_LENGTH,
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


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


[edk2] [PATCH v2 2/6] DynamicTablesPkg: Rename enum used for ID Mapping

2019-03-19 Thread Sami Mujawar
This patch was originally merged in edk2 master at
1d49a75367ef6827b8b8f77f61e9ce245d1bdee3. However, this was
later reverted at 334111b0dab80394aeb1ebb8f0f3314847e2dc1f
as it was merged during the Soft Feature Freeze for
edk2-stable201903.

Resubmitting this patch as the edk2 merge window is now open.

Renamed the enum EArmObjIdMapping to EArmObjIdMappingArray
and updated the IORT generator accordingly.

Cc: Laszlo Ersek 
Cc: Alexei Fedorov 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar 
Reviewed-by: Alexei Fedorov 
---
 DynamicTablesPkg/Include/ArmNameSpaceObjects.h   | 2 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h 
b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
index 
93cb6949f0eb2ac2ad3524494e4a14c7a6fab4b8..2adaa788083e4e15d049f5f6b6312f77f3c02488
 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -52,7 +52,7 @@ typedef enum ArmObjectID {
   EArmObjSmmuV3,  ///< 22 - SMMUv3
   EArmObjPmcg,///< 23 - PMCG
   EArmObjGicItsIdentifierArray,   ///< 24 - GIC ITS Identifier Array
-  EArmObjIdMapping,   ///< 25 - ID Mapping
+  EArmObjIdMappingArray,  ///< 25 - ID Mapping Array
   EArmObjSmmuInterruptArray,  ///< 26 - SMMU Interrupt Array
   EArmObjMax
 } EARM_OBJECT_ID;
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
index 
a3ee60664ecbeb1b12b01683f838e11804884daf..b53c4bb47798d4ad441db1fe1b1e5b180e313403
 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
@@ -44,7 +44,7 @@ Requirements:
   - EArmObjSmmuV3
   - EArmObjPmcg
   - EArmObjGicItsIdentifierArray
-  - EArmObjIdMapping
+  - EArmObjIdMappingArray
   - EArmObjGicItsIdentifierArray
 */
 
@@ -116,7 +116,7 @@ GET_OBJECT_LIST (
 */
 GET_OBJECT_LIST (
   EObjNameSpaceArm,
-  EArmObjIdMapping,
+  EArmObjIdMappingArray,
   CM_ARM_ID_MAPPING
   );
 
@@ -653,7 +653,7 @@ AddIdMappingArray (
   Generator = (ACPI_IORT_GENERATOR*)This;
 
   // Get the Id Mapping Array
-  Status = GetEArmObjIdMapping (
+  Status = GetEArmObjIdMappingArray (
  CfgMgrProtocol,
  IdMappingToken,
  ,
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


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


[edk2] [PATCH v2 0/6] DynamicTablesPkg: Framework updates and fixes

2019-03-19 Thread Sami Mujawar
This patch series was originally merged in edk2 master. However, this
was later reverted as it was merged during the Soft Feature Freeze for
edk2-stable201903.

Resubmitting this patch series as the edk2 merge window is now open.

This patch series updates the Dynamic Tables Framework to
incorporate the following changes:
  * Fix protocol section.
  * Add options for OEMs to provide OEM Table ID and revision.
  * Update DBG2_DEBUG_PORT_DDI macro to remove unused parameter.
  * Remove GIC Distributor ID field.
  * Minor updates to comments and typo fixes.

Cc: Laszlo Ersek 
Cc: Alexei Fedorov 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar 

The changes can be seen at:
https://github.com/samimujawar/edk2/tree/473_dynamic_tables_framework_v2

The corresponding edk2-platform code changes can be seen at:
https://github.com/samimujawar/edk2-platforms/tree/473_dynamic_tables_framework_v1

Sami Mujawar (6):
  DynamicTablesPkg: Fix protocol section
  DynamicTablesPkg: Rename enum used for ID Mapping
  DynamicTablesPkg: Add OEM Info
  DynamicTablesPkg: DGB2: Update DBG2_DEBUG_PORT_DDI
  DynamicTablesPkg: Remove GIC Distributor Id field
  DynamicTablesPkg: Minor updates and fix typos

 DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf |  
7 +-
 DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf |  
7 +-
 DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 
73 +++-
 DynamicTablesPkg/Include/Library/TableHelperLib.h  |  
4 +-
 DynamicTablesPkg/Include/StandardNameSpaceObjects.h| 
18 +
 DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c   |  
7 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c   |  
2 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c   |  
2 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c   |  
8 +--
 DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c   |  
6 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c   |  
2 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c   |  
2 +-
 DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c   | 
26 +--
 13 files changed, 116 insertions(+), 48 deletions(-)

-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


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


[edk2] [PATCH v2 1/6] DynamicTablesPkg: Fix protocol section

2019-03-19 Thread Sami Mujawar
This patch was originally merged in edk2 master at
bde673b2dcd1b087af7f49dd5f0c3b82b02172a5. However, this was
later reverted at 7d180efeaa03df25973416dc0aad099f4fe7e251
as it was merged during the Soft Feature Freeze for
edk2-stable201903.

Resubmitting this patch as the edk2 merge window is now open.

Updated the Protocols section to reflect the protocols
that are produced or consumed.

Cc: Laszlo Ersek 
Cc: Alexei Fedorov 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar 
Reviewed-by: Alexei Fedorov 
---
 DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf | 7 
++-
 DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf | 7 
---
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git 
a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf 
b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
index 
740811d0fc0590543a62360e6753eb04fb675d70..02c907c38023e8b44829a38ed93436904d8cf3d3
 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
+++ b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Module to manage the list of available table factories.
 #
-#  Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+#  Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -51,10 +51,7 @@ [FixedPcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomDTGenerators
 
 [Protocols]
-  gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-  gEfiSmbiosProtocolGuid# PROTOCOL ALWAYS_CONSUMED
-  gEdkiiConfigurationManagerProtocolGuid
-  gEdkiiDynamicTableFactoryProtocolGuid
+  gEdkiiDynamicTableFactoryProtocolGuid # PRODUCES
 
 [Depex]
   TRUE
diff --git 
a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf 
b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf
index 
fef8b20672fb943b78302a152fcf0f66db264b0a..e78218a914ce993f3e605841e2bffae700076dd0
 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf
+++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf
@@ -1,7 +1,7 @@
 ## @file
 # Module that drives the table generation and installation process.
 #
-#  Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+#  Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD 
License
@@ -42,8 +42,9 @@ [LibraryClasses]
 
 [Protocols]
   gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-  gEdkiiConfigurationManagerProtocolGuid
-  gEdkiiDynamicTableFactoryProtocolGuid
+
+  gEdkiiConfigurationManagerProtocolGuid# PROTOCOL ALWAYS_CONSUMED
+  gEdkiiDynamicTableFactoryProtocolGuid # PROTOCOL ALWAYS_CONSUMED
 
 [Depex]
   gEfiAcpiTableProtocolGuid AND
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


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


Re: [edk2] [Patch MdeModulePkg/Library v1 1/1] MdeModulePkg/UefiBootManangerLib: Fix exception issue

2019-03-19 Thread Leif Lindholm
Thanks, Ming.

On Tue, Mar 19, 2019 at 08:59:13PM +0800, Ming Huang wrote:
> The system environment: virtual-CDROM(USB interface) via BMC, insert a
> iso file to CDROM, like ubuntu-18.04.1-server-arm64.iso, change CDROM
> to first boot option.
> With release version bios, disconnecting CDROM when boot to
> "1 seconds left, Press Esc or F2 to enter Setup"
> then system will get a exception.
> 
> The root cause is the EFI_BLOCK_IO_PROTOCOL for UsbMass will be uninstalled
> in this situation after print some transfer error. The status will be
> invalid parameter. This line will get a exception for BlockIo not point
> to right address:
> AllocatePool (BlockIo->Media->BlockSize)
> So, here need to judge the status after ASSERT_EFI_ERROR.
> 
> The Bugzilla tracker for this:
> https://bugzilla.tianocore.org/show_bug.cgi?id=1631
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ming Huang 

Reviewed-by: Leif Lindholm 

> ---
>  MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
> b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> index 4ce83ce22d61..0535cd7335b4 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> @@ -1069,6 +1069,9 @@ BmExpandMediaDevicePath (
>//
>Status = gBS->HandleProtocol (Handle, , (VOID **) 
> );
>ASSERT_EFI_ERROR (Status);
> +  if (EFI_ERROR (Status)) {
> +return NULL;
> +  }
>Buffer = AllocatePool (BlockIo->Media->BlockSize);
>if (Buffer != NULL) {
>  BlockIo->ReadBlocks (
> -- 
> 2.9.5
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [edk2-test] SctPkg compilation is failing

2019-03-19 Thread Supreeth Venkatesh
Sorry, I had to make a few changes to get uefi-sct working with 
edk2-stable201903 
tag.
I will update the instructions after posting those patches.

Please let me know which versions of edk2 and edk2-test are you using, so that 
I can look into that first and let you know.

Thanks,
Supreeth

From: Meenakshi Aggarwal 
Sent: Tuesday, March 19, 2019 12:19 AM
To: Supreeth Venkatesh ; edk2-devel@lists.01.org
Cc: Dong Wei ; Jin, Eric ; Udit Kumar 
; Varun Sethi 
Subject: RE: [edk2-test] SctPkg compilation is failing

Hi Supreeth,

I tried the step suggested by you, but still facing error:

meenakshi@uefi-OptiPlex-790:~/SCT/edk2/SctPkg$ export 
EDK_TOOLS_PATH="/home/meenakshi/SCT/edk2/BaseTools"
meenakshi@uefi-OptiPlex-790:~/SCT/edk2/SctPkg$ rm -f 
$EDK_TOOLS_PATH/Source/C/bin/GenBin
meenakshi@uefi-OptiPlex-790:~/SCT/edk2/SctPkg$ cd ..
meenakshi@uefi-OptiPlex-790:~/SCT/edk2$ ./SctPkg/build.sh AARCH64 GCC
Target: AARCH64
Build: other
TOOLCHAIN is GCC49
Toolchain prefix: GCC49_AARCH64_PREFIX=aarch64-linux-gnu-
Building from: /home/meenakshi/SCT/edk2
using prebuilt tools
Building GenBin
make: Entering directory 
`/home/meenakshi/SCT/edk2-test/uefi-sct/SctPkg/Tools/Source/GenBin'
make: *** No rule to make target `../Include/Common/BuildVersion.h', needed by 
`GenBin.o'.  Stop.
make: Leaving directory 
`/home/meenakshi/SCT/edk2-test/uefi-sct/SctPkg/Tools/Source/GenBin'
Error while building GenBin


Also, i can't see any update in compilation steps in edk2-test repository.
Please update latest steps.


Thanks,
Meenakshi

From: Supreeth Venkatesh 
mailto:supreeth.venkat...@arm.com>>
Sent: Monday, March 18, 2019 9:37 PM
To: Meenakshi Aggarwal 
mailto:meenakshi.aggar...@nxp.com>>; 
edk2-devel@lists.01.org
Cc: Dong Wei mailto:dong@arm.com>>; Jin, Eric 
mailto:eric@intel.com>>
Subject: RE:[edk2-test] SctPkg compilation is failing

Changing Subject line to append [edk2-test].

If the source code for edk2 and/or edk2-test is stale, this may happen,
as GenBin is no longer a pre-built binary but it is getting built from the 
source.

Please try this with the existing build and recompile.
rm -f $EDK_TOOLS_PATH/Source/C/bin/GenBin

Also,
Build instructions need update, since UTWG decided to use edk2 stable releases 
tag.
I will update the instructions today.

Thanks,
Supreeth
From: Meenakshi Aggarwal 
mailto:meenakshi.aggar...@nxp.com>>
Sent: Monday, March 18, 2019 1:42 AM
To: edk2-devel@lists.01.org; Supreeth Venkatesh 
mailto:supreeth.venkat...@arm.com>>
Subject: SctPkg compilation is failing

Hi,


I followed below steps to compile SctPkg:

Refer to SctPkg/Tools/Source/GenBin/HowTo.txt to gen the GenBin and copy it to 
Home/Dev/SctWorkspace/Bin/BaseTools/BinWrappers/PosixLike

Build Instructions for UEFI SCTII AARCH64 (Linux)
   1) mkdir "sct_workspace"
   2) cd sct_workspace
   3) git clone 
https://github.com/tianocore/edk2-test.git
   4) git clone 
https://github.com/tianocore/edk2
   5) cd edk2
   6) git checkout UDK2017
   7) ln -s ../edk2-test/uefi-sct/SctPkg SctPkg
   8) cd ..
   9) mkdir -p "tools/gcc"
  10) cd "tools/gcc"
  11) wget -nv 
"https://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/aarch64-linux-gnu/gcc-linaro-4.9-2016.02-x86_64_aarch64-linux-gnu.tar.xz"
  12) tar -xf gcc-linaro-4.9-2016.02-x86_64_aarch64-linux-gnu.tar.xz
  13) cd ../..
  14) export 
PATH=$PATH:"$PWD/tools/gcc/gcc-linaro-4.9-2016.02-x86_64_aarch64-linux-gnu/bin"
  15) export 
CROSS_COMPILE="$PWD/tools/gcc/gcc-linaro-4.9-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-"
  16) ./SctPkg/build.sh AARCH64 GCC


But I am facing below error:

meenakshi@uefi-OptiPlex-790:~/SCT/edk2$ ./SctPkg/build.sh AARCH64 GCC
Target: AARCH64
Build: other
TOOLCHAIN is GCC49
Toolchain prefix: GCC49_AARCH64_PREFIX=aarch64-linux-gnu-
Building from: /home/meenakshi/SCT/edk2
using prebuilt tools
Building GenBin
make: Entering directory 

[edk2] [Patch MdeModulePkg/Library v1 0/1] Fix exception issue while UsbMass block io uninstalled

2019-03-19 Thread Ming Huang
The Bugzilla tracker for this:
https://bugzilla.tianocore.org/show_bug.cgi?id=1631

Ming Huang (1):
  MdeModulePkg/UefiBootManangerLib: Fix exception issue

 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.9.5

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


[edk2] [Patch MdeModulePkg/Library v1 1/1] MdeModulePkg/UefiBootManangerLib: Fix exception issue

2019-03-19 Thread Ming Huang
The system environment: virtual-CDROM(USB interface) via BMC, insert a
iso file to CDROM, like ubuntu-18.04.1-server-arm64.iso, change CDROM
to first boot option.
With release version bios, disconnecting CDROM when boot to
"1 seconds left, Press Esc or F2 to enter Setup"
then system will get a exception.

The root cause is the EFI_BLOCK_IO_PROTOCOL for UsbMass will be uninstalled
in this situation after print some transfer error. The status will be
invalid parameter. This line will get a exception for BlockIo not point
to right address:
AllocatePool (BlockIo->Media->BlockSize)
So, here need to judge the status after ASSERT_EFI_ERROR.

The Bugzilla tracker for this:
https://bugzilla.tianocore.org/show_bug.cgi?id=1631

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang 
---
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c 
b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 4ce83ce22d61..0535cd7335b4 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1069,6 +1069,9 @@ BmExpandMediaDevicePath (
   //
   Status = gBS->HandleProtocol (Handle, , (VOID **) 
);
   ASSERT_EFI_ERROR (Status);
+  if (EFI_ERROR (Status)) {
+return NULL;
+  }
   Buffer = AllocatePool (BlockIo->Media->BlockSize);
   if (Buffer != NULL) {
 BlockIo->ReadBlocks (
-- 
2.9.5

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


Re: [edk2] [MdeModulePkg/Library v1 1/1] MdeModulePkg/UefiBootManangerLib: Fix exception issue

2019-03-19 Thread Ming Huang



On 3/19/2019 1:56 PM, Wu, Hao A wrote:
>> -Original Message-
>> From: Ming Huang [mailto:ming.hu...@linaro.org]
>> Sent: Tuesday, March 19, 2019 12:14 PM
>> To: Wu, Hao A; Leif Lindholm
>> Cc: linaro-u...@lists.linaro.org; edk2-devel@lists.01.org; Zeng, Star; Dong,
>> Eric; Ni, Ray; dann.fraz...@canonical.com; ard.biesheu...@linaro.org; Kinney,
>> Michael D; Gao, Liming; wanghuiqi...@huawei.com;
>> huangmin...@huawei.com; zhangjinso...@huawei.com;
>> huangda...@hisilicon.com; wai...@126.com; Wang, Jian J
>> Subject: Re: [MdeModulePkg/Library v1 1/1]
>> MdeModulePkg/UefiBootManangerLib: Fix exception issue
>>
>>
>>
>> On 3/19/2019 10:25 AM, Wu, Hao A wrote:
 -Original Message-
 From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
 Sent: Monday, March 18, 2019 8:43 PM
 To: Ming Huang
 Cc: linaro-u...@lists.linaro.org; edk2-devel@lists.01.org; Zeng, Star; 
 Dong,
 Eric; Ni, Ray; dann.fraz...@canonical.com; ard.biesheu...@linaro.org;
>> Kinney,
 Michael D; Gao, Liming; wanghuiqi...@huawei.com;
 huangmin...@huawei.com; zhangjinso...@huawei.com;
 huangda...@hisilicon.com; wai...@126.com; Wang, Jian J; Wu, Hao A;
>> Ni,
 Ray
 Subject: Re: [MdeModulePkg/Library v1 1/1]
 MdeModulePkg/UefiBootManangerLib: Fix exception issue

 +MdeModulePkg maintainers (you added MdePkg maintainers to cc)

 This looks like an improvement to me.

 Am I correct in guessing this behaviour refers to some specific corner
 case of a USB CDROM emulated from a BMC?

 On Mon, Feb 25, 2019 at 05:10:52PM +0800, Ming Huang wrote:
> The system environment: virtual-CDROM(USB interface) via BMC, insert
>> a
> iso file to CDROM, like ubuntu-18.04.1-server-arm64.iso, change CDROM
> to first boot option.
> With release version bios, disconnecting CDROM when boot to
> "1 seconds left, Press Esc or F2 to enter Setup"
> then system will get a exception.
>
> The root cause is the EFI_BLOCK_IO_PROTOCOL for UsbMass will be
 uninstalled
> in this situation after print some transfer error. The status will be
> invalid parameter. This line will get a exception for BlockIo not point
>>>
>>> Do you mean 'EFI_INVALID_PARAMETER' is returned from:
>>>   Status = gBS->HandleProtocol (Handle, , (VOID
>> **) );
>>
>> Yes.
>>
>>>
>>> If so, my guess is that 'Handle' is NULL at this point. An improvement can
>>> be adding a previous check for 'Status' after the ASSERT at:
>>>
>>>   Status = gBS->LocateDevicePath (,
>> , );
>>>   ASSERT_EFI_ERROR (Status);
>>
>> As my debug output, this 'Status' is seccuss and Handle is not NULL, but
>> gBS->ConnectController return:Not Found
>>
>> Debug output:
>> [BmExpandMediaDevicePath]:[1056L] Handle=3E3F3D18 BlockIo=3B2757B6
>> Media=AFAF6C617470AFAF Status=Success
>> EhcExecTransfer: transfer failed with 40
>> EhcBulkTransfer: error - Device Error, transfer - 40
>> .
>> [UsbOnHubInterrupt]:[632L] SignalEvent (HubIf->HubNotify)
>> UsbBotExecCommand: UsbBotSendCommand (Device Error)
>> UsbBootExecCmd: Device Error to Exec 0x0 Cmd (Result = 1)
>> EhcExecTransfer: transfer failed with 40
>> ...
>> [USBMassDriverBindingStop]:[1010L] Uninstall USB block io, free:
>> 3E44F218(F0)
>> [BmExpandMediaDevicePath]:[1064L] Connect Not Found
>> [BmExpandMediaDevicePath]:[1076L] Handle=3E3F3D18 BlockIo=3B2757B6
>> Media=AFAF6C617470AFAF Status=Invalid Parameter
> 
> Thanks for the debug information, I got it now.
> 
> The call to the gBS->ConnectController() leads to protocols being
> uninstalled from 'Handle' and removing 'Handle' from the database. Then
> within the call to gBS->HandleProtocol(), CoreValidateHandle() returns
> EFI_INVALID_PARAMETER since the handle cannot be found.
> 
> I am good with this patch, please help to address Leif's previous comment
> to keep the ASSERT.

I will add ASSERT back in v2.

> 
> Also, I have filed a Bugzilla tracker for this:
> https://bugzilla.tianocore.org/show_bug.cgi?id=1631
> 
> Could you help to add the reference to the above BZ in the commit log
> message? Thanks.

Sure, add it in v2.

Thanks

> 
> 
> Best Regards,
> Hao Wu
> 
>>
>> Thanks
>>
>>>
>>> And leave:
>>>
>>>   Status = gBS->HandleProtocol (Handle, , (VOID
>> **) );
>>>   ASSERT_EFI_ERROR (Status);
>>>
>>> unchanged.
>>
>>
>>
>>>
>>> Best Regards,
>>> Hao Wu
>>>
> to right address:
> AllocatePool (BlockIo->Media->BlockSize)
> So, here need to judge the status not using ASSERT_EFI_ERROR.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ming Huang 
> ---
>  MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
 b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> index d5957db610d9..c2f1c651b02f 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> +++ 

[edk2] [Patch][edk2-platforms/devel-MinnowBoardMax-UDK2017] Vlv2TbltDevicePkg: Enable USB3.0 source debug

2019-03-19 Thread Zailiang Sun
https://vthsd.intel.com/hsd/tiano/tracker/default.aspx?tracker_id=216942

Added a boolean macro SOURCE_DEBUG_USE_USB3 to dsc file in order to
build a BIOS image with USB3.0 source level debugging libraries.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zailiang Sun 
Cc: David Wei 
Cc: Yi Qian 
---
 Vlv2TbltDevicePkg/PlatformPkgConfig.dsc |  1 +
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 60 +++
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 76 ++---
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc| 76 ++---
 4 files changed, 161 insertions(+), 52 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
index a73f881b79..632c8885f0 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
@@ -93,5 +93,6 @@ DEFINE ESRT_ENABLE   = TRUE
 #
  DEFINE SOURCE_DEBUG_ENABLE = FALSE
 
+DEFINE SOURCE_DEBUG_USE_USB3   = FALSE
 DEFINE HTTP_BOOT_SUPPORT = FALSE
 DEFINE NETWORK_TLS_ENABLE = FALSE
\ No newline at end of file
diff --git a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc 
b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
index 1daf7137ee..2ed72437e4 100644
--- a/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
+++ b/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
@@ -261,9 +261,13 @@
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   
PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
+!if $(SOURCE_DEBUG_USE_USB3) == TRUE
+   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Pei.inf
+!else
   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.inf
   
PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
   
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
+!endif
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgentLib.inf
 !else
   
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
@@ -359,8 +363,12 @@
   
HashLib|SecurityPkg/Library/HashLibBaseCryptoRouter/HashLibBaseCryptoRouterPei.inf
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   
PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
+!if $(SOURCE_DEBUG_USE_USB3) == TRUE
+
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Pei.inf
+!else
   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.inf
   
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
+!endif
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgentLib.inf 
 !else
   
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
@@ -409,6 +417,9 @@
 !endif
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
+!if $(SOURCE_DEBUG_USE_USB3) == TRUE
+   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.inf
+!endif
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
 !endif
 
@@ -422,6 +433,9 @@
 !endif
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
+!if $(SOURCE_DEBUG_USE_USB3) == TRUE
+   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.inf
+!endif
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
 !endif
 
@@ -436,10 +450,13 @@
 
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
   !if $(TARGET) != RELEASE
-  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
   !endif
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
+!if $(SOURCE_DEBUG_USE_USB3) == TRUE
+   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.inf
+!endif
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgentLib.inf
   
TimerLib|$(PLATFORM_PACKAGE)/Library/IntelPchAcpiTimerLib/IntelPchAcpiTimerLib.inf
 !endif
@@ -459,10 +476,13 @@
   
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
 
 !if $(TARGET) != RELEASE
-  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
 !endif
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
+!if $(SOURCE_DEBUG_USE_USB3) == TRUE
+   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.inf
+!endif
   DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
   
TimerLib|$(PLATFORM_PACKAGE)/Library/IntelPchAcpiTimerLib/IntelPchAcpiTimerLib.inf
 !endif
@@ -477,6 +497,9 @@
 !endif
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
+!if $(SOURCE_DEBUG_USE_USB3) == TRUE
+   

Re: [edk2] [MdeModulePkg/Library v1 1/1] MdeModulePkg/UefiBootManangerLib: Fix exception issue

2019-03-19 Thread Leif Lindholm
On Tue, Mar 19, 2019 at 12:01:51PM +0800, Ming Huang wrote:
> On 3/18/2019 8:42 PM, Leif Lindholm wrote:
> > +MdeModulePkg maintainers (you added MdePkg maintainers to cc)
> > 
> > This looks like an improvement to me.
> > 
> > Am I correct in guessing this behaviour refers to some specific corner
> > case of a USB CDROM emulated from a BMC?
> 
> Yes, I found this issue with a USB CDROM emulated from a BMC.
> I guess have the same symptom with physical USB CDROM.

Yes, you would just be less likely to disconnect it :)

Thanks for the confirmation.

Best Regards,

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


Re: [edk2] [Patch V2 3/3] Vlv2TbltDevicePkg: Fix 32bit BIOS build failure issue

2019-03-19 Thread Qian, Yi
Reviewed by Qian, Yi 

Thanks
Qian Yi

> -Original Message-
> From: Sun, Zailiang
> Sent: Tuesday, March 19, 2019 4:36 PM
> To: edk2-devel@lists.01.org
> Cc: Wei, David ; Qian, Yi 
> Subject: [Patch V2 3/3] Vlv2TbltDevicePkg: Fix 32bit BIOS build failure issue
> 
> In V2: Added new option "USE=IA32" when ARCH is IA32
> 
> Added conditional choice for Logo.inf in PlatformPkg.fdf, based on the build
> ARCH information. And Changed the location of binary object files to align
> with previous releases (%WORKSPACE%\silicon).
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zailiang Sun 
> Cc: David Wei 
> Cc: Yi Qian 
> ---
>  Vlv2TbltDevicePkg/PlatformPkg.fdf   | 4 
>  Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat | 2 +-
>  Vlv2TbltDevicePkg/bld_vlv.bat   | 4 ++--
>  3 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/Vlv2TbltDevicePkg/PlatformPkg.fdf
> b/Vlv2TbltDevicePkg/PlatformPkg.fdf
> index 5d947db7bd..ccdc76c106 100644
> --- a/Vlv2TbltDevicePkg/PlatformPkg.fdf
> +++ b/Vlv2TbltDevicePkg/PlatformPkg.fdf
> @@ -467,7 +467,11 @@ INF
> MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
>  INF RuleOverride = BINARY
> $(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_
> ARCHITECTURE)/MpCpu.inf
>  INF $(PLATFORM_PACKAGE)/Metronome/Metronome.inf
>  INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
> +!if $(ARCH) == IA32
> +INF USE=IA32 MdeModulePkg/Logo/Logo.inf !else
>  INF USE=X64 MdeModulePkg/Logo/Logo.inf
> +!endif
>  INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
>  INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
>  INF
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.in
> f
> diff --git a/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
> b/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
> index 934fef081c..4bd91ef74d 100644
> --- a/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
> +++ b/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
> @@ -191,7 +191,7 @@ for %%i in (%BIOS_Names%) do (
>  echo Generating IFWI... %BIOS_ID%.bin
>  echo.
> 
> -copy /b/y !IFWI_HEADER_FILE! + ..\..\..\edk2-non-
> osi\Silicon\Intel\Vlv2SocBinPkg\SEC\!SEC_VERSION!\VLV_SEC_REGION.bin
> + ..\..\..\edk2-non-
> osi\Silicon\Intel\Vlv2SocBinPkg\SEC\!SEC_VERSION!\Vacant.bin
> + !BIOS_Rom! %BIOS_ID%.bin
> +copy /b/y !IFWI_HEADER_FILE! +
> + ..\..\..\silicon\Vlv2SocBinPkg\SEC\!SEC_VERSION!\VLV_SEC_REGION.bin +
> + ..\..\..\silicon\Vlv2SocBinPkg\SEC\!SEC_VERSION!\Vacant.bin +
> + !BIOS_Rom! %BIOS_ID%.bin
>  echo.
>  echo
> ==
> =
>  )
> diff --git a/Vlv2TbltDevicePkg/bld_vlv.bat b/Vlv2TbltDevicePkg/bld_vlv.bat
> index cd3ce41342..749bc2dcae 100644
> --- a/Vlv2TbltDevicePkg/bld_vlv.bat
> +++ b/Vlv2TbltDevicePkg/bld_vlv.bat
> @@ -30,7 +30,7 @@ set Arch=X64
>  set Source=0
>  set CORE_PATH=%WORKSPACE%\edk2
>  set PLATFORM_PATH=%WORKSPACE%\edk2
> -set PACKAGES_PATH=%WORKSPACE%\edk2-non-
> osi\Silicon\Intel;%WORKSPACE%\edk2
> +set PACKAGES_PATH=%WORKSPACE%\silicon;%WORKSPACE%\edk2
>  cd ./edk2
> 
>  :: Clean up previous build files.
> @@ -124,7 +124,7 @@ if "%Arch%"=="IA32" (
>  :: -- Build flags settings for each Platform --  echo Setting  %1  platform
> configuration and BIOS ID...
>  if /i "%~1" == "MNW2" (
> -echo BOARD_ID = MNW2MAX >> %Conf\BiosId.env
> +echo BOARD_ID = MNW2MAX >> Conf\BiosId.env
>  echo DEFINE ENBDT_PF_BUILD = TRUE   >> %auto_config_inc%
> 
>  ) else (
> --
> 2.19.1.windows.1

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


Re: [edk2] [PATCH] Vlv2TbltDevicePkg: Resolved chipsec complains

2019-03-19 Thread Qian, Yi
Reviewed by Qian, Yi 

Thanks
Qian Yi

> -Original Message-
> From: Sun, Zailiang
> Sent: Tuesday, March 19, 2019 4:56 PM
> To: edk2-devel@lists.01.org
> Cc: Wei, David ; Qian, Yi 
> Subject: [PATCH] Vlv2TbltDevicePkg: Resolved chipsec complains
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1335
> 
> Set bit in SPI individual lock register to lock down BMWAG, BMRAG, PR0, PR1,
> PR2, PR3, SCF, PREOP, OPTYPE and OPMENU.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zailiang Sun 
> Cc: David Wei 
> Cc: Yi Qian 
> ---
>  .../SouthCluster/Include/PchRegs/PchRegsSpi.h |  9 ++
>  Vlv2TbltDevicePkg/PlatformDxe/Platform.c  | 31 +++
>  2 files changed, 40 insertions(+)
> 
> diff --git
> a/Vlv2DeviceRefCodePkg/ValleyView2Soc/SouthCluster/Include/PchRegs/Pc
> hRegsSpi.h
> b/Vlv2DeviceRefCodePkg/ValleyView2Soc/SouthCluster/Include/PchRegs/P
> chRegsSpi.h
> index 7062a09b1b..4696ecc486 100644
> ---
> a/Vlv2DeviceRefCodePkg/ValleyView2Soc/SouthCluster/Include/PchRegs/Pc
> hRegsSpi.h
> +++
> b/Vlv2DeviceRefCodePkg/ValleyView2Soc/SouthCluster/Include/PchRegs/P
> +++ chRegsSpi.h
> @@ -90,7 +90,16 @@ Copyright (c) 2011  - 2015, Intel Corporation. All rights
> reserved
>  #define R_PCH_SPI_OPMENU10x9C  // Opcode Menu
> Configuration 1 (32bits)
> 
>  #define R_PCH_SPI_IND_LOCK   0xA4  // Indvidual Lock
> +#define B_PCH_SPI_IND_LOCK_BMWAG BIT0  // BMWAG LockDown
> +#define B_PCH_SPI_IND_LOCK_BMRAG BIT1  // BMRAG LockDown
>  #define B_PCH_SPI_IND_LOCK_PR0   BIT2  // PR0 LockDown
> +#define B_PCH_SPI_IND_LOCK_PR1   BIT3  // PR1 LockDown
> +#define B_PCH_SPI_IND_LOCK_PR2   BIT4  // PR2 LockDown
> +#define B_PCH_SPI_IND_LOCK_PR3   BIT5  // PR3 LockDown
> +#define B_PCH_SPI_IND_LOCK_SCF   BIT6  // SCF LockDown
> +#define B_PCH_SPI_IND_LOCK_PREOP BIT7  // PREP LockDown
> +#define B_PCH_SPI_IND_LOCK_OPTYPEBIT8  // OPTYPE LockDown
> +#define B_PCH_SPI_IND_LOCK_OPMENUBIT9  // OPMENU
> LockDown
> 
> 
>  #define R_PCH_SPI_FDOC   0xB0  // Flash Descriptor 
> Observability
> Control Register (32 bits)
> diff --git a/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
> b/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
> index 02538fd6f0..ec1a1141e6 100644
> --- a/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
> +++ b/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
> @@ -541,6 +541,37 @@ SpiBiosProtectionFunction(
>DEBUG((EFI_D_INFO, "R_PCH_SPI_PR1 \n"));
>DEBUG((EFI_D_INFO, "MmioRead32 (0x%x, 0x%x) = 0x%x \n", (UINTN)
> SpiBase, (UINT8) R_PCH_SPI_PR1, (UINT32) Data32));
> 
> +  //
> +  // Check and set individual lock
> +  //
> +  MmioOr16 ((UINTN) (SpiBase + R_PCH_SPI_IND_LOCK),
> +B_PCH_SPI_IND_LOCK_BMWAG |
> +B_PCH_SPI_IND_LOCK_BMRAG |
> +B_PCH_SPI_IND_LOCK_PR0 |
> +B_PCH_SPI_IND_LOCK_PR1 |
> +B_PCH_SPI_IND_LOCK_PR2 |
> +B_PCH_SPI_IND_LOCK_PR3 |
> +B_PCH_SPI_IND_LOCK_SCF |
> +B_PCH_SPI_IND_LOCK_PREOP |
> +B_PCH_SPI_IND_LOCK_OPTYPE |
> +B_PCH_SPI_IND_LOCK_OPMENU);
> +  Data16 = MmioRead16 (SpiBase + R_PCH_SPI_IND_LOCK);
> + S3BootScriptSaveMemWrite (
> +S3BootScriptWidthUint16,
> +(UINTN)(SpiBase + R_PCH_SPI_IND_LOCK),
> +1,
> +
> +  );
> +  DEBUG((EFI_D_INFO, "R_PCH_SPI_IND_LOCK \n"));  DEBUG((EFI_D_INFO,
> + "MmioRead16 (0x%x, 0x%x) = 0x%x \n", (UINTN) SpiBase, (UINT8)
> + R_PCH_SPI_IND_LOCK, (UINT16) Data16));
> +
> +  //
> +  // Verify if it's really locked.
> +  //
> +  if ((MmioRead16 (SpiBase + R_PCH_SPI_IND_LOCK) &
> B_PCH_SPI_IND_LOCK_PR0) == 0) {
> +DEBUG((EFI_D_ERROR, "Failed to lock down individual lock.\n"));  }
> +
>//
>//Lock down PRx
>//
> --
> 2.19.1.windows.1

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


Re: [edk2] [Patch V2 2/3] Vlv2TbltDevicePkg: Fix build failure issue after ECP cleanup

2019-03-19 Thread Qian, Yi
Reviewed by Qian, Yi 

Thanks
Qian Yi

> -Original Message-
> From: Sun, Zailiang
> Sent: Tuesday, March 19, 2019 4:36 PM
> To: edk2-devel@lists.01.org
> Cc: Wei, David ; Qian, Yi 
> Subject: [Patch V2 2/3] Vlv2TbltDevicePkg: Fix build failure issue after ECP
> cleanup
> 
> In V2: no new changes
> 
> Moved stuff in the three old packages IA32FamilyCpuPkg, Vlv2BinaryPkg and
> Vlv2MiscBinariesPkg into a new package Vlv2SocBinPkg. Updated the build
> scripts
> and added build instructions in Readme.md.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: David Wei 
> Cc: Zailiang Sun 
> Cc: Yi Qian 
> ---
>  Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.inf | 177
> ++
> ++--
> ---
>  Vlv2TbltDevicePkg/Build_IFWI.bat|  35 
> -
> --
>  Vlv2TbltDevicePkg/Library/MultiPlatformLib/MultiPlatformLib.inf | 166
> ++
> +--
> -
>  Vlv2TbltDevicePkg/MonoStatusCode/MonoStatusCode.inf | 156
> ++
> --
> 
>  Vlv2TbltDevicePkg/PlatformCpuInfoDxe/PlatformCpuInfoDxe.inf | 122
> ++
> +++-
>  Vlv2TbltDevicePkg/PlatformInitPei/PlatformInitPei.inf   | 246
> ++
> ++
> +++--
> -
>  Vlv2TbltDevicePkg/PlatformPei/PlatformPei.inf   | 270
> ++
> ++
> +++---
> 
>  Vlv2TbltDevicePkg/PlatformPkg.fdf   |   8 
> 
>  Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   |   4 ++--
>  Vlv2TbltDevicePkg/PlatformPkgX64.dsc|   4 ++--
>  Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.inf   |   2 +-
>  Vlv2TbltDevicePkg/Readme.md |  75
> ++
> +
>  Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat |   4 ++--
>  Vlv2TbltDevicePkg/bld_vlv.bat   | 110
> +--
> ---
>  14 files changed, 727 insertions(+), 652 deletions(-)
> 
> diff --git
> a/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.inf
> b/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.inf
> index 4e2ec32ac6..8ca7a663cd 100644
> --- a/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.inf
> +++ b/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.inf
> @@ -1,90 +1,89 @@
> -## @file
> -# Implements a Tunnel Mountain specific flash update program.  This will
> allow
> -# users to update all regions of the flash as needed in a given update.
> -#
> -# Copyright (c) 2006  - 2014, Intel Corporation. All rights reserved.
> -#
> 
> -# This program and the accompanying materials are licensed and made
> available under
> 
> -# the terms and conditions of the BSD License that accompanies this
> distribution.
> 
> -# The full text of the license may be found at
> 
> -# http://opensource.org/licenses/bsd-license.php.
> 
> -#
> 
> -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> 
> -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> 
> -#
> 
> -#
> -#
> -##
> -
> -[Defines]
> -  INF_VERSION= 0x00010005
> -  BASE_NAME  = FirmwareUpdate
> -  FILE_GUID  = AEFAF26C-FB6D-4fef-AF7A-9D78FF201FCA
> -  MODULE_TYPE= UEFI_APPLICATION
> -  VERSION_STRING = 1.0
> -  ENTRY_POINT= ShellCEntryLib
> -
> -#
> -# The following information is for reference only and not required by the
> build tools.
> -#
> -#  VALID_ARCHITECTURES   = X64
> -#
> -
> -[Sources]
> -  FirmwareUpdateStrings.uni
> -  FirmwareUpdate.c
> -  FirmwareUpdate.h
> -
> -[Packages]
> -  MdeModulePkg/MdeModulePkg.dec
> -  MdePkg/MdePkg.dec
> -  IA32FamilyCpuPkg/IA32FamilyCpuPkg.dec
> - 

Re: [edk2] [Patch V2 1/3] Vlv2TbltDevicePkg: ECP Cleanup.

2019-03-19 Thread Qian, Yi
Reviewed by Qian, Yi 

Thanks
Qian Yi

> -Original Message-
> From: Sun, Zailiang
> Sent: Tuesday, March 19, 2019 4:33 PM
> To: edk2-devel@lists.01.org
> Cc: Qian, Yi ; Wei, David 
> Subject: [Patch V2 1/3] Vlv2TbltDevicePkg: ECP Cleanup.
> 
> In V2: no new changes
> 
> Remove modules of EdkCompatibilityPkg from DSC/FDF of Vlv2TbltDevicePkg
> to make this platform ECP free.
> 
> Test: Boot to 64-bit Windows 10.
> 
> Cc: Zailiang Sun 
> Cc: Yi Qian 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: David Wei 
> ---
>  Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c   |  8 
>  Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf |  4 ++--
>  Vlv2TbltDevicePkg/PciPlatform/PciPlatform.c |  8 
>  Vlv2TbltDevicePkg/PciPlatform/PciPlatform.inf   |  4 ++--
>  Vlv2TbltDevicePkg/PlatformPei/BootMode.c| 56 
> ++--
> 
>  Vlv2TbltDevicePkg/PlatformPei/PlatformPei.inf   |  4 +---
>  Vlv2TbltDevicePkg/PlatformPkg.fdf   | 11 +--
>  Vlv2TbltDevicePkg/PlatformPkgGcc.fdf| 10 --
>  Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 87 
> ---
> 
>  Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 91 
> +++
> 
>  Vlv2TbltDevicePkg/PlatformPkgX64.dsc| 87 
> -
> --
>  Vlv2TbltDevicePkg/PlatformSmm/PlatformSmm.inf   |  6 +++---
>  Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.c  | 10 +-
>  Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInitDxe.inf |  6 +++---
>  14 files changed, 30 insertions(+), 362 deletions(-)
> 
> diff --git a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c
> b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c
> index 4a913eb723..d575533319 100644
> --- a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c
> +++ b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c
> @@ -1,6 +1,6 @@
>  /** @file
> 
> -  Copyright (c) 2004  - 2016, 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 @@ -35,7 +35,7 @@ Abstract:
> 
>  #include 
>  #include 
> -#include 
> +#include 
>  #include "AcpiPlatform.h"
>  #include "AcpiPlatformHooks.h"
>  #include "AcpiPlatformHooksLib.h"
> @@ -785,7 +785,7 @@ AcpiPlatformEntryPoint (
>EFI_STATUSStatus;
>EFI_STATUSAcpiStatus;
>EFI_ACPI_SUPPORT_PROTOCOL *AcpiSupport;
> -  EFI_FIRMWARE_VOLUME_PROTOCOL  *FwVol;
> +  EFI_FIRMWARE_VOLUME2_PROTOCOL  *FwVol;
>INTN  Instance;
>EFI_ACPI_COMMON_HEADER*CurrentTable;
>UINTN TableHandle;
> @@ -856,7 +856,7 @@ AcpiPlatformEntryPoint (
>//
>// Locate the firmware volume protocol.
>//
> -  Status = LocateSupportProtocol (,
> (VOID **) , 1);
> +  Status = LocateSupportProtocol (,
> + (VOID **) , 1);
>ASSERT_EFI_ERROR (Status);
> 
>//
> diff --git a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf
> b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf
> index 24fa913b33..74a531369d 100644
> --- a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf
> +++ b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf
> @@ -1,6 +1,6 @@
>  #
>  #
> -# Copyright (c)  1999  - 2014, Intel Corporation. All rights reserved
> +# Copyright (c)  1999  - 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.
> 
> @@ -77,7 +77,7 @@
>gEfiMpServiceProtocolGuid
>gEfiGlobalNvsAreaProtocolGuid
>gEfiTcgProtocolGuid
> -  gEfiFirmwareVolumeProtocolGuid
> +  gEfiFirmwareVolume2ProtocolGuid
>gIgdOpRegionProtocolGuid
> 
>  [Pcd]
> diff --git a/Vlv2TbltDevicePkg/PciPlatform/PciPlatform.c
> b/Vlv2TbltDevicePkg/PciPlatform/PciPlatform.c
> index 08f5df2a25..27ae9de7a0 100644
> --- a/Vlv2TbltDevicePkg/PciPlatform/PciPlatform.c
> +++ b/Vlv2TbltDevicePkg/PciPlatform/PciPlatform.c
> @@ -36,7 +36,7 @@ Abstract:
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 
>  #include 
>  #include 
> 
> @@ -66,12 +66,12 @@ GetRawImage (
>EFI_HANDLE*HandleBuffer;
>UINTN HandleCount;
>UINTN Index;
> -  EFI_FIRMWARE_VOLUME_PROTOCOL  *Fv;
> +  EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv;
>UINT32AuthenticationStatus;
> 
>Status = gBS->LocateHandleBuffer (
> 

[edk2] [PATCH] Vlv2TbltDevicePkg: Resolved chipsec complains

2019-03-19 Thread Zailiang Sun
https://bugzilla.tianocore.org/show_bug.cgi?id=1335

Set bit in SPI individual lock register to lock down BMWAG, BMRAG, PR0,
PR1, PR2, PR3, SCF, PREOP, OPTYPE and OPMENU.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zailiang Sun 
Cc: David Wei 
Cc: Yi Qian 
---
 .../SouthCluster/Include/PchRegs/PchRegsSpi.h |  9 ++
 Vlv2TbltDevicePkg/PlatformDxe/Platform.c  | 31 +++
 2 files changed, 40 insertions(+)

diff --git 
a/Vlv2DeviceRefCodePkg/ValleyView2Soc/SouthCluster/Include/PchRegs/PchRegsSpi.h 
b/Vlv2DeviceRefCodePkg/ValleyView2Soc/SouthCluster/Include/PchRegs/PchRegsSpi.h
index 7062a09b1b..4696ecc486 100644
--- 
a/Vlv2DeviceRefCodePkg/ValleyView2Soc/SouthCluster/Include/PchRegs/PchRegsSpi.h
+++ 
b/Vlv2DeviceRefCodePkg/ValleyView2Soc/SouthCluster/Include/PchRegs/PchRegsSpi.h
@@ -90,7 +90,16 @@ Copyright (c) 2011  - 2015, Intel Corporation. All rights 
reserved
 #define R_PCH_SPI_OPMENU10x9C  // Opcode Menu 
Configuration 1 (32bits)
 
 #define R_PCH_SPI_IND_LOCK   0xA4  // Indvidual Lock
+#define B_PCH_SPI_IND_LOCK_BMWAG BIT0  // BMWAG LockDown
+#define B_PCH_SPI_IND_LOCK_BMRAG BIT1  // BMRAG LockDown
 #define B_PCH_SPI_IND_LOCK_PR0   BIT2  // PR0 LockDown
+#define B_PCH_SPI_IND_LOCK_PR1   BIT3  // PR1 LockDown
+#define B_PCH_SPI_IND_LOCK_PR2   BIT4  // PR2 LockDown
+#define B_PCH_SPI_IND_LOCK_PR3   BIT5  // PR3 LockDown
+#define B_PCH_SPI_IND_LOCK_SCF   BIT6  // SCF LockDown
+#define B_PCH_SPI_IND_LOCK_PREOP BIT7  // PREP LockDown
+#define B_PCH_SPI_IND_LOCK_OPTYPEBIT8  // OPTYPE LockDown
+#define B_PCH_SPI_IND_LOCK_OPMENUBIT9  // OPMENU LockDown
 
 
 #define R_PCH_SPI_FDOC   0xB0  // Flash Descriptor 
Observability Control Register (32 bits)
diff --git a/Vlv2TbltDevicePkg/PlatformDxe/Platform.c 
b/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
index 02538fd6f0..ec1a1141e6 100644
--- a/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
+++ b/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
@@ -541,6 +541,37 @@ SpiBiosProtectionFunction(
   DEBUG((EFI_D_INFO, "R_PCH_SPI_PR1 \n"));
   DEBUG((EFI_D_INFO, "MmioRead32 (0x%x, 0x%x) = 0x%x \n", (UINTN) SpiBase, 
(UINT8) R_PCH_SPI_PR1, (UINT32) Data32));
 
+  //
+  // Check and set individual lock
+  //
+  MmioOr16 ((UINTN) (SpiBase + R_PCH_SPI_IND_LOCK),
+B_PCH_SPI_IND_LOCK_BMWAG |
+B_PCH_SPI_IND_LOCK_BMRAG |
+B_PCH_SPI_IND_LOCK_PR0 |
+B_PCH_SPI_IND_LOCK_PR1 |
+B_PCH_SPI_IND_LOCK_PR2 |
+B_PCH_SPI_IND_LOCK_PR3 |
+B_PCH_SPI_IND_LOCK_SCF |
+B_PCH_SPI_IND_LOCK_PREOP |
+B_PCH_SPI_IND_LOCK_OPTYPE |
+B_PCH_SPI_IND_LOCK_OPMENU);
+  Data16 = MmioRead16 (SpiBase + R_PCH_SPI_IND_LOCK); 
+  S3BootScriptSaveMemWrite (
+S3BootScriptWidthUint16,
+(UINTN)(SpiBase + R_PCH_SPI_IND_LOCK),
+1,
+
+  );
+  DEBUG((EFI_D_INFO, "R_PCH_SPI_IND_LOCK \n"));
+  DEBUG((EFI_D_INFO, "MmioRead16 (0x%x, 0x%x) = 0x%x \n", (UINTN) SpiBase, 
(UINT8) R_PCH_SPI_IND_LOCK, (UINT16) Data16));
+
+  //
+  // Verify if it's really locked.
+  //
+  if ((MmioRead16 (SpiBase + R_PCH_SPI_IND_LOCK) & B_PCH_SPI_IND_LOCK_PR0) == 
0) {
+DEBUG((EFI_D_ERROR, "Failed to lock down individual lock.\n"));
+  }
+  
   //
   //Lock down PRx
   //
-- 
2.19.1.windows.1

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


[edk2] [Patch V2 3/3] Vlv2TbltDevicePkg: Fix 32bit BIOS build failure issue

2019-03-19 Thread Zailiang Sun
In V2: Added new option "USE=IA32" when ARCH is IA32

Added conditional choice for Logo.inf in PlatformPkg.fdf, based on the build
ARCH information. And Changed the location of binary object files to align
with previous releases (%WORKSPACE%\silicon).

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zailiang Sun 
Cc: David Wei 
Cc: Yi Qian 
---
 Vlv2TbltDevicePkg/PlatformPkg.fdf   | 4 
 Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat | 2 +-
 Vlv2TbltDevicePkg/bld_vlv.bat   | 4 ++--
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Vlv2TbltDevicePkg/PlatformPkg.fdf 
b/Vlv2TbltDevicePkg/PlatformPkg.fdf
index 5d947db7bd..ccdc76c106 100644
--- a/Vlv2TbltDevicePkg/PlatformPkg.fdf
+++ b/Vlv2TbltDevicePkg/PlatformPkg.fdf
@@ -467,7 +467,11 @@ INF 
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
 INF RuleOverride = BINARY 
$(PLATFORM_BINARY_PACKAGE)/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHITECTURE)/MpCpu.inf
 INF $(PLATFORM_PACKAGE)/Metronome/Metronome.inf
 INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
+!if $(ARCH) == IA32
+INF USE=IA32 MdeModulePkg/Logo/Logo.inf
+!else
 INF USE=X64 MdeModulePkg/Logo/Logo.inf
+!endif
 INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
 INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
 INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
diff --git a/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat 
b/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
index 934fef081c..4bd91ef74d 100644
--- a/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
+++ b/Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat
@@ -191,7 +191,7 @@ for %%i in (%BIOS_Names%) do (
 echo Generating IFWI... %BIOS_ID%.bin
 echo.
 
-copy /b/y !IFWI_HEADER_FILE! + 
..\..\..\edk2-non-osi\Silicon\Intel\Vlv2SocBinPkg\SEC\!SEC_VERSION!\VLV_SEC_REGION.bin
 + 
..\..\..\edk2-non-osi\Silicon\Intel\Vlv2SocBinPkg\SEC\!SEC_VERSION!\Vacant.bin 
+ !BIOS_Rom! %BIOS_ID%.bin
+copy /b/y !IFWI_HEADER_FILE! + 
..\..\..\silicon\Vlv2SocBinPkg\SEC\!SEC_VERSION!\VLV_SEC_REGION.bin + 
..\..\..\silicon\Vlv2SocBinPkg\SEC\!SEC_VERSION!\Vacant.bin + !BIOS_Rom! 
%BIOS_ID%.bin
 echo.
 echo 
===
 )
diff --git a/Vlv2TbltDevicePkg/bld_vlv.bat b/Vlv2TbltDevicePkg/bld_vlv.bat
index cd3ce41342..749bc2dcae 100644
--- a/Vlv2TbltDevicePkg/bld_vlv.bat
+++ b/Vlv2TbltDevicePkg/bld_vlv.bat
@@ -30,7 +30,7 @@ set Arch=X64
 set Source=0
 set CORE_PATH=%WORKSPACE%\edk2
 set PLATFORM_PATH=%WORKSPACE%\edk2
-set PACKAGES_PATH=%WORKSPACE%\edk2-non-osi\Silicon\Intel;%WORKSPACE%\edk2
+set PACKAGES_PATH=%WORKSPACE%\silicon;%WORKSPACE%\edk2
 cd ./edk2
 
 :: Clean up previous build files.
@@ -124,7 +124,7 @@ if "%Arch%"=="IA32" (
 :: -- Build flags settings for each Platform --
 echo Setting  %1  platform configuration and BIOS ID...
 if /i "%~1" == "MNW2" (
-echo BOARD_ID = MNW2MAX >> %Conf\BiosId.env
+echo BOARD_ID = MNW2MAX >> Conf\BiosId.env
 echo DEFINE ENBDT_PF_BUILD = TRUE   >> %auto_config_inc%
 
 ) else (
-- 
2.19.1.windows.1

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


[edk2] [Patch V2 2/3] Vlv2TbltDevicePkg: Fix build failure issue after ECP cleanup

2019-03-19 Thread Zailiang Sun
In V2: no new changes

Moved stuff in the three old packages IA32FamilyCpuPkg, Vlv2BinaryPkg and
Vlv2MiscBinariesPkg into a new package Vlv2SocBinPkg. Updated the build scripts
and added build instructions in Readme.md.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: David Wei 
Cc: Zailiang Sun 
Cc: Yi Qian 
---
 Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.inf | 177 
-
 Vlv2TbltDevicePkg/Build_IFWI.bat|  35 
---
 Vlv2TbltDevicePkg/Library/MultiPlatformLib/MultiPlatformLib.inf | 166 
+++---
 Vlv2TbltDevicePkg/MonoStatusCode/MonoStatusCode.inf | 156 
++--
 Vlv2TbltDevicePkg/PlatformCpuInfoDxe/PlatformCpuInfoDxe.inf | 122 
+-
 Vlv2TbltDevicePkg/PlatformInitPei/PlatformInitPei.inf   | 246 
+++---
 Vlv2TbltDevicePkg/PlatformPei/PlatformPei.inf   | 270 
+++---
 Vlv2TbltDevicePkg/PlatformPkg.fdf   |   8 
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   |   4 ++--
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc|   4 ++--
 Vlv2TbltDevicePkg/PpmPolicy/PpmPolicy.inf   |   2 +-
 Vlv2TbltDevicePkg/Readme.md |  75 
+++
 Vlv2TbltDevicePkg/Stitch/IFWIStitch.bat |   4 ++--
 Vlv2TbltDevicePkg/bld_vlv.bat   | 110 
+-
 14 files changed, 727 insertions(+), 652 deletions(-)

diff --git a/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.inf 
b/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.inf
index 4e2ec32ac6..8ca7a663cd 100644
--- a/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.inf
+++ b/Vlv2TbltDevicePkg/Application/FirmwareUpdate/FirmwareUpdate.inf
@@ -1,90 +1,89 @@
-## @file
-# Implements a Tunnel Mountain specific flash update program.  This will allow
-# users to update all regions of the flash as needed in a given update.
-#
-# Copyright (c) 2006  - 2014, Intel Corporation. All rights reserved.
-#  


-# This program and the accompanying materials are licensed and made available 
under

-# the terms and conditions of the BSD License that accompanies this 
distribution.  

-# The full text of the license may be found at 


-# http://opensource.org/licenses/bsd-license.php.  


-#  


-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,


-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.

-#  


-#
-#
-##
-
-[Defines]
-  INF_VERSION= 0x00010005
-  BASE_NAME  = FirmwareUpdate
-  FILE_GUID  = AEFAF26C-FB6D-4fef-AF7A-9D78FF201FCA
-  MODULE_TYPE= UEFI_APPLICATION
-  VERSION_STRING = 1.0
-  ENTRY_POINT= ShellCEntryLib
-
-#
-# The following information is for reference only and not required by the 
build tools.
-#
-#  VALID_ARCHITECTURES   = X64
-#
-
-[Sources]
-  FirmwareUpdateStrings.uni
-  FirmwareUpdate.c
-  FirmwareUpdate.h
-
-[Packages]
-  MdeModulePkg/MdeModulePkg.dec
-  MdePkg/MdePkg.dec
-  IA32FamilyCpuPkg/IA32FamilyCpuPkg.dec
-  Vlv2TbltDevicePkg/PlatformPkg.dec
-  Vlv2DeviceRefCodePkg/Vlv2DeviceRefCodePkg.dec
-  ShellPkg/ShellPkg.dec
-
-[LibraryClasses]
-  BaseLib
-  BaseMemoryLib
-  CacheMaintenanceLib

[edk2] [Patch V2 1/3] Vlv2TbltDevicePkg: ECP Cleanup.

2019-03-19 Thread Zailiang Sun
In V2: no new changes

Remove modules of EdkCompatibilityPkg from DSC/FDF of Vlv2TbltDevicePkg to make
this platform ECP free.

Test: Boot to 64-bit Windows 10.

Cc: Zailiang Sun 
Cc: Yi Qian 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: David Wei 
---
 Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c   |  8 
 Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf |  4 ++--
 Vlv2TbltDevicePkg/PciPlatform/PciPlatform.c |  8 
 Vlv2TbltDevicePkg/PciPlatform/PciPlatform.inf   |  4 ++--
 Vlv2TbltDevicePkg/PlatformPei/BootMode.c| 56 
++--
 Vlv2TbltDevicePkg/PlatformPei/PlatformPei.inf   |  4 +---
 Vlv2TbltDevicePkg/PlatformPkg.fdf   | 11 +--
 Vlv2TbltDevicePkg/PlatformPkgGcc.fdf| 10 --
 Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc | 87 
---
 Vlv2TbltDevicePkg/PlatformPkgIA32.dsc   | 91 
+++
 Vlv2TbltDevicePkg/PlatformPkgX64.dsc| 87 
---
 Vlv2TbltDevicePkg/PlatformSmm/PlatformSmm.inf   |  6 +++---
 Vlv2TbltDevicePkg/VlvPlatformInitDxe/IgdOpRegion.c  | 10 +-
 Vlv2TbltDevicePkg/VlvPlatformInitDxe/VlvPlatformInitDxe.inf |  6 +++---
 14 files changed, 30 insertions(+), 362 deletions(-)

diff --git a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c 
b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c
index 4a913eb723..d575533319 100644
--- a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c
+++ b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2004  - 2016, 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
@@ -35,7 +35,7 @@ Abstract:
 
 #include 
 #include 
-#include 
+#include 
 #include "AcpiPlatform.h"
 #include "AcpiPlatformHooks.h"
 #include "AcpiPlatformHooksLib.h"
@@ -785,7 +785,7 @@ AcpiPlatformEntryPoint (
   EFI_STATUSStatus;
   EFI_STATUSAcpiStatus;
   EFI_ACPI_SUPPORT_PROTOCOL *AcpiSupport;
-  EFI_FIRMWARE_VOLUME_PROTOCOL  *FwVol;
+  EFI_FIRMWARE_VOLUME2_PROTOCOL  *FwVol;
   INTN  Instance;
   EFI_ACPI_COMMON_HEADER*CurrentTable;
   UINTN TableHandle;
@@ -856,7 +856,7 @@ AcpiPlatformEntryPoint (
   //
   // Locate the firmware volume protocol.
   //
-  Status = LocateSupportProtocol (, (VOID **) 
, 1);
+  Status = LocateSupportProtocol (, (VOID **) 
, 1);
   ASSERT_EFI_ERROR (Status);
 
   //
diff --git a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf 
b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf
index 24fa913b33..74a531369d 100644
--- a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf
+++ b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf
@@ -1,6 +1,6 @@
 #
 #
-# Copyright (c)  1999  - 2014, Intel Corporation. All rights reserved
+# Copyright (c)  1999  - 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.  

@@ -77,7 +77,7 @@
   gEfiMpServiceProtocolGuid
   gEfiGlobalNvsAreaProtocolGuid
   gEfiTcgProtocolGuid
-  gEfiFirmwareVolumeProtocolGuid
+  gEfiFirmwareVolume2ProtocolGuid
   gIgdOpRegionProtocolGuid
 
 [Pcd]
diff --git a/Vlv2TbltDevicePkg/PciPlatform/PciPlatform.c 
b/Vlv2TbltDevicePkg/PciPlatform/PciPlatform.c
index 08f5df2a25..27ae9de7a0 100644
--- a/Vlv2TbltDevicePkg/PciPlatform/PciPlatform.c
+++ b/Vlv2TbltDevicePkg/PciPlatform/PciPlatform.c
@@ -36,7 +36,7 @@ Abstract:
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -66,12 +66,12 @@ GetRawImage (
   EFI_HANDLE*HandleBuffer;
   UINTN HandleCount;
   UINTN Index;
-  EFI_FIRMWARE_VOLUME_PROTOCOL  *Fv;
+  EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv;
   UINT32AuthenticationStatus;
 
   Status = gBS->LocateHandleBuffer (
   ByProtocol,
-  ,
+  ,
   NULL,
   ,
   
@@ -86,7 +86,7 @@ GetRawImage (
   for (Index = 0; Index < HandleCount; Index++) {
 Status = gBS->HandleProtocol(
 HandleBuffer[Index],
-,
+,
 (VOID **) 
 );
 
diff --git 

Re: [edk2] [PATCH] Vlv2TbltDevicePkg: SPI lock

2019-03-19 Thread Qian, Yi
Reviewed by Qian, Yi 

Thanks
Qian Yi

> -Original Message-
> From: Sun, Zailiang
> Sent: Monday, March 18, 2019 9:42 PM
> To: edk2-devel@lists.01.org
> Cc: Wei, David ; Qian, Yi ; Kinney,
> Michael D 
> Subject: [PATCH] Vlv2TbltDevicePkg: SPI lock
> 
> https://vthsd.intel.com/hsd/tiano/tracker/default.aspx?tracker_id=221549
> 
> Set protection bit such as BCR, PR0, PR1 and HSFS bits in SPI registers.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zailiang Sun 
> Cc: David Wei 
> Cc: Yi Qian 
> Cc: Michael Kinney 
> ---
>  Vlv2TbltDevicePkg/PlatformDxe/Platform.c  | 74 +--
>  Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf |  8 ++
>  2 files changed, 75 insertions(+), 7 deletions(-)
> 
> diff --git a/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
> b/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
> index ad18da5c61..02538fd6f0 100644
> --- a/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
> +++ b/Vlv2TbltDevicePkg/PlatformDxe/Platform.c
> @@ -51,7 +51,8 @@ Abstract:
>  #include 
>  #include 
>  #include 
> -
> +#include 
> +#include 
> 
>  //
>  // VLV2 GPIO GROUP OFFSET
> @@ -441,6 +442,21 @@ SpiBiosProtectionFunction(
>UINTN BiosFlaLower1;
>UINTN BiosFlaLimit1;
> 
> +  EFI_SMM_BASE2_PROTOCOL*SmmBase2;
> +  EFI_STATUSStatus;
> +  UINT32Data32;
> +  UINT16Data16;
> +
> +  //
> +  // This feature requires smm stack. check whether smm stack is ready.
> + if not, just return  //  Status = gBS->LocateProtocol
> + (, NULL, (VOID**) );  if
> (EFI_ERROR
> + (Status)) {
> +DEBUG((EFI_D_INFO, "smm stack is not ready\n"));
> +return;
> +  } else {
> +DEBUG((EFI_D_INFO, "smm stack is ready\n"));  }
> 
>BiosFlaLower0 = PcdGet32(PcdFlashMicroCodeAddress)-
> PcdGet32(PcdBiosImageBase);
>BiosFlaLimit0 = PcdGet32(PcdFlashMicroCodeSize)-1;
> @@ -461,6 +477,7 @@ SpiBiosProtectionFunction(
> );
>SpiBase  = MmioRead32(mPciD31F0RegBase + R_PCH_LPC_SPI_BASE) &
> B_PCH_LPC_SPI_BASE_BAR;
> 
> +  DEBUG((EFI_D_INFO, "SpiBase = 0x%x\n", (UINTN)SpiBase));
>//
>//Set SMM_BWP, WPD and LE bit
>//
> @@ -468,6 +485,16 @@ SpiBiosProtectionFunction(
>MmioAnd32 ((UINTN) (SpiBase + R_PCH_SPI_BCR),
> (UINT8)(~B_PCH_SPI_BCR_BIOSWE));
>MmioOr32 ((UINTN) (SpiBase + R_PCH_SPI_BCR), (UINT8)
> B_PCH_SPI_BCR_BLE);
> 
> +  Data32 = MmioRead32 (SpiBase + R_PCH_SPI_BCR);
> + S3BootScriptSaveMemWrite (
> +  S3BootScriptWidthUint32,
> +  (UINTN)(SpiBase + R_PCH_SPI_BCR),
> +  1,
> +  
> +  );
> +  DEBUG((EFI_D_INFO, "R_PCH_SPI_BCR \n"));  DEBUG((EFI_D_INFO,
> + "MmioRead32 (0x%x, 0x%x) = 0x%x \n", (UINTN) SpiBase, (UINT8)
> + R_PCH_SPI_BCR, (UINT32) Data32));
> +
>//
>//First check if FLOCKDN or PR0FLOCKDN is set. No action if either of them
> set already.
>//
> @@ -487,6 +514,16 @@ SpiBiosProtectionFunction(
>  B_PCH_SPI_PR0_RPE|B_PCH_SPI_PR0_WPE|\
> 
> (B_PCH_SPI_PR0_PRB_MASK&(BiosFlaLower0>>12))|(B_PCH_SPI_PR0_PRL
> _MASK&(BiosFlaLimit0>>12)<<16));
> 
> +  Data32 = MmioRead32 (SpiBase + R_PCH_SPI_PR0);
> +  S3BootScriptSaveMemWrite (
> +S3BootScriptWidthUint32,
> +(UINTN)(SpiBase + R_PCH_SPI_PR0),
> +1,
> +
> +  );
> +  DEBUG((EFI_D_INFO, "R_PCH_SPI_PR0 \n"));  DEBUG((EFI_D_INFO,
> + "MmioRead32 (0x%x, 0x%x) = 0x%x \n", (UINTN) SpiBase, (UINT8)
> + R_PCH_SPI_PR0, (UINT32) Data32));
> +
>//
>//Set PR1
>//
> @@ -494,12 +531,31 @@ SpiBiosProtectionFunction(
>MmioOr32((UINTN)(SpiBase + R_PCH_SPI_PR1),
>  B_PCH_SPI_PR1_RPE|B_PCH_SPI_PR1_WPE|\
> 
> (B_PCH_SPI_PR1_PRB_MASK&(BiosFlaLower1>>12))|(B_PCH_SPI_PR1_PRL
> _MASK&(BiosFlaLimit1>>12)<<16));
> +  Data32 = MmioRead32 (SpiBase + R_PCH_SPI_PR1);
> +  S3BootScriptSaveMemWrite (
> +S3BootScriptWidthUint32,
> +(UINTN)(SpiBase + R_PCH_SPI_PR1),
> +1,
> +
> +  );
> +  DEBUG((EFI_D_INFO, "R_PCH_SPI_PR1 \n"));  DEBUG((EFI_D_INFO,
> + "MmioRead32 (0x%x, 0x%x) = 0x%x \n", (UINTN) SpiBase, (UINT8)
> + R_PCH_SPI_PR1, (UINT32) Data32));
> 
>//
>//Lock down PRx
>//
>MmioOr16 ((UINTN) (SpiBase + R_PCH_SPI_HSFS), (UINT16)
> (B_PCH_SPI_HSFS_FLOCKDN));
> 
> +  Data16 = MmioRead16 (SpiBase + R_PCH_SPI_HSFS);
> + S3BootScriptSaveMemWrite (
> +S3BootScriptWidthUint16,
> +(UINTN)(SpiBase + R_PCH_SPI_HSFS),
> +1,
> +
> +  );
> +  DEBUG((EFI_D_INFO, "R_PCH_SPI_HSFS \n"));  DEBUG((EFI_D_INFO,
> + "MmioRead16 (0x%x, 0x%x) = 0x%x \n", (UINTN) SpiBase, (UINT8)
> + R_PCH_SPI_HSFS, (UINT16) Data16));
> +
>//
>// Verify if it's really locked.
>//
> @@ -783,6 +839,7 @@ InitializePlatform (
>EFI_HANDLE  Handle = NULL;
>EFI_EVENT   mEfiExitBootServicesEvent;
>EFI_EVENT   RtcEvent;
> +  EFI_EVENT   mEndOfExeEvent;
>VOID 

Re: [edk2] [Patch 1/1] Document: Update FDF spec to remove EDK and IPF related contents

2019-03-19 Thread Gao, Liming
Bob:
  There is one typo in commit message. Remove EDK and IPF related contents inf 
Fdf spec ==> Remove EDK and IPF related contents from Fdf spec.

With this change, Reviewed-by: Liming Gao 

>-Original Message-
>From: Feng, Bob C
>Sent: Wednesday, March 06, 2019 5:53 PM
>To: edk2-devel@lists.01.org
>Cc: Feng, Bob C ; Gao, Liming
>; Carsey, Jaben 
>Subject: [Patch 1/1] Document: Update FDF spec to remove EDK and IPF
>related contents
>
>BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1453
>
>Remove EDK and IPF related contents inf Fdf spec.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng 
>Cc: Liming Gao 
>Cc: Jaben Carsey 
>---
> 1_introduction/11_overview.md 
>   |  22 +++
>---
> 1_introduction/12_terms.md
>   |   8 +---
> 1_introduction/README.md  
>   |   9 ++---
> 2_fdf_design_discussion/22_flash_description_file_format.md
>|  34 --
> 2_fdf_design_discussion/24_[fd]_sections.md   
>   |   9 ++--
>-
> 2_fdf_design_discussion/25_[fv]_sections.md   
>   |   9 +++-
>-
> 2_fdf_design_discussion/{28_[rule]_sections.md => 27_[rule]_sections.md}
>| 232
>+++
>+
>---
>-
> 2_fdf_design_discussion/27_[vtf]_sections.md  
>   |  82 
>--
> 2_fdf_design_discussion/{29_[optionrom]_sections.md =>
>28_[optionrom]_sections.md}  | 112
>-
>---
> 2_fdf_design_discussion/README.md 
>   |   2 --
> 3_edk_ii_fdf_file_format/310_[vtf]_section.md 
>   | 203 ---
>---
>---
>--
> 3_edk_ii_fdf_file_format/{311_pci_optionrom_section.md =>
>310_pci_optionrom_section.md} | 228
>+++
>+++---
>---
>
> 3_edk_ii_fdf_file_format/31_general_rules.md  
>   |  13 +--
>--
> 3_edk_ii_fdf_file_format/32_fdf_definition.md 
>   |  67
>+--
> README.md 
>   |   1 +
> SUMMARY.md
>   |   8 +++-
> appendix_a_nt32pkg_flash_description_file.md  
>   |   4 ++-
>-
> 17 files changed, 321 insertions(+), 722 deletions(-)
>
>diff --git a/1_introduction/11_overview.md
>b/1_introduction/11_overview.md
>index 6db8a26..d7dbb20 100644
>--- a/1_introduction/11_overview.md
>+++ b/1_introduction/11_overview.md
>@@ -1,9 +1,9 @@
> ---
> |
> | `$(WORKSPACE)`| System Environment Variable.
>|
> | `PACKAGES_PATH`   | System Environment Variable that cannot be used
>in EDK II meta-data Files. The build system will automatically detect if this
>variable is present and use directories listed in this variable as if they were
>listed in $(WORKSPACE) |
>-| `$(EDK_SOURCE)`   | System Environment Variable.
>|
>-| `$(EFI_SOURCE)`   | System Environment Variable.
>|
> | `$(EDK_TOOLS_PATH)`   | System Environment Variable
>|
> | `EDK_TOOLS_BIN`   | System Environment Variable that cannot be used in
>EDK II meta-data Files.
>|
>-| `$(ECP_SOURCE)`   | System Environment Variable
>|
> | `$(OUTPUT_DIRECTORY)` | Tool parsing from either the DSC file or via a
>command line option. This is typically the Build/Platform name directory
>created by the build system in the EDK II WORKSPACE
>|
> | `$(BUILD_NUMBER)` | Tool parsing from either an EDK INF file or the EDK
>II DSC file's `BUILD_NUMBER` statement. The EDK II DSC file's
>`BUILD_NUMBER` takes precedence over an EDK INF file's
>|
> |   | `BUILD_NUMBER` if and only if the EDK II DSC 
> specifies a

Re: [edk2] [Patch V2 1/1] Document: Update Inf spec to remove EDK and IPF related contents

2019-03-19 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Feng, Bob C
>Sent: Wednesday, March 06, 2019 4:54 PM
>To: edk2-devel@lists.01.org
>Cc: Feng, Bob C ; Gao, Liming
>; Carsey, Jaben 
>Subject: [Patch V2 1/1] Document: Update Inf spec to remove EDK and IPF
>related contents
>
>BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1453
>
>Remove EDK and IPF related contents
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng 
>Cc: Liming Gao 
>Cc: Jaben Carsey 
>---
> 1_introduction/11_overview.md 
>|   4 ++--
> 2_inf_overview/210_[ppis]_section.md  
>|   3 +--
> 2_inf_overview/211_[guids]_section.md 
>|   3 +--
> 2_inf_overview/212_[libraryclasses]_section.md
>|   3
>+--
> 2_inf_overview/213_[packages]_section.md  
>|   3
>+--
> 2_inf_overview/214_pcd_sections.md
>|  16
>+---
> 2_inf_overview/215_[depex]_section.md 
>|   6
>+-
> 2_inf_overview/21_processing_overview.md  
>|
>21 +
> 2_inf_overview/22_information_file_general_rules.md
>|  32 +++-
> 2_inf_overview/24_[defines]_section.md
>|   6
>+++---
> 2_inf_overview/25_[sources]_section.md
>|   6 +-
>
> 2_inf_overview/26_[buildoptions]_section.md   
>|
>11 ++-
> 2_inf_overview/27_[binaries]_section.md   
>|   7 +-
>-
> 2_inf_overview/29_[protocols]_section.md  
>|   3
>+--
> 2_inf_overview/README.md  
>|  13 +---
>-
> 3_edk_ii_inf_file_format/314_[depex]_sections.md  
>|
>8 +++-
> 3_edk_ii_inf_file_format/315_[binaries]_section.md
>|
>7 +--
> 3_edk_ii_inf_file_format/32_component_inf_definition.md
>|   6 +++---
> 3_edk_ii_inf_file_format/34_[defines]_section.md  
>|
>8 ++--
> 3_edk_ii_inf_file_format/35_[buildoptions]_sections.md
>|   7 +++
> 3_edk_ii_inf_file_format/39_[sources]_sections.md 
>|
>9 ++---
> 3_edk_ii_inf_file_format/README.md
>|   6 +--
>---
> README.md 
>|   3 ++-
> SUMMARY.md
>|  37
>+
> appendix_b_build_changes_and_customizations.md =>
>appendix_a_build_changes_and_customizations.md |  10 +-
> appendix_a_edk_inf_file_specification/README.md
>|  40 
> appendix_a_edk_inf_file_specification/a1_design_discussion.md
>| 317 
>
>---
>---
>---
> appendix_a_edk_inf_file_specification/a2_edk_file_specification.md
>| 461 
>
>---
>---
>---
>
> appendix_c_symbols.md => appendix_b_symbols.md
>|   4 ++--
> appendix_d_sample_driver_inf_files.md =>
>appendix_c_sample_driver_inf_files.md   |   8 
> appendix_e_sample_library_inf_files.md =>
>appendix_d_sample_library_inf_files.md |  10 +-
> appendix_f_sample_binary_inf_files.md =>
>appendix_e_sample_binary_inf_files.md   |   8 
> appendix_g_module_types.md => appendix_f_module_types.md
>|   4 ++--
> 33 files changed, 93 insertions(+), 997 deletions(-)
>
>diff --git a/1_introduction/11_overview.md

Re: [edk2] [Patch] BaseTools: Remove EDK_GLOBAL related logic

2019-03-19 Thread Gao, Liming
Bob:
  Some platform still specifies EDK_GLOBAL, such as 
https://github.com/tianocore/edk2-platforms/blob/devel-MinPlatform/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc.
 Please update them first. 

Thanks
Liming
>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>Feng, Bob C
>Sent: Saturday, March 16, 2019 10:35 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming 
>Subject: [edk2] [Patch] BaseTools: Remove EDK_GLOBAL related logic
>
>BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1350
>
>Macros defined using EDK_GLOBAL are only valid when processing
>EDK libraries and components.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng 
>Cc: Liming Gao 
>---
> BaseTools/Source/Python/Common/DataType.py|  1 -
> BaseTools/Source/Python/Common/GlobalData.py  |  3 +--
> .../Python/CommonDataClass/DataClass.py   |  1 -
> .../Ecc/MetaFileWorkspace/MetaFileParser.py   | 19 ++
> .../Source/Python/UPT/Library/Parsing.py  |  2 +-
> .../Source/Python/UPT/Logger/StringTable.py   |  2 --
> .../Source/Python/Workspace/InfBuildData.py   |  1 -
> .../Source/Python/Workspace/MetaFileParser.py | 20 ++-
> 8 files changed, 6 insertions(+), 43 deletions(-)
>
>diff --git a/BaseTools/Source/Python/Common/DataType.py
>b/BaseTools/Source/Python/Common/DataType.py
>index 798c0e353d..99bb60c852 100644
>--- a/BaseTools/Source/Python/Common/DataType.py
>+++ b/BaseTools/Source/Python/Common/DataType.py
>@@ -415,11 +415,10 @@ TAB_DSC_DEFINES_RT_BASE_ADDRESS =
>'RtBaseAddress'
> TAB_DSC_DEFINES_RFC_LANGUAGES = 'RFC_LANGUAGES'
> TAB_DSC_DEFINES_ISO_LANGUAGES = 'ISO_LANGUAGES'
> TAB_DSC_DEFINES_DEFINE = 'DEFINE'
> TAB_DSC_DEFINES_VPD_TOOL_GUID = 'VPD_TOOL_GUID'
> TAB_FIX_LOAD_TOP_MEMORY_ADDRESS =
>'FIX_LOAD_TOP_MEMORY_ADDRESS'
>-TAB_DSC_DEFINES_EDKGLOBAL = 'EDK_GLOBAL'
> TAB_DSC_PREBUILD = 'PREBUILD'
> TAB_DSC_POSTBUILD = 'POSTBUILD'
> #
> # TargetTxt Definitions
> #
>diff --git a/BaseTools/Source/Python/Common/GlobalData.py
>b/BaseTools/Source/Python/Common/GlobalData.py
>index f117998b0b..9f42484dc1 100644
>--- a/BaseTools/Source/Python/Common/GlobalData.py
>+++ b/BaseTools/Source/Python/Common/GlobalData.py
>@@ -26,11 +26,10 @@ gPlatformDefines = {}
> gPlatformPcds = {}
> # PCDs with type that are not fixed at build and feature flag
> gPlatformOtherPcds = {}
> gActivePlatform = None
> gCommandLineDefines = {}
>-gEdkGlobal = {}
> gOverrideDir = {}
> gCommandMaxLength = 4096
> # for debug trace purpose when problem occurs
> gProcessingFile = ''
> gBuildingModule = ''
>@@ -40,11 +39,11 @@ gDefaultStores = []
> # definition for a MACRO name.  used to create regular expressions below.
> _MacroNamePattern = "[A-Z][A-Z0-9_]*"
>
> ## Regular expression for matching macro used in DSC/DEC/INF file inclusion
> gMacroRefPattern = re.compile("\$\(({})\)".format(_MacroNamePattern),
>re.UNICODE)
>-gMacroDefPattern = re.compile("^(DEFINE|EDK_GLOBAL)[ \t]+")
>+gMacroDefPattern = re.compile("^(DEFINE)[ \t]+")
> gMacroNamePattern = re.compile("^{}$".format(_MacroNamePattern))
>
> # definition for a GUID.  used to create regular expressions below.
> _HexChar = r"[0-9a-fA-F]"
> _GuidPattern = r"{Hex}{{8}}-{Hex}{{4}}-{Hex}{{4}}-{Hex}{{4}}-
>{Hex}{{12}}".format(Hex=_HexChar)
>diff --git a/BaseTools/Source/Python/CommonDataClass/DataClass.py
>b/BaseTools/Source/Python/CommonDataClass/DataClass.py
>index 2d93f79b09..ec5bb194f4 100644
>--- a/BaseTools/Source/Python/CommonDataClass/DataClass.py
>+++ b/BaseTools/Source/Python/CommonDataClass/DataClass.py
>@@ -105,11 +105,10 @@ MODEL_META_DATA_PACKAGE = 5011
> MODEL_META_DATA_NMAKE = 5012
> MODEL_META_DATA_CONDITIONAL_STATEMENT_ELSEIF = 5013
> MODEL_META_DATA_CONDITIONAL_STATEMENT_ENDIF = 5014
> MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH = 5015
> MODEL_META_DATA_COMMENT = 5016
>-MODEL_META_DATA_GLOBAL_DEFINE = 5017
> MODEL_META_DATA_SECTION_HEADER = 5100
> MODEL_META_DATA_SUBSECTION_HEADER = 5200
> MODEL_META_DATA_TAIL_COMMENT = 5300
>
> MODEL_EXTERNAL_DEPENDENCY = 1
>diff --git
>a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
>b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
>index 862974894a..cba1f40837 100644
>--- a/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
>+++ b/BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py
>@@ -40,11 +40,11 @@ from Common.LongFilePathSupport import
>CodecOpenLongFilePath
> ## A decorator used to parse macro definition
> def ParseMacro(Parser):
> def MacroParser(self):
> Match = GlobalData.gMacroDefPattern.match(self._CurrentLine)
> if not Match:
>-# Not 'DEFINE/EDK_GLOBAL' statement, call decorated method
>+# Not 'DEFINE' statement, call decorated method
> Parser(self)
> return
>
> TokenList = GetSplitValueList(self._CurrentLine[Match.end(1):],
>TAB_EQUAL_SPLIT, 1)
> # Syntax check
>@@ 

Re: [edk2] [Patch] BaseTools: Remove the logic SourceOverridePath

2019-03-19 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Feng, Bob C
>Sent: Friday, March 15, 2019 11:18 PM
>To: edk2-devel@lists.01.org
>Cc: Feng, Bob C ; Gao, Liming 
>Subject: [Patch] BaseTools: Remove the logic SourceOverridePath
>
>BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1350
>SOURCE_OVERRIDE_PATH is for EDK component INF files.
>The corresponding logic should be removed.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng 
>Cc: Liming Gao 
>---
> BaseTools/Source/Python/AutoGen/AutoGen.py| 13 +
> BaseTools/Source/Python/Common/DataType.py|  2 --
> BaseTools/Source/Python/Common/GlobalData.py  |  1 -
> .../Python/CommonDataClass/DataClass.py   |  2 --
> .../Ecc/MetaFileWorkspace/MetaFileParser.py   |  8 
> BaseTools/Source/Python/Eot/EotMain.py|  2 +-
> BaseTools/Source/Python/Eot/InfParserLite.py  |  6 +-
> .../Source/Python/UPT/Library/DataType.py |  3 ---
> .../Python/Workspace/BuildClassObject.py  |  1 -
> .../Source/Python/Workspace/DscBuildData.py   | 19 ---
> .../Source/Python/Workspace/InfBuildData.py   | 11 +--
> .../Source/Python/Workspace/MetaFileParser.py |  8 
> 12 files changed, 4 insertions(+), 72 deletions(-)
>
>diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
>b/BaseTools/Source/Python/AutoGen/AutoGen.py
>index 568d535754..8c7c20a386 100644
>--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
>+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
>@@ -1139,11 +1139,10 @@ class PlatformAutoGen(AutoGen):
> self.WorkspaceDir = Workspace.WorkspaceDir
> self.ToolChain = Toolchain
> self.BuildTarget = Target
> self.Arch = Arch
> self.SourceDir = PlatformFile.SubDir
>-self.SourceOverrideDir = None
> self.FdTargetList = self.Workspace.FdTargetList
> self.FvTargetList = self.Workspace.FvTargetList
> # get the original module/package/platform objects
> self.BuildDatabase = Workspace.BuildDatabase
> self.DscBuildDataObj = Workspace.Platform
>@@ -2557,15 +2556,10 @@ class ModuleAutoGen(AutoGen):
> self.PlatformInfo = PlatformAutoGen(Workspace, PlatformFile, Target,
>Toolchain, Arch)
>
> self.SourceDir = self.MetaFile.SubDir
> self.SourceDir = mws.relpath(self.SourceDir, self.WorkspaceDir)
>
>-self.SourceOverrideDir = None
>-# use overridden path defined in DSC file
>-if self.MetaFile.Key in GlobalData.gOverrideDir:
>-self.SourceOverrideDir = 
>GlobalData.gOverrideDir[self.MetaFile.Key]
>-
> self.ToolChain = Toolchain
> self.BuildTarget = Target
> self.Arch = Arch
> self.ToolChainFamily = self.PlatformInfo.ToolChainFamily
> self.BuildRuleFamily = self.PlatformInfo.BuildRuleFamily
>@@ -2766,16 +2760,11 @@ class ModuleAutoGen(AutoGen):
> @cached_property
> def CustomMakefile(self):
> RetVal = {}
> for Type in self.Module.CustomMakefile:
> MakeType = gMakeTypeMap[Type] if Type in gMakeTypeMap else
>'nmake'
>-if self.SourceOverrideDir is not None:
>-File = os.path.join(self.SourceOverrideDir,
>self.Module.CustomMakefile[Type])
>-if not os.path.exists(File):
>-File = os.path.join(self.SourceDir,
>self.Module.CustomMakefile[Type])
>-else:
>-File = os.path.join(self.SourceDir,
>self.Module.CustomMakefile[Type])
>+File = os.path.join(self.SourceDir, 
>self.Module.CustomMakefile[Type])
> RetVal[MakeType] = File
> return RetVal
>
> ## Return the directory of the makefile
> #
>diff --git a/BaseTools/Source/Python/Common/DataType.py
>b/BaseTools/Source/Python/Common/DataType.py
>index 798c0e353d..685f428862 100644
>--- a/BaseTools/Source/Python/Common/DataType.py
>+++ b/BaseTools/Source/Python/Common/DataType.py
>@@ -304,12 +304,10 @@ TAB_COMPONENTS_IA32 = TAB_COMPONENTS +
>TAB_SPLIT + TAB_ARCH_IA32
> TAB_COMPONENTS_X64 = TAB_COMPONENTS + TAB_SPLIT +
>TAB_ARCH_X64
> TAB_COMPONENTS_ARM = TAB_COMPONENTS + TAB_SPLIT +
>TAB_ARCH_ARM
> TAB_COMPONENTS_EBC = TAB_COMPONENTS + TAB_SPLIT +
>TAB_ARCH_EBC
> TAB_COMPONENTS_AARCH64 = TAB_COMPONENTS + TAB_SPLIT +
>TAB_ARCH_AARCH64
>
>-TAB_COMPONENTS_SOURCE_OVERRIDE_PATH =
>'SOURCE_OVERRIDE_PATH'
>-
> TAB_BUILD_OPTIONS = 'BuildOptions'
>
> TAB_DEFINE = 'DEFINE'
> TAB_NMAKE = 'Nmake'
> TAB_USER_EXTENSIONS = 'UserExtensions'
>diff --git a/BaseTools/Source/Python/Common/GlobalData.py
>b/BaseTools/Source/Python/Common/GlobalData.py
>index f117998b0b..79b21324de 100644
>--- a/BaseTools/Source/Python/Common/GlobalData.py
>+++ b/BaseTools/Source/Python/Common/GlobalData.py
>@@ -27,11 +27,10 @@ gPlatformPcds = {}
> # PCDs with type that are not fixed at build and feature flag
> gPlatformOtherPcds = {}
> gActivePlatform = None
> gCommandLineDefines = {}
> gEdkGlobal = {}
>-gOverrideDir = {}
> 

Re: [edk2] [Patch] BaseTools: Remove EDKI related logic from Trim tool

2019-03-19 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Feng, Bob C
>Sent: Friday, March 15, 2019 11:22 PM
>To: edk2-devel@lists.01.org
>Cc: Feng, Bob C ; Gao, Liming 
>Subject: [Patch] BaseTools: Remove EDKI related logic from Trim tool
>
>BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1350
>
>Remove EDKI related logic from Trim tool.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Bob Feng 
>Cc: Liming Gao 
>---
> BaseTools/Source/Python/Trim/Trim.py | 160 ---
> 1 file changed, 160 deletions(-)
>
>diff --git a/BaseTools/Source/Python/Trim/Trim.py
>b/BaseTools/Source/Python/Trim/Trim.py
>index 825ed3e5d5..228779b5a9 100644
>--- a/BaseTools/Source/Python/Trim/Trim.py
>+++ b/BaseTools/Source/Python/Trim/Trim.py
>@@ -59,74 +59,10 @@ gLongNumberPattern = re.compile("(?<=[^a-zA-Z0-
>9_])(0[xX][0-9a-fA-F]+|[0-9]+)U?L
> ## Regular expression for matching "Include ()" in asl file
> gAslIncludePattern = re.compile("^(\s*)[iI]nclude\s*\(\"?([^\"\(\)]+)\"\)",
>re.MULTILINE)
> ## Regular expression for matching C style #include "XXX.asl" in asl file
> gAslCIncludePattern = re.compile(r'^(\s*)#include\s*[<"]\s*([-
>\\/\w.]+)\s*([>"])', re.MULTILINE)
> ## Patterns used to convert EDK conventions to EDK2 ECP conventions
>-gImportCodePatterns = [
>-[
>-re.compile('^(\s*)\(\*\*PeiServices\)\.PciCfg\s*=\s*([^;\s]+);',
>re.MULTILINE),
>-'''\\1{
>-\\1  STATIC EFI_PEI_PPI_DESCRIPTOR gEcpPeiPciCfgPpiList = {
>-\\1(EFI_PEI_PPI_DESCRIPTOR_PPI |
>EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
>-\\1,
>-\\1\\2
>-\\1  };
>-\\1  (**PeiServices).InstallPpi (PeiServices, );
>-\\1}'''
>-],
>-
>-[
>-re.compile('^(\s*)\(\*PeiServices\)->PciCfg\s*=\s*([^;\s]+);',
>re.MULTILINE),
>-'''\\1{
>-\\1  STATIC EFI_PEI_PPI_DESCRIPTOR gEcpPeiPciCfgPpiList = {
>-\\1(EFI_PEI_PPI_DESCRIPTOR_PPI |
>EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
>-\\1,
>-\\1\\2
>-\\1  };
>-\\1  (**PeiServices).InstallPpi (PeiServices, );
>-\\1}'''
>-],
>-
>-[
>-re.compile("(\s*).+->Modify[\s\n]*\(", re.MULTILINE),
>-'\\1PeiLibPciCfgModify ('
>-],
>-
>-[
>-re.compile("(\W*)gRT->ReportStatusCode[\s\n]*\(", re.MULTILINE),
>-'\\1EfiLibReportStatusCode ('
>-],
>-
>-[
>-
>re.compile('#include\s+EFI_GUID_DEFINITION\s*\(FirmwareFileSystem\)',
>re.MULTILINE),
>-'#include EFI_GUID_DEFINITION (FirmwareFileSystem)\n#include
>EFI_GUID_DEFINITION (FirmwareFileSystem2)'
>-],
>-
>-[
>-re.compile('gEfiFirmwareFileSystemGuid', re.MULTILINE),
>-'gEfiFirmwareFileSystem2Guid'
>-],
>-
>-[
>-re.compile('EFI_FVH_REVISION', re.MULTILINE),
>-'EFI_FVH_PI_REVISION'
>-],
>-
>-[
>-
>re.compile("(\s*)\S*CreateEvent\s*\([\s\n]*EFI_EVENT_SIGNAL_READY_TO
>_BOOT[^,]*,((?:[^;]+\n)+)(\s*\));", re.MULTILINE),
>-'\\1EfiCreateEventReadyToBoot (\\2\\3;'
>-],
>-
>-[
>-
>re.compile("(\s*)\S*CreateEvent\s*\([\s\n]*EFI_EVENT_SIGNAL_LEGACY_B
>OOT[^,]*,((?:[^;]+\n)+)(\s*\));", re.MULTILINE),
>-'\\1EfiCreateEventLegacyBoot (\\2\\3;'
>-],
>-#[
>-#re.compile("(\W)(PEI_PCI_CFG_PPI)(\W)", re.MULTILINE),
>-#'\\1ECP_\\2\\3'
>-#]
>-]
>
> ## file cache to avoid circular include in ASL file
> gIncludedAslFile = []
>
> ## Trim preprocessed source code
>@@ -492,101 +428,10 @@ def GenerateVfrBinSec(ModuleName, DebugDir,
>OutputFile):
> EdkLogger.error("Trim", FILE_WRITE_FAILURE, "Write data to file %s
>failed, please check whether the file been locked or using by other
>applications." %OutputFile, None)
>
> fStringIO.close ()
> fInputfile.close ()
>
>-## Trim EDK source code file(s)
>-#
>-#
>-# @param  SourceFile or directory to be trimmed
>-# @param  TargetFile or directory to store the trimmed content
>-#
>-def TrimEdkSources(Source, Target):
>-if os.path.isdir(Source):
>-for CurrentDir, Dirs, Files in os.walk(Source):
>-if '.svn' in Dirs:
>-Dirs.remove('.svn')
>-elif "CVS" in Dirs:
>-Dirs.remove("CVS")
>-
>-for FileName in Files:
>-Dummy, Ext = os.path.splitext(FileName)
>-if Ext.upper() not in ['.C', '.H']: continue
>-if Target is None or Target == '':
>-TrimEdkSourceCode(
>-os.path.join(CurrentDir, FileName),
>-os.path.join(CurrentDir, FileName)
>-)
>-else:
>-TrimEdkSourceCode(
>-os.path.join(CurrentDir, FileName),
>-os.path.join(Target, CurrentDir[len(Source)+1:], 
>FileName)
>-)
>-else:
>-TrimEdkSourceCode(Source, Target)
>-
>-## Trim one EDK source code file
>-#
>-# Do following replacement:
>-#
>-#   (**PeiServices\).PciCfg = <*>;
>-#   =>  {
>-# STATIC 

[edk2] [PATCH v2 09/10] MdePkg/BaseMemoryLibRepStr: Remove .S files for IA32 and X64 arch

2019-03-19 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../BaseMemoryLibRepStr.inf   | 22 ---
 .../BaseMemoryLibRepStr/Ia32/CompareMem.S | 55 
 .../BaseMemoryLibRepStr/Ia32/CopyMem.S| 65 --
 .../BaseMemoryLibRepStr/Ia32/ScanMem16.S  | 54 ---
 .../BaseMemoryLibRepStr/Ia32/ScanMem32.S  | 54 ---
 .../BaseMemoryLibRepStr/Ia32/ScanMem64.S  | 63 --
 .../BaseMemoryLibRepStr/Ia32/ScanMem8.S   | 54 ---
 .../Library/BaseMemoryLibRepStr/Ia32/SetMem.S | 46 -
 .../BaseMemoryLibRepStr/Ia32/SetMem16.S   | 43 
 .../BaseMemoryLibRepStr/Ia32/SetMem32.S   | 43 
 .../BaseMemoryLibRepStr/Ia32/SetMem64.S   | 46 -
 .../BaseMemoryLibRepStr/Ia32/ZeroMem.S| 49 --
 .../BaseMemoryLibRepStr/X64/CompareMem.S  | 59 -
 .../Library/BaseMemoryLibRepStr/X64/CopyMem.S | 66 ---
 .../BaseMemoryLibRepStr/X64/ScanMem16.S   | 56 
 .../BaseMemoryLibRepStr/X64/ScanMem32.S   | 56 
 .../BaseMemoryLibRepStr/X64/ScanMem64.S   | 56 
 .../BaseMemoryLibRepStr/X64/ScanMem8.S| 56 
 .../Library/BaseMemoryLibRepStr/X64/SetMem.S  | 47 -
 .../BaseMemoryLibRepStr/X64/SetMem16.S| 47 -
 .../BaseMemoryLibRepStr/X64/SetMem32.S| 47 -
 .../BaseMemoryLibRepStr/X64/SetMem64.S| 46 -
 .../Library/BaseMemoryLibRepStr/X64/ZeroMem.S | 50 --
 23 files changed, 1180 deletions(-)
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S

diff --git a/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf 
b/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
index 049936deab..7b315b8302 100644
--- a/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
+++ b/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
@@ -48,27 +48,16 @@
 
 [Sources.Ia32]
   Ia32/ScanMem64.nasm
-  Ia32/ScanMem64.S
   Ia32/ScanMem32.nasm
-  Ia32/ScanMem32.S
   Ia32/ScanMem16.nasm
-  Ia32/ScanMem16.S
   Ia32/ScanMem8.nasm
-  Ia32/ScanMem8.S
   Ia32/CompareMem.nasm
-  Ia32/CompareMem.S
   Ia32/ZeroMem.nasm
-  Ia32/ZeroMem.S
   Ia32/SetMem64.nasm
-  Ia32/SetMem64.S
   Ia32/SetMem32.nasm
-  Ia32/SetMem32.S
   Ia32/SetMem16.nasm
-  Ia32/SetMem16.S
   Ia32/SetMem.nasm
-  Ia32/SetMem.S
   Ia32/CopyMem.nasm
-  Ia32/CopyMem.S
   Ia32/ScanMem64.nasm
   Ia32/ScanMem32.nasm
   Ia32/ScanMem16.nasm
@@ -84,27 +73,16 @@
 
 [Sources.X64]
   X64/ScanMem64.nasm
-  X64/ScanMem64.S
   X64/ScanMem32.nasm
-  X64/ScanMem32.S
   X64/ScanMem16.nasm
-  X64/ScanMem16.S
   X64/ScanMem8.nasm
-  X64/ScanMem8.S
   X64/CompareMem.nasm
-  X64/CompareMem.S
   X64/ZeroMem.nasm
-  X64/ZeroMem.S
   X64/SetMem64.nasm
-  X64/SetMem64.S
   X64/SetMem32.nasm
-  X64/SetMem32.S
   X64/SetMem16.nasm
-  X64/SetMem16.S
   X64/SetMem.nasm
-  X64/SetMem.S
   X64/CopyMem.nasm
-  X64/CopyMem.S
   X64/ScanMem64.nasm
   X64/ScanMem32.nasm
   X64/ScanMem16.nasm
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S 
b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S
deleted file mode 100644
index b509586adb..00
--- 

[edk2] [PATCH v2 08/10] MdePkg/BaseMemoryLibOptPei: Remove .S files for IA32 and X64 arch

2019-03-19 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../BaseMemoryLibOptPei.inf   | 22 ---
 .../BaseMemoryLibOptPei/Ia32/CompareMem.S | 55 
 .../BaseMemoryLibOptPei/Ia32/CopyMem.S| 62 -
 .../BaseMemoryLibOptPei/Ia32/ScanMem16.S  | 52 ---
 .../BaseMemoryLibOptPei/Ia32/ScanMem32.S  | 52 ---
 .../BaseMemoryLibOptPei/Ia32/ScanMem64.S  | 61 -
 .../BaseMemoryLibOptPei/Ia32/ScanMem8.S   | 52 ---
 .../Library/BaseMemoryLibOptPei/Ia32/SetMem.S | 50 --
 .../BaseMemoryLibOptPei/Ia32/SetMem16.S   | 43 
 .../BaseMemoryLibOptPei/Ia32/SetMem32.S   | 43 
 .../BaseMemoryLibOptPei/Ia32/SetMem64.S   | 46 -
 .../BaseMemoryLibOptPei/Ia32/ZeroMem.S| 49 --
 .../BaseMemoryLibOptPei/X64/CompareMem.S  | 59 -
 .../Library/BaseMemoryLibOptPei/X64/CopyMem.S | 66 ---
 .../BaseMemoryLibOptPei/X64/ScanMem16.S   | 56 
 .../BaseMemoryLibOptPei/X64/ScanMem32.S   | 56 
 .../BaseMemoryLibOptPei/X64/ScanMem64.S   | 56 
 .../BaseMemoryLibOptPei/X64/ScanMem8.S| 56 
 .../Library/BaseMemoryLibOptPei/X64/SetMem.S  | 47 -
 .../BaseMemoryLibOptPei/X64/SetMem16.S| 47 -
 .../BaseMemoryLibOptPei/X64/SetMem32.S| 47 -
 .../BaseMemoryLibOptPei/X64/SetMem64.S| 46 -
 .../Library/BaseMemoryLibOptPei/X64/ZeroMem.S | 50 --
 23 files changed, 1173 deletions(-)
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.S

diff --git a/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf 
b/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf
index 8f274d83b0..6fcb5fdac2 100644
--- a/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf
+++ b/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf
@@ -35,27 +35,16 @@
 
 [Sources.Ia32]
   Ia32/ScanMem64.nasm
-  Ia32/ScanMem64.S
   Ia32/ScanMem32.nasm
-  Ia32/ScanMem32.S
   Ia32/ScanMem16.nasm
-  Ia32/ScanMem16.S
   Ia32/ScanMem8.nasm
-  Ia32/ScanMem8.S
   Ia32/CompareMem.nasm
-  Ia32/CompareMem.S
   Ia32/ZeroMem.nasm
-  Ia32/ZeroMem.S
   Ia32/SetMem64.nasm
-  Ia32/SetMem64.S
   Ia32/SetMem32.nasm
-  Ia32/SetMem32.S
   Ia32/SetMem16.nasm
-  Ia32/SetMem16.S
   Ia32/SetMem.nasm
-  Ia32/SetMem.S
   Ia32/CopyMem.nasm
-  Ia32/CopyMem.S
   Ia32/ScanMem64.nasm
   Ia32/ScanMem32.nasm
   Ia32/ScanMem16.nasm
@@ -84,27 +73,16 @@
 
 [Sources.X64]
   X64/ScanMem64.nasm
-  X64/ScanMem64.S
   X64/ScanMem32.nasm
-  X64/ScanMem32.S
   X64/ScanMem16.nasm
-  X64/ScanMem16.S
   X64/ScanMem8.nasm
-  X64/ScanMem8.S
   X64/CompareMem.nasm
-  X64/CompareMem.S
   X64/ZeroMem.nasm
-  X64/ZeroMem.S
   X64/SetMem64.nasm
-  X64/SetMem64.S
   X64/SetMem32.nasm
-  X64/SetMem32.S
   X64/SetMem16.nasm
-  X64/SetMem16.S
   X64/SetMem.nasm
-  X64/SetMem.S
   X64/CopyMem.nasm
-  X64/CopyMem.S
   X64/IsZeroBuffer.nasm
   ScanMem64Wrapper.c
   ScanMem32Wrapper.c
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S 
b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S
deleted file mode 100644
index 23758781c9..00
--- 

[edk2] [PATCH v2 10/10] MdePkg/BaseMemoryLibSse2: Remove .S files for IA32 and X64 arch

2019-03-19 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../BaseMemoryLibSse2/BaseMemoryLibSse2.inf   | 22 -
 .../BaseMemoryLibSse2/Ia32/CompareMem.S   | 55 
 .../Library/BaseMemoryLibSse2/Ia32/CopyMem.S  | 85 ---
 .../BaseMemoryLibSse2/Ia32/ScanMem16.S| 52 
 .../BaseMemoryLibSse2/Ia32/ScanMem32.S| 52 
 .../BaseMemoryLibSse2/Ia32/ScanMem64.S| 61 -
 .../Library/BaseMemoryLibSse2/Ia32/ScanMem8.S | 52 
 .../Library/BaseMemoryLibSse2/Ia32/SetMem.S   | 76 -
 .../Library/BaseMemoryLibSse2/Ia32/SetMem16.S | 69 ---
 .../Library/BaseMemoryLibSse2/Ia32/SetMem32.S | 68 ---
 .../Library/BaseMemoryLibSse2/Ia32/SetMem64.S | 58 -
 .../Library/BaseMemoryLibSse2/Ia32/ZeroMem.S  | 65 --
 .../BaseMemoryLibSse2/X64/CompareMem.S| 59 -
 .../Library/BaseMemoryLibSse2/X64/CopyMem.S   | 83 --
 .../Library/BaseMemoryLibSse2/X64/ScanMem16.S | 56 
 .../Library/BaseMemoryLibSse2/X64/ScanMem32.S | 56 
 .../Library/BaseMemoryLibSse2/X64/ScanMem64.S | 56 
 .../Library/BaseMemoryLibSse2/X64/ScanMem8.S  | 56 
 MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S | 72 
 .../Library/BaseMemoryLibSse2/X64/SetMem16.S  | 70 ---
 .../Library/BaseMemoryLibSse2/X64/SetMem32.S  | 69 ---
 .../Library/BaseMemoryLibSse2/X64/SetMem64.S  | 60 -
 .../Library/BaseMemoryLibSse2/X64/ZeroMem.S   | 65 --
 23 files changed, 1417 deletions(-)
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S

diff --git a/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf 
b/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
index 771fddaa45..340ca15f06 100644
--- a/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
+++ b/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
@@ -47,27 +47,16 @@
 
 [Sources.Ia32]
   Ia32/ScanMem64.nasm
-  Ia32/ScanMem64.S
   Ia32/ScanMem32.nasm
-  Ia32/ScanMem32.S
   Ia32/ScanMem16.nasm
-  Ia32/ScanMem16.S
   Ia32/ScanMem8.nasm
-  Ia32/ScanMem8.S
   Ia32/CompareMem.nasm
-  Ia32/CompareMem.S
   Ia32/ZeroMem.nasm
-  Ia32/ZeroMem.S
   Ia32/SetMem64.nasm
-  Ia32/SetMem64.S
   Ia32/SetMem32.nasm
-  Ia32/SetMem32.S
   Ia32/SetMem16.nasm
-  Ia32/SetMem16.S
   Ia32/SetMem.nasm
-  Ia32/SetMem.S
   Ia32/CopyMem.nasm
-  Ia32/CopyMem.S
   Ia32/ScanMem64.nasm
   Ia32/ScanMem32.nasm
   Ia32/ScanMem16.nasm
@@ -94,27 +83,16 @@
   X64/SetMem.nasm
   X64/CopyMem.nasm
   X64/ScanMem64.nasm
-  X64/ScanMem64.S
   X64/ScanMem32.nasm
-  X64/ScanMem32.S
   X64/ScanMem16.nasm
-  X64/ScanMem16.S
   X64/ScanMem8.nasm
-  X64/ScanMem8.S
   X64/CompareMem.nasm
-  X64/CompareMem.S
   X64/ZeroMem.nasm
-  X64/ZeroMem.S
   X64/SetMem64.nasm
-  X64/SetMem64.S
   X64/SetMem32.nasm
-  X64/SetMem32.S
   X64/SetMem16.nasm
-  X64/SetMem16.S
   X64/SetMem.nasm
-  X64/SetMem.S
   X64/CopyMem.nasm
-  X64/CopyMem.S
   X64/IsZeroBuffer.nasm
 
 [Packages]
diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S 
b/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S
deleted file mode 100644
index b509586adb..00
--- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S
+++ /dev/null
@@ -1,55 +0,0 @@

[edk2] [PATCH v2 07/10] MdePkg/BaseMemoryLibOptDxe: Remove .S files for IA32 and X64 arch

2019-03-19 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../BaseMemoryLibOptDxe.inf   | 22 -
 .../BaseMemoryLibOptDxe/Ia32/CompareMem.S | 55 
 .../BaseMemoryLibOptDxe/Ia32/CopyMem.S| 85 ---
 .../BaseMemoryLibOptDxe/Ia32/ScanMem16.S  | 52 
 .../BaseMemoryLibOptDxe/Ia32/ScanMem32.S  | 52 
 .../BaseMemoryLibOptDxe/Ia32/ScanMem64.S  | 61 -
 .../BaseMemoryLibOptDxe/Ia32/ScanMem8.S   | 52 
 .../Library/BaseMemoryLibOptDxe/Ia32/SetMem.S | 50 ---
 .../BaseMemoryLibOptDxe/Ia32/SetMem16.S   | 43 --
 .../BaseMemoryLibOptDxe/Ia32/SetMem32.S   | 43 --
 .../BaseMemoryLibOptDxe/Ia32/SetMem64.S   | 46 --
 .../BaseMemoryLibOptDxe/Ia32/ZeroMem.S| 49 ---
 .../BaseMemoryLibOptDxe/X64/CompareMem.S  | 59 -
 .../Library/BaseMemoryLibOptDxe/X64/CopyMem.S | 82 --
 .../BaseMemoryLibOptDxe/X64/ScanMem16.S   | 56 
 .../BaseMemoryLibOptDxe/X64/ScanMem32.S   | 56 
 .../BaseMemoryLibOptDxe/X64/ScanMem64.S   | 55 
 .../BaseMemoryLibOptDxe/X64/ScanMem8.S| 56 
 .../Library/BaseMemoryLibOptDxe/X64/SetMem.S  | 57 -
 .../BaseMemoryLibOptDxe/X64/SetMem16.S| 47 --
 .../BaseMemoryLibOptDxe/X64/SetMem32.S| 47 --
 .../BaseMemoryLibOptDxe/X64/SetMem64.S| 46 --
 .../Library/BaseMemoryLibOptDxe/X64/ZeroMem.S | 51 ---
 23 files changed, 1222 deletions(-)
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.S

diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf 
b/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
index 3f756647e1..5ee1d70473 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
@@ -35,27 +35,16 @@
 
 [Sources.Ia32]
   Ia32/ScanMem64.nasm
-  Ia32/ScanMem64.S
   Ia32/ScanMem32.nasm
-  Ia32/ScanMem32.S
   Ia32/ScanMem16.nasm
-  Ia32/ScanMem16.S
   Ia32/ScanMem8.nasm
-  Ia32/ScanMem8.S
   Ia32/CompareMem.nasm
-  Ia32/CompareMem.S
   Ia32/ZeroMem.nasm
-  Ia32/ZeroMem.S
   Ia32/SetMem64.nasm
-  Ia32/SetMem64.S
   Ia32/SetMem32.nasm
-  Ia32/SetMem32.S
   Ia32/SetMem16.nasm
-  Ia32/SetMem16.S
   Ia32/SetMem.nasm
-  Ia32/SetMem.S
   Ia32/CopyMem.nasm
-  Ia32/CopyMem.S
   Ia32/ScanMem64.nasm
   Ia32/ScanMem32.nasm
   Ia32/ScanMem16.nasm
@@ -72,27 +61,16 @@
 
 [Sources.X64]
   X64/ScanMem64.nasm
-  X64/ScanMem64.S
   X64/ScanMem32.nasm
-  X64/ScanMem32.S
   X64/ScanMem16.nasm
-  X64/ScanMem16.S
   X64/ScanMem8.nasm
-  X64/ScanMem8.S
   X64/CompareMem.nasm
-  X64/CompareMem.S
   X64/ZeroMem.nasm
-  X64/ZeroMem.S
   X64/SetMem64.nasm
-  X64/SetMem64.S
   X64/SetMem32.nasm
-  X64/SetMem32.S
   X64/SetMem16.nasm
-  X64/SetMem16.S
   X64/SetMem.nasm
-  X64/SetMem.S
   X64/CopyMem.nasm
-  X64/CopyMem.S
   X64/IsZeroBuffer.nasm
   MemLibGuid.c
 
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S 
b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S
deleted file mode 100644
index 23758781c9..00
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S
+++ /dev/null
@@ -1,55 +0,0 @@

[edk2] [PATCH v2 04/10] MdePkg/BaseCpuLib: Remove .S files for IA32 and X64 arch

2019-03-19 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

v2: Remove CpuSleep.nasm| GCC and CpuFlushTlb.nasm| GCC in X64 arch
in BaseCpuLib.inf.

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 MdePkg/Library/BaseCpuLib/BaseCpuLib.inf|  4 ---
 MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S | 35 -
 MdePkg/Library/BaseCpuLib/X64/CpuSleep.S| 34 
 3 files changed, 73 deletions(-)
 delete mode 100644 MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S
 delete mode 100644 MdePkg/Library/BaseCpuLib/X64/CpuSleep.S

diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf 
b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
index af2f09617a..a734cac377 100644
--- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
@@ -46,10 +46,6 @@
   X64/CpuFlushTlb.nasm
   X64/CpuSleep.nasm
 
-  X64/CpuSleep.nasm| GCC
-  X64/CpuSleep.S | GCC
-  X64/CpuFlushTlb.nasm| GCC
-  X64/CpuFlushTlb.S | GCC
 
 [Sources.EBC]
   Ebc/CpuSleepFlushTlb.c
diff --git a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S 
b/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S
deleted file mode 100644
index 05d916a589..00
--- a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S
+++ /dev/null
@@ -1,35 +0,0 @@
-#--
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD 
License
-# which accompanies this distribution.  The full text of the license may be 
found at
-# 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.
-#
-# Module Name:
-#
-#   CpuFlushTlb.Asm
-#
-# Abstract:
-#
-#   CpuFlushTlb function
-#
-# Notes:
-#
-#--
-
-ASM_GLOBAL ASM_PFX(CpuFlushTlb)
-
-#--
-# VOID
-# EFIAPI
-# CpuFlushTlb (
-#   VOID
-#   );
-#--
-ASM_PFX(CpuFlushTlb):
-mov %cr3, %rax
-mov %rax, %cr3
-ret
diff --git a/MdePkg/Library/BaseCpuLib/X64/CpuSleep.S 
b/MdePkg/Library/BaseCpuLib/X64/CpuSleep.S
deleted file mode 100644
index cf763689d7..00
--- a/MdePkg/Library/BaseCpuLib/X64/CpuSleep.S
+++ /dev/null
@@ -1,34 +0,0 @@
-#--
 ;
-# Copyright (c) 2006 - 2008, 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.
-#
-# Module Name:
-#
-#   CpuSleep.S
-#
-# Abstract:
-#
-#   CpuSleep function
-#
-# Notes:
-#
-#--
-
-
-#--
-# VOID
-# EFIAPI
-# CpuSleep (
-#   VOID
-#   );
-#--
-ASM_GLOBAL ASM_PFX(CpuSleep)
-ASM_PFX(CpuSleep):
-hlt
-ret
-- 
2.18.0.windows.1

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


[edk2] [PATCH v2 00/10] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg

2019-03-19 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

v2: Remove some description in 04/10.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Eric Dong 
Cc: Ray Ni 
Shenglei Zhang (10):
  UefiCpuPkg/SmmCpuFeaturesLib: Remove .S files for IA32 and X64 arch
  UefiCpuPkg/BaseUefiCpuLib: Remove .S files for IA32 and X64 arch
  UefiCpuPkg/CpuExceptionHandlerLib:Remove.S files for IA32 and X64 arch
  MdePkg/BaseCpuLib: Remove .S files for IA32 and X64 arch
  MdePkg/BaseLib: Remove .S files for IA32 and X64 arch
  MdePkg/BaseMemoryLibMmx: Remove .S files for IA32 and X64 arch
  MdePkg/BaseMemoryLibOptDxe: Remove .S files for IA32 and X64 arch
  MdePkg/BaseMemoryLibOptPei: Remove .S files for IA32 and X64 arch
  MdePkg/BaseMemoryLibRepStr: Remove .S files for IA32 and X64 arch
  MdePkg/BaseMemoryLibSse2: Remove .S files for IA32 and X64 arch

 MdePkg/Library/BaseCpuLib/BaseCpuLib.inf  |   4 -
 MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S   |  35 -
 MdePkg/Library/BaseCpuLib/X64/CpuSleep.S  |  34 -
 MdePkg/Library/BaseLib/BaseLib.inf|  38 -
 MdePkg/Library/BaseLib/Ia32/ARShiftU64.S  |  43 --
 MdePkg/Library/BaseLib/Ia32/CpuId.S   |  63 --
 MdePkg/Library/BaseLib/Ia32/CpuIdEx.S |  67 --
 MdePkg/Library/BaseLib/Ia32/DisableCache.S|  39 -
 MdePkg/Library/BaseLib/Ia32/DisablePaging32.S |  52 --
 MdePkg/Library/BaseLib/Ia32/DivU64x32.S   |  41 --
 .../Library/BaseLib/Ia32/DivU64x32Remainder.S |  46 --
 .../Library/BaseLib/Ia32/DivU64x64Remainder.S |  89 ---
 MdePkg/Library/BaseLib/Ia32/EnableCache.S |  39 -
 .../BaseLib/Ia32/EnableDisableInterrupts.S|  36 -
 MdePkg/Library/BaseLib/Ia32/EnablePaging32.S  |  52 --
 MdePkg/Library/BaseLib/Ia32/EnablePaging64.S  |  63 --
 .../BaseLib/Ia32/InternalSwitchStack.S|  48 --
 MdePkg/Library/BaseLib/Ia32/LRotU64.S |  48 --
 MdePkg/Library/BaseLib/Ia32/LShiftU64.S   |  43 --
 MdePkg/Library/BaseLib/Ia32/LongJump.S|  41 --
 MdePkg/Library/BaseLib/Ia32/ModU64x32.S   |  40 --
 MdePkg/Library/BaseLib/Ia32/Monitor.S |  40 --
 MdePkg/Library/BaseLib/Ia32/MultU64x32.S  |  41 --
 MdePkg/Library/BaseLib/Ia32/MultU64x64.S  |  44 --
 MdePkg/Library/BaseLib/Ia32/Mwait.S   |  38 -
 MdePkg/Library/BaseLib/Ia32/RRotU64.S |  48 --
 MdePkg/Library/BaseLib/Ia32/RShiftU64.S   |  46 --
 MdePkg/Library/BaseLib/Ia32/RdRand.S  |  80 ---
 MdePkg/Library/BaseLib/Ia32/SetJump.S |  44 --
 MdePkg/Library/BaseLib/Ia32/SwapBytes64.S |  38 -
 MdePkg/Library/BaseLib/Ia32/Thunk16.S | 222 --
 MdePkg/Library/BaseLib/X64/CpuId.S|  60 --
 MdePkg/Library/BaseLib/X64/CpuIdEx.S  |  62 --
 MdePkg/Library/BaseLib/X64/DisableCache.S |  39 -
 MdePkg/Library/BaseLib/X64/DisablePaging64.S  |  82 ---
 MdePkg/Library/BaseLib/X64/EnableCache.S  |  39 -
 .../BaseLib/X64/EnableDisableInterrupts.S |  36 -
 MdePkg/Library/BaseLib/X64/LongJump.S |  54 --
 MdePkg/Library/BaseLib/X64/RdRand.S   |  72 --
 MdePkg/Library/BaseLib/X64/SetJump.S  |  53 --
 MdePkg/Library/BaseLib/X64/SwitchStack.S  |  52 --
 MdePkg/Library/BaseLib/X64/Thunk16.S  | 334 -
 .../BaseMemoryLibMmx/BaseMemoryLibMmx.inf |  22 -
 .../BaseMemoryLibMmx/Ia32/CompareMem.S|  55 --
 .../Library/BaseMemoryLibMmx/Ia32/CopyMem.S   |  86 ---
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem16.S |  52 --
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem32.S |  52 --
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem64.S |  61 --
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem8.S  |  52 --
 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S |  66 --
 .../Library/BaseMemoryLibMmx/Ia32/SetMem16.S  |  59 --
 .../Library/BaseMemoryLibMmx/Ia32/SetMem32.S  |  52 --
 .../Library/BaseMemoryLibMmx/Ia32/SetMem64.S  |  43 --
 .../Library/BaseMemoryLibMmx/Ia32/ZeroMem.S   |  54 --
 .../Library/BaseMemoryLibMmx/X64/CompareMem.S |  59 --
 MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S |  74 --
 .../Library/BaseMemoryLibMmx/X64/ScanMem16.S  |  56 --
 .../Library/BaseMemoryLibMmx/X64/ScanMem32.S  |  56 --
 .../Library/BaseMemoryLibMmx/X64/ScanMem64.S  |  55 --
 .../Library/BaseMemoryLibMmx/X64/ScanMem8.S   |  56 --
 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S  |  61 --
 .../Library/BaseMemoryLibMmx/X64/SetMem16.S   |  60 --
 .../Library/BaseMemoryLibMmx/X64/SetMem32.S   |  55 --
 .../Library/BaseMemoryLibMmx/X64/SetMem64.S   |  47 --
 MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S |  57 --
 .../BaseMemoryLibOptDxe.inf   |  22 -
 .../BaseMemoryLibOptDxe/Ia32/CompareMem.S |  55 --
 .../BaseMemoryLibOptDxe/Ia32/CopyMem.S|  85 ---
 .../BaseMemoryLibOptDxe/Ia32/ScanMem16.S  |  52 --
 .../BaseMemoryLibOptDxe/Ia32/ScanMem32.S  |  52 --
 .../BaseMemoryLibOptDxe/Ia32/ScanMem64.S  |  61 --
 .../BaseMemoryLibOptDxe/Ia32/ScanMem8.S   |  52 --
 

[edk2] [PATCH v2 06/10] MdePkg/BaseMemoryLibMmx: Remove .S files for IA32 and X64 arch

2019-03-19 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../BaseMemoryLibMmx/BaseMemoryLibMmx.inf | 22 -
 .../BaseMemoryLibMmx/Ia32/CompareMem.S| 55 
 .../Library/BaseMemoryLibMmx/Ia32/CopyMem.S   | 86 ---
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem16.S | 52 ---
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem32.S | 52 ---
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem64.S | 61 -
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem8.S  | 52 ---
 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S | 66 --
 .../Library/BaseMemoryLibMmx/Ia32/SetMem16.S  | 59 -
 .../Library/BaseMemoryLibMmx/Ia32/SetMem32.S  | 52 ---
 .../Library/BaseMemoryLibMmx/Ia32/SetMem64.S  | 43 --
 .../Library/BaseMemoryLibMmx/Ia32/ZeroMem.S   | 54 
 .../Library/BaseMemoryLibMmx/X64/CompareMem.S | 59 -
 MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S | 74 
 .../Library/BaseMemoryLibMmx/X64/ScanMem16.S  | 56 
 .../Library/BaseMemoryLibMmx/X64/ScanMem32.S  | 56 
 .../Library/BaseMemoryLibMmx/X64/ScanMem64.S  | 55 
 .../Library/BaseMemoryLibMmx/X64/ScanMem8.S   | 56 
 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S  | 61 -
 .../Library/BaseMemoryLibMmx/X64/SetMem16.S   | 60 -
 .../Library/BaseMemoryLibMmx/X64/SetMem32.S   | 55 
 .../Library/BaseMemoryLibMmx/X64/SetMem64.S   | 47 --
 MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S | 57 
 23 files changed, 1290 deletions(-)
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S

diff --git a/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf 
b/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
index d17fcf24b6..9a073d1cd9 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
+++ b/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
@@ -52,27 +52,16 @@
 
 [Sources.Ia32]
   Ia32/ScanMem64.nasm
-  Ia32/ScanMem64.S
   Ia32/ScanMem32.nasm
-  Ia32/ScanMem32.S
   Ia32/ScanMem16.nasm
-  Ia32/ScanMem16.S
   Ia32/ScanMem8.nasm
-  Ia32/ScanMem8.S
   Ia32/CompareMem.nasm
-  Ia32/CompareMem.S
   Ia32/SetMem64.nasm
-  Ia32/SetMem64.S
   Ia32/SetMem32.nasm
-  Ia32/SetMem32.S
   Ia32/SetMem16.nasm
-  Ia32/SetMem16.S
   Ia32/ZeroMem.nasm
-  Ia32/ZeroMem.S
   Ia32/SetMem.nasm
-  Ia32/SetMem.S
   Ia32/CopyMem.nasm
-  Ia32/CopyMem.S
   Ia32/ScanMem64.nasm
   Ia32/ScanMem32.nasm
   Ia32/ScanMem16.nasm
@@ -99,27 +88,16 @@
   X64/SetMem.nasm
   X64/CopyMem.nasm
   X64/ScanMem64.nasm
-  X64/ScanMem64.S
   X64/ScanMem32.nasm
-  X64/ScanMem32.S
   X64/ScanMem16.nasm
-  X64/ScanMem16.S
   X64/ScanMem8.nasm
-  X64/ScanMem8.S
   X64/CompareMem.nasm
-  X64/CompareMem.S
   X64/SetMem64.nasm
-  X64/SetMem64.S
   X64/SetMem32.nasm
-  X64/SetMem32.S
   X64/SetMem16.nasm
-  X64/SetMem16.S
   X64/ZeroMem.nasm
-  X64/ZeroMem.S
   X64/SetMem.nasm
-  X64/SetMem.S
   X64/CopyMem.nasm
-  X64/CopyMem.S
   X64/IsZeroBuffer.nasm
 
 
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S 
b/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S
deleted file mode 100644
index b509586adb..00
--- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S
+++ /dev/null
@@ -1,55 +0,0 @@
-#--
-#
-# Copyright 

[edk2] [PATCH v2 05/10] MdePkg/BaseLib: Remove .S files for IA32 and X64 arch

2019-03-19 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 MdePkg/Library/BaseLib/BaseLib.inf|  38 --
 MdePkg/Library/BaseLib/Ia32/ARShiftU64.S  |  43 ---
 MdePkg/Library/BaseLib/Ia32/CpuId.S   |  63 
 MdePkg/Library/BaseLib/Ia32/CpuIdEx.S |  67 
 MdePkg/Library/BaseLib/Ia32/DisableCache.S|  39 --
 MdePkg/Library/BaseLib/Ia32/DisablePaging32.S |  52 ---
 MdePkg/Library/BaseLib/Ia32/DivU64x32.S   |  41 ---
 .../Library/BaseLib/Ia32/DivU64x32Remainder.S |  46 ---
 .../Library/BaseLib/Ia32/DivU64x64Remainder.S |  89 -
 MdePkg/Library/BaseLib/Ia32/EnableCache.S |  39 --
 .../BaseLib/Ia32/EnableDisableInterrupts.S|  36 --
 MdePkg/Library/BaseLib/Ia32/EnablePaging32.S  |  52 ---
 MdePkg/Library/BaseLib/Ia32/EnablePaging64.S  |  63 
 .../BaseLib/Ia32/InternalSwitchStack.S|  48 ---
 MdePkg/Library/BaseLib/Ia32/LRotU64.S |  48 ---
 MdePkg/Library/BaseLib/Ia32/LShiftU64.S   |  43 ---
 MdePkg/Library/BaseLib/Ia32/LongJump.S|  41 ---
 MdePkg/Library/BaseLib/Ia32/ModU64x32.S   |  40 ---
 MdePkg/Library/BaseLib/Ia32/Monitor.S |  40 ---
 MdePkg/Library/BaseLib/Ia32/MultU64x32.S  |  41 ---
 MdePkg/Library/BaseLib/Ia32/MultU64x64.S  |  44 ---
 MdePkg/Library/BaseLib/Ia32/Mwait.S   |  38 --
 MdePkg/Library/BaseLib/Ia32/RRotU64.S |  48 ---
 MdePkg/Library/BaseLib/Ia32/RShiftU64.S   |  46 ---
 MdePkg/Library/BaseLib/Ia32/RdRand.S  |  80 -
 MdePkg/Library/BaseLib/Ia32/SetJump.S |  44 ---
 MdePkg/Library/BaseLib/Ia32/SwapBytes64.S |  38 --
 MdePkg/Library/BaseLib/Ia32/Thunk16.S | 222 
 MdePkg/Library/BaseLib/X64/CpuId.S|  60 
 MdePkg/Library/BaseLib/X64/CpuIdEx.S  |  62 
 MdePkg/Library/BaseLib/X64/DisableCache.S |  39 --
 MdePkg/Library/BaseLib/X64/DisablePaging64.S  |  82 -
 MdePkg/Library/BaseLib/X64/EnableCache.S  |  39 --
 .../BaseLib/X64/EnableDisableInterrupts.S |  36 --
 MdePkg/Library/BaseLib/X64/LongJump.S |  54 ---
 MdePkg/Library/BaseLib/X64/RdRand.S   |  72 
 MdePkg/Library/BaseLib/X64/SetJump.S  |  53 ---
 MdePkg/Library/BaseLib/X64/SwitchStack.S  |  52 ---
 MdePkg/Library/BaseLib/X64/Thunk16.S  | 334 --
 39 files changed, 2412 deletions(-)
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/ARShiftU64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/CpuId.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/CpuIdEx.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/DisableCache.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/DisablePaging32.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/DivU64x32.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/EnableCache.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/EnablePaging32.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/EnablePaging64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/LRotU64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/LShiftU64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/LongJump.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/ModU64x32.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/Monitor.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/MultU64x32.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/MultU64x64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/Mwait.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/RRotU64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/RShiftU64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/RdRand.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/SetJump.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/SwapBytes64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/Thunk16.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/CpuId.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/CpuIdEx.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/DisableCache.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/DisablePaging64.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/EnableCache.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/LongJump.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/RdRand.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/SetJump.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/SwitchStack.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/Thunk16.S

diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.inf
index a0d6c372f9..16829deeb4 

[edk2] [PATCH v2 03/10] UefiCpuPkg/CpuExceptionHandlerLib:Remove.S files for IA32 and X64 arch

2019-03-19 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../DxeCpuExceptionHandlerLib.inf |   2 -
 .../Ia32/ExceptionHandlerAsm.S| 667 --
 .../PeiCpuExceptionHandlerLib.inf |   2 -
 .../SecPeiCpuExceptionHandlerLib.inf  |   2 -
 .../SmmCpuExceptionHandlerLib.inf |   2 -
 .../X64/ExceptionHandlerAsm.S | 434 
 6 files changed, 1109 deletions(-)
 delete mode 100644 
UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S
 delete mode 100644 
UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S

diff --git 
a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf 
b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
index a480890165..391e49f077 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
@@ -30,13 +30,11 @@
 [Sources.Ia32]
   Ia32/ExceptionHandlerAsm.nasm
   Ia32/ExceptionTssEntryAsm.nasm
-  Ia32/ExceptionHandlerAsm.S
   Ia32/ArchExceptionHandler.c
   Ia32/ArchInterruptDefs.h
 
 [Sources.X64]
   X64/ExceptionHandlerAsm.nasm
-  X64/ExceptionHandlerAsm.S
   X64/ArchExceptionHandler.c
   X64/ArchInterruptDefs.h
 
diff --git 
a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S 
b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S
deleted file mode 100644
index c134257d9d..00
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S
+++ /dev/null
@@ -1,667 +0,0 @@
-#--
-#*
-#*   Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.
-#*   This program and the accompanying materials
-#*   are licensed and made available under the terms and conditions of the BSD 
License
-#*   which accompanies this distribution.  The full text of the license may be 
found at
-#*   http://opensource.org/licenses/bsd-license.php
-#*
-#*   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#*   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
-#*
-#*ExceptionHandlerAsm.S
-#*
-#*   Abstract:
-#*
-#* IA32 CPU Exception Handler
-#
-#--
-
-
-#.MMX
-#.XMM
-
-ASM_GLOBAL ASM_PFX(CommonExceptionHandler)
-ASM_GLOBAL ASM_PFX(CommonInterruptEntry)
-ASM_GLOBAL ASM_PFX(HookAfterStubHeaderEnd)
-
-#EXTRN ASM_PFX(mErrorCodeFlag):DWORD   # Error code flags for 
exceptions
-#EXTRN ASM_PFX(mDoFarReturnFlag):DWORD # Do far return flag
-
-.text
-
-#
-# exception handler stub table
-#
-Exception0Handle:
-.byte   0x6a#  push #VectorNum
-.byte   0
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception1Handle:
-.byte   0x6a#  push #VectorNum
-.byte   1
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception2Handle:
-.byte   0x6a#  push #VectorNum
-.byte   2
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception3Handle:
-.byte   0x6a#  push #VectorNum
-.byte   3
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception4Handle:
-.byte   0x6a#  push #VectorNum
-.byte   4
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception5Handle:
-.byte   0x6a#  push #VectorNum
-.byte   5
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception6Handle:
-.byte   0x6a#  push #VectorNum
-.byte   6
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception7Handle:
-.byte   0x6a#  push #VectorNum
-.byte   7
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception8Handle:
-.byte   0x6a#  push #VectorNum
-.byte   8
-pushl   %eax
- .byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception9Handle:
-.byte   0x6a#  push #VectorNum
-.byte   9
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception10Handle:
-.byte   0x6a#  push #VectorNum
-.byte   10
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception11Handle:
-.byte   0x6a#  push #VectorNum
-.byte   11
-pushl   %eax
-.byte   0xB8
-.long   

[edk2] [PATCH v2 01/10] UefiCpuPkg/SmmCpuFeaturesLib: Remove .S files for IA32 and X64 arch

2019-03-19 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Eric Dong 
Cc: Ray Ni 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S | 278 -
 .../SmmCpuFeaturesLib/Ia32/SmiException.S | 174 ---
 .../SmmCpuFeaturesLibStm.inf  |   6 -
 .../Library/SmmCpuFeaturesLib/X64/SmiEntry.S  | 282 --
 .../SmmCpuFeaturesLib/X64/SmiException.S  | 178 ---
 5 files changed, 918 deletions(-)
 delete mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S
 delete mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiException.S
 delete mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.S
 delete mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.S

diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S 
b/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S
deleted file mode 100644
index 4c0f8c8933..00
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S
+++ /dev/null
@@ -1,278 +0,0 @@
-#--
-#
-# Copyright (c) 2009 - 2016, 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.
-#
-# Module Name:
-#
-#   SmiEntry.S
-#
-# Abstract:
-#
-#   Code template of the SMI handler for a particular processor
-#
-#--
-
-ASM_GLOBAL  ASM_PFX(gcStmSmiHandlerTemplate)
-ASM_GLOBAL  ASM_PFX(gcStmSmiHandlerSize)
-ASM_GLOBAL  ASM_PFX(gcStmSmiHandlerOffset)
-ASM_GLOBAL  ASM_PFX(gStmSmiCr3)
-ASM_GLOBAL  ASM_PFX(gStmSmiStack)
-ASM_GLOBAL  ASM_PFX(gStmSmbase)
-ASM_GLOBAL  ASM_PFX(gStmXdSupported)
-ASM_GLOBAL  ASM_PFX(FeaturePcdGet (PcdCpuSmmStackGuard))
-ASM_GLOBAL  ASM_PFX(gStmSmiHandlerIdtr)
-
-.equMSR_IA32_MISC_ENABLE, 0x1A0
-.equMSR_EFER, 0xc080
-.equMSR_EFER_XD, 0x800
-
-#
-# Constants relating to TXT_PROCESSOR_SMM_DESCRIPTOR
-#
-.equDSC_OFFSET, 0xfb00
-.equDSC_GDTPTR, 0x48
-.equDSC_GDTSIZ, 0x50
-.equDSC_CS, 0x14
-.equDSC_DS, 0x16
-.equDSC_SS, 0x18
-.equDSC_OTHERSEG, 0x1A
-
-.equPROTECT_MODE_CS, 0x08
-.equPROTECT_MODE_DS, 0x20
-.equTSS_SEGMENT, 0x40
-
-.text
-ASM_PFX(gcStmSmiHandlerTemplate):
-
-_StmSmiEntryPoint:
-.byte 0xbb  # mov bx, imm16
-.word _StmGdtDesc - _StmSmiEntryPoint + 0x8000
-.byte 0x2e,0xa1 # mov ax, cs:[offset16]
-.word DSC_OFFSET + DSC_GDTSIZ
-decl%eax
-movl%eax, %cs:(%edi)# mov cs:[bx], ax
-.byte 0x66,0x2e,0xa1# mov eax, cs:[offset16]
-.word   DSC_OFFSET + DSC_GDTPTR
-movw%ax, %cs:2(%edi)
-movw%ax, %bp# ebp = GDT base
-.byte 0x66
-lgdt%cs:(%edi)
-# Patch ProtectedMode Segment
-.byte   0xb8# mov ax, imm16
-.word   PROTECT_MODE_CS # set AX for segment directly
-movl%eax, %cs:-2(%edi)  # mov cs:[bx - 2], ax
-# Patch ProtectedMode entry
-.byte 0x66, 0xbf# mov edi, SMBASE
-ASM_PFX(gStmSmbase): .space 4
-.byte 0x67
-lea ((Start32bit - _StmSmiEntryPoint) + 0x8000)(%edi), %ax
-movw %ax, %cs:-6(%edi)
-movl%cr0, %ebx
-.byte 0x66
-andl$0x9ffafff3, %ebx
-.byte 0x66
-orl $0x23, %ebx
-movl%ebx, %cr0
-.byte 0x66,0xea
-.space  4
-.space  2
-_StmGdtDesc:   .space 4
-.space 2
-
-Start32bit:
-movw$PROTECT_MODE_DS, %ax
-movl%eax,%ds
-movl%eax,%es
-movl%eax,%fs
-movl%eax,%gs
-movl%eax,%ss
-.byte   0xbc  # mov esp, imm32
-ASM_PFX(gStmSmiStack): .space 4
-movl$ASM_PFX(gStmSmiHandlerIdtr), %eax
-lidt(%eax)
-jmp ProtFlatMode
-
-ProtFlatMode:
-.byte   0xb8   # mov eax, imm32
-ASM_PFX(gStmSmiCr3): .space 4
-movl%eax, %cr3
-#
-# Need to test for CR4 specific bit support
-#
-movl$1, %eax
-cpuid  # use CPUID to determine if 
specific CR4 bits are supported
-xorl%eax, %eax # Clear EAX
-testl   $BIT2, %edx# Check for DE capabilities
-jz  L8
-orl $BIT3, %eax
-L8:
-testl   

[edk2] [PATCH v2 02/10] UefiCpuPkg/BaseUefiCpuLib: Remove .S files for IA32 and X64 arch

2019-03-19 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../Library/BaseUefiCpuLib/BaseUefiCpuLib.inf |  2 -
 .../BaseUefiCpuLib/Ia32/InitializeFpu.S   | 73 ---
 .../BaseUefiCpuLib/X64/InitializeFpu.S| 57 ---
 3 files changed, 132 deletions(-)
 delete mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.S
 delete mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.S

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf 
b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
index 5614452a88..2e9756e50e 100644
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
+++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
@@ -31,11 +31,9 @@
 
 [Sources.IA32]
   Ia32/InitializeFpu.nasm
-  Ia32/InitializeFpu.S
 
 [Sources.X64]
   X64/InitializeFpu.nasm
-  X64/InitializeFpu.S
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.S 
b/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.S
deleted file mode 100644
index 0a1a9198f6..00
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.S
+++ /dev/null
@@ -1,73 +0,0 @@
-#--
-#*
-#*   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
-#*   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.
-#*
-#*
-#--
-
-#
-# Float control word initial value:
-# all exceptions masked, double-precision, round-to-nearest
-#
-ASM_PFX(mFpuControlWord): .word 0x027F
-#
-# Multimedia-extensions control word:
-# all exceptions masked, round-to-nearest, flush to zero for masked underflow
-#
-ASM_PFX(mMmxControlWord): .long 0x01F80
-
-#
-# Initializes floating point units for requirement of UEFI specification.
-#
-# This function initializes floating-point control word to 0x027F (all 
exceptions
-# masked,double-precision, round-to-nearest) and multimedia-extensions control 
word
-# (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to 
zero
-# for masked underflow).
-#
-ASM_GLOBAL ASM_PFX(InitializeFloatingPointUnits)
-ASM_PFX(InitializeFloatingPointUnits):
-
-pushl   %ebx
-
-#
-# Initialize floating point units
-#
-finit
-fldcw   ASM_PFX(mFpuControlWord)
-
-#
-# Use CpuId instructuion (CPUID.01H:EDX.SSE[bit 25] = 1) to test
-# whether the processor supports SSE instruction.
-#
-movl$1,  %eax
-cpuid
-btl $25, %edx
-jnc Done
-
-#
-# Set OSFXSR bit 9 in CR4
-#
-movl%cr4, %eax
-or  $0x200, %eax
-movl%eax, %cr4
-
-#
-# The processor should support SSE instruction and we can use
-# ldmxcsr instruction
-#
-ldmxcsr ASM_PFX(mMmxControlWord)
-
-Done:
-popl%ebx
-
-ret
-
-#END
-
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.S 
b/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.S
deleted file mode 100644
index f0b0d3e264..00
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.S
+++ /dev/null
@@ -1,57 +0,0 @@
-#--
-#*
-#*   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
-#*   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.
-#*
-#*
-#--
-
-#
-# Initializes floating point units for requirement of UEFI specification.
-#
-# This function initializes floating-point control word to 0x037F (all 
exceptions
-# masked,double-extended-precision, round-to-nearest) and 
multimedia-extensions control word
-# (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to 
zero
-# for masked underflow).
-#
-ASM_GLOBAL ASM_PFX(InitializeFloatingPointUnits)
-ASM_PFX(InitializeFloatingPointUnits):
-
-#
-# Initialize floating point units
-#
-

Re: [edk2] [PATCH v3 2/3] SecurityPkg/SecurityPkg.uni: Add the prompt and help information

2019-03-19 Thread Wang, Jian J
Reviewed-by: Jian J Wang 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Shenglei Zhang
> Sent: Wednesday, March 13, 2019 11:24 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH v3 2/3] SecurityPkg/SecurityPkg.uni: Add the prompt and
> help information
> 
> The prompt and help information are missing in SecurityPkg.uni.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1600
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang 
> Reviewed-by: Star Zeng 
> ---
>  SecurityPkg/SecurityPkg.uni | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/SecurityPkg/SecurityPkg.uni b/SecurityPkg/SecurityPkg.uni
> index 400fe6015e..5f387672e8 100644
> --- a/SecurityPkg/SecurityPkg.uni
> +++ b/SecurityPkg/SecurityPkg.uni
> @@ -248,6 +248,12 @@
>  #string STR_gEfiSecurityPkgTokenSpaceGuid_PcdTpm2PossibleIrqNumBuf_HELP
> #language en-US "This PCD defines possible TPM2 interrupt number in a
> platform reported by _PRS control method.\n"
>   
> "If PcdTpm2CurrentIrqNum set
> to 0, _PRS will not report any possible TPM2 interrupt numbers."
> 
> +#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdSkipOpalDxeUnlock_PROMPT
> #language en-US "Skip Opal DXE driver unlock device flow."
> +
> +#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdSkipOpalDxeUnlock_HELP
> #language en-US "Indicates if Opal DXE driver skip unlock device
> flow.\n"
> + 
> "TRUE  - Skip unlock device
> flow.\n"
> + 
> "FALSE - Does not skip unlock
> device flow."
> +
>  #string
> STR_gEfiSecurityPkgTokenSpaceGuid_PcdActiveTpmInterfaceType_PROMPT
> #language en-US "Current active TPM interface type"
> 
>  #string STR_gEfiSecurityPkgTokenSpaceGuid_PcdActiveTpmInterfaceType_HELP
> #language en-US "This PCD indicates current active TPM interface type.\n"
> --
> 2.18.0.windows.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] [MdeModulePkg/Library v1 1/1] MdeModulePkg/UefiBootManangerLib: Fix exception issue

2019-03-19 Thread Wu, Hao A
> -Original Message-
> From: Ming Huang [mailto:ming.hu...@linaro.org]
> Sent: Tuesday, March 19, 2019 12:14 PM
> To: Wu, Hao A; Leif Lindholm
> Cc: linaro-u...@lists.linaro.org; edk2-devel@lists.01.org; Zeng, Star; Dong,
> Eric; Ni, Ray; dann.fraz...@canonical.com; ard.biesheu...@linaro.org; Kinney,
> Michael D; Gao, Liming; wanghuiqi...@huawei.com;
> huangmin...@huawei.com; zhangjinso...@huawei.com;
> huangda...@hisilicon.com; wai...@126.com; Wang, Jian J
> Subject: Re: [MdeModulePkg/Library v1 1/1]
> MdeModulePkg/UefiBootManangerLib: Fix exception issue
> 
> 
> 
> On 3/19/2019 10:25 AM, Wu, Hao A wrote:
> >> -Original Message-
> >> From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> >> Sent: Monday, March 18, 2019 8:43 PM
> >> To: Ming Huang
> >> Cc: linaro-u...@lists.linaro.org; edk2-devel@lists.01.org; Zeng, Star; 
> >> Dong,
> >> Eric; Ni, Ray; dann.fraz...@canonical.com; ard.biesheu...@linaro.org;
> Kinney,
> >> Michael D; Gao, Liming; wanghuiqi...@huawei.com;
> >> huangmin...@huawei.com; zhangjinso...@huawei.com;
> >> huangda...@hisilicon.com; wai...@126.com; Wang, Jian J; Wu, Hao A;
> Ni,
> >> Ray
> >> Subject: Re: [MdeModulePkg/Library v1 1/1]
> >> MdeModulePkg/UefiBootManangerLib: Fix exception issue
> >>
> >> +MdeModulePkg maintainers (you added MdePkg maintainers to cc)
> >>
> >> This looks like an improvement to me.
> >>
> >> Am I correct in guessing this behaviour refers to some specific corner
> >> case of a USB CDROM emulated from a BMC?
> >>
> >> On Mon, Feb 25, 2019 at 05:10:52PM +0800, Ming Huang wrote:
> >>> The system environment: virtual-CDROM(USB interface) via BMC, insert
> a
> >>> iso file to CDROM, like ubuntu-18.04.1-server-arm64.iso, change CDROM
> >>> to first boot option.
> >>> With release version bios, disconnecting CDROM when boot to
> >>> "1 seconds left, Press Esc or F2 to enter Setup"
> >>> then system will get a exception.
> >>>
> >>> The root cause is the EFI_BLOCK_IO_PROTOCOL for UsbMass will be
> >> uninstalled
> >>> in this situation after print some transfer error. The status will be
> >>> invalid parameter. This line will get a exception for BlockIo not point
> >
> > Do you mean 'EFI_INVALID_PARAMETER' is returned from:
> >   Status = gBS->HandleProtocol (Handle, , (VOID
> **) );
> 
> Yes.
> 
> >
> > If so, my guess is that 'Handle' is NULL at this point. An improvement can
> > be adding a previous check for 'Status' after the ASSERT at:
> >
> >   Status = gBS->LocateDevicePath (,
> , );
> >   ASSERT_EFI_ERROR (Status);
> 
> As my debug output, this 'Status' is seccuss and Handle is not NULL, but
> gBS->ConnectController return:Not Found
> 
> Debug output:
> [BmExpandMediaDevicePath]:[1056L] Handle=3E3F3D18 BlockIo=3B2757B6
> Media=AFAF6C617470AFAF Status=Success
> EhcExecTransfer: transfer failed with 40
> EhcBulkTransfer: error - Device Error, transfer - 40
> .
> [UsbOnHubInterrupt]:[632L] SignalEvent (HubIf->HubNotify)
> UsbBotExecCommand: UsbBotSendCommand (Device Error)
> UsbBootExecCmd: Device Error to Exec 0x0 Cmd (Result = 1)
> EhcExecTransfer: transfer failed with 40
> ...
> [USBMassDriverBindingStop]:[1010L] Uninstall USB block io, free:
> 3E44F218(F0)
> [BmExpandMediaDevicePath]:[1064L] Connect Not Found
> [BmExpandMediaDevicePath]:[1076L] Handle=3E3F3D18 BlockIo=3B2757B6
> Media=AFAF6C617470AFAF Status=Invalid Parameter

Thanks for the debug information, I got it now.

The call to the gBS->ConnectController() leads to protocols being
uninstalled from 'Handle' and removing 'Handle' from the database. Then
within the call to gBS->HandleProtocol(), CoreValidateHandle() returns
EFI_INVALID_PARAMETER since the handle cannot be found.

I am good with this patch, please help to address Leif's previous comment
to keep the ASSERT.

Also, I have filed a Bugzilla tracker for this:
https://bugzilla.tianocore.org/show_bug.cgi?id=1631

Could you help to add the reference to the above BZ in the commit log
message? Thanks.


Best Regards,
Hao Wu

> 
> Thanks
> 
> >
> > And leave:
> >
> >   Status = gBS->HandleProtocol (Handle, , (VOID
> **) );
> >   ASSERT_EFI_ERROR (Status);
> >
> > unchanged.
> 
> 
> 
> >
> > Best Regards,
> > Hao Wu
> >
> >>> to right address:
> >>> AllocatePool (BlockIo->Media->BlockSize)
> >>> So, here need to judge the status not using ASSERT_EFI_ERROR.
> >>>
> >>> Contributed-under: TianoCore Contribution Agreement 1.1
> >>> Signed-off-by: Ming Huang 
> >>> ---
> >>>  MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 4 +++-
> >>>  1 file changed, 3 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> >> b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> >>> index d5957db610d9..c2f1c651b02f 100644
> >>> --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> >>> +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
> >>> @@ -1068,7 +1068,9 @@ BmExpandMediaDevicePath (
> >>>// Block IO read/write will success.
> >>>//
> >>>Status =