public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Re: [PATCH v1 0/6] DynamicTablesPkg: Framework updates and fixes
@ 2019-02-21 21:22 Ashish Singhal
  0 siblings, 0 replies; 4+ messages in thread
From: Ashish Singhal @ 2019-02-21 21:22 UTC (permalink / raw)
  To: edk2-devel@lists.01.org, Sami Mujawar

Tested-by: Ashish Singhal <ashishsingha@nvidia.com>

-----Original Message-----
From: edk2-devel <edk2-devel-bounces@lists.01.org> On Behalf Of edk2-devel-request@lists.01.org
Sent: Thursday, February 21, 2019 1:00 PM
To: edk2-devel@lists.01.org
Subject: edk2-devel Digest, Vol 44, Issue 53

Send edk2-devel mailing list submissions to
	edk2-devel@lists.01.org

To subscribe or unsubscribe via the World Wide Web, visit
	https://lists.01.org/mailman/listinfo/edk2-devel
or, via email, send a message with subject or body 'help' to
	edk2-devel-request@lists.01.org

You can reach the person managing the list at
	edk2-devel-owner@lists.01.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of edk2-devel digest..."


Today's Topics:

   1. [Patch edk2 Wiki] Add ATA Security feature set support for
      edk2-stable201903 (Hao Wu)
   2. Re: [PATCH] BaseTools:Build fail if define [DEPEX] in library
      inf (Feng, Bob C)
   3. Re: [PATCH] BaseTools:Some build generated files content are
      not ordered on linux (Feng, Bob C)
   4. Re: [PATCH v4 0/7] ResetSystemLib changings (Gao, Liming)
   5. Re: [PATCH v2 1/5] MdeModulePkg/UefiBootManagerLib: fix
      LoadImage/StartImage status code rep. (Laszlo Ersek)
   6. Re: [patch 2/2] MdeModulePkg/BmBoot: Report status when fail
      to load/start boot option (Laszlo Ersek)
   7. Re: [PATCH] MdeModulePkg/VariableSmmRuntimeDxe: Refactor
      locating Variable Arch Protocol (Laszlo Ersek)
   8. Re: [PATCH] MdeModulePkg/VariableSmmRuntimeDxe: Refactor
      locating Variable Arch Protocol (Ard Biesheuvel)
   9. Re: [PATCH] MdeModulePkg/VariableSmmRuntimeDxe: Refactor
      locating Variable Arch Protocol (Zeng, Star)
  10. Re: [PATCH] MdeModulePkg/VariableSmmRuntimeDxe: Refactor
      locating Variable Arch Protocol (Ard Biesheuvel)
  11. [PATCH v3 0/5] MdeModulePkg, OvmfPkg, ArmVirtPkg: more
      visible boot progress reporting (Laszlo Ersek)
  12. [PATCH v3 1/5] MdeModulePkg/UefiBootManagerLib: fix
      LoadImage/StartImage status code rep. (Laszlo Ersek)
  13. [PATCH v3 2/5] OvmfPkg: add library to track boot option
      loading/starting on the console (Laszlo Ersek)
  14. [PATCH v3 3/5] OvmfPkg/PlatformBootManagerLib: display boot
      option loading/starting (Laszlo Ersek)
  15. [PATCH v3 4/5] ArmVirtPkg/ArmVirtQemu*: enable minimal Status
      Code Routing in DXE (Laszlo Ersek)
  16. [PATCH v3 5/5] ArmVirtPkg/PlatformBootManagerLib: display
      boot option loading/starting (Laszlo Ersek)
  17. [PATCH v2 0/2] Maintainers: updates for ArmVirtPkg and
      OvmfPkg (Laszlo Ersek)
  18. [PATCH v2 1/2] Maintainers: add TPM2 reviewers for OvmfPkg
      (Laszlo Ersek)
  19. [PATCH v2 2/2] Maintainers: specify the scope for
      OvmfPkg/ArmVirtPkg Xen module reviewers (Laszlo Ersek)
  20. Re: [PATCH v2 0/2] Maintainers: updates for ArmVirtPkg and
      OvmfPkg (Ard Biesheuvel)
  21. Re: [PATCH v2 2/2] Maintainers: specify the scope for
      OvmfPkg/ArmVirtPkg Xen module reviewers (Anthony PERARD)
  22. [Patch V2] BaseTools: Correct the value assignment for
      StructurePcd (Feng, Bob C)
  23. [PATCH] Maintainers.txt: Update e-mail address for Julien
      Grall (Julien Grall)
  24. Re: [PATCH] Maintainers.txt: Update e-mail address for Julien
      Grall (Ard Biesheuvel)
  25. Re: [PATCH] Maintainers.txt: Update e-mail address for Julien
      Grall (Laszlo Ersek)
  26. Re: [PATCH v2 2/2] Maintainers: specify the scope for
      OvmfPkg/ArmVirtPkg Xen module reviewers (Julien Grall)
  27. Re: [PATCH] Maintainers.txt: Update e-mail address for Julien
      Grall (Julien Grall)
  28. Re: [PATCH v2 2/2] Maintainers: specify the scope for
      OvmfPkg/ArmVirtPkg Xen module reviewers (Laszlo Ersek)
  29. Re: [PATCH v2 1/2] Maintainers: add TPM2 reviewers for
      OvmfPkg (Marc-Andr? Lureau)
  30. [PATCH v1 5/6] DynamicTablesPkg: Remove GIC Distributor Id
      field (Sami Mujawar)
  31. [PATCH v1 0/6] DynamicTablesPkg: Framework updates and fixes
      (Sami Mujawar)
  32. [PATCH v1 2/6] DynamicTablesPkg: Rename enum used for ID
      Mapping (Sami Mujawar)
  33. [PATCH v1 4/6] DynamicTablesPkg: DGB2: Update
      DBG2_DEBUG_PORT_DDI (Sami Mujawar)
  34. [PATCH v1 1/6] DynamicTablesPkg: Fix depex and protocol
      section (Sami Mujawar)
  35. [PATCH v1 3/6] DynamicTablesPkg: Add OEM Info (Sami Mujawar)
  36. [PATCH v1 6/6] DynamicTablesPkg: Minor updates and fix typos
      (Sami Mujawar)
  37. [PATCH edk2-platforms v1 4/4] Platform/ARM: Juno: Config Mgr
      remove GICD ID (Sami Mujawar)
  38. [PATCH edk2-platforms v1 1/4] Platform/ARM: Juno:
      Configuration Manager depex (Sami Mujawar)
  39. [PATCH edk2-platforms v1 3/4] Platform/ARM: FVP: Config Mgr
      remove GICD ID (Sami Mujawar)
  40. [PATCH edk2-platforms v1 2/4] Platform/ARM: FVP:
      Configuration Manager depex (Sami Mujawar)
  41. [PATCH edk2-platforms v1 0/4] Platform/ARM: Updates
      corresponding to Dynamic Tables Framework changes (Sami Mujawar)
  42. [PATCH 0/2] DynamicTablesPkg Updates (Ashish Singhal)
  43. [PATCH 2/2] DynamicTablesPkg/AcpiSpcrLibArm: Support 16550
      UART. (Ashish Singhal)
  44. [PATCH 1/2] DynamicTablesPkg/DynamicTableManagerDxe: Update
      DEPEX (Ashish Singhal)
  45. Re: [PATCH] Maintainers.txt: Update e-mail address for Julien
      Grall (Laszlo Ersek)
  46. Re: [PATCH v2 0/2] Maintainers: updates for ArmVirtPkg and
      OvmfPkg (Laszlo Ersek)


----------------------------------------------------------------------

Message: 1
Date: Thu, 21 Feb 2019 14:04:34 +0800
From: Hao Wu <hao.a.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Hao Wu <hao.a.wu@intel.com>,	Liming Gao <liming.gao@intel.com>
Subject: [edk2] [Patch edk2 Wiki] Add ATA Security feature set support
	for edk2-stable201903
