Re: [edk2] [PATCH v2 0/3] Improve performance of boundary validation in MakeTable()

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

>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>shenglei
>Sent: Thursday, March 21, 2019 2:32 PM
>To: edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Gao, Liming
>
>Subject: [edk2] [PATCH v2 0/3] Improve performance of boundary validation
>in MakeTable()
>
>The boundary validation checking in MakeTable() performs on
>every loop iteration. This could be improved by checking
>just once before the loop.
>https://bugzilla.tianocore.org/show_bug.cgi?id=1329
>
>v2:1.Change the the algorithm implementation of the judgement in all
>patches.
>   2.Remove previous 3/4 in v1.
>
>Cc: Bob Feng 
>Cc: Liming Gao 
>Cc: Yonghong Zhu 
>Cc: Michael D Kinney 
>Shenglei Zhang (3):
>  BaseTools/TianoCompress: Improve performance of boundary validation
>  BaseTools/C/Common: Improve performance of boundary validation
>  MdePkg/BaseUefiDecompressLib: Improve performance of boundary
>validation
>
> BaseTools/Source/C/Common/Decompress.c | 7 ---
> BaseTools/Source/C/TianoCompress/TianoCompress.c   | 7 ---
> .../Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c  | 7 ---
> 3 files changed, 12 insertions(+), 9 deletions(-)
>
>--
>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] [PATCH 2/3] Maintainers.txt: Remove EdkCompatibilityPkg information

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

>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>Shenglei Zhang
>Sent: Friday, March 22, 2019 10:35 AM
>To: edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Laszlo Ersek
>
>Subject: [edk2] [PATCH 2/3] Maintainers.txt: Remove EdkCompatibilityPkg
>information
>
>EdkCompatibilityPkg will be deleted from edk2/master.
>So update the maintainer information of EdkCompatibilityPkg.
>https://bugzilla.tianocore.org/show_bug.cgi?id=1103
>
>Cc: Andrew Fish 
>Cc: Laszlo Ersek 
>Cc: Leif Lindholm 
>Cc: Michael D Kinney 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Shenglei Zhang 
>---
> Maintainers.txt | 4 
> 1 file changed, 4 deletions(-)
>
>diff --git a/Maintainers.txt b/Maintainers.txt
>index be77898ee2..e090df7c17 100644
>--- a/Maintainers.txt
>+++ b/Maintainers.txt
>@@ -115,10 +115,6 @@ W:
>https://github.com/tianocore/tianocore.github.io/wiki/DynamicTablesPkg
> M: Sami Mujawar 
> M: Alexei Fedorov 
>
>-EdkCompatibilityPkg
>-W:
>https://github.com/tianocore/tianocore.github.io/wiki/EdkCompatibilityPkg
>-M: Liming Gao 
>-
> EmbeddedPkg
> W: https://github.com/tianocore/tianocore.github.io/wiki/EmbeddedPkg
> M: Leif Lindholm 
>--
>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] [PATCH 3/3] EdkCompatibilityPkg: Remove EdkCompatibilityPkg

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

>-Original Message-
>From: Zhang, Shenglei
>Sent: Friday, March 22, 2019 10:35 AM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming 
>Subject: [PATCH 3/3] EdkCompatibilityPkg: Remove EdkCompatibilityPkg
>
>If this patch contains all changes of removing EdkCompatibilityPkg, it will
>be too big to send. So this patch only contains one operation, deleting
>EdkCompatibilityPkg.
>https://bugzilla.tianocore.org/show_bug.cgi?id=1103
>
>Cc: Liming Gao 
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Shenglei Zhang 
___
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-21 Thread Meenakshi Aggarwal
Hi Supreeth,

I am able to compile SctPkg with your suggested changes.

Yes, we are trying eith UDK2017 as this is what mentioned in How To Build".

I tried with edk2's master branch today and faced following error:


build.py...
/home/meenakshi/SCT/edk2/SctPkg/Library/SctGuidLib/SctGuidLib.inf(...): error 
5000: MODULE_TYPE is not given


Thanks,
Meenakshi

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

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 
mailto:meenakshi.aggar...@nxp.com>>
Sent: Tuesday, March 19, 2019 12:19 AM
To: Supreeth Venkatesh 
mailto:supreeth.venkat...@arm.com>>; 
edk2-devel@lists.01.org
Cc: Dong Wei mailto:dong@arm.com>>; Jin, Eric 
mailto:eric@intel.com>>; Udit Kumar 
mailto:udit.ku...@nxp.com>>; Varun Sethi 
mailto:v.se...@nxp.com>>
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

Re: [edk2] [PATCH edk2-platforms v3 13/18] Hisilicon/D06: Add Setup Item "Support DPC" and delete some PCIe menus

2019-03-21 Thread Ming Huang



On 3/21/2019 8:32 PM, Leif Lindholm wrote:
> Hi Ming,
> 
> On Wed, Mar 20, 2019 at 04:08:24PM +0800, Ming Huang wrote:
>> Add setup item "Support DPC" to enable or disable PCIe DPC
>> (Downstream Port Containment).
>>
>> The pcie menu is suppressed for original code as these menus
>> are not ready. This patch remove the suppression for pcie menu,
>> so delete these menus for now.
> 
> As the commit message shows, this patch does two unrelated things.
> Could you break this patch up into two separate ones and resubmit just
> those?

I will break this patch up into two seperate ones soon.

Thanks

> 
> I will cherry-pick this patch manually in order to have it included in
> RPF 2019.03 -rc1, but I would prefer what goes in upstream to be
> cleaner.
> 
> Best Regards,
> 
> Leif
> 
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Ming Huang 
>> ---
>>  Silicon/Hisilicon/Include/Library/OemConfigData.h   |   1 +
>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr  |   2 -
>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c   |   4 +
>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr| 197 
>> +---
>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfigStrings.uni |   3 +-
>>  5 files changed, 10 insertions(+), 197 deletions(-)
>>
>> diff --git a/Silicon/Hisilicon/Include/Library/OemConfigData.h 
>> b/Silicon/Hisilicon/Include/Library/OemConfigData.h
>> index f120e3123c83..c0097d0829f0 100644
>> --- a/Silicon/Hisilicon/Include/Library/OemConfigData.h
>> +++ b/Silicon/Hisilicon/Include/Library/OemConfigData.h
>> @@ -49,6 +49,7 @@ typedef struct {
>>UINT8 OSWdtAction;
>>/*PCIe Config*/
>>UINT8 PcieSRIOVSupport;
>> +  UINT8 PcieDPCSupport;
>>UINT8 PciePort[PCIE_MAX_TOTAL_PORTS];
>>UINT8 PcieLinkSpeedPort[PCIE_MAX_TOTAL_PORTS];
>>UINT8 PcieLinkDeEmphasisPort[PCIE_MAX_TOTAL_PORTS];
>> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr 
>> b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
>> index 08236704fbfe..93ccb99bdc67 100644
>> --- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
>> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
>> @@ -62,11 +62,9 @@ formset
>>prompt = STRING_TOKEN(STR_IBMC_CONFIG_FORM_TITLE),
>>help   = STRING_TOKEN(STR_IBMC_CONFIG_FORM_HELP);
>>  
>> -suppressif TRUE;
>>  goto PCIE_CONFIG_FORM_ID,
>>prompt  = STRING_TOKEN(STR_PCIE_CONFIG_FORM_TITLE),
>>help= STRING_TOKEN(STR_PCIE_CONFIG_FORM_HELP);
>> -endif;
>>  
>>  goto MISC_CONFIG_FORM_ID,
>>prompt  = STRING_TOKEN(STR_MISC_CONFIG_FORM_TITLE),
>> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c 
>> b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
>> index 6668103af027..be4ce8820f73 100644
>> --- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
>> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
>> @@ -290,6 +290,10 @@ OemConfigUiLibConstructor (
>>Configuration.OSWdtTimeout = 5;
>>Configuration.OSWdtAction = 1;
>>//
>> +  //Set the default value of the PCIe option
>> +  //
>> +  Configuration.PcieDPCSupport = 0;
>> +  //
>>//Set the default value of the Misc option
>>//
>>Configuration.EnableSmmu = 1;
>> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr 
>> b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr
>> index 7cf7cdd29ba2..c65907fe846e 100644
>> --- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr
>> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr
>> @@ -17,203 +17,12 @@
>>  form formid = PCIE_CONFIG_FORM_ID,
>>title   = STRING_TOKEN (STR_PCIE_CONFIG_FORM_TITLE);
>>  
>> -  goto VFR_FORMID_PCIE_SOCKET0,
>> -prompt  = STRING_TOKEN (STR_PCIE_CPU_0_PROMPT),
>> -help= STRING_TOKEN (STR_PCIE_CPU_PROMPT_HELP);
>> -
>> -  goto VFR_FORMID_PCIE_SOCKET1,
>> -prompt  = STRING_TOKEN (STR_PCIE_CPU_1_PROMPT),
>> -help= STRING_TOKEN (STR_PCIE_CPU_PROMPT_HELP);
>> -
>> -  oneof varid  = OEM_CONFIG_DATA.PcieSRIOVSupport,
>> -prompt   = STRING_TOKEN (STR_SRIOV_SUPPORT_PROMPT),
>> -help = STRING_TOKEN (STR_SRIOV_SUPPORT_HELP),
>> +  oneof varid  = OEM_CONFIG_DATA.PcieDPCSupport,
>> +prompt   = STRING_TOKEN (STR_DPC_SUPPORT_PROMPT),
>> +help = STRING_TOKEN (STR_DPC_SUPPORT_HELP),
>>  option text = STRING_TOKEN (STR_DISABLE), value = 0, flags = 
>> MANUFACTURING | DEFAULT | RESET_REQUIRED;
>>  option text = STRING_TOKEN (STR_ENABLE),  value = 1, flags = 
>> RESET_REQUIRED;
>>endoneof;
>>  
>>  endform;
>>  
>> -form formid = VFR_FORMID_PCIE_SOCKET0,
>> -  title = STRING_TOKEN(STR_PCIE_CPU_0_PROMPT);
>> -
>> -  goto VFR_FORMID_PCIE_PORT2,
>> -prom

Re: [edk2] [PATCH edk2-platforms v3 05/18] Hisilicon/D06: Fix access variable fail issue

2019-03-21 Thread Ming Huang



On 3/22/2019 1:56 AM, Leif Lindholm wrote:
> Urgh, this was an unfortunate off-by-one post:
> I am deferring this patch until after Linaro's 2019.03 firmware
> release and cherry-picking it into that. There must be a better way to
> solve this.
> 
> My comment referred to "Hisilicon/D06: Drop the leading 0 (0x0 ->
> 0x)", which will be pushed with an improved subject.

I will change subject to:
Add runtime attribution to OemConfig variable
Should I change author to me to remove the "From: Jason Zhang"?

Thanks

> 
> /
> Leif
> 
> On Thu, Mar 21, 2019 at 05:52:18PM +, Leif Lindholm wrote:
>> I will update the subject line to reflect what is actually being
>> changed.
>>
>> Other than that,
>> Reviewed-by: Leif Lindholm 
>>
>>
>> On Wed, Mar 20, 2019 at 04:08:16PM +0800, Ming Huang wrote:
>>> From: Jason Zhang 
>>>
>>> BmcWdtEnable is a field of OemConfigData structure, need have
>>> runtime service attribution if use it during exit boot service
>>>
>>> Contributed-under: TianoCore Contribution Agreement 1.1
>>> Signed-off-by: Ming Huang 
>>> ---
>>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr | 2 +-
>>>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c  | 2 +-
>>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr 
>>> b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
>>> index 470e9ace3dcf..08236704fbfe 100644
>>> --- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
>>> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
>>> @@ -23,7 +23,7 @@ formset
>>>help  = STRING_TOKEN(STR_OEM_CONFIG),
>>>classguid = gEfiIfrFrontPageGuid,  // for MdeModule Bds.
>>>efivarstore OEM_CONFIG_DATA,
>>> -attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | 
>>> EFI_VARIABLE_NON_VOLATILE,
>>> +attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | 
>>> EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS,
>>>  name  = OemConfig,
>>>  guid  = gOemConfigGuid;
>>>  
>>> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c 
>>> b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
>>> index 012d45bc0214..6668103af027 100644
>>> --- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
>>> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
>>> @@ -316,7 +316,7 @@ OemConfigUiLibConstructor (
>>>Status = gRT->SetVariable (
>>>OEM_CONFIG_NAME,
>>>&gOemConfigGuid,
>>> -  EFI_VARIABLE_NON_VOLATILE | 
>>> EFI_VARIABLE_BOOTSERVICE_ACCESS,
>>> +  EFI_VARIABLE_NON_VOLATILE | 
>>> EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
>>>sizeof (OEM_CONFIG_DATA),
>>>&Configuration
>>>);
>>> -- 
>>> 2.9.5
>>>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH V2 1/2] MdeModulePkg/CapsuleRuntimeDxe: IA32 add cache flush function

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

The IA32 ARCH need cache flush function during capsule update.
Both arm ARCH and IA32 do not need flush cache function, so
merge the CapsuleCacheWriteBack() to one file. And add a null
version for EBC.

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: Ard Biesheuvel 
---
 .../Universal/CapsuleRuntimeDxe/Arm/CapsuleReset.c | 35 +---
 .../Universal/CapsuleRuntimeDxe/CapsuleCache.c | 63 ++
 .../Universal/CapsuleRuntimeDxe/CapsuleCacheNull.c | 38 +
 .../Universal/CapsuleRuntimeDxe/CapsuleReset.c | 16 +-
 .../CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf| 20 ---
 5 files changed, 115 insertions(+), 57 deletions(-)
 create mode 100644 MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleCache.c
 create mode 100644 MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleCacheNull.c

diff --git a/MdeModulePkg/Universal/CapsuleRuntimeDxe/Arm/CapsuleReset.c 
b/MdeModulePkg/Universal/CapsuleRuntimeDxe/Arm/CapsuleReset.c
index d79d2fc693..ec630ab7a8 100644
--- a/MdeModulePkg/Universal/CapsuleRuntimeDxe/Arm/CapsuleReset.c
+++ b/MdeModulePkg/Universal/CapsuleRuntimeDxe/Arm/CapsuleReset.c
@@ -3,6 +3,7 @@
   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
@@ -16,8 +17,6 @@
 
 #include "CapsuleService.h"
 
-#include 
-
 /**
   Whether the platform supports capsules that persist across reset. Note that
   some platforms only support such capsules at boot time.
@@ -41,35 +40,3 @@ IsPersistAcrossResetCapsuleSupported (
   return FeaturePcdGet (PcdSupportUpdateCapsuleReset) && !EfiAtRuntime ();
 }
 
-/**
-  Writes Back a range of data cache lines covering a set of capsules in memory.
-
-  Writes Back the data cache lines specified by ScatterGatherList.
-
-  @param  ScatterGatherList Physical address of the data structure that
-describes a set of capsules in memory
-
-**/
-VOID
-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/CapsuleCache.c 
b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleCache.c
new file mode 100644
index 00..ab81296a65
--- /dev/null
+++ b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleCache.c
@@ -0,0 +1,63 @@
+/** @file
+  Flush the cache is required for most architectures while do capsule
+  update. It is not support at Runtime.
+
+  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
+  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 "CapsuleService.h"
+
+#include 
+
+/**
+  Writes Back a range of data cache lines covering a set of capsules in memory.
+
+  Writes Back the data cache lines specified by ScatterGatherList.
+
+  @param  ScatterGatherList Physical address of the data structure that
+describes a set of capsules in memory
+
+**/
+VOID
+CapsuleCacheWriteBack (
+  IN  EFI_PHYSICAL_ADDRESSScatterGatherList
+  )
+{
+  EFI_CAPSULE_BLOCK_DESCRIPTOR*Desc;
+
+  if (!EfiAtRuntime ()) {
+Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR *)(UINTN)ScatterGatherList;
+do {
+  WriteBackDataCacheRange (
+(VOID *)(UINTN)Desc,
+(UINTN)sizeof (*Desc)
+);
+
+  if (Desc->Length > 0) {
+WriteBackDataCacheRange (
+  (VOID *)(UINTN)Desc->Union.DataBlock,
+  (UINTN)Desc->Length
+  );
+Desc++;
+  } else if (Desc->Union.ContinuationPointer > 0) {
+Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR 
*)(UINTN)Desc->Union.ContinuationPointer;
+  }
+} whil

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

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

V2:
Adjust the code that would not change the logic of arm ARCH.
Fix some build errors because of type convertion.

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: Ard Biesheuvel 

Zhichao Gao (2):
  MdeModulePkg/CapsuleRuntimeDxe: IA32 add cache flush function
  MdeModulePkg/ResetSystemRuntimeDxe: Remove DoS3 in warm reset

 .../Universal/CapsuleRuntimeDxe/Arm/CapsuleReset.c | 35 +---
 .../Universal/CapsuleRuntimeDxe/CapsuleCache.c | 63 ++
 .../Universal/CapsuleRuntimeDxe/CapsuleCacheNull.c | 38 +
 .../Universal/CapsuleRuntimeDxe/CapsuleReset.c | 16 +-
 .../CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf| 20 ---
 .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 38 -
 6 files changed, 115 insertions(+), 95 deletions(-)
 create mode 100644 MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleCache.c
 create mode 100644 MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleCacheNull.c

-- 
2.16.2.windows.1

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


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

2019-03-21 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,
- &gEfiCapsuleVendorGuid,
- NULL,
- &Size,
- (VOID *) &CapsuleDataPtr
- );
-
-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


