Re: [edk2-devel] [Patch edk2-stable202208 1/2] BaseTools/Source/C/GenSec: Preserve prior behavior when no GUID provided

2022-08-15 Thread Bob Feng
Reviewed-by: Bob Feng 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Michael D Kinney
Sent: Tuesday, August 16, 2022 9:49 AM
To: devel@edk2.groups.io
Cc: Konstantin Aladyshev ; Feng, Bob C 
; Gao, Liming ; Chen, Christine 

Subject: [edk2-devel] [Patch edk2-stable202208 1/2] BaseTools/Source/C/GenSec: 
Preserve prior behavior when no GUID provided

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

If no GUID value is provided with EFI_SECTION_FREEFORM_SUBTYPE_GUID then 
preserve the prior behavior until all downstream platforms are updated to pass 
in a GUID value.

Cc: Konstantin Aladyshev 
Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
Signed-off-by: Michael D Kinney 
---
 BaseTools/Source/C/GenSec/GenSec.c | 29 -
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/BaseTools/Source/C/GenSec/GenSec.c 
b/BaseTools/Source/C/GenSec/GenSec.c
index d86cc197cc26..191a49d99228 100644
--- a/BaseTools/Source/C/GenSec/GenSec.c
+++ b/BaseTools/Source/C/GenSec/GenSec.c
@@ -1752,8 +1752,7 @@ Routine Description:
   // Check whether there is GUID for the SubtypeGuid section
   //
   if ((SectType == EFI_SECTION_FREEFORM_SUBTYPE_GUID) && (CompareGuid 
(, ) == 0)) {
-Error (NULL, 0, 1001, "Missing options", "GUID");
-goto Finish;
+fprintf (stdout, "Warning: input guid value is required for section 
+ type %s\n", SectionName);
   }
 
   //
@@ -1825,13 +1824,25 @@ Routine Description:
 break;
 
   case EFI_SECTION_FREEFORM_SUBTYPE_GUID:
-Status = GenSectionSubtypeGuidSection (
-  InputFileName,
-  InputFileAlign,
-  InputFileNum,
-  ,
-  
-  );
+if (CompareGuid (, ) == 0) {
+  //
+  // Preserve existing behavior when no GUID value is provided
+  //
+  Status = GenSectionCommonLeafSection (
+InputFileName,
+InputFileNum,
+SectType,
+
+);
+} else {
+  Status = GenSectionSubtypeGuidSection (
+InputFileName,
+InputFileAlign,
+InputFileNum,
+,
+
+);
+}
 break;
 
   case EFI_SECTION_VERSION:
--
2.37.1.windows.1








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




Re: [edk2-devel] [Patch edk2-stable202208 2/2] BaseTools/Source/C/GenSec: Fix EFI_SECTION_FREEFORM_SUBTYPE_GUID header

2022-08-15 Thread Bob Feng
This patch is good to me.

Reviewed-by: Bob Feng 

-Original Message-
From: Kinney, Michael D  
Sent: Tuesday, August 16, 2022 9:49 AM
To: devel@edk2.groups.io
Cc: Konstantin Aladyshev ; Feng, Bob C 
; Gao, Liming ; Chen, Christine 

Subject: [Patch edk2-stable202208 2/2] BaseTools/Source/C/GenSec: Fix 
EFI_SECTION_FREEFORM_SUBTYPE_GUID header

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

When the size of a EFI_SECTION_FREEFORM_SUBTYPE_GUID section required the use 
of EFI_FREEFORM_SUBTYPE_GUID_SECTION2 header, set the section type to 
EFI_SECTION_FREEFORM_SUBTYPE_GUID.

Cc: Konstantin Aladyshev 
Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
Signed-off-by: Michael D Kinney 
---
 BaseTools/Source/C/GenSec/GenSec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/GenSec/GenSec.c 
b/BaseTools/Source/C/GenSec/GenSec.c
index 191a49d99228..e318d45f77d3 100644
--- a/BaseTools/Source/C/GenSec/GenSec.c
+++ b/BaseTools/Source/C/GenSec/GenSec.c
@@ -1112,7 +1112,7 @@ Routine Description:
   //
   if (TotalLength >= MAX_SECTION_SIZE) {
 SubtypeGuidSect2 = (EFI_FREEFORM_SUBTYPE_GUID_SECTION2 *) FileBuffer;
-SubtypeGuidSect2->CommonHeader.Type = EFI_SECTION_GUID_DEFINED;
+SubtypeGuidSect2->CommonHeader.Type = 
EFI_SECTION_FREEFORM_SUBTYPE_GUID;
 SubtypeGuidSect2->CommonHeader.Size[0]  = (UINT8) 0xff;
 SubtypeGuidSect2->CommonHeader.Size[1]  = (UINT8) 0xff;
 SubtypeGuidSect2->CommonHeader.Size[2]  = (UINT8) 0xff;
--
2.37.1.windows.1



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




Re: [edk2-devel] [PATCH 01/10] UefiCpuPkg: Create CpuPageTableLib for manipulating X86 paging structs

2022-08-15 Thread Ni, Ray
Tom,
Yes. I expect caller sets/clears the appropriate bits in the 
PageTableBaseAddress bit-field.

With this way, the PageTableLib can be stable enough and doesn't need to change 
for
different (Intel/AMD/...) x86 features today (or future) that repurpose some 
bits in
the page table entry.

To be specific, TDX uses the highest bit as a indicator for shared memory. So 
the caller of this lib
needs to set the highest bit in PageTableBaseAddress for shared memory in TDX 
case.

I guess SEV code can use the similar way.

Thanks,
Ray

> -Original Message-
> From: Tom Lendacky 
> Sent: Tuesday, August 16, 2022 12:24 AM
> To: devel@edk2.groups.io; Ni, Ray 
> Cc: Dong, Eric 
> Subject: Re: [edk2-devel] [PATCH 01/10] UefiCpuPkg: Create
> CpuPageTableLib for manipulating X86 paging structs
> 
> On 7/18/22 08:18, Ni, Ray via groups.io wrote:
> 
> Hi Ray,
> 
> How do you envision this library working with SEV and/or TDX which use the
> one of the bits in PageTableBaseAddress to indicate whether the page is
> encrypted or shared? For SEV, the encryption mask is set in the
> PcdPteMemoryEncryptionAddressOrMask PCD, are you planning on using
> that at
> all or is it expected that caller will set/clear the appropriate bits in
> the PageTableBaseAddress field?
> 
> Thanks,
> Tom
> 
> > ---
> >   UefiCpuPkg/Include/Library/CpuPageTableLib.h  | 129 +
> >   .../Library/CpuPageTableLib/CpuPageTable.h| 204 +++
> >   .../CpuPageTableLib/CpuPageTableLib.inf   |  35 ++
> >   .../Library/CpuPageTableLib/CpuPageTableMap.c | 543
> ++
> >   .../CpuPageTableLib/CpuPageTableParse.c   | 330 +++
> >   UefiCpuPkg/UefiCpuPkg.dec |   3 +
> >   UefiCpuPkg/UefiCpuPkg.dsc |   4 +-
> >   7 files changed, 1247 insertions(+), 1 deletion(-)
> >   create mode 100644 UefiCpuPkg/Include/Library/CpuPageTableLib.h
> >   create mode 100644
> UefiCpuPkg/Library/CpuPageTableLib/CpuPageTable.h
> >   create mode 100644
> UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
> >   create mode 100644
> UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
> >   create mode 100644
> UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableParse.c
> >
> > diff --git a/UefiCpuPkg/Include/Library/CpuPageTableLib.h
> b/UefiCpuPkg/Include/Library/CpuPageTableLib.h
> > new file mode 100644
> > index 00..2dc9b7d18e
> > --- /dev/null
> > +++ b/UefiCpuPkg/Include/Library/CpuPageTableLib.h
> > @@ -0,0 +1,129 @@
> > +/** @file
> > +  Public include file for PageTableLib library.
> > +
> > +  Copyright (c) 2022, Intel Corporation. All rights reserved.
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +#ifndef PAGE_TABLE_LIB_H_
> > +#define PAGE_TABLE_LIB_H_
> > +
> > +typedef union {
> > +  struct {
> > +UINT64Present  : 1; // 0 = Not present in memory, 1 = 
> > Present in
> memory
> > +UINT64ReadWrite: 1; // 0 = Read-Only, 1= Read/Write
> > +UINT64UserSupervisor   : 1; // 0 = Supervisor, 1=User
> > +UINT64WriteThrough : 1; // 0 = Write-Back caching, 1=Write-
> Through caching
> > +UINT64CacheDisabled: 1; // 0 = Cached, 1=Non-Cached
> > +UINT64Accessed : 1; // 0 = Not accessed, 1 = Accessed 
> > (set by
> CPU)
> > +UINT64Dirty: 1; // 0 = Not dirty, 1 = Dirty (set 
> > by CPU)
> > +UINT64Pat  : 1; // PAT
> > +
> > +UINT64Global   : 1; // 0 = Not global, 1 = Global (if 
> > CR4.PGE = 1)
> > +UINT64Reserved1: 3; // Ignored
> > +
> > +UINT64PageTableBaseAddress : 40; // Page Table Base Address
> > +UINT64Reserved2: 7;  // Ignored
> > +UINT64ProtectionKey: 4;  // Protection key
> > +UINT64Nx   : 1;  // No Execute bit
> > +  } Bits;
> > +  UINT64Uint64;
> > +} IA32_MAP_ATTRIBUTE;
> > +
> > +#define IA32_MAP_ATTRIBUTE_PAGE_TABLE_BASE_ADDRESS_MASK
> 0xFF000ull
> > +#define IA32_MAP_ATTRIBUTE_PAGE_TABLE_BASE_ADDRESS(pa)  ((pa)-
> >Uint64 & IA32_MAP_ATTRIBUTE_PAGE_TABLE_BASE_ADDRESS_MASK)
> > +#define IA32_MAP_ATTRIBUTE_ATTRIBUTES(pa)   ((pa)->Uint64 &
> ~IA32_MAP_ATTRIBUTE_PAGE_TABLE_BASE_ADDRESS_MASK)
> > +
> > +//
> > +// Below enum follows "4.1.1 Four Paging Modes" in Chapter 4 Paging of
> SDM Volume 3.
> > +// Page1GB is only supported in 4-level and 5-level.
> > +//
> > +typedef enum {
> > +  Paging32bit,
> > +
> > +  //
> > +  // High byte in paging mode indicates the max levels of the page table.
> > +  // Low byte in paging mode indicates the max level that can be a leaf
> entry.
> > +  //
> > +  PagingPae = 0x0302,
> > +
> > +  Paging4Level= 0x0402,
> > +  Paging4Level1GB = 0x0403,
> > +
> > +  Paging5Level= 0x0502,
> > +  Paging5Level1GB = 0x0503,
> > +
> > +  PagingModeMax
> > +} PAGING_MODE;
> > +
> > +/**
> > +  Create or update page table to map [LinearAddress, 

[edk2-devel] [Patch edk2-stable202208 0/2] Fix GenSec EFI_SECTION_FREEFORM_SUBTYPE_GUID

2022-08-15 Thread Michael D Kinney
If no GUID value is provided with EFI_SECTION_FREEFORM_SUBTYPE_GUID
then preserve the prior behavior until all downstream platforms
are updated to pass in a GUID value.

When the size of a EFI_SECTION_FREEFORM_SUBTYPE_GUID section required
the use of EFI_FREEFORM_SUBTYPE_GUID_SECTION2 header, set the section
type to EFI_SECTION_FREEFORM_SUBTYPE_GUID.

Cc: Konstantin Aladyshev 
Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
Signed-off-by: Michael D Kinney 

Michael D Kinney (2):
  BaseTools/Source/C/GenSec: Preserve prior behavior when no GUID
provided
  BaseTools/Source/C/GenSec: Fix EFI_SECTION_FREEFORM_SUBTYPE_GUID
header

 BaseTools/Source/C/GenSec/GenSec.c | 31 --
 1 file changed, 21 insertions(+), 10 deletions(-)

-- 
2.37.1.windows.1



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




[edk2-devel] [Patch edk2-stable202208 2/2] BaseTools/Source/C/GenSec: Fix EFI_SECTION_FREEFORM_SUBTYPE_GUID header

2022-08-15 Thread Michael D Kinney
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4021

When the size of a EFI_SECTION_FREEFORM_SUBTYPE_GUID section required
the use of EFI_FREEFORM_SUBTYPE_GUID_SECTION2 header, set the section
type to EFI_SECTION_FREEFORM_SUBTYPE_GUID.

Cc: Konstantin Aladyshev 
Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
Signed-off-by: Michael D Kinney 
---
 BaseTools/Source/C/GenSec/GenSec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/GenSec/GenSec.c 
b/BaseTools/Source/C/GenSec/GenSec.c
index 191a49d99228..e318d45f77d3 100644
--- a/BaseTools/Source/C/GenSec/GenSec.c
+++ b/BaseTools/Source/C/GenSec/GenSec.c
@@ -1112,7 +1112,7 @@ Routine Description:
   //
   if (TotalLength >= MAX_SECTION_SIZE) {
 SubtypeGuidSect2 = (EFI_FREEFORM_SUBTYPE_GUID_SECTION2 *) FileBuffer;
-SubtypeGuidSect2->CommonHeader.Type = EFI_SECTION_GUID_DEFINED;
+SubtypeGuidSect2->CommonHeader.Type = 
EFI_SECTION_FREEFORM_SUBTYPE_GUID;
 SubtypeGuidSect2->CommonHeader.Size[0]  = (UINT8) 0xff;
 SubtypeGuidSect2->CommonHeader.Size[1]  = (UINT8) 0xff;
 SubtypeGuidSect2->CommonHeader.Size[2]  = (UINT8) 0xff;
-- 
2.37.1.windows.1



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




[edk2-devel] [Patch edk2-stable202208 1/2] BaseTools/Source/C/GenSec: Preserve prior behavior when no GUID provided

2022-08-15 Thread Michael D Kinney
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4022

If no GUID value is provided with EFI_SECTION_FREEFORM_SUBTYPE_GUID
then preserve the prior behavior until all downstream platforms
are updated to pass in a GUID value.

Cc: Konstantin Aladyshev 
Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
Signed-off-by: Michael D Kinney 
---
 BaseTools/Source/C/GenSec/GenSec.c | 29 -
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/BaseTools/Source/C/GenSec/GenSec.c 
b/BaseTools/Source/C/GenSec/GenSec.c
index d86cc197cc26..191a49d99228 100644
--- a/BaseTools/Source/C/GenSec/GenSec.c
+++ b/BaseTools/Source/C/GenSec/GenSec.c
@@ -1752,8 +1752,7 @@ Routine Description:
   // Check whether there is GUID for the SubtypeGuid section
   //
   if ((SectType == EFI_SECTION_FREEFORM_SUBTYPE_GUID) && (CompareGuid 
(, ) == 0)) {
-Error (NULL, 0, 1001, "Missing options", "GUID");
-goto Finish;
+fprintf (stdout, "Warning: input guid value is required for section type 
%s\n", SectionName);
   }
 
   //
@@ -1825,13 +1824,25 @@ Routine Description:
 break;
 
   case EFI_SECTION_FREEFORM_SUBTYPE_GUID:
-Status = GenSectionSubtypeGuidSection (
-  InputFileName,
-  InputFileAlign,
-  InputFileNum,
-  ,
-  
-  );
+if (CompareGuid (, ) == 0) {
+  //
+  // Preserve existing behavior when no GUID value is provided
+  //
+  Status = GenSectionCommonLeafSection (
+InputFileName,
+InputFileNum,
+SectType,
+
+);
+} else {
+  Status = GenSectionSubtypeGuidSection (
+InputFileName,
+InputFileAlign,
+InputFileNum,
+,
+
+);
+}
 break;
 
   case EFI_SECTION_VERSION:
-- 
2.37.1.windows.1



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




Re: [edk2-devel] [PATCH EDK2 v2 1/1] MdeModulePkg/PiSmmCore:Avoid overflow risk

2022-08-15 Thread Ni, Ray
> --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
> +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
> @@ -621,6 +621,9 @@ InternalIsBufferOverlapped (
>IN UINTN  Size2
>)
>  {
> +  if (((UINTN)Buff1 > MAX_UINTN - Size1) || ((UINTN)Buff2 > MAX_UINTN -
> Size2)) {
> +return TRUE;
> +  }
1. The change looks good because it avoids integer overflow in below code that 
adds Size1 to Buff1 and
adds Size2 to Buff2.
Can you please add comments to explain the logic?


> 
> +  if (CommunicateHeader->MessageLength > MAX_UINTN - OFFSET_OF
> (EFI_SMM_COMMUNICATE_HEADER, Data)) {
> +return EFI_INVALID_PARAMETER;
> +  }
2. Above check avoids integer overflow in below code that adds 
CommunicateHeader->MessageLength
to OFFSET_OF(EFI_SMM_COMMUNICATE_HEADER, Data).
Can it be moved to inside the below if-clause?


> +
>if (CommSize == NULL) {
>  TempCommSize = OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data)
> + CommunicateHeader->MessageLength;
>} else {
3.  I further reviewed the else-clause logic. When CommSize is not NULL, is 
that needed to make sure
that *CommSize >= OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + 
CommunicateHeader->MessageLength?
Or is the check already in the code somewhere?
If we think the check is needed, I agree with the change #2 to have a common 
logic to check integer overflow.


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




[edk2-devel] Event: TianoCore Bug Triage - APAC / NAMO - 08/16/2022 #cal-reminder

2022-08-15 Thread Group Notification
*Reminder: TianoCore Bug Triage - APAC / NAMO*

*When:*
08/16/2022
6:30pm to 7:30pm
(UTC-07: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=1268263 )

*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_OTUyZTg2NjgtNDhlNS00ODVlLTllYTUtYzg1OTNjNjdiZjFh%40thread.v2/0?context=%7b%22Tid%22%3a%2246c98d88-e344-4ed4-8496-4ed7712e255d%22%2c%22Oid%22%3a%22b286b53a-1218-4db3-bfc9-3d4c5aa7669e%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 (#92461): https://edk2.groups.io/g/devel/message/92461
Mute This Topic: https://groups.io/mt/93050761/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]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 3/3] RedfishPkg: The functions for Redfish requests do not fully complied with specification

2022-08-15 Thread Igor Kulchytskyy via groups.io
There is no function to send POST request with the Content type
which is different from "application/json".
There is no function to send DELETE request with the body.

Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Igor Kulchytskyy 
---
 RedfishPkg/Include/Library/RedfishLib.h|  80 +
 RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c  | 189 +
 .../edk2libredfish/include/redfishService.h|   8 +
 .../RedfishLib/edk2libredfish/src/service.c|  43 -
 4 files changed, 317 insertions(+), 3 deletions(-)

diff --git a/RedfishPkg/Include/Library/RedfishLib.h 
b/RedfishPkg/Include/Library/RedfishLib.h
index b2488ab..d4b3246 100644
--- a/RedfishPkg/Include/Library/RedfishLib.h
+++ b/RedfishPkg/Include/Library/RedfishLib.h
@@ -380,6 +380,49 @@ RedfishPatchToPayload (
   OUTREDFISH_RESPONSE  *RedResponse
   );

+
+/**
+  Use HTTP POST to create new Redfish resource in the Resource Collection.
+
+  The POST request should be submitted to the Resource Collection in which the 
new resource
+  is to belong. The Resource Collection is addressed by URI. The Redfish may
+  ignore any service controlled properties. The corresponding redfish response 
will returned,
+  including HTTP StatusCode, Headers and Payload which record any HTTP 
response messages.
+
+  Callers are responsible for freeing the HTTP StatusCode, Headers and Payload 
returned in
+  redfish response data.
+
+  @param[in]RedfishServiceThe Service to access the Redfish 
resources.
+  @param[in]Uri   Relative path to address the resource.
+  @param[in]Content   JSON represented properties to be update.
+  @param[in]ContentSize   Size of the Content to be send to 
Redfish service
+  @param[in]ContentType   Type of the Content to be send to 
Redfish service
+  @param[out]   RedResponse   Pointer to the Redfish response data.
+
+  @retval EFI_SUCCESS The opeartion is successful, indicates the 
HTTP StatusCode is not
+  NULL and the value is 2XX. The Redfish 
resource will be returned
+  in Payload within RedResponse if server send 
it back in the HTTP
+  response message body.
+  @retval EFI_INVALID_PARAMETER   RedfishService, Uri, Content, or RedResponse 
is NULL.
+  @retval EFI_DEVICE_ERRORAn unexpected system or network error 
occurred. Callers can get
+  more error info from returned HTTP 
StatusCode, Headers and Payload
+  within RedResponse:
+  1. If the returned StatusCode is NULL, 
indicates any error happen.
+  2. If the returned StatusCode is not NULL 
and the value is not 2XX,
+ indicates any error happen.
+**/
+EFI_STATUS
+EFIAPI
+RedfishPostToUriEx (
+  IN REDFISH_SERVICE   RedfishService,
+  IN CONST CHAR8   *Uri,
+  IN CONST CHAR8   *Content,
+  IN UINTN ContentSize,
+  IN CONST CHAR8   *ContentType,
+  OUTREDFISH_RESPONSE  *RedResponse
+  );
+
+
 /**
   Use HTTP POST to create a new resource in target payload.

@@ -451,6 +494,43 @@ RedfishDeleteByUri (
   );

 /**
+  Use HTTP DELETE to remove a resource.
+
+  This function uses the RedfishService to remove a Redfish resource which is 
addressed
+  by input Uri (only the relative path is required). The corresponding redfish 
response will
+  returned, including HTTP StatusCode, Headers and Payload which record any 
HTTP response
+  messages.
+
+  Callers are responsible for freeing the HTTP StatusCode, Headers and Payload 
returned in
+  redfish response data.
+
+  @param[in]RedfishServiceThe Service to access the Redfish 
resources.
+  @param[in]Uri   Relative path to address the resource.
+  @param[in]Content   JSON represented properties to be 
deleted.
+  @param[out]   RedResponse   Pointer to the Redfish response data.
+
+  @retval EFI_SUCCESS The opeartion is successful, indicates the 
HTTP StatusCode is not
+  NULL and the value is 2XX, the Redfish 
resource has been removed.
+  If there is any message returned from 
server, it will be returned
+  in Payload within RedResponse.
+  @retval EFI_INVALID_PARAMETER   RedfishService, Uri, or RedResponse is NULL.
+  @retval EFI_DEVICE_ERRORAn unexpected system or network error 
occurred. Callers can get
+  more error info from returned HTTP 
StatusCode, Headers and Payload
+  within RedResponse:
+  1. If the returned StatusCode is NULL, 
indicates any error happen.
+  2. If the returned 

[edk2-devel] [PATCH 2/3] RedfishPkg: Redfish modules may need to use the functions which are private

2022-08-15 Thread Igor Kulchytskyy via groups.io
Definitions of the required functiuons to send requests to BMC
are in the PrivateInclude folder.
So they cannot be used by the other Redfish packages.

Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Igor Kulchytskyy 
---
 RedfishPkg/Include/Library/RedfishLib.h| 616 +
 RedfishPkg/PrivateInclude/Library/RedfishLib.h | 616 -
 RedfishPkg/RedfishPkg.dec  |   2 +-
 3 files changed, 617 insertions(+), 617 deletions(-)
 create mode 100644 RedfishPkg/Include/Library/RedfishLib.h
 delete mode 100644 RedfishPkg/PrivateInclude/Library/RedfishLib.h

diff --git a/RedfishPkg/Include/Library/RedfishLib.h 
b/RedfishPkg/Include/Library/RedfishLib.h
new file mode 100644
index 000..b2488ab
--- /dev/null
+++ b/RedfishPkg/Include/Library/RedfishLib.h
@@ -0,0 +1,616 @@
+/** @file
+  This library provides a set of utility APIs that allow to 
create/read/update/delete
+  (CRUD) Redfish resources and provide basic query abilities by using 
[URI/RedPath]
+  (https://github.com/DMTF/libredfish).
+
+  The query language is based on XPath 
(https://www.w3.org/TR/1999/REC-xpath-19991116/).
+  This library and query language essentially treat the entire Redfish Service 
like it
+  was a single JSON document. In other words whenever it encounters an 
odata.id in JSON
+  document, it will retrieve the new JSON document (if needed). We name the 
path as
+  RedPath:
+
+  Expression   Description
+
+  nodename Selects the JSON entity with the name "nodename".
+   If the value of nodename is an object with "@odata.id",
+   it will continue get the value from "@odata.id".
+
+  /Selects from the root node
+
+  [index]   Selects the index number JSON entity from an array or
+   object. If the JSON entity is one collection (has
+   Members & Members@odata.count), means to get the index
+   member in "Members". Index number >=1, 1 means to return
+   the first instance.
+
+  [XXX]Operation on JSON entity.
+   If the JSON entity is one collection (has Members &
+   Members@odata.count), means to get all elements in
+   "Members". If the JSON entity is one array, means to
+   get all elements in array. Others will match the nodename
+   directly (e.g. JSON_OBJECT, JSON_STRING, JSON_TRUE,
+   JSON_FALSE, JSON_INTEGER).
+
+  [nodename]   Selects all the elements from an JSON entity that
+   contain a property named "nodename"
+
+  [name=value] Selects all the elements from an JSON entity where
+   the property "name" is equal to "value"
+
+  [name~value] Selects all the elements from an JSON entity where
+   the string property "name" is equal to "value" using
+   case insensitive comparison.
+
+  [namevalue] Selects all the elements from an JSON entity where
+   the property "name" is greater than "value"
+
+  [name>=value]Selects all the elements from an JSON entity where
+   the property "name" is greater than or equal to "value"
+
+  Some examples:
+
+/v1/Chassis[1]- Will return the first Chassis instance.
+/v1/Chassis[SKU=1234] - Will return all Chassis instances with a SKU field 
equal to 1234.
+/v1/Systems[Storage]  - Will return all the System instances that have 
Storage field populated.
+
+  Copyright (c) 2019, Intel Corporation. All rights reserved.
+  (C) Copyright 2021 Hewlett Packard Enterprise Development LP
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef REDFISH_LIB_H_
+#define REDFISH_LIB_H_
+
+#include 
+
+#include 
+#include 
+
+#define ODATA_TYPE_NAME_MAX_SIZE  128
+#define ODATA_TYPE_MAX_SIZE   128
+
+///
+/// Library class public defines
+///
+typedef  VOID  *REDFISH_SERVICE;
+typedef  VOID  *REDFISH_PAYLOAD;
+
+///
+/// Library class public structures/unions
+///
+typedef struct {
+  EFI_HTTP_STATUS_CODE*StatusCode;
+  UINTN   HeaderCount;
+  EFI_HTTP_HEADER *Headers;
+  REDFISH_PAYLOAD Payload;
+} REDFISH_RESPONSE;
+
+///
+/// Odata type-name mapping structure.
+///
+typedef struct {
+  CONST CHAR8OdataTypeName[ODATA_TYPE_NAME_MAX_SIZE];
+  CONST CHAR8OdataType[ODATA_TYPE_MAX_SIZE];
+} REDFISH_ODATA_TYPE_MAPPING;
+
+/**
+  This function uses REST EX protocol provided in RedfishConfigServiceInfo.
+  The service enumerator will also handle the authentication flow automatically
+  if HTTP basic auth or Redfish session login is configured to use.
+
+  Callers are responsible for freeing the returned service by 
RedfishCleanupService().
+
+  @param[in]  RedfishConfigServiceInfo Redfish service information the EFI 
Redfish
+   feature driver communicates with.
+
+  @return New 

[edk2-devel] [PATCH 1/3] RedfishPkg: RedfishDiscoverDxe: USB Redfish Host interface is not supported

2022-08-15 Thread Igor Kulchytskyy via groups.io
Host Interface details are describer by the SMBIOS Type 42 table.
The table is published by the RedfishHostInterfaceDxe driver.
That driver supports USB and PCI-E host interface types.
The table is consumed by the RedfishGetHostInterfaceProtocolData
function in the RedfishDiscoverDxe driver.
The function only supports PCI-E host interface type.

Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Igor Kulchytskyy 
Reviewed-by: Abner Chang 
---
 RedfishPkg/RedfishDiscoverDxe/RedfishSmbiosHostInterface.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishSmbiosHostInterface.c 
b/RedfishPkg/RedfishDiscoverDxe/RedfishSmbiosHostInterface.c
index d79750b..0090525 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishSmbiosHostInterface.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishSmbiosHostInterface.c
@@ -65,10 +65,14 @@ RedfishGetHostInterfaceProtocolData (
 RecordTmp   = (UINT8 *)Record + Offset;

 //
-// Check Device Type, only PCI/PCIe Network Interface v2 is supported 
now.
+// Check Device Type, PCI/PCIe and USB Network Interface v2 is 
supported.
 //
-if (*RecordTmp == REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2) {
-  ASSERT (SpecificDataLen == sizeof 
(PCI_OR_PCIE_INTERFACE_DEVICE_DESCRIPTOR_V2) + 1);
+if ((*RecordTmp == REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2) || 
(*RecordTmp == REDFISH_HOST_INTERFACE_DEVICE_TYPE_USB_V2)) {
+  if (*RecordTmp == REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2) {
+  ASSERT (SpecificDataLen == sizeof 
(PCI_OR_PCIE_INTERFACE_DEVICE_DESCRIPTOR_V2) + 1);
+  } else {
+  ASSERT (SpecificDataLen > sizeof 
(REDFISH_HOST_INTERFACE_DEVICE_TYPE_USB_V2) + 1);
+  }
   *DeviceDescriptor = (REDFISH_INTERFACE_DATA *)RecordTmp;
   Offset= Offset + SpecificDataLen;
   RecordTmp = (UINT8 *)Record + Offset;
--
2.6.1.windows.1
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


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




[edk2-devel] [PATCH 0/3] EDK2 RedfishPkg issues with using it by external modules

2022-08-15 Thread Igor Kulchytskyy via groups.io
Those patches allow the third party modules to use the functionality
implemented in the RedfishPkg to support the features defined
by Redfish specification.

Cc: Abner Chang 
Cc: Nickle Wang 
Signed-off-by: Igor Kulchytskyy 
---
Igor Kulchytskyy (3):
  RedfishPkg: RedfishDiscoverDxe: USB Redfish Host interface is not
supported
  RedfishPkg: Redfish modules may need to use the functions which are
 private
  RedfishPkg: The functions for Redfish requests do not fully complied
with specification

 RedfishPkg/Include/Library/RedfishLib.h| 696 +
 RedfishPkg/PrivateInclude/Library/RedfishLib.h | 616 --
 RedfishPkg/PrivateLibrary/RedfishLib/RedfishLib.c  | 189 ++
 .../edk2libredfish/include/redfishService.h|   8 +
 .../RedfishLib/edk2libredfish/src/service.c|  43 +-
 .../RedfishSmbiosHostInterface.c   |  10 +-
 RedfishPkg/RedfishPkg.dec  |   2 +-
 7 files changed, 941 insertions(+), 623 deletions(-)
 create mode 100644 RedfishPkg/Include/Library/RedfishLib.h
 delete mode 100644 RedfishPkg/PrivateInclude/Library/RedfishLib.h

--
2.6.1.windows.1
-The information contained in this message may be confidential and proprietary 
to American Megatrends (AMI). This communication is intended to be read only by 
the individual or entity to whom it is addressed or by their designee. If the 
reader of this message is not the intended recipient, you are on notice that 
any distribution of this message, in any form, is strictly prohibited. Please 
promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and 
then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92457): https://edk2.groups.io/g/devel/message/92457
Mute This Topic: https://groups.io/mt/93050671/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 - 08/15/2022 #cal-notice

2022-08-15 Thread Group Notification
*Tools, CI, Code base construction meeting series*

*When:*
08/15/2022
4:30pm to 5:30pm
(UTC-07:00) America/Los Angeles

*Where:*
https://github.com/tianocore/edk2/discussions/2614

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

*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 (#92456): https://edk2.groups.io/g/devel/message/92456
Mute This Topic: https://groups.io/mt/93048948/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] Event: Tools, CI, Code base construction meeting series - 08/15/2022 #cal-reminder

2022-08-15 Thread Group Notification
*Reminder: Tools, CI, Code base construction meeting series*

*When:*
08/15/2022
4:30pm to 5:30pm
(UTC-07:00) America/Los Angeles

*Where:*
https://github.com/tianocore/edk2/discussions/2614

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

*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 (#92455): https://edk2.groups.io/g/devel/message/92455
Mute This Topic: https://groups.io/mt/93026208/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]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH 2/2] MdeModulePkg/Core/Dxe: Fix memory leak issue in FwVolBlock.c

2022-08-15 Thread Mike Maslenkin
FvbDev->LbaCache must be freed on error path before deallocating FvbDev.

Cc: Liming Gao 
Cc: Dandan Bi 
Signed-off-by: Mike Maslenkin 
---
 MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c 
b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
index d81334ce24d1..9f5f40e5cd49 100644
--- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
+++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
@@ -551,6 +551,7 @@ ProduceFVBProtocolOnBuffer (
 //
 FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)AllocateCopyPool (sizeof 
(FV_MEMMAP_DEVICE_PATH), );
 if (FvbDev->DevicePath == NULL) {
+  FreePool (FvbDev->LbaCache);
   FreePool (FvbDev);
   return EFI_OUT_OF_RESOURCES;
 }
@@ -563,6 +564,7 @@ ProduceFVBProtocolOnBuffer (
 //
 FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)AllocateCopyPool (sizeof 
(FV_PIWG_DEVICE_PATH), );
 if (FvbDev->DevicePath == NULL) {
+  FreePool (FvbDev->LbaCache);
   FreePool (FvbDev);
   return EFI_OUT_OF_RESOURCES;
 }
-- 
2.17.1



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




[edk2-devel] [PATCH 0/2] MdeModulePkg/Core/Dxe: Fix memory leak issues

2022-08-15 Thread Mike Maslenkin
Cc: Liming Gao 
Cc: Dandan Bi 
Signed-off-by: Mike Maslenkin 



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




[edk2-devel] [PATCH v1] MinPlatformPkg: Add PcdAcpiGpe1BlockLength for FADT from board package

2022-08-15 Thread aryeh . chen
From: Aryeh Chen 

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

Add PcdAcpiGpe1BlockLength of FADT Gpe1BlkLen register on
MinPlatformPkg for PlatformBoardpkg to update platform setting.

Signed-off-by: Aryeh Chen 
Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Liming Gao 
Cc: Eric Dong 
---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c   | 3 ++-
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf | 1 +
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec   | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index f134c8a58f..6e57b638e0 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -88,7 +88,7 @@ EFI_STATUS
 AppendCpuMapTableEntry (
 IN VOID   *ApicPtr,
 IN UINT32 LocalApicCounter,
-IN EFI_CPU_ID_ORDER_MAP *CpuApicIdOrderTable 
+IN EFI_CPU_ID_ORDER_MAP *CpuApicIdOrderTable
   )
 {
   EFI_STATUSStatus;
@@ -,6 +,7 @@ PlatformUpdateTables (
 FadtHeader->Gpe0Blk   = PcdGet16 
(PcdAcpiGpe0BlockAddress);
 FadtHeader->Gpe0BlkLen= PcdGet8 
(PcdAcpiGpe0BlockLength);
 FadtHeader->Gpe1Blk   = PcdGet16 
(PcdAcpiGpe1BlockAddress);
+FadtHeader->Gpe1BlkLen= PcdGet8 
(PcdAcpiGpe1BlockLength);
 FadtHeader->Gpe1Base  = PcdGet8 (PcdAcpiGpe1Base);
 
 FadtHeader->XPm1aEvtBlk.Address   = PcdGet16 
(PcdAcpiPm1AEventBlockAddress);
diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
index 89350828d6..451034fb8a 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
@@ -84,6 +84,7 @@
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe0BlockAddress
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe0BlockLength
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1BlockAddress
+  gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1BlockLength
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiResetRegisterAccessSize
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPm1aEvtBlkAccessSize
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPm1bEvtBlkAccessSize
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec 
b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
index db0a19066f..8e603b7bf9 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
@@ -123,6 +123,7 @@
   
gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe0BlockAddress|0x1880|UINT16|0x0001003B
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe0BlockLength|0x00|UINT8|0x0001003C
   
gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1BlockAddress|0x|UINT16|0x0001003D
+  gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1BlockLength|0x00|UINT8|0x0001003E
   gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1Base|0x00|UINT8|0x00010040
   
gMinPlatformPkgTokenSpaceGuid.PcdAcpiResetRegisterAccessSize|0x00|UINT8|0x00010042
 
-- 
2.26.2.windows.1



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




[edk2-devel] [PATCH 1/2] MdeModulePkg/Core/Dxe: Fix memory leak issue in FwVol.c

2022-08-15 Thread Mike Maslenkin
FwVolHeader must be deallocated on error path.

Cc: Liming Gao 
Cc: Dandan Bi 
Signed-off-by: Mike Maslenkin 
---
 MdeModulePkg/Core/Dxe/FwVol/FwVol.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c 
b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c
index 153bfecafa77..0c1554ba4d63 100644
--- a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c
+++ b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c
@@ -659,6 +659,7 @@ NotifyFwVolBlock (
   //
   FvDevice = AllocateCopyPool (sizeof (FV_DEVICE), );
   if (FvDevice == NULL) {
+CoreFreePool (FwVolHeader);
 return;
   }
 
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92453): https://edk2.groups.io/g/devel/message/92453
Mute This Topic: https://groups.io/mt/93047944/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] MinPlatformPkg: Add PcdAcpiGpe1BlockLength for FADT from board package

2022-08-15 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 


> -Original Message-
> From: Chen, Aryeh 
> Sent: Monday, August 15, 2022 1:36 AM
> To: devel@edk2.groups.io
> Cc: Chen, Aryeh ; Chiu, Chasel
> ; Desimone, Nathaniel L
> ; Oram, Isaac W ;
> Gao, Liming ; Dong, Eric 
> Subject: [PATCH v1] MinPlatformPkg: Add PcdAcpiGpe1BlockLength for FADT
> from board package
> 
> From: Aryeh Chen 
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4020
> 
> Add PcdAcpiGpe1BlockLength of FADT Gpe1BlkLen register on MinPlatformPkg
> for PlatformBoardpkg to update platform setting.
> 
> Signed-off-by: Aryeh Chen 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Isaac Oram 
> Cc: Liming Gao 
> Cc: Eric Dong 
> ---
>  Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c   | 3 ++-
>  Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf | 1 +
>  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec   | 1 +
>  3 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> index f134c8a58f..6e57b638e0 100644
> --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> @@ -88,7 +88,7 @@ EFI_STATUS
>  AppendCpuMapTableEntry ( IN VOID   *ApicPtr, IN UINT32
> LocalApicCounter,-IN EFI_CPU_ID_ORDER_MAP *CpuApicIdOrderTable +IN
> EFI_CPU_ID_ORDER_MAP *CpuApicIdOrderTable   ) {   EFI_STATUSStatus;@@
> -,6 +,7 @@ PlatformUpdateTables (
>  FadtHeader->Gpe0Blk   = PcdGet16 
> (PcdAcpiGpe0BlockAddress);
> FadtHeader->Gpe0BlkLen= PcdGet8 
> (PcdAcpiGpe0BlockLength);
> FadtHeader->Gpe1Blk   = PcdGet16 
> (PcdAcpiGpe1BlockAddress);+
> FadtHeader->Gpe1BlkLen= PcdGet8 
> (PcdAcpiGpe1BlockLength);
> FadtHeader->Gpe1Base  = PcdGet8 (PcdAcpiGpe1Base);
> FadtHeader->XPm1aEvtBlk.Address   = PcdGet16
> (PcdAcpiPm1AEventBlockAddress);diff --git
> a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
> b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
> index 89350828d6..451034fb8a 100644
> --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
> +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf
> @@ -84,6 +84,7 @@
>gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe0BlockAddress
> gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe0BlockLength
> gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1BlockAddress+
> gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1BlockLength
> gMinPlatformPkgTokenSpaceGuid.PcdAcpiResetRegisterAccessSize
> gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPm1aEvtBlkAccessSize
> gMinPlatformPkgTokenSpaceGuid.PcdAcpiXPm1bEvtBlkAccessSizediff --git
> a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> index db0a19066f..8e603b7bf9 100644
> --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec
> @@ -123,6 +123,7 @@
> 
> gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe0BlockAddress|0x1880|UINT16|0
> x0001003B
> gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe0BlockLength|0x00|UINT8|0x000
> 1003C
> gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1BlockAddress|0x|UINT16|0
> x0001003D+
> gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1BlockLength|0x00|UINT8|0x000
> 1003E
> gMinPlatformPkgTokenSpaceGuid.PcdAcpiGpe1Base|0x00|UINT8|0x00010040
> gMinPlatformPkgTokenSpaceGuid.PcdAcpiResetRegisterAccessSize|0x00|UINT8
> |0x00010042 --
> 2.26.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92450): https://edk2.groups.io/g/devel/message/92450
Mute This Topic: https://groups.io/mt/93042291/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 v5 0/4] Resolving SecureBootVariableLib dependency

2022-08-15 Thread Kun Qin
This v5 series is a follow up of previously submitted patches:
https://edk2.groups.io/g/devel/message/92128

The v5 patches include a new `Reviewed-by` tag collected during the v4
round and skipped 2 patches merged during the last review cycle.

Patch v5 branch:https://github.com/kuqin12/edk2-platforms/tree/fix_sb_dep_v5

Cc: Ard Biesheuvel
Cc: Leif Lindholm
Cc: Graeme Gregory
Cc: Radoslaw Biernacki
Cc: Masami Hiramatsu
Cc: Nhi Pham
Cc: Vu Nguyen
Cc: Thang Nguyen
Cc: Chuong Tran
Cc: Thomas Abraham
Cc: Sami Mujawar
Cc: Abner Chang
Cc: Gilbert Chen
Cc: Daniel Schaefer
Cc: Jeremy Linton
Cc: Peng Xie
Cc: Ling Jia
Cc: Yiqi Shu

Kun Qin (4):
  RaspberryPi: Platform Build: Resolving newly introduced dependency
  U5SeriesPkg: Platform Build: Resolving newly introduced dependency
  AmpereAltraPkg: Platform Build: Resolving newly introduced dependency
  PhytiumCommonPkg: Platform Build: Resolving newly introduced
dependency

 Platform/RaspberryPi/RPi3/RPi3.dsc   | 1 +
 Platform/RaspberryPi/RPi4/RPi4.dsc   | 1 +
 Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc   | 1 +
 Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc | 1 +
 Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 1 +
 Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc| 1 +
 6 files changed, 6 insertions(+)

-- 
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92445): https://edk2.groups.io/g/devel/message/92445
Mute This Topic: https://groups.io/mt/93041955/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 v5 2/4] U5SeriesPkg: Platform Build: Resolving newly introduced dependency

2022-08-15 Thread Kun Qin
The new changes in SecureBootVariableLib brought in a new dependency
of PlatformPKProtectionLib.

This change added the new library instance from SecurityPkg to resolve
U5SeriesPkg platforms build.

Cc: Abner Chang 
Cc: Gilbert Chen 
Cc: Daniel Schaefer 

Signed-off-by: Kun Qin 
Reviewed-by: Daniel Schaefer 
---

Notes:
v2:
- No review, no change

v4:
- Updated commit title.

v5:
- Added reviewed-by tag. [Daniel]

 Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc   | 1 +
 Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc 
b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc
index 7b36b2c885e0..fc1ed012a541 100644
--- a/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc
+++ b/Platform/SiFive/U5SeriesPkg/FreedomU500VC707Board/U500.dsc
@@ -127,6 +127,7 @@ [LibraryClasses]
   AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
   
SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf
   
SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf
+  
PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf
 !else
   
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
diff --git 
a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc 
b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc
index 26895a75ec2f..e59955d09452 100644
--- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc
+++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc
@@ -127,6 +127,7 @@ [LibraryClasses]
   AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
   
SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf
   
SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf
+  
PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf
 !else
   
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
-- 
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92447): https://edk2.groups.io/g/devel/message/92447
Mute This Topic: https://groups.io/mt/93041957/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 v5 3/4] AmpereAltraPkg: Platform Build: Resolving newly introduced dependency

2022-08-15 Thread Kun Qin
The new changes in SecureBootVariableLib brought in a new dependency
of PlatformPKProtectionLib.

This change added the new library instance from SecurityPkg to resolve
AmpereAltraPkg platforms build.

Cc: Nhi Pham 
Cc: Vu Nguyen 
Cc: Thang Nguyen 
Cc: Chuong Tran 
Cc: Leif Lindholm 

Signed-off-by: Kun Qin 
Reviewed-by: Nhi Pham 
---

Notes:
v2:
- Added reviewed-by tag [Nhi]

v4:
- Updated commit title

v5:
- No change

 Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc 
b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc
index d4c29c3c338c..1e378e37e2b8 100644
--- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc
+++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dsc.inc
@@ -144,6 +144,7 @@ [LibraryClasses.common]
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
   
SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf
   
SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf
+  
PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf
 
   #
   # re-use the UserPhysicalPresent() dummy implementation from the ovmf tree
-- 
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92448): https://edk2.groups.io/g/devel/message/92448
Mute This Topic: https://groups.io/mt/93041958/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 v5 1/4] RaspberryPi: Platform Build: Resolving newly introduced dependency

2022-08-15 Thread Kun Qin
The new changes in SecureBootVariableLib brought in a new dependency
of PlatformPKProtectionLib.

This change added the new library instance from SecurityPkg to resolve
RaspberryPi platforms build.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Jeremy Linton 

Signed-off-by: Kun Qin 
Reviewed-by: Jeremy Linton 
---

Notes:
v2:
- Add reviewed-by tag [Jeremy]

v4:
- Updated commit title.

v5:
- No change.

 Platform/RaspberryPi/RPi3/RPi3.dsc | 1 +
 Platform/RaspberryPi/RPi4/RPi4.dsc | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Platform/RaspberryPi/RPi3/RPi3.dsc 
b/Platform/RaspberryPi/RPi3/RPi3.dsc
index 0eed03c097f8..4e7377a00036 100644
--- a/Platform/RaspberryPi/RPi3/RPi3.dsc
+++ b/Platform/RaspberryPi/RPi3/RPi3.dsc
@@ -169,6 +169,7 @@ [LibraryClasses.common]
   PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf
   
SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf
   
SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf
+  
PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf
 !else
   
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
   
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
diff --git a/Platform/RaspberryPi/RPi4/RPi4.dsc 
b/Platform/RaspberryPi/RPi4/RPi4.dsc
index eabddd7382cf..8ba0ca61851e 100644
--- a/Platform/RaspberryPi/RPi4/RPi4.dsc
+++ b/Platform/RaspberryPi/RPi4/RPi4.dsc
@@ -166,6 +166,7 @@ [LibraryClasses.common]
   AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
   
SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf
   
SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf
+  
PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf
 
   # re-use the UserPhysicalPresent() dummy implementation from the ovmf tree
   PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf
-- 
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92446): https://edk2.groups.io/g/devel/message/92446
Mute This Topic: https://groups.io/mt/93041956/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 v5 4/4] PhytiumCommonPkg: Platform Build: Resolving newly introduced dependency

2022-08-15 Thread Kun Qin
The new changes in SecureBootVariableLib brought in a new dependency
of PlatformPKProtectionLib.

This change added the new library instance from SecurityPkg to resolve
PhytiumCommonPkg platforms build.

Cc: Leif Lindholm 
Cc: Peng Xie 
Cc: Ling Jia 
Cc: Yiqi Shu 

Signed-off-by: Kun Qin 
Reviewed-by: Sami Mujawar 
---

Notes:
v2:
- No review, no change.

v3:
- Added reviewed-by tag [Sami].

v4:
- Updated commit title.

v5:
- No change.

 Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc 
b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc
index a7ca630be7b9..3c4440dac5f0 100644
--- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc
+++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc
@@ -83,6 +83,7 @@ [LibraryClasses.common]
   SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
   
SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf
   
SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf
+  
PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf
 
   TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
   
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
-- 
2.37.1.windows.1



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




Re: [edk2-devel] [PATCH v2 0/3] OvmfPkg: Check arguments for validity

2022-08-15 Thread Ard Biesheuvel
On Mon, 15 Aug 2022 at 18:31, Dimitrije Pavlov  wrote:
>
> Some functions across OVMF don't check pointer arguments for
> validity, which causes null pointer dereferences and crashes
> in the SCT test suite.
>
> This series adds checks to return EFI_INVALID_PARAMETER if a
> pointer argument is NULL.
>
> v2:
> - Add Liming Gao to Cc [Ard]
> - Turn individual patches into a series [Ard]
> - Fix issue with corrupted patches [Ard]
>
> Cc: Ard Biesheuvel 
> Cc: Jiewen Yao 
> Cc: Liming Gao 
> Cc: Sunny Wang 
> Cc: Jeff Booher-Kaeding 
> Cc: Samer El-Haj-Mahmoud 
>
> Dimitrije Pavlov (3):
>   OvmfPkg/PlatformDxe: Check ExtractConfig and RouteConfig arguments
>   OvmfPkg/VirtioGpuDxe: Check QueryMode arguments
>   OvmfPkg/VirtioFsDxe: Check GetDriverName arguments
>

Thank you for the resend.

@Liming: these are all bug fixes that affect SCT results, so unless
there are any objections, I intend to merge these tomorrow (Tuesday).

Thanks,
Ard.


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




[edk2-devel] [PATCH v2 3/3] OvmfPkg/VirtioFsDxe: Check GetDriverName arguments

2022-08-15 Thread Dimitrije Pavlov
The current implementation does not check if Language or DriverName
are NULL. This causes the SCT test suite to crash.

Add a check to return EFI_INVALID_PARAMETER if any of these pointers
are NULL.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Liming Gao 
Cc: Sunny Wang 
Cc: Jeff Booher-Kaeding 
Cc: Samer El-Haj-Mahmoud 

Signed-off-by: Dimitrije Pavlov 
---
 OvmfPkg/VirtioFsDxe/DriverBinding.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/OvmfPkg/VirtioFsDxe/DriverBinding.c 
b/OvmfPkg/VirtioFsDxe/DriverBinding.c
index 86eb9cf0ba51..3d80ff0f91f5 100644
--- a/OvmfPkg/VirtioFsDxe/DriverBinding.c
+++ b/OvmfPkg/VirtioFsDxe/DriverBinding.c
@@ -218,6 +218,10 @@ VirtioFsGetDriverName (
   OUT CHAR16**DriverName
   )
 {
+  if (Language == NULL || DriverName == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
   if (AsciiStrCmp (Language, "en") != 0) {
 return EFI_UNSUPPORTED;
   }
-- 
2.37.2



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




[edk2-devel] [PATCH v2 0/3] OvmfPkg: Check arguments for validity

2022-08-15 Thread Dimitrije Pavlov
Some functions across OVMF don't check pointer arguments for
validity, which causes null pointer dereferences and crashes
in the SCT test suite.

This series adds checks to return EFI_INVALID_PARAMETER if a
pointer argument is NULL.

v2:
- Add Liming Gao to Cc [Ard]
- Turn individual patches into a series [Ard]
- Fix issue with corrupted patches [Ard]

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Liming Gao 
Cc: Sunny Wang 
Cc: Jeff Booher-Kaeding 
Cc: Samer El-Haj-Mahmoud 

Dimitrije Pavlov (3):
  OvmfPkg/PlatformDxe: Check ExtractConfig and RouteConfig arguments
  OvmfPkg/VirtioGpuDxe: Check QueryMode arguments
  OvmfPkg/VirtioFsDxe: Check GetDriverName arguments

 OvmfPkg/PlatformDxe/Platform.c  | 8 
 OvmfPkg/VirtioFsDxe/DriverBinding.c | 4 
 OvmfPkg/VirtioGpuDxe/Gop.c  | 4 +++-
 3 files changed, 15 insertions(+), 1 deletion(-)

-- 
2.37.2



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




[edk2-devel] [PATCH v2 1/3] OvmfPkg/PlatformDxe: Check ExtractConfig and RouteConfig arguments

2022-08-15 Thread Dimitrije Pavlov
The current implementation does not check if Progress or Results
pointers in ExtractConfig are NULL, or if Progress pointer in
RouteConfig is NULL. This causes the SCT test suite to crash.

Add a check to return EFI_INVALID_PARAMETER if any of these pointers
are NULL.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Liming Gao 
Cc: Sunny Wang 
Cc: Jeff Booher-Kaeding 
Cc: Samer El-Haj-Mahmoud 

Signed-off-by: Dimitrije Pavlov 
---
 OvmfPkg/PlatformDxe/Platform.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/OvmfPkg/PlatformDxe/Platform.c b/OvmfPkg/PlatformDxe/Platform.c
index 4bf22712c78f..d7be2ab65efa 100644
--- a/OvmfPkg/PlatformDxe/Platform.c
+++ b/OvmfPkg/PlatformDxe/Platform.c
@@ -232,6 +232,10 @@ ExtractConfig (
 
   DEBUG ((DEBUG_VERBOSE, "%a: Request=\"%s\"\n", __FUNCTION__, Request));
 
+  if (Progress == NULL || Results == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
   Status = PlatformConfigToFormState ();
   if (EFI_ERROR (Status)) {
 *Progress = Request;
@@ -340,6 +344,10 @@ RouteConfig (
 Configuration
 ));
 
+  if (Progress == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
   //
   // the "read" step in RMW
   //
-- 
2.37.2



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




[edk2-devel] [PATCH v2 2/3] OvmfPkg/VirtioGpuDxe: Check QueryMode arguments

2022-08-15 Thread Dimitrije Pavlov
The current implementation does not check if Info or SizeInfo
pointers are NULL. This causes the SCT test suite to crash.

Add a check to return EFI_INVALID_PARAMETER if any of these
pointers are NULL.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Liming Gao 
Cc: Sunny Wang 
Cc: Jeff Booher-Kaeding 
Cc: Samer El-Haj-Mahmoud 

Signed-off-by: Dimitrije Pavlov 
---
 OvmfPkg/VirtioGpuDxe/Gop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/VirtioGpuDxe/Gop.c b/OvmfPkg/VirtioGpuDxe/Gop.c
index 401db47672ec..bb68b1cdc2bc 100644
--- a/OvmfPkg/VirtioGpuDxe/Gop.c
+++ b/OvmfPkg/VirtioGpuDxe/Gop.c
@@ -308,7 +308,9 @@ GopQueryMode (
 {
   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *GopModeInfo;
 
-  if (ModeNumber >= This->Mode->MaxMode) {
+  if (Info == NULL ||
+  SizeOfInfo == NULL ||
+  ModeNumber >= This->Mode->MaxMode) {
 return EFI_INVALID_PARAMETER;
   }
 
-- 
2.37.2



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




Re: [edk2-devel] [PATCH 01/10] UefiCpuPkg: Create CpuPageTableLib for manipulating X86 paging structs

2022-08-15 Thread Lendacky, Thomas via groups.io

On 7/18/22 08:18, Ni, Ray via groups.io wrote:

The lib includes two APIs:
* PageTableMap
   It creates/updates mapping from LA to PA.
   The implementation only supports paging structures used in 64bit
   mode now. PAE paging structure support will be added in future.

* PageTableParse
It parses the page table and returns the mapping relations in an
   array of IA32_MAP_ENTRY.

It passed some stress tests. These test code will be upstreamed in
other patches following edk2 Unit Test framework.

Signed-off-by: Ray Ni 
Cc: Eric Dong 


Hi Ray,

How do you envision this library working with SEV and/or TDX which use the 
one of the bits in PageTableBaseAddress to indicate whether the page is 
encrypted or shared? For SEV, the encryption mask is set in the 
PcdPteMemoryEncryptionAddressOrMask PCD, are you planning on using that at 
all or is it expected that caller will set/clear the appropriate bits in 
the PageTableBaseAddress field?


Thanks,
Tom


---
  UefiCpuPkg/Include/Library/CpuPageTableLib.h  | 129 +
  .../Library/CpuPageTableLib/CpuPageTable.h| 204 +++
  .../CpuPageTableLib/CpuPageTableLib.inf   |  35 ++
  .../Library/CpuPageTableLib/CpuPageTableMap.c | 543 ++
  .../CpuPageTableLib/CpuPageTableParse.c   | 330 +++
  UefiCpuPkg/UefiCpuPkg.dec |   3 +
  UefiCpuPkg/UefiCpuPkg.dsc |   4 +-
  7 files changed, 1247 insertions(+), 1 deletion(-)
  create mode 100644 UefiCpuPkg/Include/Library/CpuPageTableLib.h
  create mode 100644 UefiCpuPkg/Library/CpuPageTableLib/CpuPageTable.h
  create mode 100644 UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf
  create mode 100644 UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableMap.c
  create mode 100644 UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableParse.c

diff --git a/UefiCpuPkg/Include/Library/CpuPageTableLib.h 
b/UefiCpuPkg/Include/Library/CpuPageTableLib.h
new file mode 100644
index 00..2dc9b7d18e
--- /dev/null
+++ b/UefiCpuPkg/Include/Library/CpuPageTableLib.h
@@ -0,0 +1,129 @@
+/** @file
+  Public include file for PageTableLib library.
+
+  Copyright (c) 2022, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef PAGE_TABLE_LIB_H_
+#define PAGE_TABLE_LIB_H_
+
+typedef union {
+  struct {
+UINT64Present  : 1; // 0 = Not present in memory, 1 = 
Present in memory
+UINT64ReadWrite: 1; // 0 = Read-Only, 1= Read/Write
+UINT64UserSupervisor   : 1; // 0 = Supervisor, 1=User
+UINT64WriteThrough : 1; // 0 = Write-Back caching, 
1=Write-Through caching
+UINT64CacheDisabled: 1; // 0 = Cached, 1=Non-Cached
+UINT64Accessed : 1; // 0 = Not accessed, 1 = Accessed (set 
by CPU)
+UINT64Dirty: 1; // 0 = Not dirty, 1 = Dirty (set by 
CPU)
+UINT64Pat  : 1; // PAT
+
+UINT64Global   : 1; // 0 = Not global, 1 = Global (if 
CR4.PGE = 1)
+UINT64Reserved1: 3; // Ignored
+
+UINT64PageTableBaseAddress : 40; // Page Table Base Address
+UINT64Reserved2: 7;  // Ignored
+UINT64ProtectionKey: 4;  // Protection key
+UINT64Nx   : 1;  // No Execute bit
+  } Bits;
+  UINT64Uint64;
+} IA32_MAP_ATTRIBUTE;
+
+#define IA32_MAP_ATTRIBUTE_PAGE_TABLE_BASE_ADDRESS_MASK  0xFF000ull
+#define IA32_MAP_ATTRIBUTE_PAGE_TABLE_BASE_ADDRESS(pa)  ((pa)->Uint64 & 
IA32_MAP_ATTRIBUTE_PAGE_TABLE_BASE_ADDRESS_MASK)
+#define IA32_MAP_ATTRIBUTE_ATTRIBUTES(pa)   ((pa)->Uint64 & 
~IA32_MAP_ATTRIBUTE_PAGE_TABLE_BASE_ADDRESS_MASK)
+
+//
+// Below enum follows "4.1.1 Four Paging Modes" in Chapter 4 Paging of SDM 
Volume 3.
+// Page1GB is only supported in 4-level and 5-level.
+//
+typedef enum {
+  Paging32bit,
+
+  //
+  // High byte in paging mode indicates the max levels of the page table.
+  // Low byte in paging mode indicates the max level that can be a leaf entry.
+  //
+  PagingPae = 0x0302,
+
+  Paging4Level= 0x0402,
+  Paging4Level1GB = 0x0403,
+
+  Paging5Level= 0x0502,
+  Paging5Level1GB = 0x0503,
+
+  PagingModeMax
+} PAGING_MODE;
+
+/**
+  Create or update page table to map [LinearAddress, LinearAddress + Length) 
with specified attribute.
+
+  @param[in, out] PageTable  The pointer to the page table to update, or 
pointer to NULL if a new page table is to be created.
+  @param[in]  PagingMode The paging mode.
+  @param[in]  Buffer The free buffer to be used for page table 
creation/updating.
+  @param[in, out] BufferSize The buffer size.
+ On return, the remaining buffer size.
+ The free buffer is used from the end so 
caller can supply the same Buffer pointer with an updated
+ BufferSize in the second call to this API.
+  @param[in]  LinearAddress  

Re: [edk2-devel] [PATCH v1 1/1] OvmfPkg/VirtioFsDxe: Check GetDriverName arguments

2022-08-15 Thread Ard Biesheuvel
On Mon, 15 Aug 2022 at 16:59, Dimitrije Pavlov  wrote:
>
> The current implementation does not check if Language or DriverName
> are NULL. This causes the SCT test suite to crash.
>
> Add a check to return EFI_INVALID_PARAMETER if any of these pointers
> are NULL.
>
> Cc: Ard Biesheuvel 
> Cc: Jiewen Yao 
> Cc: Sunny Wang 
> Cc: Jeff Booher-Kaeding 
> Cc: Samer El-Haj-Mahmoud 
>
> Signed-off-by: Dimitrije Pavlov 

Hello Dimitrije,

These patches look corrupted again. Can you please double check your
setup, and maybe compare notes with colleagues how to send patches to
the list in a way that doesn't corrupt them?

And when you resubmit, please cc liming gao as well - he is in charge
of the stable tag release process, and these are all bug fixes that
should be included in the tag. Also, please turn these individual
patches into a single series.


> ---
>  OvmfPkg/VirtioFsDxe/DriverBinding.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/OvmfPkg/VirtioFsDxe/DriverBinding.c 
> b/OvmfPkg/VirtioFsDxe/DriverBinding.c
> index 86eb9cf0ba51..3d80ff0f91f5 100644
> --- a/OvmfPkg/VirtioFsDxe/DriverBinding.c
> +++ b/OvmfPkg/VirtioFsDxe/DriverBinding.c
> @@ -218,6 +218,10 @@ VirtioFsGetDriverName (
>OUT CHAR16**DriverName
>)
>  {
> +  if (Language  NULL || DriverName  NULL) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +
>if (AsciiStrCmp (Language, "en") ! 0) {
>  return EFI_UNSUPPORTED;
>}
> --
> 2.37.1
>
>
>
> 
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#92434): https://edk2.groups.io/g/devel/message/92434
> Mute This Topic: https://groups.io/mt/93038111/5717338
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [ardb+tianoc...@kernel.org]
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92438): https://edk2.groups.io/g/devel/message/92438
Mute This Topic: https://groups.io/mt/93038111/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] OvmfPkg/PlatformDxe: Check ExtractConfig and RouteConfig arguments

2022-08-15 Thread Dimitrije Pavlov
The current implementation does not check if Progress or Results
pointers in ExtractConfig are NULL, or if Progress pointer in
RouteConfig is NULL. This causes the SCT test suite to crash.

Add a check to return EFI_INVALID_PARAMETER if any of these pointers
are NULL.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Sunny Wang 
Cc: Jeff Booher-Kaeding 
Cc: Samer El-Haj-Mahmoud 

Signed-off-by: Dimitrije Pavlov 
---
 OvmfPkg/PlatformDxe/Platform.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/OvmfPkg/PlatformDxe/Platform.c b/OvmfPkg/PlatformDxe/Platform.c
index 4bf22712c78f..d7be2ab65efa 100644
--- a/OvmfPkg/PlatformDxe/Platform.c
+++ b/OvmfPkg/PlatformDxe/Platform.c
@@ -232,6 +232,10 @@ ExtractConfig (

   DEBUG ((DEBUG_VERBOSE, "%a: Request=\"%s\"\n", __FUNCTION__, Request));

+  if (Progress == NULL || Results == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
   Status = PlatformConfigToFormState ();
   if (EFI_ERROR (Status)) {
 *Progress = Request;
@@ -340,6 +344,10 @@ RouteConfig (
 Configuration
 ));

+  if (Progress == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
   //
   // the "read" step in RMW
   //
--
2.37.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92437): https://edk2.groups.io/g/devel/message/92437
Mute This Topic: https://groups.io/mt/93038203/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] OvmfPkg/VirtioGpuDxe: Check QueryMode arguments for validity

2022-08-15 Thread Dimitrije Pavlov
The current implementation does not check if Info or SizeInfo
pointers are NULL. This causes the SCT test suite to crash.

Add a check to return EFI_INVALID_PARAMETER if any of these
pointers are NULL.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Sunny Wang 
Cc: Jeff Booher-Kaeding 
Cc: Samer El-Haj-Mahmoud 

Signed-off-by: Dimitrije Pavlov 
---
 OvmfPkg/VirtioGpuDxe/Gop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/VirtioGpuDxe/Gop.c b/OvmfPkg/VirtioGpuDxe/Gop.c
index 401db47672ec..bb68b1cdc2bc 100644
--- a/OvmfPkg/VirtioGpuDxe/Gop.c
+++ b/OvmfPkg/VirtioGpuDxe/Gop.c
@@ -308,7 +308,9 @@ GopQueryMode (
 {
   EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  *GopModeInfo;

-  if (ModeNumber >= This->Mode->MaxMode) {
+  if (Info == NULL ||
+  SizeOfInfo == NULL ||
+  ModeNumber >= This->Mode->MaxMode) {
 return EFI_INVALID_PARAMETER;
   }

--
2.37.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92436): https://edk2.groups.io/g/devel/message/92436
Mute This Topic: https://groups.io/mt/93038176/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 MptScsi and PvScsi reviewers

2022-08-15 Thread Gerd Hoffmann
On Tue, Jul 26, 2022 at 12:46:38PM -0700, Michael D Kinney wrote:
> The email addresses for the reviewers of the MptScsi and
> PvScsi in the OvmfPkg are no longer valid.  Remove the
> reviewers for the MptScsi and PvScsi drivers until new
> maintainers/reviewers can be identified.
> 
> Cc: Andrew Fish 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> Cc: Jiewen Yao 
> Cc: Jordan Justen 
> Cc: Gerd Hoffmann 
> Signed-off-by: Michael D Kinney 
> 
> Michael D Kinney (2):
>   OvmfPkg: Change default to disable MptScsi and PvScsi
>   Maintainers.txt: Remove MptScsi and PvScsi reviewers

Acked-by: Gerd Hoffmann 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92435): https://edk2.groups.io/g/devel/message/92435
Mute This Topic: https://groups.io/mt/92635539/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] OvmfPkg/VirtioFsDxe: Check GetDriverName arguments

2022-08-15 Thread Dimitrije Pavlov
The current implementation does not check if Language or DriverName
are NULL. This causes the SCT test suite to crash.

Add a check to return EFI_INVALID_PARAMETER if any of these pointers
are NULL.

Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Sunny Wang 
Cc: Jeff Booher-Kaeding 
Cc: Samer El-Haj-Mahmoud 

Signed-off-by: Dimitrije Pavlov 
---
 OvmfPkg/VirtioFsDxe/DriverBinding.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/OvmfPkg/VirtioFsDxe/DriverBinding.c 
b/OvmfPkg/VirtioFsDxe/DriverBinding.c
index 86eb9cf0ba51..3d80ff0f91f5 100644
--- a/OvmfPkg/VirtioFsDxe/DriverBinding.c
+++ b/OvmfPkg/VirtioFsDxe/DriverBinding.c
@@ -218,6 +218,10 @@ VirtioFsGetDriverName (
   OUT CHAR16**DriverName
   )
 {
+  if (Language == NULL || DriverName == NULL) {
+return EFI_INVALID_PARAMETER;
+  }
+
   if (AsciiStrCmp (Language, "en") != 0) {
 return EFI_UNSUPPORTED;
   }
--
2.37.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92434): https://edk2.groups.io/g/devel/message/92434
Mute This Topic: https://groups.io/mt/93038111/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] OvmfPkg: increase max debug message length to 512

2022-08-15 Thread Gerd Hoffmann
On Wed, Aug 10, 2022 at 10:11:40AM +0200, Oliver Steffen wrote:
> From: Laszlo Ersek 
> 
> Increase the maximum line length for debug messages.
> While log messages should be short, they can still
> get quite long, for example when printing device paths
> or config strings in HII routing.
> 512 chars is an empirically good value.
> 
> Signed-off-by: Laszlo Ersek 
> Signed-off-by: Oliver Steffen 
> ---
>  OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c 
> b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> index 4e25f198aa76..640627f38b72 100644
> --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
> @@ -21,7 +21,7 @@
>  //
>  // Define the maximum debug and assert message length that this library 
> supports
>  //
> -#define MAX_DEBUG_MESSAGE_LENGTH  0x100
> +#define MAX_DEBUG_MESSAGE_LENGTH  0x200

Acked-by: Gerd Hoffmann 

take care,
  Gerd



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




Re: [edk2-devel] [PATCH v2] MdeModulePkg/NonDiscoverablePciDeviceDxe: Allow partial FreeBuffer

2022-08-15 Thread Ard Biesheuvel
On Fri, 5 Aug 2022 at 18:56, Jeff Brasen via groups.io
 wrote:
>
>
>
> > -Original Message-
> > From: Ard Biesheuvel 
> > Sent: Tuesday, August 2, 2022 10:51 AM
> > To: Jeff Brasen 
> > Cc: devel@edk2.groups.io; hao.a...@intel.com; ray...@intel.com;
> > quic_llind...@quicinc.com; ardb+tianoc...@kernel.org
> > Subject: Re: [PATCH v2] MdeModulePkg/NonDiscoverablePciDeviceDxe:
> > Allow partial FreeBuffer
> >
> > External email: Use caution opening links or attachments
> >
> >
> > On Tue, 2 Aug 2022 at 17:32, Jeff Brasen  wrote:
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: Ard Biesheuvel 
> > > > Sent: Friday, July 29, 2022 9:48 AM
> > > > To: Jeff Brasen 
> > > > Cc: devel@edk2.groups.io; hao.a...@intel.com; ray...@intel.com;
> > > > quic_llind...@quicinc.com; ardb+tianoc...@kernel.org
> > > > Subject: Re: [PATCH v2] MdeModulePkg/NonDiscoverablePciDeviceDxe:
> > > > Allow partial FreeBuffer
> > > >
> > > > External email: Use caution opening links or attachments
> > > >
> > > >
> > > > On Thu, 28 Jul 2022 at 13:25, Jeff Brasen  wrote:
> > > > >
> > > > >
> > > > > Adding Leif/Ard to CC incase they have any comments on this patch.
> > > > >
> > > >
> > > > This generally looks ok to me. I just wonder if it wouldn't be
> > > > simpler to reuse the existing allocation descriptor if it is not
> > > > being freed entirely. Given the [presumably] the most common case is
> > > > to allocate and then free some pages at the end, lowering the page
> > > > count on the existing descriptor would cover most cases, and we'd
> > > > only need to allocate new ones if pages are being freed at the start or 
> > > > in
> > the middle.
> > >
> > > There is often freeing at the beginning as well as this is being used to 
> > > create
> > a 64K aligned section of memory in the case. So it over allocates and the
> > free's some at the beginning and the end. I could probably make it detect
> > and use that but figured this code would support all cases and required less
> > case specific detection.
> > >
> >
> > Ah interesting. Would it help if the allocate routine aligned allocations 
> > to their
> > size?
>
> The PciIo->AllocateBuffer function doesn't support passing the request in so 
> we would need to know that info beforehand. The current calling in the XHCI 
> driver does a free at the beginning and then the end of the buffer so we 
> could the existing allocation tracker but figured it would be better to 
> correct the function just in case someone called it to free in the middle.
>

What I was wondering is whether such allocations are themselves
multiples of 64k. This is perhaps orthogonal to the issue this patch
addresses, as we'' still need to deal with partial free calls
regardless. But I was curious whether XHCI in particular, and perhaps
more generally, we could streamline this by aligning all allocations
to a log2 upper bound of their sizes.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92432): https://edk2.groups.io/g/devel/message/92432
Mute This Topic: https://groups.io/mt/89143704/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 v4 4/6] Socionext: Platform Build: Resolving newly introduced dependency

2022-08-15 Thread Ard Biesheuvel
On Thu, 11 Aug 2022 at 00:54, Kun Qin  wrote:
>
> Hi Ard,
>
> Could you please help review this patch? Any feedback in appreciated.
>

Thanks for the fix

Reviewed-by: Ard Biesheuvel 

Pushed as 01e3a8877180..9675047d7245
>

> On 8/4/2022 5:35 PM, Kun Qin via groups.io wrote:
> > The new changes in SecureBootVariableLib brought in a new dependency
> > of PlatformPKProtectionLib.
> >
> > This change added the new library instance from SecurityPkg to resolve
> > DeveloperBox platforms build.
> >
> > Cc: Ard Biesheuvel 
> > Cc: Leif Lindholm 
> > Cc: Masami Hiramatsu 
> >
> > Signed-off-by: Kun Qin 
> > ---
> >
> > Notes:
> >  v2:
> >  - No review, no change.
> >
> >  v4:
> >  - Updated commit title.
> >
> >   Platform/Socionext/DeveloperBox/DeveloperBox.dsc | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc 
> > b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> > index 8419c89318fb..917c1532fb3c 100644
> > --- a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> > +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> > @@ -55,6 +55,7 @@ [LibraryClasses]
> >   !if $(SECURE_BOOT_ENABLE) == TRUE
> >
> > 
> > SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf
> >
> > 
> > SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf
> >
> > +  
> > PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf
> >
> >   !endif
> >
> >
> >
> >   [LibraryClasses.common.SEC]
> >


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




Re: [edk2-devel] [PATCH edk2-platforms v1 1/1] Platform/ARM: FVP: Fix build break when Secure Boot is enabled

2022-08-15 Thread Ard Biesheuvel
On Mon, 15 Aug 2022 at 16:10, Sami Mujawar  wrote:
>
> The edk2 patch at:
> "6eb407947592 SecurityPkg: SecureBootVariableLib: Added
> newly supported interfaces" introduced a new dependency
> of PlatformPKProtectionLib to SecureBootVariableLib.
>
> This causes the FVP model platform builds to fail when
> Secure Boot is enabled (i.e. SECURE_BOOT_ENABLE = TRUE).
>
> Therefore, add PlatformPKProtectionLib library instance
> to Platform\ARM\VExpressPkg\ArmVExpress.dsc.inc to fix
> the build.
>
> Cc: Ard Biesheuvel 
> Cc: Thomas Abraham 
>
> Signed-off-by: Sami Mujawar 

Thanks for the fix

Reviewed-by: Ard Biesheuvel 

Pushed as 01e3a8877180..9675047d7245

> ---
>  Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc 
> b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> index 
> e637f8933f792753213740f838e16e7180dd9469..17e4a3fd13d7517fd5e357e2cfc8aadd96dcdeea
>  100644
> --- a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> +++ b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> @@ -143,6 +143,7 @@ [LibraryClasses.common]
>AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
>
> SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf
>
> SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf
> +  
> PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf
>
># re-use the UserPhysicalPresent() dummy implementation from the ovmf tree
>PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
>
>
>
> 
>
>


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




[edk2-devel] [PATCH edk2-platforms v1 1/1] Platform/ARM: FVP: Fix build break when Secure Boot is enabled

2022-08-15 Thread Sami Mujawar
The edk2 patch at:
"6eb407947592 SecurityPkg: SecureBootVariableLib: Added
newly supported interfaces" introduced a new dependency
of PlatformPKProtectionLib to SecureBootVariableLib.

This causes the FVP model platform builds to fail when
Secure Boot is enabled (i.e. SECURE_BOOT_ENABLE = TRUE).

Therefore, add PlatformPKProtectionLib library instance
to Platform\ARM\VExpressPkg\ArmVExpress.dsc.inc to fix
the build.

Cc: Ard Biesheuvel 
Cc: Thomas Abraham 

Signed-off-by: Sami Mujawar 
---
 Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc 
b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
index 
e637f8933f792753213740f838e16e7180dd9469..17e4a3fd13d7517fd5e357e2cfc8aadd96dcdeea
 100644
--- a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
+++ b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
@@ -143,6 +143,7 @@ [LibraryClasses.common]
   AuthVariableLib|SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
   
SecureBootVariableLib|SecurityPkg/Library/SecureBootVariableLib/SecureBootVariableLib.inf
   
SecureBootVariableProvisionLib|SecurityPkg/Library/SecureBootVariableProvisionLib/SecureBootVariableProvisionLib.inf
+  
PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf
 
   # re-use the UserPhysicalPresent() dummy implementation from the ovmf tree
   PlatformSecureLib|OvmfPkg/Library/PlatformSecureLib/PlatformSecureLib.inf
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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




Re: [edk2-devel] [PATCH 2/2] OvmfPkg/OvmfPkgX64: Allow runtime control of IPv4 and IPv6 support

2022-08-15 Thread Gerd Hoffmann
On Mon, Aug 15, 2022 at 11:40:30AM +0200, Ard Biesheuvel wrote:
> Wire up the newly added DriverLoadInhibitorLib in a way that ties
> dispatch of the Ip4Dxe and Ip6Dxe drivers to QEMU fw_cfg variables
> 'opt/org.tianocore/IPv4Support' and 'opt/org.tianocore/IPv6Support'
> respectively.
> 
> Setting both variables to 'n' disables IP based networking entirely,
> without the need for additional code changes at the NIC driver or
> network boot protocol level.
> 
> Signed-off-by: Ard Biesheuvel 
> ---
>  OvmfPkg/OvmfPkgX64.dsc | 14 ++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index 6e68f60dc90f..0c0ded88f86e 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ b/OvmfPkg/OvmfPkgX64.dsc
> @@ -947,6 +947,20 @@ [Components]
>NULL|OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcdProducerLib.inf
>}
>  
> +  NetworkPkg/Ip4Dxe/Ip4Dxe.inf {
> +
> +  NULL|OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.inf
> +
> +  
> gUefiOvmfPkgTokenSpaceGuid.PcdDriverInhibitorFwCfgVarName|"opt/org.tianocore/IPv4Support"
> +  }
> +
> +  NetworkPkg/Ip6Dxe/Ip6Dxe.inf {
> +
> +  NULL|OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.inf
> +
> +  
> gUefiOvmfPkgTokenSpaceGuid.PcdDriverInhibitorFwCfgVarName|"opt/org.tianocore/IPv6Support"
> +  }
> +

Hmm.  Not a comment to this specifically, but more to the OVMF *.dsc and
*.fdf files in general.  We have a lot of duplication here.  I've
already moved some bits to include files (OvmfPkg/OvmfTpm*.inc for
example) to reduce that.  Makes maintainance easier and builds more
consistent.

This looks like a prime candidate for a new OvmfNetwork.dsc.inc file,
so we can easily get that for all build variants and not only X64.

And there is more which we can split out.  crypto (have an experimental
branch doing that as part of my CryptoPkg/Driver experiments).  drivers
(usb / virtio / ...).  Shell.efi

Maybe it makes sense to move those include snippets into a subdirectory
so they don't pile up in OvmfPkg/ when we move more stuff to includes?

take care,
  Gerd



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




Re: [edk2-devel] [PATCH] OvmfPkg: Update I/O port related to ACPI devices for CloudHv

2022-08-15 Thread Gerd Hoffmann
On Thu, Aug 11, 2022 at 02:40:57PM +0200, Boeuf, Sebastien wrote:
> From: Sebastien Boeuf 
> 
> Both ACPI shutdown and ACPI PM timer devices has been moved to different
> port addresses in the latest version of Cloud Hypervisor. These changes
> need to be reflected on the OVMF firmware.

Can this be detected by the guest somehow, so the firmware can work with
both old+new cloudhv?

Requiring lockstep updates tends to be painful, so we try avoid that
with qemu ...

(just a suggestion, not an objection)

Acked-by: Gerd Hoffmann 

take care,
  Gerd



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




[edk2-devel] [OVMF] Using EFI_TIMESTAMP_PROTOCOL in OVMF

2022-08-15 Thread Ayush Singh
Hello everyone. I wanted to ask if there was a device/parameter to have
`EFI_TIMESTAMP_PROTOCOL` in OVMF.

I would like to use this protocol to provide monotonic time in Rust (and
fall back to platform-specific registers in case the protocol is absent).
However, in the default qemu configuration, there is no handle supporting
`EFI_TIMESTAMP_PROTOCOL`.


For more information on what I am trying to implement, see
`std::time::Instant` [1] and the PR comment [2].


Yours Sincerely

Ayush Singh


[1]: https://doc.rust-lang.org/std/time/struct.Instant.html

[2]: https://github.com/rust-lang/rust/pull/100316#discussion_r945313267


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




[edk2-devel] [PATCH EDK2 v2 1/1] MdeModulePkg/PiSmmCore:Avoid overflow risk

2022-08-15 Thread wenyi,xie via groups.io
As the CommunicationBuffer plus BufferSize may overflow, check the
value first before using.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Eric Dong 
Cc: Ray Ni 
Signed-off-by: Wenyi Xie 
---
 MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 5 -
 MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c  | 4 
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c 
b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
index 9e5c6cbe33dd..a2a97a4056ee 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c
@@ -621,6 +621,9 @@ InternalIsBufferOverlapped (
   IN UINTN  Size2
   )
 {
+  if (((UINTN)Buff1 > MAX_UINTN - Size1) || ((UINTN)Buff2 > MAX_UINTN - 
Size2)) {
+return TRUE;
+  }
   //
   // If buff1's end is less than the start of buff2, then it's ok.
   // Also, if buff1's start is beyond buff2's end, then it's ok.
@@ -703,7 +706,7 @@ SmmEntryPoint (
 //
 // If CommunicationBuffer is not in valid address scope,
 // or there is overlap between gSmmCorePrivate and CommunicationBuffer,
-// return EFI_INVALID_PARAMETER
+// return EFI_ACCESS_DENIED
 //
 gSmmCorePrivate->CommunicationBuffer = NULL;
 gSmmCorePrivate->ReturnStatus= EFI_ACCESS_DENIED;
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c 
b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
index 4f00cebaf5ed..fe3e6ba54281 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
@@ -525,6 +525,10 @@ SmmCommunicationCommunicate (
 
   CommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *)CommBuffer;
 
+  if (CommunicateHeader->MessageLength > MAX_UINTN - OFFSET_OF 
(EFI_SMM_COMMUNICATE_HEADER, Data)) {
+return EFI_INVALID_PARAMETER;
+  }
+
   if (CommSize == NULL) {
 TempCommSize = OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data) + 
CommunicateHeader->MessageLength;
   } else {
-- 
2.20.1.windows.1



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




[edk2-devel] [PATCH EDK2 v2 0/1] MdeModulePkg/PiSmmCore:Avoid overflow risk

2022-08-15 Thread wenyi,xie via groups.io
Main Changes since v1 :
1.treate overflow as overlap

Wenyi Xie (1):
  MdeModulePkg/PiSmmCore:Avoid overflow risk

 MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 5 -
 MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c  | 4 
 2 files changed, 8 insertions(+), 1 deletion(-)

-- 
2.20.1.windows.1



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




Re: [edk2-devel] [PATCH] DynamicTablesPkg: Add support to build _DSD

2022-08-15 Thread Sami Mujawar

Hi Jeff, Pierre,

Please findmy response inline marked [SAMI].

Regards,

Sami Mujawar

On 12/08/2022 02:36 pm, Pierre Gondois wrote:

Hi Jeff,
Please find some inline comments below:

On 8/5/22 17:14, Jeff Brasen via groups.io wrote:

Add APIs needed to build _DSD with different UUIDs.

This is per ACPI specification 6.4 s6.2.5.



Adds support for building data packages with format

Package {"Name", Integer}



Signed-off-by: Jeff Brasen 

---

  .../Include/Library/AmlLib/AmlLib.h   |  50 

  .../Common/AmlLib/CodeGen/AmlCodeGen.c    | 236 ++

  2 files changed, 286 insertions(+)



diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h 
b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h


index 6f214c0dfa..30cab3f6bb 100644

--- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h

+++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h

@@ -1280,6 +1280,56 @@ AmlAddLpiState (

    IN  AML_OBJECT_NODE_HANDLE  LpiNode

    );


+/** AML code generation for a _DSD device data object.

+

+  AmlAddDeviceDataDescriptorPackage (Uuid, ParentNode, 
NewObjectNode) is


+  equivalent of the following ASL code:

+    ToUUID(Uuid),

+    Package () {}

+

+  @ingroup CodeGenApis

+

+  @param [in]  Uuid   The Uuid of the descriptor to be created

+  @param [in]  DsdNode    Node of the DSD Package.

+  @param [out] PackageNode    If success, contains the created 
package node.


+

+  @retval EFI_SUCCESS Success.

+  @retval EFI_INVALID_PARAMETER   Invalid parameter.

+  @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.

+**/

+EFI_STATUS

+EFIAPI

+AmlAddDeviceDataDescriptorPackage (

+  IN  CONST EFI_GUID    *Uuid,

+  IN    AML_OBJECT_NODE_HANDLE  DsdNode,

+  OUT   AML_OBJECT_NODE_HANDLE  *PackageNode

+  );

+

+/** AML code generation to add a package with a name and value,

+ *  to a parent package> +

+  AmlAddNameValuePackage ("Name", Value, ParentNode) is

+  equivalent of the following ASL code:

+    Package (2) {"Name", Value}

+

+  @ingroup CodeGenApis

+

+  @param [in]  Name   String to place in first entry of package

+  @param [in]  Value  Integer to place in second entry of 
package


+  @param [in]  PackageNode    Package to add new sub package to.

+

+  @retval EFI_SUCCESS Success.

+  @retval EFI_INVALID_PARAMETER   Invalid parameter.

+  @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.

+**/

+EFI_STATUS

+EFIAPI

+AmlAddNameIntegerPackage (

+  IN CHAR8   *Name,

+  IN UINT64  Value,

+  IN AML_OBJECT_NODE_HANDLE  PackageNode

+  );

+

  // DEPRECATED APIS

  #ifndef DISABLE_NEW_DEPRECATED_INTERFACES


diff --git 
a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c 
b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c


index e51d2dd7f0..80e43d0e62 100644

--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c

+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c

@@ -2600,3 +2600,239 @@ error_handler:


    return Status;

  }

+

+/** AML code generation for a _DSD device data object.

+

+  AmlAddDeviceDataDescriptorPackage (Uuid, ParentNode, 
NewObjectNode) is


I think this is DsdNode and PackageNode (same for the header file).


+  equivalent of the following ASL code:

+    ToUUID(Uuid),

+    Package () {}

+

+  @ingroup CodeGenApis

+

+  @param [in]  Uuid   The Uuid of the descriptor to be created

+  @param [in]  DsdNode    Node of the DSD Package.

+  @param [out] PackageNode    If success, contains the created 
package node.


+

+  @retval EFI_SUCCESS Success.

+  @retval EFI_INVALID_PARAMETER   Invalid parameter.

+  @retval EFI_OUT_OF_RESOURCES    Failed to allocate memory.

+**/

+EFI_STATUS

+EFIAPI

+AmlAddDeviceDataDescriptorPackage (

+  IN  CONST EFI_GUID    *Uuid,

+  IN    AML_OBJECT_NODE_HANDLE  DsdNode,

+  OUT   AML_OBJECT_NODE_HANDLE  *PackageNode

+  )

+{

+  EFI_STATUS  Status;

+  AML_OBJECT_NODE *UuidNode;

+  AML_DATA_NODE   *UuidDataNode;

+  AML_OBJECT_NODE_HANDLE  DsdEntryList;

+

+  if ((Uuid == NULL) ||

+  (PackageNode == NULL) ||

+  (AmlGetNodeType ((AML_NODE_HANDLE)DsdNode) != EAmlNodeObject) ||

+  (!AmlNodeHasOpCode (DsdNode, AML_NAME_OP, 0)) ||

+  !AmlNameOpCompareName (DsdNode, "_DSD"))

+  {

+    ASSERT (0);


This is not consistent in the file, but it could be:
  ASSERT_EFI_ERROR (ASSERT_EFI_ERROR)
[SAMI] I am fine with using either ASSERTxxx macros. The only think that 
needs to be taken care of is that the errors are handled in release 
builds (as the ASSERTxxx macros will vanish in release builds).




+    return EFI_INVALID_PARAMETER;

+  }

+

+  // Get the Package object node of the _DSD node,

+  // which is the 2nd fixed argument (i.e. index 1).

+  DsdEntryList = 

[edk2-devel] [PATCH 2/2] OvmfPkg/OvmfPkgX64: Allow runtime control of IPv4 and IPv6 support

2022-08-15 Thread Ard Biesheuvel
Wire up the newly added DriverLoadInhibitorLib in a way that ties
dispatch of the Ip4Dxe and Ip6Dxe drivers to QEMU fw_cfg variables
'opt/org.tianocore/IPv4Support' and 'opt/org.tianocore/IPv6Support'
respectively.

Setting both variables to 'n' disables IP based networking entirely,
without the need for additional code changes at the NIC driver or
network boot protocol level.

Signed-off-by: Ard Biesheuvel 
---
 OvmfPkg/OvmfPkgX64.dsc | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 6e68f60dc90f..0c0ded88f86e 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -947,6 +947,20 @@ [Components]
   NULL|OvmfPkg/Library/PxeBcPcdProducerLib/PxeBcPcdProducerLib.inf
   }
 
+  NetworkPkg/Ip4Dxe/Ip4Dxe.inf {
+
+  NULL|OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.inf
+
+  
gUefiOvmfPkgTokenSpaceGuid.PcdDriverInhibitorFwCfgVarName|"opt/org.tianocore/IPv4Support"
+  }
+
+  NetworkPkg/Ip6Dxe/Ip6Dxe.inf {
+
+  NULL|OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.inf
+
+  
gUefiOvmfPkgTokenSpaceGuid.PcdDriverInhibitorFwCfgVarName|"opt/org.tianocore/IPv6Support"
+  }
+
 !if $(NETWORK_TLS_ENABLE) == TRUE
   NetworkPkg/TlsAuthConfigDxe/TlsAuthConfigDxe.inf {
 
-- 
2.35.1



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




[edk2-devel] [PATCH 1/2] OvmfPkg: Introduce NULL class library to inhibit driver load

2022-08-15 Thread Ard Biesheuvel
Add a new library that can be incorporated into any driver built from
source, and which permits loading of the driver to be inhibited based on
the value of a QEMU fw_cfg boolean variable. This will be used in a
subsequent patch to allow dispatch of the IPv6 and IPv6 network protocol
driver to be controlled from the QEMU command line.

Signed-off-by: Ard Biesheuvel 
---
 OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.c   | 30 

 OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.inf | 28 
++
 OvmfPkg/OvmfPkg.dec   |  4 +++
 3 files changed, 62 insertions(+)

diff --git a/OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.c 
b/OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.c
new file mode 100644
index ..dc8544bc38be
--- /dev/null
+++ b/OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.c
@@ -0,0 +1,30 @@
+// @file
+// Copyright (c) 2022, Google LLC. All rights reserved.
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+
+#include 
+
+#include 
+#include 
+
+STATIC CHAR16 mExitData[] = L"Driver dispatch inhibited by QEMU fw_cfg 
variable.";
+
+EFI_STATUS
+EFIAPI
+DriverLoadInhibitorLibConstructor (
+  IN  EFI_HANDLEHandle,
+  IN  EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  RETURN_STATUS Status;
+  BOOLEAN   Enabled;
+
+  Status = QemuFwCfgParseBool (FixedPcdGetPtr (PcdDriverInhibitorFwCfgVarName),
+ );
+  if (!RETURN_ERROR (Status) && !Enabled) {
+return gBS->Exit (Handle, EFI_REQUEST_UNLOAD_IMAGE, sizeof mExitData,
+  mExitData);
+  }
+  return EFI_SUCCESS;
+}
diff --git a/OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.inf 
b/OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.inf
new file mode 100644
index ..ed521d12d335
--- /dev/null
+++ b/OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.inf
@@ -0,0 +1,28 @@
+## @file
+#  Copyright (c) 2022, Google LLC. All rights reserved.
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 1.29
+  BASE_NAME  = DriverLoadInhibitorLib
+  FILE_GUID  = af4c2c0b-f7ed-4d61-ad97-5953982c3531
+  MODULE_TYPE= DXE_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = NULL
+  CONSTRUCTOR= DriverLoadInhibitorLibConstructor
+
+[Sources]
+  DriverLoadInhibitorLib.c
+
+[LibraryClasses]
+  QemuFwCfgSimpleParserLib
+  UefiBootServicesTableLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+  OvmfPkg/OvmfPkg.dec
+
+[FixedPcd]
+  gUefiOvmfPkgTokenSpaceGuid.PcdDriverInhibitorFwCfgVarName
diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 5af76a540529..e9a22cab088c 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -399,6 +399,10 @@ [PcdsFixedAtBuild]
   ## The Tdx accept page size. 0x1000(4k),0x20(2M)
   gUefiOvmfPkgTokenSpaceGuid.PcdTdxAcceptPageSize|0x20|UINT32|0x65
 
+  ## The QEMU fw_cfg variable that DriverLoadInhibitorLib will check to
+  #  decide whether to abort dispatch of the driver it is linked into.
+  gUefiOvmfPkgTokenSpaceGuid.PcdDriverInhibitorFwCfgVarName|""|VOID*|0x68
+
 [PcdsDynamic, PcdsDynamicEx]
   gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent|0|UINT64|2
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashVariablesEnable|FALSE|BOOLEAN|0x10
-- 
2.35.1



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




[edk2-devel] [PATCH 0/2] Ovmf: Allow IPv4 and IPv6 to be disabled at runtime

2022-08-15 Thread Ard Biesheuvel
Add some generic plumbing and wire it up for OvmfPkgX64 so that IPv4
and/or IPv6 networking can be turned off from the QEMU command line.

This is a follow-up to Yuan's patch '[PATCH v1 0/2] Add support to
disable VirtIo net at runtime' which only targeted the virtio network
driver specifically.

Cc: Yuan Yu 
Cc: Laszlo Ersek 
Cc: Gerd Hoffmann 
Cc: Pawel Polawski 
Cc: Oliver Steffen 
Cc: Jiewen Yao 

Ard Biesheuvel (2):
  OvmfPkg: Introduce NULL class library to inhibit driver load
  OvmfPkg/OvmfPkgX64: Allow runtime control of IPv4 and IPv6 support

 OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.c   | 30 

 OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.inf | 28 
++
 OvmfPkg/OvmfPkg.dec   |  4 +++
 OvmfPkg/OvmfPkgX64.dsc| 14 
+
 4 files changed, 76 insertions(+)
 create mode 100644 
OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.c
 create mode 100644 
OvmfPkg/Library/DriverLoadInhibitorLib/DriverLoadInhibitorLib.inf

-- 
2.35.1



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




Re: [edk2-devel] [PATCH v2] IntelFsp2Pkg: FSPM_ARCH2_UPD mismatching bug.

2022-08-15 Thread Zeng, Star
Reviewed-by: Star Zeng 

-Original Message-
From: Chiu, Chasel  
Sent: Monday, August 15, 2022 2:23 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 
; Zeng, Star 
Subject: [PATCH v2] IntelFsp2Pkg: FSPM_ARCH2_UPD mismatching bug.

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

FSPM_ARCH2_UPD in FspApiEntryM.nasm was not up-to-date and
should be fixed for both IA32 and X64 builds.

Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Chasel Chiu 
---
 IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm | 3 ++-
 IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm 
b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm
index 5dada2af54..61ab4612a3 100644
--- a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm
+++ b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm
@@ -40,12 +40,13 @@ struc FSPM_UPD_COMMON_FSP24
 .Revision:  resb  1

 .Reserved:  resb  3

 .Length resd  1

+.NvsBufferPtr   resq  1

 .StackBase: resq  1

 .StackSize: resq  1

 .BootLoaderTolumSize:   resd  1

 .BootMode:  resd  1

 .FspEventHandlerresq  1

-.Reserved1: resb 24

+.Reserved1: resb 16

 ; }

 .size:

 endstruc

diff --git a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm 
b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm
index dacf515845..2d2f75b1f0 100644
--- a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm
+++ b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm
@@ -22,12 +22,13 @@ struc FSPM_UPD_COMMON_FSP24
 .Revision:  resb  1

 .Reserved:  resb  3

 .Length resd  1

+.NvsBufferPtr   resq  1

 .StackBase: resq  1

 .StackSize: resq  1

 .BootLoaderTolumSize:   resd  1

 .BootMode:  resd  1

 .FspEventHandlerresq  1

-.Reserved1: resb 24

+.Reserved1: resb 16

 ; }

 .size:

 endstruc