Message-ID: <20190221060434.15608-1-hao.a.wu@intel.com>

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 EDK-II-Release-Planning.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/EDK-II-Release-Planning.md b/EDK-II-Release-Planning.md
index 095da69..9244fc4 100644
--- a/EDK-II-Release-Planning.md
+++ b/EDK-II-Release-Planning.md
@@ -27,6 +27,7 @@
 * [Support PI1.7 EFI_PEI_CORE_FV_LOCATION_PPI](https://bugzilla.tianocore.org/show_bug.cgi?id=1524)
 * [Remove unused tool chain configuration in tools_def.template](https://bugzilla.tianocore.org/show_bug.cgi?id=1377)
 * [BaseTools supports to the driver combination](https://bugzilla.tianocore.org/show_bug.cgi?id=1520)
+* [Add Security feature set support for ATA devices](https://bugzilla.tianocore.org/show_bug.cgi?id=1529)
 * Standalone MM build of authenticated variable stack (bugzilla link TBD)
 * TBD Bugzilla List
 
-- 
2.12.0.windows.1



------------------------------

Message: 2
Date: Thu, 21 Feb 2019 06:44:12 +0000
From: "Feng, Bob C" <bob.c.feng@intel.com>
To: "Fan, ZhijuX" <zhijux.fan@intel.com>, "edk2-devel@lists.01.org"
	<edk2-devel@lists.01.org>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [edk2] [PATCH] BaseTools:Build fail if define [DEPEX] in
	library inf
Message-ID:
	<08650203BA1BD64D8AD9B6D5D74A85D16008C29F@SHSMSX101.ccr.corp.intel.com>
	
Content-Type: text/plain; charset="us-ascii"

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: Fan, ZhijuX 
Sent: Thursday, February 21, 2019 9:34 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
Subject: [PATCH] BaseTools:Build fail if define [DEPEX] in library inf

When define [DEPEX] in lib inf to build, it will fail and report"
gUefiOvmfPkgTokenSpaceGuid.test1 used in [Depex] section should be used as FixedAtBuild type and VOID* datum type in the module."
But we define this PCD to FixedAtBuild type and VOID* datum type indeed.

DEC:
[PcdsFixedAtBuild]
gUefiOvmfPkgTokenSpaceGuid.test1 |
{GUID("4096267b-da0a-42eb-b5eb-fef31d207cb4")}|VOID*|0x3c

DSC:
add pcd under lib inf as below:

NULL|TestPkg/TestLib/TestLib.inf
 <PcdsFixedAtBuild>
    gUefiOvmfPkgTokenSpaceGuid.test1 | {GUID(gUefiOvmfPkgTokenSpaceGuid)}

Lib inf:(TestPkg/TestLib/TestLib.inf)
[Depex]
gUefiOvmfPkgTokenSpaceGuid.test1
[FixedPcd]
gUefiOvmfPkgTokenSpaceGuid.test1

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 2452ecbcba..81361559b3 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2892,10 +2892,16 @@ class ModuleAutoGen(AutoGen):
                     if '.' not in item:
                         NewList.append(item)
                     else:
-                        if item not in self.FixedVoidTypePcds:
+                        FixedVoidTypePcds = {}
+                        if item in self.FixedVoidTypePcds:
+                            FixedVoidTypePcds = self.FixedVoidTypePcds
+                        elif M in self.PlatformInfo.LibraryAutoGenList:
+                            Index = self.PlatformInfo.LibraryAutoGenList.index(M)
+                            FixedVoidTypePcds = self.PlatformInfo.LibraryAutoGenList[Index].FixedVoidTypePcds
+                        if item not in FixedVoidTypePcds:
                             EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type in the module.".format(item))
                         else:
-                            Value = self.FixedVoidTypePcds[item]
+                            Value = FixedVoidTypePcds[item]
                             if len(Value.split(',')) != 16:
                                 EdkLogger.error("build", FORMAT_INVALID,
                                                 "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type and 16 bytes in the module.".format(item))
--
2.14.1.windows.1



------------------------------

Message: 3
Date: Thu, 21 Feb 2019 06:44:34 +0000
From: "Feng, Bob C" <bob.c.feng@intel.com>
To: "Fan, ZhijuX" <zhijux.fan@intel.com>, "edk2-devel@lists.01.org"
	<edk2-devel@lists.01.org>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [edk2] [PATCH] BaseTools:Some build generated files
	content are not ordered on linux
Message-ID:
	<08650203BA1BD64D8AD9B6D5D74A85D16008C2AF@SHSMSX101.ccr.corp.intel.com>
	
Content-Type: text/plain; charset="us-ascii"

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: Fan, ZhijuX 
Sent: Thursday, February 21, 2019 1:18 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
Subject: [edk2][PATCH] BaseTools:Some build generated files content are not ordered on linux

If the WORKSPACE environment variable has been set,The variables that control stable sorting will not be set.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
---
 edksetup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/edksetup.sh b/edksetup.sh
index a8897d10f8..39f62a29bd 100755
--- a/edksetup.sh
+++ b/edksetup.sh
@@ -49,6 +49,7 @@ function SetWorkspace()
   #
   # If WORKSPACE is already set, then we can return right now
   #
+  export PYTHONHASHSEED=1
   if [ -n "$WORKSPACE" ]
   then
     return 0
@@ -77,7 +78,6 @@ function SetWorkspace()
   # Set $WORKSPACE
   #
   export WORKSPACE=`pwd`
-  export PYTHONHASHSEED=1
   return 0
 }
 
--
2.14.1.windows.1



------------------------------

Message: 4
Date: Thu, 21 Feb 2019 06:53:02 +0000
From: "Gao, Liming" <liming.gao@intel.com>
To: "Gao, Zhichao" <zhichao.gao@intel.com>, "edk2-devel@lists.01.org"
	<edk2-devel@lists.01.org>
Subject: Re: [edk2] [PATCH v4 0/7] ResetSystemLib changings
Message-ID:
	<4A89E2EF3DFEDB4C8BFDE51014F606A14E3E40D2@SHSMSX104.ccr.corp.intel.com>
	
Content-Type: text/plain; charset="us-ascii"

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Zhichao Gao
> Sent: Thursday, February 21, 2019 9:00 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming <liming.gao@intel.com>
> Subject: [edk2] [PATCH v4 0/7] ResetSystemLib changings
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1460
> Add a new API ResetSystem in ResetSystemLib.
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1461
> Implement a runtime library instance of ResetSystemLib base on the new changing.
> 
> V2: Add some required data type header file
> 
> V3: Resolve a case-typing error.
> 
> V4: Change the ResetSystemRuntimeDxe/ResetSystem.c name to RuntimeServiceResetSystem.
> Add a new interface for PEI version ResetSystemLib.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> 
> Zhichao Gao (7):
>   MdeModulePkg: change the function name ResetSystem
>   MdeModulePkg: Add the new API ResetSystem in the head file
>   MdeModulePkg: Add a new API ResetSystem for DXE ResetSystemLib
>   MdeModulePkg: Add a new API ResetSystem for Null version
>   MdeModulePkg: Add a new API ResetSystem for PEI ResetSystemLib
>   MdeModulePkg: Add a runtime library instance of ResetSystemLib
>   MdeModulePkg: Add the runtime ResetSystemLib in MdeModulePkg.dsc
> 
>  MdeModulePkg/Include/Library/ResetSystemLib.h      |  28 ++-
>  .../BaseResetSystemLibNull.c                       |  27 +++
>  .../Library/DxeResetSystemLib/DxeResetSystemLib.c  |  28 ++-
>  .../Library/PeiResetSystemLib/PeiResetSystemLib.c  |  28 ++-
>  .../RuntimeResetSystemLib/RuntimeResetSystemLib.c  | 216 +++++++++++++++++++++
>  .../RuntimeResetSystemLib.inf                      |  50 +++++
>  .../RuntimeResetSystemLib.uni                      |  21 ++
>  MdeModulePkg/MdeModulePkg.dsc                      |   1 +
>  .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  |   8 +-
>  .../Universal/ResetSystemRuntimeDxe/ResetSystem.h  |   4 +-
>  10 files changed, 402 insertions(+), 9 deletions(-)
>  create mode 100644 MdeModulePkg/Library/RuntimeResetSystemLib/RuntimeResetSystemLib.c
>  create mode 100644 MdeModulePkg/Library/RuntimeResetSystemLib/RuntimeResetSystemLib.inf
>  create mode 100644 MdeModulePkg/Library/RuntimeResetSystemLib/RuntimeResetSystemLib.uni
> 
> --
> 2.16.2.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


------------------------------

Message: 5
Date: Thu, 21 Feb 2019 09:36:37 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: "Ni, Ray" <ray.ni@Intel.com>, edk2-devel@lists.01.org
Cc: Dandan Bi <dandan.bi@intel.com>, Hao Wu <hao.a.wu@intel.com>, Jian
	J Wang <jian.j.wang@intel.com>, Sean Brogan
	<sean.brogan@microsoft.com>, Star Zeng <star.zeng@intel.com>
Subject: Re: [edk2] [PATCH v2 1/5] MdeModulePkg/UefiBootManagerLib:
	fix LoadImage/StartImage status code rep.
Message-ID: <9e5cad87-5f32-37e4-210a-afb904089aff@redhat.com>
Content-Type: text/plain; charset=utf-8

On 02/20/19 14:17, Ni, Ray wrote:
> On 2/20/2019 4:16 PM, Laszlo Ersek wrote:
>> In the EFI_RETURN_STATUS_EXTENDED_DATA structure from PI-1.7, there
>> may be
>> padding between the DataHeader and ReturnStatus members. The
>> REPORT_STATUS_CODE_EX() macro starts populating the structure immediately
>> after DataHeader, therefore the source data must provide for the padding.
>>
>> Extract the BmReportImageFailure() function from EfiBootManagerBoot(),
>> prepare a zero padding (if any) in a temporary
>> EFI_RETURN_STATUS_EXTENDED_DATA object, and fix the
>> REPORT_STATUS_CODE_EX() macro invocation.
>>
>> Cc: Dandan Bi <dandan.bi@intel.com>
>> Cc: Hao Wu <hao.a.wu@intel.com>
>> Cc: Jian J Wang <jian.j.wang@intel.com>
>> Cc: Ray Ni <ray.ni@intel.com>
>> Cc: Sean Brogan <sean.brogan@microsoft.com>
>> Cc: Star Zeng <star.zeng@intel.com>
>> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=1539
>> Fixes: c2cf8720a5aad74230767a1f11bade2d86de3745
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
>> ---
>>
>> Notes:
>> ???? v2:
>> ???? - new in v2
>>
>> ? MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h |? 1 +
>> ? MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c???? | 69
>> +++++++++++++++-----
>> ? 2 files changed, 52 insertions(+), 18 deletions(-)
>>
>> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
>> b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
>> index 978fbff966f6..0fef63fceedf 100644
>> --- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
>> +++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
>> @@ -51,6 +51,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
>> EITHER EXPRESS OR IMPLIED.
>> ? #include <Guid/MemoryTypeInformation.h>
>> ? #include <Guid/FileInfo.h>
>> ? #include <Guid/GlobalVariable.h>
>> +#include <Guid/StatusCodeDataTypeId.h>
>> ? #include <Guid/StatusCodeDataTypeVariable.h>
>> ? ? #include <Library/PrintLib.h>
>> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
>> b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
>> index 9be1633b7480..ffb98c6c9b83 100644
>> --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
>> +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
>> @@ -1667,6 +1667,55 @@ BmIsBootManagerMenuFilePath (
>> ??? return FALSE;
>> ? }
>> ? +/**
>> +? Report status code with EFI_RETURN_STATUS_EXTENDED_DATA about
>> LoadImage() or
>> +? StartImage() failure.
>> +
>> +? @param[in] ErrorCode????? An Error Code in the Software Class, DXE
>> Boot
>> +??????????????????????????? Service Driver Subclass. ErrorCode will
>> be used to
>> +??????????????????????????? compose the Value parameter for status code
>> +??????????????????????????? reporting. Must be one of
>> +??????????????????????????? EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR and
>> +??????????????????????????? EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED.
>> +
>> +? @param[in] FailureStatus? The failure status returned by the boot
>> service
>> +??????????????????????????? that should be reported.
>> +**/
>> +VOID
>> +BmReportImageFailure (
> Laszlo,
> Thanks for quick fixing this issue.
> To match the status code it reports, how about rename the function as
> "BmReportLoadFailure"?

Sure, I can do that.

> Another minor comments in below.
>> +? IN UINT32???? ErrorCode,
>> +? IN EFI_STATUS FailureStatus
>> +? )
>> +{
>> +? EFI_RETURN_STATUS_EXTENDED_DATA ExtendedData;
>> +? VOID??????????????????????????? *PaddingStart;
>> +? UINTN?????????????????????????? PaddingSize;
>> +
>> +? if (!ReportErrorCodeEnabled ()) {
>> +??? return;
>> +? }
>> +
>> +? ASSERT (
>> +??? (ErrorCode == EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR) ||
>> +??? (ErrorCode == EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED)
>> +??? );
>> +
>> +? PaddingStart = &ExtendedData.DataHeader + 1;
>> +? PaddingSize = (UINTN) &ExtendedData.ReturnStatus - (UINTN)
>> PaddingStart;
>> +? ZeroMem (PaddingStart, PaddingSize);
> 
> I prefer "ZeroMem (&ExtendedData, sizeof (ExtendedData))" instead of
> introducing local variables such as PaddingStart/PaddingSize.
> This makes code more good-looking:).

I agree that that looks more natural. I didn't know how much you'd like
me to "optimize" this logic. Because,

(1) an optimizing compiler can eliminate PaddingSize from the ZeroMem()
call (replacing it with a constant); in other words, the PaddingSize
calculation would have no runtime cost,

(2) the ZeroMem() call would have to clear fewer bytes.

I hesitated between the smallest possible ZeroMem() and the
easiest-to-read ZeroMem(). I will rework it in v3.


> 
>> +? ExtendedData.ReturnStatus = FailureStatus;
>> +
>> +? REPORT_STATUS_CODE_EX (
>> +??? (EFI_ERROR_CODE | EFI_ERROR_MINOR),
>> +??? (EFI_SOFTWARE_DXE_BS_DRIVER | ErrorCode),
>> +??? 0,
>> +??? NULL,
>> +??? NULL,
>> +??? PaddingStart,
> &ExtendedData.DataHeader + 1
> 
>> +??? PaddingSize + sizeof (ExtendedData.ReturnStatus)
> sizeof (ExtendedData) - sizeof (ExtendedData.DataHeader)

Yes.

Thanks,
Laszlo

>> +??? );
>> +}
>> +
>> ? /**
>> ??? Attempt to boot the EFI boot option. This routine sets
>> L"BootCurent" and
>> ??? also signals the EFI ready to boot event. If the device path for
>> the option
>> @@ -1822,15 +1871,7 @@ EfiBootManagerBoot (
>> ??????? //
>> ??????? // Report Status Code with the failure status to indicate that
>> the failure to load boot option
>> ??????? //
>> -????? REPORT_STATUS_CODE_EX (
>> -??????? EFI_ERROR_CODE | EFI_ERROR_MINOR,
>> -??????? (EFI_SOFTWARE_DXE_BS_DRIVER |
>> EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR),
>> -??????? 0,
>> -??????? NULL,
>> -??????? NULL,
>> -??????? &Status,
>> -??????? sizeof (EFI_STATUS)
>> -??????? );
>> +????? BmReportImageFailure (EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR,
>> Status);
>> ??????? BootOption->Status = Status;
>> ??????? //
>> ??????? // Destroy the RAM disk
>> @@ -1911,15 +1952,7 @@ EfiBootManagerBoot (
>> ????? //
>> ????? // Report Status Code with the failure status to indicate that
>> boot failure
>> ????? //
>> -??? REPORT_STATUS_CODE_EX (
>> -????? EFI_ERROR_CODE | EFI_ERROR_MINOR,
>> -????? (EFI_SOFTWARE_DXE_BS_DRIVER |
>> EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED),
>> -????? 0,
>> -????? NULL,
>> -????? NULL,
>> -????? &Status,
>> -????? sizeof (EFI_STATUS)
>> -????? );
>> +??? BmReportImageFailure (EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED, Status);
>> ??? }
>> ??? PERF_END_EX (gImageHandle, "BdsAttempt", NULL, 0, (UINT32)
>> OptionNumber);
>> ?
> 
> 



------------------------------

Message: 6
Date: Thu, 21 Feb 2019 09:55:52 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: "Doran, Mark" <mark.doran@intel.com>, "Ni, Ray"
	<ray.ni@intel.com>, "Bi, Dandan" <dandan.bi@intel.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>, "Wu, Hao A"
	<hao.a.wu@intel.com>
Subject: Re: [edk2] [patch 2/2] MdeModulePkg/BmBoot: Report status
	when fail to load/start boot option
Message-ID: <08ffc80e-2e37-5317-182c-5da1391d0ff4@redhat.com>
Content-Type: text/plain; charset=utf-8

On 02/20/19 18:19, Doran, Mark wrote:
>> -----Original Message-----
>> From: Laszlo Ersek [mailto:lersek@redhat.com]
>> Sent: Wednesday, February 20, 2019 1:25 AM
>> To: Ni, Ray <ray.ni@intel.com>; Bi, Dandan <dandan.bi@intel.com>
>> Cc: edk2-devel@lists.01.org; Wu, Hao A <hao.a.wu@intel.com>; Doran, Mark
>> <mark.doran@intel.com>
>> Subject: Re: [edk2] [patch 2/2] MdeModulePkg/BmBoot: Report status when
>> fail to load/start boot option
>>
>> +Mark, for my comments on the process
> 
> Thank you :)
>  
>> On 02/20/19 03:21, Ni, Ray wrote:
>>> Laszlo,
>>> Thanks for catching this.
>>>
>>> GenPerformMemoryTest() in
>>> MdeModulePkg\Universal\MemoryTest\GenericMemoryTestDxe\LightMemoryTest
>>> .c uses the same technics as you suggested.
>>>
>>> I give up to propose another option: having pack(1) for the new status
>> structure.
>>
>> I think that byte-packing EFI_RETURN_STATUS_EXTENDED_DATA in the PI-1.7
>> spec would have been viable, but we should have thought about that in
>> advance. The PI and UEFI specs require natural alignment for structure
>> members, unless stated otherwise. There *are* a number of examples of
>> "stated otherwise" (the term that the specs use is frequently "byte-packed
>> structure"). Again, we should have thought of that in advance, before PI-
>> 1.7 was released, so now we can only fix the way the object is populated.
> 
> Agreed.
>  
>> More generally, I think this demonstrates a flaw in the standardization
>> process. PIWG and USWG should only standardize existing practice; that is,
>> features that have at least one functional implementation. (Not necessarily
>> open source, but the interfaces should be battle-hardened
>> *first*.) The restriction where we can't even propose patches for edk2
>> before the standards are updated is very counter-productive. There's
>> practically zero chance for getting an actual implementation peer-reviewed
>> and peer-tested before proposing the API for the standard.
>>
>> Personally I have suggested in the past to implement some new features as
>> edk2 extensions first, and once they work, to upstream them to the
>> standards. This idea is usually rejected by maintainers, because
>> maintainers worry about becoming stuck with more and more edk2 extensions
>> to core code (i.e., they worry about the feature proponents not making good
>> on their promise to standardize). Unfortunately, the alternative (= the
>> current practice) is that we standardize speculative interfaces, which then
>> prove suboptimal once we implement them.
> 
> So personally I'm a big believer in having working code for things we write down in the standards.  When EFI was first drafted that's how we did it: what was then known as "the sample implementation" and the actual spec content were more or less developed in parallel and the spec wasn't done until the code was working satisfactorily.  We got away from that largely because when the UEFI Forum was formed, there was nominal interest in promoting more than one implementation and keeping spec and code requirements separate was a part of that.
> 
> Recent changes, particularly inside Intel, present an opportunity for us to revisit this issue.  I'm advocating for the approach of spec-follows-code for new Contributions that Intel will make to the open source project going forward.  I'll have more to say about this at upcoming industry events.
> 

Sounds fantastic! Thank you!
Laszlo


------------------------------

Message: 7
Date: Thu, 21 Feb 2019 10:04:35 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>, Jagadeesh Ujja
	<jagadeesh.ujja@arm.com>, "Zeng, Star" <star.zeng@intel.com>, "Yao,
	Jiewen" <Jiewen.Yao@intel.com>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>, "Gao, Liming"
	<liming.gao@intel.com>, "edk2-devel@lists.01.org"
	<edk2-devel@lists.01.org>, "Zhang, Chao B" <chao.b.zhang@intel.com>
Subject: Re: [edk2] [PATCH] MdeModulePkg/VariableSmmRuntimeDxe:
	Refactor locating Variable Arch Protocol
Message-ID: <615a9ac8-1ca9-94e1-a473-b251dae57460@redhat.com>
Content-Type: text/plain; charset=utf-8

On 02/20/19 13:23, Ard Biesheuvel wrote:
> On Wed, 20 Feb 2019 at 06:53, Jagadeesh Ujja <jagadeesh.ujja@arm.com> wrote:
>>
>> hi Ard,
>> On Tue, Feb 19, 2019 at 6:55 PM Ard Biesheuvel
>> <ard.biesheuvel@linaro.org> wrote:
>>>
>>> Hello Jagadeesh,
>>>
>>> On Tue, 19 Feb 2019 at 11:47, Jagadeesh Ujja <jagadeesh.ujja@arm.com> wrote:
>>>>
>>>> In preparation for providing a standalone MM based non-secure variable
>>>> runtime driver, factor out some portions that are specific to the
>>>> traditional driver, mainly related to locating variable arch protocol
>>>> and variable write arch protocol, which are not required to be located
>>>> when using standalone MM based secure variable implementation.
>>>>
>>>
>>> While i think this change is correct from a technical perspective, I
>>> don't think this is the right approach.
>>>
>> these changes are mandatory, this is one of the possible solution.
>>
>>> It was a deliberate decision to expose the MM services in a way that
>>> only the producer of the communication protocol is aware of the
>>> implementation details, i.e., whether it is backed by tradtional MM or
>>> standalone MM.
>>>
>> can you please provide more details on how "exposing the MM services"
>> will help to resolve the issue here. if this helps, definitely i will use that.
>>
> 
> Let me rephrase this for the benefit of the MdeModulePkg maintainers,
> and ask them their opinion.
> 
> Currently, the DXE runtime driver that produces the architectural
> varstore protocols that are based on communication with MM components
> living elsewhere, rely on the EFI protocol database for sequencing.
> I.e., after dispatch, they wait for certain protocols to be installed
> into the DXE protocol database by the SMM drivers before proceeding to
> install the variable arch protocols.
> 
> This does not work for standalone MM, since it has no access to the
> DXE protocol database, nor is it needed, since it may be assumed that
> the MM execution context is fully configured by the time the DXE phase
> starts.
> 
> Jagadeesh's proposal is to factor this out, and create two different
> .INFs to build the same DXE runtime driver in two different ways. This
> defeats the purpose of having an abstract MM communication protocol,
> so it is something I would like to avoid. On the other hand, is it not
> obvious how to parameterize this requirement in another way.
> 
> For the moment, I could live with putting this into a library, and
> leave it up to the platform to ensure the combination of the library
> resolution with the driver that produces the MM communicate protocol
> is a sane one.
> 
> Any thoughts?

I think I'm missing the gist of the library approach; still, would it be
possible for affected platforms (i.e. those that depend on standalone
MM) to procude the necessary DXE protocols (for unblocking the variable
runtime driver) in a platform DXE driver?

Thanks
Laszlo


------------------------------

Message: 8
Date: Thu, 21 Feb 2019 10:11:44 +0100
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Jagadeesh Ujja <jagadeesh.ujja@arm.com>, "Zeng, Star"
	<star.zeng@intel.com>, "Yao, Jiewen" <Jiewen.Yao@intel.com>, "Kinney,
	Michael D" <michael.d.kinney@intel.com>,  "Gao, Liming"
	<liming.gao@intel.com>, "edk2-devel@lists.01.org"
	<edk2-devel@lists.01.org>,  "Zhang, Chao B" <chao.b.zhang@intel.com>
Subject: Re: [edk2] [PATCH] MdeModulePkg/VariableSmmRuntimeDxe:
	Refactor locating Variable Arch Protocol
Message-ID:
	<CAKv+Gu-z-w9QzgH1gPT4kA4rXz+bpLNdYyCpjTd1RGbO28mXsQ@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

On Thu, 21 Feb 2019 at 10:04, Laszlo Ersek <lersek@redhat.com> wrote:
>
> On 02/20/19 13:23, Ard Biesheuvel wrote:
> > On Wed, 20 Feb 2019 at 06:53, Jagadeesh Ujja <jagadeesh.ujja@arm.com> wrote:
> >>
> >> hi Ard,
> >> On Tue, Feb 19, 2019 at 6:55 PM Ard Biesheuvel
> >> <ard.biesheuvel@linaro.org> wrote:
> >>>
> >>> Hello Jagadeesh,
> >>>
> >>> On Tue, 19 Feb 2019 at 11:47, Jagadeesh Ujja <jagadeesh.ujja@arm.com> wrote:
> >>>>
> >>>> In preparation for providing a standalone MM based non-secure variable
> >>>> runtime driver, factor out some portions that are specific to the
> >>>> traditional driver, mainly related to locating variable arch protocol
> >>>> and variable write arch protocol, which are not required to be located
> >>>> when using standalone MM based secure variable implementation.
> >>>>
> >>>
> >>> While i think this change is correct from a technical perspective, I
> >>> don't think this is the right approach.
> >>>
> >> these changes are mandatory, this is one of the possible solution.
> >>
> >>> It was a deliberate decision to expose the MM services in a way that
> >>> only the producer of the communication protocol is aware of the
> >>> implementation details, i.e., whether it is backed by tradtional MM or
> >>> standalone MM.
> >>>
> >> can you please provide more details on how "exposing the MM services"
> >> will help to resolve the issue here. if this helps, definitely i will use that.
> >>
> >
> > Let me rephrase this for the benefit of the MdeModulePkg maintainers,
> > and ask them their opinion.
> >
> > Currently, the DXE runtime driver that produces the architectural
> > varstore protocols that are based on communication with MM components
> > living elsewhere, rely on the EFI protocol database for sequencing.
> > I.e., after dispatch, they wait for certain protocols to be installed
> > into the DXE protocol database by the SMM drivers before proceeding to
> > install the variable arch protocols.
> >
> > This does not work for standalone MM, since it has no access to the
> > DXE protocol database, nor is it needed, since it may be assumed that
> > the MM execution context is fully configured by the time the DXE phase
> > starts.
> >
> > Jagadeesh's proposal is to factor this out, and create two different
> > .INFs to build the same DXE runtime driver in two different ways. This
> > defeats the purpose of having an abstract MM communication protocol,
> > so it is something I would like to avoid. On the other hand, is it not
> > obvious how to parameterize this requirement in another way.
> >
> > For the moment, I could live with putting this into a library, and
> > leave it up to the platform to ensure the combination of the library
> > resolution with the driver that produces the MM communicate protocol
> > is a sane one.
> >
> > Any thoughts?
>
> I think I'm missing the gist of the library approach; still, would it be
> possible for affected platforms (i.e. those that depend on standalone
> MM) to procude the necessary DXE protocols (for unblocking the variable
> runtime driver) in a platform DXE driver?
>

Yes, that is the other option: we could create a library that
unconditionally produces those protocols and hook it into the MM
communication driver via NULL library class resolution.


------------------------------

Message: 9
Date: Thu, 21 Feb 2019 17:33:05 +0800
From: "Zeng, Star" <star.zeng@intel.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>, Laszlo Ersek
	<lersek@redhat.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>, "Gao, Liming"
	<liming.gao@intel.com>, "Yao, Jiewen" <Jiewen.Yao@intel.com>, "Zhang,
	Chao B" <chao.b.zhang@intel.com>, "Kinney, Michael D"
	<michael.d.kinney@intel.com>, star.zeng@intel.com
Subject: Re: [edk2] [PATCH] MdeModulePkg/VariableSmmRuntimeDxe:
	Refactor locating Variable Arch Protocol
Message-ID: <d283153c-145f-f40a-52d4-0845188b1fe8@intel.com>
Content-Type: text/plain; charset=utf-8; format=flowed

On 2019/2/21 17:11, Ard Biesheuvel wrote:
> On Thu, 21 Feb 2019 at 10:04, Laszlo Ersek <lersek@redhat.com> wrote:
>>
>> On 02/20/19 13:23, Ard Biesheuvel wrote:
>>> On Wed, 20 Feb 2019 at 06:53, Jagadeesh Ujja <jagadeesh.ujja@arm.com> wrote:
>>>>
>>>> hi Ard,
>>>> On Tue, Feb 19, 2019 at 6:55 PM Ard Biesheuvel
>>>> <ard.biesheuvel@linaro.org> wrote:
>>>>>
>>>>> Hello Jagadeesh,
>>>>>
>>>>> On Tue, 19 Feb 2019 at 11:47, Jagadeesh Ujja <jagadeesh.ujja@arm.com> wrote:
>>>>>>
>>>>>> In preparation for providing a standalone MM based non-secure variable
>>>>>> runtime driver, factor out some portions that are specific to the
>>>>>> traditional driver, mainly related to locating variable arch protocol
>>>>>> and variable write arch protocol, which are not required to be located
>>>>>> when using standalone MM based secure variable implementation.
>>>>>>
>>>>>
>>>>> While i think this change is correct from a technical perspective, I
>>>>> don't think this is the right approach.
>>>>>
>>>> these changes are mandatory, this is one of the possible solution.
>>>>
>>>>> It was a deliberate decision to expose the MM services in a way that
>>>>> only the producer of the communication protocol is aware of the
>>>>> implementation details, i.e., whether it is backed by tradtional MM or
>>>>> standalone MM.
>>>>>
>>>> can you please provide more details on how "exposing the MM services"
>>>> will help to resolve the issue here. if this helps, definitely i will use that.
>>>>
>>>
>>> Let me rephrase this for the benefit of the MdeModulePkg maintainers,
>>> and ask them their opinion.
>>>
>>> Currently, the DXE runtime driver that produces the architectural
>>> varstore protocols that are based on communication with MM components
>>> living elsewhere, rely on the EFI protocol database for sequencing.
>>> I.e., after dispatch, they wait for certain protocols to be installed
>>> into the DXE protocol database by the SMM drivers before proceeding to
>>> install the variable arch protocols.
>>>
>>> This does not work for standalone MM, since it has no access to the
>>> DXE protocol database, nor is it needed, since it may be assumed that
>>> the MM execution context is fully configured by the time the DXE phase
>>> starts.
>>>
>>> Jagadeesh's proposal is to factor this out, and create two different
>>> .INFs to build the same DXE runtime driver in two different ways. This
>>> defeats the purpose of having an abstract MM communication protocol,
>>> so it is something I would like to avoid. On the other hand, is it not
>>> obvious how to parameterize this requirement in another way.
>>>
>>> For the moment, I could live with putting this into a library, and
>>> leave it up to the platform to ensure the combination of the library
>>> resolution with the driver that produces the MM communicate protocol
>>> is a sane one.
>>>
>>> Any thoughts?
>>
>> I think I'm missing the gist of the library approach; still, would it be
>> possible for affected platforms (i.e. those that depend on standalone
>> MM) to procude the necessary DXE protocols (for unblocking the variable
>> runtime driver) in a platform DXE driver?
>>
> 
> Yes, that is the other option: we could create a library that
> unconditionally produces those protocols and hook it into the MM
> communication driver via NULL library class resolution.
> 

I am not familiar with standalone MM, either ARM. So may have no much 
valuable opinion.

For this case, standalone MM could not install DXE protocols into DXE 
protocol database to notify the wrapper (VariableSmmRuntimeDxe), so need 
another way to install the DXE protocols, right?
Could standalone MM assume the MM handler for variable is ready when MM 
communication driver runs?
If yes, a NULL library instance should work (as a stub to install the 
DXE protocols in its constructor). :)


Thanks,
Star


------------------------------

Message: 10
Date: Thu, 21 Feb 2019 10:45:37 +0100
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: "Zeng, Star" <star.zeng@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>, "edk2-devel@lists.01.org"
	<edk2-devel@lists.01.org>,  "Gao, Liming" <liming.gao@intel.com>,
	"Yao, Jiewen" <Jiewen.Yao@intel.com>,  "Zhang, Chao B"
	<chao.b.zhang@intel.com>, "Kinney, Michael D"
	<michael.d.kinney@intel.com>
Subject: Re: [edk2] [PATCH] MdeModulePkg/VariableSmmRuntimeDxe:
	Refactor locating Variable Arch Protocol
Message-ID:
	<CAKv+Gu_QzHt-_k_vWT4Y4d=S0b-=wvKxKykYZMqGr8JD=HMD1Q@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

On Thu, 21 Feb 2019 at 10:33, Zeng, Star <star.zeng@intel.com> wrote:
>
> On 2019/2/21 17:11, Ard Biesheuvel wrote:
> > On Thu, 21 Feb 2019 at 10:04, Laszlo Ersek <lersek@redhat.com> wrote:
> >>
> >> On 02/20/19 13:23, Ard Biesheuvel wrote:
> >>> On Wed, 20 Feb 2019 at 06:53, Jagadeesh Ujja <jagadeesh.ujja@arm.com> wrote:
> >>>>
> >>>> hi Ard,
> >>>> On Tue, Feb 19, 2019 at 6:55 PM Ard Biesheuvel
> >>>> <ard.biesheuvel@linaro.org> wrote:
> >>>>>
> >>>>> Hello Jagadeesh,
> >>>>>
> >>>>> On Tue, 19 Feb 2019 at 11:47, Jagadeesh Ujja <jagadeesh.ujja@arm.com> wrote:
> >>>>>>
> >>>>>> In preparation for providing a standalone MM based non-secure variable
> >>>>>> runtime driver, factor out some portions that are specific to the
> >>>>>> traditional driver, mainly related to locating variable arch protocol
> >>>>>> and variable write arch protocol, which are not required to be located
> >>>>>> when using standalone MM based secure variable implementation.
> >>>>>>
> >>>>>
> >>>>> While i think this change is correct from a technical perspective, I
> >>>>> don't think this is the right approach.
> >>>>>
> >>>> these changes are mandatory, this is one of the possible solution.
> >>>>
> >>>>> It was a deliberate decision to expose the MM services in a way that
> >>>>> only the producer of the communication protocol is aware of the
> >>>>> implementation details, i.e., whether it is backed by tradtional MM or
> >>>>> standalone MM.
> >>>>>
> >>>> can you please provide more details on how "exposing the MM services"
> >>>> will help to resolve the issue here. if this helps, definitely i will use that.
> >>>>
> >>>
> >>> Let me rephrase this for the benefit of the MdeModulePkg maintainers,
> >>> and ask them their opinion.
> >>>
> >>> Currently, the DXE runtime driver that produces the architectural
> >>> varstore protocols that are based on communication with MM components
> >>> living elsewhere, rely on the EFI protocol database for sequencing.
> >>> I.e., after dispatch, they wait for certain protocols to be installed
> >>> into the DXE protocol database by the SMM drivers before proceeding to
> >>> install the variable arch protocols.
> >>>
> >>> This does not work for standalone MM, since it has no access to the
> >>> DXE protocol database, nor is it needed, since it may be assumed that
> >>> the MM execution context is fully configured by the time the DXE phase
> >>> starts.
> >>>
> >>> Jagadeesh's proposal is to factor this out, and create two different
> >>> .INFs to build the same DXE runtime driver in two different ways. This
> >>> defeats the purpose of having an abstract MM communication protocol,
> >>> so it is something I would like to avoid. On the other hand, is it not
> >>> obvious how to parameterize this requirement in another way.
> >>>
> >>> For the moment, I could live with putting this into a library, and
> >>> leave it up to the platform to ensure the combination of the library
> >>> resolution with the driver that produces the MM communicate protocol
> >>> is a sane one.
> >>>
> >>> Any thoughts?
> >>
> >> I think I'm missing the gist of the library approach; still, would it be
> >> possible for affected platforms (i.e. those that depend on standalone
> >> MM) to procude the necessary DXE protocols (for unblocking the variable
> >> runtime driver) in a platform DXE driver?
> >>
> >
> > Yes, that is the other option: we could create a library that
> > unconditionally produces those protocols and hook it into the MM
> > communication driver via NULL library class resolution.
> >
>
> I am not familiar with standalone MM, either ARM. So may have no much
> valuable opinion.
>
> For this case, standalone MM could not install DXE protocols into DXE
> protocol database to notify the wrapper (VariableSmmRuntimeDxe), so need
> another way to install the DXE protocols, right?

Yes

> Could standalone MM assume the MM handler for variable is ready when MM
> communication driver runs?

Yes

> If yes, a NULL library instance should work (as a stub to install the
> DXE protocols in its constructor). :)
>

Yes, that was my suggestion.

So Jagadeesh, could you please take this approach instead?

- Create a library in StandaloneMmPkg with LIBRARY_CLASS = NULL and a
constructor that installs the two protocols.
- Update your platform so that the MM communication driver is included as

ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf {
  <LibraryClasses>
    NULL|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
}

I don't think this will violate any ordering constraints, given that
the drivers that have a dependency on these protocols also have a
dependency on the MM communicate driver itself.

Thanks,
Ard.


------------------------------

Message: 11
Date: Thu, 21 Feb 2019 11:41:07 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel@lists.01.org
Cc: Anthony Perard <anthony.perard@citrix.com>, Ard Biesheuvel
	<ard.biesheuvel@linaro.org>, Dandan Bi <dandan.bi@intel.com>, Hao Wu
	<hao.a.wu@intel.com>, Jian J Wang <jian.j.wang@intel.com>, Jordan
	Justen <jordan.l.justen@intel.com>, Julien Grall
	<julien.grall@linaro.org>, Ray Ni <ray.ni@intel.com>, Sean Brogan
	<sean.brogan@microsoft.com>, Star Zeng <star.zeng@intel.com>
Subject: [edk2] [PATCH v3 0/5] MdeModulePkg, OvmfPkg, ArmVirtPkg: more
	visible boot progress reporting
Message-ID: <20190221104112.14995-1-lersek@redhat.com>

Repo:   https://github.com/lersek/edk2.git
Branch: boot_diags_v3

Addressing feedback for v2, which was posted at:

  https://lists.01.org/pipermail/edk2-devel/2019-February/036965.html
  http://mid.mail-archive.com/20190220081644.8238-1-lersek@redhat.com

Changes are noted per patch.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien.grall@linaro.org>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Star Zeng <star.zeng@intel.com>

Thanks!
Laszlo

Laszlo Ersek (5):
  MdeModulePkg/UefiBootManagerLib: fix LoadImage/StartImage status code
    rep.
  OvmfPkg: add library to track boot option loading/starting on the
    console
  OvmfPkg/PlatformBootManagerLib: display boot option loading/starting
  ArmVirtPkg/ArmVirtQemu*: enable minimal Status Code Routing in DXE
  ArmVirtPkg/PlatformBootManagerLib: display boot option
    loading/starting

 ArmVirtPkg/ArmVirtQemu.dsc                                           |  11 +
 ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc                                 |   5 +
 ArmVirtPkg/ArmVirtQemuKernel.dsc                                     |  11 +
 ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c               |   3 +
 ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf |   1 +
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c                     |  65 ++--
 MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h                 |   1 +
 OvmfPkg/Include/Library/PlatformBmPrintScLib.h                       |  41 +++
 OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf        |  66 +++++
 OvmfPkg/Library/PlatformBmPrintScLib/StatusCodeHandler.c             | 310 ++++++++++++++++++++
 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c                 |   3 +
 OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf    |   1 +
 OvmfPkg/OvmfPkg.dec                                                  |   5 +
 OvmfPkg/OvmfPkgIa32.dsc                                              |   1 +
 OvmfPkg/OvmfPkgIa32X64.dsc                                           |   1 +
 OvmfPkg/OvmfPkgX64.dsc                                               |   1 +
 16 files changed, 508 insertions(+), 18 deletions(-)
 create mode 100644 OvmfPkg/Include/Library/PlatformBmPrintScLib.h
 create mode 100644 OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf
 create mode 100644 OvmfPkg/Library/PlatformBmPrintScLib/StatusCodeHandler.c

-- 
2.19.1.3.g30247aa5d201



------------------------------

Message: 12
Date: Thu, 21 Feb 2019 11:41:08 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel@lists.01.org
Cc: Dandan Bi <dandan.bi@intel.com>, Hao Wu <hao.a.wu@intel.com>, Jian
	J Wang <jian.j.wang@intel.com>, Ray Ni <ray.ni@intel.com>, Sean Brogan
	<sean.brogan@microsoft.com>, Star Zeng <star.zeng@intel.com>
Subject: [edk2] [PATCH v3 1/5] MdeModulePkg/UefiBootManagerLib: fix
	LoadImage/StartImage status code rep.
Message-ID: <20190221104112.14995-2-lersek@redhat.com>

In the EFI_RETURN_STATUS_EXTENDED_DATA structure from PI-1.7, there may be
padding between the DataHeader and ReturnStatus members. The
REPORT_STATUS_CODE_EX() macro starts populating the structure immediately
after DataHeader, therefore the source data must provide for the padding.

Extract the BmReportLoadFailure() function from EfiBootManagerBoot(),
prepare a zero padding (if any) in a temporary
EFI_RETURN_STATUS_EXTENDED_DATA object, and fix the
REPORT_STATUS_CODE_EX() macro invocation.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Star Zeng <star.zeng@intel.com>
Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=1539
Fixes: c2cf8720a5aad74230767a1f11bade2d86de3745
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    v3:
    
    - rename BmReportImageFailure() to BmReportLoadFailure() [Ray]
    
    - eliminate PaddingStart and PaddingSize; zero out the full ExtendedData
      struct [Ray]
    
    - don't pick up Ard's R-b due to the change above being functional in
      nature
    
    v2:
    - new in v2

 MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h |  1 +
 MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c     | 65 ++++++++++++++------
 2 files changed, 48 insertions(+), 18 deletions(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
index 978fbff966f6..0fef63fceedf 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
+++ b/MdeModulePkg/Library/UefiBootManagerLib/InternalBm.h
@@ -51,6 +51,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Guid/MemoryTypeInformation.h>
 #include <Guid/FileInfo.h>
 #include <Guid/GlobalVariable.h>
+#include <Guid/StatusCodeDataTypeId.h>
 #include <Guid/StatusCodeDataTypeVariable.h>
 
 #include <Library/PrintLib.h>
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
index 9be1633b7480..02ff354ef6a3 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
@@ -1667,6 +1667,51 @@ BmIsBootManagerMenuFilePath (
   return FALSE;
 }
 
+/**
+  Report status code with EFI_RETURN_STATUS_EXTENDED_DATA about LoadImage() or
+  StartImage() failure.
+
+  @param[in] ErrorCode      An Error Code in the Software Class, DXE Boot
+                            Service Driver Subclass. ErrorCode will be used to
+                            compose the Value parameter for status code
+                            reporting. Must be one of
+                            EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR and
+                            EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED.
+
+  @param[in] FailureStatus  The failure status returned by the boot service
+                            that should be reported.
+**/
+VOID
+BmReportLoadFailure (
+  IN UINT32     ErrorCode,
+  IN EFI_STATUS FailureStatus
+  )
+{
+  EFI_RETURN_STATUS_EXTENDED_DATA ExtendedData;
+
+  if (!ReportErrorCodeEnabled ()) {
+    return;
+  }
+
+  ASSERT (
+    (ErrorCode == EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR) ||
+    (ErrorCode == EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED)
+    );
+
+  ZeroMem (&ExtendedData, sizeof (ExtendedData));
+  ExtendedData.ReturnStatus = FailureStatus;
+
+  REPORT_STATUS_CODE_EX (
+    (EFI_ERROR_CODE | EFI_ERROR_MINOR),
+    (EFI_SOFTWARE_DXE_BS_DRIVER | ErrorCode),
+    0,
+    NULL,
+    NULL,
+    &ExtendedData.DataHeader + 1,
+    sizeof (ExtendedData) - sizeof (ExtendedData.DataHeader)
+    );
+}
+
 /**
   Attempt to boot the EFI boot option. This routine sets L"BootCurent" and
   also signals the EFI ready to boot event. If the device path for the option
@@ -1822,15 +1867,7 @@ EfiBootManagerBoot (
       //
       // Report Status Code with the failure status to indicate that the failure to load boot option
       //
-      REPORT_STATUS_CODE_EX (
-        EFI_ERROR_CODE | EFI_ERROR_MINOR,
-        (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR),
-        0,
-        NULL,
-        NULL,
-        &Status,
-        sizeof (EFI_STATUS)
-        );
+      BmReportLoadFailure (EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR, Status);
       BootOption->Status = Status;
       //
       // Destroy the RAM disk
@@ -1911,15 +1948,7 @@ EfiBootManagerBoot (
     //
     // Report Status Code with the failure status to indicate that boot failure
     //
-    REPORT_STATUS_CODE_EX (
-      EFI_ERROR_CODE | EFI_ERROR_MINOR,
-      (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED),
-      0,
-      NULL,
-      NULL,
-      &Status,
-      sizeof (EFI_STATUS)
-      );
+    BmReportLoadFailure (EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED, Status);
   }
   PERF_END_EX (gImageHandle, "BdsAttempt", NULL, 0, (UINT32) OptionNumber);
 
-- 
2.19.1.3.g30247aa5d201




------------------------------

Message: 13
Date: Thu, 21 Feb 2019 11:41:09 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel@lists.01.org
Cc: Anthony Perard <anthony.perard@citrix.com>, Ard Biesheuvel
	<ard.biesheuvel@linaro.org>, Jordan Justen
	<jordan.l.justen@intel.com>, Julien Grall <julien.grall@linaro.org>,
	Ray Ni <ray.ni@intel.com>
Subject: [edk2] [PATCH v3 2/5] OvmfPkg: add library to track boot
	option loading/starting on the console
Message-ID: <20190221104112.14995-3-lersek@redhat.com>

Introduce the Platform Boot Manager Print Status Code Library (for short,
PlatformBmPrintScLib) class for catching and printing the LoadImage() /
StartImage() preparations, and return statuses, that are reported by
UefiBootManagerLib.

In the primary library instance, catch only such status codes that
UefiBootManagerLib reports from the same module that contains
PlatformBmPrintScLib. The intent is to establish a reporting-printing
channel within BdsDxe, between UefiBootManagerLib and
PlatformBmPrintScLib. Ignore status codes originating elsewhence, e.g.
from UiApp's copy of UefiBootManagerLib.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien.grall@linaro.org>
Cc: Ray Ni <ray.ni@intel.com>
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1515418
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---

Notes:
    v3:
    
    - Refresh leading comment on HandleStatusCode(): the highest permitted
      TPL is TPL_CALLBACK. No code change.
    
    - pick up Ard's R-b
    
    v2:
    
    - Split the status code handling to a separate library, so that it's
      easy to reuse in ArmVirtPkg.
    
    - Rework the logic based on
      <https://bugzilla.tianocore.org/show_bug.cgi?id=1398> and
      <https://mantis.uefi.org/mantis/view.php?id=1885>, and follow Ray's
      advice in
      <http://mid.mail-archive.com/734D49CCEBEEF84792F5B80ED585239D5BACE29B@SHSMSX104.ccr.corp.intel.com>:
    
      - The boot option details are fetched via BootCurrent.
    
      - For reporting LoadImage() and StartImage() preparations, replace the
        originally proposed PcdDebugCodeOsLoaderDetail status code with the
        existent (edk2-specific) PcdProgressCodeOsLoaderLoad and
        PcdProgressCodeOsLoaderStart status codes.
    
      - For reporting LoadImage() and StartImage() return values, replace
        the originally proposed PcdDebugCodeOsLoaderDetail status code with
        the standard EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR and
        EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED status codes.
    
      - For all four kinds of reports, replace the originally proposed "OS
        Loader Detail" structure (and GUID) with the recently standardized
        EFI_RETURN_STATUS_EXTENDED_DATA structure.

 OvmfPkg/OvmfPkg.dec                                           |   5 +
 OvmfPkg/OvmfPkgIa32.dsc                                       |   1 +
 OvmfPkg/OvmfPkgIa32X64.dsc                                    |   1 +
 OvmfPkg/OvmfPkgX64.dsc                                        |   1 +
 OvmfPkg/Include/Library/PlatformBmPrintScLib.h                |  41 +++
 OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf |  66 +++++
 OvmfPkg/Library/PlatformBmPrintScLib/StatusCodeHandler.c      | 310 ++++++++++++++++++++
 7 files changed, 425 insertions(+)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 7666297cf8f1..e50c6179a249 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -45,6 +45,11 @@ [LibraryClasses]
   #                  access.
   PciCapPciSegmentLib|Include/Library/PciCapPciSegmentLib.h
 
+  ##  @libraryclass  Register a status code handler for printing the Boot
+  #                  Manager's LoadImage() and StartImage() preparations, and
+  #                  return codes, to the UEFI console.
+  PlatformBmPrintScLib|Include/Library/PlatformBmPrintScLib.h
+
   ##  @libraryclass  Access QEMU's firmware configuration interface
   #
   QemuFwCfgLib|Include/Library/QemuFwCfgLib.h
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index f9216af479f4..5b885590b275 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -348,6 +348,7 @@ [LibraryClasses.common.DXE_DRIVER]
   UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
   PlatformBootManagerLib|OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+  PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf
   QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
 !if $(SMM_REQUIRE) == TRUE
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 1e470de74434..bbf0853ee6b9 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -353,6 +353,7 @@ [LibraryClasses.common.DXE_DRIVER]
   UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
   PlatformBootManagerLib|OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+  PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf
   QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
 !if $(SMM_REQUIRE) == TRUE
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index e4929d8cf4a8..d81460f52041 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -353,6 +353,7 @@ [LibraryClasses.common.DXE_DRIVER]
   UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
   PlatformBootManagerLib|OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+  PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf
   QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
   CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
 !if $(SMM_REQUIRE) == TRUE
diff --git a/OvmfPkg/Include/Library/PlatformBmPrintScLib.h b/OvmfPkg/Include/Library/PlatformBmPrintScLib.h
new file mode 100644
index 000000000000..1777f9d7c947
--- /dev/null
+++ b/OvmfPkg/Include/Library/PlatformBmPrintScLib.h
@@ -0,0 +1,41 @@
+/** @file
+  Register a status code handler for printing the Boot Manager's LoadImage()
+  and StartImage() preparations, and return codes, to the UEFI console.
+
+  This feature enables users that are not accustomed to analyzing the firmware
+  log to glean some information about UEFI boot option processing (loading and
+  starting).
+
+  Copyright (C) 2019, Red Hat, Inc.
+
+  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 __PLATFORM_BM_PRINT_SC_LIB__
+#define __PLATFORM_BM_PRINT_SC_LIB__
+
+#include <Uefi/UefiBaseType.h>
+
+/**
+  Register a status code handler for printing the Boot Manager's LoadImage()
+  and StartImage() preparations, and return codes, to the UEFI console.
+
+  @retval EFI_SUCCESS  The status code handler has been successfully
+                       registered.
+
+  @return              Error codes propagated from boot services and from
+                       EFI_RSC_HANDLER_PROTOCOL.
+**/
+EFI_STATUS
+EFIAPI
+PlatformBmPrintScRegisterHandler (
+  VOID
+  );
+
+#endif // __PLATFORM_BM_PRINT_SC_LIB__
diff --git a/OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf b/OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf
new file mode 100644
index 000000000000..8f02e0b48236
--- /dev/null
+++ b/OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf
@@ -0,0 +1,66 @@
+## @file
+# Register a status code handler for printing the Boot Manager's LoadImage()
+# and StartImage() preparations, and return codes, to the UEFI console.
+#
+# This feature enables users that are not accustomed to analyzing the firmware
+# log to glean some information about UEFI boot option processing (loading and
+# starting).
+#
+# This library instance filters out (ignores) status codes that are not
+# reported by the containing firmware module. The intent is to link this
+# library instance into BdsDxe via PlatformBootManagerLib (which BdsDxe depends
+# upon), then catch only those status codes that BdsDxe reports (which happens
+# via UefiBootManagerLib). Status codes reported by other modules (such as
+# UiApp), via UefiBootManagerLib or otherwise, are meant to be ignored.
+#
+# Copyright (C) 2019, Red Hat, Inc.
+#
+# This program and the accompanying materials are licensed and made available
+# under the terms and conditions of the BSD License which accompanies this
+# distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
+# WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+##
+
+[Defines]
+  INF_VERSION    = 1.27
+  BASE_NAME      = PlatformBmPrintScLib
+  FILE_GUID      = 3417c705-903e-41a7-9485-3fafebf60917
+  MODULE_TYPE    = DXE_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = PlatformBmPrintScLib|DXE_DRIVER
+
+[Sources]
+  StatusCodeHandler.c
+
+[Packages]
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  BaseMemoryLib
+  DebugLib
+  DevicePathLib
+  MemoryAllocationLib
+  PcdLib
+  PrintLib
+  UefiBootManagerLib
+  UefiBootServicesTableLib
+  UefiLib
+  UefiRuntimeServicesTableLib
+
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderLoad  ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderStart ## CONSUMES
+
+[Protocols]
+  gEfiRscHandlerProtocolGuid                                  ## CONSUMES
+
+[Guids]
+  gEfiGlobalVariableGuid                                      ## CONSUMES
+  gEfiStatusCodeSpecificDataGuid                              ## CONSUMES
+
+[Depex.common.DXE_DRIVER]
+  gEfiRscHandlerProtocolGuid AND gEfiVariableArchProtocolGuid
diff --git a/OvmfPkg/Library/PlatformBmPrintScLib/StatusCodeHandler.c b/OvmfPkg/Library/PlatformBmPrintScLib/StatusCodeHandler.c
new file mode 100644
index 000000000000..3afe9d9690c7
--- /dev/null
+++ b/OvmfPkg/Library/PlatformBmPrintScLib/StatusCodeHandler.c
@@ -0,0 +1,310 @@
+/** @file
+  Register a status code handler for printing the Boot Manager's LoadImage()
+  and StartImage() preparations, and return codes, to the UEFI console.
+
+  This feature enables users that are not accustomed to analyzing the firmware
+  log to glean some information about UEFI boot option processing (loading and
+  starting).
+
+  This library instance filters out (ignores) status codes that are not
+  reported by the containing firmware module. The intent is to link this
+  library instance into BdsDxe via PlatformBootManagerLib (which BdsDxe depends
+  upon), then catch only those status codes that BdsDxe reports (which happens
+  via UefiBootManagerLib). Status codes reported by other modules (such as
+  UiApp), via UefiBootManagerLib or otherwise, are meant to be ignored.
+
+  Copyright (C) 2019, Red Hat, Inc.
+
+  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 <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PcdLib.h>
+#include <Library/PrintLib.h>
+#include <Library/UefiBootManagerLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+
+#include <Protocol/ReportStatusCodeHandler.h>
+
+#include <Guid/GlobalVariable.h>
+#include <Guid/StatusCodeDataTypeId.h>
+
+#include <Pi/PiStatusCode.h>
+
+
+//
+// Convenience variables for the status codes that are relevant for LoadImage()
+// and StartImage() preparations and return codes.
+//
+STATIC EFI_STATUS_CODE_VALUE mLoadPrep;
+STATIC EFI_STATUS_CODE_VALUE mLoadFail;
+STATIC EFI_STATUS_CODE_VALUE mStartPrep;
+STATIC EFI_STATUS_CODE_VALUE mStartFail;
+
+
+/**
+  Handle status codes reported through ReportStatusCodeLib /
+  EFI_STATUS_CODE_PROTOCOL.ReportStatusCode(). Format matching status codes to
+  the system console.
+
+  The highest TPL at which this handler can be registered with
+  EFI_RSC_HANDLER_PROTOCOL.Register() is TPL_CALLBACK. That's because
+  HandleStatusCode() uses the UEFI variable services.
+
+  The parameter list of this function precisely matches that of
+  EFI_STATUS_CODE_PROTOCOL.ReportStatusCode().
+
+  The return status of this function is ignored by the caller, but the function
+  still returns sensible codes:
+
+  @retval EFI_SUCCESS               The status code has been processed; either
+                                    as a no-op, due to filtering, or by
+                                    formatting it to the system console.
+
+  @retval EFI_INVALID_PARAMETER     Unknown or malformed contents have been
+                                    detected in Data.
+
+  @retval EFI_INCOMPATIBLE_VERSION  Unexpected UEFI variable behavior has been
+                                    encountered.
+
+  @return                           Error codes propagated from underlying
+                                    services.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+HandleStatusCode (
+  IN EFI_STATUS_CODE_TYPE  CodeType,
+  IN EFI_STATUS_CODE_VALUE Value,
+  IN UINT32                Instance,
+  IN EFI_GUID              *CallerId,
+  IN EFI_STATUS_CODE_DATA  *Data
+  )
+{
+  UINTN                        VariableSize;
+  UINT16                       BootCurrent;
+  EFI_STATUS                   Status;
+  CHAR16                       BootOptionName[ARRAY_SIZE (L"Boot####")];
+  EFI_BOOT_MANAGER_LOAD_OPTION BmBootOption;
+  BOOLEAN                      DevPathStringIsDynamic;
+  CHAR16                       *DevPathString;
+
+  //
+  // Ignore all status codes that are irrelevant for LoadImage() and
+  // StartImage() preparations and return codes.
+  //
+  if (Value != mLoadPrep && Value != mLoadFail &&
+      Value != mStartPrep && Value != mStartFail) {
+    return EFI_SUCCESS;
+  }
+  //
+  // Ignore status codes that are not reported by the same containing module.
+  //
+  if (!CompareGuid (CallerId, &gEfiCallerIdGuid)) {
+    return EFI_SUCCESS;
+  }
+
+  //
+  // Sanity-check Data in case of failure reports.
+  //
+  if ((Value == mLoadFail || Value == mStartFail) &&
+      (Data == NULL ||
+       Data->HeaderSize != sizeof *Data ||
+       Data->Size != sizeof (EFI_RETURN_STATUS_EXTENDED_DATA) - sizeof *Data ||
+       !CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid))) {
+    DEBUG ((DEBUG_ERROR, "%a:%a: malformed Data\n", gEfiCallerBaseName,
+      __FUNCTION__));
+    return EFI_INVALID_PARAMETER;
+  }
+
+  //
+  // Get the number of the Boot#### option that the status code applies to.
+  //
+  VariableSize = sizeof BootCurrent;
+  Status = gRT->GetVariable (EFI_BOOT_CURRENT_VARIABLE_NAME,
+                  &gEfiGlobalVariableGuid, NULL /* Attributes */,
+                  &VariableSize, &BootCurrent);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "%a:%a: failed to get %g:\"%s\": %r\n",
+      gEfiCallerBaseName, __FUNCTION__, &gEfiGlobalVariableGuid,
+      EFI_BOOT_CURRENT_VARIABLE_NAME, Status));
+    return Status;
+  }
+  if (VariableSize != sizeof BootCurrent) {
+    DEBUG ((DEBUG_ERROR, "%a:%a: got %Lu bytes for %g:\"%s\", expected %Lu\n",
+      gEfiCallerBaseName, __FUNCTION__, (UINT64)VariableSize,
+      &gEfiGlobalVariableGuid, EFI_BOOT_CURRENT_VARIABLE_NAME,
+      (UINT64)sizeof BootCurrent));
+    return EFI_INCOMPATIBLE_VERSION;
+  }
+
+  //
+  // Get the Boot#### option that the status code applies to.
+  //
+  UnicodeSPrint (BootOptionName, sizeof BootOptionName, L"Boot%04x",
+    BootCurrent);
+  Status = EfiBootManagerVariableToLoadOption (BootOptionName, &BmBootOption);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR,
+      "%a:%a: EfiBootManagerVariableToLoadOption(\"%s\"): %r\n",
+      gEfiCallerBaseName, __FUNCTION__, BootOptionName, Status));
+    return Status;
+  }
+
+  //
+  // Format the device path.
+  //
+  DevPathStringIsDynamic = TRUE;
+  DevPathString = ConvertDevicePathToText (
+                    BmBootOption.FilePath,
+                    FALSE,                 // DisplayOnly
+                    FALSE                  // AllowShortcuts
+                    );
+  if (DevPathString == NULL) {
+    DevPathStringIsDynamic = FALSE;
+    DevPathString = L"<out of memory while formatting device path>";
+  }
+
+  //
+  // Print the message to the console.
+  //
+  if (Value == mLoadPrep || Value == mStartPrep) {
+    Print (
+      L"%a: %a %s \"%s\" from %s\n",
+      gEfiCallerBaseName,
+      Value == mLoadPrep ? "loading" : "starting",
+      BootOptionName,
+      BmBootOption.Description,
+      DevPathString
+      );
+  } else {
+    Print (
+      L"%a: failed to %a %s \"%s\" from %s: %r\n",
+      gEfiCallerBaseName,
+      Value == mLoadFail ? "load" : "start",
+      BootOptionName,
+      BmBootOption.Description,
+      DevPathString,
+      ((EFI_RETURN_STATUS_EXTENDED_DATA *)Data)->ReturnStatus
+      );
+  }
+
+  //
+  // Done.
+  //
+  if (DevPathStringIsDynamic) {
+    FreePool (DevPathString);
+  }
+  EfiBootManagerFreeLoadOption (&BmBootOption);
+  return EFI_SUCCESS;
+}
+
+
+/**
+  Unregister HandleStatusCode() at ExitBootServices().
+
+  (See EFI_RSC_HANDLER_PROTOCOL in Volume 3 of the Platform Init spec.)
+
+  @param[in] Event    Event whose notification function is being invoked.
+
+  @param[in] Context  Pointer to EFI_RSC_HANDLER_PROTOCOL, originally looked up
+                      when HandleStatusCode() was registered.
+**/
+STATIC
+VOID
+EFIAPI
+UnregisterAtExitBootServices (
+  IN EFI_EVENT Event,
+  IN VOID      *Context
+  )
+{
+  EFI_RSC_HANDLER_PROTOCOL *StatusCodeRouter;
+
+  StatusCodeRouter = Context;
+  StatusCodeRouter->Unregister (HandleStatusCode);
+}
+
+
+/**
+  Register a status code handler for printing the Boot Manager's LoadImage()
+  and StartImage() preparations, and return codes, to the UEFI console.
+
+  @retval EFI_SUCCESS  The status code handler has been successfully
+                       registered.
+
+  @return              Error codes propagated from boot services and from
+                       EFI_RSC_HANDLER_PROTOCOL.
+**/
+EFI_STATUS
+EFIAPI
+PlatformBmPrintScRegisterHandler (
+  VOID
+  )
+{
+  EFI_STATUS               Status;
+  EFI_RSC_HANDLER_PROTOCOL *StatusCodeRouter;
+  EFI_EVENT                ExitBootEvent;
+
+  Status = gBS->LocateProtocol (&gEfiRscHandlerProtocolGuid,
+                  NULL /* Registration */, (VOID **)&StatusCodeRouter);
+  ASSERT_EFI_ERROR (Status);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  //
+  // Set the EFI_STATUS_CODE_VALUE convenience variables.
+  //
+  mLoadPrep  = PcdGet32 (PcdProgressCodeOsLoaderLoad);
+  mLoadFail  = (EFI_SOFTWARE_DXE_BS_DRIVER |
+                EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR);
+  mStartPrep = PcdGet32 (PcdProgressCodeOsLoaderStart);
+  mStartFail = (EFI_SOFTWARE_DXE_BS_DRIVER |
+                EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED);
+
+  //
+  // Register the handler callback.
+  //
+  Status = StatusCodeRouter->Register (HandleStatusCode, TPL_CALLBACK);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "%a:%a: failed to register status code handler: %r\n",
+      gEfiCallerBaseName, __FUNCTION__, Status));
+    return Status;
+  }
+
+  //
+  // Status code reporting and routing/handling extend into OS runtime. Since
+  // we don't want our handler to survive the BDS phase, we have to unregister
+  // the callback at ExitBootServices(). (See EFI_RSC_HANDLER_PROTOCOL in
+  // Volume 3 of the Platform Init spec.)
+  //
+  Status = gBS->CreateEvent (
+                  EVT_SIGNAL_EXIT_BOOT_SERVICES, // Type
+                  TPL_CALLBACK,                  // NotifyTpl
+                  UnregisterAtExitBootServices,  // NotifyFunction
+                  StatusCodeRouter,              // NotifyContext
+                  &ExitBootEvent                 // Event
+                  );
+  if (EFI_ERROR (Status)) {
+    //
+    // We have to unregister the callback right now, and fail the function.
+    //
+    DEBUG ((DEBUG_ERROR, "%a:%a: failed to create ExitBootServices() event: "
+      "%r\n", gEfiCallerBaseName, __FUNCTION__, Status));
+    StatusCodeRouter->Unregister (HandleStatusCode);
+    return Status;
+  }
+
+  return EFI_SUCCESS;
+}
-- 
2.19.1.3.g30247aa5d201




