[edk2-devel] [PATCH v1 0/1] AMD/AmdMinBoardPkg: Implements SpcrDeviceLib library

2023-05-08 Thread Abdul Lateef Attar via groups.io
PR: https://github.com/tianocore/edk2-platforms/pull/81

Implements SpcrDeviceLib for AmdMinBoardPkg.

Cc: Abner Chang 
Cc: Abdul Lateef Attar 


Abdul Lateef Attar (1):
  AMD/AmdMinBoardPkg: Implements SpcrDeviceLib library

 .../AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc |  6 ++
 .../Library/SpcrDeviceLib/SpcrDeviceLib.inf   | 23 +
 .../Library/SpcrDeviceLib/SpcrDeviceLib.c | 84 +++
 3 files changed, 113 insertions(+)
 create mode 100755 
Platform/AMD/AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.inf
 create mode 100755 
Platform/AMD/AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.c

-- 
2.25.1



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




[edk2-devel] [PATCH v1 1/1] AMD/AmdMinBoardPkg: Implements SpcrDeviceLib library

2023-05-08 Thread Abdul Lateef Attar via groups.io
Implements SpcrDeviceLib library for AMD common boards.

Cc: Abner Chang 
Signed-off-by: Abdul Lateef Attar 
---
 .../AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc |  6 ++
 .../Library/SpcrDeviceLib/SpcrDeviceLib.inf   | 23 +
 .../Library/SpcrDeviceLib/SpcrDeviceLib.c | 84 +++
 3 files changed, 113 insertions(+)
 create mode 100755 
Platform/AMD/AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.inf
 create mode 100755 
Platform/AMD/AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.c

diff --git a/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc 
b/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc
index 2f17db5df5fb..273cd74f7842 100644
--- a/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc
+++ b/Platform/AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc
@@ -22,9 +22,15 @@ [Packages]
   MinPlatformPkg/MinPlatformPkg.dec
   UefiCpuPkg/UefiCpuPkg.dec
 
+[LibraryClasses]
+  SpcrDeviceLib|AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.inf
+
 [LibraryClasses.common.PEIM]
   SetCacheMtrrLib|AmdMinBoardPkg/Library/SetCacheMtrrLib/SetCacheMtrrLib.inf
 
+[Components]
+  AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.inf
+
 [Components.IA32]
   AmdMinBoardPkg/Library/SetCacheMtrrLib/SetCacheMtrrLib.inf
 