-- 
2.35.0.windows.1



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




Re: [edk2-devel] [PATCH v4 4/4] BaseTools: Remove ext. gcc dependencies (Linux only)

2022-08-15 Thread Oliver Steffen
Thanks for testing!

-Oliver

On Mon, Aug 15, 2022 at 5:52 AM Daniel Schaefer 
wrote:

> Thanks!
> ghcr.io/tianocore/containers/fedora-35-test:cea91ec is the container it
> uses, right?
> I used this to build the RISC-V U540 platform in edk2-platforms and can
> confirm it can still build and boot to shell fine.
>
> Tested-by: Daniel Schaefer 
>
> On 8/11/22 18:49, Oliver Steffen wrote:
> > Hi Daniel,
> >
> > The CI still runs through all jobs successfully.
> > This includes builds for RiscV64. See the PR:
> > https://github.com/tianocore/edk2/pull/2935 <
> https://github.com/tianocore/edk2/pull/2935>
> >
> > Thanks,
> >  Oliver
> >
> > On Thu, Aug 11, 2022 at 5:34 AM Daniel Schaefer  > wrote:
> >
> > Hi Oliver,
> >
> > I assume you made sure that the build still works on at least one
> platform per arch?
> > For example did you build a RISCV64 platform?
> >
> > Thanks,
> > Daniel
> >
> > On 8/10/22 20:03, Oliver Steffen wrote:
> > > Remove BaseTools/Bin/gcc*_linux_ext_dep.yaml to stop
> > > downloading gcc from external locations; use the
> > > toolchains provided by the container image instead.
> > >
> > > The image needs to set the GCC5_*_PREFIX accordingly.
> > >
> > > Signed-off-by: Oliver Steffen  ostef...@redhat.com>>
> > > ---
> > >  BaseTools/Bin/gcc_aarch64_linux_ext_dep.yaml  | 21
> --
> > >  BaseTools/Bin/gcc_arm_linux_ext_dep.yaml  | 21
> --
> > >  .../Bin/gcc_riscv64_unknown_ext_dep.yaml  | 22
> ---
> > >  3 files changed, 64 deletions(-)
> > >  delete mode 100644 BaseTools/Bin/gcc_aarch64_linux_ext_dep.yaml
> > >  delete mode 100644 BaseTools/Bin/gcc_arm_linux_ext_dep.yaml
> > >  delete mode 100644 BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml
> > >
> > > diff --git a/BaseTools/Bin/gcc_aarch64_linux_ext_dep.yaml
> b/BaseTools/Bin/gcc_aarch64_linux_ext_dep.yaml
> > > deleted file mode 100644
> > > index ff8a9e868100..
> > > --- a/BaseTools/Bin/gcc_aarch64_linux_ext_dep.yaml
> > > +++ /dev/null
> > > @@ -1,21 +0,0 @@
> > > -## @file
> > > -# Download GCC AARCH64 compiler from Arm's release site
> > > -# Set shell variable GCC5_AARCH64_INSTALL to this folder
> > > -#
> > > -# This is only downloaded when a build activates scope
> gcc_aarch64_linux
> > > -#
> > > -# Copyright (c) Microsoft Corporation.
> > > -# SPDX-License-Identifier: BSD-2-Clause-Patent
> > > -##
> > > -{
> > > -  "scope": "gcc_aarch64_linux",
> > > -  "type": "web",
> > > -  "name": "gcc_aarch64_linux",
> > > -  "source": "
> https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz
> <
> https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz
> >",
> > > -  "version": "11.2-2022.02",
> > > -  "sha256":
> "52dbac3eb71dbe0916f60a8c5ab9b7dc9b66b3ce513047baa09fae56234e53f3",
> > > -  "compression_type": "tar",
> > > -  "internal_path":
> "/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu/",
> > > -  "flags": ["set_shell_var", ],
> > > -  "var_name": "GCC5_AARCH64_INSTALL"
> > > -}
> > > diff --git a/BaseTools/Bin/gcc_arm_linux_ext_dep.yaml
> b/BaseTools/Bin/gcc_arm_linux_ext_dep.yaml
> > > deleted file mode 100644
> > > index 151cbfa4b532..
> > > --- a/BaseTools/Bin/gcc_arm_linux_ext_dep.yaml
> > > +++ /dev/null
> > > @@ -1,21 +0,0 @@
> > > -## @file
> > > -# Download GCC ARM compiler from Arm's release site
> > > -# Set shell variable GCC5_ARM_INSTALL to this folder
> > > -#
> > > -# This is only downloaded when a build activates scope
> gcc_arm_linux
> > > -#
> > > -# Copyright (c) Microsoft Corporation.
> > > -# SPDX-License-Identifier: BSD-2-Clause-Patent
> > > -##
> > > -{
> > > -  "scope": "gcc_arm_linux",
> > > -  "type": "web",
> > > -  "name": "gcc_arm_linux",
> > > -  "source": "
> https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf.tar.xz
> <
> https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf.tar.xz
> >",
> > > -  "version": "11.2-2022.02",
> > > -  "sha256":
> "c254f7199261fe76c32ef42187502839bda7efad0a66646cf739d074eff45fad",
> > > -  "compression_type": "tar",
> > > -  "internal_path":
> "/gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf/",
> > > -  "flags": ["set_shell_var", ],
> > > -  "var_name": "GCC5_ARM_INSTALL"
> > > -}
> > > diff --git a/BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml
> b/BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml
> > > deleted file mode 100644
> > > index 

