Re: [edk2-devel] [PATCH] RedfishPkg/HostInterfaceBmcUsbNic: Set default Redfish service port

2023-11-27 Thread Mike Maslenkin
On Tue, Nov 28, 2023 at 8:27 AM Chang, Abner via groups.io
 wrote:
>
> From: Abner Chang 
>
> BZ #4607
> Create a PCD for the default Redfish service port.
>
> Signed-off-by: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Cc: Mike Maslenkin 
> ---
>  RedfishPkg/RedfishPkg.dec | 8 ++--
>  .../PlatformHostInterfaceBmcUsbNicLib.inf | 1 +
>  .../PlatformHostInterfaceBmcUsbNicLib.c   | 2 +-
>  3 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
> index e40538247c2..3ea9ff3ef7f 100644
> --- a/RedfishPkg/RedfishPkg.dec
> +++ b/RedfishPkg/RedfishPkg.dec
> @@ -141,12 +141,16 @@
># specification for that.
>#
>
> gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServiceUuid|L"----"|VOID*|0x1006
> +  # Use PCD to declare the Redfish service port, default set to port 443.
> +  # Platform can overide this value in platform DSC file.
> +  #
> +  gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServicePort|443|UINT16|0x1007
>#
># This PCD indicates that if BMC bootstrap credential service will be 
> disabled by BIOS or not.
>#
> -  
> gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDisableBootstrapCredentialService|FALSE|BOOLEAN|0x1007
> +  
> gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDisableBootstrapCredentialService|FALSE|BOOLEAN|0x1008
>#
># The EFI_REST_EX_HTTP_CONFIG_DATA.SendReceiveTimeout value that 
> RedfishDiscoverDxe driver
># set to EFI_REST_EX_PROTOCOL.
>#
> -  
> gEfiRedfishPkgTokenSpaceGuid.PcdRedfishSendReceiveTimeout|5000|UINT32|0x1008
> +  
> gEfiRedfishPkgTokenSpaceGuid.PcdRedfishSendReceiveTimeout|5000|UINT32|0x1009
> diff --git 
> a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
>  
> b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
> index f2c7d7fec89..838a1721a7a 100644
> --- 
> a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
> +++ 
> b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
> @@ -43,6 +43,7 @@
>  [Pcd]
>gEfiRedfishPkgTokenSpaceGuid.PcdRedfishHostName ## CONSUMED
>gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServiceUuid  ## CONSUMED
> +  gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServicePort  ## CONSUMED
>
>  [Depex]
>gIpmiProtocolGuid
> diff --git 
> a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
>  
> b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
> index 2938d54da65..7f295fe7f1c 100644
> --- 
> a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
> +++ 
> b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
> @@ -244,7 +244,7 @@ RedfishPlatformHostInterfaceProtocolData (
>  );
>
>// RedfishServiceIpPort
> -  RedfishOverIpData->RedfishServiceIpPort = 0;
> +  RedfishOverIpData->RedfishServiceIpPort = PcdGet16 
> (PcdRedfishServicePort);
>
>// RedfishServiceVlanId
>RedfishOverIpData->RedfishServiceVlanId = ThisInstance->VLanId;
> --
> 2.37.1.windows.1

Looks good to me. Thank you!

Regards,
MIke.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111799): https://edk2.groups.io/g/devel/message/111799
Mute This Topic: https://groups.io/mt/102845949/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH 3/6] RedfishClientPkg: feature driver enhancement.

2023-11-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Thanks Nickle, I just created BZ #4608 to track this TODO item.