diff --git 
a/Platform/AMD/AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.inf 
b/Platform/AMD/AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.inf
new file mode 100755
index ..d9b77e586aa8
--- /dev/null
+++ b/Platform/AMD/AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.inf
@@ -0,0 +1,23 @@
+## @file
+# Implementation for SpcrDeviceLib Library.
+# SpcrDeviceLib is usd for Serial Port Console Redirection Table (SPCR) device.
+#
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+  INF_VERSION= 1.29
+  BASE_NAME  = SpcrDeviceLib
+  FILE_GUID  = 9232A55A-45E3-424A-94C6-615AF63C9A6B
+  VERSION_STRING = 1.0
+  MODULE_TYPE= BASE
+  LIBRARY_CLASS  = SpcrDeviceLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+
+[Sources]
+  SpcrDeviceLib.c
diff --git a/Platform/AMD/AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.c 
b/Platform/AMD/AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.c
new file mode 100755
index ..0762f16fb360
--- /dev/null
+++ b/Platform/AMD/AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.c
@@ -0,0 +1,84 @@
+/** @file
+
+Implements SpcrDeviceLib library functions.
+This library implementation is for AMD processor based platforms.
+
+Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+STATIC EFI_GUID  TerminalTypeGuid[] = {
+  DEVICE_PATH_MESSAGING_PC_ANSI,
+  DEVICE_PATH_MESSAGING_VT_100,
+  DEVICE_PATH_MESSAGING_VT_100_PLUS,
+  DEVICE_PATH_MESSAGING_VT_UTF8
+};
+
+/**
+  Get a Serial Port device for SPCR.
+
+  @retval NULL   Fails to get the DevicePath
+  DevicePath If success
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+EFIAPI
+GetSpcrDevice (
+  VOID
+  )
+{
+  EFI_DEVICE_PATH_PROTOCOL  *VarConsole;
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
+  EFI_DEVICE_PATH_PROTOCOL  *TmpDevicePath;
+  VENDOR_DEVICE_PATH*Vendor;
+  UINTN Size;
+  BOOLEAN   Found;
+  UINTN Index;
+
+  // look for supported terminal type GUID in the device path
+  if (GetEfiGlobalVariable2 (L"ConOut", (VOID **)&VarConsole, NULL) == 
EFI_SUCCESS) {
+do {
+  // Get the Single Device Path
+  DevicePath = GetNextDevicePathInstance (&VarConsole, &Size);
+  if (DevicePath == NULL) {
+return NULL;
+  }
+
+  TmpDevicePath = DevicePath;
+  Found = FALSE;
+  while (!IsDevicePathEnd (TmpDevicePath)) {
+// search for terminal type
+Vendor = (VENDOR_DEVICE_PATH *)TmpDevicePath;
+for (Index = 0; Index < (sizeof (TerminalTypeGuid) / sizeof 
(TerminalTypeGuid[0])); Index++) {
+  if (CompareGuid (&Vendor->Guid, &TerminalTypeGuid[Index])) {
+Found = TRUE;
+break;
+  }
+}
+
+if (Found) {
+  break;
+}
+
+TmpDevicePath = NextDevicePathNode (TmpDevicePath);
+  }
+
+  if (Found) {
+return (DevicePath);
+  }
+
+  FreePool (DevicePath);
+} while (VarConsole != NULL);
+  }
+
+  return NULL;
+}
-- 
2.25.1



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




Re: [edk2-devel] purpose of EFI_LOCK

2023-05-08 Thread Laszlo Ersek
Thank you Vincent -- I didn't know anything about the MP approach to
edk2 networking, but even more interestingly, I never thought there had
been (successful) attempts to sneak interrupt driven device drivers
(back) into UEFI / edk2. I've always thought (somewhat vaguely perhaps)
that the timer tick was a "set in stone" limit for receiving data.

Laszlo

On 5/6/23 00:25, Vincent Zimmer wrote:
> Random and tl;dr fun friday fact.
> You can see the efi locks replaced w/ spinlocks in
> https://github.com/tianocore/edk2-staging/tree/MpNetworkStack to
> support the use case described in
> https://uefi.org/sites/default/files/resources/7_Maciej%20Vincent_INTEL_network%20stack%20performance.pdf.
> These changes along w/ a bespoke threading protocol allow for running
> efi networking code across all cores and still be able to interact w/
> an enlightened dxe core. We didn't push forward to standardize for
> various reasons, such as folks pursuing an alternate solution to the
> original problem statement (e.g., LinuxBoot for datacenter network
> provisioning) and the huge legacy app compat we'd face. So it's
> 'possible', just as you 'could' have i/o device interrupt service
> routines (isr) w/ their own 'device' tpl's between notify and high
> (see "firmware interrupts"
> https://uefi.org/specs/UEFI/2.10/07_Services_Boot_Services.html#tpl-usage)
> if you were to expose the appropriate registration and dispatch
> interface from the core. I don't think we put anything in staging or
> elsewhere public w/ isr examples, though, and I expect trying to
> retrofit after 2+ decades would face similar app compat issues w/
> folks who already curate their own proprietary device interrupt sol'n.
> Vincent
> 
> On Fri, May 5, 2023 at 12:59 PM Laszlo Ersek  wrote:
>>
>> Hi Andrew,
>>
>> thank you! The background / paragraph on the naming helps!
>>
>> Cheers,
>> Laszlo
>>
>> On 5/4/23 20:01, Andrew (EFI) Fish wrote:
>>> Laszlo,
>>>
>>> Hope you are doing well! Sorry to top post but I’m just commenting on
>>> the big picture, not answering your specific questions yet.
>>>
>>> The Wiki definition of lock  is something like: In computer science
>>> locks are a mechanism that enforces limits on access to a resource when
>>> there is the possibility for contention between threads of execution. I
>>> think the key point here is “threads of execution” is not threads….
>>>
>>> UEFI is single threaded with a cooperative event model. There is no
>>> scheduler and an event blocks all forward progress of any event at the
>>> same or lower TPL. The protocol services have defined TPL Restrictions
>>> [1] so that is possible to implement locking. In the context of EFI
>>> raising the TPL blocks any “threads of execution” (events) that could
>>> preempt the running code from contending with a critical section.
>>>
>>> Lets thing about what would happen if you use an atomic primitive as a
>>> lock in EFI. Let’s say the app is installing a protocol so the DXE Core
>>> has the protocol database locked. Any event that fired in that window
>>> would not be able to call any UEFI Boot Service that was related to
>>> protocols and expect it to succeed. If the event blocked on the lock,
>>> the system is dead locked. If the the lock was tested and failed that
>>> basically means it would be normal for any UEFI service to fail in
>>> events and event code needed to coded to deal with that. Basically the
>>> even could we need to defer to a future time the event gets signaled. I
>>> think think this quickly devolves in the event code having to implement
>>> a simple scheduler for its set. Thus making locks raise the TPL is just
>>> better for everyone.
>>>
>>> Not that we have always been good at naming things, but in the context
>>> of EFI a Lock is best implemented as raising TPL so we made an up level
>>> look API to make that clear to people, and to help educate people how
>>> locks should be implemented in EFI.
>>>
>>> This is old, but it is a good sumarry of why we did not want BIOS
>>> programmers dealing with threads 20+ years ago when we designed EFI.
>>>
>>>
>>> preview.png
>>> threads 
>>> PDF Document · 107 KB
>>> 
>>>
>>> 
>>>
>>>
>>> [1]
>>> https://uefi.org/specs/UEFI/2.10/07_Services_Boot_Services.html#tpl-restrictions
>>>  
>>> 
>>>
>>> Thanks,
>>>
>>> Andrew Fish
>>>
 On May 4, 2023, at 1:45 AM, Laszlo Ersek  wrote:

 Hi,

 what benefit does EFI_LOCK add, over direct gBS->RaiseTPL() and
 gBS->RestoreTPL() calls?

 Considering just the two APIs EfiAcquireLock() and EfiReleaseLock():

 - The "Lock" field (effectively, lock status field) is useless; it is
 only written to, never read (outside of ASSERT()s)

 - The "OwnerTpl" and "

[edk2-devel] [PATCH v5 0/5] UefiCpuPkg/ResetVector: Refine page table creation, and support 5 Level paging

2023-05-08 Thread Zhiguang Liu
This patch set simplify the page table creation code, remove some
hard-code, combine files and support 5 Level paging.

V4:
Refine comments and update below macro names:
PG_NLE -> PAGE_NLE
PTE_2MB -> PDE_2MB
PDP_1G -> PDPTE_1GB
PAGE_BLP_ATTR -> PAGE_BLE_ATTR

No code logic impact

V5:
Update below macro names:
PDE_2MB -> PAGE_PDE_2MB
PDPTE_1GB -> PAGE_PDPTE_1GB

No code logic impact

Zhiguang Liu (5):
  UefiCpuPkg/ResetVector: Rename macros about page table.
  UefiCpuPkg/ResetVector: Simplify page table creation in ResetVector
  UefiCpuPkg/ResetVector: Combine PageTables1G.asm and PageTables2M.asm
  UefiCpuPkg/ResetVector: Modify Page Table in ResetVector
  UefiCpuPkg/ResetVector: Support 5 level page table in ResetVector

 .../ResetVector/Vtf0/Ia32/Flat32ToFlat64.asm  | 25 -
 .../ResetVector/Vtf0/Ia32/PageTables64.asm| 24 -
 UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb|  9 +-
 .../ResetVector/Vtf0/X64/PageTables.asm   | 93 +++
 .../ResetVector/Vtf0/X64/PageTables1G.asm | 53 ---
 .../ResetVector/Vtf0/X64/PageTables2M.asm | 60 
 6 files changed, 118 insertions(+), 146 deletions(-)
 delete mode 100644 UefiCpuPkg/ResetVector/Vtf0/Ia32/PageTables64.asm
 create mode 100644 UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm
 delete mode 100644 UefiCpuPkg/ResetVector/Vtf0/X64/PageTables1G.asm
 delete mode 100644 UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm

-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104256): https://edk2.groups.io/g/devel/message/104256
Mute This Topic: https://groups.io/mt/98756994/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/5] UefiCpuPkg/ResetVector: Rename macros about page table.

2023-05-08 Thread Zhiguang Liu
This patch only renames macro, with no code logic impacted.
Two purpose to rename macro:
1. Align some macro name in PageTables1G.asm and PageTables2M.asm, so
that these two files can be easily combined later.
2. Some Macro names such as PDP are not accurate, since 4 level page
entry also uses this macro. PAGE_NLE (no leaf entry) is better

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Cc: Gerd Hoffmann 
Cc: Debkumar De 
Cc: Catharine West 
Signed-off-by: Zhiguang Liu 
---
 .../ResetVector/Vtf0/X64/PageTables1G.asm | 26 +-
 .../ResetVector/Vtf0/X64/PageTables2M.asm | 35 +++
 2 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables1G.asm 
b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables1G.asm
index 19bd3d5a92..20a61f949c 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables1G.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables1G.asm
@@ -2,7 +2,7 @@
 ; @file
 ; Emits Page Tables for 1:1 mapping of the addresses 0 - 0x80 (512GB)
 ;
-; Copyright (c) 2021, Intel Corporation. All rights reserved.
+; Copyright (c) 2021 - 2023, Intel Corporation. All rights reserved.
 ; SPDX-License-Identifier: BSD-2-Clause-Patent
 ; Linear-Address Translation to a 1-GByte Page
 ;
@@ -12,11 +12,18 @@ BITS64
 
 %define ALIGN_TOP_TO_4K_FOR_PAGING
 
-%define PAGE_PDP_ATTR (PAGE_ACCESSED + \
+;
+; Page table non-leaf entry attribute
+;
+%define PAGE_NLE_ATTR (PAGE_ACCESSED + \
 PAGE_READ_WRITE + \
 PAGE_PRESENT)
 
-%define PAGE_PDP_1G_ATTR (PAGE_ACCESSED + \
+;
+; Page table big leaf entry attribute:
+; PDPTE 1GB entry or PDE 2MB entry
+;
+%define PAGE_BLE_ATTR (PAGE_ACCESSED + \
 PAGE_READ_WRITE + \
 PAGE_DIRTY + \
 PAGE_PRESENT + \
@@ -25,10 +32,13 @@ BITS64
 %define PGTBLS_OFFSET(x) ((x) - TopLevelPageDirectory)
 %define PGTBLS_ADDR(x) (ADDR_OF(TopLevelPageDirectory) + (x))
 
-%define PDP(offset) (ADDR_OF(TopLevelPageDirectory) + (offset) + \
-PAGE_PDP_ATTR)
+;
+; Page table non-leaf entry
+;
+%define PAGE_NLE(offset) (ADDR_OF(TopLevelPageDirectory) + (offset) + \
+PAGE_NLE_ATTR)
 
-%define PDP_1G(x) ((x << 30) + PAGE_PDP_1G_ATTR)
+%define PAGE_PDPTE_1GB(x) ((x << 30) + PAGE_BLE_ATTR)
 
 ALIGN 16
 
@@ -37,7 +47,7 @@ TopLevelPageDirectory:
 ;
 ; Top level Page Directory Pointers (1 * 512GB entry)
 ;
-DQ  PDP(0x1000)
+DQ  PAGE_NLE(0x1000)
 
 TIMES 0x1000-PGTBLS_OFFSET($) DB 0
 ;
@@ -45,7 +55,7 @@ TopLevelPageDirectory:
 ;
 %assign i 0
 %rep  512
-DQPDP_1G(i)
+DQPAGE_PDPTE_1GB(i)
 %assign i i+1
 %endrep
 TIMES 0x2000-PGTBLS_OFFSET($) DB 0
diff --git a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm 
b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm
index b97df384ac..1221b023fe 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm
@@ -2,7 +2,7 @@
 ; @file
 ; Emits Page Tables for 1:1 mapping of the addresses 0 - 0x1 (4GB)
 ;
-; Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
+; Copyright (c) 2008 - 2023, Intel Corporation. All rights reserved.
 ; SPDX-License-Identifier: BSD-2-Clause-Patent
 ;
 ;--
@@ -11,29 +11,36 @@ BITS64
 
 %define ALIGN_TOP_TO_4K_FOR_PAGING
 
-%define PAGE_2M_PDE_ATTR (PAGE_SIZE + \
+;
+; Page table big leaf entry attribute:
+; PDPTE 1GB entry or PDE 2MB entry
+;
+%define PAGE_BLE_ATTR   (PAGE_SIZE + \
   PAGE_ACCESSED + \
   PAGE_DIRTY + \
   PAGE_READ_WRITE + \
   PAGE_PRESENT)
 
-%define PAGE_PDP_ATTR (PAGE_ACCESSED + \
-   PAGE_READ_WRITE + \
-   PAGE_PRESENT)
+;
+; Page table non-leaf entry attribute
+;
+%define PAGE_NLE_ATTR (PAGE_ACCESSED + \
+PAGE_READ_WRITE + \
+PAGE_PRESENT)
 
 %define PGTBLS_OFFSET(x) ((x) - TopLevelPageDirectory)
 %define PGTBLS_ADDR(x) (ADDR_OF(TopLevelPageDirectory) + (x))
 
-%define PDP(offset) (ADDR_OF(TopLevelPageDirectory) + (offset) + \
- PAGE_PDP_ATTR)
-%define PTE_2MB(x) ((x << 21) + PAGE_2M_PDE_ATTR)
+%define PAGE_NLE(offset) (ADDR_OF(TopLevelPageDirectory) + (offset) + \
+PAGE_NLE_ATTR)
+%define PAGE_PDE_2MB(x) ((x << 21) + PAGE_BLE_ATTR)
 
 TopLevelPageDirectory:
 
 ;
 ; Top level Page Directory Pointers (1 * 512GB entry)
 ;
-DQ  PDP(0x1000)
+DQ  PAGE_NLE(0x1000)
 
 
 ;
@@ -41,10 +48,10 @@ TopLevelPageDirectory:
 ;
 TIMES 0x1000-PGTBLS_OFFSET($) DB 0
 
-DQ  PDP(0x2000)
-DQ  PDP(0x3000)
-DQ  PDP(0x4000)
-DQ  PDP(0x5000)
+DQ  PAGE_NLE(0x2000)
+DQ  PAGE_NLE(0x3000)
+DQ  PA

[edk2-devel] [PATCH v5 2/5] UefiCpuPkg/ResetVector: Simplify page table creation in ResetVector

2023-05-08 Thread Zhiguang Liu
Currently, page table creation has many hard-code values about the
offset to the start of page table. To simplify it, add Labels such
as Pml4, Pdp and Pd, so that we can remove many hard-code values

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Cc: Gerd Hoffmann 
Cc: Debkumar De 
Cc: Catharine West 
Signed-off-by: Zhiguang Liu 
---
 .../ResetVector/Vtf0/Ia32/PageTables64.asm|  4 +--
 .../ResetVector/Vtf0/X64/PageTables1G.asm | 18 --
 .../ResetVector/Vtf0/X64/PageTables2M.asm | 34 ---
 3 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia32/PageTables64.asm 
b/UefiCpuPkg/ResetVector/Vtf0/Ia32/PageTables64.asm
index 87a4125d4b..f188da20ba 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/Ia32/PageTables64.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/Ia32/PageTables64.asm
@@ -2,7 +2,7 @@
 ; @file
 ; Sets the CR3 register for 64-bit paging
 ;
-; Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.
+; Copyright (c) 2008 - 2023, Intel Corporation. All rights reserved.
 ; SPDX-License-Identifier: BSD-2-Clause-Patent
 ;
 ;--
@@ -17,7 +17,7 @@ SetCr3ForPageTables64:
 ;
 ; These pages are built into the ROM image in X64/PageTables.asm
 ;
-mov eax, ADDR_OF(TopLevelPageDirectory)
+mov eax, ADDR_OF(Pml4)
 mov cr3, eax
 
 OneTimeCallRet SetCr3ForPageTables64
diff --git a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables1G.asm 
b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables1G.asm
index 20a61f949c..f5b8da0015 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables1G.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables1G.asm
@@ -29,35 +29,31 @@ BITS64
 PAGE_PRESENT + \
 PAGE_SIZE)
 
-%define PGTBLS_OFFSET(x) ((x) - TopLevelPageDirectory)
-%define PGTBLS_ADDR(x) (ADDR_OF(TopLevelPageDirectory) + (x))
-
 ;
 ; Page table non-leaf entry
 ;
-%define PAGE_NLE(offset) (ADDR_OF(TopLevelPageDirectory) + (offset) + \
+%define PAGE_NLE(address) (ADDR_OF(address) + \
 PAGE_NLE_ATTR)
 
 %define PAGE_PDPTE_1GB(x) ((x << 30) + PAGE_BLE_ATTR)
 
 ALIGN 16
 
-TopLevelPageDirectory:
-
+Pml4:
 ;
-; Top level Page Directory Pointers (1 * 512GB entry)
+; PML4 (1 * 512GB entry)
 ;
-DQ  PAGE_NLE(0x1000)
+DQ  PAGE_NLE(Pdp)
+TIMES   0x1000 - ($ - Pml4) DB 0
 
-TIMES 0x1000-PGTBLS_OFFSET($) DB 0
+Pdp:
 ;
-; Next level Page Directory Pointers (512 * 1GB entries => 512GB)
+; Page-directory pointer table (512 * 1GB entries => 512GB)
 ;
 %assign i 0
 %rep  512
 DQPAGE_PDPTE_1GB(i)
 %assign i i+1
 %endrep
-TIMES 0x2000-PGTBLS_OFFSET($) DB 0
 
 EndOfPageTables:
diff --git a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm 
b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm
index 1221b023fe..731dabad4d 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm
@@ -28,36 +28,32 @@ BITS64
 PAGE_READ_WRITE + \
 PAGE_PRESENT)
 
-%define PGTBLS_OFFSET(x) ((x) - TopLevelPageDirectory)
-%define PGTBLS_ADDR(x) (ADDR_OF(TopLevelPageDirectory) + (x))
-
-%define PAGE_NLE(offset) (ADDR_OF(TopLevelPageDirectory) + (offset) + \
+%define PAGE_NLE(address) (ADDR_OF(address) + \
 PAGE_NLE_ATTR)
 %define PAGE_PDE_2MB(x) ((x << 21) + PAGE_BLE_ATTR)
 
-TopLevelPageDirectory:
-
+Pml4:
 ;
-; Top level Page Directory Pointers (1 * 512GB entry)
+; PML4 (1 * 512GB entry)
 ;
-DQ  PAGE_NLE(0x1000)
-
+DQ  PAGE_NLE(Pdp)
+TIMES   0x1000 - ($ - Pml4) DB 0
 
+Pdp:
 ;
-; Next level Page Directory Pointers (4 * 1GB entries => 4GB)
+; Page-directory pointer table (4 * 1GB entries => 4GB)
 ;
-TIMES 0x1000-PGTBLS_OFFSET($) DB 0
-
-DQ  PAGE_NLE(0x2000)
-DQ  PAGE_NLE(0x3000)
-DQ  PAGE_NLE(0x4000)
-DQ  PAGE_NLE(0x5000)
+DQ  PAGE_NLE(Pd)
+DQ  PAGE_NLE(Pd + 0x1000)
+DQ  PAGE_NLE(Pd + 0x2000)
+DQ  PAGE_NLE(Pd + 0x3000)
+TIMES   0x1000 - ($ - Pdp) DB 0
 
+Pd:
 ;
-; Page Table Entries (2048 * 2MB entries => 4GB)
+; Page-Directory (2048 * 2MB entries => 4GB)
+; Four pages below, each is pointed by one entry in Pdp.
 ;
-TIMES 0x2000-PGTBLS_OFFSET($) DB 0
-
 %assign i 0
 %rep0x800
 DQ  PAGE_PDE_2MB(i)
-- 
2.31.1.windows.1



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




[edk2-devel] [PATCH v5 3/5] UefiCpuPkg/ResetVector: Combine PageTables1G.asm and PageTables2M.asm

2023-05-08 Thread Zhiguang Liu
Combine PageTables1G.asm and PageTables2M.asm to reuse code.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Cc: Gerd Hoffmann 
Cc: Debkumar De 
Cc: Catharine West 
Signed-off-by: Zhiguang Liu 
---
 UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb|  8 +--
 .../X64/{PageTables1G.asm => PageTables.asm}  | 38 ---
 .../ResetVector/Vtf0/X64/PageTables2M.asm | 63 ---
 3 files changed, 33 insertions(+), 76 deletions(-)
 rename UefiCpuPkg/ResetVector/Vtf0/X64/{PageTables1G.asm => PageTables.asm} 
(57%)
 delete mode 100644 UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb 
b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
index bdea1fb875..136361e62c 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
+++ b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
@@ -2,7 +2,7 @@
 ; @file
 ; This file includes all other code files to assemble the reset vector code
 ;
-; Copyright (c) 2008 - 2013, Intel Corporation. All rights reserved.
+; Copyright (c) 2008 - 2023, Intel Corporation. All rights reserved.
 ; SPDX-License-Identifier: BSD-2-Clause-Patent
 ;
 ;--
@@ -38,11 +38,7 @@
 %include "PageTables.inc"
 
 %ifdef ARCH_X64
-  %ifdef PAGE_TABLE_1G
-%include "X64/PageTables1G.asm"
-  %else
-%include "X64/PageTables2M.asm"
-  %endif
+  %include "X64/PageTables.asm"
 %endif
 
 %ifdef DEBUG_PORT80
diff --git a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables1G.asm 
b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm
similarity index 57%
rename from UefiCpuPkg/ResetVector/Vtf0/X64/PageTables1G.asm
rename to UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm
index f5b8da0015..9b492b063f 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables1G.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm
@@ -1,10 +1,11 @@
 ;--
 ; @file
-; Emits Page Tables for 1:1 mapping of the addresses 0 - 0x80 (512GB)
+; Emits Page Tables for 1:1 mapping.
+; If using 1G page table, map addresses 0 - 0x80 (512GB),
+; else, map addresses 0 - 0x1 (4GB)
 ;
 ; Copyright (c) 2021 - 2023, Intel Corporation. All rights reserved.
 ; SPDX-License-Identifier: BSD-2-Clause-Patent
-; Linear-Address Translation to a 1-GByte Page
 ;
 ;--
 
@@ -36,6 +37,7 @@ BITS64
 PAGE_NLE_ATTR)
 
 %define PAGE_PDPTE_1GB(x) ((x << 30) + PAGE_BLE_ATTR)
+%define PAGE_PDE_2MB(x) ((x << 21) + PAGE_BLE_ATTR)
 
 ALIGN 16
 
@@ -46,14 +48,36 @@ Pml4:
 DQ  PAGE_NLE(Pdp)
 TIMES   0x1000 - ($ - Pml4) DB 0
 
+%ifdef PAGE_TABLE_1G
 Pdp:
 ;
 ; Page-directory pointer table (512 * 1GB entries => 512GB)
 ;
-%assign i 0
-%rep  512
-DQPAGE_PDPTE_1GB(i)
-%assign i i+1
-%endrep
+%assign i 0
+%rep  512
+DQPAGE_PDPTE_1GB(i)
+%assign i i+1
+%endrep
+%else
+Pdp:
+;
+; Page-directory pointer table (4 * 1GB entries => 4GB)
+;
+DQ  PAGE_NLE(Pd)
+DQ  PAGE_NLE(Pd + 0x1000)
+DQ  PAGE_NLE(Pd + 0x2000)
+DQ  PAGE_NLE(Pd + 0x3000)
+TIMES   0x1000 - ($ - Pdp) DB 0
 
+Pd:
+;
+; Page-Directory (2048 * 2MB entries => 4GB)
+; Four pages below, each is pointed by one entry in Pdp.
+;
+%assign i 0
+%rep0x800
+DQ  PAGE_PDE_2MB(i)
+%assign i i+1
+%endrep
+%endif
 EndOfPageTables:
diff --git a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm 
b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm
deleted file mode 100644
index 731dabad4d..00
--- a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables2M.asm
+++ /dev/null
@@ -1,63 +0,0 @@
-;--
-; @file
-; Emits Page Tables for 1:1 mapping of the addresses 0 - 0x1 (4GB)
-;
-; Copyright (c) 2008 - 2023, Intel Corporation. All rights reserved.
-; SPDX-License-Identifier: BSD-2-Clause-Patent
-;
-;--
-
-BITS64
-
-%define ALIGN_TOP_TO_4K_FOR_PAGING
-
-;
-; Page table big leaf entry attribute:
-; PDPTE 1GB entry or PDE 2MB entry
-;
-%define PAGE_BLE_ATTR   (PAGE_SIZE + \
-  PAGE_ACCESSED + \
-  PAGE_DIRTY + \
-  PAGE_READ_WRITE + \
-  PAGE_PRESENT)
-
-;
-; Page table non-leaf entry attribute
-;
-%define PAGE_NLE_ATTR (PAGE_ACCESSED + \
-PAGE_READ_WRITE + \
-PAGE_PRESENT)
-
-%define PAGE_NLE(address) (ADDR_OF(address) + \
-PAGE_NLE_ATTR)
-%define PAGE_PDE_2MB(x) ((x << 21) + PAGE_BLE_ATTR)
-
-Pml4:
-;
-; PML4 (1 * 512GB entry)
-;
-DQ  PAGE_NLE(Pdp)
-TIMES   0x1000 - ($ - Pml4) DB 0
-
-Pdp:
-;
-; Page-directory pointer table (4 * 1GB entries =>

[edk2-devel] [PATCH v5 4/5] UefiCpuPkg/ResetVector: Modify Page Table in ResetVector

2023-05-08 Thread Zhiguang Liu
In ResetVector, if create page table, its highest address is fixed
because after page table, code layout is fixed(4K for normal code,
and another 4K only contains reset vector code).
Today's implementation organizes the page table as following if 1G
page table is used:
  4G-16K: PML4 page (PML4[0] points to 4G-12K)
  4G-12K: PDP page
  CR3 is set to 4G-16K
When 2M page table is used, the layout is as following:
  4G-32K: PML4 page (PML4[0] points to 4G-28K)
  4G-28K: PDP page (PDP entries point to PD pages)
  4G-24K: PD page mapping 0-1G
  4G-20K: PD page mapping 1-2G
  4G-16K: PD page mapping 2-3G
  4G-12K: PD page mapping 3-4G
  CR3 is set to 4G-32K
CR3 doesn't point to a fixed location which is a bit hard to debug at
runtime.

The new page table layout will always put PML4 in highest address
When 1G page table is used, the layout is as following:
  4G-16K: PDP page
  4G-12K: PML4 page (PML4[0] points to 4G-16K)
When 2M page table is used, the layout is as following:
  4G-32K: PD page mapping 0-1G
  4G-28K: PD page mapping 1-2G
  4G-24K: PD page mapping 2-3G
  4G-20K: PD page mapping 3-4G
  4G-16K: PDP page (PDP entries point to PD pages)
  4G-12K: PML4 page (PML4[0] points to 4G-16K)
CR3 is always set to 4G-12K
So, this patch can improve debuggability by make sure the init
CR3 pointing to a fixed address(4G-12K).

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Cc: Gerd Hoffmann 
Cc: Debkumar De 
Cc: Catharine West 
Signed-off-by: Zhiguang Liu 
---
 .../ResetVector/Vtf0/X64/PageTables.asm   | 33 ++-
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm 
b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm
index 9b492b063f..d66fb62c34 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm
@@ -41,13 +41,6 @@ BITS64
 
 ALIGN 16
 
-Pml4:
-;
-; PML4 (1 * 512GB entry)
-;
-DQ  PAGE_NLE(Pdp)
-TIMES   0x1000 - ($ - Pml4) DB 0
-
 %ifdef PAGE_TABLE_1G
 Pdp:
 ;
@@ -59,15 +52,6 @@ Pdp:
 %assign i i+1
 %endrep
 %else
-Pdp:
-;
-; Page-directory pointer table (4 * 1GB entries => 4GB)
-;
-DQ  PAGE_NLE(Pd)
-DQ  PAGE_NLE(Pd + 0x1000)
-DQ  PAGE_NLE(Pd + 0x2000)
-DQ  PAGE_NLE(Pd + 0x3000)
-TIMES   0x1000 - ($ - Pdp) DB 0
 
 Pd:
 ;
@@ -79,5 +63,22 @@ Pd:
 DQ  PAGE_PDE_2MB(i)
 %assign i i+1
 %endrep
+Pdp:
+;
+; Page-directory pointer table (4 * 1GB entries => 4GB)
+;
+DQ  PAGE_NLE(Pd)
+DQ  PAGE_NLE(Pd + 0x1000)
+DQ  PAGE_NLE(Pd + 0x2000)
+DQ  PAGE_NLE(Pd + 0x3000)
+TIMES   0x1000 - ($ - Pdp) DB 0
+
 %endif
+
+Pml4:
+;
+; PML4 (1 * 512GB entry)
+;
+DQ  PAGE_NLE(Pdp)
+TIMES   0x1000 - ($ - Pml4) DB 0
 EndOfPageTables:
-- 
2.31.1.windows.1



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




[edk2-devel] [PATCH v5 5/5] UefiCpuPkg/ResetVector: Support 5 level page table in ResetVector

2023-05-08 Thread Zhiguang Liu
Add a macro USE_5_LEVEL_PAGE_TABLE to determine whether to create
5 level page table.
If macro USE_5_LEVEL_PAGE_TABLE is defined, PML5Table is created
at (4G-12K), while PML4Table is at (4G-16K). In runtime check, if
5level paging is supported, use PML5Table, otherwise, use PML4Table.
If macro USE_5_LEVEL_PAGE_TABLE is not defined, to save space, 5level
paging is not created, and 4level paging is at (4G-12K) and be used.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Cc: Gerd Hoffmann 
Cc: Debkumar De 
Cc: Catharine West 
Signed-off-by: Zhiguang Liu 
---
 .../ResetVector/Vtf0/Ia32/Flat32ToFlat64.asm  | 25 +--
 .../ResetVector/Vtf0/Ia32/PageTables64.asm| 24 --
 UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb|  1 -
 .../ResetVector/Vtf0/X64/PageTables.asm   |  9 +++
 4 files changed, 32 insertions(+), 27 deletions(-)
 delete mode 100644 UefiCpuPkg/ResetVector/Vtf0/Ia32/PageTables64.asm

diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia32/Flat32ToFlat64.asm 
b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Flat32ToFlat64.asm
index 6891397c2a..f119f941a5 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/Ia32/Flat32ToFlat64.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/Ia32/Flat32ToFlat64.asm
@@ -2,7 +2,7 @@
 ; @file
 ; Transition from 32 bit flat protected mode into 64 bit flat protected mode
 ;
-; Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
+; Copyright (c) 2008 - 2023, Intel Corporation. All rights reserved.
 ; SPDX-License-Identifier: BSD-2-Clause-Patent
 ;
 ;--
@@ -14,7 +14,28 @@ BITS32
 ;
 Transition32FlatTo64Flat:
 
-OneTimeCall SetCr3ForPageTables64
+%ifdef USE_5_LEVEL_PAGE_TABLE
+mov eax, 0
+cpuid
+cmp eax, 07h; check if basic CPUID leaf contains 
leaf 07
+jb  NotSupport5LevelPaging  ; 5level paging not support, downgrade 
to 4level paging
+mov eax, 07h; check cpuid leaf 7, subleaf 0
+mov ecx, 0
+cpuid
+bt  ecx, 16 ; [Bits 16] Supports 5-level paging if 
1.
+jnc NotSupport5LevelPaging  ; 5level paging not support, downgrade 
to 4level paging
+mov eax, ADDR_OF(Pml5)
+mov cr3, eax
+mov eax, cr4
+bts eax, 12 ; Set LA57=1.
+mov cr4, eax
+jmp SetCr3Done
+NotSupport5LevelPaging:
+%endif
+
+mov eax, ADDR_OF(Pml4)
+mov cr3, eax
+SetCr3Done:
 
 mov eax, cr4
 bts eax, 5  ; enable PAE
diff --git a/UefiCpuPkg/ResetVector/Vtf0/Ia32/PageTables64.asm 
b/UefiCpuPkg/ResetVector/Vtf0/Ia32/PageTables64.asm
deleted file mode 100644
index f188da20ba..00
--- a/UefiCpuPkg/ResetVector/Vtf0/Ia32/PageTables64.asm
+++ /dev/null
@@ -1,24 +0,0 @@
-;--
-; @file
-; Sets the CR3 register for 64-bit paging
-;
-; Copyright (c) 2008 - 2023, Intel Corporation. All rights reserved.
-; SPDX-License-Identifier: BSD-2-Clause-Patent
-;
-;--
-
-BITS32
-
-;
-; Modified:  EAX
-;
-SetCr3ForPageTables64:
-
-;
-; These pages are built into the ROM image in X64/PageTables.asm
-;
-mov eax, ADDR_OF(Pml4)
-mov cr3, eax
-
-OneTimeCallRet SetCr3ForPageTables64
-
diff --git a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb 
b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
index 136361e62c..5a6563bd34 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
+++ b/UefiCpuPkg/ResetVector/Vtf0/Vtf0.nasmb
@@ -54,7 +54,6 @@
 
 %ifdef ARCH_X64
 %include "Ia32/Flat32ToFlat64.asm"
-%include "Ia32/PageTables64.asm"
 %endif
 
 %include "Ia16/Real16ToFlat32.asm"
diff --git a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm 
b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm
index d66fb62c34..7960b141be 100644
--- a/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm
+++ b/UefiCpuPkg/ResetVector/Vtf0/X64/PageTables.asm
@@ -81,4 +81,13 @@ Pml4:
 ;
 DQ  PAGE_NLE(Pdp)
 TIMES   0x1000 - ($ - Pml4) DB 0
+
+%ifdef USE_5_LEVEL_PAGE_TABLE
+Pml5:
+;
+; Pml5 table (only first entry is present, pointing to Pml4)
+;
+DQ  PAGE_NLE(Pml4)
+TIMES   0x1000 - ($ - Pml5) DB 0
+%endif
 EndOfPageTables:
-- 
2.31.1.windows.1



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




[edk2-devel] [PATCH v1] BaseTools/Plugin: Too many execute file will be failure

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

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

Change-Id: I7f1d8d46274f1c0104572d47253d499900effe76
Cc: Michael D Kinney 
Cc: Sean Brogan 
Cc: Michael Kubacki 
Signed-off-by: Gua Guo 
---
 .../HostBasedUnitTestRunner.py| 31 ---
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git 
a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py 
b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
index d993de9412..05bb6da50a 100644
--- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
+++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
@@ -209,13 +209,25 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 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"
+if (os.path.isfile(f"{os.path.join(buildOutputBase, 
'coverage.cov')}")):
+coverageFile += f" 
--input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
+ret = RunCmd("OpenCppCoverage", f"--export_type 
binary:{os.path.join(buildOutputBase, 'coverage.cov')} 
--working_dir={workspace}Build {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={workspace}Build " +
+f"--input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
+)
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to generate cobertura 
format xml in single package.")
 return 1
@@ -224,9 +236,20 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 testCoverageList = glob.glob(os.path.join(workspace, "Build", 
"**","*Test*.exe.cov"), recursive=True)
 coverageFile = ""
 for testCoverage in testCoverageList:
-coverageFile += " --input_coverage=" + testCoverage
+coverageFile  = f" --input_coverage={testCoverage}"
+if (os.path.isfile(f"{workspace}Build/coverage.cov")):
+coverageFile += f" 
--input_coverage={workspace}Build/coverage.cov"
+ret = RunCmd("OpenCppCoverage", f"--export_type 
binary:{workspace}Build/coverage.cov --working_dir={workspace}Build 
{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 cobertura:{workspace}Build/coverage.xml " +
+f"--working_dir={workspace}Build " +
+f"--input_coverage={workspace}Build/coverage.cov"
+)
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to generate cobertura 
format xml.")
 return 1
-- 
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104262): https://edk2.groups.io/g/devel/message/104262
Mute This Topic: https://groups.io/mt/98758306/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 0/5] Adding necessary changes for RedfishPkg

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

Hi Minh,
Just let you know your PR is just merged.
Thanks
Abner

From: Minh Nguyen 
Sent: Friday, May 5, 2023 2:50 PM
To: Chang, Abner ; Minh Nguyen 
; devel@edk2.groups.io
Cc: patc...@amperecomputing.com; nick...@nvidia.com; ig...@ami.com; 
n...@os.amperecomputing.com; tinhngu...@os.amperecomputing.com
Subject: Re: [PATCH V3 0/5] Adding necessary changes for RedfishPkg

Caution: This message originated from an External Source. Use proper caution 
when opening attachments, clicking links, or responding.


Hi Abner,

 While they're checking this issue, they recommend me to re-send v3 so I just 
sent it, you can also use the PR to review at the same time.

Thanks,

Minh Nguyen.
On 5/5/2023 1:01 PM, Minh Nguyen wrote:

Hi Abner,

 Here you are: #4338

Thanks,

Minh Nguyen
On 5/5/2023 12:45 PM, Chang, Abner wrote:

[EXTERNAL EMAIL NOTICE: This email originated from an external sender. Please 
be mindful of safe email handling and proprietary information protection 
practices.]





[AMD Official Use Only - General]



Ok, because the patch in email always has format problem when apply the patch, 
plus I can't get the patch from group.io; could you please create a PR on your 
Github thus I can review patches from there.

Just let me know the PR # after you creating it.



Thanks

Abner



-Original Message-

From: Minh Nguyen 


Sent: Friday, May 5, 2023 1:35 PM

To: Chang, Abner ; Minh Nguyen

;
 devel@edk2.groups.io

Cc: patc...@amperecomputing.com; 
nick...@nvidia.com; 
ig...@ami.com;

n...@os.amperecomputing.com; 
tinhngu...@os.amperecomputing.com

Subject: Re: [PATCH V3 0/5] Adding necessary changes for RedfishPkg



Caution: This message originated from an External Source. Use proper

caution when opening attachments, clicking links, or responding.





Hi Abner,



  Yes, me too. I have sent the email to 
miki.deme...@intel.com for checking

it.



Thanks,



Minh Nguyen



On 5/5/2023 12:03 PM, Chang, Abner wrote:

[AMD Official Use Only - General]



Hi Minh,

I don't know why however I can't see V3 patch set on group.io. Can you see

those patches on group.io?

Abner



-Original Message-

From: Minh Nguyen 


Sent: Friday, May 5, 2023 11:58 AM

To: devel@edk2.groups.io

Cc: patc...@amperecomputing.com; Chang, 
Abner

;

nick...@nvidia.com; 
ig...@ami.com; 
n...@os.amperecomputing.com;

tinhngu...@os.amperecomputing.com;

Minh Nguyen 


Subject: [PATCH V3 0/5] Adding necessary changes for RedfishPkg



Caution: This message originated from an External Source. Use proper

caution when opening attachments, clicking links, or responding.





This patchset adds necessary changes for RedfishPkg to avoid some

unexpected cases and fix compilation.



Changes since v3:

  + Replaced __FUNCTION__ with __func__ to be more C11 compliant.

Changes since v2:

  + Added "Cc:" to maintainers in commit message.

  + Corrected patch format subject prefix.

Changes since v1:

  + Removed redundant change and change the commit message for more

precise in PATCH 2/5.



Nhi Pham (1):

   RedfishPkg: Add missing newline character



Vu Nguyen (4):

   RedfishPkg: Correct variable type to prevent memory corruption

   RedfishPkg: Fix condition checking of error status

   RedfishPkg: Create RestEx child on selected interface

   RedfishPkg: Fix compile issue on Linux



  RedfishPkg/Include/Library/RestExLib.h   |   3 +

  RedfishPkg/Include/Pcd/RestExServiceDevicePath.h |   5 +-

  RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h|   3 +-

  RedfishPkg/Library/DxeRestExLib/DxeRestExLib.c   | 153





  RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c   |   4 +-

  RedfishPkg/RedfishHostInterfaceDxe/RedfishHostInterfaceDxe.c |   3 +-

  6 files changed, 73 insertions(+), 98 deletions(-)



--

2.39.0


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




[edk2-devel] [edk2-redfish-client][PATCH 2/6] Tool/Redfish-Profile-Simulator: Update computer system schema version

2023-05-08 Thread Nickle Wang via groups.io
Update mock-up file and use computer system schema version 1.5.0 in
order to support Boot.BootOrder attribute.
Update UUID of 2M220101SL for working with Redfish Profile Simulator.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
---
 .../redfish/v1/Systems/2M220100SL/index.json  | 2 +-
 .../redfish/v1/Systems/2M220101SL/index.json  | 4 ++--
 .../redfish/v1/Systems/2M220102SL/index.json  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/index.json
 
b/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/index.json
index dbba6913..090fd2ed 100644
--- 
a/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/index.json
+++ 
b/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/index.json
@@ -1,5 +1,5 @@
 {
-"@odata.type": "#ComputerSystem.v1_1_0.ComputerSystem",
+"@odata.type": "#ComputerSystem.v1_5_0.ComputerSystem",
 "Id": "2M220100SL",
 "Name": "Catfish System",
 "SystemType": "Physical",
diff --git 
a/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/index.json
 
b/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/index.json
index 3147cb88..bc082d31 100644
--- 
a/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/index.json
+++ 
b/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/index.json
@@ -1,5 +1,5 @@
 {
-"@odata.type": "#ComputerSystem.v1_1_0.ComputerSystem",
+"@odata.type": "#ComputerSystem.v1_5_0.ComputerSystem",
 "Id": "2M220101SL",
 "Name": "Catfish System",
 "SystemType": "Physical",
@@ -10,7 +10,7 @@
 "SKU": "",
 "PartNumber": "",
 "Description": "Catfish Implementation Recipe of simple scale-out 
monolithic server",
-"UUID": "BADFACED-DEAD-BEEF-1313-131313131313",
+"UUID": "25EF0280-EC82-42B0-8FB6-10ADCCC67C02",
 "HostName": "catfishHostname",
 "PowerState": "On",
 "BiosVersion": "X00.1.2.3.4(build-23)",
diff --git 
a/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/index.json
 
b/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/index.json
index 49b2d25f..d9aa7bb1 100644
--- 
a/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/index.json
+++ 
b/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/index.json
@@ -1,5 +1,5 @@
 {
-"@odata.type": "#ComputerSystem.v1_1_0.ComputerSystem",
+"@odata.type": "#ComputerSystem.v1_5_0.ComputerSystem",
 "Id": "2M220102SL",
 "Name": "Catfish System",
 "SystemType": "Physical",
-- 
2.17.1



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




[edk2-devel] [edk2-redfish-client][PATCH 1/6] Tool/Redfish-Profile-Simulator: Update requirements.txt

2023-05-08 Thread Nickle Wang via groups.io
Updates the Python module dependency for Redfish Profile Simulator.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
---
 Tools/Redfish-Profile-Simulator/requirements.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Tools/Redfish-Profile-Simulator/requirements.txt 
b/Tools/Redfish-Profile-Simulator/requirements.txt
index 88807d87..359a8144 100644
--- a/Tools/Redfish-Profile-Simulator/requirements.txt
+++ b/Tools/Redfish-Profile-Simulator/requirements.txt
@@ -1,2 +1,5 @@
+Werkzeug==0.16
+Jinja2==3.0.3
+itsdangerous==2.0.1
 flask==1.1.1
 pyOpenSSL
-- 
2.17.1



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




[edk2-devel] [edk2-redfish-client][PATCH 3/6] Tool/Redfish-Profile-Simulator: Update patch method of computer system

2023-05-08 Thread Nickle Wang via groups.io
Remove attribute check during patch of computer system and return
content-type with JSON format in HTTP header.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
---
 .../v1sim/resource.py |  4 ++-
 .../v1sim/systems.py  | 28 +++
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/Tools/Redfish-Profile-Simulator/v1sim/resource.py 
b/Tools/Redfish-Profile-Simulator/v1sim/resource.py
index ca7541f1..e722d16a 100644
--- a/Tools/Redfish-Profile-Simulator/v1sim/resource.py
+++ b/Tools/Redfish-Profile-Simulator/v1sim/resource.py
@@ -2,6 +2,7 @@
 # Copyright Notice:
 #
 # Copyright (c) 2019, Intel Corporation. All rights reserved.
+# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 # Copyright Notice:
@@ -47,6 +48,7 @@ class RfResource:
 try:
 # SHA1 should generate well-behaved etags
 response = flask.make_response(self.response)
+response.mimetype = 'application/json'
 etag = hashlib.sha1(self.response.encode('utf-8')).hexdigest()
 response.set_etag(etag)
 return response
@@ -69,7 +71,7 @@ class RfResource:
 else:
 raise Exception("attribute %s not found" % key)
 
-resp = flask.Response(json.dumps(self.res_data,indent=4))
+resp = flask.Response(json.dumps(self.res_data,indent=4), 
mimetype="application/json")
 return 0, 200, None, resp
 
 def post_resource(self, post_data):
diff --git a/Tools/Redfish-Profile-Simulator/v1sim/systems.py 
b/Tools/Redfish-Profile-Simulator/v1sim/systems.py
index de4b839a..6305a51e 100644
--- a/Tools/Redfish-Profile-Simulator/v1sim/systems.py
+++ b/Tools/Redfish-Profile-Simulator/v1sim/systems.py
@@ -2,7 +2,7 @@
 # Copyright Notice:
 #
 # Copyright (c) 2019, Intel Corporation. All rights reserved.
-# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
+# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 # Copyright Notice:
@@ -63,15 +63,7 @@ class RfSystemObj(RfResource):
 self.components[item] = RfBootOptionCollection(base_path, 
os.path.join(rel_path, item), parent=self)
 
 def patch_resource(self, patch_data):
-# first verify client didn't send us a property we cant patch
-for key in patch_data.keys():
-if key != "AssetTag" and key != "IndicatorLED" and key != "Boot" 
and key != "BiosVersion":
-return 4, 400, "Invalid Patch Property Sent", ""
-elif key == "Boot":
-for prop2 in patch_data["Boot"].keys():
-if prop2 != "BootSourceOverrideEnabled" and prop2 != 
"BootSourceOverrideTarget" and prop2 != "BootNext" and prop2 != "BootOrder":
-return 4, 400, "Invalid Patch Property Sent", ""
-# now patch the valid properties sent
+# patch the valid properties sent
 if "AssetTag" in patch_data:
 print("assetTag:{}".format(patch_data["AssetTag"]))
 self.res_data['AssetTag'] = patch_data['AssetTag']
@@ -100,7 +92,7 @@ class RfSystemObj(RfResource):
 if "BootOrder" in boot_data:
 self.res_data['Boot']['BootOrder'] = boot_data['BootOrder']
 
-resp = flask.Response(json.dumps(self.res_data,indent=4))
+resp = flask.Response(json.dumps(self.res_data,indent=4), 
mimetype="application/json")
 return 0, 200, None, resp
 
 def reset_resource(self, reset_data):
@@ -150,7 +142,7 @@ class RfMemoryCollection(RfCollection):
 post_data["@odata.etag"] = etag_str
 self.elements[str(newMemoryIdx)] = post_data
 
-resp = flask.Response(json.dumps(post_data,indent=4))
+resp = flask.Response(json.dumps(post_data,indent=4), 
mimetype="application/json")
 resp.headers["Location"] = newMemoryUrl
 resp.headers["ETag"] = etag_str
 
@@ -163,7 +155,7 @@ class RfMemoryCollection(RfCollection):
 patch_data["@odata.etag"] = etag_str
 
 self.elements[str(Idx)] = {**self.elements[str(Idx)], **patch_data}
-resp = flask.Response(json.dumps(self.elements[str(Idx)],indent=4))
+resp = flask.Response(json.dumps(self.elements[str(Idx)],indent=4), 
mimetype="application/json")
 return 0, 200, None, resp
 
 def get_memory(self, Idx):
@@ -172,7 +164,7 @@ class RfMemoryCollection(RfCollection):
 def delete_memory(self, Idx):
 print("in delete_memory")
 
-resp = flask.Response(json.dumps(self.elements[Idx],indent=4))
+resp = flask.Response(json.dumps(self.elements[Idx],indent=4), 
mimetype="application/json")
 
 self.elements.pop(Idx)
 self.res_data["Members@odata.count"] = 
self.res_data["Members@odata.count"] - 1
@@ -228,7 +220,7 @@ class RfBiosSettings(RfResource):
 return 4, 400

[edk2-devel] [edk2-redfish-client][PATCH 4/6] Tool/Redfish-Profile-Simulator: Add ETag support

2023-05-08 Thread Nickle Wang via groups.io
Implement ETag support in HTTP header

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
---
 .../v1sim/resource.py | 10 +--
 .../v1sim/systems.py  | 28 +++
 2 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/Tools/Redfish-Profile-Simulator/v1sim/resource.py 
b/Tools/Redfish-Profile-Simulator/v1sim/resource.py
index e722d16a..0c7a8382 100644
--- a/Tools/Redfish-Profile-Simulator/v1sim/resource.py
+++ b/Tools/Redfish-Profile-Simulator/v1sim/resource.py
@@ -36,6 +36,12 @@ class RfResource:
 self.final_init_processing(base_path, rel_path)
 else:
 self.res_data = {}
+self.generate_etag(json.dumps(self.res_data))
+
+def generate_etag(self, context):
+md5 = hashlib.md5()
+md5.update(context.encode('utf-8'))
+self.etag = 'W/"' + md5.hexdigest() + '"'
 
 def create_sub_objects(self, base_path, rel_path):
 pass
@@ -49,8 +55,8 @@ class RfResource:
 # SHA1 should generate well-behaved etags
 response = flask.make_response(self.response)
 response.mimetype = 'application/json'
-etag = hashlib.sha1(self.response.encode('utf-8')).hexdigest()
-response.set_etag(etag)
+response.headers["ETag"] = self.etag
+
 return response
 except KeyError:
 flask.abort(404)
diff --git a/Tools/Redfish-Profile-Simulator/v1sim/systems.py 
b/Tools/Redfish-Profile-Simulator/v1sim/systems.py
index 6305a51e..5adf81be 100644
--- a/Tools/Redfish-Profile-Simulator/v1sim/systems.py
+++ b/Tools/Redfish-Profile-Simulator/v1sim/systems.py
@@ -92,7 +92,11 @@ class RfSystemObj(RfResource):
 if "BootOrder" in boot_data:
 self.res_data['Boot']['BootOrder'] = boot_data['BootOrder']
 
-resp = flask.Response(json.dumps(self.res_data,indent=4), 
mimetype="application/json")
+context = json.dumps(self.res_data,indent=4)
+self.generate_etag(context)
+resp = flask.Response(context, mimetype="application/json")
+resp.headers["ETag"] = self.etag
+
 return 0, 200, None, resp
 
 def reset_resource(self, reset_data):
@@ -136,26 +140,28 @@ class RfMemoryCollection(RfCollection):
 
 post_data["@odata.id"] = newMemoryUrl
 
-md5 = hashlib.md5()
-md5.update(json.dumps(post_data).encode("utf-8"))
-etag_str = 'W/"' + md5.hexdigest() + '"'
-post_data["@odata.etag"] = etag_str
+self.generate_etag(json.dumps(post_data,indent=4))
+
+post_data["@odata.etag"] = self.etag
 self.elements[str(newMemoryIdx)] = post_data
 
 resp = flask.Response(json.dumps(post_data,indent=4), 
mimetype="application/json")
 resp.headers["Location"] = newMemoryUrl
-resp.headers["ETag"] = etag_str
-
+resp.headers["ETag"] = self.etag
 return 0, 200, None, resp
 
 def patch_memory(self, Idx, patch_data):
-md5 = hashlib.md5()
-md5.update(json.dumps(patch_data).encode("utf-8"))
-etag_str = 'W/"' + md5.hexdigest() + '"'
-patch_data["@odata.etag"] = etag_str
 
+
+self.elements[str(Idx)] = {**self.elements[str(Idx)], **patch_data}
+
+context = json.dumps(self.elements[str(Idx)],indent=4)
+self.generate_etag(context)
+patch_data["@odata.etag"] = self.etag
 self.elements[str(Idx)] = {**self.elements[str(Idx)], **patch_data}
+
 resp = flask.Response(json.dumps(self.elements[str(Idx)],indent=4), 
mimetype="application/json")
+resp.headers["ETag"] = self.etag
 return 0, 200, None, resp
 
 def get_memory(self, Idx):
-- 
2.17.1



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




[edk2-devel] [edk2-redfish-client][PATCH 5/6] Tool/Redfish-Profile-Simulator: Add missing module

2023-05-08 Thread Nickle Wang via groups.io
Add missing module import for conditional, RfCollection, RfResource,
RfResourceRaw, hashlib and OrderedDict

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
---
 Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py | 5 -
 Tools/Redfish-Profile-Simulator/v1sim/resource.py| 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py 
b/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py
index 35d3794c..53a44849 100644
--- a/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py
+++ b/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py
@@ -1,7 +1,7 @@
 #
 # Copyright Notice:
 # Copyright (c) 2019, Intel Corporation. All rights reserved.
-# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
+# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 # Copyright Notice:
@@ -16,6 +16,9 @@ from flask import request
 
 from .flask_redfish_auth import RfHTTPBasicOrTokenAuth
 
+from redfishProfileSimulator import conditional
+from v1sim.resource import RfCollection, RfResource, RfResourceRaw
+
 from werkzeug.serving import WSGIRequestHandler
 
 def rfApi_SimpleServer(root, versions, host="127.0.0.1", port=5000, cert="", 
key=""):
diff --git a/Tools/Redfish-Profile-Simulator/v1sim/resource.py 
b/Tools/Redfish-Profile-Simulator/v1sim/resource.py
index 0c7a8382..f6bd15cf 100644
--- a/Tools/Redfish-Profile-Simulator/v1sim/resource.py
+++ b/Tools/Redfish-Profile-Simulator/v1sim/resource.py
@@ -15,6 +15,8 @@ import os
 import sys
 
 import flask
+import hashlib
+from collections import OrderedDict
 
 if sys.version_info >= (3, 5):
 from typing import Type
-- 
2.17.1



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




[edk2-devel] [edk2-redfish-client][PATCH 6/6] Tool/Redfish-Profile-Simulator: Update Bios schema version

2023-05-08 Thread Nickle Wang via groups.io
Update mock-up file and use Bios schema version 1.0.9 in order to
support BIOS configuration driver.

Signed-off-by: Nickle Wang 
Cc: Abner Chang 
Cc: Igor Kulchytskyy 
---
 .../redfish/v1/Systems/2M220100SL/Bios/index.json   | 2 +-
 .../redfish/v1/Systems/2M220101SL/Bios/index.json   | 2 +-
 .../redfish/v1/Systems/2M220102SL/Bios/index.json   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Bios/index.json
 
b/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Bios/index.json
index 540dcd30..bab2381f 100644
--- 
a/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Bios/index.json
+++ 
b/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100SL/Bios/index.json
@@ -1,5 +1,5 @@
 {
-"@odata.type": "#Bios.v1_0_2.Bios",
+"@odata.type": "#Bios.v1_0_9.Bios",
 "Id": "Bios",
 "Name": "BIOS Configuration Current Settings",
 "Description": "BIOS Configuration Current Settings",
diff --git 
a/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Bios/index.json
 
b/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Bios/index.json
index db56911d..13fb0cac 100644
--- 
a/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Bios/index.json
+++ 
b/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101SL/Bios/index.json
@@ -1,5 +1,5 @@
 {
-"@odata.type": "#Bios.v1_0_2.Bios",
+"@odata.type": "#Bios.v1_0_9.Bios",
 "Id": "Bios",
 "Name": "BIOS Configuration Current Settings",
 "Description": "BIOS Configuration Current Settings.",
diff --git 
a/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Bios/index.json
 
b/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Bios/index.json
index b7585844..2d14918a 100644
--- 
a/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Bios/index.json
+++ 
b/Tools/Redfish-Profile-Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102SL/Bios/index.json
@@ -1,5 +1,5 @@
 {
-"@odata.type": "#Bios.v1_0_2.Bios",
+"@odata.type": "#Bios.v1_0_9.Bios",
 "Id": "Bios",
 "Name": "BIOS Configuration Current Settings",
 "Description": "BIOS Configuration Current Settings",
-- 
2.17.1



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




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

2023-05-08 Thread victorx . hsu
From: VictorX Hsu 

-   TraceHub UniversalPayload Spec: 
https://github.com/UniversalScalableFirmware/documentation/pull/52  (Industry 
Standard)
-   MipiSysTLib Wrapper: 
https://github.com/MIPI-Alliance/public-mipi-sys-t.git (Industry Standard)
-   TraceHubDebugLib: Intel(R) Trace Hub (TH) — The Linux Kernel 
documentation (Industry Standard)
Developers Guide: 
https://cdrdv2-public.intel.com/671536/intel-trace-hub-developers-manual-2-1-2.pdf
 (Public Document)

VictorX Hsu (4):
  MdePkg: Add MipiSysTLib library
  MdeModulePkg: Add TraceHubDebugSysTLib library
  MdePkg: Add NULL library of TraceHubDebugSysTLib
  Maintainers.txt: Update reviewers and maintainers for Trace Hub dbg
lib.

 .gitmodules   |  11 +-
 .pytool/CISettings.py |   2 +
 Maintainers.txt   |  18 +
 .../Include/Guid/TraceHubDebugInfoHob.h   |  25 +
 .../BaseTraceHubDebugSysTLib.c| 251 ++
 .../BaseTraceHubDebugSysTLib.inf  |  44 +
 .../DxeSmmTraceHubDebugSysTLib.c  | 247 ++
 .../DxeSmmTraceHubDebugSysTLib.inf|  50 ++
 .../InternalTraceHubApi.c |  82 ++
 .../InternalTraceHubApi.h |  46 +
 .../InternalTraceHubApiCommon.c   | 208 +
 .../InternalTraceHubApiCommon.h   | 119 +++
 .../PeiTraceHubDebugSysTLib.c | 290 +++
 .../PeiTraceHubDebugSysTLib.inf   |  50 ++
 .../Library/TraceHubDebugSysTLib/Readme.md|  30 +
 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|  55 ++
 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, 3211 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.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 MdePkg/Include/Library/TraceHubDebugSysTLib.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
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.inf

--
2.40.0.windows.1



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




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

2023-05-08 Thread Hsu, VictorX
Hi @Kinney, Michael D

All conflicts were fixed

thanks

-Original Message-
From: Kinney, Michael D  
Sent: Monday, May 8, 2023 8:45 AM
To: Guo, Gua ; devel@edk2.groups.io; Hsu, VictorX 

Cc: Chiu, Chasel ; Prakashan, Krishnadas 
Veliyathuparambil ; K N, 
Karthik ; Chan, Laura ; Kinney, 
Michael D 
Subject: RE: [edk2-devel] [PATCH 0/4] Trace Hub debug library support

Gua,

I see this PR says it passes CI but there are merge conflicts.

Can you please update the series to address the conflicts.

Thanks,

Mike

> -Original Message-
> From: Guo, Gua 
> Sent: Thursday, April 20, 2023 7:33 PM
> To: devel@edk2.groups.io; Hsu, VictorX 
> Cc: Chiu, Chasel ; Kinney, Michael D 
> ; Prakashan, Krishnadas Veliyathuparambil 
> ; K N, Karthik 
> ; Chan, Laura 
> Subject: RE: [edk2-devel] [PATCH 0/4] Trace Hub debug library support
> 
> + Related folk
> 
> I want to let the PR for related stakeholder review it.
> 
> And have any open ?
> https://github.com/tianocore/edk2/pull/3901
> 
> 
> Thanks,
> Gua
> 
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of 
> victorx@intel.com
> Sent: Tuesday, April 18, 2023 7:05 PM
> To: devel@edk2.groups.io
> Cc: Hsu, VictorX 
> Subject: [edk2-devel] [PATCH 0/4] Trace Hub debug library support
> 
> From: VictorX Hsu 
> 
> - TraceHub UniversalPayload Spec:
> https://github.com/UniversalScalableFirmware/documentation/pull/52
> (Industry Standard)
> - MipiSysTLib Wrapper: https://github.com/MIPI-Alliance/public-mipi-
> sys-t.git (Industry Standard)
> - TraceHubDebugLib: Intel(R) Trace Hub (TH) — The Linux Kernel
> documentation (Industry Standard)
> Developers Guide: 
> https://cdrdv2-public.intel.com/671536/intel-trace-hub-
> developers-manual-2-1-2.pdf (Public Document)
> 
> VictorX Hsu (4):
>   MdePkg: Add MipiSysTLib library
>   MdeModulePkg: Add TraceHubDebugSysTLib library
>   MdePkg: Add NULL library of TraceHubDebugSysTLib
>   Maintainers.txt: Update reviewers and maintainers for Trace Hub dbg
> lib.
> 
>  .gitmodules   |   5 +-
>  .pytool/CISettings.py |   2 +
>  Maintainers.txt   |  18 +
>  .../Include/Guid/TraceHubDebugInfoHob.h   |  25 +
>  .../BaseTraceHubDebugSysTLib.c| 251 ++
>  .../BaseTraceHubDebugSysTLib.inf  |  44 +
>  .../DxeSmmTraceHubDebugSysTLib.c  | 247 ++
>  .../DxeSmmTraceHubDebugSysTLib.inf|  50 ++
>  .../InternalTraceHubApi.c |  82 ++
>  .../InternalTraceHubApi.h |  46 +
>  .../InternalTraceHubApiCommon.c   | 208 +
>  .../InternalTraceHubApiCommon.h   | 119 +++
>  .../PeiTraceHubDebugSysTLib.c | 290 +++
>  .../PeiTraceHubDebugSysTLib.inf   |  50 ++
>  .../Library/TraceHubDebugSysTLib/Readme.md|  30 +
>  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|  55 ++
>  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 |  15 +-
>  MdePkg/MdePkg.dec |   9 +
>  MdePkg/MdePkg.dsc |   2 +
>  ReadMe.rst|   1 +
>  34 files changed, 3212 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.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
>

[edk2-devel] [PATCH v2 1/2] MdeModulePkg: Add more PciHostBridgeLib gmock support

2023-05-08 Thread victorx . hsu
From: Gua Guo 

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

Add Google Mock Library for PciHostBridgeLib

Cc: Michael D Kinney 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Chris Johnson 
Signed-off-by: Gua Guo 
---
 MdeModulePkg/MdeModulePkg.dec |  1 +
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|  5 +++
 .../GoogleTest/Library/MockPciHostBridgeLib.h | 40 +++
 .../MockPciHostBridgeLib.cpp  | 14 +++
 .../MockPciHostBridgeLib.inf  | 35 
 5 files changed, 95 insertions(+)
 create mode 100644 
MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 3eb4a79bf7..9bb0d3ba2d 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -24,6 +24,7 @@
 
 [Includes]
   Include
+  Test/Mock/Include
 
 [Includes.Common.Private]
   Library/BrotliCustomDecompressLib/brotli/c/include
diff --git a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc 
b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
index a2bbbe8adf..8fb982a270 100644
--- a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
+++ b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
@@ -53,3 +53,8 @@
   UefiSortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   }
+
+  #
+  # Build HOST_APPLICATION Libraries
+  #
+  
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
diff --git 
a/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h 
b/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
new file mode 100644
index 00..a63bed895c
--- /dev/null
+++ b/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
@@ -0,0 +1,40 @@
+/** @file
+  Google Test mocks for PciHostBridgeLib
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MOCK_PCI_HOST_BRIDGE_LIB_H_
+#define MOCK_PCI_HOST_BRIDGE_LIB_H_
+
+#include 
+#include 
+extern "C" {
+#include 
+#include 
+}
+
+struct MockPciHostBridgeLib {
+  MOCK_INTERFACE_DECLARATION (MockPciHostBridgeLib);
+
+  MOCK_FUNCTION_DECLARATION (
+PCI_ROOT_BRIDGE *,
+PciHostBridgeGetRootBridges,
+(UINTN  *Count)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+PciHostBridgeFreeRootBridges,
+(PCI_ROOT_BRIDGE  *Bridges,
+ UINTNCount)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+PciHostBridgeResourceConflict,
+(EFI_HANDLE  HostBridgeHandle,
+ VOID*Configuration)
+);
+};
+
+#endif
diff --git 
a/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
new file mode 100644
index 00..4b15aed169
--- /dev/null
+++ 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
@@ -0,0 +1,14 @@
+/** @file
+  Mock instance of the PCI Host Bridge Library.
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+
+MOCK_INTERFACE_DEFINITION(MockPciHostBridgeLib);
+
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeGetRootBridges, 1, 
EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeFreeRootBridges, 
2, EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeResourceConflict, 
2, EFIAPI);
diff --git 
a/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
new file mode 100644
index 00..ad4edec73e
--- /dev/null
+++ 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
@@ -0,0 +1,35 @@
+## @file
+#  Mock instance of the PCI Host Bridge Library.
+#
+# Copyright (c) 2023, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = MockPciHostBridgeLib
+  FILE_GUID  = B51721FE-0BBA-4611-B9A5-ED13C49AC060
+  MODULE_TYPE= HOST_APPLICATION
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = PciHostBridgeLib
+
+#
+# The following information is for reference only and not required by the build
+# tools.
+#
+#  VALID_ARCHITECTURES   = IA32 X64 EBC
+#
+
+[Sources]
+  MockPciHostBridgeLib.cpp
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
+
+[Library

Re: [edk2-devel] [PATCH V3 5/5] RedfishPkg: Fix compile issue on Linux

2023-05-08 Thread Minh Nguyen

Hi Pedro,

Firstly, thanks for your comments, let me explain.

- "C99 flexible array members have been well defined and well supported
for maybe 20 years in GCC (https://godbolt.org/z/9qxKar4f6)" => *Yes, I 
agree and there's no**
**comment from my side* *but this is completely different with current 
issue, why? Please see the bellow**

**explanation.*
- When we define the PCD to map with any structure in .dec file, 
BaseTools will gen /*PcdValueInit.c*/.
In this file, there're a lot of using 
"/*__FIELD_SIZE(REST_EX_SERVICE_DEVICE_PATH_DATA, DevicePath);*/"
and this is the definiton of this macro "/*#define __FIELD_SIZE(TYPE, 
Field) (sizeof((TYPE *)0)->Field)*/".
When using 
"/*__STATIC_ASSERT((__FIELD_SIZE(REST_EX_SERVICE_DEVICE_PATH_DATA, 
DevicePath) >= 3) || *//*
*//*(__FIELD_SIZE(REST_EX_SERVICE_DEVICE_PATH_DATA, DevicePath) == 0), 
"Input buffer exceeds the buffer array");*/",
"/*(sizeof((TYPE *)0)->Field*/" will be an error (_*error: invalid 
application of ‘sizeof’ to incomplete type *__*
*__*EFI_DEVICE_PATH_PROTOCOL[]*_) => will cause error on 
"__STATIC_ASSERT" because _Static_assert requires its first parameter
to be a constant expression => the error message when compile this code 
is "_*Line 257 Value {0x03,0x0b,0x25,0x00,0x00,0x1b,*__*