[edk2-devel] [PATCH v2] IntelFsp2Pkg: FSPM_ARCH2_UPD mismatching bug.

2022-08-15 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4019

FSPM_ARCH2_UPD in FspApiEntryM.nasm was not up-to-date and
should be fixed for both IA32 and X64 builds.

Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Chasel Chiu 
---
 IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm | 3 ++-
 IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm 
b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm
index 5dada2af54..61ab4612a3 100644
--- a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm
+++ b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm
@@ -40,12 +40,13 @@ struc FSPM_UPD_COMMON_FSP24
 .Revision:  resb  1
 .Reserved:  resb  3
 .Length resd  1
+.NvsBufferPtr   resq  1
 .StackBase: resq  1
 .StackSize: resq  1
 .BootLoaderTolumSize:   resd  1
 .BootMode:  resd  1
 .FspEventHandlerresq  1
-.Reserved1: resb 24
+.Reserved1: resb 16
 ; }
 .size:
 endstruc
diff --git a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm 
b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm
index dacf515845..2d2f75b1f0 100644
--- a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm
+++ b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm
@@ -22,12 +22,13 @@ struc FSPM_UPD_COMMON_FSP24
 .Revision:  resb  1
 .Reserved:  resb  3
 .Length resd  1
+.NvsBufferPtr   resq  1
 .StackBase: resq  1
 .StackSize: resq  1
 .BootLoaderTolumSize:   resd  1
 .BootMode:  resd  1
 .FspEventHandlerresq  1