For this patch,
Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Tuesday, November 28, 2023 2:44 PM
> To: Chang, Abner ; devel@edk2.groups.io
> Cc: Igor Kulchytskyy ; Nick Ramirez 
> Subject: RE: [edk2-redfish-client][PATCH 3/6] RedfishClientPkg: feature driver
> enhancement.
>
> [AMD Official Use Only - General]
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Hi Abner,
>
> Thanks for your review. Please find my comment below.
>
> > This may spend some time on network to get the whole resource from URI if
> the
> > resource size is big, but we just need the information of ETAG header. We 
> > can
> > think of using HEAD HTTP method.
> > However, this seems fine for now as the following code gets the pending
> settings
> > from the same HTTP response body retrieved above.
> > The worst case would be there is no pending setting, however we waste
> network
> > bandwidth to get the whole response body. Not sure if HTTP query $select
> can
> > improve this or not for retrieving pending setting annotation.
>
> Yes, it is good idea to use HTTP HEAD method to get ETag and save the
> bandwidth. "$select" may reduce the data size but it may increase the loading
> of BMC while BMC is doing filtering.
>
> HTTP HEAD relies on BMC support, and it seems to me that OpenBMC does
> not support HTTP HEAD yet. Let's put this to our to-do list and implement
> HTTP HEAD function while we have this support in BMC.
>
> Thanks,
> Nickle
>
> > -Original Message-
> > From: Chang, Abner 
> > Sent: Tuesday, November 28, 2023 12:05 PM
> > To: Nickle Wang ; devel@edk2.groups.io
> > Cc: Igor Kulchytskyy ; Nick Ramirez
> 
> > Subject: RE: [edk2-redfish-client][PATCH 3/6] RedfishClientPkg: feature
> driver
> > enhancement.
> >
> > External email: Use caution opening links or attachments
> >
> >
> > [AMD Official Use Only - General]
> >
> > > -Original Message-
> > > From: Nickle Wang 
> > > Sent: Thursday, November 23, 2023 10:34 PM
> > > To: devel@edk2.groups.io
> > > Cc: Chang, Abner ; Igor Kulchytskyy
> > > ; Nick Ramirez 
> > > Subject: [edk2-redfish-client][PATCH 3/6] RedfishClientPkg: feature
> > > driver enhancement.
> > >
> > > Caution: This message originated from an External Source. Use proper
> > > caution when opening attachments, clicking links, or responding.
> > >
> > >
> > > -Fix typo (include function RedfisSetRedfishUri and parameter
> > > MaxLengthConfigLang)
> > > -Add more debug message.
> > > -Do not save ETag to variable every time when new ETag is created in
> > > SetEtagWithUri().
> > > -Introduce SetEtagFromUri() to get ETag from BMC and save it in
> > > variable.
> > > -Introduce GetPendingSettings() to check and see if Redfish pending
> > > settings is supported or not.
> > >
> > > Signed-off-by: Nickle Wang 
> > > Cc: Abner Chang 
> > > Cc: Igor Kulchytskyy 
> > > Cc: Nick Ramirez 
> > > ---
> > >  .../Library/RedfishFeatureUtilityLib.h|  81 ++--
> > >  .../Features/Bios/v1_0_9/Common/BiosCommon.c  |   4 +-
> > >  .../v1_5_0/Common/ComputerSystemCommon.c  |   4 +-
> > >  .../Memory/V1_7_1/Common/MemoryCommon.c   |   4 +-
> > >  .../RedfishFeatureUtilityLib.c| 192 +-
> > >  5 files changed, 253 insertions(+), 32 deletions(-)
> > >
> > > diff --git
> > > a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > > b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > > index e2f728b2..6347585c 100644
> > > --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > > +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > > @@ -22,7 +22,7 @@
> > >
> > >Read redfish resource by given resource URI.
> > >
> > > -  @param[in]  Service   Redfish srvice instacne to make query.
> > > +  @param[in]  Service   Redfish service instance to make query.
> > >@param[in]  ResourceUri   Target resource URI.
> > >@param[out] Response  HTTP response from redfish service.
> > >
> > > @@ -47,7 +47,7 @@ GetResourceByUri (
> > >@param[out] ArraySignatureClose   String to the close of array
> signature.
> > >
> > >@retval EFI_SUCCESSIndex is found.
> > > -  @retval EFI_NOT_FOUND  The non-array configure language 
> > > string
> is
> > > retured.
> > > +  @retval EFI_NOT_FOUND  The non-array configure language 
> > > string
> is
> > > returned.
> > >@retval EFI_INVALID_PARAMETER  The format of input ConfigureLang
> is
> > > wrong.
> > >@retval Others Errors occur.
> > >
> > > @@ -118,10 +118,10 @@ GetNumberOfRedpathNodes (
> > >
> > >@param[in]  NodeString The node string to parse.
> > >@param[in]  Index  Index of the node.
> > > -  @param[out] 

Re: [edk2-devel] [edk2-redfish-client][PATCH 3/6] RedfishClientPkg: feature driver enhancement.

2023-11-27 Thread Nickle Wang via groups.io
Hi Abner,

Thanks for your review. Please find my comment below.

> This may spend some time on network to get the whole resource from URI if the
> resource size is big, but we just need the information of ETAG header. We can
> think of using HEAD HTTP method.
> However, this seems fine for now as the following code gets the pending 
> settings
> from the same HTTP response body retrieved above.
> The worst case would be there is no pending setting, however we waste network
> bandwidth to get the whole response body. Not sure if HTTP query $select can
> improve this or not for retrieving pending setting annotation.

Yes, it is good idea to use HTTP HEAD method to get ETag and save the 
bandwidth. "$select" may reduce the data size but it may increase the loading 
of BMC while BMC is doing filtering.

HTTP HEAD relies on BMC support, and it seems to me that OpenBMC does not 
support HTTP HEAD yet. Let's put this to our to-do list and implement HTTP HEAD 
function while we have this support in BMC.

Thanks,
Nickle

> -Original Message-
> From: Chang, Abner 
> Sent: Tuesday, November 28, 2023 12:05 PM
> To: Nickle Wang ; devel@edk2.groups.io
> Cc: Igor Kulchytskyy ; Nick Ramirez 
> Subject: RE: [edk2-redfish-client][PATCH 3/6] RedfishClientPkg: feature driver
> enhancement.
> 
> External email: Use caution opening links or attachments
> 
> 
> [AMD Official Use Only - General]
> 
> > -Original Message-
> > From: Nickle Wang 
> > Sent: Thursday, November 23, 2023 10:34 PM
> > To: devel@edk2.groups.io
> > Cc: Chang, Abner ; Igor Kulchytskyy
> > ; Nick Ramirez 
> > Subject: [edk2-redfish-client][PATCH 3/6] RedfishClientPkg: feature
> > driver enhancement.
> >
> > Caution: This message originated from an External Source. Use proper
> > caution when opening attachments, clicking links, or responding.
> >
> >
> > -Fix typo (include function RedfisSetRedfishUri and parameter
> > MaxLengthConfigLang)
> > -Add more debug message.
> > -Do not save ETag to variable every time when new ETag is created in
> > SetEtagWithUri().
> > -Introduce SetEtagFromUri() to get ETag from BMC and save it in
> > variable.
> > -Introduce GetPendingSettings() to check and see if Redfish pending
> > settings is supported or not.
> >
> > Signed-off-by: Nickle Wang 
> > Cc: Abner Chang 
> > Cc: Igor Kulchytskyy 
> > Cc: Nick Ramirez 
> > ---
> >  .../Library/RedfishFeatureUtilityLib.h|  81 ++--
> >  .../Features/Bios/v1_0_9/Common/BiosCommon.c  |   4 +-
> >  .../v1_5_0/Common/ComputerSystemCommon.c  |   4 +-
> >  .../Memory/V1_7_1/Common/MemoryCommon.c   |   4 +-
> >  .../RedfishFeatureUtilityLib.c| 192 +-
> >  5 files changed, 253 insertions(+), 32 deletions(-)
> >
> > diff --git
> > a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > index e2f728b2..6347585c 100644
> > --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> > @@ -22,7 +22,7 @@
> >
> >Read redfish resource by given resource URI.
> >
> > -  @param[in]  Service   Redfish srvice instacne to make query.
> > +  @param[in]  Service   Redfish service instance to make query.
> >@param[in]  ResourceUri   Target resource URI.
> >@param[out] Response  HTTP response from redfish service.
> >
> > @@ -47,7 +47,7 @@ GetResourceByUri (
> >@param[out] ArraySignatureClose   String to the close of array 
> > signature.
> >
> >@retval EFI_SUCCESSIndex is found.
> > -  @retval EFI_NOT_FOUND  The non-array configure language 
> > string is
> > retured.
> > +  @retval EFI_NOT_FOUND  The non-array configure language 
> > string is
> > returned.
> >@retval EFI_INVALID_PARAMETER  The format of input ConfigureLang is
> > wrong.
> >@retval Others Errors occur.
> >
> > @@ -118,10 +118,10 @@ GetNumberOfRedpathNodes (
> >
> >@param[in]  NodeString The node string to parse.
> >@param[in]  Index  Index of the node.
> > -  @param[out] EndOfNodePtr   Pointer to receive the poitner to
> > +  @param[out] EndOfNodePtr   Pointer to receive the pointer to
> >   the last character of node string.
> >
> > -  @retval EFI_STRING the begining of the node string.
> > +  @retval EFI_STRING the beginning of the node string.
> >
> >  **/
> >  EFI_STRING
> > @@ -140,7 +140,7 @@ GetRedpathNodeByIndex (
> >@param[out] Index The array index number.
> >
> >@retval EFI_SUCCESSIndex is found.
> > -  @retval EFI_NOT_FOUND  The non-array configure language 
> > string is
> > retured.
> > +  @retval EFI_NOT_FOUND  The non-array configure language 
> > string is
> > returned.
> >@retval EFI_INVALID_PARAMETER  The 

[edk2-devel] [PATCH] RedfishPkg/HostInterfaceBmcUsbNic: Set default Redfish service port

2023-11-27 Thread Chang, Abner via groups.io
From: Abner Chang 

BZ #4607
Create a PCD for the default Redfish service port.

Signed-off-by: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
Cc: Mike Maslenkin 
---
 RedfishPkg/RedfishPkg.dec | 8 ++--
 .../PlatformHostInterfaceBmcUsbNicLib.inf | 1 +
 .../PlatformHostInterfaceBmcUsbNicLib.c   | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
index e40538247c2..3ea9ff3ef7f 100644
--- a/RedfishPkg/RedfishPkg.dec
+++ b/RedfishPkg/RedfishPkg.dec
@@ -141,12 +141,16 @@
   # specification for that.
   #
   
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServiceUuid|L"----"|VOID*|0x1006
+  # Use PCD to declare the Redfish service port, default set to port 443.
+  # Platform can overide this value in platform DSC file.
+  #
+  gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServicePort|443|UINT16|0x1007
   #
   # This PCD indicates that if BMC bootstrap credential service will be 
disabled by BIOS or not.
   #
-  
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDisableBootstrapCredentialService|FALSE|BOOLEAN|0x1007
+  
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDisableBootstrapCredentialService|FALSE|BOOLEAN|0x1008
   #
   # The EFI_REST_EX_HTTP_CONFIG_DATA.SendReceiveTimeout value that 
RedfishDiscoverDxe driver
   # set to EFI_REST_EX_PROTOCOL.
   #
-  
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishSendReceiveTimeout|5000|UINT32|0x1008
+  
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishSendReceiveTimeout|5000|UINT32|0x1009
diff --git 
a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
 
b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
index f2c7d7fec89..838a1721a7a 100644
--- 
a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
+++ 
b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
@@ -43,6 +43,7 @@
 [Pcd]
   gEfiRedfishPkgTokenSpaceGuid.PcdRedfishHostName ## CONSUMED
   gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServiceUuid  ## CONSUMED
+  gEfiRedfishPkgTokenSpaceGuid.PcdRedfishServicePort  ## CONSUMED
 
 [Depex]
   gIpmiProtocolGuid
diff --git 
a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
 
b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
index 2938d54da65..7f295fe7f1c 100644
--- 
a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
+++ 
b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
@@ -244,7 +244,7 @@ RedfishPlatformHostInterfaceProtocolData (
 );
 
   // RedfishServiceIpPort
-  RedfishOverIpData->RedfishServiceIpPort = 0;
+  RedfishOverIpData->RedfishServiceIpPort = PcdGet16 
(PcdRedfishServicePort);
 
   // RedfishServiceVlanId
   RedfishOverIpData->RedfishServiceVlanId = ThisInstance->VLanId;
-- 
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111796): https://edk2.groups.io/g/devel/message/111796
Mute This Topic: https://groups.io/mt/102845949/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH 6/6] RedfishClientPkg/RedfishFeatureUtilityLib: add string NULL check

2023-11-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Thursday, November 23, 2023 10:34 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [edk2-redfish-client][PATCH 6/6]
> RedfishClientPkg/RedfishFeatureUtilityLib: add string NULL check
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Add string NULL check in attribute comparison function and prevent
> NULL string assertion. This is not supposed to happen in normal
> condition so add error output for debugging purpose.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  .../RedfishFeatureUtilityLib.c| 31 ++-
>  1 file changed, 24 insertions(+), 7 deletions(-)
>
> diff --git
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.
> c
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.
> c
> index 753cd7b2..6652539c 100644
> ---
> a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.
> c
> +++
> b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.
> c
> @@ -3743,6 +3743,15 @@ CompareRedfishPropertyVagueValues (
>  // Loop through all key/value on Redfish service..
>  //
>  while (ThisRedfishVagueKeyValuePtr != NULL) {
> +  //
> +  // Empty attribute string check.
> +  //
> +  if (IS_EMPTY_STRING (ThisConfigVagueKeyValuePtr->KeyNamePtr) ||
> IS_EMPTY_STRING (ThisRedfishVagueKeyValuePtr->KeyNamePtr)) {
> +DEBUG ((DEBUG_ERROR, "%a: empty attribute name detected!!\n",
> __func__));
> +ThisRedfishVagueKeyValuePtr = ThisRedfishVagueKeyValuePtr-
> >NextKeyValuePtr;
> +continue;
> +  }
> +
>if (AsciiStrCmp (ThisConfigVagueKeyValuePtr->KeyNamePtr,
> ThisRedfishVagueKeyValuePtr->KeyNamePtr) == 0) {
>  //
>  // Check the type of value.
> @@ -3758,28 +3767,36 @@ CompareRedfishPropertyVagueValues (
>//
>// Is the string identical?
>//
> -  if (AsciiStrCmp (
> -ThisConfigVagueKeyValuePtr->Value->DataValue.CharPtr,
> -ThisRedfishVagueKeyValuePtr->Value->DataValue.CharPtr
> -) == 0)
> -  {
> -break;
> +  if ((ThisConfigVagueKeyValuePtr->Value->DataValue.CharPtr != NULL)
> && (ThisRedfishVagueKeyValuePtr->Value->DataValue.CharPtr != NULL)) {
> +if (AsciiStrCmp (
> +  ThisConfigVagueKeyValuePtr->Value->DataValue.CharPtr,
> +  ThisRedfishVagueKeyValuePtr->Value->DataValue.CharPtr
> +  ) == 0)
> +{
> +  break;
> +} else {
> +  DEBUG ((REDFISH_DEBUG_TRACE, "%a: %a is updated\n", __func__,
> ThisConfigVagueKeyValuePtr->KeyNamePtr));
> +  return FALSE;
> +}
>} else {
> -return FALSE;
> +DEBUG ((DEBUG_ERROR, "%a: NULL attribute (%a) value
> detected!!\n", __func__, ThisConfigVagueKeyValuePtr->KeyNamePtr));
>}
>  } else if (ThisConfigVagueKeyValuePtr->Value->DataType ==
> RedfishCS_Vague_DataType_Int64) {
>if (*ThisConfigVagueKeyValuePtr->Value->DataValue.Int64Ptr ==
> *ThisRedfishVagueKeyValuePtr->Value->DataValue.Int64Ptr) {
>  break;
>} else {
> +DEBUG ((REDFISH_DEBUG_TRACE, "%a: %a is updated\n", __func__,
> ThisConfigVagueKeyValuePtr->KeyNamePtr));
>  return FALSE;
>}
>  } else if (ThisConfigVagueKeyValuePtr->Value->DataType ==
> RedfishCS_Vague_DataType_Bool) {
>if ((UINT8)*ThisConfigVagueKeyValuePtr->Value->DataValue.BoolPtr ==
> (UINT8)*ThisRedfishVagueKeyValuePtr->Value->DataValue.BoolPtr) {
>  break;
>} else {
> +DEBUG ((REDFISH_DEBUG_TRACE, "%a: %a is updated\n", __func__,
> ThisConfigVagueKeyValuePtr->KeyNamePtr));
>  return FALSE;
>}
>  } else {
> +  DEBUG ((REDFISH_DEBUG_TRACE, "%a: %a unsupported type: 0x%x\n",
> __func__, ThisConfigVagueKeyValuePtr->KeyNamePtr,
> ThisConfigVagueKeyValuePtr->Value->DataType));
>return FALSE;
>  }
>}
> --
> 2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111795): https://edk2.groups.io/g/devel/message/111795
Mute This Topic: https://groups.io/mt/102767547/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH 5/6] RedfishClientPkg/Features: fix NULL cached handler issue.

2023-11-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Thursday, November 23, 2023 10:34 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [edk2-redfish-client][PATCH 5/6] RedfishClientPkg/Features: fix NULL
> cached handler issue.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> EdkIIRedfishResourceSetConfigureLang() uses cached handler to
> locate protocol. However, if EdkIIRedfishResourceSetConfigureLang()
> is called at non-collection driver, the cached handler is NULL because
> cached handler is initialized by collection driver. Since
> EdkIIRedfishResourceSetConfigureLang() is in library, the cached handler
> is not shared in different drivers. Fix this issue by getting image
> handler from caller.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  .../Library/EdkIIRedfishResourceConfigLib.h|  9 ++---
>  .../Features/Bios/v1_0_9/Common/BiosCommon.c   |  9 +
>  .../Features/Bios/v1_0_9/Dxe/BiosDxe.c |  3 +--
>  .../v1_5_0/Common/ComputerSystemCommon.c   |  8 +---
>  .../v1_5_0/Dxe/ComputerSystemDxe.c |  3 +--
>  .../ComputerSystemCollectionDxe.c  |  5 +++--
>  .../Memory/V1_7_1/Common/MemoryCommon.c|  8 +---
>  .../Features/Memory/V1_7_1/Dxe/MemoryDxe.c |  3 +--
>  .../MemoryCollectionDxe/MemoryCollectionDxe.c  |  5 +++--
>  .../EdkIIRedfishResourceConfigLib.c| 18 ++
>  10 files changed, 44 insertions(+), 27 deletions(-)
>
> diff --git a/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h
> b/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h
> index a7856033..c8c9cb86 100644
> --- a/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h
> +++ b/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h
> @@ -2,6 +2,7 @@
>This file defines the EDKII resource config Library interface.
>
>(C) Copyright 2022 Hewlett Packard Enterprise Development LP
> +  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
>
>SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -18,7 +19,7 @@
>  #include 
>
>  /**
> -  Provising redfish resource by given URI.
> +  Provisioning redfish resource by given URI.
>
>@param[in]   Schema  Redfish schema information.
>@param[in]   Uri Target URI to create resource.
> @@ -32,7 +33,7 @@
>
>  **/
>  EFI_STATUS
> -EdkIIRedfishResourceConfigProvisionging (
> +EdkIIRedfishResourceConfigProvisioning (
>IN REDFISH_SCHEMA_INFO*Schema,
>IN EFI_STRING Uri,
>IN RESOURCE_INFORMATION_EXCHANGE  *InformationExchange,
> @@ -109,6 +110,7 @@ EdkIIRedfishResourceConfigIdentify (
>Set Configure language of this resource in the
>RESOURCE_INFORMATION_EXCHANGE structure.
>
> +  @param[in]   ImageHandle Pointer to image handle.
>@param[in]   ConfigLangList  Pointer to
> REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST.
>
>@retval EFI_SUCCESS  Configure language is set.
> @@ -118,7 +120,8 @@ EdkIIRedfishResourceConfigIdentify (
>  **/
>  EFI_STATUS
>  EdkIIRedfishResourceSetConfigureLang (
> -  REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  *ConfigLangList
> +  IN EFI_HANDLE   ImageHandle,
> +  IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  *ConfigLangList
>);
>
>  /**
> diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> index 98288d66..ea274018 100644
> --- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
> @@ -12,7 +12,8 @@
>
>  CHAR8  BiosEmptyJson[] = "{\"@odata.id\": \"\", \"@odata.type\":
> \"#Bios.v1_0_9.Bios\", \"Id\": \"\", \"Name\": \"\", \"Attributes\":{}}";
>
> -REDFISH_RESOURCE_COMMON_PRIVATE  *mRedfishResourcePrivate =
> NULL;
> +REDFISH_RESOURCE_COMMON_PRIVATE  *mRedfishResourcePrivate
> = NULL;
> +EFI_HANDLE   mRedfishResourceConfigProtocolHandle = NULL;
>
>  /**
>Consume resource from given URI.
> @@ -385,7 +386,7 @@ ProvisioningBiosResources (
>// Set the configuration language in the
> RESOURCE_INFORMATION_EXCHANGE.
>// This information is sent back to the parent resource (e.g. the 
> collection
> driver).
>//
> -  EdkIIRedfishResourceSetConfigureLang ();
> +  EdkIIRedfishResourceSetConfigureLang
> (mRedfishResourceConfigProtocolHandle, );
>
>for (Index = 0; Index < UnifiedConfigureLangList.Count; Index++) {
>  DEBUG ((DEBUG_MANAGEABILITY, "[%d] create Bios resource from: %s\n",
> UnifiedConfigureLangList.List[Index].Index,
> UnifiedConfigureLangList.List[Index].ConfigureLang));
> @@ -750,7 +751,7 @@ 

[edk2-devel] [edk2-platforms][PATCH] MinPlatformPkg: should build Performance driver only when perf enabled

2023-11-27 Thread Li, Yi
Should build FirmwarePerformancePei only when perf enabled.
Avoiding unconditional compilation of performance PEI drivers can
save 2KB(LZMA compressed) in PostMem FV, small but important.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Yi Li 
---
 .../MinPlatformPkg/Include/Fdf/CorePostMemoryInclude.fdf| 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Include/Fdf/CorePostMemoryInclude.fdf 
b/Platform/Intel/MinPlatformPkg/Include/Fdf/CorePostMemoryInclude.fdf
index 3edc239e5..bc8ebc84b 100644
--- a/Platform/Intel/MinPlatformPkg/Include/Fdf/CorePostMemoryInclude.fdf
+++ b/Platform/Intel/MinPlatformPkg/Include/Fdf/CorePostMemoryInclude.fdf
@@ -1,12 +1,14 @@
 ## @file
 #  FDF file of Platform.
 #
-# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
 
 !if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly == FALSE
-  INF  
MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf
+  !if gMinPlatformPkgTokenSpaceGuid.PcdPerformanceEnable == TRUE
+INF  
MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf
+  !endif
 !endif
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111793): https://edk2.groups.io/g/devel/message/111793
Mute This Topic: https://groups.io/mt/102845821/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH 4/6] RedfishClientPkg/ConverterLib: fix empty attribute value issue

2023-11-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Thursday, November 23, 2023 10:34 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [edk2-redfish-client][PATCH 4/6] RedfishClientPkg/ConverterLib: fix
> empty attribute value issue
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> When attribute is empty string, converter library creates NULL
> attribute value in C structure instead of empty string.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> index 02fcb2b2..7c2fa3c9 100644
> --- a/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> +++ b/RedfishClientPkg/ConverterLib/src/RedfishCsCommon.c
> @@ -1,6 +1,7 @@
>  /** @file
>
>(C) Copyright 2018-2022 Hewlett Packard Enterprise Development LP
> +  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
>
>SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -446,6 +447,9 @@ CreateEmptyPropCsJson (
>  if (TempJsonObj == NULL) {
>return RedfishCS_status_not_found;
>  }
> +  } else {
> +// Dump JSON from JsonObj.
> +TempJsonObj = JsonObj;
>}
>
>Status = allocateRecordCsMemory (Cs, sizeof
> (RedfishCS_Type_EmptyProp_CS_Data), (void **));
> --
> 2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111792): https://edk2.groups.io/g/devel/message/111792
Mute This Topic: https://groups.io/mt/102767546/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH 3/6] RedfishClientPkg: feature driver enhancement.

2023-11-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

> -Original Message-
> From: Nickle Wang 
> Sent: Thursday, November 23, 2023 10:34 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [edk2-redfish-client][PATCH 3/6] RedfishClientPkg: feature driver
> enhancement.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> -Fix typo (include function RedfisSetRedfishUri and parameter
> MaxLengthConfigLang)
> -Add more debug message.
> -Do not save ETag to variable every time when new ETag is created
> in SetEtagWithUri().
> -Introduce SetEtagFromUri() to get ETag from BMC and save it
> in variable.
> -Introduce GetPendingSettings() to check and see if Redfish pending
> settings is supported or not.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  .../Library/RedfishFeatureUtilityLib.h|  81 ++--
>  .../Features/Bios/v1_0_9/Common/BiosCommon.c  |   4 +-
>  .../v1_5_0/Common/ComputerSystemCommon.c  |   4 +-
>  .../Memory/V1_7_1/Common/MemoryCommon.c   |   4 +-
>  .../RedfishFeatureUtilityLib.c| 192 +-
>  5 files changed, 253 insertions(+), 32 deletions(-)
>
> diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> index e2f728b2..6347585c 100644
> --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h
> @@ -22,7 +22,7 @@
>
>Read redfish resource by given resource URI.
>
> -  @param[in]  Service   Redfish srvice instacne to make query.
> +  @param[in]  Service   Redfish service instance to make query.
>@param[in]  ResourceUri   Target resource URI.
>@param[out] Response  HTTP response from redfish service.
>
> @@ -47,7 +47,7 @@ GetResourceByUri (
>@param[out] ArraySignatureClose   String to the close of array 
> signature.
>
>@retval EFI_SUCCESSIndex is found.
> -  @retval EFI_NOT_FOUND  The non-array configure language string 
> is
> retured.
> +  @retval EFI_NOT_FOUND  The non-array configure language string 
> is
> returned.
>@retval EFI_INVALID_PARAMETER  The format of input ConfigureLang is
> wrong.
>@retval Others Errors occur.
>
> @@ -118,10 +118,10 @@ GetNumberOfRedpathNodes (
>
>@param[in]  NodeString The node string to parse.
>@param[in]  Index  Index of the node.
> -  @param[out] EndOfNodePtr   Pointer to receive the poitner to
> +  @param[out] EndOfNodePtr   Pointer to receive the pointer to
>   the last character of node string.
>
> -  @retval EFI_STRING the begining of the node string.
> +  @retval EFI_STRING the beginning of the node string.
>
>  **/
>  EFI_STRING
> @@ -140,7 +140,7 @@ GetRedpathNodeByIndex (
>@param[out] Index The array index number.
>
>@retval EFI_SUCCESSIndex is found.
> -  @retval EFI_NOT_FOUND  The non-array configure language string 
> is
> retured.
> +  @retval EFI_NOT_FOUND  The non-array configure language string 
> is
> returned.
>@retval EFI_INVALID_PARAMETER  The format of input ConfigureLang is
> wrong.
>@retval Others Errors occur.
>
> @@ -188,9 +188,9 @@ DestroyConfiglanguageList (
>
>@param[in]  DestConfigLangPointer to the node's configure language
> string.
>  The memory pointed by ConfigLang must be 
> allocated
> -through memory allocation interface. 
> Becasue we will
> replace
> +through memory allocation interface. 
> Because we will
> replace
>  the pointer in this function.
> -  @param[in]  MaxtLengthConfigLang  The maximum length of ConfigLang.
> +  @param[in]  MaxLengthConfigLang   The maximum length of ConfigLang.
>@param[in]  ConfigLangInstancePointer to Collection member instance.
>
>@retval EFI_SUCCESS The instance is inserted to the configure 
> language.
> @@ -200,7 +200,7 @@ DestroyConfiglanguageList (
>  EFI_STATUS
>  SetResourceConfigLangMemberInstance (
>IN EFI_STRING  *DestConfigLang,
> -  IN UINTN   MaxtLengthConfigLang,
> +  IN UINTN   MaxLengthConfigLang,
>IN REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG  *ConfigLangInstance
>);
>
> @@ -244,7 +244,7 @@ ApplyFeatureSettingsStringType (
>
>  /**
>
> -  Apply property value to UEFI HII database in numric type.
> +  Apply property value to UEFI HII database in numeric type.
>
>@param[in]  SchemaProperty 

Re: [edk2-devel] [edk2-platforms PATCH 1/2] WhitleyOpenBoardPkg: remove references

2023-11-27 Thread Chiu, Chasel


> -Original Message-
> From: Pedro Falcato 
> Sent: Monday, November 27, 2023 3:14 PM
> To: devel@edk2.groups.io; Chiu, Chasel 
> Cc: Laszlo Ersek ; Chaganty, Rangasai V
> ; Desimone, Nathaniel L
> 
> Subject: Re: [edk2-devel] [edk2-platforms PATCH 1/2] WhitleyOpenBoardPkg:
> remove  references
> 
> On Tue, Nov 21, 2023 at 2:17 AM Chiu, Chasel  wrote:
> >
> >
> > Hi Laszlo,
> >
> > I think you have to clone all the required repos.
> > edk2 repository
> > git clone https://github.com/tianocore/edk2.git
> >
> > edk2-platforms repository
> > git clone https://github.com/tianocore/edk2-platforms.git
> >
> > edk2-non-osi repository
> > git clone https://github.com/tianocore/edk2-non-osi.git
> >
> > FSP repository
> > git clone https://github.com/IntelFsp/FSP.git
> 
> I wonder if the docs are outdated? I had heard of 
> https://github.com/Intel/FSP,
> not IntelFsp/FSP.
> Does https://github.com/Intel/FSP work?


Yes, https://github.com/intel/FSP.git is the one, however, In my case both 
links work the same and I can clone successfully by either one.


> 
> --
> Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111790): https://edk2.groups.io/g/devel/message/111790
Mute This Topic: https://groups.io/mt/102483850/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-platforms][PATCH v1] PurleyOpenBoardPkg/BoardMtOlympus: Fix Build

2023-11-27 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

Thanks,
Chasel


> -Original Message-
> From: Desimone, Nathaniel L 
> Sent: Monday, November 27, 2023 5:04 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel 
> Subject: [edk2-platforms][PATCH v1] PurleyOpenBoardPkg/BoardMtOlympus: Fix
> Build
> 
> Updates Microcode and Silicon FV sizes so they can accomodate the newest
> content.
> 
> Cc: Chasel Chiu 
> Signed-off-by: Nate DeSimone 
> ---
>  .../BoardMtOlympus/OpenBoardPkg.fdf   | 25 +++
>  1 file changed, 14 insertions(+), 11 deletions(-)
> 
> diff --git
> a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf
> b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf
> index 413d98a070..86d1673458 100644
> --- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf
> +++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf
> @@ -1,7 +1,7 @@
>  ## @file
>  #  FDF file for the MtOlympus board.
>  #
> -# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.
> +# Copyright (c) 2018 - 2023, Intel Corporation. All rights
> +reserved.
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -43,11 +43,11 @@ FV =
> FvOsBoot
> gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUBase|gMinPlatformPkgTokenSp
> aceGuid.PcdFlashFvFspUSize
>  FV = FvLateSiliconCompressed
> 
> -0x0090|0x0040
> +0x0090|0x0030
> 
> gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootBase|gMinPlatformPkgToke
> nSpaceGuid.PcdFlashFvUefiBootSize
>  FV = FvUefiBoot
> 
> -0x00D0|0x0007C000
> +0x00C0|0x0007C000
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|gEfiMdeMo
> dulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
>  #NV_VARIABLE_STORE
>  DATA = {
> @@ -86,10 +86,10 @@ DATA = {
>0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  }
> 
> -0x00D7C000|0x2000
> +0x00C7C000|0x2000
>  #NV_EVENT_LOG
> 
> -0x00D7E000|0x2000
> +0x00C7E000|0x2000
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|gEfiMde
> ModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
>  #NV_FTW_WORKING
>  DATA = {
> @@ -103,28 +103,28 @@ DATA = {
>0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  }
> 
> -0x00D8|0x0008
> +0x00C8|0x0008
> 
> gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|gEfiMdeM
> odulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
>  #NV_FTW_SPARE
> 
> 
> -0x00E0|0x0001
> +0x00D0|0x0003
> 
> gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase|gCpuUncoreTok
> enSpaceGuid.PcdFlashNvStorageMicrocodeSize
>  FV = MICROCODE_FV
> 
> -0x00E1|0x0001
> +0x00D3|0x0001
> 
> gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryBase|gMinPlatformPkgT
> okenSpaceGuid.PcdFlashFvPostMemorySize
>  FV = FvPostMemory
> 
> -0x00E2|0x0003
> +0x00D4|0x0002
> 
> gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase|gMinPlatformPkgTokenSp
> aceGuid.PcdFlashFvFspSSize
>  FILE =
> $(PLATFORM_SI_BIN_PACKAGE)/FV/FvPostMemorySilicon/$(TARGET)/FvPostMe
> morySilicon.Fv
> 
> -0x00E5|0x0006
> +0x00D6|0x0005
> 
> gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase|gMinPlatformPkgT
> okenSpaceGuid.PcdFlashFvPreMemorySize
>  FV = FvPreMemory
> 
> -0x00EB|0x0013
> +0x00DB|0x0023
> 
> gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase|gMinPlatformPkgTokenSp
> aceGuid.PcdFlashFvFspMSize
>  FILE =
> $(PLATFORM_SI_BIN_PACKAGE)/FV/FvPreMemorySilicon/$(TARGET)/FvPreMemo
> rySilicon.Fv
> 
> @@ -135,6 +135,9 @@ FILE =
> $(PLATFORM_SI_BIN_PACKAGE)/FV/FvTempMemorySilicon/$(TARGET)/FvTempM
> emoryS
>  SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeBase=
> gEfiPchTokenSpaceGuid.PcdFlashAreaBaseAddress +
> gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase
>  SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeSize=
> gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeSize
> 
> +SET gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase   =
> gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase
> +SET gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize   =
> gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeSize
> +
>  SET gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress=
> gEfiPchTokenSpaceGuid.PcdFlashAreaBaseAddress +
> gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase + 0x60
>  SET gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize =
> gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeSize - 0x60
> 
> --
> 2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111789): https://edk2.groups.io/g/devel/message/111789
Mute This Topic: https://groups.io/mt/102842750/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-platforms][PATCH v1] PurleyOpenBoardPkg: Fix Build

2023-11-27 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

Thanks,
Chasel


> -Original Message-
> From: Desimone, Nathaniel L 
> Sent: Monday, November 27, 2023 5:04 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel 
> Subject: [edk2-platforms][PATCH v1] PurleyOpenBoardPkg: Fix Build
> 
> Adds SmmLockBox driver which is needed to build with the newest version of
> MinPlatformPkg
> 
> Cc: Chasel Chiu 
> Signed-off-by: Nate DeSimone 
> ---
>  .../Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc   | 3 ++-
>  .../Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc   | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git
> a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc
> b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc
> index 39c5cf78ab..65f22bb90e 100644
> --- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc
> +++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc
> @@ -1,7 +1,7 @@
>  ## @file
>  #  The main build description file for the MtOlympus board.
>  #
> -# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.
> +# Copyright (c) 2018 - 2023, Intel Corporation. All rights
> +reserved.
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -195,6 +195,7 @@
>$(PLATFORM_PACKAGE)/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf
> 
>$(PLATFORM_BOARD_PACKAGE)/Policy/S3NvramSave/S3NvramSave.inf
> +  MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf
> 
>#
># Shell
> diff --git
> a/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc
> b/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc
> index 5747717ecb..64e8978942 100644
> --- a/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc
> +++ b/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc
> @@ -1,7 +1,7 @@
>  ## @file
>  #  The main build description file for the TiogaPass board.
>  #
> -# Copyright (c) 2018, Intel Corporation. All rights reserved.
> +# Copyright (c) 2018 - 2023, Intel Corporation. All rights
> +reserved.
>  # Copyright (c) 2021, American Megatrends International LLC.  # SPDX-
> License-Identifier: BSD-2-Clause-Patent  # @@ -226,6 +226,7 @@
> 
>$(PLATFORM_BOARD_PACKAGE)/Policy/S3NvramSave/S3NvramSave.inf
>BoardModulePkg/BoardBdsHookDxe/BoardBdsHookDxe.inf
> +  MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf
> 
>#
># Shell
> --
> 2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111788): https://edk2.groups.io/g/devel/message/111788
Mute This Topic: https://groups.io/mt/102842752/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-platforms][PATCH v1] MinPlatformPkg: Update PatchFv Tools for Python 3.x

2023-11-27 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

Thanks,
Chasel


> -Original Message-
> From: Desimone, Nathaniel L 
> Sent: Monday, November 27, 2023 5:04 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Gao, Liming
> ; Dong, Eric 
> Subject: [edk2-platforms][PATCH v1] MinPlatformPkg: Update PatchFv Tools for
> Python 3.x
> 
> PatchFv tools now run on Python 3.x
> 
> Cc: Chasel Chiu 
> Cc: Liming Gao 
> Cc: Eric Dong 
> Signed-off-by: Nate DeSimone 
> ---
>  .../MinPlatformPkg/Tools/PatchFv/PatchBfv.py  | 35 
>  .../Tools/PatchFv/PatchBinFv.py   | 69 
>  .../Tools/PatchFv/RebaseBinFv.py  | 82 +--
>  3 files changed, 92 insertions(+), 94 deletions(-)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py
> b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py
> index 1312bfc328..f05480b91f 100644
> --- a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py
> +++ b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py
> @@ -1,6 +1,6 @@
>  ## @ PatchBfv.py
>  #
> -# Copyright (c) 2017, Intel Corporation. All rights reserved.
> +# Copyright (c) 2017 - 2023, Intel Corporation. All rights
> +reserved.
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  #  ## @@ -11,8 +11,7 @@
> import sys  import time  import shutil  import struct -import binascii
> -from   ctypes import *
> +from ctypes import *
> 
>  class FileChecker:
>  def __init__(self):
> @@ -21,17 +20,17 @@ class FileChecker:
>  self.pcd = ["", "", ""]
> 
>  def PrintPcd(self):
> -print "PCD: " + self.pcd[0] + "|" + self.pcd[1] + "(" + self.pcd[2] 
> + ")"
> +print("PCD: {0}|{1}({2})".format(*(self.pcd)))
> 
>  def ProcessReport(self):
>  try :
>  file = open(self.reportFile)
>  except Exception:
> -print "fail to open " + self.reportFile
> +print("fail to open " + self.reportFile)
>  return
>  try:
>  file.seek(0)
> -print "checking - " + self.pcd[0]
> +print("checking - " + self.pcd[0])
>  ValuePair = self.GetPcdFromReport (file, self.pcd[0])
>  self.pcd[1] = ValuePair[0]
>  self.pcd[2] = ValuePair[1]
> @@ -42,12 +41,12 @@ class FileChecker:
> 
>  def PatchFd(self):
>  fileName = self.fdName
> -print "patching BFV - " + fileName
> +print("patching BFV - " + fileName)
> 
>  try :
>  file = open(fileName, "rb")
>  except Exception:
> -print "fail to open " + fileName
> +print("fail to open " + fileName)
>  return
>  try:
>  buffer = file.read()
> @@ -57,7 +56,7 @@ class FileChecker:
>  offset = -4
> 
>  l = struct.pack("L", int(self.pcd[1],16))
> -print "  [" + hex(offset) + "] " + binascii.hexlify(data[-4:]) + 
> " <= " +
> binascii.hexlify(l)
> +print("  [" + hex(offset) + "] " + bytes(data[-4:]).hex() +
> + " <= " + bytes(l).hex())
>  data[-4:] = l
> 
>  file = open(fileName, "wb") @@ -77,36 +76,36 @@ class 
> FileChecker:
> 
>  newline = line[:-1]
> 
> -if (cmp (newline, TargetPkg) == 0):
> +if newline == TargetPkg:
>  FoundPkg = True
>  continue
> 
> -if (cmp (newline, "") == 0) or ((cmp (newline[0], " ") != 0) and 
> (cmp
> (newline[0], "0") != 0)):
> +if newline == "" or (newline[0] != " " and newline[0] != "0"):
>  FoundPkg = False
> 
>  if (FoundPkg == True) :
>  newline = newline.strip()
>  splitLine = newline.split(" ", 2)
> -if (cmp (splitLine[0], "*F") == 0) or (cmp (splitLine[0], 
> "*P") == 0) :
> -if (cmp (splitLine[1], TargetPcd) == 0):
> -print "found - " + TargetPkg + "." + TargetPcd
> +if splitLine[0] == "*F" or splitLine[0] == "*P":
> +if splitLine[1] == TargetPcd:
> +print("found - " + TargetPkg + "." + TargetPcd)
> 
>  splitLine = splitLine[2].strip()[1:].strip().split(" 
> ", 1)
> -if (cmp (splitLine[0], "FIXED") == 0) or (cmp 
> (splitLine[0], "PATCH")
> == 0):
> +if splitLine[0] == "FIXED" or splitLine[0] == 
> "PATCH":
>  SplitLine = splitLine[1].strip()[1:].split(")", 
> 1)
>  Type = SplitLine[0]
>  Value = 
> SplitLine[1].strip()[1:].strip().split()[0]
> -print "  Type - (" + Type + "), Value - (" + 
> Value + ")"
> +print("  Type - (" + Type + "), Value - ("
> + + Value + ")")
>  return [Value, Type]
>  return ["", ""]
> -
> +
>  def main():
>  global FileChecker
> 
> 

Re: [edk2-devel] [edk2-platforms][PATCH v1] MinPlatformPkg: Add edk2-platforms/Features to PACKAGES_PATH

2023-11-27 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

Thanks,
Chasel


> -Original Message-
> From: Desimone, Nathaniel L 
> Sent: Monday, November 27, 2023 5:04 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Gao, Liming
> ; Dong, Eric 
> Subject: [edk2-platforms][PATCH v1] MinPlatformPkg: Add edk2-
> platforms/Features to PACKAGES_PATH
> 
> Cc: Chasel Chiu 
> Cc: Liming Gao 
> Cc: Eric Dong 
> Signed-off-by: Nate DeSimone 
> ---
>  Platform/Intel/build.cfg |  5 +++--
>  Platform/Intel/build_bios.py | 11 +++
>  2 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/Platform/Intel/build.cfg b/Platform/Intel/build.cfg index
> 2ff536bb3e..6ab2ced1a5 100644
> --- a/Platform/Intel/build.cfg
> +++ b/Platform/Intel/build.cfg
> @@ -1,7 +1,7 @@
>  # @ build.cfg
>  # This is the main/default build configuration file  # -# Copyright (c) 2019 
> - 2021,
> Intel Corporation. All rights reserved.
> +# Copyright (c) 2019 - 2023, Intel Corporation. All rights
> +reserved.
>  # Copyright (c) 2021 - 2022, American Megatrends International LLC.  #
> SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -13,7 +13,8 @@
> WORKSPACE_FSP_BIN = FSP  EDK_TOOLS_BIN = edk2-BaseTools-win32
> EDK_BASETOOLS = BaseTools  WORKSPACE_DRIVERS = edk2-platforms/Drivers -
> WORKSPACE_FEATURES = edk2-platforms/Features/Intel
> +WORKSPACE_FEATURES = edk2-platforms/Features
> WORKSPACE_FEATURES_INTEL =
> +edk2-platforms/Features/Intel
>  WORKSPACE_PLATFORM = edk2-platforms/Platform/Intel  WORKSPACE_SILICON
> = edk2-platforms/Silicon/Intel  WORKSPACE_PLATFORM_BIN = diff --git
> a/Platform/Intel/build_bios.py b/Platform/Intel/build_bios.py index
> 43a241c837..c79a653f4d 100755
> --- a/Platform/Intel/build_bios.py
> +++ b/Platform/Intel/build_bios.py
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python3
> +#!/usr/bin/env python3
>  #
>  # @ build_bios.py
>  # Builds BIOS using configuration files and dynamically @@ -109,6 +109,8 @@
> def pre_build(build_config, build_type="DEBUG", silent=False, toolchain=None):
> config["WORKSPACE_SILICON"])
>  config["WORKSPACE_FEATURES"] = os.path.join(config["WORKSPACE"],
> config["WORKSPACE_FEATURES"])
> +config["WORKSPACE_FEATURES_INTEL"] =
> os.path.join(config["WORKSPACE"],
> +
> + config["WORKSPACE_FEATURES_INTEL"])
>  config["WORKSPACE_DRIVERS"] = os.path.join(config["WORKSPACE"],
> config["WORKSPACE_DRIVERS"])
>  config["WORKSPACE_PLATFORM_BIN"] = \ @@ -123,9 +125,10 @@ def
> pre_build(build_config, build_type="DEBUG", silent=False, toolchain=None):
>  config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_SILICON"]
>  config["PACKAGES_PATH"] += os.pathsep +
> config["WORKSPACE_SILICON_BIN"]
>  config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_FEATURES"]
> -# add all feature domains in WORKSPACE_FEATURES to package path
> -for filename in os.listdir(config["WORKSPACE_FEATURES"]):
> -filepath = os.path.join(config["WORKSPACE_FEATURES"], filename)
> +config["PACKAGES_PATH"] += os.pathsep +
> config["WORKSPACE_FEATURES_INTEL"]
> +# add all feature domains in WORKSPACE_FEATURES_INTEL to package path
> +for filename in os.listdir(config["WORKSPACE_FEATURES_INTEL"]):
> +filepath = os.path.join(config["WORKSPACE_FEATURES_INTEL"],
> + filename)
>  # feature domains folder does not contain dec file
>  if os.path.isdir(filepath) and \
>not glob.glob(os.path.join(filepath, "*.dec")):
> --
> 2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111786): https://edk2.groups.io/g/devel/message/111786
Mute This Topic: https://groups.io/mt/102842749/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-platforms][PATCH v1] PurleyOpenBoardPkg: Replace Python Interpreter Name

2023-11-27 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

Thanks,
Chasel


> -Original Message-
> From: Desimone, Nathaniel L 
> Sent: Friday, November 17, 2023 10:36 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel 
> Subject: [edk2-platforms][PATCH v1] PurleyOpenBoardPkg: Replace Python
> Interpreter Name
> 
> Removes the assumption that the python interpreter will have the name python.
> 
> Cc: Chasel Chiu 
> Signed-off-by: Nate DeSimone 
> ---
>  .../PurleyOpenBoardPkg/BoardMtOlympus/build_board.py   |  8 
>  .../PurleyOpenBoardPkg/BoardTiogaPass/build_board.py   | 10 +-
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/build_board.py
> b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/build_board.py
> index 2ba615d3e4..ffe762e289 100644
> --- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/build_board.py
> +++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/build_board.py
> @@ -1,7 +1,7 @@
>  # @ build_board.py
>  # This adds additional functions to the build_bios.py  # -# Copyright (c) 
> 2019, Intel
> Corporation. All rights reserved.
> +# Copyright (c) 2019 - 2023, Intel Corporation. All rights
> +reserved.
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  #
> 
> @@ -48,7 +48,7 @@ def pre_build_ex(config, functions):
>  print("AML_FILTER= ", config.get("AML_FILTER"))
> 
>  # build the command with arguments
> -command = ["python",
> +command = [sys.executable,
> os.path.join(config["MIN_PACKAGE_TOOLS"],
>  "AmlGenOffset",
>  "AmlGenOffset.py"), @@ -110,7 +110,7 @@ def
> post_build_ex(config, functions):
>  print("post_build_ex Error")
>  sys.exit(1)
> 
> -common_patch_command = [os.path.join(config["PYTHON_HOME"],
> "python"),
> +common_patch_command = [sys.executable,
>  os.path.join(config["MIN_PACKAGE_TOOLS"],
>   "PatchFv", "PatchBinFv.py"),
>  config["TARGET"], @@ -131,7 +131,7 @@ def
> post_build_ex(config, functions):
>  print("Patch Error!")
>  sys.exit(1)
> 
> -common_rebase_command = [os.path.join(config["PYTHON_HOME"],
> "python"),
> +common_rebase_command = [sys.executable,
>   os.path.join(config["MIN_PACKAGE_TOOLS"],
>"PatchFv", "RebaseBinFv.py"),
>   config["TARGET"], diff --git
> a/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/build_board.py
> b/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/build_board.py
> index 46fd389ef1..3b66df7115 100644
> --- a/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/build_board.py
> +++ b/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/build_board.py
> @@ -1,7 +1,7 @@
>  # @ build_board.py
>  # This adds additional functions to the build_bios.py  # -# Copyright (c) 
> 2018, Intel
> Corporation. All rights reserved.
> +# Copyright (c) 2018 - 2023, Intel Corporation. All rights
> +reserved.
>  # Copyright (c) 2021, American Megatrends International LLC.  # SPDX-
> License-Identifier: BSD-2-Clause-Patent  # @@ -49,7 +49,7 @@ def
> pre_build_ex(config, functions):
>  print("AML_FILTER= ", config.get("AML_FILTER"))
> 
>  # build the command with arguments
> -command = ["python",
> +command = [sys.executable,
> os.path.join(config["MIN_PACKAGE_TOOLS"],
>  "AmlGenOffset",
>  "AmlGenOffset.py"), @@ -111,7 +111,7 @@ def
> post_build_ex(config, functions):
>  print("post_build_ex Error")
>  sys.exit(1)
> 
> -common_patch_command = [os.path.join(config["PYTHON_HOME"],
> "python"),
> +common_patch_command = [sys.executable,
>  os.path.join(config["MIN_PACKAGE_TOOLS"],
>   "PatchFv", "PatchBinFv.py"),
>  config["TARGET"], @@ -132,7 +132,7 @@ def
> post_build_ex(config, functions):
>  print("Patch Error!")
>  sys.exit(1)
> 
> -common_rebase_command = [os.path.join(config["PYTHON_HOME"],
> "python"),
> +common_rebase_command = [sys.executable,
>   os.path.join(config["MIN_PACKAGE_TOOLS"],
>"PatchFv", "RebaseBinFv.py"),
>   config["TARGET"], @@ -161,7 +161,7 @@ def
> post_build_ex(config, functions):
>  print("Patch Error!")
>  sys.exit(1)
> 
> -common_patchbfv_command = [os.path.join(config["PYTHON_HOME"],
> "python"),
> +common_patchbfv_command = [sys.executable,
> os.path.join(config["MIN_PACKAGE_TOOLS"],
>"PatchFv", "PatchBfv.py"),
> os.path.join(config["BUILD_DIR_PATH"],
> --
> 2.34.1



Re: [edk2-devel] [edk2-platforms][PATCH v1] WhitleyOpenBoardPkg: Replace Python Interpreter Name

2023-11-27 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

Thanks,
Chasel


> -Original Message-
> From: Desimone, Nathaniel L 
> Sent: Friday, November 17, 2023 10:36 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel 
> Subject: [edk2-platforms][PATCH v1] WhitleyOpenBoardPkg: Replace Python
> Interpreter Name
> 
> Removes the assumption that the python interpreter will have the name python.
> 
> Cc: Chasel Chiu 
> Signed-off-by: Nate DeSimone  ---
>  Platform/Intel/WhitleyOpenBoardPkg/Aowanda/build_board.py | 4 ++--
>  .../Intel/WhitleyOpenBoardPkg/JunctionCity/build_board.py | 4 ++--
>  .../Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_board.py| 4 ++--
>  3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/Platform/Intel/WhitleyOpenBoardPkg/Aowanda/build_board.py
> b/Platform/Intel/WhitleyOpenBoardPkg/Aowanda/build_board.py
> index af6985019b..70ef4c2201 100644
> --- a/Platform/Intel/WhitleyOpenBoardPkg/Aowanda/build_board.py
> +++ b/Platform/Intel/WhitleyOpenBoardPkg/Aowanda/build_board.py
> @@ -2,7 +2,7 @@
>  # Extensions for building Aowanda using build_bios.py  #  # -# Copyright (c) 
> 2021,
> Intel Corporation. All rights reserved.
> +# Copyright (c) 2021 - 2023, Intel Corporation. All rights
> +reserved.
>  # Copyright (c) 2022, American Megatrends International LLC.   # SPDX-
> License-Identifier: BSD-2-Clause-Patent  # @@ -107,7 +107,7 @@ def
> pre_build_ex(config, functions):
>  if not os.path.exists(out_file_dir):
>  os.mkdir(out_file_dir)
> 
> -command = ["python",
> +command = [sys.executable,
> os.path.join(config["MIN_PACKAGE_TOOLS"], "AmlGenOffset",
> "AmlGenOffset.py"),
> "-d", "--aml_filter", config["AML_FILTER"],
> "-o", out_file_path,
> diff --git a/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/build_board.py
> b/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/build_board.py
> index ccf7a8c55a..61b893686c 100644
> --- a/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/build_board.py
> +++ b/Platform/Intel/WhitleyOpenBoardPkg/JunctionCity/build_board.py
> @@ -2,7 +2,7 @@
>  # Extensions for building JunctionCity using build_bios.py  #  # -# 
> Copyright (c)
> 2021, Intel Corporation. All rights reserved.
> +# Copyright (c) 2021 - 2023, Intel Corporation. All rights
> +reserved.
>  # Copyright (c) 2021, American Megatrends International LLC.   # SPDX-
> License-Identifier: BSD-2-Clause-Patent  # @@ -107,7 +107,7 @@ def
> pre_build_ex(config, functions):
>  if not os.path.exists(out_file_dir):
>  os.mkdir(out_file_dir)
> 
> -command = ["python",
> +command = [sys.executable,
> os.path.join(config["MIN_PACKAGE_TOOLS"], "AmlGenOffset",
> "AmlGenOffset.py"),
> "-d", "--aml_filter", config["AML_FILTER"],
> "-o", out_file_path,
> diff --git a/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_board.py
> b/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_board.py
> index e2d32d3e13..8d62dd43b8 100644
> --- a/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_board.py
> +++ b/Platform/Intel/WhitleyOpenBoardPkg/WilsonCityRvp/build_board.py
> @@ -1,7 +1,7 @@
>  # @ build_board.py
>  # Extensions for building WilsonCityRvp using build_bios.py  # -# Copyright 
> (c)
> 2021, Intel Corporation. All rights reserved.
> +# Copyright (c) 2021 - 2023, Intel Corporation. All rights
> +reserved.
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  #
> 
> @@ -105,7 +105,7 @@ def pre_build_ex(config, functions):
>  if not os.path.exists(out_file_dir):
>  os.mkdir(out_file_dir)
> 
> -command = ["python",
> +command = [sys.executable,
> os.path.join(config["MIN_PACKAGE_TOOLS"], "AmlGenOffset",
> "AmlGenOffset.py"),
> "-d", "--aml_filter", config["AML_FILTER"],
> "-o", out_file_path,
> --
> 2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111784): https://edk2.groups.io/g/devel/message/111784
Mute This Topic: https://groups.io/mt/102667306/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH 2/6] RedfishClientPkg/RedfishConfigLangMapDxe: fix issue and enhancement.

2023-11-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Thursday, November 23, 2023 10:34 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [edk2-redfish-client][PATCH 2/6]
> RedfishClientPkg/RedfishConfigLangMapDxe: fix issue and enhancement.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> -Fix typo (replace Listheader to ListHeader).
> -Replace "%a," to "%a:".
> -Add more debug message.
> -Fix issue of assigning ASCII character to Unicode string pointer.
> -Remove the exit-boot-service callback since data is saved at
> after-provisioning event. There is no need to save data to variable
> again.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  .../RedfishConfigLangMapDxe.inf   |  1 -
>  .../RedfishConfigLangMapDxe.h |  2 +-
>  .../RedfishConfigLangMapDxe.c | 89 +--
>  3 files changed, 41 insertions(+), 51 deletions(-)
>
> diff --git
> a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.in
> f
> b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.in
> f
> index 42d9daf2..02346745 100644
> ---
> a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.in
> f
> +++
> b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.in
> f
> @@ -41,7 +41,6 @@
>gEdkIIRedfishConfigLangMapProtocolGuid   ## PRODUCED ##
>
>  [Guids]
> -  gEfiEventExitBootServicesGuid  ## CONSUMED ##
>gEfiRedfishClientVariableGuid  ## CONSUMED ##
>
>  [Depex]
> diff --git
> a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h
> b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h
> index efa27d4d..4ac55941 100644
> ---
> a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h
> +++
> b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.h
> @@ -49,7 +49,7 @@ typedef struct {
>  // Definition of REDFISH_CONFIG_LANG_MAP_LIST
>  //
>  typedef struct {
> -  LIST_ENTRYListheader;
> +  LIST_ENTRYListHeader;
>UINTN TotalSize;
>UINTN Count;
>  } REDFISH_CONFIG_LANG_MAP_LIST;
> diff --git
> a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
> b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
> index 97f29549..8c930445 100644
> ---
> a/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
> +++
> b/RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.c
> @@ -102,7 +102,7 @@ ON_ERROR:
>@param[in]Uri The URI string matching to this ConfigLang.
>@param[in]ConfigLang  ConfigLang string.
>
> -  @retval EFI_SUCCESS   config language map recourd is added.
> +  @retval EFI_SUCCESS   config language map record is added.
>@retval OthersFail to add config language map.
>
>  **/
> @@ -124,7 +124,7 @@ AddConfigLangMapRecord (
>  return EFI_OUT_OF_RESOURCES;
>}
>
> -  InsertTailList (>Listheader, >List);
> +  InsertTailList (>ListHeader, >List);
>++List->Count;
>List->TotalSize += NewRecord->Size;
>
> @@ -137,7 +137,7 @@ AddConfigLangMapRecord (
>@param[in]ListTarget config language map list to be removed.
>@param[in]Record  Pointer to the instance to be deleted.
>
> -  @retval EFI_SUCCESS   config language map recourd is removed.
> +  @retval EFI_SUCCESS   config language map record is removed.
>@retval OthersFail to add config language map.
>
>  **/
> @@ -237,20 +237,20 @@ DumpConfigLangMapList (
>  DEBUG ((DEBUG_ERROR, "%s\n", Msg));
>}
>
> -  if (IsListEmpty (>Listheader)) {
> +  if (IsListEmpty (>ListHeader)) {
>  DEBUG ((DEBUG_MANAGEABILITY, "ConfigLangMap list is empty\n"));
>  return EFI_NOT_FOUND;
>}
>
>DEBUG ((DEBUG_MANAGEABILITY, "Count: %d Total Size: %d\n",
> ConfigLangMapList->Count, ConfigLangMapList->TotalSize));
>Record = NULL;
> -  List   = GetFirstNode (>Listheader);
> -  while (!IsNull (>Listheader, List)) {
> +  List   = GetFirstNode (>ListHeader);
> +  while (!IsNull (>ListHeader, List)) {
>  Record = REDFISH_CONFIG_LANG_MAP_RECORD_FROM_LIST (List);
>
>  DEBUG ((DEBUG_MANAGEABILITY, "ConfigLang: %s Uri: %s Size: %d\n",
> Record->ConfigLang, Record->Uri, Record->Size));
>
> -List = GetNextNode (>Listheader, List);
> +List = GetNextNode (>ListHeader, List);
>}
>
>return EFI_SUCCESS;
> @@ -317,16 +317,16 @@ ReleaseConfigLangMapList (
>  return EFI_INVALID_PARAMETER;
>}
>
> -  if (IsListEmpty (>Listheader)) {
> +  if (IsListEmpty (>ListHeader)) {
>  return EFI_SUCCESS;
>}
>
>Record = NULL;
>Next   = NULL;
> -  List   = GetFirstNode (>Listheader);
> -  while (!IsNull (>Listheader, List)) {
> +  List   = GetFirstNode 

Re: [edk2-devel] [edk2-platforms][PATCH v1] MinPlatformPkg: Remove usage of PYTHON_HOME

2023-11-27 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

Thanks,
Chasel



> -Original Message-
> From: Desimone, Nathaniel L 
> Sent: Friday, November 17, 2023 10:36 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Gao, Liming
> ; Dong, Eric 
> Subject: [edk2-platforms][PATCH v1] MinPlatformPkg: Remove usage of
> PYTHON_HOME
> 
> Removes usage PYTHON_HOME from RebaseFspBinBaseAddress.py
> 
> Cc: Chasel Chiu 
> Cc: Liming Gao 
> Cc: Eric Dong 
> Signed-off-by: Nate DeSimone 
> ---
>  .../MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py   | 8 ++--
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git
> a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
> b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
> index b7e4bcf5f9..32db9eb1c4 100644
> --- a/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
> +++ b/Platform/Intel/MinPlatformPkg/Tools/Fsp/RebaseFspBinBaseAddress.py
> @@ -1,6 +1,6 @@
>  ## @ RebaseFspBinBaseAddress.py
>  #
> -# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
> +# Copyright (c) 2019 - 2023, Intel Corporation. All rights
> +reserved.
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  #
> 
> @@ -65,11 +65,7 @@ file.close()
>  # Get FSP-M Size, in order to calculate the FSP-T Base. Used SplitFspBin.py 
> script
> # to dump the header, and get the ImageSize in FSP-M section  # -pythontool =
> 'python'
> -if 'PYTHON_HOME' in os.environ:
> -pythontool = os.environ['PYTHON_HOME'] + os.sep + 'python'
> -else:
> -pythontool = sys.executable
> +pythontool = sys.executable
>  Process = subprocess.Popen([pythontool, splitFspBinPath, "info","-
> f",fspBinFilePath], stdout=subprocess.PIPE)  Output = Process.communicate()[0]
> FsptInfo = Output.rsplit(b"FSP_M", 1);
> --
> 2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111782): https://edk2.groups.io/g/devel/message/111782
Mute This Topic: https://groups.io/mt/102667304/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH 1/6] RedfishClientPkg/RedfishETagDxe: fix issue and enhancement.

2023-11-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Hi Nickle,
The code change generally looks fine. However, we can improve the debug code 
enablement in the source file. I had created a BZ ticket (Bug #4606 ) for this 
enhancement and assigned it to myself.

For this change,
Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Thursday, November 23, 2023 10:34 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [edk2-redfish-client][PATCH 1/6] RedfishClientPkg/RedfishETagDxe:
> fix issue and enhancement.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> -Fix typo (replace Listheader to ListHeader).
> -Replace "%a," to "%a:".
> -Add more debug message.
> -Remove the exit-boot-service event and use after-provisioning
> event to save ETag data. Variable may not be writable during
> exit-boot-service callback.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  .../RedfishETagDxe/RedfishETagDxe.inf |  5 +-
>  .../RedfishETagDxe/RedfishETagDxe.h   |  4 +-
>  .../RedfishETagDxe/RedfishETagDxe.c   | 84 ++-
>  3 files changed, 50 insertions(+), 43 deletions(-)
>
> diff --git a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf
> b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf
> index 4aecdb41..3626f775 100644
> --- a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf
> +++ b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf
> @@ -1,7 +1,7 @@
>  ## @file
>  #
>  #  (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> -#  Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +#  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -35,6 +35,7 @@
>UefiBootServicesTableLib
>UefiRuntimeServicesTableLib
>UefiDriverEntryPoint
> +  RedfishEventLib
>
>  [Protocols]
>gEdkIIRedfishETagProtocolGuid   ## PRODUCED ##
> @@ -44,4 +45,4 @@
>gEfiRedfishClientVariableGuid   ## CONSUMED ##
>
>  [Depex]
> -  TRUE
> +  gEfiVariableArchProtocolGuid
> diff --git a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.h
> b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.h
> index 3542f289..c8302830 100644
> --- a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.h
> +++ b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.h
> @@ -2,6 +2,7 @@
>Common header file for RedfishETagDxe driver.
>
>(C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
> +  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
>
>SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -25,6 +26,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include 
>
> @@ -49,7 +51,7 @@ typedef struct {
>  // Definition of REDFISH_ETAG_LIST
>  //
>  typedef struct {
> -  LIST_ENTRYListheader;
> +  LIST_ENTRYListHeader;
>UINTN TotalSize;
>UINTN Count;
>  } REDFISH_ETAG_LIST;
> diff --git a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c
> b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c
> index f731d39d..f303604a 100644
> --- a/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c
> +++ b/RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.c
> @@ -124,7 +124,7 @@ AddETagRecord (
>  return EFI_OUT_OF_RESOURCES;
>}
>
> -  InsertTailList (>Listheader, >List);
> +  InsertTailList (>ListHeader, >List);
>++List->Count;
>List->TotalSize += NewRecord->Size;
>
> @@ -225,20 +225,20 @@ DumpETagList (
>  DEBUG ((DEBUG_ERROR, "%s\n", Msg));
>}
>
> -  if (IsListEmpty (>Listheader)) {
> +  if (IsListEmpty (>ListHeader)) {
>  DEBUG ((DEBUG_MANAGEABILITY, "ETag list is empty\n"));
>  return EFI_NOT_FOUND;
>}
>
>DEBUG ((DEBUG_MANAGEABILITY, "Count: %d Total Size: %d\n", ETagList-
> >Count, ETagList->TotalSize));
>Record = NULL;
> -  List   = GetFirstNode (>Listheader);
> -  while (!IsNull (>Listheader, List)) {
> +  List   = GetFirstNode (>ListHeader);
> +  while (!IsNull (>ListHeader, List)) {
>  Record = REDFISH_ETAG_RECORD_FROM_LIST (List);
>
>  DEBUG ((DEBUG_MANAGEABILITY, "ETag: %a Uri: %a Size: %d\n", Record-
> >ETag, Record->Uri, Record->Size));
>
> -List = GetNextNode (>Listheader, List);
> +List = GetNextNode (>ListHeader, List);
>}
>
>return EFI_SUCCESS;
> @@ -304,16 +304,16 @@ ReleaseETagList (
>  return EFI_INVALID_PARAMETER;
>}
>
> -  if (IsListEmpty (>Listheader)) {
> +  if (IsListEmpty (>ListHeader)) {
>  return EFI_SUCCESS;
>}
>
>Record = NULL;
>Next   = NULL;
> -  List   = GetFirstNode (>Listheader);
> -  while (!IsNull (>Listheader, List)) {
> +  List   = GetFirstNode (>ListHeader);
> +  while (!IsNull (>ListHeader, List)) {
>  Record = REDFISH_ETAG_RECORD_FROM_LIST (List);
> -Next   = GetNextNode 

[edk2-devel] [PATCH v2] NetworkPkg: Triger regularly scan only if not connect to AP

2023-11-27 Thread Heng Luo
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4605

When UEFI Wi-Fi is in BSS connected state, the platform is
considered as a static and Wi-Fi roaming support is not needed.
Wifi connection manager should not initiate Scan requests
in this state affect BSS client connectivity and must be avoided.
Triger regularly scan only if not connect to AP.

Signed-off-by: Heng Luo 
Cc: Saloni Kasbekar 
Cc: Zachary Clark-williams 
---
 NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c 
b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c
index d1182e52bd..4c5460b65c 100644
--- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c
+++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c
@@ -1506,8 +1506,8 @@ WifiMgrOnTimerTick (
   }
 
   Nic->ScanTickTime++;
-  if (((Nic->ScanTickTime > WIFI_SCAN_FREQUENCY) || Nic->OneTimeScanRequest) &&
-  (Nic->ScanState == WifiMgrScanFinished))
+  if Nic->ScanTickTime > WIFI_SCAN_FREQUENCY) && (Nic->ConnectState != 
WifiMgrConnectedToAp)) ||
+   Nic->OneTimeScanRequest) && (Nic->ScanState == WifiMgrScanFinished))
   {
 Nic->OneTimeScanRequest = FALSE;
 Nic->ScanTickTime   = 0;
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111780): https://edk2.groups.io/g/devel/message/111780
Mute This Topic: https://groups.io/mt/102844565/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg/ComputerSystemCollectionDxe: handle more scenarios

2023-11-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Thursday, November 23, 2023 10:13 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [edk2-redfish-client][PATCH]
> RedfishClientPkg/ComputerSystemCollectionDxe: handle more scenarios
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> This change defines two more error returns and allow feature driver to
> handle the scenarios while 1) the resource is not owned by feature
> driver. 2) feature driver owns this resource but there is nothing to
> manage on this resource now.
> Detail changes are:
> - Use "%a:" instead of "%a," in debug macro.
> - Add two error return from EdkIIRedfishResourceConfigIdentify().
>   - EFI_UNSUPPORTED: this resource is not owned by feature driver.
>   Caller should ignore this resource.
>   - EFI_NOT_FOUND: this resource is owned by feature driver but
>   there is nothing to handle now. Caller may ignore rest of
>   operations and proceed to next Redfish resource.
> - Add error return from EdkIIRedfishResourceConfigCheck().
>   - EFI_UNSUPPORTED: this resource it not owned by feature driver.
>   Caller should ignore this URI.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  .../Library/EdkIIRedfishResourceConfigLib.h   |  9 ++-
>  .../ComputerSystemCollectionDxe.c | 59 +++
>  2 files changed, 43 insertions(+), 25 deletions(-)
>
> diff --git a/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h
> b/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h
> index a7856033..8999868a 100644
> --- a/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h
> +++ b/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h
> @@ -77,6 +77,8 @@ EdkIIRedfishResourceConfigUpdate (
>@param[in]   Uri The target URI to consume.
>
>@retval EFI_SUCCESS  Value is returned successfully.
> +  @retval EFI_UNSUPPORTED  This resource is not owned by feature
> driver.
> +   Caller should ignore this resource.
>@retval Others   Some error happened.
>
>  **/
> @@ -94,7 +96,12 @@ EdkIIRedfishResourceConfigCheck (
>@param[in]   InformationExchange Pointer to
> RESOURCE_INFORMATION_EXCHANGE.
>
>@retval EFI_SUCCESS  This is target resource which we want to 
> handle.
> -  @retval EFI_UNSUPPORTED  This is not the target resource.
> +  @retval EFI_UNSUPPORTED  This resource is not owned by feature
> driver.
> +   Caller should ignore this resource.
> +  @retval EFI_NOT_FOUNDThis resource is owned by feature driver 
> but
> there
> +   is nothing to handle now. Caller may 
> ignore the
> +   rest of operations like check(), 
> provisioning(),
> +   consume() and update().
>@retval Others   Some error happened.
>
>  **/
> diff --git
> a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste
> mCollectionDxe.c
> b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste
> mCollectionDxe.c
> index 1e362d49..111f8212 100644
> ---
> a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste
> mCollectionDxe.c
> +++
> b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste
> mCollectionDxe.c
> @@ -3,6 +3,7 @@
>Redfish feature driver implementation - ComputerSystemCollection
>
>(C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
> +  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
>
>SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -32,11 +33,11 @@ HandleResource (
>// Resource match
>//
>
> -  DEBUG ((REDFISH_DEBUG_TRACE, "%a, process resource for: %s\n",
> __func__, Uri));
> +  DEBUG ((REDFISH_DEBUG_TRACE, "%a: process resource for: %s\n",
> __func__, Uri));
>
>Status = GetRedfishSchemaInfo (Private->RedfishService, Private-
> >JsonStructProtocol, Uri, );
>if (EFI_ERROR (Status)) {
> -DEBUG ((DEBUG_ERROR, "%a, failed to get schema information from: %s
> %r\n", __func__, Uri, Status));
> +DEBUG ((DEBUG_ERROR, "%a: failed to get schema information from: %s
> %r\n", __func__, Uri, Status));
>  return Status;
>}
>
> @@ -50,15 +51,19 @@ HandleResource (
>  Status = EdkIIRedfishResourceConfigIdentify (, Uri, Private-
> >InformationExchange);
>  if (EFI_ERROR (Status)) {
>if (Status == EFI_UNSUPPORTED) {
> -DEBUG ((DEBUG_MANAGEABILITY, "%a, \"%s\" is not handled by us\n",
> __func__, Uri));
> +DEBUG ((DEBUG_MANAGEABILITY, "%a: \"%s\" is not handled by us\n",
> __func__, Uri));
> +

[edk2-devel] Event: TianoCore Bug Triage - APAC / NAMO - Tuesday, November 28, 2023 #cal-reminder

2023-11-27 Thread Group Notification
*Reminder: TianoCore Bug Triage - APAC / NAMO*

*When:*
Tuesday, November 28, 2023
6:30pm to 7:30pm
(UTC-08:00) America/Los Angeles

*Where:*
https://teams.microsoft.com/l/meetup-join/19%3ameeting_OTk1YzJhN2UtOGQwNi00NjY4LWEwMTktY2JiODRlYTY1NmY0%40thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%226e4ce4c4-1242-431b-9a51-92cd01a5df3c%22%7d

*Organizer:* Liming Gao gaolim...@byosoft.com.cn ( 
gaolim...@byosoft.com.cn?subject=Re:%20Event:%20TianoCore%20Bug%20Triage%20-%20APAC%20%2F%20NAMO
 )

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=2108594 )

*Description:*

TianoCore Bug Triage - APAC / NAMO

Hosted by Liming Gao



Microsoft Teams meeting

*Join on your computer or mobile app*

Click here to join the meeting ( 
https://teams.microsoft.com/l/meetup-join/19%3ameeting_OTk1YzJhN2UtOGQwNi00NjY4LWEwMTktY2JiODRlYTY1NmY0%40thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%226e4ce4c4-1242-431b-9a51-92cd01a5df3c%22%7d
 )

*Join with a video conferencing device*

te...@conf.intel.com

Video Conference ID: 116 062 094 0

Alternate VTC dialing instructions ( 
https://conf.intel.com/teams/?conf=1160620940=teams=conf.intel.com=test_call
 )

*Or call in (audio only)*

+1 916-245-6934,,77463821# ( tel:+19162456934,,77463821# ) United States, 
Sacramento

Phone Conference ID: 774 638 21#

Find a local number ( 
https://dialin.teams.microsoft.com/d195d438-2daa-420e-b9ea-da26f9d1d6d5?id=77463821
 ) | Reset PIN ( https://mysettings.lync.com/pstnconferencing )

Learn More ( https://aka.ms/JoinTeamsMeeting ) | Meeting options ( 
https://teams.microsoft.com/meetingOptions/?organizerId=b286b53a-1218-4db3-bfc9-3d4c5aa7669e=46c98d88-e344-4ed4-8496-4ed7712e255d=19_meeting_OTUyZTg2NjgtNDhlNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh@thread.v2=0=en-US
 )


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111778): https://edk2.groups.io/g/devel/message/111778
Mute This Topic: https://groups.io/mt/102844088/21656
Mute #cal-reminder:https://edk2.groups.io/g/devel/mutehashtag/cal-reminder
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-redfish-client][PATCH 1/1] RedfishClientPkg/RedfishFeatureCoreDxe: fix incorrect URI issue

2023-11-27 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Looks good. Please go ahead to merge it.

Reviewed-by: 

> -Original Message-
> From: Nickle Wang 
> Sent: Tuesday, November 28, 2023 9:16 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> ; Nick Ramirez 
> Subject: [edk2-redfish-client][PATCH 1/1]
> RedfishClientPkg/RedfishFeatureCoreDxe: fix incorrect URI issue
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> -Fix incorrect URI issue. There is missing "/" while
> StartUpFeatureDriver() recursively calls itself.
> -Fix typo.
> -Update function name to follow the naming style.
>
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> Cc: Nick Ramirez 
> ---
>  .../RedfishFeatureCoreDxe.h   |  5 +-
>  .../RedfishFeatureCoreDxe.c   | 51 ++-
>  2 files changed, 31 insertions(+), 25 deletions(-)
>
> diff --git
> a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
> b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
> index 93139af2..acefa41b 100644
> --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
> +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
> @@ -27,8 +27,9 @@
>
>  #define MaxNodeNameLength 64
>  #define MaxParentUriLength512
> -#define NodeSeperator L'/'
> -#define UriSeperator  L';'
> +#define NodeSeparator L'/'
> +#define NodeSeparatorStr  L"/"
> +#define UriSeparator  L';'
>  #define NodeIsCollectionLeftBracket   L'{'
>  #define NodeIsCollectionRightBracket  L'}'
>  #define NodeIsCollectionSymbolL"/{}"
> diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> index e2ae125f..51d0387c 100644
> --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> @@ -20,13 +20,13 @@ RESOURCE_INFORMATION_EXCHANGE
> *mInformationExchange;
>Setup the information to deliver to child feature/collection driver.
>
>@param[in]  ThisList REDFISH_FEATURE_INTERNAL_DATA 
> instance.
> -  @param[in]  ParentConfgLanguageUri   Parent configure language URI.
> +  @param[in]  ParentConfigLanguageUri   Parent configure language URI.
>
>  **/
>  EFI_STATUS
>  SetupExchangeInformationInfo (
>IN REDFISH_FEATURE_INTERNAL_DATA  *ThisList,
> -  IN EFI_STRING ParentConfgLanguageUri
> +  IN EFI_STRING ParentConfigLanguageUri
>)
>  {
>ThisList->InformationExchange->SendInformation.ParentUri =
> (EFI_STRING)AllocateZeroPool (MaxParentUriLength * sizeof (CHAR16));
> @@ -52,7 +52,7 @@ SetupExchangeInformationInfo (
>//
>// Setup parent config language URI
>//
> -  StrCpyS (ThisList->InformationExchange->SendInformation.ParentUri,
> MaxParentUriLength, ParentConfgLanguageUri);
> +  StrCpyS (ThisList->InformationExchange->SendInformation.ParentUri,
> MaxParentUriLength, ParentConfigLanguageUri);
>
>//
>// Full config language URI
> @@ -63,7 +63,7 @@ SetupExchangeInformationInfo (
>  ThisList->InformationExchange->SendInformation.ParentUri
>  );
>if (StrLen (ThisList->InformationExchange->SendInformation.FullUri) != 0) {
> -StrCatS (ThisList->InformationExchange->SendInformation.FullUri,
> MaxParentUriLength, L"/");
> +StrCatS (ThisList->InformationExchange->SendInformation.FullUri,
> MaxParentUriLength, NodeSeparatorStr);
>}
>
>StrCatS (ThisList->InformationExchange->SendInformation.FullUri,
> MaxParentUriLength, ThisList->InformationExchange-
> >SendInformation.PropertyName);
> @@ -77,7 +77,7 @@ SetupExchangeInformationInfo (
>
>  **/
>  EFI_STATUS
> -DestroryExchangeInformation (
> +DestroyExchangeInformation (
>IN REDFISH_FEATURE_INTERNAL_DATA  *ThisList
>)
>  {
> @@ -111,7 +111,7 @@ DestroryExchangeInformation (
>  }
>
>  /**
> -  Startup child feature drivers and it's sibing feature drivers.
> +  Startup child feature drivers and it's sibling feature drivers.
>
>@param[in]  ThisFeatureDriverListThis feature driver list.
>@param[in]  CurrentConfigLanguageUri The current parent configure
> language URI.
> @@ -121,7 +121,7 @@ DestroryExchangeInformation (
>  VOID
>  StartUpFeatureDriver (
>IN REDFISH_FEATURE_INTERNAL_DATA*ThisFeatureDriverList,
> -  IN EFI_STRING   CurrentConfigLanguageUri,
> +  IN EFI_STRING   CurrentConfigLanguageUri OPTIONAL,
>IN REDFISH_FEATURE_STARTUP_CONTEXT  *StartupContext
>)
>  {
> @@ -131,6 +131,10 @@ StartUpFeatureDriver (
>REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
>EFI_STRING   NextParentUri;
>
> +  if ((ThisFeatureDriverList == NULL) || 

Re: [edk2-devel] [PATCH v1 1/1] .git-blame-ignore-revs: Ignore recent uncrustify commits

2023-11-27 Thread Michael D Kinney
Reviewed-by: Michael D Kinney 

> -Original Message-
> From: mikub...@linux.microsoft.com 
> Sent: Monday, November 27, 2023 4:17 PM
> To: devel@edk2.groups.io
> Cc: Andrew Fish ; Leif Lindholm
> ; Kinney, Michael D
> ; Rebecca Cran 
> Subject: [PATCH v1 1/1] .git-blame-ignore-revs: Ignore recent uncrustify
> commits
> 
> From: Michael Kubacki 
> 
> Includes two recent Uncrustify formatting commits to prevent them
> from showing in git blame.
> 
> Cc: Andrew Fish 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> Cc: Rebecca Cran 
> Signed-off-by: Michael Kubacki 
> ---
>  .git-blame-ignore-revs | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
> index b426add80cff..a39655ed1770 100644
> --- a/.git-blame-ignore-revs
> +++ b/.git-blame-ignore-revs
> @@ -50,3 +50,7 @@ e7108d0e9655b1795c94ac372b0449f28dd907df
>  40b0b23ed34f48c26d711d3e4613a4bb35eeadff
>  # ArmPkg: Apply uncrustify changes
>  429309e0c6b74792d679681a8edd0d5ae0ff850c
> +# EmulatorPkg: Format with Uncrustify 73.0.8
> +972e3b0b9d67ef2847c9c1c89e606e6074a7ddda
> +# OvmfPkg: Format with Uncrustify 73.0.8
> +0e9ce9146a6dc50a35488e3a4a7a2a4bbaf1eb1c
> --
> 2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111776): https://edk2.groups.io/g/devel/message/111776
Mute This Topic: https://groups.io/mt/102842040/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 
https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-redfish-client][PATCH 1/1] RedfishClientPkg/RedfishFeatureCoreDxe: fix incorrect URI issue

2023-11-27 Thread Nickle Wang via groups.io
-Fix incorrect URI issue. There is missing "/" while
StartUpFeatureDriver() recursively calls itself.
-Fix typo.
-Update function name to follow the naming style.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
Cc: Nick Ramirez 
---
 .../RedfishFeatureCoreDxe.h   |  5 +-
 .../RedfishFeatureCoreDxe.c   | 51 ++-
 2 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h 
b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
index 93139af2..acefa41b 100644
--- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
+++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h
@@ -27,8 +27,9 @@
 
 #define MaxNodeNameLength 64
 #define MaxParentUriLength512
-#define NodeSeperator L'/'
-#define UriSeperator  L';'
+#define NodeSeparator L'/'
+#define NodeSeparatorStr  L"/"
+#define UriSeparator  L';'
 #define NodeIsCollectionLeftBracket   L'{'
 #define NodeIsCollectionRightBracket  L'}'
 #define NodeIsCollectionSymbolL"/{}"
diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c 
b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
index e2ae125f..51d0387c 100644
--- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
+++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
@@ -20,13 +20,13 @@ RESOURCE_INFORMATION_EXCHANGE*mInformationExchange;
   Setup the information to deliver to child feature/collection driver.
 
   @param[in]  ThisList REDFISH_FEATURE_INTERNAL_DATA instance.
-  @param[in]  ParentConfgLanguageUri   Parent configure language URI.
+  @param[in]  ParentConfigLanguageUri   Parent configure language URI.
 
 **/
 EFI_STATUS
 SetupExchangeInformationInfo (
   IN REDFISH_FEATURE_INTERNAL_DATA  *ThisList,
-  IN EFI_STRING ParentConfgLanguageUri
+  IN EFI_STRING ParentConfigLanguageUri
   )
 {
   ThisList->InformationExchange->SendInformation.ParentUri = 
(EFI_STRING)AllocateZeroPool (MaxParentUriLength * sizeof (CHAR16));
@@ -52,7 +52,7 @@ SetupExchangeInformationInfo (
   //
   // Setup parent config language URI
   //
-  StrCpyS (ThisList->InformationExchange->SendInformation.ParentUri, 
MaxParentUriLength, ParentConfgLanguageUri);
+  StrCpyS (ThisList->InformationExchange->SendInformation.ParentUri, 
MaxParentUriLength, ParentConfigLanguageUri);
 
   //
   // Full config language URI
@@ -63,7 +63,7 @@ SetupExchangeInformationInfo (
 ThisList->InformationExchange->SendInformation.ParentUri
 );
   if (StrLen (ThisList->InformationExchange->SendInformation.FullUri) != 0) {
-StrCatS (ThisList->InformationExchange->SendInformation.FullUri, 
MaxParentUriLength, L"/");
+StrCatS (ThisList->InformationExchange->SendInformation.FullUri, 
MaxParentUriLength, NodeSeparatorStr);
   }
 
   StrCatS (ThisList->InformationExchange->SendInformation.FullUri, 
MaxParentUriLength, 
ThisList->InformationExchange->SendInformation.PropertyName);
@@ -77,7 +77,7 @@ SetupExchangeInformationInfo (
 
 **/
 EFI_STATUS
-DestroryExchangeInformation (
+DestroyExchangeInformation (
   IN REDFISH_FEATURE_INTERNAL_DATA  *ThisList
   )
 {
@@ -111,7 +111,7 @@ DestroryExchangeInformation (
 }
 
 /**
-  Startup child feature drivers and it's sibing feature drivers.
+  Startup child feature drivers and it's sibling feature drivers.
 
   @param[in]  ThisFeatureDriverListThis feature driver list.
   @param[in]  CurrentConfigLanguageUri The current parent configure language 
URI.
@@ -121,7 +121,7 @@ DestroryExchangeInformation (
 VOID
 StartUpFeatureDriver (
   IN REDFISH_FEATURE_INTERNAL_DATA*ThisFeatureDriverList,
-  IN EFI_STRING   CurrentConfigLanguageUri,
+  IN EFI_STRING   CurrentConfigLanguageUri OPTIONAL,
   IN REDFISH_FEATURE_STARTUP_CONTEXT  *StartupContext
   )
 {
@@ -131,6 +131,10 @@ StartUpFeatureDriver (
   REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST  ConfigLangList;
   EFI_STRING   NextParentUri;
 
+  if ((ThisFeatureDriverList == NULL) || (StartupContext == NULL)) {
+return;
+  }
+
   NextParentUri = (EFI_STRING)AllocateZeroPool (MaxParentUriLength * sizeof 
(CHAR16));
   if (NextParentUri == NULL) {
 DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for parent configure 
language.\n", __func__));
@@ -174,7 +178,7 @@ StartUpFeatureDriver (
   // Copy RESOURCE_INFORMATION_RETURNED then destroy the exchange 
information.
   //
   CopyConfiglanguageList 
(>InformationExchange->ReturnedInformation.ConfigureLanguageList, 
);
-  DestroryExchangeInformation (ThisList);
+  DestroyExchangeInformation (ThisList);
   //
   // Modify the collection instance according to the returned 

[edk2-devel] [edk2-platforms][PATCH v1] PurleyOpenBoardPkg/BoardMtOlympus: Fix Build

2023-11-27 Thread Nate DeSimone
Updates Microcode and Silicon FV sizes so
they can accomodate the newest content.

Cc: Chasel Chiu 
Signed-off-by: Nate DeSimone 
---
 .../BoardMtOlympus/OpenBoardPkg.fdf   | 25 +++
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf 
b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf
index 413d98a070..86d1673458 100644
--- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf
+++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.fdf
@@ -1,7 +1,7 @@
 ## @file
 #  FDF file for the MtOlympus board.
 #
-# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2018 - 2023, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -43,11 +43,11 @@ FV = FvOsBoot
 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspUSize
 FV = FvLateSiliconCompressed
 
-0x0090|0x0040
+0x0090|0x0030
 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize
 FV = FvUefiBoot
 
-0x00D0|0x0007C000
+0x00C0|0x0007C000
 
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
 #NV_VARIABLE_STORE
 DATA = {
@@ -86,10 +86,10 @@ DATA = {
   0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 }
 
-0x00D7C000|0x2000
+0x00C7C000|0x2000
 #NV_EVENT_LOG
 
-0x00D7E000|0x2000
+0x00C7E000|0x2000
 
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
 #NV_FTW_WORKING
 DATA = {
@@ -103,28 +103,28 @@ DATA = {
   0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 }
 
-0x00D8|0x0008
+0x00C8|0x0008
 
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
 #NV_FTW_SPARE
 
 
-0x00E0|0x0001
+0x00D0|0x0003
 
gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase|gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeSize
 FV = MICROCODE_FV
 
-0x00E1|0x0001
+0x00D3|0x0001
 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize
 FV = FvPostMemory
 
-0x00E2|0x0003
+0x00D4|0x0002
 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize
 FILE = 
$(PLATFORM_SI_BIN_PACKAGE)/FV/FvPostMemorySilicon/$(TARGET)/FvPostMemorySilicon.Fv
 
-0x00E5|0x0006
+0x00D6|0x0005
 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize
 FV = FvPreMemory
 
-0x00EB|0x0013
+0x00DB|0x0023
 
gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase|gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize
 FILE = 
$(PLATFORM_SI_BIN_PACKAGE)/FV/FvPreMemorySilicon/$(TARGET)/FvPreMemorySilicon.Fv
 
@@ -135,6 +135,9 @@ FILE = 
$(PLATFORM_SI_BIN_PACKAGE)/FV/FvTempMemorySilicon/$(TARGET)/FvTempMemoryS
 SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeBase= 
gEfiPchTokenSpaceGuid.PcdFlashAreaBaseAddress + 
gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase
 SET gMinPlatformPkgTokenSpaceGuid.PcdFlashFvMicrocodeSize= 
gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeSize
 
+SET gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase   = 
gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase
+SET gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize   = 
gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeSize
+
 SET gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchAddress= 
gEfiPchTokenSpaceGuid.PcdFlashAreaBaseAddress + 
gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeBase + 0x60
 SET gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize = 
gCpuUncoreTokenSpaceGuid.PcdFlashNvStorageMicrocodeSize - 0x60
 
-- 
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111772): https://edk2.groups.io/g/devel/message/111772
Mute This Topic: https://groups.io/mt/102842750/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms][PATCH v1] MinPlatformPkg: Add edk2-platforms/Features to PACKAGES_PATH

2023-11-27 Thread Nate DeSimone
Cc: Chasel Chiu 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Nate DeSimone 
---
 Platform/Intel/build.cfg |  5 +++--
 Platform/Intel/build_bios.py | 11 +++
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/Platform/Intel/build.cfg b/Platform/Intel/build.cfg
index 2ff536bb3e..6ab2ced1a5 100644
--- a/Platform/Intel/build.cfg
+++ b/Platform/Intel/build.cfg
@@ -1,7 +1,7 @@
 # @ build.cfg
 # This is the main/default build configuration file
 #
-# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2023, Intel Corporation. All rights reserved.
 # Copyright (c) 2021 - 2022, American Megatrends International LLC.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -13,7 +13,8 @@ WORKSPACE_FSP_BIN = FSP
 EDK_TOOLS_BIN = edk2-BaseTools-win32
 EDK_BASETOOLS = BaseTools
 WORKSPACE_DRIVERS = edk2-platforms/Drivers
-WORKSPACE_FEATURES = edk2-platforms/Features/Intel
+WORKSPACE_FEATURES = edk2-platforms/Features
+WORKSPACE_FEATURES_INTEL = edk2-platforms/Features/Intel
 WORKSPACE_PLATFORM = edk2-platforms/Platform/Intel
 WORKSPACE_SILICON = edk2-platforms/Silicon/Intel
 WORKSPACE_PLATFORM_BIN =
diff --git a/Platform/Intel/build_bios.py b/Platform/Intel/build_bios.py
index 43a241c837..c79a653f4d 100755
--- a/Platform/Intel/build_bios.py
+++ b/Platform/Intel/build_bios.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python3
 #
 # @ build_bios.py
 # Builds BIOS using configuration files and dynamically
@@ -109,6 +109,8 @@ def pre_build(build_config, build_type="DEBUG", 
silent=False, toolchain=None):
config["WORKSPACE_SILICON"])
 config["WORKSPACE_FEATURES"] = os.path.join(config["WORKSPACE"],
config["WORKSPACE_FEATURES"])
+config["WORKSPACE_FEATURES_INTEL"] = os.path.join(config["WORKSPACE"],
+config["WORKSPACE_FEATURES_INTEL"])
 config["WORKSPACE_DRIVERS"] = os.path.join(config["WORKSPACE"],
config["WORKSPACE_DRIVERS"])
 config["WORKSPACE_PLATFORM_BIN"] = \
@@ -123,9 +125,10 @@ def pre_build(build_config, build_type="DEBUG", 
silent=False, toolchain=None):
 config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_SILICON"]
 config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_SILICON_BIN"]
 config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_FEATURES"]
-# add all feature domains in WORKSPACE_FEATURES to package path
-for filename in os.listdir(config["WORKSPACE_FEATURES"]):
-filepath = os.path.join(config["WORKSPACE_FEATURES"], filename)
+config["PACKAGES_PATH"] += os.pathsep + config["WORKSPACE_FEATURES_INTEL"]
+# add all feature domains in WORKSPACE_FEATURES_INTEL to package path
+for filename in os.listdir(config["WORKSPACE_FEATURES_INTEL"]):
+filepath = os.path.join(config["WORKSPACE_FEATURES_INTEL"], filename)
 # feature domains folder does not contain dec file
 if os.path.isdir(filepath) and \
   not glob.glob(os.path.join(filepath, "*.dec")):
-- 
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111771): https://edk2.groups.io/g/devel/message/111771
Mute This Topic: https://groups.io/mt/102842749/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-platforms][PATCH v1] MinPlatformPkg: Update PatchFv Tools for Python 3.x

2023-11-27 Thread Nate DeSimone
PatchFv tools now run on Python 3.x

Cc: Chasel Chiu 
Cc: Liming Gao 
Cc: Eric Dong 
Signed-off-by: Nate DeSimone 
---
 .../MinPlatformPkg/Tools/PatchFv/PatchBfv.py  | 35 
 .../Tools/PatchFv/PatchBinFv.py   | 69 
 .../Tools/PatchFv/RebaseBinFv.py  | 82 +--
 3 files changed, 92 insertions(+), 94 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py 
b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py
index 1312bfc328..f05480b91f 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBfv.py
@@ -1,6 +1,6 @@
 ## @ PatchBfv.py
 #
-# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2017 - 2023, Intel Corporation. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -11,8 +11,7 @@ import sys
 import time
 import shutil
 import struct
-import binascii
-from   ctypes import *
+from ctypes import *
 
 class FileChecker:
 def __init__(self):
@@ -21,17 +20,17 @@ class FileChecker:
 self.pcd = ["", "", ""]
 
 def PrintPcd(self):
-print "PCD: " + self.pcd[0] + "|" + self.pcd[1] + "(" + self.pcd[2] + 
")"
+print("PCD: {0}|{1}({2})".format(*(self.pcd)))
 
 def ProcessReport(self):
 try :
 file = open(self.reportFile)
 except Exception:
-print "fail to open " + self.reportFile
+print("fail to open " + self.reportFile)
 return
 try:
 file.seek(0)
-print "checking - " + self.pcd[0]
+print("checking - " + self.pcd[0])
 ValuePair = self.GetPcdFromReport (file, self.pcd[0])
 self.pcd[1] = ValuePair[0]
 self.pcd[2] = ValuePair[1]
@@ -42,12 +41,12 @@ class FileChecker:
 
 def PatchFd(self):
 fileName = self.fdName
-print "patching BFV - " + fileName
+print("patching BFV - " + fileName)
 
 try :
 file = open(fileName, "rb")
 except Exception:
-print "fail to open " + fileName
+print("fail to open " + fileName)
 return
 try:
 buffer = file.read()
@@ -57,7 +56,7 @@ class FileChecker:
 offset = -4
 
 l = struct.pack("L", int(self.pcd[1],16))
-print "  [" + hex(offset) + "] " + binascii.hexlify(data[-4:]) + " 
<= " + binascii.hexlify(l)
+print("  [" + hex(offset) + "] " + bytes(data[-4:]).hex() + " <= " 
+ bytes(l).hex())
 data[-4:] = l
 
 file = open(fileName, "wb")
@@ -77,36 +76,36 @@ class FileChecker:
 
 newline = line[:-1]
 
-if (cmp (newline, TargetPkg) == 0):
+if newline == TargetPkg:
 FoundPkg = True
 continue
 
-if (cmp (newline, "") == 0) or ((cmp (newline[0], " ") != 0) and 
(cmp (newline[0], "0") != 0)):
+if newline == "" or (newline[0] != " " and newline[0] != "0"):
 FoundPkg = False
 
 if (FoundPkg == True) :
 newline = newline.strip()
 splitLine = newline.split(" ", 2)
-if (cmp (splitLine[0], "*F") == 0) or (cmp (splitLine[0], 
"*P") == 0) :
-if (cmp (splitLine[1], TargetPcd) == 0):
-print "found - " + TargetPkg + "." + TargetPcd
+if splitLine[0] == "*F" or splitLine[0] == "*P":
+if splitLine[1] == TargetPcd:
+print("found - " + TargetPkg + "." + TargetPcd)
 
 splitLine = splitLine[2].strip()[1:].strip().split(" 
", 1)
-if (cmp (splitLine[0], "FIXED") == 0) or (cmp 
(splitLine[0], "PATCH") == 0):
+if splitLine[0] == "FIXED" or splitLine[0] == "PATCH":
 SplitLine = splitLine[1].strip()[1:].split(")", 1)
 Type = SplitLine[0]
 Value = SplitLine[1].strip()[1:].strip().split()[0]
-print "  Type - (" + Type + "), Value - (" + Value 
+ ")"
+print("  Type - (" + Type + "), Value - (" + Value 
+ ")")
 return [Value, Type]
 return ["", ""]
-
+
 def main():
 global FileChecker
 
 fileChecker = FileChecker()
 
 if (len(sys.argv) != 4) :
-print "usage: PatchBfv   "
+print("usage: PatchBfv   ")
 return 0
 
 fileChecker.fdName = sys.argv[1]
diff --git a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBinFv.py 
b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBinFv.py
index b98c951b45..78576a3029 100644
--- a/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBinFv.py
+++ b/Platform/Intel/MinPlatformPkg/Tools/PatchFv/PatchBinFv.py
@@ -1,6 +1,6 @@
 ## @ PatchBinFv.py
 #
-# Copyright (c) 2017 - 2019, 

[edk2-devel] [edk2-platforms][PATCH v1] PurleyOpenBoardPkg: Fix Build

2023-11-27 Thread Nate DeSimone
Adds SmmLockBox driver which is needed to
build with the newest version of MinPlatformPkg

Cc: Chasel Chiu 
Signed-off-by: Nate DeSimone 
---
 .../Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc   | 3 ++-
 .../Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc 
b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc
index 39c5cf78ab..65f22bb90e 100644
--- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc
+++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the MtOlympus board.
 #
-# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.
+# Copyright (c) 2018 - 2023, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -195,6 +195,7 @@
   $(PLATFORM_PACKAGE)/PlatformInit/PlatformInitSmm/PlatformInitSmm.inf
 
   $(PLATFORM_BOARD_PACKAGE)/Policy/S3NvramSave/S3NvramSave.inf
+  MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf
 
   #
   # Shell
diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc 
b/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc
index 5747717ecb..64e8978942 100644
--- a/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc
+++ b/Platform/Intel/PurleyOpenBoardPkg/BoardTiogaPass/OpenBoardPkg.dsc
@@ -1,7 +1,7 @@
 ## @file
 #  The main build description file for the TiogaPass board.
 #
-# Copyright (c) 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2018 - 2023, Intel Corporation. All rights reserved.
 # Copyright (c) 2021, American Megatrends International LLC.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -226,6 +226,7 @@
 
   $(PLATFORM_BOARD_PACKAGE)/Policy/S3NvramSave/S3NvramSave.inf
   BoardModulePkg/BoardBdsHookDxe/BoardBdsHookDxe.inf
+  MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf
 
   #
   # Shell
-- 
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111774): https://edk2.groups.io/g/devel/message/111774
Mute This Topic: https://groups.io/mt/102842752/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] Now: Tools, CI, Code base construction meeting series - Monday, November 27, 2023 #cal-notice

2023-11-27 Thread Group Notification
*Tools, CI, Code base construction meeting series*

*When:*
Monday, November 27, 2023
4:30pm to 5:30pm
(UTC-08:00) America/Los Angeles

*Where:*
https://teams.microsoft.com/l/meetup-join/19%3ameeting_ZDI2ZDg4NmMtMjI1My00MzI5LWFmYjAtMGQyNjUzNTBjZGYw%40thread.v2/0?context=%7b%22Tid%22%3a%2272f988bf-86f1-41af-91ab-2d7cd011db47%22%2c%22Oid%22%3a%2223af6561-6e1c-450d-b917-d9d674eb3cb6%22%7d

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=2108597 )

*Description:*

TianoCore community,

Microsoft and Intel will be hosting a series of open meetings to discuss build, 
CI, tools, and other related topics. If you are interested, have ideas/opinions 
please join us. These meetings will be Monday 4:30pm Pacific Time on Microsoft 
Teams.

MS Teams Link in following discussion: * 
https://github.com/tianocore/edk2/discussions/2614

Anyone is welcome to join.

* tianocore/edk2: EDK II (github.com)
* tianocore/edk2-basetools: EDK II BaseTools Python tools as a PIP module 
(github.com) https://github.com/tianocore/edk2-basetools
* tianocore/edk2-pytool-extensions: Extensions to the edk2 build system 
allowing for a more robust and plugin based build system and tool execution 
environment (github.com) https://github.com/tianocore/edk2-pytool-extensions
* tianocore/edk2-pytool-library: Python library package that supports UEFI 
development (github.com) https://github.com/tianocore/edk2-pytool-library

MS Teams Browser Clients * 
https://docs.microsoft.com/en-us/microsoftteams/get-clients?tabs=Windows#browser-client


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111770): https://edk2.groups.io/g/devel/message/111770
Mute This Topic: https://groups.io/mt/102842234/21656
Mute #cal-notice:https://edk2.groups.io/g/devel/mutehashtag/cal-notice
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 1/1] .git-blame-ignore-revs: Ignore recent uncrustify commits

2023-11-27 Thread Michael Kubacki
From: Michael Kubacki 

Includes two recent Uncrustify formatting commits to prevent them
from showing in git blame.

Cc: Andrew Fish 
Cc: Leif Lindholm 
Cc: Michael D Kinney 
Cc: Rebecca Cran 
Signed-off-by: Michael Kubacki 
---
 .git-blame-ignore-revs | 4 
 1 file changed, 4 insertions(+)

diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index b426add80cff..a39655ed1770 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -50,3 +50,7 @@ e7108d0e9655b1795c94ac372b0449f28dd907df
 40b0b23ed34f48c26d711d3e4613a4bb35eeadff
 # ArmPkg: Apply uncrustify changes
 429309e0c6b74792d679681a8edd0d5ae0ff850c
+# EmulatorPkg: Format with Uncrustify 73.0.8
+972e3b0b9d67ef2847c9c1c89e606e6074a7ddda
+# OvmfPkg: Format with Uncrustify 73.0.8
+0e9ce9146a6dc50a35488e3a4a7a2a4bbaf1eb1c
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111769): https://edk2.groups.io/g/devel/message/111769
Mute This Topic: https://groups.io/mt/102842040/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 1/2] ArmPkg/Drivers/CpuDxe: Explicitly cast table entry

2023-11-27 Thread Michael Kubacki
From: Michael Kubacki 

GetNextEntryAttribute() assigns a 64-bit integer to 32-bit integers.

This change explicitly casts the assigned value as UINT32 to prevent
the following Visual Studio compiler warning:

  '=': conversion from 'UINT64' to 'UINT32', possible loss of data

Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Sami Mujawar 
Signed-off-by: Michael Kubacki 
---
 ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c 
b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
index e14eb47ce4c6..4555fdb5c2c8 100644
--- a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
+++ b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
@@ -195,8 +195,8 @@ GetNextEntryAttribute (
   // the subsequent ones should be filled up
   for (Index = 0; Index < EntryCount; Index++) {
 Entry  = TableAddress[Index];
-EntryType  = Entry & TT_TYPE_MASK;
-EntryAttribute = Entry & TT_ATTRIBUTES_MASK;
+EntryType  = (UINT32)(Entry & TT_TYPE_MASK);
+EntryAttribute = (UINT32)(Entry & TT_ATTRIBUTES_MASK);
 
 // If Entry is a Table Descriptor type entry then go through the sub-level 
table
 if ((EntryType == TT_TYPE_BLOCK_ENTRY) ||
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111767): https://edk2.groups.io/g/devel/message/111767
Mute This Topic: https://groups.io/mt/102842002/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 2/2] ArmPkg/Drivers/CpuDxe: Use lower and upper attributes

2023-11-27 Thread Michael Kubacki
From: Michael Kubacki 

GetNextEntryAttribute() is currently applying a 64-bit mask
(TT_ATTRIBUTES_MASK) to a 32-bit descriptor value (EntryType).
The original descriptor was 64 bits containing the upper and
lower attributes which are included in TT_ATTRIBUTES_MASK.

The PrevEntryAttribute parameter is also a UINT32, but passed to
PageAttributeToGcdAttribute() for a UINT64 parameter where the
function checks masks in the upper 32 bits of the integer value:

  PageAttributeToGcdAttribute (*PrevEntryAttribute)
  ...
  STATIC
  UINT64
  PageAttributeToGcdAttribute (
IN UINT64  PageAttributes
)
  ...
  if ((PageAttributes & (TT_PXN_MASK | TT_UXN_MASK)) != 0) {
GcdAttributes |= EFI_MEMORY_XP;
  }
  ...
  #define TT_PXN_MASK  BIT53
  #define TT_UXN_MASK  BIT54  // EL1&0

This change removes UINT32 intermediary values. For EntryType,
eliminating an unncessary cast. For EntryAttribute, preserving the
upper and lower attributes for evaluation in
PageAttributeToGcdAttribute().

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Sami Mujawar 
Signed-off-by: Michael Kubacki 
---
 ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c 
b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
index 4555fdb5c2c8..ff14c2f814b2 100644
--- a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
+++ b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
@@ -13,7 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include "CpuDxe.h"
 
-#define INVALID_ENTRY  ((UINT32)~0)
+#define INVALID_ENTRY  ((UINT64)~0)
 
 #define MIN_T0SZ16
 #define BITS_PER_LEVEL  9
@@ -169,14 +169,14 @@ GetNextEntryAttribute (
   IN UINTN   EntryCount,
   IN UINTN   TableLevel,
   IN UINT64  BaseAddress,
-  IN OUT UINT32  *PrevEntryAttribute,
+  IN OUT UINT64  *PrevEntryAttribute,
   IN OUT UINT64  *StartGcdRegion
   )
 {
   UINTNIndex;
   UINT64   Entry;
-  UINT32   EntryAttribute;
-  UINT32   EntryType;
+  UINT64   EntryAttribute;
+  UINT64   EntryType;
   EFI_STATUS   Status;
   UINTNNumberOfDescriptors;
   EFI_GCD_MEMORY_SPACE_DESCRIPTOR  *MemorySpaceMap;
@@ -195,8 +195,8 @@ GetNextEntryAttribute (
   // the subsequent ones should be filled up
   for (Index = 0; Index < EntryCount; Index++) {
 Entry  = TableAddress[Index];
-EntryType  = (UINT32)(Entry & TT_TYPE_MASK);
-EntryAttribute = (UINT32)(Entry & TT_ATTRIBUTES_MASK);
+EntryType  = Entry & TT_TYPE_MASK;
+EntryAttribute = Entry & TT_ATTRIBUTES_MASK;
 
 // If Entry is a Table Descriptor type entry then go through the sub-level 
table
 if ((EntryType == TT_TYPE_BLOCK_ENTRY) ||
@@ -271,7 +271,7 @@ SyncCacheConfig (
   )
 {
   EFI_STATUS   Status;
-  UINT32   PageAttribute;
+  UINT64   PageAttribute;
   UINT64   *FirstLevelTableAddress;
   UINTNTableLevel;
   UINTNTableCount;
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111768): https://edk2.groups.io/g/devel/message/111768
Mute This Topic: https://groups.io/mt/102842005/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 0/2] ArmPkg/CpuDxe: Use upper and lower attributes

2023-11-27 Thread Michael Kubacki
From: Michael Kubacki 

This series contains two changes:

1. To fix a compiler warning with the current state of code.
2. To update the code to pass the integer width needed for a
   comparison to set EFI_MEMORY_XP in the GCD attribute returned
   for a given page attribute.

Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Sami Mujawar 

Michael Kubacki (2):
  ArmPkg/Drivers/CpuDxe: Explicitly cast table entry
  ArmPkg/Drivers/CpuDxe: Use lower and upper attributes

 ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111766): https://edk2.groups.io/g/devel/message/111766
Mute This Topic: https://groups.io/mt/102841999/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v1 1/1] ArmPkg/ArmMmuLib: Use function pointer type

2023-11-27 Thread Michael Kubacki
From: Michael Kubacki 

mReplaceLiveEntryFunc is a function pointer but assigned as a VOID*
pointer:

  mReplaceLiveEntryFunc = *(VOID **)GET_GUID_HOB_DATA (Hob);

This leads to the Visual Studio warning:

  nonstandard extension, function/data pointer conversion in
  expression

This change updates the assignment to avoid using a data pointer and
defines a type for the function pointer to succinctly and accurately
refer to the type when it is used in the library code.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Sami Mujawar 
Signed-off-by: Michael Kubacki 
---
 ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c   | 13 +++
 ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c |  7 +++---
 ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf |  2 ++
 ArmPkg/Library/ArmMmuLib/ArmMmuLibInternal.h   | 23 

 ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf  |  1 +
 5 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c 
b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
index 1e57e589977e..9d9c623581fe 100644
--- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
+++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c
@@ -20,16 +20,9 @@
 #include 
 #include 
 #include 
+#include "ArmMmuLibInternal.h"
 
-STATIC
-VOID (
-  EFIAPI  *mReplaceLiveEntryFunc
-  )(
-IN  UINT64  *Entry,
-IN  UINT64  Value,
-IN  UINT64  RegionStart,
-IN  BOOLEAN DisableMmu
-) = ArmReplaceLiveTranslationEntry;
+STATIC  ARM_REPLACE_LIVE_TRANSLATION_ENTRY  mReplaceLiveEntryFunc = 
ArmReplaceLiveTranslationEntry;
 
 STATIC
 UINT64
@@ -742,7 +735,7 @@ ArmMmuBaseLibConstructor (
 
   Hob = GetFirstGuidHob ();
   if (Hob != NULL) {
-mReplaceLiveEntryFunc = *(VOID **)GET_GUID_HOB_DATA (Hob);
+mReplaceLiveEntryFunc = *(ARM_REPLACE_LIVE_TRANSLATION_ENTRY 
*)GET_GUID_HOB_DATA (Hob);
   } else {
 //
 // The ArmReplaceLiveTranslationEntry () helper function may be invoked
diff --git a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c 
b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c
index 5f50a605a338..a0c9facdea64 100644
--- a/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c
+++ b/ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuPeiLibConstructor.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include "ArmMmuLibInternal.h"
 
 EFI_STATUS
 EFIAPI
@@ -21,9 +22,9 @@ ArmMmuPeiLibConstructor (
   IN CONST EFI_PEI_SERVICES **PeiServices
   )
 {
-  extern UINT32  ArmReplaceLiveTranslationEntrySize;
-  VOID   *ArmReplaceLiveTranslationEntryFunc;
-  VOID   *Hob;
+  extern UINT32   ArmReplaceLiveTranslationEntrySize;
+  ARM_REPLACE_LIVE_TRANSLATION_ENTRY  ArmReplaceLiveTranslationEntryFunc;
+  VOID*Hob;
 
   EFI_FV_FILE_INFO  FileInfo;
   EFI_STATUSStatus;
diff --git a/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf 
b/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
index 57cb71f90ee3..510511bd414f 100644
--- a/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+++ b/ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
@@ -19,10 +19,12 @@ [Defines.AARCH64]
   CONSTRUCTOR= ArmMmuBaseLibConstructor
 
 [Sources.AARCH64]
+  ArmMmuLibInternal.h
   AArch64/ArmMmuLibCore.c
   AArch64/ArmMmuLibReplaceEntry.S
 
 [Sources.ARM]
+  ArmMmuLibInternal.h
   Arm/ArmMmuLibConvert.c
   Arm/ArmMmuLibCore.c
   Arm/ArmMmuLibUpdate.c
diff --git a/ArmPkg/Library/ArmMmuLib/ArmMmuLibInternal.h 
b/ArmPkg/Library/ArmMmuLib/ArmMmuLibInternal.h
new file mode 100644
index ..8d3bec525d8e
--- /dev/null
+++ b/ArmPkg/Library/ArmMmuLib/ArmMmuLibInternal.h
@@ -0,0 +1,23 @@
+/** @file
+  Arm MMU library instance internal header file.
+
+  Copyright (C) Microsoft Corporation. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef ARM_MMU_LIB_INTERNAL_H_
+#define ARM_MMU_LIB_INTERNAL_H_
+
+typedef
+VOID(
+ EFIAPI  *ARM_REPLACE_LIVE_TRANSLATION_ENTRY
+ )(
+  IN  UINT64  *Entry,
+  IN  UINT64  Value,
+  IN  UINT64  RegionStart,
+  IN  BOOLEAN DisableMmu
+  );
+
+#endif
diff --git a/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf 
b/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
index 02f874a1a994..37424628aa07 100644
--- a/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
+++ b/ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf
@@ -17,6 +17,7 @@ [Defines]
   CONSTRUCTOR= ArmMmuPeiLibConstructor
 
 [Sources.AARCH64]
+  ArmMmuLibInternal.h
   AArch64/ArmMmuLibCore.c
   AArch64/ArmMmuPeiLibConstructor.c
   AArch64/ArmMmuLibReplaceEntry.S
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111765): https://edk2.groups.io/g/devel/message/111765
Mute This Topic: https://groups.io/mt/102841630/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]

[edk2-devel] Event: Tools, CI, Code base construction meeting series - Monday, November 27, 2023 #cal-reminder

2023-11-27 Thread Group Notification
*Reminder: Tools, CI, Code base construction meeting series*

*When:*
Monday, November 27, 2023
4:30pm to 5:30pm
(UTC-08:00) America/Los Angeles

*Where:*
https://teams.microsoft.com/l/meetup-join/19%3ameeting_ZDI2ZDg4NmMtMjI1My00MzI5LWFmYjAtMGQyNjUzNTBjZGYw%40thread.v2/0?context=%7b%22Tid%22%3a%2272f988bf-86f1-41af-91ab-2d7cd011db47%22%2c%22Oid%22%3a%2223af6561-6e1c-450d-b917-d9d674eb3cb6%22%7d

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=2108597 )

*Description:*

TianoCore community,

Microsoft and Intel will be hosting a series of open meetings to discuss build, 
CI, tools, and other related topics. If you are interested, have ideas/opinions 
please join us. These meetings will be Monday 4:30pm Pacific Time on Microsoft 
Teams.

MS Teams Link in following discussion: * 
https://github.com/tianocore/edk2/discussions/2614

Anyone is welcome to join.

* tianocore/edk2: EDK II (github.com)
* tianocore/edk2-basetools: EDK II BaseTools Python tools as a PIP module 
(github.com) https://github.com/tianocore/edk2-basetools
* tianocore/edk2-pytool-extensions: Extensions to the edk2 build system 
allowing for a more robust and plugin based build system and tool execution 
environment (github.com) https://github.com/tianocore/edk2-pytool-extensions
* tianocore/edk2-pytool-library: Python library package that supports UEFI 
development (github.com) https://github.com/tianocore/edk2-pytool-library

MS Teams Browser Clients * 
https://docs.microsoft.com/en-us/microsoftteams/get-clients?tabs=Windows#browser-client


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111764): https://edk2.groups.io/g/devel/message/111764
Mute This Topic: https://groups.io/mt/102820702/21656
Mute #cal-reminder:https://edk2.groups.io/g/devel/mutehashtag/cal-reminder
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [edk2-platforms PATCH 1/2] WhitleyOpenBoardPkg: remove references

2023-11-27 Thread Pedro Falcato
On Tue, Nov 21, 2023 at 2:17 AM Chiu, Chasel  wrote:
>
>
> Hi Laszlo,
>
> I think you have to clone all the required repos.
> edk2 repository
> git clone https://github.com/tianocore/edk2.git
>
> edk2-platforms repository
> git clone https://github.com/tianocore/edk2-platforms.git
>
> edk2-non-osi repository
> git clone https://github.com/tianocore/edk2-non-osi.git
>
> FSP repository
> git clone https://github.com/IntelFsp/FSP.git

I wonder if the docs are outdated? I had heard of
https://github.com/Intel/FSP, not IntelFsp/FSP.
Does https://github.com/Intel/FSP work?

-- 
Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111763): https://edk2.groups.io/g/devel/message/111763
Mute This Topic: https://groups.io/mt/102483850/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] BaseTools KeyError When Building EmulatorPkg

2023-11-27 Thread ryderkeys via groups.io
On Monday, November 27th, 2023 at 2:43 PM, Sean via groups.io wrote:

> In the meantime there are two easy workarounds (pick one). 
> 
> 1. Create your venv named something like "venv" instead of ".venv".  It just 
> must come later in the default directory sort than "Basetools".
> 
> or
> 
> 2. Create your venv outside the edk2 source code tree.  Generally this is 
> what I do as I don't like my virtual environment mixed with my source code. 
> 
> As mentioned before don't forget to build the basetools.  From there, my 
> experience is everything works.  Thanks for reporting your issue.

Hi Sean,

Thanks for the reply and the swift resolution. Regarding your suggestions:
0. I can confirm that after uninstalling the pip basetools, the error 
disappears and the build works.
1. It also works if I rename ".venv" to something that starts after B (such as 
venv)
2. It also works if I place the venv outside the source tree.

Thanks once again for the help,
Ryder



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111762): https://edk2.groups.io/g/devel/message/111762
Mute This Topic: https://groups.io/mt/102698986/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v1 1/1] Maintainers.txt: Remove myself as a tools maintainer

2023-11-27 Thread Michael D Kinney
Reviewed-by: Michael D Kinney 


> -Original Message-
> From: mikub...@linux.microsoft.com 
> Sent: Monday, November 27, 2023 11:45 AM
> To: devel@edk2.groups.io
> Cc: Andrew Fish ; Chris Fernald
> ; Joey Vagedes ; Leif
> Lindholm ; Gao, Liming
> ; Kinney, Michael D
> ; Sean Brogan 
> Subject: [PATCH v1 1/1] Maintainers.txt: Remove myself as a tools
> maintainer
> 
> From: Michael Kubacki 
> 
> Replace with Joey Vagedes.
> 
> Cc: Andrew Fish 
> Cc: Chris Fernald 
> Cc: Joey Vagedes 
> Cc: Leif Lindholm 
> Cc: Liming Gao 
> Cc: Michael D Kinney 
> Cc: Sean Brogan 
> Signed-off-by: Michael Kubacki 
> ---
>  Maintainers.txt | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 7c0b4cb58cfd..8fdafcb6c7b3 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -104,19 +104,19 @@ EDK II Continuous Integration:
>  .azurepipelines/
>  F: .azurepipelines/
>  M: Sean Brogan  [spbrogan]
> -M: Michael Kubacki  [makubacki]
> +M: Joey Vagedes  [javagedes]
>  R: Michael D Kinney  [mdkinney]
>  R: Liming Gao  [lgao4]
> 
>  .devcontainer/
>  F: .devcontainer/
> -M: Michael Kubacki  [makubacki]
> +M: Joey Vagedes  [javagedes]
>  R: Chris Fernald  [cfernald]
> 
>  .github/
>  F: .github/
>  M: Sean Brogan  [spbrogan]
> -M: Michael Kubacki  [makubacki]
> +M: Joey Vagedes  [javagedes]
>  R: Michael D Kinney  [mdkinney]
> 
>  .mergify/
> @@ -128,7 +128,7 @@ R: Sean Brogan 
> [spbrogan]
>  .pytool/
>  F: .pytool/
>  M: Sean Brogan  [spbrogan]
> -M: Michael Kubacki  [makubacki]
> +M: Joey Vagedes  [javagedes]
>  R: Michael D Kinney  [mdkinney]
>  R: Liming Gao  [lgao4]
> 
> @@ -166,7 +166,7 @@ R: Yuwei Chen  [YuweiChen1110]
>  BaseTools: Plugins
>  F: BaseTools/Plugin/
>  M: Sean Brogan  [spbrogan]
> -M: Michael Kubacki  [makubacki]
> +M: Joey Vagedes  [javagedes]
>  R: Michael D Kinney  [mdkinney]
>  R: Liming Gao  [lgao4]
> 
> --
> 2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111761): https://edk2.groups.io/g/devel/message/111761
Mute This Topic: https://groups.io/mt/102836632/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 
https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v3 0/2] OvmfPkg: Enable measured direct boot on AMD SEV-SNP

2023-11-27 Thread Lendacky, Thomas via groups.io

On 3/20/23 05:06, Gerd Hoffmann wrote:

On Thu, Mar 02, 2023 at 09:15:30AM +, Dov Murik wrote:

AMD SEV and SEV-ES support measured direct boot with
kernel/initrd/cmdline hashes injected by QEMU and verified by OVMF
during boot.

To enable the same approach for AMD SEV-SNP, we declare the kernel
hashes page in the SNP metadata list as a new region type.  When QEMU
encounters that region in the list, it will insert the hashes of
kernel/initrd/cmdline and encrypt the page (or, if the user turned off
kernel hashes, it will validate the page as a zero page).

The first patch rearranges the pages in AmdSevX64's MEMFD so they are in
the same order both as in the main target (OvmfPkgX64), with the
exception of the SEV Launch Secret page which isn't defined in
OvmfPkgX64.

The second patch modifies the SNP metadata structure such that on
AmdSev target the SEV Launch Secret page is explicitly defined in SNP
metadata list, and therefore it is not included in the ranges that are
pre-validated (zero pages) by the VMM; instead the VMM will insert
content into this page (the hashes table), or mark it explicitly as a
zero page if no hashes are added.

This series is available at:
https://github.com/confidential-containers-demo/edk2/tree/snp-kernel-hashes-v3

A corresponding QEMU RFC series will be published soon in qemu-devel, or
use this tree:
https://github.com/confidential-containers-demo/qemu/tree/snp-kernel-hashes-v3


For the series:
Acked-by: Gerd Hoffmann 


I've noticed that series was never picked up. Any chance that this can be 
merged?


Thanks,
Tom






-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111760): https://edk2.groups.io/g/devel/message/111760
Mute This Topic: https://groups.io/mt/97335488/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] BaseTools KeyError When Building EmulatorPkg

2023-11-27 Thread Sean

@Ryder

We have identified the issue.

A new issue will be created here Issues · tianocore/edk2-basetools 
(github.com)  to 
track it.


In the meantime there are two easy workarounds (pick one).


1. Create your venv named something like "venv" instead of ".venv".  It 
just must come later in the default directory sort than "Basetools".


or

2. Create your venv outside the edk2 source code tree.  Generally this 
is what I do as I don't like my virtual environment mixed with my source 
code.



As mentioned before don't forget to build the basetools.  From there, my 
experience is everything works.  Thanks for reporting your issue.



Thanks

Sean


On 11/27/2023 10:16 AM, Sean wrote:


We are looking at it.

It seems to be a problem in the edk2-basetools but at this point it 
still isn't obvious.


You can do a 'pip uninstall edk2-basetools' and then I would expect 
your build would work.


I also see that you didn't build edk2 basetools (step 6) documented 
here: edk2/EmulatorPkg/PlatformCI at master · tianocore/edk2 
(github.com) 
.  
Without doing that your build will fail as well.



The CI system is building fine so we are still looking into it.

I'll update the thread when we have more info.


Thanks

Sean



On 11/21/2023 8:22 AM, Laszlo Ersek wrote:

Adding Sean

Laszlo

On 11/19/23 23:43, ryderkeys via groups.io wrote:

Hi all,

I am trying to build EDK2 from most recent Github (namely, EmulatorPkg) with 
the new Stuart build system on Windows 10 22H2 64 bit with VS 2019. I'm getting 
the following error which directed me to this mailing list. More details on my 
build process below.

INFO - build.py...
INFO -  : error C0DE: Unknown fatal error when processing 
[c:\users\ryder\edk2_2023\edk2\EmulatorPkg\EmulatorPkg.dsc]
INFO -
INFO - (Please send email tode...@edk2.groups.io  for help, attaching following 
call stack trace!)
INFO -
INFO - (Python 3.11.5 on win32) Traceback (most recent call last):
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\BaseTools\Source\Python\build\build.py", line 
2692, in Main
INFO - MyBuild = Build(Target, Workspace, Option,LogQ)
INFO -   ^
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\BaseTools\Source\Python\build\build.py", line 
815, in __init__
INFO - self.InitPreBuild()
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\BaseTools\Source\Python\build\build.py", line 
1015, in InitPreBuild
INFO - self.LoadConfiguration()
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\BaseTools\Source\Python\build\build.py", line 
971, in LoadConfiguration
INFO - self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\BaseTools\Source\Python\build\build.py", line 
905, in GetToolChainAndFamilyFromDsc
INFO - dscobj = self.BuildDatabase[File, BuildArch]
INFO -  ~~^
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\WorkspaceDatabase.py",
 line 104, in __getitem__
INFO - BuildObject = self.CreateBuildObject(FilePath, Arch, Target, 
Toolchain)
INFO -   
^
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\WorkspaceDatabase.py",
 line 125, in CreateBuildObject
INFO - BuildObject = self._GENERATOR_[FileType](
INFO -   ^^^
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\DscBuildData.py",
 line 231, in __init__
INFO - self.SkuIdMgr = SkuClass(self.SkuName, self.SkuIds)
INFO -  
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\DscBuildData.py",
 line 510, in SkuName
INFO - self._GetHeaderInfo()
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\DscBuildData.py",
 line 310, in _GetHeaderInfo
INFO - RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch]
INFO -  ~
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\MetaFileParser.py",
 line 250, in __getitem__
INFO - self._PostProcess()
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\MetaFileParser.py",
 line 1429, in _PostProcess
INFO - Processer[self._ItemType]()
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\MetaFileParser.py",
 line 1609, in __ProcessDirective
INFO - __IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE']
INFO -~^
INFO - KeyError: 'WORKSPACE'

I followed the directions 

Re: [edk2-devel] [PATCH 0/2] SEV-SNP guest support fixes

2023-11-27 Thread Lendacky, Thomas via groups.io

On 11/17/23 15:43, Tom Lendacky wrote:



On 11/7/23 03:55, Gerd Hoffmann wrote:

On Mon, Nov 06, 2023 at 04:45:29PM -0600, Tom Lendacky wrote:

This patch series provides fixes around AP startup and sorting:

- The CPUID_EXTENDED_TOPOLOGY CPUID leaf takes a sub-leaf as input. The
   current SEV-SNP support is attempting to retrieve the this leaf with
   sub-leaf 0, but is calling AsmCpuid(), which does not clear ECX before
   invoking the CPUID instruction. Therefore, because of the calling
   convention, the leaf value becomes the sub-leaf value and ends up
   returning incorrect information. Change the call from AsmCpuid() to
   AsmCpuidEx().

- When sorting the CPUs by APIC ID, the VMSA associated with the vCPU
   should follow the APIC ID. Update the sorting code to swap the VMSA
   pointer during the sort.


Series:
Acked-by: Gerd Hoffmann 



Eric/Ray/Rahul,

Have you had a chance to review this series? These bug fixes would be good 
to get in for the next/latest release...


Eric/Ray/Rahul,

Any feedback? If not, can you Ack them so they can be merged... they 
already missed the edk2-stable202311 tag.


Thanks,
Tom



Thanks,
Tom



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111756): https://edk2.groups.io/g/devel/message/111756
Mute This Topic: https://groups.io/mt/102432041/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v5 00/16] Add ImagePropertiesRecordLib and Fix MAT Bugs​

2023-11-27 Thread Ard Biesheuvel
On Mon, 27 Nov 2023 at 19:18, Taylor Beebe  wrote:
>
> v5:
> This version is purely an update of commit messages and orientation.
> No code changes were made.
> - Split patch 9 into 3 separate patches so each fix is in its own
>   commit.
> - Updated the commit comment of patch 11 to add context.
>

Thanks for sticking with this.

For the series,

Reviewed-by: Ard Biesheuvel 



> v4:
> - Expose additional functions in the Library API
> - Add NULL checks to library functions and return a
>   status where applicable.
>
> v3:
> - Refactor patch series so the transition of logic from the DXE
>   MAT logic to the new library is more clear.
> - Update function headers to improve clarity and follow EDK2
>   standards.
> - Add Create and Delete functions for Image Properties Records
>   and redirect some of the SMM and DXE MAT code to use these
>   functions.
> - Update/Add DumpImageRecords() to print the image name and code
>   sections of each runtime image which will be put in the MAT.
>   The DXE and SMM MAT logic will now invoke the DumpImageRecords()
>   on DEBUG builds at the EndOfDxe event to install the MAT.
>
> v2:
> - A one-line change in patch 3 was moved to patch 9 for correctness.
>
> Reference: https://github.com/tianocore/edk2/pull/4590
> Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=4492
>
> The UEFI and SMM MAT logic contains duplicate logic for manipulating image
> properties records which is used to track runtime images.
> This patch series adds a new library, ImagePropertiesRecordLib,
> which consolidates this logic and fixes the bugs which currently exist in
> the MAT logic.
>
> The first patch adds the ImagePropertiesRecordLib implementation which
> is a copy of the UEFI MAT logic with minor modifications to remove the
> reliance on globabl variables and make the code unit testable.
>
> The second patch adds a unit test for the ImagePropertiesRecordLib. The
> logic tests various potential layouts of the EFI memory map and runtime
> images. 3/4 of these tests will fail which demonstrates the MAT logic
> bugs.
>
> The third patch fixes the logic in the ImagePropertiesRecordLib so
> that all of the unit tests pass and the MAT logic can be fixed by
> using the library.
>
> The remaining patches add library instances to DSC files and remove
> the image properties record logic from the SMM and UEFI MAT logic.
>
> Cc: Andrew Fish 
> Cc: Ard Biesheuvel 
> Cc: Dandan Bi 
> Cc: Eric Dong 
> Cc: Gerd Hoffmann 
> Cc: Guo Dong 
> Cc: Gua Guo 
> Cc: James Lu 
> Cc: Jian J Wang 
> Cc: Jiewen Yao 
> Cc: Jordan Justen 
> Cc: Leif Lindholm 
> Cc: Liming Gao 
> Cc: Rahul Kumar 
> Cc: Ray Ni 
> Cc: Sami Mujawar 
> Cc: Sean Rhodes 
> Cc: Lazlo Ersek 
>
> Taylor Beebe (16):
>   MdeModulePkg: Add ImagePropertiesRecordLib
>   ArmVirtPkg: Add ImagePropertiesRecordLib Instance
>   EmulatorPkg: Add ImagePropertiesRecordLib Instance
>   OvmfPkg: Add ImagePropertiesRecordLib Instance
>   UefiPayloadPkg: Add ImagePropertiesRecordLib Instance
>   MdeModulePkg: Update MemoryAttributesTable.c to Reduce Global Variable
> Use
>   MdeModulePkg: Move Some DXE MAT Logic to ImagePropertiesRecordLib
>   MdeModulePkg: Add ImagePropertiesRecordLib Host-Based Unit Test
>   MdeModulePkg: Fix MAT Descriptor Count Calculation
>   MdeModulePkg: Fix MAT SplitRecord() Logic
>   MdeModulePkg: Fix MAT SplitTable() Logic
>   MdeModulePkg: Add NULL checks and Return Status to
> ImagePropertiesRecordLib
>   UefiCpuPkg: Use Attribute From SMM MemoryAttributesTable if Nonzero
>   MdeModulePkg: Transition SMM MAT Logic to Use ImagePropertiesRecordLib
>   MdeModulePkg: Add Logic to Create/Delete Image Properties Records
>   MdeModulePkg: Update DumpImageRecord() in ImagePropertiesRecordLib
>
>  MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c   
>|  967 +
>  MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c
>|   24 +-
>  MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c  
>|  958 +---
>  MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c 
>| 1144 
>  
> MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTest/ImagePropertiesRecordLibUnitTestHost.c
>|  938 
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c   
>|   19 +-
>  ArmVirtPkg/ArmVirt.dsc.inc   
>|1 +
>  EmulatorPkg/EmulatorPkg.dsc  
>|1 +
>  MdeModulePkg/Core/Dxe/DxeMain.h  
>|   20 -
>  MdeModulePkg/Core/Dxe/DxeMain.inf
>|1 +
>  MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf

Re: [edk2-devel] [edk2-platforms PATCH 1/2] WhitleyOpenBoardPkg: remove references

2023-11-27 Thread Chiu, Chasel

Hi Laszlo,

Thanks for your support too!
By the way, do we still plan to remove LgacyBiosMpTable.h? We can follow up 
with relevant OpenBoardPkg fixes if that's the goal.

Thanks,
Chasel



> -Original Message-
> From: Laszlo Ersek 
> Sent: Thursday, November 23, 2023 2:05 AM
> To: devel@edk2.groups.io; Chiu, Chasel 
> Cc: Chaganty, Rangasai V ; Desimone, Nathaniel
> L 
> Subject: Re: [edk2-devel] [edk2-platforms PATCH 1/2] WhitleyOpenBoardPkg:
> remove  references
> 
> Hi Chasel,
> 
> On 11/21/23 03:17, Chiu, Chasel wrote:
> >
> > Hi Laszlo,
> >
> > I think you have to clone all the required repos.
> > edk2 repository
> > git clone https://github.com/tianocore/edk2.git
> >
> > edk2-platforms repository
> > git clone https://github.com/tianocore/edk2-platforms.git
> >
> > edk2-non-osi repository
> > git clone https://github.com/tianocore/edk2-non-osi.git
> >
> > FSP repository
> > git clone https://github.com/IntelFsp/FSP.git
> 
> But that's the thing exactly: this repository is not public, and I'm not a 
> member of
> the IntelFsp organization. When I log in to GitHub, and open
> 
>   https://github.com/IntelFsp/
> 
> the page says
> 
>   This organization has no public repositories.
> 
> This is basically what I meant earlier, when I asked: "How can I satisfy the 
> FSP
> blob requirement?".
> 
> Anyway... this is taking too long; I don't want to waste your time with it. 
> We can't
> reasonably expect any contributor to send patches for a subsystem they can't
> even build due to not being permitted access to various proprietary blobs. I'm
> dropping this patch set now (for edk2 as well), and removing myself from the 
> BZ.
> 
> Thanks for the help thus far!
> Laszlo
> 
> >
> > check if you got all repos like below:
> > edk2
> > edk2-non-osi
> > edk2-platforms
> > FSP
> >
> > Then switch to edk2-platforms/Platform/Intel/build_bios.py -p
> > WilsonCityRvp to start the build
> >
> > Detail information is in readme:
> > https://github.com/tianocore/edk2-platforms/blob/master/Platform/Intel
> > /Readme.md
> >
> > Please let me know if any question.
> >
> > Thanks,
> > Chasel
> >
> >
> >
> >
> >
> >> -Original Message-
> >> From: Laszlo Ersek 
> >> Sent: Wednesday, November 15, 2023 3:51 AM
> >> To: devel@edk2.groups.io; Chiu, Chasel 
> >> Cc: Chaganty, Rangasai V ; Desimone,
> >> Nathaniel L 
> >> Subject: Re: [edk2-devel] [edk2-platforms PATCH 1/2] WhitleyOpenBoardPkg:
> >> remove  references
> >>
> >> Hi Chasel,
> >>
> >> On 11/10/23 02:13, Chiu, Chasel wrote:
> >>>
> >>> Hi Laszlo,
> >>>
> >>> I verified and encountered build failure as some files still
> >>> consuming definitions
> >> from LegacyBiosMpTable.h, for example:
> >>> https://github.com/tianocore/edk2-platforms/blob/899a9dc97cd54690513
> >>> 38
> >>>
> >>
> 0ad01ee8b2609dbefd5/Platform/Intel/WhitleyOpenBoardPkg/Uba/UbaMain/Co
> >> m
> >>> mon/Dxe/SystemBoardInfoDxe/SystemBoardInfoDxe.c#L22
> >>>
> >>> Any suggestion that we can reduce impact to existing platforms?
> >>
> >> I've been hoping to get comments from Nate on the expected contents
> >> of DEVICE_DATA_HW_LOCAL_INT. Barring such comments, here is my
> proposal:
> >> I'd like to just replace the enum constants in question with their 
> >> numerical
> values.
> >>
> >> However, even for that, I'd really like to be able to build-test the 
> >> platform
> locally.
> >> Do you have build instructions? How can I satisfy the FSP blob requirement?
> >>
> >> Thanks!
> >> Laszlo
> >
> >
> >
> > 
> >
> >



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111754): https://edk2.groups.io/g/devel/message/111754
Mute This Topic: https://groups.io/mt/102483850/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 16/16] MdeModulePkg: Update DumpImageRecord() in ImagePropertiesRecordLib

2023-11-27 Thread Taylor Beebe
Update DumpImageRecord() to be DumpImageRecords(), and improve
the debug output. The function will output at DEBUG_INFO instead,
and the function will be run in DXE and SMM
MAT logic when the MAT is installed at EndOfDxe on DEBUG builds.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Dandan Bi 
Cc: Jiaxin Wu 
Cc: Ray Ni 
Signed-off-by: Taylor Beebe 
Reviewed-by: Liming Gao 
---
 MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c |   
9 ++
 MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c|  
11 +-
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c   | 
134 +---
 MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h|   
6 +-
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf |   
1 +
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc |   
1 +
 6 files changed, 138 insertions(+), 24 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c 
b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
index 993db281062a..e9343a2c4ef1 100644
--- a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
+++ b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
@@ -284,6 +284,15 @@ InstallMemoryAttributesTableOnEndOfDxe (
 {
   mMemoryAttributesTableEndOfDxe = TRUE;
   InstallMemoryAttributesTable ();
+
+  DEBUG_CODE_BEGIN ();
+  if ( mImagePropertiesPrivateData.ImageRecordCount > 0) {
+DEBUG ((DEBUG_INFO, "DXE - Total Runtime Image Count: 0x%x\n", 
mImagePropertiesPrivateData.ImageRecordCount));
+DEBUG ((DEBUG_INFO, "DXE - Dump Runtime Image Records:\n"));
+DumpImageRecords ();
+  }
+
+  DEBUG_CODE_END ();
 }
 
 /**
diff --git a/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c 
b/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
index 03de9b2c5fff..28fe74ecc421 100644
--- a/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
+++ b/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
@@ -496,9 +496,14 @@ SmmInstallMemoryAttributesTable (
 return EFI_SUCCESS;
   }
 
-  DEBUG ((DEBUG_VERBOSE, "SMM Total Image Count - 0x%x\n", 
mImagePropertiesPrivateData.ImageRecordCount));
-  DEBUG ((DEBUG_VERBOSE, "SMM Dump ImageRecord:\n"));
-  DumpImageRecord ();
+  DEBUG_CODE_BEGIN ();
+  if ( mImagePropertiesPrivateData.ImageRecordCount > 0) {
+DEBUG ((DEBUG_INFO, "SMM - Total Runtime Image Count - 0x%x\n", 
mImagePropertiesPrivateData.ImageRecordCount));
+DEBUG ((DEBUG_INFO, "SMM - Dump Runtime Image Records:\n"));
+DumpImageRecords ();
+  }
+
+  DEBUG_CODE_END ();
 
   PublishMemoryAttributesTable ();
 
diff --git 
a/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c 
b/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
index 6c5eb1dc3185..e53ce086c54c 100644
--- a/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
+++ b/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define PREVIOUS_MEMORY_DESCRIPTOR(MemoryDescriptor, Size) \
@@ -785,31 +786,128 @@ SortImageRecord (
 }
 
 /**
-  Dump image record.
+  Extract the .efi filename out of the input PDB.
 
-  @param[in]  ImageRecordList  A list of IMAGE_PROPERTIES_RECORD entries
+  @param[in]  PdbPointer  Pointer to the PDB file path.
+  @param[out] EfiFileName Pointer to the .efi filename.
+  @param[in]  EfiFileNameSize Size of the .efi filename buffer.
+**/
+STATIC
+VOID
+GetFilename (
+  IN CHAR8   *PdbPointer,
+  OUT CHAR8  *EfiFileName,
+  IN UINTN   EfiFileNameSize
+  )
+{
+  UINTN  Index;
+  UINTN  StartIndex;
+
+  if ((PdbPointer == NULL) || (EfiFileNameSize < 5)) {
+return;
+  }
+
+  // Print Module Name by Pdb file path.
+  StartIndex = 0;
+  for (Index = 0; PdbPointer[Index] != 0; Index++) {
+if ((PdbPointer[Index] == '\\') || (PdbPointer[Index] == '/')) {
+  StartIndex = Index + 1;
+}
+  }
+
+  // Copy the PDB file name to EfiFileName and replace .pdb with .efi
+  for (Index = 0; Index < EfiFileNameSize - 4; Index++) {
+EfiFileName[Index] = PdbPointer[Index + StartIndex];
+if (EfiFileName[Index] == 0) {
+  EfiFileName[Index] = '.';
+}
+
+if (EfiFileName[Index] == '.') {
+  EfiFileName[Index + 1] = 'e';
+  EfiFileName[Index + 2] = 'f';
+  EfiFileName[Index + 3] = 'i';
+  EfiFileName[Index + 4] = 0;
+  break;
+}
+  }
+
+  if (Index == sizeof (EfiFileName) - 4) {
+EfiFileName[Index] = 0;
+  }
+}
+
+/**
+  Debug dumps the input list of IMAGE_PROPERTIES_RECORD structs.
+
+  @param[in]  ImageRecordList   Head of the IMAGE_PROPERTIES_RECORD list
 **/
 VOID
 EFIAPI
-DumpImageRecord (
+DumpImageRecords (
   IN LIST_ENTRY  *ImageRecordList
   )
 {
-  IMAGE_PROPERTIES_RECORD  *ImageRecord;
-  LIST_ENTRY   *ImageRecordLink;
-  UINTNIndex;
-
-  for (ImageRecordLink = ImageRecordList->ForwardLink, Index = 0;
-  

[edk2-devel] [PATCH v5 14/16] MdeModulePkg: Transition SMM MAT Logic to Use ImagePropertiesRecordLib

2023-11-27 Thread Taylor Beebe
Now that the bugs are fixed in the MAT logic, we can remove the
duplicate logic from PiSmmCore/MemoryAttributesTable.c and use
ImagePropertiesRecordLib instead.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Dandan Bi 
Cc: Jiaxin Wu 
Cc: Ray Ni 
Signed-off-by: Taylor Beebe 
Reviewed-by: Liming Gao 
---
 MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c  | 785 
+---
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c |  29 
+
 MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf|   1 
+
 MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h  |  11 
+
 4 files changed, 58 insertions(+), 768 deletions(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c 
b/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
index 394fdae50741..2e4aaddef4e5 100644
--- a/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
+++ b/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
@@ -14,6 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -25,26 +26,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #define PREVIOUS_MEMORY_DESCRIPTOR(MemoryDescriptor, Size) \
   ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)(MemoryDescriptor) - (Size)))
 
-#define IMAGE_PROPERTIES_RECORD_CODE_SECTION_SIGNATURE  SIGNATURE_32 
('I','P','R','C')
-
-typedef struct {
-  UINT32  Signature;
-  LIST_ENTRY  Link;
-  EFI_PHYSICAL_ADDRESSCodeSegmentBase;
-  UINT64  CodeSegmentSize;
-} IMAGE_PROPERTIES_RECORD_CODE_SECTION;
-
-#define IMAGE_PROPERTIES_RECORD_SIGNATURE  SIGNATURE_32 ('I','P','R','D')
-
-typedef struct {
-  UINT32  Signature;
-  LIST_ENTRY  Link;
-  EFI_PHYSICAL_ADDRESSImageBase;
-  UINT64  ImageSize;
-  UINTN   CodeSegmentCount;
-  LIST_ENTRY  CodeSegmentList;
-} IMAGE_PROPERTIES_RECORD;
-
 #define IMAGE_PROPERTIES_PRIVATE_DATA_SIGNATURE  SIGNATURE_32 ('I','P','P','D')
 
 typedef struct {
@@ -69,87 +50,6 @@ UINT64  mMemoryProtectionAttribute = 
EFI_MEMORY_ATTRIBUTES_RUNTIME_MEMORY_PROTEC
 // Below functions are for MemoryMap
 //
 
-/**
-  Converts a number of EFI_PAGEs to a size in bytes.
-
-  NOTE: Do not use EFI_PAGES_TO_SIZE because it handles UINTN only.
-
-  @param[in]  Pages The number of EFI_PAGES.
-
-  @return  The number of bytes associated with the number of EFI_PAGEs 
specified
-   by Pages.
-**/
-STATIC
-UINT64
-EfiPagesToSize (
-  IN UINT64  Pages
-  )
-{
-  return LShiftU64 (Pages, EFI_PAGE_SHIFT);
-}
-
-/**
-  Converts a size, in bytes, to a number of EFI_PAGESs.
-
-  NOTE: Do not use EFI_SIZE_TO_PAGES because it handles UINTN only.
-
-  @param[in]  Size  A size in bytes.
-
-  @return  The number of EFI_PAGESs associated with the number of bytes 
specified
-   by Size.
-
-**/
-STATIC
-UINT64
-EfiSizeToPages (
-  IN UINT64  Size
-  )
-{
-  return RShiftU64 (Size, EFI_PAGE_SHIFT) + UINTN)Size) & EFI_PAGE_MASK) ? 
1 : 0);
-}
-
-/**
-  Sort memory map entries based upon PhysicalStart, from low to high.
-
-  @param[in,out]  MemoryMap A pointer to the buffer in which firmware 
places
-the current memory map.
-  @param[in]  MemoryMapSize Size, in bytes, of the MemoryMap buffer.
-  @param[in]  DescriptorSizeSize, in bytes, of an individual 
EFI_MEMORY_DESCRIPTOR.
-**/
-STATIC
-VOID
-SortMemoryMap (
-  IN OUT EFI_MEMORY_DESCRIPTOR  *MemoryMap,
-  IN UINTN  MemoryMapSize,
-  IN UINTN  DescriptorSize
-  )
-{
-  EFI_MEMORY_DESCRIPTOR  *MemoryMapEntry;
-  EFI_MEMORY_DESCRIPTOR  *NextMemoryMapEntry;
-  EFI_MEMORY_DESCRIPTOR  *MemoryMapEnd;
-  EFI_MEMORY_DESCRIPTOR  TempMemoryMap;
-
-  MemoryMapEntry = MemoryMap;
-  NextMemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (MemoryMapEntry, DescriptorSize);
-  MemoryMapEnd   = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)MemoryMap + 
MemoryMapSize);
-  while (MemoryMapEntry < MemoryMapEnd) {
-while (NextMemoryMapEntry < MemoryMapEnd) {
-  if (MemoryMapEntry->PhysicalStart > NextMemoryMapEntry->PhysicalStart) {
-CopyMem (, MemoryMapEntry, sizeof 
(EFI_MEMORY_DESCRIPTOR));
-CopyMem (MemoryMapEntry, NextMemoryMapEntry, sizeof 
(EFI_MEMORY_DESCRIPTOR));
-CopyMem (NextMemoryMapEntry, , sizeof 
(EFI_MEMORY_DESCRIPTOR));
-  }
-
-  NextMemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (NextMemoryMapEntry, 
DescriptorSize);
-}
-
-MemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (MemoryMapEntry, 
DescriptorSize);
-NextMemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (MemoryMapEntry, 
DescriptorSize);
-  }
-
-  return;
-}
-
 /**
   Merge continuous memory map entries whose have same attributes.
 
@@ -183,7 +83,7 @@ MergeMemoryMap (
 NextMemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (MemoryMapEntry, 
DescriptorSize);
 
 do {
-  MemoryBlockLength = (UINT64)(EfiPagesToSize 

[edk2-devel] [PATCH v5 12/16] MdeModulePkg: Add NULL checks and Return Status to ImagePropertiesRecordLib

2023-11-27 Thread Taylor Beebe
Update function headers to clarify the contract of each function and
improve readability. Add NULL checks to all functions that take a
pointer as an argument. Add return status to functions that
may need to return early due to invalid input.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Dandan Bi 
Signed-off-by: Taylor Beebe 
Reviewed-by: Liming Gao 
---
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c | 290 

 MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h  | 137 
-
 2 files changed, 246 insertions(+), 181 deletions(-)

diff --git 
a/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c 
b/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
index 379eb0c6cccd..c9378679e7bb 100644
--- a/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
+++ b/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
@@ -22,14 +22,13 @@
   ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)(MemoryDescriptor) + (Size)))
 
 /**
-  Converts a number of EFI_PAGEs to a size in bytes.
+  Converts a number of pages to a size in bytes.
 
   NOTE: Do not use EFI_PAGES_TO_SIZE because it handles UINTN only.
 
-  @param  Pages The number of EFI_PAGES.
+  @param[in]  Pages The number of EFI_PAGES.
 
-  @return  The number of bytes associated with the number of EFI_PAGEs 
specified
-   by Pages.
+  @retval  The number of bytes associated with the input number of pages.
 **/
 STATIC
 UINT64
@@ -45,10 +44,9 @@ EfiPagesToSize (
 
   NOTE: Do not use EFI_SIZE_TO_PAGES because it handles UINTN only.
 
-  @param  Size  A size in bytes.
+  @param[in]  Size  A size in bytes.
 
-  @return  The number of EFI_PAGESs associated with the number of bytes 
specified
-   by Size.
+  @retval  The number of pages associated with the input number of bytes.
 
 **/
 STATIC
@@ -61,12 +59,12 @@ EfiSizeToPages (
 }
 
 /**
-  Sort memory map entries based upon PhysicalStart, from low to high.
+  Sort memory map entries based upon PhysicalStart from low to high.
 
-  @param  MemoryMap  A pointer to the buffer in which firmware 
places
- the current memory map.
-  @param  MemoryMapSize  Size, in bytes, of the MemoryMap buffer.
-  @param  DescriptorSize Size, in bytes, of an individual 
EFI_MEMORY_DESCRIPTOR.
+  @param[in, out] MemoryMap   A pointer to the buffer in which firmware 
places
+  the current memory map.
+  @param[in]  MemoryMapSize   Size, in bytes, of the MemoryMap buffer.
+  @param[in]  DescriptorSize  Size, in bytes, of an individual 
EFI_MEMORY_DESCRIPTOR.
 **/
 STATIC
 VOID
@@ -105,11 +103,12 @@ SortMemoryMap (
 /**
   Return the first image record, whose [ImageBase, ImageSize] covered by 
[Buffer, Length].
 
-  @param Buffer   Start Address
-  @param Length   Address length
-  @param ImageRecordList  Image record list
+  @param[in] Buffer   Starting Address
+  @param[in] Length   Length to check
+  @param[in] ImageRecordList  A list of IMAGE_PROPERTIES_RECORD entries to 
check against
+  the memory range Buffer -> Buffer + Length
 
-  @return first image record covered by [buffer, length]
+  @retval The first image record covered by [Buffer, Length]
 **/
 STATIC
 IMAGE_PROPERTIES_RECORD *
@@ -144,17 +143,19 @@ GetImageRecordByAddress (
 }
 
 /**
-  Set the memory map to new entries, according to one old entry,
-  based upon PE code section and data section in image record
+  Break up the input OldRecord into multiple new records based on the code
+  and data sections in the input ImageRecord.
 
-  @param  ImageRecordAn image record whose [ImageBase, ImageSize] 
covered
- by old memory map entry.
-  @param  NewRecord  A pointer to several new memory map entries.
- The caller gurantee the buffer size be 1 +
- (SplitRecordCount * DescriptorSize) calculated
- below.
-  @param  OldRecord  A pointer to one old memory map entry.
-  @param  DescriptorSize Size, in bytes, of an individual 
EFI_MEMORY_DESCRIPTOR.
+  @param[in]ImageRecord   An IMAGE_PROPERTIES_RECORD whose 
ImageBase and
+  ImageSize is covered by by OldRecord.
+  @param[in, out]   NewRecord A pointer to several new memory map 
entries.
+  The caller gurantee the buffer size be 1 
+
+  (SplitRecordCount * DescriptorSize) 
calculated
+  below.
+  @param[in]OldRecord A pointer to one old memory map entry.
+  @param[in]DescriptorSizeThe size, in bytes, of an individual 
EFI_MEMORY_DESCRIPTOR.
+
+  @retval The 

[edk2-devel] [PATCH v5 13/16] UefiCpuPkg: Use Attribute From SMM MemoryAttributesTable if Nonzero

2023-11-27 Thread Taylor Beebe
PiSmmCore fetches the EFI memory map and calls SplitTable() to
split each loaded image section into its own descriptor with
EFI_MEMORY_XP marking data sections and EFI_MEMORY_RO marking
code sections.

The SMM MAT logic is almost identical to the DXE MAT logic but goes
a step further and also updates the memory map descriptors which describe
image code and data sections to be of type EfiRuntimeServicesCode and
EfiRuntimeServicesData respectively. The consolidated MAT logic
(present in the new ImagePropertiesRecordLib) more closely follows
the DXE MAT logic which identifies image code sections by the presence
of the attribute EFI_MEMORY_RO in the descriptor and image data
sections by the presence of the attribute EFI_MEMORY_XP. Because of
the flow choice of the consolidated MAT logic, the SMM MAT logic should
just use the attributes from the table returned by SplitTable().

Additionally, the function EnforceMemoryMapAttribute() in the SMM MAT
logic will ensure that the CODE and DATA memory types have the desired
attributes so bisecting this patch series at this commit will still
function as before.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Cc: Gerd Hoffmann 
Cc: Laszlo Ersek 
Signed-off-by: Taylor Beebe 
Reviewed-by: Laszlo Ersek 
---
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 19 +++
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
index 3d445df213ab..15f998e501a2 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
@@ -1047,14 +1047,17 @@ SetMemMapAttributes (
   MemoryMap = MemoryMapStart;
   for (Index = 0; Index < MemoryMapEntryCount; Index++) {
 DEBUG ((DEBUG_VERBOSE, "SetAttribute: Memory Entry - 0x%lx, 0x%x\n", 
MemoryMap->PhysicalStart, MemoryMap->NumberOfPages));
-if (MemoryMap->Type == EfiRuntimeServicesCode) {
-  MemoryAttribute = EFI_MEMORY_RO;
-} else {
-  ASSERT ((MemoryMap->Type == EfiRuntimeServicesData) || (MemoryMap->Type 
== EfiConventionalMemory));
-  //
-  // Set other type memory as NX.
-  //
-  MemoryAttribute = EFI_MEMORY_XP;
+MemoryAttribute = MemoryMap->Attribute & EFI_MEMORY_ACCESS_MASK;
+if (MemoryAttribute == 0) {
+  if (MemoryMap->Type == EfiRuntimeServicesCode) {
+MemoryAttribute = EFI_MEMORY_RO;
+  } else {
+ASSERT ((MemoryMap->Type == EfiRuntimeServicesData) || 
(MemoryMap->Type == EfiConventionalMemory));
+//
+// Set other type memory as NX.
+//
+MemoryAttribute = EFI_MEMORY_XP;
+  }
 }
 
 //
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111750): https://edk2.groups.io/g/devel/message/111750
Mute This Topic: https://groups.io/mt/102834921/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 11/16] MdeModulePkg: Fix MAT SplitTable() Logic

2023-11-27 Thread Taylor Beebe
SplitTable() does not properly handle the case where there is
an odd number of code regions within a loaded image. When there are
an odd number of code regions, at least one image region descriptor
is overwritten with uninitialized memory which has caused crashes
in the right conditions.

This failure cases is documented extensively in the following bugzilla:
https://bugzilla.tianocore.org/show_bug.cgi?id=4492

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Dandan Bi 
Signed-off-by: Taylor Beebe 
Reviewed-by: Liming Gao 
---
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c | 40 
++--
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git 
a/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c 
b/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
index 9d4082280bf5..379eb0c6cccd 100644
--- a/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
+++ b/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
@@ -463,11 +463,12 @@ SplitTable (
 {
   INTN   IndexOld;
   INTN   IndexNew;
+  INTN   IndexNewStarting;
   UINTN  MaxSplitRecordCount;
   UINTN  RealSplitRecordCount;
-  UINTN  TotalSplitRecordCount;
+  UINTN  TotalSkippedRecords;
 
-  TotalSplitRecordCount = 0;
+  TotalSkippedRecords = 0;
   //
   // Let old record point to end of valid MemoryMap buffer.
   //
@@ -475,7 +476,8 @@ SplitTable (
   //
   // Let new record point to end of full MemoryMap buffer.
   //
-  IndexNew = ((*MemoryMapSize) / DescriptorSize) - 1 + 
NumberOfAdditionalDescriptors;
+  IndexNew = ((*MemoryMapSize) / DescriptorSize) - 1 + 
NumberOfAdditionalDescriptors;
+  IndexNewStarting = IndexNew;
   for ( ; IndexOld >= 0; IndexOld--) {
 MaxSplitRecordCount = GetMaxSplitRecordCount ((EFI_MEMORY_DESCRIPTOR 
*)((UINT8 *)MemoryMap + IndexOld * DescriptorSize), ImageRecordList);
 //
@@ -489,16 +491,14 @@ SplitTable (
  DescriptorSize,
  ImageRecordList
  );
-//
-// Adjust IndexNew according to real split.
-//
-CopyMem (
-  ((UINT8 *)MemoryMap + (IndexNew + MaxSplitRecordCount - 
RealSplitRecordCount) * DescriptorSize),
-  ((UINT8 *)MemoryMap + IndexNew * DescriptorSize),
-  RealSplitRecordCount * DescriptorSize
-  );
-IndexNew   = IndexNew + MaxSplitRecordCount - 
RealSplitRecordCount;
-TotalSplitRecordCount += RealSplitRecordCount;
+
+// If we didn't utilize all the extra allocated descriptor slots, set the 
physical address of the unused slots
+// to MAX_ADDRESS so they are moved to the bottom of the list when sorting.
+for ( ; RealSplitRecordCount < MaxSplitRecordCount; 
RealSplitRecordCount++) {
+  ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)MemoryMap + ((IndexNew + 
RealSplitRecordCount + 1) * DescriptorSize)))->PhysicalStart = MAX_ADDRESS;
+  TotalSkippedRecords++;
+}
+
 IndexNew--;
   }
 
@@ -507,16 +507,16 @@ SplitTable (
   //
   CopyMem (
 MemoryMap,
-(UINT8 *)MemoryMap + (NumberOfAdditionalDescriptors - 
TotalSplitRecordCount) * DescriptorSize,
-(*MemoryMapSize) + TotalSplitRecordCount * DescriptorSize
+(UINT8 *)MemoryMap + ((IndexNew + 1) * DescriptorSize),
+(IndexNewStarting - IndexNew) * DescriptorSize
 );
 
-  *MemoryMapSize = (*MemoryMapSize) + DescriptorSize * TotalSplitRecordCount;
+  //
+  // Sort from low to high to filter out the MAX_ADDRESS records.
+  //
+  SortMemoryMap (MemoryMap, (IndexNewStarting - IndexNew) * DescriptorSize, 
DescriptorSize);
 
-  //
-  // Sort from low to high (Just in case)
-  //
-  SortMemoryMap (MemoryMap, *MemoryMapSize, DescriptorSize);
+  *MemoryMapSize = (IndexNewStarting - IndexNew - TotalSkippedRecords) * 
DescriptorSize;
 
   return;
 }
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111748): https://edk2.groups.io/g/devel/message/111748
Mute This Topic: https://groups.io/mt/102834918/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 15/16] MdeModulePkg: Add Logic to Create/Delete Image Properties Records

2023-11-27 Thread Taylor Beebe
Add logic to create and delete image properties records. Where
applicable, redirect existing code to use the new library.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Dandan Bi 
Cc: Jiaxin Wu 
Cc: Ray Ni 
Signed-off-by: Taylor Beebe 
Reviewed-by: Liming Gao 
---
 MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c | 
184 +++
 MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c| 
166 +++--
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c   | 
186 
 MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h|  
39 
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf |   
1 +
 5 files changed, 281 insertions(+), 295 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c 
b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
index af6c26244cc0..993db281062a 100644
--- a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
+++ b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
@@ -557,25 +557,6 @@ CoreGetMemoryMapWithSeparatedImageSection (
 // Below functions are for ImageRecord
 //
 
-/**
-  Set MemoryAttributesTable according to PE/COFF image section alignment.
-
-  @param  SectionAlignmentPE/COFF section alignment
-**/
-STATIC
-VOID
-SetMemoryAttributesTableSectionAlignment (
-  IN UINT32  SectionAlignment
-  )
-{
-  if (((SectionAlignment & (RUNTIME_PAGE_ALLOCATION_GRANULARITY - 1)) != 0) &&
-  mMemoryAttributesTableEnable)
-  {
-DEBUG ((DEBUG_VERBOSE, "SetMemoryAttributesTableSectionAlignment - 
Clear\n"));
-mMemoryAttributesTableEnable = FALSE;
-  }
-}
-
 /**
   Insert image record.
 
@@ -586,20 +567,12 @@ InsertImageRecord (
   IN EFI_RUNTIME_IMAGE_ENTRY  *RuntimeImage
   )
 {
-  VOID  *ImageAddress;
-  EFI_IMAGE_DOS_HEADER  *DosHdr;
-  UINT32PeCoffHeaderOffset;
-  UINT32SectionAlignment;
-  EFI_IMAGE_SECTION_HEADER  *Section;
-  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION   Hdr;
-  UINT8 *Name;
-  UINTN Index;
-  IMAGE_PROPERTIES_RECORD   *ImageRecord;
-  CHAR8 *PdbPointer;
-  IMAGE_PROPERTIES_RECORD_CODE_SECTION  *ImageRecordCodeSection;
+  EFI_STATUS   Status;
+  IMAGE_PROPERTIES_RECORD  *ImageRecord;
+  CHAR8*PdbPointer;
+  UINT32   RequiredAlignment;
 
   DEBUG ((DEBUG_VERBOSE, "InsertImageRecord - 0x%x\n", RuntimeImage));
-  DEBUG ((DEBUG_VERBOSE, "InsertImageRecord - 0x%016lx - 0x%016lx\n", 
(EFI_PHYSICAL_ADDRESS)(UINTN)RuntimeImage->ImageBase, RuntimeImage->ImageSize));
 
   if (mMemoryAttributesTableEndOfDxe) {
 DEBUG ((DEBUG_INFO, "Do not insert runtime image record after 
EndOfDxe\n"));
@@ -611,139 +584,48 @@ InsertImageRecord (
 return;
   }
 
-  ImageRecord->Signature = IMAGE_PROPERTIES_RECORD_SIGNATURE;
+  InitializeListHead (>Link);
+  InitializeListHead (>CodeSegmentList);
 
-  DEBUG ((DEBUG_VERBOSE, "ImageRecordCount - 0x%x\n", 
mImagePropertiesPrivateData.ImageRecordCount));
-
-  //
-  // Step 1: record whole region
-  //
-  ImageRecord->ImageBase = 
(EFI_PHYSICAL_ADDRESS)(UINTN)RuntimeImage->ImageBase;
-  ImageRecord->ImageSize = RuntimeImage->ImageSize;
-
-  ImageAddress = RuntimeImage->ImageBase;
-
-  PdbPointer = PeCoffLoaderGetPdbPointer ((VOID *)(UINTN)ImageAddress);
+  PdbPointer = PeCoffLoaderGetPdbPointer ((VOID 
*)(UINTN)RuntimeImage->ImageBase);
   if (PdbPointer != NULL) {
 DEBUG ((DEBUG_VERBOSE, "  Image - %a\n", PdbPointer));
   }
 
-  //
-  // Check PE/COFF image
-  //
-  DosHdr = (EFI_IMAGE_DOS_HEADER *)(UINTN)ImageAddress;
-  PeCoffHeaderOffset = 0;
-  if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
-PeCoffHeaderOffset = DosHdr->e_lfanew;
-  }
-
-  Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINT8 *)(UINTN)ImageAddress + 
PeCoffHeaderOffset);
-  if (Hdr.Pe32->Signature != EFI_IMAGE_NT_SIGNATURE) {
-DEBUG ((DEBUG_VERBOSE, "Hdr.Pe32->Signature invalid - 0x%x\n", 
Hdr.Pe32->Signature));
-// It might be image in SMM.
-goto Finish;
-  }
-
-  //
-  // Get SectionAlignment
-  //
-  if (Hdr.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
-SectionAlignment = Hdr.Pe32->OptionalHeader.SectionAlignment;
-  } else {
-SectionAlignment = Hdr.Pe32Plus->OptionalHeader.SectionAlignment;
-  }
-
-  SetMemoryAttributesTableSectionAlignment (SectionAlignment);
-  if ((SectionAlignment & (RUNTIME_PAGE_ALLOCATION_GRANULARITY - 1)) != 0) {
-DEBUG ((
-  DEBUG_WARN,
-  "  InsertImageRecord - Section Alignment(0x%x) is not %dK  
\n",
-  SectionAlignment,
-  RUNTIME_PAGE_ALLOCATION_GRANULARITY >> 10
-  ));
-PdbPointer = PeCoffLoaderGetPdbPointer ((VOID *)(UINTN)ImageAddress);
-if (PdbPointer != NULL) {
-  DEBUG ((DEBUG_WARN, 

[edk2-devel] [PATCH v5 08/16] MdeModulePkg: Add ImagePropertiesRecordLib Host-Based Unit Test

2023-11-27 Thread Taylor Beebe
Create a host-based unit test for the ImagePropertiesRecordLib
SplitTable() logic. This test has 4 cases which tests different
potential image and memory map layouts. 3/4 of these tests fail
with the logic in its current state to provide proof of the bugs
in the current MAT logic.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Dandan Bi 
Signed-off-by: Taylor Beebe 
Reviewed-by: Liming Gao 
---
 
MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTest/ImagePropertiesRecordLibUnitTestHost.c
   | 938 
 
MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTest/ImagePropertiesRecordLibUnitTestHost.inf
 |  35 +
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc 
 |   5 +
 3 files changed, 978 insertions(+)

diff --git 
a/MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTest/ImagePropertiesRecordLibUnitTestHost.c
 
b/MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTest/ImagePropertiesRecordLibUnitTestHost.c
new file mode 100644
index ..8b0a55685ce3
--- /dev/null
+++ 
b/MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTest/ImagePropertiesRecordLibUnitTestHost.c
@@ -0,0 +1,938 @@
+/** @file
+  Unit tests the SplitTable() ImagePropertiesRecordLib Logic
+
+  Copyright (C) Microsoft Corporation.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define UNIT_TEST_APP_NAME "Image Properties Record Lib Unit Test"
+#define UNIT_TEST_APP_VERSION  "1.0"
+
+#define NEXT_MEMORY_DESCRIPTOR(MemoryDescriptor, Size) \
+  ((EFI_MEMORY_DESCRIPTOR *)((UINT8 *)(MemoryDescriptor) + (Size)))
+
+// The starting memory map will contain 6 entries
+#define NUMBER_OF_MEMORY_MAP_DESCRIPTORS  6
+
+// Each memory map descriptor will be the sizeof(EFI_MEMORY_DESCRIPTOR) 
instead of a nonstandard size
+// to catch pointer math issues
+#define DESCRIPTOR_SIZE  sizeof(EFI_MEMORY_DESCRIPTOR)
+
+// Each memory map descriptor will describe 12 pages
+#define BASE_DESCRIPTOR_NUMBER_OF_PAGES  0x0C
+
+// The size, in bytes, of each memory map descriptor range
+#define BASE_DESCRIPTOR_ENTRY_SIZE  
(EFI_PAGES_TO_SIZE(BASE_DESCRIPTOR_NUMBER_OF_PAGES))
+
+// MACRO to get the starting address of a descriptor's described range based 
on the index of that descriptor
+#define BASE_DESCRIPTOR_START_ADDRESS(DescriptorNumber)  (DescriptorNumber * 
BASE_DESCRIPTOR_ENTRY_SIZE)
+
+// Virtual start must be zero
+#define BASE_DESCRIPTOR_VIRTUAL_START  0x0
+
+// Size of the default memory map
+#define BASE_MEMORY_MAP_SIZE  (NUMBER_OF_MEMORY_MAP_DESCRIPTORS * 
DESCRIPTOR_SIZE)
+
+// Number of images in each test case
+#define NUMBER_OF_IMAGES_TO_SPLIT  3
+
+// Maximum number of descriptors required for each image 
(None->Data->Code->Data->Code->Data->None)
+#define MAX_DESCRIPTORS_PER_IMAGE  7
+
+// Number of unused additional descriptors in the starting memory map buffer 
which is used by the
+// SplitTable() logic
+#define NUMBER_OF_ADDITIONAL_DESCRIPTORS  (NUMBER_OF_IMAGES_TO_SPLIT * 
MAX_DESCRIPTORS_PER_IMAGE)
+
+// Size of the memory map with enough space for the starting descriptors and 
the split descriptors
+#define SPLIT_MEMORY_MAP_SIZE  (BASE_MEMORY_MAP_SIZE + 
(NUMBER_OF_ADDITIONAL_DESCRIPTORS * DESCRIPTOR_SIZE))
+
+typedef enum {
+  SectionTypeCode,
+  SectionTypeData,
+  SectionTypeNotFound
+} SECTION_TYPE;
+
+typedef struct {
+  EFI_MEMORY_DESCRIPTOR*MemoryMap;
+  LIST_ENTRY   ImageList;
+} IMAGE_PROPERTIES_RECORD_HOST_TEST_CONTEXT;
+
+EFI_MEMORY_DESCRIPTOR  BaseMemoryMap[] = {
+  {
+EfiConventionalMemory, // Type
+BASE_DESCRIPTOR_START_ADDRESS (0), // PhysicalStart
+BASE_DESCRIPTOR_VIRTUAL_START, // VirtualStart
+BASE_DESCRIPTOR_NUMBER_OF_PAGES,   // Number of Pages
+0  // Attribute
+  },
+  {
+EfiConventionalMemory, // Type
+BASE_DESCRIPTOR_START_ADDRESS (1), // PhysicalStart
+BASE_DESCRIPTOR_VIRTUAL_START, // VirtualStart
+BASE_DESCRIPTOR_NUMBER_OF_PAGES,   // Number of Pages
+0  // Attribute
+  },
+  {
+EfiConventionalMemory, // Type
+BASE_DESCRIPTOR_START_ADDRESS (2), // PhysicalStart
+BASE_DESCRIPTOR_VIRTUAL_START, // VirtualStart
+BASE_DESCRIPTOR_NUMBER_OF_PAGES,   // Number of Pages
+0  // Attribute
+  },
+  {
+EfiConventionalMemory, // Type
+BASE_DESCRIPTOR_START_ADDRESS (3), // PhysicalStart
+BASE_DESCRIPTOR_VIRTUAL_START, // VirtualStart
+BASE_DESCRIPTOR_NUMBER_OF_PAGES,   // Number of Pages
+0  // Attribute
+  },
+  {
+EfiConventionalMemory, // Type
+BASE_DESCRIPTOR_START_ADDRESS (4), // PhysicalStart
+BASE_DESCRIPTOR_VIRTUAL_START, // VirtualStart
+BASE_DESCRIPTOR_NUMBER_OF_PAGES,   // Number of Pages
+

[edk2-devel] [PATCH v5 09/16] MdeModulePkg: Fix MAT Descriptor Count Calculation

2023-11-27 Thread Taylor Beebe
|4K PAGE|DATA|CODE|DATA|CODE|DATA|4K PAGE|
Say the above memory region is currently one memory map descriptor.
The above image memory layout example contains two code sections
oriented in a way that maximizes the number of descriptors which
would be required to describe each section.

NOTE: It's unlikely that a data section would ever be between
two code sections, but it's still handled by the below formula
for correctness.

There are two code sections (let's say CodeSegmentMax == 2),
three data sections, and two unrelated memory regions flanking the
image. The number of required descriptors to describe this layout
will be 2 * 2 + 3 == 7. This patch updates the calculations to account
for the worst-case scenario.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Dandan Bi 
Signed-off-by: Taylor Beebe 
Reviewed-by: Liming Gao 
---
 MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c   | 2 +-
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c 
b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
index 51630f504ea1..af6c26244cc0 100644
--- a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
+++ b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
@@ -517,7 +517,7 @@ CoreGetMemoryMapWithSeparatedImageSection (
 
   CoreAcquiremMemoryAttributesTableLock ();
 
-  AdditionalRecordCount = (2 * mImagePropertiesPrivateData.CodeSegmentCountMax 
+ 1) * mImagePropertiesPrivateData.ImageRecordCount;
+  AdditionalRecordCount = (2 * mImagePropertiesPrivateData.CodeSegmentCountMax 
+ 3) * mImagePropertiesPrivateData.ImageRecordCount;
 
   OldMemoryMapSize = *MemoryMapSize;
   Status   = CoreGetMemoryMap (MemoryMapSize, MemoryMap, MapKey, 
DescriptorSize, DescriptorVersion);
diff --git 
a/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c 
b/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
index 9fb3b922038f..7c0ecd07c1bb 100644
--- a/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
+++ b/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
@@ -277,7 +277,7 @@ GetMaxSplitRecordCount (
   break;
 }
 
-SplitRecordCount += (2 * ImageRecord->CodeSegmentCount + 1);
+SplitRecordCount += (2 * ImageRecord->CodeSegmentCount + 3);
 PhysicalStart = ImageRecord->ImageBase + ImageRecord->ImageSize;
   } while ((ImageRecord != NULL) && (PhysicalStart < PhysicalEnd));
 
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111746): https://edk2.groups.io/g/devel/message/111746
Mute This Topic: https://groups.io/mt/102834916/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 06/16] MdeModulePkg: Update MemoryAttributesTable.c to Reduce Global Variable Use

2023-11-27 Thread Taylor Beebe
This patch updates MemoryAttributesTable.c to reduce reliance on global
variables and allow some logic to move to a library.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Dandan Bi 
Signed-off-by: Taylor Beebe 
Reviewed-by: Liming Gao 
---
 MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c | 102 +++-
 1 file changed, 54 insertions(+), 48 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c 
b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
index fd127ee167e1..64b0aa1ff5e5 100644
--- a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
+++ b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
@@ -541,8 +541,9 @@ EnforceMemoryMapAttribute (
 /**
   Return the first image record, whose [ImageBase, ImageSize] covered by 
[Buffer, Length].
 
-  @param Buffer  Start Address
-  @param Length  Address length
+  @param Buffer   Start Address
+  @param Length   Address length
+  @param ImageRecordList  Image record list
 
   @return first image record covered by [buffer, length]
 **/
@@ -550,14 +551,12 @@ STATIC
 IMAGE_PROPERTIES_RECORD *
 GetImageRecordByAddress (
   IN EFI_PHYSICAL_ADDRESS  Buffer,
-  IN UINT64Length
+  IN UINT64Length,
+  IN LIST_ENTRY*ImageRecordList
   )
 {
   IMAGE_PROPERTIES_RECORD  *ImageRecord;
   LIST_ENTRY   *ImageRecordLink;
-  LIST_ENTRY   *ImageRecordList;
-
-  ImageRecordList = 
 
   for (ImageRecordLink = ImageRecordList->ForwardLink;
ImageRecordLink != ImageRecordList;
@@ -692,7 +691,8 @@ SetNewRecord (
 STATIC
 UINTN
 GetMaxSplitRecordCount (
-  IN EFI_MEMORY_DESCRIPTOR  *OldRecord
+  IN EFI_MEMORY_DESCRIPTOR  *OldRecord,
+  IN LIST_ENTRY *ImageRecordList
   )
 {
   IMAGE_PROPERTIES_RECORD  *ImageRecord;
@@ -705,7 +705,7 @@ GetMaxSplitRecordCount (
   PhysicalEnd  = OldRecord->PhysicalStart + EfiPagesToSize 
(OldRecord->NumberOfPages);
 
   do {
-ImageRecord = GetImageRecordByAddress (PhysicalStart, PhysicalEnd - 
PhysicalStart);
+ImageRecord = GetImageRecordByAddress (PhysicalStart, PhysicalEnd - 
PhysicalStart, ImageRecordList);
 if (ImageRecord == NULL) {
   break;
 }
@@ -725,13 +725,16 @@ GetMaxSplitRecordCount (
   Split the memory map to new entries, according to one old entry,
   based upon PE code section and data section.
 
-  @param  OldRecord  A pointer to one old memory map entry.
-  @param  NewRecord  A pointer to several new memory map entries.
- The caller gurantee the buffer size be 1 +
- (SplitRecordCount * DescriptorSize) calculated
- below.
-  @param  MaxSplitRecordCountThe max number of splitted entries
-  @param  DescriptorSize Size, in bytes, of an individual 
EFI_MEMORY_DESCRIPTOR.
+  @paramOldRecord A pointer to one old memory map entry.
+  @paramNewRecord A pointer to several new memory map 
entries.
+  The caller gurantee the buffer size be 1 
+
+  (SplitRecordCount * DescriptorSize) 
calculated
+  below.
+  @paramMaxSplitRecordCount   The max number of splitted entries
+  @paramDescriptorSizeSize, in bytes, of an individual 
EFI_MEMORY_DESCRIPTOR.
+  @paramImageRecordList   A list of IMAGE_PROPERTIES_RECORD 
entries used when searching
+  for an image record contained by the 
memory range described in
+  the existing EFI memory map descriptor 
OldRecord
 
   @retval  0 no entry is splitted.
   @return  the real number of splitted record.
@@ -742,7 +745,8 @@ SplitRecord (
   IN EFI_MEMORY_DESCRIPTOR  *OldRecord,
   IN OUT EFI_MEMORY_DESCRIPTOR  *NewRecord,
   IN UINTN  MaxSplitRecordCount,
-  IN UINTN  DescriptorSize
+  IN UINTN  DescriptorSize,
+  IN LIST_ENTRY *ImageRecordList
   )
 {
   EFI_MEMORY_DESCRIPTORTempRecord;
@@ -770,7 +774,7 @@ SplitRecord (
 
   ImageRecord = NULL;
   do {
-NewImageRecord = GetImageRecordByAddress (PhysicalStart, PhysicalEnd - 
PhysicalStart);
+NewImageRecord = GetImageRecordByAddress (PhysicalStart, PhysicalEnd - 
PhysicalStart, ImageRecordList);
 if (NewImageRecord == NULL) {
   //
   // No more image covered by this range, stop
@@ -867,23 +871,29 @@ SplitRecord (
| Record Y  |
+---+
 
-  @param  MemoryMapSize  A pointer to the size, in bytes, of the
- MemoryMap buffer. On input, this is the size 
of
- old MemoryMap before split. The actual buffer
- size of MemoryMap is MemoryMapSize +
- (AdditionalRecordCount * 

[edk2-devel] [PATCH v5 04/16] OvmfPkg: Add ImagePropertiesRecordLib Instance

2023-11-27 Thread Taylor Beebe
Add an instance of ImagePropertiesRecordLib which will be used by the
DXE Core.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Gerd Hoffmann 
Signed-off-by: Taylor Beebe 
Reviewed-by: Michael D Kinney 
Acked-by: Jiewen Yao 
---
 OvmfPkg/AmdSev/AmdSevX64.dsc| 1 +
 OvmfPkg/Bhyve/BhyveX64.dsc  | 1 +
 OvmfPkg/CloudHv/CloudHvX64.dsc  | 1 +
 OvmfPkg/IntelTdx/IntelTdxX64.dsc| 1 +
 OvmfPkg/Microvm/MicrovmX64.dsc  | 1 +
 OvmfPkg/OvmfPkgIa32.dsc | 1 +
 OvmfPkg/OvmfPkgIa32X64.dsc  | 1 +
 OvmfPkg/OvmfPkgX64.dsc  | 1 +
 OvmfPkg/OvmfXen.dsc | 1 +
 OvmfPkg/RiscVVirt/RiscVVirtQemu.dsc | 1 +
 10 files changed, 10 insertions(+)

diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 302c90e7c2b4..3a1f788eb37f 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -171,6 +171,7 @@ [LibraryClasses]
   
MemEncryptTdxLib|OvmfPkg/Library/BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf
   PeiHardwareInfoLib|OvmfPkg/Library/HardwareInfoLib/PeiHardwareInfoLib.inf
   DxeHardwareInfoLib|OvmfPkg/Library/HardwareInfoLib/DxeHardwareInfoLib.inf
+  
ImagePropertiesRecordLib|MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   
PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 6693342c5f6e..8f0cd93a2d6c 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -173,6 +173,7 @@ [LibraryClasses]
   
MemEncryptTdxLib|OvmfPkg/Library/BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf
   PeiHardwareInfoLib|OvmfPkg/Library/HardwareInfoLib/PeiHardwareInfoLib.inf
   DxeHardwareInfoLib|OvmfPkg/Library/HardwareInfoLib/DxeHardwareInfoLib.inf
+  
ImagePropertiesRecordLib|MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
 
   
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
   
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc
index c23c7eaf6cc2..821ad1b9fab2 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.dsc
+++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
@@ -182,6 +182,7 @@ [LibraryClasses]
   MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf
   PeiHardwareInfoLib|OvmfPkg/Library/HardwareInfoLib/PeiHardwareInfoLib.inf
   DxeHardwareInfoLib|OvmfPkg/Library/HardwareInfoLib/DxeHardwareInfoLib.inf
+  
ImagePropertiesRecordLib|MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
 !if $(SMM_REQUIRE) == FALSE
   LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf
 !endif
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index 182ec3705dd3..0ed36daf7c44 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -171,6 +171,7 @@ [LibraryClasses]
   
MemEncryptTdxLib|OvmfPkg/Library/BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf
   PeiHardwareInfoLib|OvmfPkg/Library/HardwareInfoLib/PeiHardwareInfoLib.inf
   DxeHardwareInfoLib|OvmfPkg/Library/HardwareInfoLib/DxeHardwareInfoLib.inf
+  
ImagePropertiesRecordLib|MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
 
   LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf
   
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index ea1fa3e2963f..8817006f90c4 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -185,6 +185,7 @@ [LibraryClasses]
   
MemEncryptTdxLib|OvmfPkg/Library/BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf
   PeiHardwareInfoLib|OvmfPkg/Library/HardwareInfoLib/PeiHardwareInfoLib.inf
   DxeHardwareInfoLib|OvmfPkg/Library/HardwareInfoLib/DxeHardwareInfoLib.inf
+  
ImagePropertiesRecordLib|MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   
PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index ed3a19feebe6..bce2aedcd781 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -187,6 +187,7 @@ [LibraryClasses]
   
MemEncryptTdxLib|OvmfPkg/Library/BaseMemEncryptTdxLib/BaseMemEncryptTdxLibNull.inf
   PeiHardwareInfoLib|OvmfPkg/Library/HardwareInfoLib/PeiHardwareInfoLib.inf
   DxeHardwareInfoLib|OvmfPkg/Library/HardwareInfoLib/DxeHardwareInfoLib.inf
+  
ImagePropertiesRecordLib|MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
 !if $(SMM_REQUIRE) == FALSE
   LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 

[edk2-devel] [PATCH v5 03/16] EmulatorPkg: Add ImagePropertiesRecordLib Instance

2023-11-27 Thread Taylor Beebe
Add an instance of ImagePropertiesRecordLib which will be used by the
DXE Core.

Cc: Andrew Fish 
Cc: Ray Ni 
Signed-off-by: Taylor Beebe 
Reviewed-by: Michael D Kinney 
---
 EmulatorPkg/EmulatorPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc
index b14654739b54..85134b07816e 100644
--- a/EmulatorPkg/EmulatorPkg.dsc
+++ b/EmulatorPkg/EmulatorPkg.dsc
@@ -126,6 +126,7 @@ [LibraryClasses]
   SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
   ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
   FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+  
ImagePropertiesRecordLib|MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
 
 !if $(SECURE_BOOT_ENABLE) == TRUE
   RngLib|MdeModulePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111740): https://edk2.groups.io/g/devel/message/111740
Mute This Topic: https://groups.io/mt/102834908/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 00/16] Add ImagePropertiesRecordLib and Fix MAT Bugs​

2023-11-27 Thread Taylor Beebe
v5:
This version is purely an update of commit messages and orientation.
No code changes were made.
- Split patch 9 into 3 separate patches so each fix is in its own
  commit.
- Updated the commit comment of patch 11 to add context.

v4:
- Expose additional functions in the Library API
- Add NULL checks to library functions and return a
  status where applicable.

v3:
- Refactor patch series so the transition of logic from the DXE
  MAT logic to the new library is more clear.
- Update function headers to improve clarity and follow EDK2
  standards.
- Add Create and Delete functions for Image Properties Records
  and redirect some of the SMM and DXE MAT code to use these
  functions.
- Update/Add DumpImageRecords() to print the image name and code
  sections of each runtime image which will be put in the MAT.
  The DXE and SMM MAT logic will now invoke the DumpImageRecords()
  on DEBUG builds at the EndOfDxe event to install the MAT.

v2:
- A one-line change in patch 3 was moved to patch 9 for correctness.

Reference: https://github.com/tianocore/edk2/pull/4590
Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=4492

The UEFI and SMM MAT logic contains duplicate logic for manipulating image
properties records which is used to track runtime images.
This patch series adds a new library, ImagePropertiesRecordLib,
which consolidates this logic and fixes the bugs which currently exist in
the MAT logic.

The first patch adds the ImagePropertiesRecordLib implementation which
is a copy of the UEFI MAT logic with minor modifications to remove the
reliance on globabl variables and make the code unit testable.

The second patch adds a unit test for the ImagePropertiesRecordLib. The
logic tests various potential layouts of the EFI memory map and runtime
images. 3/4 of these tests will fail which demonstrates the MAT logic
bugs.

The third patch fixes the logic in the ImagePropertiesRecordLib so
that all of the unit tests pass and the MAT logic can be fixed by
using the library.

The remaining patches add library instances to DSC files and remove
the image properties record logic from the SMM and UEFI MAT logic.

Cc: Andrew Fish 
Cc: Ard Biesheuvel 
Cc: Dandan Bi 
Cc: Eric Dong 
Cc: Gerd Hoffmann 
Cc: Guo Dong 
Cc: Gua Guo 
Cc: James Lu 
Cc: Jian J Wang 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Leif Lindholm 
Cc: Liming Gao 
Cc: Rahul Kumar 
Cc: Ray Ni 
Cc: Sami Mujawar 
Cc: Sean Rhodes 
Cc: Lazlo Ersek 

Taylor Beebe (16):
  MdeModulePkg: Add ImagePropertiesRecordLib
  ArmVirtPkg: Add ImagePropertiesRecordLib Instance
  EmulatorPkg: Add ImagePropertiesRecordLib Instance
  OvmfPkg: Add ImagePropertiesRecordLib Instance
  UefiPayloadPkg: Add ImagePropertiesRecordLib Instance
  MdeModulePkg: Update MemoryAttributesTable.c to Reduce Global Variable
Use
  MdeModulePkg: Move Some DXE MAT Logic to ImagePropertiesRecordLib
  MdeModulePkg: Add ImagePropertiesRecordLib Host-Based Unit Test
  MdeModulePkg: Fix MAT Descriptor Count Calculation
  MdeModulePkg: Fix MAT SplitRecord() Logic
  MdeModulePkg: Fix MAT SplitTable() Logic
  MdeModulePkg: Add NULL checks and Return Status to
ImagePropertiesRecordLib
  UefiCpuPkg: Use Attribute From SMM MemoryAttributesTable if Nonzero
  MdeModulePkg: Transition SMM MAT Logic to Use ImagePropertiesRecordLib
  MdeModulePkg: Add Logic to Create/Delete Image Properties Records
  MdeModulePkg: Update DumpImageRecord() in ImagePropertiesRecordLib

 MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c 
 |  967 +
 MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c  
 |   24 +-
 MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
 |  958 +---
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c   
 | 1144 
 
MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTest/ImagePropertiesRecordLibUnitTestHost.c
   |  938 
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c 
 |   19 +-
 ArmVirtPkg/ArmVirt.dsc.inc 
 |1 +
 EmulatorPkg/EmulatorPkg.dsc
 |1 +
 MdeModulePkg/Core/Dxe/DxeMain.h
 |   20 -
 MdeModulePkg/Core/Dxe/DxeMain.inf  
 |1 +
 MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf  
 |1 +
 MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h
 |  234 
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf 
 |   31 +
 
MdeModulePkg/Library/ImagePropertiesRecordLib/UnitTest/ImagePropertiesRecordLibUnitTestHost.inf
 |   35 

[edk2-devel] [PATCH v5 01/16] MdeModulePkg: Add ImagePropertiesRecordLib

2023-11-27 Thread Taylor Beebe
Create a library for manipulating image properties records. The
library is currently blank and will be filled in a future patch
to help with reviewer readability.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Dandan Bi 
Signed-off-by: Taylor Beebe 
Reviewed-by: Liming Gao 
---
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c   |  
9 +++
 MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h| 
14 +++
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf | 
25 
 MdeModulePkg/MdeModulePkg.dec  |  
5 
 MdeModulePkg/MdeModulePkg.dsc  |  
2 ++
 5 files changed, 55 insertions(+)

diff --git 
a/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c 
b/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
new file mode 100644
index ..df7c54ebb793
--- /dev/null
+++ b/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
@@ -0,0 +1,9 @@
+/** @file
+
+  Provides definitions and functionality for manipulating 
IMAGE_PROPERTIES_RECORD.
+
+  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) Microsoft Corporation.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
diff --git a/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h 
b/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h
new file mode 100644
index ..728008a2e5bb
--- /dev/null
+++ b/MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h
@@ -0,0 +1,14 @@
+/** @file
+
+  Provides definitions and functionality for manipulating 
IMAGE_PROPERTIES_RECORD.
+
+  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) Microsoft Corporation.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef IMAGE_PROPERTIES_RECORD_SUPPORT_LIB_H_
+#define IMAGE_PROPERTIES_RECORD_SUPPORT_LIB_H_
+
+#endif
diff --git 
a/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf 
b/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
new file mode 100644
index ..b7e493056889
--- /dev/null
+++ b/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
@@ -0,0 +1,25 @@
+## @file
+#  Provides definitions and functionality for manipulating
+#  IMAGE_PROPERTIES_RECORD.
+#
+#  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
+#  Copyright (c) Microsoft Corporation.
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = ImagePropertiesRecordLib
+  FILE_GUID  = 5CCA36C1-C430-4A90-8BF7-23D2719D5928
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = ImagePropertiesRecordLib
+
+[Sources.common]
+  ImagePropertiesRecordLib.c
+
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index d2fede4f87c0..1a162e97e6fb 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -164,6 +164,11 @@ [LibraryClasses]
   #
   VariableFlashInfoLib|Include/Library/VariableFlashInfoLib.h
 
+  ##  @libraryclass   Memory Attribute Table support logic for tracking and 
reporting
+  #   runtime images
+  #
+  ImagePropertiesRecordLib|Include/Library/ImagePropertiesRecordLib.h
+
 [Guids]
   ## MdeModule package token space guid
   # Include/Guid/MdeModulePkgTokenSpace.h
diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc
index c7af921782ee..6b3052ff4614 100644
--- a/MdeModulePkg/MdeModulePkg.dsc
+++ b/MdeModulePkg/MdeModulePkg.dsc
@@ -96,6 +96,7 @@ [LibraryClasses]
   VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
   
NonDiscoverableDeviceRegistrationLib|MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.inf
+  
ImagePropertiesRecordLib|MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
 
   
FmpAuthenticationLib|MdeModulePkg/Library/FmpAuthenticationLibNull/FmpAuthenticationLibNull.inf
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
@@ -237,6 +238,7 @@ [Components]
   MdeModulePkg/Library/BaseHobLibNull/BaseHobLibNull.inf
   
MdeModulePkg/Library/BaseMemoryAllocationLibNull/BaseMemoryAllocationLibNull.inf
   MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
+  MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
 
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
   MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this 

[edk2-devel] [PATCH v5 02/16] ArmVirtPkg: Add ImagePropertiesRecordLib Instance

2023-11-27 Thread Taylor Beebe
Add an instance of ImagePropertiesRecordLib which will be used by the
DXE Core.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Sami Mujawar 
Cc: Gerd Hoffmann 
Signed-off-by: Taylor Beebe 
Reviewed-by: Michael D Kinney 
---
 ArmVirtPkg/ArmVirt.dsc.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index fe6488ee9910..6bc72f1decbd 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -52,6 +52,7 @@ [LibraryClasses.common]
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicArmVirt.inf
   
UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
   CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+  
ImagePropertiesRecordLib|MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
 
   UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
   HobLib|ArmVirtPkg/Library/ArmVirtDxeHobLib/ArmVirtDxeHobLib.inf
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111739): https://edk2.groups.io/g/devel/message/111739
Mute This Topic: https://groups.io/mt/102834907/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 07/16] MdeModulePkg: Move Some DXE MAT Logic to ImagePropertiesRecordLib

2023-11-27 Thread Taylor Beebe
Move some DXE MAT logic to ImagePropertiesRecordLib to consolidate
code and enable unit testability.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Dandan Bi 
Signed-off-by: Taylor Beebe 
Reviewed-by: Liming Gao 
---
 MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c | 
774 +---
 MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c  |  
24 +-
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c   | 
770 +++
 MdeModulePkg/Core/Dxe/DxeMain.h|  
20 -
 MdeModulePkg/Core/Dxe/DxeMain.inf  |   
1 +
 MdeModulePkg/Include/Library/ImagePropertiesRecordLib.h| 
159 
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf |   
4 +
 7 files changed, 947 insertions(+), 805 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c 
b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
index 64b0aa1ff5e5..51630f504ea1 100644
--- a/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
+++ b/MdeModulePkg/Core/Dxe/Misc/MemoryAttributesTable.c
@@ -14,6 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -333,45 +334,6 @@ CoreInitializeMemoryAttributesTable (
 // Below functions are for MemoryMap
 //
 
-/**
-  Converts a number of EFI_PAGEs to a size in bytes.
-
-  NOTE: Do not use EFI_PAGES_TO_SIZE because it handles UINTN only.
-
-  @param  Pages The number of EFI_PAGES.
-
-  @return  The number of bytes associated with the number of EFI_PAGEs 
specified
-   by Pages.
-**/
-STATIC
-UINT64
-EfiPagesToSize (
-  IN UINT64  Pages
-  )
-{
-  return LShiftU64 (Pages, EFI_PAGE_SHIFT);
-}
-
-/**
-  Converts a size, in bytes, to a number of EFI_PAGESs.
-
-  NOTE: Do not use EFI_SIZE_TO_PAGES because it handles UINTN only.
-
-  @param  Size  A size in bytes.
-
-  @return  The number of EFI_PAGESs associated with the number of bytes 
specified
-   by Size.
-
-**/
-STATIC
-UINT64
-EfiSizeToPages (
-  IN UINT64  Size
-  )
-{
-  return RShiftU64 (Size, EFI_PAGE_SHIFT) + UINTN)Size) & EFI_PAGE_MASK) ? 
1 : 0);
-}
-
 /**
   Acquire memory lock on mMemoryAttributesTableLock.
 **/
@@ -396,48 +358,6 @@ CoreReleasemMemoryAttributesTableLock (
   CoreReleaseLock ();
 }
 
-/**
-  Sort memory map entries based upon PhysicalStart, from low to high.
-
-  @param  MemoryMap  A pointer to the buffer in which firmware 
places
- the current memory map.
-  @param  MemoryMapSize  Size, in bytes, of the MemoryMap buffer.
-  @param  DescriptorSize Size, in bytes, of an individual 
EFI_MEMORY_DESCRIPTOR.
-**/
-STATIC
-VOID
-SortMemoryMap (
-  IN OUT EFI_MEMORY_DESCRIPTOR  *MemoryMap,
-  IN UINTN  MemoryMapSize,
-  IN UINTN  DescriptorSize
-  )
-{
-  EFI_MEMORY_DESCRIPTOR  *MemoryMapEntry;
-  EFI_MEMORY_DESCRIPTOR  *NextMemoryMapEntry;
-  EFI_MEMORY_DESCRIPTOR  *MemoryMapEnd;
-  EFI_MEMORY_DESCRIPTOR  TempMemoryMap;
-
-  MemoryMapEntry = MemoryMap;
-  NextMemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (MemoryMapEntry, DescriptorSize);
-  MemoryMapEnd   = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)MemoryMap + 
MemoryMapSize);
-  while (MemoryMapEntry < MemoryMapEnd) {
-while (NextMemoryMapEntry < MemoryMapEnd) {
-  if (MemoryMapEntry->PhysicalStart > NextMemoryMapEntry->PhysicalStart) {
-CopyMem (, MemoryMapEntry, sizeof 
(EFI_MEMORY_DESCRIPTOR));
-CopyMem (MemoryMapEntry, NextMemoryMapEntry, sizeof 
(EFI_MEMORY_DESCRIPTOR));
-CopyMem (NextMemoryMapEntry, , sizeof 
(EFI_MEMORY_DESCRIPTOR));
-  }
-
-  NextMemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (NextMemoryMapEntry, 
DescriptorSize);
-}
-
-MemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (MemoryMapEntry, 
DescriptorSize);
-NextMemoryMapEntry = NEXT_MEMORY_DESCRIPTOR (MemoryMapEntry, 
DescriptorSize);
-  }
-
-  return;
-}
-
 /**
   Merge continous memory map entries whose have same attributes.
 
@@ -471,7 +391,7 @@ MergeMemoryMap (
 
 do {
   MergeGuardPages (NewMemoryMapEntry, NextMemoryMapEntry->PhysicalStart);
-  MemoryBlockLength = (UINT64)(EfiPagesToSize 
(NewMemoryMapEntry->NumberOfPages));
+  MemoryBlockLength = LShiftU64 (NewMemoryMapEntry->NumberOfPages, 
EFI_PAGE_SHIFT);
   if (((UINTN)NextMemoryMapEntry < (UINTN)MemoryMapEnd) &&
   (NewMemoryMapEntry->Type == NextMemoryMapEntry->Type) &&
   (NewMemoryMapEntry->Attribute == NextMemoryMapEntry->Attribute) &&
@@ -538,434 +458,6 @@ EnforceMemoryMapAttribute (
   return;
 }
 
-/**
-  Return the first image record, whose [ImageBase, ImageSize] covered by 
[Buffer, Length].
-
-  @param Buffer   Start Address
-  @param Length   Address length
-  @param ImageRecordList  Image record list
-
-  @return first image record covered by [buffer, length]
-**/

[edk2-devel] [PATCH v5 10/16] MdeModulePkg: Fix MAT SplitRecord() Logic

2023-11-27 Thread Taylor Beebe
SplitRecord() does not handle the case where a memory descriptor
describes an image region plus extra pages before or after the
image region. This patch fixes this case by carving off the
unrelated regions into their own descriptors.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Dandan Bi 
Signed-off-by: Taylor Beebe 
Reviewed-by: Liming Gao 
---
 MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c | 56 
++--
 1 file changed, 27 insertions(+), 29 deletions(-)

diff --git 
a/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c 
b/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
index 7c0ecd07c1bb..9d4082280bf5 100644
--- a/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
+++ b/MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.c
@@ -323,7 +323,6 @@ SplitRecord (
   UINT64   PhysicalEnd;
   UINTNNewRecordCount;
   UINTNTotalNewRecordCount;
-  BOOLEAN  IsLastRecordData;
 
   if (MaxSplitRecordCount == 0) {
 CopyMem (NewRecord, OldRecord, DescriptorSize);
@@ -344,35 +343,16 @@ SplitRecord (
 NewImageRecord = GetImageRecordByAddress (PhysicalStart, PhysicalEnd - 
PhysicalStart, ImageRecordList);
 if (NewImageRecord == NULL) {
   //
-  // No more image covered by this range, stop
+  // No more images cover this range, check if we've reached the end of 
the old descriptor. If not,
+  // add the remaining range to the new descriptor list.
   //
-  if ((PhysicalEnd > PhysicalStart) && (ImageRecord != NULL)) {
-//
-// If this is still address in this record, need record.
-//
-NewRecord= PREVIOUS_MEMORY_DESCRIPTOR (NewRecord, 
DescriptorSize);
-IsLastRecordData = FALSE;
-if ((NewRecord->Attribute & EFI_MEMORY_XP) != 0) {
-  IsLastRecordData = TRUE;
-}
-
-if (IsLastRecordData) {
-  //
-  // Last record is DATA, just merge it.
-  //
-  NewRecord->NumberOfPages = EfiSizeToPages (PhysicalEnd - 
NewRecord->PhysicalStart);
-} else {
-  //
-  // Last record is CODE, create a new DATA entry.
-  //
-  NewRecord= NEXT_MEMORY_DESCRIPTOR (NewRecord, 
DescriptorSize);
-  NewRecord->Type  = TempRecord.Type;
-  NewRecord->PhysicalStart = TempRecord.PhysicalStart;
-  NewRecord->VirtualStart  = 0;
-  NewRecord->NumberOfPages = TempRecord.NumberOfPages;
-  NewRecord->Attribute = TempRecord.Attribute | EFI_MEMORY_XP;
-  TotalNewRecordCount++;
-}
+  if (PhysicalEnd > PhysicalStart) {
+NewRecord->Type  = TempRecord.Type;
+NewRecord->PhysicalStart = PhysicalStart;
+NewRecord->VirtualStart  = 0;
+NewRecord->NumberOfPages = EfiSizeToPages (PhysicalEnd - 
PhysicalStart);
+NewRecord->Attribute = TempRecord.Attribute;
+TotalNewRecordCount++;
   }
 
   break;
@@ -380,6 +360,24 @@ SplitRecord (
 
 ImageRecord = NewImageRecord;
 
+//
+// Update PhysicalStart to exclude the portion before the image buffer
+//
+if (TempRecord.PhysicalStart < ImageRecord->ImageBase) {
+  NewRecord->Type  = TempRecord.Type;
+  NewRecord->PhysicalStart = TempRecord.PhysicalStart;
+  NewRecord->VirtualStart  = 0;
+  NewRecord->NumberOfPages = EfiSizeToPages (ImageRecord->ImageBase - 
TempRecord.PhysicalStart);
+  NewRecord->Attribute = TempRecord.Attribute;
+  TotalNewRecordCount++;
+
+  PhysicalStart= ImageRecord->ImageBase;
+  TempRecord.PhysicalStart = PhysicalStart;
+  TempRecord.NumberOfPages = EfiSizeToPages (PhysicalEnd - PhysicalStart);
+
+  NewRecord = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)NewRecord + 
DescriptorSize);
+}
+
 //
 // Set new record
 //
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111747): https://edk2.groups.io/g/devel/message/111747
Mute This Topic: https://groups.io/mt/102834917/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v5 05/16] UefiPayloadPkg: Add ImagePropertiesRecordLib Instance

2023-11-27 Thread Taylor Beebe
Add an instance of ImagePropertiesRecordLib which will be used by the
DXE Core.

Cc: Guo Dong 
Cc: Sean Rhodes 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Taylor Beebe 
Reviewed-by: Michael D Kinney 
Reviewed-by: Gua Guo 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index af9308ef8ed7..a65f9d5b831a 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -284,6 +284,7 @@ [LibraryClasses]
   #
   
DebugPrintErrorLevelLib|UefiPayloadPkg/Library/DebugPrintErrorLevelLibHob/DebugPrintErrorLevelLibHob.inf
   
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
+  
ImagePropertiesRecordLib|MdeModulePkg/Library/ImagePropertiesRecordLib/ImagePropertiesRecordLib.inf
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   
PeCoffExtraActionLib|SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
   
DebugCommunicationLib|SourceLevelDebugPkg/Library/DebugCommunicationLibSerialPort/DebugCommunicationLibSerialPort.inf
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111742): https://edk2.groups.io/g/devel/message/111742
Mute This Topic: https://groups.io/mt/102834912/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] BaseTools KeyError When Building EmulatorPkg

2023-11-27 Thread Sean

We are looking at it.

It seems to be a problem in the edk2-basetools but at this point it 
still isn't obvious.


You can do a 'pip uninstall edk2-basetools' and then I would expect your 
build would work.


I also see that you didn't build edk2 basetools (step 6) documented 
here: edk2/EmulatorPkg/PlatformCI at master · tianocore/edk2 
(github.com) 
.  
Without doing that your build will fail as well.



The CI system is building fine so we are still looking into it.

I'll update the thread when we have more info.


Thanks

Sean



On 11/21/2023 8:22 AM, Laszlo Ersek wrote:

Adding Sean

Laszlo

On 11/19/23 23:43, ryderkeys via groups.io wrote:

Hi all,

I am trying to build EDK2 from most recent Github (namely, EmulatorPkg) with 
the new Stuart build system on Windows 10 22H2 64 bit with VS 2019. I'm getting 
the following error which directed me to this mailing list. More details on my 
build process below.

INFO - build.py...
INFO -  : error C0DE: Unknown fatal error when processing 
[c:\users\ryder\edk2_2023\edk2\EmulatorPkg\EmulatorPkg.dsc]
INFO -
INFO - (Please send email tode...@edk2.groups.io  for help, attaching following 
call stack trace!)
INFO -
INFO - (Python 3.11.5 on win32) Traceback (most recent call last):
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\BaseTools\Source\Python\build\build.py", line 
2692, in Main
INFO - MyBuild = Build(Target, Workspace, Option,LogQ)
INFO -   ^
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\BaseTools\Source\Python\build\build.py", line 
815, in __init__
INFO - self.InitPreBuild()
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\BaseTools\Source\Python\build\build.py", line 
1015, in InitPreBuild
INFO - self.LoadConfiguration()
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\BaseTools\Source\Python\build\build.py", line 
971, in LoadConfiguration
INFO - self.GetToolChainAndFamilyFromDsc (self.PlatformFile)
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\BaseTools\Source\Python\build\build.py", line 
905, in GetToolChainAndFamilyFromDsc
INFO - dscobj = self.BuildDatabase[File, BuildArch]
INFO -  ~~^
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\WorkspaceDatabase.py",
 line 104, in __getitem__
INFO - BuildObject = self.CreateBuildObject(FilePath, Arch, Target, 
Toolchain)
INFO -   
^
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\WorkspaceDatabase.py",
 line 125, in CreateBuildObject
INFO - BuildObject = self._GENERATOR_[FileType](
INFO -   ^^^
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\DscBuildData.py",
 line 231, in __init__
INFO - self.SkuIdMgr = SkuClass(self.SkuName, self.SkuIds)
INFO -  
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\DscBuildData.py",
 line 510, in SkuName
INFO - self._GetHeaderInfo()
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\DscBuildData.py",
 line 310, in _GetHeaderInfo
INFO - RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch]
INFO -  ~
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\MetaFileParser.py",
 line 250, in __getitem__
INFO - self._PostProcess()
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\MetaFileParser.py",
 line 1429, in _PostProcess
INFO - Processer[self._ItemType]()
INFO -   File 
"C:\Users\ryder\edk2_2023\edk2\.venv\Lib\site-packages\edk2basetools\Workspace\MetaFileParser.py",
 line 1609, in __ProcessDirective
INFO - __IncludeMacros['WORKSPACE'] = GlobalData.gGlobalDefines['WORKSPACE']
INFO -~^
INFO - KeyError: 'WORKSPACE'

I followed the directions 
on  
and. Are these 
the correct set of instructions to follow? If so, I entered the following commands and 
received the error above.

git clonehttps://github.com/tianocore/edk2.git
cd edk2
python -m venv .venv
.\.venv\Scripts\Activate.ps1
stuart_setup -c EmulatorPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=VS2019 
-a X64
stuart_update -c EmulatorPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=VS2019 
-a X64
stuart_build -c EmulatorPkg/PlatformCI/PlatformBuild.py TOOL_CHAIN_TAG=VS2019 
-a X64

A quick couple of print statements in the python code of basetools reveal that 
gGlobalDefines is an 

Re: [edk2-devel] [PATCH 1/1] StandaloneMmPkg/Core: Restart dispatcher once MmEntryPoint is registered

2023-11-27 Thread Wu, Jiaxin
>  //
>  MM_CORE_MMI_HANDLERS  mMmCoreMmiHandlers[] = {
> +  { MmDriverDispatchHandler,  , NULL,
> TRUE  },


Should we need define a new HandlerType name instead of using the 
gEfiEventDxeDispatchGuid?

 We just need a simple MM Dispatch Event, which is trigged by IPL to dispatch 
again after StandaloneMmCore returns. Not depends on dxe dispatch event.

And besides, should we update & correct the below code comments?

///
/// Define values for the communications buffer used when 
gEfiEventDxeDispatchGuid is
/// event signaled.  This event is signaled by the DXE Core each time the DXE 
Core
/// dispatcher has completed its work.  When this event is signaled, the MM Core
/// if notified, so the MM Core can dispatch MM drivers.  If 
COMM_BUFFER_MM_DISPATCH_ERROR
/// is returned in the communication buffer, then an error occurred dispatching 
MM
/// Drivers.  If COMM_BUFFER_MM_DISPATCH_SUCCESS is returned, then the MM Core
/// dispatched all the drivers it could.  If COMM_BUFFER_MM_DISPATCH_RESTART is
/// returned, then the MM Core just dispatched the MM Driver that registered
/// the MM Entry Point enabling the use of MM Mode.  In this case, the MM Core
/// should be notified again to dispatch more MM Drivers using MM Mode.
///
#define COMM_BUFFER_MM_DISPATCH_ERROR0x00
#define COMM_BUFFER_MM_DISPATCH_SUCCESS  0x01
#define COMM_BUFFER_MM_DISPATCH_RESTART  0x02 



Thanks,
Jiaxin 



>{ MmReadyToLockHandler, , NULL,
> TRUE  },
>{ MmEndOfDxeHandler,,   NULL,
> FALSE },
>{ MmExitBootServiceHandler, ,NULL,
> FALSE },
> diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.inf
> b/StandaloneMmPkg/Core/StandaloneMmCore.inf
> index c44b9ff33303..845fed831c47 100644
> --- a/StandaloneMmPkg/Core/StandaloneMmCore.inf
> +++ b/StandaloneMmPkg/Core/StandaloneMmCore.inf
> @@ -76,6 +76,9 @@ [Guids]
>gEfiEventExitBootServicesGuid
>gEfiEventReadyToBootGuid
> 
> +[Pcd]
> +
> gStandaloneMmPkgTokenSpaceGuid.PcdRestartMmDispatcherOnceMmEntry
> Registered
> +
>  #
>  # This configuration fails for CLANGPDB, which does not support PIE in the
> GCC
>  # sense. Such however is required for ARM family StandaloneMmCore
> diff --git a/StandaloneMmPkg/StandaloneMmPkg.dec
> b/StandaloneMmPkg/StandaloneMmPkg.dec
> index 46784d94e421..bb4d1520f7d9 100644
> --- a/StandaloneMmPkg/StandaloneMmPkg.dec
> +++ b/StandaloneMmPkg/StandaloneMmPkg.dec
> @@ -48,3 +48,9 @@ [Guids]
>gEfiStandaloneMmNonSecureBufferGuid  = { 0xf00497e3, 0xbfa2, 0x41a1,
> { 0x9d, 0x29, 0x54, 0xc2, 0xe9, 0x37, 0x21, 0xc5 }}
>gEfiArmTfCpuDriverEpDescriptorGuid   = { 0x6ecbd5a1, 0xc0f8, 0x4702,
> { 0x83, 0x01, 0x4f, 0xc2, 0xc5, 0x47, 0x0a, 0x51 }}
> 
> +[PcdsFeatureFlag]
> +  ## Indicates if restart MM Dispatcher once MM Entry Point is
> registered.
> +  #   TRUE  - Restart MM Dispatcher once MM Entry Point is registered.
> +  #   FALSE - Do not restart MM Dispatcher once MM Entry Point is
> registered.
> +  # @Prompt Restart MM Dispatcher once MM Entry Point is registered.
> +
> gStandaloneMmPkgTokenSpaceGuid.PcdRestartMmDispatcherOnceMmEntry
> Registered|FALSE|BOOLEAN|0x0001
> --
> 2.29.2.windows.2
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111735): https://edk2.groups.io/g/devel/message/111735
Mute This Topic: https://groups.io/mt/102703852/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 0/2] Remove string IO instruction in BaseIoLibIntrinsic.inf

2023-11-27 Thread duntan
Hi Mike and Liming,

Could you help to review this patch set? It's to remove string IO instruction 
in BaseIoLibIntrinsic and simplify BaseIoLibIntrinsic.

Thanks,
Dun

-Original Message-
From: Laszlo Ersek  
Sent: Monday, November 13, 2023 9:08 PM
To: devel@edk2.groups.io; Ni, Ray ; Tan, Dun 

Subject: Re: [edk2-devel] [PATCH 0/2] Remove string IO instruction in 
BaseIoLibIntrinsic.inf

On 11/9/23 06:56, Ni, Ray wrote:
> Reviewed-by: Ray Ni 
> 
> Thanks for providing the alternative solution that avoids impacting 
> OVMF boot performance.

This approach looks good to me.

The IA32 and X64 OVMF platforms use "BaseIoLibIntrinsicSev.inf", and that 
library instance is left alone.

The RISC-V OVMF platform uses "BaseIoLibIntrinsic.inf", but RISC-V already 
doesn't (can't) use the IA32/X64 NASM files.

So, surprisingly, the "IoFifo.nasm" files are actually unused, pre-patch; IA32 
and X64 OVMF only uses the "IoFifoSev.nasm" files.

Acked-by: Laszlo Ersek 

Thanks!
Laszlo




> 
> Thanks,
> Ray
> --
> --
> *From:* devel@edk2.groups.io  on behalf of 
> duntan 
> *Sent:* Thursday, November 9, 2023 10:49 AM
> *To:* devel@edk2.groups.io 
> *Subject:* [edk2-devel] [PATCH 0/2] Remove string IO instruction in 
> BaseIoLibIntrinsic.inf
>  
> Simplify IoRead/WriteFifo implement in BaseIoLibIntrinsic by 
> repeatedly calling IoRead/Write in C code. This can avoid calling 
> assembly code to use string I/O instructions.
> With this change, Ia32/IoFifo.nasm and X64/IoFifo.nasm can be removed. 
> Also source files for IA32 and X64 are the same.
> 
> Dun Tan (2):
>   MdePkg: Change IoLibFifo.c to IoLibFifoCc.c
>   MdePkg:simplify Fifo API in BaseIoLibIntrinsic
> 
>  MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf    |  10
> ++
>  MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf |   2 +-
>  MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm  | 131
> --
> -
>  MdePkg/Library/BaseIoLibIntrinsic/IoLibFifo.c   |  59
> +++
>  MdePkg/Library/BaseIoLibIntrinsic/IoLibFifoCc.c | 217
> +
>  MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm   | 120
> --
> --
>  6 files changed, 251 insertions(+), 288 deletions(-)
>  delete mode 100644 MdePkg/Library/BaseIoLibIntrinsic/Ia32/IoFifo.nasm
>  create mode 100644 MdePkg/Library/BaseIoLibIntrinsic/IoLibFifoCc.c
>  delete mode 100644 MdePkg/Library/BaseIoLibIntrinsic/X64/IoFifo.nasm
> 
> --
> 2.31.1.windows.1
> 
> 
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111734): https://edk2.groups.io/g/devel/message/111734
Mute This Topic: https://groups.io/mt/102478994/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH] NetworkPkg: Triger timely scan only if not connect to AP

2023-11-27 Thread Heng Luo
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4605

When UEFI Wi-Fi is in BSS connected state, the platform is
considered as a static and Wi-Fi roaming support is not needed.
Wifi connection manager should not initiate Scan requests
in this state affect BSS client connectivity and must be avoided.
Triger timely scan only if not connect to AP.

Signed-off-by: Heng Luo 
Cc: Saloni Kasbekar 
Cc: Zachary Clark-williams 
---
 NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c 
b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c
index d1182e52bd..4c5460b65c 100644
--- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c
+++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c
@@ -1506,8 +1506,8 @@ WifiMgrOnTimerTick (
   }
 
   Nic->ScanTickTime++;
-  if (((Nic->ScanTickTime > WIFI_SCAN_FREQUENCY) || Nic->OneTimeScanRequest) &&
-  (Nic->ScanState == WifiMgrScanFinished))
+  if Nic->ScanTickTime > WIFI_SCAN_FREQUENCY) && (Nic->ConnectState != 
WifiMgrConnectedToAp)) ||
+   Nic->OneTimeScanRequest) && (Nic->ScanState == WifiMgrScanFinished))
   {
 Nic->OneTimeScanRequest = FALSE;
 Nic->ScanTickTime   = 0;
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111733): https://edk2.groups.io/g/devel/message/111733
Mute This Topic: https://groups.io/mt/102825661/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v3 03/11] MdePkg/Acpi65: Add _PSD/_CPC/State Coordination Types macros

2023-11-27 Thread PierreGondois

Hello Ray,
Is the patch acceptable as it is ? Or is there something to modify
before I send a new version ?

Regards,
Pierre

On 11/22/23 08:54, Pierre Gondois wrote:

Hello Ray,

On 11/22/23 01:03, Ni, Ray wrote:

These ACPI methods were there since long ago.
Why do you only add the related definitions to 65.h?


I have only added the definitions to the latest ACPI definition file
(i.e. 6.5) because:
- as it was not defined before, I assumed it was not used previously
in edk2 and definitions for older ACPI spec versions might not be
necessary (i.e. no need to use EFI_ACPI_6_4_xxx definition if
EFI_ACPI_6_5_xxx is available)
- this present patch-set only requires the latest definitions

Do you want to have definitions for all spec. versions ?




Cf. s8.3 Power, Performance, and Throttling State Dependencies


What does "Cf. s8.3" mean?


I used s8.3 for 'section 8.3' (in the ACPI 6.5 spec),



Thanks,
Ray

-Original Message-
From: devel@edk2.groups.io  On Behalf Of
PierreGondois
Sent: Wednesday, November 22, 2023 12:50 AM
To: devel@edk2.groups.io
Cc: Ard Biesheuvel ; Leif Lindholm
; Sami Mujawar ;
Kinney, Michael D ; Gao, Liming

Subject: [edk2-devel] [PATCH v3 03/11] MdePkg/Acpi65: Add
_PSD/_CPC/State Coordination Types macros

Add macros for:
- _PSD version
- _CPC version
- C-state/T-state/P-state Coordination Types

These objects were present in previous ACPI specification version,
but are only added to the latest availbable version (6.5).

Signed-off-by: Pierre Gondois 
---
   MdePkg/Include/IndustryStandard/Acpi65.h | 23
+++
   1 file changed, 23 insertions(+)

diff --git a/MdePkg/Include/IndustryStandard/Acpi65.h
b/MdePkg/Include/IndustryStandard/Acpi65.h
index d79d0b2b5f9c..ec7c34e8e190 100644
--- a/MdePkg/Include/IndustryStandard/Acpi65.h
+++ b/MdePkg/Include/IndustryStandard/Acpi65.h
@@ -18,6 +18,29 @@
   //

   #pragma pack(1)



+///

+/// C-state/T-state/P-state Coordination Types

+/// Cf. s8.3 Power, Performance, and Throttling State Dependencies

+///

+#define EFI_ACPI_6_5_AML_STATE_COORD_TYPE_SW_ALL  0xFC

+#define EFI_ACPI_6_5_AML_STATE_COORD_TYPE_SW_ANY  0xFD

+#define EFI_ACPI_6_5_AML_STATE_COORD_TYPE_HW_ALL  0xFE

+

+///

+/// _PSD Revision

+/// Cf. s8.4.5.5 _PSD (P-State Dependency)

+///

+#define EFI_ACPI_6_5_AML_PSD_REVISION_V0  0

+

+///

+/// _CPC Revision

+/// Cf. s8.4.6.1 _CPC (Continuous Performance Control)

+///

+#define EFI_ACPI_6_5_AML_CPC_REVISION_V0  0

+#define EFI_ACPI_6_5_AML_CPC_REVISION_V1  1

+#define EFI_ACPI_6_5_AML_CPC_REVISION_V2  2

+#define EFI_ACPI_6_5_AML_CPC_REVISION_V3  3


Also a personal note, I realize this doesn't really make sense to define
versions like this, as there is only one revision for ACPI 6.5. This should
be instead:

#define EFI_ACPI_6_5_AML_CPC_REVISION  3

(same comment for EFI_ACPI_6_5_AML_PSD_REVISION_V0 above)

Regards,
Pierre



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111732): https://edk2.groups.io/g/devel/message/111732
Mute This Topic: https://groups.io/mt/102732018/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 3/3] UefiCpuPkg/CpuMpPei: Use CpuPageTableLib to set memory attribute.

2023-11-27 Thread Zhiguang Liu
Currently, there are code to set memory attribute in CpuMpPei module.
However, the code doesn't handle the case of 5 level paging.
Use the CpuPageTableLib to set memory attribute for two purpose:
1. Add 5 level paging support
2. Clean up code

Cc: Ray Ni 
Cc: Rahul Kumar 
Cc: Gerd Hoffmann 
Cc: Laszlo Ersek 
Signed-off-by: Zhiguang Liu 
---
 UefiCpuPkg/CpuMpPei/CpuPaging.c | 317 +++-
 1 file changed, 69 insertions(+), 248 deletions(-)

diff --git a/UefiCpuPkg/CpuMpPei/CpuPaging.c b/UefiCpuPkg/CpuMpPei/CpuPaging.c
index b7ddb0005b..2dd7237141 100644
--- a/UefiCpuPkg/CpuMpPei/CpuPaging.c
+++ b/UefiCpuPkg/CpuMpPei/CpuPaging.c
@@ -15,50 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 
 #include "CpuMpPei.h"
-
-#define IA32_PG_P   BIT0
-#define IA32_PG_RW  BIT1
-#define IA32_PG_U   BIT2
-#define IA32_PG_A   BIT5
-#define IA32_PG_D   BIT6
-#define IA32_PG_PS  BIT7
-#define IA32_PG_NX  BIT63
-
-#define PAGE_ATTRIBUTE_BITS  (IA32_PG_RW | IA32_PG_P)
-#define PAGE_PROGATE_BITS(IA32_PG_D | IA32_PG_A | IA32_PG_NX | IA32_PG_U | 
\
-   PAGE_ATTRIBUTE_BITS)
-
-#define PAGING_PAE_INDEX_MASK0x1FF
-#define PAGING_4K_ADDRESS_MASK_640x000FF000ull
-#define PAGING_2M_ADDRESS_MASK_640x000FFFE0ull
-#define PAGING_1G_ADDRESS_MASK_640x000FC000ull
-#define PAGING_512G_ADDRESS_MASK_64  0x000FFF80ull
-
-typedef enum {
-  PageNone = 0,
-  PageMin  = 1,
-  Page4K   = PageMin,
-  Page2M   = 2,
-  Page1G   = 3,
-  Page512G = 4,
-  PageMax  = Page512G
-} PAGE_ATTRIBUTE;
-
-typedef struct {
-  PAGE_ATTRIBUTEAttribute;
-  UINT64Length;
-  UINT64AddressMask;
-  UINTN AddressBitOffset;
-  UINTN AddressBitLength;
-} PAGE_ATTRIBUTE_TABLE;
-
-PAGE_ATTRIBUTE_TABLE  mPageAttributeTable[] = {
-  { PageNone, 0,  0,   0,  0 },
-  { Page4K,   SIZE_4KB,   PAGING_4K_ADDRESS_MASK_64,   12, 9 },
-  { Page2M,   SIZE_2MB,   PAGING_2M_ADDRESS_MASK_64,   21, 9 },
-  { Page1G,   SIZE_1GB,   PAGING_1G_ADDRESS_MASK_64,   30, 9 },
-  { Page512G, SIZE_512GB, PAGING_512G_ADDRESS_MASK_64, 39, 9 },
-};
+#define PAGING_4K_ADDRESS_MASK_64  0x000FF000ull
 
 EFI_PEI_NOTIFY_DESCRIPTOR  mPostMemNotifyList[] = {
   {
@@ -117,237 +74,101 @@ AllocatePageTableMemory (
   return Address;
 }
 
-/**
-  Get the type of top level page table.
-
-  @retval Page512G  PML4 paging.
-  @retval Page1GPAE paging.
-
-**/
-PAGE_ATTRIBUTE
-GetPageTableTopLevelType (
-  VOID
-  )
-{
-  MSR_IA32_EFER_REGISTER  MsrEfer;
-
-  MsrEfer.Uint64 = AsmReadMsr64 (MSR_CORE_IA32_EFER);
-
-  return (MsrEfer.Bits.LMA == 1) ? Page512G : Page1G;
-}
-
-/**
-  Return page table entry matching the address.
-
-  @param[in]   Address  The address to be checked.
-  @param[out]  PageAttributes   The page attribute of the page entry.
-
-  @return The page entry.
-**/
-VOID *
-GetPageTableEntry (
-  IN  PHYSICAL_ADDRESS  Address,
-  OUT PAGE_ATTRIBUTE*PageAttribute
-  )
-{
-  INTNLevel;
-  UINTN   Index;
-  UINT64  *PageTable;
-  UINT64  AddressEncMask;
-
-  AddressEncMask = PcdGet64 (PcdPteMemoryEncryptionAddressOrMask);
-  PageTable  = (UINT64 *)(UINTN)(AsmReadCr3 () & 
PAGING_4K_ADDRESS_MASK_64);
-  for (Level = (INTN)GetPageTableTopLevelType (); Level > 0; --Level) {
-Index  = (UINTN)RShiftU64 (Address, 
mPageAttributeTable[Level].AddressBitOffset);
-Index &= PAGING_PAE_INDEX_MASK;
-
-//
-// No mapping?
-//
-if (PageTable[Index] == 0) {
-  *PageAttribute = PageNone;
-  return NULL;
-}
-
-//
-// Page memory?
-//
-if (((PageTable[Index] & IA32_PG_PS) != 0) || (Level == PageMin)) {
-  *PageAttribute = (PAGE_ATTRIBUTE)Level;
-  return [Index];
-}
-
-//
-// Page directory or table
-//
-PageTable = (UINT64 *)(UINTN)(PageTable[Index] &
-  ~AddressEncMask &
-  PAGING_4K_ADDRESS_MASK_64);
-  }
-
-  *PageAttribute = PageNone;
-  return NULL;
-}
-
-/**
-  This function splits one page entry to smaller page entries.
-
-  @param[in]  PageEntryThe page entry to be splitted.
-  @param[in]  PageAttributeThe page attribute of the page entry.
-  @param[in]  SplitAttribute   How to split the page entry.
-  @param[in]  Recursively  Do the split recursively or not.
-
-  @retval RETURN_SUCCESSThe page entry is splitted.
-  @retval RETURN_INVALID_PARAMETER  If target page attribute is invalid
-  @retval RETURN_OUT_OF_RESOURCES   No resource to split page entry.
-**/
-RETURN_STATUS
-SplitPage (
-  IN  UINT64  *PageEntry,
-  IN  PAGE_ATTRIBUTE  PageAttribute,
-  IN  PAGE_ATTRIBUTE  SplitAttribute,
-  IN  BOOLEAN Recursively
-  )
-{
-  UINT64  BaseAddress;
-  UINT64  *NewPageEntry;
-  UINTN   Index;
-  UINT64  AddressEncMask;
-  PAGE_ATTRIBUTE  SplitTo;
-
-  if ((SplitAttribute == 

[edk2-devel] [PATCH 2/3] UefiCpuPkg/CpuPageTableLib/TestCase: Refine test case for PAE paging.

2023-11-27 Thread Zhiguang Liu
Refine test case:
1. Check PAE paging reserved bits is zero.
2. Set stack as random value.

Cc: Ray Ni 
Cc: Rahul Kumar 
Cc: Gerd Hoffmann 
Cc: Laszlo Ersek 
Signed-off-by: Zhiguang Liu 
---
 .../UnitTest/CpuPageTableLibUnitTestHost.inf  |  3 +++
 .../CpuPageTableLib/UnitTest/RandomTest.c | 23 ++-
 .../CpuPageTableLib/UnitTest/TestHelper.c | 14 ---
 3 files changed, 36 insertions(+), 4 deletions(-)

diff --git 
a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHost.inf 
b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHost.inf
index eb71c5ad68..3714b18492 100644
--- 
a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHost.inf
+++ 
b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHost.inf
@@ -40,3 +40,6 @@
   UnitTestLib
   MemoryAllocationLib
   BaseCryptLib
+
+[BuildOptions]
+  GCC:*_*_*_CC_FLAGS = -Wno-unused-but-set-variable
diff --git a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c 
b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c
index f7a77d00e7..50e40aa002 100644
--- a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c
+++ b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c
@@ -138,6 +138,22 @@ RandomBoolean (
   return ((Probability > ((UINT8)Random64 (0, 100))) ? TRUE : FALSE);
 }
 
+/**
+  Set 8K stack as random value.
+**/
+VOID
+SetRandomStack (
+  VOID
+  )
+{
+  UINT64  Buffer[SIZE_1KB];
+  UINTN   Index;
+
+  for (Index = 0; Index < SIZE_1KB; Index++) {
+Buffer[Index] = Random64 (0, MAX_UINT64);
+  }
+}
+
 /**
   Check if the Page table entry is valid
 
@@ -670,6 +686,7 @@ SingleMapEntryTest (
   IsNotPresent  = FALSE;
   IsModified= FALSE;
 
+  SetRandomStack ();
   GenerateSingleRandomMapEntry (MaxAddress, MapEntrys);
   LastMapEntry = >Maps[MapsIndex];
   Status   = PageTableParse (*PageTable, PagingMode, NULL, );
@@ -1039,7 +1056,11 @@ TestCaseforRandomTest (
   mSupportedBit.Bits.Pat= 1;
   mSupportedBit.Bits.Global = 1;
   mSupportedBit.Bits.ProtectionKey  = 0xF;
-  mSupportedBit.Bits.Nx = 1;
+  if (((CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT *)Context)->PagingMode == 
PagingPae) {
+mSupportedBit.Bits.ProtectionKey = 0;
+  }
+
+  mSupportedBit.Bits.Nx = 1;
 
   mRandomOption = ((CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT 
*)Context)->RandomOption;
   mNumberIndex  = 0;
diff --git a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c 
b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c
index 67776255c2..d2c50a6c8a 100644
--- a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c
+++ b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c
@@ -9,6 +9,7 @@
 #include "CpuPageTableLibUnitTest.h"
 #include "../CpuPageTable.h"
 
+#define IA32_PAE_RESERVED_MASK  0x7FF0ull
 //
 // Global Data to validate if the page table is legal
 // mValidMaskNoLeaf[0] is not used
@@ -95,6 +96,7 @@ InitGlobalData (
   @param[in]   Level  the level of PagingEntry.
   @param[in]   MaxLeafLevel   Max leaf entry level.
   @param[in]   LinearAddress  The linear address verified.
+  @param[in]   PagingMode The paging mode.
 
   @retval  Leaf entry.
 **/
@@ -103,13 +105,18 @@ IsPageTableEntryValid (
   IN IA32_PAGING_ENTRY  *PagingEntry,
   IN UINTN  Level,
   IN UINTN  MaxLeafLevel,
-  IN UINT64 Address
+  IN UINT64 Address,
+  IN PAGING_MODEPagingMode
   )
 {
   UINT64 Index;
   IA32_PAGING_ENTRY  *ChildPageEntry;
   UNIT_TEST_STATUS   Status;
 
+  if (PagingMode == PagingPae) {
+UT_ASSERT_EQUAL (PagingEntry->Uint64 & IA32_PAE_RESERVED_MASK, 0);
+  }
+
   if (PagingEntry->Pce.Present == 0) {
 return UNIT_TEST_PASSED;
   }
@@ -142,7 +149,7 @@ IsPageTableEntryValid (
 
   ChildPageEntry = (IA32_PAGING_ENTRY  
*)(UINTN)(IA32_PNLE_PAGE_TABLE_BASE_ADDRESS (>Pnle));
   for (Index = 0; Index < 512; Index++) {
-Status = IsPageTableEntryValid ([Index], Level-1, 
MaxLeafLevel, Address + (Index<<(9*(Level-1) + 3)));
+Status = IsPageTableEntryValid ([Index], Level-1, 
MaxLeafLevel, Address + (Index<<(9*(Level-1) + 3)), PagingMode);
 if (Status != UNIT_TEST_PASSED) {
   return Status;
 }
@@ -190,9 +197,10 @@ IsPageTableValid (
 if (PagingMode == PagingPae) {
   UT_ASSERT_EQUAL (PagingEntry[Index].PdptePae.Bits.MustBeZero, 0);
   UT_ASSERT_EQUAL (PagingEntry[Index].PdptePae.Bits.MustBeZero2, 0);
+  UT_ASSERT_EQUAL (PagingEntry[Index].PdptePae.Bits.MustBeZero3, 0);
 }
 
-Status = IsPageTableEntryValid ([Index], MaxLevel, 
MaxLeafLevel, Index << (9 * MaxLevel + 3));
+Status = IsPageTableEntryValid ([Index], MaxLevel, 
MaxLeafLevel, Index << (9 * MaxLevel + 3), PagingMode);
 if (Status != UNIT_TEST_PASSED) {
   return Status;
 }
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply 

[edk2-devel] [PATCH 1/3] UefiCpuPkg/CpuPageTableLib: Init local variable before using it.

2023-11-27 Thread Zhiguang Liu
The local variable OneOfPagingEntry is used before initialized, this
may cause reserved bit in page table entry is set especially in PAE
paging mode. The bug is random because it depends on the value in
stack.

Cc: Ray Ni 
Cc: Rahul Kumar 
Cc: Gerd Hoffmann 
Cc: Laszlo Ersek 
Signed-off-by: Zhiguang Liu 
---
 UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c 
b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
index eff02619fa..36b2c4e6a3 100644
--- a/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
+++ b/UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
@@ -338,7 +338,7 @@ PageTableLibMapInLevel (
   ParentAttribute = 
 
   OriginalParentPagingEntry.Uint64 = ParentPagingEntry->Uint64;
-
+  OneOfPagingEntry.Uint64  = 0;
   //
   // RegionLength: 256T (1 << 48) 512G (1 << 39), 1G (1 << 30), 2M (1 << 21) 
or 4K (1 << 12).
   //
@@ -367,8 +367,6 @@ PageTableLibMapInLevel (
   if (RETURN_ERROR (Status)) {
 return Status;
   }
-
-  OneOfPagingEntry.Pnle.Uint64 = 0;
 } else {
   PageTableLibSetPle (Level, , 0, , 
);
 }
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111729): https://edk2.groups.io/g/devel/message/111729
Mute This Topic: https://groups.io/mt/102825574/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-