*__*0x21,0xdc,0x35,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,*__*
*__*0x00,0x00,0x00,0x00,0x00,0x01,0x7f,0xff,0x04,0x00}:293:19: error: 
expression in static assertion is not an integer*_"


- An other demonstation on other platforms in this behavior: you can 
check at 
*edk2-platforms/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec*.
/*gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation|{0x0}|SMBIOS_TABLE_TYPE0|0xD001 
{*//*

*//*    *//*
*//*  IndustryStandard/SmBios.h*//*
*//*    *//*
*//*  MdePkg/MdePkg.dec*//*
*//*SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec*//*
*//*  }*/
/*gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[0]|0x33*//*
*//*gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[1]|0x0F*/
This is the declaration to map PcdSmbiosType0BiosInformation with 
SMBIOS_TABLE_TYPE0 structure and
the declaration of BIOSCharacteristicsExtensionBytes is "*UINT8 
BIOSCharacteristicsExtensionBytes[2];*". If
we remove the number of elements (2) to flexible array, we will see the 
same error like "_*Index of BIOSCharacteristicsExtensionBytes[0]:361:19: 
*__*

*__*error: expression in static assertion is not an integer*_".

=> Conclusion: This is not problem on compiler, it just comes from the 
way BasTools gen PcdValueInit.c
and define macros for this case (map PCD structure to any structure). I 
hope it satisfy your concerns.



Thanks,

Minh Nguyen.

On 5/6/2023 5:57 AM, Pedro Falcato wrote:

On Fri, May 5, 2023 at 6:12 PM Minh Nguyen via groups.io
  wrote:

From: Vu Nguyen

It requires a fixed size array to store the content of device path PCD.
Add the array size to solve this issue.

Signed-off-by: Minh Nguyen
Cc: Abner Chang
Cc: Igor Kulchytskyy
Cc: Nick Ramirez
Reviewed-by: Abner Chang
---
  RedfishPkg/Include/Pcd/RestExServiceDevicePath.h | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h 
b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h
index 91b1198297c2..57fc199f61f2 100644
--- a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h
+++ b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h
@@ -4,6 +4,7 @@

Copyright (c) 2019, Intel Corporation. All rights reserved.
(C) Copyright 2020 Hewlett Packard Enterprise Development LP
+  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.

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

@@ -14,6 +15,8 @@

  #include 

+#define MAX_DEVICE_PATH_NODE  40
+
  typedef enum {
DEVICE_PATH_MATCH_MAC_NODE = 1,
DEVICE_PATH_MATCH_PCI_NODE = 2,
@@ -32,7 +35,7 @@ typedef struct {
//
0x03,0x0b,0x25,0x00,0x00,0x50,0x56,0xc0,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
//0x7f,0xff,0x04,0x00}
//
-  EFI_DEVICE_PATH_PROTOCOLDevicePath[];
+  EFI_DEVICE_PATH_PROTOCOL  DevicePath[MAX_DEVICE_PATH_NODE];
  } REST_EX_SERVICE_DEVICE_PATH_DATA;

This doesn't work (changes the meaning) and may possibly break ABI.

What error do you get? What compiler?

C99 flexible array members have been well defined and well supported
for maybe 20 years in GCC (https://godbolt.org/z/9qxKar4f6)




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

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

2023-05-08 Thread victorx . hsu
From: VictorX Hsu 

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: VictorX Hsu 
---
 .../TraceHubDebugSysTLibNull.c| 76 +++
 .../TraceHubDebugSysTLibNull.inf  | 29 +++
 MdePkg/MdePkg.dsc |  1 +
 3 files changed, 106 insertions(+)
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.c
 create mode 100644 
MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.inf

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 TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT64   Id,
+  IN GUID *Guid
+  )
+{
+  return RETURN_UNSUPPORTED;
+}
+
+/**
+  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,
+  ...
+  )
+{
+  return RETURN_UNSUPPORTED;
+}
diff --git 
a/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.inf 
b/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.inf
new file mode 100644
index 00..ba894fc250
--- /dev/null
+++ b/MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.inf
@@ -0,0 +1,29 @@
+## @file
+#  Null library of TraceHubDebugSysTLib.
+#
+#  Copyright (c) 2023, Intel Corporation. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = TraceHubDebugSysTLibNull
+  FILE_GUID  = 16196A4E-4196-4AF4-9A6B-F4D2ACC430A8
+  MODULE_TYPE= BASE
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = TraceHubDebugSysTLib
+
+#
+# The following information is for reference only and not required by the 
build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64
+#
+
+[Packages]
+  MdePkg/MdePkg.dec
+
+[Sources]
+  TraceHubDebugSysTLibNull.c
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index 902a39cffc..536df8e0dc 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -184,6 +184,7 @@
   MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf
   MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf
   MdePkg/Library/TdxLib/TdxLib.inf
+  MdePkg/Library/TraceHubDebugSysTLibNull/TraceHubDebugSysTLibNull.inf
   MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
 
 [Components.EBC]
-- 
2.40.0.windows.1



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




[edk2-devel] [PATCH v2 0/2] Add more google mock library

2023-05-08 Thread victorx . hsu
From: Gua Guo 

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

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

V2:
Fixed Azure build failure

V1:
Add google mock support for HobLib
Add google mock support for PciHostBridgeLib
Add google mock support for PeiServicesLib


Gua Guo (2):
  MdeModulePkg: Add more PciHostBridgeLib gmock support
  MdePkg: Add more HobLib/PeiServicesLib gmock support

 MdeModulePkg/MdeModulePkg.dec |   1 +
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|   5 +
 .../GoogleTest/Library/MockPciHostBridgeLib.h |  40 
 .../MockPciHostBridgeLib.cpp  |  14 ++
 .../MockPciHostBridgeLib.inf  |  35 
 MdePkg/Test/MdePkgHostTest.dsc|   2 +
 .../Include/GoogleTest/Library/MockHobLib.h   | 150 ++
 .../GoogleTest/Library/MockPeiServicesLib.h   | 189 ++
 .../GoogleTest/MockHobLib/MockHobLib.cpp  |  30 +++
 .../GoogleTest/MockHobLib/MockHobLib.inf  |  33 +++
 .../MockPeiServicesLib/MockPeiServicesLib.cpp |  36 
 .../MockPeiServicesLib/MockPeiServicesLib.inf |  33 +++
 12 files changed, 568 insertions(+)
 create mode 100644 
MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
 create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
 create mode 100644 
MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib.h
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf

--
2.39.2.windows.1



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




[edk2-devel] [PATCH 4/4] Maintainers.txt: Update reviewers and maintainers for Trace Hub dbg lib.

2023-05-08 Thread victorx . hsu
From: VictorX Hsu 

Update reviewers and maintainers for TraceHubDebugSysTlib.

Signed-off-by: VictorX Hsu 
---
 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.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104277): https://edk2.groups.io/g/devel/message/104277
Mute This Topic: https://groups.io/mt/98764725/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 5/5] RedfishPkg: Fix compile issue on Linux

2023-05-08 Thread Minh Nguyen

Hi Pedro,
 I just re-sent in readable format.

Thanks,
Minh Nguyen

On 5/7/2023 12:39 PM, Minh Nguyen wrote:

Hi Pedro,
  Firstly, thanks for your comments, let me explain.
- "C99 flexible array members have been well defined and well
  supported for maybe 20 years in GCC (https://godbolt.org/z/9qxKar4f6)"
  =>*Yes, I agree and there's nocomment from my side*  *but this is completely different with current issue, why? Please see 
the bellowexplanation.*

- When we define the PCD to map with any structure in .dec file, BaseTools 
will gen/*PcdValueInit.c*/.
  In this file, there're a lot of using 
"/*__FIELD_SIZE(REST_EX_SERVICE_DEVICE_PATH_DATA, DevicePath);*/"
  and this is the definiton of this macro "/*#define __FIELD_SIZE(TYPE, Field) 
(sizeof((TYPE *)0)->Field)*/".
  When using "/*__STATIC_ASSERT((__FIELD_SIZE(REST_EX_SERVICE_DEVICE_PATH_DATA, 
DevicePath) >= 3) || *//**//*(__FIELD_SIZE(REST_EX_SERVICE_DEVICE_PATH_DATA, DevicePath) == 0), 
"Input buffer exceeds the buffer array");*/",

   "/*(sizeof((TYPE *)0)->Field*/" will be an error (*error: invalid 
application of ‘sizeof’ to incomplete type **EFI_DEVICE_PATH_PROTOCOL[]*)
  => cause error on "__STATIC_ASSERT" because _Static_assert requires its 
first parameter to be a constant expression => the error message when compile
  this code is "*Line 257 Value {0x03,0x0b,0x25,0x00,0x00,0x1b,0x21,0xdc,0x35,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x7f,0xff,0x04,0x00}:293:19: error: 
expression in static assertion is not an integer*".


    - An other demonstation on other platforms in this behavior: You can check 
at*edk2-platforms/Features/Intel/SystemInformation/SmbiosFeaturePkg/SmbiosFeaturePkg.dec*
  and I try it in my platform.

  
gAmpereTokenSpaceGuid.PcdSmbiosType0BiosInformation|{0x0}|SMBIOS_TABLE_TYPE0|0xB00C{

    
IndustryStandard/SmBios.h
    
      MdePkg/MdePkg.dec
      Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
  }
  gAmpereTokenSpaceGuid.PcdSmbiosType0BiosInformation.Vendor|0x1
  
gAmpereTokenSpaceGuid.PcdSmbiosType0BiosInformation.BIOSCharacteristicsExtensionBytes[0]|0x33 



 This is the declaration to map PcdSmbiosType0BiosInformation with 
SMBIOS_TABLE_TYPE0 structure and
 the declaration BIOSCharacteristicsExtensionBytes is "*UINT8 
BIOSCharacteristicsExtensionBytes[2];*".
 If we remove the number of elements (2) to flexible array, we will see the 
same error like
 "*Index of BIOSCharacteristicsExtensionBytes[0]:361:19: error: expression 
in static assertion is not an integer."*
 
 => CONCLUSION: This is not problem of compiler, it just comes from the way BaseTools gen

/*PcdValueInit.c*/  and definition of macros. I hope above explanation satisfy 
your concern.

Thanks,
Minh Nguyen


On 5/6/2023 5:57 AM, Pedro Falcato wrote:

On Fri, May 5, 2023 at 6:12 PM Minh Nguyen via groups.io
  wrote:

From: Vu Nguyen

It requires a fixed size array to store the content of device path PCD.
Add the array size to solve this issue.

Signed-off-by: Minh Nguyen
Cc: Abner Chang
Cc: Igor Kulchytskyy
Cc: Nick Ramirez
Reviewed-by: Abner Chang
---
  RedfishPkg/Include/Pcd/RestExServiceDevicePath.h | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h 
b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h
index 91b1198297c2..57fc199f61f2 100644
--- a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h
+++ b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h
@@ -4,6 +4,7 @@

Copyright (c) 2019, Intel Corporation. All rights reserved.
(C) Copyright 2020 Hewlett Packard Enterprise Development LP
+  Copyright (c) 2023, Ampere Computing LLC. All rights reserved.

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

@@ -14,6 +15,8 @@

  #include 

