Re: [edk2-devel] [PATCH v1 1/3] UefiCpuPkg/SecCore: Migrate page table to permanent memory

2023-05-10 Thread Ni, Ray


> -Original Message-
> From: kra...@redhat.com 
> Sent: Wednesday, May 10, 2023 3:48 PM
> To: devel@edk2.groups.io; Ni, Ray 
> Cc: Wu, Jiaxin ; Dong, Eric ; Zeng,
> Star ; Kumar, Rahul R 
> Subject: Re: [edk2-devel] [PATCH v1 1/3] UefiCpuPkg/SecCore: Migrate page
> table to permanent memory
> 
> On Wed, May 10, 2023 at 02:48:52AM +, Ni, Ray wrote:
> > Gerd,
> > My understanding is that when code dereferences memory address, the code
> itself is responsible for
> > supplying the sign-extended linear address.
> > The page table creation logic still maps the entire linear memory space
> supported by the CPU.
> >
> > Why do you think covering the half of the space is better?
> 
> edk2 boot services operate on the assumption that everything is identity
> mapped, only runtime services know the concept of virtual addresses.
> 
> The lower half of the address space can be identity-mapped (virtual
> address == physical address).  The upper half can not, so I think it's
> better for efi boot services to restrict themself to the lower half.

Good point. I am convinced that 4-level paging only maps up to 2^47 address and
5-level only maps up to 2^56 address.

+@Kinney, Michael D, if he have other thoughts.

> 
> take care,
>   Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104668): https://edk2.groups.io/g/devel/message/104668
Mute This Topic: https://groups.io/mt/98780500/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 v1 1/3] UefiCpuPkg/SecCore: Migrate page table to permanent memory

2023-05-10 Thread Wu, Jiaxin
What's your comments to the existing code logic for the PhysicalAddressBits in 
the CreateIdentityMappingPageTables()? Looks all doesn't consider the  
sign-extended case? is it reasonable create the paging but not used? All system 
with long mode are sign-extended?

//
  // IA-32e paging translates 48-bit linear addresses to 52-bit physical 
addresses
  //  when 5-Level Paging is disabled,
  //  due to either unsupported by HW, or disabled by PCD.
  //
  ASSERT (PhysicalAddressBits <= 52);
  if (!Page5LevelSupport && (PhysicalAddressBits > 48)) {
PhysicalAddressBits = 48;
  }


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Gerd
> Hoffmann
> Sent: Wednesday, May 10, 2023 3:48 PM
> To: devel@edk2.groups.io; Ni, Ray 
> Cc: Wu, Jiaxin ; Dong, Eric ; Zeng,
> Star ; Kumar, Rahul R 
> Subject: Re: [edk2-devel] [PATCH v1 1/3] UefiCpuPkg/SecCore: Migrate page
> table to permanent memory
> 
> On Wed, May 10, 2023 at 02:48:52AM +, Ni, Ray wrote:
> > Gerd,
> > My understanding is that when code dereferences memory address, the code
> itself is responsible for
> > supplying the sign-extended linear address.
> > The page table creation logic still maps the entire linear memory space
> supported by the CPU.
> >
> > Why do you think covering the half of the space is better?
> 
> edk2 boot services operate on the assumption that everything is identity
> mapped, only runtime services know the concept of virtual addresses.
> 
> The lower half of the address space can be identity-mapped (virtual
> address == physical address).  The upper half can not, so I think it's
> better for efi boot services to restrict themself to the lower half.
> 
> take care,
>   Gerd
> 
> 
> 
> 
> 



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




Re: [edk2-devel] [PATCH] BaseTools/tools_def: Disable overzealous unused variable warning on Clang

2023-05-10 Thread Gerd Hoffmann
On Wed, May 10, 2023 at 04:50:08PM +0200, Ard Biesheuvel wrote:
> The warnings Clang emits when enabling -Wunneeded-internal-declaration
> (which is part of -Wall) are generating false positives for variables
> whose size gets taken but are not referenced beyond that.
> 
> This may happen legitimately in debug code, so let's disable this
> warning for Clang, rather than tiptoe around it in the code base.
> 
> This fixes the RELEASE build for OVMF, which triggers this issue in the
> newly added VirtioSerialDxe driver.
> 
> Cc: Rebecca Cran 
> Cc: Gerd Hoffmann 
> Cc: Liming Gao 
> Signed-off-by: Ard Biesheuvel 

Acked-by: Gerd Hoffmann 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104666): https://edk2.groups.io/g/devel/message/104666
Mute This Topic: https://groups.io/mt/98807494/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 00/12] OvmfPkg: Replace the OVMF-specific SataControllerDxe with the generic one

2023-05-10 Thread Gerd Hoffmann
On Tue, May 09, 2023 at 05:32:00PM +0100, Pedro Falcato wrote:
> This patch-set replaces the OVMF specific SataControllerDxe with the 
> MdeModulePkg/Bus/Pci one.
> They were both forked from the same code, and are code-and-functionality 
> similar. As such, there
> seems to be no need for duplication here.
> 
> The first four pages both replay OvmfPkg/SataControllerDxe commits and fix up 
> a couple of details.
> The rest of the patches (minus the last) replace OvmfPkg/SataControllerDxe 
> with the MdeModulePkg variant.
> The last patch, finally, removes the thing.
> 
> Tested by booting in QEMU (Q35 (AHCI) and PC (IDE)).
> More testing from other, alternative platforms is desired, although breakage 
> seems unlikely.
> 
> This patchset (or at least, the last patch) depends on the edk2-platforms 
> patch series to get merged.
> 
> (+CC Laszlo as the author of the original SataControllerDxe patches)
> 
> Cc: Ard Biesheuvel 
> Cc: Jiewen Yao 
> Cc :Jordan Justen 
> Cc: Gerd Hoffmann 
> Cc: Erdem Aktas 
> Cc: James Bottomley 
> Cc: Min Xu 
> Cc: Tom Lendacky 
> Cc: Michael Roth 
> Cc: Rebecca Cran 
> Cc: Peter Grehan 
> Cc: Corvin Köhne 
> Cc: Sebastien Boeuf 
> Cc: Anthony Perard 
> Cc: Julien Grall 
> Cc: Laszlo Ersek 

Acked-by: Gerd Hoffmann 



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




[edk2-devel] [PATCH v3] MinPlatformPkg: Update ACPI 6.5 definition

2023-05-10 Thread Chen, Aryeh
From: Aryeh Chen 

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

Update ACPI 6.5 definition on MinPlatformPkg

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Liming Gao 
Cc: Eric Dong 
Cc: Jiewen Yao 
Cc: Ankit Sinha

Signed-off-by: Aryeh Chen 
---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c   
   | 154 ++--
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Facs/Facs.c  
   |   8 +-
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Fadt/Fadt.c  
   |  46 +++---
 Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/Hpet/Hpet.c  
   |   4 +-
 Platform/Intel/MinPlatformPkg/Acpi/Library/DxeAslUpdateLib/DxeAslUpdateLib.c   
   |   2 +-
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec   
   |   2 +-
 Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckAcpi.c
   | 154 ++--
 
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckAcpiMadt.c 
  | 150 +--
 
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckDmaProtection.c
  |   4 +-
 
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckTcgTrustedBoot.c
 |   2 +-
 
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeTestPointCheckLib.c
   |   2 +-
 11 files changed, 264 insertions(+), 264 deletions(-)

diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c 
b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
index e967031a3b..2f2c96f907 100644
--- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
+++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
@@ -27,9 +27,9 @@ typedef struct {
 // Define Union of IO APIC & Local APIC structure;
 //
 typedef union {
-  EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC_STRUCTURE   AcpiLocalApic;
-  EFI_ACPI_6_3_IO_APIC_STRUCTUREAcpiIoApic;
-  EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC_STRUCTURE AcpiLocalx2Apic;
+  EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE   AcpiLocalApic;
+  EFI_ACPI_6_5_IO_APIC_STRUCTUREAcpiIoApic;
+  EFI_ACPI_6_5_PROCESSOR_LOCAL_X2APIC_STRUCTURE AcpiLocalx2Apic;
   struct {
 UINT8 Type;
 UINT8 Length;
@@ -38,8 +38,8 @@ typedef union {
 
 #pragma pack()
 
-extern EFI_ACPI_6_3_FIRMWARE_ACPI_CONTROL_STRUCTURE Facs;
-extern EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLEFadt;
+extern EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE Facs;
+extern EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLEFadt;
 extern EFI_ACPI_HIGH_PRECISION_EVENT_TIMER_TABLE_HEADER Hpet;
 extern EFI_ACPI_WSMT_TABLE Wsmt;
 
@@ -92,16 +92,16 @@ AppendCpuMapTableEntry (
   )
 {
   EFI_STATUSStatus;
-  EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC_STRUCTURE   *LocalApicPtr;
-  EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC_STRUCTURE *LocalX2ApicPtr;
+  EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE   *LocalApicPtr;
+  EFI_ACPI_6_5_PROCESSOR_LOCAL_X2APIC_STRUCTURE *LocalX2ApicPtr;
   UINT8 Type;
 
   Status = EFI_SUCCESS;
   Type = ((ACPI_APIC_STRUCTURE_PTR *)ApicPtr)->AcpiApicCommon.Type;
-  LocalApicPtr = (EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC_STRUCTURE 
*)(&((ACPI_APIC_STRUCTURE_PTR *)ApicPtr)->AcpiLocalApic);
-  LocalX2ApicPtr = (EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC_STRUCTURE 
*)(&((ACPI_APIC_STRUCTURE_PTR *)ApicPtr)->AcpiLocalx2Apic);
+  LocalApicPtr = (EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC_STRUCTURE 
*)(&((ACPI_APIC_STRUCTURE_PTR *)ApicPtr)->AcpiLocalApic);
+  LocalX2ApicPtr = (EFI_ACPI_6_5_PROCESSOR_LOCAL_X2APIC_STRUCTURE 
*)(&((ACPI_APIC_STRUCTURE_PTR *)ApicPtr)->AcpiLocalx2Apic);
 
-  if(Type == EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC) {
+  if(Type == EFI_ACPI_6_5_PROCESSOR_LOCAL_APIC) {
 if(!mX2ApicEnabled) {
   LocalApicPtr->Flags= 
(UINT8)CpuApicIdOrderTable[LocalApicCounter].Flags;
   LocalApicPtr->ApicId   = 
(UINT8)CpuApicIdOrderTable[LocalApicCounter].ApicId;
@@ -112,7 +112,7 @@ AppendCpuMapTableEntry (
   LocalApicPtr->AcpiProcessorUid = (UINT8)0xFF;
   Status = EFI_UNSUPPORTED;
 }
-  } else if(Type == EFI_ACPI_6_3_PROCESSOR_LOCAL_X2APIC) {
+  } else if(Type == EFI_ACPI_6_5_PROCESSOR_LOCAL_X2APIC) {
 if(mX2ApicEnabled) {
   LocalX2ApicPtr->Flags= 
(UINT8)CpuApicIdOrderTable[LocalApicCounter].Flags;
   LocalX2ApicPtr->X2ApicId = 
CpuApicIdOrderTable[LocalApicCounter].ApicId;
@@ -215,17 +215,17 @@ typedef struct {
 } STRUCTURE_HEADER;
 
 STRUCTURE_HEADER mMadtStructureTable[] = {
-  {EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC,  sizeof 
(EFI_ACPI_6_3_PROCESSOR_LOCAL_APIC_STRUCTURE)},
-  {EFI_ACPI_6_3_IO_APIC,   sizeof 
(EFI_ACPI_6_3_IO_APIC_STRUCTURE)},
-  {EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE, sizeof 
(EFI_ACPI_6_3_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE)},
-  {EFI_ACPI_6_3_NON_MASKABLE_INTERRUPT_SOURCE, sizeof 
(EFI_ACPI_6_3_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE)},
-  {EFI_ACPI_6_3_LOCAL_APIC_NMI, 

Re: [edk2-devel] [PATCH v6] MinPlatformPkg: Update HWSignature filed in FACS

2023-05-10 Thread Ni, Ray
Vincent,
ACPI spec contains following:
  The XSDT provides identical functionality to the RSDT but accommodates 
physical addresses of DESCRIPTION
  HEADERs that are larger than 32 bits. Notice that both the XSDT and the RSDT 
can be pointed to by the RSDP
  structure. An ACPI-compatible OS must use the XSDT if present.

Which means, XSDT is used over RSDT when it exists.
But your code measures both XSDT and RSDT. It's not right.

This change is not a simple change. I suggest you review the ACPI spec in 
detail and close the opens within your team
before sending another version of patches.

Thanks,
Ray

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of VincentX Ke
> Sent: Wednesday, May 10, 2023 5:58 PM
> To: devel@edk2.groups.io
> Cc: Ke, VincentX ; Chiu, Chasel
> ; Desimone, Nathaniel L
> ; Oram, Isaac W ;
> Gao, Liming ; Dong, Eric ;
> Sinha, Ankit 
> Subject: [edk2-devel] [PATCH v6] MinPlatformPkg: Update HWSignature filed in
> FACS
> 
> From: VincentX Ke 
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4428
> 
> Calculating CRC based on each ACPI table.
> Update HWSignature filed in FACS based on CRC while ACPI table changed.
> 
> Change-Id: Ic0ca66ff10cda0fbcd0683020fab1bc9aea9b78c
> Signed-off-by: VincentX Ke 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Isaac Oram 
> Cc: Liming Gao 
> Cc: Eric Dong 
> Cc: Ankit Sinha
> Signed-off-by: VincentX Ke 
> ---
>  Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c   | 271
> +++-
>  Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.inf |   1 +
>  2 files changed, 209 insertions(+), 63 deletions(-)
> 
> diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> index e967031a3b..bb0f4a1f04 100644
> --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c
> @@ -1191,98 +1191,243 @@ PlatformUpdateTables (
>  }
> 
> 
> 
>  /**
> 
> -  This function calculates RCR based on PCI Device ID and Vendor ID from the
> devices
> 
> -  available on the platform.
> 
> -  It also includes other instances of BIOS change to calculate CRC and 
> provides
> as
> 
> -  HWSignature filed in FADT table.
> 
> +  This function calculates CRC based on each offset in the ACPI table.
> 
> +
> 
> +  @param[in] Table  The ACPI table required to calculate CRC.
> 
> +
> 
> +  @retval CRC   A pointer to allocate UINT32 that
> 
> +contains the CRC32 data.
> 
> +**/
> 
> +UINT32
> 
> +AcpiTableCrcCalculator (
> 
> +  IN  EFI_ACPI_COMMON_HEADER  *Table
> 
> +  )
> 
> +{
> 
> +  EFI_STATUS  Status;
> 
> +  UINT32  CRC;
> 
> +
> 
> +  Status = EFI_SUCCESS;
> 
> +  CRC= 0;
> 
> +
> 
> +  //
> 
> +  // Calculate CRC value.
> 
> +  //
> 
> +  if (Table->Signature ==
> EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE) {
> 
> +//
> 
> +// Zero HardwareSignature field before Calculating FACS CRC
> 
> +//
> 
> +((EFI_ACPI_6_5_FIRMWARE_ACPI_CONTROL_STRUCTURE *)Table)-
> >HardwareSignature = 0;
> 
> +  }
> 
> +
> 
> +  Status = gBS->CalculateCrc32 ((UINT8 *)Table, (UINTN)Table->Length, );
> 
> +  return CRC;
> 
> +}
> 
> +
> 
> +/**
> 
> +  This function count ACPI tables in RSDT/XSDT and return the result.
> 
> +
> 
> +  @param[in] SdtACPI XSDT/RSDT.
> 
> +  @param[in] TablePointerSize   Size of table pointer:
> 
> +4(RSDT) or 8(XSDT).
> 
> +
> 
> +  @retval TableCountThe total number of ACPI tables in
> 
> +RSDT or XSDT.
> 
> +**/
> 
> +UINTN
> 
> +CountTableInSDT (
> 
> +  IN  EFI_ACPI_DESCRIPTION_HEADER  *Sdt,
> 
> +  IN  UINTNTablePointerSize
> 
> +  )
> 
> +{
> 
> +  UINTN   Index;
> 
> +  UINTN   TableCount;
> 
> +  UINTN   EntryCount;
> 
> +  UINT64  EntryPtr;
> 
> +  UINTN   BasePtr;
> 
> +  EFI_ACPI_COMMON_HEADER  *Table;
> 
> +
> 
> +  EntryCount = (Sdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) /
> TablePointerSize;
> 
> +  BasePtr= (UINTN)(Sdt + 1);
> 
> +
> 
> +  for (Index = 0, TableCount = 0; Index < EntryCount; Index++) {
> 
> +EntryPtr = 0;
> 
> +Table= NULL;
> 
> +CopyMem (, (VOID *)(BasePtr + Index * TablePointerSize),
> TablePointerSize);
> 
> +Table = (EFI_ACPI_COMMON_HEADER *)((UINTN)(EntryPtr));
> 
> +if (Table) {
> 
> +  TableCount++;
> 
> +}
> 
> +
> 
> +if (Table->Signature ==
> EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {
> 
> +  CopyMem ((VOID *), (VOID *)Table, sizeof
> (EFI_ACPI_6_5_FIXED_ACPI_DESCRIPTION_TABLE));
> 
> +  if (Fadt.FirmwareCtrl || Fadt.XFirmwareCtrl) {
> 
> +TableCount++;
> 
> +  }
> 
> +
> 
> +  if (Fadt.Dsdt || Fadt.XDsdt) {
> 
> +TableCount++;
> 
> +  }
> 
> +}
> 
> +  }
> 
> +
> 
> +  return 

Re: [edk2-devel] Side effects of enabling PML5 in EFI

2023-05-10 Thread Ni, Ray


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Pedro
> Falcato
> Sent: Thursday, May 11, 2023 12:39 AM
> To: Ni, Ray 
> Cc: Gerd Hoffmann ; devel@edk2.groups.io; Andrew Fish
> ; Kinney, Michael D ; Ard
> Biesheuvel 
> Subject: Re: [edk2-devel] Side effects of enabling PML5 in EFI
> 
> On Wed, May 10, 2023 at 10:34 AM Ni, Ray  wrote:
> >
> > Firmware chooses to use 5-level paging when the platform using this firmware
> claims to boot 5-level paging OS only.
> >
> > Usually, firmware uses 4-level paging to keep maximum OS compability.
> 
> Hi Ray,
> 
> So, what happens if I don't enable LA57, have a gazillion TB of memory
> (such that I go over the 128TB 47-bit AS limit). Will EFI never try to
> access memory up there and page fault?

No. UEFI firmware on x86 doesn't try to create non-1:1 mapping page table to let
firmware code access these high physical addresses.

> 
> What happens to the OS/bootloader? If it asks for memory up there (for
> KASLR, etc)? Does the memory map pre-reserve those upper regions of
> memory that are not accessible using 4-level paging?

That depends on how the EFI_HOB_CPU is produced from the firmware code.
The UEFI memory map data is from GCD database in DxeCore.
GCD database is built based on the physical address size value in EFI_HOB_CPU.

> 
> I really fail to see the advantages of PML5 support in EFI fw at the
> moment, particularly as you can simply choose to start all your
> allocations lower down the memory map (where you can indeed access
> things), reserve the upper, inaccessible bits, and things Should Work?
> Unless you're keeping some MMIO ranges up there, in which case, the
> solution is probably hard.

I agree that 5-level paging is only needed when very high MMIO is needed for
silicon init.

> 
> --
> Pedro
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104662): https://edk2.groups.io/g/devel/message/104662
Mute This Topic: https://groups.io/mt/98788948/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 1/1] SecurityPkg: Add missing break in Tpm2TestParms

2023-05-10 Thread Yao, Jiewen
Thank you! Merged https://github.com/tianocore/edk2/pull/4386

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of
> gaoliming via groups.io
> Sent: Thursday, May 11, 2023 9:46 AM
> To: devel@edk2.groups.io; Yao, Jiewen ; 'Rebecca
> Cran' ; Wang, Jian J ; Kinney,
> Michael D 
> Subject: 回复: [edk2-devel] [PATCH 1/1] SecurityPkg: Add missing break in
> Tpm2TestParms
> 
> Jiewen:
>   This is a bug fix. It can be merged for 202305.
> 
> Thanks
> Liming> -邮件原件-
> > 发件人: devel@edk2.groups.io  代表 Yao, Jiewen
> > 发送时间: 2023年5月10日 8:13
> > 收件人: Rebecca Cran ; devel@edk2.groups.io;
> Wang,
> > Jian J ; Kinney, Michael D
> > ; Gao, Liming 
> > 主题: Re: [edk2-devel] [PATCH 1/1] SecurityPkg: Add missing break in
> > Tpm2TestParms
> >
> > Reviewed-by: Jiewen Yao 
> >
> > Can we add this in 202305 stable tag?
> >
> >
> > > -Original Message-
> > > From: Rebecca Cran 
> > > Sent: Wednesday, May 10, 2023 12:45 AM
> > > To: devel@edk2.groups.io; Yao, Jiewen ; Wang,
> > > Jian J ; Kinney, Michael D
> > > ; Gao, Liming
> 
> > > Cc: Rebecca Cran 
> > > Subject: [PATCH 1/1] SecurityPkg: Add missing break in Tpm2TestParms
> > >
> > > Add missing break in Tpm2TestParms.
> > >
> > > Reported in https://github.com/tianocore/edk2/issues/4073
> > >
> > > Signed-off-by: Rebecca Cran 
> > > ---
> > >  SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
> > > b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
> > > index 9db301ec9a90..f0e6019a47be 100644
> > > --- a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
> > > +++ b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
> > > @@ -743,6 +743,7 @@ Tpm2TestParms (
> > >return EFI_INVALID_PARAMETER;
> > >}
> > >
> > > +  break;
> > >  case TPM_ALG_SYMCIPHER:
> > >WriteUnaligned16 ((UINT16 *)Buffer, SwapBytes16 (Parameters-
> > > >parameters.symDetail.algorithm));
> > >Buffer += sizeof (UINT16);
> > > --
> > > 2.39.2
> >
> >
> >
> >
> >
> 
> 
> 
> 
> 
> 
> 



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




回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure

2023-05-10 Thread gaoliming via groups.io
I just add push label.

Thanks
Liming
> -邮件原件-
> 发件人: Guo, Gua 
> 发送时间: 2023年5月11日 10:13
> 收件人: devel@edk2.groups.io; Gao, Liming ;
> Kinney, Michael D ; 'Michael Kubacki'
> 
> 抄送: 'Sean Brogan' 
> 主题: RE: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute
> files cause "cmd too long" failure
> 
> Hi Liming
> 
> I've added both review-by now.
> One from Mike
> One from Michael.
> 
> Thanks,
> Gua
> 
> 
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of gaoliming
> via groups.io
> Sent: Thursday, May 11, 2023 10:07 AM
> To: devel@edk2.groups.io; Guo, Gua ; Kinney, Michael D
> ; 'Michael Kubacki'
> 
> Cc: 'Sean Brogan' 
> Subject: 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many
> execute files cause "cmd too long" failure
> 
> Gua:
>   Seemly, this PR 4357 doesn't match the reviewed patch. I find the commit
> message is different. And, you also need to add reviewed-by from Michael.
> 
> Thanks
> Liming
> > -邮件原件-
> > 发件人: devel@edk2.groups.io  代表 Guo, Gua
> > 发送时间: 2023年5月11日 10:00
> > 收件人: Kinney, Michael D ;
> > devel@edk2.groups.io; Gao, Liming ; 'Michael
> > Kubacki' 
> > 抄送: 'Sean Brogan' 
> > 主题: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute
> > files cause "cmd too long" failure
> >
> > @Gao, Liming
> >
> > Thank for the reply.
> > It's PR for the patch.
> > https://github.com/tianocore/edk2/pull/4357
> >
> >
> > Thanks
> > Gua
> > -Original Message-
> > From: Kinney, Michael D 
> > Sent: Thursday, May 11, 2023 9:53 AM
> > To: devel@edk2.groups.io; Gao, Liming ; Guo,
> > Gua ; 'Michael Kubacki'
> > 
> > Cc: 'Sean Brogan' ; Kinney, Michael D
> > 
> > Subject: RE: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many
> execute
> > files cause "cmd too long" failure
> >
> > Hi Liming,
> >
> > I agree it is bug fix.  Can you do review and if pass help with push label?
> >
> > Thanks,
> >
> > Mike
> >
> > > -Original Message-
> > > From: devel@edk2.groups.io  On Behalf Of
> > > gaoliming via groups.io
> > > Sent: Wednesday, May 10, 2023 6:43 PM
> > > To: devel@edk2.groups.io; Guo, Gua ; 'Michael
> > Kubacki'
> > > ; Kinney, Michael D
> > > 
> > > Cc: 'Sean Brogan' 
> > > Subject: 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many
> > > execute files cause "cmd too long" failure
> > >
> > > Gua:
> > >
> > > This is like a bug fix. I am OK to merge it for this stable tag.
> > >
> > > Thanks
> > > Liming
> > > > -邮件原件-
> > > > 发件人: devel@edk2.groups.io  代表 Guo,
> Gua
> > > > 发送时间: 2023年5月11日 6:01
> > > > 收件人: Michael Kubacki ;
> > > > devel@edk2.groups.io; Kinney, Michael D
> 
> > > > 抄送: Sean Brogan 
> > > > 主题: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many
> > > > execute files cause "cmd too long" failure
> > > >
> > > > @Kinney, Michael D
> > > >
> > > > Could we merge the bug patch before code freeze ? The patch can help
> > > unlock
> > > > command too long issue on Windows command prompt.
> > > >
> > > > Thanks,
> > > > Gua
> > > >
> > > > -Original Message-
> > > > From: Michael Kubacki 
> > > > Sent: Thursday, May 11, 2023 5:41 AM
> > > > To: devel@edk2.groups.io; Guo, Gua 
> > > > Cc: Kinney, Michael D ; Sean Brogan
> > > > 
> > > > Subject: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many
> > > execute
> > > > files cause "cmd too long" failure
> > > >
> > > > Reviewed-by: Michael Kubacki 
> > > >
> > > > On 5/10/2023 1:14 AM, Guo, Gua wrote:
> > > > > From: Gua Guo 
> > > > >
> > > > > Windows command prompt have 8191 characters limitation, enhance
> it
> > > > > to make command too long can be resloved.
> > > > >
> > > > > Provide an example, if have too many cov files, it causes to run
> > > > > single command over the 8191 characters limitation.
> > > > >> OpenCppCoverage
> > > > >>   --export_type binary:coverage.cov
> > > > >>   --working_dir={workspace}Build
> > > > >>   --input_coverage=AAA.cov
> > > > >>   ...
> > > > >>   --input_coverage=NNN.cov
> > > > >
> > > > > The solution is passing many coverage files in single command line
> > > > > to breaking it up into many command lines with one coverage file
> > > > > per command line in order to prevent single line is over to 8191
> > characters.
> > > > >
> > > > > - Command Line 1
> > > > >> OpenCppCoverage
> > > > >>   --export_type binary:coverage.cov
> > > > >>   --working_dir={workspace}Build
> > > > >>   --input_coverage=AAA.cov
> > > > >>   --input_coverage=coverage.cov
> > > > > ...
> > > > >
> > > > > - Command Line N
> > > > >> OpenCppCoverage
> > > > >>   --export_type binary:coverage.cov
> > > > >>   --working_dir={workspace}Build
> > > > >>   --input_coverage=NNN.cov
> > > > >>   --input_coverage=coverage.cov
> > > > >
> > > > > Cc: Michael D Kinney 
> > > > > Cc: Sean Brogan 
> > > > > Cc: Michael Kubacki 
> > > > > Signed-off-by: Gua Guo 
> > > > > ---
> > > > >   .../HostBasedUnitTestRunner.py| 46
> > > > +--
> > > > >   1 file changed, 41 

回复: 回复: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0 before walking through next FV

2023-05-10 Thread gaoliming via groups.io
Wendy:
  I understand the problem now. Your fix is correct. Reviewed-by: Liming Gao 


  This is a bug fix. I suggest to merge it for this stable tag 202305. 

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Wendy Liao
> via groups.io
> 发送时间: 2023年5月11日 10:23
> 收件人: gaoliming ; devel@edk2.groups.io
> 抄送: 'Leon Chen' ; 'Tim Lewis'
> 
> 主题: Re: 回复: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set
> AprioriCount=0 before walking through next FV
> 
> Hi gaoliming,
> 
> DiscoverPeimsAndOrderWithApriori () will not reset Private->AprioriCount
> to Zero when CoreFileHandle->ScanFv = TRUE.
> DiscoverPeimsAndOrderWithApriori () {
> ...
>if (CoreFileHandle->ScanFv) {
>  Private->CurrentFvFileHandles = CoreFileHandle->FvFileHandles;
>  return;
>}
> ...
> }
> After go through all FV and the last FV has one or more Apriori Peim,
> Private->AprioriCount will not be reset to 0 anymore.
> 
> Scan loop 1
> [FV1]
> Before DiscoverPeimsAndOrderWithApriori () : Private->AprioriCount = 0,
> CoreFileHandle->ScanFv = FALSE
> After DiscoverPeimsAndOrderWithApriori (): Private->AprioriCount =
> 2, CoreFileHandle->ScanFv = TRUE
> [FV2]
> Before DiscoverPeimsAndOrderWithApriori () : Private->AprioriCount = 2,
> CoreFileHandle->ScanFv = FALSE
> After DiscoverPeimsAndOrderWithApriori (): Private->AprioriCount =
> 0, CoreFileHandle->ScanFv = TRUE
> ...
> [FVn]
> Before DiscoverPeimsAndOrderWithApriori () : Private->AprioriCount = 0,
> CoreFileHandle->ScanFv = FALSE
> After DiscoverPeimsAndOrderWithApriori (): Private->AprioriCount =
> 1, CoreFileHandle->ScanFv = TRUE
> 
> Scan loop 2
> [FV1]
> Before DiscoverPeimsAndOrderWithApriori () : Private->AprioriCount = 1,
> CoreFileHandle->ScanFv = TRUE
> After DiscoverPeimsAndOrderWithApriori (): Private->AprioriCount =
> 1, CoreFileHandle->ScanFv = TRUE
> 
> Best Regards,
> 
> Wendy Liao
> Insyde Software Corp.
> Phone: +886-2-6608-3688 Ext.8731
> 
> gaoliming 於 2023/05/11 上午 09:32 寫道:
> > Wendy:
> >DiscoverPeimsAndOrderWithApriori () has the logic to reset
> Private->AprioriCount as zero.
> >It will set the real AprioriCount for each FV when this FV first scans,
> then dispatch the peims in the apriori list.
> >So, I don't think there is the issue here. Do you find the real
> functionality issue?
> >
> > Thanks
> > Liming
> >> -邮件原件-
> >> 发件人: devel@edk2.groups.io  代表 Wendy
> Liao
> >> via groups.io
> >> 发送时间: 2023年5月10日 14:23
> >> 收件人: devel@edk2.groups.io
> >> 抄送: Leon Chen ; Tim Lewis
> >> 
> >> 主题: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0
> >> before walking through next FV
> >>
> >>
> >> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4438
> >>
> >> The main dispatch loop in PeiDispatcher() goes through each FV and
> >> calls DiscoverPeimsAndOrderWithApriori() to search Apriori file to
> >> reorder all PEIMs then do the PEIM dispatched.
> >>
> >> DiscoverPeimsAndOrderWithApriori() calculates Apriori file count for
> >> every FV once and set Private->AprioriCount, but Private->AprioriCount
> >> doesn't be set to 0 before dispatch loop walking through the next FV.
> >>
> >> It causes the peim which sort on less than Private->AprioriCount and
> >> depex is not satisfied would be dispatched when dispatch loop go through
> >> to a scaned FV, even the peim is not set in APRIORI file.
> >>
> >> Cc: Leon Chen 
> >> Cc: Tim Lewis 
> >> Reported-by: Esther Lee 
> >> Signed-off-by: Wendy Liao 
> >>
> >> ---
> >>MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 1 +
> >>1 file changed, 1 insertion(+)
> >>
> >> diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
> >> b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
> >> index d8284f9f4f..5f32ebb560 100644
> >> --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
> >> +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
> >> @@ -1630,6 +1630,7 @@ PeiDispatcher (
> >>  Private->CurrentFileHandle= NULL;
> >>  Private->CurrentPeimCount = 0;
> >>  Private->CurrentFvFileHandles = NULL;
> >> +  Private->AprioriCount = 0;
> >>}
> >>
> >>//
> >> --
> >> 2.29.2.windows.2
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> 
> 
> 
> 





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




Re: [edk2-devel] [PATCH v9 0/5] Trace Hub debug library support

2023-05-10 Thread Chiu, Chasel


Hello Andrew Fish,

Sorry that we seem to miss you from previous patch CC list mistakenly, please 
help to review this series about new submodule we are adding and let us know if 
any feedbacks.

Thanks,
Chasel


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Guo, Gua
> Sent: Wednesday, May 10, 2023 4:39 PM
> To: devel@edk2.groups.io
> Cc: Guo, Gua 
> Subject: [edk2-devel] [PATCH v9 0/5] Trace Hub debug library support
> 
> From: Gua Guo 
> 
> V9: Add more maintainers into CC list
> - https://github.com/tianocore/edk2/pull/3901
>   F: *
>   M: Andrew Fish  [ajfish]
>   M: Leif Lindholm  [leiflindholm]
>   M: Michael D Kinney  [mdkinney]
> 
>   MdeModulePkg
>   M: Jian J Wang  [jwang36]
>   M: Liming Gao  [lgao4]
> 
>   .pytool/
>   M: Sean Brogan  [spbrogan]
>   M: Michael Kubacki  [makubacki]
>   R: Michael D Kinney  [mdkinney]
>   R: Liming Gao  [lgao4]
> 
>   MdePkg/
>   M: Michael D Kinney  [mdkinney]
>   M: Liming Gao  [lgao4]
>   R: Zhiguang Liu  [LiuZhiguang001]
> 
> 
> V8: Add MdeModulePkg maintainers into CC list
> 
> V7: Miss one patch on V6
> 
> V6:
> - https://github.com/tianocore/edk2/pull/3901
>   Split submodule into new patch
>   Fix formatting issue
>   Add Review-by message
>   Offline check with Victor to use my sign-off name.
> 
> V5: if no other open, it will be final change
> - https://github.com/tianocore/edk2/pull/3901
>   Fix random exception when long run catalog debug message
> 
> V4
> - https://github.com/tianocore/edk2/pull/3901 - Done
>   Enhance SwapBytesGuid to use CopyGuid instead of CopyMem, to make
> implement code more simple.
> 
> V3
> - https://github.com/tianocore/edk2/pull/3901 - Done
>   - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why
> MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
> Solution: Remove this macro, use Library Constructor to allocate it 
> dynamiclly.
>   - Open:
> MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c:
> SwapBytesGuid () algorithm wrong.
> Solution: Follow correct algorithm to implement it.
> VOID
> EFIAPI
> SwapBytesGuid (
>   IN  GUID  *Guid,<--- In PreMem, guid is global data 
> so region is
> readonly, add output data to support it.
>   OUT GUID  *ConvertedGuid
> );
> 
>   - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D
> Solution: use *_*_*_CC_FLAGS  = -DMIPI_SYST_STATIC to unified both.
> 
> 
> V2
> - https://github.com/tianocore/edk2/pull/3901
>   - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why
> MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
>   - Open:
> MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c:
> SwapBytesGuid () algorithm wrong.
>   - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D
> 
> V1
> Previous PR:
> - https://github.com/tianocore/edk2/pull/3613
>   - TraceHubDebugLib without submodule - Reject
> 
> - https://github.com/tianocore/edk2/pull/3793
>   - TraceHubDebugLib with submodule and without seperate into MipiSysTLib
> and TraceHubDebugLib - Reject
> 
> Gua Guo (5):
>   MdePkg: Add mipisyst submodule
>   MdePkg: Add MipiSysTLib library
>   MdePkg: Add NULL library of TraceHubDebugSysTLib
>   MdeModulePkg: Add TraceHubDebugSysTLib library
>   Maintainers.txt: Update reviewers and maintainers for
> TraceHubDebugLib.
> 
>  .gitmodules   |   3 +
>  .pytool/CISettings.py |   2 +
>  Maintainers.txt   |  18 +
>  .../Include/Guid/TraceHubDebugInfoHob.h   |  24 +
>  .../BaseTraceHubDebugSysTLib.c| 245 ++
>  .../BaseTraceHubDebugSysTLib.inf  |  44 +
>  .../DxeSmmTraceHubDebugSysTLib.c  | 263 ++
>  .../DxeSmmTraceHubDebugSysTLib.inf|  51 ++
>  .../InternalTraceHubApi.c |  74 ++
>  .../InternalTraceHubApi.h |  37 +
>  .../InternalTraceHubApiCommon.c   | 200 +
>  .../InternalTraceHubApiCommon.h   | 119 +++
>  .../PeiTraceHubDebugSysTLib.c | 282 +++
>  .../PeiTraceHubDebugSysTLib.inf   |  50 ++
>  .../Library/TraceHubDebugSysTLib/Readme.md|  26 +
>  MdeModulePkg/MdeModulePkg.dec |  21 +
>  MdeModulePkg/MdeModulePkg.dsc |   3 +
>  MdeModulePkg/MdeModulePkg.uni |  18 +
>  MdePkg/Include/Library/MipiSysTLib.h  |  66 ++
>  MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 ++
>  MdePkg/Library/MipiSysTLib/GenMipiSystH.py| 132 +++
>  MdePkg/Library/MipiSysTLib/MipiSysTLib.c  | 123 +++
>  MdePkg/Library/MipiSysTLib/MipiSysTLib.inf|  52 ++
>  MdePkg/Library/MipiSysTLib/Platform.c | 164 
>  MdePkg/Library/MipiSysTLib/Platform.h | 138 +++
>  MdePkg/Library/MipiSysTLib/Readme.md  |  25 +
>  MdePkg/Library/MipiSysTLib/mipi_syst.h| 789 ++
>  MdePkg/Library/MipiSysTLib/mipisyst   |   1 +
>  

Re: 回复: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0 before walking through next FV

2023-05-10 Thread Wendy Liao via groups.io

Hi gaoliming,

DiscoverPeimsAndOrderWithApriori () will not reset Private->AprioriCount 
to Zero when CoreFileHandle->ScanFv = TRUE.

DiscoverPeimsAndOrderWithApriori () {
...
  if (CoreFileHandle->ScanFv) {
    Private->CurrentFvFileHandles = CoreFileHandle->FvFileHandles;
    return;
  }
...
}
After go through all FV and the last FV has one or more Apriori Peim, 
Private->AprioriCount will not be reset to 0 anymore.


Scan loop 1
[FV1]
Before DiscoverPeimsAndOrderWithApriori () : Private->AprioriCount = 0, 
CoreFileHandle->ScanFv = FALSE
After DiscoverPeimsAndOrderWithApriori ()    : Private->AprioriCount = 
2, CoreFileHandle->ScanFv = TRUE

[FV2]
Before DiscoverPeimsAndOrderWithApriori () : Private->AprioriCount = 2, 
CoreFileHandle->ScanFv = FALSE
After DiscoverPeimsAndOrderWithApriori ()    : Private->AprioriCount = 
0, CoreFileHandle->ScanFv = TRUE

...
[FVn]
Before DiscoverPeimsAndOrderWithApriori () : Private->AprioriCount = 0, 
CoreFileHandle->ScanFv = FALSE
After DiscoverPeimsAndOrderWithApriori ()    : Private->AprioriCount = 
1, CoreFileHandle->ScanFv = TRUE


Scan loop 2
[FV1]
Before DiscoverPeimsAndOrderWithApriori () : Private->AprioriCount = 1, 
CoreFileHandle->ScanFv = TRUE
After DiscoverPeimsAndOrderWithApriori ()    : Private->AprioriCount = 
1, CoreFileHandle->ScanFv = TRUE


Best Regards,

Wendy Liao
Insyde Software Corp.
Phone: +886-2-6608-3688 Ext.8731

gaoliming 於 2023/05/11 上午 09:32 寫道:

Wendy:
   DiscoverPeimsAndOrderWithApriori () has the logic to reset 
Private->AprioriCount as zero.
   It will set the real AprioriCount for each FV when this FV first scans, then 
dispatch the peims in the apriori list.
   So, I don't think there is the issue here. Do you find the real 
functionality issue?

Thanks
Liming

-邮件原件-
发件人: devel@edk2.groups.io  代表 Wendy Liao
via groups.io
发送时间: 2023年5月10日 14:23
收件人: devel@edk2.groups.io
抄送: Leon Chen ; Tim Lewis

主题: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0
before walking through next FV


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

The main dispatch loop in PeiDispatcher() goes through each FV and
calls DiscoverPeimsAndOrderWithApriori() to search Apriori file to
reorder all PEIMs then do the PEIM dispatched.

DiscoverPeimsAndOrderWithApriori() calculates Apriori file count for
every FV once and set Private->AprioriCount, but Private->AprioriCount
doesn't be set to 0 before dispatch loop walking through the next FV.

It causes the peim which sort on less than Private->AprioriCount and
depex is not satisfied would be dispatched when dispatch loop go through
to a scaned FV, even the peim is not set in APRIORI file.

Cc: Leon Chen 
Cc: Tim Lewis 
Reported-by: Esther Lee 
Signed-off-by: Wendy Liao 

---
   MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 1 +
   1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
index d8284f9f4f..5f32ebb560 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -1630,6 +1630,7 @@ PeiDispatcher (
 Private->CurrentFileHandle= NULL;
 Private->CurrentPeimCount = 0;
 Private->CurrentFvFileHandles = NULL;
+  Private->AprioriCount = 0;
   }

   //
--
2.29.2.windows.2












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




Re: [edk2-devel] [PATCH v9 0/5] Trace Hub debug library support

2023-05-10 Thread Guo, Gua
@Gao, Liming and @Michael Kubacki

Also add rb info into commit message and update the PR.
  Acked-by: Liming Gao 
  Reviewed-by:: Michael Kubacki 

PR: https://github.com/tianocore/edk2/pull/3901/

Thanks,
Gua



-Original Message-
From: devel@edk2.groups.io  On Behalf Of gaoliming via 
groups.io
Sent: Thursday, May 11, 2023 10:01 AM
To: devel@edk2.groups.io; Guo, Gua 
Subject: 回复: [edk2-devel] [PATCH v9 0/5] Trace Hub debug library support

Acked-by: Liming Gao 

> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Guo, Gua
> 发送时间: 2023年5月11日 7:39
> 收件人: devel@edk2.groups.io
> 抄送: gua@intel.com
> 主题: [edk2-devel] [PATCH v9 0/5] Trace Hub debug library support
> 
> From: Gua Guo 
> 
> V9: Add more maintainers into CC list
> - https://github.com/tianocore/edk2/pull/3901
>   F: *
>   M: Andrew Fish  [ajfish]
>   M: Leif Lindholm  [leiflindholm]
>   M: Michael D Kinney  [mdkinney]
> 
>   MdeModulePkg
>   M: Jian J Wang  [jwang36]
>   M: Liming Gao  [lgao4]
> 
>   .pytool/
>   M: Sean Brogan  [spbrogan]
>   M: Michael Kubacki  [makubacki]
>   R: Michael D Kinney  [mdkinney]
>   R: Liming Gao  [lgao4]
> 
>   MdePkg/
>   M: Michael D Kinney  [mdkinney]
>   M: Liming Gao  [lgao4]
>   R: Zhiguang Liu  [LiuZhiguang001]
> 
> 
> V8: Add MdeModulePkg maintainers into CC list
> 
> V7: Miss one patch on V6
> 
> V6:
> - https://github.com/tianocore/edk2/pull/3901
>   Split submodule into new patch
>   Fix formatting issue
>   Add Review-by message
>   Offline check with Victor to use my sign-off name.
> 
> V5: if no other open, it will be final change
> - https://github.com/tianocore/edk2/pull/3901
>   Fix random exception when long run catalog debug message
> 
> V4
> - https://github.com/tianocore/edk2/pull/3901 - Done
>   Enhance SwapBytesGuid to use CopyGuid instead of CopyMem, to make
> implement code more simple.
> 
> V3
> - https://github.com/tianocore/edk2/pull/3901 - Done
>   - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why
> MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
> Solution: Remove this macro, use Library Constructor to allocate it
> dynamiclly.
>   - Open:
> MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommo
> n.c: SwapBytesGuid () algorithm wrong.
> Solution: Follow correct algorithm to implement it.
> VOID
> EFIAPI
> SwapBytesGuid (
>   IN  GUID  *Guid,<--- In PreMem, guid is global
> data so region is readonly, add output data to support it.
>   OUT GUID  *ConvertedGuid
> );
> 
>   - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D
> Solution: use *_*_*_CC_FLAGS  = -DMIPI_SYST_STATIC to unified both.
> 
> 
> V2
> - https://github.com/tianocore/edk2/pull/3901
>   - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why
> MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
>   - Open:
> MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommo
> n.c: SwapBytesGuid () algorithm wrong.
>   - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D
> 
> V1
> Previous PR:
> - https://github.com/tianocore/edk2/pull/3613
>   - TraceHubDebugLib without submodule - Reject
> 
> - https://github.com/tianocore/edk2/pull/3793
>   - TraceHubDebugLib with submodule and without seperate into
> MipiSysTLib and TraceHubDebugLib - Reject
> 
> Gua Guo (5):
>   MdePkg: Add mipisyst submodule
>   MdePkg: Add MipiSysTLib library
>   MdePkg: Add NULL library of TraceHubDebugSysTLib
>   MdeModulePkg: Add TraceHubDebugSysTLib library
>   Maintainers.txt: Update reviewers and maintainers for
> TraceHubDebugLib.
> 
>  .gitmodules   |   3 +
>  .pytool/CISettings.py |   2 +
>  Maintainers.txt   |  18 +
>  .../Include/Guid/TraceHubDebugInfoHob.h   |  24 +
>  .../BaseTraceHubDebugSysTLib.c| 245 ++
>  .../BaseTraceHubDebugSysTLib.inf  |  44 +
>  .../DxeSmmTraceHubDebugSysTLib.c  | 263 ++
>  .../DxeSmmTraceHubDebugSysTLib.inf|  51 ++
>  .../InternalTraceHubApi.c |  74 ++
>  .../InternalTraceHubApi.h |  37 +
>  .../InternalTraceHubApiCommon.c   | 200 +
>  .../InternalTraceHubApiCommon.h   | 119 +++
>  .../PeiTraceHubDebugSysTLib.c | 282 +++
>  .../PeiTraceHubDebugSysTLib.inf   |  50 ++
>  .../Library/TraceHubDebugSysTLib/Readme.md|  26 +
>  MdeModulePkg/MdeModulePkg.dec |  21 +
>  MdeModulePkg/MdeModulePkg.dsc |   3 +
>  MdeModulePkg/MdeModulePkg.uni |  18 +
>  MdePkg/Include/Library/MipiSysTLib.h  |  66 ++
>  MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 ++
>  MdePkg/Library/MipiSysTLib/GenMipiSystH.py| 132 +++
>  MdePkg/Library/MipiSysTLib/MipiSysTLib.c  | 123 +++
>  MdePkg/Library/MipiSysTLib/MipiSysTLib.inf|  52 ++
>  MdePkg/Library/MipiSysTLib/Platform.c | 164 
>  

Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure

2023-05-10 Thread Guo, Gua
Hi Liming

I've added both review-by now.
One from Mike
One from Michael.

Thanks,
Gua


-Original Message-
From: devel@edk2.groups.io  On Behalf Of gaoliming via 
groups.io
Sent: Thursday, May 11, 2023 10:07 AM
To: devel@edk2.groups.io; Guo, Gua ; Kinney, Michael D 
; 'Michael Kubacki' 
Cc: 'Sean Brogan' 
Subject: 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute 
files cause "cmd too long" failure

Gua:
  Seemly, this PR 4357 doesn't match the reviewed patch. I find the commit 
message is different. And, you also need to add reviewed-by from Michael. 

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Guo, Gua
> 发送时间: 2023年5月11日 10:00
> 收件人: Kinney, Michael D ;
> devel@edk2.groups.io; Gao, Liming ; 'Michael
> Kubacki' 
> 抄送: 'Sean Brogan' 
> 主题: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute
> files cause "cmd too long" failure
> 
> @Gao, Liming
> 
> Thank for the reply.
> It's PR for the patch.
> https://github.com/tianocore/edk2/pull/4357
> 
> 
> Thanks
> Gua
> -Original Message-
> From: Kinney, Michael D 
> Sent: Thursday, May 11, 2023 9:53 AM
> To: devel@edk2.groups.io; Gao, Liming ; Guo,
> Gua ; 'Michael Kubacki'
> 
> Cc: 'Sean Brogan' ; Kinney, Michael D
> 
> Subject: RE: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute
> files cause "cmd too long" failure
> 
> Hi Liming,
> 
> I agree it is bug fix.  Can you do review and if pass help with push label?
> 
> Thanks,
> 
> Mike
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of
> > gaoliming via groups.io
> > Sent: Wednesday, May 10, 2023 6:43 PM
> > To: devel@edk2.groups.io; Guo, Gua ; 'Michael
> Kubacki'
> > ; Kinney, Michael D
> > 
> > Cc: 'Sean Brogan' 
> > Subject: 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many
> > execute files cause "cmd too long" failure
> >
> > Gua:
> >
> > This is like a bug fix. I am OK to merge it for this stable tag.
> >
> > Thanks
> > Liming
> > > -邮件原件-
> > > 发件人: devel@edk2.groups.io  代表 Guo, Gua
> > > 发送时间: 2023年5月11日 6:01
> > > 收件人: Michael Kubacki ;
> > > devel@edk2.groups.io; Kinney, Michael D 
> > > 抄送: Sean Brogan 
> > > 主题: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many
> > > execute files cause "cmd too long" failure
> > >
> > > @Kinney, Michael D
> > >
> > > Could we merge the bug patch before code freeze ? The patch can help
> > unlock
> > > command too long issue on Windows command prompt.
> > >
> > > Thanks,
> > > Gua
> > >
> > > -Original Message-
> > > From: Michael Kubacki 
> > > Sent: Thursday, May 11, 2023 5:41 AM
> > > To: devel@edk2.groups.io; Guo, Gua 
> > > Cc: Kinney, Michael D ; Sean Brogan
> > > 
> > > Subject: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many
> > execute
> > > files cause "cmd too long" failure
> > >
> > > Reviewed-by: Michael Kubacki 
> > >
> > > On 5/10/2023 1:14 AM, Guo, Gua wrote:
> > > > From: Gua Guo 
> > > >
> > > > Windows command prompt have 8191 characters limitation, enhance it
> > > > to make command too long can be resloved.
> > > >
> > > > Provide an example, if have too many cov files, it causes to run
> > > > single command over the 8191 characters limitation.
> > > >> OpenCppCoverage
> > > >>   --export_type binary:coverage.cov
> > > >>   --working_dir={workspace}Build
> > > >>   --input_coverage=AAA.cov
> > > >>   ...
> > > >>   --input_coverage=NNN.cov
> > > >
> > > > The solution is passing many coverage files in single command line
> > > > to breaking it up into many command lines with one coverage file
> > > > per command line in order to prevent single line is over to 8191
> characters.
> > > >
> > > > - Command Line 1
> > > >> OpenCppCoverage
> > > >>   --export_type binary:coverage.cov
> > > >>   --working_dir={workspace}Build
> > > >>   --input_coverage=AAA.cov
> > > >>   --input_coverage=coverage.cov
> > > > ...
> > > >
> > > > - Command Line N
> > > >> OpenCppCoverage
> > > >>   --export_type binary:coverage.cov
> > > >>   --working_dir={workspace}Build
> > > >>   --input_coverage=NNN.cov
> > > >>   --input_coverage=coverage.cov
> > > >
> > > > Cc: Michael D Kinney 
> > > > Cc: Sean Brogan 
> > > > Cc: Michael Kubacki 
> > > > Signed-off-by: Gua Guo 
> > > > ---
> > > >   .../HostBasedUnitTestRunner.py| 46
> > > +--
> > > >   1 file changed, 41 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git
> > > >
> > >
> >
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> > > >
> > >
> >
> b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> > > > index d993de9412..2e5c462cd2 100644
> > > > ---
> > > >
> > >
> >
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> > > > +++
> > > b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner
> > > > +++ .py
> > > > @@ -205,28 +205,64 @@ class
> > > HostBasedUnitTestRunner(IUefiBuildPlugin):
> > > >   testList = 

回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure

2023-05-10 Thread gaoliming via groups.io
Gua:
  Seemly, this PR 4357 doesn't match the reviewed patch. I find the commit 
message is different. And, you also need to add reviewed-by from Michael. 

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Guo, Gua
> 发送时间: 2023年5月11日 10:00
> 收件人: Kinney, Michael D ;
> devel@edk2.groups.io; Gao, Liming ; 'Michael
> Kubacki' 
> 抄送: 'Sean Brogan' 
> 主题: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute
> files cause "cmd too long" failure
> 
> @Gao, Liming
> 
> Thank for the reply.
> It's PR for the patch.
> https://github.com/tianocore/edk2/pull/4357
> 
> 
> Thanks
> Gua
> -Original Message-
> From: Kinney, Michael D 
> Sent: Thursday, May 11, 2023 9:53 AM
> To: devel@edk2.groups.io; Gao, Liming ; Guo,
> Gua ; 'Michael Kubacki'
> 
> Cc: 'Sean Brogan' ; Kinney, Michael D
> 
> Subject: RE: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute
> files cause "cmd too long" failure
> 
> Hi Liming,
> 
> I agree it is bug fix.  Can you do review and if pass help with push label?
> 
> Thanks,
> 
> Mike
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of
> > gaoliming via groups.io
> > Sent: Wednesday, May 10, 2023 6:43 PM
> > To: devel@edk2.groups.io; Guo, Gua ; 'Michael
> Kubacki'
> > ; Kinney, Michael D
> > 
> > Cc: 'Sean Brogan' 
> > Subject: 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many
> > execute files cause "cmd too long" failure
> >
> > Gua:
> >
> > This is like a bug fix. I am OK to merge it for this stable tag.
> >
> > Thanks
> > Liming
> > > -邮件原件-
> > > 发件人: devel@edk2.groups.io  代表 Guo, Gua
> > > 发送时间: 2023年5月11日 6:01
> > > 收件人: Michael Kubacki ;
> > > devel@edk2.groups.io; Kinney, Michael D 
> > > 抄送: Sean Brogan 
> > > 主题: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many
> > > execute files cause "cmd too long" failure
> > >
> > > @Kinney, Michael D
> > >
> > > Could we merge the bug patch before code freeze ? The patch can help
> > unlock
> > > command too long issue on Windows command prompt.
> > >
> > > Thanks,
> > > Gua
> > >
> > > -Original Message-
> > > From: Michael Kubacki 
> > > Sent: Thursday, May 11, 2023 5:41 AM
> > > To: devel@edk2.groups.io; Guo, Gua 
> > > Cc: Kinney, Michael D ; Sean Brogan
> > > 
> > > Subject: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many
> > execute
> > > files cause "cmd too long" failure
> > >
> > > Reviewed-by: Michael Kubacki 
> > >
> > > On 5/10/2023 1:14 AM, Guo, Gua wrote:
> > > > From: Gua Guo 
> > > >
> > > > Windows command prompt have 8191 characters limitation, enhance it
> > > > to make command too long can be resloved.
> > > >
> > > > Provide an example, if have too many cov files, it causes to run
> > > > single command over the 8191 characters limitation.
> > > >> OpenCppCoverage
> > > >>   --export_type binary:coverage.cov
> > > >>   --working_dir={workspace}Build
> > > >>   --input_coverage=AAA.cov
> > > >>   ...
> > > >>   --input_coverage=NNN.cov
> > > >
> > > > The solution is passing many coverage files in single command line
> > > > to breaking it up into many command lines with one coverage file
> > > > per command line in order to prevent single line is over to 8191
> characters.
> > > >
> > > > - Command Line 1
> > > >> OpenCppCoverage
> > > >>   --export_type binary:coverage.cov
> > > >>   --working_dir={workspace}Build
> > > >>   --input_coverage=AAA.cov
> > > >>   --input_coverage=coverage.cov
> > > > ...
> > > >
> > > > - Command Line N
> > > >> OpenCppCoverage
> > > >>   --export_type binary:coverage.cov
> > > >>   --working_dir={workspace}Build
> > > >>   --input_coverage=NNN.cov
> > > >>   --input_coverage=coverage.cov
> > > >
> > > > Cc: Michael D Kinney 
> > > > Cc: Sean Brogan 
> > > > Cc: Michael Kubacki 
> > > > Signed-off-by: Gua Guo 
> > > > ---
> > > >   .../HostBasedUnitTestRunner.py| 46
> > > +--
> > > >   1 file changed, 41 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git
> > > >
> > >
> >
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> > > >
> > >
> >
> b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> > > > index d993de9412..2e5c462cd2 100644
> > > > ---
> > > >
> > >
> >
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> > > > +++
> > > b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner
> > > > +++ .py
> > > > @@ -205,28 +205,64 @@ class
> > > HostBasedUnitTestRunner(IUefiBuildPlugin):
> > > >   testList = glob.glob(os.path.join(buildOutputBase,
> > > > "**","*Test*.exe"), recursive=True)
> > > >
> > > >   workspace = thebuilder.env.GetValue("WORKSPACE")
> > > >
> > > >   workspace = (workspace + os.sep) if workspace[-1] !=
> > > > os.sep else workspace
> > > >
> > > > +workspaceBuild = os.path.join(workspace, 'Build')
> > > >
> > > >   # Generate coverage file
> > > >
> > > >   coverageFile = ""
> > > >
> > > >   

回复: [edk2-devel] [PATCH v9 0/5] Trace Hub debug library support

2023-05-10 Thread gaoliming via groups.io
Acked-by: Liming Gao 

> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Guo, Gua
> 发送时间: 2023年5月11日 7:39
> 收件人: devel@edk2.groups.io
> 抄送: gua@intel.com
> 主题: [edk2-devel] [PATCH v9 0/5] Trace Hub debug library support
> 
> From: Gua Guo 
> 
> V9: Add more maintainers into CC list
> - https://github.com/tianocore/edk2/pull/3901
>   F: *
>   M: Andrew Fish  [ajfish]
>   M: Leif Lindholm  [leiflindholm]
>   M: Michael D Kinney  [mdkinney]
> 
>   MdeModulePkg
>   M: Jian J Wang  [jwang36]
>   M: Liming Gao  [lgao4]
> 
>   .pytool/
>   M: Sean Brogan  [spbrogan]
>   M: Michael Kubacki  [makubacki]
>   R: Michael D Kinney  [mdkinney]
>   R: Liming Gao  [lgao4]
> 
>   MdePkg/
>   M: Michael D Kinney  [mdkinney]
>   M: Liming Gao  [lgao4]
>   R: Zhiguang Liu  [LiuZhiguang001]
> 
> 
> V8: Add MdeModulePkg maintainers into CC list
> 
> V7: Miss one patch on V6
> 
> V6:
> - https://github.com/tianocore/edk2/pull/3901
>   Split submodule into new patch
>   Fix formatting issue
>   Add Review-by message
>   Offline check with Victor to use my sign-off name.
> 
> V5: if no other open, it will be final change
> - https://github.com/tianocore/edk2/pull/3901
>   Fix random exception when long run catalog debug message
> 
> V4
> - https://github.com/tianocore/edk2/pull/3901 - Done
>   Enhance SwapBytesGuid to use CopyGuid instead of CopyMem, to make
> implement code more simple.
> 
> V3
> - https://github.com/tianocore/edk2/pull/3901 - Done
>   - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why
> MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
> Solution: Remove this macro, use Library Constructor to allocate it
> dynamiclly.
>   - Open:
> MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommo
> n.c: SwapBytesGuid () algorithm wrong.
> Solution: Follow correct algorithm to implement it.
> VOID
> EFIAPI
> SwapBytesGuid (
>   IN  GUID  *Guid,<--- In PreMem, guid is global
> data so region is readonly, add output data to support it.
>   OUT GUID  *ConvertedGuid
> );
> 
>   - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D
> Solution: use *_*_*_CC_FLAGS  = -DMIPI_SYST_STATIC to unified both.
> 
> 
> V2
> - https://github.com/tianocore/edk2/pull/3901
>   - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why
> MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
>   - Open:
> MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommo
> n.c: SwapBytesGuid () algorithm wrong.
>   - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D
> 
> V1
> Previous PR:
> - https://github.com/tianocore/edk2/pull/3613
>   - TraceHubDebugLib without submodule - Reject
> 
> - https://github.com/tianocore/edk2/pull/3793
>   - TraceHubDebugLib with submodule and without seperate into
> MipiSysTLib and TraceHubDebugLib - Reject
> 
> Gua Guo (5):
>   MdePkg: Add mipisyst submodule
>   MdePkg: Add MipiSysTLib library
>   MdePkg: Add NULL library of TraceHubDebugSysTLib
>   MdeModulePkg: Add TraceHubDebugSysTLib library
>   Maintainers.txt: Update reviewers and maintainers for
> TraceHubDebugLib.
> 
>  .gitmodules   |   3 +
>  .pytool/CISettings.py |   2 +
>  Maintainers.txt   |  18 +
>  .../Include/Guid/TraceHubDebugInfoHob.h   |  24 +
>  .../BaseTraceHubDebugSysTLib.c| 245 ++
>  .../BaseTraceHubDebugSysTLib.inf  |  44 +
>  .../DxeSmmTraceHubDebugSysTLib.c  | 263 ++
>  .../DxeSmmTraceHubDebugSysTLib.inf|  51 ++
>  .../InternalTraceHubApi.c |  74 ++
>  .../InternalTraceHubApi.h |  37 +
>  .../InternalTraceHubApiCommon.c   | 200 +
>  .../InternalTraceHubApiCommon.h   | 119 +++
>  .../PeiTraceHubDebugSysTLib.c | 282 +++
>  .../PeiTraceHubDebugSysTLib.inf   |  50 ++
>  .../Library/TraceHubDebugSysTLib/Readme.md|  26 +
>  MdeModulePkg/MdeModulePkg.dec |  21 +
>  MdeModulePkg/MdeModulePkg.dsc |   3 +
>  MdeModulePkg/MdeModulePkg.uni |  18 +
>  MdePkg/Include/Library/MipiSysTLib.h  |  66 ++
>  MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 ++
>  MdePkg/Library/MipiSysTLib/GenMipiSystH.py| 132 +++
>  MdePkg/Library/MipiSysTLib/MipiSysTLib.c  | 123 +++
>  MdePkg/Library/MipiSysTLib/MipiSysTLib.inf|  52 ++
>  MdePkg/Library/MipiSysTLib/Platform.c | 164 
>  MdePkg/Library/MipiSysTLib/Platform.h | 138 +++
>  MdePkg/Library/MipiSysTLib/Readme.md  |  25 +
>  MdePkg/Library/MipiSysTLib/mipi_syst.h| 789
> ++
>  MdePkg/Library/MipiSysTLib/mipisyst   |   1 +
>  .../TraceHubDebugSysTLibNull.c|  76 ++
>  .../TraceHubDebugSysTLibNull.inf  |  29 +
>  MdePkg/MdePkg.ci.yaml |  12 +-
>  MdePkg/MdePkg.dec |   9 +

Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure

2023-05-10 Thread Guo, Gua
@Gao, Liming

Thank for the reply.
It's PR for the patch.
https://github.com/tianocore/edk2/pull/4357


Thanks
Gua
-Original Message-
From: Kinney, Michael D  
Sent: Thursday, May 11, 2023 9:53 AM
To: devel@edk2.groups.io; Gao, Liming ; Guo, Gua 
; 'Michael Kubacki' 
Cc: 'Sean Brogan' ; Kinney, Michael D 

Subject: RE: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute 
files cause "cmd too long" failure

Hi Liming,

I agree it is bug fix.  Can you do review and if pass help with push label?

Thanks,

Mike 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of 
> gaoliming via groups.io
> Sent: Wednesday, May 10, 2023 6:43 PM
> To: devel@edk2.groups.io; Guo, Gua ; 'Michael Kubacki'
> ; Kinney, Michael D 
> 
> Cc: 'Sean Brogan' 
> Subject: 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many 
> execute files cause "cmd too long" failure
> 
> Gua:
> 
> This is like a bug fix. I am OK to merge it for this stable tag.
> 
> Thanks
> Liming
> > -邮件原件-
> > 发件人: devel@edk2.groups.io  代表 Guo, Gua
> > 发送时间: 2023年5月11日 6:01
> > 收件人: Michael Kubacki ; 
> > devel@edk2.groups.io; Kinney, Michael D 
> > 抄送: Sean Brogan 
> > 主题: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many 
> > execute files cause "cmd too long" failure
> >
> > @Kinney, Michael D
> >
> > Could we merge the bug patch before code freeze ? The patch can help
> unlock
> > command too long issue on Windows command prompt.
> >
> > Thanks,
> > Gua
> >
> > -Original Message-
> > From: Michael Kubacki 
> > Sent: Thursday, May 11, 2023 5:41 AM
> > To: devel@edk2.groups.io; Guo, Gua 
> > Cc: Kinney, Michael D ; Sean Brogan 
> > 
> > Subject: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many
> execute
> > files cause "cmd too long" failure
> >
> > Reviewed-by: Michael Kubacki 
> >
> > On 5/10/2023 1:14 AM, Guo, Gua wrote:
> > > From: Gua Guo 
> > >
> > > Windows command prompt have 8191 characters limitation, enhance it 
> > > to make command too long can be resloved.
> > >
> > > Provide an example, if have too many cov files, it causes to run 
> > > single command over the 8191 characters limitation.
> > >> OpenCppCoverage
> > >>   --export_type binary:coverage.cov
> > >>   --working_dir={workspace}Build
> > >>   --input_coverage=AAA.cov
> > >>   ...
> > >>   --input_coverage=NNN.cov
> > >
> > > The solution is passing many coverage files in single command line 
> > > to breaking it up into many command lines with one coverage file 
> > > per command line in order to prevent single line is over to 8191 
> > > characters.
> > >
> > > - Command Line 1
> > >> OpenCppCoverage
> > >>   --export_type binary:coverage.cov
> > >>   --working_dir={workspace}Build
> > >>   --input_coverage=AAA.cov
> > >>   --input_coverage=coverage.cov
> > > ...
> > >
> > > - Command Line N
> > >> OpenCppCoverage
> > >>   --export_type binary:coverage.cov
> > >>   --working_dir={workspace}Build
> > >>   --input_coverage=NNN.cov
> > >>   --input_coverage=coverage.cov
> > >
> > > Cc: Michael D Kinney 
> > > Cc: Sean Brogan 
> > > Cc: Michael Kubacki 
> > > Signed-off-by: Gua Guo 
> > > ---
> > >   .../HostBasedUnitTestRunner.py| 46
> > +--
> > >   1 file changed, 41 insertions(+), 5 deletions(-)
> > >
> > > diff --git
> > >
> >
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> > >
> >
> b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> > > index d993de9412..2e5c462cd2 100644
> > > ---
> > >
> >
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> > > +++
> > b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner
> > > +++ .py
> > > @@ -205,28 +205,64 @@ class
> > HostBasedUnitTestRunner(IUefiBuildPlugin):
> > >   testList = glob.glob(os.path.join(buildOutputBase,
> > > "**","*Test*.exe"), recursive=True)
> > >
> > >   workspace = thebuilder.env.GetValue("WORKSPACE")
> > >
> > >   workspace = (workspace + os.sep) if workspace[-1] != 
> > > os.sep else workspace
> > >
> > > +workspaceBuild = os.path.join(workspace, 'Build')
> > >
> > >   # Generate coverage file
> > >
> > >   coverageFile = ""
> > >
> > >   for testFile in testList:
> > >
> > >   ret = RunCmd("OpenCppCoverage", f"--source
> > {workspace}
> > > --export_type binary:{testFile}.cov -- {testFile}")
> > >
> > > -coverageFile += " --input_coverage=" + testFile + ".cov"
> > >
> > > +if ret != 0:
> > >
> > > +logging.error("UnitTest Coverage: Failed to 
> > > + collect coverage data.")
> > >
> > > +return 1
> > >
> > > +
> > >
> > > +coverageFile  = f" --input_coverage={testFile}.cov"
> > >
> > > +totalCoverageFile = os.path.join(buildOutputBase,
> > > + 'coverage.cov')
> > >
> > > +if os.path.isfile(totalCoverageFile):
> > >
> > > +coverageFile += f"
> > 

回复: [edk2-devel] 回复: [PATCH v1 03/11] MdePkg/Acpi64: Add _PSD/_CPC/State Coordination Types macros

2023-05-10 Thread gaoliming via groups.io



> -邮件原件-
> 发件人: devel@edk2.groups.io  代表
> PierreGondois
> 发送时间: 2023年5月9日 15:50
> 收件人: gaoliming ; devel@edk2.groups.io
> 抄送: 'Ard Biesheuvel' ; 'Leif Lindholm'
> ; 'Sami Mujawar' ; 'Michael D
> Kinney' ; 'Zhiguang Liu'
> 
> 主题: Re: [edk2-devel] 回复: [PATCH v1 03/11] MdePkg/Acpi64: Add
> _PSD/_CPC/State Coordination Types macros
> 
> Hello Liming,
> 
> On 5/6/23 03:25, gaoliming wrote:
> > Pierre:
> >
> >> -邮件原件-
> >> 发件人: pierre.gond...@arm.com 
> >> 发送时间: 2023年5月5日 21:17
> >> 收件人: devel@edk2.groups.io
> >> 抄送: Ard Biesheuvel ; Leif Lindholm
> >> ; Sami Mujawar ; Michael
> D
> >> Kinney ; Liming Gao
> >> ; Zhiguang Liu 
> >> 主题: [PATCH v1 03/11] MdePkg/Acpi64: Add _PSD/_CPC/State
> Coordination
> >> Types macros
> >>
> >> From: Pierre Gondois 
> >>
> >> Add macros for:
> >> - _PSD version
> >> - _CPC version
> >> - C-state/T-state/P-state Coordination Types
> >>
> >> These objects were present in previous ACPI specification version,
> >> but are only added to the latest availbable version (6.4).
> >>
> >> Signed-off-by: Pierre Gondois 
> >> ---
> >>   MdePkg/Include/IndustryStandard/Acpi64.h | 25
> >> +++-
> >>   1 file changed, 24 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/MdePkg/Include/IndustryStandard/Acpi64.h
> >> b/MdePkg/Include/IndustryStandard/Acpi64.h
> >> index 575ca0430c13..e3c128d7548d 100644
> >> --- a/MdePkg/Include/IndustryStandard/Acpi64.h
> >> +++ b/MdePkg/Include/IndustryStandard/Acpi64.h
> >> @@ -2,7 +2,7 @@
> >> ACPI 6.4 definitions from the ACPI Specification Revision 6.4 Jan,
> > 2021.
> >>
> >> Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.
> >> -  Copyright (c) 2019 - 2021, ARM Ltd. All rights reserved.
> >> +  Copyright (c) 2019 - 2023, Arm Ltd. All rights reserved.
> >>
> > I see other source files all use ARM Ltd. Is it required to be updated to
> > Arm Ltd?
> 
> I think the name of the company was rebranded from ARM to Arm in 2017,
> so I've been asked to change the the copyright name when we update the
> copyright
> year ...
> 

OK. Got it. 

Thanks
Liming

> 
> >
> > Thanks
> > Liming
> >> SPDX-License-Identifier: BSD-2-Clause-Patent
> >>   **/
> >> @@ -17,6 +17,29 @@
> >>   //
> >>   #pragma pack(1)
> >>
> >> +///
> >> +/// C-state/T-state/P-state Coordination Types
> >> +/// Cf. s8.3 Power, Performance, and Throttling State Dependencies
> >> +///
> >> +#define EFI_ACPI_6_4_AML_STATE_COORD_TYPE_SW_ALL  0xFC
> >> +#define EFI_ACPI_6_4_AML_STATE_COORD_TYPE_SW_ANY  0xFD
> >> +#define EFI_ACPI_6_4_AML_STATE_COORD_TYPE_HW_ALL  0xFE
> >> +
> >> +///
> >> +/// _PSD Revision
> >> +/// Cf. s8.4.6.5 _PSD (P-State Dependency)
> >> +///
> >> +#define EFI_ACPI_6_4_AML_PSD_REVISION_V0  0
> >> +
> >> +///
> >> +/// _CPC Revision
> >> +/// Cf. s8.4.7.1 _CPC (Continuous Performance Control)
> >> +///
> >> +#define EFI_ACPI_6_4_AML_CPC_REVISION_V0  0
> >> +#define EFI_ACPI_6_4_AML_CPC_REVISION_V1  1
> >> +#define EFI_ACPI_6_4_AML_CPC_REVISION_V2  2
> >> +#define EFI_ACPI_6_4_AML_CPC_REVISION_V3  3
> >> +
> >>   ///
> >>   /// ACPI 6.4 Generic Address Space definition
> >>   ///
> >> --
> >> 2.25.1
> >
> >
> >
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104651): https://edk2.groups.io/g/devel/message/104651
Mute This Topic: https://groups.io/mt/98819630/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 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure

2023-05-10 Thread Michael D Kinney
Hi Liming,

I agree it is bug fix.  Can you do review and if pass help with push label?

Thanks,

Mike 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of gaoliming
> via groups.io
> Sent: Wednesday, May 10, 2023 6:43 PM
> To: devel@edk2.groups.io; Guo, Gua ; 'Michael Kubacki'
> ; Kinney, Michael D
> 
> Cc: 'Sean Brogan' 
> Subject: 回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many
> execute files cause "cmd too long" failure
> 
> Gua:
> 
> This is like a bug fix. I am OK to merge it for this stable tag.
> 
> Thanks
> Liming
> > -邮件原件-
> > 发件人: devel@edk2.groups.io  代表 Guo, Gua
> > 发送时间: 2023年5月11日 6:01
> > 收件人: Michael Kubacki ;
> > devel@edk2.groups.io; Kinney, Michael D 
> > 抄送: Sean Brogan 
> > 主题: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute
> > files cause "cmd too long" failure
> >
> > @Kinney, Michael D
> >
> > Could we merge the bug patch before code freeze ? The patch can help
> unlock
> > command too long issue on Windows command prompt.
> >
> > Thanks,
> > Gua
> >
> > -Original Message-
> > From: Michael Kubacki 
> > Sent: Thursday, May 11, 2023 5:41 AM
> > To: devel@edk2.groups.io; Guo, Gua 
> > Cc: Kinney, Michael D ; Sean Brogan
> > 
> > Subject: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many
> execute
> > files cause "cmd too long" failure
> >
> > Reviewed-by: Michael Kubacki 
> >
> > On 5/10/2023 1:14 AM, Guo, Gua wrote:
> > > From: Gua Guo 
> > >
> > > Windows command prompt have 8191 characters limitation, enhance it to
> > > make command too long can be resloved.
> > >
> > > Provide an example, if have too many cov files, it causes to run
> > > single command over the 8191 characters limitation.
> > >> OpenCppCoverage
> > >>   --export_type binary:coverage.cov
> > >>   --working_dir={workspace}Build
> > >>   --input_coverage=AAA.cov
> > >>   ...
> > >>   --input_coverage=NNN.cov
> > >
> > > The solution is passing many coverage files in single command line to
> > > breaking it up into many command lines with one coverage file per
> > > command line in order to prevent single line is over to 8191 characters.
> > >
> > > - Command Line 1
> > >> OpenCppCoverage
> > >>   --export_type binary:coverage.cov
> > >>   --working_dir={workspace}Build
> > >>   --input_coverage=AAA.cov
> > >>   --input_coverage=coverage.cov
> > > ...
> > >
> > > - Command Line N
> > >> OpenCppCoverage
> > >>   --export_type binary:coverage.cov
> > >>   --working_dir={workspace}Build
> > >>   --input_coverage=NNN.cov
> > >>   --input_coverage=coverage.cov
> > >
> > > Cc: Michael D Kinney 
> > > Cc: Sean Brogan 
> > > Cc: Michael Kubacki 
> > > Signed-off-by: Gua Guo 
> > > ---
> > >   .../HostBasedUnitTestRunner.py| 46
> > +--
> > >   1 file changed, 41 insertions(+), 5 deletions(-)
> > >
> > > diff --git
> > >
> >
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> > >
> >
> b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> > > index d993de9412..2e5c462cd2 100644
> > > ---
> > >
> >
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> > > +++
> > b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner
> > > +++ .py
> > > @@ -205,28 +205,64 @@ class
> > HostBasedUnitTestRunner(IUefiBuildPlugin):
> > >   testList = glob.glob(os.path.join(buildOutputBase,
> > > "**","*Test*.exe"), recursive=True)
> > >
> > >   workspace = thebuilder.env.GetValue("WORKSPACE")
> > >
> > >   workspace = (workspace + os.sep) if workspace[-1] != os.sep
> > > else workspace
> > >
> > > +workspaceBuild = os.path.join(workspace, 'Build')
> > >
> > >   # Generate coverage file
> > >
> > >   coverageFile = ""
> > >
> > >   for testFile in testList:
> > >
> > >   ret = RunCmd("OpenCppCoverage", f"--source
> > {workspace}
> > > --export_type binary:{testFile}.cov -- {testFile}")
> > >
> > > -coverageFile += " --input_coverage=" + testFile + ".cov"
> > >
> > > +if ret != 0:
> > >
> > > +logging.error("UnitTest Coverage: Failed to collect
> > > + coverage data.")
> > >
> > > +return 1
> > >
> > > +
> > >
> > > +coverageFile  = f" --input_coverage={testFile}.cov"
> > >
> > > +totalCoverageFile = os.path.join(buildOutputBase,
> > > + 'coverage.cov')
> > >
> > > +if os.path.isfile(totalCoverageFile):
> > >
> > > +coverageFile += f"
> > --input_coverage={totalCoverageFile}"
> > >
> > > +ret = RunCmd(
> > >
> > > +"OpenCppCoverage",
> > >
> > > +f"--export_type binary:{totalCoverageFile} " +
> > >
> > > +f"--working_dir={workspaceBuild} " +
> > >
> > > +f"{coverageFile}"
> > >
> > > +)
> > >
> > >   if ret != 0:
> > >
> > >   logging.error("UnitTest Coverage: Failed to collect

回复: [edk2-devel] [PATCH 1/1] SecurityPkg: Add missing break in Tpm2TestParms

2023-05-10 Thread gaoliming via groups.io
Jiewen:
  This is a bug fix. It can be merged for 202305. 

Thanks
Liming> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Yao, Jiewen
> 发送时间: 2023年5月10日 8:13
> 收件人: Rebecca Cran ; devel@edk2.groups.io; Wang,
> Jian J ; Kinney, Michael D
> ; Gao, Liming 
> 主题: Re: [edk2-devel] [PATCH 1/1] SecurityPkg: Add missing break in
> Tpm2TestParms
> 
> Reviewed-by: Jiewen Yao 
> 
> Can we add this in 202305 stable tag?
> 
> 
> > -Original Message-
> > From: Rebecca Cran 
> > Sent: Wednesday, May 10, 2023 12:45 AM
> > To: devel@edk2.groups.io; Yao, Jiewen ; Wang,
> > Jian J ; Kinney, Michael D
> > ; Gao, Liming 
> > Cc: Rebecca Cran 
> > Subject: [PATCH 1/1] SecurityPkg: Add missing break in Tpm2TestParms
> >
> > Add missing break in Tpm2TestParms.
> >
> > Reported in https://github.com/tianocore/edk2/issues/4073
> >
> > Signed-off-by: Rebecca Cran 
> > ---
> >  SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
> > b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
> > index 9db301ec9a90..f0e6019a47be 100644
> > --- a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
> > +++ b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Capability.c
> > @@ -743,6 +743,7 @@ Tpm2TestParms (
> >return EFI_INVALID_PARAMETER;
> >}
> >
> > +  break;
> >  case TPM_ALG_SYMCIPHER:
> >WriteUnaligned16 ((UINT16 *)Buffer, SwapBytes16 (Parameters-
> > >parameters.symDetail.algorithm));
> >Buffer += sizeof (UINT16);
> > --
> > 2.39.2
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104649): https://edk2.groups.io/g/devel/message/104649
Mute This Topic: https://groups.io/mt/98819547/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] Platform/Loongson: Set common page size to 16k

2023-05-10 Thread maobibo



在 2023/5/11 09:33, xianglai li 写道:
> Default page size is 16K for loongarch qemu tcg code section
> separated with data section with 16K page alignment,
> And data write operation in the same page with code section
> will cause qemu TB flush.
Xianglai,

Could you add more data supporting? such as size of dxe ffs image and 
dxe compaction ffs.

Regards
Bibo, Mao

> 
> Cc: Ard Biesheuvel 
> Cc: Bibo Mao 
> Cc: Chao Li 
> Cc: Leif Lindholm 
> Cc: Liming Gao 
> Cc: Michael D Kinney 
> Signed-off-by: xianglai li 
> ---
>  Platform/Loongson/LoongArchQemuPkg/Loongson.dsc | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc 
> b/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc
> index 6875e39cc6..13b27d84b8 100644
> --- a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc
> +++ b/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc
> @@ -61,8 +61,13 @@
>  [BuildOptions.LOONGARCH64.EDKII.SEC]
>*_*_*_CC_FLAGS =
>  
> +#
> +# default page size is 16K for loongarch qemu tcg
> +# code section separated with data section with 16K page alignment, else data
> +# write operation in the same page with code section will cause qemu TB flush
> +#
>  
> [BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
> -  GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
> +  GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x4000
>  
>  [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
>GCC:*_*_LOONGARCH64_DLINK_FLAGS = -z common-page-size=0x1



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




回复: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure

2023-05-10 Thread gaoliming via groups.io
Gua:

This is like a bug fix. I am OK to merge it for this stable tag. 

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Guo, Gua
> 发送时间: 2023年5月11日 6:01
> 收件人: Michael Kubacki ;
> devel@edk2.groups.io; Kinney, Michael D 
> 抄送: Sean Brogan 
> 主题: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute
> files cause "cmd too long" failure
> 
> @Kinney, Michael D
> 
> Could we merge the bug patch before code freeze ? The patch can help unlock
> command too long issue on Windows command prompt.
> 
> Thanks,
> Gua
> 
> -Original Message-
> From: Michael Kubacki 
> Sent: Thursday, May 11, 2023 5:41 AM
> To: devel@edk2.groups.io; Guo, Gua 
> Cc: Kinney, Michael D ; Sean Brogan
> 
> Subject: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute
> files cause "cmd too long" failure
> 
> Reviewed-by: Michael Kubacki 
> 
> On 5/10/2023 1:14 AM, Guo, Gua wrote:
> > From: Gua Guo 
> >
> > Windows command prompt have 8191 characters limitation, enhance it to
> > make command too long can be resloved.
> >
> > Provide an example, if have too many cov files, it causes to run
> > single command over the 8191 characters limitation.
> >> OpenCppCoverage
> >>   --export_type binary:coverage.cov
> >>   --working_dir={workspace}Build
> >>   --input_coverage=AAA.cov
> >>   ...
> >>   --input_coverage=NNN.cov
> >
> > The solution is passing many coverage files in single command line to
> > breaking it up into many command lines with one coverage file per
> > command line in order to prevent single line is over to 8191 characters.
> >
> > - Command Line 1
> >> OpenCppCoverage
> >>   --export_type binary:coverage.cov
> >>   --working_dir={workspace}Build
> >>   --input_coverage=AAA.cov
> >>   --input_coverage=coverage.cov
> > ...
> >
> > - Command Line N
> >> OpenCppCoverage
> >>   --export_type binary:coverage.cov
> >>   --working_dir={workspace}Build
> >>   --input_coverage=NNN.cov
> >>   --input_coverage=coverage.cov
> >
> > Cc: Michael D Kinney 
> > Cc: Sean Brogan 
> > Cc: Michael Kubacki 
> > Signed-off-by: Gua Guo 
> > ---
> >   .../HostBasedUnitTestRunner.py| 46
> +--
> >   1 file changed, 41 insertions(+), 5 deletions(-)
> >
> > diff --git
> >
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> >
> b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> > index d993de9412..2e5c462cd2 100644
> > ---
> >
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> > +++
> b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner
> > +++ .py
> > @@ -205,28 +205,64 @@ class
> HostBasedUnitTestRunner(IUefiBuildPlugin):
> >   testList = glob.glob(os.path.join(buildOutputBase,
> > "**","*Test*.exe"), recursive=True)
> >
> >   workspace = thebuilder.env.GetValue("WORKSPACE")
> >
> >   workspace = (workspace + os.sep) if workspace[-1] != os.sep
> > else workspace
> >
> > +workspaceBuild = os.path.join(workspace, 'Build')
> >
> >   # Generate coverage file
> >
> >   coverageFile = ""
> >
> >   for testFile in testList:
> >
> >   ret = RunCmd("OpenCppCoverage", f"--source
> {workspace}
> > --export_type binary:{testFile}.cov -- {testFile}")
> >
> > -coverageFile += " --input_coverage=" + testFile + ".cov"
> >
> > +if ret != 0:
> >
> > +logging.error("UnitTest Coverage: Failed to collect
> > + coverage data.")
> >
> > +return 1
> >
> > +
> >
> > +coverageFile  = f" --input_coverage={testFile}.cov"
> >
> > +totalCoverageFile = os.path.join(buildOutputBase,
> > + 'coverage.cov')
> >
> > +if os.path.isfile(totalCoverageFile):
> >
> > +coverageFile += f"
> --input_coverage={totalCoverageFile}"
> >
> > +ret = RunCmd(
> >
> > +"OpenCppCoverage",
> >
> > +f"--export_type binary:{totalCoverageFile} " +
> >
> > +f"--working_dir={workspaceBuild} " +
> >
> > +f"{coverageFile}"
> >
> > +)
> >
> >   if ret != 0:
> >
> >   logging.error("UnitTest Coverage: Failed to collect
> > coverage data.")
> >
> >   return 1
> >
> >
> >
> >   # Generate and XML file if requested.by each package
> >
> > -ret = RunCmd("OpenCppCoverage", f"--export_type
> cobertura:{os.path.join(buildOutputBase, 'coverage.xml')}
> --working_dir={workspace}Build {coverageFile}")
> >
> > +ret = RunCmd(
> >
> > +"OpenCppCoverage",
> >
> > +f"--export_type cobertura:{os.path.join(buildOutputBase,
> > + 'coverage.xml')} " +
> >
> > +f"--working_dir={workspaceBuild} " +
> >
> > +f"--input_coverage={totalCoverageFile} "
> >
> > +)
> >
> >   if ret != 0:
> >
> >   logging.error("UnitTest Coverage: Failed to generate
> > cobertura format xml 

Re: [edk2-devel] [edk2-platforms] Platform/Loongson: Set common page size to 16k

2023-05-10 Thread Chao Li

Reviewed-by: Chao Li 


Thanks,
Chao
在 2023/5/11 09:33, xianglai 写道:

Default page size is 16K for loongarch qemu tcg code section
separated with data section with 16K page alignment,
And data write operation in the same page with code section
will cause qemu TB flush.

Cc: Ard Biesheuvel
Cc: Bibo Mao
Cc: Chao Li
Cc: Leif Lindholm
Cc: Liming Gao
Cc: Michael D Kinney
Signed-off-by: xianglai li
---
  Platform/Loongson/LoongArchQemuPkg/Loongson.dsc | 7 ++-
  1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc 
b/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc
index 6875e39cc6..13b27d84b8 100644
--- a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc
+++ b/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc
@@ -61,8 +61,13 @@
  [BuildOptions.LOONGARCH64.EDKII.SEC]
*_*_*_CC_FLAGS =
  
+#

+# default page size is 16K for loongarch qemu tcg
+# code section separated with data section with 16K page alignment, else data
+# write operation in the same page with code section will cause qemu TB flush
+#
  
[BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
-  GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
+  GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x4000
  
  [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]

GCC:*_*_LOONGARCH64_DLINK_FLAGS = -z common-page-size=0x1



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




回复: [edk2-devel] [edk2-stable202305 PATCH 0/3] BaseTools: Fix PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat

2023-05-10 Thread gaoliming via groups.io
Rebecca:
  I just add PUSH label for this change. 

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Rebecca Cran
> 发送时间: 2023年5月11日 6:30
> 收件人: devel@edk2.groups.io; Andrew Fish ; Leif
> Lindholm ; Michael D Kinney
> ; Liming Gao ;
> Bob Feng ; Yuwei Chen 
> 主题: Re: [edk2-devel] [edk2-stable202305 PATCH 0/3] BaseTools: Fix
> PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat
> 
> Mike/Liming:
> 
> 
> I'd like to get this in for the upcoming stable tag.
> 
> The PR is https://github.com/tianocore/edk2/pull/4363 .
> 
> 
> --
> Rebecca Cran
> 
> 
> On 5/8/23 22:25, Rebecca Cran wrote:
> > Fix some issues in BaseTools:
> >
> > - When the Pip BaseTools are used, make sure PYTHONPATH is set.
> > - Fix Tests\TestTools.py so it works on Windows.
> > - Cleanup toolsetup.bat
> >
> > Rebecca Cran (3):
> >BaseTools: Update toolsetup.bat to not use
> BASETOOLS_PYTHON_SOURCE
> >BaseTools: only print the environment once in toolsetup.bat
> >BaseTools: Update Tests/TestTools.py to allow it to work on Windows
> >
> >   BaseTools/Tests/TestTools.py |  4 +-
> >   BaseTools/toolsetup.bat  | 40 +---
> >   2 files changed, 21 insertions(+), 23 deletions(-)
> >
> 
> 
> 
> 





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




[edk2-devel] [edk2-platforms] Platform/Loongson: Set common page size to 16k

2023-05-10 Thread xianglai
Default page size is 16K for loongarch qemu tcg code section
separated with data section with 16K page alignment,
And data write operation in the same page with code section
will cause qemu TB flush.

Cc: Ard Biesheuvel 
Cc: Bibo Mao 
Cc: Chao Li 
Cc: Leif Lindholm 
Cc: Liming Gao 
Cc: Michael D Kinney 
Signed-off-by: xianglai li 
---
 Platform/Loongson/LoongArchQemuPkg/Loongson.dsc | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc 
b/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc
index 6875e39cc6..13b27d84b8 100644
--- a/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc
+++ b/Platform/Loongson/LoongArchQemuPkg/Loongson.dsc
@@ -61,8 +61,13 @@
 [BuildOptions.LOONGARCH64.EDKII.SEC]
   *_*_*_CC_FLAGS =
 
+#
+# default page size is 16K for loongarch qemu tcg
+# code section separated with data section with 16K page alignment, else data
+# write operation in the same page with code section will cause qemu TB flush
+#
 
[BuildOptions.common.EDKII.DXE_CORE,BuildOptions.common.EDKII.DXE_DRIVER,BuildOptions.common.EDKII.UEFI_DRIVER,BuildOptions.common.EDKII.UEFI_APPLICATION]
-  GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
+  GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x4000
 
 [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
   GCC:*_*_LOONGARCH64_DLINK_FLAGS = -z common-page-size=0x1
-- 
2.31.1



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




回复: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0 before walking through next FV

2023-05-10 Thread gaoliming via groups.io
Wendy:
  DiscoverPeimsAndOrderWithApriori () has the logic to reset 
Private->AprioriCount as zero. 
  It will set the real AprioriCount for each FV when this FV first scans, then 
dispatch the peims in the apriori list. 
  So, I don't think there is the issue here. Do you find the real functionality 
issue?

Thanks
Liming
> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Wendy Liao
> via groups.io
> 发送时间: 2023年5月10日 14:23
> 收件人: devel@edk2.groups.io
> 抄送: Leon Chen ; Tim Lewis
> 
> 主题: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0
> before walking through next FV
> 
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4438
> 
> The main dispatch loop in PeiDispatcher() goes through each FV and
> calls DiscoverPeimsAndOrderWithApriori() to search Apriori file to
> reorder all PEIMs then do the PEIM dispatched.
> 
> DiscoverPeimsAndOrderWithApriori() calculates Apriori file count for
> every FV once and set Private->AprioriCount, but Private->AprioriCount
> doesn't be set to 0 before dispatch loop walking through the next FV.
> 
> It causes the peim which sort on less than Private->AprioriCount and
> depex is not satisfied would be dispatched when dispatch loop go through
> to a scaned FV, even the peim is not set in APRIORI file.
> 
> Cc: Leon Chen 
> Cc: Tim Lewis 
> Reported-by: Esther Lee 
> Signed-off-by: Wendy Liao 
> 
> ---
>   MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
> b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
> index d8284f9f4f..5f32ebb560 100644
> --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
> +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
> @@ -1630,6 +1630,7 @@ PeiDispatcher (
> Private->CurrentFileHandle= NULL;
> Private->CurrentPeimCount = 0;
> Private->CurrentFvFileHandles = NULL;
> +  Private->AprioriCount = 0;
>   }
> 
>   //
> --
> 2.29.2.windows.2
> 
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104643): https://edk2.groups.io/g/devel/message/104643
Mute This Topic: https://groups.io/mt/98819385/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 0/2] Support for PCIe Auto Bifurcation feature

2023-05-10 Thread Minh Nguyen

Hi all,

 Thanks a lot for reviewing these patches

Thanks,

Minh Nguyen

On 5/10/2023 1:11 PM, Ard Biesheuvel wrote:

On Wed, 10 May 2023 at 07:59, Nhi Pham  wrote:

Thanks Minh for this series. It looks good to me.

Reviewed-by: Nhi Pham 

Hi Leif, Ard - Could you please help merge this series?


Pushed as 7ac91ec277db..c91f8862ae87

Thanks all



On 5/5/2023 9:49 AM, Minh Nguyen wrote:

These patches support for PCIe Auto Bifurcation feature of Ampere
silicon (Altra and Altra Max).

Vu Nguyen (2):
AmpereAltraPkg: Add support for PCIe Auto Bifurcation
AmpereAltraPkg: Enable auto bifurcation via BoardSetting

   Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.h   
   |   4 +-
   Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.h  
   |   5 +-
   Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.h 
   |   5 +
   Silicon/Ampere/AmpereAltraPkg/Drivers/PcieInitPei/RootComplexNVParam.c   
   |  14 +-
   
Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.c
   |  19 +-
   Silicon/Ampere/AmpereAltraPkg/Library/Ac01PcieLib/PcieCore.c 
   | 344 +++-
   
Silicon/Ampere/AmpereAltraPkg/Drivers/RootComplexConfigDxe/RootComplexConfigDxe.uni
 |   3 +-
   7 files changed, 383 insertions(+), 11 deletions(-)




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




Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: Update Redfish converter lib

2023-05-10 Thread Nickle Wang via groups.io
Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Thursday, May 11, 2023 8:58 AM
> To: devel@edk2.groups.io
> Cc: Nickle Wang ; Igor Kulchytskyy 
> Subject: [edk2-redfish-client][PATCH] RedfishClientPkg: Update Redfish 
> converter
> lib
>
> External email: Use caution opening links or attachments
>
>
> From: Abner Chang 
>
> Temporary modified on the auto-generated lib to support
> Redfish BIOS attributes. RedfishScemaToCStructure python
> script needs to be updated for fixing this issue.
>
> Signed-off-by: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../src/Bios/Bios.V1_0_9/Bios.V1_0_9.c| 1118 -
>  1 file changed, 559 insertions(+), 559 deletions(-)
>
> diff --git a/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c
> b/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c
> index d698321886..c1418c634d 100644
> --- a/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c
> +++ b/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c
> @@ -1,559 +1,559 @@
> -//
> -// Auto-generated file by Redfish Schema C Structure Generator.
> -//
> https://github.co/
> m%2FDMTF%2FRedfish-Schema-C-Struct-
> Generator=05%7C01%7Cnicklew%40nvidia.com%7C215698e96e474237d1
> 7608db51bac39d%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C6381
> 93634821405844%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJ
> QIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=
> nNokUJpI5nXRQtPhLUV0epV7sjQsVglZldHlMT2mOQ8%3D=0.
> -//
> -//  (C) Copyright 2019-2022 Hewlett Packard Enterprise Development LP
> -//
> -// Copyright Notice:
> -// Copyright 2019-2022 Distributed Management Task Force, Inc. All rights
> reserved.
> -// License: BSD 3-Clause License. For full text see link:
> https://github.co/
> m%2FDMTF%2FRedfish-JSON-C-Struct-
> Converter%2Fblob%2Fmaster%2FLICENSE.md=05%7C01%7Cnicklew%40n
> vidia.com%7C215698e96e474237d17608db51bac39d%7C43083d15727340c1b7
> db39efd9ccc17a%7C0%7C0%7C638193634821405844%7CUnknown%7CTWFpb
> GZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn
> 0%3D%7C3000%7C%7C%7C=BfX7e%2BhMQ2hNW%2BTOVxjL124i%2Fnh
> obX1s384yR5NW08Q%3D=0
> -//
> -
> -#include"Redfish_Bios_v1_0_9_CS.h"
> -#include 
> -#include 
> -#include 
> -
> -RedfishCS_bool SupportedRedfishResource (RedfishCS_char *Odata_Type,
> RedfishCS_char *NameSpace, RedfishCS_char *Version, RedfishCS_char
> *DataType);
> -RedfishCS_status CreateCsUriByNode (RedfishCS_void *Cs, json_t *JsonOj,
> RedfishCS_char *NodeName, RedfishCS_char *ParentUri,
> RedfishCS_Type_Uri_Data **CsTypeUriData);
> -RedfishCS_status CreateCsJsonByNode (RedfishCS_void *Cs, json_t *JsonOj,
> RedfishCS_char *NodeName, RedfishCS_char *ParentUri,
> RedfishCS_Type_JSON_Data **CsTypeJsonData);
> -RedfishCS_status CreateCsUriOrJsonByNode (RedfishCS_void *Cs, json_t
> *JsonObj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri,
> RedfishCS_Link *LinkHead);
> -RedfishCS_status CreateCsUriOrJsonByNodeArray (RedfishCS_void *Cs, json_t
> *JsonObj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri,
> RedfishCS_Link *LinkHead);
> -RedfishCS_status CreateJsonPayloadAndCs (char *JsonRawText, char
> *ResourceType, char *ResourceVersion, char *TypeName, json_t
> **JsonObjReturned, void **Cs, int size);
> -RedfishCS_status GetRedfishPropertyStr (RedfishCS_void *Cs, json_t *JsonObj,
> char *Key, RedfishCS_char **DstBuffer);
> -RedfishCS_status GetRedfishPropertyBoolean (RedfishCS_void *Cs, json_t
> *JsonObj, char *Key, RedfishCS_bool **DstBuffer);
> -RedfishCS_status GetRedfishPropertyVague (RedfishCS_void *Cs, json_t
> *JsonObj, char *Key, RedfishCS_Vague **DstBuffer);
> -RedfishCS_status DestoryCsMemory (RedfishCS_void *rootCs);
> -RedfishCS_status GetRedfishPropertyInt64 (RedfishCS_void *Cs, json_t 
> *JsonObj,
> char *Key, RedfishCS_int64 **Dst);
> -RedfishCS_status InsertJsonStringObj (json_t *JsonObj, char *Key, char
> *StringValue);
> -RedfishCS_status InsertJsonLinkObj (json_t *JsonObj, char *Key, 
> RedfishCS_Link
> *Link);
> -RedfishCS_status InsertJsonInt64Obj (json_t *ParentJsonObj, char *Key,
> RedfishCS_int64 *Int64Value);
> -RedfishCS_status InsertJsonBoolObj (json_t *ParentJsonObj, char *Key,
> RedfishCS_bool *BoolValue);
> -RedfishCS_status InsertJsonStringArrayObj (json_t *JsonObj, char *Key,
> RedfishCS_char_Array *StringValueArray);
> -RedfishCS_status InsertJsonLinkArrayObj (json_t *JsonObj, char *Key,
> RedfishCS_Link *LinkArray);
> -RedfishCS_status InsertJsonInt64ArrayObj (json_t *ParentJsonObj, char *Key,
> RedfishCS_int64_Array *Int64ValueArray);
> -RedfishCS_status InsertJsonBoolArrayObj (json_t *ParentJsonObj, char *Key,
> RedfishCS_bool_Array *BoolValueArray);
> -RedfishCS_status InsertJsonVagueObj (json_t *ParentJsonObj, char *Key,
> RedfishCS_Vague *VagueValue);
> -RedfishCS_bool CheckEmptyPropJsonObject(json_t *JsonObj, RedfishCS_uint32
> *NumOfProperty);
> -RedfishCS_status 

[edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: Update Redfish converter lib

2023-05-10 Thread Chang, Abner via groups.io
From: Abner Chang 

Temporary modified on the auto-generated lib to support
Redfish BIOS attributes. RedfishScemaToCStructure python
script needs to be updated for fixing this issue.

Signed-off-by: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
---
 .../src/Bios/Bios.V1_0_9/Bios.V1_0_9.c| 1118 -
 1 file changed, 559 insertions(+), 559 deletions(-)

diff --git a/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c 
b/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c
index d698321886..c1418c634d 100644
--- a/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c
+++ b/RedfishClientPkg/ConverterLib/src/Bios/Bios.V1_0_9/Bios.V1_0_9.c
@@ -1,559 +1,559 @@
-//
-// Auto-generated file by Redfish Schema C Structure Generator.
-// https://github.com/DMTF/Redfish-Schema-C-Struct-Generator.
-//
-//  (C) Copyright 2019-2022 Hewlett Packard Enterprise Development LP
-//
-// Copyright Notice:
-// Copyright 2019-2022 Distributed Management Task Force, Inc. All rights 
reserved.
-// License: BSD 3-Clause License. For full text see link: 
https://github.com/DMTF/Redfish-JSON-C-Struct-Converter/blob/master/LICENSE.md
-//
-
-#include"Redfish_Bios_v1_0_9_CS.h"
-#include 
-#include 
-#include 
-
-RedfishCS_bool SupportedRedfishResource (RedfishCS_char *Odata_Type, 
RedfishCS_char *NameSpace, RedfishCS_char *Version, RedfishCS_char *DataType);
-RedfishCS_status CreateCsUriByNode (RedfishCS_void *Cs, json_t *JsonOj, 
RedfishCS_char *NodeName, RedfishCS_char *ParentUri, RedfishCS_Type_Uri_Data 
**CsTypeUriData);
-RedfishCS_status CreateCsJsonByNode (RedfishCS_void *Cs, json_t *JsonOj, 
RedfishCS_char *NodeName, RedfishCS_char *ParentUri, RedfishCS_Type_JSON_Data 
**CsTypeJsonData);
-RedfishCS_status CreateCsUriOrJsonByNode (RedfishCS_void *Cs, json_t *JsonObj, 
RedfishCS_char *NodeName, RedfishCS_char *ParentUri, RedfishCS_Link *LinkHead);
-RedfishCS_status CreateCsUriOrJsonByNodeArray (RedfishCS_void *Cs, json_t 
*JsonObj, RedfishCS_char *NodeName, RedfishCS_char *ParentUri, RedfishCS_Link 
*LinkHead);
-RedfishCS_status CreateJsonPayloadAndCs (char *JsonRawText, char 
*ResourceType, char *ResourceVersion, char *TypeName, json_t **JsonObjReturned, 
void **Cs, int size);
-RedfishCS_status GetRedfishPropertyStr (RedfishCS_void *Cs, json_t *JsonObj, 
char *Key, RedfishCS_char **DstBuffer);
-RedfishCS_status GetRedfishPropertyBoolean (RedfishCS_void *Cs, json_t 
*JsonObj, char *Key, RedfishCS_bool **DstBuffer);
-RedfishCS_status GetRedfishPropertyVague (RedfishCS_void *Cs, json_t *JsonObj, 
char *Key, RedfishCS_Vague **DstBuffer);
-RedfishCS_status DestoryCsMemory (RedfishCS_void *rootCs);
-RedfishCS_status GetRedfishPropertyInt64 (RedfishCS_void *Cs, json_t *JsonObj, 
char *Key, RedfishCS_int64 **Dst);
-RedfishCS_status InsertJsonStringObj (json_t *JsonObj, char *Key, char 
*StringValue);
-RedfishCS_status InsertJsonLinkObj (json_t *JsonObj, char *Key, RedfishCS_Link 
*Link);
-RedfishCS_status InsertJsonInt64Obj (json_t *ParentJsonObj, char *Key, 
RedfishCS_int64 *Int64Value);
-RedfishCS_status InsertJsonBoolObj (json_t *ParentJsonObj, char *Key, 
RedfishCS_bool *BoolValue);
-RedfishCS_status InsertJsonStringArrayObj (json_t *JsonObj, char *Key, 
RedfishCS_char_Array *StringValueArray);
-RedfishCS_status InsertJsonLinkArrayObj (json_t *JsonObj, char *Key, 
RedfishCS_Link *LinkArray);
-RedfishCS_status InsertJsonInt64ArrayObj (json_t *ParentJsonObj, char *Key, 
RedfishCS_int64_Array *Int64ValueArray);
-RedfishCS_status InsertJsonBoolArrayObj (json_t *ParentJsonObj, char *Key, 
RedfishCS_bool_Array *BoolValueArray);
-RedfishCS_status InsertJsonVagueObj (json_t *ParentJsonObj, char *Key, 
RedfishCS_Vague *VagueValue);
-RedfishCS_bool CheckEmptyPropJsonObject(json_t *JsonObj, RedfishCS_uint32 
*NumOfProperty);
-RedfishCS_status CreateEmptyPropCsJson(RedfishCS_void *Cs, json_t *JsonOj, 
RedfishCS_char *NodeName, RedfishCS_char *ParentUri, 
RedfishCS_Type_EmptyProp_CS_Data **CsTypeEmptyPropCS, RedfishCS_uint32 
NunmOfProperties);
-RedfishCS_status CsEmptyPropLinkToJson(json_t *CsJson, char *Key, 
RedfishCS_Link *Link);
-
-//
-//Generate C structure for #Bios.ChangePassword
-//
-static RedfishCS_status GenChangePasswordCs(RedfishBios_V1_0_9_Bios_CS *Cs, 
json_t *JsonObj, char *Key, RedfishBios_V1_0_9_ChangePassword_CS **Dst)
-{
-  RedfishCS_status Status;
-  json_t *TempJsonObj;
-
-  Status = RedfishCS_status_success;
-  TempJsonObj = json_object_get(JsonObj, Key);
-  if (TempJsonObj == NULL) {
-return RedfishCS_status_not_found;
-  }
-  Status = allocateRecordCsMemory(Cs, 
sizeof(RedfishBios_V1_0_9_ChangePassword_CS), (RedfishCS_void **)Dst);
-  if (Status != RedfishCS_status_success){
-goto Error;
-  }
-  // target
-  Status = GetRedfishPropertyStr (Cs, TempJsonObj, "target", &(*Dst)->target);
-  if (Status != RedfishCS_status_success && Status != 
RedfishCS_status_not_found) {goto Error;}
-  else {if (Status == RedfishCS_status_not_found){/*This is not the 

Re: [edk2-devel] [edk2-stable202305 PATCH 1/1] BaseTools: Revert Set the CLANGDWARF OBJCOPY path in tools_def.template

2023-05-10 Thread Michael D Kinney
Merged

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Rebecca
> Cran
> Sent: Wednesday, May 10, 2023 7:50 AM
> To: Ard Biesheuvel 
> Cc: devel@edk2.groups.io; Gao, Liming ; Feng,
> Bob C ; Chen, Christine ;
> Kinney, Michael D ; Gao, Liming
> 
> Subject: Re: [edk2-devel] [edk2-stable202305 PATCH 1/1] BaseTools: Revert
> Set the CLANGDWARF OBJCOPY path in tools_def.template
> 
> Mike/Liming:
> 
> 
> GitHub PR with R-B added: https://github.com/tianocore/edk2/pull/4384
> 
> 
> --
> Rebecca Cran
> 
> 
> On 5/10/23 07:51, Ard Biesheuvel wrote:
> > On Wed, 10 May 2023 at 14:46, Rebecca Cran  wrote:
> >> On 5/10/23 06:37, Ard Biesheuvel wrote:
> >>> On Wed, 10 May 2023 at 14:31, Rebecca Cran 
> wrote:
>  This reverts commit 11f62f4cc09f16d265da1a737dabfd8ed65f8c00.
> 
>  While GCC uses objcopy for the OBJCOPY command, it's not needed for
> the
>  CLANGDWARF toolchain and can be left as echo.
> 
> >>> Are you sure you want to change this for IA32 and X86 as well? I'm not
> >>> sure what the significance is, I suppose it sets the debuglink on the
> >>> copies of the dll files?
> >> Looking back to the tools_def.template from edk2-stable202302, we set
> >> OBJCOPY_PATH for CLANG38 IA32 and X64, but not for CLANGPDB or
> CLANGDWARF.
> >>
> >> I was thinking it's safer to keep existing behavior for now.
> >>
> > Existing behavior of CLANGDWARF for X86 and IA32, right? Yeah that makes
> sense.
> >
> > Reviewed-by: Ard BIesheuvel 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104639): https://edk2.groups.io/g/devel/message/104639
Mute This Topic: https://groups.io/mt/98804529/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] [PATCH v5 0/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure

2023-05-10 Thread Guo, Gua
From: Gua Guo 

V4:
Add Reviewed-by Info from Michael Kubacki
Add more people into Cc List
> BaseTools
> F: BaseTools/
> M: Rebecca Cran  [bcran]
> M: Liming Gao  [lgao4]
> R: Bob Feng  [BobCF]
> R: Yuwei Chen  [YuweiChen1110]

V3:
Michael Kubacki
Open1:
I understand it was common in some parts of the code base at one point to wrap 
all expressions in parentheses, but can it be avoided in newly added code?
And the parentheses are unnecessary in this case and don't follow typical 
Python style.

Solution: Fixed, I will record it in my personal guideline to prevent happen 
again in next time that I change python code on Edk2.

Open2:
Due to the number of references, it would be easier to follow if this path were 
assigned to a variable:
os.path.join(buildOutputBase, 'coverage.cov')

Solution: Fixed, Use variable to reduce repetitive data.

Open3:
Solution: my local test, performance time increase 1.4% each build. I'm not 
sure whether the data is reasonable or not. But if won't fix it, I think one 
day unittest implement more and more on Edk2 part.
It will break azurepipe line build in the future.

V2/V1:
Mike Kinney:
Open1: Make commit message more clearly.
Solution: Change commit message to use real case to describe the issue I 
encounter.

Gua Guo (1):
  BaseTools/Plugin: Too many execute files cause "cmd too long" failure

 .../HostBasedUnitTestRunner.py| 46 +--
 1 file changed, 41 insertions(+), 5 deletions(-)

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v5 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure

2023-05-10 Thread Guo, Gua
From: Gua Guo 

Windows command prompt have 8191 characters limitation,
enhance it to make command too long can be resloved.

Provide an example, if have too many cov files, it causes to run single
command over the 8191 characters limitation.
> OpenCppCoverage
>  --export_type binary:coverage.cov
>  --working_dir={workspace}Build
>  --input_coverage=AAA.cov
>  ...
>  --input_coverage=NNN.cov

The solution is passing many coverage files in single command line to
breaking it up into many command lines with one coverage file per
command line in order to prevent single line is over to 8191 characters.

- Command Line 1
> OpenCppCoverage
>  --export_type binary:coverage.cov
>  --working_dir={workspace}Build
>  --input_coverage=AAA.cov
>  --input_coverage=coverage.cov
...

- Command Line N
> OpenCppCoverage
>  --export_type. binary:coverage.cov
>  --working_dir={workspace}Build
>  --input_coverage=NNN.cov
>  --input_coverage=coverage.cov

Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Michael Kubacki 
Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Signed-off-by: Gua Guo 
Reviewed-by: Michael Kubacki 
---
 .../HostBasedUnitTestRunner.py| 46 +--
 1 file changed, 41 insertions(+), 5 deletions(-)

diff --git 
a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py 
b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
index d993de9412..2e5c462cd2 100644
--- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
+++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
@@ -205,28 +205,64 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 testList = glob.glob(os.path.join(buildOutputBase, "**","*Test*.exe"), 
recursive=True)
 workspace = thebuilder.env.GetValue("WORKSPACE")
 workspace = (workspace + os.sep) if workspace[-1] != os.sep else 
workspace
+workspaceBuild = os.path.join(workspace, 'Build')
 # Generate coverage file
 coverageFile = ""
 for testFile in testList:
 ret = RunCmd("OpenCppCoverage", f"--source {workspace} 
--export_type binary:{testFile}.cov -- {testFile}")
-coverageFile += " --input_coverage=" + testFile + ".cov"
+if ret != 0:
+logging.error("UnitTest Coverage: Failed to collect coverage 
data.")
+return 1
+
+coverageFile  = f" --input_coverage={testFile}.cov"
+totalCoverageFile = os.path.join(buildOutputBase, 'coverage.cov')
+if os.path.isfile(totalCoverageFile):
+coverageFile += f" --input_coverage={totalCoverageFile}"
+ret = RunCmd(
+"OpenCppCoverage",
+f"--export_type binary:{totalCoverageFile} " +
+f"--working_dir={workspaceBuild} " +
+f"{coverageFile}"
+)
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to collect coverage 
data.")
 return 1
 
 # Generate and XML file if requested.by each package
-ret = RunCmd("OpenCppCoverage", f"--export_type 
cobertura:{os.path.join(buildOutputBase, 'coverage.xml')} 
--working_dir={workspace}Build {coverageFile}")
+ret = RunCmd(
+"OpenCppCoverage",
+f"--export_type cobertura:{os.path.join(buildOutputBase, 
'coverage.xml')} " +
+f"--working_dir={workspaceBuild} " +
+f"--input_coverage={totalCoverageFile} "
+)
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to generate cobertura 
format xml in single package.")
 return 1
 
 # Generate total report XML file for all package
-testCoverageList = glob.glob(os.path.join(workspace, "Build", 
"**","*Test*.exe.cov"), recursive=True)
+testCoverageList = glob.glob(os.path.join(workspace, "Build", "**", 
"*Test*.exe.cov"), recursive=True)
 coverageFile = ""
+totalCoverageFile = os.path.join(workspaceBuild, 'coverage.cov')
 for testCoverage in testCoverageList:
-coverageFile += " --input_coverage=" + testCoverage
+coverageFile  = f" --input_coverage={testCoverage}"
+if os.path.isfile(totalCoverageFile):
+coverageFile += f" --input_coverage={totalCoverageFile}"
+ret = RunCmd(
+"OpenCppCoverage",
+f"--export_type binary:{totalCoverageFile} " +
+f"--working_dir={workspaceBuild} " +
+f"{coverageFile}"
+)
+if ret != 0:
+logging.error("UnitTest Coverage: Failed to collect coverage 
data.")
+return 1
 
-ret = RunCmd("OpenCppCoverage", f"--export_type 
cobertura:{workspace}Build/coverage.xml --working_dir={workspace}Build 
{coverageFile}")
+ret = RunCmd(
+"OpenCppCoverage",
+f"--export_type 

[edk2-devel] [PATCH v9 3/5] MdePkg: Add NULL library of TraceHubDebugSysTLib

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library is NULL library of TraceHubDebugSysTLib.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 MdePkg/Include/Library/TraceHubDebugSysTLib.h | 81 +++
 .../TraceHubDebugSysTLibNull.c| 76 +
 .../TraceHubDebugSysTLibNull.inf  | 29 +++
 MdePkg/MdePkg.dsc |  1 +
 4 files changed, 187 insertions(+)
 create mode 100644 MdePkg/Include/Library/TraceHubDebugSysTLib.h
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.inf

diff --git a/MdePkg/Include/Library/TraceHubDebugSysTLib.h 
b/MdePkg/Include/Library/TraceHubDebugSysTLib.h
new file mode 100644
index 00..7df20e67d6
--- /dev/null
+++ b/MdePkg/Include/Library/TraceHubDebugSysTLib.h
@@ -0,0 +1,81 @@
+/** @file
+This header file declares Trace Hub related top level APIs.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef TRACE_HUB_DEBUG_SYST_LIB_H_
+#define TRACE_HUB_DEBUG_SYST_LIB_H_
+
+typedef enum {
+  SeverityNone= 0,
+  SeverityFatal   = 1,
+  SeverityError   = 2,
+  SeverityWarning = 3,
+  SeverityNormal  = 4,
+  SeverityUser1   = 5,
+  SeverityUser2   = 6,
+  SeverityUser3   = 7,
+  SeverityMax
+} TRACE_HUB_SEVERITY_TYPE;
+
+/**
+  Write debug string to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Buffer   A pointer to the data buffer.
+  @param[in]  NumberOfBytesThe size of data buffer.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTDebugWrite (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT8*Buffer,
+  IN UINTNNumberOfBytes
+  );
+
+/**
+  Write catalog status code message to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Id   Catalog ID.
+  @param[in]  Guid Driver Guid.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTWriteCataLog64StatusCode (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT64   Id,
+  IN GUID *Guid
+  );
+
+/**
+  Write catalog message to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType   Severity type of input message.
+  @param[in]  Id Catalog ID.
+  @param[in]  NumberOfParams Number of entries in argument list.
+  @param[in]  ...Catalog message parameters.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTWriteCataLog64 (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT64   Id,
+  IN UINTNNumberOfParams,
+  ...
+  );
+
+#endif // TRACE_HUB_DEBUG_SYST_LIB_H_
diff --git a/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c 
b/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
new file mode 100644
index 00..0bd14d4e24
--- /dev/null
+++ b/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
@@ -0,0 +1,76 @@
+/** @file
+Null library of TraceHubDebugSysTLib.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+
+/**
+  Write debug string to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Buffer   A pointer to the data buffer.
+  @param[in]  NumberOfBytesThe size of data buffer.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTDebugWrite (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT8*Buffer,
+  IN UINTNNumberOfBytes
+  )
+{
+  return RETURN_UNSUPPORTED;
+}
+
+/**
+  Write catalog status code message to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Id   Catalog ID.
+  @param[in]  Guid Driver Guid.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI

[edk2-devel] [PATCH v9 5/5] Maintainers.txt: Update reviewers and maintainers for TraceHubDebugLib.

2023-05-10 Thread Guo, Gua
From: Gua Guo 

Update reviewers and maintainers for TraceHubDebugSysTlib.

Cc: Michael D Kinney 
Cc: Andrew Fish 
Cc: Leif Lindholm 
Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 Maintainers.txt | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index 09d04af27a..30e2d2686d 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -437,6 +437,14 @@ R: Zhiguang Liu  [LiuZhiguang001]
 R: Ray Ni  [niruiyu]
 R: Gua Guo  [gguo11837463]
 
+MdeModulePkg: Trace Hub debug message related library instance
+F: MdeModulePkg/Library/TraceHubDebugSysTLib/
+F: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
+M: Gua Guo  [gguo11837463]
+M: Prakashan Krishnadas Veliyathuparambil 
 [kprakas2]
+R: Chan Laura  [lauracha]
+R: K N Karthik  [karthikkabbigere1]
+
 MdePkg
 F: MdePkg/
 W: https://github.com/tianocore/tianocore.github.io/wiki/MdePkg
@@ -444,6 +452,16 @@ M: Michael D Kinney  [mdkinney]
 M: Liming Gao  [lgao4]
 R: Zhiguang Liu  [LiuZhiguang001]
 
+MdePkg: Trace Hub debug message related library instance
+F: MdePkg/Library/TraceHubDebugSysTLibNull/
+F: MdePkg/Library/MipiSysTLib/
+F: MdePkg/Include/Library/TraceHubDebugSysTLib.h
+F: MdePkg/Include/Library/MipiSysTLib.h
+M: Gua Guo  [gguo11837463]
+M: Prakashan Krishnadas Veliyathuparambil 
 [kprakas2]
+R: Chan Laura  [lauracha]
+R: K N Karthik  [karthikkabbigere1]
+
 NetworkPkg
 F: NetworkPkg/
 W: https://github.com/tianocore/tianocore.github.io/wiki/NetworkPkg
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v9 2/5] MdePkg: Add MipiSysTLib library

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library provides functions consuming MIPI SYS-T submodule.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 MdePkg/Include/Library/MipiSysTLib.h   |  66 ++
 MdePkg/Library/MipiSysTLib/GenMipiSystH.py | 132 
 MdePkg/Library/MipiSysTLib/MipiSysTLib.c   | 123 
 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf |  52 ++
 MdePkg/Library/MipiSysTLib/Platform.c  | 164 +
 MdePkg/Library/MipiSysTLib/Platform.h  | 138 
 MdePkg/Library/MipiSysTLib/Readme.md   |  25 +
 MdePkg/Library/MipiSysTLib/mipi_syst.h | 789 +
 MdePkg/MdePkg.ci.yaml  |  12 +-
 MdePkg/MdePkg.dec  |   9 +
 MdePkg/MdePkg.dsc  |   1 +
 11 files changed, 1508 insertions(+), 3 deletions(-)
 create mode 100644 MdePkg/Include/Library/MipiSysTLib.h
 create mode 100644 MdePkg/Library/MipiSysTLib/GenMipiSystH.py
 create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.c
 create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
 create mode 100644 MdePkg/Library/MipiSysTLib/Platform.c
 create mode 100644 MdePkg/Library/MipiSysTLib/Platform.h
 create mode 100644 MdePkg/Library/MipiSysTLib/Readme.md
 create mode 100644 MdePkg/Library/MipiSysTLib/mipi_syst.h

diff --git a/MdePkg/Include/Library/MipiSysTLib.h 
b/MdePkg/Include/Library/MipiSysTLib.h
new file mode 100644
index 00..4ced1c02cd
--- /dev/null
+++ b/MdePkg/Include/Library/MipiSysTLib.h
@@ -0,0 +1,66 @@
+/** @file
+This header file declares functions consuming MIPI Sys-T submodule.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef MIPI_SYST_LIB_H_
+#define MIPI_SYST_LIB_H_
+
+/**
+  Invoke initialization function in Mipi Sys-T module to initialize Mipi Sys-T 
handle.
+
+  @param[in, out]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.
+
+  @retval RETURN_SUCCESS  MIPI_SYST_HANDLE instance was initialized.
+  @retval Other   MIPI_SYST_HANDLE instance was not initialized.
+**/
+RETURN_STATUS
+EFIAPI
+InitMipiSystHandle (
+  IN OUT VOID  *MipiSystHandle
+  );
+
+/**
+  Invoke write_debug_string function in Mipi Sys-T module.
+
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.
+  @param[in]  SeveritySeverity type of input message.
+  @param[in]  Len Length of data buffer.
+  @param[in]  Str A pointer to data buffer.
+
+  @retval RETURN_SUCCESS   Data in buffer was processed.
+  @retval RETURN_ABORTED   No data need to be written to Trace Hub.
+  @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle or Str is a 
NULL pointer.
+**/
+RETURN_STATUS
+EFIAPI
+MipiSystWriteDebug (
+  INVOID*MipiSystHandle,
+  INUINT32  Severity,
+  INUINT16  Len,
+  IN CONST  CHAR8   *Str
+  );
+
+/**
+  Invoke catalog_write_message function in Mipi Sys-T module.
+
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.
+  @param[in]  SeveritySeverity type of input message.
+  @param[in]  CatId   Catalog Id.
+
+  @retval RETURN_SUCCESS   Data in buffer was processed.
+  @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle is a NULL 
pointer.
+**/
+RETURN_STATUS
+EFIAPI
+MipiSystWriteCatalog (
+  IN  VOID*MipiSystHandle,
+  IN  UINT32  Severity,
+  IN  UINT64  CatId
+  );
+
+#endif // MIPI_SYST_LIB_H_
diff --git a/MdePkg/Library/MipiSysTLib/GenMipiSystH.py 
b/MdePkg/Library/MipiSysTLib/GenMipiSystH.py
new file mode 100644
index 00..ee48285590
--- /dev/null
+++ b/MdePkg/Library/MipiSysTLib/GenMipiSystH.py
@@ -0,0 +1,132 @@
+## @file
+#  This python script update content from mipi_syst.h.in in mipi sys-T 
submodule
+#  and generate it as mipi_syst.h. mipi_syst.h include necessary data 
structure and
+#  definition that will be consumed by MipiSysTLib itself, mipi sys-T submodule
+#  and other library.
+#
+#  This script needs to be done once by a developer when adding some
+#  project-relating definition or a new version of mipi_syst.h.in is released.
+#  Normal users do not need to do this, since the resulting file is stored
+#  in the EDK2 git repository.
+#
+#  Customize structures mentioned below to generate updated mipi_syst.h file:
+#  1. ExistingValueToBeReplaced
+#   -> To replace existing value in mipi_syst.h.in to newer one.
+#  2. ExistingDefinitionToBeRemoved
+#   -> To #undef a existing definition in mipi_syst.h.in.
+#  3. NewItemToBeAdded
+#   -> Items in this structure will be placed at the end of mipi_syst.h as 
a customized section.
+#
+#  Run GenMipiSystH.py without any parameters as normal python script after 

[edk2-devel] [PATCH v9 4/5] MdeModulePkg: Add TraceHubDebugSysTLib library

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library provides API to dump Trace Hub message.

Cc: Michael D Kinney 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 .../Include/Guid/TraceHubDebugInfoHob.h   |  24 ++
 .../BaseTraceHubDebugSysTLib.c| 245 +++
 .../BaseTraceHubDebugSysTLib.inf  |  44 +++
 .../DxeSmmTraceHubDebugSysTLib.c  | 263 
 .../DxeSmmTraceHubDebugSysTLib.inf|  51 
 .../InternalTraceHubApi.c |  74 +
 .../InternalTraceHubApi.h |  37 +++
 .../InternalTraceHubApiCommon.c   | 200 +
 .../InternalTraceHubApiCommon.h   | 119 
 .../PeiTraceHubDebugSysTLib.c | 282 ++
 .../PeiTraceHubDebugSysTLib.inf   |  50 
 .../Library/TraceHubDebugSysTLib/Readme.md|  26 ++
 MdeModulePkg/MdeModulePkg.dec |  21 ++
 MdeModulePkg/MdeModulePkg.dsc |   3 +
 MdeModulePkg/MdeModulePkg.uni |  18 ++
 15 files changed, 1457 insertions(+)
 create mode 100644 MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.inf
 create mode 100644 MdeModulePkg/Library/TraceHubDebugSysTLib/Readme.md

diff --git a/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h 
b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
new file mode 100644
index 00..367f97dc90
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
@@ -0,0 +1,24 @@
+/** @file
+This header file declares Trace Hub related structure.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef TRACE_HUB_DEBUG_INFO_HOB_H_
+#define TRACE_HUB_DEBUG_INFO_HOB_H_
+
+#define TRACEHUB_DEBUG_INFO_HOB_REVISION  1
+
+typedef struct {
+  UINT16 Revision;// Structure revision
+  BOOLEANFlag;// Flag to enable or disable Trace Hub debug 
message.
+  UINT8  DebugLevel;  // Debug level for Trace Hub.
+  UINT8  Rvsd[4]; // Reserved for future use
+  UINT64 TraceHubMmioAddress; // MMIO address where Trace Hub debug 
message output to.
+} TRACEHUB_DEBUG_INFO_HOB;
+
+extern GUID  gTraceHubDebugInfoHobGuid;
+
+#endif // TRACE_HUB_DEBUG_INFO_HOB_H_
diff --git 
a/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c 
b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
new file mode 100644
index 00..45dfd3127a
--- /dev/null
+++ b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
@@ -0,0 +1,245 @@
+/** @file
+System prints Trace Hub message in SEC/PEI/DXE/SMM based on fixed PCDs.
+Only support single Trace Hub debug instance.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "InternalTraceHubApiCommon.h"
+#include "InternalTraceHubApi.h"
+
+/**
+  Write debug string to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Buffer   A pointer to the data buffer.
+  @param[in]  NumberOfBytesThe size of data buffer.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTDebugWrite (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT8*Buffer,
+  IN UINTNNumberOfBytes
+  )
+{
+  MIPI_SYST_HANDLE  MipiSystHandle;
+  MIPI_SYST_HEADER  MipiSystHeader;
+  RETURN_STATUS Status;
+  UINT32DbgInstCount;
+  UINT16Index;
+
+  if (NumberOfBytes == 0) {
+//
+// No data need to be written to Trace Hub
+//
+return 

[edk2-devel] [PATCH v9 0/5] Trace Hub debug library support

2023-05-10 Thread Guo, Gua
From: Gua Guo 

V9: Add more maintainers into CC list
- https://github.com/tianocore/edk2/pull/3901
  F: *
  M: Andrew Fish  [ajfish]
  M: Leif Lindholm  [leiflindholm]
  M: Michael D Kinney  [mdkinney]

  MdeModulePkg
  M: Jian J Wang  [jwang36]
  M: Liming Gao  [lgao4]

  .pytool/
  M: Sean Brogan  [spbrogan]
  M: Michael Kubacki  [makubacki]
  R: Michael D Kinney  [mdkinney]
  R: Liming Gao  [lgao4]

  MdePkg/
  M: Michael D Kinney  [mdkinney]
  M: Liming Gao  [lgao4]
  R: Zhiguang Liu  [LiuZhiguang001]


V8: Add MdeModulePkg maintainers into CC list

V7: Miss one patch on V6

V6:
- https://github.com/tianocore/edk2/pull/3901
  Split submodule into new patch
  Fix formatting issue
  Add Review-by message
  Offline check with Victor to use my sign-off name.

V5: if no other open, it will be final change
- https://github.com/tianocore/edk2/pull/3901
  Fix random exception when long run catalog debug message

V4
- https://github.com/tianocore/edk2/pull/3901 - Done
  Enhance SwapBytesGuid to use CopyGuid instead of CopyMem, to make implement 
code more simple.

V3
- https://github.com/tianocore/edk2/pull/3901 - Done
  - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why 
MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
Solution: Remove this macro, use Library Constructor to allocate it 
dynamiclly.
  - Open: 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c: 
SwapBytesGuid () algorithm wrong.
Solution: Follow correct algorithm to implement it.
VOID
EFIAPI
SwapBytesGuid (
  IN  GUID  *Guid,<--- In PreMem, guid is global data 
so region is readonly, add output data to support it.
  OUT GUID  *ConvertedGuid
);

  - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D
Solution: use *_*_*_CC_FLAGS  = -DMIPI_SYST_STATIC to unified both.


V2
- https://github.com/tianocore/edk2/pull/3901
  - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why 
MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
  - Open: 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c: 
SwapBytesGuid () algorithm wrong.
  - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D

V1
Previous PR:
- https://github.com/tianocore/edk2/pull/3613
  - TraceHubDebugLib without submodule - Reject

- https://github.com/tianocore/edk2/pull/3793
  - TraceHubDebugLib with submodule and without seperate into MipiSysTLib and 
TraceHubDebugLib - Reject

Gua Guo (5):
  MdePkg: Add mipisyst submodule
  MdePkg: Add MipiSysTLib library
  MdePkg: Add NULL library of TraceHubDebugSysTLib
  MdeModulePkg: Add TraceHubDebugSysTLib library
  Maintainers.txt: Update reviewers and maintainers for
TraceHubDebugLib.

 .gitmodules   |   3 +
 .pytool/CISettings.py |   2 +
 Maintainers.txt   |  18 +
 .../Include/Guid/TraceHubDebugInfoHob.h   |  24 +
 .../BaseTraceHubDebugSysTLib.c| 245 ++
 .../BaseTraceHubDebugSysTLib.inf  |  44 +
 .../DxeSmmTraceHubDebugSysTLib.c  | 263 ++
 .../DxeSmmTraceHubDebugSysTLib.inf|  51 ++
 .../InternalTraceHubApi.c |  74 ++
 .../InternalTraceHubApi.h |  37 +
 .../InternalTraceHubApiCommon.c   | 200 +
 .../InternalTraceHubApiCommon.h   | 119 +++
 .../PeiTraceHubDebugSysTLib.c | 282 +++
 .../PeiTraceHubDebugSysTLib.inf   |  50 ++
 .../Library/TraceHubDebugSysTLib/Readme.md|  26 +
 MdeModulePkg/MdeModulePkg.dec |  21 +
 MdeModulePkg/MdeModulePkg.dsc |   3 +
 MdeModulePkg/MdeModulePkg.uni |  18 +
 MdePkg/Include/Library/MipiSysTLib.h  |  66 ++
 MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 ++
 MdePkg/Library/MipiSysTLib/GenMipiSystH.py| 132 +++
 MdePkg/Library/MipiSysTLib/MipiSysTLib.c  | 123 +++
 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf|  52 ++
 MdePkg/Library/MipiSysTLib/Platform.c | 164 
 MdePkg/Library/MipiSysTLib/Platform.h | 138 +++
 MdePkg/Library/MipiSysTLib/Readme.md  |  25 +
 MdePkg/Library/MipiSysTLib/mipi_syst.h| 789 ++
 MdePkg/Library/MipiSysTLib/mipisyst   |   1 +
 .../TraceHubDebugSysTLibNull.c|  76 ++
 .../TraceHubDebugSysTLibNull.inf  |  29 +
 MdePkg/MdePkg.ci.yaml |  12 +-
 MdePkg/MdePkg.dec |   9 +
 MdePkg/MdePkg.dsc |   2 +
 ReadMe.rst|   1 +
 34 files changed, 3177 insertions(+), 3 deletions(-)
 create mode 100644 MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.inf
 create mode 100644 

[edk2-devel] [PATCH v9 1/5] MdePkg: Add mipisyst submodule

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library provides functions consuming MIPI SYS-T submodule.

Cc: Michael D Kinney 
Cc: Andrew Fish 
Cc: Leif Lindholm 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Sean Brogan 
Cc: Michael Kubacki 
Signed-off-by: Guo Gua 
Reviewed-by: Leif Lindholm 
Reviewed-by: Michael D Kinney 
---
 .gitmodules | 3 +++
 .pytool/CISettings.py   | 2 ++
 MdePkg/Library/MipiSysTLib/mipisyst | 1 +
 ReadMe.rst  | 1 +
 4 files changed, 7 insertions(+)
 create mode 16 MdePkg/Library/MipiSysTLib/mipisyst

diff --git a/.gitmodules b/.gitmodules
index 6211c59724..387794f05e 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -29,3 +29,6 @@
 [submodule "MdePkg/Library/BaseFdtLib/libfdt"]
path = MdePkg/Library/BaseFdtLib/libfdt
url = https://github.com/devicetree-org/pylibfdt.git
+[submodule "MdePkg/Library/MipiSysTLib/mipisyst"]
+   path = MdePkg/Library/MipiSysTLib/mipisyst
+   url = https://github.com/MIPI-Alliance/public-mipi-sys-t.git
diff --git a/.pytool/CISettings.py b/.pytool/CISettings.py
index 2fb99f2a17..6fb7342f81 100644
--- a/.pytool/CISettings.py
+++ b/.pytool/CISettings.py
@@ -197,6 +197,8 @@ class Settings(CiBuildSettingsManager, 
UpdateSettingsManager, SetupSettingsManag
 "UnitTestFrameworkPkg/Library/SubhookLib/subhook", False))
 rs.append(RequiredSubmodule(
 "MdePkg/Library/BaseFdtLib/libfdt", False))
+rs.append(RequiredSubmodule(
+"MdePkg/Library/MipiSysTLib/mipisyst", False))
 return rs
 
 def GetName(self):
diff --git a/MdePkg/Library/MipiSysTLib/mipisyst 
b/MdePkg/Library/MipiSysTLib/mipisyst
new file mode 16
index 00..370b5944c0
--- /dev/null
+++ b/MdePkg/Library/MipiSysTLib/mipisyst
@@ -0,0 +1 @@
+Subproject commit 370b5944c046bab043dd8b133727b2135af7747a
diff --git a/ReadMe.rst b/ReadMe.rst
index d46c534229..ed1d482245 100644
--- a/ReadMe.rst
+++ b/ReadMe.rst
@@ -97,6 +97,7 @@ that are covered by additional licenses.
 -  `UnitTestFrameworkPkg/Library/SubhookLib/subhook 
`__
 -  `RedfishPkg/Library/JsonLib/jansson 
`__
 -  `MdePkg/Library/BaseFdtLib/libfdt 
`__
+-  `MdePkg/Library/MipiSysTLib/mipisyst 
`__
 
 The EDK II Project is composed of packages. The maintainers for each package
 are listed in `Maintainers.txt `__.
-- 
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104631): https://edk2.groups.io/g/devel/message/104631
Mute This Topic: https://groups.io/mt/98817580/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 3/3] OvmfPkg/Bhyve: install ACPI tables from memory

2023-05-10 Thread Rebecca Cran

Reviewed-by: Rebecca Cran 


On 5/10/23 01:23, Corvin Köhne wrote:

It's much easier to create configuration dependend ACPI tables for bhyve
than for OVMF. For this reason, don't use the statically created ACPI
tables provided by OVMF. Instead prefer the dynamically created ACPI
tables of bhyve. If bhyve provides no ACPI tables or we are unable to
detect those, fall back to OVMF tables.

Ideally, we use the qemu fwcfg interface to pass the ACPI tables from
bhyve to OVMF. bhyve will support this in the future. However, current
bhyve executables don't support passing ACPI tables by the qemu fwcfg
interface. They just copy the ACPI into main memory. For that reason,
pick up the ACPI tables from main memory.

Signed-off-by: Corvin Köhne 
Acked-by: Gerd Hoffmann 
Cc: Ard Biesheuvel 
Cc: Jiewen Yao 
Cc: Jordan Justen 
Cc: Rebecca Cran 
Cc: Peter Grehan 
---
  OvmfPkg/Bhyve/BhyveX64.dsc|  1 +
  .../Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf |  1 +
  OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c  | 37 ++-
  3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index d0d2712c5662..465b81ffcd51 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -341,6 +341,7 @@ [LibraryClasses.common.UEFI_DRIVER]
PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
  
  [LibraryClasses.common.DXE_DRIVER]

+  AcpiPlatformLib|OvmfPkg/Library/AcpiPlatformLib/DxeAcpiPlatformLib.inf
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf

MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf 
b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
index 94c65f32dcab..75ed8e4a7deb 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -35,6 +35,7 @@ [Packages]
UefiCpuPkg/UefiCpuPkg.dec
  
  [LibraryClasses]

+  AcpiPlatformLib
BaseLib
BaseMemoryLib
BhyveFwCtlLib
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c 
b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
index 999e9f151ebb..1e1c90614ea1 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatform.c
@@ -10,6 +10,11 @@
  
  #include "AcpiPlatform.h"
  
+#include  // InstallAcpiTablesFromMemory()

+
+#define BHYVE_ACPI_PHYSICAL_ADDRESS  ((UINTN)0x000F2400)
+#define BHYVE_BIOS_PHYSICAL_END  ((UINTN)0x0010)
+
  EFI_STATUS
  EFIAPI
  InstallAcpiTable (
@@ -241,7 +246,37 @@ InstallAcpiTables (
IN   EFI_ACPI_TABLE_PROTOCOL  *AcpiTable
)
  {
-  EFI_STATUS  Status;
+  EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER  *Rsdp;
+  EFI_STATUSStatus;
+
+  Status = GetAcpiRsdpFromMemory (
+ BHYVE_ACPI_PHYSICAL_ADDRESS,
+ BHYVE_BIOS_PHYSICAL_END,
+ 
+ );
+  if (EFI_ERROR (Status)) {
+return Status;
+  }
+
+  Status = InstallAcpiTablesFromRsdp (
+ AcpiTable,
+ Rsdp
+ );
+  if (!EFI_ERROR (Status)) {
+return EFI_SUCCESS;
+  }
+
+  if (Status != EFI_NOT_FOUND) {
+DEBUG (
+  (
+   DEBUG_WARN,
+   "%a: unable to install bhyve's ACPI tables (%r)\n",
+   __func__,
+   Status
+  )
+  );
+return Status;
+  }
  
Status = InstallOvmfFvTables (AcpiTable);
  



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104629): https://edk2.groups.io/g/devel/message/104629
Mute This Topic: https://groups.io/mt/98801217/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 1/1] Silicon/Marvell: Fix setting I2cStatus in MvI2cEnableConf

2023-05-10 Thread Rebecca Cran

Pushed as 1f8ff3b1c03fab1fc5af285c2d939904e560c1c2.

On 5/10/23 15:56, Marcin Wojtas wrote:

śr., 10 maj 2023 o 17:38 Rebecca Cran  napisał(a):

Fix setting I2cStatus in MvI2cEnableConf.

Signed-off-by: Rebecca Cran 
---
  Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c 
b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
index b4dda56bbd2f..a8ff722aab22 100755
--- a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
+++ b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
@@ -777,7 +777,7 @@ MvI2cEnableConf (
  {
/* do nothing */
if (I2cStatus != NULL)
-I2cStatus = EFI_SUCCESS;
+*I2cStatus = EFI_SUCCESS;
if (Event != NULL)
  gBS->SignalEvent(Event);
return EFI_SUCCESS;
--
2.39.2


Reviewed-by: Marcin Wojtas 

Thanks!
Marcin



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




Re: [edk2-devel] [edk2-stable202305 PATCH 0/3] BaseTools: Fix PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat

2023-05-10 Thread Rebecca Cran

Mike/Liming:


I'd like to get this in for the upcoming stable tag.

The PR is https://github.com/tianocore/edk2/pull/4363 .


--
Rebecca Cran


On 5/8/23 22:25, Rebecca Cran wrote:

Fix some issues in BaseTools:

- When the Pip BaseTools are used, make sure PYTHONPATH is set.
- Fix Tests\TestTools.py so it works on Windows.
- Cleanup toolsetup.bat

Rebecca Cran (3):
   BaseTools: Update toolsetup.bat to not use BASETOOLS_PYTHON_SOURCE
   BaseTools: only print the environment once in toolsetup.bat
   BaseTools: Update Tests/TestTools.py to allow it to work on Windows

  BaseTools/Tests/TestTools.py |  4 +-
  BaseTools/toolsetup.bat  | 40 +---
  2 files changed, 21 insertions(+), 23 deletions(-)




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104627): https://edk2.groups.io/g/devel/message/104627
Mute This Topic: https://groups.io/mt/98777504/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 1/1] BaseTools/Plugin: Too many execute files cause "cmd too long" failure

2023-05-10 Thread Guo, Gua
@Kinney, Michael D

Could we merge the bug patch before code freeze ? The patch can help unlock 
command too long issue on Windows command prompt.

Thanks,
Gua

-Original Message-
From: Michael Kubacki  
Sent: Thursday, May 11, 2023 5:41 AM
To: devel@edk2.groups.io; Guo, Gua 
Cc: Kinney, Michael D ; Sean Brogan 

Subject: Re: [edk2-devel] [PATCH v4 1/1] BaseTools/Plugin: Too many execute 
files cause "cmd too long" failure

Reviewed-by: Michael Kubacki 

On 5/10/2023 1:14 AM, Guo, Gua wrote:
> From: Gua Guo 
> 
> Windows command prompt have 8191 characters limitation, enhance it to 
> make command too long can be resloved.
> 
> Provide an example, if have too many cov files, it causes to run 
> single command over the 8191 characters limitation.
>> OpenCppCoverage
>>   --export_type binary:coverage.cov
>>   --working_dir={workspace}Build
>>   --input_coverage=AAA.cov
>>   ...
>>   --input_coverage=NNN.cov
> 
> The solution is passing many coverage files in single command line to 
> breaking it up into many command lines with one coverage file per 
> command line in order to prevent single line is over to 8191 characters.
> 
> - Command Line 1
>> OpenCppCoverage
>>   --export_type binary:coverage.cov
>>   --working_dir={workspace}Build
>>   --input_coverage=AAA.cov
>>   --input_coverage=coverage.cov
> ...
> 
> - Command Line N
>> OpenCppCoverage
>>   --export_type binary:coverage.cov
>>   --working_dir={workspace}Build
>>   --input_coverage=NNN.cov
>>   --input_coverage=coverage.cov
> 
> Cc: Michael D Kinney 
> Cc: Sean Brogan 
> Cc: Michael Kubacki 
> Signed-off-by: Gua Guo 
> ---
>   .../HostBasedUnitTestRunner.py| 46 +--
>   1 file changed, 41 insertions(+), 5 deletions(-)
> 
> diff --git 
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py 
> b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> index d993de9412..2e5c462cd2 100644
> --- 
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> +++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner
> +++ .py
> @@ -205,28 +205,64 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
>   testList = glob.glob(os.path.join(buildOutputBase, 
> "**","*Test*.exe"), recursive=True)
> 
>   workspace = thebuilder.env.GetValue("WORKSPACE")
> 
>   workspace = (workspace + os.sep) if workspace[-1] != os.sep 
> else workspace
> 
> +workspaceBuild = os.path.join(workspace, 'Build')
> 
>   # Generate coverage file
> 
>   coverageFile = ""
> 
>   for testFile in testList:
> 
>   ret = RunCmd("OpenCppCoverage", f"--source {workspace} 
> --export_type binary:{testFile}.cov -- {testFile}")
> 
> -coverageFile += " --input_coverage=" + testFile + ".cov"
> 
> +if ret != 0:
> 
> +logging.error("UnitTest Coverage: Failed to collect 
> + coverage data.")
> 
> +return 1
> 
> +
> 
> +coverageFile  = f" --input_coverage={testFile}.cov"
> 
> +totalCoverageFile = os.path.join(buildOutputBase, 
> + 'coverage.cov')
> 
> +if os.path.isfile(totalCoverageFile):
> 
> +coverageFile += f" --input_coverage={totalCoverageFile}"
> 
> +ret = RunCmd(
> 
> +"OpenCppCoverage",
> 
> +f"--export_type binary:{totalCoverageFile} " +
> 
> +f"--working_dir={workspaceBuild} " +
> 
> +f"{coverageFile}"
> 
> +)
> 
>   if ret != 0:
> 
>   logging.error("UnitTest Coverage: Failed to collect 
> coverage data.")
> 
>   return 1
> 
>   
> 
>   # Generate and XML file if requested.by each package
> 
> -ret = RunCmd("OpenCppCoverage", f"--export_type 
> cobertura:{os.path.join(buildOutputBase, 'coverage.xml')} 
> --working_dir={workspace}Build {coverageFile}")
> 
> +ret = RunCmd(
> 
> +"OpenCppCoverage",
> 
> +f"--export_type cobertura:{os.path.join(buildOutputBase, 
> + 'coverage.xml')} " +
> 
> +f"--working_dir={workspaceBuild} " +
> 
> +f"--input_coverage={totalCoverageFile} "
> 
> +)
> 
>   if ret != 0:
> 
>   logging.error("UnitTest Coverage: Failed to generate 
> cobertura format xml in single package.")
> 
>   return 1
> 
>   
> 
>   # Generate total report XML file for all package
> 
> -testCoverageList = glob.glob(os.path.join(workspace, "Build", 
> "**","*Test*.exe.cov"), recursive=True)
> 
> +testCoverageList = glob.glob(os.path.join(workspace, "Build", 
> + "**", "*Test*.exe.cov"), recursive=True)
> 
>   coverageFile = ""
> 
> +totalCoverageFile = os.path.join(workspaceBuild, 
> + 'coverage.cov')
> 
>   for testCoverage in testCoverageList:
> 
> -coverageFile += " --input_coverage=" + testCoverage
> 
> +

Re: [edk2-devel] [PATCH edk2-platforms 1/1] Silicon/Marvell: Fix setting I2cStatus in MvI2cEnableConf

2023-05-10 Thread Marcin Wojtas via groups.io
śr., 10 maj 2023 o 17:38 Rebecca Cran  napisał(a):
>
> Fix setting I2cStatus in MvI2cEnableConf.
>
> Signed-off-by: Rebecca Cran 
> ---
>  Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c 
> b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
> index b4dda56bbd2f..a8ff722aab22 100755
> --- a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
> +++ b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
> @@ -777,7 +777,7 @@ MvI2cEnableConf (
>  {
>/* do nothing */
>if (I2cStatus != NULL)
> -I2cStatus = EFI_SUCCESS;
> +*I2cStatus = EFI_SUCCESS;
>if (Event != NULL)
>  gBS->SignalEvent(Event);
>return EFI_SUCCESS;
> --
> 2.39.2
>

Reviewed-by: Marcin Wojtas 

Thanks!
Marcin


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




[edk2-devel] [PATCH v8 4/5] MdeModulePkg: Add TraceHubDebugSysTLib library

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library provides API to dump Trace Hub message.

Cc: Michael D Kinney 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Cc: Jian J Wang 
Cc: Liming Gao 
Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 .../Include/Guid/TraceHubDebugInfoHob.h   |  24 ++
 .../BaseTraceHubDebugSysTLib.c| 245 +++
 .../BaseTraceHubDebugSysTLib.inf  |  44 +++
 .../DxeSmmTraceHubDebugSysTLib.c  | 263 
 .../DxeSmmTraceHubDebugSysTLib.inf|  51 
 .../InternalTraceHubApi.c |  74 +
 .../InternalTraceHubApi.h |  37 +++
 .../InternalTraceHubApiCommon.c   | 200 +
 .../InternalTraceHubApiCommon.h   | 119 
 .../PeiTraceHubDebugSysTLib.c | 282 ++
 .../PeiTraceHubDebugSysTLib.inf   |  50 
 .../Library/TraceHubDebugSysTLib/Readme.md|  26 ++
 MdeModulePkg/MdeModulePkg.dec |  21 ++
 MdeModulePkg/MdeModulePkg.dsc |   3 +
 MdeModulePkg/MdeModulePkg.uni |  18 ++
 15 files changed, 1457 insertions(+)
 create mode 100644 MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.inf
 create mode 100644 MdeModulePkg/Library/TraceHubDebugSysTLib/Readme.md

diff --git a/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h 
b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
new file mode 100644
index 00..367f97dc90
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
@@ -0,0 +1,24 @@
+/** @file
+This header file declares Trace Hub related structure.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef TRACE_HUB_DEBUG_INFO_HOB_H_
+#define TRACE_HUB_DEBUG_INFO_HOB_H_
+
+#define TRACEHUB_DEBUG_INFO_HOB_REVISION  1
+
+typedef struct {
+  UINT16 Revision;// Structure revision
+  BOOLEANFlag;// Flag to enable or disable Trace Hub debug 
message.
+  UINT8  DebugLevel;  // Debug level for Trace Hub.
+  UINT8  Rvsd[4]; // Reserved for future use
+  UINT64 TraceHubMmioAddress; // MMIO address where Trace Hub debug 
message output to.
+} TRACEHUB_DEBUG_INFO_HOB;
+
+extern GUID  gTraceHubDebugInfoHobGuid;
+
+#endif // TRACE_HUB_DEBUG_INFO_HOB_H_
diff --git 
a/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c 
b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
new file mode 100644
index 00..45dfd3127a
--- /dev/null
+++ b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
@@ -0,0 +1,245 @@
+/** @file
+System prints Trace Hub message in SEC/PEI/DXE/SMM based on fixed PCDs.
+Only support single Trace Hub debug instance.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "InternalTraceHubApiCommon.h"
+#include "InternalTraceHubApi.h"
+
+/**
+  Write debug string to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Buffer   A pointer to the data buffer.
+  @param[in]  NumberOfBytesThe size of data buffer.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTDebugWrite (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT8*Buffer,
+  IN UINTNNumberOfBytes
+  )
+{
+  MIPI_SYST_HANDLE  MipiSystHandle;
+  MIPI_SYST_HEADER  MipiSystHeader;
+  RETURN_STATUS Status;
+  UINT32DbgInstCount;
+  UINT16Index;
+
+  if (NumberOfBytes == 0) {
+//
+// No data need to be written to Trace Hub
+//
+return 

[edk2-devel] [PATCH v8 5/5] Maintainers.txt: Update reviewers and maintainers for TraceHubDebugLib.

2023-05-10 Thread Guo, Gua
From: Gua Guo 

Update reviewers and maintainers for TraceHubDebugSysTlib.

Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 Maintainers.txt | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index 09d04af27a..30e2d2686d 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -437,6 +437,14 @@ R: Zhiguang Liu  [LiuZhiguang001]
 R: Ray Ni  [niruiyu]
 R: Gua Guo  [gguo11837463]
 
+MdeModulePkg: Trace Hub debug message related library instance
+F: MdeModulePkg/Library/TraceHubDebugSysTLib/
+F: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
+M: Gua Guo  [gguo11837463]
+M: Prakashan Krishnadas Veliyathuparambil 
 [kprakas2]
+R: Chan Laura  [lauracha]
+R: K N Karthik  [karthikkabbigere1]
+
 MdePkg
 F: MdePkg/
 W: https://github.com/tianocore/tianocore.github.io/wiki/MdePkg
@@ -444,6 +452,16 @@ M: Michael D Kinney  [mdkinney]
 M: Liming Gao  [lgao4]
 R: Zhiguang Liu  [LiuZhiguang001]
 
+MdePkg: Trace Hub debug message related library instance
+F: MdePkg/Library/TraceHubDebugSysTLibNull/
+F: MdePkg/Library/MipiSysTLib/
+F: MdePkg/Include/Library/TraceHubDebugSysTLib.h
+F: MdePkg/Include/Library/MipiSysTLib.h
+M: Gua Guo  [gguo11837463]
+M: Prakashan Krishnadas Veliyathuparambil 
 [kprakas2]
+R: Chan Laura  [lauracha]
+R: K N Karthik  [karthikkabbigere1]
+
 NetworkPkg
 F: NetworkPkg/
 W: https://github.com/tianocore/tianocore.github.io/wiki/NetworkPkg
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v8 2/5] MdePkg: Add MipiSysTLib library

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library provides functions consuming MIPI SYS-T submodule.

Cc: Michael D Kinney 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 MdePkg/Include/Library/MipiSysTLib.h   |  66 ++
 MdePkg/Library/MipiSysTLib/GenMipiSystH.py | 132 
 MdePkg/Library/MipiSysTLib/MipiSysTLib.c   | 123 
 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf |  52 ++
 MdePkg/Library/MipiSysTLib/Platform.c  | 164 +
 MdePkg/Library/MipiSysTLib/Platform.h  | 138 
 MdePkg/Library/MipiSysTLib/Readme.md   |  25 +
 MdePkg/Library/MipiSysTLib/mipi_syst.h | 789 +
 MdePkg/MdePkg.ci.yaml  |  12 +-
 MdePkg/MdePkg.dec  |   9 +
 MdePkg/MdePkg.dsc  |   1 +
 11 files changed, 1508 insertions(+), 3 deletions(-)
 create mode 100644 MdePkg/Include/Library/MipiSysTLib.h
 create mode 100644 MdePkg/Library/MipiSysTLib/GenMipiSystH.py
 create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.c
 create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
 create mode 100644 MdePkg/Library/MipiSysTLib/Platform.c
 create mode 100644 MdePkg/Library/MipiSysTLib/Platform.h
 create mode 100644 MdePkg/Library/MipiSysTLib/Readme.md
 create mode 100644 MdePkg/Library/MipiSysTLib/mipi_syst.h

diff --git a/MdePkg/Include/Library/MipiSysTLib.h 
b/MdePkg/Include/Library/MipiSysTLib.h
new file mode 100644
index 00..4ced1c02cd
--- /dev/null
+++ b/MdePkg/Include/Library/MipiSysTLib.h
@@ -0,0 +1,66 @@
+/** @file
+This header file declares functions consuming MIPI Sys-T submodule.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef MIPI_SYST_LIB_H_
+#define MIPI_SYST_LIB_H_
+
+/**
+  Invoke initialization function in Mipi Sys-T module to initialize Mipi Sys-T 
handle.
+
+  @param[in, out]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.
+
+  @retval RETURN_SUCCESS  MIPI_SYST_HANDLE instance was initialized.
+  @retval Other   MIPI_SYST_HANDLE instance was not initialized.
+**/
+RETURN_STATUS
+EFIAPI
+InitMipiSystHandle (
+  IN OUT VOID  *MipiSystHandle
+  );
+
+/**
+  Invoke write_debug_string function in Mipi Sys-T module.
+
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.
+  @param[in]  SeveritySeverity type of input message.
+  @param[in]  Len Length of data buffer.
+  @param[in]  Str A pointer to data buffer.
+
+  @retval RETURN_SUCCESS   Data in buffer was processed.
+  @retval RETURN_ABORTED   No data need to be written to Trace Hub.
+  @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle or Str is a 
NULL pointer.
+**/
+RETURN_STATUS
+EFIAPI
+MipiSystWriteDebug (
+  INVOID*MipiSystHandle,
+  INUINT32  Severity,
+  INUINT16  Len,
+  IN CONST  CHAR8   *Str
+  );
+
+/**
+  Invoke catalog_write_message function in Mipi Sys-T module.
+
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.
+  @param[in]  SeveritySeverity type of input message.
+  @param[in]  CatId   Catalog Id.
+
+  @retval RETURN_SUCCESS   Data in buffer was processed.
+  @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle is a NULL 
pointer.
+**/
+RETURN_STATUS
+EFIAPI
+MipiSystWriteCatalog (
+  IN  VOID*MipiSystHandle,
+  IN  UINT32  Severity,
+  IN  UINT64  CatId
+  );
+
+#endif // MIPI_SYST_LIB_H_
diff --git a/MdePkg/Library/MipiSysTLib/GenMipiSystH.py 
b/MdePkg/Library/MipiSysTLib/GenMipiSystH.py
new file mode 100644
index 00..ee48285590
--- /dev/null
+++ b/MdePkg/Library/MipiSysTLib/GenMipiSystH.py
@@ -0,0 +1,132 @@
+## @file
+#  This python script update content from mipi_syst.h.in in mipi sys-T 
submodule
+#  and generate it as mipi_syst.h. mipi_syst.h include necessary data 
structure and
+#  definition that will be consumed by MipiSysTLib itself, mipi sys-T submodule
+#  and other library.
+#
+#  This script needs to be done once by a developer when adding some
+#  project-relating definition or a new version of mipi_syst.h.in is released.
+#  Normal users do not need to do this, since the resulting file is stored
+#  in the EDK2 git repository.
+#
+#  Customize structures mentioned below to generate updated mipi_syst.h file:
+#  1. ExistingValueToBeReplaced
+#   -> To replace existing value in mipi_syst.h.in to newer one.
+#  2. ExistingDefinitionToBeRemoved
+#   -> To #undef a existing definition in mipi_syst.h.in.
+#  3. NewItemToBeAdded
+#   -> Items in this structure will be placed at the end of mipi_syst.h as 
a customized section.
+#
+#  Run GenMipiSystH.py without any parameters as normal python script after 
customizing.
+#
+#  Copyright (c) 

[edk2-devel] [PATCH v8 3/5] MdePkg: Add NULL library of TraceHubDebugSysTLib

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library is NULL library of TraceHubDebugSysTLib.

Cc: Michael D Kinney 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 MdePkg/Include/Library/TraceHubDebugSysTLib.h | 81 +++
 .../TraceHubDebugSysTLibNull.c| 76 +
 .../TraceHubDebugSysTLibNull.inf  | 29 +++
 MdePkg/MdePkg.dsc |  1 +
 4 files changed, 187 insertions(+)
 create mode 100644 MdePkg/Include/Library/TraceHubDebugSysTLib.h
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.inf

diff --git a/MdePkg/Include/Library/TraceHubDebugSysTLib.h 
b/MdePkg/Include/Library/TraceHubDebugSysTLib.h
new file mode 100644
index 00..7df20e67d6
--- /dev/null
+++ b/MdePkg/Include/Library/TraceHubDebugSysTLib.h
@@ -0,0 +1,81 @@
+/** @file
+This header file declares Trace Hub related top level APIs.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef TRACE_HUB_DEBUG_SYST_LIB_H_
+#define TRACE_HUB_DEBUG_SYST_LIB_H_
+
+typedef enum {
+  SeverityNone= 0,
+  SeverityFatal   = 1,
+  SeverityError   = 2,
+  SeverityWarning = 3,
+  SeverityNormal  = 4,
+  SeverityUser1   = 5,
+  SeverityUser2   = 6,
+  SeverityUser3   = 7,
+  SeverityMax
+} TRACE_HUB_SEVERITY_TYPE;
+
+/**
+  Write debug string to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Buffer   A pointer to the data buffer.
+  @param[in]  NumberOfBytesThe size of data buffer.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTDebugWrite (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT8*Buffer,
+  IN UINTNNumberOfBytes
+  );
+
+/**
+  Write catalog status code message to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Id   Catalog ID.
+  @param[in]  Guid Driver Guid.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTWriteCataLog64StatusCode (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT64   Id,
+  IN GUID *Guid
+  );
+
+/**
+  Write catalog message to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType   Severity type of input message.
+  @param[in]  Id Catalog ID.
+  @param[in]  NumberOfParams Number of entries in argument list.
+  @param[in]  ...Catalog message parameters.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTWriteCataLog64 (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT64   Id,
+  IN UINTNNumberOfParams,
+  ...
+  );
+
+#endif // TRACE_HUB_DEBUG_SYST_LIB_H_
diff --git a/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c 
b/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
new file mode 100644
index 00..0bd14d4e24
--- /dev/null
+++ b/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
@@ -0,0 +1,76 @@
+/** @file
+Null library of TraceHubDebugSysTLib.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+
+/**
+  Write debug string to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Buffer   A pointer to the data buffer.
+  @param[in]  NumberOfBytesThe size of data buffer.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTDebugWrite (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT8*Buffer,
+  IN UINTNNumberOfBytes
+  )
+{
+  return RETURN_UNSUPPORTED;
+}
+
+/**
+  Write catalog status code message to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Id   Catalog ID.
+  @param[in]  Guid Driver Guid.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTWriteCataLog64StatusCode (
+  IN 

[edk2-devel] [PATCH v8 1/5] MdePkg: Add mipisyst submodule

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library provides functions consuming MIPI SYS-T submodule.

Cc: Michael D Kinney 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Guo Gua 
Reviewed-by: Leif Lindholm 
Reviewed-by: Michael D Kinney 
---
 .gitmodules | 3 +++
 .pytool/CISettings.py   | 2 ++
 MdePkg/Library/MipiSysTLib/mipisyst | 1 +
 ReadMe.rst  | 1 +
 4 files changed, 7 insertions(+)
 create mode 16 MdePkg/Library/MipiSysTLib/mipisyst

diff --git a/.gitmodules b/.gitmodules
index 6211c59724..387794f05e 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -29,3 +29,6 @@
 [submodule "MdePkg/Library/BaseFdtLib/libfdt"]
path = MdePkg/Library/BaseFdtLib/libfdt
url = https://github.com/devicetree-org/pylibfdt.git
+[submodule "MdePkg/Library/MipiSysTLib/mipisyst"]
+   path = MdePkg/Library/MipiSysTLib/mipisyst
+   url = https://github.com/MIPI-Alliance/public-mipi-sys-t.git
diff --git a/.pytool/CISettings.py b/.pytool/CISettings.py
index 2fb99f2a17..6fb7342f81 100644
--- a/.pytool/CISettings.py
+++ b/.pytool/CISettings.py
@@ -197,6 +197,8 @@ class Settings(CiBuildSettingsManager, 
UpdateSettingsManager, SetupSettingsManag
 "UnitTestFrameworkPkg/Library/SubhookLib/subhook", False))
 rs.append(RequiredSubmodule(
 "MdePkg/Library/BaseFdtLib/libfdt", False))
+rs.append(RequiredSubmodule(
+"MdePkg/Library/MipiSysTLib/mipisyst", False))
 return rs
 
 def GetName(self):
diff --git a/MdePkg/Library/MipiSysTLib/mipisyst 
b/MdePkg/Library/MipiSysTLib/mipisyst
new file mode 16
index 00..370b5944c0
--- /dev/null
+++ b/MdePkg/Library/MipiSysTLib/mipisyst
@@ -0,0 +1 @@
+Subproject commit 370b5944c046bab043dd8b133727b2135af7747a
diff --git a/ReadMe.rst b/ReadMe.rst
index d46c534229..ed1d482245 100644
--- a/ReadMe.rst
+++ b/ReadMe.rst
@@ -97,6 +97,7 @@ that are covered by additional licenses.
 -  `UnitTestFrameworkPkg/Library/SubhookLib/subhook 
`__
 -  `RedfishPkg/Library/JsonLib/jansson 
`__
 -  `MdePkg/Library/BaseFdtLib/libfdt 
`__
+-  `MdePkg/Library/MipiSysTLib/mipisyst 
`__
 
 The EDK II Project is composed of packages. The maintainers for each package
 are listed in `Maintainers.txt `__.
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v8 0/5] Trace Hub debug library support

2023-05-10 Thread Guo, Gua
From: Gua Guo 

V8: Add MdeModulePkg maintainers into CC list

V7: Miss one patch on V6

V6:
- https://github.com/tianocore/edk2/pull/3901
  Split submodule into new patch
  Fix formatting issue
  Add Review-by message
  Offline check with Victor to use my sign-off name.

V5: if no other open, it will be final change
- https://github.com/tianocore/edk2/pull/3901
  Fix random exception when long run catalog debug message

V4
- https://github.com/tianocore/edk2/pull/3901 - Done
  Enhance SwapBytesGuid to use CopyGuid instead of CopyMem, to make implement 
code more simple.

V3
- https://github.com/tianocore/edk2/pull/3901 - Done
  - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why 
MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
Solution: Remove this macro, use Library Constructor to allocate it 
dynamiclly.
  - Open: 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c: 
SwapBytesGuid () algorithm wrong.
Solution: Follow correct algorithm to implement it.
VOID
EFIAPI
SwapBytesGuid (
  IN  GUID  *Guid,<--- In PreMem, guid is global data 
so region is readonly, add output data to support it.
  OUT GUID  *ConvertedGuid
);

  - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D
Solution: use *_*_*_CC_FLAGS  = -DMIPI_SYST_STATIC to unified both.


V2
- https://github.com/tianocore/edk2/pull/3901
  - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why 
MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
  - Open: 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c: 
SwapBytesGuid () algorithm wrong.
  - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D

V1
Previous PR:
- https://github.com/tianocore/edk2/pull/3613
  - TraceHubDebugLib without submodule - Reject

- https://github.com/tianocore/edk2/pull/3793
  - TraceHubDebugLib with submodule and without seperate into MipiSysTLib and 
TraceHubDebugLib - Reject

Gua Guo (5):
  MdePkg: Add mipisyst submodule
  MdePkg: Add MipiSysTLib library
  MdePkg: Add NULL library of TraceHubDebugSysTLib
  MdeModulePkg: Add TraceHubDebugSysTLib library
  Maintainers.txt: Update reviewers and maintainers for
TraceHubDebugLib.

 .gitmodules   |   3 +
 .pytool/CISettings.py |   2 +
 Maintainers.txt   |  18 +
 .../Include/Guid/TraceHubDebugInfoHob.h   |  24 +
 .../BaseTraceHubDebugSysTLib.c| 245 ++
 .../BaseTraceHubDebugSysTLib.inf  |  44 +
 .../DxeSmmTraceHubDebugSysTLib.c  | 263 ++
 .../DxeSmmTraceHubDebugSysTLib.inf|  51 ++
 .../InternalTraceHubApi.c |  74 ++
 .../InternalTraceHubApi.h |  37 +
 .../InternalTraceHubApiCommon.c   | 200 +
 .../InternalTraceHubApiCommon.h   | 119 +++
 .../PeiTraceHubDebugSysTLib.c | 282 +++
 .../PeiTraceHubDebugSysTLib.inf   |  50 ++
 .../Library/TraceHubDebugSysTLib/Readme.md|  26 +
 MdeModulePkg/MdeModulePkg.dec |  21 +
 MdeModulePkg/MdeModulePkg.dsc |   3 +
 MdeModulePkg/MdeModulePkg.uni |  18 +
 MdePkg/Include/Library/MipiSysTLib.h  |  66 ++
 MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 ++
 MdePkg/Library/MipiSysTLib/GenMipiSystH.py| 132 +++
 MdePkg/Library/MipiSysTLib/MipiSysTLib.c  | 123 +++
 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf|  52 ++
 MdePkg/Library/MipiSysTLib/Platform.c | 164 
 MdePkg/Library/MipiSysTLib/Platform.h | 138 +++
 MdePkg/Library/MipiSysTLib/Readme.md  |  25 +
 MdePkg/Library/MipiSysTLib/mipi_syst.h| 789 ++
 MdePkg/Library/MipiSysTLib/mipisyst   |   1 +
 .../TraceHubDebugSysTLibNull.c|  76 ++
 .../TraceHubDebugSysTLibNull.inf  |  29 +
 MdePkg/MdePkg.ci.yaml |  12 +-
 MdePkg/MdePkg.dec |   9 +
 MdePkg/MdePkg.dsc |   2 +
 ReadMe.rst|   1 +
 34 files changed, 3177 insertions(+), 3 deletions(-)
 create mode 100644 MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.h
 create mode 

Re: [edk2-devel] [PATCH v7 4/5] MdeModulePkg: Add TraceHubDebugSysTLib library

2023-05-10 Thread Michael D Kinney
The MdeModulePkg maintainers were never Cc, so they did not know to review

Cc: Jian J Wang  
Cc: Liming Gao  

Will have to wait for review from Jian or Liming and add Rb.

Mike

> -Original Message-
> From: Guo, Gua 
> Sent: Wednesday, May 10, 2023 2:32 PM
> To: devel@edk2.groups.io
> Cc: Guo, Gua ; Kinney, Michael D
> ; Chan, Laura ;
> Prakashan, Krishnadas Veliyathuparambil
> ; K N, Karthik
> 
> Subject: [PATCH v7 4/5] MdeModulePkg: Add TraceHubDebugSysTLib library
> 
> From: Gua Guo 
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4144
> 
> This Library provides API to dump Trace Hub message.
> 
> Cc: Michael D Kinney 
> Cc: Guo Gua 
> Cc: Chan Laura 
> Cc: Prakashan Krishnadas Veliyathuparambil
> 
> Cc: K N Karthik 
> Signed-off-by: Guo Gua 
> Reviewed-by: Michael D Kinney 
> Reviewed-by: K N Karthik 
> Reviewed-by: Chan Laura 
> ---
>  .../Include/Guid/TraceHubDebugInfoHob.h   |  24 ++
>  .../BaseTraceHubDebugSysTLib.c| 245 +++
>  .../BaseTraceHubDebugSysTLib.inf  |  44 +++
>  .../DxeSmmTraceHubDebugSysTLib.c  | 263 
>  .../DxeSmmTraceHubDebugSysTLib.inf|  51 
>  .../InternalTraceHubApi.c |  74 +
>  .../InternalTraceHubApi.h |  37 +++
>  .../InternalTraceHubApiCommon.c   | 200 +
>  .../InternalTraceHubApiCommon.h   | 119 
>  .../PeiTraceHubDebugSysTLib.c | 282 ++
>  .../PeiTraceHubDebugSysTLib.inf   |  50 
>  .../Library/TraceHubDebugSysTLib/Readme.md|  26 ++
>  MdeModulePkg/MdeModulePkg.dec |  21 ++
>  MdeModulePkg/MdeModulePkg.dsc |   3 +
>  MdeModulePkg/MdeModulePkg.uni |  18 ++
>  15 files changed, 1457 insertions(+)
>  create mode 100644 MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.i
> nf
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTL
> ib.c
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTL
> ib.inf
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.h
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon
> .c
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon
> .h
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.c
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.inf
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/Readme.md
> 
> diff --git a/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
> b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
> new file mode 100644
> index 00..367f97dc90
> --- /dev/null
> +++ b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
> @@ -0,0 +1,24 @@
> +/** @file
> 
> +This header file declares Trace Hub related structure.
> 
> +
> 
> +Copyright (c) 2023, Intel Corporation. All rights reserved.
> 
> +
> 
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +**/
> 
> +
> 
> +#ifndef TRACE_HUB_DEBUG_INFO_HOB_H_
> 
> +#define TRACE_HUB_DEBUG_INFO_HOB_H_
> 
> +
> 
> +#define TRACEHUB_DEBUG_INFO_HOB_REVISION  1
> 
> +
> 
> +typedef struct {
> 
> +  UINT16 Revision;// Structure revision
> 
> +  BOOLEANFlag;// Flag to enable or disable Trace Hub 
> debug
> message.
> 
> +  UINT8  DebugLevel;  // Debug level for Trace Hub.
> 
> +  UINT8  Rvsd[4]; // Reserved for future use
> 
> +  UINT64 TraceHubMmioAddress; // MMIO address where Trace Hub
> debug message output to.
> 
> +} TRACEHUB_DEBUG_INFO_HOB;
> 
> +
> 
> +extern GUID  gTraceHubDebugInfoHobGuid;
> 
> +
> 
> +#endif // TRACE_HUB_DEBUG_INFO_HOB_H_
> 
> diff --git
> a/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib
> .c
> b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib
> .c
> new file mode 100644
> index 00..45dfd3127a
> --- /dev/null
> +++
> b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib
> .c
> @@ -0,0 +1,245 @@
> +/** @file
> 
> +System prints Trace Hub message in SEC/PEI/DXE/SMM based on fixed PCDs.
> 
> +Only support single Trace Hub debug instance.
> 
> +
> 
> +Copyright (c) 2023, Intel Corporation. All rights reserved.
> 
> +
> 
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +
> 
> +**/
> 
> +
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +#include 
> 
> +#include "InternalTraceHubApiCommon.h"
> 
> +#include "InternalTraceHubApi.h"
> 
> +
> 
> +/**

Re: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update reviewers and maintainers for TraceHubDebugLib.

2023-05-10 Thread Guo, Gua
Sure, can track this one.


-Original Message-
From: Kinney, Michael D  
Sent: Thursday, May 11, 2023 5:22 AM
To: Guo, Gua ; devel@edk2.groups.io; 
quic_llind...@quicinc.com
Cc: Hsu, VictorX ; Chiu, Chasel ; 
Kinney, Michael D 
Subject: RE: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update reviewers and 
maintainers for TraceHubDebugLib.

Hi Gua,

Can you please resend the email patches for the series and make sure the Author 
and Signed-off-by are correct on your local branch before sending.

Thanks,

Mike

> -Original Message-
> From: Guo, Gua 
> Sent: Wednesday, May 10, 2023 2:02 PM
> To: Kinney, Michael D ; 
> devel@edk2.groups.io; quic_llind...@quicinc.com
> Cc: Hsu, VictorX ; Chiu, Chasel 
> 
> Subject: RE: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update 
> reviewers and maintainers for TraceHubDebugLib.
> 
> @Leif Lindholm and @Kinney, Michael D
> 
> I've locate Leif and update on the PR.
> 
> - Split submodule into new patch
> - Fix formatting issue
> - Add Review-by message
> - Offline check with Victor to use my sign-off name.
> https://github.com/tianocore/edk2/pull/3901
> 
> Thanks,
> Gua
> -Original Message-
> From: Kinney, Michael D 
> Sent: Thursday, May 11, 2023 2:57 AM
> To: devel@edk2.groups.io; quic_llind...@quicinc.com; Guo, Gua 
> 
> Cc: Hsu, VictorX ; Kinney, Michael D 
> 
> Subject: RE: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update 
> reviewers and maintainers for TraceHubDebugLib.
> 
> Hi Leif,
> 
> The original patch series was sent by Victor in January and has 
> Signed-off-by from Victor.
> 
>   https://edk2.groups.io/g/devel/message/99333
> 
> Subsequent updates to the patch series based on feedback were sent by Gua.
> 
> With this background, who should be Signed-off-by and the Author in 
> the final patch series?
> 
> Mike
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Leif 
> > Lindholm
> > Sent: Wednesday, May 10, 2023 11:34 AM
> > To: devel@edk2.groups.io; Guo, Gua 
> > Cc: Hsu, VictorX 
> > Subject: Re: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update 
> > reviewers and maintainers for TraceHubDebugLib.
> >
> > On Wed, May 10, 2023 at 10:33:55 +0800, Guo, Gua wrote:
> > > From: Gua Guo 
> > >
> > > Update reviewers and maintainers for TraceHubDebugSysTlib.
> > >
> > > Signed-off-by: VictorX Hsu 
> >
> > The DCO is a legal statement about the contribution. Only the person 
> > posting the patches can make that statement.
> > If VictorX is the author, that should be covered by the From: tag.
> > I notice this applies to the whole set. Please address.
> >
> > Once addressed:
> > Reviewed-by: Leif Lindholm 
> >
> > /
> > Leif
> >
> > > ---
> > >  Maintainers.txt | 18 ++
> > >  1 file changed, 18 insertions(+)
> > >
> > > diff --git a/Maintainers.txt b/Maintainers.txt index 
> > > 09d04af27a..30e2d2686d 100644
> > > --- a/Maintainers.txt
> > > +++ b/Maintainers.txt
> > > @@ -437,6 +437,14 @@ R: Zhiguang Liu 
> > [LiuZhiguang001]
> > >  R: Ray Ni  [niruiyu]
> > >  R: Gua Guo  [gguo11837463]
> > >
> > > +MdeModulePkg: Trace Hub debug message related library instance
> > > +F: MdeModulePkg/Library/TraceHubDebugSysTLib/
> > > +F: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
> > > +M: Gua Guo  [gguo11837463]
> > > +M: Prakashan Krishnadas Veliyathuparambil
> >  [kprakas2]
> > > +R: Chan Laura  [lauracha]
> > > +R: K N Karthik  [karthikkabbigere1]
> > > +
> > >  MdePkg
> > >  F: MdePkg/
> > >  W: https://github.com/tianocore/tianocore.github.io/wiki/MdePkg
> > > @@ -444,6 +452,16 @@ M: Michael D Kinney 
> > > 
> > [mdkinney]
> > >  M: Liming Gao  [lgao4]
> > >  R: Zhiguang Liu  [LiuZhiguang001]
> > >
> > > +MdePkg: Trace Hub debug message related library instance
> > > +F: MdePkg/Library/TraceHubDebugSysTLibNull/
> > > +F: MdePkg/Library/MipiSysTLib/
> > > +F: MdePkg/Include/Library/TraceHubDebugSysTLib.h
> > > +F: MdePkg/Include/Library/MipiSysTLib.h
> > > +M: Gua Guo  [gguo11837463]
> > > +M: Prakashan Krishnadas Veliyathuparambil
> >  [kprakas2]
> > > +R: Chan Laura  [lauracha]
> > > +R: K N Karthik  [karthikkabbigere1]
> > > +
> > >  NetworkPkg
> > >  F: NetworkPkg/
> > >  W: 
> > > https://github.com/tianocore/tianocore.github.io/wiki/NetworkPkg
> > > --
> > > 2.39.2.windows.1
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > 
> >



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


--- Begin Message ---
From: Gua Guo 

V7: Miss one patch on V6

V6:
- https://github.com/tianocore/edk2/pull/3901
  Split submodule into new patch
  Fix formatting issue
  Add Review-by message
  Offline check with Victor to use my sign-off name.

V5: if no other open, it will be final change
- 

[edk2-devel] [PATCH v7 5/5] Maintainers.txt: Update reviewers and maintainers for TraceHubDebugLib.

2023-05-10 Thread Guo, Gua
From: Gua Guo 

Update reviewers and maintainers for TraceHubDebugSysTlib.

Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 Maintainers.txt | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index 09d04af27a..30e2d2686d 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -437,6 +437,14 @@ R: Zhiguang Liu  [LiuZhiguang001]
 R: Ray Ni  [niruiyu]
 R: Gua Guo  [gguo11837463]
 
+MdeModulePkg: Trace Hub debug message related library instance
+F: MdeModulePkg/Library/TraceHubDebugSysTLib/
+F: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
+M: Gua Guo  [gguo11837463]
+M: Prakashan Krishnadas Veliyathuparambil 
 [kprakas2]
+R: Chan Laura  [lauracha]
+R: K N Karthik  [karthikkabbigere1]
+
 MdePkg
 F: MdePkg/
 W: https://github.com/tianocore/tianocore.github.io/wiki/MdePkg
@@ -444,6 +452,16 @@ M: Michael D Kinney  [mdkinney]
 M: Liming Gao  [lgao4]
 R: Zhiguang Liu  [LiuZhiguang001]
 
+MdePkg: Trace Hub debug message related library instance
+F: MdePkg/Library/TraceHubDebugSysTLibNull/
+F: MdePkg/Library/MipiSysTLib/
+F: MdePkg/Include/Library/TraceHubDebugSysTLib.h
+F: MdePkg/Include/Library/MipiSysTLib.h
+M: Gua Guo  [gguo11837463]
+M: Prakashan Krishnadas Veliyathuparambil 
 [kprakas2]
+R: Chan Laura  [lauracha]
+R: K N Karthik  [karthikkabbigere1]
+
 NetworkPkg
 F: NetworkPkg/
 W: https://github.com/tianocore/tianocore.github.io/wiki/NetworkPkg
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v7 4/5] MdeModulePkg: Add TraceHubDebugSysTLib library

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library provides API to dump Trace Hub message.

Cc: Michael D Kinney 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 .../Include/Guid/TraceHubDebugInfoHob.h   |  24 ++
 .../BaseTraceHubDebugSysTLib.c| 245 +++
 .../BaseTraceHubDebugSysTLib.inf  |  44 +++
 .../DxeSmmTraceHubDebugSysTLib.c  | 263 
 .../DxeSmmTraceHubDebugSysTLib.inf|  51 
 .../InternalTraceHubApi.c |  74 +
 .../InternalTraceHubApi.h |  37 +++
 .../InternalTraceHubApiCommon.c   | 200 +
 .../InternalTraceHubApiCommon.h   | 119 
 .../PeiTraceHubDebugSysTLib.c | 282 ++
 .../PeiTraceHubDebugSysTLib.inf   |  50 
 .../Library/TraceHubDebugSysTLib/Readme.md|  26 ++
 MdeModulePkg/MdeModulePkg.dec |  21 ++
 MdeModulePkg/MdeModulePkg.dsc |   3 +
 MdeModulePkg/MdeModulePkg.uni |  18 ++
 15 files changed, 1457 insertions(+)
 create mode 100644 MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.inf
 create mode 100644 MdeModulePkg/Library/TraceHubDebugSysTLib/Readme.md

diff --git a/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h 
b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
new file mode 100644
index 00..367f97dc90
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
@@ -0,0 +1,24 @@
+/** @file
+This header file declares Trace Hub related structure.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef TRACE_HUB_DEBUG_INFO_HOB_H_
+#define TRACE_HUB_DEBUG_INFO_HOB_H_
+
+#define TRACEHUB_DEBUG_INFO_HOB_REVISION  1
+
+typedef struct {
+  UINT16 Revision;// Structure revision
+  BOOLEANFlag;// Flag to enable or disable Trace Hub debug 
message.
+  UINT8  DebugLevel;  // Debug level for Trace Hub.
+  UINT8  Rvsd[4]; // Reserved for future use
+  UINT64 TraceHubMmioAddress; // MMIO address where Trace Hub debug 
message output to.
+} TRACEHUB_DEBUG_INFO_HOB;
+
+extern GUID  gTraceHubDebugInfoHobGuid;
+
+#endif // TRACE_HUB_DEBUG_INFO_HOB_H_
diff --git 
a/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c 
b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
new file mode 100644
index 00..45dfd3127a
--- /dev/null
+++ b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
@@ -0,0 +1,245 @@
+/** @file
+System prints Trace Hub message in SEC/PEI/DXE/SMM based on fixed PCDs.
+Only support single Trace Hub debug instance.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "InternalTraceHubApiCommon.h"
+#include "InternalTraceHubApi.h"
+
+/**
+  Write debug string to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Buffer   A pointer to the data buffer.
+  @param[in]  NumberOfBytesThe size of data buffer.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTDebugWrite (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT8*Buffer,
+  IN UINTNNumberOfBytes
+  )
+{
+  MIPI_SYST_HANDLE  MipiSystHandle;
+  MIPI_SYST_HEADER  MipiSystHeader;
+  RETURN_STATUS Status;
+  UINT32DbgInstCount;
+  UINT16Index;
+
+  if (NumberOfBytes == 0) {
+//
+// No data need to be written to Trace Hub
+//
+return RETURN_SUCCESS;
+  }
+
+  if 

[edk2-devel] [PATCH v7 3/5] MdePkg: Add NULL library of TraceHubDebugSysTLib

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library is NULL library of TraceHubDebugSysTLib.

Cc: Michael D Kinney 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 MdePkg/Include/Library/TraceHubDebugSysTLib.h | 81 +++
 .../TraceHubDebugSysTLibNull.c| 76 +
 .../TraceHubDebugSysTLibNull.inf  | 29 +++
 MdePkg/MdePkg.dsc |  1 +
 4 files changed, 187 insertions(+)
 create mode 100644 MdePkg/Include/Library/TraceHubDebugSysTLib.h
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.inf

diff --git a/MdePkg/Include/Library/TraceHubDebugSysTLib.h 
b/MdePkg/Include/Library/TraceHubDebugSysTLib.h
new file mode 100644
index 00..7df20e67d6
--- /dev/null
+++ b/MdePkg/Include/Library/TraceHubDebugSysTLib.h
@@ -0,0 +1,81 @@
+/** @file
+This header file declares Trace Hub related top level APIs.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef TRACE_HUB_DEBUG_SYST_LIB_H_
+#define TRACE_HUB_DEBUG_SYST_LIB_H_
+
+typedef enum {
+  SeverityNone= 0,
+  SeverityFatal   = 1,
+  SeverityError   = 2,
+  SeverityWarning = 3,
+  SeverityNormal  = 4,
+  SeverityUser1   = 5,
+  SeverityUser2   = 6,
+  SeverityUser3   = 7,
+  SeverityMax
+} TRACE_HUB_SEVERITY_TYPE;
+
+/**
+  Write debug string to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Buffer   A pointer to the data buffer.
+  @param[in]  NumberOfBytesThe size of data buffer.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTDebugWrite (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT8*Buffer,
+  IN UINTNNumberOfBytes
+  );
+
+/**
+  Write catalog status code message to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Id   Catalog ID.
+  @param[in]  Guid Driver Guid.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTWriteCataLog64StatusCode (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT64   Id,
+  IN GUID *Guid
+  );
+
+/**
+  Write catalog message to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType   Severity type of input message.
+  @param[in]  Id Catalog ID.
+  @param[in]  NumberOfParams Number of entries in argument list.
+  @param[in]  ...Catalog message parameters.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTWriteCataLog64 (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT64   Id,
+  IN UINTNNumberOfParams,
+  ...
+  );
+
+#endif // TRACE_HUB_DEBUG_SYST_LIB_H_
diff --git a/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c 
b/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
new file mode 100644
index 00..0bd14d4e24
--- /dev/null
+++ b/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
@@ -0,0 +1,76 @@
+/** @file
+Null library of TraceHubDebugSysTLib.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+
+/**
+  Write debug string to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Buffer   A pointer to the data buffer.
+  @param[in]  NumberOfBytesThe size of data buffer.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTDebugWrite (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT8*Buffer,
+  IN UINTNNumberOfBytes
+  )
+{
+  return RETURN_UNSUPPORTED;
+}
+
+/**
+  Write catalog status code message to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Id   Catalog ID.
+  @param[in]  Guid Driver Guid.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTWriteCataLog64StatusCode (
+  IN 

[edk2-devel] [PATCH v7 2/5] MdePkg: Add MipiSysTLib library

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library provides functions consuming MIPI SYS-T submodule.

Cc: Michael D Kinney 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 MdePkg/Include/Library/MipiSysTLib.h   |  66 ++
 MdePkg/Library/MipiSysTLib/GenMipiSystH.py | 132 
 MdePkg/Library/MipiSysTLib/MipiSysTLib.c   | 123 
 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf |  52 ++
 MdePkg/Library/MipiSysTLib/Platform.c  | 164 +
 MdePkg/Library/MipiSysTLib/Platform.h  | 138 
 MdePkg/Library/MipiSysTLib/Readme.md   |  25 +
 MdePkg/Library/MipiSysTLib/mipi_syst.h | 789 +
 MdePkg/MdePkg.ci.yaml  |  12 +-
 MdePkg/MdePkg.dec  |   9 +
 MdePkg/MdePkg.dsc  |   1 +
 11 files changed, 1508 insertions(+), 3 deletions(-)
 create mode 100644 MdePkg/Include/Library/MipiSysTLib.h
 create mode 100644 MdePkg/Library/MipiSysTLib/GenMipiSystH.py
 create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.c
 create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
 create mode 100644 MdePkg/Library/MipiSysTLib/Platform.c
 create mode 100644 MdePkg/Library/MipiSysTLib/Platform.h
 create mode 100644 MdePkg/Library/MipiSysTLib/Readme.md
 create mode 100644 MdePkg/Library/MipiSysTLib/mipi_syst.h

diff --git a/MdePkg/Include/Library/MipiSysTLib.h 
b/MdePkg/Include/Library/MipiSysTLib.h
new file mode 100644
index 00..4ced1c02cd
--- /dev/null
+++ b/MdePkg/Include/Library/MipiSysTLib.h
@@ -0,0 +1,66 @@
+/** @file
+This header file declares functions consuming MIPI Sys-T submodule.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef MIPI_SYST_LIB_H_
+#define MIPI_SYST_LIB_H_
+
+/**
+  Invoke initialization function in Mipi Sys-T module to initialize Mipi Sys-T 
handle.
+
+  @param[in, out]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.
+
+  @retval RETURN_SUCCESS  MIPI_SYST_HANDLE instance was initialized.
+  @retval Other   MIPI_SYST_HANDLE instance was not initialized.
+**/
+RETURN_STATUS
+EFIAPI
+InitMipiSystHandle (
+  IN OUT VOID  *MipiSystHandle
+  );
+
+/**
+  Invoke write_debug_string function in Mipi Sys-T module.
+
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.
+  @param[in]  SeveritySeverity type of input message.
+  @param[in]  Len Length of data buffer.
+  @param[in]  Str A pointer to data buffer.
+
+  @retval RETURN_SUCCESS   Data in buffer was processed.
+  @retval RETURN_ABORTED   No data need to be written to Trace Hub.
+  @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle or Str is a 
NULL pointer.
+**/
+RETURN_STATUS
+EFIAPI
+MipiSystWriteDebug (
+  INVOID*MipiSystHandle,
+  INUINT32  Severity,
+  INUINT16  Len,
+  IN CONST  CHAR8   *Str
+  );
+
+/**
+  Invoke catalog_write_message function in Mipi Sys-T module.
+
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.
+  @param[in]  SeveritySeverity type of input message.
+  @param[in]  CatId   Catalog Id.
+
+  @retval RETURN_SUCCESS   Data in buffer was processed.
+  @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle is a NULL 
pointer.
+**/
+RETURN_STATUS
+EFIAPI
+MipiSystWriteCatalog (
+  IN  VOID*MipiSystHandle,
+  IN  UINT32  Severity,
+  IN  UINT64  CatId
+  );
+
+#endif // MIPI_SYST_LIB_H_
diff --git a/MdePkg/Library/MipiSysTLib/GenMipiSystH.py 
b/MdePkg/Library/MipiSysTLib/GenMipiSystH.py
new file mode 100644
index 00..ee48285590
--- /dev/null
+++ b/MdePkg/Library/MipiSysTLib/GenMipiSystH.py
@@ -0,0 +1,132 @@
+## @file
+#  This python script update content from mipi_syst.h.in in mipi sys-T 
submodule
+#  and generate it as mipi_syst.h. mipi_syst.h include necessary data 
structure and
+#  definition that will be consumed by MipiSysTLib itself, mipi sys-T submodule
+#  and other library.
+#
+#  This script needs to be done once by a developer when adding some
+#  project-relating definition or a new version of mipi_syst.h.in is released.
+#  Normal users do not need to do this, since the resulting file is stored
+#  in the EDK2 git repository.
+#
+#  Customize structures mentioned below to generate updated mipi_syst.h file:
+#  1. ExistingValueToBeReplaced
+#   -> To replace existing value in mipi_syst.h.in to newer one.
+#  2. ExistingDefinitionToBeRemoved
+#   -> To #undef a existing definition in mipi_syst.h.in.
+#  3. NewItemToBeAdded
+#   -> Items in this structure will be placed at the end of mipi_syst.h as 
a customized section.
+#
+#  Run GenMipiSystH.py without any parameters as normal python script after 
customizing.
+#
+#  Copyright (c) 

[edk2-devel] [PATCH v7 0/5] Trace Hub debug library support

2023-05-10 Thread Guo, Gua
From: Gua Guo 

V7: Miss one patch on V6

V6:
- https://github.com/tianocore/edk2/pull/3901
  Split submodule into new patch
  Fix formatting issue
  Add Review-by message
  Offline check with Victor to use my sign-off name.

V5: if no other open, it will be final change
- https://github.com/tianocore/edk2/pull/3901
  Fix random exception when long run catalog debug message

V4
- https://github.com/tianocore/edk2/pull/3901 - Done
  Enhance SwapBytesGuid to use CopyGuid instead of CopyMem, to make implement 
code more simple.

V3
- https://github.com/tianocore/edk2/pull/3901 - Done
  - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why 
MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
Solution: Remove this macro, use Library Constructor to allocate it 
dynamiclly.
  - Open: 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c: 
SwapBytesGuid () algorithm wrong.
Solution: Follow correct algorithm to implement it.
VOID
EFIAPI
SwapBytesGuid (
  IN  GUID  *Guid,<--- In PreMem, guid is global data 
so region is readonly, add output data to support it.
  OUT GUID  *ConvertedGuid
);

  - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D
Solution: use *_*_*_CC_FLAGS  = -DMIPI_SYST_STATIC to unified both.


V2
- https://github.com/tianocore/edk2/pull/3901
  - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why 
MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
  - Open: 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c: 
SwapBytesGuid () algorithm wrong.
  - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D

V1
Previous PR:
- https://github.com/tianocore/edk2/pull/3613
  - TraceHubDebugLib without submodule - Reject

- https://github.com/tianocore/edk2/pull/3793
  - TraceHubDebugLib with submodule and without seperate into MipiSysTLib and 
TraceHubDebugLib - Reject

Gua Guo (5):
  MdePkg: Add mipisyst submodule
  MdePkg: Add MipiSysTLib library
  MdePkg: Add NULL library of TraceHubDebugSysTLib
  MdeModulePkg: Add TraceHubDebugSysTLib library
  Maintainers.txt: Update reviewers and maintainers for
TraceHubDebugLib.

 .gitmodules   |   3 +
 .pytool/CISettings.py |   2 +
 Maintainers.txt   |  18 +
 .../Include/Guid/TraceHubDebugInfoHob.h   |  24 +
 .../BaseTraceHubDebugSysTLib.c| 245 ++
 .../BaseTraceHubDebugSysTLib.inf  |  44 +
 .../DxeSmmTraceHubDebugSysTLib.c  | 263 ++
 .../DxeSmmTraceHubDebugSysTLib.inf|  51 ++
 .../InternalTraceHubApi.c |  74 ++
 .../InternalTraceHubApi.h |  37 +
 .../InternalTraceHubApiCommon.c   | 200 +
 .../InternalTraceHubApiCommon.h   | 119 +++
 .../PeiTraceHubDebugSysTLib.c | 282 +++
 .../PeiTraceHubDebugSysTLib.inf   |  50 ++
 .../Library/TraceHubDebugSysTLib/Readme.md|  26 +
 MdeModulePkg/MdeModulePkg.dec |  21 +
 MdeModulePkg/MdeModulePkg.dsc |   3 +
 MdeModulePkg/MdeModulePkg.uni |  18 +
 MdePkg/Include/Library/MipiSysTLib.h  |  66 ++
 MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 ++
 MdePkg/Library/MipiSysTLib/GenMipiSystH.py| 132 +++
 MdePkg/Library/MipiSysTLib/MipiSysTLib.c  | 123 +++
 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf|  52 ++
 MdePkg/Library/MipiSysTLib/Platform.c | 164 
 MdePkg/Library/MipiSysTLib/Platform.h | 138 +++
 MdePkg/Library/MipiSysTLib/Readme.md  |  25 +
 MdePkg/Library/MipiSysTLib/mipi_syst.h| 789 ++
 MdePkg/Library/MipiSysTLib/mipisyst   |   1 +
 .../TraceHubDebugSysTLibNull.c|  76 ++
 .../TraceHubDebugSysTLibNull.inf  |  29 +
 MdePkg/MdePkg.ci.yaml |  12 +-
 MdePkg/MdePkg.dec |   9 +
 MdePkg/MdePkg.dsc |   2 +
 ReadMe.rst|   1 +
 34 files changed, 3177 insertions(+), 3 deletions(-)
 create mode 100644 MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.h
 create mode 100644 

[edk2-devel] [PATCH v7 1/5] MdePkg: Add mipisyst submodule

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library provides functions consuming MIPI SYS-T submodule.

Cc: Michael D Kinney 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Guo Gua 
Reviewed-by: Leif Lindholm 
Reviewed-by: Michael D Kinney 
---
 .gitmodules | 3 +++
 .pytool/CISettings.py   | 2 ++
 MdePkg/Library/MipiSysTLib/mipisyst | 1 +
 ReadMe.rst  | 1 +
 4 files changed, 7 insertions(+)
 create mode 16 MdePkg/Library/MipiSysTLib/mipisyst

diff --git a/.gitmodules b/.gitmodules
index 6211c59724..387794f05e 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -29,3 +29,6 @@
 [submodule "MdePkg/Library/BaseFdtLib/libfdt"]
path = MdePkg/Library/BaseFdtLib/libfdt
url = https://github.com/devicetree-org/pylibfdt.git
+[submodule "MdePkg/Library/MipiSysTLib/mipisyst"]
+   path = MdePkg/Library/MipiSysTLib/mipisyst
+   url = https://github.com/MIPI-Alliance/public-mipi-sys-t.git
diff --git a/.pytool/CISettings.py b/.pytool/CISettings.py
index 2fb99f2a17..6fb7342f81 100644
--- a/.pytool/CISettings.py
+++ b/.pytool/CISettings.py
@@ -197,6 +197,8 @@ class Settings(CiBuildSettingsManager, 
UpdateSettingsManager, SetupSettingsManag
 "UnitTestFrameworkPkg/Library/SubhookLib/subhook", False))
 rs.append(RequiredSubmodule(
 "MdePkg/Library/BaseFdtLib/libfdt", False))
+rs.append(RequiredSubmodule(
+"MdePkg/Library/MipiSysTLib/mipisyst", False))
 return rs
 
 def GetName(self):
diff --git a/MdePkg/Library/MipiSysTLib/mipisyst 
b/MdePkg/Library/MipiSysTLib/mipisyst
new file mode 16
index 00..370b5944c0
--- /dev/null
+++ b/MdePkg/Library/MipiSysTLib/mipisyst
@@ -0,0 +1 @@
+Subproject commit 370b5944c046bab043dd8b133727b2135af7747a
diff --git a/ReadMe.rst b/ReadMe.rst
index d46c534229..ed1d482245 100644
--- a/ReadMe.rst
+++ b/ReadMe.rst
@@ -97,6 +97,7 @@ that are covered by additional licenses.
 -  `UnitTestFrameworkPkg/Library/SubhookLib/subhook 
`__
 -  `RedfishPkg/Library/JsonLib/jansson 
`__
 -  `MdePkg/Library/BaseFdtLib/libfdt 
`__
+-  `MdePkg/Library/MipiSysTLib/mipisyst 
`__
 
 The EDK II Project is composed of packages. The maintainers for each package
 are listed in `Maintainers.txt `__.
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v6 4/4] Maintainers.txt: Update reviewers and maintainers for TraceHubDebugLib.

2023-05-10 Thread Guo, Gua
From: Gua Guo 

Update reviewers and maintainers for TraceHubDebugSysTlib.

Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 Maintainers.txt | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/Maintainers.txt b/Maintainers.txt
index 09d04af27a..30e2d2686d 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -437,6 +437,14 @@ R: Zhiguang Liu  [LiuZhiguang001]
 R: Ray Ni  [niruiyu]
 R: Gua Guo  [gguo11837463]
 
+MdeModulePkg: Trace Hub debug message related library instance
+F: MdeModulePkg/Library/TraceHubDebugSysTLib/
+F: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
+M: Gua Guo  [gguo11837463]
+M: Prakashan Krishnadas Veliyathuparambil 
 [kprakas2]
+R: Chan Laura  [lauracha]
+R: K N Karthik  [karthikkabbigere1]
+
 MdePkg
 F: MdePkg/
 W: https://github.com/tianocore/tianocore.github.io/wiki/MdePkg
@@ -444,6 +452,16 @@ M: Michael D Kinney  [mdkinney]
 M: Liming Gao  [lgao4]
 R: Zhiguang Liu  [LiuZhiguang001]
 
+MdePkg: Trace Hub debug message related library instance
+F: MdePkg/Library/TraceHubDebugSysTLibNull/
+F: MdePkg/Library/MipiSysTLib/
+F: MdePkg/Include/Library/TraceHubDebugSysTLib.h
+F: MdePkg/Include/Library/MipiSysTLib.h
+M: Gua Guo  [gguo11837463]
+M: Prakashan Krishnadas Veliyathuparambil 
 [kprakas2]
+R: Chan Laura  [lauracha]
+R: K N Karthik  [karthikkabbigere1]
+
 NetworkPkg
 F: NetworkPkg/
 W: https://github.com/tianocore/tianocore.github.io/wiki/NetworkPkg
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v6 3/4] MdeModulePkg: Add TraceHubDebugSysTLib library

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library provides API to dump Trace Hub message.

Cc: Michael D Kinney 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 .../Include/Guid/TraceHubDebugInfoHob.h   |  24 ++
 .../BaseTraceHubDebugSysTLib.c| 245 +++
 .../BaseTraceHubDebugSysTLib.inf  |  44 +++
 .../DxeSmmTraceHubDebugSysTLib.c  | 263 
 .../DxeSmmTraceHubDebugSysTLib.inf|  51 
 .../InternalTraceHubApi.c |  74 +
 .../InternalTraceHubApi.h |  37 +++
 .../InternalTraceHubApiCommon.c   | 200 +
 .../InternalTraceHubApiCommon.h   | 119 
 .../PeiTraceHubDebugSysTLib.c | 282 ++
 .../PeiTraceHubDebugSysTLib.inf   |  50 
 .../Library/TraceHubDebugSysTLib/Readme.md|  26 ++
 MdeModulePkg/MdeModulePkg.dec |  21 ++
 MdeModulePkg/MdeModulePkg.dsc |   3 +
 MdeModulePkg/MdeModulePkg.uni |  18 ++
 15 files changed, 1457 insertions(+)
 create mode 100644 MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.inf
 create mode 100644 MdeModulePkg/Library/TraceHubDebugSysTLib/Readme.md

diff --git a/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h 
b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
new file mode 100644
index 00..367f97dc90
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
@@ -0,0 +1,24 @@
+/** @file
+This header file declares Trace Hub related structure.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef TRACE_HUB_DEBUG_INFO_HOB_H_
+#define TRACE_HUB_DEBUG_INFO_HOB_H_
+
+#define TRACEHUB_DEBUG_INFO_HOB_REVISION  1
+
+typedef struct {
+  UINT16 Revision;// Structure revision
+  BOOLEANFlag;// Flag to enable or disable Trace Hub debug 
message.
+  UINT8  DebugLevel;  // Debug level for Trace Hub.
+  UINT8  Rvsd[4]; // Reserved for future use
+  UINT64 TraceHubMmioAddress; // MMIO address where Trace Hub debug 
message output to.
+} TRACEHUB_DEBUG_INFO_HOB;
+
+extern GUID  gTraceHubDebugInfoHobGuid;
+
+#endif // TRACE_HUB_DEBUG_INFO_HOB_H_
diff --git 
a/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c 
b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
new file mode 100644
index 00..45dfd3127a
--- /dev/null
+++ b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
@@ -0,0 +1,245 @@
+/** @file
+System prints Trace Hub message in SEC/PEI/DXE/SMM based on fixed PCDs.
+Only support single Trace Hub debug instance.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "InternalTraceHubApiCommon.h"
+#include "InternalTraceHubApi.h"
+
+/**
+  Write debug string to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Buffer   A pointer to the data buffer.
+  @param[in]  NumberOfBytesThe size of data buffer.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTDebugWrite (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT8*Buffer,
+  IN UINTNNumberOfBytes
+  )
+{
+  MIPI_SYST_HANDLE  MipiSystHandle;
+  MIPI_SYST_HEADER  MipiSystHeader;
+  RETURN_STATUS Status;
+  UINT32DbgInstCount;
+  UINT16Index;
+
+  if (NumberOfBytes == 0) {
+//
+// No data need to be written to Trace Hub
+//
+return RETURN_SUCCESS;
+  }
+
+  if 

[edk2-devel] [PATCH v6 1/4] MdePkg: Add MipiSysTLib library

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library provides functions consuming MIPI SYS-T submodule.

Cc: Michael D Kinney 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 MdePkg/Include/Library/MipiSysTLib.h   |  66 ++
 MdePkg/Library/MipiSysTLib/GenMipiSystH.py | 132 
 MdePkg/Library/MipiSysTLib/MipiSysTLib.c   | 123 
 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf |  52 ++
 MdePkg/Library/MipiSysTLib/Platform.c  | 164 +
 MdePkg/Library/MipiSysTLib/Platform.h  | 138 
 MdePkg/Library/MipiSysTLib/Readme.md   |  25 +
 MdePkg/Library/MipiSysTLib/mipi_syst.h | 789 +
 MdePkg/MdePkg.ci.yaml  |  12 +-
 MdePkg/MdePkg.dec  |   9 +
 MdePkg/MdePkg.dsc  |   1 +
 11 files changed, 1508 insertions(+), 3 deletions(-)
 create mode 100644 MdePkg/Include/Library/MipiSysTLib.h
 create mode 100644 MdePkg/Library/MipiSysTLib/GenMipiSystH.py
 create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.c
 create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
 create mode 100644 MdePkg/Library/MipiSysTLib/Platform.c
 create mode 100644 MdePkg/Library/MipiSysTLib/Platform.h
 create mode 100644 MdePkg/Library/MipiSysTLib/Readme.md
 create mode 100644 MdePkg/Library/MipiSysTLib/mipi_syst.h

diff --git a/MdePkg/Include/Library/MipiSysTLib.h 
b/MdePkg/Include/Library/MipiSysTLib.h
new file mode 100644
index 00..4ced1c02cd
--- /dev/null
+++ b/MdePkg/Include/Library/MipiSysTLib.h
@@ -0,0 +1,66 @@
+/** @file
+This header file declares functions consuming MIPI Sys-T submodule.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef MIPI_SYST_LIB_H_
+#define MIPI_SYST_LIB_H_
+
+/**
+  Invoke initialization function in Mipi Sys-T module to initialize Mipi Sys-T 
handle.
+
+  @param[in, out]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.
+
+  @retval RETURN_SUCCESS  MIPI_SYST_HANDLE instance was initialized.
+  @retval Other   MIPI_SYST_HANDLE instance was not initialized.
+**/
+RETURN_STATUS
+EFIAPI
+InitMipiSystHandle (
+  IN OUT VOID  *MipiSystHandle
+  );
+
+/**
+  Invoke write_debug_string function in Mipi Sys-T module.
+
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.
+  @param[in]  SeveritySeverity type of input message.
+  @param[in]  Len Length of data buffer.
+  @param[in]  Str A pointer to data buffer.
+
+  @retval RETURN_SUCCESS   Data in buffer was processed.
+  @retval RETURN_ABORTED   No data need to be written to Trace Hub.
+  @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle or Str is a 
NULL pointer.
+**/
+RETURN_STATUS
+EFIAPI
+MipiSystWriteDebug (
+  INVOID*MipiSystHandle,
+  INUINT32  Severity,
+  INUINT16  Len,
+  IN CONST  CHAR8   *Str
+  );
+
+/**
+  Invoke catalog_write_message function in Mipi Sys-T module.
+
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.
+  @param[in]  SeveritySeverity type of input message.
+  @param[in]  CatId   Catalog Id.
+
+  @retval RETURN_SUCCESS   Data in buffer was processed.
+  @retval RETURN_INVALID_PARAMETER On entry, MipiSystHandle is a NULL 
pointer.
+**/
+RETURN_STATUS
+EFIAPI
+MipiSystWriteCatalog (
+  IN  VOID*MipiSystHandle,
+  IN  UINT32  Severity,
+  IN  UINT64  CatId
+  );
+
+#endif // MIPI_SYST_LIB_H_
diff --git a/MdePkg/Library/MipiSysTLib/GenMipiSystH.py 
b/MdePkg/Library/MipiSysTLib/GenMipiSystH.py
new file mode 100644
index 00..ee48285590
--- /dev/null
+++ b/MdePkg/Library/MipiSysTLib/GenMipiSystH.py
@@ -0,0 +1,132 @@
+## @file
+#  This python script update content from mipi_syst.h.in in mipi sys-T 
submodule
+#  and generate it as mipi_syst.h. mipi_syst.h include necessary data 
structure and
+#  definition that will be consumed by MipiSysTLib itself, mipi sys-T submodule
+#  and other library.
+#
+#  This script needs to be done once by a developer when adding some
+#  project-relating definition or a new version of mipi_syst.h.in is released.
+#  Normal users do not need to do this, since the resulting file is stored
+#  in the EDK2 git repository.
+#
+#  Customize structures mentioned below to generate updated mipi_syst.h file:
+#  1. ExistingValueToBeReplaced
+#   -> To replace existing value in mipi_syst.h.in to newer one.
+#  2. ExistingDefinitionToBeRemoved
+#   -> To #undef a existing definition in mipi_syst.h.in.
+#  3. NewItemToBeAdded
+#   -> Items in this structure will be placed at the end of mipi_syst.h as 
a customized section.
+#
+#  Run GenMipiSystH.py without any parameters as normal python script after 
customizing.
+#
+#  Copyright (c) 

[edk2-devel] [PATCH v6 2/4] MdePkg: Add NULL library of TraceHubDebugSysTLib

2023-05-10 Thread Guo, Gua
From: Gua Guo 

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

This Library is NULL library of TraceHubDebugSysTLib.

Cc: Michael D Kinney 
Cc: Guo Gua 
Cc: Chan Laura 
Cc: Prakashan Krishnadas Veliyathuparambil 

Cc: K N Karthik 
Signed-off-by: Guo Gua 
Reviewed-by: Michael D Kinney 
Reviewed-by: K N Karthik 
Reviewed-by: Chan Laura 
---
 MdePkg/Include/Library/TraceHubDebugSysTLib.h | 81 +++
 .../TraceHubDebugSysTLibNull.c| 76 +
 .../TraceHubDebugSysTLibNull.inf  | 29 +++
 MdePkg/MdePkg.dsc |  1 +
 4 files changed, 187 insertions(+)
 create mode 100644 MdePkg/Include/Library/TraceHubDebugSysTLib.h
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.inf

diff --git a/MdePkg/Include/Library/TraceHubDebugSysTLib.h 
b/MdePkg/Include/Library/TraceHubDebugSysTLib.h
new file mode 100644
index 00..7df20e67d6
--- /dev/null
+++ b/MdePkg/Include/Library/TraceHubDebugSysTLib.h
@@ -0,0 +1,81 @@
+/** @file
+This header file declares Trace Hub related top level APIs.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef TRACE_HUB_DEBUG_SYST_LIB_H_
+#define TRACE_HUB_DEBUG_SYST_LIB_H_
+
+typedef enum {
+  SeverityNone= 0,
+  SeverityFatal   = 1,
+  SeverityError   = 2,
+  SeverityWarning = 3,
+  SeverityNormal  = 4,
+  SeverityUser1   = 5,
+  SeverityUser2   = 6,
+  SeverityUser3   = 7,
+  SeverityMax
+} TRACE_HUB_SEVERITY_TYPE;
+
+/**
+  Write debug string to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Buffer   A pointer to the data buffer.
+  @param[in]  NumberOfBytesThe size of data buffer.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTDebugWrite (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT8*Buffer,
+  IN UINTNNumberOfBytes
+  );
+
+/**
+  Write catalog status code message to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Id   Catalog ID.
+  @param[in]  Guid Driver Guid.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTWriteCataLog64StatusCode (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT64   Id,
+  IN GUID *Guid
+  );
+
+/**
+  Write catalog message to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType   Severity type of input message.
+  @param[in]  Id Catalog ID.
+  @param[in]  NumberOfParams Number of entries in argument list.
+  @param[in]  ...Catalog message parameters.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTWriteCataLog64 (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT64   Id,
+  IN UINTNNumberOfParams,
+  ...
+  );
+
+#endif // TRACE_HUB_DEBUG_SYST_LIB_H_
diff --git a/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c 
b/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
new file mode 100644
index 00..0bd14d4e24
--- /dev/null
+++ b/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
@@ -0,0 +1,76 @@
+/** @file
+Null library of TraceHubDebugSysTLib.
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+
+/**
+  Write debug string to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Buffer   A pointer to the data buffer.
+  @param[in]  NumberOfBytesThe size of data buffer.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTDebugWrite (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT8*Buffer,
+  IN UINTNNumberOfBytes
+  )
+{
+  return RETURN_UNSUPPORTED;
+}
+
+/**
+  Write catalog status code message to specified Trace Hub MMIO address.
+
+  @param[in]  SeverityType Severity type of input message.
+  @param[in]  Id   Catalog ID.
+  @param[in]  Guid Driver Guid.
+
+  @retval RETURN_SUCCESS  Data was written to Trace Hub.
+  @retval Other   Failed to output Trace Hub message.
+**/
+RETURN_STATUS
+EFIAPI
+TraceHubSysTWriteCataLog64StatusCode (
+  IN 

[edk2-devel] [PATCH v6 0/4] Trace Hub debug library support

2023-05-10 Thread Guo, Gua
From: Gua Guo 

V6:
- https://github.com/tianocore/edk2/pull/3901
  Split submodule into new patch
  Fix formatting issue
  Add Review-by message
  Offline check with Victor to use my sign-off name.

V5: if no other open, it will be final change
- https://github.com/tianocore/edk2/pull/3901
  Fix random exception when long run catalog debug message

V4
- https://github.com/tianocore/edk2/pull/3901 - Done
  Enhance SwapBytesGuid to use CopyGuid instead of CopyMem, to make implement 
code more simple.

V3
- https://github.com/tianocore/edk2/pull/3901 - Done
  - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why 
MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
Solution: Remove this macro, use Library Constructor to allocate it 
dynamiclly.
  - Open: 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c: 
SwapBytesGuid () algorithm wrong.
Solution: Follow correct algorithm to implement it.
VOID
EFIAPI
SwapBytesGuid (
  IN  GUID  *Guid,<--- In PreMem, guid is global data 
so region is readonly, add output data to support it.
  OUT GUID  *ConvertedGuid
);

  - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D
Solution: use *_*_*_CC_FLAGS  = -DMIPI_SYST_STATIC to unified both.


V2
- https://github.com/tianocore/edk2/pull/3901
  - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why 
MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
  - Open: 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c: 
SwapBytesGuid () algorithm wrong.
  - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D

V1
Previous PR:
- https://github.com/tianocore/edk2/pull/3613
  - TraceHubDebugLib without submodule - Reject

- https://github.com/tianocore/edk2/pull/3793
  - TraceHubDebugLib with submodule and without seperate into MipiSysTLib and 
TraceHubDebugLib - Reject

Gua Guo (4):
  MdePkg: Add MipiSysTLib library
  MdePkg: Add NULL library of TraceHubDebugSysTLib
  MdeModulePkg: Add TraceHubDebugSysTLib library
  Maintainers.txt: Update reviewers and maintainers for
TraceHubDebugLib.

 Maintainers.txt   |  18 +
 .../Include/Guid/TraceHubDebugInfoHob.h   |  24 +
 .../BaseTraceHubDebugSysTLib.c| 245 ++
 .../BaseTraceHubDebugSysTLib.inf  |  44 +
 .../DxeSmmTraceHubDebugSysTLib.c  | 263 ++
 .../DxeSmmTraceHubDebugSysTLib.inf|  51 ++
 .../InternalTraceHubApi.c |  74 ++
 .../InternalTraceHubApi.h |  37 +
 .../InternalTraceHubApiCommon.c   | 200 +
 .../InternalTraceHubApiCommon.h   | 119 +++
 .../PeiTraceHubDebugSysTLib.c | 282 +++
 .../PeiTraceHubDebugSysTLib.inf   |  50 ++
 .../Library/TraceHubDebugSysTLib/Readme.md|  26 +
 MdeModulePkg/MdeModulePkg.dec |  21 +
 MdeModulePkg/MdeModulePkg.dsc |   3 +
 MdeModulePkg/MdeModulePkg.uni |  18 +
 MdePkg/Include/Library/MipiSysTLib.h  |  66 ++
 MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 ++
 MdePkg/Library/MipiSysTLib/GenMipiSystH.py| 132 +++
 MdePkg/Library/MipiSysTLib/MipiSysTLib.c  | 123 +++
 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf|  52 ++
 MdePkg/Library/MipiSysTLib/Platform.c | 164 
 MdePkg/Library/MipiSysTLib/Platform.h | 138 +++
 MdePkg/Library/MipiSysTLib/Readme.md  |  25 +
 MdePkg/Library/MipiSysTLib/mipi_syst.h| 789 ++
 .../TraceHubDebugSysTLibNull.c|  76 ++
 .../TraceHubDebugSysTLibNull.inf  |  29 +
 MdePkg/MdePkg.ci.yaml |  12 +-
 MdePkg/MdePkg.dec |   9 +
 MdePkg/MdePkg.dsc |   2 +
 30 files changed, 3170 insertions(+), 3 deletions(-)
 create mode 100644 MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTLib.inf
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApi.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon.h
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.c
 create mode 100644 
MdeModulePkg/Library/TraceHubDebugSysTLib/PeiTraceHubDebugSysTLib.inf
 create mode 100644 MdeModulePkg/Library/TraceHubDebugSysTLib/Readme.md
 create mode 100644 MdePkg/Include/Library/MipiSysTLib.h
 create mode 100644 

Re: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update reviewers and maintainers for TraceHubDebugLib.

2023-05-10 Thread Michael D Kinney
Hi Gua,

Can you please resend the email patches for the series and make sure the Author 
and Signed-off-by are correct 
on your local branch before sending.

Thanks,

Mike

> -Original Message-
> From: Guo, Gua 
> Sent: Wednesday, May 10, 2023 2:02 PM
> To: Kinney, Michael D ; devel@edk2.groups.io;
> quic_llind...@quicinc.com
> Cc: Hsu, VictorX ; Chiu, Chasel
> 
> Subject: RE: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update reviewers
> and maintainers for TraceHubDebugLib.
> 
> @Leif Lindholm and @Kinney, Michael D
> 
> I've locate Leif and update on the PR.
> 
> - Split submodule into new patch
> - Fix formatting issue
> - Add Review-by message
> - Offline check with Victor to use my sign-off name.
> https://github.com/tianocore/edk2/pull/3901
> 
> Thanks,
> Gua
> -Original Message-
> From: Kinney, Michael D 
> Sent: Thursday, May 11, 2023 2:57 AM
> To: devel@edk2.groups.io; quic_llind...@quicinc.com; Guo, Gua
> 
> Cc: Hsu, VictorX ; Kinney, Michael D
> 
> Subject: RE: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update reviewers
> and maintainers for TraceHubDebugLib.
> 
> Hi Leif,
> 
> The original patch series was sent by Victor in January and has Signed-off-by
> from Victor.
> 
>   https://edk2.groups.io/g/devel/message/99333
> 
> Subsequent updates to the patch series based on feedback were sent by Gua.
> 
> With this background, who should be Signed-off-by and the Author in the
> final patch series?
> 
> Mike
> 
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of Leif
> > Lindholm
> > Sent: Wednesday, May 10, 2023 11:34 AM
> > To: devel@edk2.groups.io; Guo, Gua 
> > Cc: Hsu, VictorX 
> > Subject: Re: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update
> > reviewers and maintainers for TraceHubDebugLib.
> >
> > On Wed, May 10, 2023 at 10:33:55 +0800, Guo, Gua wrote:
> > > From: Gua Guo 
> > >
> > > Update reviewers and maintainers for TraceHubDebugSysTlib.
> > >
> > > Signed-off-by: VictorX Hsu 
> >
> > The DCO is a legal statement about the contribution. Only the person
> > posting the patches can make that statement.
> > If VictorX is the author, that should be covered by the From: tag.
> > I notice this applies to the whole set. Please address.
> >
> > Once addressed:
> > Reviewed-by: Leif Lindholm 
> >
> > /
> > Leif
> >
> > > ---
> > >  Maintainers.txt | 18 ++
> > >  1 file changed, 18 insertions(+)
> > >
> > > diff --git a/Maintainers.txt b/Maintainers.txt index
> > > 09d04af27a..30e2d2686d 100644
> > > --- a/Maintainers.txt
> > > +++ b/Maintainers.txt
> > > @@ -437,6 +437,14 @@ R: Zhiguang Liu 
> > [LiuZhiguang001]
> > >  R: Ray Ni  [niruiyu]
> > >  R: Gua Guo  [gguo11837463]
> > >
> > > +MdeModulePkg: Trace Hub debug message related library instance
> > > +F: MdeModulePkg/Library/TraceHubDebugSysTLib/
> > > +F: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
> > > +M: Gua Guo  [gguo11837463]
> > > +M: Prakashan Krishnadas Veliyathuparambil
> >  [kprakas2]
> > > +R: Chan Laura  [lauracha]
> > > +R: K N Karthik  [karthikkabbigere1]
> > > +
> > >  MdePkg
> > >  F: MdePkg/
> > >  W: https://github.com/tianocore/tianocore.github.io/wiki/MdePkg
> > > @@ -444,6 +452,16 @@ M: Michael D Kinney
> > > 
> > [mdkinney]
> > >  M: Liming Gao  [lgao4]
> > >  R: Zhiguang Liu  [LiuZhiguang001]
> > >
> > > +MdePkg: Trace Hub debug message related library instance
> > > +F: MdePkg/Library/TraceHubDebugSysTLibNull/
> > > +F: MdePkg/Library/MipiSysTLib/
> > > +F: MdePkg/Include/Library/TraceHubDebugSysTLib.h
> > > +F: MdePkg/Include/Library/MipiSysTLib.h
> > > +M: Gua Guo  [gguo11837463]
> > > +M: Prakashan Krishnadas Veliyathuparambil
> >  [kprakas2]
> > > +R: Chan Laura  [lauracha]
> > > +R: K N Karthik  [karthikkabbigere1]
> > > +
> > >  NetworkPkg
> > >  F: NetworkPkg/
> > >  W: https://github.com/tianocore/tianocore.github.io/wiki/NetworkPkg
> > > --
> > > 2.39.2.windows.1
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > 
> >



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




Re: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update reviewers and maintainers for TraceHubDebugLib.

2023-05-10 Thread Guo, Gua
@Leif Lindholm and @Kinney, Michael D

I've locate Leif and update on the PR.

- Split submodule into new patch
- Fix formatting issue
- Add Review-by message
- Offline check with Victor to use my sign-off name.
https://github.com/tianocore/edk2/pull/3901

Thanks,
Gua
-Original Message-
From: Kinney, Michael D  
Sent: Thursday, May 11, 2023 2:57 AM
To: devel@edk2.groups.io; quic_llind...@quicinc.com; Guo, Gua 

Cc: Hsu, VictorX ; Kinney, Michael D 

Subject: RE: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update reviewers and 
maintainers for TraceHubDebugLib.

Hi Leif,

The original patch series was sent by Victor in January and has Signed-off-by 
from Victor.

https://edk2.groups.io/g/devel/message/99333

Subsequent updates to the patch series based on feedback were sent by Gua.

With this background, who should be Signed-off-by and the Author in the final 
patch series?

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Leif 
> Lindholm
> Sent: Wednesday, May 10, 2023 11:34 AM
> To: devel@edk2.groups.io; Guo, Gua 
> Cc: Hsu, VictorX 
> Subject: Re: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update 
> reviewers and maintainers for TraceHubDebugLib.
> 
> On Wed, May 10, 2023 at 10:33:55 +0800, Guo, Gua wrote:
> > From: Gua Guo 
> >
> > Update reviewers and maintainers for TraceHubDebugSysTlib.
> >
> > Signed-off-by: VictorX Hsu 
> 
> The DCO is a legal statement about the contribution. Only the person 
> posting the patches can make that statement.
> If VictorX is the author, that should be covered by the From: tag.
> I notice this applies to the whole set. Please address.
> 
> Once addressed:
> Reviewed-by: Leif Lindholm 
> 
> /
> Leif
> 
> > ---
> >  Maintainers.txt | 18 ++
> >  1 file changed, 18 insertions(+)
> >
> > diff --git a/Maintainers.txt b/Maintainers.txt index 
> > 09d04af27a..30e2d2686d 100644
> > --- a/Maintainers.txt
> > +++ b/Maintainers.txt
> > @@ -437,6 +437,14 @@ R: Zhiguang Liu 
> [LiuZhiguang001]
> >  R: Ray Ni  [niruiyu]
> >  R: Gua Guo  [gguo11837463]
> >
> > +MdeModulePkg: Trace Hub debug message related library instance
> > +F: MdeModulePkg/Library/TraceHubDebugSysTLib/
> > +F: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
> > +M: Gua Guo  [gguo11837463]
> > +M: Prakashan Krishnadas Veliyathuparambil
>  [kprakas2]
> > +R: Chan Laura  [lauracha]
> > +R: K N Karthik  [karthikkabbigere1]
> > +
> >  MdePkg
> >  F: MdePkg/
> >  W: https://github.com/tianocore/tianocore.github.io/wiki/MdePkg
> > @@ -444,6 +452,16 @@ M: Michael D Kinney 
> > 
> [mdkinney]
> >  M: Liming Gao  [lgao4]
> >  R: Zhiguang Liu  [LiuZhiguang001]
> >
> > +MdePkg: Trace Hub debug message related library instance
> > +F: MdePkg/Library/TraceHubDebugSysTLibNull/
> > +F: MdePkg/Library/MipiSysTLib/
> > +F: MdePkg/Include/Library/TraceHubDebugSysTLib.h
> > +F: MdePkg/Include/Library/MipiSysTLib.h
> > +M: Gua Guo  [gguo11837463]
> > +M: Prakashan Krishnadas Veliyathuparambil
>  [kprakas2]
> > +R: Chan Laura  [lauracha]
> > +R: K N Karthik  [karthikkabbigere1]
> > +
> >  NetworkPkg
> >  F: NetworkPkg/
> >  W: https://github.com/tianocore/tianocore.github.io/wiki/NetworkPkg
> > --
> > 2.39.2.windows.1
> >
> >
> >
> >
> >
> >
> 
> 
> 
> 



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




Re: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update reviewers and maintainers for TraceHubDebugLib.

2023-05-10 Thread Michael D Kinney
Hi Leif,

The original patch series was sent by Victor in January and has Signed-off-by 
from Victor.

https://edk2.groups.io/g/devel/message/99333

Subsequent updates to the patch series based on feedback were sent by Gua.

With this background, who should be Signed-off-by and the Author in the final 
patch series?

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Leif
> Lindholm
> Sent: Wednesday, May 10, 2023 11:34 AM
> To: devel@edk2.groups.io; Guo, Gua 
> Cc: Hsu, VictorX 
> Subject: Re: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update reviewers
> and maintainers for TraceHubDebugLib.
> 
> On Wed, May 10, 2023 at 10:33:55 +0800, Guo, Gua wrote:
> > From: Gua Guo 
> >
> > Update reviewers and maintainers for TraceHubDebugSysTlib.
> >
> > Signed-off-by: VictorX Hsu 
> 
> The DCO is a legal statement about the contribution. Only the person
> posting the patches can make that statement.
> If VictorX is the author, that should be covered by the From: tag.
> I notice this applies to the whole set. Please address.
> 
> Once addressed:
> Reviewed-by: Leif Lindholm 
> 
> /
> Leif
> 
> > ---
> >  Maintainers.txt | 18 ++
> >  1 file changed, 18 insertions(+)
> >
> > diff --git a/Maintainers.txt b/Maintainers.txt
> > index 09d04af27a..30e2d2686d 100644
> > --- a/Maintainers.txt
> > +++ b/Maintainers.txt
> > @@ -437,6 +437,14 @@ R: Zhiguang Liu 
> [LiuZhiguang001]
> >  R: Ray Ni  [niruiyu]
> >  R: Gua Guo  [gguo11837463]
> >
> > +MdeModulePkg: Trace Hub debug message related library instance
> > +F: MdeModulePkg/Library/TraceHubDebugSysTLib/
> > +F: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
> > +M: Gua Guo  [gguo11837463]
> > +M: Prakashan Krishnadas Veliyathuparambil
>  [kprakas2]
> > +R: Chan Laura  [lauracha]
> > +R: K N Karthik  [karthikkabbigere1]
> > +
> >  MdePkg
> >  F: MdePkg/
> >  W: https://github.com/tianocore/tianocore.github.io/wiki/MdePkg
> > @@ -444,6 +452,16 @@ M: Michael D Kinney 
> [mdkinney]
> >  M: Liming Gao  [lgao4]
> >  R: Zhiguang Liu  [LiuZhiguang001]
> >
> > +MdePkg: Trace Hub debug message related library instance
> > +F: MdePkg/Library/TraceHubDebugSysTLibNull/
> > +F: MdePkg/Library/MipiSysTLib/
> > +F: MdePkg/Include/Library/TraceHubDebugSysTLib.h
> > +F: MdePkg/Include/Library/MipiSysTLib.h
> > +M: Gua Guo  [gguo11837463]
> > +M: Prakashan Krishnadas Veliyathuparambil
>  [kprakas2]
> > +R: Chan Laura  [lauracha]
> > +R: K N Karthik  [karthikkabbigere1]
> > +
> >  NetworkPkg
> >  F: NetworkPkg/
> >  W: https://github.com/tianocore/tianocore.github.io/wiki/NetworkPkg
> > --
> > 2.39.2.windows.1
> >
> >
> >
> >
> >
> >
> 
> 
> 
> 



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




Re: [edk2-devel] [PATCH v3 1/4] MdePkg: Add MipiSysTLib library

2023-05-10 Thread Michael D Kinney
Thanks Leif,

I will split the patch into the line ending changes and the addition of just 
the MipiSysTLib submodule and apply your Rb to the submodule addition.

Mike

> -Original Message-
> From: Leif Lindholm 
> Sent: Wednesday, May 10, 2023 11:29 AM
> To: devel@edk2.groups.io; Guo, Gua 
> Cc: Kinney, Michael D ; Chan, Laura
> ; Prakashan, Krishnadas Veliyathuparambil
> ; K N, Karthik
> ; Hsu, VictorX 
> Subject: Re: [edk2-devel] [PATCH v3 1/4] MdePkg: Add MipiSysTLib library
> 
> On Wed, May 10, 2023 at 10:33:52 +0800, Guo, Gua wrote:
> > From: Gua Guo 
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4144
> >
> > This Library provides functions consuming MIPI SYS-T submodule.
> >
> > Cc: Michael D Kinney 
> > Cc: Guo Gua 
> > Cc: Chan Laura 
> > Cc: Prakashan Krishnadas Veliyathuparambil
> 
> > Cc: K N Karthik 
> > Signed-off-by: VictorX Hsu 
> > ---
> >  .gitmodules|  11 +-
> >  .pytool/CISettings.py  |   2 +
> >  MdePkg/Include/Library/MipiSysTLib.h   |  66 ++
> >  MdePkg/Library/MipiSysTLib/GenMipiSystH.py | 132 
> >  MdePkg/Library/MipiSysTLib/MipiSysTLib.c   | 123 
> >  MdePkg/Library/MipiSysTLib/MipiSysTLib.inf |  52 ++
> >  MdePkg/Library/MipiSysTLib/Platform.c  | 164 +
> >  MdePkg/Library/MipiSysTLib/Platform.h  | 138 
> >  MdePkg/Library/MipiSysTLib/Readme.md   |  25 +
> >  MdePkg/Library/MipiSysTLib/mipi_syst.h | 789 +
> >  MdePkg/Library/MipiSysTLib/mipisyst|   1 +
> >  MdePkg/MdePkg.ci.yaml  |  12 +-
> >  MdePkg/MdePkg.dec  |   9 +
> >  MdePkg/MdePkg.dsc  |   1 +
> >  ReadMe.rst |   1 +
> >  15 files changed, 1519 insertions(+), 7 deletions(-)
> >  create mode 100644 MdePkg/Include/Library/MipiSysTLib.h
> >  create mode 100644 MdePkg/Library/MipiSysTLib/GenMipiSystH.py
> >  create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.c
> >  create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
> >  create mode 100644 MdePkg/Library/MipiSysTLib/Platform.c
> >  create mode 100644 MdePkg/Library/MipiSysTLib/Platform.h
> >  create mode 100644 MdePkg/Library/MipiSysTLib/Readme.md
> >  create mode 100644 MdePkg/Library/MipiSysTLib/mipi_syst.h
> >  create mode 16 MdePkg/Library/MipiSysTLib/mipisyst
> >
> > diff --git a/.gitmodules b/.gitmodules
> > index 6211c59724..fb79ebfb72 100644
> > --- a/.gitmodules
> > +++ b/.gitmodules
> > @@ -16,7 +16,7 @@
> >  [submodule "BaseTools/Source/C/BrotliCompress/brotli"]
> > path = BaseTools/Source/C/BrotliCompress/brotli
> > url = https://github.com/google/brotli
> > -   ignore = untracked
> > +   ignore = untracked
> >  [submodule "RedfishPkg/Library/JsonLib/jansson"]
> > path = RedfishPkg/Library/JsonLib/jansson
> > url = https://github.com/akheron/jansson
> > @@ -26,6 +26,9 @@
> >  [submodule "UnitTestFrameworkPkg/Library/SubhookLib/subhook"]
> > path = UnitTestFrameworkPkg/Library/SubhookLib/subhook
> > url = https://github.com/Zeex/subhook.git
> > -[submodule "MdePkg/Library/BaseFdtLib/libfdt"]
> > -   path = MdePkg/Library/BaseFdtLib/libfdt
> > -   url = https://github.com/devicetree-org/pylibfdt.git
> > +[submodule "MdePkg/Library/BaseFdtLib/libfdt"]
> > +   path = MdePkg/Library/BaseFdtLib/libfdt
> > +   url = https://github.com/devicetree-org/pylibfdt.git
> 
> It's unfortunate that incorrect line endings have crept into the
> .gitmodules file, but fixing that should be a separate patch, not part
> of this one.
> 
> Once the unrelated changes have been removed:
> Reviewed-by: Leif Lindholm 
> 
> > +[submodule "MdePkg/Library/MipiSysTLib/mipisyst"]
> > +   path = MdePkg/Library/MipiSysTLib/mipisyst
> > +   url = https://github.com/MIPI-Alliance/public-mipi-sys-t.git
> > diff --git a/.pytool/CISettings.py b/.pytool/CISettings.py
> > index 2fb99f2a17..6fb7342f81 100644
> > --- a/.pytool/CISettings.py
> > +++ b/.pytool/CISettings.py
> > @@ -197,6 +197,8 @@ class Settings(CiBuildSettingsManager,
> UpdateSettingsManager, SetupSettingsManag
> >  "UnitTestFrameworkPkg/Library/SubhookLib/subhook", False))
> >  rs.append(RequiredSubmodule(
> >  "MdePkg/Library/BaseFdtLib/libfdt", False))
> > +rs.append(RequiredSubmodule(
> > +"MdePkg/Library/MipiSysTLib/mipisyst", False))
> >  return rs
> >
> >  def GetName(self):
> > diff --git a/MdePkg/Include/Library/MipiSysTLib.h
> b/MdePkg/Include/Library/MipiSysTLib.h
> > new file mode 100644
> > index 00..4ced1c02cd
> > --- /dev/null
> > +++ b/MdePkg/Include/Library/MipiSysTLib.h
> > @@ -0,0 +1,66 @@
> > +/** @file
> > +This header file declares functions consuming MIPI Sys-T submodule.
> > +
> > +Copyright (c) 2023, Intel Corporation. All rights reserved.
> > +
> > +SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +#ifndef MIPI_SYST_LIB_H_
> > +#define 

Re: [edk2-devel] [PATCH v3 4/4] Maintainers.txt: Update reviewers and maintainers for TraceHubDebugLib.

2023-05-10 Thread Leif Lindholm
On Wed, May 10, 2023 at 10:33:55 +0800, Guo, Gua wrote:
> From: Gua Guo 
> 
> Update reviewers and maintainers for TraceHubDebugSysTlib.
> 
> Signed-off-by: VictorX Hsu 

The DCO is a legal statement about the contribution. Only the person
posting the patches can make that statement.
If VictorX is the author, that should be covered by the From: tag.
I notice this applies to the whole set. Please address.

Once addressed:
Reviewed-by: Leif Lindholm 

/
Leif

> ---
>  Maintainers.txt | 18 ++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 09d04af27a..30e2d2686d 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -437,6 +437,14 @@ R: Zhiguang Liu  [LiuZhiguang001]
>  R: Ray Ni  [niruiyu]
>  R: Gua Guo  [gguo11837463]
>  
> +MdeModulePkg: Trace Hub debug message related library instance
> +F: MdeModulePkg/Library/TraceHubDebugSysTLib/
> +F: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
> +M: Gua Guo  [gguo11837463]
> +M: Prakashan Krishnadas Veliyathuparambil 
>  [kprakas2]
> +R: Chan Laura  [lauracha]
> +R: K N Karthik  [karthikkabbigere1]
> +
>  MdePkg
>  F: MdePkg/
>  W: https://github.com/tianocore/tianocore.github.io/wiki/MdePkg
> @@ -444,6 +452,16 @@ M: Michael D Kinney  
> [mdkinney]
>  M: Liming Gao  [lgao4]
>  R: Zhiguang Liu  [LiuZhiguang001]
>  
> +MdePkg: Trace Hub debug message related library instance
> +F: MdePkg/Library/TraceHubDebugSysTLibNull/
> +F: MdePkg/Library/MipiSysTLib/
> +F: MdePkg/Include/Library/TraceHubDebugSysTLib.h
> +F: MdePkg/Include/Library/MipiSysTLib.h
> +M: Gua Guo  [gguo11837463]
> +M: Prakashan Krishnadas Veliyathuparambil 
>  [kprakas2]
> +R: Chan Laura  [lauracha]
> +R: K N Karthik  [karthikkabbigere1]
> +
>  NetworkPkg
>  F: NetworkPkg/
>  W: https://github.com/tianocore/tianocore.github.io/wiki/NetworkPkg
> -- 
> 2.39.2.windows.1
> 
> 
> 
> 
> 
> 


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




Re: [edk2-devel] [PATCH v3 1/4] MdePkg: Add MipiSysTLib library

2023-05-10 Thread Leif Lindholm
On Wed, May 10, 2023 at 10:33:52 +0800, Guo, Gua wrote:
> From: Gua Guo 
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4144
> 
> This Library provides functions consuming MIPI SYS-T submodule.
> 
> Cc: Michael D Kinney 
> Cc: Guo Gua 
> Cc: Chan Laura 
> Cc: Prakashan Krishnadas Veliyathuparambil 
> 
> Cc: K N Karthik 
> Signed-off-by: VictorX Hsu 
> ---
>  .gitmodules|  11 +-
>  .pytool/CISettings.py  |   2 +
>  MdePkg/Include/Library/MipiSysTLib.h   |  66 ++
>  MdePkg/Library/MipiSysTLib/GenMipiSystH.py | 132 
>  MdePkg/Library/MipiSysTLib/MipiSysTLib.c   | 123 
>  MdePkg/Library/MipiSysTLib/MipiSysTLib.inf |  52 ++
>  MdePkg/Library/MipiSysTLib/Platform.c  | 164 +
>  MdePkg/Library/MipiSysTLib/Platform.h  | 138 
>  MdePkg/Library/MipiSysTLib/Readme.md   |  25 +
>  MdePkg/Library/MipiSysTLib/mipi_syst.h | 789 +
>  MdePkg/Library/MipiSysTLib/mipisyst|   1 +
>  MdePkg/MdePkg.ci.yaml  |  12 +-
>  MdePkg/MdePkg.dec  |   9 +
>  MdePkg/MdePkg.dsc  |   1 +
>  ReadMe.rst |   1 +
>  15 files changed, 1519 insertions(+), 7 deletions(-)
>  create mode 100644 MdePkg/Include/Library/MipiSysTLib.h
>  create mode 100644 MdePkg/Library/MipiSysTLib/GenMipiSystH.py
>  create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.c
>  create mode 100644 MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
>  create mode 100644 MdePkg/Library/MipiSysTLib/Platform.c
>  create mode 100644 MdePkg/Library/MipiSysTLib/Platform.h
>  create mode 100644 MdePkg/Library/MipiSysTLib/Readme.md
>  create mode 100644 MdePkg/Library/MipiSysTLib/mipi_syst.h
>  create mode 16 MdePkg/Library/MipiSysTLib/mipisyst
> 
> diff --git a/.gitmodules b/.gitmodules
> index 6211c59724..fb79ebfb72 100644
> --- a/.gitmodules
> +++ b/.gitmodules
> @@ -16,7 +16,7 @@
>  [submodule "BaseTools/Source/C/BrotliCompress/brotli"]
>   path = BaseTools/Source/C/BrotliCompress/brotli
>   url = https://github.com/google/brotli
> - ignore = untracked
> + ignore = untracked
>  [submodule "RedfishPkg/Library/JsonLib/jansson"]
>   path = RedfishPkg/Library/JsonLib/jansson
>   url = https://github.com/akheron/jansson
> @@ -26,6 +26,9 @@
>  [submodule "UnitTestFrameworkPkg/Library/SubhookLib/subhook"]
>   path = UnitTestFrameworkPkg/Library/SubhookLib/subhook
>   url = https://github.com/Zeex/subhook.git
> -[submodule "MdePkg/Library/BaseFdtLib/libfdt"]
> - path = MdePkg/Library/BaseFdtLib/libfdt
> - url = https://github.com/devicetree-org/pylibfdt.git
> +[submodule "MdePkg/Library/BaseFdtLib/libfdt"]
> + path = MdePkg/Library/BaseFdtLib/libfdt
> + url = https://github.com/devicetree-org/pylibfdt.git

It's unfortunate that incorrect line endings have crept into the
.gitmodules file, but fixing that should be a separate patch, not part
of this one.

Once the unrelated changes have been removed:
Reviewed-by: Leif Lindholm 

> +[submodule "MdePkg/Library/MipiSysTLib/mipisyst"]
> + path = MdePkg/Library/MipiSysTLib/mipisyst
> + url = https://github.com/MIPI-Alliance/public-mipi-sys-t.git
> diff --git a/.pytool/CISettings.py b/.pytool/CISettings.py
> index 2fb99f2a17..6fb7342f81 100644
> --- a/.pytool/CISettings.py
> +++ b/.pytool/CISettings.py
> @@ -197,6 +197,8 @@ class Settings(CiBuildSettingsManager, 
> UpdateSettingsManager, SetupSettingsManag
>  "UnitTestFrameworkPkg/Library/SubhookLib/subhook", False))
>  rs.append(RequiredSubmodule(
>  "MdePkg/Library/BaseFdtLib/libfdt", False))
> +rs.append(RequiredSubmodule(
> +"MdePkg/Library/MipiSysTLib/mipisyst", False))
>  return rs
>  
>  def GetName(self):
> diff --git a/MdePkg/Include/Library/MipiSysTLib.h 
> b/MdePkg/Include/Library/MipiSysTLib.h
> new file mode 100644
> index 00..4ced1c02cd
> --- /dev/null
> +++ b/MdePkg/Include/Library/MipiSysTLib.h
> @@ -0,0 +1,66 @@
> +/** @file
> +This header file declares functions consuming MIPI Sys-T submodule.
> +
> +Copyright (c) 2023, Intel Corporation. All rights reserved.
> +
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef MIPI_SYST_LIB_H_
> +#define MIPI_SYST_LIB_H_
> +
> +/**
> +  Invoke initialization function in Mipi Sys-T module to initialize Mipi 
> Sys-T handle.
> +
> +  @param[in, out]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.
> +
> +  @retval RETURN_SUCCESS  MIPI_SYST_HANDLE instance was initialized.
> +  @retval Other   MIPI_SYST_HANDLE instance was not initialized.
> +**/
> +RETURN_STATUS
> +EFIAPI
> +InitMipiSystHandle (
> +  IN OUT VOID  *MipiSystHandle
> +  );
> +
> +/**
> +  Invoke write_debug_string function in Mipi Sys-T module.
> +
> +  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.
> +  @param[in]  SeveritySeverity type of input 

Re: [edk2-devel] [PATCH v3 1/1] Platform/SbsaQemu: read platform version

2023-05-10 Thread Marcin Juszkiewicz

W dniu 10.05.2023 o 18:14, Rebecca Cran pisze:


Sorry, but there are new problems.


No problem. Thanks for reviewing.


There should be a space before the parenthesis in the 'DEBUG' line.


No problem. I hope that one day someone will run source formatter on 
whole edk2-platforms so it would be possible to autoformat changes 
before posting.


PcdGet32 doesn't return a RETURN_STATUS or EFI_STATUS, so 
ASSERT_EFI_ERROR is incorrect.


fixed




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




[edk2-devel] [PATCH v4 1/1] Platform/SbsaQemu: read platform version

2023-05-10 Thread Marcin Juszkiewicz
Qemu has versioning for sbsa-ref platform. TF-A reads it from provided
DeviceTree and provides as SMC.

This change adds reading platform version into EDK2.

Signed-off-by: Marcin Juszkiewicz 
---
 Platform/Qemu/SbsaQemu/SbsaQemu.dsc   |  3 +++
 .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 27 +++
 .../SbsaQemuPlatformDxe.inf   |  5 
 Silicon/Qemu/SbsaQemu/SbsaQemu.dec|  3 +++
 4 files changed, 38 insertions(+)

diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc 
b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
index c9b912cc1e9e..facca3b3e272 100644
--- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
+++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
@@ -561,6 +561,9 @@ DEFINE NETWORK_HTTP_BOOT_ENABLE   = FALSE
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L"AT"
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L"SK"
 
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0
+
 

 #
 # Components Section - list of all EDK II Modules needed by this Platform
diff --git 
a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c 
b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
index b7270a07abbd..91ae85e0d950 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
@@ -7,15 +7,25 @@
 *
 **/
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
+/* those probably should go into IndustryStandard/ArmStdSmc.h */
+#define SMC_FASTCALL   0x8000
+#define SMC64_FUNCTION (SMC_FASTCALL   | 0x4000)
+#define SIP_FUNCTION   (SMC64_FUNCTION | 0x0200)
+#define SIP_FUNCTION_ID(n) (SIP_FUNCTION   | (n))
+
+#define SIP_SVC_VERSION SIP_FUNCTION_ID(1)
+
 EFI_STATUS
 EFIAPI
 InitializeSbsaQemuPlatformDxe (
@@ -26,6 +36,9 @@ InitializeSbsaQemuPlatformDxe (
   EFI_STATUS Status;
   UINTN  Size;
   VOID*  Base;
+  UINTN  Major;
+  UINTN  Minor;
+  UINTN  Result;
 
   DEBUG ((DEBUG_INFO, "%a: InitializeSbsaQemuPlatformDxe called\n", 
__FUNCTION__));
 
@@ -51,5 +64,19 @@ InitializeSbsaQemuPlatformDxe (
 return Status;
   }
 
+  Result = ArmCallSmc0 (SIP_SVC_VERSION, , , NULL);
+  if (Result == SMC_ARCH_CALL_SUCCESS)
+  {
+Result = PcdSet32S (PcdPlatformVersionMajor, Major);
+ASSERT_EFI_ERROR (Result);
+Result = PcdSet32S (PcdPlatformVersionMinor, Minor);
+ASSERT_EFI_ERROR (Result);
+  }
+
+  Major = PcdGet32 (PcdPlatformVersionMajor);
+  Minor = PcdGet32 (PcdPlatformVersionMinor);
+
+  DEBUG ((DEBUG_INFO, "Platform version: %d.%d\n", Major, Minor));
+
   return EFI_SUCCESS;
 }
diff --git 
a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf 
b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
index 21d2135f6d17..1f2c8a9dd6af 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
@@ -20,6 +20,7 @@
   SbsaQemuPlatformDxe.c
 
 [Packages]
+  ArmPkg/ArmPkg.dec
   ArmVirtPkg/ArmVirtPkg.dec
   EmbeddedPkg/EmbeddedPkg.dec
   MdeModulePkg/MdeModulePkg.dec
@@ -27,6 +28,7 @@
   Silicon/Qemu/SbsaQemu/SbsaQemu.dec
 
 [LibraryClasses]
+  ArmSmcLib
   PcdLib
   DebugLib
   NonDiscoverableDeviceRegistrationLib
@@ -36,6 +38,9 @@
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize
 
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor
+
 [Depex]
   TRUE
 
diff --git a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec 
b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
index 8654cc7c858c..fb5903bfda0f 100644
--- a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
+++ b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
@@ -70,3 +70,6 @@
   
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisManufacturer|L""|VOID*|0x011B
   
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L""|VOID*|0x011C
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L""|VOID*|0x011D
+
+  
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0|UINT32|0x011E
+  
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0|UINT32|0x011F
-- 
2.40.1



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

Re: [edk2-devel] JunoPkg ARM build breakage: "Error: bad instruction `aarch64_bti(c)'"

2023-05-10 Thread Leif Lindholm
On Wed, May 10, 2023 at 18:54:04 +0200, Ard Biesheuvel wrote:
> (cc Leif)
> 
> On Wed, 10 May 2023 at 18:52, Rebecca Cran  wrote:
> >
> > Thanks. Yes, that fixes it.
> >
> >
> > I also tried running the build script with CLANGDWARF, and it seems to
> > have found some valid problems with
> > Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c
> >
> 
> Seems to me like an excellent opportunity to rip that thing out completely.

Sounds like the ideal solution. The /dev/mem of program loaders.

/
Leif

> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:216:11:
> > error: variable 'FileSize' is used uninitialized whenever 'if' condition
> > is false [-Werror,-Wsometimes-uninitialized]
> >if (FileHandle != NULL) {
> >^~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> > note: uninitialized use occurs here
> >WriteBackDataCacheRange (FileData, FileSize);
> >   ^~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:216:7:
> > note: remove the 'if' if its condition is always true
> >if (FileHandle != NULL) {
> >^~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9:
> > error: variable 'FileSize' is used uninitialized whenever 'if' condition
> > is true [-Werror,-Wsometimes-uninitialized]
> >  if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
> >  ^~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> > note: uninitialized use occurs here
> >WriteBackDataCacheRange (FileData, FileSize);
> >   ^~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:5:
> > note: remove the 'if' if its condition is always false
> >  if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
> >  ^~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9:
> > error: variable 'FileSize' is used uninitialized whenever '||' condition
> > is true [-Werror,-Wsometimes-uninitialized]
> >  if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
> >  ^~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> > note: uninitialized use occurs here
> >WriteBackDataCacheRange (FileData, FileSize);
> >   ^~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9:
> > note: remove the '||' if its condition is always false
> >  if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
> >  ^~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:172:7:
> > error: variable 'FileSize' is used uninitialized whenever 'if' condition
> > is true [-Werror,-Wsometimes-uninitialized]
> >if (EFI_ERROR (Status)) {
> >^~
> > /home/bcran/src/uefi/edk2/MdePkg/Include/Uefi/UefiBaseType.h:159:23:
> > note: expanded from macro 'EFI_ERROR'
> > #define EFI_ERROR(A)  RETURN_ERROR(A)
> >^~~
> > /home/bcran/src/uefi/edk2/MdePkg/Include/Base.h:1061:35: note: expanded
> > from macro 'RETURN_ERROR'
> > #define RETURN_ERROR(StatusCode) (((INTN)(RETURN_STATUS)(StatusCode)) < 0)
> > ^
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> > note: uninitialized use occurs here
> >WriteBackDataCacheRange (FileData, FileSize);
> >   ^~~~
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:172:3:
> > note: remove the 'if' if its condition is always false
> >if (EFI_ERROR (Status)) {
> >^
> > /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:136:39:
> > note: initialize the variable 'FileSize' to silence this warning
> >UINTN   FileSize;
> >^
> > = 0
> > 4 errors generated.
> > make: *** [GNUmakefile:342:
> > /home/bcran/src/uefi/Build/ArmJuno/RELEASE_CLANGDWARF/AARCH64/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/RunAxf.obj]
> > Error 1
> >
> > --
> >
> > Rebecca Cran
> >
> >
> >
> > On 5/10/23 10:27, Ard Biesheuvel wrote:
> > > Hi Rebecca,
> > >
> > > On Wed, 10 May 2023 at 18:23, Rebecca Cran  wrote:
> > >> I ran my script that tries to build all Arm platforms in edk2-platforms
> > >> (with the exception of known broken ones) with the 

Re: [edk2-devel] JunoPkg ARM build breakage: "Error: bad instruction `aarch64_bti(c)'"

2023-05-10 Thread Ard Biesheuvel
(cc Leif)

On Wed, 10 May 2023 at 18:52, Rebecca Cran  wrote:
>
> Thanks. Yes, that fixes it.
>
>
> I also tried running the build script with CLANGDWARF, and it seems to
> have found some valid problems with
> Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c
>

Seems to me like an excellent opportunity to rip that thing out completely.


>
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:216:11:
> error: variable 'FileSize' is used uninitialized whenever 'if' condition
> is false [-Werror,-Wsometimes-uninitialized]
>if (FileHandle != NULL) {
>^~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> note: uninitialized use occurs here
>WriteBackDataCacheRange (FileData, FileSize);
>   ^~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:216:7:
> note: remove the 'if' if its condition is always true
>if (FileHandle != NULL) {
>^~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9:
> error: variable 'FileSize' is used uninitialized whenever 'if' condition
> is true [-Werror,-Wsometimes-uninitialized]
>  if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
>  ^~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> note: uninitialized use occurs here
>WriteBackDataCacheRange (FileData, FileSize);
>   ^~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:5:
> note: remove the 'if' if its condition is always false
>  if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
>  ^~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9:
> error: variable 'FileSize' is used uninitialized whenever '||' condition
> is true [-Werror,-Wsometimes-uninitialized]
>  if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
>  ^~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> note: uninitialized use occurs here
>WriteBackDataCacheRange (FileData, FileSize);
>   ^~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9:
> note: remove the '||' if its condition is always false
>  if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
>  ^~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:172:7:
> error: variable 'FileSize' is used uninitialized whenever 'if' condition
> is true [-Werror,-Wsometimes-uninitialized]
>if (EFI_ERROR (Status)) {
>^~
> /home/bcran/src/uefi/edk2/MdePkg/Include/Uefi/UefiBaseType.h:159:23:
> note: expanded from macro 'EFI_ERROR'
> #define EFI_ERROR(A)  RETURN_ERROR(A)
>^~~
> /home/bcran/src/uefi/edk2/MdePkg/Include/Base.h:1061:35: note: expanded
> from macro 'RETURN_ERROR'
> #define RETURN_ERROR(StatusCode) (((INTN)(RETURN_STATUS)(StatusCode)) < 0)
> ^
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38:
> note: uninitialized use occurs here
>WriteBackDataCacheRange (FileData, FileSize);
>   ^~~~
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:172:3:
> note: remove the 'if' if its condition is always false
>if (EFI_ERROR (Status)) {
>^
> /home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:136:39:
> note: initialize the variable 'FileSize' to silence this warning
>UINTN   FileSize;
>^
> = 0
> 4 errors generated.
> make: *** [GNUmakefile:342:
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_CLANGDWARF/AARCH64/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/RunAxf.obj]
> Error 1
>
> --
>
> Rebecca Cran
>
>
>
> On 5/10/23 10:27, Ard Biesheuvel wrote:
> > Hi Rebecca,
> >
> > On Wed, 10 May 2023 at 18:23, Rebecca Cran  wrote:
> >> I ran my script that tries to build all Arm platforms in edk2-platforms
> >> (with the exception of known broken ones) with the GCC5/GCC toolchain,
> >> and noticed a new breakage since I last ran it a few months ago.
> >>
> >> Building JunoPkg for ARM doesn't work.
> >>
> >> I also noticed it passes both -march=armv7-a and -march=armv8-a.
> >>
> > This looks like a bug in the Juno package - if I grep for aarch64_bti
> > in edk2, every single hit is in a 

Re: [edk2-devel] JunoPkg ARM build breakage: "Error: bad instruction `aarch64_bti(c)'"

2023-05-10 Thread Rebecca Cran

Thanks. Yes, that fixes it.


I also tried running the build script with CLANGDWARF, and it seems to 
have found some valid problems with 
Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c



/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:216:11: 
error: variable 'FileSize' is used uninitialized whenever 'if' condition 
is false [-Werror,-Wsometimes-uninitialized]

  if (FileHandle != NULL) {
  ^~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38: 
note: uninitialized use occurs here

  WriteBackDataCacheRange (FileData, FileSize);
 ^~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:216:7: 
note: remove the 'if' if its condition is always true

  if (FileHandle != NULL) {
  ^~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9: 
error: variable 'FileSize' is used uninitialized whenever 'if' condition 
is true [-Werror,-Wsometimes-uninitialized]

    if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
    ^~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38: 
note: uninitialized use occurs here

  WriteBackDataCacheRange (FileData, FileSize);
 ^~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:5: 
note: remove the 'if' if its condition is always false

    if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
    ^~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9: 
error: variable 'FileSize' is used uninitialized whenever '||' condition 
is true [-Werror,-Wsometimes-uninitialized]

    if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
    ^~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38: 
note: uninitialized use occurs here

  WriteBackDataCacheRange (FileData, FileSize);
 ^~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:179:9: 
note: remove the '||' if its condition is always false

    if ((ShellCommandLineGetFlag (ParamPackage, L"-?")) ||
    ^~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:172:7: 
error: variable 'FileSize' is used uninitialized whenever 'if' condition 
is true [-Werror,-Wsometimes-uninitialized]

  if (EFI_ERROR (Status)) {
  ^~
/home/bcran/src/uefi/edk2/MdePkg/Include/Uefi/UefiBaseType.h:159:23: 
note: expanded from macro 'EFI_ERROR'

#define EFI_ERROR(A)  RETURN_ERROR(A)
  ^~~
/home/bcran/src/uefi/edk2/MdePkg/Include/Base.h:1061:35: note: expanded 
from macro 'RETURN_ERROR'

#define RETURN_ERROR(StatusCode) (((INTN)(RETURN_STATUS)(StatusCode)) < 0)
^
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:281:38: 
note: uninitialized use occurs here

  WriteBackDataCacheRange (FileData, FileSize);
 ^~~~
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:172:3: 
note: remove the 'if' if its condition is always false

  if (EFI_ERROR (Status)) {
  ^
/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/RunAxf.c:136:39: 
note: initialize the variable 'FileSize' to silence this warning

  UINTN   FileSize;
  ^
   = 0
4 errors generated.
make: *** [GNUmakefile:342: 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_CLANGDWARF/AARCH64/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/RunAxf.obj] 
Error 1


--

Rebecca Cran



On 5/10/23 10:27, Ard Biesheuvel wrote:

Hi Rebecca,

On Wed, 10 May 2023 at 18:23, Rebecca Cran  wrote:

I ran my script that tries to build all Arm platforms in edk2-platforms
(with the exception of known broken ones) with the GCC5/GCC toolchain,
and noticed a new breakage since I last ran it a few months ago.

Building JunoPkg for ARM doesn't work.

I also noticed it passes both -march=armv7-a and -march=armv8-a.


This looks like a bug in the Juno package - if I grep for aarch64_bti
in edk2, every single hit is in a aarch64 specific source or header
file, but it is getting pulled into an ARM build.

Does the below help?

diff --git a/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
b/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
index 50efcfacdfe6..7d5eed94b25f 100644
--- a/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
+++ 

Re: [edk2-devel] Side effects of enabling PML5 in EFI

2023-05-10 Thread Pedro Falcato
On Wed, May 10, 2023 at 10:41 AM Ard Biesheuvel  wrote:
>
> On Tue, 9 May 2023 at 19:24, Pedro Falcato  wrote:
> >
> > Hi all,
> >
> > (+CC people vaguely related to the EFI spec, the PML5 implementation
> > and kernel EFI boot code)
> >
> > As a result of the latest 5-level paging patches, I've been looking
> > into how tiano supports PML5.
> > This raised a question: Doesn't enabling PML5 in-firmware break
> > compatibility with non-PML5-aware bootloaders and kernels?
> >
> > From an architectural point of view:
> > - PML5 is enabled in CR4.LA57, but may only be toggled when not in
> > IA32e mode (so, only in 32-bit)
> > - Trying to mindlessly write to CR4 will #GP, and loading a 4-level
> > page tables will crash with probable page faults or #GPs
> >
> > From an EFI spec point of view:
> > - Whereas other architectures (arm64 for instance) specify the MMU
> > state in detail, the x64 bits do not specify anything beyond "Paging
> > enabled" (see 2.3.4). Which pre-PML5, was obviously well defined.
>
> We actually have a related problem on ARM: the size of the virtual
> address space is not mandated by the spec, but it does require that
> all memory is mapped 1:1.
>

Yes, your ARM problem sounds similar, but you do have the advantage
that T0SZ (et al) have been there since forever,
while for x86_64 this is just a surprise CR4 bit that you had no idea
existed for the past 20 years.

> This means that, if a system has any memory that is outside of the
> 48-bit physical range, it must enable 5 level paging to map it 1:1 in
> the 52-bit virtual range.
>
> Given that EDK2's page allocator allocates from top down from the end
> of the address space, we might end up with allocations for ACPI tables
> etc that cannot be mapped by kernels that do not implement support for
> 5 level paging.

Do we need to have all the memory mapped? I know the EFI spec demands
identity mapping,
but it does sound a lot like we could reserve everything from
2^(va_size) onwards with some (new or old) EFI memory type and keep
going?
Right? I imagine 128/256 TiB of DRAM will work just fine for EFI firmware...

Basically, EFI allocations and usage would be restricted to commonly
accessible ranges of memory (47-bit for x86, 48 for ARM64, etc...)

>
> I imagine a similar issue might exist on x86 as well, and this
> suggests that using 5 level paging in the firmware is only sensible if
> it is guaranteed that the OS and loader can deal with it (IOW, running
> the firmware with 5 level pages and switching back to 4 in
> ExitBootServices() may result in other issues)
>

Right. Sadly, I don't think you can even pull an EBS() trick here, as
in theory you *can* set up alternate translations, even when under
boot services (see 2.3.4.3).

> > - When under boot services, this is likely not a problem as page
> > tables are owned by boot services. Unless they touch them as defined
> > in "2.3.4.3. Enabling Paging or Alternate Translations in an
> > Application", which may run into problems.
> >
> > From an OS kernel/bootloader point of view:
> > - A PML5 aware kernel/bootloader will likely correctly identify the
> > PML5 capability and enable LA57, load 5-level page tables. As such,
> > this scenario always works.
> > - A non-PML5-aware one may incorrectly overwrite LA57 (and #GP), or
> > just load a 4-level paging structure into CR3, and thus disastrously
> > crash.
> >
> > So, how is any of this supposed to work?
> >
>
> I don't think the firmware should ever use 5 level paging unless it is
> strictly needed for a particular use case. And even then, it should
> avoid allocating memory from the region that is only 1:1 accessible
> when 5 level paging is enabled.

I agree. But I would like it if the more EFI "big whigs" (Mike K,
Andrew, etc) could give a heads up as to what should happen. And then
possibly put wording into the spec.

-- 
Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104593): https://edk2.groups.io/g/devel/message/104593
Mute This Topic: https://groups.io/mt/98788948/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: Fix SetLargeVariable fail issue

2023-05-10 Thread Zhang, Xiaoqiang
Thanks Nate for the comprehensive proposal!

Since I found SetLargeVariable only used in SaveMemoryConfig DXE driver now, so 
how about we fix this issue first to unblock the verification on server 
platform. And after that, we can handle the case you mentioned.

-Original Message-
From: Desimone, Nathaniel L  
Sent: Wednesday, May 10, 2023 12:35 PM
To: Zhang, Xiaoqiang ; devel@edk2.groups.io
Cc: Chiu, Chasel ; Gao, Liming 
; Dong, Eric 
Subject: RE: [PATCH v1] MinPlatformPkg: Fix SetLargeVariable fail issue

Great catch Xiaoqiang!

Only issue I see is that for 100% correctness we will need to add a check to 
see if we are past ExitBootServices(). 

This issue is if we are in OS runtime and we try to overwrite an existing 
variable when there isn't enough space to do so without a reclaim... the 
current value of the large variable will be deleted and it will be impossible 
to store the new value until after a platform reset.

To do this check you will need to add an AtOsRuntime() API to the 
VariableWriteLib implemented in 
MinPlatformPkg/Library/DxeRuntimeVariableWriteLib and 
MinPlatformPkg/Library/SmmVariableWriteLib to check for OS runtime. The DXE 
implementation can just be a passthrough to EfiAtRuntime() in 
MdePkg/Library/UefiRuntimeLib. But the SMM one will need to add a notification 
callback for gEdkiiSmmExitBootServicesProtocolGuid and set a global variable to 
indicate whether that event has been triggered yet. Because UefiRuntimeLib can 
only be used by DXE_RUNTIME drivers, you will need to make a separate version 
of this library for boot time only DXE_DRIVERs that has an implementation of 
AtOsRuntime() that always returns FALSE.

-Original Message-
From: Zhang, Xiaoqiang  
Sent: Monday, May 8, 2023 10:39 PM
To: devel@edk2.groups.io
Cc: Zhang, Xiaoqiang ; Chiu, Chasel 
; Desimone, Nathaniel L 
; Gao, Liming ; Dong, 
Eric 
Subject: [PATCH v1] MinPlatformPkg: Fix SetLargeVariable fail issue

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

On Server platform, when the large variable "FspNvsBuffer" is already in the 
UEFI variable store and the remaining variable storage space is less than the 
large variable size. And also not in OS runtime then we need to add the size of 
the current data that will end up being replaced by the new data to the 
remaining space before we decide that there is not enough space to store the 
large variable.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Eric Dong 

Signed-off-by: Xiaoqiang Zhang 
---
 
Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWriteLib.c
   | 10 +-
 
Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableWriteLib.inf
 |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWriteLib.c
 
b/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWriteLib.c
index de23ae6160..da820f65b9 100644
--- 
a/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVariableWriteLib.c
+++ b/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/LargeVa
+++ riableWriteLib.c
@@ -22,7 +22,7 @@
 #include 
 #include 
 #include 
-
+#include 
 #include "LargeVariableCommon.h"
 
 /**
@@ -270,6 +270,7 @@ SetLargeVariable (
   UINT8 *OffsetPtr;
   UINTN BytesRemaining;
   UINTN SizeToSave;
+  UINTN BufferSize = 0;
 
   //
   // Check input parameters.
@@ -365,6 +366,13 @@ SetLargeVariable (
 // Non-Volatile storage to store the data.
 //
 RemainingVariableStorage = GetRemainingVariableStorageSpace ();
+//
+// Check if current variable already existed in NV storage variable space
+//
+Status = GetLargeVariable (VariableName, VendorGuid, , NULL);
+if ((Status == EFI_BUFFER_TOO_SMALL) && (BufferSize != 0)) {
+  RemainingVariableStorage = RemainingVariableStorage + BufferSize;
+}
 if (DataSize > RemainingVariableStorage) {
   DEBUG ((DEBUG_ERROR, "SetLargeVariable: Not enough NV storage space to 
store the data\n"));
   Status = EFI_OUT_OF_RESOURCES;
diff --git 
a/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableWriteLib.inf
 
b/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableWriteLib.inf
index 2493a94596..cbc2a5d93a 100644
--- 
a/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableWriteLib.inf
+++ b/Platform/Intel/MinPlatformPkg/Library/BaseLargeVariableLib/BaseLar
+++ geVariableWriteLib.inf
@@ -49,3 +49,4 @@
   PrintLib
   VariableReadLib
   VariableWriteLib
+  LargeVariableReadLib
--
2.39.1.windows.1



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

[edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0 before walking through next FV

2023-05-10 Thread Wendy Liao via groups.io



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

The main dispatch loop in PeiDispatcher() goes through each FV and
calls DiscoverPeimsAndOrderWithApriori() to search Apriori file to
reorder all PEIMs then do the PEIM dispatched.

DiscoverPeimsAndOrderWithApriori() calculates Apriori file count for
every FV once and set Private->AprioriCount, but Private->AprioriCount
doesn't be set to 0 before dispatch loop walking through the next FV.

It causes the peim which sort on less than Private->AprioriCount and
depex is not satisfied would be dispatched when dispatch loop go through
to a scaned FV, even the peim is not set in APRIORI file.

Cc: Leon Chen 
Cc: Tim Lewis 
Reported-by: Esther Lee 
Signed-off-by: Wendy Liao 

---
 MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c 
b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c

index d8284f9f4f..5f32ebb560 100644
--- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
+++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
@@ -1630,6 +1630,7 @@ PeiDispatcher (
   Private->CurrentFileHandle    = NULL;
   Private->CurrentPeimCount = 0;
   Private->CurrentFvFileHandles = NULL;
+  Private->AprioriCount = 0;
 }

 //
--
2.29.2.windows.2




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




Re: [edk2-devel] Side effects of enabling PML5 in EFI

2023-05-10 Thread Pedro Falcato
On Wed, May 10, 2023 at 10:34 AM Ni, Ray  wrote:
>
> Firmware chooses to use 5-level paging when the platform using this firmware 
> claims to boot 5-level paging OS only.
>
> Usually, firmware uses 4-level paging to keep maximum OS compability.

Hi Ray,

So, what happens if I don't enable LA57, have a gazillion TB of memory
(such that I go over the 128TB 47-bit AS limit). Will EFI never try to
access memory up there and page fault?

What happens to the OS/bootloader? If it asks for memory up there (for
KASLR, etc)? Does the memory map pre-reserve those upper regions of
memory that are not accessible using 4-level paging?

I really fail to see the advantages of PML5 support in EFI fw at the
moment, particularly as you can simply choose to start all your
allocations lower down the memory map (where you can indeed access
things), reserve the upper, inaccessible bits, and things Should Work?
Unless you're keeping some MMIO ranges up there, in which case, the
solution is probably hard.

-- 
Pedro


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




Re: [edk2-devel] Side effects of enabling PML5 in EFI

2023-05-10 Thread Pedro Falcato
On Wed, May 10, 2023 at 10:18 AM Gerd Hoffmann  wrote:
>
> On Tue, May 09, 2023 at 06:24:03PM +0100, Pedro Falcato wrote:
> > Hi all,
> >
> > (+CC people vaguely related to the EFI spec, the PML5 implementation
> > and kernel EFI boot code)
> >
> > As a result of the latest 5-level paging patches, I've been looking
> > into how tiano supports PML5.
> > This raised a question: Doesn't enabling PML5 in-firmware break
> > compatibility with non-PML5-aware bootloaders and kernels?
>
> kernels yes, bootloaders probably not (unless the bootloader not the
> kernel calls exitbootservices).

Bootloaders can theoretically enable "alternative translations" as
they call it in-spec. No need to EBS() to use your own page tables.
I have no idea how prevalent this is, but if someone told me GRUB does
this I would be 0% shocked.

> > So, how is any of this supposed to work?
>
> edk2 is relatively late to the party, so with everybody else supporting
> 5-level paging already it might not be much of an issue in practice even
> though there is no compatibility handling (I know of) in edk2.
>
> When running your operating system museum in virtual machines you have
> the option to just turn off 5-level paging support in the virtual cpu.

Ok, went looking. Linux supports this since ~2017. Darwin (from macOS)
does not support this.
FreeBSD supports LA57 from 2020 onwards. NetBSD does not support it.
Fuchsia does not support it.

And, more glaringly, Windows 11 does not support it (no source, went
testing with qemu -cpu +la57).

So, this is far from an operating system museum. I don't think this
can be safely enabled at all. And especially not,
when you're not running under a VM (presumably, this will get deployed
on real hardware).

-- 
Pedro


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




Re: [edk2-devel] JunoPkg ARM build breakage: "Error: bad instruction `aarch64_bti(c)'"

2023-05-10 Thread Ard Biesheuvel
Hi Rebecca,

On Wed, 10 May 2023 at 18:23, Rebecca Cran  wrote:
>
> I ran my script that tries to build all Arm platforms in edk2-platforms
> (with the exception of known broken ones) with the GCC5/GCC toolchain,
> and noticed a new breakage since I last ran it a few months ago.
>
> Building JunoPkg for ARM doesn't work.
>
> I also noticed it passes both -march=armv7-a and -march=armv8-a.
>

This looks like a bug in the Juno package - if I grep for aarch64_bti
in edk2, every single hit is in a aarch64 specific source or header
file, but it is getting pulled into an ARM build.

Does the below help?

diff --git a/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
b/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
index 50efcfacdfe6..7d5eed94b25f 100644
--- a/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
+++ b/Platform/ARM/Library/ArmShellCmdRunAxf/Arm/Pivot.S
@@ -4,7 +4,7 @@
 //  SPDX-License-Identifier: BSD-2-Clause-Patent
 //

-#include 
+#include 

 // VOID
 // RunAxfPivot (



>
> "arm-none-eabi-gcc" -march=armv7-a -mfloat-abi=soft -march=armv8-a -c -x
> assembler -imacros AutoGen.h -mlittle-endian -o
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.obj
> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/Arm
> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf
> -I/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/DEBUG
> -I/home/bcran/src/uefi/edk2/ArmPkg
> -I/home/bcran/src/uefi/edk2/ArmPkg/Include
> -I/home/bcran/src/uefi/edk2/MdeModulePkg
> -I/home/bcran/src/uefi/edk2/MdeModulePkg/Test/Mock/Include
> -I/home/bcran/src/uefi/edk2/MdeModulePkg/Include
> -I/home/bcran/src/uefi/edk2/MdePkg
> -I/home/bcran/src/uefi/edk2/MdePkg/Include
> -I/home/bcran/src/uefi/edk2/MdePkg/Test/UnitTest/Include
> -I/home/bcran/src/uefi/edk2/MdePkg/Test/Mock/Include
> -I/home/bcran/src/uefi/edk2/MdePkg/Include/Arm
> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM
> -I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Include
> -I/home/bcran/src/uefi/edk2/ShellPkg
> -I/home/bcran/src/uefi/edk2/ShellPkg/Include
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.
> Trim --trim-long --source-code -o
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe/OUTPUT/Arm/CopyMem.
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe/OUTPUT/Arm/CopyMem.ii
> Trim --trim-long --source-code -o
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/Arm/ctzsi2.
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/Arm/ctzsi2.ii
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.:
> Assembler messages:
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.:17:
> Error: bad instruction `aarch64_bti(c)'
> make: *** [GNUmakefile:363:
> /home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.obj]
> Error 1
>
>
> --
> Rebecca Cran
>


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




[edk2-devel] JunoPkg ARM build breakage: "Error: bad instruction `aarch64_bti(c)'"

2023-05-10 Thread Rebecca Cran
I ran my script that tries to build all Arm platforms in edk2-platforms 
(with the exception of known broken ones) with the GCC5/GCC toolchain, 
and noticed a new breakage since I last ran it a few months ago.


Building JunoPkg for ARM doesn't work.

I also noticed it passes both -march=armv7-a and -march=armv8-a.


"arm-none-eabi-gcc" -march=armv7-a -mfloat-abi=soft -march=armv8-a -c -x 
assembler -imacros AutoGen.h -mlittle-endian -o 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.obj 
-I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf/Arm 
-I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Library/ArmShellCmdRunAxf 
-I/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/DEBUG 
-I/home/bcran/src/uefi/edk2/ArmPkg 
-I/home/bcran/src/uefi/edk2/ArmPkg/Include 
-I/home/bcran/src/uefi/edk2/MdeModulePkg 
-I/home/bcran/src/uefi/edk2/MdeModulePkg/Test/Mock/Include 
-I/home/bcran/src/uefi/edk2/MdeModulePkg/Include 
-I/home/bcran/src/uefi/edk2/MdePkg 
-I/home/bcran/src/uefi/edk2/MdePkg/Include 
-I/home/bcran/src/uefi/edk2/MdePkg/Test/UnitTest/Include 
-I/home/bcran/src/uefi/edk2/MdePkg/Test/Mock/Include 
-I/home/bcran/src/uefi/edk2/MdePkg/Include/Arm 
-I/home/bcran/src/uefi/edk2-platforms/Platform/ARM 
-I/home/bcran/src/uefi/edk2-platforms/Platform/ARM/Include 
-I/home/bcran/src/uefi/edk2/ShellPkg 
-I/home/bcran/src/uefi/edk2/ShellPkg/Include 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.
Trim --trim-long --source-code -o 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe/OUTPUT/Arm/CopyMem. 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe/OUTPUT/Arm/CopyMem.ii
Trim --trim-long --source-code -o 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/Arm/ctzsi2. 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib/OUTPUT/Arm/ctzsi2.ii
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.: 
Assembler messages:
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.:17: 
Error: bad instruction `aarch64_bti(c)'
make: *** [GNUmakefile:363: 
/home/bcran/src/uefi/Build/ArmJuno/RELEASE_GCC5/ARM/Platform/ARM/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf/OUTPUT/Arm/Pivot.obj] 
Error 1



--
Rebecca Cran



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




Re: [edk2-devel] [PATCH v3 1/1] Platform/SbsaQemu: read platform version

2023-05-10 Thread Rebecca Cran

On 5/10/23 10:06, Marcin Juszkiewicz wrote:

+  Result = ArmCallSmc0 (SIP_SVC_VERSION, , , NULL);
+  if (Result == SMC_ARCH_CALL_SUCCESS)
+  {
+Result = PcdSet32S (PcdPlatformVersionMajor, Major);
+ASSERT_EFI_ERROR (Result);
+Result = PcdSet32S (PcdPlatformVersionMinor, Minor);
+ASSERT_EFI_ERROR (Result);
+  }
+
+  Major = PcdGet32 (PcdPlatformVersionMajor);
+  ASSERT_EFI_ERROR (Major);
+  Minor = PcdGet32 (PcdPlatformVersionMinor);
+  ASSERT_EFI_ERROR (Minor);
+
+  DEBUG((DEBUG_INFO, "Platform version: %d.%d\n", Major, Minor));
+
return EFI_SUCCESS;
  }


Sorry, but there are new problems.

There should be a space before the parenthesis in the 'DEBUG' line.

PcdGet32 doesn't return a RETURN_STATUS or EFI_STATUS, so 
ASSERT_EFI_ERROR is incorrect.



--

Rebecca Cran



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104586): https://edk2.groups.io/g/devel/message/104586
Mute This Topic: https://groups.io/mt/98809146/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] ArmPkg: CpuDxe: Sync GCD Capabilities With Page Table Attributes

2023-05-10 Thread Taylor Beebe
Can we schedule the meeting for Wednesday 5/17? I will be out the 
following week and would like to attend.


Thanks :)

On 5/9/2023 7:59 AM, Oliver Smith-Denny wrote:

On 5/8/2023 11:59 PM, Ard Biesheuvel wrote:

On Tue, 9 May 2023 at 04:04, Kinney, Michael D
 wrote:


I would prefer next week as well.

Mike



Next week, i can only do Wednesday. The week after (22-26), the time
slot works for me on any day of the week.



Weds works from our side, the week after also works perfectly well
any day. Thanks for the flexibility and willingness to meet.

For reference for this specific patch, this bz may help cache in
some info: https://bugzilla.tianocore.org/show_bug.cgi?id=753. The
mail links are largely dead, of course, but can be found on other
mailing list retention sites (maybe in the future we will have PRs
and discussions to reference :).

Thanks,
Oliver









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




Re: [edk2-devel] [PATCH v5 0/4] MdePkg: Add MipiSysTLib library

2023-05-10 Thread Chiu, Chasel


Thanks a lot Mike for your detail reviewing and providing better implementation 
suggestions!


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Michael D
> Kinney
> Sent: Wednesday, May 10, 2023 9:00 AM
> To: Guo, Gua ; devel@edk2.groups.io; Gao, Liming
> 
> Cc: Kinney, Michael D 
> Subject: Re: [edk2-devel] [PATCH v5 0/4] MdePkg: Add MipiSysTLib library
> 
> Series Reviewed-by: Michael D Kinney 
> 
> Liming, this code review started well before the soft freeze.  It has now 
> passed
> review.
> 
> We should include this in this stable-tag release.
> 
> Mike
> 
> 
> > -Original Message-
> > From: Guo, Gua 
> > Sent: Wednesday, May 10, 2023 2:20 AM
> > To: devel@edk2.groups.io
> > Cc: Kinney, Michael D ; Guo, Gua
> > 
> > Subject: [PATCH v5 0/4] MdePkg: Add MipiSysTLib library
> >
> > From: Gua Guo 
> >
> > V5: if no other open, it will be final change
> > - https://github.com/tianocore/edk2/pull/3901
> >   Fix random exception when long run catalog debug message
> >
> > V4
> > - https://github.com/tianocore/edk2/pull/3901 - Done
> >   Enhance SwapBytesGuid to use CopyGuid instead of CopyMem, to make
> > implement code more simple.
> >
> > V3
> > - https://github.com/tianocore/edk2/pull/3901 - Done
> >   - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why
> > MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
> > Solution: Remove this macro, use Library Constructor to allocate
> > it dynamiclly.
> >   - Open:
> > MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon
> > .c: SwapBytesGuid () algorithm wrong.
> > Solution: Follow correct algorithm to implement it.
> > VOID
> > EFIAPI
> > SwapBytesGuid (
> >   IN  GUID  *Guid,<--- In PreMem, guid is global 
> > data so region
> > is readonly, add output data to support it.
> >   OUT GUID  *ConvertedGuid
> > );
> >
> >   - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D
> > Solution: use *_*_*_CC_FLAGS  = -DMIPI_SYST_STATIC to unified both.
> >
> >
> > V2
> > - https://github.com/tianocore/edk2/pull/3901
> >   - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why
> > MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
> >   - Open:
> > MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon
> > .c: SwapBytesGuid () algorithm wrong.
> >   - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D
> >
> > V1
> > Previous PR:
> > - https://github.com/tianocore/edk2/pull/3613
> >   - TraceHubDebugLib without submodule - Reject
> >
> > - https://github.com/tianocore/edk2/pull/3793
> >   - TraceHubDebugLib with submodule and without seperate into
> > MipiSysTLib and TraceHubDebugLib - Reject
> >
> > Gua Guo (4):
> >   MdePkg: Add MipiSysTLib library
> >   MdePkg: Add NULL library of TraceHubDebugSysTLib
> >   MdeModulePkg: Add TraceHubDebugSysTLib library
> >   Maintainers.txt: Update reviewers and maintainers for
> > TraceHubDebugLib.
> >
> >  .gitmodules   |  11 +-
> >  .pytool/CISettings.py |   2 +
> >  Maintainers.txt   |  18 +
> >  .../Include/Guid/TraceHubDebugInfoHob.h   |  24 +
> >  .../BaseTraceHubDebugSysTLib.c| 245 ++
> >  .../BaseTraceHubDebugSysTLib.inf  |  44 +
> >  .../DxeSmmTraceHubDebugSysTLib.c  | 263 ++
> >  .../DxeSmmTraceHubDebugSysTLib.inf|  51 ++
> >  .../InternalTraceHubApi.c |  74 ++
> >  .../InternalTraceHubApi.h |  37 +
> >  .../InternalTraceHubApiCommon.c   | 200 +
> >  .../InternalTraceHubApiCommon.h   | 119 +++
> >  .../PeiTraceHubDebugSysTLib.c | 282 +++
> >  .../PeiTraceHubDebugSysTLib.inf   |  50 ++
> >  .../Library/TraceHubDebugSysTLib/Readme.md|  26 +
> >  MdeModulePkg/MdeModulePkg.dec |  21 +
> >  MdeModulePkg/MdeModulePkg.dsc |   3 +
> >  MdeModulePkg/MdeModulePkg.uni |  18 +
> >  MdePkg/Include/Library/MipiSysTLib.h  |  66 ++
> >  MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 ++
> >  MdePkg/Library/MipiSysTLib/GenMipiSystH.py| 132 +++
> >  MdePkg/Library/MipiSysTLib/MipiSysTLib.c  | 123 +++
> >  MdePkg/Library/MipiSysTLib/MipiSysTLib.inf|  52 ++
> >  MdePkg/Library/MipiSysTLib/Platform.c | 164 
> >  MdePkg/Library/MipiSysTLib/Platform.h | 138 +++
> >  MdePkg/Library/MipiSysTLib/Readme.md  |  25 +
> >  MdePkg/Library/MipiSysTLib/mipi_syst.h| 789 ++
> >  MdePkg/Library/MipiSysTLib/mipisyst   |   1 +
> >  .../TraceHubDebugSysTLibNull.c|  76 ++
> >  .../TraceHubDebugSysTLibNull.inf  |  29 +
> >  MdePkg/MdePkg.ci.yaml |  12 +-
> >  MdePkg/MdePkg.dec |   9 +
> >  MdePkg/MdePkg.dsc |   2 +
> >  ReadMe.rst

[edk2-devel] [PATCH v3 1/1] Platform/SbsaQemu: read platform version

2023-05-10 Thread Marcin Juszkiewicz
Qemu has versioning for sbsa-ref platform. TF-A reads it from provided
DeviceTree and provides as SMC.

This change adds reading platform version into EDK2.

Signed-off-by: Marcin Juszkiewicz 
---
 Platform/Qemu/SbsaQemu/SbsaQemu.dsc   |  3 ++
 .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 29 +++
 .../SbsaQemuPlatformDxe.inf   |  5 
 Silicon/Qemu/SbsaQemu/SbsaQemu.dec|  3 ++
 4 files changed, 40 insertions(+)

diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc 
b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
index c9b912cc1e9e..facca3b3e272 100644
--- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
+++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
@@ -561,6 +561,9 @@ DEFINE NETWORK_HTTP_BOOT_ENABLE   = FALSE
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L"AT"
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L"SK"
 
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0
+
 

 #
 # Components Section - list of all EDK II Modules needed by this Platform
diff --git 
a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c 
b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
index b7270a07abbd..f03369c7c81f 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
@@ -7,15 +7,25 @@
 *
 **/
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
+/* those probably should go into IndustryStandard/ArmStdSmc.h */
+#define SMC_FASTCALL   0x8000
+#define SMC64_FUNCTION (SMC_FASTCALL   | 0x4000)
+#define SIP_FUNCTION   (SMC64_FUNCTION | 0x0200)
+#define SIP_FUNCTION_ID(n) (SIP_FUNCTION   | (n))
+
+#define SIP_SVC_VERSION SIP_FUNCTION_ID(1)
+
 EFI_STATUS
 EFIAPI
 InitializeSbsaQemuPlatformDxe (
@@ -26,6 +36,9 @@ InitializeSbsaQemuPlatformDxe (
   EFI_STATUS Status;
   UINTN  Size;
   VOID*  Base;
+  UINTN  Major;
+  UINTN  Minor;
+  UINTN  Result;
 
   DEBUG ((DEBUG_INFO, "%a: InitializeSbsaQemuPlatformDxe called\n", 
__FUNCTION__));
 
@@ -51,5 +64,21 @@ InitializeSbsaQemuPlatformDxe (
 return Status;
   }
 
+  Result = ArmCallSmc0 (SIP_SVC_VERSION, , , NULL);
+  if (Result == SMC_ARCH_CALL_SUCCESS)
+  {
+Result = PcdSet32S (PcdPlatformVersionMajor, Major);
+ASSERT_EFI_ERROR (Result);
+Result = PcdSet32S (PcdPlatformVersionMinor, Minor);
+ASSERT_EFI_ERROR (Result);
+  }
+
+  Major = PcdGet32 (PcdPlatformVersionMajor);
+  ASSERT_EFI_ERROR (Major);
+  Minor = PcdGet32 (PcdPlatformVersionMinor);
+  ASSERT_EFI_ERROR (Minor);
+
+  DEBUG((DEBUG_INFO, "Platform version: %d.%d\n", Major, Minor));
+
   return EFI_SUCCESS;
 }
diff --git 
a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf 
b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
index 21d2135f6d17..1f2c8a9dd6af 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
@@ -20,6 +20,7 @@
   SbsaQemuPlatformDxe.c
 
 [Packages]
+  ArmPkg/ArmPkg.dec
   ArmVirtPkg/ArmVirtPkg.dec
   EmbeddedPkg/EmbeddedPkg.dec
   MdeModulePkg/MdeModulePkg.dec
@@ -27,6 +28,7 @@
   Silicon/Qemu/SbsaQemu/SbsaQemu.dec
 
 [LibraryClasses]
+  ArmSmcLib
   PcdLib
   DebugLib
   NonDiscoverableDeviceRegistrationLib
@@ -36,6 +38,9 @@
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize
 
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor
+
 [Depex]
   TRUE
 
diff --git a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec 
b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
index 8654cc7c858c..fb5903bfda0f 100644
--- a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
+++ b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
@@ -70,3 +70,6 @@
   
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisManufacturer|L""|VOID*|0x011B
   
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L""|VOID*|0x011C
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L""|VOID*|0x011D
+
+  
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0|UINT32|0x011E
+  
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0|UINT32|0x011F
-- 
2.40.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104583): https://edk2.groups.io/g/devel/message/104583
Mute This Topic: https://groups.io/mt/98809146/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: 

Re: [edk2-devel] [PATCH v5 0/4] MdePkg: Add MipiSysTLib library

2023-05-10 Thread Michael D Kinney
Series Reviewed-by: Michael D Kinney 

Liming, this code review started well before the soft freeze.  It has now 
passed review.

We should include this in this stable-tag release.

Mike


> -Original Message-
> From: Guo, Gua 
> Sent: Wednesday, May 10, 2023 2:20 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ; Guo, Gua
> 
> Subject: [PATCH v5 0/4] MdePkg: Add MipiSysTLib library
> 
> From: Gua Guo 
> 
> V5: if no other open, it will be final change
> - https://github.com/tianocore/edk2/pull/3901
>   Fix random exception when long run catalog debug message
> 
> V4
> - https://github.com/tianocore/edk2/pull/3901 - Done
>   Enhance SwapBytesGuid to use CopyGuid instead of CopyMem, to make
> implement code more simple.
> 
> V3
> - https://github.com/tianocore/edk2/pull/3901 - Done
>   - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why
> MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
> Solution: Remove this macro, use Library Constructor to allocate it
> dynamiclly.
>   - Open:
> MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon
> .c: SwapBytesGuid () algorithm wrong.
> Solution: Follow correct algorithm to implement it.
> VOID
> EFIAPI
> SwapBytesGuid (
>   IN  GUID  *Guid,<--- In PreMem, guid is global data 
> so region
> is readonly, add output data to support it.
>   OUT GUID  *ConvertedGuid
> );
> 
>   - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D
> Solution: use *_*_*_CC_FLAGS  = -DMIPI_SYST_STATIC to unified both.
> 
> 
> V2
> - https://github.com/tianocore/edk2/pull/3901
>   - Open: MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h: why
> MAX_TRACE_HUB_DEBUG_INSTANCE hardcoded to 5?
>   - Open:
> MdeModulePkg/Library/TraceHubDebugSysTLib/InternalTraceHubApiCommon
> .c: SwapBytesGuid () algorithm wrong.
>   - Open: Merge MSFT and GCC CC_FLAGS as they both supports -D
> 
> V1
> Previous PR:
> - https://github.com/tianocore/edk2/pull/3613
>   - TraceHubDebugLib without submodule - Reject
> 
> - https://github.com/tianocore/edk2/pull/3793
>   - TraceHubDebugLib with submodule and without seperate into MipiSysTLib
> and TraceHubDebugLib - Reject
> 
> Gua Guo (4):
>   MdePkg: Add MipiSysTLib library
>   MdePkg: Add NULL library of TraceHubDebugSysTLib
>   MdeModulePkg: Add TraceHubDebugSysTLib library
>   Maintainers.txt: Update reviewers and maintainers for
> TraceHubDebugLib.
> 
>  .gitmodules   |  11 +-
>  .pytool/CISettings.py |   2 +
>  Maintainers.txt   |  18 +
>  .../Include/Guid/TraceHubDebugInfoHob.h   |  24 +
>  .../BaseTraceHubDebugSysTLib.c| 245 ++
>  .../BaseTraceHubDebugSysTLib.inf  |  44 +
>  .../DxeSmmTraceHubDebugSysTLib.c  | 263 ++
>  .../DxeSmmTraceHubDebugSysTLib.inf|  51 ++
>  .../InternalTraceHubApi.c |  74 ++
>  .../InternalTraceHubApi.h |  37 +
>  .../InternalTraceHubApiCommon.c   | 200 +
>  .../InternalTraceHubApiCommon.h   | 119 +++
>  .../PeiTraceHubDebugSysTLib.c | 282 +++
>  .../PeiTraceHubDebugSysTLib.inf   |  50 ++
>  .../Library/TraceHubDebugSysTLib/Readme.md|  26 +
>  MdeModulePkg/MdeModulePkg.dec |  21 +
>  MdeModulePkg/MdeModulePkg.dsc |   3 +
>  MdeModulePkg/MdeModulePkg.uni |  18 +
>  MdePkg/Include/Library/MipiSysTLib.h  |  66 ++
>  MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 ++
>  MdePkg/Library/MipiSysTLib/GenMipiSystH.py| 132 +++
>  MdePkg/Library/MipiSysTLib/MipiSysTLib.c  | 123 +++
>  MdePkg/Library/MipiSysTLib/MipiSysTLib.inf|  52 ++
>  MdePkg/Library/MipiSysTLib/Platform.c | 164 
>  MdePkg/Library/MipiSysTLib/Platform.h | 138 +++
>  MdePkg/Library/MipiSysTLib/Readme.md  |  25 +
>  MdePkg/Library/MipiSysTLib/mipi_syst.h| 789 ++
>  MdePkg/Library/MipiSysTLib/mipisyst   |   1 +
>  .../TraceHubDebugSysTLibNull.c|  76 ++
>  .../TraceHubDebugSysTLibNull.inf  |  29 +
>  MdePkg/MdePkg.ci.yaml |  12 +-
>  MdePkg/MdePkg.dec |   9 +
>  MdePkg/MdePkg.dsc |   2 +
>  ReadMe.rst|   1 +
>  34 files changed, 3181 insertions(+), 7 deletions(-)
>  create mode 100644 MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.i
> nf
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTL
> ib.c
>  create mode 100644
> MdeModulePkg/Library/TraceHubDebugSysTLib/DxeSmmTraceHubDebugSysTL
> ib.inf
>  create mode 100644
> 

Re: [edk2-devel] [edk2-platforms][PATCH v4 1/1] MinPlatformPkg: Add FspNvsBuffer compression option

2023-05-10 Thread Chiu, Chasel


Patch merged:
https://github.com/tianocore/edk2-platforms/commit/dbd802cd273ad1b51be46ca09a58a15e4b70863f

Thanks,
Chasel


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Michael
> Kubacki
> Sent: Wednesday, May 10, 2023 8:02 AM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> ; Oram, Isaac W ;
> Gao, Liming ; Dong, Eric ;
> Gudla, Raghava 
> Subject: [edk2-devel] [edk2-platforms][PATCH v4 1/1] MinPlatformPkg: Add
> FspNvsBuffer compression option
> 
> From: Michael Kubacki 
> 
> Adds a PCD called "PcdEnableCompressedFspNvsBuffer" that allows the
> "FspNvsBuffer" UEFI variable data to be saved as compressed data.
> 
> Especially due to the nature of the data saved in this variable, it 
> compresses well.
> For example, it has been found to reduce ~63KB of data to ~13KB. Boot time
> impact has been found to be negligible.
> 
> The default value is FALSE to keep default behavior consistent.
> 
> Decompression can be performed on the variable data using the standard
> UefiDecompressLib.
> 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Isaac Oram 
> Cc: Liming Gao 
> Cc: Eric Dong 
> Cc: Raghava Gudla 
> Signed-off-by: Michael Kubacki 
> ---
> 
> Notes:
> v4:
>   - Rebase onto 42a677e992d2
>   - Add CompressLib to MinPlatformPkg.dsc as well
> v3:
>   - Rebase onto 7ac91ec277db
>   - Add CompressLib instance to CoreCommonLib.dsc
> v2: Rebase onto 9769bf28d1fc
> 
> 
> Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryC
> onfig.c   | 62 
> 
> Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryC
> onfig.inf |  4 ++
>  Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc  
>   |
> 1 +
>  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec 
>   |  6 ++
>  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc 
>   |  1 +
>  5 files changed, 61 insertions(+), 13 deletions(-)
> 
> diff --git
> a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemor
> yConfig.c
> b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemor
> yConfig.c
> index 0215e8eeddfb..95b8cef8b32b 100644
> ---
> a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemor
> yConfig.c
> +++
> b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemo
> +++ ryConfig.c
> @@ -3,6 +3,7 @@
>exists, and saves the data to nvRAM.
> 
>  Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.
> +Copyright (c) Microsoft Corporation.
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -10,6 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  #include
>   #include   #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -19,6 +21,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  #include
>   #include 
> #include 
> +#include 
>  #include 
>  #include 
> 
> @@ -38,20 +41,26 @@ SaveMemoryConfigEntryPoint (
>IN EFI_SYSTEM_TABLE   *SystemTable
>)
>  {
> -  EFI_STATUSStatus;
> -  EFI_HOB_GUID_TYPE *GuidHob;
> -  VOID  *HobData;
> -  VOID  *VariableData;
> -  UINTN DataSize;
> -  UINTN BufferSize;
> -  BOOLEAN   DataIsIdentical;
> +  EFI_STATUS Status;
> +  EFI_HOB_GUID_TYPE  *GuidHob;
> +  VOID   *HobData;
> +  VOID   *VariableData;
> +  UINTN  DataSize;
> +  UINTN  BufferSize;
> +  BOOLEANDataIsIdentical;
> +  VOID   *CompressedData;
> +  UINT64 CompressedSize;
> +  UINTN  CompressedAllocationPages;
> 
> -  DataSize= 0;
> -  BufferSize  = 0;
> -  VariableData= NULL;
> -  GuidHob = NULL;
> -  HobData = NULL;
> -  DataIsIdentical = FALSE;
> +  DataSize  = 0;
> +  BufferSize= 0;
> +  VariableData  = NULL;
> +  GuidHob   = NULL;
> +  HobData   = NULL;
> +  DataIsIdentical   = FALSE;
> +  CompressedData= NULL;
> +  CompressedSize= 0;
> +  CompressedAllocationPages = 0;
> 
>//
>// Search for the Memory Configuration GUID HOB.  If it is not present, 
> then
> @@ -73,6 +82,29 @@ SaveMemoryConfigEntryPoint (
>  }
>}
> 
> +  if (PcdGetBool (PcdEnableCompressedFspNvsBuffer)) {
> +if (DataSize > 0) {
> +  CompressedAllocationPages = EFI_SIZE_TO_PAGES (DataSize);
> +  CompressedData= AllocatePages (CompressedAllocationPages);
> +  if (CompressedData == NULL) {
> +DEBUG ((DEBUG_ERROR, "[%a] - Failed to allocate compressed data
> buffer.\n", __FUNCTION__));
> +ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
> +return EFI_OUT_OF_RESOURCES;
> +  }
> +
> +  CompressedSize = EFI_PAGES_TO_SIZE (CompressedAllocationPages);
> +  Status = Compress (HobData, DataSize, CompressedData,
> );
> +  if (EFI_ERROR 

Re: [edk2-devel] [PATCH v2 1/1] Platform/SbsaQemu: read platform version

2023-05-10 Thread Rebecca Cran

On 5/10/23 09:40, Marcin Juszkiewicz wrote:


@@ -26,6 +36,9 @@ InitializeSbsaQemuPlatformDxe (
EFI_STATUS Status;
UINTN  Size;
VOID*  Base;
+  UINTN  Major;
+  UINTN  Minor;
+  UINTN  Result;
  
DEBUG ((DEBUG_INFO, "%a: InitializeSbsaQemuPlatformDxe called\n", __FUNCTION__));
  
@@ -51,5 +64,16 @@ InitializeSbsaQemuPlatformDxe (

  return Status;
}
  
+  Result = ArmCallSmc0 (SIP_SVC_VERSION, , , NULL);

+  if (Result == SMC_ARCH_CALL_SUCCESS)
+  {
+Result = PcdSet32S (PcdPlatformVersionMajor, Major);
+ASSERT_EFI_ERROR (Result);
+Result = PcdSet32S (PcdPlatformVersionMinor, Minor);
+ASSERT_EFI_ERROR (Result);
+  }
+
+  DEBUG((DEBUG_ERROR, "Platform version: %d.%d\n", Major, Minor));
+
return EFI_SUCCESS;
  }


That should probably be logged at DEBUG_INFO instead of DEBUG_ERROR.

Also, if the SMC call fails Major and Minor are uninitialized. With a 
slightly older TF-A I get:



Platform version: -71457408.-8905312


--

Rebecca Cran



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104580): https://edk2.groups.io/g/devel/message/104580
Mute This Topic: https://groups.io/mt/98808598/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 1/1] MinPlatformPkg: Add FspNvsBuffer compression option

2023-05-10 Thread Chiu, Chasel


Reviewed-by: Chasel Chiu 

Thanks,
Chasel


> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Michael
> Kubacki
> Sent: Wednesday, May 10, 2023 8:02 AM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> ; Oram, Isaac W ;
> Gao, Liming ; Dong, Eric ;
> Gudla, Raghava 
> Subject: [edk2-devel] [edk2-platforms][PATCH v4 1/1] MinPlatformPkg: Add
> FspNvsBuffer compression option
> 
> From: Michael Kubacki 
> 
> Adds a PCD called "PcdEnableCompressedFspNvsBuffer" that allows the
> "FspNvsBuffer" UEFI variable data to be saved as compressed data.
> 
> Especially due to the nature of the data saved in this variable, it 
> compresses well.
> For example, it has been found to reduce ~63KB of data to ~13KB. Boot time
> impact has been found to be negligible.
> 
> The default value is FALSE to keep default behavior consistent.
> 
> Decompression can be performed on the variable data using the standard
> UefiDecompressLib.
> 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Isaac Oram 
> Cc: Liming Gao 
> Cc: Eric Dong 
> Cc: Raghava Gudla 
> Signed-off-by: Michael Kubacki 
> ---
> 
> Notes:
> v4:
>   - Rebase onto 42a677e992d2
>   - Add CompressLib to MinPlatformPkg.dsc as well
> v3:
>   - Rebase onto 7ac91ec277db
>   - Add CompressLib instance to CoreCommonLib.dsc
> v2: Rebase onto 9769bf28d1fc
> 
> 
> Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryC
> onfig.c   | 62 
> 
> Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryC
> onfig.inf |  4 ++
>  Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc  
>   |
> 1 +
>  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec 
>   |  6 ++
>  Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc 
>   |  1 +
>  5 files changed, 61 insertions(+), 13 deletions(-)
> 
> diff --git
> a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemor
> yConfig.c
> b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemor
> yConfig.c
> index 0215e8eeddfb..95b8cef8b32b 100644
> ---
> a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemor
> yConfig.c
> +++
> b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemo
> +++ ryConfig.c
> @@ -3,6 +3,7 @@
>exists, and saves the data to nvRAM.
> 
>  Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.
> +Copyright (c) Microsoft Corporation.
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -10,6 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  #include
>   #include   #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -19,6 +21,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  #include
>   #include 
> #include 
> +#include 
>  #include 
>  #include 
> 
> @@ -38,20 +41,26 @@ SaveMemoryConfigEntryPoint (
>IN EFI_SYSTEM_TABLE   *SystemTable
>)
>  {
> -  EFI_STATUSStatus;
> -  EFI_HOB_GUID_TYPE *GuidHob;
> -  VOID  *HobData;
> -  VOID  *VariableData;
> -  UINTN DataSize;
> -  UINTN BufferSize;
> -  BOOLEAN   DataIsIdentical;
> +  EFI_STATUS Status;
> +  EFI_HOB_GUID_TYPE  *GuidHob;
> +  VOID   *HobData;
> +  VOID   *VariableData;
> +  UINTN  DataSize;
> +  UINTN  BufferSize;
> +  BOOLEANDataIsIdentical;
> +  VOID   *CompressedData;
> +  UINT64 CompressedSize;
> +  UINTN  CompressedAllocationPages;
> 
> -  DataSize= 0;
> -  BufferSize  = 0;
> -  VariableData= NULL;
> -  GuidHob = NULL;
> -  HobData = NULL;
> -  DataIsIdentical = FALSE;
> +  DataSize  = 0;
> +  BufferSize= 0;
> +  VariableData  = NULL;
> +  GuidHob   = NULL;
> +  HobData   = NULL;
> +  DataIsIdentical   = FALSE;
> +  CompressedData= NULL;
> +  CompressedSize= 0;
> +  CompressedAllocationPages = 0;
> 
>//
>// Search for the Memory Configuration GUID HOB.  If it is not present, 
> then
> @@ -73,6 +82,29 @@ SaveMemoryConfigEntryPoint (
>  }
>}
> 
> +  if (PcdGetBool (PcdEnableCompressedFspNvsBuffer)) {
> +if (DataSize > 0) {
> +  CompressedAllocationPages = EFI_SIZE_TO_PAGES (DataSize);
> +  CompressedData= AllocatePages (CompressedAllocationPages);
> +  if (CompressedData == NULL) {
> +DEBUG ((DEBUG_ERROR, "[%a] - Failed to allocate compressed data
> buffer.\n", __FUNCTION__));
> +ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
> +return EFI_OUT_OF_RESOURCES;
> +  }
> +
> +  CompressedSize = EFI_PAGES_TO_SIZE (CompressedAllocationPages);
> +  Status = Compress (HobData, DataSize, CompressedData,
> );
> +  if (EFI_ERROR (Status)) {
> +DEBUG ((DEBUG_ERROR, "[%a] - failed to compress data. Status = 

Re: [edk2-devel] [PATCH v2 1/1] Platform/SbsaQemu: read platform version

2023-05-10 Thread Marcin Juszkiewicz

W dniu 10.05.2023 o 17:40, Marcin Juszkiewicz via groups.io pisze:

Qemu has versioning for sbsa-ref platform. TF-A reads it from provided
DeviceTree and provides as SMC.

This change adds reading platform version into EDK2.


TF-A side of change: 
https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/20871



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104578): https://edk2.groups.io/g/devel/message/104578
Mute This Topic: https://groups.io/mt/98808649/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/1] Platform/SbsaQemu: read platform version

2023-05-10 Thread Marcin Juszkiewicz
Qemu has versioning for sbsa-ref platform. TF-A reads it from provided
DeviceTree and provides as SMC.

This change adds reading platform version into EDK2.

Signed-off-by: Marcin Juszkiewicz 
---
 Platform/Qemu/SbsaQemu/SbsaQemu.dsc   |  3 +++
 .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 24 +++
 .../SbsaQemuPlatformDxe.inf   |  5 
 Silicon/Qemu/SbsaQemu/SbsaQemu.dec|  3 +++
 4 files changed, 35 insertions(+)

diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc 
b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
index c9b912cc1e9e..facca3b3e272 100644
--- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
+++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
@@ -561,6 +561,9 @@ DEFINE NETWORK_HTTP_BOOT_ENABLE   = FALSE
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L"AT"
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L"SK"
 
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0
+
 

 #
 # Components Section - list of all EDK II Modules needed by this Platform
diff --git 
a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c 
b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
index b7270a07abbd..c9dd79f69958 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
@@ -7,15 +7,25 @@
 *
 **/
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
+/* those probably should go into IndustryStandard/ArmStdSmc.h */
+#define SMC_FASTCALL   0x8000
+#define SMC64_FUNCTION (SMC_FASTCALL   | 0x4000)
+#define SIP_FUNCTION   (SMC64_FUNCTION | 0x0200)
+#define SIP_FUNCTION_ID(n) (SIP_FUNCTION   | (n))
+
+#define SIP_SVC_VERSION SIP_FUNCTION_ID(1)
+
 EFI_STATUS
 EFIAPI
 InitializeSbsaQemuPlatformDxe (
@@ -26,6 +36,9 @@ InitializeSbsaQemuPlatformDxe (
   EFI_STATUS Status;
   UINTN  Size;
   VOID*  Base;
+  UINTN  Major;
+  UINTN  Minor;
+  UINTN  Result;
 
   DEBUG ((DEBUG_INFO, "%a: InitializeSbsaQemuPlatformDxe called\n", 
__FUNCTION__));
 
@@ -51,5 +64,16 @@ InitializeSbsaQemuPlatformDxe (
 return Status;
   }
 
+  Result = ArmCallSmc0 (SIP_SVC_VERSION, , , NULL);
+  if (Result == SMC_ARCH_CALL_SUCCESS)
+  {
+Result = PcdSet32S (PcdPlatformVersionMajor, Major);
+ASSERT_EFI_ERROR (Result);
+Result = PcdSet32S (PcdPlatformVersionMinor, Minor);
+ASSERT_EFI_ERROR (Result);
+  }
+
+  DEBUG((DEBUG_ERROR, "Platform version: %d.%d\n", Major, Minor));
+
   return EFI_SUCCESS;
 }
diff --git 
a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf 
b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
index 21d2135f6d17..1f2c8a9dd6af 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
@@ -20,6 +20,7 @@
   SbsaQemuPlatformDxe.c
 
 [Packages]
+  ArmPkg/ArmPkg.dec
   ArmVirtPkg/ArmVirtPkg.dec
   EmbeddedPkg/EmbeddedPkg.dec
   MdeModulePkg/MdeModulePkg.dec
@@ -27,6 +28,7 @@
   Silicon/Qemu/SbsaQemu/SbsaQemu.dec
 
 [LibraryClasses]
+  ArmSmcLib
   PcdLib
   DebugLib
   NonDiscoverableDeviceRegistrationLib
@@ -36,6 +38,9 @@
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize
 
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor
+
 [Depex]
   TRUE
 
diff --git a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec 
b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
index 8654cc7c858c..fb5903bfda0f 100644
--- a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
+++ b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
@@ -70,3 +70,6 @@
   
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisManufacturer|L""|VOID*|0x011B
   
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L""|VOID*|0x011C
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L""|VOID*|0x011D
+
+  
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0|UINT32|0x011E
+  
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0|UINT32|0x011F
-- 
2.40.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104577): https://edk2.groups.io/g/devel/message/104577
Mute This Topic: https://groups.io/mt/98808598/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 1/1] Silicon/Marvell: Fix setting I2cStatus in MvI2cEnableConf

2023-05-10 Thread Rebecca Cran
Fix setting I2cStatus in MvI2cEnableConf.

Signed-off-by: Rebecca Cran 
---
 Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c 
b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
index b4dda56bbd2f..a8ff722aab22 100755
--- a/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
+++ b/Silicon/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c
@@ -777,7 +777,7 @@ MvI2cEnableConf (
 {
   /* do nothing */
   if (I2cStatus != NULL)
-I2cStatus = EFI_SUCCESS;
+*I2cStatus = EFI_SUCCESS;
   if (Event != NULL)
 gBS->SignalEvent(Event);
   return EFI_SUCCESS;
-- 
2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104576): https://edk2.groups.io/g/devel/message/104576
Mute This Topic: https://groups.io/mt/98808529/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] Platform/SbsaQemu: read platform version

2023-05-10 Thread Rebecca Cran

On 5/10/23 09:08, Marcin Juszkiewicz wrote:


+  Result = ArmCallSmc0(SIP_FUNCTION_ID(1), , , NULL);


There should be space before the opening parenthesis.

Also, it would be nice to avoid a magic number - i.e. define what 
SIP_FUNCTION_ID(1) is.



--
Rebecca Cran



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104575): https://edk2.groups.io/g/devel/message/104575
Mute This Topic: https://groups.io/mt/98807889/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] Platform/SbsaQemu: read platform version

2023-05-10 Thread Ard Biesheuvel
HI Marcin,

On Wed, 10 May 2023 at 17:08, Marcin Juszkiewicz
 wrote:
>
> Qemu has versioning for sbsa-ref platform. TF-A reads it from provided
> DeviceTree and provides as SMC.
>
> This change adds reading platform version into EDK2.
>
> Signed-off-by: Marcin Juszkiewicz 
> ---
>  Platform/Qemu/SbsaQemu/SbsaQemu.dsc|  3 +++
>  .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c  | 14 ++
>  .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf|  5 +
>  Silicon/Qemu/SbsaQemu/SbsaQemu.dec |  3 +++
>  4 files changed, 25 insertions(+)
>
> diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc 
> b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> index c9b912cc1e9e..facca3b3e272 100644
> --- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
> @@ -561,6 +561,9 @@ DEFINE NETWORK_HTTP_BOOT_ENABLE   = FALSE
>gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L"AT"
>gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L"SK"
>
> +  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0
> +  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0
> +
>  
> 
>  #
>  # Components Section - list of all EDK II Modules needed by this Platform
> diff --git 
> a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c 
> b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
> index b7270a07abbd..7a22f067b600 100644
> --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
> +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
> @@ -7,12 +7,14 @@
>  *
>  **/
>
> +#include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include 
>
> @@ -26,6 +28,9 @@ InitializeSbsaQemuPlatformDxe (
>EFI_STATUS Status;
>UINTN  Size;
>VOID*  Base;
> +  UINTN  Major;
> +  UINTN  Minor;
> +  UINTN  Result;
>
>DEBUG ((DEBUG_INFO, "%a: InitializeSbsaQemuPlatformDxe called\n", 
> __FUNCTION__));
>
> @@ -51,5 +56,14 @@ InitializeSbsaQemuPlatformDxe (
>  return Status;
>}
>
> +  Result = ArmCallSmc0(SIP_FUNCTION_ID(1), , , NULL);
> +  if (Result != 0xFF)
> +  {
> +PcdSet32S (PcdPlatformVersionMajor, Major);
> +PcdSet32S (PcdPlatformVersionMinor, Minor);

Please don't ignore the return values of PcdSet32S like that - at
least capture the return value and use ASSERT_EFI_ERROR() or log them
using DEBUG() so we'll notice if this breaks.

> +  }
> +
> +  DEBUG((DEBUG_ERROR, "Platform version: %d.%d\n", Major, Minor));
> +
>return EFI_SUCCESS;
>  }
> diff --git 
> a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf 
> b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
> index 21d2135f6d17..1f2c8a9dd6af 100644
> --- 
> a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
> +++ 
> b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
> @@ -20,6 +20,7 @@
>SbsaQemuPlatformDxe.c
>
>  [Packages]
> +  ArmPkg/ArmPkg.dec
>ArmVirtPkg/ArmVirtPkg.dec
>EmbeddedPkg/EmbeddedPkg.dec
>MdeModulePkg/MdeModulePkg.dec
> @@ -27,6 +28,7 @@
>Silicon/Qemu/SbsaQemu/SbsaQemu.dec
>
>  [LibraryClasses]
> +  ArmSmcLib
>PcdLib
>DebugLib
>NonDiscoverableDeviceRegistrationLib
> @@ -36,6 +38,9 @@
>gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase
>gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize
>
> +  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor
> +  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor
> +
>  [Depex]
>TRUE
>
> diff --git a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec 
> b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
> index 8654cc7c858c..fb5903bfda0f 100644
> --- a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
> +++ b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
> @@ -70,3 +70,6 @@
>
> gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisManufacturer|L""|VOID*|0x011B
>
> gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L""|VOID*|0x011C
>gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L""|VOID*|0x011D
> +
> +  
> gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0|UINT32|0x011E
> +  
> gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0|UINT32|0x011F
> --
> 2.40.1
>
>
>
> 
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#104572): https://edk2.groups.io/g/devel/message/104572
> Mute This Topic: https://groups.io/mt/98807889/1131722
> Group Owner: devel+ow...@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [a...@kernel.org]
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive 

Re: [edk2-devel] [edk2-platforms][PATCH v4 1/1] MinPlatformPkg: Add FspNvsBuffer compression option

2023-05-10 Thread Isaac Oram
Reviewed-by: Isaac Oram 

-Original Message-
From: mikub...@linux.microsoft.com  
Sent: Wednesday, May 10, 2023 8:02 AM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 
; Oram, Isaac W ; Gao, 
Liming ; Dong, Eric ; Gudla, 
Raghava 
Subject: [edk2-platforms][PATCH v4 1/1] MinPlatformPkg: Add FspNvsBuffer 
compression option

From: Michael Kubacki 

Adds a PCD called "PcdEnableCompressedFspNvsBuffer" that allows the 
"FspNvsBuffer" UEFI variable data to be saved as compressed data.

Especially due to the nature of the data saved in this variable, it compresses 
well. For example, it has been found to reduce ~63KB of data to ~13KB. Boot 
time impact has been found to be negligible.

The default value is FALSE to keep default behavior consistent.

Decompression can be performed on the variable data using the standard 
UefiDecompressLib.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Liming Gao 
Cc: Eric Dong 
Cc: Raghava Gudla 
Signed-off-by: Michael Kubacki 
---

Notes:
v4:
  - Rebase onto 42a677e992d2
  - Add CompressLib to MinPlatformPkg.dsc as well
v3:
  - Rebase onto 7ac91ec277db
  - Add CompressLib instance to CoreCommonLib.dsc
v2: Rebase onto 9769bf28d1fc

 Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c   
| 62 
 Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf 
|  4 ++
 Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
|  1 +
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec   
|  6 ++
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc   
|  1 +
 5 files changed, 61 insertions(+), 13 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c 
b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c
index 0215e8eeddfb..95b8cef8b32b 100644
--- 
a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c
+++ b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemo
+++ ryConfig.c
@@ -3,6 +3,7 @@
   exists, and saves the data to nvRAM.
 
 Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.
+Copyright (c) Microsoft Corporation.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -10,6 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  #include 
  #include   #include 
+#include 
 #include 
 #include 
 #include 
@@ -19,6 +21,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  #include 
  #include   #include 

+#include 
 #include 
 #include 
 
@@ -38,20 +41,26 @@ SaveMemoryConfigEntryPoint (
   IN EFI_SYSTEM_TABLE   *SystemTable
   )
 {
-  EFI_STATUSStatus;
-  EFI_HOB_GUID_TYPE *GuidHob;
-  VOID  *HobData;
-  VOID  *VariableData;
-  UINTN DataSize;
-  UINTN BufferSize;
-  BOOLEAN   DataIsIdentical;
+  EFI_STATUS Status;
+  EFI_HOB_GUID_TYPE  *GuidHob;
+  VOID   *HobData;
+  VOID   *VariableData;
+  UINTN  DataSize;
+  UINTN  BufferSize;
+  BOOLEANDataIsIdentical;
+  VOID   *CompressedData;
+  UINT64 CompressedSize;
+  UINTN  CompressedAllocationPages;
 
-  DataSize= 0;
-  BufferSize  = 0;
-  VariableData= NULL;
-  GuidHob = NULL;
-  HobData = NULL;
-  DataIsIdentical = FALSE;
+  DataSize  = 0;
+  BufferSize= 0;
+  VariableData  = NULL;
+  GuidHob   = NULL;
+  HobData   = NULL;
+  DataIsIdentical   = FALSE;
+  CompressedData= NULL;
+  CompressedSize= 0;
+  CompressedAllocationPages = 0;
 
   //
   // Search for the Memory Configuration GUID HOB.  If it is not present, then 
@@ -73,6 +82,29 @@ SaveMemoryConfigEntryPoint (
 }
   }
 
+  if (PcdGetBool (PcdEnableCompressedFspNvsBuffer)) {
+if (DataSize > 0) {
+  CompressedAllocationPages = EFI_SIZE_TO_PAGES (DataSize);
+  CompressedData= AllocatePages (CompressedAllocationPages);
+  if (CompressedData == NULL) {
+DEBUG ((DEBUG_ERROR, "[%a] - Failed to allocate compressed data 
buffer.\n", __FUNCTION__));
+ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+return EFI_OUT_OF_RESOURCES;
+  }
+
+  CompressedSize = EFI_PAGES_TO_SIZE (CompressedAllocationPages);
+  Status = Compress (HobData, DataSize, CompressedData, 
);
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "[%a] - failed to compress data. Status = %r\n", 
__FUNCTION__, Status));
+ASSERT_EFI_ERROR (Status);
+return Status;
+  }
+}
+
+HobData  = CompressedData;
+DataSize = (UINTN)CompressedSize;
+  }
+
   if (HobData != NULL) {
 DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataLength:%d\n", DataSize));
 DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataPtr   : 

[edk2-devel] [PATCH 1/1] Platform/SbsaQemu: read platform version

2023-05-10 Thread Marcin Juszkiewicz
Qemu has versioning for sbsa-ref platform. TF-A reads it from provided
DeviceTree and provides as SMC.

This change adds reading platform version into EDK2.

Signed-off-by: Marcin Juszkiewicz 
---
 Platform/Qemu/SbsaQemu/SbsaQemu.dsc|  3 +++
 .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c  | 14 ++
 .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf|  5 +
 Silicon/Qemu/SbsaQemu/SbsaQemu.dec |  3 +++
 4 files changed, 25 insertions(+)

diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc 
b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
index c9b912cc1e9e..facca3b3e272 100644
--- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
+++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc
@@ -561,6 +561,9 @@ DEFINE NETWORK_HTTP_BOOT_ENABLE   = FALSE
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L"AT"
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L"SK"
 
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0
+
 

 #
 # Components Section - list of all EDK II Modules needed by this Platform
diff --git 
a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c 
b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
index b7270a07abbd..7a22f067b600 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
@@ -7,12 +7,14 @@
 *
 **/
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -26,6 +28,9 @@ InitializeSbsaQemuPlatformDxe (
   EFI_STATUS Status;
   UINTN  Size;
   VOID*  Base;
+  UINTN  Major;
+  UINTN  Minor;
+  UINTN  Result;
 
   DEBUG ((DEBUG_INFO, "%a: InitializeSbsaQemuPlatformDxe called\n", 
__FUNCTION__));
 
@@ -51,5 +56,14 @@ InitializeSbsaQemuPlatformDxe (
 return Status;
   }
 
+  Result = ArmCallSmc0(SIP_FUNCTION_ID(1), , , NULL);
+  if (Result != 0xFF)
+  {
+PcdSet32S (PcdPlatformVersionMajor, Major);
+PcdSet32S (PcdPlatformVersionMinor, Minor);
+  }
+
+  DEBUG((DEBUG_ERROR, "Platform version: %d.%d\n", Major, Minor));
+
   return EFI_SUCCESS;
 }
diff --git 
a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf 
b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
index 21d2135f6d17..1f2c8a9dd6af 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
@@ -20,6 +20,7 @@
   SbsaQemuPlatformDxe.c
 
 [Packages]
+  ArmPkg/ArmPkg.dec
   ArmVirtPkg/ArmVirtPkg.dec
   EmbeddedPkg/EmbeddedPkg.dec
   MdeModulePkg/MdeModulePkg.dec
@@ -27,6 +28,7 @@
   Silicon/Qemu/SbsaQemu/SbsaQemu.dec
 
 [LibraryClasses]
+  ArmSmcLib
   PcdLib
   DebugLib
   NonDiscoverableDeviceRegistrationLib
@@ -36,6 +38,9 @@
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize
 
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor
+  gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor
+
 [Depex]
   TRUE
 
diff --git a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec 
b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
index 8654cc7c858c..fb5903bfda0f 100644
--- a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
+++ b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec
@@ -70,3 +70,6 @@
   
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisManufacturer|L""|VOID*|0x011B
   
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L""|VOID*|0x011C
   gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L""|VOID*|0x011D
+
+  
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0|UINT32|0x011E
+  
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0|UINT32|0x011F
-- 
2.40.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104572): https://edk2.groups.io/g/devel/message/104572
Mute This Topic: https://groups.io/mt/98807889/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/4] OvmfPkg: remove PlatformBootManagerLibGrub

2023-05-10 Thread Ard Biesheuvel
On Wed, 10 May 2023 at 14:43, Ard Biesheuvel  wrote:
>
> On Wed, 10 May 2023 at 14:33, Ard Biesheuvel  wrote:
> >
> > On Wed, 10 May 2023 at 09:41, gaoliming via groups.io
> >  wrote:
> > >
> > > Ard:
> > >   Seemly, this patch set passed code review before the soft feature 
> > > freeze. So, I am OK to merge it for this stable tag.
> > >
> >
> > Thanks
> >
> > Gerd,
> >
> > Could you run this through the CI please? I am getting errors.
> >
> > https://github.com/tianocore/edk2/pull/4382
>
> Actually, it seems to be a trivial uncrustify fix - i'll just fix that
> up locally.

Merged. Thanks all.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104571): https://edk2.groups.io/g/devel/message/104571
Mute This Topic: https://groups.io/mt/98801329/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] OvmfPkg/VirtioSerialDxe: fix RELEASE build error

2023-05-10 Thread Ard Biesheuvel
On Wed, 10 May 2023 at 15:54, Ard Biesheuvel  wrote:
>
> On Wed, 10 May 2023 at 11:18, Ard Biesheuvel  wrote:
> >
> > On Wed, 10 May 2023 at 09:39, Ard Biesheuvel  wrote:
> > >
> > > On Wed, 10 May 2023 at 09:34, Gerd Hoffmann  wrote:
> > > >
> > > > EventNames is used to pretty-print debug log messages.
> > > > Add #ifdef to only include it in debug builds.
> > > > Fixes a clang build failure.
> > > >
> > > > Reported-by: Rebecca Cran 
> > > > Signed-off-by: Gerd Hoffmann 
> > >
> > > Queued up as #4381 - thanks.
> > >
> >
> > This appears to break the build
> >
> > https://github.com/tianocore/edk2/pull/4381
>
> Actually, looking at the code, I think the Clang diagnostic is highly
> dubious here. The non-DEBUG code takes the ARRAY_SIZE() of EventNames,
> and so the #ifdef will result in a compiler error.
>
> I suppose we can work around this, but we might also just add
> -Wunneeded-internal-declaration to the clang cflags for RELEASE

I've sent a BaseTools patch for this - I suggest we merge that and
drop this one.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104570): https://edk2.groups.io/g/devel/message/104570
Mute This Topic: https://groups.io/mt/98801293/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 v4 1/1] MinPlatformPkg: Add FspNvsBuffer compression option

2023-05-10 Thread Michael Kubacki
From: Michael Kubacki 

Adds a PCD called "PcdEnableCompressedFspNvsBuffer" that allows the
"FspNvsBuffer" UEFI variable data to be saved as compressed data.

Especially due to the nature of the data saved in this variable, it
compresses well. For example, it has been found to reduce ~63KB
of data to ~13KB. Boot time impact has been found to be negligible.

The default value is FALSE to keep default behavior consistent.

Decompression can be performed on the variable data using the
standard UefiDecompressLib.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Isaac Oram 
Cc: Liming Gao 
Cc: Eric Dong 
Cc: Raghava Gudla 
Signed-off-by: Michael Kubacki 
---

Notes:
v4:
  - Rebase onto 42a677e992d2
  - Add CompressLib to MinPlatformPkg.dsc as well
v3:
  - Rebase onto 7ac91ec277db
  - Add CompressLib instance to CoreCommonLib.dsc
v2: Rebase onto 9769bf28d1fc

 Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c   
| 62 
 Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf 
|  4 ++
 Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc
|  1 +
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec   
|  6 ++
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc   
|  1 +
 5 files changed, 61 insertions(+), 13 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c 
b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c
index 0215e8eeddfb..95b8cef8b32b 100644
--- 
a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c
+++ 
b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c
@@ -3,6 +3,7 @@
   exists, and saves the data to nvRAM.
 
 Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.
+Copyright (c) Microsoft Corporation.
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -10,6 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -19,6 +21,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -38,20 +41,26 @@ SaveMemoryConfigEntryPoint (
   IN EFI_SYSTEM_TABLE   *SystemTable
   )
 {
-  EFI_STATUSStatus;
-  EFI_HOB_GUID_TYPE *GuidHob;
-  VOID  *HobData;
-  VOID  *VariableData;
-  UINTN DataSize;
-  UINTN BufferSize;
-  BOOLEAN   DataIsIdentical;
+  EFI_STATUS Status;
+  EFI_HOB_GUID_TYPE  *GuidHob;
+  VOID   *HobData;
+  VOID   *VariableData;
+  UINTN  DataSize;
+  UINTN  BufferSize;
+  BOOLEANDataIsIdentical;
+  VOID   *CompressedData;
+  UINT64 CompressedSize;
+  UINTN  CompressedAllocationPages;
 
-  DataSize= 0;
-  BufferSize  = 0;
-  VariableData= NULL;
-  GuidHob = NULL;
-  HobData = NULL;
-  DataIsIdentical = FALSE;
+  DataSize  = 0;
+  BufferSize= 0;
+  VariableData  = NULL;
+  GuidHob   = NULL;
+  HobData   = NULL;
+  DataIsIdentical   = FALSE;
+  CompressedData= NULL;
+  CompressedSize= 0;
+  CompressedAllocationPages = 0;
 
   //
   // Search for the Memory Configuration GUID HOB.  If it is not present, then
@@ -73,6 +82,29 @@ SaveMemoryConfigEntryPoint (
 }
   }
 
+  if (PcdGetBool (PcdEnableCompressedFspNvsBuffer)) {
+if (DataSize > 0) {
+  CompressedAllocationPages = EFI_SIZE_TO_PAGES (DataSize);
+  CompressedData= AllocatePages (CompressedAllocationPages);
+  if (CompressedData == NULL) {
+DEBUG ((DEBUG_ERROR, "[%a] - Failed to allocate compressed data 
buffer.\n", __FUNCTION__));
+ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+return EFI_OUT_OF_RESOURCES;
+  }
+
+  CompressedSize = EFI_PAGES_TO_SIZE (CompressedAllocationPages);
+  Status = Compress (HobData, DataSize, CompressedData, 
);
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "[%a] - failed to compress data. Status = %r\n", 
__FUNCTION__, Status));
+ASSERT_EFI_ERROR (Status);
+return Status;
+  }
+}
+
+HobData  = CompressedData;
+DataSize = (UINTN)CompressedSize;
+  }
+
   if (HobData != NULL) {
 DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataLength:%d\n", DataSize));
 DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataPtr   : 0x%x\n", HobData));
@@ -136,6 +168,10 @@ SaveMemoryConfigEntryPoint (
 DEBUG((DEBUG_ERROR, "Memory S3 Data HOB was not found\n"));
   }
 
+  if (CompressedData != NULL) {
+FreePages (CompressedData, CompressedAllocationPages);
+  }
+
   //
   // This driver does not produce any protocol services, so always unload it.
   //
diff --git 

Re: [edk2-devel] [PATCH] BaseTools/tools_def: Disable overzealous unused variable warning on Clang

2023-05-10 Thread Rebecca Cran

Reviewed-by: Rebecca Cran 


This should go in for the edk2-stable202305 release.


--
Rebecca Cran


On 5/10/23 08:50, Ard Biesheuvel wrote:

The warnings Clang emits when enabling -Wunneeded-internal-declaration
(which is part of -Wall) are generating false positives for variables
whose size gets taken but are not referenced beyond that.

This may happen legitimately in debug code, so let's disable this
warning for Clang, rather than tiptoe around it in the code base.

This fixes the RELEASE build for OVMF, which triggers this issue in the
newly added VirtioSerialDxe driver.

Cc: Rebecca Cran 
Cc: Gerd Hoffmann 
Cc: Liming Gao 
Signed-off-by: Ard Biesheuvel 
---
Reproducer: https://godbolt.org/z/zx6qqjKrK

  BaseTools/Conf/tools_def.template | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index b3c822f0bc20046d..65dde57631fb6c95 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -1858,7 +1858,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS= 
-Wl,--defsym=PECOFF_HEADER_SIZE=0x22
  DEFINE CLANGDWARF_IA32_TARGET = -target i686-pc-linux-gnu

  DEFINE CLANGDWARF_X64_TARGET  = -target x86_64-pc-linux-gnu

  


-DEFINE CLANGDWARF_WARNING_OVERRIDES= -Wno-parentheses-equality 
-Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare 
-Wno-empty-body -Wno-unused-const-variable -Wno-varargs 
-Wno-unknown-warning-option -Wno-unused-but-set-variable 
-Wno-unused-const-variable -Wno-unaligned-access

+DEFINE CLANGDWARF_WARNING_OVERRIDES= -Wno-parentheses-equality 
-Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare 
-Wno-empty-body -Wno-unused-const-variable -Wno-varargs 
-Wno-unknown-warning-option -Wno-unused-but-set-variable 
-Wno-unused-const-variable -Wno-unaligned-access 
-Wno-unneeded-internal-declaration

  DEFINE CLANGDWARF_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) 
DEF(CLANGDWARF_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields 
-Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas 
-Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables 
-mno-sse -mno-mmx -msoft-float -mno-implicit-float  
-ftrap-function=undefined_behavior_has_been_optimized_away_by_clang 
-funsigned-char -fno-ms-extensions -Wno-null-dereference

  


  ###




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




[edk2-devel] [PATCH] BaseTools/tools_def: Disable overzealous unused variable warning on Clang

2023-05-10 Thread Ard Biesheuvel
The warnings Clang emits when enabling -Wunneeded-internal-declaration
(which is part of -Wall) are generating false positives for variables
whose size gets taken but are not referenced beyond that.

This may happen legitimately in debug code, so let's disable this
warning for Clang, rather than tiptoe around it in the code base.

This fixes the RELEASE build for OVMF, which triggers this issue in the
newly added VirtioSerialDxe driver.

Cc: Rebecca Cran 
Cc: Gerd Hoffmann 
Cc: Liming Gao 
Signed-off-by: Ard Biesheuvel 
---
Reproducer: https://godbolt.org/z/zx6qqjKrK

 BaseTools/Conf/tools_def.template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index b3c822f0bc20046d..65dde57631fb6c95 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -1858,7 +1858,7 @@ DEFINE CLANGDWARF_X64_DLINK2_FLAGS= 
-Wl,--defsym=PECOFF_HEADER_SIZE=0x22
 DEFINE CLANGDWARF_IA32_TARGET = -target i686-pc-linux-gnu

 DEFINE CLANGDWARF_X64_TARGET  = -target x86_64-pc-linux-gnu

 

-DEFINE CLANGDWARF_WARNING_OVERRIDES= -Wno-parentheses-equality 
-Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare 
-Wno-empty-body -Wno-unused-const-variable -Wno-varargs 
-Wno-unknown-warning-option -Wno-unused-but-set-variable 
-Wno-unused-const-variable -Wno-unaligned-access

+DEFINE CLANGDWARF_WARNING_OVERRIDES= -Wno-parentheses-equality 
-Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare 
-Wno-empty-body -Wno-unused-const-variable -Wno-varargs 
-Wno-unknown-warning-option -Wno-unused-but-set-variable 
-Wno-unused-const-variable -Wno-unaligned-access 
-Wno-unneeded-internal-declaration

 DEFINE CLANGDWARF_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) 
DEF(CLANGDWARF_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields 
-Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas 
-Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables 
-mno-sse -mno-mmx -msoft-float -mno-implicit-float  
-ftrap-function=undefined_behavior_has_been_optimized_away_by_clang 
-funsigned-char -fno-ms-extensions -Wno-null-dereference

 

 ###

-- 
2.39.2



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




  1   2   >