-.Reserved1: resb 24
+.Reserved1: resb 16
 ; }
 .size:
 endstruc
-- 
2.35.0.windows.1



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




[edk2-devel] [PATCH] IntelFsp2Pkg: FSPM_ARCH2_UPD mismatching bug.

2022-08-15 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4019

FSPM_ARCH2_UPD in FspApiEntryM.nasm was not up-to-date and
should be fixed.

Cc: Nate DeSimone 
Cc: Star Zeng 
Signed-off-by: Chasel Chiu 
---
 IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm 
b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm
index dacf515845..2d2f75b1f0 100644
--- a/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm
+++ b/IntelFsp2Pkg/FspSecCore/X64/FspApiEntryM.nasm
@@ -22,12 +22,13 @@ struc FSPM_UPD_COMMON_FSP24
 .Revision:  resb  1
 .Reserved:  resb  3
 .Length resd  1
+.NvsBufferPtr   resq  1
 .StackBase: resq  1
 .StackSize: resq  1
 .BootLoaderTolumSize:   resd  1
 .BootMode:  resd  1
 .FspEventHandlerresq  1
-.Reserved1: resb 24
+.Reserved1: resb 16
 ; }
 .size:
 endstruc
-- 
2.35.0.windows.1



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




Re: [edk2-devel] [PATCH 1/1] AsfPkg: Add Alert standard format support