+#define MAX_DEVICE_PATH_NODE  40
+
  typedef enum {
DEVICE_PATH_MATCH_MAC_NODE = 1,
DEVICE_PATH_MATCH_PCI_NODE = 2,
@@ -32,7 +35,7 @@ typedef struct {
//
0x03,0x0b,0x25,0x00,0x00,0x50,0x56,0xc0,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
//0x7f,0xff,0x04,0x00}
//
-  EFI_DEVICE_PATH_PROTOCOLDevicePath[];
+  EFI_DEVICE_PATH_PROTOCOL  DevicePath[MAX_DEVICE_PATH_NODE];
  } REST_EX_SERVICE_DEVICE_PATH_DATA;

This doesn't work (changes the meaning) and may possibly break ABI.

What error do you get? What compiler?

C99 flexible array members have been well defined and well supported
for maybe 20 years in GCC (https://godbolt.org/z/9qxKar4f6)




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

[edk2-devel] [PATCH v2 2/2] MdePkg: Add more HobLib/PeiServicesLib gmock support

2023-05-08 Thread victorx . hsu
From: Gua Guo 

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

Add Google Mock Library for HobLib
Add Google Mock Library for PeiServicesLib

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Chris Johnson 
Signed-off-by: Gua Guo 
---
 MdePkg/Test/MdePkgHostTest.dsc|   2 +
 .../Include/GoogleTest/Library/MockHobLib.h   | 150 ++
 .../GoogleTest/Library/MockPeiServicesLib.h   | 189 ++
 .../GoogleTest/MockHobLib/MockHobLib.cpp  |  30 +++
 .../GoogleTest/MockHobLib/MockHobLib.inf  |  33 +++
 .../MockPeiServicesLib/MockPeiServicesLib.cpp |  36 
 .../MockPeiServicesLib/MockPeiServicesLib.inf |  33 +++
 7 files changed, 473 insertions(+)
 create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
 create mode 100644 
MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib.h
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf

diff --git a/MdePkg/Test/MdePkgHostTest.dsc b/MdePkg/Test/MdePkgHostTest.dsc
index 35e3ef6d97..529ea69024 100644
--- a/MdePkg/Test/MdePkgHostTest.dsc
+++ b/MdePkg/Test/MdePkgHostTest.dsc
@@ -36,3 +36,5 @@
   MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
   MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.inf
   
MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf
+  MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf
+  MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h 
b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
new file mode 100644
index 00..994b8133e5
--- /dev/null
+++ b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
@@ -0,0 +1,150 @@
+/** @file
+  Google Test mocks for HobLib
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MOCK_HOB_LIB_H_
+#define MOCK_HOB_LIB_H_
+
+#include 
+#include 
+extern "C" {
+#include 
+#include 
+#include 
+}
+
+struct MockHobLib {
+  MOCK_INTERFACE_DECLARATION (MockHobLib);
+
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetHobList,
+()
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetNextHob,
+(IN UINT16  Type,
+ IN CONST VOID  *HobStart)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetFirstHob,
+(IN UINT16  Type)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetNextGuidHob,
+(IN CONST EFI_GUID  *Guid,
+ IN CONST VOID  *HobStart)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetFirstGuidHob,
+(IN CONST EFI_GUID  *Guid)
+);
+  MOCK_FUNCTION_DECLARATION (
+EFI_BOOT_MODE,
+GetBootModeHob,
+()
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildModuleHob,
+(IN CONST EFI_GUID*ModuleName,
+ IN EFI_PHYSICAL_ADDRESS  MemoryAllocationModule,
+ IN UINT64ModuleLength,
+ IN EFI_PHYSICAL_ADDRESS  EntryPoint)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildResourceDescriptorWithOwnerHob,
+(IN EFI_RESOURCE_TYPEResourceType,
+ IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+ IN EFI_PHYSICAL_ADDRESS PhysicalStart,
+ IN UINT64   NumberOfBytes,
+ IN EFI_GUID *OwnerGUID)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildResourceDescriptorHob,
+(IN EFI_RESOURCE_TYPEResourceType,
+ IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+ IN EFI_PHYSICAL_ADDRESS PhysicalStart,
+ IN UINT64   NumberOfBytes)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+BuildGuidHob,
+(IN CONST EFI_GUID  *Guid,
+ IN UINTN   DataLength)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+BuildGuidDataHob,
+(IN CONST EFI_GUID  *Guid,
+ IN VOID*Data,
+ IN UINTN   DataLength)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFvHob,
+(IN EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN UINT64Length)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFv2Hob,
+(IN  EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN  UINT64Length,
+ IN CONSTEFI_GUID  *FvName,
+ IN CONSTEFI_GUID  *FileName)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFv3Hob,
+(IN  EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN  UINT64Length,
+ IN  UINT32AuthenticationStatus,
+ IN  BOOLEAN   

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

2023-05-08 Thread victorx . hsu
From: VictorX Hsu 

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 |  55 ++
 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  |   5 +
 MdePkg/MdePkg.dsc  |   1 +
 ReadMe.rst |   1 +
 15 files changed, 1518 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
+[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 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,
+  IN   

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

2023-05-08 Thread victorx . hsu
From: VictorX Hsu 

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: VictorX Hsu 
---
 .../Include/Guid/TraceHubDebugInfoHob.h   |  25 ++
 .../BaseTraceHubDebugSysTLib.c| 251 +++
 .../BaseTraceHubDebugSysTLib.inf  |  44 +++
 .../DxeSmmTraceHubDebugSysTLib.c  | 247 +++
 .../DxeSmmTraceHubDebugSysTLib.inf|  50 +++
 .../InternalTraceHubApi.c |  82 +
 .../InternalTraceHubApi.h |  46 +++
 .../InternalTraceHubApiCommon.c   | 208 +
 .../InternalTraceHubApiCommon.h   | 119 +++
 .../PeiTraceHubDebugSysTLib.c | 290 ++
 .../PeiTraceHubDebugSysTLib.inf   |  50 +++
 .../Library/TraceHubDebugSysTLib/Readme.md|  30 ++
 MdeModulePkg/MdeModulePkg.dec |  21 ++
 MdeModulePkg/MdeModulePkg.dsc |   3 +
 MdeModulePkg/MdeModulePkg.uni |  18 ++
 MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 +
 MdePkg/MdePkg.dec |   4 +
 17 files changed, 1569 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
 create mode 100644 MdePkg/Include/Library/TraceHubDebugSysTLib.h

diff --git a/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h 
b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
new file mode 100644
index 00..3a8fcc3d21
--- /dev/null
+++ b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
@@ -0,0 +1,25 @@
+/** @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
+#define MAX_TRACE_HUB_DEBUG_INSTANCE  5
+
+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..fbf1cc2a9e
--- /dev/null
+++ b/MdeModulePkg/Library/TraceHubDebugSysTLib/BaseTraceHubDebugSysTLib.c
@@ -0,0 +1,251 @@
+/** @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;
+  UINT16

Re: [edk2-devel] [PATCH v1] BaseTools/Plugin: Too many execute file will be failure

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

Can you add summary of change made to the commit message?

I think it is changes passing many coverage files in single command line to 
breaking it up into many command lines with one coverage file per command line. 
 Right?

Mike

> -Original Message-
> From: Guo, Gua 
> Sent: Monday, May 8, 2023 3:49 AM
> To: devel@edk2.groups.io
> Cc: Guo, Gua ; Kinney, Michael D
> ; Sean Brogan ;
> Michael Kubacki 
> Subject: [PATCH v1] BaseTools/Plugin: Too many execute file will be failure
> 
> From: Gua Guo 
> 
> Windows command prompt have 8191 character limitation,
> enhance it to make command too long can be resloved.
> 
> Change-Id: I7f1d8d46274f1c0104572d47253d499900effe76
> Cc: Michael D Kinney 
> Cc: Sean Brogan 
> Cc: Michael Kubacki 
> Signed-off-by: Gua Guo 
> ---
>  .../HostBasedUnitTestRunner.py| 31 ---
>  1 file changed, 27 insertions(+), 4 deletions(-)
> 
> diff --git
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> index d993de9412..05bb6da50a 100644
> ---
> a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> +++
> b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
> @@ -209,13 +209,25 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
>  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"
> 
> +if (os.path.isfile(f"{os.path.join(buildOutputBase, 
> 'coverage.cov')}")):
> 
> +coverageFile += f" 
> --input_coverage={os.path.join(buildOutputBase,
> 'coverage.cov')}"
> 
> +ret = RunCmd("OpenCppCoverage", f"--export_type
> binary:{os.path.join(buildOutputBase, 'coverage.cov')} --
> working_dir={workspace}Build {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={workspace}Build " +
> 
> +f"--input_coverage={os.path.join(buildOutputBase, 
> 'coverage.cov')}"
> 
> +)
> 
>  if ret != 0:
> 
>  logging.error("UnitTest Coverage: Failed to generate cobertura 
> format
> xml in single package.")
> 
>  return 1
> 
> @@ -224,9 +236,20 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
>  testCoverageList = glob.glob(os.path.join(workspace, "Build",
> "**","*Test*.exe.cov"), recursive=True)
> 
>  coverageFile = ""
> 
>  for testCoverage in testCoverageList:
> 
> -coverageFile += " --input_coverage=" + testCoverage
> 
> +coverageFile  = f" --input_coverage={testCoverage}"
> 
> +if (os.path.isfile(f"{workspace}Build/coverage.cov")):
> 
> +coverageFile += f" --
> input_coverage={workspace}Build/coverage.cov"
> 
> +ret = RunCmd("OpenCppCoverage", f"--export_type
> binary:{workspace}Build/coverage.cov --working_dir={workspace}Build
> {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 cobertura:{workspace}Build/coverage.xml " +
> 
> +f"--working_dir={workspace}Build " +
> 
> +f"--input_coverage={workspace}Build/coverage.cov"
> 
> +)
> 
>  if ret != 0:
> 
>  logging.error("UnitTest Coverage: Failed to generate cobertura 
> format
> xml.")
> 
>  return 1
> 
> --
> 2.39.2.windows.1



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

Re: [edk2-devel] [PATCH v2 0/6] RISC-V MMU support

2023-05-08 Thread Andrei Warkentin
Apologies for the late review. I added my comments on GH. Aside from a request 
for more context for 
https://github.com/tianocore/edk2/commit/b7387dae40cc3a72562c6461d007d20087ab7414#comments,
 I think this patch set from a functionality standpoint looks good enough to be 
submitted.

Reviewed-by: Andrei Warkentin 

From: devel@edk2.groups.io  On Behalf Of Tuan Phan
Sent: Wednesday, April 19, 2023 5:37 PM
To: devel@edk2.groups.io; Warkentin, Andrei 
Cc: Kinney, Michael D ; Gao, Liming 
; Liu, Zhiguang ; 
suni...@ventanamicro.com; g...@danielschaefer.me
Subject: Re: [edk2-devel] [PATCH v2 0/6] RISC-V MMU support

Hi Andrei,
Here you go: https://github.com/pttuan/edk2/tree/tphan/riscv_mmu
Will put the link in the cover letter next round.

From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> on behalf of Andrei 
Warkentin mailto:andrei.warken...@intel.com>>
Date: Tuesday, April 18, 2023 at 9:04 AM
To: Tuan Phan mailto:tp...@ventanamicro.com>>, 
devel@edk2.groups.io 
mailto:devel@edk2.groups.io>>
Cc: Kinney, Michael D 
mailto:michael.d.kin...@intel.com>>, Gao, Liming 
mailto:gaolim...@byosoft.com.cn>>, Liu, Zhiguang 
mailto:zhiguang@intel.com>>, 
suni...@ventanamicro.com 
mailto:suni...@ventanamicro.com>>, 
g...@danielschaefer.me 
mailto:g...@danielschaefer.me>>
Subject: Re: [edk2-devel] [PATCH v2 0/6] RISC-V MMU support
Hi Tuan,

Do you mind sharing the GitHub branch as well? It would help with the review 
immensely.

A

> -Original Message-
> From: Tuan Phan mailto:tp...@ventanamicro.com>>
> Sent: Friday, April 14, 2023 1:58 PM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D 
> mailto:michael.d.kin...@intel.com>>; Gao, Liming
> mailto:gaolim...@byosoft.com.cn>>; Liu, Zhiguang 
> mailto:zhiguang@intel.com>>;
> suni...@ventanamicro.com; 
> g...@danielschaefer.me; Warkentin, Andrei
> mailto:andrei.warken...@intel.com>>; Tuan Phan 
> mailto:tp...@ventanamicro.com>>
> Subject: [PATCH v2 0/6] RISC-V MMU support
>
> RISC-V: Add MMU support
>
> This series adds MMU support for RISC-V. Only SV39/48/57 modes are
> supported and tested. The MMU is required to support setting page
> attribute which is the first basic step to support security booting on RISC-V.
>
> There are three parts:
> 1. Add MMU base library. MMU will be enabled during CpuDxe initialization.
> 2. Fix OvmfPkg/VirtNorFlashDxe that failed to add flash base address to GCD
> if already done.
> 3. Fix all resources should be populated in HOB or added to GCD by driver
> before accessing when MMU enabled.
>
> Changes in v2:
>   - Move MMU core to a library.
>   - Setup SATP mode as highest possible that HW supports.
>
> Tuan Phan (6):
>   MdePkg/BaseLib: RISC-V: Support getting satp register value
>   MdePkg/Register: RISC-V: Add satp mode bits shift definition
>   UefiCpuPkg: RISC-V: Support MMU with SV39/48/57 mode
>   OvmfPkg/RiscVVirt: VirtNorFlashPlatformLib: Fix wrong flash size
>   OvmfPkg/VirtNorFlashDxe: Not add memory space if it exists
>   OvmfPkg/RiscVVirt: SEC: Add IO memory resource hob for platform
> devices
>
>  MdePkg/Include/Library/BaseLib.h  |   5 +
>  MdePkg/Include/Library/BaseRiscVMmuLib.h  |  39 ++
>  .../Include/Register/RiscV64/RiscVEncoding.h  |   7 +-
>  MdePkg/Library/BaseLib/RiscV64/RiscVMmu.S |   8 +
>  .../Library/BaseRiscVMmuLib/BaseRiscVMmuLib.c | 569
> ++
>  .../BaseRiscVMmuLib/BaseRiscVMmuLib.inf   |  25 +
>  MdePkg/Library/BaseRiscVMmuLib/RiscVMmuCore.S |  31 +
>  .../VirtNorFlashStaticLib.c   |   3 +-
>  OvmfPkg/RiscVVirt/RiscVVirt.dsc.inc   |   1 +
>  OvmfPkg/RiscVVirt/Sec/Memory.c|  18 +-
>  OvmfPkg/RiscVVirt/Sec/Platform.c  |  62 ++
>  OvmfPkg/RiscVVirt/Sec/SecMain.inf |   1 +
>  OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c |  25 +-
>  UefiCpuPkg/CpuDxeRiscV64/CpuDxe.c |   9 +-
>  UefiCpuPkg/CpuDxeRiscV64/CpuDxe.h |   2 +
>  UefiCpuPkg/CpuDxeRiscV64/CpuDxeRiscV64.inf|   2 +
>  16 files changed, 776 insertions(+), 31 deletions(-)  create mode 100644
> MdePkg/Include/Library/BaseRiscVMmuLib.h
>  create mode 100644
> MdePkg/Library/BaseRiscVMmuLib/BaseRiscVMmuLib.c
>  create mode 100644
> MdePkg/Library/BaseRiscVMmuLib/BaseRiscVMmuLib.inf
>  create mode 100644 MdePkg/Library/BaseRiscVMmuLib/RiscVMmuCore.S
>
> --
> 2.25.1







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




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

2023-05-08 Thread Michael D Kinney
Hi Victor,

Comment on SwapBytesGuid() API below.  I believe there is a significant logic 
issues and an opportunity to simplify.  Please let me know if you found a 
different algorithm to perform GUID LE <-> BE conversions.

A second comment on the limit on max instances being 5.  Why is 5 selected?  
The HOB list can support any number of instances and the consumers that need to 
cache the HOB state can do dynamical allocation using AllocatePool() to 
allocate space for the number of HOBs detected.

Mike

> -Original Message-
> From: Hsu, VictorX 
> Sent: Sunday, May 7, 2023 10:32 PM
> To: devel@edk2.groups.io
> Cc: Hsu, VictorX ; Kinney, Michael D
> ; Guo, Gua ; Chan, Laura
> ; Prakashan, Krishnadas Veliyathuparambil
> ; K N, Karthik
> 
> Subject: [PATCH 2/4] MdeModulePkg: Add TraceHubDebugSysTLib library
> 
> From: VictorX Hsu 
> 
> 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: VictorX Hsu 
> ---
>  .../Include/Guid/TraceHubDebugInfoHob.h   |  25 ++
>  .../BaseTraceHubDebugSysTLib.c| 251 +++
>  .../BaseTraceHubDebugSysTLib.inf  |  44 +++
>  .../DxeSmmTraceHubDebugSysTLib.c  | 247 +++
>  .../DxeSmmTraceHubDebugSysTLib.inf|  50 +++
>  .../InternalTraceHubApi.c |  82 +
>  .../InternalTraceHubApi.h |  46 +++
>  .../InternalTraceHubApiCommon.c   | 208 +
>  .../InternalTraceHubApiCommon.h   | 119 +++
>  .../PeiTraceHubDebugSysTLib.c | 290 ++
>  .../PeiTraceHubDebugSysTLib.inf   |  50 +++
>  .../Library/TraceHubDebugSysTLib/Readme.md|  30 ++
>  MdeModulePkg/MdeModulePkg.dec |  21 ++
>  MdeModulePkg/MdeModulePkg.dsc |   3 +
>  MdeModulePkg/MdeModulePkg.uni |  18 ++
>  MdePkg/Include/Library/TraceHubDebugSysTLib.h |  81 +
>  MdePkg/MdePkg.dec |   4 +
>  17 files changed, 1569 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
>  create mode 100644 MdePkg/Include/Library/TraceHubDebugSysTLib.h
> 
> diff --git a/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
> b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
> new file mode 100644
> index 00..3a8fcc3d21
> --- /dev/null
> +++ b/MdeModulePkg/Include/Guid/TraceHubDebugInfoHob.h
> @@ -0,0 +1,25 @@
> +/** @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
> 
> +#define MAX_TRACE_HUB_DEBUG_INSTANCE  5

Why is this hard coded to 5 instances?  Can't all consumers use the number of 
instances of this GUIDed HOB that are present in the HOB list?

> 
> +
> 
> +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..fbf1cc2a9e
> -

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

2023-05-08 Thread Michael D Kinney
Update to INF to simplify [BuildOptions] section below.

Mike

> -Original Message-
> From: Hsu, VictorX 
> Sent: Sunday, May 7, 2023 10:32 PM
> To: devel@edk2.groups.io
> Cc: Hsu, VictorX ; Kinney, Michael D
> ; Guo, Gua ; Chan, Laura
> ; Prakashan, Krishnadas Veliyathuparambil
> ; K N, Karthik
> 
> Subject: [PATCH 1/4] MdePkg: Add MipiSysTLib library
> 
> From: VictorX Hsu 
> 
> 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 |  55 ++
>  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  |   5 +
>  MdePkg/MdePkg.dsc  |   1 +
>  ReadMe.rst |   1 +
>  15 files changed, 1518 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
> +[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
> 
> +  );
> 
> +
> 
> +/**
> 

Re: [edk2-devel] [edk2-platforms:PATCH V1] MinPlatformPkg/SaveMemoryConfig: Support NVS Data compression.

2023-05-08 Thread Isaac Oram
The proposed implementation is fine and I will reviewed-by and push if that is 
the desired direction.

My question is if we generally like the design of doing compression in common 
MinPlatform code, decompression in board specific FSP wrapper code.  The 
alternative design is to do compression and decompression inside the FSP.  This 
seems like a slightly simpler separation of responsibilities.
The board code is responsible for save/restore, the FSP code is responsible for 
data blob creation and use.  Data integrity, authentication, compression, etc 
all can be done based on more detailed knowledge of the silicon implementation 
requirements.

I can see another argument though that doing it inside FSP effectively forces 
both bootloader and FSP to carry compression/decompression.  The 
compression/decompression aren't likely to need to be silicon specific.  And 
bootloader may have more requirements to balance than just the silicon 
requirements.

Can I get some votes on preferred answer for compressing/decompressing FSP 
non-volatile data in bootloader or FSP?

Thanks,
Isaac

-Original Message-
From: Gudla, Raghava  
Sent: Friday, May 5, 2023 5:03 PM
To: devel@edk2.groups.io
Cc: Gudla, Raghava ; Chiu, Chasel 
; Desimone, Nathaniel L 
; Oram, Isaac W 
Subject: [edk2-platforms:PATCH V1] MinPlatformPkg/SaveMemoryConfig: Support NVS 
Data compression.

Around 50KB "FspNonVolatileStorageHob" data can be compressed to approximately 
3 KB which can save NVRAM space and enhance life of the SPI part by decreasing 
the number of reclaim cycles needed.

This patch added support to compress "FspNonVolatileStorageHob" data before 
saving to NVRAM.

A PcdEnableCompressFspNvsHob is introduced to enable/disable this feature per 
platform usage.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Isaac Oram 

Signed-off-by: Raghava Gudla 
---
 .../SaveMemoryConfig/SaveMemoryConfig.c   | 34 +++
 .../SaveMemoryConfig/SaveMemoryConfig.inf |  6 +++-
 .../Include/Dsc/CoreCommonLib.dsc |  1 +
 .../Intel/MinPlatformPkg/MinPlatformPkg.dec   |  5 +++
 4 files changed, 45 insertions(+), 1 deletion(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c 
b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c
index 0215e8eed..8aa935b54 100644
--- 
a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.c
+++ b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemo
+++ ryConfig.c
@@ -21,6 +21,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include  #include 
 #include 
+#include +#include 
  /**   This is the standard EFI driver point that 
detects whether there is a@@ -45,6 +47,9 @@ SaveMemoryConfigEntryPoint (
   UINTN DataSize;   UINTN BufferSize;   BOOLEAN
   DataIsIdentical;+  VOID  *CompressedData;+  UINT64
CompressedSize;+  UINTN CompressedAllocationPages;DataSize  
  = 0;   BufferSize  = 0;@@ -73,6 +78,35 @@ SaveMemoryConfigEntryPoint (
 }   } +  if (PcdGetBool (PcdEnableCompressFspNvsHob) == 1) {+
CompressedData= NULL;+CompressedSize= 0;+
CompressedAllocationPages = 0;++DEBUG ((DEBUG_INFO, "compressing mem config 
nvs variable\n"));+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", 
__func__));+ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);+return 
EFI_OUT_OF_RESOURCES;+  }++  CompressedSize = EFI_PAGES_TO_SIZE 
(CompressedAllocationPages);+  Status = Compress (HobData, DataSize, 
CompressedData, &CompressedSize);+  if (EFI_ERROR (Status)) {+DEBUG 
((DEBUG_ERROR, "[%a] - failed to compress data. Status = %r\n", __func__, 
Status));+ASSERT_EFI_ERROR (Status);+FreePool(CompressedData);+ 
   return Status;+  } else {+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));diff --git 
a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf
 
b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf
index 61e85a658..77920d031 100644
--- 
a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConfig.inf
+++ b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemo
+++ ryConfig.inf
@@ -26,6 +26,7 @@
   LargeVariableReadLib   LargeVariableWriteLib   BaseLib+  CompressLib  
[Packages]   MdePkg/MdePkg.dec@@ -45,6 +46,9 @@
   gFspNonVolatileStorageHob2Guid## CONSUMES   
gFspNvsBufferVariableGuid 

Re: [edk2-devel] [edk2-platforms:PATCH V1] MinPlatformPkg/SaveMemoryConfig: Support NVS Data compression.

2023-05-08 Thread Chiu, Chasel


Hi Isaac,

Just my thoughts, I would vote for platform/bootloader to decide compressing 
the variable data before saving to NVRAM or not.
It should be optional and when platform having big SPI flash they might not 
want to do this.

Thanks,
Chasel


> -Original Message-
> From: Oram, Isaac W 
> Sent: Monday, May 8, 2023 12:15 PM
> To: Gudla, Raghava ; devel@edk2.groups.io
> Cc: Chiu, Chasel ; Desimone, Nathaniel L
> ; Kubacki, Michael
> ; Chaganty, Rangasai V
> 
> Subject: RE: [edk2-platforms:PATCH V1] MinPlatformPkg/SaveMemoryConfig:
> Support NVS Data compression.
> 
> The proposed implementation is fine and I will reviewed-by and push if that is
> the desired direction.
> 
> My question is if we generally like the design of doing compression in common
> MinPlatform code, decompression in board specific FSP wrapper code.  The
> alternative design is to do compression and decompression inside the FSP.  
> This
> seems like a slightly simpler separation of responsibilities.
> The board code is responsible for save/restore, the FSP code is responsible 
> for
> data blob creation and use.  Data integrity, authentication, compression, etc 
> all
> can be done based on more detailed knowledge of the silicon implementation
> requirements.
> 
> I can see another argument though that doing it inside FSP effectively forces
> both bootloader and FSP to carry compression/decompression.  The
> compression/decompression aren't likely to need to be silicon specific.  And
> bootloader may have more requirements to balance than just the silicon
> requirements.
> 
> Can I get some votes on preferred answer for compressing/decompressing FSP
> non-volatile data in bootloader or FSP?
> 
> Thanks,
> Isaac
> 
> -Original Message-
> From: Gudla, Raghava 
> Sent: Friday, May 5, 2023 5:03 PM
> To: devel@edk2.groups.io
> Cc: Gudla, Raghava ; Chiu, Chasel
> ; Desimone, Nathaniel L
> ; Oram, Isaac W 
> Subject: [edk2-platforms:PATCH V1] MinPlatformPkg/SaveMemoryConfig:
> Support NVS Data compression.
> 
> Around 50KB "FspNonVolatileStorageHob" data can be compressed to
> approximately 3 KB which can save NVRAM space and enhance life of the SPI
> part by decreasing the number of reclaim cycles needed.
> 
> This patch added support to compress "FspNonVolatileStorageHob" data before
> saving to NVRAM.
> 
> A PcdEnableCompressFspNvsHob is introduced to enable/disable this feature per
> platform usage.
> 
> Cc: Chasel Chiu 
> Cc: Nate DeSimone 
> Cc: Isaac Oram 
> 
> Signed-off-by: Raghava Gudla 
> ---
>  .../SaveMemoryConfig/SaveMemoryConfig.c   | 34 +++
>  .../SaveMemoryConfig/SaveMemoryConfig.inf |  6 +++-
>  .../Include/Dsc/CoreCommonLib.dsc |  1 +
>  .../Intel/MinPlatformPkg/MinPlatformPkg.dec   |  5 +++
>  4 files changed, 45 insertions(+), 1 deletion(-)
> 
> diff --git
> a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemor
> yConfig.c
> b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemor
> yConfig.c
> index 0215e8eed..8aa935b54 100644
> ---
> a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemor
> yConfig.c
> +++
> b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemo
> +++ ryConfig.c
> @@ -21,6 +21,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include  #include
>  #include
> +#include +#include
>   /**   This is the standard EFI driver point that 
> detects
> whether there is a@@ -45,6 +47,9 @@ SaveMemoryConfigEntryPoint (
>UINTN DataSize;   UINTN BufferSize;   BOOLEAN
> DataIsIdentical;+  VOID  *CompressedData;+  UINT64
> CompressedSize;+  UINTN CompressedAllocationPages;DataSize
> = 0;
> BufferSize  = 0;@@ -73,6 +78,35 @@ SaveMemoryConfigEntryPoint (
>  }   } +  if (PcdGetBool (PcdEnableCompressFspNvsHob) == 1) {+
> CompressedData= NULL;+CompressedSize= 0;+
> CompressedAllocationPages = 0;++DEBUG ((DEBUG_INFO, "compressing mem
> config nvs variable\n"));+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",
> __func__));+ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);+return
> EFI_OUT_OF_RESOURCES;+  }++  CompressedSize = EFI_PAGES_TO_SIZE
> (CompressedAllocationPages);+  Status = Compress (HobData, DataSize,
> CompressedData, &CompressedSize);+  if (EFI_ERROR (Status)) {+
> DEBUG
> ((DEBUG_ERROR, "[%a] - failed to compress data. Status = %r\n", __func__,
> Status));+ASSERT_EFI_ERROR (Status);+
> FreePool(CompressedData);+
> return Status;+  } else {+HobData  = CompressedData;+
> DataSize =
> (UINTN) CompressedSize;+  }+}+  }+   if (HobData != NULL) { DEBUG
> ((DEBUG_INFO, "FspNvsHob.NvsDataLengt

[edk2-devel] [PATCH v2] BaseTools/Plugin: Too many execute file report cmd too long failure

2023-05-08 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 to many *.cov, 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| 31 ---
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git 
a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py 
b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
index d993de9412..05bb6da50a 100644
--- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
+++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
@@ -209,13 +209,25 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 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"
+if (os.path.isfile(f"{os.path.join(buildOutputBase, 
'coverage.cov')}")):
+coverageFile += f" 
--input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
+ret = RunCmd("OpenCppCoverage", f"--export_type 
binary:{os.path.join(buildOutputBase, 'coverage.cov')} 
--working_dir={workspace}Build {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={workspace}Build " +
+f"--input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
+)
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to generate cobertura 
format xml in single package.")
 return 1
@@ -224,9 +236,20 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 testCoverageList = glob.glob(os.path.join(workspace, "Build", 
"**","*Test*.exe.cov"), recursive=True)
 coverageFile = ""
 for testCoverage in testCoverageList:
-coverageFile += " --input_coverage=" + testCoverage
+coverageFile  = f" --input_coverage={testCoverage}"
+if (os.path.isfile(f"{workspace}Build/coverage.cov")):
+coverageFile += f" 
--input_coverage={workspace}Build/coverage.cov"
+ret = RunCmd("OpenCppCoverage", f"--export_type 
binary:{workspace}Build/coverage.cov --working_dir={workspace}Build 
{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 cobertura:{workspace}Build/coverage.xml " +
+f"--working_dir={workspace}Build " +
+f"--input_coverage={workspace}Build/coverage.cov"
+)
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to generate cobertura 
format xml.")
 return 1
-- 
2.39.2.windows.1



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




[edk2-devel] [PATCH v3] BaseTools/Plugin: Too many execute filess cause "cmd too long" failure

2023-05-08 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 
Signed-off-by: Gua Guo 
---
 .../HostBasedUnitTestRunner.py| 31 ---
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git 
a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py 
b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
index d993de9412..05bb6da50a 100644
--- a/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
+++ b/BaseTools/Plugin/HostBasedUnitTestRunner/HostBasedUnitTestRunner.py
@@ -209,13 +209,25 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 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"
+if (os.path.isfile(f"{os.path.join(buildOutputBase, 
'coverage.cov')}")):
+coverageFile += f" 
--input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
+ret = RunCmd("OpenCppCoverage", f"--export_type 
binary:{os.path.join(buildOutputBase, 'coverage.cov')} 
--working_dir={workspace}Build {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={workspace}Build " +
+f"--input_coverage={os.path.join(buildOutputBase, 'coverage.cov')}"
+)
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to generate cobertura 
format xml in single package.")
 return 1
@@ -224,9 +236,20 @@ class HostBasedUnitTestRunner(IUefiBuildPlugin):
 testCoverageList = glob.glob(os.path.join(workspace, "Build", 
"**","*Test*.exe.cov"), recursive=True)
 coverageFile = ""
 for testCoverage in testCoverageList:
-coverageFile += " --input_coverage=" + testCoverage
+coverageFile  = f" --input_coverage={testCoverage}"
+if (os.path.isfile(f"{workspace}Build/coverage.cov")):
+coverageFile += f" 
--input_coverage={workspace}Build/coverage.cov"
+ret = RunCmd("OpenCppCoverage", f"--export_type 
binary:{workspace}Build/coverage.cov --working_dir={workspace}Build 
{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 cobertura:{workspace}Build/coverage.xml " +
+f"--working_dir={workspace}Build " +
+f"--input_coverage={workspace}Build/coverage.cov"
+)
 if ret != 0:
 logging.error("UnitTest Coverage: Failed to generate cobertura 
format xml.")
 return 1
-- 
2.39.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104288): https://edk2.groups.io/g/devel/message/104288
Mute This Topic: https://groups.io/mt/98769942/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] ManageabilityPkg/IpmiCommandLib:IPMI Command Library

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


A few superficial things that could be fixed now or later.

Typo:  EFI_STASTUS

There is a mismatch between function names and parameter names that looks like 
a cut/paste from prior function.  Updating would probably match the spirit of 
"no functional changes", but it is your choice to correct.
IpmiSetPowerRestorePolicy (
  IN  IPMI_SET_POWER_RESTORE_POLICY_REQUEST   *ChassisControlRequest,
  OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE  *ChassisControlResponse
  )

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Chang, Abner via 
groups.io
Sent: Thursday, May 4, 2023 10:24 PM
To: devel@edk2.groups.io
Cc: Oram, Isaac W ; Abdul Lateef Attar 
; Nickle Wang ; Tinh Nguyen 

Subject: [edk2-devel] [edk2-platforms][PATCH] 
ManageabilityPkg/IpmiCommandLib:IPMI Command Library

From: Abner Chang 

BZ #: 

IpmiCommandLib is cloned from
edk2-platforms/Features/Intel/OutOfBandManagement/
IpmiFeaturePkg/Library/IpmiCommandLib in order to
consolidate edk2 system manageability support in
one place. Function header are added to the source
files and header files. Uncustify is applied to C
files and no functionalities are changed in this patch.

We will still keep the one under IpmiFeaturePkg/Library/
IpmiCommandLib until the reference to this instance are
removed from platforms.

Signed-off-by: Abner Chang 
Cc: Isaac Oram 
Cc: Abdul Lateef Attar 
Cc: Nickle Wang 
Cc: Tinh Nguyen 
---
 .../Library/IpmiCommandLib/IpmiCommandLib.inf |  33 +
 .../Include/Library/IpmiCommandLib.h  | 620 ++
 .../IpmiCommandLib/IpmiCommandLibNetFnApp.c   | 444 +
 .../IpmiCommandLibNetFnChassis.c  | 199 ++
 .../IpmiCommandLibNetFnStorage.c  | 384 +++
 .../IpmiCommandLibNetFnTransport.c| 156 +
 6 files changed, 1836 insertions(+)
 create mode 100644 
Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.inf
 create mode 100644 Features/ManageabilityPkg/Include/Library/IpmiCommandLib.h
 create mode 100644 
Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnApp.c
 create mode 100644 
Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnChassis.c
 create mode 100644 
Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnStorage.c
 create mode 100644 
Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTransport.c

diff --git 
a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.inf 
b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.inf
new file mode 100644
index 00..3dc485cf38
--- /dev/null
+++ b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.inf
@@ -0,0 +1,33 @@
+### @file
+# Component description file for IPMI Command Library.
+#
+# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.
+# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = IpmiCommandLib
+  FILE_GUID  = 96FC1989-CB7F-489B-9D3B-68DCA2C2DADC
+  MODULE_TYPE= UEFI_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = IpmiCommandLib
+
+[sources]
+  IpmiCommandLibNetFnApp.c
+  IpmiCommandLibNetFnTransport.c
+  IpmiCommandLibNetFnChassis.c
+  IpmiCommandLibNetFnStorage.c
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  ManageabilityPkg/ManageabilityPkg.dec
+
+[LibraryClasses]
+  BaseMemoryLib
+  DebugLib
+  IpmiLib
diff --git a/Features/ManageabilityPkg/Include/Library/IpmiCommandLib.h 
b/Features/ManageabilityPkg/Include/Library/IpmiCommandLib.h
new file mode 100644
index 00..685f6e2ea2
--- /dev/null
+++ b/Features/ManageabilityPkg/Include/Library/IpmiCommandLib.h
@@ -0,0 +1,620 @@
+/** @file
+  This library abstract how to send/receive IPMI command.
+
+Copyright (c) 2018-2021, Intel Corporation. All rights reserved.
+Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef IPMI_COMMAND_LIB_H_
+#define IPMI_COMMAND_LIB_H_
+
+#include 
+#include 
+
+///
+/// Functions for IPMI NetFnApp commands
+///
+
+/**
+  This function is used to retrieve device ID.
+
+  @param [out]  DeviceId  The pointer to receive IPMI_GET_DEVICE_ID_RESPONSE.
+
+  @retval EFI_STASTUS   See the return values of IpmiSubmitCommand () function.
+
+**/
+EFI_STATUS
+EFIAPI
+IpmiGetDeviceId (
+  OUT IPMI_GET_DEVICE_ID_RESPONSE  *DeviceId
+  );
+
+/**
+  This function returns device self test results
+
+  @param [out]  SelfTestResult  The pointer to receive 
IPMI_SELF_TEST_RESULT_RESPONSE.
+
+  @retval EFI_STASTUS   See the return values of IpmiSubmitCommand () function.
+
+**/
+EFI_STATUS
+EFIAPI
+IpmiGetSelfTestResult (
+  OUT IPMI_SELF_TEST_RESULT_RESPONSE  *SelfTestResult
+  );
+
+/**
+  This function is

[edk2-devel] [PATCH 0/2] OvmfPkg: Relax assertion that interrupts do not occur at TPL_HIGH_LEVEL

2023-05-08 Thread Michael Brown
At TPL_HIGH_LEVEL, CPU interrupts are disabled (as per the UEFI
specification) and so we should never encounter a situation in which
an interrupt occurs at TPL_HIGH_LEVEL. The specification also
restricts usage of TPL_HIGH_LEVEL to the firmware itself.

However, nothing prevents a rogue UEFI application from illegally
calling gBS->RaiseTPL(TPL_HIGH_LEVEL) and then deliberately violating
the invariant by enabling interrupts via the STI or equivalent
instruction. Some versions of the Microsoft Windows bootloader are
known to do this.

NestedInterruptTplLib maintains the invariant that interrupts are
disabled at TPL_HIGH_LEVEL (even when performing the dark art of
deliberately manipulating the stack so that IRET will return with
interrupts still disabled), but does not itself rely on external code
maintaining this invariant.

Relax the assertion that the interrupted TPL is below TPL_HIGH_LEVEL
to an error message, to allow rogue UEFI applications such as the
Microsoft Windows bootloader to continue to function.

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=2189136
Cc: Laszlo Ersek 
Cc: Gerd Hoffmann 
Cc: Oliver Steffen 
Cc: Pawel Polawski 
Cc: Jiewen Yao 
Cc: Ard Biesheuvel 
Cc: Jordan Justen 

Michael Brown (2):
  OvmfPkg: Clarify invariants for NestedInterruptTplLib
  OvmfPkg: Relax assertion that interrupts do not occur at
TPL_HIGH_LEVEL

 OvmfPkg/Library/NestedInterruptTplLib/Tpl.c | 31 +
 1 file changed, 26 insertions(+), 5 deletions(-)

-- 
2.39.0



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




[edk2-devel] [PATCH 1/2] OvmfPkg: Clarify invariants for NestedInterruptTplLib

2023-05-08 Thread Michael Brown
NestedInterruptTplLib relies on CPU interrupts being disabled to
guarantee exclusive (and hence atomic) access to the shared state in
IsrState.  Nothing in the calling interrupt handler should have
re-enabled interrupts before calling NestedInterruptRestoreTPL(), and
the loop in NestedInterruptRestoreTPL() itself maintains the invariant
that interrupts are disabled at the start of each iteration.

Add assertions to clarify this invariant, and expand the comments
around the calls to RestoreTPL() and DisableInterrupts() to clarify
the expectations around enabling and disabling interrupts.

Signed-off-by: Michael Brown 
---
 OvmfPkg/Library/NestedInterruptTplLib/Tpl.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c 
b/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c
index e19d98878eb7..e921a09c5599 100644
--- a/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c
+++ b/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c
@@ -104,6 +104,7 @@ NestedInterruptRestoreTPL (
   // defer our call to RestoreTPL() to the in-progress outer instance
   // of the same interrupt handler.
   //
+  ASSERT (GetInterruptState () == FALSE);
   if (InterruptedTPL == IsrState->InProgressRestoreTPL) {
 //
 // Trigger outer instance of this interrupt handler to perform the
@@ -153,6 +154,7 @@ NestedInterruptRestoreTPL (
 //
 // Check shared state loop invariants.
 //
+ASSERT (GetInterruptState () == FALSE);
 ASSERT (IsrState->InProgressRestoreTPL < InterruptedTPL);
 ASSERT (IsrState->DeferredRestoreTPL == FALSE);
 
@@ -167,13 +169,17 @@ NestedInterruptRestoreTPL (
 
 //
 // Call RestoreTPL() to allow event notifications to be
-// dispatched.  This will implicitly re-enable interrupts.
+// dispatched.  This will implicitly re-enable interrupts (if
+// InterruptedTPL is below TPL_HIGH_LEVEL), even though we are
+// still inside the interrupt handler.
 //
 gBS->RestoreTPL (InterruptedTPL);
 
 //
 // Re-disable interrupts after the call to RestoreTPL() to ensure
-// that we have exclusive access to the shared state.
+// that we have exclusive access to the shared state.  Interrupts
+// will be re-enabled by the IRET or equivalent instruction when
+// we subsequently return from the interrupt handler.
 //
 DisableInterrupts ();
 
-- 
2.39.0



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




[edk2-devel] [PATCH 2/2] OvmfPkg: Relax assertion that interrupts do not occur at TPL_HIGH_LEVEL

2023-05-08 Thread Michael Brown
At TPL_HIGH_LEVEL, CPU interrupts are disabled (as per the UEFI
specification) and so we should never encounter a situation in which
an interrupt occurs at TPL_HIGH_LEVEL.  The specification also
restricts usage of TPL_HIGH_LEVEL to the firmware itself.

However, nothing prevents a rogue UEFI application from illegally
calling gBS->RaiseTPL(TPL_HIGH_LEVEL) and then deliberately violating
the invariant by enabling interrupts via the STI or equivalent
instruction.  Some versions of the Microsoft Windows bootloader are
known to do this.

NestedInterruptTplLib maintains the invariant that interrupts are
disabled at TPL_HIGH_LEVEL (even when performing the dark art of
deliberately manipulating the stack so that IRET will return with
interrupts still disabled), but does not itself rely on external code
maintaining this invariant.

Relax the assertion that the interrupted TPL is below TPL_HIGH_LEVEL
to an error message, to allow rogue UEFI applications such as the
Microsoft Windows bootloader to continue to function.

Debugged-by: Gerd Hoffmann 
Debugged-by: Laszlo Ersek 
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=2189136
Signed-off-by: Michael Brown 
---
 OvmfPkg/Library/NestedInterruptTplLib/Tpl.c | 21 ++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c 
b/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c
index e921a09c5599..a91f2d3cb8c7 100644
--- a/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c
+++ b/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c
@@ -34,12 +34,27 @@ NestedInterruptRaiseTPL (
 
   //
   // Raise TPL and assert that we were called from within an interrupt
-  // handler (i.e. with TPL below TPL_HIGH_LEVEL but with interrupts
-  // disabled).
+  // handler (i.e. with interrupts already disabled before raising the
+  // TPL).
   //
   ASSERT (GetInterruptState () == FALSE);
   InterruptedTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
-  ASSERT (InterruptedTPL < TPL_HIGH_LEVEL);
+
+  //
+  // At TPL_HIGH_LEVEL, CPU interrupts are disabled (as per the UEFI
+  // specification) and so we should never encounter a situation in
+  // which InterruptedTPL==TPL_HIGH_LEVEL.  The specification also
+  // restricts usage of TPL_HIGH_LEVEL to the firmware itself.
+  //
+  // However, nothing prevents a rogue UEFI application from illegally
+  // calling gBS->RaiseTPL(TPL_HIGH_LEVEL) and then deliberately
+  // violating the invariant by enabling interrupts via the STI or
+  // equivalent instruction.  Some versions of the Microsoft Windows
+  // bootloader are known to do this.
+  //
+  if (InterruptedTPL >= TPL_HIGH_LEVEL) {
+DEBUG ((DEBUG_ERROR, "Illegal interrupt at TPL_HIGH_LEVEL!\n"));
+  }
 
   return InterruptedTPL;
 }
-- 
2.39.0



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




Re: [edk2-devel] [edk2-platforms:PATCH V1] MinPlatformPkg/SaveMemoryConfig: Support NVS Data compression.

2023-05-08 Thread Michael D Kinney
When reviewing the Variable feature that adds integrity and confidentiality,
I suggested that the interface between the Variable services and the NVStorage
could provide an abstraction to encode/decode the stored data that would
support encryption, compression, or both.  Could also support a platform 
policy for which variables the encode/decode operation is applied.

Wouldn't that be a better abstraction than piecemeal adding these
features?

Doesn't mean that this can't go in as-is.  But would be an opportunity to
consolidate in the future.

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Chiu,
> Chasel
> Sent: Monday, May 8, 2023 12:37 PM
> To: Oram, Isaac W ; Gudla, Raghava
> ; devel@edk2.groups.io
> Cc: Desimone, Nathaniel L ; Kubacki,
> Michael ; Chaganty, Rangasai V
> ; Chiu, Chasel 
> Subject: Re: [edk2-devel] [edk2-platforms:PATCH V1]
> MinPlatformPkg/SaveMemoryConfig: Support NVS Data compression.
> 
> 
> Hi Isaac,
> 
> Just my thoughts, I would vote for platform/bootloader to decide
> compressing the variable data before saving to NVRAM or not.
> It should be optional and when platform having big SPI flash they might not
> want to do this.
> 
> Thanks,
> Chasel
> 
> 
> > -Original Message-
> > From: Oram, Isaac W 
> > Sent: Monday, May 8, 2023 12:15 PM
> > To: Gudla, Raghava ; devel@edk2.groups.io
> > Cc: Chiu, Chasel ; Desimone, Nathaniel L
> > ; Kubacki, Michael
> > ; Chaganty, Rangasai V
> > 
> > Subject: RE: [edk2-platforms:PATCH V1] MinPlatformPkg/SaveMemoryConfig:
> > Support NVS Data compression.
> >
> > The proposed implementation is fine and I will reviewed-by and push if that
> is
> > the desired direction.
> >
> > My question is if we generally like the design of doing compression in
> common
> > MinPlatform code, decompression in board specific FSP wrapper code.  The
> > alternative design is to do compression and decompression inside the FSP.
> This
> > seems like a slightly simpler separation of responsibilities.
> > The board code is responsible for save/restore, the FSP code is responsible
> for
> > data blob creation and use.  Data integrity, authentication, compression, 
> > etc
> all
> > can be done based on more detailed knowledge of the silicon
> implementation
> > requirements.
> >
> > I can see another argument though that doing it inside FSP effectively 
> > forces
> > both bootloader and FSP to carry compression/decompression.  The
> > compression/decompression aren't likely to need to be silicon specific.  And
> > bootloader may have more requirements to balance than just the silicon
> > requirements.
> >
> > Can I get some votes on preferred answer for compressing/decompressing
> FSP
> > non-volatile data in bootloader or FSP?
> >
> > Thanks,
> > Isaac
> >
> > -Original Message-
> > From: Gudla, Raghava 
> > Sent: Friday, May 5, 2023 5:03 PM
> > To: devel@edk2.groups.io
> > Cc: Gudla, Raghava ; Chiu, Chasel
> > ; Desimone, Nathaniel L
> > ; Oram, Isaac W
> 
> > Subject: [edk2-platforms:PATCH V1] MinPlatformPkg/SaveMemoryConfig:
> > Support NVS Data compression.
> >
> > Around 50KB "FspNonVolatileStorageHob" data can be compressed to
> > approximately 3 KB which can save NVRAM space and enhance life of the SPI
> > part by decreasing the number of reclaim cycles needed.
> >
> > This patch added support to compress "FspNonVolatileStorageHob" data
> before
> > saving to NVRAM.
> >
> > A PcdEnableCompressFspNvsHob is introduced to enable/disable this
> feature per
> > platform usage.
> >
> > Cc: Chasel Chiu 
> > Cc: Nate DeSimone 
> > Cc: Isaac Oram 
> >
> > Signed-off-by: Raghava Gudla 
> > ---
> >  .../SaveMemoryConfig/SaveMemoryConfig.c   | 34 +++
> >  .../SaveMemoryConfig/SaveMemoryConfig.inf |  6 +++-
> >  .../Include/Dsc/CoreCommonLib.dsc |  1 +
> >  .../Intel/MinPlatformPkg/MinPlatformPkg.dec   |  5 +++
> >  4 files changed, 45 insertions(+), 1 deletion(-)
> >
> > diff --git
> >
> a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemo
> r
> > yConfig.c
> >
> b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMem
> or
> > yConfig.c
> > index 0215e8eed..8aa935b54 100644
> > ---
> >
> a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemo
> r
> > yConfig.c
> > +++
> >
> b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMem
> o
> > +++ ryConfig.c
> > @@ -21,6 +21,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> >  #include  #include
> >  #include
> > +#include +#include
> >   /**   This is the standard EFI driver point that
> detects
> > whether there is a@@ -45,6 +47,9 @@ SaveMemoryConfigEntryPoint (
> >UINTN DataSize;   UINTN BufferSize;   BOOLEAN
> > DataIsIdentical;+  VOID  *CompressedData;+  UINT64
> > CompressedSize;+  UINTN CompressedAllocationPages;DataSize
> = 0;
> > BufferSize  = 0;@@ -73,6 +78,35 @@ SaveMemoryConfigEntryPoint (
> >  }   } +  if (PcdGetBool (Pc

[edk2-devel] [PATCH 0/2] OvmfPkg: Replace the OVMF-specific SataControllerDxe with the generic one

2023-05-08 Thread Pedro Falcato
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.

First I manually replayed OvmfPkg/SataControllerDxe's patches on top of the 
generic one. Only one
seemed to make sense. The second patch removes OvmfPkg/SataControllerDxe and 
replaces it for all platforms
under OvmfPkg. 

Tested by booting in QEMU (Q35 (AHCI) and PC (IDE)).
More testing from other, alternative platforms is desired, although breakage 
seems unlikely.

(+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 

Pedro Falcato (2):
  MdeModulePkg/SataControllerDxe: Remove useless null check
  OvmfPkg: Replace the OVMF-specific SataControllerDxe with a generic
one

 .../Pci/SataControllerDxe/SataController.c|   44 +-
 OvmfPkg/AmdSev/AmdSevX64.dsc  |2 +-
 OvmfPkg/AmdSev/AmdSevX64.fdf  |2 +-
 OvmfPkg/Bhyve/BhyveX64.dsc|2 +-
 OvmfPkg/Bhyve/BhyveX64.fdf|2 +-
 OvmfPkg/CloudHv/CloudHvX64.dsc|2 +-
 OvmfPkg/CloudHv/CloudHvX64.fdf|2 +-
 OvmfPkg/IntelTdx/IntelTdxX64.dsc  |2 +-
 OvmfPkg/IntelTdx/IntelTdxX64.fdf  |2 +-
 OvmfPkg/Microvm/MicrovmX64.dsc|2 +-
 OvmfPkg/Microvm/MicrovmX64.fdf|2 +-
 OvmfPkg/OvmfPkgIa32.dsc   |2 +-
 OvmfPkg/OvmfPkgIa32.fdf   |2 +-
 OvmfPkg/OvmfPkgIa32X64.dsc|2 +-
 OvmfPkg/OvmfPkgIa32X64.fdf|2 +-
 OvmfPkg/OvmfPkgX64.dsc|2 +-
 OvmfPkg/OvmfPkgX64.fdf|2 +-
 OvmfPkg/OvmfXen.dsc   |2 +-
 OvmfPkg/OvmfXen.fdf   |2 +-
 OvmfPkg/SataControllerDxe/ComponentName.c |  170 ---
 OvmfPkg/SataControllerDxe/SataController.c| 1112 -
 OvmfPkg/SataControllerDxe/SataController.h|  544 
 .../SataControllerDxe/SataControllerDxe.inf   |   43 -
 23 files changed, 39 insertions(+), 1910 deletions(-)
 delete mode 100644 OvmfPkg/SataControllerDxe/ComponentName.c
 delete mode 100644 OvmfPkg/SataControllerDxe/SataController.c
 delete mode 100644 OvmfPkg/SataControllerDxe/SataController.h
 delete mode 100644 OvmfPkg/SataControllerDxe/SataControllerDxe.inf

-- 
2.40.1



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




[edk2-devel] [PATCH 1/2] MdeModulePkg/SataControllerDxe: Remove useless null check

2023-05-08 Thread Pedro Falcato
ASSERT (Private != NULL) already covers this check.
See commit 81310a6.

Cc: Jian J Wang 
Cc: Liming Gao 
Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Pedro Falcato 
---
 .../Pci/SataControllerDxe/SataController.c| 44 +--
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c 
b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c
index f661efaec7e9..ab069845fd02 100644
--- a/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c
+++ b/MdeModulePkg/Bus/Pci/SataControllerDxe/SataController.c
@@ -625,34 +625,32 @@ SataControllerStop (
 return Status;
   }
 
-  if (Private != NULL) {
-if (Private->DisqualifiedModes != NULL) {
-  FreePool (Private->DisqualifiedModes);
-}
-
-if (Private->IdentifyData != NULL) {
-  FreePool (Private->IdentifyData);
-}
+  if (Private->DisqualifiedModes != NULL) {
+FreePool (Private->DisqualifiedModes);
+  }
 
-if (Private->IdentifyValid != NULL) {
-  FreePool (Private->IdentifyValid);
-}
+  if (Private->IdentifyData != NULL) {
+FreePool (Private->IdentifyData);
+  }
 
-if (Private->PciAttributesChanged) {
-  //
-  // Restore original PCI attributes
-  //
-  Private->PciIo->Attributes (
-Private->PciIo,
-EfiPciIoAttributeOperationSet,
-Private->OriginalPciAttributes,
-NULL
-);
-}
+  if (Private->IdentifyValid != NULL) {
+FreePool (Private->IdentifyValid);
+  }
 
-FreePool (Private);
+  if (Private->PciAttributesChanged) {
+//
+// Restore original PCI attributes
+//
+Private->PciIo->Attributes (
+  Private->PciIo,
+  EfiPciIoAttributeOperationSet,
+  Private->OriginalPciAttributes,
+  NULL
+  );
   }
 
+  FreePool (Private);
+
   //
   // Close protocols opened by Sata Controller driver
   //
-- 
2.40.1



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




[edk2-devel] [PATCH 2/2] OvmfPkg: Replace the OVMF-specific SataControllerDxe with a generic one

2023-05-08 Thread Pedro Falcato
Previously, OVMF had forked DuetPkg's SataControllerDxe (see commit
12e92a2). However, in commit fda951d a generic SataControllerDxe was
added to MdeModulePkg/Bus/Pci.
Since they are most similar (both code-wise and functionally), let's
unify them and de-duplicate code.

Tested by booting in QEMU, in both Q35 and PC (to test IDE and AHCI
functionality).

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 
Signed-off-by: Pedro Falcato 
---
 OvmfPkg/AmdSev/AmdSevX64.dsc  |2 +-
 OvmfPkg/AmdSev/AmdSevX64.fdf  |2 +-
 OvmfPkg/Bhyve/BhyveX64.dsc|2 +-
 OvmfPkg/Bhyve/BhyveX64.fdf|2 +-
 OvmfPkg/CloudHv/CloudHvX64.dsc|2 +-
 OvmfPkg/CloudHv/CloudHvX64.fdf|2 +-
 OvmfPkg/IntelTdx/IntelTdxX64.dsc  |2 +-
 OvmfPkg/IntelTdx/IntelTdxX64.fdf  |2 +-
 OvmfPkg/Microvm/MicrovmX64.dsc|2 +-
 OvmfPkg/Microvm/MicrovmX64.fdf|2 +-
 OvmfPkg/OvmfPkgIa32.dsc   |2 +-
 OvmfPkg/OvmfPkgIa32.fdf   |2 +-
 OvmfPkg/OvmfPkgIa32X64.dsc|2 +-
 OvmfPkg/OvmfPkgIa32X64.fdf|2 +-
 OvmfPkg/OvmfPkgX64.dsc|2 +-
 OvmfPkg/OvmfPkgX64.fdf|2 +-
 OvmfPkg/OvmfXen.dsc   |2 +-
 OvmfPkg/OvmfXen.fdf   |2 +-
 OvmfPkg/SataControllerDxe/ComponentName.c |  170 ---
 OvmfPkg/SataControllerDxe/SataController.c| 1112 -
 OvmfPkg/SataControllerDxe/SataController.h|  544 
 .../SataControllerDxe/SataControllerDxe.inf   |   43 -
 22 files changed, 18 insertions(+), 1887 deletions(-)
 delete mode 100644 OvmfPkg/SataControllerDxe/ComponentName.c
 delete mode 100644 OvmfPkg/SataControllerDxe/SataController.c
 delete mode 100644 OvmfPkg/SataControllerDxe/SataController.h
 delete mode 100644 OvmfPkg/SataControllerDxe/SataControllerDxe.inf

diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 943c4eed9831..4c726fd55529 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -668,7 +668,7 @@
   MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
   MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
   MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
-  OvmfPkg/SataControllerDxe/SataControllerDxe.inf
+  MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf
   MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
   MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
   MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
diff --git a/OvmfPkg/AmdSev/AmdSevX64.fdf b/OvmfPkg/AmdSev/AmdSevX64.fdf
index fec08468d3e0..463bd3e9ef15 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.fdf
+++ b/OvmfPkg/AmdSev/AmdSevX64.fdf
@@ -250,7 +250,7 @@ INF  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
 INF  MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
 INF  MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
 INF  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
-INF  OvmfPkg/SataControllerDxe/SataControllerDxe.inf
+INF  MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf
 INF  MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
 INF  MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
 INF  MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index d0d2712c5662..bb317a50e6af 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -698,7 +698,7 @@
   MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf
   MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
   MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
-  OvmfPkg/SataControllerDxe/SataControllerDxe.inf
+  MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf
   MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
   MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
   MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
diff --git a/OvmfPkg/Bhyve/BhyveX64.fdf b/OvmfPkg/Bhyve/BhyveX64.fdf
index 153b3cfeba55..3f6270c048cc 100644
--- a/OvmfPkg/Bhyve/BhyveX64.fdf
+++ b/OvmfPkg/Bhyve/BhyveX64.fdf
@@ -239,7 +239,7 @@ INF  MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf
 INF  MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
 INF  MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
 INF  MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
-INF  OvmfPkg/SataControllerDxe/SataControllerDxe.inf
+INF  MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf
 INF  MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
 INF  MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
 INF  MdeModulePkg/Bus/Pci/NvmExpressDxe/

Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/SataControllerDxe: Remove useless null check

2023-05-08 Thread Mike Maslenkin
Hello Pedro,
Technically speaking  ASSERT (Private != NULL) doesn't cover this branch.
It should crash before as result of UninstallMultipleProtocolInterfaces() call.
Obviously it make no sense in release target (under normal condition
when assertion is turned off), while this code does.
But I would suggest to remove ASSERT (Private != NULL) as well since
it is useless also.
It needs to be very lucky to get NULL as result of BASE_CR(), but
actually SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS() and CR()
definition care about this. There will be assert if signature doesn't
match to dereferenced memory area before Private != NULL check.

In fact, this patch just reduces indentation level by removing useless checks.


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




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

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

*When:*
Monday, May 8, 2023
4:30pm to 5:30pm
(UTC-07:00) America/Los Angeles

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

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

*Description:*

TianoCore community,

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

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

Anyone is welcome to join.

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

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


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




Re: [edk2-devel] [PATCH 1/2] MdeModulePkg/SataControllerDxe: Remove useless null check

2023-05-08 Thread Pedro Falcato
On Mon, May 8, 2023 at 11:28 PM Mike Maslenkin  wrote:
>
> Hello Pedro,
> Technically speaking  ASSERT (Private != NULL) doesn't cover this branch.
> It should crash before as result of UninstallMultipleProtocolInterfaces() 
> call.
> Obviously it make no sense in release target (under normal condition
> when assertion is turned off), while this code does.
> But I would suggest to remove ASSERT (Private != NULL) as well since
> it is useless also.
> It needs to be very lucky to get NULL as result of BASE_CR(), but
> actually SATA_CONTROLLER_PRIVATE_DATA_FROM_THIS() and CR()
> definition care about this. There will be assert if signature doesn't
> match to dereferenced memory area before Private != NULL check.
>
> In fact, this patch just reduces indentation level by removing useless checks.

Hmm yes, I agree. I don't see how that ASSERT can realistically fire.
It should also be removed.
I'm keeping this patch as-is since it's essentially a cheap backport
from OVMF SataControllerDxe; maintainers, pull it if you'd like, or I
can send a v2 later on that cleans up that ASSERT as well.

The OVMF patch doesn't really depend on this, as this is just refactoring.

(sidenote: you're dropping all CCs accidentally)

-- 
Pedro


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




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

2023-05-08 Thread Group Notification
*Tools, CI, Code base construction meeting series*

*When:*
Monday, May 8, 2023
4:30pm to 5:30pm
(UTC-07:00) America/Los Angeles

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

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

*Description:*

TianoCore community,

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

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

Anyone is welcome to join.

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

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


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




Re: [edk2-devel] [PATCH edk2-platforms 1/2] QemuOpenBoardPkg: Redo PCI bus initialization

2023-05-08 Thread Pedro Falcato
On Thu, Mar 9, 2023 at 3:48 AM Isaac Oram  wrote:
>
> We are doing some work to enable CI on edk2-platforms and would like to add 
> QemuOpenBoardPkg to the CI list.  I do think that this will become more 
> active over time.
>
> Is there a V2 coming?  If so, I found a compiler issue with VS2019 and VS2015.
> It doesn't like the local variable PlatformData having the same name as the 
> global variable PlatformData.
> I would suggest changing the global to mPlatformData.

Hi!

Really sorry for ghosting you here, I've been busy lately and this
email slipped through my inbox's cracks :)

Yes, I'll try and spin up a V2 in the coming weeks if I can. Thank you
for spotting the issue with VS, I'll take a look.
Also, any update on CI?

-- 
Pedro


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




[edk2-devel] [PATCH v3 0/2] Add more google mock library

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

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

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

V3
Remove EBC and fix some coding rule

V2:
Fixed Azure build failure

V1:
Add google mock support for HobLib
Add google mock support for PciHostBridgeLib Add google mock support for 
PeiServicesLib

Gua Guo (2):
  MdeModulePkg: Add more PciHostBridgeLib gmock support
  MdePkg: Add more HobLib/PeiServicesLib gmock support

 MdeModulePkg/MdeModulePkg.dec |   1 +
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|   5 +
 .../GoogleTest/Library/MockPciHostBridgeLib.h |  40 
 .../MockPciHostBridgeLib.cpp  |  14 ++
 .../MockPciHostBridgeLib.inf  |  35 
 MdePkg/Test/MdePkgHostTest.dsc|   2 +
 .../Include/GoogleTest/Library/MockHobLib.h   | 150 ++
 .../GoogleTest/Library/MockPeiServicesLib.h   | 189 ++
 .../GoogleTest/MockHobLib/MockHobLib.cpp  |  30 +++
 .../GoogleTest/MockHobLib/MockHobLib.inf  |  33 +++
 .../MockPeiServicesLib/MockPeiServicesLib.cpp |  36 
 .../MockPeiServicesLib/MockPeiServicesLib.inf |  32 +++
 12 files changed, 567 insertions(+)
 create mode 100644 
MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
 create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
 create mode 100644 
MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib.h
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf

--
2.39.2.windows.1



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




[edk2-devel] [PATCH v3 2/2] MdePkg: Add more HobLib/PeiServicesLib gmock support

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

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

Add Google Mock Library for HobLib
Add Google Mock Library for PeiServicesLib

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Chris Johnson 
Signed-off-by: Gua Guo 
---
 MdePkg/Test/MdePkgHostTest.dsc|   2 +
 .../Include/GoogleTest/Library/MockHobLib.h   | 150 ++
 .../GoogleTest/Library/MockPeiServicesLib.h   | 189 ++
 .../GoogleTest/MockHobLib/MockHobLib.cpp  |  30 +++
 .../GoogleTest/MockHobLib/MockHobLib.inf  |  33 +++
 .../MockPeiServicesLib/MockPeiServicesLib.cpp |  36 
 .../MockPeiServicesLib/MockPeiServicesLib.inf |  32 +++
 7 files changed, 472 insertions(+)
 create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
 create mode 100644 
MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib.h
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.cpp
 create mode 100644 
MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf

diff --git a/MdePkg/Test/MdePkgHostTest.dsc b/MdePkg/Test/MdePkgHostTest.dsc
index 35e3ef6d97..529ea69024 100644
--- a/MdePkg/Test/MdePkgHostTest.dsc
+++ b/MdePkg/Test/MdePkgHostTest.dsc
@@ -36,3 +36,5 @@
   MdePkg/Library/BaseLib/UnitTestHostBaseLib.inf
   MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.inf
   
MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf
+  MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLib.inf
+  MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h 
b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
new file mode 100644
index 00..994b8133e5
--- /dev/null
+++ b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
@@ -0,0 +1,150 @@
+/** @file
+  Google Test mocks for HobLib
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MOCK_HOB_LIB_H_
+#define MOCK_HOB_LIB_H_
+
+#include 
+#include 
+extern "C" {
+#include 
+#include 
+#include 
+}
+
+struct MockHobLib {
+  MOCK_INTERFACE_DECLARATION (MockHobLib);
+
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetHobList,
+()
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetNextHob,
+(IN UINT16  Type,
+ IN CONST VOID  *HobStart)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetFirstHob,
+(IN UINT16  Type)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetNextGuidHob,
+(IN CONST EFI_GUID  *Guid,
+ IN CONST VOID  *HobStart)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+GetFirstGuidHob,
+(IN CONST EFI_GUID  *Guid)
+);
+  MOCK_FUNCTION_DECLARATION (
+EFI_BOOT_MODE,
+GetBootModeHob,
+()
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildModuleHob,
+(IN CONST EFI_GUID*ModuleName,
+ IN EFI_PHYSICAL_ADDRESS  MemoryAllocationModule,
+ IN UINT64ModuleLength,
+ IN EFI_PHYSICAL_ADDRESS  EntryPoint)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildResourceDescriptorWithOwnerHob,
+(IN EFI_RESOURCE_TYPEResourceType,
+ IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+ IN EFI_PHYSICAL_ADDRESS PhysicalStart,
+ IN UINT64   NumberOfBytes,
+ IN EFI_GUID *OwnerGUID)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildResourceDescriptorHob,
+(IN EFI_RESOURCE_TYPEResourceType,
+ IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+ IN EFI_PHYSICAL_ADDRESS PhysicalStart,
+ IN UINT64   NumberOfBytes)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+BuildGuidHob,
+(IN CONST EFI_GUID  *Guid,
+ IN UINTN   DataLength)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID *,
+BuildGuidDataHob,
+(IN CONST EFI_GUID  *Guid,
+ IN VOID*Data,
+ IN UINTN   DataLength)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFvHob,
+(IN EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN UINT64Length)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFv2Hob,
+(IN  EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN  UINT64Length,
+ IN CONSTEFI_GUID  *FvName,
+ IN CONSTEFI_GUID  *FileName)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+BuildFv3Hob,
+(IN  EFI_PHYSICAL_ADDRESS  BaseAddress,
+ IN  UINT64Length,
+ IN  UINT32AuthenticationStatus,
+ IN  BOOLEAN   

[edk2-devel] [PATCH v3 1/2] MdeModulePkg: Add more PciHostBridgeLib gmock support

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

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

Add Google Mock Library for PciHostBridgeLib

Cc: Michael D Kinney 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Chris Johnson 
Signed-off-by: Gua Guo 
---
 MdeModulePkg/MdeModulePkg.dec |  1 +
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc|  5 +++
 .../GoogleTest/Library/MockPciHostBridgeLib.h | 40 +++
 .../MockPciHostBridgeLib.cpp  | 14 +++
 .../MockPciHostBridgeLib.inf  | 35 
 5 files changed, 95 insertions(+)
 create mode 100644 
MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 create mode 100644 
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 3eb4a79bf7..9bb0d3ba2d 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -24,6 +24,7 @@
 
 [Includes]
   Include
+  Test/Mock/Include
 
 [Includes.Common.Private]
   Library/BrotliCustomDecompressLib/brotli/c/include
diff --git a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc 
b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
index a2bbbe8adf..8fb982a270 100644
--- a/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
+++ b/MdeModulePkg/Test/MdeModulePkgHostTest.dsc
@@ -53,3 +53,8 @@
   UefiSortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
   DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
   }
+
+  #
+  # Build HOST_APPLICATION Libraries
+  #
+  
MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
diff --git 
a/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h 
b/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
new file mode 100644
index 00..a63bed895c
--- /dev/null
+++ b/MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib.h
@@ -0,0 +1,40 @@
+/** @file
+  Google Test mocks for PciHostBridgeLib
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MOCK_PCI_HOST_BRIDGE_LIB_H_
+#define MOCK_PCI_HOST_BRIDGE_LIB_H_
+
+#include 
+#include 
+extern "C" {
+#include 
+#include 
+}
+
+struct MockPciHostBridgeLib {
+  MOCK_INTERFACE_DECLARATION (MockPciHostBridgeLib);
+
+  MOCK_FUNCTION_DECLARATION (
+PCI_ROOT_BRIDGE *,
+PciHostBridgeGetRootBridges,
+(UINTN  *Count)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+PciHostBridgeFreeRootBridges,
+(PCI_ROOT_BRIDGE  *Bridges,
+ UINTNCount)
+);
+  MOCK_FUNCTION_DECLARATION (
+VOID,
+PciHostBridgeResourceConflict,
+(EFI_HANDLE  HostBridgeHandle,
+ VOID*Configuration)
+);
+};
+
+#endif
diff --git 
a/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
new file mode 100644
index 00..4b15aed169
--- /dev/null
+++ 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.cpp
@@ -0,0 +1,14 @@
+/** @file
+  Mock instance of the PCI Host Bridge Library.
+
+  Copyright (c) 2023, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+
+MOCK_INTERFACE_DEFINITION(MockPciHostBridgeLib);
+
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeGetRootBridges, 1, 
EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeFreeRootBridges, 
2, EFIAPI);
+MOCK_FUNCTION_DEFINITION(MockPciHostBridgeLib, PciHostBridgeResourceConflict, 
2, EFIAPI);
diff --git 
a/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
new file mode 100644
index 00..89daefb9f0
--- /dev/null
+++ 
b/MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockPciHostBridgeLib.inf
@@ -0,0 +1,35 @@
+## @file
+#  Mock instance of the PCI Host Bridge Library.
+#
+# Copyright (c) 2023, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = MockPciHostBridgeLib
+  FILE_GUID  = B51721FE-0BBA-4611-B9A5-ED13C49AC060
+  MODULE_TYPE= HOST_APPLICATION
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = PciHostBridgeLib
+
+#
+# The following information is for reference only and not required by the build
+# tools.
+#
+#  VALID_ARCHITECTURES   = IA32 X64
+#
+
+[Sources]
+  MockPciHostBridgeLib.cpp
+
+[Packages]
+  MdePkg/MdePkg.dec
+  MdeModulePkg/MdeModulePkg.dec
+  UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
+
+[LibraryClas

Re: [edk2-devel] [PATCH v3 0/2] Add more google mock library

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

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Guo, Gua
> Sent: Monday, May 8, 2023 5:04 PM
> To: devel@edk2.groups.io
> Cc: Guo, Gua 
> Subject: [edk2-devel] [PATCH v3 0/2] Add more google mock library
> 
> From: Gua Guo 
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4443
> 
> PR: https://github.com/tianocore/edk2/pull/4335
> 
> V3
> Remove EBC and fix some coding rule
> 
> V2:
> Fixed Azure build failure
> 
> V1:
> Add google mock support for HobLib
> Add google mock support for PciHostBridgeLib Add google mock support for
> PeiServicesLib
> 
> Gua Guo (2):
>   MdeModulePkg: Add more PciHostBridgeLib gmock support
>   MdePkg: Add more HobLib/PeiServicesLib gmock support
> 
>  MdeModulePkg/MdeModulePkg.dec |   1 +
>  MdeModulePkg/Test/MdeModulePkgHostTest.dsc|   5 +
>  .../GoogleTest/Library/MockPciHostBridgeLib.h |  40 
>  .../MockPciHostBridgeLib.cpp  |  14 ++
>  .../MockPciHostBridgeLib.inf  |  35 
>  MdePkg/Test/MdePkgHostTest.dsc|   2 +
>  .../Include/GoogleTest/Library/MockHobLib.h   | 150 ++
>  .../GoogleTest/Library/MockPeiServicesLib.h   | 189 ++
>  .../GoogleTest/MockHobLib/MockHobLib.cpp  |  30 +++
>  .../GoogleTest/MockHobLib/MockHobLib.inf  |  33 +++
>  .../MockPeiServicesLib/MockPeiServicesLib.cpp |  36 
>  .../MockPeiServicesLib/MockPeiServicesLib.inf |  32 +++
>  12 files changed, 567 insertions(+)
>  create mode 100644
> MdeModulePkg/Test/Mock/Include/GoogleTest/Library/MockPciHostBridgeLib
> .h
>  create mode 100644
> MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockP
> ciHostBridgeLib.cpp
>  create mode 100644
> MdeModulePkg/Test/Mock/Library/GoogleTest/MockPciHostBridgeLib/MockP
> ciHostBridgeLib.inf
>  create mode 100644
> MdePkg/Test/Mock/Include/GoogleTest/Library/MockHobLib.h
>  create mode 100644
> MdePkg/Test/Mock/Include/GoogleTest/Library/MockPeiServicesLib.h
>  create mode 100644
> MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.cpp
>  create mode 100644
> MdePkg/Test/Mock/Library/GoogleTest/MockHobLib/MockHobLib.inf
>  create mode 100644
> MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLi
> b.cpp
>  create mode 100644
> MdePkg/Test/Mock/Library/GoogleTest/MockPeiServicesLib/MockPeiServicesLi
> b.inf
> 
> --
> 2.39.2.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104305): https://edk2.groups.io/g/devel/message/104305
Mute This Topic: https://groups.io/mt/98773947/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 1/2] Ext4Pkg: Improve extent node validation on the number of entries

2023-05-08 Thread Pedro Falcato
Improve the extent tree node validation by validating the number of
entries the node advertises against the theoretical max (derived from
the size of on-disk structs and the block size (or i_data, if inline
extents).

Previously, we did not validate the number of entries. This could be
exploited for out-of-bounds reads and crashes.

Cc: Marvin Häuser 
Fixes: d9ceedca6c8f ("Ext4Pkg: Add Ext4Dxe driver.")
Reported-by: Savva Mitrofanov 
Signed-off-by: Pedro Falcato 
---
 Features/Ext4Pkg/Ext4Dxe/Extents.c | 47 +++---
 1 file changed, 30 insertions(+), 17 deletions(-)

diff --git a/Features/Ext4Pkg/Ext4Dxe/Extents.c 
b/Features/Ext4Pkg/Ext4Dxe/Extents.c
index 9e4364e50d99..66d085938549 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Extents.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Extents.c
@@ -1,7 +1,7 @@
 /** @file
   Extent related routines
 
-  Copyright (c) 2021 - 2022 Pedro Falcato All rights reserved.
+  Copyright (c) 2021 - 2023 Pedro Falcato All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -80,13 +80,15 @@ Ext4GetInoExtentHeader (
 /**
Checks if an extent header is valid.
@param[in]  Header Pointer to the EXT4_EXTENT_HEADER structure.
+   @param[in]  MaxEntries Maximum number of entries possible for this 
tree node.
 
@return TRUE if valid, FALSE if not.
 **/
 STATIC
 BOOLEAN
 Ext4ExtentHeaderValid (
-  IN CONST EXT4_EXTENT_HEADER  *Header
+  IN CONST EXT4_EXTENT_HEADER  *Header,
+  IN UINT16MaxEntries
   )
 {
   if (Header->eh_depth > EXT4_EXTENT_TREE_MAX_DEPTH) {
@@ -99,6 +101,18 @@ Ext4ExtentHeaderValid (
 return FALSE;
   }
 
+  if ((Header->eh_max > MaxEntries) || (Header->eh_entries > MaxEntries)) {
+DEBUG ((
+  DEBUG_ERROR,
+  "[ext4] Invalid extent header entries (extent header: %u max,"
+  " %u entries, theoretical max: %u) (larger than permitted)\n",
+  Header->eh_max,
+  Header->eh_entries,
+  MaxEntries
+  ));
+return FALSE;
+  }
+
   if (Header->eh_max < Header->eh_entries) {
 DEBUG ((
   DEBUG_ERROR,
@@ -212,6 +226,9 @@ Ext4ExtentIdxLeafBlock (
   return LShiftU64 (Index->ei_leaf_hi, 32) | Index->ei_leaf_lo;
 }
 
+// Results of sizeof(i_data) / sizeof(extent) - 1 = 4
+#define EXT4_NR_INLINE_EXTENTS  4
+
 /**
Retrieves an extent from an EXT4 inode.
@param[in]  Partition Pointer to the opened EXT4 partition.
@@ -237,7 +254,7 @@ Ext4GetExtent (
   EXT4_EXTENT_HEADER  *ExtHeader;
   EXT4_EXTENT_INDEX   *Index;
   EFI_STATUS  Status;
-  EXT4_BLOCK_NR   BlockNumber;
+  UINT32  MaxExtentsPerNode;
 
   Inode  = File->Inode;
   Ext= NULL;
@@ -275,12 +292,17 @@ Ext4GetExtent (
 
   ExtHeader = Ext4GetInoExtentHeader (Inode);
 
-  if (!Ext4ExtentHeaderValid (ExtHeader)) {
+  if (!Ext4ExtentHeaderValid (ExtHeader, EXT4_NR_INLINE_EXTENTS)) {
 return EFI_VOLUME_CORRUPTED;
   }
 
   CurrentDepth = ExtHeader->eh_depth;
 
+  // A single node fits into a single block, so we can only have (BlockSize / 
sizeof(EXT4_EXTENT)) - 1
+  // extents in a single node. Note the -1, because both leaf and internal 
node headers are 12 bytes,
+  // and so are individual entries.
+  MaxExtentsPerNode = (Partition->BlockSize / sizeof (EXT4_EXTENT)) - 1;
+
   while (ExtHeader->eh_depth != 0) {
 CurrentDepth--;
 // While depth != 0, we're traversing the tree itself and not any leaves
@@ -289,17 +311,7 @@ Ext4GetExtent (
 // Therefore, we can use binary search, and it's actually the standard for 
doing so
 // (see FreeBSD).
 
-Index   = Ext4BinsearchExtentIndex (ExtHeader, LogicalBlock);
-BlockNumber = Ext4ExtentIdxLeafBlock (Index);
-
-// Check that block isn't file hole
-if (BlockNumber == EXT4_BLOCK_FILE_HOLE) {
-  if (Buffer != NULL) {
-FreePool (Buffer);
-  }
-
-  return EFI_VOLUME_CORRUPTED;
-}
+Index = Ext4BinsearchExtentIndex (ExtHeader, LogicalBlock);
 
 if (Buffer == NULL) {
   Buffer = AllocatePool (Partition->BlockSize);
@@ -309,7 +321,8 @@ Ext4GetExtent (
 }
 
 // Read the leaf block onto the previously-allocated buffer.
-Status = Ext4ReadBlocks (Partition, Buffer, 1, BlockNumber);
+
+Status = Ext4ReadBlocks (Partition, Buffer, 1, Ext4ExtentIdxLeafBlock 
(Index));
 if (EFI_ERROR (Status)) {
   FreePool (Buffer);
   return Status;
@@ -317,7 +330,7 @@ Ext4GetExtent (
 
 ExtHeader = Buffer;
 
-if (!Ext4ExtentHeaderValid (ExtHeader)) {
+if (!Ext4ExtentHeaderValid (ExtHeader, MaxExtentsPerNode)) {
   FreePool (Buffer);
   return EFI_VOLUME_CORRUPTED;
 }
-- 
2.40.1



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

[edk2-devel] [PATCH 2/2] Ext4Pkg: Advertise CSUM_SEED as supported

2023-05-08 Thread Pedro Falcato
We had added support for CSUM_SEED but accidentally forgot to advertise
it in gSupportedIncompatFeat. This made it (erroneously) impossible to
mount CSUM_SEED filesystems.

Detected by attempting to mount a relatively new mkfs.ext4'd filesystem.

Cc: Marvin Häuser 
Signed-off-by: Pedro Falcato 
---
 Features/Ext4Pkg/Ext4Dxe/Superblock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Features/Ext4Pkg/Ext4Dxe/Superblock.c 
b/Features/Ext4Pkg/Ext4Dxe/Superblock.c
index 3f56de93c105..604925b582c1 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Superblock.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Superblock.c
@@ -1,7 +1,7 @@
 /** @file
   Superblock managing routines
 
-  Copyright (c) 2021 - 2022 Pedro Falcato All rights reserved.
+  Copyright (c) 2021 - 2023 Pedro Falcato All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -18,7 +18,7 @@ STATIC CONST UINT32  gSupportedIncompatFeat =
   EXT4_FEATURE_INCOMPAT_64BIT | EXT4_FEATURE_INCOMPAT_DIRDATA |
   EXT4_FEATURE_INCOMPAT_FLEX_BG | EXT4_FEATURE_INCOMPAT_FILETYPE |
   EXT4_FEATURE_INCOMPAT_EXTENTS | EXT4_FEATURE_INCOMPAT_LARGEDIR |
-  EXT4_FEATURE_INCOMPAT_MMP | EXT4_FEATURE_INCOMPAT_RECOVER;
+  EXT4_FEATURE_INCOMPAT_MMP | EXT4_FEATURE_INCOMPAT_RECOVER | 
EXT4_FEATURE_INCOMPAT_CSUM_SEED;
 
 // Future features that may be nice additions in the future:
 // 1) Btree support: Required for write support and would speed up lookups in 
large directories.
-- 
2.40.1



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




回复: [edk2-devel] [PATCH 1/1] Remove bashisms from edksetup.sh and BaseTools/BuildEnv

2023-05-08 Thread gaoliming via groups.io
Reviewed-by: Liming Gao 

> -邮件原件-
> 发件人: devel@edk2.groups.io  代表 Pedro Falcato
> 发送时间: 2023年5月7日 11:51
> 收件人: Rebecca Cran 
> 抄送: devel@edk2.groups.io; Liming Gao ; Bob
> Feng ; Yuwei Chen ; Andrew
> Fish ; Leif Lindholm ;
> Michael D Kinney 
> 主题: Re: [edk2-devel] [PATCH 1/1] Remove bashisms from edksetup.sh and
> BaseTools/BuildEnv
> 
> On Sun, May 7, 2023 at 4:31 AM Rebecca Cran  wrote:
> >
> > On 5/6/23 15:48, Pedro Falcato wrote:
> > >
> > > My local installations of Net (latest stable) and FreeBSD (13.1 with a
> > > hacked-up kernel) do not have a python3 symlink.
> > >
> > > I'm slightly worried that this breaks something. I know requiring
> > > whereis isn't ideal, but I'm fairly sure it did handle this situation?
> >
> > I uninstalled the python and python3 packages, leaving only python39.
> >
> > I got the following results on edk2 master:
> >
> >
> > [bcran@maxamd ~/src/uefi/edk2]$ whereis python3
> > python3:
> >
> > [bcran@maxamd ~/src/uefi/edk2]$ ls /usr/local/bin | grep python
> >
> > python3.9
> >
> > python3.9-config
> >
> > [bcran@maxamd ~/src/uefi/edk2]$ . edksetup.sh
> > Using EDK2 in-source Basetools
> > WORKSPACE: /home/bcran/src/uefi/edk2
> > EDK_TOOLS_PATH: /home/bcran/src/uefi/edk2/BaseTools
> >
> > CONF_PATH: /home/bcran/src/uefi/edk2/Conf
> >
> >
> > [bcran@maxamd ~/src/uefi/edk2]$ echo $PYTHON_COMMAND
> >
> > [bcran@maxamd ~/src/uefi/edk2]$ gmake -C BaseTools/ -j16
> > gmake: Entering directory '/usr/home/bcran/src/uefi/edk2/BaseTools'
> > gmake -C Source/C
> > gmake -C Source/Python
> > gmake[1]: Entering directory
> > '/usr/home/bcran/src/uefi/edk2/BaseTools/Source/C'
> > gmake[1]: Entering directory
> > '/usr/home/bcran/src/uefi/edk2/BaseTools/Source/Python'
> > gmake[1]: Nothing to be done for 'all'.
> > gmake[1]: Leaving directory
> > '/usr/home/bcran/src/uefi/edk2/BaseTools/Source/Python'
> > Attempting to detect HOST_ARCH from 'uname -m': amd64
> > Detected HOST_ARCH of X64 using uname.
> > mkdir -p .
> > mkdir ./libs
> > mkdir ./bin
> > gmake -C VfrCompile VfrLexer.h
> > gmake -C Common
> > gmake[2]: Entering directory
> > '/usr/home/bcran/src/uefi/edk2/BaseTools/Source/C/VfrCompile'
> > gmake[2]: Entering directory
> > '/usr/home/bcran/src/uefi/edk2/BaseTools/Source/C/Common'
> >
> > .
> >
> > Finished building BaseTools C Tools with HOST_ARCH=X64
> > gmake[1]: Leaving directory
> > '/usr/home/bcran/src/uefi/edk2/BaseTools/Source/C'
> > gmake -C Tests
> > gmake[1]: Entering directory
> '/usr/home/bcran/src/uefi/edk2/BaseTools/Tests'
> > /bin/sh: python: not found
> > gmake[1]: *** [GNUmakefile:11: test] Error 127
> > gmake[1]: Leaving directory
> '/usr/home/bcran/src/uefi/edk2/BaseTools/Tests'
> > gmake: *** [GNUmakefile:19: Tests] Error 2
> > gmake: Leaving directory '/usr/home/bcran/src/uefi/edk2/BaseTools'
> > ...
> >
> > [bcran@maxamd ~/src/uefi/edk2]$ build -p OvmfPkg/OvmfPkgX64.dsc -a
> X64
> > -t GCC -b RELEASE
> > /home/bcran/src/uefi/edk2/BaseTools/BinWrappers/PosixLike/build: line
> > 14: exec: python: not found
> 
> Thank you for your testing. I asked around and came to the conclusion
> it's a FreeBSD "meta-package" that lots of people don't have
> installed.
> 
> If this doesn't break anything, I'm ok with it. Although there should
> really be a better solution, the status quo sucks.
> 
> That said, the rest of the POSIX sh conversion looks ok to me.
> 
> Acked-by: Pedro Falcato 
> 
> Although there's a small fixup you may want to do at
>>echo "source $SCRIPTNAME"
> Since source is not POSIX, but '.' is.
> 
> --
> Pedro
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104308): https://edk2.groups.io/g/devel/message/104308
Mute This Topic: https://groups.io/mt/98774755/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/2] Ext4Pkg: Improve extent node validation on the number of entries

2023-05-08 Thread Pedro Falcato
Improve the extent tree node validation by validating the number of
entries the node advertises against the theoretical max (derived from
the size of on-disk structs and the block size (or i_data, if inline
extents).

Previously, we did not validate the number of entries. This could be
exploited for out-of-bounds reads and crashes.

Cc: Marvin Häuser 
Fixes: d9ceedca6c8f ("Ext4Pkg: Add Ext4Dxe driver.")
Reported-by: Savva Mitrofanov 
Signed-off-by: Pedro Falcato 
---
v2:
Accidentally based my previous patch on the wrong version of Extents.c, which 
accidentally undid some previous changes.

 Features/Ext4Pkg/Ext4Dxe/Extents.c | 32 ++
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/Features/Ext4Pkg/Ext4Dxe/Extents.c 
b/Features/Ext4Pkg/Ext4Dxe/Extents.c
index 9e4364e50d99..2d86a7abdedb 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Extents.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Extents.c
@@ -1,7 +1,7 @@
 /** @file
   Extent related routines
 
-  Copyright (c) 2021 - 2022 Pedro Falcato All rights reserved.
+  Copyright (c) 2021 - 2023 Pedro Falcato All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -80,13 +80,15 @@ Ext4GetInoExtentHeader (
 /**
Checks if an extent header is valid.
@param[in]  Header Pointer to the EXT4_EXTENT_HEADER structure.
+   @param[in]  MaxEntries Maximum number of entries possible for this 
tree node.
 
@return TRUE if valid, FALSE if not.
 **/
 STATIC
 BOOLEAN
 Ext4ExtentHeaderValid (
-  IN CONST EXT4_EXTENT_HEADER  *Header
+  IN CONST EXT4_EXTENT_HEADER  *Header,
+  IN UINT16MaxEntries
   )
 {
   if (Header->eh_depth > EXT4_EXTENT_TREE_MAX_DEPTH) {
@@ -99,6 +101,18 @@ Ext4ExtentHeaderValid (
 return FALSE;
   }
 
+  if ((Header->eh_max > MaxEntries) || (Header->eh_entries > MaxEntries)) {
+DEBUG ((
+  DEBUG_ERROR,
+  "[ext4] Invalid extent header entries (extent header: %u max,"
+  " %u entries, theoretical max: %u) (larger than permitted)\n",
+  Header->eh_max,
+  Header->eh_entries,
+  MaxEntries
+  ));
+return FALSE;
+  }
+
   if (Header->eh_max < Header->eh_entries) {
 DEBUG ((
   DEBUG_ERROR,
@@ -212,6 +226,9 @@ Ext4ExtentIdxLeafBlock (
   return LShiftU64 (Index->ei_leaf_hi, 32) | Index->ei_leaf_lo;
 }
 
+// Results of sizeof(i_data) / sizeof(extent) - 1 = 4
+#define EXT4_NR_INLINE_EXTENTS  4
+
 /**
Retrieves an extent from an EXT4 inode.
@param[in]  Partition Pointer to the opened EXT4 partition.
@@ -237,6 +254,7 @@ Ext4GetExtent (
   EXT4_EXTENT_HEADER  *ExtHeader;
   EXT4_EXTENT_INDEX   *Index;
   EFI_STATUS  Status;
+  UINT32  MaxExtentsPerNode;
   EXT4_BLOCK_NR   BlockNumber;
 
   Inode  = File->Inode;
@@ -275,12 +293,17 @@ Ext4GetExtent (
 
   ExtHeader = Ext4GetInoExtentHeader (Inode);
 
-  if (!Ext4ExtentHeaderValid (ExtHeader)) {
+  if (!Ext4ExtentHeaderValid (ExtHeader, EXT4_NR_INLINE_EXTENTS)) {
 return EFI_VOLUME_CORRUPTED;
   }
 
   CurrentDepth = ExtHeader->eh_depth;
 
+  // A single node fits into a single block, so we can only have (BlockSize / 
sizeof(EXT4_EXTENT)) - 1
+  // extents in a single node. Note the -1, because both leaf and internal 
node headers are 12 bytes,
+  // and so are individual entries.
+  MaxExtentsPerNode = (Partition->BlockSize / sizeof (EXT4_EXTENT)) - 1;
+
   while (ExtHeader->eh_depth != 0) {
 CurrentDepth--;
 // While depth != 0, we're traversing the tree itself and not any leaves
@@ -309,6 +332,7 @@ Ext4GetExtent (
 }
 
 // Read the leaf block onto the previously-allocated buffer.
+
 Status = Ext4ReadBlocks (Partition, Buffer, 1, BlockNumber);
 if (EFI_ERROR (Status)) {
   FreePool (Buffer);
@@ -317,7 +341,7 @@ Ext4GetExtent (
 
 ExtHeader = Buffer;
 
-if (!Ext4ExtentHeaderValid (ExtHeader)) {
+if (!Ext4ExtentHeaderValid (ExtHeader, MaxExtentsPerNode)) {
   FreePool (Buffer);
   return EFI_VOLUME_CORRUPTED;
 }
-- 
2.40.1



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




[edk2-devel] [PATCH v2 2/2] Ext4Pkg: Advertise CSUM_SEED as supported

2023-05-08 Thread Pedro Falcato
We had added support for CSUM_SEED but accidentally forgot to advertise
it in gSupportedIncompatFeat. This made it (erroneously) impossible to
mount CSUM_SEED filesystems.

Detected by attempting to mount a relatively new mkfs.ext4'd filesystem.

Cc: Marvin Häuser 
Signed-off-by: Pedro Falcato 
---
 Features/Ext4Pkg/Ext4Dxe/Superblock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Features/Ext4Pkg/Ext4Dxe/Superblock.c 
b/Features/Ext4Pkg/Ext4Dxe/Superblock.c
index 3f56de93c105..604925b582c1 100644
--- a/Features/Ext4Pkg/Ext4Dxe/Superblock.c
+++ b/Features/Ext4Pkg/Ext4Dxe/Superblock.c
@@ -1,7 +1,7 @@
 /** @file
   Superblock managing routines
 
-  Copyright (c) 2021 - 2022 Pedro Falcato All rights reserved.
+  Copyright (c) 2021 - 2023 Pedro Falcato All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
@@ -18,7 +18,7 @@ STATIC CONST UINT32  gSupportedIncompatFeat =
   EXT4_FEATURE_INCOMPAT_64BIT | EXT4_FEATURE_INCOMPAT_DIRDATA |
   EXT4_FEATURE_INCOMPAT_FLEX_BG | EXT4_FEATURE_INCOMPAT_FILETYPE |
   EXT4_FEATURE_INCOMPAT_EXTENTS | EXT4_FEATURE_INCOMPAT_LARGEDIR |
-  EXT4_FEATURE_INCOMPAT_MMP | EXT4_FEATURE_INCOMPAT_RECOVER;
+  EXT4_FEATURE_INCOMPAT_MMP | EXT4_FEATURE_INCOMPAT_RECOVER | 
EXT4_FEATURE_INCOMPAT_CSUM_SEED;
 
 // Future features that may be nice additions in the future:
 // 1) Btree support: Required for write support and would speed up lookups in 
large directories.
-- 
2.40.1



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




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

2023-05-08 Thread Group Notification
*Reminder: TianoCore Bug Triage - APAC / NAMO*

*When:*
Tuesday, May 9, 2023
6:30pm to 7:30pm
(UTC-07:00) America/Los Angeles

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

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

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

*Description:*

TianoCore Bug Triage - APAC / NAMO

Hosted by Liming Gao



Microsoft Teams meeting

*Join on your computer or mobile app*

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

*Join with a video conferencing device*

te...@conf.intel.com

Video Conference ID: 116 062 094 0

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

*Or call in (audio only)*

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

Phone Conference ID: 774 638 21#

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

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


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




Re: [edk2-devel] [PATCH] ShellPkg/SmbiosView: type 45 and type 46 support.

2023-05-08 Thread Simon Wang via groups.io
Hi @Ray Ni ( ray.ni@... ) , @Zhichao Gao ( zhichao.gao@... ) ,

Could you please help to review this change?

Thanks,

Simon


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104313): https://edk2.groups.io/g/devel/message/104313
Mute This Topic: https://groups.io/mt/98677252/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-08 Thread Ni, Ray
All,
Can you check if the meeting time is ok for you?

It will be in this week:
* PDT Thursday 07:00
* Paris Thursday 16:00
* Shanghai Thursday 22:00

Thanks,
Ray


> -Original Message-
> From: Kinney, Michael D 
> Sent: Tuesday, May 2, 2023 1:59 AM
> To: Oliver Smith-Denny ; Ard Biesheuvel
> ; devel@edk2.groups.io
> Cc: Ni, Ray ; Leif Lindholm ;
> Ard Biesheuvel ; Sami Mujawar
> ; Michael Kubacki
> ; Sean Brogan
> ; Kinney, Michael D
> 
> Subject: RE: [edk2-devel] [PATCH v1 1/1] ArmPkg: CpuDxe: Sync GCD
> Capabilities With Page Table Attributes
> 
> Thanks for the quick feedback.  Ray is out this week.  I will work with Ray to
> arrange a time slot, hopefully next week that works for everyone.
> 
> Mike
> 
> > -Original Message-
> > From: Oliver Smith-Denny 
> > Sent: Monday, May 1, 2023 10:53 AM
> > To: Ard Biesheuvel ; devel@edk2.groups.io; Kinney,
> > Michael D 
> > Cc: Ni, Ray ; Leif Lindholm ;
> > Ard Biesheuvel ; Sami Mujawar
> > ; Michael Kubacki
> > ; Sean Brogan
> > 
> > Subject: Re: [edk2-devel] [PATCH v1 1/1] ArmPkg: CpuDxe: Sync GCD
> > Capabilities With Page Table Attributes
> >
> > On 5/1/2023 10:50 AM, Ard Biesheuvel wrote:
> > > On Mon, 1 May 2023 at 19:49, Michael D Kinney
> > >  wrote:
> > >>
> > >> Hi,
> > >>
> > >> These UEFI Memory Map, GCD, and Page Table interactions can be
> > complex and I
> > >> agree there are some UEFI/PI spec clarifications that may help.
> > >>
> > >> Ray hosts a TianoCore design meeting when needed.  Do you think a
> > meeting with
> > >> an open discussion on these topics would help, or do we prefer to
> > continue with
> > >> email discussions?
> > >>
> > >
> > > I'll gladly join a call to discuss this if we can find a timeslot that
> > > works for everyone in terms of time zone. (I'm on Paris time)
> >
> > I also think a call would be great, I certainly would benefit from
> > learning more here :). I'm sure various members of my team would
> > be interested in joining, happy to be flexible on timeslot (we are
> > generally in PST).
> >
> > Thanks,
> > Oliver


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


BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 16.0 MIMEDIR//EN
VERSION:2.0
METHOD:REQUEST
X-MS-OLK-FORCEINSPECTOROPEN:TRUE
BEGIN:VTIMEZONE
TZID:China Standard Time
BEGIN:STANDARD
DTSTART:16010101T00
TZOFFSETFROM:+0800
TZOFFSETTO:+0800
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
CLASS:PUBLIC
CREATED:20230509T013045Z
DESCRIPTION: \n
	 \nMicrosoft Teams meeting \nJoin on your computer\, m
	obile app or room device \nClick here to join the meeting   \nMeeting ID: 256 188 860 359 \nPasscode: yJZsmm \nDownload Teams
	   | Join on
	 the web  \nJoin
	 with a video conferencing device \nte...@conf.intel.com \nVideo Conferenc
	e ID: 113 587 139 9 \nAlternate VTC instructions   \nOr cal
	l in (audio only) \n+86 10 5697 1340\,\,703118725# China\, 北京 (Beijing) \nPhone Conference ID: 703 118 725#
	 \nFind a local number   | Reset PIN   \nLearn More   | Meeting options   \n
	 \n \n
DTEND;TZID="China Standard Time":20230511T23
DTSTAMP:20230509T013045Z
DTSTART;TZID="China Standard Time":20230511T22
LAST-MODIFIED:20230509T013045Z
LOCATION:Microsoft Teams Meeting
ORGANIZER;CN="Ni, Ray":mailto:ray...@intel.com
PRIORITY:5
SEQUENCE:0
SUMMARY;LANGUAGE=en-us:UEFI Memory Map\, GCD\, Page Table discussion - ARM/
	X86
TRANSP:OPAQUE
UID:04008200E00074C5B7101A82E00820C8B5925882D901000
	0100043BF7D9269E0E24899EAE72E7F953601
X-ALT-DESC;FMTTYPE=text/html:\nhttp://schemas.microsoft.com/office/200
	4/12/omml" xmlns="http://www.w3.org/TR/REC-ht

Re: [edk2-devel] [PATCH v1 1/1] ArmPkg: CpuDxe: Sync GCD Capabilities With Page Table Attributes

2023-05-08 Thread Michael D Kinney
I would prefer next week as well.

Mike

> -Original Message-
> From: Oliver Smith-Denny 
> Sent: Monday, May 8, 2023 7:03 PM
> To: Ni, Ray ; Kinney, Michael D
> ; Ard Biesheuvel ;
> devel@edk2.groups.io
> Cc: Leif Lindholm ; Ard Biesheuvel
> ; Sami Mujawar ;
> Michael Kubacki ; Sean Brogan
> 
> Subject: Re: [edk2-devel] [PATCH v1 1/1] ArmPkg: CpuDxe: Sync GCD
> Capabilities With Page Table Attributes
> 
> Hi Ray,
> 
> Thanks for setting up a meeting on this! We have some
> conflicts on our side for this week, does it work
> for everyone to have it the following Thursday
> (May 18th)?
> 
> The time works for us.
> 
> Thanks,
> Oliver
> 
> On 5/8/2023 6:35 PM, Ni, Ray wrote:
> > All,
> > Can you check if the meeting time is ok for you?
> >
> > It will be in this week:
> > * PDT Thursday 07:00
> > * Paris Thursday 16:00
> > * Shanghai Thursday 22:00
> >
> > Thanks,
> > Ray
> >
> >
> >> -Original Message-
> >> From: Kinney, Michael D 
> >> Sent: Tuesday, May 2, 2023 1:59 AM
> >> To: Oliver Smith-Denny ; Ard Biesheuvel
> >> ; devel@edk2.groups.io
> >> Cc: Ni, Ray ; Leif Lindholm
> ;
> >> Ard Biesheuvel ; Sami Mujawar
> >> ; Michael Kubacki
> >> ; Sean Brogan
> >> ; Kinney, Michael D
> >> 
> >> Subject: RE: [edk2-devel] [PATCH v1 1/1] ArmPkg: CpuDxe: Sync GCD
> >> Capabilities With Page Table Attributes
> >>
> >> Thanks for the quick feedback.  Ray is out this week.  I will work with 
> >> Ray to
> >> arrange a time slot, hopefully next week that works for everyone.
> >>
> >> Mike
> >>
> >>> -Original Message-
> >>> From: Oliver Smith-Denny 
> >>> Sent: Monday, May 1, 2023 10:53 AM
> >>> To: Ard Biesheuvel ; devel@edk2.groups.io; Kinney,
> >>> Michael D 
> >>> Cc: Ni, Ray ; Leif Lindholm
> ;
> >>> Ard Biesheuvel ; Sami Mujawar
> >>> ; Michael Kubacki
> >>> ; Sean Brogan
> >>> 
> >>> Subject: Re: [edk2-devel] [PATCH v1 1/1] ArmPkg: CpuDxe: Sync GCD
> >>> Capabilities With Page Table Attributes
> >>>
> >>> On 5/1/2023 10:50 AM, Ard Biesheuvel wrote:
>  On Mon, 1 May 2023 at 19:49, Michael D Kinney
>   wrote:
> >
> > Hi,
> >
> > These UEFI Memory Map, GCD, and Page Table interactions can be
> >>> complex and I
> > agree there are some UEFI/PI spec clarifications that may help.
> >
> > Ray hosts a TianoCore design meeting when needed.  Do you think a
> >>> meeting with
> > an open discussion on these topics would help, or do we prefer to
> >>> continue with
> > email discussions?
> >
> 
>  I'll gladly join a call to discuss this if we can find a timeslot that
>  works for everyone in terms of time zone. (I'm on Paris time)
> >>>
> >>> I also think a call would be great, I certainly would benefit from
> >>> learning more here :). I'm sure various members of my team would
> >>> be interested in joining, happy to be flexible on timeslot (we are
> >>> generally in PST).
> >>>
> >>> Thanks,
> >>> Oliver


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




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

2023-05-08 Thread Rebecca Cran
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(-)

-- 
2.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104317): https://edk2.groups.io/g/devel/message/104317
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]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [edk2-stable202305 PATCH 1/3] BaseTools: Update toolsetup.bat to not use BASETOOLS_PYTHON_SOURCE

2023-05-08 Thread Rebecca Cran
The BASETOOLS_PYTHON_SOURCE environment variable is only used temporarily to
set PYTHONPATH. Since it doesn't help improve clarity, remove it.

While here, make sure we set PYTHONPATH when we're using Pip BaseTools
so that build etc. can be found.

Signed-off-by: Rebecca Cran 
---
 BaseTools/toolsetup.bat | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
index dc6288effd7d..85104aa224da 100755
--- a/BaseTools/toolsetup.bat
+++ b/BaseTools/toolsetup.bat
@@ -371,14 +371,13 @@ if %ERRORLEVEL% EQU 0 (
   @echo Using EDK2 in-source Basetools
   if defined BASETOOLS_PYTHON_SOURCE goto print_python_info
   set "PATH=%BASE_TOOLS_PATH%\BinWrappers\WindowsLike;%PATH%"
-  set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python
-  set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%
+  set PYTHONPATH=%BASE_TOOLS_PATH%\Source\Python;%PYTHONPATH%
   goto print_python_info
 
 :use_pip_basetools
   @echo Using Pip Basetools
   set "PATH=%BASE_TOOLS_PATH%\BinPipWrappers\WindowsLike;%PATH%"
-  set BASETOOLS_PYTHON_SOURCE=edk2basetools
+  set PYTHONPATH=%BASE_TOOLS_PATH%\Source\Python;%PYTHONPATH%
   goto print_python_info
 
 :print_python_info
-- 
2.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104318): https://edk2.groups.io/g/devel/message/104318
Mute This Topic: https://groups.io/mt/98777505/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 2/3] BaseTools: only print the environment once in toolsetup.bat

2023-05-08 Thread Rebecca Cran
Avoid printing %PATH% twice: move the printing of the environment down
to print_python_info.

Signed-off-by: Rebecca Cran 
---
 BaseTools/toolsetup.bat | 35 +---
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
index 85104aa224da..9521f67c024e 100755
--- a/BaseTools/toolsetup.bat
+++ b/BaseTools/toolsetup.bat
@@ -250,24 +250,6 @@ if NOT exist %CONF_PATH%\build_rule.txt (
   if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\build_rule.template 
%CONF_PATH%\build_rule.txt > nul
 )
 
-echo   PATH  = %PATH%
-echo.
-if defined WORKSPACE (
-  echo  WORKSPACE  = %WORKSPACE%
-)
-if defined PACKAGES_PATH (
-  echo  PACKAGES_PATH  = %PACKAGES_PATH%
-)
-echo EDK_TOOLS_PATH  = %EDK_TOOLS_PATH%
-if defined BASE_TOOLS_PATH (
-  echo BASE_TOOLS_PATH = %BASE_TOOLS_PATH%
-)
-if defined EDK_TOOLS_BIN (
-  echo  EDK_TOOLS_BIN  = %EDK_TOOLS_BIN%
-)
-echo  CONF_PATH  = %CONF_PATH%
-echo.
-
 :skip_reconfig
 
 @REM
@@ -381,7 +363,22 @@ if %ERRORLEVEL% EQU 0 (
   goto print_python_info
 
 :print_python_info
-  echoPATH = %PATH%
+  echo   PATH  = %PATH%
+  echo.
+  if defined WORKSPACE (
+echo  WORKSPACE  = %WORKSPACE%
+  )
+  if defined PACKAGES_PATH (
+echo  PACKAGES_PATH  = %PACKAGES_PATH%
+  )
+  echo EDK_TOOLS_PATH  = %EDK_TOOLS_PATH%
+  if defined BASE_TOOLS_PATH (
+echo BASE_TOOLS_PATH = %BASE_TOOLS_PATH%
+  )
+  if defined EDK_TOOLS_BIN (
+echo  EDK_TOOLS_BIN  = %EDK_TOOLS_BIN%
+  )
+  echo  CONF_PATH  = %CONF_PATH%
   echo  PYTHON_COMMAND = %PYTHON_COMMAND%
   echo  PYTHONPATH = %PYTHONPATH%
   echo.
-- 
2.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104319): https://edk2.groups.io/g/devel/message/104319
Mute This Topic: https://groups.io/mt/98777506/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] Remove bashisms from edksetup.sh and BaseTools/BuildEnv

2023-05-08 Thread Rebecca Cran

I'd like this to go in for the edk2-stable202305 tag.


--

Rebecca Cran


On 5/8/23 18:53, gaoliming wrote:

Reviewed-by: Liming Gao 


-邮件原件-
发件人: devel@edk2.groups.io  代表 Pedro Falcato
发送时间: 2023年5月7日 11:51
收件人: Rebecca Cran 
抄送: devel@edk2.groups.io; Liming Gao ; Bob
Feng ; Yuwei Chen ; Andrew
Fish ; Leif Lindholm ;
Michael D Kinney 
主题: Re: [edk2-devel] [PATCH 1/1] Remove bashisms from edksetup.sh and
BaseTools/BuildEnv

On Sun, May 7, 2023 at 4:31 AM Rebecca Cran  wrote:

On 5/6/23 15:48, Pedro Falcato wrote:

My local installations of Net (latest stable) and FreeBSD (13.1 with a
hacked-up kernel) do not have a python3 symlink.

I'm slightly worried that this breaks something. I know requiring
whereis isn't ideal, but I'm fairly sure it did handle this situation?

I uninstalled the python and python3 packages, leaving only python39.

I got the following results on edk2 master:


[bcran@maxamd ~/src/uefi/edk2]$ whereis python3
python3:

[bcran@maxamd ~/src/uefi/edk2]$ ls /usr/local/bin | grep python

python3.9

python3.9-config

[bcran@maxamd ~/src/uefi/edk2]$ . edksetup.sh
Using EDK2 in-source Basetools
WORKSPACE: /home/bcran/src/uefi/edk2
EDK_TOOLS_PATH: /home/bcran/src/uefi/edk2/BaseTools

CONF_PATH: /home/bcran/src/uefi/edk2/Conf


[bcran@maxamd ~/src/uefi/edk2]$ echo $PYTHON_COMMAND

[bcran@maxamd ~/src/uefi/edk2]$ gmake -C BaseTools/ -j16
gmake: Entering directory '/usr/home/bcran/src/uefi/edk2/BaseTools'
gmake -C Source/C
gmake -C Source/Python
gmake[1]: Entering directory
'/usr/home/bcran/src/uefi/edk2/BaseTools/Source/C'
gmake[1]: Entering directory
'/usr/home/bcran/src/uefi/edk2/BaseTools/Source/Python'
gmake[1]: Nothing to be done for 'all'.
gmake[1]: Leaving directory
'/usr/home/bcran/src/uefi/edk2/BaseTools/Source/Python'
Attempting to detect HOST_ARCH from 'uname -m': amd64
Detected HOST_ARCH of X64 using uname.
mkdir -p .
mkdir ./libs
mkdir ./bin
gmake -C VfrCompile VfrLexer.h
gmake -C Common
gmake[2]: Entering directory
'/usr/home/bcran/src/uefi/edk2/BaseTools/Source/C/VfrCompile'
gmake[2]: Entering directory
'/usr/home/bcran/src/uefi/edk2/BaseTools/Source/C/Common'

.

Finished building BaseTools C Tools with HOST_ARCH=X64
gmake[1]: Leaving directory
'/usr/home/bcran/src/uefi/edk2/BaseTools/Source/C'
gmake -C Tests
gmake[1]: Entering directory

'/usr/home/bcran/src/uefi/edk2/BaseTools/Tests'

/bin/sh: python: not found
gmake[1]: *** [GNUmakefile:11: test] Error 127
gmake[1]: Leaving directory

'/usr/home/bcran/src/uefi/edk2/BaseTools/Tests'

gmake: *** [GNUmakefile:19: Tests] Error 2
gmake: Leaving directory '/usr/home/bcran/src/uefi/edk2/BaseTools'
...

[bcran@maxamd ~/src/uefi/edk2]$ build -p OvmfPkg/OvmfPkgX64.dsc -a

X64

-t GCC -b RELEASE
/home/bcran/src/uefi/edk2/BaseTools/BinWrappers/PosixLike/build: line
14: exec: python: not found

Thank you for your testing. I asked around and came to the conclusion
it's a FreeBSD "meta-package" that lots of people don't have
installed.

If this doesn't break anything, I'm ok with it. Although there should
really be a better solution, the status quo sucks.

That said, the rest of the POSIX sh conversion looks ok to me.

Acked-by: Pedro Falcato 

Although there's a small fixup you may want to do at
>echo "source $SCRIPTNAME"
Since source is not POSIX, but '.' is.

--
Pedro










-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104320): https://edk2.groups.io/g/devel/message/104320
Mute This Topic: https://groups.io/mt/98774755/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] CryptoPkg: Delete CLANG35 and CLANG38 build flags; add CLANGDWARF flags

2023-05-08 Thread Rebecca Cran

Could someone from CryptoPkg add a "Reviewed-by" tag please?

I'd like this to go into the upcoming edk2-stable202305 release.


--
Rebecca Cran


On 5/5/23 07:43, Rebecca Cran wrote:

Since CLANG35 and CLANG38 toolchains have been deleted from
tools_def.template, delete the build flags for them from CryptoPkg.

Since CLANGDWARF has replaced CLANG38, add build flags for it to the
CryptoPkg .inf files.

Signed-off-by: Rebecca Cran 
---
  CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf | 3 +--
  CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf  | 3 +--
  CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf  | 3 +--
  CryptoPkg/Library/BaseCryptLib/SecCryptLib.inf  | 3 +--
  CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf  | 3 +--
  CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf | 3 +--
  CryptoPkg/Library/OpensslLib/OpensslLib.inf | 3 +--
  CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf| 3 +--
  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf   | 3 +--
  CryptoPkg/Library/OpensslLib/OpensslLibFull.inf | 3 +--
  CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf| 3 +--
  11 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
index 5be1724f0852..07b984869629 100644
--- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
@@ -110,8 +110,7 @@ [BuildOptions]
#
# suppress the following warnings so we do not break the build with 
warnings-as-errors:
#
-  GCC:*_CLANG35_*_CC_FLAGS = -std=c99
-  GCC:*_CLANG38_*_CC_FLAGS = -std=c99
+  GCC:*_CLANGDWARF_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
  
XCODE:*_*_*_CC_FLAGS = -std=c99

diff --git a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
index 66261138a00b..d10c83b53c09 100644
--- a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
@@ -97,8 +97,7 @@ [BuildOptions]
#
# suppress the following warnings so we do not break the build with 
warnings-as-errors:
#
-  GCC:*_CLANG35_*_CC_FLAGS = -std=c99
-  GCC:*_CLANG38_*_CC_FLAGS = -std=c99
+  GCC:*_CLANGDWARF_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
  
XCODE:*_*_*_CC_FLAGS = -std=c99

diff --git a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
index 07dbc0e7a8bd..56b4f7306d30 100644
--- a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
@@ -106,8 +106,7 @@ [BuildOptions]
#
# suppress the following warnings so we do not break the build with 
warnings-as-errors:
#
-  GCC:*_CLANG35_*_CC_FLAGS = -std=c99
-  GCC:*_CLANG38_*_CC_FLAGS = -std=c99
+  GCC:*_CLANGDWARF_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
  
XCODE:*_*_*_CC_FLAGS = -std=c99

diff --git a/CryptoPkg/Library/BaseCryptLib/SecCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/SecCryptLib.inf
index 4ad59b7bbc59..e7801b24c9a0 100644
--- a/CryptoPkg/Library/BaseCryptLib/SecCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/SecCryptLib.inf
@@ -81,8 +81,7 @@ [BuildOptions]
#
# suppress the following warnings so we do not break the build with 
warnings-as-errors:
#
-  GCC:*_CLANG35_*_CC_FLAGS = -std=c99
-  GCC:*_CLANG38_*_CC_FLAGS = -std=c99
+  GCC:*_CLANGDWARF_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
  
XCODE:*_*_*_CC_FLAGS = -std=c99

diff --git a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
index ab1993087167..109e08377a2d 100644
--- a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
@@ -105,6 +105,5 @@ [BuildOptions]
  
XCODE:*_*_*_CC_FLAGS = -mmmx -msse -std=c99
  
-  GCC:*_CLANG35_*_CC_FLAGS = -std=c99

-  GCC:*_CLANG38_*_CC_FLAGS = -std=c99
+  GCC:*_CLANGDWARF_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
GCC:*_CLANGPDB_*_CC_FLAGS = -std=c99 -Wno-error=incompatible-pointer-types
diff --git a/CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf
index 80261794470f..c3d1d61e59c5 100644
--- a/CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/UnitTestHostBaseCryptLib.inf
@@ -78,8 +78,7 @@ [BuildOptions]
#
# suppress the following warnings so we do not break the build with 
warnings-as-errors:
   

Re: [edk2-devel] [edk2-redfish-client][PATCH 1/6] Tool/Redfish-Profile-Simulator: Update requirements.txt

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

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Monday, May 8, 2023 10:52 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> 
> Subject: [edk2-redfish-client][PATCH 1/6] Tool/Redfish-Profile-Simulator:
> Update requirements.txt
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Updates the Python module dependency for Redfish Profile Simulator.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> ---
>  Tools/Redfish-Profile-Simulator/requirements.txt | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Tools/Redfish-Profile-Simulator/requirements.txt
> b/Tools/Redfish-Profile-Simulator/requirements.txt
> index 88807d87..359a8144 100644
> --- a/Tools/Redfish-Profile-Simulator/requirements.txt
> +++ b/Tools/Redfish-Profile-Simulator/requirements.txt
> @@ -1,2 +1,5 @@
> +Werkzeug==0.16
> +Jinja2==3.0.3
> +itsdangerous==2.0.1
>  flask==1.1.1
>  pyOpenSSL
> --
> 2.17.1


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




Re: [edk2-devel] [edk2-redfish-client][PATCH 2/6] Tool/Redfish-Profile-Simulator: Update computer system schema version

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

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Monday, May 8, 2023 10:52 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> 
> Subject: [edk2-redfish-client][PATCH 2/6] Tool/Redfish-Profile-Simulator:
> Update computer system schema version
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Update mock-up file and use computer system schema version 1.5.0 in order
> to support Boot.BootOrder attribute.
> Update UUID of 2M220101SL for working with Redfish Profile Simulator.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> ---
>  .../redfish/v1/Systems/2M220100SL/index.json  | 2 +-
>  .../redfish/v1/Systems/2M220101SL/index.json  | 4 ++--
>  .../redfish/v1/Systems/2M220102SL/index.json  | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100S
> L/index.json b/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100S
> L/index.json
> index dbba6913..090fd2ed 100644
> --- a/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100S
> L/index.json
> +++ b/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfi
> +++ sh/v1/Systems/2M220100SL/index.json
> @@ -1,5 +1,5 @@
>  {
> -"@odata.type": "#ComputerSystem.v1_1_0.ComputerSystem",
> +"@odata.type": "#ComputerSystem.v1_5_0.ComputerSystem",
>  "Id": "2M220100SL",
>  "Name": "Catfish System",
>  "SystemType": "Physical",
> diff --git a/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101S
> L/index.json b/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101S
> L/index.json
> index 3147cb88..bc082d31 100644
> --- a/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101S
> L/index.json
> +++ b/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfi
> +++ sh/v1/Systems/2M220101SL/index.json
> @@ -1,5 +1,5 @@
>  {
> -"@odata.type": "#ComputerSystem.v1_1_0.ComputerSystem",
> +"@odata.type": "#ComputerSystem.v1_5_0.ComputerSystem",
>  "Id": "2M220101SL",
>  "Name": "Catfish System",
>  "SystemType": "Physical",
> @@ -10,7 +10,7 @@
>  "SKU": "",
>  "PartNumber": "",
>  "Description": "Catfish Implementation Recipe of simple scale-out
> monolithic server",
> -"UUID": "BADFACED-DEAD-BEEF-1313-131313131313",
> +"UUID": "25EF0280-EC82-42B0-8FB6-10ADCCC67C02",
>  "HostName": "catfishHostname",
>  "PowerState": "On",
>  "BiosVersion": "X00.1.2.3.4(build-23)", diff --git 
> a/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102S
> L/index.json b/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102S
> L/index.json
> index 49b2d25f..d9aa7bb1 100644
> --- a/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102S
> L/index.json
> +++ b/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfi
> +++ sh/v1/Systems/2M220102SL/index.json
> @@ -1,5 +1,5 @@
>  {
> -"@odata.type": "#ComputerSystem.v1_1_0.ComputerSystem",
> +"@odata.type": "#ComputerSystem.v1_5_0.ComputerSystem",
>  "Id": "2M220102SL",
>  "Name": "Catfish System",
>  "SystemType": "Physical",
> --
> 2.17.1


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




Re: [edk2-devel] [edk2-redfish-client][PATCH 3/6] Tool/Redfish-Profile-Simulator: Update patch method of computer system

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

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Monday, May 8, 2023 10:52 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> 
> Subject: [edk2-redfish-client][PATCH 3/6] Tool/Redfish-Profile-Simulator:
> Update patch method of computer system
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Remove attribute check during patch of computer system and return
> content-type with JSON format in HTTP header.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> ---
>  .../v1sim/resource.py |  4 ++-
>  .../v1sim/systems.py  | 28 +++
>  2 files changed, 13 insertions(+), 19 deletions(-)
> 
> diff --git a/Tools/Redfish-Profile-Simulator/v1sim/resource.py
> b/Tools/Redfish-Profile-Simulator/v1sim/resource.py
> index ca7541f1..e722d16a 100644
> --- a/Tools/Redfish-Profile-Simulator/v1sim/resource.py
> +++ b/Tools/Redfish-Profile-Simulator/v1sim/resource.py
> @@ -2,6 +2,7 @@
>  # Copyright Notice:
>  #
>  # Copyright (c) 2019, Intel Corporation. All rights reserved.
> +# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  #  # Copyright Notice:
> @@ -47,6 +48,7 @@ class RfResource:
>  try:
>  # SHA1 should generate well-behaved etags
>  response = flask.make_response(self.response)
> +response.mimetype = 'application/json'
>  etag = hashlib.sha1(self.response.encode('utf-8')).hexdigest()
>  response.set_etag(etag)
>  return response
> @@ -69,7 +71,7 @@ class RfResource:
>  else:
>  raise Exception("attribute %s not found" % key)
> 
> -resp = flask.Response(json.dumps(self.res_data,indent=4))
> +resp = flask.Response(json.dumps(self.res_data,indent=4),
> + mimetype="application/json")
>  return 0, 200, None, resp
> 
>  def post_resource(self, post_data):
> diff --git a/Tools/Redfish-Profile-Simulator/v1sim/systems.py
> b/Tools/Redfish-Profile-Simulator/v1sim/systems.py
> index de4b839a..6305a51e 100644
> --- a/Tools/Redfish-Profile-Simulator/v1sim/systems.py
> +++ b/Tools/Redfish-Profile-Simulator/v1sim/systems.py
> @@ -2,7 +2,7 @@
>  # Copyright Notice:
>  #
>  # Copyright (c) 2019, Intel Corporation. All rights reserved. -# (C)
> Copyright 2021 Hewlett Packard Enterprise Development LP
> +# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  #  # Copyright Notice:
> @@ -63,15 +63,7 @@ class RfSystemObj(RfResource):
>  self.components[item] = RfBootOptionCollection(base_path,
> os.path.join(rel_path, item), parent=self)
> 
>  def patch_resource(self, patch_data):
> -# first verify client didn't send us a property we cant patch
> -for key in patch_data.keys():
> -if key != "AssetTag" and key != "IndicatorLED" and key != "Boot" 
> and
> key != "BiosVersion":
> -return 4, 400, "Invalid Patch Property Sent", ""
> -elif key == "Boot":
> -for prop2 in patch_data["Boot"].keys():
> -if prop2 != "BootSourceOverrideEnabled" and prop2 !=
> "BootSourceOverrideTarget" and prop2 != "BootNext" and prop2 !=
> "BootOrder":
> -return 4, 400, "Invalid Patch Property Sent", ""
> -# now patch the valid properties sent
> +# patch the valid properties sent
>  if "AssetTag" in patch_data:
>  print("assetTag:{}".format(patch_data["AssetTag"]))
>  self.res_data['AssetTag'] = patch_data['AssetTag'] @@ -100,7 
> +92,7
> @@ class RfSystemObj(RfResource):
>  if "BootOrder" in boot_data:
>  self.res_data['Boot']['BootOrder'] = boot_data['BootOrder']
> 
> -resp = flask.Response(json.dumps(self.res_data,indent=4))
> +resp = flask.Response(json.dumps(self.res_data,indent=4),
> + mimetype="application/json")
>  return 0, 200, None, resp
> 
>  def reset_resource(self, reset_data):
> @@ -150,7 +142,7 @@ class RfMemoryCollection(RfCollection):
>  post_data["@odata.etag"] = etag_str
>  self.elements[str(newMemoryIdx)] = post_data
> 
> -resp = flask.Response(json.dumps(post_data,indent=4))
> +resp = flask.Response(json.dumps(post_data,indent=4),
> + mimetype="application/json")
>  resp.headers["Location"] = newMemoryUrl
>  resp.headers["ETag"] = etag_str
> 
> @@ -163,7 +155,7 @@ class RfMemoryCollection(RfCollection):
>  patch_data["@odata.etag"] = etag_str
> 
>  self.elements[str(Idx)] = {**self.elements[str(Idx)], **patch_data}
> -resp = flask.Response(json.dumps(self.elements[str(Idx)],indent=4))
> +resp =

Re: [edk2-devel] [edk2-redfish-client][PATCH 4/6] Tool/Redfish-Profile-Simulator: Add ETag support

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

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Monday, May 8, 2023 10:52 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> 
> Subject: [edk2-redfish-client][PATCH 4/6] Tool/Redfish-Profile-Simulator:
> Add ETag support
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Implement ETag support in HTTP header
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> ---
>  .../v1sim/resource.py | 10 +--
>  .../v1sim/systems.py  | 28 +++
>  2 files changed, 25 insertions(+), 13 deletions(-)
> 
> diff --git a/Tools/Redfish-Profile-Simulator/v1sim/resource.py
> b/Tools/Redfish-Profile-Simulator/v1sim/resource.py
> index e722d16a..0c7a8382 100644
> --- a/Tools/Redfish-Profile-Simulator/v1sim/resource.py
> +++ b/Tools/Redfish-Profile-Simulator/v1sim/resource.py
> @@ -36,6 +36,12 @@ class RfResource:
>  self.final_init_processing(base_path, rel_path)
>  else:
>  self.res_data = {}
> +self.generate_etag(json.dumps(self.res_data))
> +
> +def generate_etag(self, context):
> +md5 = hashlib.md5()
> +md5.update(context.encode('utf-8'))
> +self.etag = 'W/"' + md5.hexdigest() + '"'
> 
>  def create_sub_objects(self, base_path, rel_path):
>  pass
> @@ -49,8 +55,8 @@ class RfResource:
>  # SHA1 should generate well-behaved etags
>  response = flask.make_response(self.response)
>  response.mimetype = 'application/json'
> -etag = hashlib.sha1(self.response.encode('utf-8')).hexdigest()
> -response.set_etag(etag)
> +response.headers["ETag"] = self.etag
> +
>  return response
>  except KeyError:
>  flask.abort(404)
> diff --git a/Tools/Redfish-Profile-Simulator/v1sim/systems.py
> b/Tools/Redfish-Profile-Simulator/v1sim/systems.py
> index 6305a51e..5adf81be 100644
> --- a/Tools/Redfish-Profile-Simulator/v1sim/systems.py
> +++ b/Tools/Redfish-Profile-Simulator/v1sim/systems.py
> @@ -92,7 +92,11 @@ class RfSystemObj(RfResource):
>  if "BootOrder" in boot_data:
>  self.res_data['Boot']['BootOrder'] = boot_data['BootOrder']
> 
> -resp = flask.Response(json.dumps(self.res_data,indent=4),
> mimetype="application/json")
> +context = json.dumps(self.res_data,indent=4)
> +self.generate_etag(context)
> +resp = flask.Response(context, mimetype="application/json")
> +resp.headers["ETag"] = self.etag
> +
>  return 0, 200, None, resp
> 
>  def reset_resource(self, reset_data):
> @@ -136,26 +140,28 @@ class RfMemoryCollection(RfCollection):
> 
>  post_data["@odata.id"] = newMemoryUrl
> 
> -md5 = hashlib.md5()
> -md5.update(json.dumps(post_data).encode("utf-8"))
> -etag_str = 'W/"' + md5.hexdigest() + '"'
> -post_data["@odata.etag"] = etag_str
> +self.generate_etag(json.dumps(post_data,indent=4))
> +
> +post_data["@odata.etag"] = self.etag
>  self.elements[str(newMemoryIdx)] = post_data
> 
>  resp = flask.Response(json.dumps(post_data,indent=4),
> mimetype="application/json")
>  resp.headers["Location"] = newMemoryUrl
> -resp.headers["ETag"] = etag_str
> -
> +resp.headers["ETag"] = self.etag
>  return 0, 200, None, resp
> 
>  def patch_memory(self, Idx, patch_data):
> -md5 = hashlib.md5()
> -md5.update(json.dumps(patch_data).encode("utf-8"))
> -etag_str = 'W/"' + md5.hexdigest() + '"'
> -patch_data["@odata.etag"] = etag_str
> 
> +
> +self.elements[str(Idx)] = {**self.elements[str(Idx)], **patch_data}
> +
> +context = json.dumps(self.elements[str(Idx)],indent=4)
> +self.generate_etag(context)
> +patch_data["@odata.etag"] = self.etag
>  self.elements[str(Idx)] = {**self.elements[str(Idx)], **patch_data}
> +
>  resp = flask.Response(json.dumps(self.elements[str(Idx)],indent=4),
> mimetype="application/json")
> +resp.headers["ETag"] = self.etag
>  return 0, 200, None, resp
> 
>  def get_memory(self, Idx):
> --
> 2.17.1


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




Re: [edk2-devel] [edk2-redfish-client][PATCH 5/6] Tool/Redfish-Profile-Simulator: Add missing module

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

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Monday, May 8, 2023 10:52 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> 
> Subject: [edk2-redfish-client][PATCH 5/6] Tool/Redfish-Profile-Simulator:
> Add missing module
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Add missing module import for conditional, RfCollection, RfResource,
> RfResourceRaw, hashlib and OrderedDict
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> ---
>  Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py | 5 -
>  Tools/Redfish-Profile-Simulator/v1sim/resource.py| 2 ++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py
> b/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py
> index 35d3794c..53a44849 100644
> --- a/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py
> +++ b/Tools/Redfish-Profile-Simulator/v1sim/redfishURIs.py
> @@ -1,7 +1,7 @@
>  #
>  # Copyright Notice:
>  # Copyright (c) 2019, Intel Corporation. All rights reserved. -# (C)
> Copyright 2021 Hewlett Packard Enterprise Development LP
> +# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
>  # SPDX-License-Identifier: BSD-2-Clause-Patent  #  # Copyright Notice:
> @@ -16,6 +16,9 @@ from flask import request
> 
>  from .flask_redfish_auth import RfHTTPBasicOrTokenAuth
> 
> +from redfishProfileSimulator import conditional from v1sim.resource
> +import RfCollection, RfResource, RfResourceRaw
> +
>  from werkzeug.serving import WSGIRequestHandler
> 
>  def rfApi_SimpleServer(root, versions, host="127.0.0.1", port=5000, cert="",
> key=""):
> diff --git a/Tools/Redfish-Profile-Simulator/v1sim/resource.py
> b/Tools/Redfish-Profile-Simulator/v1sim/resource.py
> index 0c7a8382..f6bd15cf 100644
> --- a/Tools/Redfish-Profile-Simulator/v1sim/resource.py
> +++ b/Tools/Redfish-Profile-Simulator/v1sim/resource.py
> @@ -15,6 +15,8 @@ import os
>  import sys
> 
>  import flask
> +import hashlib
> +from collections import OrderedDict
> 
>  if sys.version_info >= (3, 5):
>  from typing import Type
> --
> 2.17.1


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




Re: [edk2-devel] [edk2-redfish-client][PATCH 6/6] Tool/Redfish-Profile-Simulator: Update Bios schema version

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

Reviewed-by: Abner Chang 

> -Original Message-
> From: Nickle Wang 
> Sent: Monday, May 8, 2023 10:52 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner ; Igor Kulchytskyy
> 
> Subject: [edk2-redfish-client][PATCH 6/6] Tool/Redfish-Profile-Simulator:
> Update Bios schema version
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Update mock-up file and use Bios schema version 1.0.9 in order to support
> BIOS configuration driver.
> 
> Signed-off-by: Nickle Wang 
> Cc: Abner Chang 
> Cc: Igor Kulchytskyy 
> ---
>  .../redfish/v1/Systems/2M220100SL/Bios/index.json   | 2 +-
>  .../redfish/v1/Systems/2M220101SL/Bios/index.json   | 2 +-
>  .../redfish/v1/Systems/2M220102SL/Bios/index.json   | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100S
> L/Bios/index.json b/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100S
> L/Bios/index.json
> index 540dcd30..bab2381f 100644
> --- a/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220100S
> L/Bios/index.json
> +++ b/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfi
> +++ sh/v1/Systems/2M220100SL/Bios/index.json
> @@ -1,5 +1,5 @@
>  {
> -"@odata.type": "#Bios.v1_0_2.Bios",
> +"@odata.type": "#Bios.v1_0_9.Bios",
>  "Id": "Bios",
>  "Name": "BIOS Configuration Current Settings",
>  "Description": "BIOS Configuration Current Settings", diff --git
> a/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101S
> L/Bios/index.json b/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101S
> L/Bios/index.json
> index db56911d..13fb0cac 100644
> --- a/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220101S
> L/Bios/index.json
> +++ b/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfi
> +++ sh/v1/Systems/2M220101SL/Bios/index.json
> @@ -1,5 +1,5 @@
>  {
> -"@odata.type": "#Bios.v1_0_2.Bios",
> +"@odata.type": "#Bios.v1_0_9.Bios",
>  "Id": "Bios",
>  "Name": "BIOS Configuration Current Settings",
>  "Description": "BIOS Configuration Current Settings.", diff --git
> a/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102S
> L/Bios/index.json b/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102S
> L/Bios/index.json
> index b7585844..2d14918a 100644
> --- a/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfish/v1/Systems/2M220102S
> L/Bios/index.json
> +++ b/Tools/Redfish-Profile-
> Simulator/MockupData/SimpleOcpServerV1/redfi
> +++ sh/v1/Systems/2M220102SL/Bios/index.json
> @@ -1,5 +1,5 @@
>  {
> -"@odata.type": "#Bios.v1_0_2.Bios",
> +"@odata.type": "#Bios.v1_0_9.Bios",
>  "Id": "Bios",
>  "Name": "BIOS Configuration Current Settings",
>  "Description": "BIOS Configuration Current Settings",
> --
> 2.17.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104327): https://edk2.groups.io/g/devel/message/104327
Mute This Topic: https://groups.io/mt/98762722/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 02/10] MdePkg: don't set visibility to hidden

2023-05-08 Thread Gerd Hoffmann
On Fri, May 05, 2023 at 08:33:41AM -0600, Rebecca Cran wrote:
> Gerd,
> 
> 
> Does this series need rework following this discussion, or is it ready to
> merge?

I think we are good to go.  The ASSERT suggested by Ard here ...

> 
> > > So it would be better to ASSERT() on non-empty GOT, and ignore such
> > > GOTPCREL relocations instead of attempting to relocate the GOT entries
> > > they (used to) refer to.

... is added to the linker scripts by patch #1 of the series.

take care,
  Gerd



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




Re: [edk2-devel] [PATCH v11 0/8] Adds AmdSmmCpuFeaturesLib and MmSaveStateLib

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

Hi @Ray Ni,
Could you please help to review this patch set as the Hard Freeze is coming 
soon?

Thanks
Abner

> -Original Message-
> From: Abdul Lateef Attar 
> Sent: Saturday, May 6, 2023 12:07 PM
> To: devel@edk2.groups.io
> Cc: Attar, AbdulLateef (Abdul Lateef) ;
> Grimes, Paul ; Chang, Abner
> ; Eric Dong ; Ray Ni
> ; Rahul Kumar ; Gerd
> Hoffmann ; Michael D Kinney
> ; Liming Gao ;
> Zhiguang Liu ; Ard Biesheuvel
> ; Jiewen Yao ; Jordan
> Justen 
> Subject: [PATCH v11 0/8] Adds AmdSmmCpuFeaturesLib and
> MmSaveStateLib
> 
> PR: https://github.com/tianocore/edk2/pull/4341
> 
> V11: Delta changes
> Drop the OVMF implementation of MmSaveStateLib
> V10: Delta changes:
>   Addressed review comments from Abner.
> V9: Delta changes:
>   Addressed review comments.
>   Rename to MmSaveStateLib.
>   Also rename SMM_ defines to MM_.
>   Implemented OVMF MmSaveStateLib.
>   Removes SmmCpuFeaturesReadSaveStateRegister and
> SmmCpuFeaturesWriteSaveStateRegister
>   function interface.
> V8 delta changes:
>Addressed review comments from Abner,
>Fix the whitespace error.
>Seperate the Ovmf changes to another patch
> V7 delta changes:
>Adds SmmSmramSaveStateLib for Intel processor.
>Integrate SmmSmramSaveStateLib library.
> V6 delta changes:
>Addressed review comments for Ray NI.
>removed unnecessary EFIAPI.
> V5 delta changes:
>rebase to master branch.
>updated Reviewed-by
> V4 delta changes:
>   rebase to master branch.
>   added reviewed-by.
> V3 delta changes:
>   Addressed review comments from Abner chang.
>   Re-arranged patch order.
> 
> Cc: Paul Grimes 
> Cc: Abner Chang 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Cc: Rahul Kumar 
> Cc: Gerd Hoffmann 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Zhiguang Liu 
> Cc: Ard Biesheuvel 
> Cc: Jiewen Yao 
> Cc: Jordan Justen 
> Cc: Abdul Lateef Attar 
> 
> Abdul Lateef Attar (8):
>   MdePkg: Adds AMD SMRAM save state map
>   UefiCpuPkg: Adds MmSaveStateLib library class
>   UefiCpuPkg: Implements MmSaveStateLib library instance
>   UefiCpuPkg/SmmCpuFeaturesLib: Restructure arch-dependent code
>   UefiCpuPkg: Implements SmmCpuFeaturesLib for AMD Family
>   UefiCpuPkg: Implements MmSaveStateLib for Intel
>   UefiCpuPkg: Removes SmmCpuFeaturesReadSaveStateRegister
>   OvmfPkg: Uses MmSaveStateLib library
> 
>  UefiCpuPkg/UefiCpuPkg.dec |   4 +
>  OvmfPkg/OvmfPkgIa32.dsc   |   1 +
>  OvmfPkg/OvmfPkgIa32X64.dsc|   3 +
>  OvmfPkg/OvmfPkgX64.dsc|   1 +
>  UefiCpuPkg/UefiCpuPkg.dsc |  14 +
>  .../MmSaveStateLib/AmdMmSaveStateLib.inf  |  28 +
>  .../MmSaveStateLib/IntelMmSaveStateLib.inf|  28 +
>  .../AmdSmmCpuFeaturesLib.inf  |  38 +
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf  |   2 +
>  .../Include/Register/Amd/SmramSaveStateMap.h  | 194 +
>  UefiCpuPkg/Include/Library/MmSaveStateLib.h   |  70 ++
>  .../Include/Library/SmmCpuFeaturesLib.h   |  52 --
>  .../Library/MmSaveStateLib/MmSaveState.h  | 102 +++
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h|  56 +-
>  .../SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 767 --
>  .../Library/MmSaveStateLib/AmdMmSaveState.c   | 309 +++
>  .../Library/MmSaveStateLib/IntelMmSaveState.c | 413 ++
>  .../MmSaveStateLib/MmSaveStateCommon.c| 138 
>  .../SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.c  | 387 +
>  .../IntelSmmCpuFeaturesLib.c  |  70 ++
>  .../SmmCpuFeaturesLibCommon.c | 128 ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c|  11 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c| 500 +---
>  MdePkg/MdePkg.ci.yaml |   4 +-
>  24 files changed, 1812 insertions(+), 1508 deletions(-)  create mode 100644
> UefiCpuPkg/Library/MmSaveStateLib/AmdMmSaveStateLib.inf
>  create mode 100644
> UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveStateLib.inf
>  create mode 100644
> UefiCpuPkg/Library/SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.inf
>  create mode 100644
> MdePkg/Include/Register/Amd/SmramSaveStateMap.h
>  create mode 100644 UefiCpuPkg/Include/Library/MmSaveStateLib.h
>  create mode 100644 UefiCpuPkg/Library/MmSaveStateLib/MmSaveState.h
>  create mode 100644
> UefiCpuPkg/Library/MmSaveStateLib/AmdMmSaveState.c
>  create mode 100644
> UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveState.c
>  create mode 100644
> UefiCpuPkg/Library/MmSaveStateLib/MmSaveStateCommon.c
>  create mode 100644
> UefiCpuPkg/Library/SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.c
> 
> --
> 2.25.1


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




Re: [edk2-devel] [PATCH v11 0/8] Adds AmdSmmCpuFeaturesLib and MmSaveStateLib

2023-05-08 Thread Gerd Hoffmann
On Sat, May 06, 2023 at 09:36:56AM +0530, Abdul Lateef Attar wrote:
> PR: https://github.com/tianocore/edk2/pull/4341
> 
> V11: Delta changes
> Drop the OVMF implementation of MmSaveStateLib

Tested-by: Gerd Hoffmann 
Acked-by: Gerd Hoffmann 

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104330): https://edk2.groups.io/g/devel/message/104330
Mute This Topic: https://groups.io/mt/98720163/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] ManageabilityPkg/IpmiCommandLib:IPMI Command Library

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

Thanks, I will correct it before pushing it to edk2-platform.
Abner

> -Original Message-
> From: Oram, Isaac W 
> Sent: Tuesday, May 9, 2023 5:19 AM
> To: devel@edk2.groups.io; Chang, Abner 
> Cc: Attar, AbdulLateef (Abdul Lateef) ; Nickle
> Wang ; Tinh Nguyen
> 
> Subject: RE: [edk2-devel] [edk2-platforms][PATCH]
> ManageabilityPkg/IpmiCommandLib:IPMI Command Library
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> Reviewed-by:  Isaac Oram 
> 
> 
> A few superficial things that could be fixed now or later.
> 
> Typo:  EFI_STASTUS
> 
> There is a mismatch between function names and parameter names that
> looks like a cut/paste from prior function.  Updating would probably match
> the spirit of "no functional changes", but it is your choice to correct.
> IpmiSetPowerRestorePolicy (
>   IN  IPMI_SET_POWER_RESTORE_POLICY_REQUEST
> *ChassisControlRequest,
>   OUT IPMI_SET_POWER_RESTORE_POLICY_RESPONSE
> *ChassisControlResponse
>   )
> 
> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Chang,
> Abner via groups.io
> Sent: Thursday, May 4, 2023 10:24 PM
> To: devel@edk2.groups.io
> Cc: Oram, Isaac W ; Abdul Lateef Attar
> ; Nickle Wang ; Tinh Nguyen
> 
> Subject: [edk2-devel] [edk2-platforms][PATCH]
> ManageabilityPkg/IpmiCommandLib:IPMI Command Library
> 
> From: Abner Chang 
> 
> BZ #: 
> 
> IpmiCommandLib is cloned from
> edk2-platforms/Features/Intel/OutOfBandManagement/
> IpmiFeaturePkg/Library/IpmiCommandLib in order to
> consolidate edk2 system manageability support in
> one place. Function header are added to the source
> files and header files. Uncustify is applied to C
> files and no functionalities are changed in this patch.
> 
> We will still keep the one under IpmiFeaturePkg/Library/
> IpmiCommandLib until the reference to this instance are
> removed from platforms.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Tinh Nguyen 
> ---
>  .../Library/IpmiCommandLib/IpmiCommandLib.inf |  33 +
>  .../Include/Library/IpmiCommandLib.h  | 620 ++
>  .../IpmiCommandLib/IpmiCommandLibNetFnApp.c   | 444 +
>  .../IpmiCommandLibNetFnChassis.c  | 199 ++
>  .../IpmiCommandLibNetFnStorage.c  | 384 +++
>  .../IpmiCommandLibNetFnTransport.c| 156 +
>  6 files changed, 1836 insertions(+)
>  create mode 100644
> Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.inf
>  create mode 100644
> Features/ManageabilityPkg/Include/Library/IpmiCommandLib.h
>  create mode 100644
> Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNet
> FnApp.c
>  create mode 100644
> Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNet
> FnChassis.c
>  create mode 100644
> Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNet
> FnStorage.c
>  create mode 100644
> Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNet
> FnTransport.c
> 
> diff --git
> a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.in
> f
> b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.in
> f
> new file mode 100644
> index 00..3dc485cf38
> --- /dev/null
> +++
> b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.in
> f
> @@ -0,0 +1,33 @@
> +### @file
> +# Component description file for IPMI Command Library.
> +#
> +# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +###
> +
> +[Defines]
> +  INF_VERSION= 0x00010005
> +  BASE_NAME  = IpmiCommandLib
> +  FILE_GUID  = 96FC1989-CB7F-489B-9D3B-68DCA2C2DADC
> +  MODULE_TYPE= UEFI_DRIVER
> +  VERSION_STRING = 1.0
> +  LIBRARY_CLASS  = IpmiCommandLib
> +
> +[sources]
> +  IpmiCommandLibNetFnApp.c
> +  IpmiCommandLibNetFnTransport.c
> +  IpmiCommandLibNetFnChassis.c
> +  IpmiCommandLibNetFnStorage.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  ManageabilityPkg/ManageabilityPkg.dec
> +
> +[LibraryClasses]
> +  BaseMemoryLib
> +  DebugLib
> +  IpmiLib
> diff --git a/Features/ManageabilityPkg/Include/Library/IpmiCommandLib.h
> b/Features/ManageabilityPkg/Include/Library/IpmiCommandLib.h
> new file mode 100644
> index 00..685f6e2ea2
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Include/Library/IpmiCommandLib.h
> @@ -0,0 +1,620 @@
> +/** @file
> +  This library abstract how to send/receive IPMI command.
> +
> +Copyright (c) 2018-2021, Intel Corporation. All rights reserved.
> +Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
> +
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +

Re: [edk2-devel] [PATCH v1 0/1] AMD/AmdMinBoardPkg: Implements SpcrDeviceLib library

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

Reviewed-by: Abner Chang 

> -Original Message-
> From: Abdul Lateef Attar 
> Sent: Monday, May 8, 2023 3:03 PM
> To: devel@edk2.groups.io
> Cc: Attar, AbdulLateef (Abdul Lateef) ; Chang,
> Abner 
> Subject: [PATCH v1 0/1] AMD/AmdMinBoardPkg: Implements SpcrDeviceLib
> library
> 
> PR: https://github.com/tianocore/edk2-platforms/pull/81
> 
> Implements SpcrDeviceLib for AmdMinBoardPkg.
> 
> Cc: Abner Chang 
> Cc: Abdul Lateef Attar 
> 
> 
> Abdul Lateef Attar (1):
>   AMD/AmdMinBoardPkg: Implements SpcrDeviceLib library
> 
>  .../AMD/AmdMinBoardPkg/AmdMinBoardPkg.dsc |  6 ++
>  .../Library/SpcrDeviceLib/SpcrDeviceLib.inf   | 23 +
>  .../Library/SpcrDeviceLib/SpcrDeviceLib.c | 84 +++
>  3 files changed, 113 insertions(+)
>  create mode 100755
> Platform/AMD/AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.inf
>  create mode 100755
> Platform/AMD/AmdMinBoardPkg/Library/SpcrDeviceLib/SpcrDeviceLib.c
> 
> --
> 2.25.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104332): https://edk2.groups.io/g/devel/message/104332
Mute This Topic: https://groups.io/mt/98756414/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] ManageabilityPkg/IpmiCommandLib: Add IpmiCommandLib to package

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

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Friday, May 5, 2023 1:24 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Tinh Nguyen
> 
> Subject: [edk2-platforms][PATCH] ManageabilityPkg/IpmiCommandLib: Add
> IpmiCommandLib to package
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> BZ #: 
> Add IpmiCommandLib to ManageabilityPkg package.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Tinh Nguyen 
> ---
>  Features/ManageabilityPkg/ManageabilityPkg.dec  | 4 
>  Features/ManageabilityPkg/Include/Manageability.dsc | 1 +
>  Features/ManageabilityPkg/ManageabilityPkg.dsc  | 1 +
>  3 files changed, 6 insertions(+)
> 
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec
> b/Features/ManageabilityPkg/ManageabilityPkg.dec
> index 6f58ab4f45..38813c5f48 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dec
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
> @@ -18,6 +18,10 @@
>Include
> 
>  [LibraryClasses]
> +  ##  @libraryclass IPMI command library
> +  #   Provide the help functions to send IPMI commands.
> +  IpmiCommandLib|Include/Library/IpmiCommandLib.h
> +
>##  @libraryclass Manageability Transport Library
>#   Manageability Transport Library definitions
>ManageabilityTransportLib|Include/Library/ManageabilityTransportLib.h
> diff --git a/Features/ManageabilityPkg/Include/Manageability.dsc
> b/Features/ManageabilityPkg/Include/Manageability.dsc
> index 5e7cdb885f..a432b0ff26 100644
> --- a/Features/ManageabilityPkg/Include/Manageability.dsc
> +++ b/Features/ManageabilityPkg/Include/Manageability.dsc
> @@ -7,6 +7,7 @@
>  ##
>  [LibraryClasses]
> 
> ManageabilityTransportHelperLib|ManageabilityPkg/Library/BaseManageability
> TransportHelperLib/BaseManageabilityTransportHelper.inf
> +
> IpmiCommandLib|ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLi
> b.inf
> 
>  [LibraryClasses.common.DXE_DRIVER]
> 
> PldmProtocolLib|ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProt
> ocolLib.inf
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> index a0712d1c0a..e3baf27f2a 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> @@ -49,6 +49,7 @@
> 
> ManageabilityPkg/Library/ManageabilityTransportKcsLib/Dxe/DxeManageability
> TransportKcs.inf
> 
> ManageabilityPkg/Library/ManageabilityTransportMctpLib/Dxe/DxeManageabili
> tyTransportMctp.inf
>ManageabilityPkg/Library/PldmProtocolLibrary/Dxe/PldmProtocolLib.inf
> +  ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.inf
> 
>  [LibraryClasses]
> 
> ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTransp
> ortNullLib/BaseManageabilityTransportNull.inf
> --
> 2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104333): https://edk2.groups.io/g/devel/message/104333
Mute This Topic: https://groups.io/mt/98699832/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] ManageabilityPkg/IpmiCommandLib:IPMI Command Library

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

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Friday, May 5, 2023 1:24 PM
> To: devel@edk2.groups.io
> Cc: Isaac Oram ; Abdul Lateef Attar
> ; Nickle Wang ; Tinh Nguyen
> 
> Subject: [edk2-platforms][PATCH] ManageabilityPkg/IpmiCommandLib:IPMI
> Command Library
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> BZ #: 
> 
> IpmiCommandLib is cloned from
> edk2-platforms/Features/Intel/OutOfBandManagement/
> IpmiFeaturePkg/Library/IpmiCommandLib in order to
> consolidate edk2 system manageability support in
> one place. Function header are added to the source
> files and header files. Uncustify is applied to C
> files and no functionalities are changed in this patch.
> 
> We will still keep the one under IpmiFeaturePkg/Library/
> IpmiCommandLib until the reference to this instance are
> removed from platforms.
> 
> Signed-off-by: Abner Chang 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Cc: Nickle Wang 
> Cc: Tinh Nguyen 
> ---
>  .../Library/IpmiCommandLib/IpmiCommandLib.inf |  33 +
>  .../Include/Library/IpmiCommandLib.h  | 620 ++
>  .../IpmiCommandLib/IpmiCommandLibNetFnApp.c   | 444 +
>  .../IpmiCommandLibNetFnChassis.c  | 199 ++
>  .../IpmiCommandLibNetFnStorage.c  | 384 +++
>  .../IpmiCommandLibNetFnTransport.c| 156 +
>  6 files changed, 1836 insertions(+)
>  create mode 100644
> Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.inf
>  create mode 100644
> Features/ManageabilityPkg/Include/Library/IpmiCommandLib.h
>  create mode 100644
> Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnA
> pp.c
>  create mode 100644
> Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnC
> hassis.c
>  create mode 100644
> Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnSt
> orage.c
>  create mode 100644
> Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLibNetFnTr
> ansport.c
> 
> diff --git
> a/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.inf
> b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.inf
> new file mode 100644
> index 00..3dc485cf38
> --- /dev/null
> +++
> b/Features/ManageabilityPkg/Library/IpmiCommandLib/IpmiCommandLib.inf
> @@ -0,0 +1,33 @@
> +### @file
> +# Component description file for IPMI Command Library.
> +#
> +# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved.
> +# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +###
> +
> +[Defines]
> +  INF_VERSION= 0x00010005
> +  BASE_NAME  = IpmiCommandLib
> +  FILE_GUID  = 96FC1989-CB7F-489B-9D3B-68DCA2C2DADC
> +  MODULE_TYPE= UEFI_DRIVER
> +  VERSION_STRING = 1.0
> +  LIBRARY_CLASS  = IpmiCommandLib
> +
> +[sources]
> +  IpmiCommandLibNetFnApp.c
> +  IpmiCommandLibNetFnTransport.c
> +  IpmiCommandLibNetFnChassis.c
> +  IpmiCommandLibNetFnStorage.c
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  ManageabilityPkg/ManageabilityPkg.dec
> +
> +[LibraryClasses]
> +  BaseMemoryLib
> +  DebugLib
> +  IpmiLib
> diff --git a/Features/ManageabilityPkg/Include/Library/IpmiCommandLib.h
> b/Features/ManageabilityPkg/Include/Library/IpmiCommandLib.h
> new file mode 100644
> index 00..685f6e2ea2
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Include/Library/IpmiCommandLib.h
> @@ -0,0 +1,620 @@
> +/** @file
> +  This library abstract how to send/receive IPMI command.
> +
> +Copyright (c) 2018-2021, Intel Corporation. All rights reserved.
> +Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
> +
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef IPMI_COMMAND_LIB_H_
> +#define IPMI_COMMAND_LIB_H_
> +
> +#include 
> +#include 
> +
> +///
> +/// Functions for IPMI NetFnApp commands
> +///
> +
> +/**
> +  This function is used to retrieve device ID.
> +
> +  @param [out]  DeviceId  The pointer to receive
> IPMI_GET_DEVICE_ID_RESPONSE.
> +
> +  @retval EFI_STASTUS   See the return values of IpmiSubmitCommand ()
> function.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +IpmiGetDeviceId (
> +  OUT IPMI_GET_DEVICE_ID_RESPONSE  *DeviceId
> +  );
> +
> +/**
> +  This function returns device self test results
> +
> +  @param [out]  SelfTestResult  The pointer to receive
> IPMI_SELF_TEST_RESULT_RESPONSE.
> +
> +  @retval EFI_STASTUS   See the return values of IpmiSubmitCommand ()
> function.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +IpmiGetSelfTestResult (
> +  OUT IPMI_SELF_TEST_RESULT_RESPONSE  *SelfTestResult
> +  );
> +
> +/**
> +  This function is used for starting and restarting the Watchdog
> +  Timer from the initial countdown value that was specified in
> +  the Set Watchdog Timer