------------------------------

Message: 14
Date: Thu, 21 Feb 2019 11:41:10 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel@lists.01.org
Cc: Anthony Perard <anthony.perard@citrix.com>, Ard Biesheuvel
	<ard.biesheuvel@linaro.org>, Jordan Justen
	<jordan.l.justen@intel.com>, Julien Grall <julien.grall@linaro.org>,
	Ray Ni <ray.ni@intel.com>
Subject: [edk2] [PATCH v3 3/5] OvmfPkg/PlatformBootManagerLib: display
	boot option loading/starting
Message-ID: <20190221104112.14995-4-lersek@redhat.com>

Consume PlatformBmPrintScLib, added earlier in this series. When
BdsDxe+UefiBootManagerLib report LoadImage() / StartImage() preparations
and return statuses, print the reports to the UEFI console. This allows
end-users better visibility into the boot process.

Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien.grall@linaro.org>
Cc: Ray Ni <ray.ni@intel.com>
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1515418
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---

Notes:
    v3:
    - pick up Ard's R-b
    
    v2:
    
    - Split the OvmfPkg/PlatformBootManagerLib change to a separate patch.
    
    - Drop general messages from PlatformBootManagerAfterConsole(), which
      would report calls of EfiBootManagerRefreshAllBootOption(),
      RemoveStaleFvFileOptions(), and SetBootOrderFromQemu(). Those messages
      weren't really helpful for diagnosing boot problems.

 OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 +
 OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c              | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 5d9b53bf2d1e..c41aaeef3fc3 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -58,6 +58,7 @@ [LibraryClasses]
   QemuBootOrderLib
   ReportStatusCodeLib
   UefiLib