2022-08-15 Thread CrystalLee [李怡萱] via groups . io
+cc: isaac.w.ora, nathaniel.l.desimone, star.zeng, zhichao.gao, maciej.rabeda, 
jiaxin.wu, siyuan.fu, zhiguang.liu, dandan.bi, gaoliming, rfc

Hi,

I would like to propose to add Alert standard format support which is based
on ASF2.0 specification(DSP0136).
REF:https://www.dmtf.org/sites/default/files/standards/documents/DSP0136.pdf

Could you suggest which package is suitable for this feature?
The Asf Acpi table may be different base on platform support, but other feature 
could  be generic.

Since I'm not sure which package to include this feature, I create a temporarily
Asfpkg to include my patch.
Asf branch in forked edk2 reop
REF:https://github.com/CrystalLee-77/edk2/tree/AlertStandardFormatSupport

Currently, the drivers focus on below features
1. ASF Smbus alert-relate messages (progress logs or error logs)
2. Publish ASF ACPI table for remote control and other information

Drivers description:
Asf Pei driver: send Bios present and memory initial related messages.
Asf Dxe driver:
1. Get boot options from device(DSP0136, ch5.2 boot option messages)
2. Install Asf Acpi table.
3. Register callback function through RscHandler Protocol, the function will
send standard messages base on the reported status code.
4. Register callback function on ready to boot event, this function will send
set system state(S0) message to device.
5. Install Asf protocol, the protocol include the boot options information in
step 1 so other drivers can get the information.

Thanks,
Crystal

-Original Message-
From: CrystalLee [李怡萱] 
Sent: Tuesday, July 26, 2022 4:52 PM
To: devel@edk2.groups.io
Cc: DavidHsieh [謝坤智] ; CrystalLee [李怡萱] 
Subject: [PATCH 1/1] AsfPkg: Add Alert standard format support

Alert Standard format specification(DSP0136)
REF:https://www.dmtf.org/sites/default/files/standards/documents/DSP0136.pdf

Send standard alert message base on the status code reported by drivers.
Report Asf configuration and capabilities in Asf ACPI table

More information:
I'm not sure which package is suitable for this feature. So I create AsfPkg
as temporary location.

My branch in forked edk2 reop
REF:https://github.com/CrystalLee-77/edk2/tree/AlertStandardFormatSupport

Asf Pei driver: send Bios present and memory initial related message.
Asf Dxe driver:
1. Get boot options from device(DSP0136, ch5.2 boot option messages)
2. Install Asf Acpi table.
3. Register callback function through RscHandler Protocol, the function will
send stardand messages base on the reported status code.
4. Register callback function on ready to boot event, this function will send
set system state(S0) message to device.
5. Intall Asf protocol, the protocol include the boot options information in
step 1 and push event function for send message to device.

Signed-off-by: Crystal Lee 
---
 AsfPkg/Asf/AsfDxe/AsfDxe.c | 338 +
 AsfPkg/Asf/AsfDxe/AsfDxeEvent.c| 319 
 AsfPkg/Asf/AsfPei/AsfPei.c | 384 
 AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.c   | 210 +++
 AsfPkg/Asf/AsfDxe/AsfDxe.h |  67 
 AsfPkg/Asf/AsfDxe/AsfDxe.inf   |  52 +++
 AsfPkg/Asf/AsfDxe/AsfDxe.uni   |  15 +
 AsfPkg/Asf/AsfDxe/AsfDxeExtra.uni  |  13 +
 AsfPkg/Asf/AsfPei/AsfPei.inf   |  57 +++
 AsfPkg/Asf/AsfPei/AsfPei.uni   |  15 +
 AsfPkg/Asf/AsfPei/AsfPeiExtra.uni  |  13 +
 AsfPkg/AsfPkg.dec  |  47 +++
 AsfPkg/AsfPkg.dsc  |  59 +++
 AsfPkg/Include/AsfMessages.h   | 104 ++
 AsfPkg/Include/IndustryStandard/Asf.h  | 145 
 AsfPkg/Include/Library/AsfAcpiTableLib.h   |  26 ++
 AsfPkg/Include/Protocol/AsfProtocol.h  |  57 +++
 AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.inf |  30 ++
 AsfPkg/Library/AsfAcpiTableLib/AsfAcpiTableLib.uni |  15 +
 19 files changed, 1966 insertions(+)

diff --git a/AsfPkg/Asf/AsfDxe/AsfDxe.c b/AsfPkg/Asf/AsfDxe/AsfDxe.c
new file mode 100644
index ..1919dec6d095
--- /dev/null
+++ b/AsfPkg/Asf/AsfDxe/AsfDxe.c
@@ -0,0 +1,338 @@
+/** @file

+  Asf Dxe driver which is used for sending event record log to NIC or receiving

+  boot option command from NIC and provide in Asf Dxe protocol.

+

+  Copyright (c) 1985 - 2022, AMI. All rights reserved.

+  SPDX-License-Identifier: BSD-2-Clause-Patent

+**/

+

+#include 

+

+ASF_BOOT_OPTION   gAsfBootOption = { 0, 0, 0, 0, 0, 0, 0 };

+ASF_PROTOCOL  gAsfProtocol   = { AsfPushEvent, NULL };

+EFI_SMBUS_DEVICE_ADDRESS  mFixedTargetAddress;

+EFI_SMBUS_HC_PROTOCOL *mSmBus = NULL;

+

+/**

+  Send message through SmBus to lan card.

+

+  @param[in] Command  Command of System Firmware Events.

+  @param[in] Length   Length of the data in bytes.

+  @param[in] AsfEvent Message data.

+

+