Re: [edk2] [PATCH 1/3] Nt32Pkg/Nt32Pkg.dsc: Remove EdkCompatibilityPkg information

2019-03-21 Thread Wu, Hao A
Reviewed-by: Hao Wu 

Best Regards,
Hao Wu


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Shenglei Zhang
> Sent: Friday, March 22, 2019 10:35 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A
> Subject: [edk2] [PATCH 1/3] Nt32Pkg/Nt32Pkg.dsc: Remove
> EdkCompatibilityPkg information
> 
> EdkCompatibilityPkg will be removed from edk2/master.
> The dependency about EdkCompatibilityPkg in Nt32Pkg.dsc should
> also be removed.
> 
> Cc: Ray Ni 
> Cc: Hao Wu 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang 
> ---
>  Nt32Pkg/Nt32Pkg.dsc | 51 -
>  1 file changed, 51 deletions(-)
> 
> diff --git a/Nt32Pkg/Nt32Pkg.dsc b/Nt32Pkg/Nt32Pkg.dsc
> index 4dbde0cc45..d7b78007d2 100644
> --- a/Nt32Pkg/Nt32Pkg.dsc
> +++ b/Nt32Pkg/Nt32Pkg.dsc
> @@ -545,54 +545,3 @@
>NOOPT_*_*_DLINK_FLAGS =
> /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x1 /ALIGN:4096
> /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
>RELEASE_*_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096
> 
> -
> 
> #
> -# NOTE:
> -# The following [Libraries] section is for building EDK module under the 
> EDKII
> tool chain.
> -# If you want build EDK module for Nt32 platform, please uncomment
> [Libraries] section and
> -# libraries used by that EDK module.
> -# Currently, Nt32 platform do not has any EDK style module
> -#
> -#
> -#[Libraries]
> -  #
> -  # Libraries common to PEI and DXE
> -  #
> -  #  EdkCompatibilityPkg/Foundation/Efi/Guid/EfiGuidLib.inf
> -  #
> EdkCompatibilityPkg/Foundation/Framework/Guid/EdkFrameworkGuidLib.inf
> -  #  EdkCompatibilityPkg/Foundation/Guid/EdkGuidLib.inf
> -  #  EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/EfiCommonLib.inf
> -  #  EdkCompatibilityPkg/Foundation/Cpu/Pentium/CpuIA32Lib/CpuIA32Lib.inf
> -  #  EdkCompatibilityPkg/Foundation/Cpu/Itanium/CpuIa64Lib/CpuIA64Lib.inf
> -  #
> EdkCompatibilityPkg/Foundation/Library/CustomizedDecompress/CustomizedD
> ecompress.inf
> -  #
> EdkCompatibilityPkg/Foundation/Library/CompilerStub/CompilerStubLib.inf
> -  #  EdkCompatibilityPkg/Foundation/Library/Dxe/Hob/HobLib.inf
> -
> -  #
> -  # PEI libraries
> -  #
> -  #  EdkCompatibilityPkg/Foundation/Framework/Ppi/EdkFrameworkPpiLib.inf
> -  #  EdkCompatibilityPkg/Foundation/Ppi/EdkPpiLib.inf
> -  #  EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/PeiLib.inf
> -  #  EdkCompatibilityPkg/Foundation/Library/Pei/Hob/PeiHobLib.inf
> -
> -  #
> -  # DXE libraries
> -  #
> -  #
> EdkCompatibilityPkg/Foundation/Core/Dxe/ArchProtocol/ArchProtocolLib.inf
> -  #  EdkCompatibilityPkg/Foundation/Efi/Protocol/EfiProtocolLib.inf
> -  #
> EdkCompatibilityPkg/Foundation/Framework/Protocol/EdkFrameworkProtocolLi
> b.inf
> -  #  EdkCompatibilityPkg/Foundation/Protocol/EdkProtocolLib.inf
> -  #  EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/EfiDriverLib.inf
> -  #
> EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/EfiRuntim
> eLib.inf
> -  #  EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Graphics.inf
> -  #
> EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/EfiIfrSupportLib.i
> nf
> -  #  EdkCompatibilityPkg/Foundation/Library/Dxe/Print/PrintLib.inf
> -  #  EdkCompatibilityPkg/Foundation/Library/Dxe/EfiScriptLib/EfiScriptLib.inf
> -  #  EdkCompatibilityPkg/Foundation/Library/Dxe/EfiUiLib/EfiUiLib.inf
> -
> -  #
> -  # Print/Graphics Library consume SetupBrowser Print Protocol
> -  #
> -  #  EdkCompatibilityPkg/Foundation/Library/Dxe/PrintLite/PrintLib.inf
> -  #  EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Graphics.inf
> -
> --
> 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


[edk2] [PATCH 1/3] Nt32Pkg/Nt32Pkg.dsc: Remove EdkCompatibilityPkg information

2019-03-21 Thread Shenglei Zhang
EdkCompatibilityPkg will be removed from edk2/master.
The dependency about EdkCompatibilityPkg in Nt32Pkg.dsc should
also be removed.

Cc: Ray Ni 
Cc: Hao Wu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 Nt32Pkg/Nt32Pkg.dsc | 51 -
 1 file changed, 51 deletions(-)

diff --git a/Nt32Pkg/Nt32Pkg.dsc b/Nt32Pkg/Nt32Pkg.dsc
index 4dbde0cc45..d7b78007d2 100644
--- a/Nt32Pkg/Nt32Pkg.dsc
+++ b/Nt32Pkg/Nt32Pkg.dsc
@@ -545,54 +545,3 @@
   NOOPT_*_*_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) 
/BASE:0x1 /ALIGN:4096 /FILEALIGN:4096 /SUBSYSTEM:CONSOLE
   RELEASE_*_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096
 
-#
-# NOTE:
-# The following [Libraries] section is for building EDK module under the EDKII 
tool chain.
-# If you want build EDK module for Nt32 platform, please uncomment [Libraries] 
section and
-# libraries used by that EDK module.
-# Currently, Nt32 platform do not has any EDK style module
-#
-#
-#[Libraries]
-  #
-  # Libraries common to PEI and DXE
-  #
-  #  EdkCompatibilityPkg/Foundation/Efi/Guid/EfiGuidLib.inf
-  #  EdkCompatibilityPkg/Foundation/Framework/Guid/EdkFrameworkGuidLib.inf
-  #  EdkCompatibilityPkg/Foundation/Guid/EdkGuidLib.inf
-  #  EdkCompatibilityPkg/Foundation/Library/EfiCommonLib/EfiCommonLib.inf
-  #  EdkCompatibilityPkg/Foundation/Cpu/Pentium/CpuIA32Lib/CpuIA32Lib.inf
-  #  EdkCompatibilityPkg/Foundation/Cpu/Itanium/CpuIa64Lib/CpuIA64Lib.inf
-  #  
EdkCompatibilityPkg/Foundation/Library/CustomizedDecompress/CustomizedDecompress.inf
-  #  EdkCompatibilityPkg/Foundation/Library/CompilerStub/CompilerStubLib.inf
-  #  EdkCompatibilityPkg/Foundation/Library/Dxe/Hob/HobLib.inf
-
-  #
-  # PEI libraries
-  #
-  #  EdkCompatibilityPkg/Foundation/Framework/Ppi/EdkFrameworkPpiLib.inf
-  #  EdkCompatibilityPkg/Foundation/Ppi/EdkPpiLib.inf
-  #  EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/PeiLib.inf
-  #  EdkCompatibilityPkg/Foundation/Library/Pei/Hob/PeiHobLib.inf
-
-  #
-  # DXE libraries
-  #
-  #  EdkCompatibilityPkg/Foundation/Core/Dxe/ArchProtocol/ArchProtocolLib.inf
-  #  EdkCompatibilityPkg/Foundation/Efi/Protocol/EfiProtocolLib.inf
-  #  
EdkCompatibilityPkg/Foundation/Framework/Protocol/EdkFrameworkProtocolLib.inf
-  #  EdkCompatibilityPkg/Foundation/Protocol/EdkProtocolLib.inf
-  #  EdkCompatibilityPkg/Foundation/Library/Dxe/EfiDriverLib/EfiDriverLib.inf
-  #  
EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/EfiRuntimeLib.inf
-  #  EdkCompatibilityPkg/Foundation/Library/Dxe/Graphics/Graphics.inf
-  #  
EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/EfiIfrSupportLib.inf
-  #  EdkCompatibilityPkg/Foundation/Library/Dxe/Print/PrintLib.inf
-  #  EdkCompatibilityPkg/Foundation/Library/Dxe/EfiScriptLib/EfiScriptLib.inf
-  #  EdkCompatibilityPkg/Foundation/Library/Dxe/EfiUiLib/EfiUiLib.inf
-
-  #
-  # Print/Graphics Library consume SetupBrowser Print Protocol
-  #
-  #  EdkCompatibilityPkg/Foundation/Library/Dxe/PrintLite/PrintLib.inf
-  #  EdkCompatibilityPkg/Foundation/Library/Dxe/GraphicsLite/Graphics.inf
-
-- 
2.18.0.windows.1

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


[edk2] [PATCH 3/3] EdkCompatibilityPkg: Remove EdkCompatibilityPkg

2019-03-21 Thread Shenglei Zhang
If this patch contains all changes of removing EdkCompatibilityPkg, it will
be too big to send. So this patch only contains one operation, deleting
EdkCompatibilityPkg.
https://bugzilla.tianocore.org/show_bug.cgi?id=1103

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 2/3] Maintainers.txt: Remove EdkCompatibilityPkg information

2019-03-21 Thread Shenglei Zhang
EdkCompatibilityPkg will be deleted from edk2/master.
So update the maintainer information of EdkCompatibilityPkg.
https://bugzilla.tianocore.org/show_bug.cgi?id=1103

Cc: Andrew Fish 
Cc: Laszlo Ersek 
Cc: Leif Lindholm 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 Maintainers.txt | 4 
 1 file changed, 4 deletions(-)

diff --git a/Maintainers.txt b/Maintainers.txt
index be77898ee2..e090df7c17 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -115,10 +115,6 @@ W: 
https://github.com/tianocore/tianocore.github.io/wiki/DynamicTablesPkg
 M: Sami Mujawar 
 M: Alexei Fedorov 
 
-EdkCompatibilityPkg
-W: https://github.com/tianocore/tianocore.github.io/wiki/EdkCompatibilityPkg
-M: Liming Gao 
-
 EmbeddedPkg
 W: https://github.com/tianocore/tianocore.github.io/wiki/EmbeddedPkg
 M: Leif Lindholm 
-- 
2.18.0.windows.1

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


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

2019-03-21 Thread Wu, Hao A
If it follows the EDK II C Coding Standards Specification, then ignore
my relating comments then,

Best Regards,
Hao Wu

> -Original Message-
> From: Gao, Zhichao
> Sent: Friday, March 22, 2019 10:19 AM
> To: Wu, Hao A; edk2-devel@lists.01.org
> Cc: Gao, Liming; Wang, Jian J; Ni, Ray; Zeng, Star; Sean Brogan; Michael 
> Turner;
> Bret Barkelew
> Subject: RE: [PATCH V4 16/17] MdeModulePkg/PeiDebugLibDebugPpi: Add PEI
> debug lib
> 
> For the sections you point. It seems good to watch the patch downloaded.
> The indention is one or two space behind the function name depend on tab
> expand(2 space).
> Is it need to adjust them?
> 
> Thanks,
> Zhichao
> 
> > -Original Message-
> > From: Wu, Hao A
> > Sent: Friday, March 22, 2019 10:09 AM
> > To: Gao, Zhichao ; edk2-devel@lists.01.org
> > Cc: Gao, Liming ; Wang, Jian J
> > ; Ni, Ray ; Zeng, Star
> > ; Sean Brogan ;
> > Michael Turner ; Bret Barkelew
> > 
> > Subject: RE: [PATCH V4 16/17] MdeModulePkg/PeiDebugLibDebugPpi: Add
> > PEI debug lib
> >
> > > -Original Message-
> > > From: Gao, Zhichao
> > > Sent: Thursday, March 21, 2019 10:05 PM
> > > To: edk2-devel@lists.01.org
> > > Cc: Gao, Liming; Wang, Jian J; Wu, Hao A; Ni, Ray; Zeng, Star; Sean
> > > Brogan; Michael Turner; Bret Barkelew
> > > Subject: [PATCH V4 16/17] MdeModulePkg/PeiDebugLibDebugPpi: Add PEI
> > > debug lib
> > >
> > > 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 | 456
> > > +
> > >  .../PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf|  55 +++
> > >  2 files changed, 511 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..75859163ae
> > > --- /dev/null
> > > +++ b/MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c
> > > @@ -0,0 +1,456 @@
> > > +/** @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 
> > > +
> > > +EDKII_DEBUG_PPI *mDebugPpi = 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  ...   Variable argument list whose contents are 
> > > accessed
> > > +based on the format string specified by Format.
> > > +
> > > +**/
> > > +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

[edk2] [PATCH 0/2] FmpDevicePkg/FmpDxe: Change the default Image Type ID

2019-03-21 Thread Zhichao Gao
Add a pcd to provide a default image type ID for FmpDxe
driver instead of gEfiCallerIdGuid. If the pcd is not
initialized as a GUID type, then it will assert and
fall back to gEfiCallerIdGuid in function GetImageTypeIdGuid.

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

Zhichao Gao (2):
  FmpDevicePkg/FmpDevucePkg.dec: Add a pcd
  FmpDevicePkg/FmpDxe: Change the default Image Type ID

 FmpDevicePkg/FmpDevicePkg.dec |  8 +++-
 FmpDevicePkg/FmpDxe/FmpDxe.c  | 26 ++
 FmpDevicePkg/FmpDxe/FmpDxe.inf|  3 ++-
 FmpDevicePkg/FmpDxe/FmpDxeLib.inf |  3 ++-
 4 files changed, 29 insertions(+), 11 deletions(-)

-- 
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] FmpDevicePkg/FmpDxe: Change the default Image Type ID

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

Change the default Image Type id from gEfiCallerIdGuid to
PcdFmpDeviceImageDefaultTypeIdGuid. If the pcd is not
initialized as a valid GUID value, the driver will ASSERT
and fall back to gEfiCallerIdGuid.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Liming Gao 
Cc: Michael D Kinney 
---
 FmpDevicePkg/FmpDxe/FmpDxe.c  | 26 ++
 FmpDevicePkg/FmpDxe/FmpDxe.inf|  3 ++-
 FmpDevicePkg/FmpDxe/FmpDxeLib.inf |  3 ++-
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c
index 57eac5ac14..5dee59e378 100644
--- a/FmpDevicePkg/FmpDxe/FmpDxe.c
+++ b/FmpDevicePkg/FmpDxe/FmpDxe.c
@@ -4,7 +4,7 @@
   information provided through PCDs and libraries.
 
   Copyright (c) 2016, Microsoft Corporation. All rights reserved.