+  PlatformBmPrintScLib
   Tcg2PhysicalPresenceLib
 
 [Pcd]
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index b2faa797c61b..12303fb0f1f3 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -16,6 +16,7 @@
 #include <Guid/XenInfo.h>
 #include <Guid/RootBridgesConnectedEventGroup.h>
 #include <Protocol/FirmwareVolume2.h>
+#include <Library/PlatformBmPrintScLib.h>
 #include <Library/Tcg2PhysicalPresenceLib.h>
 
 
@@ -1542,6 +1543,8 @@ PlatformBootManagerAfterConsole (
 
   RemoveStaleFvFileOptions ();
   SetBootOrderFromQemu ();
+
+  PlatformBmPrintScRegisterHandler ();
 }
 
 /**
-- 
2.19.1.3.g30247aa5d201




------------------------------

Message: 15
Date: Thu, 21 Feb 2019 11:41:11 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH v3 4/5] ArmVirtPkg/ArmVirtQemu*: enable minimal
	Status Code Routing in DXE
Message-ID: <20190221104112.14995-5-lersek@redhat.com>

The EFI_RETURN_STATUS_EXTENDED_DATA feature from PI-1.7
(<https://mantis.uefi.org/mantis/view.php?id=1885>) enables platform code
to learn about boot option failures (loading and launching) via status
codes reported by the UEFI Boot Manager.

In commit 59541d41633c, we removed all status code support from
ArmVirtPkg. Reenable that support now, minimally, just to the extent so we
can benefit from the PI-1.7 feature mentioned above:

(1) Include the ReportStatusCodeRouterRuntimeDxe driver.

    This driver produces two protocols, EFI_STATUS_CODE_PROTOCOL and
    EFI_RSC_HANDLER_PROTOCOL. The former allows DXE phase modules and
    runtime modules to report (produce) status codes. The latter allows
    the same types of modules to register callbacks for status code
    handling (consumption).

    (Handler registration  occurs only at boot time. Status codes are
    delivered to each handler at runtime as well, unless the handler is
    unregistered at ExitBootServices().)

(2) Resolve ReportStatusCodeLib to a non-Null instance, for DXE_DRIVER
    modules only. This way DXE_DRIVER modules that use the
    REPORT_STATUS_CODE_EX() macro and friends will reach
    EFI_STATUS_CODE_PROTOCOL from point (1).

(3) Set PcdReportStatusCodePropertyMask to 3 (the default value is 0).
    This causes the REPORT_STATUS_CODE_EX() macro and friends to let
    Progress Codes (bit#0) and Error Codes (bit#1) through to point (1).
    Debug Codes (bit#2) are filtered out.

(4) Include no driver, for now, that registers any status code handler via
    EFI_RSC_HANDLER_PROTOCOL, from point (1). Status codes that reach
    ReportStatusCodeRouterRuntimeDxe will be thrown away.

(5) Modify only the ArmVirtQemu* platforms. A status code handler will
    be added to "ArmVirtPkg/Library/PlatformBootManagerLib" in the next patch,
    and this library instance is not consumed by ArmVirtXen.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Julien Grall <julien.grall@linaro.org>
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1515418
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---

Notes:
    v3:
    - pick up Ard's R-b
    
    v2:
    - new in v2

 ArmVirtPkg/ArmVirtQemu.dsc           | 10 ++++++++++
 ArmVirtPkg/ArmVirtQemuKernel.dsc     | 10 ++++++++++
 ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc |  5 +++++
 3 files changed, 25 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index 8cc31fda7a37..ec97d5a14b3a 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -69,6 +69,9 @@ [LibraryClasses.common]
 [LibraryClasses.common.PEIM]
   ArmVirtMemInfoLib|ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoPeiLib.inf
 
+[LibraryClasses.common.DXE_DRIVER]
+  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
+
 [LibraryClasses.common.UEFI_DRIVER]
   UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
 
@@ -155,6 +158,8 @@ [PcdsFixedAtBuild.common]
   gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
 !endif
 
+  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|3
+
 [PcdsFixedAtBuild.AARCH64]
   # Clearing BIT0 in this PCD prevents installing a 32-bit SMBIOS entry point,
   # if the entry point version is >= 3.0. AARCH64 OSes cannot assume the
@@ -304,6 +309,11 @@ [Components.common]
   ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
 
+  #
+  # Status Code Routing
+  #
+  MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
+
   #
   # Platform Driver
   #
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index c3e0c9bf2549..e8c065229b21 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -66,6 +66,9 @@ [LibraryClasses.common]
   PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
   PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
 
+[LibraryClasses.common.DXE_DRIVER]
+  ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
+
 [LibraryClasses.common.UEFI_DRIVER]
   UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
 
@@ -149,6 +152,8 @@ [PcdsFixedAtBuild.common]
   gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
 !endif
 
+  gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|3
+
 [PcdsPatchableInModule.common]
   #
   # This will be overridden in the code
@@ -288,6 +293,11 @@ [Components.common]
   ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
   MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
 
+  #
+  # Status Code Routing
+  #
+  MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
+
   #
   # Platform Driver
   #
diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
index dc6a0a2bcdc7..098d40b61b15 100644
--- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
+++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
@@ -91,6 +91,11 @@ [FV.FvMain]
   INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
   INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
 
+  #
+  # Status Code Routing
+  #
+  INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
+
   #
   # Platform Driver
   #
-- 
2.19.1.3.g30247aa5d201




------------------------------

Message: 16
Date: Thu, 21 Feb 2019 11:41:12 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH v3 5/5] ArmVirtPkg/PlatformBootManagerLib:
	display boot option loading/starting
Message-ID: <20190221104112.14995-6-lersek@redhat.com>

Consume PlatformBmPrintScLib, added earlier in this series. When
BdsDxe+UefiBootManagerLib report LoadImage() / StartImage() preparations
and return statuses, print the reports to the UEFI console. This allows
end-users better visibility into the boot process.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1515418
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---

Notes:
    v3:
    - pick up Ard's R-b
    
    v2:
    - new in v2

 ArmVirtPkg/ArmVirtQemu.dsc                                           | 1 +
 ArmVirtPkg/ArmVirtQemuKernel.dsc                                     | 1 +
 ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 +
 ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c               | 3 +++
 4 files changed, 6 insertions(+)

diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
index ec97d5a14b3a..a77d71bcea36 100644
--- a/ArmVirtPkg/ArmVirtQemu.dsc
+++ b/ArmVirtPkg/ArmVirtQemu.dsc
@@ -58,6 +58,7 @@ [LibraryClasses.common]
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
   BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
   PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+  PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf
   CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
   FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
   QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKernel.dsc
index e8c065229b21..1e5388ae708f 100644
--- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
+++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
@@ -58,6 +58,7 @@ [LibraryClasses.common]
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
   BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
   PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+  PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf
   CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
   FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
   QemuBootOrderLib|OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 0cbc82f5d27d..9a8a70379e67 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -50,6 +50,7 @@ [LibraryClasses]
   DevicePathLib
   MemoryAllocationLib
   PcdLib
+  PlatformBmPrintScLib
   PrintLib
   QemuBootOrderLib
   QemuFwCfgLib
diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
index 534357eff46b..0e8d7501fb1d 100644
--- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
+++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c
@@ -20,6 +20,7 @@
 #include <Library/BootLogoLib.h>
 #include <Library/DevicePathLib.h>
 #include <Library/PcdLib.h>
+#include <Library/PlatformBmPrintScLib.h>
 #include <Library/QemuBootOrderLib.h>
 #include <Library/UefiBootManagerLib.h>
 #include <Protocol/DevicePath.h>
@@ -833,6 +834,8 @@ PlatformBootManagerAfterConsole (
 
   RemoveStaleFvFileOptions ();
   SetBootOrderFromQemu ();
+
+  PlatformBmPrintScRegisterHandler ();
 }
 
 /**
-- 
2.19.1.3.g30247aa5d201



------------------------------

Message: 17
Date: Thu, 21 Feb 2019 13:28:02 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel@lists.01.org
Cc: Andrew Fish <afish@apple.com>, Anthony Perard
	<anthony.perard@citrix.com>, Ard Biesheuvel
	<ard.biesheuvel@linaro.org>, Jordan Justen
	<jordan.l.justen@intel.com>, Julien Grall <julien.grall@linaro.org>,
	Leif Lindholm <leif.lindholm@linaro.org>, Marc-Andr? Lureau
	<marcandre.lureau@redhat.com>, Michael D Kinney
	<michael.d.kinney@intel.com>, Stefan Berger <stefanb@linux.ibm.com>
Subject: [edk2] [PATCH v2 0/2] Maintainers: updates for ArmVirtPkg and
	OvmfPkg
Message-ID: <20190221122804.20314-1-lersek@redhat.com>
Content-Type: text/plain; charset=UTF-8

Previous version:
  [edk2] [PATCH] Maintainers: add TPM2 reviewers for OvmfPkg
  https://lists.01.org/pipermail/edk2-devel/2019-February/036495.html

Patch #1 in v2 is an iteration of the above. Patch #2 in v2 is new.

Cc: Andrew Fish <afish@apple.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien.grall@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Stefan Berger <stefanb@linux.ibm.com>

Thanks,
Laszlo

Laszlo Ersek (2):
  Maintainers: add TPM2 reviewers for OvmfPkg
  Maintainers: specify the scope for OvmfPkg/ArmVirtPkg Xen module
    reviewers

 Maintainers.txt | 7 +++++++
 1 file changed, 7 insertions(+)

-- 
2.19.1.3.g30247aa5d201



------------------------------

Message: 18
Date: Thu, 21 Feb 2019 13:28:03 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel@lists.01.org
Cc: Andrew Fish <afish@apple.com>, Ard Biesheuvel
	<ard.biesheuvel@linaro.org>, Jordan Justen
	<jordan.l.justen@intel.com>, Leif Lindholm <leif.lindholm@linaro.org>,
	Marc-Andr? Lureau <marcandre.lureau@redhat.com>, Michael D Kinney
	<michael.d.kinney@intel.com>, Stefan Berger <stefanb@linux.ibm.com>
Subject: [edk2] [PATCH v2 1/2] Maintainers: add TPM2 reviewers for
	OvmfPkg
Message-ID: <20190221122804.20314-2-lersek@redhat.com>
Content-Type: text/plain; charset=UTF-8

OVMF can be built with a significant amount of TPM2 code now; add
Marc-Andr? and Stefan as Reviewers for TPM2-related patches.

Keep the list of "R" entries alphabetically sorted.

Cc: Andrew Fish <afish@apple.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Stefan Berger <stefanb@linux.ibm.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
---

Notes:
    v2:
    - pick up feedback tags
    - describe the Reviewership scope, in the format seen under MdeModulePkg
      [Marc-Andr?]

 Maintainers.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index 3b2676bc32ea..e45b77039d67 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -218,6 +218,10 @@ M: Laszlo Ersek <lersek@redhat.com>
 M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
 R: Anthony Perard <anthony.perard@citrix.com>
 R: Julien Grall <julien.grall@linaro.org>
+R: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
+   (TPM2 modules)
+R: Stefan Berger <stefanb@linux.ibm.com>
+   (TPM2 modules)
 S: Maintained
 
 PcAtChipsetPkg
-- 
2.19.1.3.g30247aa5d201




------------------------------

Message: 19
Date: Thu, 21 Feb 2019 13:28:04 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel@lists.01.org
Cc: Andrew Fish <afish@apple.com>, Anthony Perard
	<anthony.perard@citrix.com>, Ard Biesheuvel
	<ard.biesheuvel@linaro.org>, Jordan Justen
	<jordan.l.justen@intel.com>, Julien Grall <julien.grall@linaro.org>,
	Leif Lindholm <leif.lindholm@linaro.org>, Michael D Kinney
	<michael.d.kinney@intel.com>
Subject: [edk2] [PATCH v2 2/2] Maintainers: specify the scope for
	OvmfPkg/ArmVirtPkg Xen module reviewers
Message-ID: <20190221122804.20314-3-lersek@redhat.com>
Content-Type: text/plain; charset=UTF-8

We can use the format introduced under MdeModulePkg to clarify the
reviewership scopes a little. This should decrease the review spam that
Xen reviewers get.

Cc: Andrew Fish <afish@apple.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Julien Grall <julien.grall@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

Notes:
    v2:
    - new in v2

 Maintainers.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index e45b77039d67..86f80b7d38a0 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -81,6 +81,7 @@ W: https://github.com/tianocore/tianocore.github.io/wiki/ArmVirtPkg
 M: Laszlo Ersek <lersek@redhat.com>
 M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
 R: Julien Grall <julien.grall@linaro.org>
+   (Xen modules)
 
 BaseTools
 W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
@@ -217,7 +218,9 @@ M: Jordan Justen <jordan.l.justen@intel.com>
 M: Laszlo Ersek <lersek@redhat.com>
 M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
 R: Anthony Perard <anthony.perard@citrix.com>
+   (Xen modules)
 R: Julien Grall <julien.grall@linaro.org>
+   (Xen modules)
 R: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
    (TPM2 modules)
 R: Stefan Berger <stefanb@linux.ibm.com>
-- 
2.19.1.3.g30247aa5d201



------------------------------

Message: 20
Date: Thu, 21 Feb 2019 13:30:09 +0100
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Laszlo Ersek <lersek@redhat.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>, Andrew Fish
	<afish@apple.com>, Anthony Perard <anthony.perard@citrix.com>, Jordan
	Justen <jordan.l.justen@intel.com>,  Julien Grall
	<julien.grall@linaro.org>, Leif Lindholm <leif.lindholm@linaro.org>,
	Marc-Andr? Lureau <marcandre.lureau@redhat.com>, Michael D Kinney
	<michael.d.kinney@intel.com>, Stefan Berger <stefanb@linux.ibm.com>
Subject: Re: [edk2] [PATCH v2 0/2] Maintainers: updates for ArmVirtPkg
	and OvmfPkg
Message-ID:
	<CAKv+Gu9+FdyepJjGYYLpF6yydSJW_xwh+U23RujcEmUSbtQoRA@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

On Thu, 21 Feb 2019 at 13:28, Laszlo Ersek <lersek@redhat.com> wrote:
>
> Previous version:
>   [edk2] [PATCH] Maintainers: add TPM2 reviewers for OvmfPkg
>   https://lists.01.org/pipermail/edk2-devel/2019-February/036495.html
>
> Patch #1 in v2 is an iteration of the above. Patch #2 in v2 is new.
>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien.grall@linaro.org>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Stefan Berger <stefanb@linux.ibm.com>
>
> Thanks,
> Laszlo
>
> Laszlo Ersek (2):
>   Maintainers: add TPM2 reviewers for OvmfPkg
>   Maintainers: specify the scope for OvmfPkg/ArmVirtPkg Xen module
>     reviewers
>

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
  (for the series)


------------------------------

Message: 21
Date: Thu, 21 Feb 2019 12:32:36 +0000
From: Anthony PERARD <anthony.perard@citrix.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: <edk2-devel@lists.01.org>, Andrew Fish <afish@apple.com>, Ard
	Biesheuvel <ard.biesheuvel@linaro.org>, Jordan Justen
	<jordan.l.justen@intel.com>, Julien Grall <julien.grall@linaro.org>,
	Leif Lindholm <leif.lindholm@linaro.org>, Michael D Kinney
	<michael.d.kinney@intel.com>
Subject: Re: [edk2] [PATCH v2 2/2] Maintainers: specify the scope for
	OvmfPkg/ArmVirtPkg Xen module reviewers
Message-ID: <20190221123236.GD1349@perard.uk.xensource.com>
Content-Type: text/plain; charset="iso-8859-1"

On Thu, Feb 21, 2019 at 01:28:04PM +0100, Laszlo Ersek wrote:
> We can use the format introduced under MdeModulePkg to clarify the
> reviewership scopes a little. This should decrease the review spam that
> Xen reviewers get.
> 
> Cc: Andrew Fish <afish@apple.com>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien.grall@linaro.org>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
> 
> Notes:
>     v2:
>     - new in v2
> 
>  Maintainers.txt | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index e45b77039d67..86f80b7d38a0 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -81,6 +81,7 @@ W: https://github.com/tianocore/tianocore.github.io/wiki/ArmVirtPkg
>  M: Laszlo Ersek <lersek@redhat.com>
>  M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>  R: Julien Grall <julien.grall@linaro.org>
> +   (Xen modules)
>  
>  BaseTools
>  W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
> @@ -217,7 +218,9 @@ M: Jordan Justen <jordan.l.justen@intel.com>
>  M: Laszlo Ersek <lersek@redhat.com>
>  M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>  R: Anthony Perard <anthony.perard@citrix.com>
> +   (Xen modules)
>  R: Julien Grall <julien.grall@linaro.org>
> +   (Xen modules)
>  R: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
>     (TPM2 modules)
>  R: Stefan Berger <stefanb@linux.ibm.com>

Acked-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks,

-- 
Anthony PERARD


------------------------------

Message: 22
Date: Thu, 21 Feb 2019 22:37:31 +0800
From: "Feng, Bob C" <bob.c.feng@intel.com>
To: edk2-devel@lists.01.org
Cc: Bob Feng <bob.c.feng@intel.com>,	Liming Gao <liming.gao@intel.com>
Subject: [edk2] [Patch V2] BaseTools: Correct the value assignment for
	StructurePcd
Message-ID: <20190221143731.12732-1-bob.c.feng@intel.com>

This patch is to fix the code bug in StructurePcd overall
value assignment logic. If a Pcd Array size is fixed but the
size of actual value in Dsc or Dec is bigger than the Pcd
array size, the tool will report error about such setting and
stop build.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/Python/Common/Misc.py        |   1 +
 .../Python/Workspace/BuildClassObject.py      |  78 ++++---
 .../Source/Python/Workspace/DecBuildData.py   |   2 +-
 .../Source/Python/Workspace/DscBuildData.py   | 211 ++++++++++++++----
 4 files changed, 218 insertions(+), 74 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py
index c7daf5417c..526aa2dd54 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -40,10 +40,11 @@ from Common.Parsing import GetSplitValueList
 from Common.LongFilePathSupport import OpenLongFilePath as open
 from Common.MultipleWorkspace import MultipleWorkspace as mws
 from CommonDataClass.Exceptions import BadExpression
 from Common.caching import cached_property
 
+ArrayIndex = re.compile("\[\s*[0-9a-fA-FxX]*\s*\]")
 ## Regular expression used to find out place holders in string template
 gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE | re.UNICODE)
 
 ## regular expressions for map file processing
 startPatternGeneral = re.compile("^Start[' ']+Length[' ']+Name[' ']+Class")
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index b82af49236..b50e250cfb 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -14,14 +14,16 @@
 from collections import OrderedDict, namedtuple
 from Common.DataType import *
 import collections
 import re
 from collections import OrderedDict
-from Common.Misc import CopyDict
+from Common.Misc import CopyDict,ArrayIndex
 import copy
+import Common.EdkLogger as EdkLogger
+from Common.BuildToolError import OPTION_VALUE_INVALID
 StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_\[\]]*$')
-ArrayIndex = re.compile("\[\s*[0-9a-fA-FxX]*\s*\]")
+
 ## PcdClassObject
 #
 # This Class is used for PcdObject
 #
 # @param object:             Inherited from object class
@@ -66,44 +68,62 @@ class PcdClassObject(object):
         self.validateranges = validateranges if validateranges is not None else []
         self.validlists = validlists if validlists is not None else []
         self.expressions = expressions if expressions is not None else []
         self.DscDefaultValue = None
         self.DscRawValue = {}
+        self.DscRawValueInfo = {}
         if IsDsc:
             self.DscDefaultValue = Value
         self.PcdValueFromComm = ""
         self.PcdValueFromFdf = ""
         self.CustomAttribute = {}
         self.UserDefinedDefaultStoresFlag = UserDefinedDefaultStoresFlag
         self._Capacity = None
 
     @property
     def Capacity(self):
-        self._Capacity = []
-        dimension = ArrayIndex.findall(self._DatumType)
-        for item in dimension:
-            maxsize = item.lstrip("[").rstrip("]").strip()
-            if not maxsize:
-                maxsize = "-1"
-            maxsize = str(int(maxsize,16)) if maxsize.startswith(("0x","0X")) else maxsize
-            self._Capacity.append(maxsize)
-        if hasattr(self, "SkuOverrideValues"):
-            for sku in self.SkuOverrideValues:
-                for defaultstore in self.SkuOverrideValues[sku]:
-                    fields = self.SkuOverrideValues[sku][defaultstore]
-                    for demesionattr in fields:
-                        deme = ArrayIndex.findall(demesionattr)
-                        for i in range(len(deme)-1):
-                            if int(deme[i].lstrip("[").rstrip("]").strip()) > int(self._Capacity[i]):
-                                print ("error")
-        if hasattr(self,"DefaultValues"):
-            for demesionattr in self.DefaultValues:
-                deme = ArrayIndex.findall(demesionattr)
-                for i in range(len(deme)-1):
-                    if int(deme[i].lstrip("[").rstrip("]").strip()) > int(self._Capacity[i]):
-                        print ("error")
+        if self._Capacity is None:
+            self._Capacity = []
+            dimension = ArrayIndex.findall(self._DatumType)
+            for item in dimension:
+                maxsize = item.lstrip("[").rstrip("]").strip()
+                if not maxsize:
+                    maxsize = "-1"
+                maxsize = str(int(maxsize,16)) if maxsize.startswith(("0x","0X")) else maxsize
+                self._Capacity.append(maxsize)
+            if hasattr(self, "SkuOverrideValues"):
+                for sku in self.SkuOverrideValues:
+                    for defaultstore in self.SkuOverrideValues[sku]:
+                        fields = self.SkuOverrideValues[sku][defaultstore]
+                        for demesionattr in fields:
+                            fieldinfo = fields[demesionattr]
+                            deme = ArrayIndex.findall(demesionattr)
+                            for i in range(len(deme)):
+                                if int(deme[i].lstrip("[").rstrip("]").strip()) >= int(self._Capacity[i]):
+                                    if self._Capacity[i] != "-1":
+                                        firstfieldinfo = list(fieldinfo.values())[0]
+                                        EdkLogger.error('Build', OPTION_VALUE_INVALID, "For Pcd %s, Array Index exceed the Array size. From %s Line %s \n " %
+                                    (".".join((self.TokenSpaceGuidCName, self.TokenCName)), firstfieldinfo[1],firstfieldinfo[2] ))
+            if hasattr(self,"DefaultValues"):
+                for demesionattr in self.DefaultValues:
+                    fieldinfo = self.DefaultValues[demesionattr]
+                    deme = ArrayIndex.findall(demesionattr)
+                    for i in range(len(deme)):
+                        if int(deme[i].lstrip("[").rstrip("]").strip()) >= int(self._Capacity[i]):
+                            if self._Capacity[i] != "-1":
+                                firstfieldinfo = list(fieldinfo.values())[0]
+                                EdkLogger.error('Build', OPTION_VALUE_INVALID, "For Pcd %s, Array Index exceed the Array size. From %s Line %s \n " %
+                                    (".".join((self.TokenSpaceGuidCName, self.TokenCName)), firstfieldinfo[1],firstfieldinfo[2] ))
         return self._Capacity
+
+    def PcdArraySize(self):
+        if self.Capacity[-1] == "-1":
+            return -1
+        size = 1
+        for de in self.Capacity:
+            size = size * int(de)
+        return size
     @property
     def DatumType(self):
         return self._DatumType
 
     @DatumType.setter
@@ -231,10 +251,11 @@ class PcdClassObject(object):
         new_pcd.IsFromDsc = self.IsFromDsc
         new_pcd.PcdValueFromComm = self.PcdValueFromComm
         new_pcd.PcdValueFromFdf = self.PcdValueFromFdf
         new_pcd.UserDefinedDefaultStoresFlag = self.UserDefinedDefaultStoresFlag
         new_pcd.DscRawValue = self.DscRawValue
+        new_pcd.DscRawValueInfo = self.DscRawValueInfo
         new_pcd.CustomAttribute = self.CustomAttribute
         new_pcd.validateranges = [item for item in self.validateranges]
         new_pcd.validlists = [item for item in self.validlists]
         new_pcd.expressions = [item for item in self.expressions]
         new_pcd.SkuInfoList = {key: copy.deepcopy(skuobj) for key,skuobj in self.SkuInfoList.items()}
@@ -266,10 +287,11 @@ class StructurePcd(PcdClassObject):
         self.SkuOverrideValues = OrderedDict()
         self.StructName = None
         self.PcdDefineLineNo = 0
         self.PkgPath = ""
         self.DefaultValueFromDec = ""
+        self.DefaultValueFromDecInfo = None
         self.ValueChain = set()
         self.PcdFieldValueFromComm = OrderedDict()
         self.PcdFieldValueFromFdf = OrderedDict()
         self.DefaultFromDSC=None
     def __repr__(self):
@@ -281,12 +303,13 @@ class StructurePcd(PcdClassObject):
         if FieldName in self.DefaultValues[DimensionAttr]:
             del self.DefaultValues[DimensionAttr][FieldName]
         self.DefaultValues[DimensionAttr][FieldName] = [Value.strip(), FileName, LineNo]
         return self.DefaultValues[DimensionAttr][FieldName]
 
-    def SetDecDefaultValue(self, DefaultValue):
+    def SetDecDefaultValue(self, DefaultValue,decpath=None,lineno=None):
         self.DefaultValueFromDec = DefaultValue
+        self.DefaultValueFromDecInfo = (decpath,lineno)
     def AddOverrideValue (self, FieldName, Value, SkuName, DefaultStoreName, FileName="", LineNo=0, DimensionAttr = '-1'):
         if SkuName not in self.SkuOverrideValues:
             self.SkuOverrideValues[SkuName] = OrderedDict()
         if DefaultStoreName not in self.SkuOverrideValues[SkuName]:
             self.SkuOverrideValues[SkuName][DefaultStoreName] = OrderedDict()
@@ -317,20 +340,22 @@ class StructurePcd(PcdClassObject):
         self.IsFromDsc = PcdObject.IsFromDsc if PcdObject.IsFromDsc else self.IsFromDsc
         self.validateranges = PcdObject.validateranges if PcdObject.validateranges else self.validateranges
         self.validlists = PcdObject.validlists if PcdObject.validlists else self.validlists
         self.expressions = PcdObject.expressions if PcdObject.expressions else self.expressions
         self.DscRawValue = PcdObject.DscRawValue if PcdObject.DscRawValue else self.DscRawValue
+        self.DscRawValueInfo = PcdObject.DscRawValueInfo if PcdObject.DscRawValueInfo else self.DscRawValueInfo
         self.PcdValueFromComm = PcdObject.PcdValueFromComm if PcdObject.PcdValueFromComm else self.PcdValueFromComm
         self.PcdValueFromFdf = PcdObject.PcdValueFromFdf if PcdObject.PcdValueFromFdf else self.PcdValueFromFdf
         self.CustomAttribute = PcdObject.CustomAttribute if PcdObject.CustomAttribute else self.CustomAttribute
         self.UserDefinedDefaultStoresFlag = PcdObject.UserDefinedDefaultStoresFlag if PcdObject.UserDefinedDefaultStoresFlag else self.UserDefinedDefaultStoresFlag
         if isinstance(PcdObject, StructurePcd):
             self.StructuredPcdIncludeFile = PcdObject.StructuredPcdIncludeFile if PcdObject.StructuredPcdIncludeFile else self.StructuredPcdIncludeFile
             self.PackageDecs = PcdObject.PackageDecs if PcdObject.PackageDecs else self.PackageDecs
             self.DefaultValues = PcdObject.DefaultValues if PcdObject.DefaultValues else self.DefaultValues
             self.PcdMode = PcdObject.PcdMode if PcdObject.PcdMode else self.PcdMode
             self.DefaultValueFromDec = PcdObject.DefaultValueFromDec if PcdObject.DefaultValueFromDec else self.DefaultValueFromDec
+            self.DefaultValueFromDecInfo = PcdObject.DefaultValueFromDecInfo if PcdObject.DefaultValueFromDecInfo else self.DefaultValueFromDecInfo
             self.SkuOverrideValues = PcdObject.SkuOverrideValues if PcdObject.SkuOverrideValues else self.SkuOverrideValues
             self.StructName = PcdObject.DatumType if PcdObject.DatumType else self.StructName
             self.PcdDefineLineNo = PcdObject.PcdDefineLineNo if PcdObject.PcdDefineLineNo else self.PcdDefineLineNo
             self.PkgPath = PcdObject.PkgPath if PcdObject.PkgPath else self.PkgPath
             self.ValueChain = PcdObject.ValueChain if PcdObject.ValueChain else self.ValueChain
@@ -340,10 +365,11 @@ class StructurePcd(PcdClassObject):
     def __deepcopy__(self,memo):
         new_pcd = StructurePcd()
         self.sharedcopy(new_pcd)
 
         new_pcd.DefaultValueFromDec = self.DefaultValueFromDec
+        new_pcd.DefaultValueFromDecInfo = self.DefaultValueFromDecInfo
         new_pcd.PcdMode = self.PcdMode
         new_pcd.StructName = self.DatumType
         new_pcd.PcdDefineLineNo = self.PcdDefineLineNo
         new_pcd.PkgPath = self.PkgPath
         new_pcd.StructuredPcdIncludeFile = [item for item in self.StructuredPcdIncludeFile]
diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/Source/Python/Workspace/DecBuildData.py
index 149c057b70..ea0f816e27 100644
--- a/BaseTools/Source/Python/Workspace/DecBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DecBuildData.py
@@ -399,11 +399,11 @@ class DecBuildData(PackageBuildClassObject):
                     struct_pcd.copy(item)
                     struct_pcd.TokenValue = struct_pcd.TokenValue.strip("{").strip()
                     struct_pcd.TokenSpaceGuidCName, struct_pcd.TokenCName = pcdname.split(".")
                     struct_pcd.PcdDefineLineNo = LineNo
                     struct_pcd.PkgPath = self.MetaFile.File
-                    struct_pcd.SetDecDefaultValue(item.DefaultValue)
+                    struct_pcd.SetDecDefaultValue(item.DefaultValue,self.MetaFile.File,LineNo)
                 else:
                     DemesionAttr, Fields = self.ParsePcdName(item.TokenCName)
                     struct_pcd.AddDefaultValue(Fields, item.DefaultValue, self.MetaFile.File, LineNo,DemesionAttr)
 
             struct_pcd.PackageDecs = dep_pkgs
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 1ffefe6e7e..7b8c9eedf6 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -31,21 +31,20 @@ from .MetaDataTable import *
 from .MetaFileTable import *
 from .MetaFileParser import *
 
 from .WorkspaceCommon import GetDeclaredPcd
 from Common.Misc import AnalyzeDscPcd
-from Common.Misc import ProcessDuplicatedInf,RemoveCComments
+from Common.Misc import ProcessDuplicatedInf,RemoveCComments,ArrayIndex
 import re
 from Common.Parsing import IsValidWord
 from Common.VariableAttributes import VariableAttributes
 import Common.GlobalData as GlobalData
 import subprocess
 from functools import reduce
 from Common.Misc import SaveFileOnChange
 from Workspace.BuildClassObject import PlatformBuildClassObject, StructurePcd, PcdClassObject, ModuleBuildClassObject
 from collections import OrderedDict, defaultdict
-from .BuildClassObject import ArrayIndex
 
 def _IsFieldValueAnArray (Value):
     Value = Value.strip()
     if Value.startswith(TAB_GUID) and Value.endswith(')'):
         return True
@@ -1681,21 +1680,21 @@ class DscBuildData(PlatformBuildClassObject):
                                     File=self.MetaFile, Line=Dummy4)
                 if int(MaxDatumSize, 0) < 0:
                     EdkLogger.error('build', FORMAT_INVALID, "The size value can't be set to negative value for %s." % ".".join((TokenSpaceGuid, PcdCName)),
                                     File=self.MetaFile, Line=Dummy4)
             if (PcdCName, TokenSpaceGuid) in PcdValueDict:
-                PcdValueDict[PcdCName, TokenSpaceGuid][SkuName] = (PcdValue, DatumType, MaxDatumSize)
+                PcdValueDict[PcdCName, TokenSpaceGuid][SkuName] = (PcdValue, DatumType, MaxDatumSize,Dummy4)
             else:
-                PcdValueDict[PcdCName, TokenSpaceGuid] = {SkuName:(PcdValue, DatumType, MaxDatumSize)}
+                PcdValueDict[PcdCName, TokenSpaceGuid] = {SkuName:(PcdValue, DatumType, MaxDatumSize,Dummy4)}
 
         for ((PcdCName, TokenSpaceGuid), PcdSetting) in PcdValueDict.items():
             if self.SkuIdMgr.SystemSkuId in PcdSetting:
-                PcdValue, DatumType, MaxDatumSize = PcdSetting[self.SkuIdMgr.SystemSkuId]
+                PcdValue, DatumType, MaxDatumSize,_ = PcdSetting[self.SkuIdMgr.SystemSkuId]
             elif TAB_DEFAULT in PcdSetting:
-                PcdValue, DatumType, MaxDatumSize = PcdSetting[TAB_DEFAULT]
+                PcdValue, DatumType, MaxDatumSize,_  = PcdSetting[TAB_DEFAULT]
             elif TAB_COMMON in PcdSetting:
-                PcdValue, DatumType, MaxDatumSize = PcdSetting[TAB_COMMON]
+                PcdValue, DatumType, MaxDatumSize,_  = PcdSetting[TAB_COMMON]
             else:
                 PcdValue = None
                 DatumType = None
                 MaxDatumSize = None
 
@@ -1713,11 +1712,13 @@ class DscBuildData(PlatformBuildClassObject):
                                                 IsDsc=True)
             for SkuName in PcdValueDict[PcdCName, TokenSpaceGuid]:
                 Settings = PcdValueDict[PcdCName, TokenSpaceGuid][SkuName]
                 if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue:
                     Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
+                    Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName] = {}
                 Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName][TAB_DEFAULT_STORES_DEFAULT] = Settings[0]
+                Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName][TAB_DEFAULT_STORES_DEFAULT] = (self.MetaFile.File,Settings[3])
         return Pcds
 
     @staticmethod
     def GetStructurePcdMaxSize(str_pcd):
         pcd_default_value = str_pcd.DefaultValue
@@ -1766,28 +1767,45 @@ class DscBuildData(PlatformBuildClassObject):
         return Result
 
     def GenerateSizeFunction(self, Pcd):
         CApp = "// Default Value in Dec \n"
         CApp = CApp + "void Cal_%s_%s_Size(UINT32 *Size){\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
-        if Pcd.IsArray():
+
+        if Pcd.IsArray() and Pcd.Capacity[-1] != "-1":
+            CApp += "  *Size = (sizeof (%s) > *Size ? sizeof (%s) : *Size);\n" % (Pcd.DatumType,Pcd.DatumType)
+        else:
+            if "{CODE(" in Pcd.DefaultValueFromDec:
+                CApp += "  *Size = (sizeof (%s_%s_INIT_Value) > *Size ? sizeof (%s_%s_INIT_Value) : *Size);\n" % (Pcd.TokenSpaceGuidCName,Pcd.TokenCName,Pcd.TokenSpaceGuidCName,Pcd.TokenCName)
             if Pcd.Type in PCD_DYNAMIC_TYPE_SET | PCD_DYNAMIC_EX_TYPE_SET:
                 for skuname in Pcd.SkuInfoList:
                     skuobj = Pcd.SkuInfoList[skuname]
                     if skuobj.VariableName:
                         for defaultstore in skuobj.DefaultStoreDict:
                             pcddef = self.GetPcdDscRawDefaultValue(Pcd,skuname,defaultstore)
-                            if pcddef and "{CODE(" in pcddef:
-                                CApp += "  *Size = (sizeof (%s_%s_%s_%s_Value) > *Size ? sizeof (%s_%s_%s_%s_Value) : *Size);\n" % (Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,defaultstore,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,defaultstore)
+                            if pcddef:
+                                if "{CODE(" in pcddef:
+                                    CApp += "  *Size = (sizeof (%s_%s_%s_%s_Value) > *Size ? sizeof (%s_%s_%s_%s_Value) : *Size);\n" % (Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,defaultstore,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,defaultstore)
+                                else:
+                                    CApp += "  *Size = %s > *Size ? %s : *Size;\n" % (self.GetStructurePcdMaxSize(Pcd),self.GetStructurePcdMaxSize(Pcd))
                     else:
                         pcddef = self.GetPcdDscRawDefaultValue(Pcd,skuname,TAB_DEFAULT_STORES_DEFAULT)
-                        if pcddef and "{CODE(" in pcddef:
-                            CApp += "  *Size = (sizeof (%s_%s_%s_%s_Value) > *Size ? sizeof (%s_%s_%s_%s_Value) : *Size);\n" % (Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,TAB_DEFAULT_STORES_DEFAULT,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,TAB_DEFAULT_STORES_DEFAULT)
+                        if pcddef:
+                            if  "{CODE(" in pcddef:
+                                CApp += "  *Size = (sizeof (%s_%s_%s_%s_Value) > *Size ? sizeof (%s_%s_%s_%s_Value) : *Size);\n" % (Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,TAB_DEFAULT_STORES_DEFAULT,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,skuname,TAB_DEFAULT_STORES_DEFAULT)
+                            else:
+                                CApp += "  *Size = %s > *Size ? %s : *Size;\n" % (self.GetStructurePcdMaxSize(Pcd),self.GetStructurePcdMaxSize(Pcd))
             else:
                 pcddef = self.GetPcdDscRawDefaultValue(Pcd,TAB_DEFAULT,TAB_DEFAULT_STORES_DEFAULT)
-                if pcddef and "{CODE(" in pcddef:
-                    CApp += "  *Size = (sizeof (%s_%s_%s_%s_Value) > *Size ? sizeof (%s_%s_%s_%s_Value) : *Size);\n" % (Pcd.TokenSpaceGuidCName,Pcd.TokenCName,TAB_DEFAULT,TAB_DEFAULT_STORES_DEFAULT,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,TAB_DEFAULT,TAB_DEFAULT_STORES_DEFAULT)
+                if pcddef:
+                    if "{CODE(" in pcddef:
+                        CApp += "  *Size = (sizeof (%s_%s_%s_%s_Value) > *Size ? sizeof (%s_%s_%s_%s_Value) : *Size);\n" % (Pcd.TokenSpaceGuidCName,Pcd.TokenCName,TAB_DEFAULT,TAB_DEFAULT_STORES_DEFAULT,Pcd.TokenSpaceGuidCName,Pcd.TokenCName,TAB_DEFAULT,TAB_DEFAULT_STORES_DEFAULT)
+                    else:
+                        CApp += "  *Size = %s > *Size ? %s : *Size;\n" % (self.GetStructurePcdMaxSize(Pcd),self.GetStructurePcdMaxSize(Pcd))
+        ActualCap = []
         for index in Pcd.DefaultValues:
+            if index:
+                ActualCap.append(index)
             FieldList = Pcd.DefaultValues[index]
             if not FieldList:
                 continue
             for FieldName in FieldList:
                 FieldName = "." + FieldName
@@ -1804,22 +1822,24 @@ class DscBuildData(PlatformBuildClassObject):
                 else:
                     NewFieldName = ''
                     FieldName_ori = FieldName.strip('.')
                     while '[' in  FieldName:
                         NewFieldName = NewFieldName + FieldName.split('[', 1)[0] + '[0]'
-                        ArrayIndex = int(FieldName.split('[', 1)[1].split(']', 1)[0])
+                        Array_Index = int(FieldName.split('[', 1)[1].split(']', 1)[0])
                         FieldName = FieldName.split(']', 1)[1]
                     FieldName = NewFieldName + FieldName
                     while '[' in FieldName and not Pcd.IsArray:
                         FieldName = FieldName.rsplit('[', 1)[0]
-                        CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), ArrayIndex + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], FieldList[FieldName_ori][0])
+                        CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s\n' % (Pcd.DatumType, FieldName.strip("."), Array_Index + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], FieldList[FieldName_ori][0])
         for skuname in Pcd.SkuOverrideValues:
             if skuname == TAB_COMMON:
                 continue
             for defaultstorenameitem in Pcd.SkuOverrideValues[skuname]:
                 CApp = CApp + "// SkuName: %s,  DefaultStoreName: %s \n" % (skuname, defaultstorenameitem)
                 for index in Pcd.SkuOverrideValues[skuname][defaultstorenameitem]:
+                    if index:
+                        ActualCap.append(index)
                     for FieldList in [Pcd.SkuOverrideValues[skuname][defaultstorenameitem][index]]:
                         if not FieldList:
                             continue
                         for FieldName in FieldList:
                             FieldName = "." + FieldName
@@ -1836,16 +1856,16 @@ class DscBuildData(PlatformBuildClassObject):
                             else:
                                 NewFieldName = ''
                                 FieldName_ori = FieldName.strip('.')
                                 while '[' in  FieldName:
                                     NewFieldName = NewFieldName + FieldName.split('[', 1)[0] + '[0]'
-                                    ArrayIndex = int(FieldName.split('[', 1)[1].split(']', 1)[0])
+                                    Array_Index = int(FieldName.split('[', 1)[1].split(']', 1)[0])
                                     FieldName = FieldName.split(']', 1)[1]
                                 FieldName = NewFieldName + FieldName
                                 while '[' in FieldName and not Pcd.IsArray:
                                     FieldName = FieldName.rsplit('[', 1)[0]
-                                    CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), ArrayIndex + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], FieldList[FieldName_ori][0])
+                                    CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), Array_Index + 1, FieldList[FieldName_ori][1], FieldList[FieldName_ori][2], FieldList[FieldName_ori][0])
         if Pcd.PcdFieldValueFromFdf:
             CApp = CApp + "// From fdf \n"
         for FieldName in Pcd.PcdFieldValueFromFdf:
             FieldName = "." + FieldName
             IsArray = _IsFieldValueAnArray(Pcd.PcdFieldValueFromFdf[FieldName.strip(".")][0])
@@ -1861,16 +1881,16 @@ class DscBuildData(PlatformBuildClassObject):
             else:
                 NewFieldName = ''
                 FieldName_ori = FieldName.strip('.')
                 while '[' in  FieldName:
                     NewFieldName = NewFieldName + FieldName.split('[', 1)[0] + '[0]'
-                    ArrayIndex = int(FieldName.split('[', 1)[1].split(']', 1)[0])
+                    Array_Index = int(FieldName.split('[', 1)[1].split(']', 1)[0])
                     FieldName = FieldName.split(']', 1)[1]
                 FieldName = NewFieldName + FieldName
                 while '[' in FieldName:
                     FieldName = FieldName.rsplit('[', 1)[0]
-                    CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %s Value %s \n' % (Pcd.DatumType, FieldName.strip("."), ArrayIndex + 1, Pcd.PcdFieldValueFromFdf[FieldName_ori][1], Pcd.PcdFieldValueFromFdf[FieldName_ori][2], Pcd.PcdFieldValueFromFdf[FieldName_ori][0])
+                    CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %s Value %s \n' % (Pcd.DatumType, FieldName.strip("."), Array_Index + 1, Pcd.PcdFieldValueFromFdf[FieldName_ori][1], Pcd.PcdFieldValueFromFdf[FieldName_ori][2], Pcd.PcdFieldValueFromFdf[FieldName_ori][0])
         if Pcd.PcdFieldValueFromComm:
             CApp = CApp + "// From Command Line \n"
         for FieldName in Pcd.PcdFieldValueFromComm:
             FieldName = "." + FieldName
             IsArray = _IsFieldValueAnArray(Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0])
@@ -1886,20 +1906,41 @@ class DscBuildData(PlatformBuildClassObject):
             else:
                 NewFieldName = ''
                 FieldName_ori = FieldName.strip('.')
                 while '[' in  FieldName:
                     NewFieldName = NewFieldName + FieldName.split('[', 1)[0] + '[0]'
-                    ArrayIndex = int(FieldName.split('[', 1)[1].split(']', 1)[0])
+                    Array_Index = int(FieldName.split('[', 1)[1].split(']', 1)[0])
                     FieldName = FieldName.split(']', 1)[1]
                 FieldName = NewFieldName + FieldName
                 while '[' in FieldName and not Pcd.IsArray:
                     FieldName = FieldName.rsplit('[', 1)[0]
-                    CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), ArrayIndex + 1, Pcd.PcdFieldValueFromComm[FieldName_ori][1], Pcd.PcdFieldValueFromComm[FieldName_ori][2], Pcd.PcdFieldValueFromComm[FieldName_ori][0])
+                    CApp = CApp + '  __FLEXIBLE_SIZE(*Size, %s, %s, %d); // From %s Line %d Value %s \n' % (Pcd.DatumType, FieldName.strip("."), Array_Index + 1, Pcd.PcdFieldValueFromComm[FieldName_ori][1], Pcd.PcdFieldValueFromComm[FieldName_ori][2], Pcd.PcdFieldValueFromComm[FieldName_ori][0])
         if Pcd.GetPcdMaxSize():
             CApp = CApp + "  *Size = (%d > *Size ? %d : *Size); // The Pcd maxsize is %d \n" % (Pcd.GetPcdMaxSize(), Pcd.GetPcdMaxSize(), Pcd.GetPcdMaxSize())
+        ArraySizeByAssign = self.CalculateActualCap(ActualCap)
+        if ArraySizeByAssign > 1:
+            CApp = CApp + "  *Size = (%d > *Size ? %d : *Size); \n" % (ArraySizeByAssign, ArraySizeByAssign)
         CApp = CApp + "}\n"
         return CApp
+    def CalculateActualCap(self,ActualCap):
+        if not ActualCap:
+            return 1
+        maxsize = 1
+        for item in ActualCap:
+            index_elements = ArrayIndex.findall(item)
+            rt = 1
+            for index_e in index_elements:
+                index_num = index_e.lstrip("[").rstrip("]").strip()
+                if not index_num:
+                    # Not support flexiable pcd array assignment 
+                    return 1
+                index_num = int(index_num,16) if index_num.startswith(("0x","0X")) else int(index_num)
+                rt = rt * (index_num+1)
+            if rt  >maxsize:
+                maxsize = rt
+
+        return maxsize
 
     @staticmethod
     def GenerateSizeStatments(Pcd,skuname,defaultstorename):
         if Pcd.IsArray():
             r_datatype = [Pcd.BaseDatumType]
@@ -1974,10 +2015,11 @@ class DscBuildData(PlatformBuildClassObject):
     def GenerateDefaultValueAssignFunction(self, Pcd):
         CApp = "// Default value in Dec \n"
         CApp = CApp + "void Assign_%s_%s_Default_Value(%s *Pcd){\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.BaseDatumType)
         CApp = CApp + '  UINT32  FieldSize;\n'
         CApp = CApp + '  CHAR8   *Value;\n'
+        CApp = CApp + ' UINT32 PcdArraySize;\n'
         DefaultValueFromDec = Pcd.DefaultValueFromDec
         IsArray = _IsFieldValueAnArray(Pcd.DefaultValueFromDec)
         if IsArray:
             try:
                 DefaultValueFromDec = ValueExpressionEx(Pcd.DefaultValueFromDec, TAB_VOID)(True)
@@ -1985,18 +2027,33 @@ class DscBuildData(PlatformBuildClassObject):
                 EdkLogger.error("Build", FORMAT_INVALID, "Invalid value format for %s.%s, from DEC: %s" %
                                 (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, DefaultValueFromDec))
         DefaultValueFromDec = StringToArray(DefaultValueFromDec)
         Value, ValueSize = ParseFieldValue (DefaultValueFromDec)
         if IsArray:
-        #
-        # Use memcpy() to copy value into field
-        #
-            if "{CODE(" in Pcd.DefaultValueFromDec:
-                CApp = CApp + '  memcpy (Pcd, %s_%s_INIT_Value, sizeof(%s_%s_INIT_Value));\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+            #
+            # Use memcpy() to copy value into field
+            #
+            if Pcd.IsArray():
+                pcdarraysize = Pcd.PcdArraySize()
+                if "{CODE(" in Pcd.DefaultValueFromDec:
+                    if Pcd.Capacity[-1] != "-1":
+                        CApp = CApp + '__STATIC_ASSERT(sizeof(%s_%s_INIT_Value) < %d * sizeof(%s), "Pcd %s.%s Value in Dec exceed the array capability %s"); // From  %s Line %s \n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType,Pcd.DefaultValueFromDecInfo[0],Pcd.DefaultValueFromDecInfo[1])
+                    CApp = CApp + ' PcdArraySize = sizeof(%s_%s_INIT_Value);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+                    CApp = CApp + '  memcpy (Pcd, %s_%s_INIT_Value,PcdArraySize);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+                else:
+                    if Pcd.Capacity[-1] != "-1":
+                        CApp = CApp + '__STATIC_ASSERT(%d < %d * sizeof(%s), "Pcd %s.%s Value in Dec exceed the array capability %s"); // From %s Line %s \n' % (ValueSize,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType,Pcd.DefaultValueFromDecInfo[0],Pcd.DefaultValueFromDecInfo[1])
+                    CApp = CApp + ' PcdArraySize = %d;\n' % ValueSize
+                    CApp = CApp + '  Value     = %s; // From DEC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DefaultValueFromDec)
+                    CApp = CApp + '  memcpy (Pcd, Value, PcdArraySize);\n'
             else:
-                CApp = CApp + '  Value     = %s; // From DEC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DefaultValueFromDec)
-                CApp = CApp + '  memcpy (Pcd, Value, %d);\n' % (ValueSize)
+                if "{CODE(" in Pcd.DefaultValueFromDec:
+                    CApp = CApp + '  PcdArraySize = sizeof(%s_%s_INIT_Value);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+                    CApp = CApp + '  memcpy (Pcd, &%s_%s_INIT_Value,PcdArraySize);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
+                else:
+                    CApp = CApp + '  Value     = %s; // From DEC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DefaultValueFromDec)
+                    CApp = CApp + '  memcpy (Pcd, Value, %d);\n' % (ValueSize)
         elif isinstance(Value, str):
             CApp = CApp + '  Pcd = %s; // From DEC Default Value %s\n' % (Value, Pcd.DefaultValueFromDec)
         for index in Pcd.DefaultValues:
             FieldList = Pcd.DefaultValues[index]
             if not FieldList:
@@ -2050,18 +2107,33 @@ class DscBuildData(PlatformBuildClassObject):
                 pcddefaultvalue = Pcd.DscRawValue.get(SkuName, {}).get(DefaultStoreName)
         else:
             pcddefaultvalue = Pcd.DscRawValue.get(SkuName, {}).get(TAB_DEFAULT_STORES_DEFAULT)
 
         return pcddefaultvalue
+    def GetPcdDscRawValueInfo(self,Pcd, SkuName,DefaultStoreName):
+        DscValueInfo = Pcd.DscRawValueInfo.get(SkuName, {}).get(DefaultStoreName)
+        if DscValueInfo:
+            dscfilepath,lineno = DscValueInfo
+        else:
+            dscfilepath = self.MetaFile.File
+            lineno = ""
+        return dscfilepath,lineno
+
     def GenerateInitValueFunction(self, Pcd, SkuName, DefaultStoreName):
         CApp = "// Value in Dsc for Sku: %s, DefaultStore %s\n" % (SkuName, DefaultStoreName)
         CApp = CApp + "void Assign_%s_%s_%s_%s_Value(%s *Pcd){\n" % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, SkuName, DefaultStoreName, Pcd.BaseDatumType)
         CApp = CApp + '  UINT32  FieldSize;\n'
         CApp = CApp + '  CHAR8   *Value;\n'
+        CApp = CApp + ' UINT32 PcdArraySize;\n'
 
         CApp = CApp + "// SkuName: %s,  DefaultStoreName: %s \n" % (TAB_DEFAULT, TAB_DEFAULT_STORES_DEFAULT)
         inherit_OverrideValues = Pcd.SkuOverrideValues[SkuName]
+        dscfilepath,lineno = self.GetPcdDscRawValueInfo(Pcd, SkuName, DefaultStoreName)
+        if lineno:
+            valuefrom = "%s Line %s" % (dscfilepath,str(lineno))
+        else:
+            valuefrom = dscfilepath
 
         pcddefaultvalue = self.GetPcdDscRawDefaultValue(Pcd, SkuName, DefaultStoreName)
         if pcddefaultvalue:
             FieldList = pcddefaultvalue
             IsArray = _IsFieldValueAnArray(FieldList)
@@ -2075,37 +2147,75 @@ class DscBuildData(PlatformBuildClassObject):
             Value, ValueSize = ParseFieldValue (FieldList)
 
             if (SkuName, DefaultStoreName) == (TAB_DEFAULT, TAB_DEFAULT_STORES_DEFAULT):
                 if isinstance(Value, str):
                     if "{CODE(" in Value:
-                        CApp = CApp + '  memcpy (Pcd, %s_%s_%s_%s_Value, sizeof(%s_%s_%s_%s_Value));\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+                        if Pcd.IsArray() and Pcd.Capacity[-1] != "-1":
+                            pcdarraysize = Pcd.PcdArraySize()
+                            CApp = CApp + '__STATIC_ASSERT(sizeof(%s_%s_%s_%s_Value) < %d * sizeof(%s), "Pcd %s.%s Value in Dsc exceed the array capability %s"); // From %s \n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType, valuefrom)
+                        CApp = CApp+ ' PcdArraySize = sizeof(%s_%s_%s_%s_Value);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+                        CApp = CApp + '  memcpy (Pcd, &%s_%s_%s_%s_Value,PcdArraySize);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
                     else:
                         CApp = CApp + '  Pcd = %s; // From DSC Default Value %s\n' % (Value, Pcd.DefaultFromDSC.get(TAB_DEFAULT, {}).get(TAB_DEFAULT_STORES_DEFAULT, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
                 elif IsArray:
-                #
-                # Use memcpy() to copy value into field
-                #
-                    if Pcd.IsArray() and "{CODE(" in pcddefaultvalue:
-                        CApp = CApp + '  memcpy (Pcd, %s_%s_%s_%s_Value, sizeof(%s_%s_%s_%s_Value));\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+                    #
+                    # Use memcpy() to copy value into field
+                    #
+                    if Pcd.IsArray():
+                        pcdarraysize = Pcd.PcdArraySize()
+                        if "{CODE(" in pcddefaultvalue:
+                            if Pcd.Capacity[-1] != "-1":
+                                CApp = CApp + '__STATIC_ASSERT(sizeof(%s_%s_%s_%s_Value) < %d * sizeof(%s), "Pcd %s.%s Value in Dsc exceed the array capability %s"); // From  %s \n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType,valuefrom)
+                            CApp = CApp + ' PcdArraySize = sizeof(%s_%s_%s_%s_Value);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+                            CApp = CApp + '  memcpy (Pcd, %s_%s_%s_%s_Value, PcdArraySize);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+                        else:
+                            if Pcd.Capacity[-1] != "-1":
+                                CApp = CApp + '__STATIC_ASSERT(%d < %d * sizeof(%s), "Pcd %s.%s Value in Dsc exceed the array capability %s"); // From  %s \n' % (ValueSize,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType,valuefrom)
+                            CApp = CApp + ' PcdArraySize = %d;\n' % ValueSize
+                            CApp = CApp + '  Value     = %s; // From DSC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DefaultFromDSC.get(TAB_DEFAULT, {}).get(TAB_DEFAULT_STORES_DEFAULT, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
+                            CApp = CApp + '  memcpy (Pcd, Value, PcdArraySize);\n'
                     else:
-                        CApp = CApp + '  Value     = %s; // From DSC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DefaultFromDSC.get(TAB_DEFAULT, {}).get(TAB_DEFAULT_STORES_DEFAULT, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
-                        CApp = CApp + '  memcpy (Pcd, Value, %d);\n' % (ValueSize)
+                        if "{CODE(" in pcddefaultvalue:
+                            CApp = CApp + '  PcdArraySize = %d < sizeof(%s) * %d ? %d: sizeof(%s) * %d;\n ' % (ValueSize,Pcd.BaseDatumType,pcdarraysize,ValueSize,Pcd.BaseDatumType,pcdarraysize)
+                            CApp = CApp + '  memcpy (Pcd, &%s_%s_%s_%s_Value, PcdArraySize);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+                        else:
+                            CApp = CApp + '  Value     = %s; // From DSC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DefaultFromDSC.get(TAB_DEFAULT, {}).get(TAB_DEFAULT_STORES_DEFAULT, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
+                            CApp = CApp + '  memcpy (Pcd, Value, %d);\n' % (ValueSize)
             else:
                 if isinstance(Value, str):
                     if "{CODE(" in Value:
-                        CApp = CApp + '  memcpy (Pcd, %s_%s_%s_%s_Value, sizeof(%s_%s_%s_%s_Value));\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+                        if Pcd.IsArray() and Pcd.Capacity[-1] != "-1":
+                            pcdarraysize = Pcd.PcdArraySize()
+                            CApp = CApp + '__STATIC_ASSERT(sizeof(%s_%s_%s_%s_Value) < %d * sizeof(%s), "Pcd %s.%s Value in Dsc exceed the array capability %s"); // From %s \n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType,valuefrom)
+                        CApp = CApp + ' PcdArraySize = sizeof(%s_%s_%s_%s_Value);\n '% (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+                        CApp = CApp + '  memcpy (Pcd, &%s_%s_%s_%s_Value, PcdArraySize);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
                     else:
                         CApp = CApp + '  Pcd = %s; // From DSC Default Value %s\n' % (Value, Pcd.DscRawValue.get(SkuName, {}).get(DefaultStoreName))
                 elif IsArray:
-                #
-                # Use memcpy() to copy value into field
-                #
-                    if Pcd.IsArray() and "{CODE(" in pcddefaultvalue:
-                        CApp = CApp + '  memcpy (Pcd, %s_%s_%s_%s_Value, sizeof(%s_%s_%s_%s_Value));\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+                    #
+                    # Use memcpy() to copy value into field
+                    #
+                    if Pcd.IsArray():
+                        pcdarraysize = Pcd.PcdArraySize()
+                        if "{CODE(" in pcddefaultvalue:
+                            if Pcd.Capacity[-1] != "-1":
+                                CApp = CApp + '__STATIC_ASSERT(sizeof(%s_%s_%s_%s_Value) < %d * sizeof(%s), "Pcd %s.%s Value in Dsc exceed the array capability %s"); // From  %s \n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType,valuefrom)
+                            CApp + ' PcdArraySize = sizeof(%s_%s_%s_%s_Value);\n ' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+                            CApp = CApp + '  memcpy (Pcd, %s_%s_%s_%s_Value, PcdArraySize);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+                        else:
+                            if Pcd.Capacity[-1] != "-1":
+                                CApp = CApp + '__STATIC_ASSERT(%d < %d * sizeof(%s), "Pcd %s.%s Value in Dsc exceed the array capability %s"); // From  %s \n' % (ValueSize,pcdarraysize,Pcd.BaseDatumType,Pcd.TokenSpaceGuidCName, Pcd.TokenCName,Pcd.DatumType,valuefrom)
+                            CApp = CApp + ' PcdArraySize = %d;\n' % ValueSize
+                            CApp = CApp + '  Value     = %s; // From DSC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DscRawValue.get(TAB_DEFAULT, {}).get(TAB_DEFAULT_STORES_DEFAULT, Pcd.DefaultValue) if Pcd.DefaultFromDSC else Pcd.DefaultValue)
+                            CApp = CApp + '  memcpy (Pcd, Value, PcdArraySize);\n'
                     else:
-                        CApp = CApp + '  Value     = %s; // From DSC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DscRawValue.get(SkuName, {}).get(DefaultStoreName))
-                        CApp = CApp + '  memcpy (Pcd, Value, %d);\n' % (ValueSize)
+                        if "{CODE(" in pcddefaultvalue:
+                            CApp = CApp + '  PcdArraySize = %d < sizeof(%s) * %d ? %d: sizeof(%s) * %d;\n ' % (ValueSize,Pcd.BaseDatumType,pcdarraysize,ValueSize,Pcd.BaseDatumType,pcdarraysize)
+                            CApp = CApp + '  memcpy (Pcd, &%s_%s_%s_%s_Value, PcdArraySize);\n' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName,SkuName, DefaultStoreName)
+                        else:
+                            CApp = CApp + '  Value     = %s; // From DSC Default Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), Pcd.DscRawValue.get(SkuName, {}).get(DefaultStoreName))
+                            CApp = CApp + '  memcpy (Pcd, Value, %d);\n' % (ValueSize)
 
         inheritvalue = inherit_OverrideValues.get(DefaultStoreName)
         if not inheritvalue:
             inheritvalue = []
         for index in inheritvalue:
@@ -2327,10 +2437,13 @@ class DscBuildData(PlatformBuildClassObject):
             # the flexible array member.  The flexible array member must be the last field
             # in a structure.  The size formula for this case is:
             # OFFSET_OF(FlexbleArrayField) + sizeof(FlexibleArray[0]) * (HighestIndex + 1)
             #
             CApp = CApp + DscBuildData.GenerateSizeStatments(Pcd,SkuName,DefaultStoreName)
+            if Pcd.IsArray() and Pcd.Capacity[-1] != "-1":
+                CApp = CApp + '  OriginalSize = OriginalSize < sizeof(%s) * %d? OriginalSize:sizeof(%s) * %d; \n' % (Pcd.BaseDatumType,Pcd.PcdArraySize(),Pcd.BaseDatumType,Pcd.PcdArraySize())
+                CApp = CApp + '  Size = sizeof(%s) * %d; \n' % (Pcd.BaseDatumType,Pcd.PcdArraySize())
 
             #
             # Allocate and zero buffer for the PCD
             # Must handle cases where current value is smaller, larger, or same size
             # Always keep that larger one as the current size
@@ -2377,12 +2490,10 @@ class DscBuildData(PlatformBuildClassObject):
 
     def GenerateArrayAssignment(self, Pcd):
         CApp = ""
         if not Pcd:
             return CApp
-        if not Pcd.IsArray():
-            return CApp
         Demesion = ""
         for d in Pcd.Capacity:
             Demesion += "[]"
 
         Value = Pcd.DefaultValueFromDec
@@ -2770,11 +2881,13 @@ class DscBuildData(PlatformBuildClassObject):
                                                     None,
                                                     IsDsc=True)
 
             if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue:
                 Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
+                Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName] = {}
             Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName][TAB_DEFAULT_STORES_DEFAULT] = PcdValue
+            Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName][TAB_DEFAULT_STORES_DEFAULT] = (self.MetaFile.File,Dummy4)
 
         for pcd in Pcds.values():
             pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]
             # Only fix the value while no value provided in DSC file.
             for sku in pcd.SkuInfoList.values():
@@ -2972,11 +3085,13 @@ class DscBuildData(PlatformBuildClassObject):
                 Pcds[PcdCName, TokenSpaceGuid] = PcdClassObj
 
                 Pcds[PcdCName, TokenSpaceGuid].CustomAttribute['DscPosition'] = int(Dummy4)
             if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue:
                 Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
+                Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName] = {}
             Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName][DefaultStore] = DefaultValue
+            Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName][DefaultStore] = (self.MetaFile.File,Dummy4)
         for pcd in Pcds.values():
             pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]
             pcd.DatumType = pcdDecObject.DatumType
             # Only fix the value while no value provided in DSC file.
             for sku in pcd.SkuInfoList.values():
@@ -3110,11 +3225,13 @@ class DscBuildData(PlatformBuildClassObject):
                                                 None,
                                                 IsDsc=True)
 
             if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue:
                 Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {}
+                Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName] = {}
             Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName][TAB_DEFAULT_STORES_DEFAULT] = InitialValue
+            Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName][TAB_DEFAULT_STORES_DEFAULT] = (self.MetaFile.File,Dummy4)
         for pcd in Pcds.values():
             pcdDecObject = self._DecPcds[pcd.TokenCName, pcd.TokenSpaceGuidCName]
             pcd.DatumType = pcdDecObject.DatumType
             # Only fix the value while no value provided in DSC file.
             for sku in pcd.SkuInfoList.values():
-- 
2.18.0.windows.1



------------------------------

Message: 23
Date: Thu, 21 Feb 2019 15:21:07 +0000
From: Julien Grall <julien.grall@arm.com>
To: edk2-devel@lists.01.org
Cc: afish@apple.com, lersek@redhat.com, leif.lindholm@linaro.org,
	michael.d.kinney@intel.com, Julien Grall <julien.grall@arm.com>
Subject: [edk2] [PATCH] Maintainers.txt: Update e-mail address for
	Julien Grall
Message-ID: <20190221152107.8263-1-julien.grall@arm.com>

I don't watch much my Linaro e-mail anymore. So update my e-mail address
from Linaro to the Arm one.

Contributed-under: Tianocore Contribution Agreement 1.1
Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 Maintainers.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Maintainers.txt b/Maintainers.txt
index 3b2676bc32..1e3fdc1de9 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -80,7 +80,7 @@ ArmVirtPkg
 W: https://github.com/tianocore/tianocore.github.io/wiki/ArmVirtPkg
 M: Laszlo Ersek <lersek@redhat.com>
 M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
-R: Julien Grall <julien.grall@linaro.org>
+R: Julien Grall <julien.grall@arm.com>
 
 BaseTools
 W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
@@ -217,7 +217,7 @@ M: Jordan Justen <jordan.l.justen@intel.com>
 M: Laszlo Ersek <lersek@redhat.com>
 M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
 R: Anthony Perard <anthony.perard@citrix.com>
-R: Julien Grall <julien.grall@linaro.org>
+R: Julien Grall <julien.grall@arm.com>
 S: Maintained
 
 PcAtChipsetPkg
-- 
2.11.0



------------------------------

Message: 24
Date: Thu, 21 Feb 2019 16:45:18 +0100
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Julien Grall <julien.grall@arm.com>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,  "Kinney,
	Michael D" <michael.d.kinney@intel.com>, Laszlo Ersek
	<lersek@redhat.com>
Subject: Re: [edk2] [PATCH] Maintainers.txt: Update e-mail address for
	Julien Grall
Message-ID:
	<CAKv+Gu98_yVcSjT+TLgyei1ptebxvMWKAwUgNqiKDcon2Jinhw@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

On Thu, 21 Feb 2019 at 16:29, Julien Grall <julien.grall@arm.com> wrote:
>
> I don't watch much my Linaro e-mail anymore. So update my e-mail address
> from Linaro to the Arm one.
>
> Contributed-under: Tianocore Contribution Agreement 1.1
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  Maintainers.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 3b2676bc32..1e3fdc1de9 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -80,7 +80,7 @@ ArmVirtPkg
>  W: https://github.com/tianocore/tianocore.github.io/wiki/ArmVirtPkg
>  M: Laszlo Ersek <lersek@redhat.com>
>  M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> -R: Julien Grall <julien.grall@linaro.org>
> +R: Julien Grall <julien.grall@arm.com>
>
>  BaseTools
>  W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
> @@ -217,7 +217,7 @@ M: Jordan Justen <jordan.l.justen@intel.com>
>  M: Laszlo Ersek <lersek@redhat.com>
>  M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>  R: Anthony Perard <anthony.perard@citrix.com>
> -R: Julien Grall <julien.grall@linaro.org>
> +R: Julien Grall <julien.grall@arm.com>
>  S: Maintained
>
>  PcAtChipsetPkg
> --
> 2.11.0
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


------------------------------

Message: 25
Date: Thu, 21 Feb 2019 17:47:14 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: Julien Grall <julien.grall@arm.com>, edk2-devel@lists.01.org
Cc: afish@apple.com, leif.lindholm@linaro.org,
	michael.d.kinney@intel.com
Subject: Re: [edk2] [PATCH] Maintainers.txt: Update e-mail address for
	Julien Grall
Message-ID: <10a4fa4a-e94a-2d6a-ef3b-8ef6b5bdd959@redhat.com>
Content-Type: text/plain; charset=utf-8

On 02/21/19 16:21, Julien Grall wrote:
> I don't watch much my Linaro e-mail anymore. So update my e-mail address
> from Linaro to the Arm one.
> 
> Contributed-under: Tianocore Contribution Agreement 1.1
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> ---
>  Maintainers.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 3b2676bc32..1e3fdc1de9 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -80,7 +80,7 @@ ArmVirtPkg
>  W: https://github.com/tianocore/tianocore.github.io/wiki/ArmVirtPkg
>  M: Laszlo Ersek <lersek@redhat.com>
>  M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> -R: Julien Grall <julien.grall@linaro.org>
> +R: Julien Grall <julien.grall@arm.com>
>  
>  BaseTools
>  W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
> @@ -217,7 +217,7 @@ M: Jordan Justen <jordan.l.justen@intel.com>
>  M: Laszlo Ersek <lersek@redhat.com>
>  M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>  R: Anthony Perard <anthony.perard@citrix.com>
> -R: Julien Grall <julien.grall@linaro.org>
> +R: Julien Grall <julien.grall@arm.com>
>  S: Maintained
>  
>  PcAtChipsetPkg
> 

Acked-by: Laszlo Ersek <lersek@redhat.com>

Ard, I assume we'll push this before my

  [edk2] [PATCH v2 0/2] Maintainers: updates for ArmVirtPkg and OvmfPkg

This patch is going to cause conflicts for my series, but I'll resolve
those when I push the series.

Julien: can you please also ACK patch #2 of the series that I reference
above. If you are subscribed to the list with your @arm.com email
address, you should find it at least in your list folder (if not in your
inbox).

Thanks,
Laszlo


------------------------------

Message: 26
Date: Thu, 21 Feb 2019 16:49:15 +0000
From: Julien Grall <julien.grall@arm.com>
To: Laszlo Ersek <lersek@redhat.com>, edk2-devel@lists.01.org
Cc: Andrew Fish <afish@apple.com>, Anthony Perard
	<anthony.perard@citrix.com>, Ard Biesheuvel
	<ard.biesheuvel@linaro.org>, Jordan Justen
	<jordan.l.justen@intel.com>, Leif Lindholm <leif.lindholm@linaro.org>,
	Michael D Kinney <michael.d.kinney@intel.com>
Subject: Re: [edk2] [PATCH v2 2/2] Maintainers: specify the scope for
	OvmfPkg/ArmVirtPkg Xen module reviewers
Message-ID: <8e4f2158-3b17-5799-3152-47e477cf74ae@arm.com>
Content-Type: text/plain; charset=utf-8; format=flowed

Hi Laszlo,

On 21/02/2019 12:28, Laszlo Ersek wrote:
> We can use the format introduced under MdeModulePkg to clarify the
> reviewership scopes a little. This should decrease the review spam that
> Xen reviewers get.
> 
> Cc: Andrew Fish <afish@apple.com>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien.grall@linaro.org>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
> 
> Notes:
>      v2:
>      - new in v2
> 
>   Maintainers.txt | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index e45b77039d67..86f80b7d38a0 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -81,6 +81,7 @@ W: https://github.com/tianocore/tianocore.github.io/wiki/ArmVirtPkg
>   M: Laszlo Ersek <lersek@redhat.com>
>   M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>   R: Julien Grall <julien.grall@linaro.org>
> +   (Xen modules)
>   
>   BaseTools
>   W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
> @@ -217,7 +218,9 @@ M: Jordan Justen <jordan.l.justen@intel.com>
>   M: Laszlo Ersek <lersek@redhat.com>
>   M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>   R: Anthony Perard <anthony.perard@citrix.com>
> +   (Xen modules)
>   R: Julien Grall <julien.grall@linaro.org>
> +   (Xen modules)
>   R: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
>      (TPM2 modules)
>   R: Stefan Berger <stefanb@linux.ibm.com>
> 

Acked-by: Julien Grall <julien.grall@arm.com>

Cheers,


-- 
Julien Grall


------------------------------

Message: 27
Date: Thu, 21 Feb 2019 16:50:55 +0000
From: Julien Grall <julien.grall@arm.com>
To: Laszlo Ersek <lersek@redhat.com>, edk2-devel@lists.01.org
Cc: afish@apple.com, leif.lindholm@linaro.org,
	michael.d.kinney@intel.com
Subject: Re: [edk2] [PATCH] Maintainers.txt: Update e-mail address for
	Julien Grall
Message-ID: <52406734-b421-c2fc-55dd-0396af97a905@arm.com>
Content-Type: text/plain; charset=utf-8; format=flowed

Hi,

On 21/02/2019 16:47, Laszlo Ersek wrote:
> On 02/21/19 16:21, Julien Grall wrote:
>> I don't watch much my Linaro e-mail anymore. So update my e-mail address
>> from Linaro to the Arm one.
>>
>> Contributed-under: Tianocore Contribution Agreement 1.1
>> Signed-off-by: Julien Grall <julien.grall@arm.com>
>> ---
>>   Maintainers.txt | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/Maintainers.txt b/Maintainers.txt
>> index 3b2676bc32..1e3fdc1de9 100644
>> --- a/Maintainers.txt
>> +++ b/Maintainers.txt
>> @@ -80,7 +80,7 @@ ArmVirtPkg
>>   W: https://github.com/tianocore/tianocore.github.io/wiki/ArmVirtPkg
>>   M: Laszlo Ersek <lersek@redhat.com>
>>   M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> -R: Julien Grall <julien.grall@linaro.org>
>> +R: Julien Grall <julien.grall@arm.com>
>>   
>>   BaseTools
>>   W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
>> @@ -217,7 +217,7 @@ M: Jordan Justen <jordan.l.justen@intel.com>
>>   M: Laszlo Ersek <lersek@redhat.com>
>>   M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>   R: Anthony Perard <anthony.perard@citrix.com>
>> -R: Julien Grall <julien.grall@linaro.org>
>> +R: Julien Grall <julien.grall@arm.com>
>>   S: Maintained
>>   
>>   PcAtChipsetPkg
>>
> 
> Acked-by: Laszlo Ersek <lersek@redhat.com>
> 
> Ard, I assume we'll push this before my
> 
>    [edk2] [PATCH v2 0/2] Maintainers: updates for ArmVirtPkg and OvmfPkg
> 
> This patch is going to cause conflicts for my series, but I'll resolve
> those when I push the series.

Thank you for resolving the conflicts.

> Julien: can you please also ACK patch #2 of the series that I reference
> above. If you are subscribed to the list with your @arm.com email
> address, you should find it at least in your list folder (if not in your
> inbox).

It is acked now.

Cheers,

-- 
Julien Grall


------------------------------

Message: 28
Date: Thu, 21 Feb 2019 17:56:53 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: Julien Grall <julien.grall@arm.com>, edk2-devel@lists.01.org
Cc: Andrew Fish <afish@apple.com>, Anthony Perard
	<anthony.perard@citrix.com>, Ard Biesheuvel
	<ard.biesheuvel@linaro.org>, Jordan Justen
	<jordan.l.justen@intel.com>, Leif Lindholm <leif.lindholm@linaro.org>,
	Michael D Kinney <michael.d.kinney@intel.com>
Subject: Re: [edk2] [PATCH v2 2/2] Maintainers: specify the scope for
	OvmfPkg/ArmVirtPkg Xen module reviewers
Message-ID: <1d07427a-3178-bb0b-38e4-8ecf7264153d@redhat.com>
Content-Type: text/plain; charset=utf-8

On 02/21/19 17:49, Julien Grall wrote:
> Hi Laszlo,
> 
> On 21/02/2019 12:28, Laszlo Ersek wrote:
>> We can use the format introduced under MdeModulePkg to clarify the
>> reviewership scopes a little. This should decrease the review spam that
>> Xen reviewers get.
>>
>> Cc: Andrew Fish <afish@apple.com>
>> Cc: Anthony Perard <anthony.perard@citrix.com>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Julien Grall <julien.grall@linaro.org>
>> Cc: Leif Lindholm <leif.lindholm@linaro.org>
>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
>> ---
>>
>> Notes:
>> ???? v2:
>> ???? - new in v2
>>
>> ? Maintainers.txt | 3 +++
>> ? 1 file changed, 3 insertions(+)
>>
>> diff --git a/Maintainers.txt b/Maintainers.txt
>> index e45b77039d67..86f80b7d38a0 100644
>> --- a/Maintainers.txt
>> +++ b/Maintainers.txt
>> @@ -81,6 +81,7 @@ W:
>> https://github.com/tianocore/tianocore.github.io/wiki/ArmVirtPkg
>> ? M: Laszlo Ersek <lersek@redhat.com>
>> ? M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ? R: Julien Grall <julien.grall@linaro.org>
>> +?? (Xen modules)
>> ? ? BaseTools
>> ? W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
>> @@ -217,7 +218,9 @@ M: Jordan Justen <jordan.l.justen@intel.com>
>> ? M: Laszlo Ersek <lersek@redhat.com>
>> ? M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ? R: Anthony Perard <anthony.perard@citrix.com>
>> +?? (Xen modules)
>> ? R: Julien Grall <julien.grall@linaro.org>
>> +?? (Xen modules)
>> ? R: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
>> ???? (TPM2 modules)
>> ? R: Stefan Berger <stefanb@linux.ibm.com>
>>
> 
> Acked-by: Julien Grall <julien.grall@arm.com>

Thanks!

(For readers not following the other thread: by the time I push this,
Maintainers.txt will refer to Julien's @arm.com email address. I'll
resolve the conflict, and there won't be a mismatch between the text
file contents and Julien's ACK.)

Laszlo


------------------------------

Message: 29
Date: Thu, 21 Feb 2019 18:16:11 +0100
From: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: edk2-devel@lists.01.org, Andrew Fish <afish@apple.com>,  Ard
	Biesheuvel <ard.biesheuvel@linaro.org>, Jordan Justen
	<jordan.l.justen@intel.com>,  Leif Lindholm
	<leif.lindholm@linaro.org>, Michael D Kinney
	<michael.d.kinney@intel.com>,  Stefan Berger <stefanb@linux.ibm.com>
Subject: Re: [edk2] [PATCH v2 1/2] Maintainers: add TPM2 reviewers for
	OvmfPkg
Message-ID:
	<CAMxuvay1rVxwKJ20awoJ2Gkar-g1E-asjQUHB-sgD13EUQ9yzw@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Hi
On Thu, Feb 21, 2019 at 1:28 PM Laszlo Ersek <lersek@redhat.com> wrote:
>
> OVMF can be built with a significant amount of TPM2 code now; add
> Marc-Andr? and Stefan as Reviewers for TPM2-related patches.
>
> Keep the list of "R" entries alphabetically sorted.
>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Stefan Berger <stefanb@linux.ibm.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Acked-by: Jordan Justen <jordan.l.justen@intel.com>

Reviewed-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com>

> ---
>
> Notes:
>     v2:
>     - pick up feedback tags
>     - describe the Reviewership scope, in the format seen under MdeModulePkg
>       [Marc-Andr?]
>
>  Maintainers.txt | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 3b2676bc32ea..e45b77039d67 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -218,6 +218,10 @@ M: Laszlo Ersek <lersek@redhat.com>
>  M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>  R: Anthony Perard <anthony.perard@citrix.com>
>  R: Julien Grall <julien.grall@linaro.org>
> +R: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
> +   (TPM2 modules)
> +R: Stefan Berger <stefanb@linux.ibm.com>
> +   (TPM2 modules)
>  S: Maintained
>
>  PcAtChipsetPkg
> --
> 2.19.1.3.g30247aa5d201
>
>


------------------------------

Message: 30
Date: Thu, 21 Feb 2019 18:14:13 +0000
From: Sami Mujawar <sami.mujawar@arm.com>
To: edk2-devel@lists.01.org
Cc: alexei.fedorov@arm.com, leif.lindholm@linaro.org,
	Matteo.Carlini@arm.com,  Stephanie.Hughes-Fitt@arm.com, nd@arm.com
Subject: [edk2] [PATCH v1 5/6] DynamicTablesPkg: Remove GIC
	Distributor Id field
Message-ID: <20190221181414.83136-6-sami.mujawar@arm.com>

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

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

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 DynamicTablesPkg/Include/ArmNameSpaceObjects.h                   | 5 +----
 DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c | 4 +++-
 2 files changed, 4 insertions(+), 5 deletions(-)

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




------------------------------

Message: 31
Date: Thu, 21 Feb 2019 18:14:08 +0000
From: Sami Mujawar <sami.mujawar@arm.com>
To: edk2-devel@lists.01.org
Cc: alexei.fedorov@arm.com, leif.lindholm@linaro.org,
	Matteo.Carlini@arm.com,  Stephanie.Hughes-Fitt@arm.com, nd@arm.com
Subject: [edk2] [PATCH v1 0/6] DynamicTablesPkg: Framework updates and
	fixes
Message-ID: <20190221181414.83136-1-sami.mujawar@arm.com>

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

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>

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

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

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

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

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




------------------------------

Message: 32
Date: Thu, 21 Feb 2019 18:14:10 +0000
From: Sami Mujawar <sami.mujawar@arm.com>
To: edk2-devel@lists.01.org
Cc: alexei.fedorov@arm.com, leif.lindholm@linaro.org,
	Matteo.Carlini@arm.com,  Stephanie.Hughes-Fitt@arm.com, nd@arm.com
Subject: [edk2] [PATCH v1 2/6] DynamicTablesPkg: Rename enum used for
	ID Mapping
Message-ID: <20190221181414.83136-3-sami.mujawar@arm.com>

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

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 DynamicTablesPkg/Include/ArmNameSpaceObjects.h                   | 2 +-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

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




------------------------------

Message: 33
Date: Thu, 21 Feb 2019 18:14:12 +0000
From: Sami Mujawar <sami.mujawar@arm.com>
To: edk2-devel@lists.01.org
Cc: alexei.fedorov@arm.com, leif.lindholm@linaro.org,
	Matteo.Carlini@arm.com,  Stephanie.Hughes-Fitt@arm.com, nd@arm.com
Subject: [edk2] [PATCH v1 4/6] DynamicTablesPkg: DGB2: Update
	DBG2_DEBUG_PORT_DDI
Message-ID: <20190221181414.83136-5-sami.mujawar@arm.com>

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

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

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




------------------------------

Message: 34
Date: Thu, 21 Feb 2019 18:14:09 +0000
From: Sami Mujawar <sami.mujawar@arm.com>
To: edk2-devel@lists.01.org
Cc: alexei.fedorov@arm.com, leif.lindholm@linaro.org,
	Matteo.Carlini@arm.com,  Stephanie.Hughes-Fitt@arm.com, nd@arm.com
Subject: [edk2] [PATCH v1 1/6] DynamicTablesPkg: Fix depex and
	protocol section
Message-ID: <20190221181414.83136-2-sami.mujawar@arm.com>

Updated the DynamicTableFactoryDxe and DynamicTableManagerDxe
to setup the correct dependency order. Also updated the
Protocols section to reflect the protocols that are produced
or consumed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf |  7 ++-----
 DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf | 11 +++++++----
 2 files changed, 9 insertions(+), 9 deletions(-)

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




------------------------------

Message: 35
Date: Thu, 21 Feb 2019 18:14:11 +0000
From: Sami Mujawar <sami.mujawar@arm.com>
To: edk2-devel@lists.01.org
Cc: alexei.fedorov@arm.com, leif.lindholm@linaro.org,
	Matteo.Carlini@arm.com,  Stephanie.Hughes-Fitt@arm.com, nd@arm.com
Subject: [edk2] [PATCH v1 3/6] DynamicTablesPkg: Add OEM Info
Message-ID: <20190221181414.83136-4-sami.mujawar@arm.com>

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

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

diff --git a/DynamicTablesPkg/Include/Library/TableHelperLib.h b/DynamicTablesPkg/Include/Library/TableHelperLib.h
index 3c4e1d23d2e6955388ab0b51fb57779f2225beb2..0f872bc3d08bf78e33bd8dab866e7bf57e00cb8c 100644
--- a/DynamicTablesPkg/Include/Library/TableHelperLib.h
+++ b/DynamicTablesPkg/Include/Library/TableHelperLib.h
@@ -45,7 +45,7 @@ GetCgfMgrInfo (
   @param [in]     Generator      Pointer to the ACPI table Generator.
   @param [in,out] AcpiHeader     Pointer to the ACPI table header to be
                                  updated.
-  @param [in]     Revision       Revision of the ACPI table.
+  @param [in]     AcpiTableInfo  Pointer to the ACPI table info structure.
   @param [in]     Length         Length of the ACPI table.
 
   @retval EFI_SUCCESS           The ACPI table is updated successfully.
@@ -61,7 +61,7 @@ AddAcpiHeader (
   IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
   IN      CONST ACPI_TABLE_GENERATOR                  * CONST Generator,
   IN OUT  EFI_ACPI_DESCRIPTION_HEADER                 * CONST AcpiHeader,
-  IN      CONST UINT32                                        Revision,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
   IN      CONST UINT32                                        Length
   );
 
diff --git a/DynamicTablesPkg/Include/StandardNameSpaceObjects.h b/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
index 4377ee8f785399b02fec824f3a34d2f4ed3b1c01..58503858b27141cf7647a410c4b0b3fa574033de 100644
--- a/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/StandardNameSpaceObjects.h
@@ -93,6 +93,24 @@ typedef struct CmAStdObjAcpiTableInfo {
   /// Optional pointer to the ACPI table data
   EFI_ACPI_DESCRIPTION_HEADER  * AcpiTableData;
 
+  /// An OEM-supplied string that the OEM uses to identify the particular
+  /// data table. This field is particularly useful when defining a definition
+  /// block to distinguish definition block functions. The OEM assigns each
+  /// dissimilar table a new OEM Table ID.
+  /// This field could be constructed using the SIGNATURE_64() macro.
+  ///   e.g. SIGNATURE_64 ('A','R','M','H','G','T','D','T')
+  /// Note: If this field is not populated (has value of Zero), then the
+  /// Generators shall populate this information using part of the
+  /// CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.OemId field and the
+  /// ACPI table signature.
+  UINT64                         OemTableId;
+
+  /// An OEM-supplied revision number. Larger numbers are assumed to be
+  /// newer revisions.
+  /// Note: If this field is not populated (has value of Zero), then the
+  /// Generators shall populate this information using the revision of the
+  /// Configuration Manager (CM_STD_OBJ_CONFIGURATION_MANAGER_INFO.Revision).
+  UINT32                         OemRevision;
 } CM_STD_OBJ_ACPI_TABLE_INFO;
 
 /** A structure used to describe the SMBIOS table generators to be invoked.
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
index e21e2b660634b1aedce8167b74573694d6df2a3b..697cfc46abaedf34d30abf26e7ebb2b4d271822a 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiDbg2LibArm/Dbg2Generator.c
@@ -342,7 +342,7 @@ BuildDbg2Table (
              CfgMgrProtocol,
              This,
              (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiDbg2,
-             AcpiTableInfo->AcpiTableRevision,
+             AcpiTableInfo,
              sizeof (DBG2_TABLE)
              );
   if (EFI_ERROR (Status)) {
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
index 62927b51d6d7c1585da1cb0d59785e2382639002..6699901b42a63a152027de59887ed097748ece91 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiFadtLibArm/FadtGenerator.c
@@ -537,7 +537,7 @@ BuildFadtTable (
              CfgMgrProtocol,
              This,
              (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiFadt,
-             AcpiTableInfo->AcpiTableRevision,
+             AcpiTableInfo,
              sizeof (EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE)
              );
   if (EFI_ERROR (Status)) {
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
index 70f52507bc7f12a776f76271b3f378bc62e717ba..d58794ee3ef5b72a8b2e3eb930ad5ab5bbb57c38 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiGtdtLibArm/GtdtGenerator.c
@@ -518,7 +518,7 @@ BuildGtdtTable (
              CfgMgrProtocol,
              This,
              &Gtdt->Header,
-             AcpiTableInfo->AcpiTableRevision,
+             AcpiTableInfo,
              TableSize
              );
   if (EFI_ERROR (Status)) {
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
index b53c4bb47798d4ad441db1fe1b1e5b180e313403..2bac7a59ea40d6a3cae675b39d5df26ab7783a29 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/IortGenerator.c
@@ -1798,7 +1798,7 @@ BuildIortTable (
              CfgMgrProtocol,
              This,
              &Iort->Header,
-             AcpiTableInfo->AcpiTableRevision,
+             AcpiTableInfo,
              TableSize
              );
   if (EFI_ERROR (Status)) {
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
index 06794758308e028b7d8da06670b1793cbdb3ae81..1ee0b9e006bfa00ea5bbf6aa64209dac244c90a0 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/MadtGenerator.c
@@ -569,7 +569,7 @@ BuildMadtTable (
              CfgMgrProtocol,
              This,
              &Madt->Header,
-             AcpiTableInfo->AcpiTableRevision,
+             AcpiTableInfo,
              TableSize
              );
   if (EFI_ERROR (Status)) {
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
index 29eb72bd917227e87b8f126aa098a6e0ff3918cc..2131683a35158f40304892da9ab12e547483a4bc 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiMcfgLibArm/McfgGenerator.c
@@ -220,7 +220,7 @@ BuildMcfgTable (
              CfgMgrProtocol,
              This,
              &Mcfg->Header,
-             AcpiTableInfo->AcpiTableRevision,
+             AcpiTableInfo,
              TableSize
              );
   if (EFI_ERROR (Status)) {
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
index 23d3a50713d200321e3d93850c1b42e48da2faeb..5018eb8ebfb4053fe845e5403b0ad1df373255a0 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
@@ -209,7 +209,7 @@ BuildSpcrTable (
              CfgMgrProtocol,
              This,
              (EFI_ACPI_DESCRIPTION_HEADER*)&AcpiSpcr,
-             AcpiTableInfo->AcpiTableRevision,
+             AcpiTableInfo,
              sizeof (EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE)
              );
   if (EFI_ERROR (Status)) {
diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c
index 02860ddf233b4a44c30450c8c090b416f1e07d81..203207bac2b202f568072b68e8cb25c5c258045f 100644
--- a/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c
+++ b/DynamicTablesPkg/Library/Common/TableHelperLib/TableHelper.c
@@ -100,7 +100,7 @@ GetCgfMgrInfo (
   @param [in]     Generator      Pointer to the ACPI table Generator.
   @param [in,out] AcpiHeader     Pointer to the ACPI table header to be
                                  updated.
-  @param [in]     Revision       Revision of the ACPI table.
+  @param [in]     AcpiTableInfo  Pointer to the ACPI table info structure.
   @param [in]     Length         Length of the ACPI table.
 
   @retval EFI_SUCCESS           The ACPI table is updated successfully.
@@ -116,7 +116,7 @@ AddAcpiHeader (
   IN      CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL  * CONST CfgMgrProtocol,
   IN      CONST ACPI_TABLE_GENERATOR                  * CONST Generator,
   IN OUT  EFI_ACPI_DESCRIPTION_HEADER                 * CONST AcpiHeader,
-  IN      CONST UINT32                                        Revision,
+  IN      CONST CM_STD_OBJ_ACPI_TABLE_INFO            * CONST AcpiTableInfo,
   IN      CONST UINT32                                        Length
   )
 {
@@ -151,7 +151,7 @@ AddAcpiHeader (
   // UINT32  Length
   AcpiHeader->Length = Length;
   // UINT8   Revision
-  AcpiHeader->Revision = Revision;
+  AcpiHeader->Revision = AcpiTableInfo->AcpiTableRevision;
   // UINT8   Checksum
   AcpiHeader->Checksum = 0;
 
@@ -159,12 +159,24 @@ AddAcpiHeader (
   CopyMem (AcpiHeader->OemId, CfgMfrInfo->OemId, sizeof (AcpiHeader->OemId));
 
   // UINT64  OemTableId
-  AcpiHeader->OemTableId = Generator->CreatorId;
-  AcpiHeader->OemTableId <<= 32;
-  AcpiHeader->OemTableId |= Generator->AcpiTableSignature;
+  if (AcpiTableInfo->OemTableId != 0) {
+    AcpiHeader->OemTableId = AcpiTableInfo->OemTableId;
+  } else {
+    AcpiHeader->OemTableId = SIGNATURE_32 (
+                               CfgMfrInfo->OemId[0],
+                               CfgMfrInfo->OemId[1],
+                               CfgMfrInfo->OemId[2],
+                               CfgMfrInfo->OemId[3]
+                               ) |
+                             ((UINT64)Generator->AcpiTableSignature << 32);
+  }
 
   // UINT32  OemRevision
-  AcpiHeader->OemRevision = CfgMfrInfo->Revision;
+  if (AcpiTableInfo->OemRevision != 0) {
+    AcpiHeader->OemRevision = AcpiTableInfo->OemRevision;
+  } else {
+    AcpiHeader->OemRevision = CfgMfrInfo->Revision;
+  }
 
   // UINT32  CreatorId
   AcpiHeader->CreatorId = Generator->CreatorId;
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'




------------------------------

Message: 36
Date: Thu, 21 Feb 2019 18:14:14 +0000
From: Sami Mujawar <sami.mujawar@arm.com>
To: edk2-devel@lists.01.org
Cc: alexei.fedorov@arm.com, leif.lindholm@linaro.org,
	Matteo.Carlini@arm.com,  Stephanie.Hughes-Fitt@arm.com, nd@arm.com
Subject: [edk2] [PATCH v1 6/6] DynamicTablesPkg: Minor updates and fix
	typos
Message-ID: <20190221181414.83136-7-sami.mujawar@arm.com>

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

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 DynamicTablesPkg/Include/ArmNameSpaceObjects.h | 66 ++++++++++++++++----
 1 file changed, 55 insertions(+), 11 deletions(-)

diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
index 73139eb3273e89205ef9e6bee67b1b842f7f516b..ec31c40449d0658f98a89ce0bb6f604b491f1f34 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -59,6 +59,8 @@ typedef enum ArmObjectID {
 
 /** A structure that describes the
     ARM Boot Architecture flags.
+
+    ID: EArmObjBootArchInfo
 */
 typedef struct CmArmBootArchInfo {
   /** This is the ARM_BOOT_ARCH flags field of the FADT Table
@@ -71,13 +73,10 @@ typedef struct CmArmCpuInfo {
   // Reserved for use when SMBIOS tables are implemented
 } CM_ARM_CPU_INFO;
 
-typedef struct CmArmCpuInfoList {
-  UINT32             CpuCount;
-  CM_ARM_CPU_INFO  * CpuInfo;
-} CM_ARM_CPU_INFO_LIST;
-
 /** A structure that describes the
     Power Management Profile Information for the Platform.
+
+    ID: EArmObjPowerManagementProfileInfo
 */
 typedef struct CmArmPowerManagementProfileInfo {
   /** This is the Preferred_PM_Profile field of the FADT Table
@@ -88,6 +87,8 @@ typedef struct CmArmPowerManagementProfileInfo {
 
 /** A structure that describes the
     GIC CPU Interface for the Platform.
+
+    ID: EArmObjGicCInfo
 */
 typedef struct CmArmGicCInfo {
   /// The GIC CPU Interface number.
@@ -164,6 +165,8 @@ typedef struct CmArmGicCInfo {
 
 /** A structure that describes the
     GIC Distributor information for the Platform.
+
+    ID: EArmObjGicDInfo
 */
 typedef struct CmArmGicDInfo {
   /// The Physical Base address for the GIC Distributor.
@@ -184,6 +187,8 @@ typedef struct CmArmGicDInfo {
 
 /** A structure that describes the
     GIC MSI Frame information for the Platform.
+
+    ID: EArmObjGicMsiFrameInfo
 */
 typedef struct CmArmGicMsiFrameInfo {
   /// The GIC MSI Frame ID
@@ -207,6 +212,8 @@ typedef struct CmArmGicMsiFrameInfo {
 
 /** A structure that describes the
     GIC Redistributor information for the Platform.
+
+    ID: EArmObjGicRedistributorInfo
 */
 typedef struct CmArmGicRedistInfo {
   /** The physical address of a page range
@@ -220,6 +227,8 @@ typedef struct CmArmGicRedistInfo {
 
 /** A structure that describes the
     GIC Interrupt Translation Service information for the Platform.
+
+    ID: EArmObjGicItsInfo
 */
 typedef struct CmArmGicItsInfo {
   /// The GIC ITS ID
@@ -231,6 +240,9 @@ typedef struct CmArmGicItsInfo {
 
 /** A structure that describes the
     Serial Port information for the Platform.
+
+    ID: EArmObjSerialConsolePortInfo or
+        EArmObjSerialDebugPortInfo
 */
 typedef struct CmArmSerialPortInfo {
   /// The physical base address for the serial port
@@ -251,6 +263,8 @@ typedef struct CmArmSerialPortInfo {
 
 /** A structure that describes the
     Generic Timer information for the Platform.
+
+    ID: EArmObjGenericTimerInfo
 */
 typedef struct CmArmGenericTimerInfo {
   /// The physical base address for the counter control frame
@@ -286,6 +300,8 @@ typedef struct CmArmGenericTimerInfo {
 
 /** A structure that describes the
     Platform Generic Block Timer Frame information for the Platform.
+
+    ID: EArmObjGTBlockTimerFrameInfo
 */
 typedef struct CmArmGTBlockTimerFrameInfo {
   /// The Generic Timer frame number
@@ -321,6 +337,8 @@ typedef struct CmArmGTBlockTimerFrameInfo {
 
 /** A structure that describes the
     Platform Generic Block Timer information for the Platform.
+
+    ID: EArmObjPlatformGTBlockInfo
 */
 typedef struct CmArmGTBlockInfo {
   /// The physical base address for the GT Block Timer structure
@@ -335,6 +353,8 @@ typedef struct CmArmGTBlockInfo {
 
 /** A structure that describes the
     SBSA Generic Watchdog information for the Platform.
+
+    ID: EArmObjPlatformGenericWatchdogInfo
 */
 typedef struct CmArmGenericWatchdogInfo {
   /// The physical base address of the SBSA Watchdog control frame
@@ -354,6 +374,8 @@ typedef struct CmArmGenericWatchdogInfo {
 
 /** A structure that describes the
     PCI Configuration Space information for the Platform.
+
+    ID: EArmObjPciConfigSpaceInfo
 */
 typedef struct CmArmPciConfigSpaceInfo {
   /// The physical base address for the PCI segment
@@ -371,6 +393,8 @@ typedef struct CmArmPciConfigSpaceInfo {
 
 /** A structure that describes the
     Hypervisor Vendor ID information for the Platform.
+
+    ID: EArmObjHypervisorVendorIdentity
 */
 typedef struct CmArmHypervisorVendorId {
   /// The hypervisor Vendor ID
@@ -379,6 +403,8 @@ typedef struct CmArmHypervisorVendorId {
 
 /** A structure that describes the
     Fixed feature flags for the Platform.
+
+    ID: EArmObjFixedFeatureFlags
 */
 typedef struct CmArmFixedFeatureFlags {
   /// The Fixed feature flags
@@ -387,9 +413,11 @@ typedef struct CmArmFixedFeatureFlags {
 
 /** A structure that describes the
     ITS Group node for the Platform.
+
+    ID: EArmObjItsGroup
 */
 typedef struct CmArmItsGroupNode {
-  /// An unique token used to ideintify this object
+  /// An unique token used to identify this object
   CM_OBJECT_TOKEN   Token;
   /// The number of ITS identifiers in the ITS node
   UINT32            ItsIdCount;
@@ -399,6 +427,8 @@ typedef struct CmArmItsGroupNode {
 
 /** A structure that describes the
     GIC ITS Identifiers for an ITS Group node.
+
+    ID: EArmObjGicItsIdentifierArray
 */
 typedef struct CmArmGicItsIdentifier {
   /// The ITS Identifier
@@ -407,9 +437,11 @@ typedef struct CmArmGicItsIdentifier {
 
 /** A structure that describes the
     Named component node for the Platform.
+
+    ID: EArmObjNamedComponent
 */
 typedef struct CmArmNamedComponentNode {
-  /// An unique token used to ideintify this object
+  /// An unique token used to identify this object
   CM_OBJECT_TOKEN   Token;
   /// Number of ID mappings
   UINT32            IdMappingCount;
@@ -436,9 +468,11 @@ typedef struct CmArmNamedComponentNode {
 
 /** A structure that describes the
     Root complex node for the Platform.
+
+    ID: EArmObjRootComplex
 */
 typedef struct CmArmRootComplexNode {
-  /// An unique token used to ideintify this object
+  /// An unique token used to identify this object
   CM_OBJECT_TOKEN   Token;
   /// Number of ID mappings
   UINT32            IdMappingCount;
@@ -462,9 +496,11 @@ typedef struct CmArmRootComplexNode {
 
 /** A structure that describes the
     SMMUv1 or SMMUv2 node for the Platform.
+
+    ID: EArmObjSmmuV1SmmuV2
 */
 typedef struct CmArmSmmuV1SmmuV2Node {
-  /// An unique token used to ideintify this object
+  /// An unique token used to identify this object
   CM_OBJECT_TOKEN   Token;
   /// Number of ID mappings
   UINT32            IdMappingCount;
@@ -502,9 +538,11 @@ typedef struct CmArmSmmuV1SmmuV2Node {
 
 /** A structure that describes the
     SMMUv3 node for the Platform.
+
+    ID: EArmObjSmmuV3
 */
 typedef struct CmArmSmmuV3Node {
-  /// An unique token used to ideintify this object
+  /// An unique token used to identify this object
   CM_OBJECT_TOKEN   Token;
   /// Number of ID mappings
   UINT32            IdMappingCount;
@@ -536,9 +574,11 @@ typedef struct CmArmSmmuV3Node {
 
 /** A structure that describes the
     PMCG node for the Platform.
+
+    ID: EArmObjPmcg
 */
 typedef struct CmArmPmcgNode {
-  /// An unique token used to ideintify this object
+  /// An unique token used to identify this object
   CM_OBJECT_TOKEN   Token;
   /// Number of ID mappings
   UINT32            IdMappingCount;
@@ -558,6 +598,8 @@ typedef struct CmArmPmcgNode {
 
 /** A structure that describes the
     ID Mappings for the Platform.
+
+    ID: EArmObjIdMappingArray
 */
 typedef struct CmArmIdMapping {
   /// Input base
@@ -574,6 +616,8 @@ typedef struct CmArmIdMapping {
 
 /** A structure that describes the
     SMMU interrupts for the Platform.
+
+    ID: EArmObjSmmuInterruptArray
 */
 typedef struct CmArmSmmuInterrupt {
   /// Interrupt number
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'




------------------------------

Message: 37
Date: Thu, 21 Feb 2019 18:15:25 +0000
From: Sami Mujawar <sami.mujawar@arm.com>
To: edk2-devel@lists.01.org
Cc: Sami Mujawar <sami.mujawar@arm.com>, ard.biesheuvel@linaro.org,
	leif.lindholm@linaro.org, michael.d.kinney@intel.com,
	alexei.fedorov@arm.com, Matteo.Carlini@arm.com,
	Stephanie.Hughes-Fitt@arm.com, nd@arm.com
Subject: [edk2] [PATCH edk2-platforms v1 4/4] Platform/ARM: Juno:
	Config Mgr remove GICD ID
Message-ID: <20190221181525.49624-5-sami.mujawar@arm.com>

According to ACPI 6.2 Specification - Errata A, 'One,
and only one, GIC distributor structure must be present
in the MADT for an ARM based system'. Accordingly the
CM_ARM_GICD_INFO structure has been updated to remove
the GicId field as this value is set to zero by the
MADT generator.

This update reflects the corresponding change required
to the Configuration Manager.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 55f0984ee6741f5434dd1ec673281c78e2a576f2..444c1d95af27d938da76e00e41756b800b977589 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -145,7 +145,6 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = {
 
   // GIC Distributor Info
   {
-    0,                                      // UINT32  GicId
     FixedPcdGet64 (PcdGicDistributorBase),  // UINT64  PhysicalBaseAddress
     0,                                      // UINT32  SystemVectorBase
     2                                       // UINT8   GicVersion
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'




------------------------------

Message: 38
Date: Thu, 21 Feb 2019 18:15:22 +0000
From: Sami Mujawar <sami.mujawar@arm.com>
To: edk2-devel@lists.01.org
Cc: Sami Mujawar <sami.mujawar@arm.com>, ard.biesheuvel@linaro.org,
	leif.lindholm@linaro.org, michael.d.kinney@intel.com,
	alexei.fedorov@arm.com, Matteo.Carlini@arm.com,
	Stephanie.Hughes-Fitt@arm.com, nd@arm.com
Subject: [edk2] [PATCH edk2-platforms v1 1/4] Platform/ARM: Juno:
	Configuration Manager depex
Message-ID: <20190221181525.49624-2-sami.mujawar@arm.com>

The Configuration Manager needs to be loaded before
other Dynamic Tables Framework Modules.

Fix the DEPEX section for Configuration Manager Dxe to
remove incorrect dependency.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
index 1491653ab8fe4d44ce11bdf9116f187cc3edf817..a8ef27108237d5cdf20166cffe7a348ebb2b2b12 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Configuration Manager Dxe
 #
-#  Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+#  Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -83,4 +83,4 @@ [FixedPcd]
 [Pcd]
 
 [Depex]
-  gEdkiiDynamicTableFactoryProtocolGuid
+  TRUE
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'




------------------------------

Message: 39
Date: Thu, 21 Feb 2019 18:15:24 +0000
From: Sami Mujawar <sami.mujawar@arm.com>
To: edk2-devel@lists.01.org
Cc: Sami Mujawar <sami.mujawar@arm.com>, ard.biesheuvel@linaro.org,
	leif.lindholm@linaro.org, michael.d.kinney@intel.com,
	alexei.fedorov@arm.com, Matteo.Carlini@arm.com,
	Stephanie.Hughes-Fitt@arm.com, nd@arm.com
Subject: [edk2] [PATCH edk2-platforms v1 3/4] Platform/ARM: FVP:
	Config Mgr remove GICD ID
Message-ID: <20190221181525.49624-4-sami.mujawar@arm.com>

According to ACPI 6.2 Specification - Errata A, 'One,
and only one, GIC distributor structure must be present
in the MADT for an ARM based system'. Accordingly the
CM_ARM_GICD_INFO structure has been updated to remove
the GicId field as this value is set to zero by the
MADT generator.

This update reflects the corresponding change required
to the Configuration Manager.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 66ee79341dfeceff1dc70c32b308056d87b99540..cdde32f6b43e876d8869941b4a11b0da8c72224e 100644
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -116,7 +116,6 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo = {
 
   // GIC Distributor Info
   {
-    0,                                      // UINT32  GicId
     FixedPcdGet64 (PcdGicDistributorBase),  // UINT64  PhysicalBaseAddress
     0,                                      // UINT32  SystemVectorBase
     3                                       // UINT8   GicVersion
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'




------------------------------

Message: 40
Date: Thu, 21 Feb 2019 18:15:23 +0000
From: Sami Mujawar <sami.mujawar@arm.com>
To: edk2-devel@lists.01.org
Cc: Sami Mujawar <sami.mujawar@arm.com>, ard.biesheuvel@linaro.org,
	leif.lindholm@linaro.org, michael.d.kinney@intel.com,
	alexei.fedorov@arm.com, Matteo.Carlini@arm.com,
	Stephanie.Hughes-Fitt@arm.com, nd@arm.com
Subject: [edk2] [PATCH edk2-platforms v1 2/4] Platform/ARM: FVP:
	Configuration Manager depex
Message-ID: <20190221181525.49624-3-sami.mujawar@arm.com>

The Configuration Manager needs to be loaded before
other Dynamic Tables Framework Modules.

Fix the DEPEX section for Configuration Manager Dxe to
remove incorrect dependency.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
index c4c8f462b8fa8ea718589f2265ae42953ac0a49a..299c61f10f6fe41060d648a6fadcc63c310108a9 100644
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
@@ -1,7 +1,7 @@
 ## @file
 # Configuration Manager Dxe
 #
-#  Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+#  Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -76,4 +76,4 @@ [FixedPcd]
 [Pcd]
 
 [Depex]
-  gEdkiiDynamicTableFactoryProtocolGuid
+  TRUE
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'




------------------------------

Message: 41
Date: Thu, 21 Feb 2019 18:15:21 +0000
From: Sami Mujawar <sami.mujawar@arm.com>
To: edk2-devel@lists.01.org
Cc: Sami Mujawar <sami.mujawar@arm.com>, ard.biesheuvel@linaro.org,
	leif.lindholm@linaro.org, michael.d.kinney@intel.com,
	alexei.fedorov@arm.com, Matteo.Carlini@arm.com,
	Stephanie.Hughes-Fitt@arm.com, nd@arm.com
Subject: [edk2] [PATCH edk2-platforms v1 0/4] Platform/ARM: Updates
	corresponding to Dynamic Tables Framework changes
Message-ID: <20190221181525.49624-1-sami.mujawar@arm.com>

The Dynamic tables framework has been updated to incorporated a series of
updates namely:
  * Resolving DEPEX order for modules.
  * Removing GIC Distributor ID

This patch series implement the corresponding changes required in the platform
Configuration Manager.

Note: This patch series is dependent on the patch series:
https://lists.01.org/pipermail/edk2-devel/2019-January/035611.html

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>

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

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

Sami Mujawar (4):
  Platform/ARM: Juno: Configuration Manager depex
  Platform/ARM: FVP: Configuration Manager depex
  Platform/ARM: FVP: Config Mgr remove GICD ID
  Platform/ARM: Juno: Config Mgr remove GICD ID

 Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c          | 1 -
 Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf     | 4 ++--
 Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c      | 1 -
 Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf | 4 ++--
 4 files changed, 4 insertions(+), 6 deletions(-)

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




------------------------------

Message: 42
Date: Thu, 21 Feb 2019 11:38:55 -0700
From: Ashish Singhal <ashishsingha@nvidia.com>
To: <edk2-devel@lists.01.org>
Cc: <Sami.Mujawar@arm.com>, <Alexei.Fedorov@arm.com>, Ashish Singhal
	<ashishsingha@nvidia.com>
Subject: [edk2] [PATCH 0/2] DynamicTablesPkg Updates
Message-ID: <cover.1550773480.git.ashishsingha@nvidia.com>
Content-Type: text/plain

DynamicTablesPkg/DynamicTableManagerDxe: Update DEPEX

This patch adds appropriate dependencies to DynamicTableManagerDxe.
The initialization function fails if gEdkiiDynamicTableFactoryProtocolGuid
and gEdkiiConfigurationManagerProtocolGuid are not present already. Since
we are not relying on a callback but locating these in initialization, we
should add these dependencies. Towards the end of initialization function
where we build and install ACPI tables, we locate gEfiAcpiTableProtocolGuid
and return a failure is not present. We need to add approriate dependency
for this as well. Adding these proper dependencies would make the code not
rely on drivers forcefully dispatched in a particular order

DynamicTablesPkg/AcpiSpcrLibArm: Support 16550 UART.

This patch adds support for 16550 UART in ACPI SPCR table. HLOS support for
this type of UART is already present.

Both the patches have been verified to work on hardware.

Ashish Singhal (2):
  DynamicTablesPkg/DynamicTableManagerDxe: Update DEPEX
  DynamicTablesPkg/AcpiSpcrLibArm: Support 16550 UART.

 .../Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf         | 4 +++-
 DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c      | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.7.4



------------------------------

Message: 43
Date: Thu, 21 Feb 2019 11:38:57 -0700
From: Ashish Singhal <ashishsingha@nvidia.com>
To: <edk2-devel@lists.01.org>
Cc: <Sami.Mujawar@arm.com>, <Alexei.Fedorov@arm.com>, Ashish Singhal
	<ashishsingha@nvidia.com>
Subject: [edk2] [PATCH 2/2] DynamicTablesPkg/AcpiSpcrLibArm: Support
	16550 UART.
Message-ID:
	<8960abcec179f116cc195523ae826eecc2968d4a.1550773480.git.ashishsingha@nvidia.com>
	
Content-Type: text/plain

Add support for 16550 UART to ACPI SPCR table as it is a
supported UART type by HLOS.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
---
 DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
index 23d3a50..a4654ac 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
@@ -189,6 +189,8 @@ BuildSpcrTable (
       (SerialPortInfo->PortSubtype !=
       EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_SBSA_GENERIC_UART) &&
       (SerialPortInfo->PortSubtype !=
+      EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550) &&
+      (SerialPortInfo->PortSubtype !=
       EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_DCC)) {
     Status = EFI_INVALID_PARAMETER;
     DEBUG ((
-- 
2.7.4



------------------------------

Message: 44
Date: Thu, 21 Feb 2019 11:38:56 -0700
From: Ashish Singhal <ashishsingha@nvidia.com>
To: <edk2-devel@lists.01.org>
Cc: <Sami.Mujawar@arm.com>, <Alexei.Fedorov@arm.com>, Ashish Singhal
	<ashishsingha@nvidia.com>
Subject: [edk2] [PATCH 1/2] DynamicTablesPkg/DynamicTableManagerDxe:
	Update DEPEX
Message-ID:
	<1015295535e2bf2b69a321be1b913be45a77fc94.1550773480.git.ashishsingha@nvidia.com>
	
Content-Type: text/plain

DynamicTableManagerDxe initialization fails if
gEdkiiDynamicTableFactoryProtocolGuid,
gEdkiiConfigurationManagerProtocolGuid and
gEfiAcpiTableProtocolGuid are not already available.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
---
 .../Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf         | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf
index 2aeaf15..fef8b20 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf
+++ b/DynamicTablesPkg/Drivers/DynamicTableManagerDxe/DynamicTableManagerDxe.inf
@@ -46,5 +46,7 @@
   gEdkiiDynamicTableFactoryProtocolGuid
 
 [Depex]
-  gEdkiiConfigurationManagerProtocolGuid
+  gEfiAcpiTableProtocolGuid AND
+  gEdkiiConfigurationManagerProtocolGuid AND
+  gEdkiiDynamicTableFactoryProtocolGuid
 
-- 
2.7.4



------------------------------

Message: 45
Date: Thu, 21 Feb 2019 20:25:17 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: Julien Grall <julien.grall@arm.com>, edk2-devel@lists.01.org
Cc: michael.d.kinney@intel.com
Subject: Re: [edk2] [PATCH] Maintainers.txt: Update e-mail address for
	Julien Grall
Message-ID: <c93fd040-fc0c-fbde-4ddc-55464a40c6bd@redhat.com>
Content-Type: text/plain; charset=utf-8

On 02/21/19 16:21, Julien Grall wrote:
> I don't watch much my Linaro e-mail anymore. So update my e-mail address
> from Linaro to the Arm one.
> 
> Contributed-under: Tianocore Contribution Agreement 1.1
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> ---
>  Maintainers.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 3b2676bc32..1e3fdc1de9 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -80,7 +80,7 @@ ArmVirtPkg
>  W: https://github.com/tianocore/tianocore.github.io/wiki/ArmVirtPkg
>  M: Laszlo Ersek <lersek@redhat.com>
>  M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> -R: Julien Grall <julien.grall@linaro.org>
> +R: Julien Grall <julien.grall@arm.com>
>  
>  BaseTools
>  W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools
> @@ -217,7 +217,7 @@ M: Jordan Justen <jordan.l.justen@intel.com>
>  M: Laszlo Ersek <lersek@redhat.com>
>  M: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>  R: Anthony Perard <anthony.perard@citrix.com>
> -R: Julien Grall <julien.grall@linaro.org>
> +R: Julien Grall <julien.grall@arm.com>
>  S: Maintained
>  
>  PcAtChipsetPkg
> 

Pushed as commit 98fc52c44eee.

Thanks
Laszlo


------------------------------

Message: 46
Date: Thu, 21 Feb 2019 20:42:38 +0100
From: Laszlo Ersek <lersek@redhat.com>
To: edk2-devel@lists.01.org
Cc: Jordan Justen <jordan.l.justen@intel.com>, Michael D Kinney
	<michael.d.kinney@intel.com>, Anthony Perard
	<anthony.perard@citrix.com>
Subject: Re: [edk2] [PATCH v2 0/2] Maintainers: updates for ArmVirtPkg
	and OvmfPkg
Message-ID: <258dda29-8f6e-1658-ccdf-db323e533ee8@redhat.com>
Content-Type: text/plain; charset=utf-8

On 02/21/19 13:28, Laszlo Ersek wrote:
> Previous version:
>   [edk2] [PATCH] Maintainers: add TPM2 reviewers for OvmfPkg
>   https://lists.01.org/pipermail/edk2-devel/2019-February/036495.html
> 
> Patch #1 in v2 is an iteration of the above. Patch #2 in v2 is new.
> 
> Cc: Andrew Fish <afish@apple.com>
> Cc: Anthony Perard <anthony.perard@citrix.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Julien Grall <julien.grall@linaro.org>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Stefan Berger <stefanb@linux.ibm.com>
> 
> Thanks,
> Laszlo
> 
> Laszlo Ersek (2):
>   Maintainers: add TPM2 reviewers for OvmfPkg
>   Maintainers: specify the scope for OvmfPkg/ArmVirtPkg Xen module
>     reviewers
> 
>  Maintainers.txt | 7 +++++++
>  1 file changed, 7 insertions(+)
> 

Pushed as commit range 98fc52c44eee..94e0dd1afe53.

Thanks,
Laszlo


------------------------------

Subject: Digest Footer

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


------------------------------

End of edk2-devel Digest, Vol 44, Issue 53
******************************************
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH v1 0/6] DynamicTablesPkg: Framework updates and fixes
@ 2019-02-21 18:14 Sami Mujawar
  2019-02-25 13:48 ` Alexei Fedorov
  2019-02-25 19:27 ` Laszlo Ersek
  0 siblings, 2 replies; 4+ messages in thread
From: Sami Mujawar @ 2019-02-21 18:14 UTC (permalink / raw)
  To: edk2-devel
  Cc: alexei.fedorov, leif.lindholm, Matteo.Carlini,
	Stephanie.Hughes-Fitt, nd

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

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>

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

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

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

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

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-25 19:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-21 21:22 [PATCH v1 0/6] DynamicTablesPkg: Framework updates and fixes Ashish Singhal
  -- strict thread matches above, loose matches on Subject: below --
2019-02-21 18:14 Sami Mujawar
2019-02-25 13:48 ` Alexei Fedorov
2019-02-25 19:27 ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox