Re: [edk2-devel] UDK2022 stable202211 - GCC compiler for Windows for building X64 EFI

2023-09-27 Thread Andrew Fish via groups.io
There is info about toolchains checked in here:edk2/BaseTools/Conf/tools_def.template at master · tianocore/edk2github.comOn Sep 27, 2023, at 8:10 PM, Daniel Samuelraj  wrote:We tried GCC at https://sourceforge.net/projects/gcc-win64/And then we tried GCC ver5.4We are getting the following error:x86_64-5.4.0-release-posix-sjlj-rt_v5-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../x86_64-w64-mingw32/bin/ld.exe: unrecognised emulation mode: elf_x86_64 Can you please let me know the recommended/suggested GCC version to compile UDK2022 stable202211? Also if there is any link with instructions to compile UDK2022 with GCC would be helpful?  Thanks,DanielFrom: Daniel Samuelraj  Sent: Wednesday, September 27, 2023 12:54 PMTo: 'devel@edk2.groups.io' Cc: Jianning Wang ; 'Kinney, Michael D' Subject: UDK2022 GCC compiler Hi,Can you recommend a GCC compiler to build UDK2022?  Thanks


This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.


_._,_._,_



Groups.io Links:


  
You receive all messages sent to this group.
  
  



View/Reply Online (#109135) |


  

|

  Mute This Topic


| New Topic






Your Subscription |
Contact Group Owner |

Unsubscribe

 [arch...@mail-archive.com]
_._,_._,_



Re: [edk2-devel] [PATCH v2] MdeModulePkg/Xhci: Skip size round up for TRB during address translation

2023-09-27 Thread Wu, Hao A
Patch merged via:
PR - https://github.com/tianocore/edk2/pull/4875
Commit - 
https://github.com/tianocore/edk2/commit/f36e1ec1f0a5fd3be84913e09181d7813444b620

Best Regards,
Hao Wu

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Wu, Hao
> A
> Sent: Wednesday, September 27, 2023 9:05 AM
> To: Cheng, Gao ; devel@edk2.groups.io
> Cc: Ni, Ray ; Wang, Jian J ; Gao,
> Liming 
> Subject: Re: [edk2-devel] [PATCH v2] MdeModulePkg/Xhci: Skip size round up
> for TRB during address translation
> 
> Reviewed-by: Hao A Wu 
> 
> Best Regards,
> Hao Wu
> 
> > -Original Message-
> > From: Cheng, Gao 
> > Sent: Tuesday, September 26, 2023 4:25 PM
> > To: devel@edk2.groups.io
> > Cc: Cheng, Gao ; Wu, Hao A
> ;
> > Ni, Ray ; Wang, Jian J ; Gao,
> > Liming 
> > Subject: [PATCH v2] MdeModulePkg/Xhci: Skip size round up for TRB during
> > address translation
> >
> > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4560
> >
> >
> >
> > TRB Template is 16 bytes. When boundary checking is 64 bytes for xHCI
> >
> > device/host memory address, it may exceed xHCI host memory pool and
> >
> > cause unwanted DXE_ASSERT. Introduce a new input parameter to indicate
> >
> > whether to enforce 64byte size alignment and round up. For TRB case,
> >
> > should set it to FALSE to skip the size round up.
> >
> >
> >
> > Signed-off-by: Gao Cheng 
> >
> > Cc: Hao A Wu 
> >
> > Cc: Ray Ni 
> >
> > Cc: Jian J Wang 
> >
> > Cc: Liming Gao 
> >
> > ---
> >
> >  MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c  | 24 ---
> >
> >  MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.h  |  8 +++-
> >
> >  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 54 +---
> >
> >  MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c  | 24 ---
> >
> >  MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.h  |  8 +++-
> >
> >  MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 48 +++--
> >
> >  6 files changed, 103 insertions(+), 63 deletions(-)
> >
> >
> >
> > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c
> > b/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c
> >
> > index d0ad1582e4..b54187ec22 100644
> >
> > --- a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c
> >
> > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c
> >
> > @@ -226,6 +226,7 @@ UsbHcAllocMemFromBlock (
> >
> >@param  Pool   The memory pool of the host controller.
> >
> >@param  MemThe pointer to host memory.
> >
> >@param  Size   The size of the memory region.
> >
> > +  @param  Alignment  Alignment the size to USBHC_MEM_UNIT bytes.
> >
> >
> >
> >@returnThe pci memory address
> >
> >
> >
> > @@ -234,7 +235,8 @@ EFI_PHYSICAL_ADDRESS
> >
> >  UsbHcGetPciAddrForHostAddr (
> >
> >IN USBHC_MEM_POOL  *Pool,
> >
> >IN VOID*Mem,
> >
> > -  IN UINTN   Size
> >
> > +  IN UINTN   Size,
> >
> > +  IN BOOLEAN Alignment
> >
> >)
> >
> >  {
> >
> >USBHC_MEM_BLOCK   *Head;
> >
> > @@ -243,8 +245,12 @@ UsbHcGetPciAddrForHostAddr (
> >
> >EFI_PHYSICAL_ADDRESS  PhyAddr;
> >
> >UINTN Offset;
> >
> >
> >
> > -  Head  = Pool->Head;
> >
> > -  AllocSize = USBHC_MEM_ROUND (Size);
> >
> > +  Head = Pool->Head;
> >
> > +  if (Alignment) {
> >
> > +AllocSize = USBHC_MEM_ROUND (Size);
> >
> > +  } else {
> >
> > +AllocSize = Size;
> >
> > +  }
> >
> >
> >
> >if (Mem == NULL) {
> >
> >  return 0;
> >
> > @@ -275,6 +281,7 @@ UsbHcGetPciAddrForHostAddr (
> >
> >@param  Pool   The memory pool of the host controller.
> >
> >@param  MemThe pointer to pci memory.
> >
> >@param  Size   The size of the memory region.
> >
> > +  @param  Alignment  Alignment the size to USBHC_MEM_UNIT bytes.
> >
> >
> >
> >@returnThe host memory address
> >
> >
> >
> > @@ -283,7 +290,8 @@ EFI_PHYSICAL_ADDRESS
> >
> >  UsbHcGetHostAddrForPciAddr (
> >
> >IN USBHC_MEM_POOL  *Pool,
> >
> >IN VOID*Mem,
> >
> > -  IN UINTN   Size
> >
> > +  IN UINTN   Size,
> >
> > +  IN BOOLEAN Alignment
> >
> >)
> >
> >  {
> >
> >USBHC_MEM_BLOCK   *Head;
> >
> > @@ -292,8 +300,12 @@ UsbHcGetHostAddrForPciAddr (
> >
> >EFI_PHYSICAL_ADDRESS  HostAddr;
> >
> >UINTN Offset;
> >
> >
> >
> > -  Head  = Pool->Head;
> >
> > -  AllocSize = USBHC_MEM_ROUND (Size);
> >
> > +  Head = Pool->Head;
> >
> > +  if (Alignment) {
> >
> > +AllocSize = USBHC_MEM_ROUND (Size);
> >
> > +  } else {
> >
> > +AllocSize = Size;
> >
> > +  }
> >
> >
> >
> >if (Mem == NULL) {
> >
> >  return 0;
> >
> > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.h
> > b/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.h
> >
> > index c85b0b919f..b21bf9da3e 100644
> >
> > --- a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.h
> >
> > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.h
> >
> > @@ -129,6 +129,7 @@ UsbHcFreeMem (
> >
> >@param  Pool   The memory pool of the host controller.
> >
> 

Re: [edk2-devel] [PATCH v2] MdeModulePkg/Xhci: Skip size round up for TRB during address translation

2023-09-27 Thread Gao
Hi Hao,

Thanks for the support.

Best Regards,
Gao

-Original Message-
From: Wu, Hao A  
Sent: Thursday, September 28, 2023 10:07 AM
To: devel@edk2.groups.io; Wu, Hao A ; Cheng, Gao 

Cc: Ni, Ray ; Wang, Jian J ; Gao, 
Liming 
Subject: RE: [edk2-devel] [PATCH v2] MdeModulePkg/Xhci: Skip size round up for 
TRB during address translation

Patch merged via:
PR - https://github.com/tianocore/edk2/pull/4875
Commit - 
https://github.com/tianocore/edk2/commit/f36e1ec1f0a5fd3be84913e09181d7813444b620

Best Regards,
Hao Wu

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Wu, Hao 
> A
> Sent: Wednesday, September 27, 2023 9:05 AM
> To: Cheng, Gao ; devel@edk2.groups.io
> Cc: Ni, Ray ; Wang, Jian J ; 
> Gao, Liming 
> Subject: Re: [edk2-devel] [PATCH v2] MdeModulePkg/Xhci: Skip size 
> round up for TRB during address translation
> 
> Reviewed-by: Hao A Wu 
> 
> Best Regards,
> Hao Wu
> 
> > -Original Message-
> > From: Cheng, Gao 
> > Sent: Tuesday, September 26, 2023 4:25 PM
> > To: devel@edk2.groups.io
> > Cc: Cheng, Gao ; Wu, Hao A
> ;
> > Ni, Ray ; Wang, Jian J ; 
> > Gao, Liming 
> > Subject: [PATCH v2] MdeModulePkg/Xhci: Skip size round up for TRB 
> > during address translation
> >
> > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4560
> >
> >
> >
> > TRB Template is 16 bytes. When boundary checking is 64 bytes for 
> > xHCI
> >
> > device/host memory address, it may exceed xHCI host memory pool and
> >
> > cause unwanted DXE_ASSERT. Introduce a new input parameter to 
> > indicate
> >
> > whether to enforce 64byte size alignment and round up. For TRB case,
> >
> > should set it to FALSE to skip the size round up.
> >
> >
> >
> > Signed-off-by: Gao Cheng 
> >
> > Cc: Hao A Wu 
> >
> > Cc: Ray Ni 
> >
> > Cc: Jian J Wang 
> >
> > Cc: Liming Gao 
> >
> > ---
> >
> >  MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c  | 24 ---
> >
> >  MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.h  |  8 +++-
> >
> >  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 54 
> > +---
> >
> >  MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c  | 24 ---
> >
> >  MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.h  |  8 +++-
> >
> >  MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 48 +++--
> >
> >  6 files changed, 103 insertions(+), 63 deletions(-)
> >
> >
> >
> > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c
> > b/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c
> >
> > index d0ad1582e4..b54187ec22 100644
> >
> > --- a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c
> >
> > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c
> >
> > @@ -226,6 +226,7 @@ UsbHcAllocMemFromBlock (
> >
> >@param  Pool   The memory pool of the host controller.
> >
> >@param  MemThe pointer to host memory.
> >
> >@param  Size   The size of the memory region.
> >
> > +  @param  Alignment  Alignment the size to USBHC_MEM_UNIT bytes.
> >
> >
> >
> >@returnThe pci memory address
> >
> >
> >
> > @@ -234,7 +235,8 @@ EFI_PHYSICAL_ADDRESS
> >
> >  UsbHcGetPciAddrForHostAddr (
> >
> >IN USBHC_MEM_POOL  *Pool,
> >
> >IN VOID*Mem,
> >
> > -  IN UINTN   Size
> >
> > +  IN UINTN   Size,
> >
> > +  IN BOOLEAN Alignment
> >
> >)
> >
> >  {
> >
> >USBHC_MEM_BLOCK   *Head;
> >
> > @@ -243,8 +245,12 @@ UsbHcGetPciAddrForHostAddr (
> >
> >EFI_PHYSICAL_ADDRESS  PhyAddr;
> >
> >UINTN Offset;
> >
> >
> >
> > -  Head  = Pool->Head;
> >
> > -  AllocSize = USBHC_MEM_ROUND (Size);
> >
> > +  Head = Pool->Head;
> >
> > +  if (Alignment) {
> >
> > +AllocSize = USBHC_MEM_ROUND (Size);
> >
> > +  } else {
> >
> > +AllocSize = Size;
> >
> > +  }
> >
> >
> >
> >if (Mem == NULL) {
> >
> >  return 0;
> >
> > @@ -275,6 +281,7 @@ UsbHcGetPciAddrForHostAddr (
> >
> >@param  Pool   The memory pool of the host controller.
> >
> >@param  MemThe pointer to pci memory.
> >
> >@param  Size   The size of the memory region.
> >
> > +  @param  Alignment  Alignment the size to USBHC_MEM_UNIT bytes.
> >
> >
> >
> >@returnThe host memory address
> >
> >
> >
> > @@ -283,7 +290,8 @@ EFI_PHYSICAL_ADDRESS
> >
> >  UsbHcGetHostAddrForPciAddr (
> >
> >IN USBHC_MEM_POOL  *Pool,
> >
> >IN VOID*Mem,
> >
> > -  IN UINTN   Size
> >
> > +  IN UINTN   Size,
> >
> > +  IN BOOLEAN Alignment
> >
> >)
> >
> >  {
> >
> >USBHC_MEM_BLOCK   *Head;
> >
> > @@ -292,8 +300,12 @@ UsbHcGetHostAddrForPciAddr (
> >
> >EFI_PHYSICAL_ADDRESS  HostAddr;
> >
> >UINTN Offset;
> >
> >
> >
> > -  Head  = Pool->Head;
> >
> > -  AllocSize = USBHC_MEM_ROUND (Size);
> >
> > +  Head = Pool->Head;
> >
> > +  if (Alignment) {
> >
> > +AllocSize = USBHC_MEM_ROUND (Size);
> >
> > +  } else {
> >
> > +AllocSize = Size;
> >
> > +  }
> >
> >
> >
> >if (Mem == NULL) {
> >
> >  return 0;
> >
> > diff 

[edk2-devel] [PATCH] IntelSiliconPkg/Vtd: fix incorrect number of arguments

2023-09-27 Thread Sheng Wei
Fix incorrect number of arguments in VtdLibDumpSetAttribute().

Signed-off-by: Sheng Wei 
Cc: Ray Ni 
Cc: Rangasai V Chaganty 
Cc: Jenny Huang 
---
 .../Library/IntelVTdPeiDxeLib/IntelVTdPeiDxeLib.c| 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Silicon/Intel/IntelSiliconPkg/Library/IntelVTdPeiDxeLib/IntelVTdPeiDxeLib.c 
b/Silicon/Intel/IntelSiliconPkg/Library/IntelVTdPeiDxeLib/IntelVTdPeiDxeLib.c
index 1e65115c..84eb6287 100644
--- 
a/Silicon/Intel/IntelSiliconPkg/Library/IntelVTdPeiDxeLib/IntelVTdPeiDxeLib.c
+++ 
b/Silicon/Intel/IntelSiliconPkg/Library/IntelVTdPeiDxeLib/IntelVTdPeiDxeLib.c
@@ -1300,6 +1300,7 @@ VtdLibDumpSetAttribute (
  SetAttributeInfo->SourceId.Uint16,
  SetAttributeInfo->DeviceAddress,
  SetAttributeInfo->Length,
+ SetAttributeInfo->IoMmuAccess,
  SetAttributeInfo->Status));
 }
 
-- 
2.26.2.windows.1



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




Re: [edk2-devel] setting TLS ciphers is broken (openssl 3?)

2023-09-27 Thread Li, Yi
Hi Gerd,

We have validated HTTPs boot and WIFI with EAP-TLS, where the code consumed 
openssl3.0 TLS lib API.

So we cannot reproduce this issue. Could you provide detail test steps to me, I 
will look into it.

Thanks,
Yi  

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Yao, Jiewen
Sent: Thursday, September 28, 2023 1:31 AM
To: devel@edk2.groups.io; kra...@redhat.com
Subject: Re: [edk2-devel] setting TLS ciphers is broken (openssl 3?)

Hi Gerd
Thanks for the reporting. 

We will look into that. Is below text full reproduce steps? Which server you 
are using? Which TLS version is configured?
Please provide as detail as possible, if you could.


One more thing: We are going to have 1 week National Holiday since Tomorrow.
If we cannot nail down shortly, that would be next next week.

Thank you
Yao, Jiewen



> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Gerd 
> Hoffmann
> Sent: Wednesday, September 27, 2023 4:39 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] setting TLS ciphers is broken (openssl 3?)
> 
>   Hi,
> 
> I've noticed that setting chipers for TLS stopped working in ovmf, 
> most likely due to the openssl 3.0 update.
> 
> Test case: try http boot from https server, set ciphers on the qemu 
> command line using:
> -object tls-cipher-suites,id=tls-cipher0,priority=@SYSTEM
> -fw_cfg name=etc/edk2/https/ciphers,gen_id=tls-cipher0
> 
> OvmfPkg/Library/TlsAuthConfigLib will read it from fwcfg and set 
> EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE.
> 
> CryptoPkg/Library/TlsLib/TlsConfig.c will read the variable, map the 
> IDs to strings and call SSL_set_cipher_list() with the result.
> 
> Later on the tls handshake fails.  From the log:
> 
> [ ... ]
> TlsDxe:TlsSetCipherList: CipherString={
>   ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-
> SHA384:ECDHE-ECDSA-AES128-GC
>   M-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:DHE-RSA-AES256-GCM-
> SHA384:DHE-RSA-A
>   ES256-SHA:DHE-RSA-AES128-SHA:DHE-RSA-DES-CBC3-SHA
>   }
> [ ... ]
> TlsDoHandshake SSL_HANDSHAKE_ERROR State=0x10 SSL_ERROR_SSL 
> TlsDoHandshake ERROR 0x308010C=L6:R8010C TlsDoHandshake ERROR 
> 0xA0C0103=L14:RC0103 [ ... ]
> 
> take care,
>   Gerd
> 
> 
> 
> 
> 








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




[edk2-devel] UDK2022 GCC compiler

2023-09-27 Thread Daniel Samuelraj via groups.io
Hi,

Can you recommend a GCC compiler to build UDK2022?



Thanks

-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.


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




smime.p7s
Description: S/MIME Cryptographic Signature


Re: [edk2-devel] [PATCH v2 0/7] Uncrustify GoogleTest update

2023-09-27 Thread VivianNK

Hi Mike,

Can you help merge this? Looks like it has all of the reviews.

Thank you!
- Vivian

On 9/12/2023 7:42 AM, Michael D Kinney wrote:

Series Reviewed-by: Michael D Kinney


-Original Message-
From:devel@edk2.groups.ioOn Behalf Of VivianNK
Sent: Wednesday, August 16, 2023 2:15 PM
To:devel@edk2.groups.io
Subject: [edk2-devel] [PATCH v2 0/7] Uncrustify GoogleTest update

v1 -> v2:
  - Update commit message to explain the audit only mode change is
temporary to prevent intermediate CI failures.
  - Format patch Cc's correctly

v1 archive:https://edk2.groups.io/g/devel/message/107665

VivianNK (7):
   .pytool: Set uncrustify check to audit only (temporary)
   .pytool: Add cpp support to uncrustify plugin
   MdeModulePkg: Apply uncrustify formatting to relevant files.
   MdePkg: Apply uncrustify formatting to relevant files
   SecurityPkg: Apply uncrustify formatting to relevant files
   UnitTestFrameworkPkg: Apply uncrustify formatting to relevant files
   .pytool: Undo uncrustify check change

  .pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py
|   2 +-
  .pytool/Plugin/UncrustifyCheck/uncrustify.cfg
|   4 +-
  MdeModulePkg/Library/UefiSortLib/GoogleTest/UefiSortLibGoogleTest.cpp
|  37 +-
  MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
|   4 +-

MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBri
dgeLib.cpp |   8 +-

MdePkg/Test/GoogleTest/Library/BaseSafeIntLib/SafeIntLibUintnIntnUnitTests32.
cpp| 114 ++--

MdePkg/Test/GoogleTest/Library/BaseSafeIntLib/SafeIntLibUintnIntnUnitTests64.
cpp| 114 ++--
  MdePkg/Test/GoogleTest/Library/BaseSafeIntLib/TestBaseSafeIntLib.cpp
| 563 ++--
  MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
|   6 +-
  MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib.h
|   6 +-
  MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiLib.h
|   4 +-

MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiRuntimeServicesTableLib.h
|   4 +-
  MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp
|  40 +-

MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.cpp
|  52 +-
  MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.cpp
|   6 +-

MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiR
untimeServicesTableLib.cpp |  12 +-

SecurityPkg/Library/SecureBootVariableLib/GoogleTest/SecureBootVariableLibGoo
gleTest.cpp| 205 ---

SecurityPkg/Test/Mock/Include/GoogleTest/Library/MockPlatformPKProtectionLib.
h  |   4 +-

SecurityPkg/Test/Mock/Library/GoogleTest/MockPlatformPKProtectionLib/MockPlat
formPKProtectionLib.cpp|   4 +-
  UnitTestFrameworkPkg/Include/Library/GoogleTestLib.h
|   2 +-

UnitTestFrameworkPkg/Test/GoogleTest/Sample/SampleGoogleTest/SampleGoogleTest
.cpp   |  76 +--
  21 files changed, 664 insertions(+), 603 deletions(-)

--
2.41.0.windows.3



-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107809):https://edk2.groups.io/g/devel/message/107809
Mute This Topic:https://groups.io/mt/100788665/1643496
Group Owner:devel+ow...@edk2.groups.io
Unsubscribe:https://edk2.groups.io/g/devel/unsub
[michael.d.kin...@intel.com]
-=-=-=-=-=-=







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




Re: [edk2-devel] setting TLS ciphers is broken (openssl 3?)

2023-09-27 Thread Yao, Jiewen
Hi Gerd
Thanks for the reporting. 

We will look into that. Is below text full reproduce steps? Which server you 
are using? Which TLS version is configured?
Please provide as detail as possible, if you could.


One more thing: We are going to have 1 week National Holiday since Tomorrow.
If we cannot nail down shortly, that would be next next week.

Thank you
Yao, Jiewen



> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Gerd
> Hoffmann
> Sent: Wednesday, September 27, 2023 4:39 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] setting TLS ciphers is broken (openssl 3?)
> 
>   Hi,
> 
> I've noticed that setting chipers for TLS stopped working in ovmf, most
> likely due to the openssl 3.0 update.
> 
> Test case: try http boot from https server, set ciphers on the qemu
> command line using:
> -object tls-cipher-suites,id=tls-cipher0,priority=@SYSTEM
> -fw_cfg name=etc/edk2/https/ciphers,gen_id=tls-cipher0
> 
> OvmfPkg/Library/TlsAuthConfigLib will read it from fwcfg and set
> EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE.
> 
> CryptoPkg/Library/TlsLib/TlsConfig.c will read the variable, map the IDs
> to strings and call SSL_set_cipher_list() with the result.
> 
> Later on the tls handshake fails.  From the log:
> 
> [ ... ]
> TlsDxe:TlsSetCipherList: CipherString={
>   ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-
> SHA384:ECDHE-ECDSA-AES128-GC
>   M-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:DHE-RSA-AES256-GCM-
> SHA384:DHE-RSA-A
>   ES256-SHA:DHE-RSA-AES128-SHA:DHE-RSA-DES-CBC3-SHA
>   }
> [ ... ]
> TlsDoHandshake SSL_HANDSHAKE_ERROR State=0x10 SSL_ERROR_SSL
> TlsDoHandshake ERROR 0x308010C=L6:R8010C
> TlsDoHandshake ERROR 0xA0C0103=L14:RC0103
> [ ... ]
> 
> take care,
>   Gerd
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109128): https://edk2.groups.io/g/devel/message/109128
Mute This Topic: https://groups.io/mt/101613778/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] Maintainers.txt: add Sami as maintainer of arm-architectural subdirs

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

> -Original Message-
> From: Leif Lindholm 
> Sent: Wednesday, September 27, 2023 4:07 AM
> To: devel@edk2.groups.io
> Cc: Ard Biesheuvel ; Sami Mujawar
> ; Andrew Fish ; Kinney, Michael
> D 
> Subject: [PATCH 1/1] Maintainers.txt: add Sami as maintainer of arm-
> architectural subdirs
> 
> We added Sami as a reviewer to ArmPkg early last year, and I think it
> was
> always our intention to have him as a reviewer of Arm architectural
> stuff
> in general, but we seem to have missed out the Arm/AArch64 subdir
> wildcards. So let's fix that.
> 
> Signed-off-by: Leif Lindholm 
> Cc: Ard Biesheuvel 
> Cc: Sami Mujawar 
> Cc: Andrew Fish 
> Cc: Michael D Kinney 
> ---
>  Maintainers.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 55a8af21dc3e..1a7525b1b4c0 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -88,6 +88,7 @@ F: */AArch64/
>  F: */Arm/
>  M: Leif Lindholm  [leiflindholm]
>  M: Ard Biesheuvel  [ardbiesheuvel]
> +M: Sami Mujawar  [samimujawar]
> 
>  RISCV64
>  F: */RiscV64/
> --
> 2.30.2



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




[edk2-devel] [PATCHv2 2/2] MdePkg/Test: Add DevicePathLib host test module

2023-09-27 Thread Albecki, Mateusz
This commit adds host-based unit tests for device path lib.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 

Signed-off-by: Mateusz Albecki 
---
 MdePkg/MdePkg.ci.yaml |   5 +-
 MdePkg/Test/MdePkgHostTest.dsc|   2 +
 .../Library/DevicePathLib/TestDevicePathLib.c | 638 ++
 .../Library/DevicePathLib/TestDevicePathLib.h |  26 +
 .../DevicePathLib/TestDevicePathLibHost.inf   |  33 +
 .../TestDevicePathStringConversions.c | 370 ++
 6 files changed, 1073 insertions(+), 1 deletion(-)
 create mode 100644 
MdePkg/Test/UnitTest/Library/DevicePathLib/TestDevicePathLib.c
 create mode 100644 
MdePkg/Test/UnitTest/Library/DevicePathLib/TestDevicePathLib.h
 create mode 100644 
MdePkg/Test/UnitTest/Library/DevicePathLib/TestDevicePathLibHost.inf
 create mode 100644 
MdePkg/Test/UnitTest/Library/DevicePathLib/TestDevicePathStringConversions.c

diff --git a/MdePkg/MdePkg.ci.yaml b/MdePkg/MdePkg.ci.yaml
index c3faf4913d..45f4fb537b 100644
--- a/MdePkg/MdePkg.ci.yaml
+++ b/MdePkg/MdePkg.ci.yaml
@@ -74,7 +74,10 @@
 "Test/UnitTest/Library/BaseSafeIntLib/TestBaseSafeIntLib.c",
 "Library/BaseFdtLib",
 "Library/MipiSysTLib/mipi_syst.h",
-"Include/Register/Amd/SmramSaveStateMap.h"
+"Include/Register/Amd/SmramSaveStateMap.h",
+"Test/UnitTest/Library/DevicePathLib/TestDevicePathLib.c",
+"Test/UnitTest/Library/DevicePathLib/TestDevicePathLib.h",
+
"Test/UnitTest/Library/DevicePathLib/TestDevicePathStringConversions.c"
 ]
 },
 ## options defined ci/Plugin/CompilerPlugin
diff --git a/MdePkg/Test/MdePkgHostTest.dsc b/MdePkg/Test/MdePkgHostTest.dsc
index 529ea69024..b92b564d43 100644
--- a/MdePkg/Test/MdePkgHostTest.dsc
+++ b/MdePkg/Test/MdePkgHostTest.dsc
@@ -21,6 +21,7 @@
 
 [LibraryClasses]
   SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+  DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibBase.inf
 
 [Components]
   #
@@ -29,6 +30,7 @@
   MdePkg/Test/UnitTest/Library/BaseSafeIntLib/TestBaseSafeIntLibHost.inf
   MdePkg/Test/UnitTest/Library/BaseLib/BaseLibUnitTestsHost.inf
   MdePkg/Test/GoogleTest/Library/BaseSafeIntLib/GoogleTestBaseSafeIntLib.inf
+  MdePkg/Test/UnitTest/Library/DevicePathLib/TestDevicePathLibHost.inf
 
   #
   # Build HOST_APPLICATION Libraries
diff --git a/MdePkg/Test/UnitTest/Library/DevicePathLib/TestDevicePathLib.c 
b/MdePkg/Test/UnitTest/Library/DevicePathLib/TestDevicePathLib.c
new file mode 100644
index 00..687497278c
--- /dev/null
+++ b/MdePkg/Test/UnitTest/Library/DevicePathLib/TestDevicePathLib.c
@@ -0,0 +1,638 @@
+/** @file
+  UEFI OS based application for unit testing the DevicePathLib.
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include "TestDevicePathLib.h"
+
+#define UNIT_TEST_NAME "DevicePathLib Unit Test Application"
+#define UNIT_TEST_VERSION  "0.1"
+
+typedef struct {
+  ACPI_HID_DEVICE_PATHAcpiPath;
+  PCI_DEVICE_PATH PciPathRootPort;
+  PCI_DEVICE_PATH PciPathEndPoint;
+  USB_DEVICE_PATH UsbPath;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
+} TEST_COMPLEX_DEVICE_PATH;
+
+GLOBAL_REMOVE_IF_UNREFERENCED TEST_COMPLEX_DEVICE_PATH  mComplexDevicePath = {
+  { // ACPI device path with root bridge EISA_PNP_ID
+{
+  ACPI_DEVICE_PATH,
+  ACPI_DP,
+  {
+(UINT8)(sizeof (ACPI_HID_DEVICE_PATH)),
+(UINT8)((sizeof (ACPI_HID_DEVICE_PATH)) >> 8)
+  }
+},
+EISA_PNP_ID (0x0A03),
+0
+  },
+  { // PCI device path - root port (0x2:0x0)
+{
+  HARDWARE_DEVICE_PATH,
+  HW_PCI_DP,
+  {
+(UINT8)(sizeof (PCI_DEVICE_PATH)),
+(UINT8)((sizeof (PCI_DEVICE_PATH)) >> 8)
+  }
+},
+0x2,
+0x0
+  },
+  { // PCI device path - endpoint (0x0:0x0)
+{
+  HARDWARE_DEVICE_PATH,
+  HW_PCI_DP,
+  {
+(UINT8)(sizeof (PCI_DEVICE_PATH)),
+(UINT8)((sizeof (PCI_DEVICE_PATH)) >> 8)
+  }
+},
+0x0,
+0x0
+  },
+  { // USB interface
+{
+  MESSAGING_DEVICE_PATH,
+  MSG_USB_DP,
+  {
+(UINT8)(sizeof (USB_DEVICE_PATH)),
+(UINT8)((sizeof (USB_CLASS_DEVICE_PATH)) >> 8)
+  }
+},
+0,
+2
+  },
+  {
+END_DEVICE_PATH_TYPE,
+END_ENTIRE_DEVICE_PATH_SUBTYPE,
+{
+  (UINT8)(sizeof (EFI_DEVICE_PATH_PROTOCOL)),
+  (UINT8)((sizeof (EFI_DEVICE_PATH_PROTOCOL)) >> 8)
+}
+  }
+};
+
+CONST GLOBAL_REMOVE_IF_UNREFERENCED CHAR16  *mComplexDevicePathString = 
L"PciRoot(0x0)/Pci(0x0,0x2)/Pci(0x0,0x0)/USB(0x0,0x2)";
+
+CONST GLOBAL_REMOVE_IF_UNREFERENCED CHAR16  *mPciEndPointPathString = 
L"Pci(0x0, 0x0)";
+
+typedef struct {
+  ACPI_HID_DEVICE_PATHAcpiPath;
+  EFI_DEVICE_PATH_PROTOCOLEnd;
+} TEST_SIMPLE_DEVICE_PATH;
+
+GLOBAL_REMOVE_IF_UNREFERENCED TEST_SIMPLE_DEVICE_PATH  mSimpleDevicePath = {
+  { // ACPI device 

[edk2-devel] [PATCHv2 1/2] MdePkg/UefiDevicePathLib: Fix AcpiEx print logic

2023-09-27 Thread Albecki, Mateusz
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4555

Add logic that checks if the code doesn't overflow
ACPI_EXTENDED_HID_DEVICE_PATH node when searching for optional
strings. If the string is not provided in the device path node
default value of "\0" is used.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 

Signed-off-by: Mateusz Albecki 
---
 .../UefiDevicePathLib/DevicePathToText.c  | 69 +++
 1 file changed, 42 insertions(+), 27 deletions(-)

diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c 
b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
index dd90dfa58e..bd8d1de201 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
@@ -418,23 +418,38 @@ DevPathToTextAcpiEx (
   )
 {
   ACPI_EXTENDED_HID_DEVICE_PATH  *AcpiEx;
-  CHAR8  *HIDStr;
-  CHAR8  *UIDStr;
-  CHAR8  *CIDStr;
   CHAR16 HIDText[11];
   CHAR16 CIDText[11];
-
-  AcpiEx = DevPath;
-  HIDStr = (CHAR8 *)(((UINT8 *)AcpiEx) + sizeof 
(ACPI_EXTENDED_HID_DEVICE_PATH));
-  UIDStr = HIDStr + AsciiStrLen (HIDStr) + 1;
-  CIDStr = UIDStr + AsciiStrLen (UIDStr) + 1;
+  UINTN  CurrentLength;
+  CHAR8  *CurrentPos;
+  UINTN  NextStringOffset;
+  CHAR8  *Strings[3];
+  CONST UINT8HidStrIndex = 0;
+  CONST UINT8UidStrIndex = 1;
+  CONST UINT8CidStrIndex = 2;
+  UINT8  StrIndex;
+
+  AcpiEx   = DevPath;
+  Strings[HidStrIndex] = NULL;
+  Strings[UidStrIndex] = NULL;
+  Strings[CidStrIndex] = NULL;
+  CurrentLength= sizeof (ACPI_EXTENDED_HID_DEVICE_PATH);
+  CurrentPos   = (CHAR8 *)(((UINT8 *)AcpiEx) + sizeof 
(ACPI_EXTENDED_HID_DEVICE_PATH));
+  StrIndex = 0;
+  while (CurrentLength < AcpiEx->Header.Length[0] && StrIndex < ARRAY_SIZE 
(Strings)) {
+Strings[StrIndex] = CurrentPos;
+NextStringOffset  = AsciiStrLen (CurrentPos) + 1;
+CurrentLength+= NextStringOffset;
+CurrentPos   += NextStringOffset;
+StrIndex++;
+  }
 
   if (DisplayOnly) {
 if ((EISA_ID_TO_NUM (AcpiEx->HID) == 0x0A03) ||
 ((EISA_ID_TO_NUM (AcpiEx->CID) == 0x0A03) && (EISA_ID_TO_NUM 
(AcpiEx->HID) != 0x0A08)))
 {
-  if (AcpiEx->UID == 0) {
-UefiDevicePathLibCatPrint (Str, L"PciRoot(%a)", UIDStr);
+  if (Strings[UidStrIndex] != NULL) {
+UefiDevicePathLibCatPrint (Str, L"PciRoot(%a)", Strings[UidStrIndex]);
   } else {
 UefiDevicePathLibCatPrint (Str, L"PciRoot(0x%x)", AcpiEx->UID);
   }
@@ -443,8 +458,8 @@ DevPathToTextAcpiEx (
 }
 
 if ((EISA_ID_TO_NUM (AcpiEx->HID) == 0x0A08) || (EISA_ID_TO_NUM 
(AcpiEx->CID) == 0x0A08)) {
-  if (AcpiEx->UID == 0) {
-UefiDevicePathLibCatPrint (Str, L"PcieRoot(%a)", UIDStr);
+  if (Strings[UidStrIndex] != NULL) {
+UefiDevicePathLibCatPrint (Str, L"PcieRoot(%a)", Strings[UidStrIndex]);
   } else {
 UefiDevicePathLibCatPrint (Str, L"PcieRoot(0x%x)", AcpiEx->UID);
   }
@@ -475,7 +490,10 @@ DevPathToTextAcpiEx (
 (AcpiEx->CID >> 16) & 0x
 );
 
-  if ((*HIDStr == '\0') && (*CIDStr == '\0') && (*UIDStr != '\0')) {
+  if (((Strings[HidStrIndex] != NULL) && (*Strings[HidStrIndex] == '\0')) &&
+  ((Strings[CidStrIndex] != NULL) && (*Strings[CidStrIndex] == '\0')) &&
+  ((Strings[UidStrIndex] != NULL) && (*Strings[UidStrIndex] != '\0')))
+  {
 //
 // use AcpiExp()
 //
@@ -484,7 +502,7 @@ DevPathToTextAcpiEx (
 Str,
 L"AcpiExp(%s,0,%a)",
 HIDText,
-UIDStr
+Strings[UidStrIndex]
 );
 } else {
   UefiDevicePathLibCatPrint (
@@ -492,28 +510,25 @@ DevPathToTextAcpiEx (
 L"AcpiExp(%s,%s,%a)",
 HIDText,
 CIDText,
-UIDStr
+Strings[UidStrIndex]
 );
 }
   } else {
 if (DisplayOnly) {
-  //
-  // display only
-  //
-  if (AcpiEx->HID == 0) {
-UefiDevicePathLibCatPrint (Str, L"AcpiEx(%a,", HIDStr);
+  if (Strings[HidStrIndex] != NULL) {
+UefiDevicePathLibCatPrint (Str, L"AcpiEx(%a,", Strings[HidStrIndex]);
   } else {
 UefiDevicePathLibCatPrint (Str, L"AcpiEx(%s,", HIDText);
   }
 
-  if (AcpiEx->CID == 0) {
-UefiDevicePathLibCatPrint (Str, L"%a,", CIDStr);
+  if (Strings[CidStrIndex] != NULL) {
+UefiDevicePathLibCatPrint (Str, L"%a,", Strings[CidStrIndex]);
   } else {
 UefiDevicePathLibCatPrint (Str, L"%s,", CIDText);
   }
 
-  if (AcpiEx->UID == 0) {
-UefiDevicePathLibCatPrint (Str, L"%a)", UIDStr);
+  if (Strings[UidStrIndex] != NULL) {
+UefiDevicePathLibCatPrint (Str, L"%a)", Strings[UidStrIndex]);
   } else {
 

[edk2-devel] [PATCHv2 0/2] MdePkg/UefiDevicePathLib: Fix buffer overflows in DevPathToTextAcpiEx

2023-09-27 Thread Albecki, Mateusz
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4555

Github PR: https://github.com/tianocore/edk2/pull/4865

Fix for buffer overlows that arise in DevPathToTextAcpiEx when device path node
producer doesn't specify all of the optional strings.

Changes in v2:
- Fix AcpiExp print logic that got broken in V1
- Don't pass NULL string to print function

Tests:
- Booted the platform and confirmed that platform doesn't hang when special 
pool is enabled
  (special pool detects accesses outside of allocated pool)
- Examined the output of the DevPathToTextAcpiEx, here are some example strings:
  AcpiEx(@@@,@@@,0x0,INTC10E7,,) - this device path doesn't specify 
UIDSTR and CIDSTR
  PciRoot(0x0)/AcpiEx(UAR0002,@@@,0x0,UART2,,) - this device path specifies 
empty UIDSTR and CIDSTR
- Unit tests added in second patch are passing

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 

Mateusz Albecki (2):
  MdePkg/UefiDevicePathLib: Fix AcpiEx print logic
  MdePkg/Test: Add DevicePathLib host test module

 .../UefiDevicePathLib/DevicePathToText.c  |  69 +-
 MdePkg/MdePkg.ci.yaml |   5 +-
 MdePkg/Test/MdePkgHostTest.dsc|   2 +
 .../Library/DevicePathLib/TestDevicePathLib.c | 638 ++
 .../Library/DevicePathLib/TestDevicePathLib.h |  26 +
 .../DevicePathLib/TestDevicePathLibHost.inf   |  33 +
 .../TestDevicePathStringConversions.c | 370 ++
 7 files changed, 1115 insertions(+), 28 deletions(-)
 create mode 100644 
MdePkg/Test/UnitTest/Library/DevicePathLib/TestDevicePathLib.c
 create mode 100644 
MdePkg/Test/UnitTest/Library/DevicePathLib/TestDevicePathLib.h
 create mode 100644 
MdePkg/Test/UnitTest/Library/DevicePathLib/TestDevicePathLibHost.inf
 create mode 100644 
MdePkg/Test/UnitTest/Library/DevicePathLib/TestDevicePathStringConversions.c

-- 
2.39.2

-
Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial 
Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 
Kapital zakladowy 200.000 PLN.
Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z 
dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach 
handlowych.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i 
moze zawierac informacje poufne. W razie przypadkowego otrzymania tej 
wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; 
jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole 
use of the intended recipient(s). If you are not the intended recipient, please 
contact the sender and delete all copies; any review or distribution by others 
is strictly prohibited.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109124): https://edk2.groups.io/g/devel/message/109124
Mute This Topic: https://groups.io/mt/101619975/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 2/4] DynamicTablesPkg: Add support for simple method invocation.

2023-09-27 Thread PierreGondois

Hello Abdul,

On 9/23/23 06:22, Attar, AbdulLateef (Abdul Lateef) wrote:

[AMD Official Use Only - General]


Hi Jeff, Sami,

     I’m not reviewer, just providing the opinion.

How about making it generic(generic to integer argument)  instead of single 
integer argument.

     IN    UINT64  IntegerArgument

     IN     UINT64 **IntegerArgumentArray.*

Create the list(by making use of AmlVarListAddTail) of data object depends on 
IntergerArgument value.

Also, I think if data in data node is AML_ARG0(0x68), AML_ARG1…., then it will 
considered as Arg0, Arg1, ….etc.


Just to be sure, you would like the method generated by 
AmlCodeGenMethodRetNameStringIntegerArgument()
to take multiple integer argument ? This would allow to generate a function 
taking N input arguments like:

Method(MET0, N, Serialized, 3) {
  Return (MET1 (1, 2, ..., N))
}

It is true AmlCodeGenMethodRetNameStringIntegerArgument() takes a NumArgs 
parameter,
but currently NumArgs can only equal 1.

Is there a specific use case that you are looking to solve with this solution ?

Regards,
Pierre



Thanks

AbduL




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




Re: [edk2-devel] Uploading to fd file flash chip

2023-09-27 Thread Alireza Banejad
any thoughts on this?

On Tue, Sep 26, 2023 at 5:48 PM Alireza Banejad via groups.io
 wrote:

> Hi everybody,
> I have built the Whisky Lake platform and I got the fd file but now I want
> to upload it into my motherboard's flash chip but I haven't found the right
> way of doing so. it seems I need to translate it into a *.rom file but I
> don't know how to do that. I have already built a coreboot firmware with
> the edk2 as payload and uploaded it into the flash IC using the flashrom
> software and a ch341a programmer. but then I found out that edk2 has a repo
> for building on different silicon so I successfully built the Whisky Lake
> board and got the fd file but I don't know what to do next. can anybody
> help me on this?
>
> Thanks,
> Alireza
> 
>
>


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




[edk2-devel] efi and ext4 and case sensitive file names

2023-09-27 Thread Gerd Hoffmann
  Hi,

I've noticed that the edk2 ext4 driver does case-insensitive filename
matching.  I know the fat filesystem is case-insensitive, and the uefi
spec describing the fat filesystem also explicitly says it is
case-insensitive.  On a quick scan I can't find anything in the uefi
spec requiring *all* filesystem drivers being case-insensitive though.

So I'm wondering whenever the ext4 driver behavior is correct.  It
certainly is different than the linux kernel's behavior which is (by
default) case-sensitive.

Also note that the linux kernel ext4 driver recently got support for
case-insensitive file names, which must be explicitly enabled for both
filesystems (EXT4_FEATURE_INCOMPAT_CASEFOLD) and directories
(EXT4_CASEFOLD_FL).

On practical terms I've ran into actual problems due to Fedora mounting
the ESP at /boot/efi[1] and UKIs (unified kernel images) should be
placed in EFI/Linux on either ESP or XBOOTLDR partition, which on fedora
translates to /boot/efi/EFI/Linux (ESP) or /boot/EFI/Linux (XBOOTLDR).
So I have both /boot/efi and /boot/EFI ...

take care,
  Gerd

[1] Yes, a bad choice for a number of reasons, but changing that isn't
easy as this is hard-coded in a unknown number of places :(



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109121): https://edk2.groups.io/g/devel/message/109121
Mute This Topic: https://groups.io/mt/101615699/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] MdePkg/UefiDevicePathLib: Fix AcpiEx print logic

2023-09-27 Thread Albecki, Mateusz
This patch has a bug related to AcpiExp device path. I will resend the fixed 
version along with unit tests to cover AcpiExp cases.

Thanks,
Mateusz


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




[edk2-devel] [PATCH 1/1] Maintainers.txt: add Sami as maintainer of arm-architectural subdirs

2023-09-27 Thread Leif Lindholm
We added Sami as a reviewer to ArmPkg early last year, and I think it was
always our intention to have him as a reviewer of Arm architectural stuff
in general, but we seem to have missed out the Arm/AArch64 subdir
wildcards. So let's fix that.

Signed-off-by: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Sami Mujawar 
Cc: Andrew Fish 
Cc: Michael D Kinney 
---
 Maintainers.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index 55a8af21dc3e..1a7525b1b4c0 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -88,6 +88,7 @@ F: */AArch64/
 F: */Arm/
 M: Leif Lindholm  [leiflindholm]
 M: Ard Biesheuvel  [ardbiesheuvel]
+M: Sami Mujawar  [samimujawar]
 
 RISCV64
 F: */RiscV64/
-- 
2.30.2



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




Re: [edk2-devel] [PATCH edk2-platforms v3 1/1] Platform/SbsaQemu: add XHCI support and replace EHCI

2023-09-27 Thread Leif Lindholm
Hi Yuquan,

I am mostly happy with the below, but there are a couple of things I'd
like to change (comments inline).

On Fri, Sep 22, 2023 at 21:41:15 +0800, Yuquan Wang wrote:
> As sbsa-ref does not have DRAM below 4G, it cannot utilize EHCI
> that only has 32-bit DMA capablity and sbsa-ref board uses xhci
> to replace ehci.
> 
> This updates DSDT to match the platform xhci controller with two
> usb ports changed from type A to type C.
> 
> This also registers the non-discoverable XHCI for sbsa-ref.

Ah, I failed to notice this on previous review. Since we didn't map
EHCI at all (probably because it was non-functioning), this
registering becomes a separate change, which should be in a separate
patch.
This is just mechanics, so I'll rework it myself.

> Signed-off-by: Yuquan Wang 
> ---
>  Silicon/Qemu/SbsaQemu/SbsaQemu.dec|  4 +-
>  Platform/Qemu/SbsaQemu/SbsaQemu.dsc   |  6 +--
>  .../Qemu/SbsaQemu/AcpiTables/AcpiTables.inf   |  4 +-
>  .../SbsaQemuPlatformDxe.inf   |  2 +
>  .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 41 +++
>  Silicon/Qemu/SbsaQemu/AcpiTables/Dsdt.asl | 15 +++
>  6 files changed, 49 insertions(+), 23 deletions(-)
> 
> diff --git a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec 
> b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
> index aab2894e6455..913d1d75ef29 100644
> --- a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
> +++ b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
> @@ -32,8 +32,8 @@ [PcdsFixedAtBuild.common]
># Non discoverable devices Pcds
>
> gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase|0|UINT64|0x0001
>
> gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize|0x1|UINT32|0x0002
> -  
> gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciBase|0|UINT64|0x0003
> -  
> gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciSize|0x1|UINT32|0x0004
> +  
> gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciBase|0|UINT64|0x0003
> +  
> gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciSize|0x1|UINT32|0x0004
>
> gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdDeviceTreeBaseAddress|0x100|UINT64|0x0005
>  
># PCDs complementing PCIe layout pulled into ACPI tables
> diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc 
> b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> index be406144c242..948e42326c33 100644
> --- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> @@ -429,11 +429,11 @@ [PcdsFixedAtBuild.common]
># Initial Device Tree Location
>
> gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdDeviceTreeBaseAddress|0x100
>  
> -  # Non discoverable devices (AHCI,EHCI)
> +  # Non discoverable devices (AHCI,XHCI)
>gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase|0x6010
>gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize|0x0001
> -  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciBase|0x6011
> -  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciSize|0x0001
> +  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciBase|0x6011
> +  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciSize|0x0001
>  
># PL011 - Serial Terminal
>gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x6000
> diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf 
> b/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
> index 97021f7971c7..abd10b6c3098 100644
> --- a/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
> +++ b/Silicon/Qemu/SbsaQemu/AcpiTables/AcpiTables.inf
> @@ -69,8 +69,8 @@ [FixedPcd]
>  
>gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase
>gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize
> -  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciBase
> -  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformEhciSize
> +  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciBase
> +  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciSize
>  
>  [Pcd]
>gArmTokenSpaceGuid.PcdGicDistributorBase
> diff --git 
> a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf 
> b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
> index 0e3b11d60426..19534b7a274a 100644
> --- 
> a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
> +++ 
> b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
> @@ -37,6 +37,8 @@ [LibraryClasses]
>  [Pcd]
>gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase
>gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize
> +  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciBase
> +  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformXhciSize
>  
>gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor
>gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor
> diff --git 
> a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c 
> 

Re: [edk2-devel] [PATCH v2 2/2] StandaloneMmPkg: Arm: Update to use the new StandaloneMmCpu driver

2023-09-27 Thread levi.yun
Look good to me.

Thanks!

Reviewed-by: levi.yun 


From: devel@edk2.groups.io  on behalf of Tuan Phan via 
groups.io 
Sent: 15 September 2023 00:10
To: devel@edk2.groups.io
Cc: ardb+tianoc...@kernel.org; Sami Mujawar; ray...@intel.com; 
huangm...@linux.alibaba.com; suni...@ventanamicro.com; yong...@intel.com; Tuan 
Phan
Subject: [edk2-devel] [PATCH v2 2/2] StandaloneMmPkg: Arm: Update to use the 
new StandaloneMmCpu driver

Update entry point library for Arm to use the new platform independent
StandaloneMmCpu driver.

Signed-off-by: Tuan Phan 
---
 .../Library/Arm/StandaloneMmCoreEntryPoint.h  | 17 ++--
 .../Arm/CreateHobList.c   | 43 ++-
 .../Arm/StandaloneMmCoreEntryPoint.c  | 15 ++-
 .../StandaloneMmCoreEntryPoint.inf|  2 +-
 4 files changed, 40 insertions(+), 37 deletions(-)

diff --git a/StandaloneMmPkg/Include/Library/Arm/StandaloneMmCoreEntryPoint.h 
b/StandaloneMmPkg/Include/Library/Arm/StandaloneMmCoreEntryPoint.h
index 41bf0f132b4f..dbb81610ff8e 100644
--- a/StandaloneMmPkg/Include/Library/Arm/StandaloneMmCoreEntryPoint.h
+++ b/StandaloneMmPkg/Include/Library/Arm/StandaloneMmCoreEntryPoint.h
@@ -10,6 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #ifndef __STANDALONEMMCORE_ENTRY_POINT_H__

 #define __STANDALONEMMCORE_ENTRY_POINT_H__



+#include 

 #include 

 #include 



@@ -47,18 +48,6 @@ typedef struct {
   EFI_SECURE_PARTITION_CPU_INFO*CpuInfo;

 } EFI_SECURE_PARTITION_BOOT_INFO;



-typedef

-EFI_STATUS

-(*PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT) (

-  IN UINTN  EventId,

-  IN UINTN  CpuNumber,

-  IN UINTN  NsCommBufferAddr

-  );

-

-typedef struct {

-  PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT*ArmTfCpuDriverEpPtr;

-} ARM_TF_CPU_DRIVER_EP_DESCRIPTOR;

-

 typedef RETURN_STATUS (*REGION_PERMISSION_UPDATE_FUNC) (

   IN  EFI_PHYSICAL_ADDRESS  BaseAddress,

   IN  UINT64Length

@@ -145,8 +134,8 @@ LocateStandaloneMmCorePeCoffData (
 VOID *

 EFIAPI

 CreateHobListFromBootInfo (

-  IN  OUT  PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT  *CpuDriverEntryPoint,

-  IN   EFI_SECURE_PARTITION_BOOT_INFO  *PayloadBootInfo

+  IN  OUT  PI_MM_CPU_DRIVER_ENTRYPOINT *CpuDriverEntryPoint,

+  IN   EFI_SECURE_PARTITION_BOOT_INFO  *PayloadBootInfo

   );



 /**

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c 
b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c
index 2ac2d354f06a..80ed532352af 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreEntryPoint/Arm/CreateHobList.c
@@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 

 #include 



+#include 

 #include 

 #include 

 #include 

@@ -39,7 +40,7 @@ extern EFI_GUID  gEfiStandaloneMmNonSecureBufferGuid;
 // GUID to identify HOB where the entry point of the CPU driver will be

 // populated to allow this entry point driver to invoke it upon receipt of an

 // event

-extern EFI_GUID  gEfiArmTfCpuDriverEpDescriptorGuid;

+extern EFI_GUID  gEfiMmCpuDriverEpDescriptorGuid;



 /**

   Use the boot information passed by privileged firmware to populate a HOB list

@@ -52,22 +53,22 @@ extern EFI_GUID  gEfiArmTfCpuDriverEpDescriptorGuid;
 **/

 VOID *

 CreateHobListFromBootInfo (

-  IN  OUT  PI_MM_ARM_TF_CPU_DRIVER_ENTRYPOINT  *CpuDriverEntryPoint,

-  IN   EFI_SECURE_PARTITION_BOOT_INFO  *PayloadBootInfo

+  IN  OUT  PI_MM_CPU_DRIVER_ENTRYPOINT *CpuDriverEntryPoint,

+  IN   EFI_SECURE_PARTITION_BOOT_INFO  *PayloadBootInfo

   )

 {

-  EFI_HOB_HANDOFF_INFO_TABLE   *HobStart;

-  EFI_RESOURCE_ATTRIBUTE_TYPE  Attributes;

-  UINT32   Index;

-  UINT32   BufferSize;

-  UINT32   Flags;

-  EFI_MMRAM_HOB_DESCRIPTOR_BLOCK   *MmramRangesHob;

-  EFI_MMRAM_DESCRIPTOR *MmramRanges;

-  EFI_MMRAM_DESCRIPTOR *NsCommBufMmramRange;

-  MP_INFORMATION_HOB_DATA  *MpInformationHobData;

-  EFI_PROCESSOR_INFORMATION*ProcInfoBuffer;

-  EFI_SECURE_PARTITION_CPU_INFO*CpuInfo;

-  ARM_TF_CPU_DRIVER_EP_DESCRIPTOR  *CpuDriverEntryPointDesc;

+  EFI_HOB_HANDOFF_INFO_TABLE  *HobStart;

+  EFI_RESOURCE_ATTRIBUTE_TYPE Attributes;

+  UINT32  Index;

+  UINT32  BufferSize;

+  UINT32  Flags;

+  EFI_MMRAM_HOB_DESCRIPTOR_BLOCK  *MmramRangesHob;

+  EFI_MMRAM_DESCRIPTOR*MmramRanges;

+  EFI_MMRAM_DESCRIPTOR*NsCommBufMmramRange;

+  MP_INFORMATION_HOB_DATA *MpInformationHobData;

+  EFI_PROCESSOR_INFORMATION   *ProcInfoBuffer;

+  EFI_SECURE_PARTITION_CPU_INFO   *CpuInfo;

+  MM_CPU_DRIVER_EP_DESCRIPTOR *CpuDriverEntryPointDesc;



   // Create a hoblist with a PHIT and EOH

   HobStart = HobConstructor (

@@ -144,13 +145,13 @@ 

Re: [edk2-devel] [PATCH v2 1/2] StandaloneMmPkg: Make StandaloneMmCpu driver platform independent

2023-09-27 Thread levi.yun
Look good to me.

Thanks!

Reviewed-by: levi.yun 


From: devel@edk2.groups.io  on behalf of Tuan Phan via 
groups.io 
Sent: 15 September 2023 00:10
To: devel@edk2.groups.io
Cc: ardb+tianoc...@kernel.org; Sami Mujawar; ray...@intel.com; 
huangm...@linux.alibaba.com; suni...@ventanamicro.com; yong...@intel.com; Tuan 
Phan
Subject: [edk2-devel] [PATCH v2 1/2] StandaloneMmPkg: Make StandaloneMmCpu 
driver platform independent

StandaloneMmCpu now can supports more platforms like RISC-V besides
ARM/AARCH64.

Signed-off-by: Tuan Phan 
---
 .../Drivers/StandaloneMmCpu/EventHandle.c | 25 +++
 .../Drivers/StandaloneMmCpu/StandaloneMmCpu.c | 42 +--
 .../StandaloneMmCpu/StandaloneMmCpu.inf   |  9 ++--
 .../StandaloneMmCpu.h | 22 +++---
 StandaloneMmPkg/StandaloneMmPkg.dec   |  2 +-
 5 files changed, 46 insertions(+), 54 deletions(-)
 rename StandaloneMmPkg/{Drivers/StandaloneMmCpu => Include}/StandaloneMmCpu.h 
(82%)

diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c 
b/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c
index 818e147f874c..dc11d4375a02 100644
--- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c
+++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/EventHandle.c
@@ -3,6 +3,7 @@
   Copyright (c) 2016 HP Development Company, L.P.

   Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.

   Copyright (c) 2021, Linaro Limited

+  Copyright (c) 2023, Ventana Micro System Inc. All rights reserved.



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



@@ -11,8 +12,6 @@
 #include 

 #include 



-#include 

-#include 

 #include 

 #include 

 #include 

@@ -22,10 +21,7 @@
 #include 

 #include 



-#include 

-#include 

-

-#include "StandaloneMmCpu.h"

+#include 



 EFI_STATUS

 EFIAPI

@@ -108,7 +104,7 @@ CheckBufferAddr (
 }



 /**

-  The PI Standalone MM entry point for the TF-A CPU driver.

+  The PI Standalone MM entry point for the CPU driver.



   @param  [in] EventIdThe event Id.

   @param  [in] CpuNumber  The CPU number.

@@ -121,7 +117,7 @@ CheckBufferAddr (
   @retval   EFI_UNSUPPORTED Operation not supported.

 **/

 EFI_STATUS

-PiMmStandaloneArmTfCpuDriverEntry (

+PiMmStandaloneMmCpuDriverEntry (

   IN UINTN  EventId,

   IN UINTN  CpuNumber,

   IN UINTN  NsCommBufferAddr

@@ -135,17 +131,6 @@ PiMmStandaloneArmTfCpuDriverEntry (
   DEBUG ((DEBUG_INFO, "Received event - 0x%x on cpu %d\n", EventId, 
CpuNumber));



   Status = EFI_SUCCESS;

-  //

-  // ARM TF passes SMC FID of the MM_COMMUNICATE interface as the Event ID upon

-  // receipt of a synchronous MM request. Use the Event ID to distinguish

-  // between synchronous and asynchronous events.

-  //

-  if ((ARM_SMC_ID_MM_COMMUNICATE != EventId) &&

-  (ARM_SVC_ID_FFA_MSG_SEND_DIRECT_REQ != EventId))

-  {

-DEBUG ((DEBUG_ERROR, "UnRecognized Event - 0x%x\n", EventId));

-return EFI_INVALID_PARAMETER;

-  }



   // Perform parameter validation of NsCommBufferAddr

   if (NsCommBufferAddr == (UINTN)NULL) {

@@ -177,7 +162,7 @@ PiMmStandaloneArmTfCpuDriverEntry (
   }



   // X1 contains the VA of the normal world memory accessible from

-  // S-EL0

+  // secure world.

   CopyMem (GuidedEventContext, (CONST VOID *)NsCommBufferAddr, 
NsCommBufferSize);



   // Stash the pointer to the allocated Event Context for this CPU

diff --git a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c 
b/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c
index 3d1dc6181bd9..c5ec1a5a80c5 100644
--- a/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c
+++ b/StandaloneMmPkg/Drivers/StandaloneMmCpu/StandaloneMmCpu.c
@@ -3,6 +3,7 @@
   Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.

   Copyright (c) 2016 HP Development Company, L.P.

   Copyright (c) 2016 - 2021, Arm Limited. All rights reserved.

+  Copyright (c) 2023, Ventana Micro System Inc. All rights reserved.



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



@@ -10,10 +11,7 @@


 #include 

 #include 

-#include 

 #include 

-#include 

-#include 

 #include 

 #include 



@@ -22,7 +20,7 @@
 #include 

 #include 



-#include "StandaloneMmCpu.h"

+#include 



 // GUID to identify HOB with whereabouts of communication buffer with Normal

 // World

@@ -31,7 +29,7 @@ extern EFI_GUID  gEfiStandaloneMmNonSecureBufferGuid;
 // GUID to identify HOB where the entry point of this CPU driver will be

 // populated to allow the entry point driver to invoke it upon receipt of an

 // event

-extern EFI_GUID  gEfiArmTfCpuDriverEpDescriptorGuid;

+extern EFI_GUID  gEfiMmCpuDriverEpDescriptorGuid;



 //

 // Private copy of the MM system table for future use

@@ -96,17 +94,17 @@ StandaloneMmCpuInitialize (
   IN EFI_MM_SYSTEM_TABLE  *SystemTable   // not actual systemtable

   )

 {

-  ARM_TF_CPU_DRIVER_EP_DESCRIPTOR  *CpuDriverEntryPointDesc;

-  EFI_CONFIGURATION_TABLE  

Re: [edk2-devel] [PATCH edk2-platforms v3 1/1] Platform/SbsaQemu: add XHCI support and replace EHCI

2023-09-27 Thread Marcin Juszkiewicz

W dniu 22.09.2023 o 15:41, Yuquan Wang pisze:

As sbsa-ref does not have DRAM below 4G, it cannot utilize EHCI
that only has 32-bit DMA capablity and sbsa-ref board uses xhci
to replace ehci.

This updates DSDT to match the platform xhci controller with two
usb ports changed from type A to type C.

This also registers the non-discoverable XHCI for sbsa-ref.

Signed-off-by: Yuquan Wang 


Tested-off-by: Marcin Juszkiewicz 

With this change applied I can finally run OpenBSD 7.3 on SBSA Reference 
Platform as it hang when EDK2 says 'there is EHCI' when it is no longer 
there.





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




[edk2-devel] setting TLS ciphers is broken (openssl 3?)

2023-09-27 Thread Gerd Hoffmann
  Hi,

I've noticed that setting chipers for TLS stopped working in ovmf, most
likely due to the openssl 3.0 update.

Test case: try http boot from https server, set ciphers on the qemu
command line using:
-object tls-cipher-suites,id=tls-cipher0,priority=@SYSTEM
-fw_cfg name=etc/edk2/https/ciphers,gen_id=tls-cipher0

OvmfPkg/Library/TlsAuthConfigLib will read it from fwcfg and set
EDKII_HTTP_TLS_CIPHER_LIST_VARIABLE.

CryptoPkg/Library/TlsLib/TlsConfig.c will read the variable, map the IDs
to strings and call SSL_set_cipher_list() with the result.

Later on the tls handshake fails.  From the log:

[ ... ]
TlsDxe:TlsSetCipherList: CipherString={
  
ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GC
  
M-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-A
  ES256-SHA:DHE-RSA-AES128-SHA:DHE-RSA-DES-CBC3-SHA
  }
[ ... ]
TlsDoHandshake SSL_HANDSHAKE_ERROR State=0x10 SSL_ERROR_SSL
TlsDoHandshake ERROR 0x308010C=L6:R8010C
TlsDoHandshake ERROR 0xA0C0103=L14:RC0103
[ ... ]

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109114): https://edk2.groups.io/g/devel/message/109114
Mute This Topic: https://groups.io/mt/101613778/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 20/28] MdeModulePkg: Add Additional Profiles to SetMemoryProtectionsLib

2023-09-27 Thread Gerd Hoffmann
On Tue, Sep 19, 2023 at 05:57:43PM -0700, Taylor Beebe wrote:
> Now that the EDK2 tree uses GetMemoryProtectionsLib to query
> the platform memory protection settings, we can add additional
> profiles to SetMemoryProtectionsLib to give plaforms more options
> for setting memory protections.

What is the recommended way to add more profiles?

Specifically I have a bunch of linux test cases failing when testing
this series, which is most likely causes by older + broken grub versions
(which are known to use EfiLoaderData for code).

So I think I need a "GrubCompat" profile which has
ExecutionProtection.EnabledForType[EfiLoaderData] = FALSE
but is otherwise identical to the production profile.

Should that go into SetMemoryProtectionsLib?
Or MemoryProtectionConfigLib?

take care,
  Gerd



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




[edk2-devel] [PATCH v1 5/5] MdeModulePkg/Bus/Pci/PciBusDxe: Fix UNUSED_VALUE Coverity issues

2023-09-27 Thread Ranbir Singh
The return value after calls to functions
gBS->UninstallMultipleProtocolInterfaces, StartPciDevicesOnBridge,
PciPciDeviceInfoCollector, BarExisted, PciRootBridgeIo->Pci.Write,
gPciHotPlugInit->InitializeRootHpc and PciRootBridgeP2CProcess is
stored in Status, but it is not made of any use and later Status
gets overridden.

Remove the return value storage in Status or add Status check as
seems appropriate at a particular point.

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

Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Ranbir Singh 
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 68 +++-
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 42 
 MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c   |  8 +++
 3 files changed, 72 insertions(+), 46 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
index f43f10325f16..ae770d766381 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
@@ -544,12 +544,12 @@ DeRegisterPciDevice (
   EFI_OPEN_PROTOCOL_TEST_PROTOCOL
   );
   if (!EFI_ERROR (Status)) {
-Status = gBS->UninstallMultipleProtocolInterfaces (
-Handle,
-,
->LoadFile2,
-NULL
-);
+gBS->UninstallMultipleProtocolInterfaces (
+   Handle,
+   ,
+   >LoadFile2,
+   NULL
+   );
   }
 
   //
@@ -678,19 +678,21 @@ StartPciDevicesOnBridge (
ChildHandleBuffer
);
 
-PciIoDevice->PciIo.Attributes (
- &(PciIoDevice->PciIo),
- EfiPciIoAttributeOperationSupported,
- 0,
- 
- );
-Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;
-PciIoDevice->PciIo.Attributes (
- &(PciIoDevice->PciIo),
- EfiPciIoAttributeOperationEnable,
- Supports,
- NULL
- );
+if (!EFI_ERROR (Status)) {
+  PciIoDevice->PciIo.Attributes (
+   &(PciIoDevice->PciIo),
+   EfiPciIoAttributeOperationSupported,
+   0,
+   
+   );
+  Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;
+  PciIoDevice->PciIo.Attributes (
+   &(PciIoDevice->PciIo),
+   EfiPciIoAttributeOperationEnable,
+   Supports,
+   NULL
+   );
+}
 
 return Status;
   } else {
@@ -726,19 +728,21 @@ StartPciDevicesOnBridge (
ChildHandleBuffer
);
 
-PciIoDevice->PciIo.Attributes (
- &(PciIoDevice->PciIo),
- EfiPciIoAttributeOperationSupported,
- 0,
- 
- );
-Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;
-PciIoDevice->PciIo.Attributes (
- &(PciIoDevice->PciIo),
- EfiPciIoAttributeOperationEnable,
- Supports,
- NULL
- );
+if (!EFI_ERROR (Status)) {
+  PciIoDevice->PciIo.Attributes (
+   &(PciIoDevice->PciIo),
+   EfiPciIoAttributeOperationSupported,
+   0,
+   
+   );
+  Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;
+  PciIoDevice->PciIo.Attributes (
+   &(PciIoDevice->PciIo),
+   EfiPciIoAttributeOperationEnable,
+   Supports,
+   NULL
+   );
+}
   }
 
   CurrentLink = CurrentLink->ForwardLink;
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index eda97285ee18..636885dd189d 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -2796,6 +2796,20 @@ IsPciDeviceRejected (
   // Test its high 32-Bit BAR
   //
   Status = BarExisted (PciIoDevice, BarOffset, , );
+  if (EFI_ERROR (Status)) {
+//
+// Not sure if it is correct to skip the below if (TestValue == 

[edk2-devel] [PATCH v1 4/5] MdeModulePkg/Bus/Pci/PciBusDxe: Fix NULL_RETURNS Coverity issue

2023-09-27 Thread Ranbir Singh
From: Ranbir Singh 

The function StartPciDevices has a check

ASSERT (RootBridge != NULL);

but this comes into play only in DEBUG mode. In Release mode, there
is no handling if the RootBridge value is NULL and the code proceeds
to unconditionally dereference "RootBridge" which will lead to CRASH.

Hence, for safety add NULL pointer checks always and return
EFI_NOT_READY if RootBridge value is NULL which is one of the return
values as mentioned in the function description header.

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

Cc: Hao A Wu 
Cc: Ray Ni 
Co-authored-by: Veeresh Sangolli 
Signed-off-by: Ranbir Singh 
Signed-off-by: Ranbir Singh 
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
index 581e9075ad41..f43f10325f16 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
@@ -773,6 +773,11 @@ StartPciDevices (
 
   RootBridge = GetRootBridgeByHandle (Controller);
   ASSERT (RootBridge != NULL);
+
+  if (RootBridge == NULL) {
+return EFI_NOT_READY;
+  }
+
   ThisHostBridge = RootBridge->PciRootBridgeIo->ParentHandle;
 
   CurrentLink = mPciDevicePool.ForwardLink;
-- 
2.34.1



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




[edk2-devel] [PATCH v1 3/5] MdeModulePkg/Bus/Pci/PciBusDxe: Fix ARRAY_VS_SINGLETON Coverity issues

2023-09-27 Thread Ranbir Singh
From: Ranbir Singh 

The function PciHostBridgeResourceAllocator is not making use of the
generic approach as is used in one of the other function namely -
DumpResourceMap. As a result, the following warnings can be seen as
reported by Coverity e.g.

(30) Event address_of:  Taking address with "" yields a
 singleton pointer.
(31) Event callee_ptr_arith:Passing "" to function
 "FindResourceNode" which uses it as an array. This might corrupt
 or misinterpret adjacent memory locations.

Hence, adopt the generic approach to fix the issues at relevant points.

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

Cc: Hao A Wu 
Cc: Ray Ni 
Co-authored-by: Veeresh Sangolli 
Signed-off-by: Ranbir Singh 
Signed-off-by: Ranbir Singh 
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 37 
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
index 84fc0161a19c..71767d3793d4 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
@@ -485,6 +485,8 @@ PciHostBridgeResourceAllocator (
   UINT64 Mem64ResStatus;
   UINT64 PMem64ResStatus;
   UINT32 MaxOptionRomSize;
+  PCI_RESOURCE_NODE  **ChildResources;
+  UINTN  ChildResourceCount;
   PCI_RESOURCE_NODE  *IoBridge;
   PCI_RESOURCE_NODE  *Mem32Bridge;
   PCI_RESOURCE_NODE  *PMem32Bridge;
@@ -895,16 +897,39 @@ PciHostBridgeResourceAllocator (
 // Create the entire system resource map from the information collected by
 // enumerator. Several resource tree was created
 //
-FindResourceNode (RootBridgeDev, , );
-FindResourceNode (RootBridgeDev, , );
-FindResourceNode (RootBridgeDev, , );
-FindResourceNode (RootBridgeDev, , );
-FindResourceNode (RootBridgeDev, , );
-
+ChildResourceCount = FindResourceNode (RootBridgeDev, , NULL);
+ChildResources = AllocatePool (sizeof (PCI_RESOURCE_NODE *) * 
ChildResourceCount);
+ASSERT (ChildResources != NULL);
+FindResourceNode (RootBridgeDev, , [0]);
+IoBridge = ChildResources[0];
 ASSERT (IoBridge != NULL);
+
+ChildResourceCount = FindResourceNode (RootBridgeDev, , NULL);
+ChildResources = AllocatePool (sizeof (PCI_RESOURCE_NODE *) * 
ChildResourceCount);
+ASSERT (ChildResources != NULL);
+FindResourceNode (RootBridgeDev, , [0]);
+Mem32Bridge = ChildResources[0];
 ASSERT (Mem32Bridge  != NULL);
+
+ChildResourceCount = FindResourceNode (RootBridgeDev, , NULL);
+ChildResources = AllocatePool (sizeof (PCI_RESOURCE_NODE *) * 
ChildResourceCount);
+ASSERT (ChildResources != NULL);
+FindResourceNode (RootBridgeDev, , [0]);
+PMem32Bridge = ChildResources[0];
 ASSERT (PMem32Bridge != NULL);
+
+ChildResourceCount = FindResourceNode (RootBridgeDev, , NULL);
+ChildResources = AllocatePool (sizeof (PCI_RESOURCE_NODE *) * 
ChildResourceCount);
+ASSERT (ChildResources != NULL);
+FindResourceNode (RootBridgeDev, , [0]);
+Mem64Bridge = ChildResources[0];
 ASSERT (Mem64Bridge  != NULL);
+
+ChildResourceCount = FindResourceNode (RootBridgeDev, , NULL);
+ChildResources = AllocatePool (sizeof (PCI_RESOURCE_NODE *) * 
ChildResourceCount);
+ASSERT (ChildResources != NULL);
+FindResourceNode (RootBridgeDev, , [0]);
+PMem64Bridge = ChildResources[0];
 ASSERT (PMem64Bridge != NULL);
 
 //
-- 
2.34.1



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




[edk2-devel] [PATCH v1 2/5] MdeModulePkg/Bus/Pci/PciBusDxe: Fix MISSING_BREAK Coverity issues

2023-09-27 Thread Ranbir Singh
From: Ranbir Singh 

The function UpdatePciInfo has switch-case code in which there are fall
through from case 32: to case 64:. While this is seeemingly intentional,
it is not evident to any static analyzer tool. Just adding

// No break; here as this is an intentional fallthrough.

as explicit comment in between makes a reader as well as Coverity happy.

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

Cc: Hao A Wu 
Cc: Ray Ni 
Co-authored-by: Veeresh Sangolli 
Signed-off-by: Ranbir Singh 
Signed-off-by: Ranbir Singh 
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index 6594b8eae83f..eda97285ee18 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -1428,6 +1428,9 @@ UpdatePciInfo (
   switch (Ptr->AddrSpaceGranularity) {
 case 32:
   PciIoDevice->PciBar[BarIndex].BarType = PciBarTypeMem32;
+  //
+  // No break; here as this is an intentional fall through.
+  //
 case 64:
   PciIoDevice->PciBar[BarIndex].BarTypeFixed = TRUE;
   break;
@@ -1440,6 +1443,9 @@ UpdatePciInfo (
   switch (Ptr->AddrSpaceGranularity) {
 case 32:
   PciIoDevice->PciBar[BarIndex].BarType = PciBarTypePMem32;
+  //
+  // No break; here as this is an intentional fall through.
+  //
 case 64:
   PciIoDevice->PciBar[BarIndex].BarTypeFixed = TRUE;
   break;
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109109): https://edk2.groups.io/g/devel/message/109109
Mute This Topic: https://groups.io/mt/101612808/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/5] MdeModulePkg/Bus/Pci/PciBusDxe: Fix DEADCODE Coverity issue

2023-09-27 Thread Ranbir Singh
From: Ranbir Singh 

The function PciHotPlugRequestNotify has two if blocks towards the end
of function both containing return. Due to the parameter checks ensured
at the beginning of the function, one of the two if blocks is bound to
come in execution flow. Hence, the return EFI_SUCCESS; at line 2112 is
redundant/deadcode.

To fix it, either of line 2109 or 2112 can be deleted.

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

Cc: Hao A Wu 
Cc: Ray Ni 
Co-authored-by: Veeresh Sangolli 
Signed-off-by: Ranbir Singh 
Signed-off-by: Ranbir Singh 
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
index 3f8c6e6da7dc..5b71e152f3ea 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
@@ -2106,7 +2106,6 @@ PciHotPlugRequestNotify (
 //
 // End for
 //
-return EFI_SUCCESS;
   }
 
   return EFI_SUCCESS;
-- 
2.34.1



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




[edk2-devel] [PATCH v1 0/5] BZ 4239: Fix PciBusDxe issues pointed by

2023-09-27 Thread Ranbir Singh
Ranbir Singh (5):
  MdeModulePkg/Bus/Pci/PciBusDxe: Fix DEADCODE Coverity issue
  MdeModulePkg/Bus/Pci/PciBusDxe: Fix MISSING_BREAK Coverity issues
  MdeModulePkg/Bus/Pci/PciBusDxe: Fix ARRAY_VS_SINGLETON Coverity issues
  MdeModulePkg/Bus/Pci/PciBusDxe: Fix NULL_RETURNS Coverity issue
  MdeModulePkg/Bus/Pci/PciBusDxe: Fix UNUSED_VALUE Coverity issues

 MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 73 +++-
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c|  1 -
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 48 +
 MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c   | 45 ++--
 4 files changed, 114 insertions(+), 53 deletions(-)

-- 
2.34.1



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




[edk2-devel] [PATCH v2 5/5] MdeModulePkg/Core/Dxe: Fix UNUSED_VALUE Coverity issues

2023-09-27 Thread Ranbir Singh
The return value after calls to functions CoreProcessFvImageFile,
CoreStartImage,  CoreGetDepexSectionAndPreProccess,
CoreInternalAddMemorySpace, CoreAddIoSpace, CoreAllocateMemorySpace
and CoreCloseProtocol is stored in Status, but it is not made of any
use and later Status gets overridden.

An option assuming this no Status check is deliberate, would be to
remove the return value storage in Status. Otherwise, simply add
Status check and appropriate debug messages (the patch does this).

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

Cc: Dandan Bi 
Cc: Liming Gao 
Signed-off-by: Ranbir Singh 
---
 MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 15 +++
 MdeModulePkg/Core/Dxe/Gcd/Gcd.c   | 15 +++
 MdeModulePkg/Core/Dxe/Image/Image.c   |  3 +++
 3 files changed, 33 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c 
b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
index cf9d55687766..f53a2513457a 100644
--- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
@@ -506,6 +506,10 @@ CoreDispatcher (
 // Produce a firmware volume block protocol for FvImage so it gets 
dispatched from.
 //
 Status = CoreProcessFvImageFile (DriverEntry->Fv, 
DriverEntry->FvHandle, >FileName);
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_DISPATCH, "Failed to produce a FVB protocol for Fv %p 
FvHandle %p and FileName %g.\n",
+DriverEntry->Fv, DriverEntry->FvHandle, >FileName));
+}
   } else {
 REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
   EFI_PROGRESS_CODE,
@@ -516,6 +520,10 @@ CoreDispatcher (
 ASSERT (DriverEntry->ImageHandle != NULL);
 
 Status = CoreStartImage (DriverEntry->ImageHandle, NULL, NULL);
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_DISPATCH, "Failed to transfer control to a loaded 
image's entry point for ImageHandle %p.\n",
+DriverEntry->ImageHandle));
+}
 
 REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
   EFI_PROGRESS_CODE,
@@ -549,6 +557,13 @@ CoreDispatcher (
 // If Section Extraction Protocol did not let the Depex be read before 
retry the read
 //
 Status = CoreGetDepexSectionAndPreProccess (DriverEntry);
+if (EFI_ERROR (Status)) {
+  if (Status == EFI_PROTOCOL_ERROR) {
+DEBUG ((DEBUG_DISPATCH, "Section extraction protocol failure for 
DriverEntry %p.\n", DriverEntry));
+  } else {
+DEBUG ((DEBUG_DISPATCH, "No Depex, assume UEFI 2.0 driver model 
for DriverEntry %p.\n", DriverEntry));
+  }
+}
   }
 
   if (DriverEntry->Dependent) {
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index 39fa2adf9366..384fee600d85 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -2638,6 +2638,9 @@ CoreInitializeGcdServices (
ResourceHob->ResourceLength,
Capabilities
);
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_GCD, "Failed to add a segment of memory to GCD map, 
Status = %r\n", Status));
+}
   }
 
   if (GcdIoType != EfiGcdIoTypeNonExistent) {
@@ -2646,6 +2649,9 @@ CoreInitializeGcdServices (
ResourceHob->PhysicalStart,
ResourceHob->ResourceLength
);
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_GCD, "Failed to add reserved I/O or I/O resources, 
Status = %r\n", Status));
+}
   }
 }
   }
@@ -2668,6 +2674,9 @@ CoreInitializeGcdServices (
gDxeCoreImageHandle,
NULL
);
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_GCD, "Failed to allocate memory space, Status = %r\n", 
Status));
+}
   }
 
   //
@@ -2715,6 +2724,9 @@ CoreInitializeGcdServices (
 gDxeCoreImageHandle,
 NULL
 );
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_GCD, "Failed to allocate memory space, Status = %r\n", 
Status));
+  }
 }
   }
 
@@ -2763,6 +2775,9 @@ CoreInitializeGcdServices (
gDxeCoreImageHandle,
NULL
);
+if (EFI_ERROR (Status)) {
+  DEBUG ((DEBUG_GCD, "Failed to allocate memory space, Status = %r\n", 
Status));
+}
   }
 }
   }
diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c 
b/MdeModulePkg/Core/Dxe/Image/Image.c
index 9dbfb2a1fad2..769e2d379051 100644
--- a/MdeModulePkg/Core/Dxe/Image/Image.c
+++ b/MdeModulePkg/Core/Dxe/Image/Image.c
@@ -1010,6 +1010,9 @@ CoreUnloadAndCloseImage (
  Image->Handle,
  OpenInfo[OpenInfoIndex].ControllerHandle
  );
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_WARN, 

[edk2-devel] [PATCH v2 4/5] MdeModulePkg/Core/Dxe: Fix OVERFLOW_BEFORE_WIDEN Coverity issues

2023-09-27 Thread Ranbir Singh
From: Ranbir Singh 

"1 << Priority" / "1 << Event->NotifyTpl" are potentially overflowing
expressions with type "int" (32 bits, signed) evaluated using 32-bit
arithmetic, and then used in a context that expects an expression of
type "UINTN" (64 bits, unsigned).

To avoid overflow, cast "1" to type "UINTN" before << operation.

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

Cc: Dandan Bi 
Cc: Liming Gao 
Co-authored-by: Veeresh Sangolli 
Signed-off-by: Ranbir Singh 
Signed-off-by: Ranbir Singh 
---
 MdeModulePkg/Core/Dxe/Event/Event.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Event/Event.c 
b/MdeModulePkg/Core/Dxe/Event/Event.c
index dc82abb02130..6cf93f7f562d 100644
--- a/MdeModulePkg/Core/Dxe/Event/Event.c
+++ b/MdeModulePkg/Core/Dxe/Event/Event.c
@@ -191,7 +191,7 @@ CoreDispatchEventNotifies (
 CoreAcquireEventLock ();
   }
 
-  gEventPending &= ~(UINTN)(1 << Priority);
+  gEventPending &= ~(UINTN)((UINTN)1 << Priority);
   CoreReleaseEventLock ();
 }
 
@@ -225,7 +225,7 @@ CoreNotifyEvent (
   //
 
   InsertTailList ([Event->NotifyTpl], >NotifyLink);
-  gEventPending |= (UINTN)(1 << Event->NotifyTpl);
+  gEventPending |= (UINTN)((UINTN)1 << Event->NotifyTpl);
 }
 
 /**
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109105): https://edk2.groups.io/g/devel/message/109105
Mute This Topic: https://groups.io/mt/101612681/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/5] MdeModulePkg/Core/Dxe: Fix FORWARD_NULL Coverity issues

2023-09-27 Thread Ranbir Singh
From: Ranbir Singh 

The functions CoreConvertSpace and CoreAllocateSpace in

MdeModulePkg/Core/Dxe/Gcd/Gcd.c has

ASSERT (FALSE); at lines 755 and 1155 which gets hit when

Operation neither include GCD_MEMORY_SPACE_OPERATION nor include
GCD_IO_SPACE_OPERATION but this comes into play only in DEBUG mode.
In Release mode, the code continues to proceed in this undesirable
case with Map variable still set to NULL and hence dereferencing
"Map" will lead to CRASH.

It is safer to add a debug message in this scenario and return from
the function with EFI_INVALID_PARAMETER; The existing ASSERT may be
retained or may be deleted whatever is deemed more appropriate.

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

Cc: Dandan Bi 
Cc: Liming Gao 
Co-authored-by: Veeresh Sangolli 
Signed-off-by: Ranbir Singh 
Signed-off-by: Ranbir Singh 
---
 MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index 792cd2e0af23..39fa2adf9366 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -752,7 +752,9 @@ CoreConvertSpace (
 CoreAcquireGcdIoLock ();
 Map = 
   } else {
+DEBUG ((DEBUG_GCD, "  Status = %r\n", EFI_INVALID_PARAMETER));
 ASSERT (FALSE);
+return EFI_INVALID_PARAMETER;
   }
 
   //
@@ -1152,7 +1154,9 @@ CoreAllocateSpace (
 CoreAcquireGcdIoLock ();
 Map = 
   } else {
+DEBUG ((DEBUG_GCD, "  Status = %r\n", EFI_INVALID_PARAMETER));
 ASSERT (FALSE);
+return EFI_INVALID_PARAMETER;
   }
 
   Found = FALSE;
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109102): https://edk2.groups.io/g/devel/message/109102
Mute This Topic: https://groups.io/mt/101612676/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/5] MdeModulePkg/Core/Dxe: Fix DEADCODE Coverity issue

2023-09-27 Thread Ranbir Singh
From: Ranbir Singh 

In the function PromoteGuardedFreePages(), the value of AvailablePages
cannot be ZERO at the condition check point

  if (AvailablePages != 0) {

as the code can come out of the while loop above only when AvailablePages
is non-ZERO.

Hence, remove the redundant condition check and the return FALSE;
DEADCODE statement at the end of the function.

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

Cc: Dandan Bi 
Cc: Liming Gao 
Co-authored-by: Veeresh Sangolli 
Signed-off-by: Ranbir Singh 
Signed-off-by: Ranbir Singh 
---
 MdeModulePkg/Core/Dxe/Mem/HeapGuard.c | 35 +---
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c 
b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
index 0c0ca61872b4..016791ee002b 100644
--- a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
+++ b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
@@ -1568,28 +1568,25 @@ PromoteGuardedFreePages (
 }
   }
 
-  if (AvailablePages != 0) {
-DEBUG ((DEBUG_INFO, "Promoted pages: %lX (%lx)\r\n", Start, 
(UINT64)AvailablePages));
-ClearGuardedMemoryBits (Start, AvailablePages);
+  DEBUG ((DEBUG_INFO, "Promoted pages: %lX (%lx)\r\n", Start, 
(UINT64)AvailablePages));
+  ClearGuardedMemoryBits (Start, AvailablePages);
 
-if (gCpu != NULL) {
-  //
-  // Set flag to make sure allocating memory without GUARD for page table
-  // operation; otherwise infinite loops could be caused.
-  //
-  mOnGuarding = TRUE;
-  Status  = gCpu->SetMemoryAttributes (gCpu, Start, EFI_PAGES_TO_SIZE 
(AvailablePages), 0);
-  ASSERT_EFI_ERROR (Status);
-  mOnGuarding = FALSE;
-}
-
-mLastPromotedPage = Start;
-*StartAddress = Start;
-*EndAddress   = Start + EFI_PAGES_TO_SIZE (AvailablePages) - 1;
-return TRUE;
+  if (gCpu != NULL) {
+//
+// Set flag to make sure allocating memory without GUARD for page table
+// operation; otherwise infinite loops could be caused.
+//
+mOnGuarding = TRUE;
+Status  = gCpu->SetMemoryAttributes (gCpu, Start, EFI_PAGES_TO_SIZE 
(AvailablePages), 0);
+ASSERT_EFI_ERROR (Status);
+mOnGuarding = FALSE;
   }
 
-  return FALSE;
+  mLastPromotedPage = Start;
+  *StartAddress = Start;
+  *EndAddress   = Start + EFI_PAGES_TO_SIZE (AvailablePages) - 1;
+
+  return TRUE;
 }
 
 /**
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109104): https://edk2.groups.io/g/devel/message/109104
Mute This Topic: https://groups.io/mt/101612679/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/5] MdeModulePkg/Core/Dxe: Fix MISSING_BREAK Coverity issue

2023-09-27 Thread Ranbir Singh
From: Ranbir Singh 

The function CoreIsSchedulable has switch-case code in which

   case EFI_DEP_BEFORE:
   case EFI_DEP_AFTER:

has a comment that

// For a well-formed Dependency Expression, the code should never get here.

It also has an ASSERT (FALSE); but this is applicable only in DEBUG
mode. Seemingly, for RELEASE mode, code should not be allowed to fall
through to case EFI_DEP_SOR: which is below the above two.

Hence, add return FALSE at the end.

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

Cc: Dandan Bi 
Cc: Liming Gao 
Co-authored-by: Veeresh Sangolli 
Signed-off-by: Ranbir Singh 
Signed-off-by: Ranbir Singh 
---
 MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c 
b/MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c
index acbf68b700fb..9799ec9ca097 100644
--- a/MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c
+++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c
@@ -265,6 +265,8 @@ CoreIsSchedulable (
 //
 DEBUG ((DEBUG_DISPATCH, "  RESULT = FALSE (Unexpected BEFORE or AFTER 
opcode)\n"));
 ASSERT (FALSE);
+return FALSE;
+
   case EFI_DEP_SOR:
 //
 // These opcodes can only appear once as the first opcode.  If it is 
found
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109103): https://edk2.groups.io/g/devel/message/109103
Mute This Topic: https://groups.io/mt/101612677/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/5] BZ 4219: MdeModulePkg/Core/Dxe: Fix issues

2023-09-27 Thread Ranbir Singh
v1 -> v2:
  - Rebased
  - Commit message update wrt Fix UNUSED_VALUE Coverity issues

Ranbir Singh (5):
  MdeModulePkg/Core/Dxe: Fix FORWARD_NULL Coverity issues
  MdeModulePkg/Core/Dxe: Fix MISSING_BREAK Coverity issue
  MdeModulePkg/Core/Dxe: Fix DEADCODE Coverity issue
  MdeModulePkg/Core/Dxe: Fix OVERFLOW_BEFORE_WIDEN Coverity issues
  MdeModulePkg/Core/Dxe: Fix UNUSED_VALUE Coverity issues

 MdeModulePkg/Core/Dxe/Dispatcher/Dependency.c |  2 ++
 MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c | 15 +
 MdeModulePkg/Core/Dxe/Event/Event.c   |  4 +--
 MdeModulePkg/Core/Dxe/Gcd/Gcd.c   | 19 +++
 MdeModulePkg/Core/Dxe/Image/Image.c   |  3 ++
 MdeModulePkg/Core/Dxe/Mem/HeapGuard.c | 35 +---
 6 files changed, 57 insertions(+), 21 deletions(-)

-- 
2.34.1



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