-  Copyright (c) 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
 
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions are met:
@@ -152,7 +152,10 @@ FmpDxeProgress (
 /**
   Returns a pointer to the ImageTypeId GUID value.  An attempt is made to get
   the GUID value from the FmpDeviceLib. If the FmpDeviceLib does not provide
-  a GUID value, then gEfiCallerIdGuid is returned.
+  a GUID value, then PcdFmpDeviceImageDefaultTypeIdGuid is returned.
+
+  If the PcdFmpDeviceImageDefaultTypeIdGuid is not initialize as a EFI_GUID,
+  then ASSERT().
 
   @return  The ImageTypeId GUID
 
@@ -167,16 +170,23 @@ GetImageTypeIdGuid (
 
   FmpDeviceLibGuid = NULL;
   Status = FmpDeviceGetImageTypeIdGuidPtr (&FmpDeviceLibGuid);
-  if (EFI_ERROR (Status)) {
+
+  if (EFI_ERROR(Status) || FmpDeviceLibGuid == NULL) {
 if (Status != EFI_UNSUPPORTED) {
   DEBUG ((DEBUG_ERROR, "FmpDxe: FmpDeviceLib GetImageTypeIdGuidPtr() 
returned invalid error %r\n", Status));
 }
-return &gEfiCallerIdGuid;
-  }
-  if (FmpDeviceLibGuid == NULL) {
-DEBUG ((DEBUG_ERROR, "FmpDxe: FmpDeviceLib GetImageTypeIdGuidPtr() 
returned invalid GUID\n"));
-return &gEfiCallerIdGuid;
+if (FmpDeviceLibGuid == NULL) {
+  DEBUG ((DEBUG_ERROR, "FmpDxe: FmpDeviceLib GetImageTypeIdGuidPtr() 
returned invalid GUID\n"));
+}
+if (PcdGetSize (PcdFmpDeviceImageDefaultTypeIdGuid) == sizeof (EFI_GUID)) {
+  FmpDeviceLibGuid = (EFI_GUID *)PcdGetPtr 
(PcdFmpDeviceImageDefaultTypeIdGuid);
+} else {
+  DEBUG ((DEBUG_ERROR, "FmpDxe %s: FmpDeviceLib did not return a GUID and 
PcdFmpDeviceImageDefaultTypeIdGuid is undefined\n", mImageIdName));
+  ASSERT (FALSE);
+  FmpDeviceLibGuid = &gEfiCallerIdGuid;
+}
   }
+
   return FmpDeviceLibGuid;
 }
 
diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.inf b/FmpDevicePkg/FmpDxe/FmpDxe.inf
index 228e53658a..52807ca2cb 100644
--- a/FmpDevicePkg/FmpDxe/FmpDxe.inf
+++ b/FmpDevicePkg/FmpDxe/FmpDxe.inf
@@ -4,7 +4,7 @@
 #  information provided through PCDs and libraries.
 #
 #  Copyright (c) 2016, Microsoft Corporation. All rights reserved.
-#  Copyright (c) 2018, Intel Corporation. All rights reserved.
+#  Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
 #
 #  Redistribution and use in source and binary forms, with or without
 #  modification, are permitted provided that the following conditions are met:
@@ -84,6 +84,7 @@
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr   ## 
CONSUMES
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceTestKeySha256Digest  ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed## 
SOMETIMES_PRODUCES
+  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageDefaultTypeIdGuid   ## 
SOMETIMES_CONSUMES
 
 [Depex]
   gEfiVariableWriteArchProtocolGuid AND gEdkiiVariableLockProtocolGuid
diff --git a/FmpDevicePkg/FmpDxe/FmpDxeLib.inf 
b/FmpDevicePkg/FmpDxe/FmpDxeLib.inf
index 5484531155..57189a77d1 100644
--- a/FmpDevicePkg/FmpDxe/FmpDxeLib.inf
+++ b/FmpDevicePkg/FmpDxe/FmpDxeLib.inf
@@ -4,7 +4,7 @@
 #  information provided through PCDs and libraries.
 #
 #  Copyright (c) 2016, Microsoft Corporation. All rights reserved.
-#  Copyright (c) 2018, Intel Corporation. All rights reserved.
+#  Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
 #
 #  Redistribution and use in source and binary forms, with or without
 #  modification, are permitted provided that the following conditions are met:
@@ -84,6 +84,7 @@
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr   ## 
CONSUMES
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceTestKeySha256Digest  ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed## 
SOMETIMES_PRODUCES
+  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageDefaultTypeIdGuid   ## 
SOMETIMES_CONSUMES
 
 [Depex]
   gEfiVariableWriteArchProtocolGuid A

[edk2] [PATCH 1/2] FmpDevicePkg/FmpDevucePkg.dec: Add a pcd

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

Add a pcd named PcdFmpDeviceImageDefaultTypeIdGuid. This is used
to provide a default Image Type Id for FmpDxe driver instead of
the gEfiCallerIdGuid.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Liming Gao 
Cc: Michael D Kinney 
---
 FmpDevicePkg/FmpDevicePkg.dec | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/FmpDevicePkg/FmpDevicePkg.dec b/FmpDevicePkg/FmpDevicePkg.dec
index ad0730a532..e9261b7e7f 100644
--- a/FmpDevicePkg/FmpDevicePkg.dec
+++ b/FmpDevicePkg/FmpDevicePkg.dec
@@ -7,7 +7,7 @@
 # customized using libraries and PCDs.
 #
 # Copyright (c) 2016, Microsoft Corporation. All rights reserved.
-# Copyright (c) 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are met:
@@ -121,5 +121,11 @@
   # @Prompt Firmware Device Lock Event GUID.
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceLockEventGuid|{0}|VOID*|0x400F
 
+  ## The default Image Type ID to use if none is specified by the FmpDeviceLib.
+  #  If this PCD is not a valid GUID value, the the FmpDxe driver will ASSERT
+  #  and fall back to the gEfiCallerIdGuid (FILE_GUID for the specific driver).
+  # @Prompt Firmware Device Default Image Type ID
+  
gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageDefaultTypeIdGuid|{0}|VOID*|0x4010
+
 [UserExtensions.TianoCore."ExtraFiles"]
   FmpDevicePkgExtra.uni
-- 
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 V4 16/17] MdeModulePkg/PeiDebugLibDebugPpi: Add PEI debug lib

2019-03-21 Thread Gao, Zhichao
For the sections you point. It seems good to watch the patch downloaded.
The indention is one or two space behind the function name depend on tab 
expand(2 space).
Is it need to adjust them?

Thanks,
Zhichao

> -Original Message-
> From: Wu, Hao A
> Sent: Friday, March 22, 2019 10:09 AM
> To: Gao, Zhichao ; edk2-devel@lists.01.org
> Cc: Gao, Liming ; Wang, Jian J
> ; Ni, Ray ; Zeng, Star
> ; Sean Brogan ;
> Michael Turner ; Bret Barkelew
> 
> Subject: RE: [PATCH V4 16/17] MdeModulePkg/PeiDebugLibDebugPpi: Add
> PEI debug lib
> 
> > -Original Message-
> > From: Gao, Zhichao
> > Sent: Thursday, March 21, 2019 10:05 PM
> > To: edk2-devel@lists.01.org
> > Cc: Gao, Liming; Wang, Jian J; Wu, Hao A; Ni, Ray; Zeng, Star; Sean
> > Brogan; Michael Turner; Bret Barkelew
> > Subject: [PATCH V4 16/17] MdeModulePkg/PeiDebugLibDebugPpi: Add PEI
> > debug lib
> >
> > 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 | 456
> > +
> >  .../PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf|  55 +++
> >  2 files changed, 511 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..75859163ae
> > --- /dev/null
> > +++ b/MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c
> > @@ -0,0 +1,456 @@
> > +/** @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 
> > +
> > +EDKII_DEBUG_PPI *mDebugPpi = 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  ...   Variable argument list whose contents are accessed
> > +based on the format string specified by Format.
> > +
> > +**/
> > +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);
> > +
> > +  //
> > +

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

2019-03-21 Thread Wu, Hao A
> -Original Message-
> From: Gao, Zhichao
> Sent: Thursday, March 21, 2019 10:05 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming; Wang, Jian J; Wu, Hao A; Ni, Ray; Zeng, Star; Sean Brogan;
> Michael Turner; Bret Barkelew
> Subject: [PATCH V4 16/17] MdeModulePkg/PeiDebugLibDebugPpi: Add PEI
> debug lib
> 
> 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 | 456
> +
>  .../PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf|  55 +++
>  2 files changed, 511 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..75859163ae
> --- /dev/null
> +++ b/MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c
> @@ -0,0 +1,456 @@
> +/** @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 
> +
> +EDKII_DEBUG_PPI *mDebugPpi = 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  ...   Variable argument list whose contents are accessed
> +based on the format string specified by Format.
> +
> +**/
> +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 (

*

> +&gEdkiiDebugPpiGuid,
> +0,
> +NULL,
> +(VOID **)&mDebugPpi
> +);

*

The indention seems not consistent for the above several lines.


> +if (EFI_ERROR (Status)) {
> +  CpuDeadLoop();
> +}
> +  }
> +
> +  mDebugPpi->DebugBPrint (

*

> +  ErrorLevel,
> +  Format,
> +  BaseListMarker
> +  );

*

The indention seems not consistent for the above several lines.


> +}
> +
> +
> +/**
> +  Worker function that convert a VA_LIST to a BASE_LIST ba

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

2019-03-21 Thread Wu, Hao A
Reviewed-by: Hao Wu 

Best Regards,
Hao Wu


> -Original Message-
> From: Gao, Zhichao
> Sent: Thursday, March 21, 2019 10:05 PM
> To: edk2-devel@lists.01.org
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ray; Zeng, Star; Gao, Liming; Sean Brogan;
> Michael Turner; Bret Barkelew
> Subject: [PATCH V4 15/17] MdeModulePkg: Add a PEIM to install Debug PPI
> 
> 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   | 60
> ++
>  .../Universal/DebugServicePei/DebugService.h   | 56
> 
>  .../Universal/DebugServicePei/DebugServicePei.c| 54
> +++
>  .../Universal/DebugServicePei/DebugServicePei.inf  | 52
> +++
>  .../Universal/DebugServicePei/DebugServicePei.uni  | 20 
>  5 files changed, 242 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..a9ea14db81
> --- /dev/null
> +++ b/MdeModulePkg/Universal/DebugServicePei/DebugService.c
> @@ -0,0 +1,60 @@
> +/** @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] 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 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] 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 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..3e234f76b6
> --- /dev/null
> +++ b/MdeModulePkg/Universal/DebugServicePei/DebugService.h
> @@ -0,0 +1,56 @@
> +/** @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__
> +#

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

2019-03-21 Thread Wu, Hao A
> -Original Message-
> From: Gao, Zhichao
> Sent: Thursday, March 21, 2019 10:05 PM
> To: edk2-devel@lists.01.org
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ray; Zeng, Star; Gao, Liming; Sean Brogan;
> Michael Turner; Bret Barkelew
> Subject: [PATCH V4 14/17] MdeModulePkg: Add definitions for EDKII DEBUG
> PPI
> 
> 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 | 82
> 
>  MdeModulePkg/MdeModulePkg.dec|  3 ++
>  2 files changed, 85 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..dc50ed1b46
> --- /dev/null
> +++ b/MdeModulePkg/Include/Ppi/Debug.h
> @@ -0,0 +1,82 @@
> +/** @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] ErrorLevel   The error level of the debug message.
> +  @param[in] Format   Format string for the debug message to 
> print.
> +  @param[in] VaListMarker BASE_LIST marker for the variable
> argument list.

Minor comment:

Parameter name is not consistent between function description comment
'VaListMarker' and the service prototype 'Marker'.

With this handled:
Reviewed-by: Hao Wu 

Best Regards,
Hao Wu


> +
> +**/
> +typedef
> +VOID
> +(EFIAPI *EDKII_DEBUG_BPRINT)(
> +  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] 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 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

_

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

2019-03-21 Thread Wu, Hao A
> -Original Message-
> From: Gao, Zhichao
> Sent: Thursday, March 21, 2019 10:05 PM
> To: edk2-devel@lists.01.org
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ray; Zeng, Star; Gao, Liming; Sean Brogan;
> Michael Turner; Bret Barkelew
> Subject: [PATCH V4 13/17] MdeModulePkg/PeiDxeDebugLibReportStatusCode:
> 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: 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  | 171
> +
>  1 file changed, 144 insertions(+), 27 deletions(-)
> 
> diff --git
> a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
> b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
> index 6f0f416273..d593752050 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,48 @@ 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.
> +
> +  Only one list type is used.
> +  If BaseListMarker == NULL, then use VaListMarker.
> +  Otherwise use BaseListMarker and the VaListMarker should be initilized as
> +  mVaListNull.
> +
> +  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;
> 
> @@ -78,22 +120,22 @@ DebugPrint (
>// Note that the passing-in format string and variable parameters will be
> constructed to
>// the following layout:
>//
> -  // Buffer->||
> -  // | Padding| 4 bytes
> -  //  DebugInfo->||
> -  // |  EFI_DEBUG_INFO| sizeof(EFI_DEBUG_INFO)
> -  // BaseListMarker->||
> -  // |   ...  |
> -  // |   variable arguments   | 12 * sizeof (UINT64)
> -  // |   ...  |
> -  // ||
> -  // |   Format String|
> -  // ||<- (UINT8 *)Buffer + 
> sizeof(Buffer)
> +  //Buffer->||
> +  //| Padding| 4 bytes
> +  // DebugInfo->||
> +  //|  EFI_DEBUG_INFO| sizeof(EFI_DEBUG_INFO)
> +  // BaseListMarkerPointer->||
> 

[edk2] [PATCH 1/2] Platform/Intel: Added python build script.

2019-03-21 Thread Agyeman
This change allows building all the platforms in Platform/Intel with
a single python script. This script is tested on windows 10 , python 2.7
and python 3.7 with VS2015

Files Added:

* BuildBios.py: the main build script
  build.json: contains general/default build settings
* ClevoOpenBoardPkg/N1xxWU/buildConfig.json: contains N1xxWU specific
  build settings
* KabylakeOpenBoardPkg/KabylakeRvp3/BuildEx.py : contains KabylakeRvp3
  custom build script
* KabylakeOpenBoardPkg/KabylakeRvp3/buildConfig.json: contains
  KabylakeRvp3 build settings
* PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.py: contains
  BoardMtOlympus custom build script
* PurleyOpenBoardPkg/BoardMtOlympus/buildConfig.json: contains
  BoardMtOlympus custom build settings

Cc: Nate DeSimone 
Cc: Ankit Sinha 
Cc: Michael D Kinney 
Cc: Isaac W Oram 
Cc: Liming Gao 

Contributed-under: TianoCore Contribution Agreement 0.1
Signed-off-by: Agyeman 
---
 Platform/Intel/BuildBios.py   | 866 ++
 .../ClevoOpenBoardPkg/N1xxWU/buildConfig.json |  31 +
 .../KabylakeRvp3/BuildEx.py   |  17 +
 .../KabylakeRvp3/buildConfig.json |  32 +
 .../BoardMtOlympus/BuildBoard.py  | 100 ++
 .../BoardMtOlympus/buildConfig.json   |  35 +
 Platform/Intel/build.json |  55 ++
 7 files changed, 1136 insertions(+)
 create mode 100644 Platform/Intel/BuildBios.py
 create mode 100644 Platform/Intel/ClevoOpenBoardPkg/N1xxWU/buildConfig.json
 create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/BuildEx.py
 create mode 100644 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/buildConfig.json
 create mode 100644 
Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/BuildBoard.py
 create mode 100644 
Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/buildConfig.json
 create mode 100644 Platform/Intel/build.json

diff --git a/Platform/Intel/BuildBios.py b/Platform/Intel/BuildBios.py
new file mode 100644
index 00..512640c9d1
--- /dev/null
+++ b/Platform/Intel/BuildBios.py
@@ -0,0 +1,866 @@
+## @ PatchFspBinBaseAddress.py
+#
+# 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 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.
+#
+##
+
+import os
+import subprocess
+import sys
+import json
+import argparse
+import signal
+import re
+import stat
+import shutil
+from importlib import import_module
+
+
+def prebuild(buildConfig , buildType = "DEBUG", silent = False, toolchain = 
None):
+"""Sets the environment variables that shall be used for the build
+
+:param buildConfig: The build configuration as defined in the JOSN 
configuration files
+:type buildConfig: Dictionary
+:param buildType: The build target, DEBUG, RELEASE, RELEASE_PDB, 
TEST_RELEASE
+:type buildType: String
+:param silent: Enables build in silent mode
+:type silent: Boolean
+:param toolchain: Specifies the tool chain tag to use for the build
+:type toolchain: String
+:returns: The updated environment variables
+:rtype: Dictionary
+"""
+#patch the config
+buildConfig = patchConfig(buildConfig)
+
+#get current environment variables
+buildConfig.update(os.environ.copy())
+
+config = {}
+
+for key,item in buildConfig.items():
+config[str(key)] = str(item)
+
+config = py27Fix(config)
+
+#Set WORKSPACE environment.
+config["WORKSPACE"] = os.path.abspath(os.path.join("..","..","..","")) 
#TODO
+print("Set WORKSPACE as: {}".format(config["WORKSPACE"]))
+
+#Check whether Git has been installed and been added to system path.
+try:
+subprocess.Popen(["git", "--help"],stdout=subprocess.PIPE)
+except OSError as error:
+if error.errno == os.errno.ENOENT:
+print("The 'git' command is not recognized.")
+print("Please make sure that Git is installed and has been added 
to system path.")
+os.exit(1)
+
+   #Create the Conf directory under WORKSPACE
+if not os.path.isdir(os.path.join(config["WORKSPACE"],"Conf")):
+try:
+#create directory
+os.makedirs(os.path.join(config["WORKSPACE"],"Conf"))
+#copy files to it
+configTemplatePath = 
os.path.join(config["WORKSPACE"],config["BASE_TOOLS_PATH"],"Conf")
+configPath = os.path.join(config["WORKSPACE"],"Conf")
+shutil.copyfile(configTemplatePath + os.sep + "target.template", 
configPath + os.sep + "target.txt")
+shutil.copyfile(configTemplatePath + os.sep + 
"tools_def.template", configPath + os.sep + "tools_def.t

[edk2] [PATCH 2/2] ReadMe.md: Update the build instructions

2019-03-21 Thread Agyeman
Updated the build instructions to include
the python script build instructions

Cc: Michael Kubacki 
Cc: Michael D Kinney 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Ankit Sinha 

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Agyeman 
---
 ReadMe.md | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/ReadMe.md b/ReadMe.md
index 72e332a476..947d428ce9 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -105,6 +105,20 @@ return back to the minimum platform caller.
 
 ### Build
 
+**Building with the python script**
+
+1. Open command window, go to the workspace directory, e.g. c:\Kabylake.
+2. Type "cd edk2-platforms\Platform\Intel
+3. Type "python BuildBios.py -p REPLACE_WITH_BOARD_NAME"
+
+* To view the supported platforms
+  * ``Type "python BuildBios.py -l"``
+
+* For more information
+  * ``Type "python BuildBios.py -h"``
+
+**Building with the batch scripts**
+
 For KabylakeOpenBoardPkg
 1. Open command window, go to the workspace directory, e.g. c:\Kabylake.
 2. Type "cd edk2-platforms\Platform\Intel\KabylakeOpenBoardPkg\KabylakeRvp3".
-- 
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 v1 0/2] Ovmf: Stop using ISA drivers within IntelFrameworkModulePkg

2019-03-21 Thread Wu, Hao A
> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Friday, March 22, 2019 3:04 AM
> To: Ard Biesheuvel; Wu, Hao A
> Cc: edk2-devel@lists.01.org; Justen, Jordan L; Ni, Ray
> Subject: Re: [PATCH v1 0/2] Ovmf: Stop using ISA drivers within
> IntelFrameworkModulePkg
> 
> On 03/21/19 11:08, Ard Biesheuvel wrote:
> > On Thu, 21 Mar 2019 at 07:44, Wu, Hao A  wrote:
> >>
> >
> > Just a couple of notes from my side - I'm sure Laszlo will have a much
> > longer list :-)
> >
> > - Dropping the floppy driver is fine with me.
> > - What is OVMF specific about this driver? Is it only the hardcoded
> > list of COM1/COM2/PS2 keyboard? If so, should we split this into a
> > driver and a library class, where the driver lives in MdeModulePkg,
> > and the library is implemented in the context of OVMF?
> 
>  Hello Ard,
> 
>  I think the special thing for this one is that:
>  For QEMU, it does not have a Super I/O (SIO) chip. While, as far as I
>  know, the SIO chip exists on other platforms. The driver proposed here
>  simulates the behavior of an SIO chip. IMO, if we find more platforms
> that
>  do not have a SIO chip, we can convert the driver into a general one.
> 
>  Also, for the implementation of the services in the Super I/O protocol,
>  the proposed driver just does the minimal effort in order to support the
>  serial/PS2 keyboard.
> >>>
> >>> Here's why I'd like the majority of this driver to live under
> >>> MdeModulePkg (for example through a lib class separation like Ard
> suggests):
> >>>
> >>> Because then its maintenance would not be the responsibility of OvmfPkg
> >>> maintainers.
> >>>
> >>> Consider, this driver is absolutely huge (1.5-2 kLOC), for doing "the
> >>> minimal effort in order to support the serial/PS2 keyboard".
> >>>
> >>> The risk of regressions is extreme (the PS/2 keyboard is the default
> >>> one, and if it breaks *subtly*, almost all users will be inconvenienced,
> >>> but not necessarily soon enough for us to get reports about it *early*
> >>> in the current development cycle).
> >>>
> >>> I realize that IntelFrameworkModulePkg/Bus/Isa/* drivers are frowned
> >>> upon nowadays, they may be ugly / platform specific / etc etc etc, but
> >>> they have also proved themselves to *work*, and (as far as I remember)
> >>> they have required practically zero fixes in order to function well on 
> >>> QEMU.
> >>>
> >>> It is very unwelcome by me to take on the maintenance burden for a
> >>> driver that is all of:
> >>> - not widely tested,
> >>> - replacing a proven set of drivers that is critical to users,
> >>> - large.
> >>>
> >>> I understand that Intel wants to stop maintaining
> >>> IntelFrameworkModulePkg/Bus/Isa/*, but the above price is too high for
> me.
> >>>
> >>> Compare the case if we simply moved the
> >>> IntelFrameworkModulePkg/Bus/Isa/* drivers under OvmfPkg:
> >>> - still large,
> >>> - but widely tested (with minimal churn in the past),
> >>> - and no risk of regressions.
> >>>
> >>> So in this form, I'm generally opposed to the switch. The two sets of
> >>> drivers need to coexist for a while, and we must expose the new drivers
> >>> to users while providing them with some sort of easy fallback. (I'd
> >>> prefer that fallback to be dynamically configurable, but, again, if your
> >>> keyboard breaks, how do you interact with e.g. the UEFI shell? So I
> >>> guess a static build flag would do as well.) I think the old drivers
> >>
> >> Hello Laszlo,
> >>
> >> I agree with your point. So your suggestion is to:
> >>
> >> 1. Duplicate the below drivers into OvmfPkg:
> >>   PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.inf
> >>   IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.inf
> >>   IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf
> >>   IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
> >>
> >> 2. Meanwhile, add the proposed SioBusDxe driver in the OvmfPkg as well
> >>
> >> 3. Add a static build flag within OvmfPkg to let users choose between:
> >>a) New OVMF SioBusDxe driver + ISA device drivers under
> >>   MdeModulePkg/Bus/Isa;
> >>b) Legacy ISA stack copied from PcAtChipsetPkg &
> IntelFrameworkModulePkg
> >>
> >> Is my understanding correct?
> 
> Yes (but see below, at the end).
> 
> >>> should be removed only in the edk2 stable tag that comes *after* the
> >>> next one, once we've given the drivers enough time to "prove themselves".
> >>
> >> Do you mean we should keep the copy of the legacy ISA stack from
> >> PcAtChipsetPkg & IntelFrameworkModulePkg until the announcement of
> >> edk2-stable201905 tag?
> 
> Yes, exactly. People that adopt "edk2-stable201905" should be able to
> switch back to the old driver stack.
> 
> NB: I certainly agree that the new code should be made the *default*.
> 
> >>
> >
> > I think we should just keep the IntelFrameworkModulePkg components in
> > place until we are ready to stop using them in

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

2019-03-21 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

> -Original Message-
> From: Gao, Zhichao
> Sent: Thursday, March 21, 2019 10:05 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 V4 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 
> Reviewed-by: Chasel Chiu 
> ---
>  .../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 DebugPrintError

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

2019-03-21 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

> -Original Message-
> From: Gao, Zhichao
> Sent: Thursday, March 21, 2019 10:05 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 V4 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 
> Reviewed-by: Chasel Chiu 
> ---
>  .../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 DebugPrintErr

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

2019-03-21 Thread Gao, Zhichao
Sorry for forgetting to add tag.
I am new to this community and this wiki page would help me a lot. 

Thanks,
Zhichao

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Friday, March 22, 2019 2:58 AM
> To: Gao, Zhichao ; edk2-devel@lists.01.org
> Cc: Justen, Jordan L ; Ard Biesheuvel
> ; Gao, Liming ; Sean
> Brogan ; Michael Turner
> ; Bret Barkelew
> 
> Subject: Re: [PATCH V4 09/17] OvmfPkg/PlatformDebugLibIoPort: Add new
> APIs
> 
> On 03/21/19 15:04, Zhichao Gao wrote:
> > 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(-)
> 
> This v4 patch is identical to v3.
> 
> When you repost a series in order to update a subset of the patches, you
> should please pick up the feedback tags from the previous review session for
> those patches that you do *not* change.
> 
> This is explained here, for example:
> 
> https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-
> guide-for-edk2-contributors-and-maintainers#contrib-26
> 
> https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-
> guide-for-edk2-contributors-and-maintainers#contrib-28
> 
> This makes a huge difference for reviewers -- it costs you a bit of time, but 
> it
> saves reviewers a lot more time.
> 
> For example, the present patch has not been changed from v3 to v4, and I
> gave my A-b in the v3 review session. Therefore you should have edited the
> commit message on this patch, to include my A-b, for the v4 posting.
> 
> Either way, I can give it again here.
> 
> Acked-by: Laszlo Ersek 
> 
> Thanks
> Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] IntelSiliconPkg/IntelSiliconPkg.dsc: Add a driver to build

2019-03-21 Thread Chaganty, Rangasai V
Reviewed-by: Rangasai V Chaganty  

-Original Message-
From: Gao, Zhichao 
Sent: Thursday, March 21, 2019 7:44 AM
To: edk2-devel@lists.01.org
Cc: Ni, Ray ; Chaganty, Rangasai V 
; Gao, Liming 
Subject: [PATCH] IntelSiliconPkg/IntelSiliconPkg.dsc: Add a driver to build

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

Add a driver MicrocodeFlashAccessLibNull.inf to the [Components] section to 
make sure it would build correctly.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Ray Ni 
Cc: Rangasai V Chaganty 
Cc: Liming Gao 
---
 IntelSiliconPkg/IntelSiliconPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/IntelSiliconPkg/IntelSiliconPkg.dsc 
b/IntelSiliconPkg/IntelSiliconPkg.dsc
index 790870e2f1..a00fef6010 100644
--- a/IntelSiliconPkg/IntelSiliconPkg.dsc
+++ b/IntelSiliconPkg/IntelSiliconPkg.dsc
@@ -85,6 +85,7 @@
   IntelSiliconPkg/Feature/VTd/PlatformVTdSampleDxe/PlatformVTdSampleDxe.inf
   
IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/PlatformVTdInfoSamplePei.inf
   IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf
+  
+ IntelSiliconPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/Mi
+ crocodeFlashAccessLibNull.inf
 
 [BuildOptions]
   *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
--
2.16.2.windows.1

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


[edk2] [edk2-announce] Monthly Community Meeting Update

2019-03-21 Thread stephano

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

These meetings are now available on the Groups.io calendar as a 
recurring meeting. You can subscribe to the calendar to receive any 
updates. Reminders will be sent out automatically to those subscribed to 
the group.


I will no longer be providing calendar invites, so you'll have to 
subscribe to this calendar. I'll continue to provide reminders to this 
list until we transition to the new list. After that, reminders will be 
automated.


These changes will free up my time to work on more meaningful issues 
rather than scheduling meetings. However, as always, please feel free to 
provide feedback on the list or email me directly.


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


[edk2] [edk2-announce] Groups.io Transition

2019-03-21 Thread stephano
First off, I'd like to thank Laszlo for his help in confirming the 
functionality of the Groups.io mailing list. I could not have done this 
without him. Groups.io seems to mimic our current list almost 100%, 
certainly enough to make it viable. Also, it will allow such exciting 
features as "email attachments", "email whitelisting", calendars, file 
storage, and polls.


edk2-devel transition
---
I am currently working with 01.org to archive our current mbox from 
edk2-devel and move it over to Groups.io. Once this is complete we will 
officially use that as our development mailing list.


01.org and I are currently working out a date for the transition. I will 
send out an email 2 weeks before the switch, again 1 week before the 
switch, and 24 hours before we "go dark" on 01.org. Please update your 
scripts / documents accordingly.


edk2-bugs transition
---
Once we have been using groups.io for development emails for a few 
weeks, I'll transition edk2-bugs over as well. I'd rather not do both at 
the same time. Also, I want to give us a chance to collectively agree 
that Groups.io is a successful platform.


Using Groups.io as a Community
---
There are three "groups" in our current setup: devel, bugs, and 
announce. Please take some time to familiarize yourself with the platform:


https://edk2.groups.io

The "default group" is devel, and that is where we will have any polls, 
calendar updates, and file uploads. I will be sending out a Design 
Meeting announcement soon which will rely heavily on this platform.


As always, please feel free to contact me with any questions or comments.

Cheers,
Stephano

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


[edk2] [edk2-announce] APAC/NAMO Bug Triage Time Changes

2019-03-21 Thread stephano

Hey All,

So, as it turns out, we here in the US change to Daylight Savings Time, 
whereas in PRC they do not change their clocks. Because of this, I've 
moved the Bug Triage for this evening out 1 hour to 5pm PDT (8am in 
PRC). The triage will remain at this time until Daylight Savings ends in 
the US on Sunday, November 3.


Also of note, Europe will not observe Daylight Savings Time until 
Sunday, March 31. As such we here in the US will be moving our bug 
triage from 7am to 8am to accommodate this shift. If any US folks 
dislike this extra hour of sleep, or if this move conflicts with your 
schedule please let me know. We will resume "normal" 7am bug triages in 
2 weeks.


Sorry for the late notice. I've updated the wiki:

https://github.com/tianocore/tianocore.github.io/wiki/Bug-Triage

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


Re: [edk2] [PATCH v1 0/2] Ovmf: Stop using ISA drivers within IntelFrameworkModulePkg

2019-03-21 Thread Laszlo Ersek
On 03/21/19 11:08, Ard Biesheuvel wrote:
> On Thu, 21 Mar 2019 at 07:44, Wu, Hao A  wrote:
>>
>
> Just a couple of notes from my side - I'm sure Laszlo will have a much
> longer list :-)
>
> - Dropping the floppy driver is fine with me.
> - What is OVMF specific about this driver? Is it only the hardcoded
> list of COM1/COM2/PS2 keyboard? If so, should we split this into a
> driver and a library class, where the driver lives in MdeModulePkg,
> and the library is implemented in the context of OVMF?

 Hello Ard,

 I think the special thing for this one is that:
 For QEMU, it does not have a Super I/O (SIO) chip. While, as far as I
 know, the SIO chip exists on other platforms. The driver proposed here
 simulates the behavior of an SIO chip. IMO, if we find more platforms that
 do not have a SIO chip, we can convert the driver into a general one.

 Also, for the implementation of the services in the Super I/O protocol,
 the proposed driver just does the minimal effort in order to support the
 serial/PS2 keyboard.
>>>
>>> Here's why I'd like the majority of this driver to live under
>>> MdeModulePkg (for example through a lib class separation like Ard suggests):
>>>
>>> Because then its maintenance would not be the responsibility of OvmfPkg
>>> maintainers.
>>>
>>> Consider, this driver is absolutely huge (1.5-2 kLOC), for doing "the
>>> minimal effort in order to support the serial/PS2 keyboard".
>>>
>>> The risk of regressions is extreme (the PS/2 keyboard is the default
>>> one, and if it breaks *subtly*, almost all users will be inconvenienced,
>>> but not necessarily soon enough for us to get reports about it *early*
>>> in the current development cycle).
>>>
>>> I realize that IntelFrameworkModulePkg/Bus/Isa/* drivers are frowned
>>> upon nowadays, they may be ugly / platform specific / etc etc etc, but
>>> they have also proved themselves to *work*, and (as far as I remember)
>>> they have required practically zero fixes in order to function well on QEMU.
>>>
>>> It is very unwelcome by me to take on the maintenance burden for a
>>> driver that is all of:
>>> - not widely tested,
>>> - replacing a proven set of drivers that is critical to users,
>>> - large.
>>>
>>> I understand that Intel wants to stop maintaining
>>> IntelFrameworkModulePkg/Bus/Isa/*, but the above price is too high for me.
>>>
>>> Compare the case if we simply moved the
>>> IntelFrameworkModulePkg/Bus/Isa/* drivers under OvmfPkg:
>>> - still large,
>>> - but widely tested (with minimal churn in the past),
>>> - and no risk of regressions.
>>>
>>> So in this form, I'm generally opposed to the switch. The two sets of
>>> drivers need to coexist for a while, and we must expose the new drivers
>>> to users while providing them with some sort of easy fallback. (I'd
>>> prefer that fallback to be dynamically configurable, but, again, if your
>>> keyboard breaks, how do you interact with e.g. the UEFI shell? So I
>>> guess a static build flag would do as well.) I think the old drivers
>>
>> Hello Laszlo,
>>
>> I agree with your point. So your suggestion is to:
>>
>> 1. Duplicate the below drivers into OvmfPkg:
>>   PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.inf
>>   IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.inf
>>   IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf
>>   IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
>>
>> 2. Meanwhile, add the proposed SioBusDxe driver in the OvmfPkg as well
>>
>> 3. Add a static build flag within OvmfPkg to let users choose between:
>>a) New OVMF SioBusDxe driver + ISA device drivers under
>>   MdeModulePkg/Bus/Isa;
>>b) Legacy ISA stack copied from PcAtChipsetPkg & IntelFrameworkModulePkg
>>
>> Is my understanding correct?

Yes (but see below, at the end).

>>> should be removed only in the edk2 stable tag that comes *after* the
>>> next one, once we've given the drivers enough time to "prove themselves".
>>
>> Do you mean we should keep the copy of the legacy ISA stack from
>> PcAtChipsetPkg & IntelFrameworkModulePkg until the announcement of
>> edk2-stable201905 tag?

Yes, exactly. People that adopt "edk2-stable201905" should be able to
switch back to the old driver stack.

NB: I certainly agree that the new code should be made the *default*.

>>
> 
> I think we should just keep the IntelFrameworkModulePkg components in
> place until we are ready to stop using them in OVMF. Cloning them into
> OvmfPkg now just so we can remove IntelFrameworkModulePkg in its
> entirety has little added value IMO.

I fully agree with this modification (it minimizes the churn), but I'm
unsure how quickly Intel would like to rid themselves of
IntelFrameworkModulePkg. If their deadline is edk2-stable201905, then
that conflicts with my request above, and we might have no choice in
moving the code to OvmfPkg, for the sake of one more stable tag.

Thanks
Laszlo
_

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

2019-03-21 Thread Laszlo Ersek
On 03/21/19 15:04, Zhichao Gao wrote:
> 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(-)

This v4 patch is identical to v3.

When you repost a series in order to update a subset of the patches, you
should please pick up the feedback tags from the previous review session
for those patches that you do *not* change.

This is explained here, for example:

https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers#contrib-26

https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers#contrib-28

This makes a huge difference for reviewers -- it costs you a bit of
time, but it saves reviewers a lot more time.

For example, the present patch has not been changed from v3 to v4, and I
gave my A-b in the v3 review session. Therefore you should have edited
the commit message on this patch, to include my A-b, for the v4 posting.

Either way, I can give it again here.

Acked-by: Laszlo Ersek 

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


Re: [edk2] [PATCH edk2-non-osi v3 0/8] Upload D0x binary modules

2019-03-21 Thread Leif Lindholm
On Wed, Mar 20, 2019 at 04:17:21PM +0800, Ming Huang wrote:
> Main Changes since v2 :
> 1 Move "Add some header files" patch to the first of this series;
> 
> Code can also be found in github:
> https://github.com/hisilicon/OpenPlatformPkg.git
> branch: 1902-non-osi-v3

Apart from the patches I've called out separately:
Reviewed-by: Leif Lindholm 
Pushed as 635f97e0..99907896.

Thanks!

> Ming Huang (8):
>   Hisilicon/D0x: Add some header files
>   Hisilicon/D06: Remove PCI enumeration dependency from SAS driver
>   Hisilicon/D0x: Update PlatformSysCtrlLib binary
>   Hisilicon/D06: Update Mbigen and gic RAS register
>   Hisilicon/D06: Support PCIe local RAS
>   Hisilicon/D06: Use new flash layout
>   Hisilicon/D06: Fix numa node wrong issue
>   Hisilicon/D06: Add Setup Item "Support DPC"
> 
>  Silicon/Hisilicon/Include/Library/IpmiCmdLib.h   
>   | 110 +++
>  Silicon/Hisilicon/Include/Library/LpcLib.h   
>   | 113 
>  Silicon/Hisilicon/Include/Library/OemAddressMapLib.h 
>   |  45 
>  Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h   
>   | 112 +++
>  Silicon/Hisilicon/Include/Library/SerdesLib.h
>   |  21 
>  Platform/Hisilicon/D06/CustomData.Fv 
>   | Bin 0 -> 65536 bytes
>  Platform/Hisilicon/D06/Drivers/IoInitDxe/IoInitDxe.efi   
>   | Bin 232832 -> 226784 bytes
>  Platform/Hisilicon/D06/Drivers/PcieRasInitDxe/PcieRasInitDxe.efi 
>   | Bin 21248 -> 22048 bytes
>  Platform/Hisilicon/D06/Drivers/RasInitDxe/RasInitDxe.efi 
>   | Bin 17984 -> 18720 bytes
>  Platform/Hisilicon/D06/Drivers/Sas/SasDriverDxe.depex
>   | Bin 216 -> 36 bytes
>  Platform/Hisilicon/D06/Drivers/Sas/SasDriverDxe.efi  
>   | Bin 221312 -> 220640 bytes
>  Platform/Hisilicon/D06/Library/OemAddressMapD06/OemAddressMapD06.lib 
>   | Bin 61892 -> 31696 bytes
>  Platform/Hisilicon/D06/MemoryInitPei/MemoryInit.efi  
>   | Bin 297696 -> 358656 bytes
>  Platform/Hisilicon/D06/Sec/FVMAIN_SEC.Fv 
>   | Bin 1048576 -> 1048576 bytes
>  Platform/Hisilicon/D06/bl1.bin   
>   | Bin 12432 -> 12432 bytes
>  Platform/Hisilicon/D06/fip.bin   
>   | Bin 113450 -> 121866 bytes
>  
> Silicon/Hisilicon/Hi1610/Library/PlatformSysCtrlLibHi1610/PlatformSysCtrlLibHi1610.lib
>  | Bin 297590 -> 229128 bytes
>  
> Silicon/Hisilicon/Hi1616/Library/PlatformSysCtrlLibHi1616/PlatformSysCtrlLibHi1616.lib
>  | Bin 344310 -> 275312 bytes
>  
> Silicon/Hisilicon/Hi1620/Library/PlatformSysCtrlLibHi1620/PlatformSysCtrlLibHi1620.lib
>  | Bin 356032 -> 375916 bytes
>  19 files changed, 401 insertions(+)
>  create mode 100644 Silicon/Hisilicon/Include/Library/IpmiCmdLib.h
>  create mode 100755 Silicon/Hisilicon/Include/Library/LpcLib.h
>  create mode 100644 Silicon/Hisilicon/Include/Library/OemAddressMapLib.h
>  create mode 100644 Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h
>  create mode 100644 Silicon/Hisilicon/Include/Library/SerdesLib.h
>  create mode 100644 Platform/Hisilicon/D06/CustomData.Fv
> 
> -- 
> 2.9.5
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms v3 00/18] Fix issues and improve D0x

2019-03-21 Thread Leif Lindholm
On Wed, Mar 20, 2019 at 04:08:11PM +0800, Ming Huang wrote:
> Main Changes since v2 :
> 1 Move tidy and delete header file patch to the first of the series.
> 
> Code can also be found in github:
> https://github.com/hisilicon/OpenPlatformPkg.git
> branch: 1902-platforms-v3

Apart from the patches I've called out separately:
Reviewed-by: Leif Lindholm 
Pushed as a8f34e0658..89f6901df0.

Thanks!

> Jason Zhang (1):
>   Hisilicon/D06: Fix access variable fail issue
> 
> Ming Huang (16):
>   Hisilicon/D0x: Remove and tidy some codes about SerdesLib
>   Hisilicon/D0x: Delete some header files
>   Hisilicon/D0x: Add DriverHealthManagerDxe
>   Hisilicon/D06: Optimize SAS driver for reducing boot time
>   Hisilicon/D06: Drop the leading 0 (0x0 -> 0x)
>   Hisilicon/D06: Add more PCIe port INT-x support
>   Hisilicon/D0x: Rename StartupAp() function
>   Hisilicon/D06: Use HCCS speed with 2.6G
>   Hisilicon/D06: Add PCI_OSC_SUPPORT
>   Hisilicon/D06: Modify for IMP self-Adapte support
>   Hisilicon/D06: Add Setup Item "Support DPC" and delete some PCIe menus
>   Hisilicon/D06: Use new flash layout
>   Hisilicon/D06: Remove SECURE_BOOT_ENABLE definition
>   Hisilicon/D0x: Remove SP805 watchdog pcd
>   Hisilicon/D06: Fix USB crash issue(4079)
>   Hisilicon/D0x: Modify version to 19.02
> 
> xingjiang tang (1):
>   Hisilicon/D06: Add OemGetCpuFreq to encapsulate difference
> 
>  Platform/Hisilicon/D03/D03.dsc   
>  |   8 +-
>  Platform/Hisilicon/D05/D05.dsc   
>  |   8 +-
>  Platform/Hisilicon/D06/D06.dsc   
>  |  19 +-
>  Platform/Hisilicon/D03/D03.fdf   
>  |   1 +
>  Platform/Hisilicon/D05/D05.fdf   
>  |   1 +
>  Platform/Hisilicon/D06/D06.fdf   
>  |  18 +-
>  Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.inf
>  |   1 +
>  Platform/Hisilicon/D03/Library/OemMiscLib2P/OemMiscLib2PHi1610.inf   
>  |   2 +-
>  Platform/Hisilicon/D05/EarlyConfigPeim/EarlyConfigPeimD05.inf
>  |   1 +
>  Platform/Hisilicon/D05/Library/OemMiscLibD05/OemMiscLibD05.inf   
>  |   1 +
>  Platform/Hisilicon/D06/EarlyConfigPeim/EarlyConfigPeimD06.inf
>  |   1 +
>  Platform/Hisilicon/D06/Library/OemMiscLibD06/OemMiscLibD06.inf   
>  |   1 +
>  Silicon/Hisilicon/Drivers/Smbios/MemorySubClassDxe/MemorySubClassDxe.inf 
>  |   1 +
>  
> Silicon/Hisilicon/Drivers/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf
> |   1 +
>  Silicon/Hisilicon/Drivers/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf 
>  |   4 +-
>  Silicon/Hisilicon/Drivers/VirtualEhciPciIo/VirtualEhciPciIo.inf  
>  |   1 +
>  Silicon/Hisilicon/Hi1610/Drivers/IoInitDxe/IoInitDxe.inf 
>  |   1 +
>  Silicon/Hisilicon/Library/ArmPlatformLibHisilicon/ArmPlatformLib.inf 
>  |   1 -
>  Silicon/Hisilicon/Library/BmcConfigBootLib/BmcConfigBootLib.inf  
>  |   1 +
>  Silicon/Hisilicon/Library/I2CLib/I2CLib.inf  
>  |   1 +
>  Silicon/Hisilicon/Library/I2CLib/I2CLibRuntime.inf   
>  |   1 +
>  Platform/Hisilicon/D06/Include/Library/CpldD06.h 
>  |   4 +
>  Silicon/Hisilicon/Hi1610/Include/Library/SerdesLib.h 
>  | 131 -
>  Silicon/Hisilicon/Hi1616/Include/Library/SerdesLib.h 
>  |  86 --
>  Silicon/Hisilicon/Hi1620/Include/Library/SerdesLib.h 
>  |  85 --
>  Silicon/Hisilicon/Include/Library/IpmiCmdLib.h   
>  | 110 ---
>  Silicon/Hisilicon/Include/Library/LpcLib.h   
>  | 113 ---
>  Silicon/Hisilicon/Include/Library/OemAddressMapLib.h 
>  |  45 ---
>  Silicon/Hisilicon/Include/Library/OemConfigData.h
>  |   1 +
>  Silicon/Hisilicon/Include/Library/OemMiscLib.h   
>  |  75 +
>  Silicon/Hisilicon/Include/Library/PlatformSysCtrlLib.h   
>  | 112 ---
>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr   
>  |   4 +-
>  Platform/Hisilicon/D03/EarlyConfigPeim/EarlyConfigPeimD03.c  
>  |   2 +-
>  Platform/Hisilicon/D03/Library/OemMiscLib2P/BoardFeature2PHi1610.c   
>  |   1 -
>  Platform/Hisilicon/D03

Re: [edk2] [PATCH edk2-non-osi v3 8/8] Hisilicon/D06: Add Setup Item "Support DPC"

2019-03-21 Thread Leif Lindholm
Just in case there is an interdependency with the edk2-platforms patch
  Hisilicon/D06: Add Setup Item "Support DPC" and delete some PCIe menus"
I will refrain from pushing this just yet, and will similarly
cherry-pick this patch into the Linaro release build.

I will push this patch once I push the corresponding edk2-platforms
patch, or if you tell me there is no dependency.

/
Leif


On Wed, Mar 20, 2019 at 04:17:29PM +0800, Ming Huang wrote:
> Add setup item "Support DPC" to enable or disable PCIe DPC
> (Downstream Port Containment).
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ming Huang 
> Reviewed-by: Leif Lindholm 
> ---
>  Platform/Hisilicon/D06/Drivers/IoInitDxe/IoInitDxe.efi | Bin 232832 -> 
> 226784 bytes
>  1 file changed, 0 insertions(+), 0 deletions(-)
> 
> diff --git a/Platform/Hisilicon/D06/Drivers/IoInitDxe/IoInitDxe.efi 
> b/Platform/Hisilicon/D06/Drivers/IoInitDxe/IoInitDxe.efi
> index e32c056..4511f6b 100644
> Binary files a/Platform/Hisilicon/D06/Drivers/IoInitDxe/IoInitDxe.efi and 
> b/Platform/Hisilicon/D06/Drivers/IoInitDxe/IoInitDxe.efi differ
> -- 
> 2.9.5
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms v3 12/18] Hisilicon/D06: Modify for IMP self-Adapte support

2019-03-21 Thread Leif Lindholm
On Wed, Mar 20, 2019 at 04:08:23PM +0800, Ming Huang wrote:
> As new IMP(Cortex-M7) firmware support self-adapte, so do not
> need BIOS to implement some function, remove useless funtions

I will reword/correct the above to "unused functions". With that:
Reviewed-by: Leif Lindholm 


> and report CPU0/CPU1 Nic NCL offset to IMP.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ming Huang 
> ---
>  Platform/Hisilicon/D06/Library/OemNicLib/OemNicLib.c | 281 
> 
>  1 file changed, 54 insertions(+), 227 deletions(-)
> 
> diff --git a/Platform/Hisilicon/D06/Library/OemNicLib/OemNicLib.c 
> b/Platform/Hisilicon/D06/Library/OemNicLib/OemNicLib.c
> index aaf990216982..678c2107bdd3 100644
> --- a/Platform/Hisilicon/D06/Library/OemNicLib/OemNicLib.c
> +++ b/Platform/Hisilicon/D06/Library/OemNicLib/OemNicLib.c
> @@ -21,44 +21,21 @@
>  #include 
>  
>  #define CPU2_SFP2_100G_CARD_OFFSET   0x25
> -#define CPU1_SFP1_LOCATE_OFFSET  0x16
> -#define CPU1_SFP0_LOCATE_OFFSET  0x12
> -#define CPU2_SFP1_LOCATE_OFFSET  0x21
> -#define CPU2_SFP0_LOCATE_OFFSET  0x19
> -#define CPU2_SFP2_10G_GE_CARD_OFFSET 0x25
>  
> -#define SFP_10G_SPEED   10
> -#define SFP_25G_SPEED   25
> -#define SFP_100G_SPEED  100
> -#define SFP_GE_SPEED1
> -
> -#define SFP_GE_SPEED_VAL_VENDOR_FINISAR 0x0C
> -#define SFP_GE_SPEED_VAL0x0D
> -#define SFP_10G_SPEED_VAL   0x67
> -#define SFP_25G_SPEED_VAL   0xFF
> +#define SOCKET1_NET_PORT_100G 1
> +#define SOCKET0_NET_PORT_NUM  4
> +#define SOCKET1_NET_PORT_NUM  2
>  
>  #define CARD_PRESENT_100G   (BIT7)
> -#define CARD_PRESENT_10G(BIT0)
> -#define SELECT_SFP_BY_INDEX(index)  (1 << (index - 1))
> -#define SPF_SPEED_OFFSET12
> -
> -#define SFP_DEVICE_ADDRESS 0x50
> -#define CPU1_9545_I2C_ADDR 0x70
> -#define CPU2_9545_I2C_ADDR 0x71
> -
> -#define FIBER_PRESENT 0
> -#define CARD_PRESENT  1
> -#define I2C_PORT_SFP  4
> -#define CPU2_I2C_PORT_SFP 5
> -
> -#define SOCKET_0 0
> -#define SOCKET_1 1
>  #define EEPROM_I2C_PORT  4
>  #define EEPROM_PAGE_SIZE 0x40
>  #define MAC_ADDR_LEN 6
>  #define I2C_OFFSET_EEPROM_ETH0   (0xc00)
>  #define I2C_SLAVEADDR_EEPROM (0x52)
>  
> +#define SRAM_NIC_NCL1_OFFSET_ADDRESS   0xA0E87FE0
> +#define SRAM_NIC_NCL2_OFFSET_ADDRESS   0xA0E87FE4
> +
>  #pragma pack(1)
>  typedef struct {
>UINT16 Crc16;
> @@ -114,204 +91,6 @@ UINT16 CrcTable16[256] = {
>0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0,
>  };
>  
> -EFI_STATUS
> -GetSfpSpeed (
> -  UINT16 Socket,
> -  UINT16 SfpNum,
> -  UINT8* FiberSpeed
> -  )
> -{
> -  EFI_STATUS  Status;
> -  I2C_DEVICE  SpdDev;
> -  UINT8   SfpSelect;
> -  UINT8   SfpSpeed;
> -  UINT32  RegAddr;
> -  UINT16  I2cAddr;
> -  UINT32  SfpPort;
> -
> -  SfpSpeed = 0x0;
> -  if (Socket == SOCKET_1) {
> -I2cAddr = CPU2_9545_I2C_ADDR;
> -SfpPort = CPU2_I2C_PORT_SFP;
> -  } else {
> -I2cAddr = CPU1_9545_I2C_ADDR;
> -SfpPort = I2C_PORT_SFP;
> -  }
> -
> -  Status = I2CInit (Socket, SfpPort, Normal);
> -  if (EFI_ERROR (Status)) {
> -DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Socket%d Call I2CInit failed! 
> p1=0x%x.\n",
> -__FUNCTION__, __LINE__, Socket, Status));
> -return Status;
> -  }
> -
> -  SpdDev.Socket = Socket;
> -  SpdDev.DeviceType = DEVICE_TYPE_SPD;
> -  SpdDev.Port = SfpPort;
> -  SpdDev.SlaveDeviceAddress = I2cAddr;
> -  RegAddr = 0x0;
> -  SfpSelect = SELECT_SFP_BY_INDEX (SfpNum);
> -
> -  Status = I2CWrite (&SpdDev, RegAddr, 1, &SfpSelect);
> -  if (EFI_ERROR (Status)) {
> -DEBUG ((DEBUG_ERROR, "I2CWrite Error =%r.\n", Status));
> -return Status;
> -  }
> -
> -  SpdDev.Socket = Socket;
> -  SpdDev.DeviceType = DEVICE_TYPE_SPD;
> -  SpdDev.Port = SfpPort;
> -  SpdDev.SlaveDeviceAddress = SFP_DEVICE_ADDRESS;
> -
> -  RegAddr = SPF_SPEED_OFFSET;
> -  Status = I2CRead (&SpdDev, RegAddr, 1, &SfpSpeed);
> -  if (EFI_ERROR (Status)) {
> -DEBUG ((DEBUG_ERROR, "I2CRead Error =%r.\n", Status));
> -return Status;
> -  }
> -
> -  DEBUG ((DEBUG_INFO, "BR, Nominal, Nominal signalling rate, SfpSpeed:
> 0x%x\n",
> - SfpSpeed));
> -
> -  if (SfpSpeed == SFP_10G_SPEED_VAL) {
> -*FiberSpeed = SFP_10G_SPEED;
> -  } else if (SfpSpeed == SFP_25G_SPEED_VAL) {
> -*FiberSpeed = SFP_25G_SPEED;
> -  } else if ((SfpSpeed == SFP_GE_SPEED_VAL) ||
> - (SfpSpeed == SFP_GE_SPEED_VAL_VENDOR_FINISAR)) {
> -*FiberSpeed = SFP_GE_SPEED;
> -  }
> -
> -  return EFI_SUCCESS;
> -}
> -
> -//Fiber1Type/Fiber2Type/Fiber3Type return: SFP_10G_SPEED, SFP_100G_SPEED, 
> SFP_GE_SPEED
> -UINT32
> -GetCpu2FiberType (
> -  UINT8* Fiber1Type,
> -  UINT8* Fiber2Type,
> -  UINT8* Fiber100Ge
> -  )
> -{
> -  EFI_STATUS  Status;
> -  UINT16  SfpNum1;
> -  UINT8   SfpSpeed1;
> -  UINT16  SfpNum2;
> -  UINT8   SfpSpee

Re: [edk2] [PATCH edk2-platforms v3 05/18] Hisilicon/D06: Fix access variable fail issue

2019-03-21 Thread Leif Lindholm
Urgh, this was an unfortunate off-by-one post:
I am deferring this patch until after Linaro's 2019.03 firmware
release and cherry-picking it into that. There must be a better way to
solve this.

My comment referred to "Hisilicon/D06: Drop the leading 0 (0x0 ->
0x)", which will be pushed with an improved subject.

/
Leif

On Thu, Mar 21, 2019 at 05:52:18PM +, Leif Lindholm wrote:
> I will update the subject line to reflect what is actually being
> changed.
> 
> Other than that,
> Reviewed-by: Leif Lindholm 
> 
> 
> On Wed, Mar 20, 2019 at 04:08:16PM +0800, Ming Huang wrote:
> > From: Jason Zhang 
> > 
> > BmcWdtEnable is a field of OemConfigData structure, need have
> > runtime service attribution if use it during exit boot service
> > 
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ming Huang 
> > ---
> >  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr | 2 +-
> >  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c  | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr 
> > b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
> > index 470e9ace3dcf..08236704fbfe 100644
> > --- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
> > +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
> > @@ -23,7 +23,7 @@ formset
> >help  = STRING_TOKEN(STR_OEM_CONFIG),
> >classguid = gEfiIfrFrontPageGuid,  // for MdeModule Bds.
> >efivarstore OEM_CONFIG_DATA,
> > -attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | 
> > EFI_VARIABLE_NON_VOLATILE,
> > +attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | 
> > EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS,
> >  name  = OemConfig,
> >  guid  = gOemConfigGuid;
> >  
> > diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c 
> > b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
> > index 012d45bc0214..6668103af027 100644
> > --- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
> > +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
> > @@ -316,7 +316,7 @@ OemConfigUiLibConstructor (
> >Status = gRT->SetVariable (
> >OEM_CONFIG_NAME,
> >&gOemConfigGuid,
> > -  EFI_VARIABLE_NON_VOLATILE | 
> > EFI_VARIABLE_BOOTSERVICE_ACCESS,
> > +  EFI_VARIABLE_NON_VOLATILE | 
> > EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
> >sizeof (OEM_CONFIG_DATA),
> >&Configuration
> >);
> > -- 
> > 2.9.5
> > 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms v3 05/18] Hisilicon/D06: Fix access variable fail issue

2019-03-21 Thread Leif Lindholm
I will update the subject line to reflect what is actually being
changed.

Other than that,
Reviewed-by: Leif Lindholm 


On Wed, Mar 20, 2019 at 04:08:16PM +0800, Ming Huang wrote:
> From: Jason Zhang 
> 
> BmcWdtEnable is a field of OemConfigData structure, need have
> runtime service attribution if use it during exit boot service
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ming Huang 
> ---
>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr | 2 +-
>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr 
> b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
> index 470e9ace3dcf..08236704fbfe 100644
> --- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
> @@ -23,7 +23,7 @@ formset
>help  = STRING_TOKEN(STR_OEM_CONFIG),
>classguid = gEfiIfrFrontPageGuid,  // for MdeModule Bds.
>efivarstore OEM_CONFIG_DATA,
> -attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
> +attribute = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE 
> | EFI_VARIABLE_RUNTIME_ACCESS,
>  name  = OemConfig,
>  guid  = gOemConfigGuid;
>  
> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c 
> b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
> index 012d45bc0214..6668103af027 100644
> --- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
> @@ -316,7 +316,7 @@ OemConfigUiLibConstructor (
>Status = gRT->SetVariable (
>OEM_CONFIG_NAME,
>&gOemConfigGuid,
> -  EFI_VARIABLE_NON_VOLATILE | 
> EFI_VARIABLE_BOOTSERVICE_ACCESS,
> +  EFI_VARIABLE_NON_VOLATILE | 
> EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
>sizeof (OEM_CONFIG_DATA),
>&Configuration
>);
> -- 
> 2.9.5
> 
___
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-21 Thread Laszlo Ersek
On 03/21/19 13:04, Lars Kurth wrote:
> 
> 
> On 20/03/2019, 18:25, "Laszlo Ersek"  wrote:
> 
> But, again, this should be discussed in that separate BZ then.
> 
> > >OvmfPkg/XenBusDxe/XenBus.c
> 
> This file is licensed under the BSD license, aka 
> https://opensource.org/licenses/bsd-license.php
> 
> > >OvmfPkg/XenBusDxe/XenStore.c
> > >OvmfPkg/XenBusDxe/XenStore.h
> >I do not know where these files come from. The files do not appear to 
> come from a Xen project repo. 
> 
> See commit a9090a94bb4a ("OvmfPkg/XenBusDxe: Add XenStore client
> implementation", 2014-10-29), by Anthony.
> 
> https://github.com/tianocore/edk2/commit/a9090a94bb4a
> 
> The commit message states,
> 
> >Origin: FreeBSD 10.0
> >License: This patch adds several files under the MIT licence.
> 
> >So, unless you trust that the license in the headers are correct, the 
> right thing would be to identify the source and check whether the license 
> text has been imported unmodified
> 
> We do trust that the license blocks, as they exist, are correct. Where
> we need help & support is the mapping/replacement of those verbose
> license blocks to/with SPDX-License-Identifier tags.
> 
> As I now understand what is needed, I had a look at the XenStore.* licenses. 
> They are NOT a standard MIT license
> 
> The sources say:
> "Permission is hereby granted, free of charge, to any person obtaining a copy 
> of this source file (the "Software")"
> The MIT license says
> "Permission is hereby granted, free of charge, to any person obtaining a copy 
> of this software and associated documentation files (the "Software")"
> 
> I would argue that replacing "source file" with "software and associated 
> documentation files" is probably OK, but I am not an expert. I am pretty sure 
> this type of issue has come up before when migrating to SPDX. It might be 
> worthwhile reaching out to someone from SPDX.
> 
> Hope this helped

Thank you! We'll revisit this issue (and thread, I assume) later on.

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


[edk2] [PATCH] PcAtChipsetPkg/PcatChipsetPkg.dsc: Add a driver to build

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

Add the IdeControllerDxe driver to the [Components] section
to make sure it would build correctly.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Ray Ni 
Cc: Liming Gao 
---
 PcAtChipsetPkg/PcAtChipsetPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dsc 
b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
index d357aa28d0..e58ca81864 100644
--- a/PcAtChipsetPkg/PcAtChipsetPkg.dsc
+++ b/PcAtChipsetPkg/PcAtChipsetPkg.dsc
@@ -52,6 +52,7 @@
   PcAtChipsetPkg/8254TimerDxe/8254Timer.inf
   PcAtChipsetPkg/HpetTimerDxe/HpetTimerDxe.inf
   PcAtChipsetPkg/8259InterruptControllerDxe/8259.inf
+  PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeControllerDxe.inf
   PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.inf
   PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
   PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.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] IntelSiliconPkg/IntelSiliconPkg.dsc: Add a driver to build

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

Add a driver MicrocodeFlashAccessLibNull.inf to the
[Components] section to make sure it would build correctly.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Ray Ni 
Cc: Rangasai V Chaganty 
Cc: Liming Gao 
---
 IntelSiliconPkg/IntelSiliconPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/IntelSiliconPkg/IntelSiliconPkg.dsc 
b/IntelSiliconPkg/IntelSiliconPkg.dsc
index 790870e2f1..a00fef6010 100644
--- a/IntelSiliconPkg/IntelSiliconPkg.dsc
+++ b/IntelSiliconPkg/IntelSiliconPkg.dsc
@@ -85,6 +85,7 @@
   IntelSiliconPkg/Feature/VTd/PlatformVTdSampleDxe/PlatformVTdSampleDxe.inf
   
IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/PlatformVTdInfoSamplePei.inf
   IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdateDxe.inf
+  
IntelSiliconPkg/Feature/Capsule/Library/MicrocodeFlashAccessLibNull/MicrocodeFlashAccessLibNull.inf
 
 [BuildOptions]
   *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
-- 
2.16.2.windows.1

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


Re: [edk2] Enquiry on GetTimerPeriod function in Ping.c

2019-03-21 Thread Carsey, Jaben
Correct 0 is supposed to indicate an error.

That function may be incorrect for your platform. I think that function is used 
to help determine the granularity to use when determine how long it took for 
packets to make their trip over the network and back.

-Jaben

> -Original Message-
> From: Ooi, Tzy Way
> Sent: Thursday, March 21, 2019 5:20 AM
> To: Carsey, Jaben ; Ni, Ray ;
> edk2-devel@lists.01.org
> Cc: Loh, Tien Hock ; Ooi, Tzy Way
> 
> Subject: Enquiry on GetTimerPeriod function in Ping.c
> 
> Hi,
> 
> I am enabling an UEFI ethernet driver in our platform. While I tried to
> test the driver with ping command, I noticed that ping operation is
> aborted due to the GetTimerPeriod function return a value 0.
> 
> In the function GetTimerPeriod in ping.c, the function will return the
> value of StallCounter/RttTimerTick once it completed all the
> operations. However, the value return in my platform is zero due to
> StallCounter is having smaller value than RttTimerTick.
> 
> I am not sure what is the usage of GetTimerPeriod function and how it
> works. The GetTimerPeriod function will return 0 if any of the
> operation having an error during the execution. However, I suspect that
> this function should not return 0 when StallCounter is having less
> value than RttTimerTick? This is because the function actually did not
> encounter any error. Please correct me if I m wrong.
> 
> Thank you
> 
> Best regards,
> Tzy Way
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


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

2019-03-21 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   | 60 ++
 .../Universal/DebugServicePei/DebugService.h   | 56 
 .../Universal/DebugServicePei/DebugServicePei.c| 54 +++
 .../Universal/DebugServicePei/DebugServicePei.inf  | 52 +++
 .../Universal/DebugServicePei/DebugServicePei.uni  | 20 
 5 files changed, 242 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..a9ea14db81
--- /dev/null
+++ b/MdeModulePkg/Universal/DebugServicePei/DebugService.c
@@ -0,0 +1,60 @@
+/** @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] 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 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] 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 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..3e234f76b6
--- /dev/null
+++ b/MdeModulePkg/Universal/DebugServicePei/DebugService.h
@@ -0,0 +1,56 @@
+/** @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 level
+  is enabled.
+
+  @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 UINTN  ErrorLevel,
+  IN CONST CHAR8*Format,
+  IN BASE_LIST  Marker
+  );
+
+/**
+  Prints an assert message containing a filename, line n

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

2019-03-21 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 | 456 +
 .../PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf|  55 +++
 2 files changed, 511 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..75859163ae
--- /dev/null
+++ b/MdeModulePkg/Library/PeiDebugLibDebugPpi/DebugLib.c
@@ -0,0 +1,456 @@
+/** @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 
+
+EDKII_DEBUG_PPI *mDebugPpi = 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  ...   Variable argument list whose contents are accessed
+based on the format string specified by Format.
+
+**/
+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 (
+&gEdkiiDebugPpiGuid,
+0,
+NULL,
+(VOID **)&mDebugPpi
+);
+if (EFI_ERROR (Status)) {
+  CpuDeadLoop();
+}
+  }
+
+  mDebugPpi->DebugBPrint (
+  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  VaListMarker,
+  OUT BASE_LISTBaseListMarker,
+  IN  UINTNSize
+  )
+{
+  BASE_LIST   BaseListStart;
+  BOOLEAN Long;
+
+  A

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

2019-03-21 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 | 82 
 MdeModulePkg/MdeModulePkg.dec|  3 ++
 2 files changed, 85 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..dc50ed1b46
--- /dev/null
+++ b/MdeModulePkg/Include/Ppi/Debug.h
@@ -0,0 +1,82 @@
+/** @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] ErrorLevel   The error level of the debug message.
+  @param[in] Format   Format string for the debug message to 
print.
+  @param[in] VaListMarker BASE_LIST marker for the variable 
argument list.
+
+**/
+typedef
+VOID
+(EFIAPI *EDKII_DEBUG_BPRINT)(
+  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] 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 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 V4 17/17] MdeModulePkg: Add PEIM and lib to dsc file

2019-03-21 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 V4 09/17] OvmfPkg/PlatformDebugLibIoPort: Add new APIs

2019-03-21 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, Base

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

2019-03-21 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  | 171 +
 1 file changed, 144 insertions(+), 27 deletions(-)

diff --git a/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c 
b/MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
index 6f0f416273..d593752050 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,48 @@ 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.
+
+  Only one list type is used.
+  If BaseListMarker == NULL, then use VaListMarker.
+  Otherwise use BaseListMarker and the VaListMarker should be initilized as
+  mVaListNull.
+
+  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;
 
@@ -78,22 +120,22 @@ DebugPrint (
   // Note that the passing-in format string and variable parameters will be 
constructed to
   // the following layout:
   //
-  // Buffer->||
-  // | Padding| 4 bytes
-  //  DebugInfo->||
-  // |  EFI_DEBUG_INFO| sizeof(EFI_DEBUG_INFO)
-  // BaseListMarker->||
-  // |   ...  |
-  // |   variable arguments   | 12 * sizeof (UINT64)
-  // |   ...  |
-  // ||
-  // |   Format String|
-  // ||<- (UINT8 *)Buffer + 
sizeof(Buffer)
+  //Buffer->||
+  //| Padding| 4 bytes
+  // DebugInfo->||
+  //|  EFI_DEBUG_INFO| sizeof(EFI_DEBUG_INFO)
+  // BaseListMarkerPointer->||
+  //|   ...  |
+  //|   variable arguments   | 12 * sizeof (UINT64)
+  //|   ...  |
+  //||
+  //|   Format String|
+  //||<- (UINT8 *)Buffer + 
sizeof(Buffer)
   //
   TotalSize = 4 + sizeof (EFI_DEBUG_INFO) + 12 * sizeof (UINT64) + 
AsciiStrSize (Format);
 
   //
-  // If the TotalSize is larger than the maximum record size, then return

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

2019-03-21 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  | 173 +
 1 file changed, 145 insertions(+), 28 deletions(-)

diff --git 
a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c 
b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
index b0445115a9..7ae4edb40d 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,49 @@ 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.
+
+  Only one list type is used.
+  If BaseListMarker == NULL, then use VaListMarker.
+  Otherwise use BaseListMarker and the VaListMarker should be initilized as
+  mVaListNull.
+
+  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;
 
@@ -79,25 +121,25 @@ DebugPrint (
   // Note that the passing-in format string and variable parameters will be 
constructed to
   // the following layout:
   //
-  // Buffer->||
-  // | Padding| 4 bytes
-  //  DebugInfo->||
-  // |  EFI_DEBUG_INFO| sizeof(EFI_DEBUG_INFO)
-  // BaseListMarker->||
-  // |   ...  |
-  // |   variable arguments   | 12 * sizeof (UINT64)
-  // |   ...  |
-  // ||
-  // |   Format String|
-  // ||<- (UINT8 *)Buffer + 
sizeof(Buffer)
+  //Buffer->||
+  //| Padding| 4 bytes
+  // DebugInfo->||
+  //|  EFI_DEBUG_INFO| sizeof(EFI_DEBUG_INFO)
+  // BaseListMarkerPointer->||
+  //|   ...  |
+  //|   variable arguments   | 12 * sizeof (UINT64)
+  //|   ...  |
+  //||
+  //|   Format String|
+  //||<- (UINT8 *)Buffer + 
sizeof(Buffer)
   //
   TotalSize = 4 + sizeof (EFI_DEBUG_INFO) + 12 * sizeof (UINT64) + 
AsciiStrSize (Format);
 
   //
-  // If the TotalSize is larger than the maximum 

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

2019-03-21 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 
Reviewed-by: Chasel Chiu 
---
 .../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, BaseListMarke

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

2019-03-21 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 
Reviewed-by: Chasel Chiu 
---
 .../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);

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

2019-03-21 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 co

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

2019-03-21 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 
Reviewed-by: Liming Gao  
---
 .../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, BaseListMark

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

2019-03-21 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 
Reviewed-by: Liming Gao  
---
 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, mVaListNu

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

2019-03-21 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 
Reviewed-by: Liming Gao  
---
 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 Bas

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

2019-03-21 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 
Reviewed-by: Liming Gao  
---
 .../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 

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

2019-03-21 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 
Reviewed-by: Liming Gao  
---
 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

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

2019-03-21 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 
Reviewed-by: Liming Gao  
---
 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 V4 00/17] Add new APIs DebugVPrint for DebugLib

2019-03-21 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.

V4:
Sync the implement on MdeModulePkg/PeiDxeDebugLibReportStatusCode to
IntelFramworkModulePkg/PeiDxeDebugLibReportStatusCode. While the format
string is too long just truncate it instead of return.
Fix and update some functions' comments.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao 
Cc: Michael D Kinney 
Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Laszlo Ersek 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Star Zeng 
Cc: Nate DeSimone 
Cc: Jian J Wang 
Cc: Hao Wu 
Cc: Ray Ni 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 

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  | 173 ++--
 .../Library/BaseFspDebugLibSerialPort/DebugLib.c   | 103 -
 .../Library/BaseFspDebugLibSerialPort/DebugLib.c   | 103 -
 MdeModulePkg/Include/Ppi/Debug.h   |  82 
 .../Library/PeiDebugLibDebugPpi/DebugLib.c | 456 +
 .../PeiDebugLibDebugPpi/PeiDebugLibDebugPpi.inf|  55 +++
 .../PeiDxeDebugLibReportStatusCode/DebugLib.c  | 171 ++--
 MdeModulePkg/MdeModulePkg.dec  |   3 +
 MdeModulePkg/MdeModulePkg.dsc  |   3 +
 .../Universal/DebugServicePei/DebugService.c   |  60 +++
 .../Universal/DebugServicePei/DebugService.h   |  56 +++
 .../Universal/DebugServicePei/DebugServicePei.c|  54 +++
 .../Universal/DebugServicePei/DebugServicePei.inf  |  52 +++
 .../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, 2140 insertions(+), 102 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 V4 01/17] MdePkg/DebugLib.h: Add new APIs for DebugLib

2019-03-21 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 
Reviewed-by: Liming Gao  
---
 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 edk2-platforms v3 13/18] Hisilicon/D06: Add Setup Item "Support DPC" and delete some PCIe menus

2019-03-21 Thread Leif Lindholm
Hi Ming,

On Wed, Mar 20, 2019 at 04:08:24PM +0800, Ming Huang wrote:
> Add setup item "Support DPC" to enable or disable PCIe DPC
> (Downstream Port Containment).
> 
> The pcie menu is suppressed for original code as these menus
> are not ready. This patch remove the suppression for pcie menu,
> so delete these menus for now.

As the commit message shows, this patch does two unrelated things.
Could you break this patch up into two separate ones and resubmit just
those?

I will cherry-pick this patch manually in order to have it included in
RPF 2019.03 -rc1, but I would prefer what goes in upstream to be
cleaner.

Best Regards,

Leif

> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ming Huang 
> ---
>  Silicon/Hisilicon/Include/Library/OemConfigData.h   |   1 +
>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr  |   2 -
>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c   |   4 +
>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr| 197 
> +---
>  Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfigStrings.uni |   3 +-
>  5 files changed, 10 insertions(+), 197 deletions(-)
> 
> diff --git a/Silicon/Hisilicon/Include/Library/OemConfigData.h 
> b/Silicon/Hisilicon/Include/Library/OemConfigData.h
> index f120e3123c83..c0097d0829f0 100644
> --- a/Silicon/Hisilicon/Include/Library/OemConfigData.h
> +++ b/Silicon/Hisilicon/Include/Library/OemConfigData.h
> @@ -49,6 +49,7 @@ typedef struct {
>UINT8 OSWdtAction;
>/*PCIe Config*/
>UINT8 PcieSRIOVSupport;
> +  UINT8 PcieDPCSupport;
>UINT8 PciePort[PCIE_MAX_TOTAL_PORTS];
>UINT8 PcieLinkSpeedPort[PCIE_MAX_TOTAL_PORTS];
>UINT8 PcieLinkDeEmphasisPort[PCIE_MAX_TOTAL_PORTS];
> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr 
> b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
> index 08236704fbfe..93ccb99bdc67 100644
> --- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfigVfr.vfr
> @@ -62,11 +62,9 @@ formset
>prompt = STRING_TOKEN(STR_IBMC_CONFIG_FORM_TITLE),
>help   = STRING_TOKEN(STR_IBMC_CONFIG_FORM_HELP);
>  
> -suppressif TRUE;
>  goto PCIE_CONFIG_FORM_ID,
>prompt  = STRING_TOKEN(STR_PCIE_CONFIG_FORM_TITLE),
>help= STRING_TOKEN(STR_PCIE_CONFIG_FORM_HELP);
> -endif;
>  
>  goto MISC_CONFIG_FORM_ID,
>prompt  = STRING_TOKEN(STR_MISC_CONFIG_FORM_TITLE),
> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c 
> b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
> index 6668103af027..be4ce8820f73 100644
> --- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/OemConfig.c
> @@ -290,6 +290,10 @@ OemConfigUiLibConstructor (
>Configuration.OSWdtTimeout = 5;
>Configuration.OSWdtAction = 1;
>//
> +  //Set the default value of the PCIe option
> +  //
> +  Configuration.PcieDPCSupport = 0;
> +  //
>//Set the default value of the Misc option
>//
>Configuration.EnableSmmu = 1;
> diff --git a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr 
> b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr
> index 7cf7cdd29ba2..c65907fe846e 100644
> --- a/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr
> +++ b/Silicon/Hisilicon/Hi1620/Hi1620OemConfigUiLib/PcieConfig.hfr
> @@ -17,203 +17,12 @@
>  form formid = PCIE_CONFIG_FORM_ID,
>title   = STRING_TOKEN (STR_PCIE_CONFIG_FORM_TITLE);
>  
> -  goto VFR_FORMID_PCIE_SOCKET0,
> -prompt  = STRING_TOKEN (STR_PCIE_CPU_0_PROMPT),
> -help= STRING_TOKEN (STR_PCIE_CPU_PROMPT_HELP);
> -
> -  goto VFR_FORMID_PCIE_SOCKET1,
> -prompt  = STRING_TOKEN (STR_PCIE_CPU_1_PROMPT),
> -help= STRING_TOKEN (STR_PCIE_CPU_PROMPT_HELP);
> -
> -  oneof varid  = OEM_CONFIG_DATA.PcieSRIOVSupport,
> -prompt   = STRING_TOKEN (STR_SRIOV_SUPPORT_PROMPT),
> -help = STRING_TOKEN (STR_SRIOV_SUPPORT_HELP),
> +  oneof varid  = OEM_CONFIG_DATA.PcieDPCSupport,
> +prompt   = STRING_TOKEN (STR_DPC_SUPPORT_PROMPT),
> +help = STRING_TOKEN (STR_DPC_SUPPORT_HELP),
>  option text = STRING_TOKEN (STR_DISABLE), value = 0, flags = 
> MANUFACTURING | DEFAULT | RESET_REQUIRED;
>  option text = STRING_TOKEN (STR_ENABLE),  value = 1, flags = 
> RESET_REQUIRED;
>endoneof;
>  
>  endform;
>  
> -form formid = VFR_FORMID_PCIE_SOCKET0,
> -  title = STRING_TOKEN(STR_PCIE_CPU_0_PROMPT);
> -
> -  goto VFR_FORMID_PCIE_PORT2,
> -prompt  = STRING_TOKEN(STR_PCIE_PORT_2_PROMPT),
> -help= STRING_TOKEN(STR_PCIE_PORT_PROMPT_HELP);
> -
> -  goto VFR_FORMID_PCIE_PORT4,
> -prompt  = STRING_TOKEN(STR_PCIE_PORT_4_PROMPT),
> -help= STRING_TOKEN(STR_PCIE_PORT_PRO

[edk2] Enquiry on GetTimerPeriod function in Ping.c

2019-03-21 Thread twooi
Hi,

I am enabling an UEFI ethernet driver in our platform. While I tried to
test the driver with ping command, I noticed that ping operation is
aborted due to the GetTimerPeriod function return a value 0.

In the function GetTimerPeriod in ping.c, the function will return the
value of StallCounter/RttTimerTick once it completed all the
operations. However, the value return in my platform is zero due to
StallCounter is having smaller value than RttTimerTick.

I am not sure what is the usage of GetTimerPeriod function and how it
works. The GetTimerPeriod function will return 0 if any of the
operation having an error during the execution. However, I suspect that
this function should not return 0 when StallCounter is having less
value than RttTimerTick? This is because the function actually did not
encounter any error. Please correct me if I m wrong.

Thank you

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


Re: [edk2] Debugging why Build Rebuilds Something

2019-03-21 Thread Cohen, Eugene
Liming - thank you - this technique of diff'ing the Makefiles immediately 
identified the issue.

We were defining an environment variable that contained date/time values that 
was used in tools_def resulting in all this unnecessary rebuild behavior.

Thanks a ton!

Eugene

From: Cohen, Eugene
Sent: Thursday, March 21, 2019 4:15 AM
To: 'Gao, Liming' ; edk2-devel@lists.01.org
Subject: RE: Debugging why Build Rebuilds Something

Great - I will try this now, thanks Liming!

From: Gao, Liming mailto:liming@intel.com>>
Sent: Thursday, March 21, 2019 4:02 AM
To: Cohen, Eugene mailto:eug...@hp.com>>; 
edk2-devel@lists.01.org
Subject: RE: Debugging why Build Rebuilds Something

Could you help check the timestamp of AutoGen files in OpenSslLib output 
directory?

After the first build, copy OpenSslLib output directory to another directory
After the second build, compare the output directory between two builds, please 
check whether there is the difference for AutoGen.h and Makefile. If no 
difference, please directly trig Makefile to see whether rebuild happen. If 
rebuild happen, it may be the issue in Makefile. Then, further check Makefile.

Thanks
Liming
>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>Cohen, Eugene
>Sent: Thursday, March 21, 2019 5:50 PM
>To: edk2-devel@lists.01.org
>Subject: [edk2] Debugging why Build Rebuilds Something
>
>I'm experiencing an annoying problem where OpenSslLib is constantly being
>rebuilt. I don't think I've done anything unusual or different to it but
>nevertheless it gets built almost every time I rebuild the same platform.
>
>I don't believe any source file timestamps are changing so I think this may be
>the build.py tool deciding to re-generate stuff. (As a side note: does the
>Autogen process only run when changes are detected on dependencies? I
>assume this must be the case otherwise everything would get rebuilt, right?)
>
>Is there a debug flag that can be turned on to see why build might choose to
>rebuild something? The normal build report and debug flags don't see to
>provide the information for "why" something is being rebuilt.
>
>Thanks,
>
>Eugene
>
>___
>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] BaseTools: Add embedded driver support to GenerateCapsule.py

2019-03-21 Thread Tomas Pilar (tpilar)
Hi Mike,

Thank you, that is great news!

Cheers,
Tom

On 20/03/2019 20:00, Kinney, Michael D wrote:
> Hi Tomas,
>
> Thanks for the contribution.  I agree we need this feature.
> We have been working on updates to GenerateCapsule that
> add support for one or more embedded drivers and multiple
> payloads and the option to provide all the configuration
> information in a JSON file.  It also extends decode
> and dumpinfo to show the embedded drivers.  We will post
> patch with all those features very soon.
>
> Thanks,
>
> Mike
>
>> -Original Message-
>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org]
>> On Behalf Of Tomas Pilar (tpilar)
>> Sent: Wednesday, March 20, 2019 10:18 AM
>> To: edk2-devel@lists.01.org
>> Subject: [edk2] [PATCH] BaseTools: Add embedded driver
>> support to GenerateCapsule.py
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Tomas Pilar 
>> ---
>>  .../Source/Python/Capsule/GenerateCapsule.py  | 25
>> ---
>>  1 file changed, 22 insertions(+), 3 deletions(-)
>>
>> diff --git
>> a/BaseTools/Source/Python/Capsule/GenerateCapsule.py
>> b/BaseTools/Source/Python/Capsule/GenerateCapsule.py
>> index 7b08918857..4b275b092b 100644
>> --- a/BaseTools/Source/Python/Capsule/GenerateCapsule.py
>> +++ b/BaseTools/Source/Python/Capsule/GenerateCapsule.py
>> @@ -9,8 +9,7 @@
>>  # system firmware or device firmware for integrated
>> devices.  In order to
>>  # keep the tool as simple as possible, it has the
>> following limitations:
>>  #   * Do not support multiple payloads in a capsule.
>> -#   * Do not support optional drivers in a capsule.
>> -#   * Do not support vendor code bytes in a capsule.
>> +#   * Support at most one optional driver in a capsule.
>>  #
>>  # Copyright (c) 2018, Intel Corporation. All rights
>> reserved.
>>  # This program and the accompanying materials
>> @@ -236,6 +235,12 @@ if __name__ == '__main__':
>>  help = "Input binary payload
>> filename.")
>>  parser.add_argument("-o", "--output", dest =
>> 'OutputFile', type = argparse.FileType('wb'),
>>  help = "Output filename.")
>> +
>> +#
>> +# Add optional embedded driver and vendor code
>> arguments
>> +#
>> +parser.add_argument("--driver", dest = 'Driver',
>> type = argparse.FileType('rb'),
>> +help = "Input binary embedded
>> driver to package alongside the image")
>>  #
>>  # Add group for -e and -d flags that are mutually
>> exclusive and required
>>  #
>> @@ -355,7 +360,7 @@ if __name__ == '__main__':
>>  parser.error ('the following option is not
>> supported for dumpinfo operations: --output')
>>
>>  #
>> -# Read binary input file
>> +# Read binary input files
>>  #
>>  try:
>>  if args.Verbose:
>> @@ -366,6 +371,17 @@ if __name__ == '__main__':
>>  print ('GenerateCapsule: error: can not read
>> binary input file {File}'.format (File =
>> args.InputFile.name))
>>  sys.exit (1)
>>
>> +DriverBuffer = b''
>> +if args.Driver:
>> +try:
>> +if args.Verbose:
>> +print ('Read binary embedded driver
>> {File}'.format (File = args.Driver.name))
>> +DriverBuffer = args.Driver.read ()
>> +args.Driver.close ()
>> +except:
>> +print ('GenerateCapsule: error: can not read
>> supplied binary embedded driver file {File}'.format (File
>> = args.Driver.name))
>> +sys.exit (1)
>> +
>>  #
>>  # Create objects
>>  #
>> @@ -423,6 +439,9 @@ if __name__ == '__main__':
>>
>>  try:
>>  FmpCapsuleHeader.AddPayload (args.Guid,
>> Result, HardwareInstance = args.HardwareInstance)
>> +if args.Driver:
>> +
>> FmpCapsuleHeader.AddEmbeddedDriver(DriverBuffer)
>> +
>>  Result = FmpCapsuleHeader.Encode ()
>>  if args.Verbose:
>>  FmpCapsuleHeader.DumpInfo ()
>> --
>> 2.17.2
>>
>> ___
>> 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] Debugging why Build Rebuilds Something

2019-03-21 Thread Cohen, Eugene
Great - I will try this now, thanks Liming!

From: Gao, Liming 
Sent: Thursday, March 21, 2019 4:02 AM
To: Cohen, Eugene ; edk2-devel@lists.01.org
Subject: RE: Debugging why Build Rebuilds Something

Could you help check the timestamp of AutoGen files in OpenSslLib output 
directory?

After the first build, copy OpenSslLib output directory to another directory
After the second build, compare the output directory between two builds, please 
check whether there is the difference for AutoGen.h and Makefile. If no 
difference, please directly trig Makefile to see whether rebuild happen. If 
rebuild happen, it may be the issue in Makefile. Then, further check Makefile.

Thanks
Liming
>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>Cohen, Eugene
>Sent: Thursday, March 21, 2019 5:50 PM
>To: edk2-devel@lists.01.org
>Subject: [edk2] Debugging why Build Rebuilds Something
>
>I'm experiencing an annoying problem where OpenSslLib is constantly being
>rebuilt. I don't think I've done anything unusual or different to it but
>nevertheless it gets built almost every time I rebuild the same platform.
>
>I don't believe any source file timestamps are changing so I think this may be
>the build.py tool deciding to re-generate stuff. (As a side note: does the
>Autogen process only run when changes are detected on dependencies? I
>assume this must be the case otherwise everything would get rebuilt, right?)
>
>Is there a debug flag that can be turned on to see why build might choose to
>rebuild something? The normal build report and debug flags don't see to
>provide the information for "why" something is being rebuilt.
>
>Thanks,
>
>Eugene
>
>___
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


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

2019-03-21 Thread Gao, Zhichao
Thanks for your reminder. 
I forgot to add all CCs to cover letter. I would be careful next time.

Thanks,
Zhichao

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Thursday, March 21, 2019 12:58 AM
> To: Gao, Zhichao ; edk2-devel@lists.01.org
> Cc: Justen, Jordan L ; Michael Turner
> ; Bret Barkelew
> ; Gao, Liming 
> Subject: Re: [edk2] [PATCH V3 09/17] OvmfPkg/PlatformDebugLibIoPort:
> Add new APIs
> 
> On 03/19/19 16:25, Zhichao Gao wrote:
> > 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,
> >

Re: [edk2] [PATCH v1 0/2] Ovmf: Stop using ISA drivers within IntelFrameworkModulePkg

2019-03-21 Thread Ard Biesheuvel
On Thu, 21 Mar 2019 at 07:44, Wu, Hao A  wrote:
>
> > >>
> > >> Just a couple of notes from my side - I'm sure Laszlo will have a much
> > >> longer list :-)
> > >>
> > >> - Dropping the floppy driver is fine with me.
> > >> - What is OVMF specific about this driver? Is it only the hardcoded
> > >> list of COM1/COM2/PS2 keyboard? If so, should we split this into a
> > >> driver and a library class, where the driver lives in MdeModulePkg,
> > >> and the library is implemented in the context of OVMF?
> > >
> > > Hello Ard,
> > >
> > > I think the special thing for this one is that:
> > > For QEMU, it does not have a Super I/O (SIO) chip. While, as far as I
> > > know, the SIO chip exists on other platforms. The driver proposed here
> > > simulates the behavior of an SIO chip. IMO, if we find more platforms that
> > > do not have a SIO chip, we can convert the driver into a general one.
> > >
> > > Also, for the implementation of the services in the Super I/O protocol,
> > > the proposed driver just does the minimal effort in order to support the
> > > serial/PS2 keyboard.
> >
> > Here's why I'd like the majority of this driver to live under
> > MdeModulePkg (for example through a lib class separation like Ard suggests):
> >
> > Because then its maintenance would not be the responsibility of OvmfPkg
> > maintainers.
> >
> > Consider, this driver is absolutely huge (1.5-2 kLOC), for doing "the
> > minimal effort in order to support the serial/PS2 keyboard".
> >
> > The risk of regressions is extreme (the PS/2 keyboard is the default
> > one, and if it breaks *subtly*, almost all users will be inconvenienced,
> > but not necessarily soon enough for us to get reports about it *early*
> > in the current development cycle).
> >
> > I realize that IntelFrameworkModulePkg/Bus/Isa/* drivers are frowned
> > upon nowadays, they may be ugly / platform specific / etc etc etc, but
> > they have also proved themselves to *work*, and (as far as I remember)
> > they have required practically zero fixes in order to function well on QEMU.
> >
> > It is very unwelcome by me to take on the maintenance burden for a
> > driver that is all of:
> > - not widely tested,
> > - replacing a proven set of drivers that is critical to users,
> > - large.
> >
> > I understand that Intel wants to stop maintaining
> > IntelFrameworkModulePkg/Bus/Isa/*, but the above price is too high for me.
> >
> > Compare the case if we simply moved the
> > IntelFrameworkModulePkg/Bus/Isa/* drivers under OvmfPkg:
> > - still large,
> > - but widely tested (with minimal churn in the past),
> > - and no risk of regressions.
> >
> > So in this form, I'm generally opposed to the switch. The two sets of
> > drivers need to coexist for a while, and we must expose the new drivers
> > to users while providing them with some sort of easy fallback. (I'd
> > prefer that fallback to be dynamically configurable, but, again, if your
> > keyboard breaks, how do you interact with e.g. the UEFI shell? So I
> > guess a static build flag would do as well.) I think the old drivers
>
> Hello Laszlo,
>
> I agree with your point. So your suggestion is to:
>
> 1. Duplicate the below drivers into OvmfPkg:
>   PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.inf
>   IntelFrameworkModulePkg/Bus/Isa/IsaBusDxe/IsaBusDxe.inf
>   IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf
>   IntelFrameworkModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2keyboardDxe.inf
>
> 2. Meanwhile, add the proposed SioBusDxe driver in the OvmfPkg as well
>
> 3. Add a static build flag within OvmfPkg to let users choose between:
>a) New OVMF SioBusDxe driver + ISA device drivers under
>   MdeModulePkg/Bus/Isa;
>b) Legacy ISA stack copied from PcAtChipsetPkg & IntelFrameworkModulePkg
>
> Is my understanding correct?
>
> > should be removed only in the edk2 stable tag that comes *after* the
> > next one, once we've given the drivers enough time to "prove themselves".
>
> Do you mean we should keep the copy of the legacy ISA stack from
> PcAtChipsetPkg & IntelFrameworkModulePkg until the announcement of
> edk2-stable201905 tag?
>

I think we should just keep the IntelFrameworkModulePkg components in
place until we are ready to stop using them in OVMF. Cloning them into
OvmfPkg now just so we can remove IntelFrameworkModulePkg in its
entirety has little added value IMO.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Debugging why Build Rebuilds Something

2019-03-21 Thread Gao, Liming
  Could you help check the timestamp of AutoGen files in OpenSslLib output 
directory? 

  After the first build, copy OpenSslLib output directory to another directory
  After the second build, compare the output directory between two builds, 
please check whether there is the difference for AutoGen.h and Makefile. If no 
difference, please directly trig Makefile to see whether rebuild happen. If 
rebuild happen, it may be the issue in Makefile. Then, further check Makefile.

Thanks
Liming
>-Original Message-
>From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
>Cohen, Eugene
>Sent: Thursday, March 21, 2019 5:50 PM
>To: edk2-devel@lists.01.org
>Subject: [edk2] Debugging why Build Rebuilds Something
>
>I'm experiencing an annoying problem where OpenSslLib is constantly being
>rebuilt.  I don't think I've done anything unusual or different to it but
>nevertheless it gets built almost every time I rebuild the same platform.
>
>I don't believe any source file timestamps are changing so I think this may be
>the build.py tool deciding to re-generate stuff.  (As a side note: does the
>Autogen process only run when changes are detected on dependencies?  I
>assume this must be the case otherwise everything would get rebuilt, right?)
>
>Is there a debug flag that can be turned on to see why build might choose to
>rebuild something?  The normal build report and debug flags don't see to
>provide the information for "why" something is being rebuilt.
>
>Thanks,
>
>Eugene
>
>___
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] Debugging why Build Rebuilds Something

2019-03-21 Thread Cohen, Eugene
I'm experiencing an annoying problem where OpenSslLib is constantly being 
rebuilt.  I don't think I've done anything unusual or different to it but 
nevertheless it gets built almost every time I rebuild the same platform.

I don't believe any source file timestamps are changing so I think this may be 
the build.py tool deciding to re-generate stuff.  (As a side note: does the 
Autogen process only run when changes are detected on dependencies?  I assume 
this must be the case otherwise everything would get rebuilt, right?)

Is there a debug flag that can be turned on to see why build might choose to 
rebuild something?  The normal build report and debug flags don't see to 
provide the information for "why" something is being rebuilt.

Thanks,

Eugene

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


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

2019-03-21 Thread Gao, Zhichao


> -Original Message-
> From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org]
> Sent: Wednesday, March 20, 2019 5:49 PM
> To: Gao, Zhichao 
> Cc: edk2-devel@lists.01.org; Wu, Hao A ; Gao, Liming
> ; Zeng, Star 
> Subject: Re: [edk2] [PATCH 1/2] MdeModulePkg/CapsuleRuntimeDxe:
> Merge changes form arm to all ARCH
> 
> On Wed, 20 Mar 2019 at 02:43, Zhichao Gao  wrote:
> >
> > 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 
> 
> After this patch, platforms may return TRUE from
> QueryCapsuleCapabilities() while they returned FALSE before, i.e., at
> runtime. This behavior change will surely break ARM, but I don't see how it
> doesn't break IA32 as well if it now relies on this cache maintenance to occur
> in the context of UpdateCapsule().
> 

You are right. I forgot to consider the function QueryCapsuleCapabilities.
At runtime, maybe IA32 would catch the same issue on arm ARCH. That should be 
concerned.
For this patch set, we only want to add cache function before runtime. So it is 
better to keep its original logic and add this support.

I would fix the issue you mentioned to make sure it would not affect arm ARCH. 
But disable some function for IA32 ARCH should be another case.

Thanks,
Zhichao

> 
> 
> > ---
> >  .../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
> > -  // c

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

2019-03-21 Thread Gao, Zhichao
I have mixed the section with IntelFrameworkModulePkg.
Seems the truncating behavior can work fine. And the comment of this section 
should be updated.

Thanks,
Zhichao

> -Original Message-
> From: Wu, Hao A
> Sent: Thursday, March 21, 2019 3:06 PM
> To: Gao, Liming ; Gao, Zhichao
> ; edk2-devel@lists.01.org
> Cc: Wang, Jian J ; Ni, Ray ; Zeng,
> Star ; Sean Brogan ;
> Michael Turner ; Bret Barkelew
> 
> Subject: RE: [PATCH V3 13/17]
> MdeModulePkg/PeiDxeDebugLibReportStatusCode: Add new APIs
> 
> > -Original Message-
> > From: Gao, Liming
> > Sent: Thursday, March 21, 2019 2:58 PM
> > To: Gao, Zhichao; edk2-devel@lists.01.org
> > Cc: Wang, Jian J; Wu, Hao A; Ni, Ray; Zeng, Star; Sean Brogan; Michael
> > Turner; Bret Barkelew
> > Subject: RE: [PATCH V3 13/17]
> > MdeModulePkg/PeiDxeDebugLibReportStatusCode: Add new APIs
> >
> > Zhichao:
> >   Why do below change? Seemly, this change is not related to add new
> > APIs. In fact, current log is added as the purpose by commit
> > 137ed15511e2045a7333e33ae7f1e873ce1961dd.
> 
> I would suggest to add another separate commit to refine the below
> comments to state the message truncating behavior here:
> 
>   //
>   // If the TotalSize is larger than the maximum record size, then return
>   ^^^
>   //
>   if (TotalSize > sizeof (Buffer)) {
> TotalSize = sizeof (Buffer);
>   }
> 
> Best Regards,
> Hao Wu
> 
> >
> >   if (TotalSize > sizeof (Buffer)) {
> > TotalSize = sizeof (Buffer);  ==> return;
> >   }
> >
> > Thanks
> > Liming
> > >-Original Message-
> > >From: Gao, Zhichao
> > >Sent: Tuesday, March 19, 2019 11:26 PM
> > >To: edk2-devel@lists.01.org
> > >Cc: Wang, Jian J ; Wu, Hao A
> > >; Ni, Ray ; Zeng, Star
> > >; Gao, Liming ; Sean
> > >Brogan ; Michael Turner
> > >; Bret Barkelew
> > >
> > >Subject: [PATCH V3 13/17]
> > >MdeModulePkg/PeiDxeDebugLibReportStatusCode: 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: 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 f

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

2019-03-21 Thread Wu, Hao A
> -Original Message-
> From: Gao, Liming
> Sent: Thursday, March 21, 2019 2:58 PM
> To: Gao, Zhichao; edk2-devel@lists.01.org
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ray; Zeng, Star; Sean Brogan; Michael Turner;
> Bret Barkelew
> Subject: RE: [PATCH V3 13/17]
> MdeModulePkg/PeiDxeDebugLibReportStatusCode: Add new APIs
> 
> Zhichao:
>   Why do below change? Seemly, this change is not related to add new APIs. In
> fact, current log is added as the purpose by commit
> 137ed15511e2045a7333e33ae7f1e873ce1961dd.

I would suggest to add another separate commit to refine the below
comments to state the message truncating behavior here:

  //
  // If the TotalSize is larger than the maximum record size, then return
  ^^^
  //
  if (TotalSize > sizeof (Buffer)) {
TotalSize = sizeof (Buffer);
  }

Best Regards,
Hao Wu

> 
>   if (TotalSize > sizeof (Buffer)) {
> TotalSize = sizeof (Buffer);  ==> return;
>   }
> 
> Thanks
> Liming
> >-Original Message-
> >From: Gao, Zhichao
> >Sent: Tuesday, March 19, 2019 11:26 PM
> >To: edk2-devel@lists.01.org
> >Cc: Wang, Jian J ; Wu, Hao A ;
> >Ni, Ray ; Zeng, Star ; Gao, Liming
> >; Sean Brogan ;
> >Michael Turner ; Bret Barkelew
> >
> >Subject: [PATCH V3 13/17]
> >MdeModulePkg/PeiDxeDebugLibReportStatusCode: 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: 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 (Buff

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

2019-03-21 Thread Gao, Liming
Reviewed-by: Liming Gao  for MdePkg.

>-Original Message-
>From: Gao, Zhichao
>Sent: Tuesday, March 19, 2019 11:26 PM
>To: edk2-devel@lists.01.org
>Cc: Kinney, Michael D ; Gao, Liming
>; Sean Brogan ;
>Michael Turner ; Bret Barkelew
>
>Subject: [PATCH V3 01/17] MdePkg/DebugLib.h: Add new APIs for DebugLib
>
>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