Re: [edk2-devel] [PATCH v3 0/5] BaseTools/Scripts/GetMaintainer: Handle reviewer only case

2023-11-10 Thread Michael D Kinney
Merged: https://github.com/tianocore/edk2/pull/5033

> -Original Message-
> From: Rebecca Cran 
> Sent: Friday, November 10, 2023 12:36 PM
> To: Leif Lindholm ; devel@edk2.groups.io
> Cc: Kinney, Michael D ; Gao, Liming
> ; Feng, Bob C ; Chen,
> Christine 
> Subject: Re: [PATCH v3 0/5] BaseTools/Scripts/GetMaintainer: Handle
> reviewer only case
> 
> For the series:
> 
> Acked-by: Rebecca Cran 
> 
> 
> On 11/10/23 12:30, Leif Lindholm wrote:
> > OK, so this a bit of a backwards review, but I figured I might as
> > well show how I would prefer the split. I'm adding a patch that
> > changes internal returns to dictionaries instead of multiple return
> > values.
> >
> > There are no functional differences between the original submission
> > and this for 1-2,4-5/5, so I'm happy to give
> > Reviewed-by: Leif Lindholm 
> > for those. 3/5 is new and requires review by someone else.
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4593
> >
> > Fix logic bug where maintainers was incorrectly added to lists.
> >
> > If a package only has reviewers and no maintainers, then also
> > return the  maintainers.
> >
> > In order to detect this case, get_maintainers() is updated to
> > return maintainers, reviews, and lists separately instead of
> > a single merged list.  This also allows this module to be used
> > by other scripts that need to distinguish between maintainers,
> > reviewers, and lists.
> >
> > Simplify logic that accumulates maintainers, reviewers, lists.
> >
> > Sort the list of output addresses alphabetically and use set()
> > instead of OrderedDict() to accumulate unique addresses.
> >
> > Changes since v2:
> > - Reworked internal return logic to use dictionaries.
> > - Reordered cleanup before new functionality.
> > Changes since v1:
> > - Split into patch series
> >
> > Cc: Rebecca Cran 
> > Cc: Liming Gao 
> > Cc: Bob Feng 
> > Cc: Yuwei Chen 
> > Cc: Michael D Kinney 
> >
> > Leif Lindholm (1):
> >BaseTools/Scripts/GetMaintainer: refactor internal returns as
> dicts
> >
> > Michael D Kinney (4):
> >BaseTools/Scripts/GetMaintainer: Fix logic bug collecting
> maintainers
> >BaseTools/Scripts/GetMaintainer: Simplify logic
> >BaseTools/Scripts/GetMaintainer: Handle reviewer only case
> >BaseTools/Scripts/GetMaintainer: Sort output addresses
> >
> >   BaseTools/Scripts/GetMaintainer.py | 43 +++---
> 
> >   1 file changed, 27 insertions(+), 16 deletions(-)
> >


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#11): https://edk2.groups.io/g/devel/message/11
Mute This Topic: https://groups.io/mt/102513765/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] OvmfPkg/MemEncryptSevLib: Fix address overflow during PVALIDATE

2023-11-10 Thread Roth, Michael via groups.io
The struct used for GHCB-based page-state change requests uses a 40-bit
bit-field for the GFN, which is shifted by PAGE_SHIFT to generate a
64-bit address. However, anything beyond 40-bits simply gets shifted off
when doing this, which will cause issues when dealing with 1TB+
addresses. Fix this by casting the 40-bit GFN values to 64-bit ones
prior to shifting it by PAGE_SHIFT.

Fixes: ade62c18f474 ("OvmfPkg/MemEncryptSevLib: add support to validate system 
RAM")
Signed-off-by: Michael Roth 
---
 .../BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c| 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c 
b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
index 85eb41585b..d52d2940e9 100644
--- a/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
+++ b/OvmfPkg/Library/BaseMemEncryptSevLib/X64/SnpPageStateChangeInternal.c
@@ -78,13 +78,14 @@ PvalidateRange (
   IN  BOOLEAN Validate

   )

 {

-  UINTN  Address, RmpPageSize, Ret, i;

+  UINTN RmpPageSize, Ret, i;

+  EFI_PHYSICAL_ADDRESS  Address;

 

   for ( ; StartIndex <= EndIndex; StartIndex++) {

 //

 // Get the address and the page size from the Info.

 //

-Address = Info->Entry[StartIndex].GuestFrameNumber << EFI_PAGE_SHIFT;

+Address = ((UINT64)Info->Entry[StartIndex].GuestFrameNumber) << 
EFI_PAGE_SHIFT;

 RmpPageSize = Info->Entry[StartIndex].PageSize;

 

 Ret = AsmPvalidate (RmpPageSize, Validate, Address);

-- 
2.25.1



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




Re: [edk2-devel] [PATCH 00/37] OvmfPkg: remove the CSM (after edk2-stable202311)

2023-11-10 Thread Yao, Jiewen
Glad to see we can get rid of the legacy burden.

All: Reviewed-by: Jiewen Yao 


> -Original Message-
> From: Laszlo Ersek 
> Sent: Saturday, November 11, 2023 7:58 AM
> To: devel@edk2.groups.io
> Cc: Anatol Belski ; Warkentin, Andrei
> ; Anthony Perard ;
> Ard Biesheuvel ; Corvin Köhne
> ; Aktas, Erdem ; Gerd
> Hoffmann ; Jianyong Wu ; Yao,
> Jiewen ; Michael Roth ; Xu,
> Min M ; Rebecca Cran ; Sunil V L
> ; Tom Lendacky 
> Subject: [PATCH 00/37] OvmfPkg: remove the CSM (after edk2-stable202311)
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
> CI: https://github.com/tianocore/edk2/pull/5031 (@ 961d5add9f03)
> 
> Remove the Compatibility Support Module (CSM) from OVMF (after
> edk2-stable202311).
> 
> Modify the following platforms:
> 
>   OvmfPkg/AmdSev/AmdSevX64.dsc
>   OvmfPkg/Bhyve/BhyveX64.dsc
>   OvmfPkg/CloudHv/CloudHvX64.dsc
>   OvmfPkg/IntelTdx/IntelTdxX64.dsc
>   OvmfPkg/Microvm/MicrovmX64.dsc
>   OvmfPkg/OvmfPkgIa32.dsc
>   OvmfPkg/OvmfPkgIa32X64.dsc
>   OvmfPkg/OvmfPkgX64.dsc
>   OvmfPkg/OvmfXen.dsc
> 
> Each of those platforms builds at every stage of the series.
> 
> Follow a gradual approach. Peel off CSM components in (reverse)
> dependency order:
> 
> - exclude a high-level CSM component (library or driver) from the OVMF
>   platforms, without breaking dependencies of low-level components;
> 
> - delete the high-level component from OvmfPkg;
> 
> - add, to a removal queue, any source code artifacts (protocols, GUIDs,
>   headers, PCDs) that the high-level component's deletion
>   *unreferences*;
> 
> - delete all entries of the removal queue (protocols, GUIDs, headers,
>   PCDs) from the edk2 source tree that are now completely unreferenced
>   (... and extend the removal queue recursively, if needed);
> 
> - advance to the next component that now qualifies as "high-level"
>   (because nothing consumes the services it provides any longer), and
>   exclude that one.
> 
> Regression-test the traditional platforms as needed; see the notes in
> the following patches:
> 
> - OvmfPkg: remove PcdCsmEnable
> - OvmfPkg/IncompatiblePciDeviceSupportDxe: ignore CSM presence
> - OvmfPkg: exclude 8254TimerDxe
> 
> Cc: Anatol Belski 
> Cc: Andrei Warkentin 
> Cc: Anthony Perard 
> Cc: Ard Biesheuvel 
> Cc: Corvin Köhne 
> Cc: Erdem Aktas 
> Cc: Gerd Hoffmann 
> Cc: Jianyong Wu 
> Cc: Jiewen Yao 
> Cc: Michael Roth 
> Cc: Min Xu 
> Cc: Rebecca Cran 
> Cc: Sunil V L 
> Cc: Tom Lendacky 
> 
> Thanks
> Laszlo
> 
> Laszlo Ersek (37):
>   OvmfPkg: cripple CSM_ENABLE macro
>   OvmfPkg: remove PcdCsmEnable
>   OvmfPkg: unplug LegacyBootManagerLib from BdsDxe and UiApp
>   OvmfPkg: remove LegacyBootManagerLib
>   OvmfPkg: unplug LegacyBootMaintUiLib from UiApp
>   OvmfPkg: remove LegacyBootMaintUiLib
>   OvmfPkg: remove gEfiLegacyDevOrderVariableGuid
>   OvmfPkg: exclude the CSM-based VideoDxe driver
>   OvmfPkg: remove Csm/BiosThunk/VideoDxe
>   OvmfPkg: remove gEfiVgaMiniPortProtocolGuid
>   OvmfPkg: remove Bios Video PCDs
>   OvmfPkg: exclude LegacyBiosDxe
>   OvmfPkg/IncompatiblePciDeviceSupportDxe: ignore CSM presence
>   Revert "OvmfPkg: don't assign PCI BARs above 4GiB when CSM enabled"
>   OvmfPkg: remove LegacyBiosDxe
>   OvmfPkg: exclude NullMemoryTestDxe driver
>   OvmfPkg: remove gEfiIsaIoProtocolGuid
>   OvmfPkg: remove gEfiIsaAcpiProtocolGuid
>   OvmfPkg: remove gEfiLegacyBiosGuid
>   OvmfPkg: remove LegacyBiosDxe PCDs
>   OvmfPkg: unplug CsmSupportLib from BdsDxe
>   OvmfPkg: remove CsmSupportLib
>   OvmfPkg: remove gEfiFirmwareVolumeProtocolGuid
>   OvmfPkg: remove gEfiLegacyBiosPlatformProtocolGuid
>   OvmfPkg: remove gEfiLegacyBiosProtocolGuid
>   OvmfPkg: remove gEfiLegacyInterruptProtocolGuid
>   OvmfPkg: remove 
>   OvmfPkg: exclude Csm16.inf / Csm16.bin
>   OvmfPkg: remove Rule.Common.USER_DEFINED.CSM from all FDF files
>   OvmfPkg: remove Csm16
>   OvmfPkg: exclude 8254TimerDxe
>   OvmfPkg: remove 8254TimerDxe
>   OvmfPkg: exclude 8259InterruptControllerDxe
>   OvmfPkg: remove 8259InterruptControllerDxe
>   OvmfPkg: remove gEfiLegacy8259ProtocolGuid
>   OvmfPkg: remove Pcd8259LegacyModeEdgeLevel and
> Pcd8259LegacyModeMask
>   OvmfPkg: remove CSM_ENABLE build macro
> 
>  OvmfPkg/8254TimerDxe/8254Timer.inf   |   
> 43 -
>  OvmfPkg/8254TimerDxe/Timer.c |  
> 406 ---
>  OvmfPkg/8254TimerDxe/Timer.h |  
> 186 --
>  OvmfPkg/8254TimerDxe/Timer.uni   |   
> 16 -
>  OvmfPkg/8254TimerDxe/TimerExtra.uni  |   
> 14 -
>  OvmfPkg/8259InterruptControllerDxe/8259.c|  
> 622 
>  OvmfPkg/8259InterruptControllerDxe/8259.h|  
> 218 --
>  OvmfPkg/8259InterruptControllerDxe/8259.inf  |   
> 45 -
>  OvmfPkg/8259InterruptControllerDxe/Legacy8259.uni|   
> 16 -
>  

[edk2-devel] [PATCH 36/37] OvmfPkg: remove Pcd8259LegacyModeEdgeLevel and Pcd8259LegacyModeMask

2023-11-10 Thread Laszlo Ersek
The following PCDs are unused at this point; remove them:

- Pcd8259LegacyModeEdgeLevel
- Pcd8259LegacyModeMask

This shrinks the list of resources scheduled for removal to nil.

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Erdem Aktas 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Michael Roth 
Cc: Min Xu 
Cc: Tom Lendacky 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec  | 26 
 OvmfPkg/AmdSev/AmdSevX64.dsc |  3 ---
 OvmfPkg/IntelTdx/IntelTdxX64.dsc |  3 ---
 OvmfPkg/Microvm/MicrovmX64.dsc   |  3 ---
 OvmfPkg/OvmfPkgIa32.dsc  |  3 ---
 OvmfPkg/OvmfPkgIa32X64.dsc   |  3 ---
 OvmfPkg/OvmfPkgX64.dsc   |  3 ---
 OvmfPkg/OvmfXen.dsc  |  3 ---
 8 files changed, 47 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 2e9e699aa6ab..b44fa039f76c 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -256,32 +256,6 @@ [PcdsFixedAtBuild]
   gUefiOvmfPkgTokenSpaceGuid.PcdGuidedExtractHandlerTableSize|0x0|UINT32|0x1a
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfDecompressionScratchEnd|0x0|UINT32|0x1f
 
-  ## Pcd8259LegacyModeMask defines the default mask value for platform. This
-  #  value is determined.
-  #  1) If platform only support pure UEFI, value should be set to 0x or
-  # 0xFFFE; Because only clock interrupt is allowed in legacy mode in pure
-  # UEFI platform.
-  #  2) If platform install CSM and use thunk module:
-  # a) If thunk call provided by CSM binary requires some legacy interrupt
-  #support, the corresponding bit should be opened as 0.
-  #For example, if keyboard interfaces provided CSM binary use legacy
-  #keyboard interrupt in 8259 bit 1, then the value should be set to
-  #0xFFFC.
-  # b) If all thunk call provied by CSM binary do not require legacy
-  #interrupt support, value should be set to 0x or 0xFFFE.
-  #
-  #  The default value of legacy mode mask could be changed by
-  #  EFI_LEGACY_8259_PROTOCOL->SetMask(). But it is rarely need change it
-  #  except some special cases such as when initializing the CSM binary, it
-  #  should be set to 0x to mask all legacy interrupt. Please restore the
-  #  original legacy mask value if changing is made for these special case.
-  gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeMask|0x|UINT16|0x3
-
-  ## Pcd8259LegacyModeEdgeLevel defines the default edge level for legacy
-  #  mode's interrrupt controller.
-  #  For the corresponding bits, 0 = Edge triggered and 1 = Level triggered.
-  gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x|UINT16|0x5
-
   gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr|0x0|UINT32|0x17
   gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtrSize|0x0|UINT32|0x32
 
diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index a00f4c12904c..f416193984f6 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -460,9 +460,6 @@ [PcdsFixedAtBuild]
   gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x100
   gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0x100
 
-  # IRQs 5, 9, 10, 11 are level-triggered
-  gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20
-
   # Point to the MdeModulePkg/Application/UiApp/UiApp.inf
   gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 
0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
 
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index af0ecb0453ea..152d05b52c3d 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -457,9 +457,6 @@ [PcdsFixedAtBuild]
 
   gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x2
 
-  # IRQs 5, 9, 10, 11 are level-triggered
-  gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20
-
   # Point to the MdeModulePkg/Application/UiApp/UiApp.inf
   gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 
0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
 
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index 75c53c0bb287..b538c234cf2b 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -555,9 +555,6 @@ [PcdsFixedAtBuild]
 
   gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x2
 
-  # IRQs 5, 9, 10, 11 are level-triggered
-  gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x0E20
-
   # Point to the MdeModulePkg/Application/UiApp/UiApp.inf
   gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 
0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 }
 
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 8021c2f325f3..361fdec7a8c1 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -580,9 +580,6 @@ [PcdsFixedAtBuild]
   

[edk2-devel] [PATCH 37/37] OvmfPkg: remove CSM_ENABLE build macro

2023-11-10 Thread Laszlo Ersek
At this point, the CSM_ENABLE conditionals only bracket the !error
directives that we added at the front of this series; it's time to remove
CSM_ENABLE.

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Corvin Köhne 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Bhyve/BhyveX64.dsc   | 7 +--
 OvmfPkg/IntelTdx/IntelTdxX64.dsc | 3 ---
 OvmfPkg/OvmfPkgIa32.dsc  | 3 ---
 OvmfPkg/OvmfPkgIa32X64.dsc   | 3 ---
 OvmfPkg/OvmfPkgX64.dsc   | 3 ---
 OvmfPkg/OvmfXen.dsc  | 3 ---
 6 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 85ad6b194c91..7004f00c69db 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -662,12 +662,7 @@ [Components]
   MdeModulePkg/Universal/Metronome/Metronome.inf
   PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf
   MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
-  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
-
-!ifdef $(CSM_ENABLE)
-!error "CSM is being torn down"
-!endif
-  }
+  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
   MdeModulePkg/Logo/LogoDxe.inf
   MdeModulePkg/Application/UiApp/UiApp.inf {
 
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index 152d05b52c3d..aaf8cc6b5dca 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -375,9 +375,6 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
-!ifdef $(CSM_ENABLE)
-!error "CSM is being torn down"
-!endif
 !if $(SECURE_BOOT_ENABLE) == TRUE
   gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootSupported|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdRequireSelfSignedPk|TRUE
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 361fdec7a8c1..135275a01f32 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -470,9 +470,6 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
-!ifdef $(CSM_ENABLE)
-!error "CSM is being torn down"
-!endif
 !if $(SMM_REQUIRE) == TRUE
   gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire|TRUE
   gUefiCpuPkgTokenSpaceGuid.PcdCpuHotPlugSupport|TRUE
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 4e362600ff8d..fda01a71ab33 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -477,9 +477,6 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
-!ifdef $(CSM_ENABLE)
-!error "CSM is being torn down"
-!endif
 !if $(SMM_REQUIRE) == TRUE
   gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire|TRUE
   gUefiCpuPkgTokenSpaceGuid.PcdCpuHotPlugSupport|TRUE
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 07592a775895..10cd51f41dbf 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -496,9 +496,6 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
-!ifdef $(CSM_ENABLE)
-!error "CSM is being torn down"
-!endif
 !if $(SMM_REQUIRE) == TRUE
   gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire|TRUE
   gUefiCpuPkgTokenSpaceGuid.PcdCpuHotPlugSupport|TRUE
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 9548ffb9482c..19db45c9e996 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -362,9 +362,6 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
-!ifdef $(CSM_ENABLE)
-!error "CSM is being torn down"
-!endif
 
 [PcdsFixedAtBuild]
   gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|TRUE


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

2023-11-10 Thread Laszlo Ersek
At this point, gEfiLegacy8259ProtocolGuid is unused; remove it.

This shrinks the list of resources scheduled for removal to:

- PCDs:
  - Pcd8259LegacyModeEdgeLevel
  - Pcd8259LegacyModeMask

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec   |   1 -
 OvmfPkg/Include/Protocol/Legacy8259.h | 290 
 2 files changed, 291 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 9d326e8143eb..2e9e699aa6ab 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -181,7 +181,6 @@ [Protocols]
   gXenBusProtocolGuid   = {0x3d3ca290, 0xb9a5, 0x11e3, {0xb7, 
0x5d, 0xb8, 0xac, 0x6f, 0x7d, 0x65, 0xe6}}
   gXenIoProtocolGuid= {0x6efac84f, 0x0ab0, 0x4747, {0x81, 
0xbe, 0x85, 0x55, 0x62, 0x59, 0x04, 0x49}}
   gIoMmuAbsentProtocolGuid  = {0xf8775d50, 0x8abd, 0x4adf, {0x92, 
0xac, 0x85, 0x3e, 0x51, 0xf6, 0xc8, 0xdc}}
-  gEfiLegacy8259ProtocolGuid= {0x38321dba, 0x4fe0, 0x4e17, {0x8a, 
0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1}}
   gOvmfLoadedX86LinuxKernelProtocolGuid = {0xa3edc05d, 0xb618, 0x4ff6, {0x95, 
0x52, 0x76, 0xd7, 0x88, 0x63, 0x43, 0xc8}}
   gOvmfSevMemoryAcceptanceProtocolGuid  = {0xc5a010fe, 0x38a7, 0x4531, {0x8a, 
0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49}}
   gQemuAcpiTableNotifyProtocolGuid  = {0x928939b2, 0x4235, 0x462f, {0x95, 
0x80, 0xf6, 0xa2, 0xb2, 0xc2, 0x1a, 0x4f}}
diff --git a/OvmfPkg/Include/Protocol/Legacy8259.h 
b/OvmfPkg/Include/Protocol/Legacy8259.h
deleted file mode 100644
index 233e817c0696..
--- a/OvmfPkg/Include/Protocol/Legacy8259.h
+++ /dev/null
@@ -1,290 +0,0 @@
-/** @file
-  This protocol abstracts the 8259 interrupt controller. This includes
-  PCI IRQ routing needed to program the PCI Interrupt Line register.
-
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-  @par Revision Reference:
-  This protocol is defined in Framework for EFI Compatibility Support Module 
spec
-  Version 0.97.
-
-**/
-
-#ifndef _EFI_LEGACY_8259_H_
-#define _EFI_LEGACY_8259_H_
-
-#define EFI_LEGACY_8259_PROTOCOL_GUID \
-  { \
-0x38321dba, 0x4fe0, 0x4e17, {0x8a, 0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 
0xc1 } \
-  }
-
-typedef struct _EFI_LEGACY_8259_PROTOCOL EFI_LEGACY_8259_PROTOCOL;
-
-typedef enum {
-  Efi8259Irq0,
-  Efi8259Irq1,
-  Efi8259Irq2,
-  Efi8259Irq3,
-  Efi8259Irq4,
-  Efi8259Irq5,
-  Efi8259Irq6,
-  Efi8259Irq7,
-  Efi8259Irq8,
-  Efi8259Irq9,
-  Efi8259Irq10,
-  Efi8259Irq11,
-  Efi8259Irq12,
-  Efi8259Irq13,
-  Efi8259Irq14,
-  Efi8259Irq15,
-  Efi8259IrqMax
-} EFI_8259_IRQ;
-
-typedef enum {
-  Efi8259LegacyMode,
-  Efi8259ProtectedMode,
-  Efi8259MaxMode
-} EFI_8259_MODE;
-
-/**
-  Get the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
-  the legacy mode mask and the protected mode mask. The base address for the 
8259
-  is different for legacy and protected mode, so two masks are required.
-
-  @param  This  The protocol instance pointer.
-  @param  MasterBaseThe base vector for the Master PIC in the 8259 
controller.
-  @param  SlaveBase The base vector for the Slave PIC in the 8259 
controller.
-
-  @retval EFI_SUCCESS   The new bases were programmed.
-  @retval EFI_DEVICE_ERROR  A device error occurred programming the vector 
bases.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_LEGACY_8259_SET_VECTOR_BASE)(
-  IN EFI_LEGACY_8259_PROTOCOL   *This,
-  IN  UINT8 MasterBase,
-  IN  UINT8 SlaveBase
-  );
-
-/**
-  Get the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
-  the legacy mode mask and the protected mode mask. The base address for the 
8259
-  is different for legacy and protected mode, so two masks are required.
-
-  @param  This  The protocol instance pointer.
-  @param  LegacyMaskBit 0 is Irq0 - Bit 15 is Irq15.
-  @param  LegacyEdgeLevel   Bit 0 is Irq0 - Bit 15 is Irq15.
-  @param  ProtectedMask Bit 0 is Irq0 - Bit 15 is Irq15.
-  @param  ProtectedEdgeLevelBit 0 is Irq0 - Bit 15 is Irq15.
-
-  @retval EFI_SUCCESS   8259 status returned.
-  @retval EFI_DEVICE_ERROR  Error reading 8259.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_LEGACY_8259_GET_MASK)(
-  IN EFI_LEGACY_8259_PROTOCOL   *This,
-  OUT UINT16*LegacyMask  OPTIONAL,
-  OUT UINT16*LegacyEdgeLevel  OPTIONAL,
-  OUT UINT16*ProtectedMask  OPTIONAL,
-  OUT UINT16*ProtectedEdgeLevel OPTIONAL
-  );
-
-/**
-  Set the 8259 interrupt masks for Irq0 - Irq15. A different mask exists for
-  the legacy mode mask and the protected mode mask. The base address for the 
8259
-  is different for legacy and 

[edk2-devel] [PATCH 34/37] OvmfPkg: remove 8259InterruptControllerDxe

2023-11-10 Thread Laszlo Ersek
8259InterruptControllerDxe is not used by any platforms at this point,
remove it.

This patch removes mentions of the following CSM resources from the source
code:

- GUIDs (protocols or otherwise):
  - gEfiLegacy8259ProtocolGuid

- headers:
  - Protocol/Legacy8259.h

- PCDs:
  - Pcd8259LegacyModeEdgeLevel
  - Pcd8259LegacyModeMask

which extends the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - gEfiLegacy8259ProtocolGuid

- headers:
  - Protocol/Legacy8259.h

- PCDs:
  - Pcd8259LegacyModeEdgeLevel
  - Pcd8259LegacyModeMask

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/8259InterruptControllerDxe/Legacy8259.uni  |  16 -
 OvmfPkg/8259InterruptControllerDxe/Legacy8259Extra.uni |  14 -
 OvmfPkg/8259InterruptControllerDxe/8259.inf|  45 --
 OvmfPkg/8259InterruptControllerDxe/8259.h  | 218 ---
 OvmfPkg/8259InterruptControllerDxe/8259.c  | 622 

 5 files changed, 915 deletions(-)

diff --git a/OvmfPkg/8259InterruptControllerDxe/Legacy8259.uni 
b/OvmfPkg/8259InterruptControllerDxe/Legacy8259.uni
deleted file mode 100644
index d03529241958..
--- a/OvmfPkg/8259InterruptControllerDxe/Legacy8259.uni
+++ /dev/null
@@ -1,16 +0,0 @@
-// /** @file
-// 8259 Interrupt Controller driver that provides Legacy 8259 protocol.
-//
-// 8259 Interrupt Controller driver that provides Legacy 8259 protocol.
-//
-// Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "8259 Interrupt 
Controller driver that provides Legacy 8259 protocol"
-
-#string STR_MODULE_DESCRIPTION  #language en-US "8259 Interrupt 
Controller driver that provides Legacy 8259 protocol."
-
diff --git a/OvmfPkg/8259InterruptControllerDxe/Legacy8259Extra.uni 
b/OvmfPkg/8259InterruptControllerDxe/Legacy8259Extra.uni
deleted file mode 100644
index ee43f6923c45..
--- a/OvmfPkg/8259InterruptControllerDxe/Legacy8259Extra.uni
+++ /dev/null
@@ -1,14 +0,0 @@
-// /** @file
-// Legacy8259 Localized Strings and Content
-//
-// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-#string STR_PROPERTIES_MODULE_NAME
-#language en-US
-"Legacy 8259 Interrupt Controller DXE Driver"
-
-
diff --git a/OvmfPkg/8259InterruptControllerDxe/8259.inf 
b/OvmfPkg/8259InterruptControllerDxe/8259.inf
deleted file mode 100644
index 7320ff2490a7..
--- a/OvmfPkg/8259InterruptControllerDxe/8259.inf
+++ /dev/null
@@ -1,45 +0,0 @@
-## @file
-# 8259 Interrupt Controller driver that provides Legacy 8259 protocol.
-#
-# Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
-  INF_VERSION= 0x00010005
-  BASE_NAME  = Legacy8259
-  MODULE_UNI_FILE= Legacy8259.uni
-  FILE_GUID  = 245CB4DA-8E15-4A1B-87E3-9878FFA07520
-  MODULE_TYPE= DXE_DRIVER
-  VERSION_STRING = 1.0
-  ENTRY_POINT= Install8259
-
-[Sources]
-  8259.c
-  8259.h
-
-[Packages]
-  MdePkg/MdePkg.dec
-  OvmfPkg/OvmfPkg.dec
-
-[LibraryClasses]
-  UefiBootServicesTableLib
-  DebugLib
-  UefiDriverEntryPoint
-  IoLib
-  PcdLib
-
-[Protocols]
-  gEfiLegacy8259ProtocolGuid## PRODUCES
-  gEfiPciIoProtocolGuid ## SOMETIMES_CONSUMES
-
-[Pcd]
-  gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeMask  ## CONSUMES
-  gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel ## CONSUMES
-
-[Depex]
-  TRUE
-
-[UserExtensions.TianoCore."ExtraFiles"]
-  Legacy8259Extra.uni
diff --git a/OvmfPkg/8259InterruptControllerDxe/8259.h 
b/OvmfPkg/8259InterruptControllerDxe/8259.h
deleted file mode 100644
index 066552ca933e..
--- a/OvmfPkg/8259InterruptControllerDxe/8259.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/** @file
-  Driver implementing the Tiano Legacy 8259 Protocol
-
-Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _8259_H__
-#define _8259_H__
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-// 8259 Hardware definitions
-
-#define LEGACY_MODE_BASE_VECTOR_MASTER  0x08
-#define LEGACY_MODE_BASE_VECTOR_SLAVE   0x70
-
-#define PROTECTED_MODE_BASE_VECTOR_MASTER  0x68
-#define PROTECTED_MODE_BASE_VECTOR_SLAVE   0x70
-
-#define LEGACY_8259_CONTROL_REGISTER_MASTER   0x20
-#define LEGACY_8259_MASK_REGISTER_MASTER  0x21
-#define LEGACY_8259_CONTROL_REGISTER_SLAVE0xA0
-#define LEGACY_8259_MASK_REGISTER_SLAVE   0xA1
-#define 

[edk2-devel] [PATCH 33/37] OvmfPkg: exclude 8259InterruptControllerDxe

2023-11-10 Thread Laszlo Ersek
With 8254TimerDxe gone, no module in OVMF consumes
gEfiLegacy8259ProtocolGuid; exclude 8259InterruptControllerDxe therefore.

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkgIa32.dsc| 3 ---
 OvmfPkg/OvmfPkgIa32X64.dsc | 3 ---
 OvmfPkg/OvmfPkgX64.dsc | 3 ---
 OvmfPkg/OvmfPkgIa32.fdf| 3 ---
 OvmfPkg/OvmfPkgIa32X64.fdf | 3 ---
 OvmfPkg/OvmfPkgX64.fdf | 3 ---
 6 files changed, 18 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index a98406cb8ca6..8021c2f325f3 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -753,9 +753,6 @@ [Components]
   MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
   UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
   UefiCpuPkg/CpuDxe/CpuDxe.inf
-!ifdef $(CSM_ENABLE)
-  OvmfPkg/8259InterruptControllerDxe/8259.inf
-!endif
   OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
   OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
   OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 6962735f668f..66025fae1fa2 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -767,9 +767,6 @@ [Components.X64]
   MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
   UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
   UefiCpuPkg/CpuDxe/CpuDxe.inf
-!ifdef $(CSM_ENABLE)
-  OvmfPkg/8259InterruptControllerDxe/8259.inf
-!endif
   OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
   OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
   OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 7429136a1ffa..9b1168076f42 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -835,9 +835,6 @@ [Components]
   NULL|OvmfPkg/Library/MpInitLibDepLib/DxeMpInitLibUpDepLib.inf
   }
 
-!ifdef $(CSM_ENABLE)
-  OvmfPkg/8259InterruptControllerDxe/8259.inf
-!endif
   OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
   OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
   OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index c1ff11f50e31..501b4de4695e 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -219,9 +219,6 @@ [FV.DXEFV]
 INF  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
 INF  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
 INF  UefiCpuPkg/CpuDxe/CpuDxe.inf
-!ifdef $(CSM_ENABLE)
-  INF OvmfPkg/8259InterruptControllerDxe/8259.inf
-!endif
 INF  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
 INF  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
 INF  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index 11d73a16df7e..74cfb58f06cd 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -220,9 +220,6 @@ [FV.DXEFV]
 INF  MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
 INF  UefiCpuPkg/CpuIo2Dxe/CpuIo2Dxe.inf
 INF  UefiCpuPkg/CpuDxe/CpuDxe.inf
-!ifdef $(CSM_ENABLE)
-  INF OvmfPkg/8259InterruptControllerDxe/8259.inf
-!endif
 INF  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
 INF  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
 INF  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index dd97615b0d8d..f47ab1727e4c 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -245,9 +245,6 @@ [FV.DXEFV]
 INF  UefiCpuPkg/CpuDxe/CpuDxe.inf
 INF  FILE_GUID = $(UP_CPU_DXE_GUID) UefiCpuPkg/CpuDxe/CpuDxe.inf
 
-!ifdef $(CSM_ENABLE)
-  INF  OvmfPkg/8259InterruptControllerDxe/8259.inf
-!endif
 INF  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
 INF  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
 INF  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf



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

2023-11-10 Thread Laszlo Ersek
8254TimerDxe is not used by any platforms at this point, remove it.

This patch removes mentions of the following CSM resources from the source
code:

- GUIDs (protocols or otherwise):
  - gEfiLegacy8259ProtocolGuid

- headers:
  - Protocol/Legacy8259.h

which extends the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - gEfiLegacy8259ProtocolGuid

- headers:
  - Protocol/Legacy8259.h

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/8254TimerDxe/Timer.uni  |  16 -
 OvmfPkg/8254TimerDxe/TimerExtra.uni |  14 -
 OvmfPkg/8254TimerDxe/8254Timer.inf  |  43 ---
 OvmfPkg/8254TimerDxe/Timer.h| 186 -
 OvmfPkg/8254TimerDxe/Timer.c| 406 
 5 files changed, 665 deletions(-)

diff --git a/OvmfPkg/8254TimerDxe/Timer.uni b/OvmfPkg/8254TimerDxe/Timer.uni
deleted file mode 100644
index 7f3d35f4e1cd..
--- a/OvmfPkg/8254TimerDxe/Timer.uni
+++ /dev/null
@@ -1,16 +0,0 @@
-// /** @file
-// 8254 timer driver that provides Timer Arch protocol.
-//
-// 8254 timer driver that provides Timer Arch protocol.
-//
-// Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-
-#string STR_MODULE_ABSTRACT #language en-US "8254 timer driver 
that provides Timer Arch protocol"
-
-#string STR_MODULE_DESCRIPTION  #language en-US "8254 timer driver 
that provides Timer Arch protocol."
-
diff --git a/OvmfPkg/8254TimerDxe/TimerExtra.uni 
b/OvmfPkg/8254TimerDxe/TimerExtra.uni
deleted file mode 100644
index 7a54767a451b..
--- a/OvmfPkg/8254TimerDxe/TimerExtra.uni
+++ /dev/null
@@ -1,14 +0,0 @@
-// /** @file
-// Timer Localized Strings and Content
-//
-// Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-#string STR_PROPERTIES_MODULE_NAME
-#language en-US
-"8254 Timer DXE Driver"
-
-
diff --git a/OvmfPkg/8254TimerDxe/8254Timer.inf 
b/OvmfPkg/8254TimerDxe/8254Timer.inf
deleted file mode 100644
index 8fbab896f01b..
--- a/OvmfPkg/8254TimerDxe/8254Timer.inf
+++ /dev/null
@@ -1,43 +0,0 @@
-## @file
-# 8254 timer driver that provides Timer Arch protocol.
-#
-# Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
-  INF_VERSION= 0x00010005
-  BASE_NAME  = Timer
-  MODULE_UNI_FILE= Timer.uni
-  FILE_GUID  = C190FE35-44AA-41A1-8AEA-4947BC60E09D
-  MODULE_TYPE= DXE_DRIVER
-  VERSION_STRING = 1.0
-
-  ENTRY_POINT= TimerDriverInitialize
-
-[Packages]
-  MdePkg/MdePkg.dec
-  OvmfPkg/OvmfPkg.dec
-
-[LibraryClasses]
-  UefiBootServicesTableLib
-  BaseLib
-  DebugLib
-  NestedInterruptTplLib
-  UefiDriverEntryPoint
-  IoLib
-
-[Sources]
-  Timer.h
-  Timer.c
-
-[Protocols]
-  gEfiCpuArchProtocolGuid   ## CONSUMES
-  gEfiLegacy8259ProtocolGuid## CONSUMES
-  gEfiTimerArchProtocolGuid ## PRODUCES
-
-[Depex]
-  gEfiCpuArchProtocolGuid AND gEfiLegacy8259ProtocolGuid
-[UserExtensions.TianoCore."ExtraFiles"]
-  TimerExtra.uni
diff --git a/OvmfPkg/8254TimerDxe/Timer.h b/OvmfPkg/8254TimerDxe/Timer.h
deleted file mode 100644
index b19ef3c1f94e..
--- a/OvmfPkg/8254TimerDxe/Timer.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/** @file
-  Private data structures
-
-Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-**/
-
-#ifndef _TIMER_H_
-#define _TIMER_H_
-
-#include 
-
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-
-//
-// The PCAT 8253/8254 has an input clock at 1.193182 MHz and Timer 0 is
-// initialized as a 16 bit free running counter that generates an 
interrupt(IRQ0)
-// each time the counter rolls over.
-//
-//   65536 counts
-//  * 1,000,000 uS/S = 54925.4 uS = 549254 * 100 ns
-//   1,193,182 Hz
-//
-
-//
-// The maximum tick duration for 8254 timer
-//
-#define MAX_TIMER_TICK_DURATION  549254
-//
-// The default timer tick duration is set to 10 ms = 10 100 ns units
-//
-#define DEFAULT_TIMER_TICK_DURATION  10
-#define TIMER_CONTROL_PORT   0x43
-#define TIMER0_COUNT_PORT0x40
-
-//
-// Function Prototypes
-//
-
-/**
-  Initialize the Timer Architectural Protocol driver
-
-  @param ImageHandle ImageHandle of the loaded driver
-  @param SystemTable Pointer to the System Table
-
-  @retval EFI_SUCCESSTimer Architectural Protocol created
-  @retval EFI_OUT_OF_RESOURCES   Not enough resources available to initialize 
driver.
-  @retval EFI_DEVICE_ERROR   A device error occurred attempting to 
initialize the driver.
-
-**/
-EFI_STATUS
-EFIAPI
-TimerDriverInitialize (
-  IN EFI_HANDLE

[edk2-devel] [PATCH 30/37] OvmfPkg: remove Csm16

2023-11-10 Thread Laszlo Ersek
Csm16 is not used by any platform at this point, remove it.

This shrinks the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - gEfiLegacy8259ProtocolGuid

- headers:
  - Protocol/Legacy8259.h

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Csm/Csm16/Csm16.inf  | 17 -
 OvmfPkg/Csm/Csm16/ReadMe.txt | 12 
 2 files changed, 29 deletions(-)

diff --git a/OvmfPkg/Csm/Csm16/Csm16.inf b/OvmfPkg/Csm/Csm16/Csm16.inf
deleted file mode 100644
index 2bd33e309d7b..
--- a/OvmfPkg/Csm/Csm16/Csm16.inf
+++ /dev/null
@@ -1,17 +0,0 @@
-## @file
-#  CSM Binary
-#
-#  Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
-#  SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
-  INF_VERSION= 0x00010005
-  BASE_NAME  = Csm16
-  FILE_GUID  = 1547B4F3-3E8A-4FEF-81C8-328ED647AB1A
-  MODULE_TYPE= USER_DEFINED
-  VERSION_STRING = 1.0
-
-[Binaries]
-  BIN|Csm16.bin|*
\ No newline at end of file
diff --git a/OvmfPkg/Csm/Csm16/ReadMe.txt b/OvmfPkg/Csm/Csm16/ReadMe.txt
deleted file mode 100644
index 4d5d086bb4a2..
--- a/OvmfPkg/Csm/Csm16/ReadMe.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-This module allows a CSM16 binary to be easily included
-in the OVMF.fd output file.
-
-=== How to use Csm16.inf ===
-
-1. Copy the CSM16 binary to OvmfPkg/Csm/Csm16/Csm16.bin
-2. Build OVMF with CSM_ENABLE defined.
-
-   For example:
-   * build -D CSM_ENABLE, or
-   * OvmfPkg/build.sh -D CSM_ENABLE
-



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111099): https://edk2.groups.io/g/devel/message/111099
Mute This Topic: https://groups.io/mt/102518670/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 29/37] OvmfPkg: remove Rule.Common.USER_DEFINED.CSM from all FDF files

2023-11-10 Thread Laszlo Ersek
We no longer have

  INF  RuleOverride=CSM OvmfPkg/Csm/Csm16/Csm16.inf

lines in any of the OVMF platform FDF files; remove the CSM rules
themselves.

(Note that some of the more recent platforms had cargo-culted this rule
from the original ones, without ever referencing the rule with
RuleOverride=CSM. Remove those rules as well.)

Cc: Anatol Belski 
Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Corvin Köhne 
Cc: Gerd Hoffmann 
Cc: Jianyong Wu 
Cc: Jiewen Yao 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Bhyve/BhyveX64.fdf   | 5 -
 OvmfPkg/CloudHv/CloudHvX64.fdf   | 5 -
 OvmfPkg/IntelTdx/IntelTdxX64.fdf | 5 -
 OvmfPkg/Microvm/MicrovmX64.fdf   | 5 -
 OvmfPkg/OvmfPkgIa32.fdf  | 5 -
 OvmfPkg/OvmfPkgIa32X64.fdf   | 5 -
 OvmfPkg/OvmfPkgX64.fdf   | 5 -
 OvmfPkg/OvmfXen.fdf  | 5 -
 8 files changed, 40 deletions(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.fdf b/OvmfPkg/Bhyve/BhyveX64.fdf
index 9cd059de159f..497c6753ce9b 100644
--- a/OvmfPkg/Bhyve/BhyveX64.fdf
+++ b/OvmfPkg/Bhyve/BhyveX64.fdf
@@ -454,11 +454,6 @@ [Rule.Common.USER_DEFINED.ACPITABLE]
 RAW ASL|.aml
   }
 
-[Rule.Common.USER_DEFINED.CSM]
-  FILE FREEFORM = $(NAMED_GUID) {
-RAW BIN|.bin
-  }
-
 [Rule.Common.SEC.RESET_VECTOR]
   FILE RAW = $(NAMED_GUID) {
 RAW BIN   Align = 16   |.bin
diff --git a/OvmfPkg/CloudHv/CloudHvX64.fdf b/OvmfPkg/CloudHv/CloudHvX64.fdf
index eac6557e6b74..eae3ada1913c 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.fdf
+++ b/OvmfPkg/CloudHv/CloudHvX64.fdf
@@ -458,11 +458,6 @@ [Rule.Common.UEFI_APPLICATION.BINARY]
 VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
   }
 
-[Rule.Common.USER_DEFINED.CSM]
-  FILE FREEFORM = $(NAMED_GUID) {
-RAW BIN|.bin
-  }
-
 [Rule.Common.SEC.RESET_VECTOR]
   FILE RAW = $(NAMED_GUID) {
 RAW BIN   Align = 16   |.bin
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.fdf b/OvmfPkg/IntelTdx/IntelTdxX64.fdf
index 69074cfb1e73..e844a0988d68 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.fdf
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.fdf
@@ -431,11 +431,6 @@ [Rule.Common.UEFI_APPLICATION.BINARY]
 VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
   }
 
-[Rule.Common.USER_DEFINED.CSM]
-  FILE FREEFORM = $(NAMED_GUID) {
-RAW BIN|.bin
-  }
-
 [Rule.Common.SEC.RESET_VECTOR]
   FILE RAW = $(NAMED_GUID) {
 RAW BIN   Align = 16   |.bin
diff --git a/OvmfPkg/Microvm/MicrovmX64.fdf b/OvmfPkg/Microvm/MicrovmX64.fdf
index a9b6618ca811..c877b3f088f9 100644
--- a/OvmfPkg/Microvm/MicrovmX64.fdf
+++ b/OvmfPkg/Microvm/MicrovmX64.fdf
@@ -416,11 +416,6 @@ [Rule.Common.UEFI_APPLICATION.BINARY]
 VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
   }
 
-[Rule.Common.USER_DEFINED.CSM]
-  FILE FREEFORM = $(NAMED_GUID) {
-RAW BIN|.bin
-  }
-
 [Rule.Common.SEC.RESET_VECTOR]
   FILE RAW = $(NAMED_GUID) {
 RAW BIN   Align = 16   |.bin
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index f7652bb7009c..44e3b4e140d0 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -484,11 +484,6 @@ [Rule.Common.UEFI_APPLICATION.BINARY]
 VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
   }
 
-[Rule.Common.USER_DEFINED.CSM]
-  FILE FREEFORM = $(NAMED_GUID) {
-RAW BIN|.bin
-  }
-
 [Rule.Common.SEC.RESET_VECTOR]
   FILE RAW = $(NAMED_GUID) {
 RAW BIN   Align = 16   |.bin
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index 74049ec129d2..1fbfdd40c58a 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -487,11 +487,6 @@ [Rule.Common.UEFI_APPLICATION.BINARY]
 VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
   }
 
-[Rule.Common.USER_DEFINED.CSM]
-  FILE FREEFORM = $(NAMED_GUID) {
-RAW BIN|.bin
-  }
-
 [Rule.Common.SEC.RESET_VECTOR]
   FILE RAW = $(NAMED_GUID) {
 RAW BIN   Align = 16   |.bin
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 48b97d90e820..2220d1769c91 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -521,11 +521,6 @@ [Rule.Common.UEFI_APPLICATION.BINARY]
 VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
   }
 
-[Rule.Common.USER_DEFINED.CSM]
-  FILE FREEFORM = $(NAMED_GUID) {
-RAW BIN|.bin
-  }
-
 [Rule.Common.SEC.RESET_VECTOR]
   FILE RAW = $(NAMED_GUID) {
 RAW BIN   Align = 16   |.bin
diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf
index 18f8c81b0ef7..5770b173168b 100644
--- a/OvmfPkg/OvmfXen.fdf
+++ b/OvmfPkg/OvmfXen.fdf
@@ -462,11 +462,6 @@ [Rule.Common.UEFI_APPLICATION.BINARY]
 VERSION   STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
   }
 
-[Rule.Common.USER_DEFINED.CSM]
-  FILE FREEFORM = $(NAMED_GUID) {
-RAW BIN|.bin
-  }
-
 

[edk2-devel] [PATCH 28/37] OvmfPkg: exclude Csm16.inf / Csm16.bin

2023-11-10 Thread Laszlo Ersek
The Csm16 module wraps the CONFIG_CSM build of SeaBIOS. "Csm16.inf" has
FILE_GUID 1547B4F3-3E8A-4FEF-81C8-328ED647AB1A, which was previously
referenced by the (now removed) CsmSupportLib, under the name
SYSTEM_ROM_FILE_GUID.

Nothing relies on the SeaBIOS binary any longer, so exclude the Csm16
module from all OVMF platforms.

(Note that the "OvmfPkg/Bhyve/Csm/BhyveCsm16/BhyveCsm16.inf" pathname that
the BhyveX64 platform refers to is bogus anyway.)

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Corvin Köhne 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Bhyve/BhyveX64.dsc | 4 
 OvmfPkg/OvmfPkgIa32.dsc| 4 
 OvmfPkg/OvmfPkgIa32X64.dsc | 4 
 OvmfPkg/OvmfPkgX64.dsc | 4 
 OvmfPkg/OvmfXen.dsc| 4 
 OvmfPkg/Bhyve/BhyveX64.fdf | 4 
 OvmfPkg/OvmfPkgIa32.fdf| 4 
 OvmfPkg/OvmfPkgIa32X64.fdf | 4 
 OvmfPkg/OvmfPkgX64.fdf | 4 
 OvmfPkg/OvmfXen.fdf| 4 
 10 files changed, 40 deletions(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index b26e5053f69b..85ad6b194c91 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -762,10 +762,6 @@ [Components]
   MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
-!ifdef $(CSM_ENABLE)
-  OvmfPkg/Bhyve/Csm/BhyveCsm16/BhyveCsm16.inf
-!endif
-
 !if $(TOOL_CHAIN_TAG) != "XCODE5"
   ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
 
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index d4f4460425c3..fcd7f4a58957 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -886,10 +886,6 @@ [Components]
   MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
-!ifdef $(CSM_ENABLE)
-  OvmfPkg/Csm/Csm16/Csm16.inf
-!endif
-
 !if $(TOOL_CHAIN_TAG) != "XCODE5" && $(BUILD_SHELL) == TRUE
   ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
 
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 6e87a7a43704..8cbe3733aba2 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -900,10 +900,6 @@ [Components.X64]
   MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
-!ifdef $(CSM_ENABLE)
-  OvmfPkg/Csm/Csm16/Csm16.inf
-!endif
-
 !if $(TOOL_CHAIN_TAG) != "XCODE5" && $(BUILD_SHELL) == TRUE
   ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
 
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 1916abdf67f1..288c2cf28abf 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -968,10 +968,6 @@ [Components]
   MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
-!ifdef $(CSM_ENABLE)
-  OvmfPkg/Csm/Csm16/Csm16.inf
-!endif
-
 !if $(TOOL_CHAIN_TAG) != "XCODE5" && $(BUILD_SHELL) == TRUE
   ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
 
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 4e195b66c379..d8552ad37ea2 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -693,10 +693,6 @@ [Components]
   MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
-!ifdef $(CSM_ENABLE)
-  OvmfPkg/Csm/Csm16/Csm16.inf
-!endif
-
 !if $(TOOL_CHAIN_TAG) != "XCODE5"
   ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf {
 
diff --git a/OvmfPkg/Bhyve/BhyveX64.fdf b/OvmfPkg/Bhyve/BhyveX64.fdf
index 8b5aa46a1e33..9cd059de159f 100644
--- a/OvmfPkg/Bhyve/BhyveX64.fdf
+++ b/OvmfPkg/Bhyve/BhyveX64.fdf
@@ -295,10 +295,6 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
 INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
-!ifdef $(CSM_ENABLE)
-INF  RuleOverride=CSM OvmfPkg/Bhyve/Csm/BhyveCsm16/BhyveCsm16.inf
-!endif
-
 INF  OvmfPkg/PlatformDxe/Platform.inf
 INF  OvmfPkg/AmdSevDxe/AmdSevDxe.inf
 INF  OvmfPkg/IoMmuDxe/IoMmuDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index d55a6e1590d0..f7652bb7009c 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -325,10 +325,6 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
 INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
-!ifdef $(CSM_ENABLE)
-INF  RuleOverride=CSM OvmfPkg/Csm/Csm16/Csm16.inf
-!endif
-
 INF  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
 INF  OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf
 INF  OvmfPkg/VirtioGpuDxe/VirtioGpu.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index d9ae001a669d..74049ec129d2 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -331,10 +331,6 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
 INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
-!ifdef $(CSM_ENABLE)
-INF  

[edk2-devel] [PATCH 31/37] OvmfPkg: exclude 8254TimerDxe

2023-11-10 Thread Laszlo Ersek
In the original three OVMF platforms, CSM_ENABLE selects the legacy timer
driver; exclude it. Instead, include LocalApicTimerDxe unconditionally
(which in turn consumes PcdFSBClock).

Background: commits c37cbc030d96 ("OvmfPkg: Switch timer in build time for
OvmfPkg", 2022-04-02) and 07c0c2eb0a59 ("OvmfPkg: fix PcdFSBClock",
2022-05-25).

Regression test: verified that the BDS progress bar still advanced at
normal speed in each platform.

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkgIa32.dsc| 6 +-
 OvmfPkg/OvmfPkgIa32X64.dsc | 6 +-
 OvmfPkg/OvmfPkgX64.dsc | 6 +-
 OvmfPkg/OvmfPkgIa32.fdf| 4 +---
 OvmfPkg/OvmfPkgIa32X64.fdf | 4 +---
 OvmfPkg/OvmfPkgX64.fdf | 4 +---
 6 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index fcd7f4a58957..a98406cb8ca6 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -669,9 +669,7 @@ [PcdsDynamicDefault]
   # Set ConfidentialComputing defaults
   gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0
 
-!if $(CSM_ENABLE) == FALSE
   gEfiMdePkgTokenSpaceGuid.PcdFSBClock|10
-!endif
 
 [PcdsDynamicHii]
 !include OvmfPkg/Include/Dsc/OvmfTpmPcdsHii.dsc.inc
@@ -757,10 +755,8 @@ [Components]
   UefiCpuPkg/CpuDxe/CpuDxe.inf
 !ifdef $(CSM_ENABLE)
   OvmfPkg/8259InterruptControllerDxe/8259.inf
-  OvmfPkg/8254TimerDxe/8254Timer.inf
-!else
+!endif
   OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
-!endif
   OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
   OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 8cbe3733aba2..6962735f668f 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -677,9 +677,7 @@ [PcdsDynamicDefault]
   # Set ConfidentialComputing defaults
   gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0
 
-!if $(CSM_ENABLE) == FALSE
   gEfiMdePkgTokenSpaceGuid.PcdFSBClock|10
-!endif
 
 [PcdsDynamicDefault.X64]
   # IPv4 and IPv6 PXE Boot support.
@@ -771,10 +769,8 @@ [Components.X64]
   UefiCpuPkg/CpuDxe/CpuDxe.inf
 !ifdef $(CSM_ENABLE)
   OvmfPkg/8259InterruptControllerDxe/8259.inf
-  OvmfPkg/8254TimerDxe/8254Timer.inf
-!else
+!endif
   OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
-!endif
   OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
   OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 288c2cf28abf..7429136a1ffa 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -701,9 +701,7 @@ [PcdsDynamicDefault]
   # Set ConfidentialComputing defaults
   gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr|0
 
-!if $(CSM_ENABLE) == FALSE
   gEfiMdePkgTokenSpaceGuid.PcdFSBClock|10
-!endif
 
 [PcdsDynamicHii]
 !include OvmfPkg/Include/Dsc/OvmfTpmPcdsHii.dsc.inc
@@ -839,10 +837,8 @@ [Components]
 
 !ifdef $(CSM_ENABLE)
   OvmfPkg/8259InterruptControllerDxe/8259.inf
-  OvmfPkg/8254TimerDxe/8254Timer.inf
-!else
+!endif
   OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
-!endif
   OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
   OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
   MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index 44e3b4e140d0..c1ff11f50e31 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -221,10 +221,8 @@ [FV.DXEFV]
 INF  UefiCpuPkg/CpuDxe/CpuDxe.inf
 !ifdef $(CSM_ENABLE)
   INF OvmfPkg/8259InterruptControllerDxe/8259.inf
-  INF OvmfPkg/8254TimerDxe/8254Timer.inf
-!else
-  INF OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
 !endif
+INF  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
 INF  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
 INF  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
 INF  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index 1fbfdd40c58a..11d73a16df7e 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -222,10 +222,8 @@ [FV.DXEFV]
 INF  UefiCpuPkg/CpuDxe/CpuDxe.inf
 !ifdef $(CSM_ENABLE)
   INF OvmfPkg/8259InterruptControllerDxe/8259.inf
-  INF OvmfPkg/8254TimerDxe/8254Timer.inf
-!else
-  INF OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
 !endif
+INF  OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf
 INF  OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
 INF  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
 INF  MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 2220d1769c91..dd97615b0d8d 100644

[edk2-devel] [PATCH 27/37] OvmfPkg: remove

2023-11-10 Thread Laszlo Ersek
The  header is not used by any source file at this point,
remove it.

 is a thin wrapper for including all header files under
the "OvmfPkg/Csm/Include/Framework" directory. Remove that directory at
the same time (nothing else references contents in that directory
directly).

Consequently, the "OvmfPkg/Csm/Include" directory becomes empty, and git
automatically deletes it; remove that include path from
"OvmfPkg/OvmfPkg.dec".

This shrinks the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - SYSTEM_ROM_FILE_GUID (1547B4F3-3E8A-4FEF-81C8-328ED647AB1A)
  - gEfiLegacy8259ProtocolGuid

- headers:
  - Protocol/Legacy8259.h

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec |   1 -
 OvmfPkg/Csm/Include/Framework/BootScript.h  |  40 --
 OvmfPkg/Csm/Include/Framework/DxeCis.h  | 169 
-
 OvmfPkg/Csm/Include/Framework/FirmwareVolumeHeader.h|  79 
 OvmfPkg/Csm/Include/Framework/FirmwareVolumeImageFormat.h   |  32 --
 OvmfPkg/Csm/Include/Framework/FrameworkInternalFormRepresentation.h | 396 

 OvmfPkg/Csm/Include/Framework/Hob.h |  28 --
 OvmfPkg/Csm/Include/Framework/StatusCode.h  | 155 

 OvmfPkg/Csm/Include/FrameworkDxe.h  |  26 --
 9 files changed, 926 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 32543e466ad7..9d326e8143eb 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -17,7 +17,6 @@ [Defines]
 
 [Includes]
   Include
-  Csm/Include
 
 [LibraryClasses]
   ##  @libraryclass  Search and install ACPI tables.
diff --git a/OvmfPkg/Csm/Include/Framework/BootScript.h 
b/OvmfPkg/Csm/Include/Framework/BootScript.h
deleted file mode 100644
index ea1d03cf479d..
--- a/OvmfPkg/Csm/Include/Framework/BootScript.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/** @file
-  This file contains the boot script definitions that are shared between the
-  Boot Script Executor PPI and the Boot Script Save Protocol.
-
-Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _BOOT_SCRIPT_H_
-#define _BOOT_SCRIPT_H_
-
-#include 
-///
-/// The framework implementation defines follow opcode that are different from 
the PI specification:
-/// Add FRAMEWORK_ prefix to avoid naming conflict.
-///
-/// S3 Boot Script Table identifier.
-///
-#define FRAMEWORK_EFI_ACPI_S3_RESUME_SCRIPT_TABLE  0x00
-///
-/// The opcode is used to add a record for memory reads of the memory location 
and continues when the
-/// exit criteria is satisfied, or after a defined duration.
-///
-#define FRAMEWORK_EFI_BOOT_SCRIPT_MEM_POLL_OPCODE  0x09
-///
-/// The opcode is used to add a record for dispatching specified arbitrary 
code into a specified
-/// boot script table.
-///
-#define FRAMEWORK_EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE  0x0D
-///
-/// The opcode indicates the start of the boot script table.
-///
-#define FRAMEWORK_EFI_BOOT_SCRIPT_TABLE_OPCODE  0xAA
-///
-/// The opcode indicates the end of the boot script table.
-///
-#define FRAMEWORK_EFI_BOOT_SCRIPT_TERMINATE_OPCODE  0xFF
-
-#endif
diff --git a/OvmfPkg/Csm/Include/Framework/DxeCis.h 
b/OvmfPkg/Csm/Include/Framework/DxeCis.h
deleted file mode 100644
index d2ee61d681fb..
--- a/OvmfPkg/Csm/Include/Framework/DxeCis.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/** @file
-  Include file for definitions in the Intel Platform Innovation Framework for 
EFI
-  Driver Execution Environment Core Interface Specification (DXE CIS) Version 
0.91.
-
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _DXECIS_H_
-#define _DXECIS_H_
-
-#include 
-
-/**
-  Functions of this type are used with the Framework MP Services Protocol and
-  the  SMM Services Table to execute a procedure on enabled APs.  The context
-  the AP should use durng execution is specified by Buffer.
-
-  @param[in]  Buffer   The pointer to the procedure's argument.
-
-**/
-typedef
-VOID
-(EFIAPI *FRAMEWORK_EFI_AP_PROCEDURE)(
-  IN  VOID  *Buffer
-  );
-
-///
-/// The Framework EFI Runtime Services Table as an extension to the EFI 1.10 
Runtime Services Table.
-///
-typedef struct {
-  //
-  // Table header for the Framework EFI Runtime Services Table
-  //
-  EFI_TABLE_HEADERHdr;
-  //
-  // Time services
-  //
-  EFI_GET_TIMEGetTime;
-  EFI_SET_TIMESetTime;
-  EFI_GET_WAKEUP_TIME GetWakeupTime;
-  EFI_SET_WAKEUP_TIME SetWakeupTime;
-  //
-  // Virtual memory services
-  //
-  EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
-  EFI_CONVERT_POINTER ConvertPointer;
-  //
-  

[edk2-devel] [PATCH 26/37] OvmfPkg: remove gEfiLegacyInterruptProtocolGuid

2023-11-10 Thread Laszlo Ersek
At this point, gEfiLegacyInterruptProtocolGuid is unused; remove it.

This shrinks the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - SYSTEM_ROM_FILE_GUID (1547B4F3-3E8A-4FEF-81C8-328ED647AB1A)
  - gEfiLegacy8259ProtocolGuid

- headers:
  - FrameworkDxe.h
  - Protocol/Legacy8259.h

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec|   1 -
 OvmfPkg/Csm/Include/Protocol/LegacyInterrupt.h | 121 
 2 files changed, 122 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 9c2e84ca6060..32543e466ad7 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -183,7 +183,6 @@ [Protocols]
   gXenIoProtocolGuid= {0x6efac84f, 0x0ab0, 0x4747, {0x81, 
0xbe, 0x85, 0x55, 0x62, 0x59, 0x04, 0x49}}
   gIoMmuAbsentProtocolGuid  = {0xf8775d50, 0x8abd, 0x4adf, {0x92, 
0xac, 0x85, 0x3e, 0x51, 0xf6, 0xc8, 0xdc}}
   gEfiLegacy8259ProtocolGuid= {0x38321dba, 0x4fe0, 0x4e17, {0x8a, 
0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1}}
-  gEfiLegacyInterruptProtocolGuid   = {0x31ce593d, 0x108a, 0x485d, {0xad, 
0xb2, 0x78, 0xf2, 0x1f, 0x29, 0x66, 0xbe}}
   gOvmfLoadedX86LinuxKernelProtocolGuid = {0xa3edc05d, 0xb618, 0x4ff6, {0x95, 
0x52, 0x76, 0xd7, 0x88, 0x63, 0x43, 0xc8}}
   gOvmfSevMemoryAcceptanceProtocolGuid  = {0xc5a010fe, 0x38a7, 0x4531, {0x8a, 
0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49}}
   gQemuAcpiTableNotifyProtocolGuid  = {0x928939b2, 0x4235, 0x462f, {0x95, 
0x80, 0xf6, 0xa2, 0xb2, 0xc2, 0x1a, 0x4f}}
diff --git a/OvmfPkg/Csm/Include/Protocol/LegacyInterrupt.h 
b/OvmfPkg/Csm/Include/Protocol/LegacyInterrupt.h
deleted file mode 100644
index 8287ad5b5c1c..
--- a/OvmfPkg/Csm/Include/Protocol/LegacyInterrupt.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/** @file
-  This protocol abstracts the PIRQ programming from the generic EFI 
Compatibility Support Modules (CSMs).
-
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-  @par Revision Reference:
-  This protocol is defined in Framework for the EFI Compatibility Support 
Module specification.
-  Version 0.97.
-
-**/
-
-#ifndef _EFI_LEGACY_INTERRUPT_H_
-#define _EFI_LEGACY_INTERRUPT_H_
-
-#define EFI_LEGACY_INTERRUPT_PROTOCOL_GUID \
-  { \
-0x31ce593d, 0x108a, 0x485d, {0xad, 0xb2, 0x78, 0xf2, 0x1f, 0x29, 0x66, 
0xbe } \
-  }
-
-typedef struct _EFI_LEGACY_INTERRUPT_PROTOCOL EFI_LEGACY_INTERRUPT_PROTOCOL;
-
-/**
-  Get the number of PIRQs this hardware supports.
-
-  @param  This  The protocol instance pointer.
-  @param  NumberPirsq   The number of PIRQs that are supported.
-
-  @retval EFI_SUCCESS   The number of PIRQs was returned successfully.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_LEGACY_INTERRUPT_GET_NUMBER_PIRQS)(
-  IN EFI_LEGACY_INTERRUPT_PROTOCOL*This,
-  OUT UINT8   *NumberPirqs
-  );
-
-/**
-  Gets the PCI location associated with this protocol.
-
-  @param  This  The Protocol instance pointer.
-  @param  Bus   The PCI Bus.
-  @param  DeviceThe PCI Device.
-  @param  Function  The PCI Function.
-
-  @retval EFI_SUCCESS   The Bus, Device, and Function were returned 
successfully.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_LEGACY_INTERRUPT_GET_LOCATION)(
-  IN EFI_LEGACY_INTERRUPT_PROTOCOL*This,
-  OUT UINT8   *Bus,
-  OUT UINT8   *Device,
-  OUT UINT8   *Function
-  );
-
-/**
-  Read the PIRQ register and return the data
-
-  @param  This  The protocol instance pointer.
-  @param  PirqNumberThe PIRQ register to read.
-  @param  PirqData  The data read.
-
-  @retval EFI_SUCCESS   The data was read.
-  @retval EFI_INVALID_PARAMETER Invalid PIRQ number.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_LEGACY_INTERRUPT_READ_PIRQ)(
-  IN EFI_LEGACY_INTERRUPT_PROTOCOL   *This,
-  IN  UINT8  PirqNumber,
-  OUT UINT8  *PirqData
-  );
-
-/**
-  Write the specified PIRQ register with the given data.
-
-  @param  This  The protocol instance pointer.
-  @param  PirqNumberA PIRQ register to read.
-  @param  PirqData  The data to write.
-
-  @retval EFI_SUCCESS   The PIRQ was programmed.
-  @retval EFI_INVALID_PARAMETER Invalid PIRQ number.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_LEGACY_INTERRUPT_WRITE_PIRQ)(
-  IN EFI_LEGACY_INTERRUPT_PROTOCOL   *This,
-  IN  UINT8  PirqNumber,
-  IN UINT8   PirqData
-  );
-
-struct _EFI_LEGACY_INTERRUPT_PROTOCOL {
-  ///
-  ///   Gets the 

[edk2-devel] [PATCH 25/37] OvmfPkg: remove gEfiLegacyBiosProtocolGuid

2023-11-10 Thread Laszlo Ersek
At this point, gEfiLegacyBiosProtocolGuid is unused; remove it.

This shrinks the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - SYSTEM_ROM_FILE_GUID (1547B4F3-3E8A-4FEF-81C8-328ED647AB1A)
  - gEfiLegacy8259ProtocolGuid
  - gEfiLegacyInterruptProtocolGuid

- headers:
  - FrameworkDxe.h
  - Protocol/Legacy8259.h
  - Protocol/LegacyInterrupt.h

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec   |1 -
 OvmfPkg/Csm/Include/Protocol/LegacyBios.h | 1551 
 2 files changed, 1552 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index d257007c236a..9c2e84ca6060 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -183,7 +183,6 @@ [Protocols]
   gXenIoProtocolGuid= {0x6efac84f, 0x0ab0, 0x4747, {0x81, 
0xbe, 0x85, 0x55, 0x62, 0x59, 0x04, 0x49}}
   gIoMmuAbsentProtocolGuid  = {0xf8775d50, 0x8abd, 0x4adf, {0x92, 
0xac, 0x85, 0x3e, 0x51, 0xf6, 0xc8, 0xdc}}
   gEfiLegacy8259ProtocolGuid= {0x38321dba, 0x4fe0, 0x4e17, {0x8a, 
0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1}}
-  gEfiLegacyBiosProtocolGuid= {0xdb9a1e3d, 0x45cb, 0x4abb, {0x85, 
0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d}}
   gEfiLegacyInterruptProtocolGuid   = {0x31ce593d, 0x108a, 0x485d, {0xad, 
0xb2, 0x78, 0xf2, 0x1f, 0x29, 0x66, 0xbe}}
   gOvmfLoadedX86LinuxKernelProtocolGuid = {0xa3edc05d, 0xb618, 0x4ff6, {0x95, 
0x52, 0x76, 0xd7, 0x88, 0x63, 0x43, 0xc8}}
   gOvmfSevMemoryAcceptanceProtocolGuid  = {0xc5a010fe, 0x38a7, 0x4531, {0x8a, 
0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49}}
diff --git a/OvmfPkg/Csm/Include/Protocol/LegacyBios.h 
b/OvmfPkg/Csm/Include/Protocol/LegacyBios.h
deleted file mode 100644
index b9a225a8748e..
--- a/OvmfPkg/Csm/Include/Protocol/LegacyBios.h
+++ /dev/null
@@ -1,1551 +0,0 @@
-/** @file
-  The EFI Legacy BIOS Protocol is used to abstract legacy Option ROM usage
-  under EFI and Legacy OS boot.  This file also includes all the related
-  COMPATIBILITY16 structures and definitions.
-
-  Note: The names for EFI_IA32_REGISTER_SET elements were picked to follow
-  well known naming conventions.
-
-  Thunk is the code that switches from 32-bit protected environment into the 
16-bit real-mode
-  environment. Reverse thunk is the code that does the opposite.
-
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-  @par Revision Reference:
-  This protocol is defined in Framework for EFI Compatibility Support Module 
spec
-  Version 0.98.
-
-**/
-
-#ifndef _EFI_LEGACY_BIOS_H_
-#define _EFI_LEGACY_BIOS_H_
-
-///
-///
-///
-#pragma pack(1)
-
-typedef UINT8  SERIAL_MODE;
-typedef UINT8  PARALLEL_MODE;
-
-#define EFI_COMPATIBILITY16_TABLE_SIGNATURE  SIGNATURE_32 ('I', 'F', 'E', '$')
-
-///
-/// There is a table located within the traditional BIOS in either the 
0xF000: or 0xE000:
-/// physical address range. It is located on a 16-byte boundary and provides 
the physical address of the
-/// entry point for the Compatibility16 functions. These functions provide the 
platform-specific
-/// information that is required by the generic EfiCompatibility code. The 
functions are invoked via
-/// thunking by using EFI_LEGACY_BIOS_PROTOCOL.FarCall86() with the 32-bit 
physical
-/// entry point.
-///
-typedef struct {
-  ///
-  /// The string "$EFI" denotes the start of the EfiCompatibility table. Byte 
0 is "I," byte
-  /// 1 is "F," byte 2 is "E," and byte 3 is "$" and is normally accessed as a 
DWORD or UINT32.
-  ///
-  UINT32Signature;
-
-  ///
-  /// The value required such that byte checksum of TableLength equals zero.
-  ///
-  UINT8 TableChecksum;
-
-  ///
-  /// The length of this table.
-  ///
-  UINT8 TableLength;
-
-  ///
-  /// The major EFI revision for which this table was generated.
-  ///
-  UINT8 EfiMajorRevision;
-
-  ///
-  /// The minor EFI revision for which this table was generated.
-  ///
-  UINT8 EfiMinorRevision;
-
-  ///
-  /// The major revision of this table.
-  ///
-  UINT8 TableMajorRevision;
-
-  ///
-  /// The minor revision of this table.
-  ///
-  UINT8 TableMinorRevision;
-
-  ///
-  /// Reserved for future usage.
-  ///
-  UINT16Reserved;
-
-  ///
-  /// The segment of the entry point within the traditional BIOS for 
Compatibility16 functions.
-  ///
-  UINT16Compatibility16CallSegment;
-
-  ///
-  /// The offset of the entry point within the traditional BIOS for 
Compatibility16 functions.
-  ///
-  UINT16Compatibility16CallOffset;
-
-  ///
-  /// The segment of the entry point within the traditional BIOS for 
EfiCompatibility
-  /// to invoke the PnP installation check.
-  ///
-  UINT16PnPInstallationCheckSegment;
-
-  ///
-  /// The Offset of the entry point within the traditional BIOS for 
EfiCompatibility
-  /// to 

[edk2-devel] [PATCH 22/37] OvmfPkg: remove CsmSupportLib

2023-11-10 Thread Laszlo Ersek
CsmSupportLib is not used by any platform at this point, remove it.

This patch removes mentions of the following CSM resources from the source
code [*]:

- GUIDs (protocols or otherwise):
  - SYSTEM_ROM_FILE_GUID (1547B4F3-3E8A-4FEF-81C8-328ED647AB1A)
  - gEfiFirmwareVolumeProtocolGuid (by cutting the
 link)
  - gEfiLegacyBiosPlatformProtocolGuid
  - gEfiLegacyBiosProtocolGuid
  - gEfiLegacyInterruptProtocolGuid

- headers:
  - FrameworkDxe.h
  - Protocol/FirmwareVolume.h
  - Protocol/LegacyBiosPlatform.h
  - Protocol/LegacyInterrupt.h

which extends the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - SYSTEM_ROM_FILE_GUID (1547B4F3-3E8A-4FEF-81C8-328ED647AB1A)
  - gEfiFirmwareVolumeProtocolGuid
  - gEfiLegacy8259ProtocolGuid
  - gEfiLegacyBiosPlatformProtocolGuid
  - gEfiLegacyBiosProtocolGuid
  - gEfiLegacyInterruptProtocolGuid

- headers:
  - FrameworkDxe.h
  - Protocol/FirmwareVolume.h
  - Protocol/Legacy8259.h
  - Protocol/LegacyBios.h
  - Protocol/LegacyBiosPlatform.h
  - Protocol/LegacyInterrupt.h

[*] Note that gEfiLegacyRegion2ProtocolGuid, while a CSM-related protocol,
cannot be scheduled for removal, because the protocol GUID is defined in
"MdePkg.dec", and it's not only "OvmfPkg/Csm/CsmSupportLib" that produces
it in all of edk2, but also "MdeModulePkg/Universal/LegacyRegion2Dxe" (not
used by OVMF). For the same reason, the "Protocol/LegacyRegion2.h" header
(from MdePkg) cannot be scheduled for removal.

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf |   55 -
 OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.h   |   48 -
 OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.h |  115 ---
 OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.h  |   97 --
 OvmfPkg/Csm/CsmSupportLib/LegacyRegion.h|  202 
 OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.c   |   31 -
 OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c |  212 
 OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.c  | 1086 
 OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c|  506 -
 9 files changed, 2352 deletions(-)

diff --git a/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf 
b/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
deleted file mode 100644
index 45f201f07b5f..
--- a/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
+++ /dev/null
@@ -1,55 +0,0 @@
-## @file
-#  Platform CSM Support Library
-#
-#  Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
-#  SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
-  INF_VERSION= 0x00010005
-  BASE_NAME  = CsmSupportLib
-  FILE_GUID  = 04e03541-4663-417d-93f6-976378247d61
-  MODULE_TYPE= BASE
-  VERSION_STRING = 1.0
-  LIBRARY_CLASS  = CsmSupportLib
-
-  CONSTRUCTOR= CsmSupportLibConstructor
-
-#
-# The following information is for reference only and not required by the 
build tools.
-#
-#  VALID_ARCHITECTURES   = IA32 X64 EBC
-#
-
-[Sources]
-  CsmSupportLib.c
-  CsmSupportLib.h
-  LegacyInterrupt.c
-  LegacyInterrupt.h
-  LegacyPlatform.c
-  LegacyPlatform.h
-  LegacyRegion.c
-  LegacyRegion.h
-
-[Packages]
-  MdePkg/MdePkg.dec
-  OvmfPkg/OvmfPkg.dec
-
-[Pcd]
-  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
-
-[Protocols]
-  gEfiDevicePathProtocolGuid# PROTOCOL ALWAYS_CONSUMED
-  gEfiDiskInfoProtocolGuid  # PROTOCOL ALWAYS_CONSUMED
-  gEfiLegacyBiosPlatformProtocolGuid# PROTOCOL ALWAYS_CONSUMED
-  gEfiLegacyBiosProtocolGuid# PROTOCOL ALWAYS_CONSUMED
-  gEfiLegacyInterruptProtocolGuid   # PROTOCOL ALWAYS_PRODUCED
-  gEfiLegacyRegion2ProtocolGuid # PROTOCOL ALWAYS_PRODUCED
-  gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
-
-[LibraryClasses]
-  BaseLib
-  PciLib
-  IoLib
-
diff --git a/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.h 
b/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.h
deleted file mode 100644
index a6ee93f16739..
--- a/OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/** @file
-  Platform CSM Support Library
-
-  Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _CSM_SUPPORT_LIB_H_
-#define _CSM_SUPPORT_LIB_H_
-
-#include 
-
-/**
-  Initialize Legacy Region support
-
-  @retval EFI_SUCCESS   Successfully initialized
-
-**/
-EFI_STATUS
-LegacyRegionInit (
-  VOID
-  );
-
-/**
-  Initialize Legacy Interrupt support
-
-  @retval EFI_SUCCESS   Successfully initialized
-
-**/
-EFI_STATUS
-LegacyInterruptInstall (
-  VOID
-  );
-
-/**
-  Initialize Legacy Platform support
-
-  @retval EFI_SUCCESS   Successfully initialized
-
-**/
-EFI_STATUS
-LegacyBiosPlatformInstall (
-  VOID
-  );
-
-#endif
diff --git 

[edk2-devel] [PATCH 24/37] OvmfPkg: remove gEfiLegacyBiosPlatformProtocolGuid

2023-11-10 Thread Laszlo Ersek
At this point, gEfiLegacyBiosPlatformProtocolGuid is unused; remove it.

This shrinks the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - SYSTEM_ROM_FILE_GUID (1547B4F3-3E8A-4FEF-81C8-328ED647AB1A)
  - gEfiLegacy8259ProtocolGuid
  - gEfiLegacyBiosProtocolGuid
  - gEfiLegacyInterruptProtocolGuid

- headers:
  - FrameworkDxe.h
  - Protocol/Legacy8259.h
  - Protocol/LegacyBios.h
  - Protocol/LegacyInterrupt.h

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec   |   1 -
 OvmfPkg/Csm/Include/Protocol/LegacyBiosPlatform.h | 753 
 2 files changed, 754 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 94ad22d9501b..d257007c236a 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -184,7 +184,6 @@ [Protocols]
   gIoMmuAbsentProtocolGuid  = {0xf8775d50, 0x8abd, 0x4adf, {0x92, 
0xac, 0x85, 0x3e, 0x51, 0xf6, 0xc8, 0xdc}}
   gEfiLegacy8259ProtocolGuid= {0x38321dba, 0x4fe0, 0x4e17, {0x8a, 
0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1}}
   gEfiLegacyBiosProtocolGuid= {0xdb9a1e3d, 0x45cb, 0x4abb, {0x85, 
0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d}}
-  gEfiLegacyBiosPlatformProtocolGuid= {0x783658a3, 0x4172, 0x4421, {0xa2, 
0x99, 0xe0, 0x09, 0x07, 0x9c, 0x0c, 0xb4}}
   gEfiLegacyInterruptProtocolGuid   = {0x31ce593d, 0x108a, 0x485d, {0xad, 
0xb2, 0x78, 0xf2, 0x1f, 0x29, 0x66, 0xbe}}
   gOvmfLoadedX86LinuxKernelProtocolGuid = {0xa3edc05d, 0xb618, 0x4ff6, {0x95, 
0x52, 0x76, 0xd7, 0x88, 0x63, 0x43, 0xc8}}
   gOvmfSevMemoryAcceptanceProtocolGuid  = {0xc5a010fe, 0x38a7, 0x4531, {0x8a, 
0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49}}
diff --git a/OvmfPkg/Csm/Include/Protocol/LegacyBiosPlatform.h 
b/OvmfPkg/Csm/Include/Protocol/LegacyBiosPlatform.h
deleted file mode 100644
index 941b1c833159..
--- a/OvmfPkg/Csm/Include/Protocol/LegacyBiosPlatform.h
+++ /dev/null
@@ -1,753 +0,0 @@
-/** @file
-  The EFI Legacy BIOS Platform Protocol is used to mate a Legacy16
-  implementation with this EFI code. The EFI driver that produces
-  the Legacy BIOS protocol is generic and consumes this protocol.
-  A driver that matches the Legacy16 produces this protocol
-
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-  @par Revision Reference:
-  This protocol is defined in Framework for EFI Compatibility Support Module 
spec
-  Version 0.97.
-
-**/
-
-#ifndef _EFI_LEGACY_BIOS_PLATFORM_H_
-#define _EFI_LEGACY_BIOS_PLATFORM_H_
-
-///
-/// Legacy BIOS Platform depends on HDD_INFO and EFI_COMPATIBILITY16_TABLE that
-/// are defined with the Legacy BIOS Protocol
-///
-#include 
-
-#define EFI_LEGACY_BIOS_PLATFORM_PROTOCOL_GUID \
-  { \
-0x783658a3, 0x4172, 0x4421, {0xa2, 0x99, 0xe0, 0x9, 0x7, 0x9c, 0xc, 0xb4 } 
\
-  }
-
-typedef struct _EFI_LEGACY_BIOS_PLATFORM_PROTOCOL 
EFI_LEGACY_BIOS_PLATFORM_PROTOCOL;
-
-/**
-  This enum specifies the Mode param values for GetPlatformInfo()
-**/
-typedef enum {
-  ///
-  /// This mode is invoked twice. The first invocation has LegacySegment and
-  /// LegacyOffset set to 0. The mode returns the MP table address in EFI 
memory, along with its size.
-  /// The second invocation has LegacySegment and LegacyOffset set to the 
location
-  /// in the 0xF or 0xE block to which the MP table is to be copied. 
The second
-  /// invocation allows any MP table address fixes to occur in the EFI memory 
copy of the
-  /// MP table. The caller, not EfiGetPlatformBinaryMpTable, copies the 
modified MP
-  /// table to the allocated region in 0xF or 0xE block after the 
second invocation.
-  ///
-  /// The function parameters associated with this mode are:
-  ///
-  ///   Table Pointer to the MP table.
-  ///
-  ///   TableSize Size in bytes of the MP table.
-  ///
-  ///   Location Location to place table. 0x00. Either 0xE or 0xF 64 
KB blocks.
-  /// Bit 0 = 1 0xF 64 KB block.
-  /// Bit 1 = 1 0xE 64 KB block.
-  /// Multiple bits can be set.
-  ///
-  ///   Alignment Bit-mapped address alignment granularity.
-  /// The first nonzero bit from the right is the address granularity.
-  ///
-  //LegacySegment Segment in which EfiCompatibility code will place the MP 
table.
-  ///
-  ///   LegacyOffset Offset in which EfiCompatibility code will place the MP 
table.
-  ///
-  /// The return values associated with this mode are:
-  ///
-  ///   EFI_SUCCESS The MP table was returned.
-  ///
-  ///   EFI_UNSUPPORTED The MP table is not supported on this platform.
-  ///
-  EfiGetPlatformBinaryMpTable = 0,
-  ///
-  /// This mode returns a block of data. The content and usage is IBV or OEM 
defined.
-  /// OEMs or IBVs normally use this function for nonstandard Compatibility16 
runtime soft
-  /// INTs. It is the responsibility of this routine 

[edk2-devel] [PATCH 23/37] OvmfPkg: remove gEfiFirmwareVolumeProtocolGuid

2023-11-10 Thread Laszlo Ersek
At this point, gEfiFirmwareVolumeProtocolGuid is unused; remove it.

This shrinks the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - SYSTEM_ROM_FILE_GUID (1547B4F3-3E8A-4FEF-81C8-328ED647AB1A)
  - gEfiLegacy8259ProtocolGuid
  - gEfiLegacyBiosPlatformProtocolGuid
  - gEfiLegacyBiosProtocolGuid
  - gEfiLegacyInterruptProtocolGuid

- headers:
  - FrameworkDxe.h
  - Protocol/Legacy8259.h
  - Protocol/LegacyBios.h
  - Protocol/LegacyBiosPlatform.h
  - Protocol/LegacyInterrupt.h

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec   |   1 -
 OvmfPkg/Csm/Include/Protocol/FirmwareVolume.h | 339 
 2 files changed, 340 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 45a6105d39d6..94ad22d9501b 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -183,7 +183,6 @@ [Protocols]
   gXenIoProtocolGuid= {0x6efac84f, 0x0ab0, 0x4747, {0x81, 
0xbe, 0x85, 0x55, 0x62, 0x59, 0x04, 0x49}}
   gIoMmuAbsentProtocolGuid  = {0xf8775d50, 0x8abd, 0x4adf, {0x92, 
0xac, 0x85, 0x3e, 0x51, 0xf6, 0xc8, 0xdc}}
   gEfiLegacy8259ProtocolGuid= {0x38321dba, 0x4fe0, 0x4e17, {0x8a, 
0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1}}
-  gEfiFirmwareVolumeProtocolGuid= {0x389F751F, 0x1838, 0x4388, {0x83, 
0x90, 0xcd, 0x81, 0x54, 0xbd, 0x27, 0xf8}}
   gEfiLegacyBiosProtocolGuid= {0xdb9a1e3d, 0x45cb, 0x4abb, {0x85, 
0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d}}
   gEfiLegacyBiosPlatformProtocolGuid= {0x783658a3, 0x4172, 0x4421, {0xa2, 
0x99, 0xe0, 0x09, 0x07, 0x9c, 0x0c, 0xb4}}
   gEfiLegacyInterruptProtocolGuid   = {0x31ce593d, 0x108a, 0x485d, {0xad, 
0xb2, 0x78, 0xf2, 0x1f, 0x29, 0x66, 0xbe}}
diff --git a/OvmfPkg/Csm/Include/Protocol/FirmwareVolume.h 
b/OvmfPkg/Csm/Include/Protocol/FirmwareVolume.h
deleted file mode 100644
index bac03c11c408..
--- a/OvmfPkg/Csm/Include/Protocol/FirmwareVolume.h
+++ /dev/null
@@ -1,339 +0,0 @@
-/** @file
-  This file declares the Firmware Volume Protocol.
-
-  The Firmware Volume Protocol provides file-level access to the firmware 
volume.
-  Each firmware volume driver must produce an instance of the Firmware Volume
-  Protocol if the firmware volume is to be visible to the system. The Firmware
-  Volume Protocol also provides mechanisms for determining and modifying some
-  attributes of the firmware volume.
-
-Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-  @par Revision Reference:
-  This protocol is defined in Firmware Volume specification.
-  Version 0.9.
-
-**/
-
-#ifndef _FIRMWARE_VOLUME_H_
-#define _FIRMWARE_VOLUME_H_
-
-//
-// Firmware Volume Protocol GUID definition
-//
-#define EFI_FIRMWARE_VOLUME_PROTOCOL_GUID \
-  { \
-0x389F751F, 0x1838, 0x4388, {0x83, 0x90, 0xCD, 0x81, 0x54, 0xBD, 0x27, 
0xF8 } \
-  }
-
-#define FV_DEVICE_SIGNATURE  SIGNATURE_32 ('_', 'F', 'V', '_')
-
-typedef struct _EFI_FIRMWARE_VOLUME_PROTOCOL EFI_FIRMWARE_VOLUME_PROTOCOL;
-
-//
-// FRAMEWORK_EFI_FV_ATTRIBUTES bit definitions
-//
-typedef UINT64 FRAMEWORK_EFI_FV_ATTRIBUTES;
-
-//
-// 
-// FRAMEWORK_EFI_FV_ATTRIBUTES bit definitions
-// 
-//
-#define EFI_FV_READ_DISABLE_CAP  0x0001ULL
-#define EFI_FV_READ_ENABLE_CAP   0x0002ULL
-#define EFI_FV_READ_STATUS   0x0004ULL
-
-#define EFI_FV_WRITE_DISABLE_CAP  0x0008ULL
-#define EFI_FV_WRITE_ENABLE_CAP   0x0010ULL
-#define EFI_FV_WRITE_STATUS   0x0020ULL
-
-#define EFI_FV_LOCK_CAP   0x0040ULL
-#define EFI_FV_LOCK_STATUS0x0080ULL
-#define EFI_FV_WRITE_POLICY_RELIABLE  0x0100ULL
-
-#define EFI_FV_ALIGNMENT_CAP  0x8000ULL
-#define EFI_FV_ALIGNMENT_20x0001ULL
-#define EFI_FV_ALIGNMENT_40x0002ULL
-#define EFI_FV_ALIGNMENT_80x0004ULL
-#define EFI_FV_ALIGNMENT_16   0x0008ULL
-#define EFI_FV_ALIGNMENT_32   0x0010ULL
-#define EFI_FV_ALIGNMENT_64   0x0020ULL
-#define EFI_FV_ALIGNMENT_128  0x0040ULL
-#define EFI_FV_ALIGNMENT_256  0x0080ULL
-#define EFI_FV_ALIGNMENT_512  0x0100ULL
-#define EFI_FV_ALIGNMENT_1K   0x0200ULL
-#define EFI_FV_ALIGNMENT_2K   0x0400ULL
-#define EFI_FV_ALIGNMENT_4K   0x0800ULL
-#define EFI_FV_ALIGNMENT_8K   0x1000ULL
-#define EFI_FV_ALIGNMENT_16K  0x2000ULL
-#define EFI_FV_ALIGNMENT_32K  0x4000ULL
-#define EFI_FV_ALIGNMENT_64K  0x8000ULL
-
-//
-// Protocol API definitions
-//
-
-/**
-  Retrieves attributes, insures positive polarity of 

[edk2-devel] [PATCH 21/37] OvmfPkg: unplug CsmSupportLib from BdsDxe

2023-11-10 Thread Laszlo Ersek
CsmSupportLib is effectively a hack. It produces the following protocols:

- Legacy Bios Platform,
- Legacy Interrupt,
- Legacy Region2.

(Note that the "OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf" file contains
an error where it claims that "Legacy Bios Platform" is "consumed" -- it
is not; the lib instance produces that protocol).

At the same time, the library instance consumes
gEfiLegacyBiosProtocolGuid.

This *seemingly* creates a circular dependency with LegacyBiosDxe, because
that driver has the exact opposite protocol usage patterns. The solution
is that LegacyBiosDxe has a DEPEX on the protocols produced by
CsmSupportLib, while CsmSupportLib consumes the Legacy Bios Protocol from
LegacyBiosDxe only in the member functions of the protocols it produces.
Therefore, once BdsDxe is dispatched, and the CsmSupportLib constructor
exposes those three protocols, LegacyBiosDxe can also be started by the
DXE dispatcher, and then the protocols from CsmSupportLib become
functional.

But the main reason why CsmSupportLib is a hack is that it should be a
normal platform DXE driver (called e.g. "CsmSupportDxe"), and not a NULL
class library that's randomly hooked into BdsDxe.

Given that we have removed LegacyBiosDxe earlier (so there is no DEPEX we
need to satisfy now, conceptually), unhook CsmSupportLib from BdsDxe.

--*--

Note that in the BhyveX64 platform, the pathname
"OvmfPkg/Bhyve/Csm/CsmSupportLib/CsmSupportLib.inf" is bogus, and has
always been, since commit 656419f922c0 ("Add BhyvePkg, to support the
bhyve hypervisor", 2020-07-31).

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Corvin Köhne 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Bhyve/BhyveX64.dsc | 1 -
 OvmfPkg/OvmfPkgIa32.dsc| 3 ---
 OvmfPkg/OvmfPkgIa32X64.dsc | 3 ---
 OvmfPkg/OvmfPkgX64.dsc | 3 ---
 OvmfPkg/OvmfXen.dsc| 7 +--
 5 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index a3452efc5a84..b26e5053f69b 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -666,7 +666,6 @@ [Components]
 
 !ifdef $(CSM_ENABLE)
 !error "CSM is being torn down"
-  NULL|OvmfPkg/Bhyve/Csm/CsmSupportLib/CsmSupportLib.inf
 !endif
   }
   MdeModulePkg/Logo/LogoDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index eb6022bafed3..d4f4460425c3 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -780,9 +780,6 @@ [Components]
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
 
   XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
-!ifdef $(CSM_ENABLE)
-  NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
-!endif
   }
   MdeModulePkg/Logo/LogoDxe.inf
   MdeModulePkg/Application/UiApp/UiApp.inf {
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 5f63596eeb2c..6e87a7a43704 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -794,9 +794,6 @@ [Components.X64]
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
 
   XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
-!ifdef $(CSM_ENABLE)
-  NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
-!endif
   }
   MdeModulePkg/Logo/LogoDxe.inf
   MdeModulePkg/Application/UiApp/UiApp.inf {
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 4dcda2ab17c2..1916abdf67f1 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -862,9 +862,6 @@ [Components]
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
 
   XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
-!ifdef $(CSM_ENABLE)
-  NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
-!endif
   }
   MdeModulePkg/Logo/LogoDxe.inf
   MdeModulePkg/Application/UiApp/UiApp.inf {
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index ddcc1d7ad48c..4e195b66c379 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -592,12 +592,7 @@ [Components]
   MdeModulePkg/Universal/Metronome/Metronome.inf
   EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf
   MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf
-  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
-
-!ifdef $(CSM_ENABLE)
-  NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
-!endif
-  }
+  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
   MdeModulePkg/Logo/LogoDxe.inf
   MdeModulePkg/Application/UiApp/UiApp.inf {
 



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

2023-11-10 Thread Laszlo Ersek
At this point, gEfiLegacyBiosGuid is unused; remove it.

This shrinks the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - gEfiLegacy8259ProtocolGuid
  - gEfiLegacyBiosPlatformProtocolGuid
  - gEfiLegacyBiosProtocolGuid
  - gEfiLegacyInterruptProtocolGuid

- headers:
  - FrameworkDxe.h
  - Protocol/Legacy8259.h
  - Protocol/LegacyBios.h
  - Protocol/LegacyBiosPlatform.h
  - Protocol/LegacyInterrupt.h

- PCDs:
  - PcdEbdaReservedMemorySize
  - PcdEndOpromShadowAddress
  - PcdHighPmmMemorySize
  - PcdLegacyBiosCacheLegacyRegion
  - PcdLowPmmMemorySize
  - PcdOpromReservedMemoryBase
  - PcdOpromReservedMemorySize

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec   |  1 -
 OvmfPkg/Csm/Include/Guid/LegacyBios.h | 29 
 2 files changed, 30 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index de4b6fe5c02b..060198e6278d 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -155,7 +155,6 @@ [Guids]
   gXenBusRootDeviceGuid = {0xa732241f, 0x383d, 0x4d9c, {0x8a, 
0xe1, 0x8e, 0x09, 0x83, 0x75, 0x89, 0xd7}}
   gRootBridgesConnectedEventGroupGuid   = {0x24a2d66f, 0xeedd, 0x4086, {0x90, 
0x42, 0xf2, 0x6e, 0x47, 0x97, 0xee, 0x69}}
   gMicrosoftVendorGuid  = {0x77fa9abd, 0x0359, 0x4d32, {0xbd, 
0x60, 0x28, 0xf4, 0xe7, 0x8f, 0x78, 0x4b}}
-  gEfiLegacyBiosGuid= {0x2E3044AC, 0x879F, 0x490F, {0x97, 
0x60, 0xBB, 0xDF, 0xAF, 0x69, 0x5F, 0x50}}
   gQemuKernelLoaderFsMediaGuid  = {0x1428f772, 0xb64a, 0x441e, {0xb8, 
0xc3, 0x9e, 0xbd, 0xd7, 0xf8, 0x93, 0xc7}}
   gGrubFileGuid = {0xb5ae312c, 0xbc8a, 0x43b1, {0x9c, 
0x62, 0xeb, 0xb8, 0x26, 0xdd, 0x5d, 0x07}}
   gConfidentialComputingSecretGuid  = {0xadf956ad, 0xe98c, 0x484c, {0xae, 
0x11, 0xb5, 0x1c, 0x7d, 0x33, 0x64, 0x47}}
diff --git a/OvmfPkg/Csm/Include/Guid/LegacyBios.h 
b/OvmfPkg/Csm/Include/Guid/LegacyBios.h
deleted file mode 100644
index b196844d00fc..
--- a/OvmfPkg/Csm/Include/Guid/LegacyBios.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/** @file
-  Defines a Tag GUID used to mark a UEFI legacy BIOS thunk driver based
-  on legacy BIOS services and legacy option ROM. This Tag GUID must be 
installed on
-  the ImageHandle of any module that follows the EFI Driver Model and uses
-  the Int86() or FarCall() services of the Legacy Bios Protocol to produce
-  a standard UEFI I/O Protocol.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _LEGACY_BIOS_H_
-#define _LEGACY_BIOS_H_
-
-///
-/// The Global ID for the Legacy BIOS GUID that must be installed onto the 
ImageHandle
-/// of any module follows the EFI Driver Model and uses the Int86() or 
FarCall()
-/// services of the Legacy BIOS Protocol to produce a standard UEFI I/O 
Protocol.
-///
-#define EFI_LEGACY_BIOS_GUID \
-  { \
-0x2e3044ac, 0x879f, 0x490f, {0x97, 0x60, 0xbb, 0xdf, 0xaf, 0x69, 0x5f, 
0x50 } \
-  }
-
-extern EFI_GUID  gEfiLegacyBiosGuid;
-
-#endif



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111089): https://edk2.groups.io/g/devel/message/111089
Mute This Topic: https://groups.io/mt/102518657/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 16/37] OvmfPkg: exclude NullMemoryTestDxe driver

2023-11-10 Thread Laszlo Ersek
NullMemoryTestDxe was included in the OVMF platforms in historical commit
999a815e9ff3 ("OvmfPkg: Add NullMemoryTestDxe driver", 2011-01-21). It
produces gEfiGenericMemTestProtocolGuid. With LegacyBiosDxe gone, the only
consumer of this protocol in all of edk2 is
"EmulatorPkg/Library/PlatformBmLib/PlatformBmMemoryTest.c". Thus, exclude
NullMemoryTestDxe from all OVMF platforms.

(Notably, ArmVirtPkg platforms don't include NullMemoryTestDxe either.)

Cc: Anatol Belski 
Cc: Andrei Warkentin 
Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Corvin Köhne 
Cc: Erdem Aktas 
Cc: Gerd Hoffmann 
Cc: Jianyong Wu 
Cc: Jiewen Yao 
Cc: Michael Roth 
Cc: Min Xu 
Cc: Rebecca Cran 
Cc: Sunil V L 
Cc: Tom Lendacky 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/AmdSev/AmdSevX64.dsc| 1 -
 OvmfPkg/Bhyve/BhyveX64.dsc  | 1 -
 OvmfPkg/CloudHv/CloudHvX64.dsc  | 1 -
 OvmfPkg/IntelTdx/IntelTdxX64.dsc| 1 -
 OvmfPkg/Microvm/MicrovmX64.dsc  | 1 -
 OvmfPkg/OvmfPkgIa32.dsc | 1 -
 OvmfPkg/OvmfPkgIa32X64.dsc  | 1 -
 OvmfPkg/OvmfPkgX64.dsc  | 1 -
 OvmfPkg/OvmfXen.dsc | 1 -
 OvmfPkg/AmdSev/AmdSevX64.fdf| 1 -
 OvmfPkg/Bhyve/BhyveX64.fdf  | 1 -
 OvmfPkg/CloudHv/CloudHvX64.fdf  | 1 -
 OvmfPkg/IntelTdx/IntelTdxX64.fdf| 1 -
 OvmfPkg/Microvm/MicrovmX64.fdf  | 1 -
 OvmfPkg/OvmfPkgIa32.fdf | 1 -
 OvmfPkg/OvmfPkgIa32X64.fdf  | 1 -
 OvmfPkg/OvmfPkgX64.fdf  | 1 -
 OvmfPkg/OvmfXen.fdf | 1 -
 OvmfPkg/RiscVVirt/RiscVVirtQemu.fdf | 2 --
 19 files changed, 20 deletions(-)

diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
index 302c90e7c2b4..a00f4c12904c 100644
--- a/OvmfPkg/AmdSev/AmdSevX64.dsc
+++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
@@ -691,7 +691,6 @@ [Components]
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
   MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
   MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
-  MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
 
   OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
   OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index c938ed76ee92..a3452efc5a84 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -711,7 +711,6 @@ [Components]
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
   MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
   MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
-  MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
 
   OvmfPkg/Bhyve/BhyveRfbDxe/BhyveRfbDxe.inf {
 
diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc
index c23c7eaf6cc2..f6e4b2c628a3 100644
--- a/OvmfPkg/CloudHv/CloudHvX64.dsc
+++ b/OvmfPkg/CloudHv/CloudHvX64.dsc
@@ -795,7 +795,6 @@ [Components]
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
   MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
   MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
-  MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
 
   #
   # Serial Support
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index 0177c174c2ab..af0ecb0453ea 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -682,7 +682,6 @@ [Components]
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
   MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
   MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
-  MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
 
   OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
   OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf
diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc
index ea1fa3e2963f..75c53c0bb287 100644
--- a/OvmfPkg/Microvm/MicrovmX64.dsc
+++ b/OvmfPkg/Microvm/MicrovmX64.dsc
@@ -787,7 +787,6 @@ [Components]
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
   MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
   MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
-  MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
 
   OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
   OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 3005ef771bea..eb6022bafed3 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -841,7 +841,6 @@ [Components]
   MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
   MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
   MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
-  MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
 
   OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
   OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc 

[edk2-devel] [PATCH 20/37] OvmfPkg: remove LegacyBiosDxe PCDs

2023-11-10 Thread Laszlo Ersek
The following PCDs are unused at this point; remove them:

- PcdEbdaReservedMemorySize
- PcdEndOpromShadowAddress
- PcdHighPmmMemorySize
- PcdLegacyBiosCacheLegacyRegion
- PcdLowPmmMemorySize
- PcdOpromReservedMemoryBase
- PcdOpromReservedMemorySize

This shrinks the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - gEfiLegacy8259ProtocolGuid
  - gEfiLegacyBiosPlatformProtocolGuid
  - gEfiLegacyBiosProtocolGuid
  - gEfiLegacyInterruptProtocolGuid

- headers:
  - FrameworkDxe.h
  - Protocol/Legacy8259.h
  - Protocol/LegacyBios.h
  - Protocol/LegacyBiosPlatform.h
  - Protocol/LegacyInterrupt.h

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec | 38 
 1 file changed, 38 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 060198e6278d..45a6105d39d6 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -288,44 +288,6 @@ [PcdsFixedAtBuild]
   #  For the corresponding bits, 0 = Edge triggered and 1 = Level triggered.
   gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x|UINT16|0x5
 
-  ## Indicates if memory space for legacy region will be set as cacheable.
-  #   TRUE  - Set cachebility for legacy region.
-  #   FALSE - Does not set cachebility for legacy region.
-  gUefiOvmfPkgTokenSpaceGuid.PcdLegacyBiosCacheLegacyRegion|TRUE|BOOLEAN|0x2b
-
-  ## Specify memory size with bytes to reserve EBDA below 640K for OPROM.
-  #  The value should be a multiple of 4KB.
-  gUefiOvmfPkgTokenSpaceGuid.PcdEbdaReservedMemorySize|0x8000|UINT32|0x2c
-
-  ## Specify memory base address for OPROM to find free memory.
-  #  Some OPROMs do not use EBDA or PMM to allocate memory for its usage,
-  #  instead they find the memory filled with zero from 0x2.
-  #  The value should be a multiple of 4KB.
-  #  The range should be below the EBDA reserved range from
-  #  (CONVENTIONAL_MEMORY_TOP - Reserved EBDA Memory Size) to
-  #  CONVENTIONAL_MEMORY_TOP.
-  gUefiOvmfPkgTokenSpaceGuid.PcdOpromReservedMemoryBase|0x6|UINT32|0x2d
-
-  ## Specify memory size with bytes for OPROM to find free memory.
-  #  The value should be a multiple of 4KB. And the range should be below the
-  #  EBDA reserved range from
-  #  (CONVENTIONAL_MEMORY_TOP - Reserved EBDA Memory Size) to
-  #  CONVENTIONAL_MEMORY_TOP.
-  gUefiOvmfPkgTokenSpaceGuid.PcdOpromReservedMemorySize|0x28000|UINT32|0x2e
-
-  ## Specify the end of address below 1MB for the OPROM.
-  #  The last shadowed OpROM should not exceed this address.
-  gUefiOvmfPkgTokenSpaceGuid.PcdEndOpromShadowAddress|0xd|UINT32|0x2f
-
-  ## Specify the low PMM (Post Memory Manager) size with bytes below 1MB.
-  #  The value should be a multiple of 4KB.
-  # @Prompt Low PMM (Post Memory Manager) Size
-  gUefiOvmfPkgTokenSpaceGuid.PcdLowPmmMemorySize|0x1|UINT32|0x30
-
-  ## Specify the high PMM (Post Memory Manager) size with bytes above 1MB.
-  #  The value should be a multiple of 4KB.
-  gUefiOvmfPkgTokenSpaceGuid.PcdHighPmmMemorySize|0x40|UINT32|0x31
-
   gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtr|0x0|UINT32|0x17
   gUefiOvmfPkgTokenSpaceGuid.PcdXenPvhStartOfDayStructPtrSize|0x0|UINT32|0x32
 



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

2023-11-10 Thread Laszlo Ersek
At this point, gEfiIsaAcpiProtocolGuid is unused; remove it.

This shrinks the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - gEfiLegacy8259ProtocolGuid
  - gEfiLegacyBiosGuid
  - gEfiLegacyBiosPlatformProtocolGuid
  - gEfiLegacyBiosProtocolGuid
  - gEfiLegacyInterruptProtocolGuid

- headers:
  - FrameworkDxe.h
  - Guid/LegacyBios.h
  - Protocol/Legacy8259.h
  - Protocol/LegacyBios.h
  - Protocol/LegacyBiosPlatform.h
  - Protocol/LegacyInterrupt.h

- PCDs:
  - PcdEbdaReservedMemorySize
  - PcdEndOpromShadowAddress
  - PcdHighPmmMemorySize
  - PcdLegacyBiosCacheLegacyRegion
  - PcdLowPmmMemorySize
  - PcdOpromReservedMemoryBase
  - PcdOpromReservedMemorySize

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec|   1 -
 OvmfPkg/Csm/Include/Protocol/IsaAcpi.h | 298 
 2 files changed, 299 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 0b616c30a4ef..de4b6fe5c02b 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -185,7 +185,6 @@ [Protocols]
   gIoMmuAbsentProtocolGuid  = {0xf8775d50, 0x8abd, 0x4adf, {0x92, 
0xac, 0x85, 0x3e, 0x51, 0xf6, 0xc8, 0xdc}}
   gEfiLegacy8259ProtocolGuid= {0x38321dba, 0x4fe0, 0x4e17, {0x8a, 
0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1}}
   gEfiFirmwareVolumeProtocolGuid= {0x389F751F, 0x1838, 0x4388, {0x83, 
0x90, 0xcd, 0x81, 0x54, 0xbd, 0x27, 0xf8}}
-  gEfiIsaAcpiProtocolGuid   = {0x64a892dc, 0x5561, 0x4536, {0x92, 
0xc7, 0x79, 0x9b, 0xfc, 0x18, 0x33, 0x55}}
   gEfiLegacyBiosProtocolGuid= {0xdb9a1e3d, 0x45cb, 0x4abb, {0x85, 
0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d}}
   gEfiLegacyBiosPlatformProtocolGuid= {0x783658a3, 0x4172, 0x4421, {0xa2, 
0x99, 0xe0, 0x09, 0x07, 0x9c, 0x0c, 0xb4}}
   gEfiLegacyInterruptProtocolGuid   = {0x31ce593d, 0x108a, 0x485d, {0xad, 
0xb2, 0x78, 0xf2, 0x1f, 0x29, 0x66, 0xbe}}
diff --git a/OvmfPkg/Csm/Include/Protocol/IsaAcpi.h 
b/OvmfPkg/Csm/Include/Protocol/IsaAcpi.h
deleted file mode 100644
index afb415a388ab..
--- a/OvmfPkg/Csm/Include/Protocol/IsaAcpi.h
+++ /dev/null
@@ -1,298 +0,0 @@
-/** @file
-  EFI ISA ACPI Protocol is used to enumerate and manage all the ISA 
controllers on
-  the platform's ISA Bus.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __ISA_ACPI_H_
-#define __ISA_ACPI_H_
-
-///
-/// Global ID for the EFI ISA ACPI Protocol.
-///
-#define EFI_ISA_ACPI_PROTOCOL_GUID \
-  { \
-0x64a892dc, 0x5561, 0x4536, { 0x92, 0xc7, 0x79, 0x9b, 0xfc, 0x18, 0x33, 
0x55 } \
-  }
-
-///
-/// Forward declaration fo the EFI ISA ACPI Protocol
-///
-typedef struct _EFI_ISA_ACPI_PROTOCOL EFI_ISA_ACPI_PROTOCOL;
-
-///
-/// ISA ACPI Protocol interrupt resource attributes.
-///
-#define EFI_ISA_ACPI_IRQ_TYPE_HIGH_TRUE_EDGE_SENSITIVE   0x01   ///< Edge 
triggered interrupt on a rising edge.
-#define EFI_ISA_ACPI_IRQ_TYPE_LOW_TRUE_EDGE_SENSITIVE0x02   ///< Edge 
triggered interrupt on a falling edge.
-#define EFI_ISA_ACPI_IRQ_TYPE_HIGH_TRUE_LEVEL_SENSITIVE  0x04   ///< Level 
sensitive interrupt active high.
-#define EFI_ISA_ACPI_IRQ_TYPE_LOW_TRUE_LEVEL_SENSITIVE   0x08   ///< Level 
sensitive interrupt active low.
-
-///
-/// ISA ACPI Protocol DMA resource attributes.
-///
-#define EFI_ISA_ACPI_DMA_SPEED_TYPE_MASK 0x03   ///< Bit mask 
of supported DMA speed attributes.
-#define EFI_ISA_ACPI_DMA_SPEED_TYPE_COMPATIBILITY0x00   ///< ISA 
controller supports compatibility mode DMA transfers.
-#define EFI_ISA_ACPI_DMA_SPEED_TYPE_A0x01   ///< ISA 
controller supports type A DMA transfers.
-#define EFI_ISA_ACPI_DMA_SPEED_TYPE_B0x02   ///< ISA 
controller supports type B DMA transfers.
-#define EFI_ISA_ACPI_DMA_SPEED_TYPE_F0x03   ///< ISA 
controller supports type F DMA transfers.
-#define EFI_ISA_ACPI_DMA_COUNT_BY_BYTE   0x04   ///< ISA 
controller increments DMA address by bytes (8-bit).
-#define EFI_ISA_ACPI_DMA_COUNT_BY_WORD   0x08   ///< ISA 
controller increments DMA address by words (16-bit).
-#define EFI_ISA_ACPI_DMA_BUS_MASTER  0x10   ///< ISA 
controller is a DMA bus master.
-#define EFI_ISA_ACPI_DMA_TRANSFER_TYPE_8_BIT 0x20   ///< ISA 
controller only supports 8-bit DMA transfers.
-#define EFI_ISA_ACPI_DMA_TRANSFER_TYPE_8_BIT_AND_16_BIT  0x40   ///< ISA 
controller both 8-bit and 16-bit DMA transfers.
-#define EFI_ISA_ACPI_DMA_TRANSFER_TYPE_16_BIT0x80   ///< ISA 
controller only supports 16-bit DMA transfers.
-
-///
-/// ISA ACPI Protocol MMIO resource attributes
-///
-#define EFI_ISA_ACPI_MEMORY_WIDTH_MASK  0x03///< Bit mask 
of supported ISA memory width attributes.
-#define 

[edk2-devel] [PATCH 17/37] OvmfPkg: remove gEfiIsaIoProtocolGuid

2023-11-10 Thread Laszlo Ersek
At this point, gEfiIsaIoProtocolGuid is unused; remove it.

Recursively, this patch removes mentions of the following further CSM
resources from the source code:

- GUIDs (protocols or otherwise):
  - gEfiIsaAcpiProtocolGuid (by cutting the  link)

- headers:
  - Protocol/IsaAcpi.h

This changes the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - gEfiIsaAcpiProtocolGuid
  - gEfiLegacy8259ProtocolGuid
  - gEfiLegacyBiosGuid
  - gEfiLegacyBiosPlatformProtocolGuid
  - gEfiLegacyBiosProtocolGuid
  - gEfiLegacyInterruptProtocolGuid

- headers:
  - FrameworkDxe.h
  - Guid/LegacyBios.h
  - Protocol/IsaAcpi.h
  - Protocol/Legacy8259.h
  - Protocol/LegacyBios.h
  - Protocol/LegacyBiosPlatform.h
  - Protocol/LegacyInterrupt.h

- PCDs:
  - PcdEbdaReservedMemorySize
  - PcdEndOpromShadowAddress
  - PcdHighPmmMemorySize
  - PcdLegacyBiosCacheLegacyRegion
  - PcdLowPmmMemorySize
  - PcdOpromReservedMemoryBase
  - PcdOpromReservedMemorySize

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec  |   1 -
 OvmfPkg/Csm/Include/Protocol/IsaIo.h | 356 
 2 files changed, 357 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index c77126ea0892..0b616c30a4ef 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -186,7 +186,6 @@ [Protocols]
   gEfiLegacy8259ProtocolGuid= {0x38321dba, 0x4fe0, 0x4e17, {0x8a, 
0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1}}
   gEfiFirmwareVolumeProtocolGuid= {0x389F751F, 0x1838, 0x4388, {0x83, 
0x90, 0xcd, 0x81, 0x54, 0xbd, 0x27, 0xf8}}
   gEfiIsaAcpiProtocolGuid   = {0x64a892dc, 0x5561, 0x4536, {0x92, 
0xc7, 0x79, 0x9b, 0xfc, 0x18, 0x33, 0x55}}
-  gEfiIsaIoProtocolGuid = {0x7ee2bd44, 0x3da0, 0x11d4, {0x9a, 
0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d}}
   gEfiLegacyBiosProtocolGuid= {0xdb9a1e3d, 0x45cb, 0x4abb, {0x85, 
0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d}}
   gEfiLegacyBiosPlatformProtocolGuid= {0x783658a3, 0x4172, 0x4421, {0xa2, 
0x99, 0xe0, 0x09, 0x07, 0x9c, 0x0c, 0xb4}}
   gEfiLegacyInterruptProtocolGuid   = {0x31ce593d, 0x108a, 0x485d, {0xad, 
0xb2, 0x78, 0xf2, 0x1f, 0x29, 0x66, 0xbe}}
diff --git a/OvmfPkg/Csm/Include/Protocol/IsaIo.h 
b/OvmfPkg/Csm/Include/Protocol/IsaIo.h
deleted file mode 100644
index 40a8171e95da..
--- a/OvmfPkg/Csm/Include/Protocol/IsaIo.h
+++ /dev/null
@@ -1,356 +0,0 @@
-/** @file
-  ISA I/O Protocol is used by ISA device drivers to perform I/O, MMIO and DMA
-  operations on the ISA controllers they manage.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _EFI_ISA_IO_H_
-#define _EFI_ISA_IO_H_
-
-#include 
-
-///
-/// Global ID for the EFI_ISA_IO_PROTOCOL
-///
-#define EFI_ISA_IO_PROTOCOL_GUID \
-  { \
-0x7ee2bd44, 0x3da0, 0x11d4, { 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 
0x4d } \
-  }
-
-///
-/// Forward declaration for the EFI_ISA_IO_PROTOCOL.
-///
-typedef struct _EFI_ISA_IO_PROTOCOL EFI_ISA_IO_PROTOCOL;
-
-///
-/// Width of EFI_ISA_IO_PROTOCOL I/O Port and MMIO operations.
-///
-typedef enum {
-  EfiIsaIoWidthUint8 = 0,  ///< 8-bit operation.
-  EfiIsaIoWidthUint16, ///< 16-bit operation.
-  EfiIsaIoWidthUint32, ///< 32-bit operation
-  EfiIsaIoWidthReserved,
-  EfiIsaIoWidthFifoUint8,  ///< 8-bit FIFO operation.
-  EfiIsaIoWidthFifoUint16, ///< 16-bit FIFO operation.
-  EfiIsaIoWidthFifoUint32, ///< 32-bit FIFO operation.
-  EfiIsaIoWidthFifoReserved,
-  EfiIsaIoWidthFillUint8,  ///< 8-bit Fill operation.
-  EfiIsaIoWidthFillUint16, ///< 16-bit Fill operation.
-  EfiIsaIoWidthFillUint32, ///< 32-bit Fill operation.
-  EfiIsaIoWidthFillReserved,
-  EfiIsaIoWidthMaximum
-} EFI_ISA_IO_PROTOCOL_WIDTH;
-
-///
-/// Attributes for the EFI_ISA_IO_PROTOCOL common DMA buffer allocations.
-///
-#define EFI_ISA_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE  0x080///< Map a memory 
range so write are combined.
-#define EFI_ISA_IO_ATTRIBUTE_MEMORY_CACHED 0x800///< Map a memory 
range so all read and write accesses are cached.
-#define EFI_ISA_IO_ATTRIBUTE_MEMORY_DISABLE0x1000   ///< Disable a 
memory range.
-
-///
-/// Channel attribute for EFI_ISA_IO_PROTOCOL slave DMA requests
-///
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_COMPATIBLE  0x001   ///< Set the 
speed of the DMA transfer in compatible mode.
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_A   0x002   ///< Not 
supported.
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_B   0x004   ///< Not 
supported.
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_C   0x008   ///< Not 
supported.
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_8   0x010   ///< Request 
8-bit DMA transfers.  Only available on channels 0..3.
-#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_16  

[edk2-devel] [PATCH 14/37] Revert "OvmfPkg: don't assign PCI BARs above 4GiB when CSM enabled"

2023-11-10 Thread Laszlo Ersek
This reverts commit c7341877f69505e69acd199c84b6c09218058bfa.

That commit was a later (2019-06-26), heavier weight exclusion of 64-bit
BARs when a CSM was included, and is similarly superfluous now, so revert
it.

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkgIa32X64.dsc | 4 
 OvmfPkg/OvmfPkgX64.dsc | 4 
 2 files changed, 8 deletions(-)

diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 3a83418bdd4e..1f144b07a650 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -635,11 +635,7 @@ [PcdsDynamicDefault]
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base|0x0
-!ifdef $(CSM_ENABLE)
-  gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size|0x0
-!else
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size|0x8
-!endif
 
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0
 
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index ab846e5324fa..ce932301aff1 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -653,11 +653,7 @@ [PcdsDynamicDefault]
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Base|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size|0x0
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base|0x0
-!ifdef $(CSM_ENABLE)
-  gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size|0x0
-!else
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size|0x8
-!endif
 
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|0
 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111085): https://edk2.groups.io/g/devel/message/111085
Mute This Topic: https://groups.io/mt/102518652/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 12/37] OvmfPkg: exclude LegacyBiosDxe

2023-11-10 Thread Laszlo Ersek
LegacyBiosDxe is the core CSM driver. It procudes
gEfiLegacyBiosProtocolGuid, on top of several smaller, more foundational
legacy BIOS protocols, whose drivers we've not excluded yet. In the course
of tearing down CSM support in (reverse) dependency order, exclude
LegacyBiosDxe at this point.

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Corvin Köhne 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Bhyve/BhyveX64.dsc | 1 -
 OvmfPkg/OvmfPkgIa32.dsc| 1 -
 OvmfPkg/OvmfPkgIa32X64.dsc | 1 -
 OvmfPkg/OvmfPkgX64.dsc | 1 -
 OvmfPkg/OvmfXen.dsc| 1 -
 OvmfPkg/Bhyve/BhyveX64.fdf | 1 -
 OvmfPkg/OvmfPkgIa32.fdf| 1 -
 OvmfPkg/OvmfPkgIa32X64.fdf | 1 -
 OvmfPkg/OvmfPkgX64.fdf | 1 -
 OvmfPkg/OvmfXen.fdf| 1 -
 10 files changed, 10 deletions(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index a328819a19b5..c938ed76ee92 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -764,7 +764,6 @@ [Components]
   MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
-#  OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
 !ifdef $(CSM_ENABLE)
   OvmfPkg/Bhyve/Csm/BhyveCsm16/BhyveCsm16.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 6f6c7ac48ac5..3005ef771bea 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -891,7 +891,6 @@ [Components]
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 !ifdef $(CSM_ENABLE)
-  OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
   OvmfPkg/Csm/Csm16/Csm16.inf
 !endif
 
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 1dc9de851388..3a83418bdd4e 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -909,7 +909,6 @@ [Components.X64]
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 !ifdef $(CSM_ENABLE)
-  OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
   OvmfPkg/Csm/Csm16/Csm16.inf
 !endif
 
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 4be493e830d5..ab846e5324fa 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -977,7 +977,6 @@ [Components]
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 !ifdef $(CSM_ENABLE)
-  OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
   OvmfPkg/Csm/Csm16/Csm16.inf
 !endif
 
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 8823f28d7b3b..0e2548d964bc 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -700,7 +700,6 @@ [Components]
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 !ifdef $(CSM_ENABLE)
-  OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
   OvmfPkg/Csm/Csm16/Csm16.inf
 !endif
 
diff --git a/OvmfPkg/Bhyve/BhyveX64.fdf b/OvmfPkg/Bhyve/BhyveX64.fdf
index 13e66c7304d8..b465fea7c72d 100644
--- a/OvmfPkg/Bhyve/BhyveX64.fdf
+++ b/OvmfPkg/Bhyve/BhyveX64.fdf
@@ -296,7 +296,6 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
 INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
-#INF  OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
 !ifdef $(CSM_ENABLE)
 INF  RuleOverride=CSM OvmfPkg/Bhyve/Csm/BhyveCsm16/BhyveCsm16.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf
index d01bae02c39e..996c116e418a 100644
--- a/OvmfPkg/OvmfPkgIa32.fdf
+++ b/OvmfPkg/OvmfPkgIa32.fdf
@@ -327,7 +327,6 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 !ifdef $(CSM_ENABLE)
-INF  OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
 INF  RuleOverride=CSM OvmfPkg/Csm/Csm16/Csm16.inf
 !endif
 
diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf
index ed2e4583f01a..36727965798e 100644
--- a/OvmfPkg/OvmfPkgIa32X64.fdf
+++ b/OvmfPkg/OvmfPkgIa32X64.fdf
@@ -333,7 +333,6 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 !ifdef $(CSM_ENABLE)
-INF  OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
 INF  RuleOverride=CSM OvmfPkg/Csm/Csm16/Csm16.inf
 !endif
 
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index 3ee7e1be9b19..1000707d8c9a 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -360,7 +360,6 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 !ifdef $(CSM_ENABLE)
-INF  OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
 INF  RuleOverride=CSM OvmfPkg/Csm/Csm16/Csm16.inf
 !endif
 
diff --git a/OvmfPkg/OvmfXen.fdf b/OvmfPkg/OvmfXen.fdf
index 73388bc5a3bf..ce825b01b48b 100644
--- a/OvmfPkg/OvmfXen.fdf
+++ b/OvmfPkg/OvmfXen.fdf
@@ -336,7 +336,6 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 !ifdef $(CSM_ENABLE)
-INF  OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
 INF  RuleOverride=CSM OvmfPkg/Csm/Csm16/Csm16.inf
 !endif
 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111083): 

[edk2-devel] [PATCH 13/37] OvmfPkg/IncompatiblePciDeviceSupportDxe: ignore CSM presence

2023-11-10 Thread Laszlo Ersek
The UEFI protocol database cannot contain gEfiLegacyBiosProtocolGuid any
longer, after excluding LegacyBiosDxe from the OVMF platforms. Therefore,
instruct PciBusDxe from IncompatiblePciDeviceSupportDxe to allocate 64-bit
BARs above 4 GB regardless of a CSM.

Regression test: in commit 855743f71774 ("OvmfPkg: prevent 64-bit MMIO BAR
degradation if there is no CSM", 2016-05-25), where we introduced
IncompatiblePciDeviceSupportDxe, we said, "By default, the PCI Bus driver
considers an option ROM reason enough for allocating the 64-bit MMIO BARs
in 32-bit address space". Therefore it suffices to verify the 64-bit BARs
of a device for which QEMU provides an option ROM. The simplest case is
the virtio-net-pci device. And indeed, with this patch applied, the log
contains:

> PciBus: Discovered PCI @ [04|00|00]  [VID = 0x1AF4, DID = 0x1041]
>BAR[1]: Type =  Mem32; Alignment = 0xFFF;Length = 0x1000;
> Offset = 0x14
>BAR[4]: Type = PMem64; Alignment = 0x3FFF;   Length = 0x4000;
> Offset = 0x20

This portion shows that Bus|Device|Function 04|00|00 is a (modern)
virito-net-pci device [VID = 0x1AF4, DID = 0x1041].

> PciBus: Resource Map for Bridge [00|01|03]
> Type =  Mem32; Base = 0x8120;   Length = 0x20;  Alignment = 
> 0x1F
>Base = Padding;  Length = 0x20;  Alignment = 0x1F
>Base = 0x8120;   Length = 0x1000;Alignment = 0xFFF;  Owner 
> = PCI [04|00|00:14]
> Type =  Mem32; Base = 0x81A43000;   Length = 0x1000;Alignment = 
> 0xFFF
> Type = PMem64; Base = 0x80020;  Length = 0x10;  Alignment = 
> 0xF
>Base = 0x80020;  Length = 0x4000;Alignment = 0x3FFF; Owner 
> = PCI [04|00|00:20]

This quote shows that 04|00|00 has a BAR at 0x8_0020_.

(It also shows that the device is behind a bridge (PCIe root port) whose
own BDF is 00|01|03.)

> [Security] 3rd party image[7CEEB418] can be loaded after EndOfDxe: 
> PciRoot(0x0)/Pci(0x1,0x3)/Pci(0x0,0x0)/Offset(0x10E00,0x273FF).
> None of Tcg2Protocol/CcMeasurementProtocol is installed.
> InstallProtocolInterface: [EfiLoadedImageProtocol] 7D2E5140
> Loading driver at 0x0007CA9F000 EntryPoint=0x0007CAA5447 1af41000.efi
> InstallProtocolInterface: [EfiLoadedImageDevicePathProtocol] 7D5B2198

And this part finally shows that the iPXE option ROM for the device
(1af41000.efi) was detected and is loaded. (Same PCIe root port, and PCIe
root ports can only host a single device.)

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf |   5 
+-
 OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c   | 141 
+---
 2 files changed, 6 insertions(+), 140 deletions(-)

diff --git 
a/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf 
b/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
index ad38128fcbf9..b92662d0bb36 100644
--- a/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
+++ b/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.inf
@@ -1,7 +1,7 @@
 ## @file
 # A simple DXE_DRIVER that causes the PCI Bus UEFI_DRIVER to allocate 64-bit
-# MMIO BARs above 4 GB, regardless of option ROM availability (as long as a CSM
-# is not present), conserving 32-bit MMIO aperture for 32-bit BARs.
+# MMIO BARs above 4 GB, regardless of option ROM availability, conserving 
32-bit
+# MMIO aperture for 32-bit BARs.
 #
 # Copyright (C) 2016, Red Hat, Inc.
 #
@@ -33,7 +33,6 @@ [LibraryClasses]
 
 [Protocols]
   gEfiIncompatiblePciDeviceSupportProtocolGuid ## SOMETIMES_PRODUCES
-  gEfiLegacyBiosProtocolGuid   ## NOTIFY
 
 [Pcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size## CONSUMES
diff --git 
a/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c 
b/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
index 3092a174bc51..434cdca84b23 100644
--- a/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
+++ b/OvmfPkg/IncompatiblePciDeviceSupportDxe/IncompatiblePciDeviceSupport.c
@@ -1,7 +1,7 @@
 /** @file
   A simple DXE_DRIVER that causes the PCI Bus UEFI_DRIVER to allocate 64-bit
-  MMIO BARs above 4 GB, regardless of option ROM availability (as long as a CSM
-  is not present), conserving 32-bit MMIO aperture for 32-bit BARs.
+  MMIO BARs above 4 GB, regardless of option ROM availability, conserving 
32-bit
+  MMIO aperture for 32-bit BARs.
 
   Copyright (C) 2016, Red Hat, Inc.
   Copyright (c) 2017, Intel Corporation. All rights reserved.
@@ -21,12 +21,6 @@
 #include 
 
 #include 
-#include 
-
-//
-// The Legacy BIOS protocol has been located.
-//
-STATIC BOOLEAN  mLegacyBiosInstalled;
 
 //
 // The protocol interface this driver produces.
@@ -111,50 +105,6 @@ STATIC CONST EFI_ACPI_END_TAG_DESCRIPTOR  

[edk2-devel] [PATCH 11/37] OvmfPkg: remove Bios Video PCDs

2023-11-10 Thread Laszlo Ersek
PcdBiosVideoSetTextVgaModeEnable, PcdBiosVideoCheckVbeEnable and
PcdBiosVideoCheckVgaEnable are unused at this point, remove them.

This shrinks the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - gEfiLegacyBiosGuid
  - gEfiLegacyBiosProtocolGuid

- headers:
  - FrameworkDxe.h
  - Guid/LegacyBios.h
  - Protocol/LegacyBios.h

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec | 20 
 1 file changed, 20 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index c9f41c7ddea5..c77126ea0892 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -291,26 +291,6 @@ [PcdsFixedAtBuild]
   #  For the corresponding bits, 0 = Edge triggered and 1 = Level triggered.
   gUefiOvmfPkgTokenSpaceGuid.Pcd8259LegacyModeEdgeLevel|0x|UINT16|0x5
 
-  ## Indicates if BiosVideo driver will switch to 80x25 Text VGA Mode when
-  #  exiting boot service.
-  #   TRUE  - Switch to Text VGA Mode.
-  #   FALSE - Does not switch to Text VGA Mode.
-  
gUefiOvmfPkgTokenSpaceGuid.PcdBiosVideoSetTextVgaModeEnable|FALSE|BOOLEAN|0x28
-
-  ## Indicates if BiosVideo driver will check for VESA BIOS Extension service
-  #  support.
-  #   TRUE  - Check for VESA BIOS Extension service.
-  #   FALSE - Does not check for VESA BIOS Extension service.
-  gUefiOvmfPkgTokenSpaceGuid.PcdBiosVideoCheckVbeEnable|TRUE|BOOLEAN|0x29
-
-  ## Indicates if BiosVideo driver will check for VGA service support.
-  #  NOTE: If both PcdBiosVideoCheckVbeEnable and PcdBiosVideoCheckVgaEnable
-  #  are set to FALSE, that means Graphics Output protocol will not be
-  #  installed, the VGA miniport protocol will be installed instead.
-  #   TRUE  - Check for VGA service.
-  #   FALSE - Does not check for VGA service.
-  gUefiOvmfPkgTokenSpaceGuid.PcdBiosVideoCheckVgaEnable|TRUE|BOOLEAN|0x2a
-
   ## Indicates if memory space for legacy region will be set as cacheable.
   #   TRUE  - Set cachebility for legacy region.
   #   FALSE - Does not set cachebility for legacy region.



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

2023-11-10 Thread Laszlo Ersek
At this point, gEfiVgaMiniPortProtocolGuid is unused; remove it.

This shrinks the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - gEfiLegacyBiosGuid
  - gEfiLegacyBiosProtocolGuid

- headers:
  - FrameworkDxe.h
  - Guid/LegacyBios.h
  - Protocol/LegacyBios.h

- PCDs:
  - PcdBiosVideoCheckVbeEnable
  - PcdBiosVideoCheckVgaEnable
  - PcdBiosVideoSetTextVgaModeEnable

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec|  1 -
 OvmfPkg/Csm/Include/Protocol/VgaMiniPort.h | 88 
 2 files changed, 89 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 19149dc9fec7..c9f41c7ddea5 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -190,7 +190,6 @@ [Protocols]
   gEfiLegacyBiosProtocolGuid= {0xdb9a1e3d, 0x45cb, 0x4abb, {0x85, 
0x3b, 0xe5, 0x38, 0x7f, 0xdb, 0x2e, 0x2d}}
   gEfiLegacyBiosPlatformProtocolGuid= {0x783658a3, 0x4172, 0x4421, {0xa2, 
0x99, 0xe0, 0x09, 0x07, 0x9c, 0x0c, 0xb4}}
   gEfiLegacyInterruptProtocolGuid   = {0x31ce593d, 0x108a, 0x485d, {0xad, 
0xb2, 0x78, 0xf2, 0x1f, 0x29, 0x66, 0xbe}}
-  gEfiVgaMiniPortProtocolGuid   = {0xc7735a2f, 0x88f5, 0x4882, {0xae, 
0x63, 0xfa, 0xac, 0x8c, 0x8b, 0x86, 0xb3}}
   gOvmfLoadedX86LinuxKernelProtocolGuid = {0xa3edc05d, 0xb618, 0x4ff6, {0x95, 
0x52, 0x76, 0xd7, 0x88, 0x63, 0x43, 0xc8}}
   gOvmfSevMemoryAcceptanceProtocolGuid  = {0xc5a010fe, 0x38a7, 0x4531, {0x8a, 
0x4a, 0x05, 0x00, 0xd2, 0xfd, 0x16, 0x49}}
   gQemuAcpiTableNotifyProtocolGuid  = {0x928939b2, 0x4235, 0x462f, {0x95, 
0x80, 0xf6, 0xa2, 0xb2, 0xc2, 0x1a, 0x4f}}
diff --git a/OvmfPkg/Csm/Include/Protocol/VgaMiniPort.h 
b/OvmfPkg/Csm/Include/Protocol/VgaMiniPort.h
deleted file mode 100644
index fa023a2dfae4..
--- a/OvmfPkg/Csm/Include/Protocol/VgaMiniPort.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/** @file
-  The VGA Mini Port Protocol used to set the text display mode of a VGA 
controller.
-
-Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __VGA_MINI_PORT_H_
-#define __VGA_MINI_PORT_H_
-
-///
-/// Global ID for the EFI_VGA_MINI_PORT_PROTOCOL.
-///
-#define EFI_VGA_MINI_PORT_PROTOCOL_GUID \
-  { \
-0xc7735a2f, 0x88f5, 0x4882, {0xae, 0x63, 0xfa, 0xac, 0x8c, 0x8b, 0x86, 
0xb3 } \
-  }
-
-///
-/// Forward declaration for the EFI_VGA_MINI_PORT_PROTOCOL.
-///
-typedef struct _EFI_VGA_MINI_PORT_PROTOCOL EFI_VGA_MINI_PORT_PROTOCOL;
-
-/**
-  Sets the text display mode of a VGA controller.
-
-  Sets the text display mode of the VGA controller to the mode specified by
-  ModeNumber.  A ModeNumber of 0 is a request for an 80x25 text mode.  A
-  ModeNumber of 1 is a request for an 80x50 text mode.  If ModeNumber is 
greater
-  than MaxModeNumber, then EFI_UNSUPPORTED is returned.  If the VGA controller
-  is not functioning properly, then EFI_DEVICE_ERROR is returned.  If the VGA
-  controller is successfully set to the mode number specified by ModeNumber, 
then
-  EFI_SUCCESS is returned.
-
-  @param[in] This A pointer to the EFI_VGA_MINI_PORT_PROTOCOL instance.
-  @param[in] ModeNumber   The requested mode number.  0 for 80x25.  1 for 80x5.
-
-  @retval EFI_SUCCESSThe mode number was set.
-  @retval EFI_UNSUPPORTEDThe mode number specified by ModeNumber is not 
supported.
-  @retval EFI_DEVICE_ERROR   The device is not functioning properly.
-
-**/
-typedef
-EFI_STATUS
-(EFIAPI *EFI_VGA_MINI_PORT_SET_MODE)(
-  IN EFI_VGA_MINI_PORT_PROTOCOL  *This,
-  IN UINTNModeNumber
-  );
-
-struct _EFI_VGA_MINI_PORT_PROTOCOL {
-  EFI_VGA_MINI_PORT_SET_MODESetMode;
-  ///
-  /// MMIO base address of the VGA text mode framebuffer.  Typically set to 
0xB8000.
-  ///
-  UINT64VgaMemoryOffset;
-  ///
-  /// I/O Port address for the VGA CRTC address register. Typically set to 
0x3D4.
-  ///
-  UINT64CrtcAddressRegisterOffset;
-  ///
-  /// I/O Port address for the VGA CRTC data register.  Typically set to 0x3D5.
-  ///
-  UINT64CrtcDataRegisterOffset;
-  ///
-  /// PCI Controller MMIO BAR index of the VGA text mode frame buffer.  
Typically
-  /// set to EFI_PCI_IO_PASS_THROUGH_BAR
-  ///
-  UINT8 VgaMemoryBar;
-  ///
-  /// PCI Controller I/O BAR index of the VGA CRTC address register.  Typically
-  /// set to EFI_PCI_IO_PASS_THROUGH_BAR
-  ///
-  UINT8 CrtcAddressRegisterBar;
-  ///
-  /// PCI Controller I/O BAR index of the VGA CRTC data register.  Typically 
set
-  /// to EFI_PCI_IO_PASS_THROUGH_BAR
-  ///
-  UINT8 CrtcDataRegisterBar;
-  ///
-  /// The maximum number of text modes that this VGA controller supports.
-  ///
-  UINT8 MaxMode;
-};
-
-extern EFI_GUID  

[edk2-devel] [PATCH 08/37] OvmfPkg: exclude the CSM-based VideoDxe driver

2023-11-10 Thread Laszlo Ersek
The CSM-based VideoDxe driver is a special UEFI_DRIVER module that both
follows and doesn't follow the UEFI driver model.

Namely, in the Supported and Start members of its Driver Binding Protocol
instance, it consumes the Legacy Bios Protocol directly from the UEFI
protocol database, as opposed to (only) opening protocols on the handle
that it is supposed to bind.

Furthermore, the driver "marks" its own image handle with the
NULL-interface "Legacy Bios" (pseudo-protocol) GUID, in order to "inform
back" the provider of the Legacy Bios Protocol, i.e., LegacyBiosDxe, that
VideoDxe is a "BIOS Thunk Driver" in the system.

Quoting "OvmfPkg/Csm/Include/Guid/LegacyBios.h", such a driver follows the
UEFI Driver Model, but still uses the Int86() or FarCall() services of the
Legacy Bios Protocol as the basis for the UEFI protocol it produces.

In a sense, there is a circular dependency between VideoDxe and
LegacyBiosDxe; each knows about the other. However, VideoDxe is a
UEFI_DRIVER, while LegacyBiosDxe is a platform DXE_DRIVER with a very long
DEPEX. Therefore, for keeping dependencies conceptually intact, first
exclude VideoDxe from the OVMF platforms. Always include the
hypervisor-specific real UEFI video driver.

--*--

Note that the pathname
"IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf" in the bhyve
platform DSC and FDF files is bogus anyway.

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Corvin Köhne 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Bhyve/BhyveX64.dsc| 6 --
 OvmfPkg/IntelTdx/IntelTdxX64.dsc  | 2 --
 OvmfPkg/OvmfPkgIa32.dsc   | 6 --
 OvmfPkg/OvmfPkgIa32X64.dsc| 6 --
 OvmfPkg/OvmfPkgX64.dsc| 6 --
 OvmfPkg/OvmfXen.dsc   | 4 
 OvmfPkg/Bhyve/BhyveX64.fdf| 3 ---
 OvmfPkg/OvmfPkgIa32.fdf   | 6 ++
 OvmfPkg/OvmfPkgIa32X64.fdf| 6 ++
 OvmfPkg/OvmfPkgX64.fdf| 6 ++
 OvmfPkg/OvmfXen.fdf   | 1 -
 OvmfPkg/Bhyve/BhyveRfbDxe/GopDriver.c | 2 --
 12 files changed, 6 insertions(+), 48 deletions(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 073bf541661c..a328819a19b5 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -764,12 +764,6 @@ [Components]
   MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
-!ifdef $(CSM_ENABLE)
-  IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf {
-
-  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
-  }
-!endif
 #  OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
 !ifdef $(CSM_ENABLE)
   OvmfPkg/Bhyve/Csm/BhyveCsm16/BhyveCsm16.inf
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index 5513b7763774..0177c174c2ab 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -684,9 +684,7 @@ [Components]
   MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
   MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
 
-!ifndef $(CSM_ENABLE)
   OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
-!endif
   OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf
   OvmfPkg/VirtioGpuDxe/VirtioGpu.inf
 
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index a2ac18a4a766..6f6c7ac48ac5 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -843,9 +843,7 @@ [Components]
   MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
   MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
 
-!ifndef $(CSM_ENABLE)
   OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
-!endif
   OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf
   OvmfPkg/VirtioGpuDxe/VirtioGpu.inf
 
@@ -893,10 +891,6 @@ [Components]
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 !ifdef $(CSM_ENABLE)
-  OvmfPkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf {
-
-  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
-  }
   OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
   OvmfPkg/Csm/Csm16/Csm16.inf
 !endif
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index a935ca2eb6ac..1dc9de851388 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -861,9 +861,7 @@ [Components.X64]
   MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
   MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
 
-!ifndef $(CSM_ENABLE)
   OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
-!endif
   OvmfPkg/QemuRamfbDxe/QemuRamfbDxe.inf
   OvmfPkg/VirtioGpuDxe/VirtioGpu.inf
 
@@ -911,10 +909,6 @@ [Components.X64]
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 !ifdef $(CSM_ENABLE)
-  OvmfPkg/Csm/BiosThunk/VideoDxe/VideoDxe.inf {
-
-  PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
-  }
   OvmfPkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
   OvmfPkg/Csm/Csm16/Csm16.inf
 !endif
diff --git 

[edk2-devel] [PATCH 06/37] OvmfPkg: remove LegacyBootMaintUiLib

2023-11-10 Thread Laszlo Ersek
LegacyBootMaintUiLib is not used by any platform at this point, remove it.

This patch removes mentions of the following CSM resources from the source
code:

- GUIDs (protocols or otherwise):
  - gEfiLegacyBiosProtocolGuid
  - gEfiLegacyDevOrderVariableGuid

- headers:
  - Guid/LegacyDevOrder.h
  - Protocol/LegacyBios.h

which extends the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - gEfiLegacyBiosProtocolGuid
  - gEfiLegacyDevOrderVariableGuid

- headers:
  - Guid/LegacyDevOrder.h
  - Protocol/LegacyBios.h

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.uni |   20 -
 OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiStrings.uni |   43 -
 OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf |   62 -
 OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.h  |  242 
 OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiVfr.h   |   73 -
 OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUi.c  | 1500 

 OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiVfr.Vfr |   67 -
 7 files changed, 2007 deletions(-)

diff --git a/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.uni 
b/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.uni
deleted file mode 100644
index f29e1449a749..
--- a/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.uni
+++ /dev/null
@@ -1,20 +0,0 @@
-// /** @file
-// Legacy Boot Maintenance UI module is library for BDS phase.
-//
-// Legacy Boot Maintenance UI module is library for BDS phase.
-//
-// Copyright (c) 2015, Intel Corporation. All rights reserved.
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-#string STR_MODULE_ABSTRACT
-#language en-US
-"Legacy Boot Maintenance UI module is library for BDS phase."
-
-#string STR_MODULE_DESCRIPTION
-#language en-US
-"Legacy Boot Maintenance UI module is library for BDS phase."
-
-
diff --git a/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiStrings.uni 
b/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiStrings.uni
deleted file mode 100644
index 8d40ca1af1c0..
--- a/OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiStrings.uni
+++ /dev/null
@@ -1,43 +0,0 @@
-///** @file
-//
-//String definitions for Legacy Boot Maintainece Ui.
-//
-//  Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.
-//  SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-//**/
-
-/=#
-
-#langdef   en-US "English"
-#langdef   fr-FR "Français"
-
-#string STR_LEGACY_BOOT_PROMPT #language en-US  "Legacy Boot Options 
Menu"
-   #language fr-FR  "Legacy Boot Options 
Menu"
-#string STR_LEGACY_BOOT_HELP   #language en-US  "Manager legacy boot 
options in this driver."
-   #language fr-FR  "Manager legacy boot 
options in this driver."
-#string STR_FORM_FLOPPY_BOOT_TITLE #language en-US  "Set Legacy Floppy 
Driver Order"
-   #language fr-FR  "Set Legacy Floppy 
Driver Order"
-#string STR_FORM_FLOPPY_BOOT_HELP  #language en-US  "Set Legacy Floppy 
Driver Order."
-   #language fr-FR  "Set Legacy Floppy 
Driver Order."
-#string STR_FORM_HARDDISK_BOOT_TITLE   #language en-US  "Set Legacy HARDDISK 
Driver Order"
-   #language fr-FR  "Set Legacy HARDDISK 
Driver Order"
-#string STR_FORM_HARDDISK_BOOT_HELP#language en-US  "Set Legacy HARDDISK 
Driver Order."
-   #language fr-FR  "Set Legacy HARDDISK 
Driver Order."
-#string STR_FORM_CDROM_BOOT_TITLE  #language en-US  "Set Legacy CDROM 
Driver Order"
-   #language fr-FR  "Set Legacy CDROM 
Driver Order"
-#string STR_FORM_CDROM_BOOT_HELP   #language en-US  "Set Legacy CDROM 
Driver Order."
-   #language fr-FR  "Set Legacy CDROM 
Driver Order."
-#string STR_FORM_NET_BOOT_TITLE#language en-US  "Set Legacy NET Driver 
Order"
-   #language fr-FR  "Set Legacy NET Driver 
Order"
-#string STR_FORM_NET_BOOT_HELP #language en-US  "Set Legacy NET Driver 
Order."
-   #language fr-FR  "Set Legacy NET Driver 
Order."
-#string STR_FORM_BEV_BOOT_TITLE#language en-US  "Set Legacy BEV Driver 
Order"
-   #language fr-FR  "Set Legacy BEV Driver 
Order"
-#string STR_FORM_BEV_BOOT_HELP #language en-US  "Set Legacy BEV Driver 
Order."
-   #language fr-FR  "Set Legacy BEV Driver 
Order."
-#string STR_ORDER_CHANGE_PROMPT#language en-US  "Change Driver Boot 
Order."
-   #language fr-FR  "Change Driver Boot 
Order."
-#string 

[edk2-devel] [PATCH 07/37] OvmfPkg: remove gEfiLegacyDevOrderVariableGuid

2023-11-10 Thread Laszlo Ersek
At this point, gEfiLegacyDevOrderVariableGuid is unused; remove it.

This shrinks the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - gEfiLegacyBiosProtocolGuid

- headers:
  - Protocol/LegacyBios.h

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec   |  1 -
 OvmfPkg/Csm/Include/Guid/LegacyDevOrder.h | 39 
 2 files changed, 40 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index 74cc870cbed3..19149dc9fec7 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -156,7 +156,6 @@ [Guids]
   gRootBridgesConnectedEventGroupGuid   = {0x24a2d66f, 0xeedd, 0x4086, {0x90, 
0x42, 0xf2, 0x6e, 0x47, 0x97, 0xee, 0x69}}
   gMicrosoftVendorGuid  = {0x77fa9abd, 0x0359, 0x4d32, {0xbd, 
0x60, 0x28, 0xf4, 0xe7, 0x8f, 0x78, 0x4b}}
   gEfiLegacyBiosGuid= {0x2E3044AC, 0x879F, 0x490F, {0x97, 
0x60, 0xBB, 0xDF, 0xAF, 0x69, 0x5F, 0x50}}
-  gEfiLegacyDevOrderVariableGuid= {0xa56074db, 0x65fe, 0x45f7, {0xbd, 
0x21, 0x2d, 0x2b, 0xdd, 0x8e, 0x96, 0x52}}
   gQemuKernelLoaderFsMediaGuid  = {0x1428f772, 0xb64a, 0x441e, {0xb8, 
0xc3, 0x9e, 0xbd, 0xd7, 0xf8, 0x93, 0xc7}}
   gGrubFileGuid = {0xb5ae312c, 0xbc8a, 0x43b1, {0x9c, 
0x62, 0xeb, 0xb8, 0x26, 0xdd, 0x5d, 0x07}}
   gConfidentialComputingSecretGuid  = {0xadf956ad, 0xe98c, 0x484c, {0xae, 
0x11, 0xb5, 0x1c, 0x7d, 0x33, 0x64, 0x47}}
diff --git a/OvmfPkg/Csm/Include/Guid/LegacyDevOrder.h 
b/OvmfPkg/Csm/Include/Guid/LegacyDevOrder.h
deleted file mode 100644
index 4446b005cb12..
--- a/OvmfPkg/Csm/Include/Guid/LegacyDevOrder.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/** @file
-  Guid of a NV Variable which store the information about the
-  FD/HD/CD/NET/BEV order.
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef __LEGACY_DEV_ORDER_VARIABLE_GUID_H__
-#define __LEGACY_DEV_ORDER_VARIABLE_GUID_H__
-
-///
-/// Name and Guid of a NV Variable which stores the information about the
-/// FD/HD/CD/NET/BEV order
-///
-#define EFI_LEGACY_DEV_ORDER_VARIABLE_GUID \
-  { \
-  0xa56074db, 0x65fe, 0x45f7, {0xbd, 0x21, 0x2d, 0x2b, 0xdd, 0x8e, 0x96, 0x52} 
\
-  }
-
-typedef UINT8 BBS_TYPE;
-
-#pragma pack(1)
-typedef struct {
-  BBS_TYPEBbsType;
-  ///
-  /// Length = sizeof (UINT16) + sizeof (Data)
-  ///
-  UINT16  Length;
-  UINT16  Data[1];
-} LEGACY_DEV_ORDER_ENTRY;
-#pragma pack()
-
-#define VAR_LEGACY_DEV_ORDER  L"LegacyDevOrder"
-
-extern EFI_GUID  gEfiLegacyDevOrderVariableGuid;
-
-#endif



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111078): https://edk2.groups.io/g/devel/message/111078
Mute This Topic: https://groups.io/mt/102518644/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 05/37] OvmfPkg: unplug LegacyBootMaintUiLib from UiApp

2023-11-10 Thread Laszlo Ersek
LegacyBootMaintUiLib registers a form (HII Config Access Protocol
instance) with UiApp, for configuring legacy boot options; stop plugging
it into UiApp.

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Corvin Köhne 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Bhyve/BhyveX64.dsc | 3 ---
 OvmfPkg/OvmfPkgIa32.dsc| 3 ---
 OvmfPkg/OvmfPkgIa32X64.dsc | 3 ---
 OvmfPkg/OvmfPkgX64.dsc | 3 ---
 OvmfPkg/OvmfXen.dsc| 3 ---
 5 files changed, 15 deletions(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 4d4bb2a58708..073bf541661c 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -675,9 +675,6 @@ [Components]
   NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
-!ifdef $(CSM_ENABLE)
-  NULL|OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
-!endif
   }
   OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
   OvmfPkg/Virtio10Dxe/Virtio10.inf
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index ca09a9302e02..a2ac18a4a766 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -790,9 +790,6 @@ [Components]
   NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
-!ifdef $(CSM_ENABLE)
-  NULL|OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
-!endif
   }
   OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf {
 
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 1ff2213dc4a1..a935ca2eb6ac 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -808,9 +808,6 @@ [Components.X64]
   NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
-!ifdef $(CSM_ENABLE)
-  NULL|OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
-!endif
   }
   OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf {
 
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 0bd497c64be4..5f95d9ca3d36 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -876,9 +876,6 @@ [Components]
   NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
-!ifdef $(CSM_ENABLE)
-  NULL|OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
-!endif
   }
   OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf {
 
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 8573052dc9c5..dee2349e57f0 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -604,9 +604,6 @@ [Components]
   NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
-!ifdef $(CSM_ENABLE)
-  NULL|OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
-!endif
   }
   OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.inf {
 



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

2023-11-10 Thread Laszlo Ersek
LegacyBootManagerLib is not used by any platform at this point, remove it.

This patch removes mentions of the following CSM resources from the source
code:

- GUIDs (protocols or otherwise):
  - gEfiLegacyBiosProtocolGuid
  - gEfiLegacyDevOrderVariableGuid

- headers:
  - Guid/LegacyDevOrder.h
  - Protocol/LegacyBios.h

which extends the list of resources scheduled for removal to:

- GUIDs (protocols or otherwise):
  - gEfiLegacyBiosProtocolGuid
  - gEfiLegacyDevOrderVariableGuid

- headers:
  - Guid/LegacyDevOrder.h
  - Protocol/LegacyBios.h

Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.uni |   20 -
 OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf |   57 -
 OvmfPkg/Csm/LegacyBootManagerLib/InternalLegacyBm.h   |   60 -
 OvmfPkg/Csm/LegacyBootManagerLib/LegacyBm.c   | 1573 

 4 files changed, 1710 deletions(-)

diff --git a/OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.uni 
b/OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.uni
deleted file mode 100644
index da2915a9a391..
--- a/OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.uni
+++ /dev/null
@@ -1,20 +0,0 @@
-// /** @file
-// Legacy Boot Manager module is library for BDS phase.
-//
-// Legacy Boot Manager module is library for BDS phase.
-//
-// Copyright (c) 2015, Intel Corporation. All rights reserved.
-//
-// SPDX-License-Identifier: BSD-2-Clause-Patent
-//
-// **/
-
-#string STR_MODULE_ABSTRACT
-#language en-US
-"Legacy Boot Manager module is library for BDS phase."
-
-#string STR_MODULE_DESCRIPTION
-#language en-US
-"Legacy Boot Manager module is library for BDS phase."
-
-
diff --git a/OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf 
b/OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
deleted file mode 100644
index e43351cf959f..
--- a/OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
+++ /dev/null
@@ -1,57 +0,0 @@
-## @file
-#  Legacy Boot Manager module is library for BDS phase.
-#
-#  Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.
-#  SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[Defines]
-  INF_VERSION= 0x00010005
-  BASE_NAME  = LegacyBootManagerLib
-  MODULE_UNI_FILE= LegacyBootManagerLib.uni
-  FILE_GUID  = D1BBB810-6A9E-40E0-87CB-65EAD2AA2A09
-  MODULE_TYPE= DXE_DRIVER
-  VERSION_STRING = 1.0
-  LIBRARY_CLASS  = NULL|DXE_DRIVER UEFI_APPLICATION
-  CONSTRUCTOR= LegacyBootManagerLibConstructor
-
-#
-# The following information is for reference only and not required by the 
build tools.
-#
-#  VALID_ARCHITECTURES   = IA32 X64 EBC
-#
-
-[Sources]
-  LegacyBm.c
-  InternalLegacyBm.h
-
-[Packages]
-  MdePkg/MdePkg.dec
-  MdeModulePkg/MdeModulePkg.dec
-  OvmfPkg/OvmfPkg.dec
-
-[LibraryClasses]
-  BaseLib
-  BaseMemoryLib
-  UefiBootServicesTableLib
-  UefiRuntimeServicesTableLib
-  DevicePathLib
-  MemoryAllocationLib
-  UefiLib
-  DebugLib
-  PrintLib
-  PerformanceLib
-  UefiBootManagerLib
-
-[Guids]
-  gEfiGlobalVariableGuid## SOMETIMES_PRODUCES ## 
Variable:L"Boot" (Boot option variable)
-## SOMETIMES_CONSUMES ## 
Variable:L"BootOrder" (The boot option array)
-  gEfiLegacyDevOrderVariableGuid
-
-[Protocols]
-  gEfiLegacyBiosProtocolGuid## SOMETIMES_CONSUMES
-
-[FeaturePcd]
-
-[Pcd]
diff --git a/OvmfPkg/Csm/LegacyBootManagerLib/InternalLegacyBm.h 
b/OvmfPkg/Csm/LegacyBootManagerLib/InternalLegacyBm.h
deleted file mode 100644
index 8dd8b884d375..
--- a/OvmfPkg/Csm/LegacyBootManagerLib/InternalLegacyBm.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/** @file
-
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#ifndef _INTERNAL_LEGACY_BM_H_
-#define _INTERNAL_LEGACY_BM_H_
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#pragma pack(1)
-typedef struct {
-  UINT16BbsIndex;
-} LEGACY_BM_BOOT_OPTION_BBS_DATA;
-#pragma pack()
-
-/**
-  Boot the legacy system with the boot option.
-
-  @param  BootOption The legacy boot option which have BBS device path
- On return, BootOption->Status contains the boot status.
- EFI_UNSUPPORTEDThere is no legacybios protocol, do 
not support
-legacy boot.
- EFI_STATUS The status of LegacyBios->LegacyBoot 
().
-**/
-VOID
-EFIAPI
-LegacyBmBoot (
-  IN  EFI_BOOT_MANAGER_LOAD_OPTION  *BootOption
-  );
-
-/**
-  Refresh all legacy boot options.
-
-**/

[edk2-devel] [PATCH 03/37] OvmfPkg: unplug LegacyBootManagerLib from BdsDxe and UiApp

2023-11-10 Thread Laszlo Ersek
Don't register the LegacyBmRefreshAllBootOption() and LegacyBmBoot()
functions in BdsDxe and UiApp.

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Corvin Köhne 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Bhyve/BhyveX64.dsc | 2 --
 OvmfPkg/OvmfPkgIa32.dsc| 2 --
 OvmfPkg/OvmfPkgIa32X64.dsc | 2 --
 OvmfPkg/OvmfPkgX64.dsc | 2 --
 OvmfPkg/OvmfXen.dsc| 2 --
 5 files changed, 10 deletions(-)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 6965c90508f2..4d4bb2a58708 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -667,7 +667,6 @@ [Components]
 !ifdef $(CSM_ENABLE)
 !error "CSM is being torn down"
   NULL|OvmfPkg/Bhyve/Csm/CsmSupportLib/CsmSupportLib.inf
-  NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
 !endif
   }
   MdeModulePkg/Logo/LogoDxe.inf
@@ -677,7 +676,6 @@ [Components]
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
 !ifdef $(CSM_ENABLE)
-  NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
   NULL|OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
 !endif
   }
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index ea513eb2e951..ca09a9302e02 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -782,7 +782,6 @@ [Components]
   XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 !ifdef $(CSM_ENABLE)
   NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
-  NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
 !endif
   }
   MdeModulePkg/Logo/LogoDxe.inf
@@ -792,7 +791,6 @@ [Components]
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
 !ifdef $(CSM_ENABLE)
-  NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
   NULL|OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
 !endif
   }
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index bb078ed89c14..1ff2213dc4a1 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -800,7 +800,6 @@ [Components.X64]
   XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 !ifdef $(CSM_ENABLE)
   NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
-  NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
 !endif
   }
   MdeModulePkg/Logo/LogoDxe.inf
@@ -810,7 +809,6 @@ [Components.X64]
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
 !ifdef $(CSM_ENABLE)
-  NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
   NULL|OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
 !endif
   }
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index fb816c722c40..0bd497c64be4 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -868,7 +868,6 @@ [Components]
   XenPlatformLib|OvmfPkg/Library/XenPlatformLib/XenPlatformLib.inf
 !ifdef $(CSM_ENABLE)
   NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
-  NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
 !endif
   }
   MdeModulePkg/Logo/LogoDxe.inf
@@ -878,7 +877,6 @@ [Components]
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
 !ifdef $(CSM_ENABLE)
-  NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
   NULL|OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
 !endif
   }
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 2fbab39b485d..8573052dc9c5 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -596,7 +596,6 @@ [Components]
 
 !ifdef $(CSM_ENABLE)
   NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf
-  NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
 !endif
   }
   MdeModulePkg/Logo/LogoDxe.inf
@@ -606,7 +605,6 @@ [Components]
   NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
   
NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
 !ifdef $(CSM_ENABLE)
-  NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
   NULL|OvmfPkg/Csm/LegacyBootMaintUiLib/LegacyBootMaintUiLib.inf
 !endif
   }



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

2023-11-10 Thread Laszlo Ersek
PcdCsmEnable was introduced in commits 50f911d25d39 ("OvmfPkg: introduce
PcdCsmEnable feature flag", 2020-02-05) and 75839f977d37
("OvmfPkg/PlatformPei: detect SMRAM at default SMBASE (for real)",
2020-02-05). Remove it, and substitute constant FALSE wherever it has been
evaluated thus far.

Regression test: after building OVMF IA32X64 with -D SMM_REQUIRE, and
booting it on Q35, the log still contains

> Q35SmramAtDefaultSmbaseInitialization: SMRAM at default SMBASE found

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/OvmfPkg.dec |  5 ---
 OvmfPkg/IntelTdx/IntelTdxX64.dsc|  1 -
 OvmfPkg/OvmfPkgIa32.dsc |  1 -
 OvmfPkg/OvmfPkgIa32X64.dsc  |  1 -
 OvmfPkg/OvmfPkgX64.dsc  |  1 -
 OvmfPkg/OvmfXen.dsc |  1 -
 OvmfPkg/PlatformPei/PlatformPei.inf |  1 -
 OvmfPkg/PlatformPei/MemDetect.c | 36 +++-
 8 files changed, 13 insertions(+), 34 deletions(-)

diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
index e3861e5c1b39..74cc870cbed3 100644
--- a/OvmfPkg/OvmfPkg.dec
+++ b/OvmfPkg/OvmfPkg.dec
@@ -497,8 +497,3 @@ [PcdsFeatureFlag]
 
   ## This feature flag indicates the firmware build supports secure boot.
   gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootSupported|FALSE|BOOLEAN|0x6d
-
-  ## Informs modules (including pre-DXE-phase modules) whether the platform
-  #  firmware contains a CSM (Compatibility Support Module).
-  #
-  gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|FALSE|BOOLEAN|0x35
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index 669d3343b199..5513b7763774 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -377,7 +377,6 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
 !ifdef $(CSM_ENABLE)
 !error "CSM is being torn down"
-  gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE
 !endif
 !if $(SECURE_BOOT_ENABLE) == TRUE
   gUefiOvmfPkgTokenSpaceGuid.PcdSecureBootSupported|TRUE
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index 9b1117ac51f7..ea513eb2e951 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -472,7 +472,6 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
 !ifdef $(CSM_ENABLE)
 !error "CSM is being torn down"
-  gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE
 !endif
 !if $(SMM_REQUIRE) == TRUE
   gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire|TRUE
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 22f9d903dcd5..bb078ed89c14 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -479,7 +479,6 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
 !ifdef $(CSM_ENABLE)
 !error "CSM is being torn down"
-  gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE
 !endif
 !if $(SMM_REQUIRE) == TRUE
   gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire|TRUE
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index cf232e2b95b0..fb816c722c40 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -498,7 +498,6 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
 !ifdef $(CSM_ENABLE)
 !error "CSM is being torn down"
-  gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE
 !endif
 !if $(SMM_REQUIRE) == TRUE
   gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire|TRUE
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index e83a6497a793..2fbab39b485d 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -364,7 +364,6 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
 !ifdef $(CSM_ENABLE)
 !error "CSM is being torn down"
-  gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE
 !endif
 
 [PcdsFixedAtBuild]
diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf 
b/OvmfPkg/PlatformPei/PlatformPei.inf
index 3934aeed9514..ad52be306560 100644
--- a/OvmfPkg/PlatformPei/PlatformPei.inf
+++ b/OvmfPkg/PlatformPei/PlatformPei.inf
@@ -133,7 +133,6 @@ [FixedPcd]
   gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSnpSecretsSize
 
 [FeaturePcd]
-  gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable
   gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire
 
 [Ppis]
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
index 0c755c4940bb..493cb1fbeb01 100644
--- a/OvmfPkg/PlatformPei/MemDetect.c
+++ b/OvmfPkg/PlatformPei/MemDetect.c
@@ -89,32 +89,22 @@ Q35SmramAtDefaultSmbaseInitialization (
   )
 {
   RETURN_STATUS  PcdStatus;
+  UINTN  CtlReg;
+  UINT8  CtlRegVal;
 
   ASSERT (PlatformInfoHob->HostBridgeDevId == INTEL_Q35_MCH_DEVICE_ID);
 
-  PlatformInfoHob->Q35SmramAtDefaultSmbase = FALSE;
-  if (FeaturePcdGet (PcdCsmEnable)) {
-DEBUG ((
-  DEBUG_INFO,
-  "%a: SMRAM at default SMBASE not checked due to CSM\n",
-  __func__
-  ));
-  } else {
-UINTN  CtlReg;
-UINT8  CtlRegVal;
-
-

[edk2-devel] [PATCH 01/37] OvmfPkg: cripple CSM_ENABLE macro

2023-11-10 Thread Laszlo Ersek
We're going to gradually tear down and remove the Compatibility Support
Module (CSM) in OvmfPkg (due to it having no maintainer). Start by making
all platforms that have thus far accepted "-D CSM_ENABLE" reject that
macro, so that mid-series, the partially removed infrastructure cannot be
built or booted.

Insert an !error directive in each DSC file's first "!ifdef $(CSM_ENABLE)"
conditional.

At the end of the series, the !error directive introduced in this patch
will be removed.

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Corvin Köhne 
Cc: Gerd Hoffmann 
Cc: Jiewen Yao 
Cc: Rebecca Cran 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
Signed-off-by: Laszlo Ersek 
---
 OvmfPkg/Bhyve/BhyveX64.dsc   | 1 +
 OvmfPkg/IntelTdx/IntelTdxX64.dsc | 1 +
 OvmfPkg/OvmfPkgIa32.dsc  | 1 +
 OvmfPkg/OvmfPkgIa32X64.dsc   | 1 +
 OvmfPkg/OvmfPkgX64.dsc   | 1 +
 OvmfPkg/OvmfXen.dsc  | 1 +
 6 files changed, 6 insertions(+)

diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 6693342c5f6e..6965c90508f2 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -665,6 +665,7 @@ [Components]
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {
 
 !ifdef $(CSM_ENABLE)
+!error "CSM is being torn down"
   NULL|OvmfPkg/Bhyve/Csm/CsmSupportLib/CsmSupportLib.inf
   NULL|OvmfPkg/Csm/LegacyBootManagerLib/LegacyBootManagerLib.inf
 !endif
diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
index 182ec3705dd3..669d3343b199 100644
--- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc
+++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc
@@ -376,6 +376,7 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
 !ifdef $(CSM_ENABLE)
+!error "CSM is being torn down"
   gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE
 !endif
 !if $(SECURE_BOOT_ENABLE) == TRUE
diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
index ed3a19feebe6..9b1117ac51f7 100644
--- a/OvmfPkg/OvmfPkgIa32.dsc
+++ b/OvmfPkg/OvmfPkgIa32.dsc
@@ -471,6 +471,7 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
 !ifdef $(CSM_ENABLE)
+!error "CSM is being torn down"
   gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE
 !endif
 !if $(SMM_REQUIRE) == TRUE
diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
index 16ca139b2973..22f9d903dcd5 100644
--- a/OvmfPkg/OvmfPkgIa32X64.dsc
+++ b/OvmfPkg/OvmfPkgIa32X64.dsc
@@ -478,6 +478,7 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
 !ifdef $(CSM_ENABLE)
+!error "CSM is being torn down"
   gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE
 !endif
 !if $(SMM_REQUIRE) == TRUE
diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index dc1a0942aa8b..cf232e2b95b0 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -497,6 +497,7 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
 !ifdef $(CSM_ENABLE)
+!error "CSM is being torn down"
   gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE
 !endif
 !if $(SMM_REQUIRE) == TRUE
diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc
index 0063245b5659..e83a6497a793 100644
--- a/OvmfPkg/OvmfXen.dsc
+++ b/OvmfPkg/OvmfXen.dsc
@@ -363,6 +363,7 @@ [PcdsFeatureFlag]
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE
   gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
 !ifdef $(CSM_ENABLE)
+!error "CSM is being torn down"
   gUefiOvmfPkgTokenSpaceGuid.PcdCsmEnable|TRUE
 !endif
 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111072): https://edk2.groups.io/g/devel/message/111072
Mute This Topic: https://groups.io/mt/102518624/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 00/37] OvmfPkg: remove the CSM (after edk2-stable202311)

2023-11-10 Thread Laszlo Ersek
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4588
CI: https://github.com/tianocore/edk2/pull/5031 (@ 961d5add9f03)

Remove the Compatibility Support Module (CSM) from OVMF (after
edk2-stable202311).

Modify the following platforms:

  OvmfPkg/AmdSev/AmdSevX64.dsc
  OvmfPkg/Bhyve/BhyveX64.dsc
  OvmfPkg/CloudHv/CloudHvX64.dsc
  OvmfPkg/IntelTdx/IntelTdxX64.dsc
  OvmfPkg/Microvm/MicrovmX64.dsc
  OvmfPkg/OvmfPkgIa32.dsc
  OvmfPkg/OvmfPkgIa32X64.dsc
  OvmfPkg/OvmfPkgX64.dsc
  OvmfPkg/OvmfXen.dsc

Each of those platforms builds at every stage of the series.

Follow a gradual approach. Peel off CSM components in (reverse)
dependency order:

- exclude a high-level CSM component (library or driver) from the OVMF
  platforms, without breaking dependencies of low-level components;

- delete the high-level component from OvmfPkg;

- add, to a removal queue, any source code artifacts (protocols, GUIDs,
  headers, PCDs) that the high-level component's deletion
  *unreferences*;

- delete all entries of the removal queue (protocols, GUIDs, headers,
  PCDs) from the edk2 source tree that are now completely unreferenced
  (... and extend the removal queue recursively, if needed);

- advance to the next component that now qualifies as "high-level"
  (because nothing consumes the services it provides any longer), and
  exclude that one.

Regression-test the traditional platforms as needed; see the notes in
the following patches:

- OvmfPkg: remove PcdCsmEnable
- OvmfPkg/IncompatiblePciDeviceSupportDxe: ignore CSM presence
- OvmfPkg: exclude 8254TimerDxe

Cc: Anatol Belski 
Cc: Andrei Warkentin 
Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Corvin Köhne 
Cc: Erdem Aktas 
Cc: Gerd Hoffmann 
Cc: Jianyong Wu 
Cc: Jiewen Yao 
Cc: Michael Roth 
Cc: Min Xu 
Cc: Rebecca Cran 
Cc: Sunil V L 
Cc: Tom Lendacky 

Thanks
Laszlo

Laszlo Ersek (37):
  OvmfPkg: cripple CSM_ENABLE macro
  OvmfPkg: remove PcdCsmEnable
  OvmfPkg: unplug LegacyBootManagerLib from BdsDxe and UiApp
  OvmfPkg: remove LegacyBootManagerLib
  OvmfPkg: unplug LegacyBootMaintUiLib from UiApp
  OvmfPkg: remove LegacyBootMaintUiLib
  OvmfPkg: remove gEfiLegacyDevOrderVariableGuid
  OvmfPkg: exclude the CSM-based VideoDxe driver
  OvmfPkg: remove Csm/BiosThunk/VideoDxe
  OvmfPkg: remove gEfiVgaMiniPortProtocolGuid
  OvmfPkg: remove Bios Video PCDs
  OvmfPkg: exclude LegacyBiosDxe
  OvmfPkg/IncompatiblePciDeviceSupportDxe: ignore CSM presence
  Revert "OvmfPkg: don't assign PCI BARs above 4GiB when CSM enabled"
  OvmfPkg: remove LegacyBiosDxe
  OvmfPkg: exclude NullMemoryTestDxe driver
  OvmfPkg: remove gEfiIsaIoProtocolGuid
  OvmfPkg: remove gEfiIsaAcpiProtocolGuid
  OvmfPkg: remove gEfiLegacyBiosGuid
  OvmfPkg: remove LegacyBiosDxe PCDs
  OvmfPkg: unplug CsmSupportLib from BdsDxe
  OvmfPkg: remove CsmSupportLib
  OvmfPkg: remove gEfiFirmwareVolumeProtocolGuid
  OvmfPkg: remove gEfiLegacyBiosPlatformProtocolGuid
  OvmfPkg: remove gEfiLegacyBiosProtocolGuid
  OvmfPkg: remove gEfiLegacyInterruptProtocolGuid
  OvmfPkg: remove 
  OvmfPkg: exclude Csm16.inf / Csm16.bin
  OvmfPkg: remove Rule.Common.USER_DEFINED.CSM from all FDF files
  OvmfPkg: remove Csm16
  OvmfPkg: exclude 8254TimerDxe
  OvmfPkg: remove 8254TimerDxe
  OvmfPkg: exclude 8259InterruptControllerDxe
  OvmfPkg: remove 8259InterruptControllerDxe
  OvmfPkg: remove gEfiLegacy8259ProtocolGuid
  OvmfPkg: remove Pcd8259LegacyModeEdgeLevel and Pcd8259LegacyModeMask
  OvmfPkg: remove CSM_ENABLE build macro

 OvmfPkg/8254TimerDxe/8254Timer.inf   |   
43 -
 OvmfPkg/8254TimerDxe/Timer.c |  
406 ---
 OvmfPkg/8254TimerDxe/Timer.h |  
186 --
 OvmfPkg/8254TimerDxe/Timer.uni   |   
16 -
 OvmfPkg/8254TimerDxe/TimerExtra.uni  |   
14 -
 OvmfPkg/8259InterruptControllerDxe/8259.c|  
622 
 OvmfPkg/8259InterruptControllerDxe/8259.h|  
218 --
 OvmfPkg/8259InterruptControllerDxe/8259.inf  |   
45 -
 OvmfPkg/8259InterruptControllerDxe/Legacy8259.uni|   
16 -
 OvmfPkg/8259InterruptControllerDxe/Legacy8259Extra.uni   |   
14 -
 OvmfPkg/AmdSev/AmdSevX64.dsc |
4 -
 OvmfPkg/AmdSev/AmdSevX64.fdf |
1 -
 OvmfPkg/Bhyve/BhyveRfbDxe/GopDriver.c|
2 -
 OvmfPkg/Bhyve/BhyveX64.dsc   |   
24 +-
 OvmfPkg/Bhyve/BhyveX64.fdf   |   
14 -
 OvmfPkg/CloudHv/CloudHvX64.dsc   |
1 -
 OvmfPkg/CloudHv/CloudHvX64.fdf   |
6 -
 OvmfPkg/Csm/BiosThunk/VideoDxe/BiosVideo.c   | 
3357 

Re: [edk2-devel] [PATCH v3 0/5] BaseTools/Scripts/GetMaintainer: Handle reviewer only case

2023-11-10 Thread Rebecca Cran

For the series:

Acked-by: Rebecca Cran 


On 11/10/23 12:30, Leif Lindholm wrote:

OK, so this a bit of a backwards review, but I figured I might as
well show how I would prefer the split. I'm adding a patch that
changes internal returns to dictionaries instead of multiple return
values.

There are no functional differences between the original submission
and this for 1-2,4-5/5, so I'm happy to give
Reviewed-by: Leif Lindholm 
for those. 3/5 is new and requires review by someone else.

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

Fix logic bug where maintainers was incorrectly added to lists.

If a package only has reviewers and no maintainers, then also
return the  maintainers.

In order to detect this case, get_maintainers() is updated to
return maintainers, reviews, and lists separately instead of
a single merged list.  This also allows this module to be used
by other scripts that need to distinguish between maintainers,
reviewers, and lists.

Simplify logic that accumulates maintainers, reviewers, lists.

Sort the list of output addresses alphabetically and use set()
instead of OrderedDict() to accumulate unique addresses.

Changes since v2:
- Reworked internal return logic to use dictionaries.
- Reordered cleanup before new functionality.
Changes since v1:
- Split into patch series

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Cc: Michael D Kinney 

Leif Lindholm (1):
   BaseTools/Scripts/GetMaintainer: refactor internal returns as dicts

Michael D Kinney (4):
   BaseTools/Scripts/GetMaintainer: Fix logic bug collecting maintainers
   BaseTools/Scripts/GetMaintainer: Simplify logic
   BaseTools/Scripts/GetMaintainer: Handle reviewer only case
   BaseTools/Scripts/GetMaintainer: Sort output addresses

  BaseTools/Scripts/GetMaintainer.py | 43 +++---
  1 file changed, 27 insertions(+), 16 deletions(-)




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111070): https://edk2.groups.io/g/devel/message/111070
Mute This Topic: https://groups.io/mt/102513765/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 3/5] BaseTools/Scripts/GetMaintainer: refactor internal returns as dicts

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

Thank you for the addition cleanup.

Reviewed-by: Michael D Kinney 

Mike

> -Original Message-
> From: Leif Lindholm 
> Sent: Friday, November 10, 2023 11:31 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ; Rebecca Cran
> ; Gao, Liming ; Feng, Bob
> C ; Chen, Christine 
> Subject: [PATCH v3 3/5] BaseTools/Scripts/GetMaintainer: refactor
> internal returns as dicts
> 
> To clean up interfaces, change the lookup functions to return
> dictionaries
> rather than multiple values.
> 
> Cc: Rebecca Cran 
> Cc: Liming Gao 
> Cc: Bob Feng 
> Cc: Yuwei Chen 
> Cc: Michael D Kinney 
> Signed-off-by: Leif Lindholm 
> ---
>  BaseTools/Scripts/GetMaintainer.py | 19 ++-
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/BaseTools/Scripts/GetMaintainer.py
> b/BaseTools/Scripts/GetMaintainer.py
> index cdcdff750635..cb3aadbbefb1 100644
> --- a/BaseTools/Scripts/GetMaintainer.py
> +++ b/BaseTools/Scripts/GetMaintainer.py
> @@ -96,7 +96,7 @@ def get_section_maintainers(path, section):
>  else:
>  lists += [address]
> 
> -return maintainers, lists
> +return {'maintainers': maintainers, 'lists': lists}
> 
>  def get_maintainers(path, sections, level=0):
>  """For 'path', iterates over all sections, returning maintainers
> @@ -104,22 +104,24 @@ def get_maintainers(path, sections, level=0):
>  maintainers = []
>  lists = []
>  for section in sections:
> -tmp_maint, tmp_lists = get_section_maintainers(path, section)
> -maintainers += tmp_maint
> -lists += tmp_lists
> +recipients = get_section_maintainers(path, section)
> +maintainers += recipients['maintainers']
> +lists += recipients['lists']
> 
>  if not maintainers:
>  # If no match found, look for match for (nonexistent) file
>  # REPO.working_dir/
>  print('"%s": no maintainers found, looking for default' %
> path)
>  if level == 0:
> -maintainers = get_maintainers('', sections,
> level=level + 1)
> +recipients = get_maintainers('', sections,
> level=level + 1)
> +maintainers += recipients['maintainers']
> +lists += recipients['lists']
>  else:
>  print("No  maintainers set for project.")
>  if not maintainers:
>  return None
> 
> -return maintainers + lists
> +return {'maintainers': maintainers, 'lists': lists}
> 
>  def parse_maintainers_line(line):
>  """Parse one line of Maintainers.txt, returning any match group
> and its key."""
> @@ -184,9 +186,8 @@ if __name__ == '__main__':
> 
>  for file in FILES:
>  print(file)
> -addresslist = get_maintainers(file, SECTIONS)
> -if addresslist:
> -ADDRESSES += addresslist
> +recipients = get_maintainers(file, SECTIONS)
> +ADDRESSES += recipients['maintainers'] + recipients['lists']
> 
>  for address in list(OrderedDict.fromkeys(ADDRESSES)):
>  if '<' in address and '>' in address:
> --
> 2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111069): https://edk2.groups.io/g/devel/message/111069
Mute This Topic: https://groups.io/mt/102513771/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 v3 4/5] BaseTools/Scripts/GetMaintainer: Handle reviewer only case

2023-11-10 Thread Leif Lindholm
From: Michael D Kinney 

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

If a package only has reviewers and no maintainers, then also
return the  maintainers.

In order to detect this case, get_maintainers() is updated to
return maintainers, reviews, and lists separately instead of
a single merged list.  This also allows this module to be used
by other scripts that need to distinguish between maintainers,
reviewers, and lists.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
---
 BaseTools/Scripts/GetMaintainer.py | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Scripts/GetMaintainer.py 
b/BaseTools/Scripts/GetMaintainer.py
index cb3aadbbefb1..1361fb6c0e30 100644
--- a/BaseTools/Scripts/GetMaintainer.py
+++ b/BaseTools/Scripts/GetMaintainer.py
@@ -76,6 +76,7 @@ def get_section_maintainers(path, section):
 """Returns a list with email addresses to any M: and R: entries
matching the provided path in the provided section."""
 maintainers = []
+reviewers = []
 lists = []
 nowarn_status = ['Supported', 'Maintained']
 
@@ -83,12 +84,18 @@ def get_section_maintainers(path, section):
 for status in section['status']:
 if status not in nowarn_status:
 print('WARNING: Maintained status for "%s" is \'%s\'!' % 
(path, status))
-for address in section['maintainer'], section['reviewer']:
+for address in section['maintainer']:
 # Convert to list if necessary
 if isinstance(address, list):
 maintainers += address
 else:
 maintainers += [address]
+for address in section['reviewer']:
+# Convert to list if necessary
+if isinstance(address, list):
+reviewers += address
+else:
+reviewers += [address]
 for address in section['list']:
 # Convert to list if necessary
 if isinstance(address, list):
@@ -96,16 +103,18 @@ def get_section_maintainers(path, section):
 else:
 lists += [address]
 
-return {'maintainers': maintainers, 'lists': lists}
+return {'maintainers': maintainers, 'reviewers': reviewers, 'lists': lists}
 
 def get_maintainers(path, sections, level=0):
 """For 'path', iterates over all sections, returning maintainers
for matching ones."""
 maintainers = []
+reviewers = []
 lists = []
 for section in sections:
 recipients = get_section_maintainers(path, section)
 maintainers += recipients['maintainers']
+reviewers += recipients['reviewers']
 lists += recipients['lists']
 
 if not maintainers:
@@ -115,13 +124,14 @@ def get_maintainers(path, sections, level=0):
 if level == 0:
 recipients = get_maintainers('', sections, level=level + 
1)
 maintainers += recipients['maintainers']
+reviewers += recipients['reviewers']
 lists += recipients['lists']
 else:
 print("No  maintainers set for project.")
 if not maintainers:
 return None
 
-return {'maintainers': maintainers, 'lists': lists}
+return {'maintainers': maintainers, 'reviewers': reviewers, 'lists': lists}
 
 def parse_maintainers_line(line):
 """Parse one line of Maintainers.txt, returning any match group and its 
key."""
@@ -187,7 +197,7 @@ if __name__ == '__main__':
 for file in FILES:
 print(file)
 recipients = get_maintainers(file, SECTIONS)
-ADDRESSES += recipients['maintainers'] + recipients['lists']
+ADDRESSES += recipients['maintainers'] + recipients['reviewers'] + 
recipients['lists']
 
 for address in list(OrderedDict.fromkeys(ADDRESSES)):
 if '<' in address and '>' in address:
-- 
2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111067): https://edk2.groups.io/g/devel/message/111067
Mute This Topic: https://groups.io/mt/102513772/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 v3 5/5] BaseTools/Scripts/GetMaintainer: Sort output addresses

2023-11-10 Thread Leif Lindholm
From: Michael D Kinney 

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

Sort the list of output addresses alphabetically so this
script produces the same output even if the order of patches
in a patch series is modified such that that order of files
processed by this script changes.

Use set() logic instead of OrderedDict to accumulate the
list of unique addresses that are sorted alphabetically.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
---
 BaseTools/Scripts/GetMaintainer.py | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Scripts/GetMaintainer.py 
b/BaseTools/Scripts/GetMaintainer.py
index 1361fb6c0e30..8097ba4e7bd6 100644
--- a/BaseTools/Scripts/GetMaintainer.py
+++ b/BaseTools/Scripts/GetMaintainer.py
@@ -192,14 +192,16 @@ if __name__ == '__main__':
 else:
 FILES = get_modified_files(REPO, ARGS)
 
-ADDRESSES = []
-
+# Accumulate a sorted list of addresses
+ADDRESSES = set([])
 for file in FILES:
 print(file)
 recipients = get_maintainers(file, SECTIONS)
-ADDRESSES += recipients['maintainers'] + recipients['reviewers'] + 
recipients['lists']
+ADDRESSES |= set(recipients['maintainers'] + recipients['reviewers'] + 
recipients['lists'])
+ADDRESSES = list(ADDRESSES)
+ADDRESSES.sort()
 
-for address in list(OrderedDict.fromkeys(ADDRESSES)):
+for address in ADDRESSES:
 if '<' in address and '>' in address:
 address = address.split('>', 1)[0] + '>'
 print('  %s' % address)
-- 
2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111068): https://edk2.groups.io/g/devel/message/111068
Mute This Topic: https://groups.io/mt/102513774/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 v3 3/5] BaseTools/Scripts/GetMaintainer: refactor internal returns as dicts

2023-11-10 Thread Leif Lindholm
To clean up interfaces, change the lookup functions to return dictionaries
rather than multiple values.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Cc: Michael D Kinney 
Signed-off-by: Leif Lindholm 
---
 BaseTools/Scripts/GetMaintainer.py | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/BaseTools/Scripts/GetMaintainer.py 
b/BaseTools/Scripts/GetMaintainer.py
index cdcdff750635..cb3aadbbefb1 100644
--- a/BaseTools/Scripts/GetMaintainer.py
+++ b/BaseTools/Scripts/GetMaintainer.py
@@ -96,7 +96,7 @@ def get_section_maintainers(path, section):
 else:
 lists += [address]
 
-return maintainers, lists
+return {'maintainers': maintainers, 'lists': lists}
 
 def get_maintainers(path, sections, level=0):
 """For 'path', iterates over all sections, returning maintainers
@@ -104,22 +104,24 @@ def get_maintainers(path, sections, level=0):
 maintainers = []
 lists = []
 for section in sections:
-tmp_maint, tmp_lists = get_section_maintainers(path, section)
-maintainers += tmp_maint
-lists += tmp_lists
+recipients = get_section_maintainers(path, section)
+maintainers += recipients['maintainers']
+lists += recipients['lists']
 
 if not maintainers:
 # If no match found, look for match for (nonexistent) file
 # REPO.working_dir/
 print('"%s": no maintainers found, looking for default' % path)
 if level == 0:
-maintainers = get_maintainers('', sections, level=level + 
1)
+recipients = get_maintainers('', sections, level=level + 
1)
+maintainers += recipients['maintainers']
+lists += recipients['lists']
 else:
 print("No  maintainers set for project.")
 if not maintainers:
 return None
 
-return maintainers + lists
+return {'maintainers': maintainers, 'lists': lists}
 
 def parse_maintainers_line(line):
 """Parse one line of Maintainers.txt, returning any match group and its 
key."""
@@ -184,9 +186,8 @@ if __name__ == '__main__':
 
 for file in FILES:
 print(file)
-addresslist = get_maintainers(file, SECTIONS)
-if addresslist:
-ADDRESSES += addresslist
+recipients = get_maintainers(file, SECTIONS)
+ADDRESSES += recipients['maintainers'] + recipients['lists']
 
 for address in list(OrderedDict.fromkeys(ADDRESSES)):
 if '<' in address and '>' in address:
-- 
2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111066): https://edk2.groups.io/g/devel/message/111066
Mute This Topic: https://groups.io/mt/102513771/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 v3 2/5] BaseTools/Scripts/GetMaintainer: Simplify logic

2023-11-10 Thread Leif Lindholm
From: Michael D Kinney 

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

get_section_maintainers() either returns a list with
valid entries or an empty list.  It never returns None.
Simplify logic that accumulates maintainers and lists by
unconditionally appending lists returned from
get_section_maintainers().

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
---
 BaseTools/Scripts/GetMaintainer.py | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Scripts/GetMaintainer.py 
b/BaseTools/Scripts/GetMaintainer.py
index 2a3147c059b5..cdcdff750635 100644
--- a/BaseTools/Scripts/GetMaintainer.py
+++ b/BaseTools/Scripts/GetMaintainer.py
@@ -105,10 +105,8 @@ def get_maintainers(path, sections, level=0):
 lists = []
 for section in sections:
 tmp_maint, tmp_lists = get_section_maintainers(path, section)
-if tmp_maint:
-maintainers += tmp_maint
-if tmp_lists:
-lists += tmp_lists
+maintainers += tmp_maint
+lists += tmp_lists
 
 if not maintainers:
 # If no match found, look for match for (nonexistent) file
-- 
2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111065): https://edk2.groups.io/g/devel/message/111065
Mute This Topic: https://groups.io/mt/102513768/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 v3 1/5] BaseTools/Scripts/GetMaintainer: Fix logic bug collecting maintainers

2023-11-10 Thread Leif Lindholm
From: Michael D Kinney 

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

Fix logic bug where maintainers is incorrectly added to lists.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
---
 BaseTools/Scripts/GetMaintainer.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/GetMaintainer.py 
b/BaseTools/Scripts/GetMaintainer.py
index d1e042c0afe4..2a3147c059b5 100644
--- a/BaseTools/Scripts/GetMaintainer.py
+++ b/BaseTools/Scripts/GetMaintainer.py
@@ -88,7 +88,7 @@ def get_section_maintainers(path, section):
 if isinstance(address, list):
 maintainers += address
 else:
-lists += [address]
+maintainers += [address]
 for address in section['list']:
 # Convert to list if necessary
 if isinstance(address, list):
-- 
2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111064): https://edk2.groups.io/g/devel/message/111064
Mute This Topic: https://groups.io/mt/102513767/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 v3 0/5] BaseTools/Scripts/GetMaintainer: Handle reviewer only case

2023-11-10 Thread Leif Lindholm
OK, so this a bit of a backwards review, but I figured I might as
well show how I would prefer the split. I'm adding a patch that
changes internal returns to dictionaries instead of multiple return
values.

There are no functional differences between the original submission 
and this for 1-2,4-5/5, so I'm happy to give 
Reviewed-by: Leif Lindholm 
for those. 3/5 is new and requires review by someone else.

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

Fix logic bug where maintainers was incorrectly added to lists.

If a package only has reviewers and no maintainers, then also
return the  maintainers.

In order to detect this case, get_maintainers() is updated to
return maintainers, reviews, and lists separately instead of
a single merged list.  This also allows this module to be used
by other scripts that need to distinguish between maintainers,
reviewers, and lists.

Simplify logic that accumulates maintainers, reviewers, lists.

Sort the list of output addresses alphabetically and use set()
instead of OrderedDict() to accumulate unique addresses.

Changes since v2:
- Reworked internal return logic to use dictionaries.
- Reordered cleanup before new functionality.
Changes since v1:
- Split into patch series

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Cc: Michael D Kinney 

Leif Lindholm (1):
  BaseTools/Scripts/GetMaintainer: refactor internal returns as dicts

Michael D Kinney (4):
  BaseTools/Scripts/GetMaintainer: Fix logic bug collecting maintainers
  BaseTools/Scripts/GetMaintainer: Simplify logic
  BaseTools/Scripts/GetMaintainer: Handle reviewer only case
  BaseTools/Scripts/GetMaintainer: Sort output addresses

 BaseTools/Scripts/GetMaintainer.py | 43 +++---
 1 file changed, 27 insertions(+), 16 deletions(-)

-- 
2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111063): https://edk2.groups.io/g/devel/message/111063
Mute This Topic: https://groups.io/mt/102513765/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 edk2-test v2 4/4] Fix the URL for the edk2-test repo

2023-11-10 Thread Rebecca Cran
Fix the URL for the edk2-test repo: the uefi-sct is a directory inside
the repo.

Signed-off-by: Rebecca Cran 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 Maintainers.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Maintainers.txt b/Maintainers.txt
index a94255f015ad..ae6dd7008bcd 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -28,7 +28,7 @@ Descriptions of section entries:
 
 UEFI-SCT
 --
-T: git - https://github.com/tianocore/edk2-test/uefi-sct
+T: git - https://github.com/tianocore/edk2-test
 
 
 Responsible Disclosure, Reporting Security Issues
-- 
2.34.1



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




[edk2-devel] [PATCH edk2-test v2 3/4] Point users to the URL for edk2-test-parser if it doesn't exist

2023-11-10 Thread Rebecca Cran
If edk2-test-parser doesn't exist, tell the user where they can clone it
from.

Signed-off-by: Rebecca Cran 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 uefi-sct/SctPkg/buildzip.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/uefi-sct/SctPkg/buildzip.sh b/uefi-sct/SctPkg/buildzip.sh
index c7f4673f62b2..639d5152c9d2 100755
--- a/uefi-sct/SctPkg/buildzip.sh
+++ b/uefi-sct/SctPkg/buildzip.sh
@@ -54,6 +54,7 @@ cp Build/MdeModule/RELEASE_GCC5/${TARGET_ARCH}/CapsuleApp.efi 
${TARGET_ARCH}_SCT
 if [ ! -d "${pwd}edk2-test-parser" ]
 then
 echo "edk2-test-parser repo is missing from current directory, please 
clone and try again"
+echo "The URL for edk2-test-parser is 
https://git.gitlab.arm.com/systemready/edk2-test-parser.git;
 exit
 fi
 
-- 
2.34.1



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




[edk2-devel] [PATCH edk2-test v2 2/4] Rename files in HowToBuild to avoid spaces in filenames

2023-11-10 Thread Rebecca Cran
Rename the text files in the HowToBuild directory to remove the spaces
and use CamelCase instead.

Signed-off-by: Rebecca Cran 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 uefi-sct/HowToBuild/{How to accelerate SCT execution.txt => 
HowToAccelerateSctExecution.txt} | 0
 uefi-sct/HowToBuild/{How to build SCT.txt => HowToBuildSct.txt}
  | 0
 uefi-sct/HowToBuild/{How to build SCT in UDK2017.txt => 
HowToBuildSctInUdk2017.txt}  | 0
 3 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/uefi-sct/HowToBuild/How to accelerate SCT execution.txt 
b/uefi-sct/HowToBuild/HowToAccelerateSctExecution.txt
similarity index 100%
rename from uefi-sct/HowToBuild/How to accelerate SCT execution.txt
rename to uefi-sct/HowToBuild/HowToAccelerateSctExecution.txt
diff --git a/uefi-sct/HowToBuild/How to build SCT.txt 
b/uefi-sct/HowToBuild/HowToBuildSct.txt
similarity index 100%
rename from uefi-sct/HowToBuild/How to build SCT.txt
rename to uefi-sct/HowToBuild/HowToBuildSct.txt
diff --git a/uefi-sct/HowToBuild/How to build SCT in UDK2017.txt 
b/uefi-sct/HowToBuild/HowToBuildSctInUdk2017.txt
similarity index 100%
rename from uefi-sct/HowToBuild/How to build SCT in UDK2017.txt
rename to uefi-sct/HowToBuild/HowToBuildSctInUdk2017.txt
-- 
2.34.1



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




[edk2-devel] [PATCH edk2-test v2 1/4] Unbreak buildzip.sh

2023-11-10 Thread Rebecca Cran
Unbreak buildzip.sh by removing the line sourcing edksetup.sh: unless
WORKSPACE and PACKAGES_PATH are already configured, edksetup.sh will
error out.

Signed-off-by: Rebecca Cran 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 uefi-sct/SctPkg/buildzip.sh | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/uefi-sct/SctPkg/buildzip.sh b/uefi-sct/SctPkg/buildzip.sh
index 625475701f12..c7f4673f62b2 100755
--- a/uefi-sct/SctPkg/buildzip.sh
+++ b/uefi-sct/SctPkg/buildzip.sh
@@ -32,9 +32,6 @@ esac
 # clear all positional parameters
 set --
 
-source ./edk2/edksetup.sh
-
-
 NUM_CPUS=$((`getconf _NPROCESSORS_ONLN` + 2))
 
 make -j"$NUM_CPUS" -C edk2/BaseTools/
-- 
2.34.1



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




[edk2-devel] [PATCH edk2-test v2 0/4] Various improvements to the repo

2023-11-10 Thread Rebecca Cran
Some improvements to the edk2-test repository.

Since buildzip.sh creates output that appears more useful for running on
the target machine, I wonder if we might want to mention it in the
documentation someplace?

Also, I suspect the HowToBuildSctInUdk2017.txt file is now pretty
outdated. Should we delete it?

Finally, is the TianoCore Contribution Agreement still relevant? I know
it is for the edk2 docs repositories, but not sure if edk2-test should
be updated to match the other code repos like edk2 and edk2-platforms?

CHANGES FROM v1 to v2:

Converted tabs to spaces in the echo line added to buildzip.sh

Rebecca Cran (4):
  Unbreak buildzip.sh
  Rename files in HowToBuild to avoid spaces in filenames
  Point users to the URL for edk2-test-parser if it doesn't exist
  Fix the URL for the edk2-test repo

 Maintainers.txt
  | 2 +-
 uefi-sct/HowToBuild/{How to accelerate SCT execution.txt => 
HowToAccelerateSctExecution.txt} | 0
 uefi-sct/HowToBuild/{How to build SCT.txt => HowToBuildSct.txt}
  | 0
 uefi-sct/HowToBuild/{How to build SCT in UDK2017.txt => 
HowToBuildSctInUdk2017.txt}  | 0
 uefi-sct/SctPkg/buildzip.sh
  | 4 +---
 5 files changed, 2 insertions(+), 4 deletions(-)
 rename uefi-sct/HowToBuild/{How to accelerate SCT execution.txt => 
HowToAccelerateSctExecution.txt} (100%)
 rename uefi-sct/HowToBuild/{How to build SCT.txt => HowToBuildSct.txt} (100%)
 rename uefi-sct/HowToBuild/{How to build SCT in UDK2017.txt => 
HowToBuildSctInUdk2017.txt} (100%)

-- 
2.34.1



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




Re: [edk2-devel] [PATCH edk2-test 0/4] Various improvements to the repo

2023-11-10 Thread Rebecca Cran
It looks like Maintainers.txt also needs to be updated since I got 
bounces from Eric Jin and Arvin Chen's email addresses.



On 11/10/23 12:01, Rebecca Cran wrote:

Some improvements to the edk2-test repository.

Since buildzip.sh creates output that appears more useful for running on
the target machine, I wonder if we might want to mention it in the
documentation someplace?

Also, I suspect the HowToBuildSctInUdk2017.txt file is now pretty
outdated. Should we delete it?

Finally, is the TianoCore Contribution Agreement still relevant? I know
it is for the edk2 docs repositories, but not sure if edk2-test should
be updated to match the other code repos like edk2 and edk2-platforms?

Rebecca Cran (4):
   Unbreak buildzip.sh
   Rename files in HowToBuild to avoid spaces in filenames
   Point users to the URL for edk2-test-parser if it doesn't exist
   Fix the URL for the edk2-test repo

  Maintainers.txt   
   | 2 +-
  uefi-sct/HowToBuild/{How to accelerate SCT execution.txt => 
HowToAccelerateSctExecution.txt} | 0
  uefi-sct/HowToBuild/{How to build SCT.txt => HowToBuildSct.txt}   
   | 0
  uefi-sct/HowToBuild/{How to build SCT in UDK2017.txt => 
HowToBuildSctInUdk2017.txt}  | 0
  uefi-sct/SctPkg/buildzip.sh   
   | 4 +---
  5 files changed, 2 insertions(+), 4 deletions(-)
  rename uefi-sct/HowToBuild/{How to accelerate SCT execution.txt => 
HowToAccelerateSctExecution.txt} (100%)
  rename uefi-sct/HowToBuild/{How to build SCT.txt => HowToBuildSct.txt} (100%)
  rename uefi-sct/HowToBuild/{How to build SCT in UDK2017.txt => 
HowToBuildSctInUdk2017.txt} (100%)




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




[edk2-devel] [PATCH edk2-test 4/4] Fix the URL for the edk2-test repo

2023-11-10 Thread Rebecca Cran
Fix the URL for the edk2-test repo: the uefi-sct is a directory inside
the repo.

Signed-off-by: Rebecca Cran 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 Maintainers.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Maintainers.txt b/Maintainers.txt
index a94255f015ad..ae6dd7008bcd 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -28,7 +28,7 @@ Descriptions of section entries:
 
 UEFI-SCT
 --
-T: git - https://github.com/tianocore/edk2-test/uefi-sct
+T: git - https://github.com/tianocore/edk2-test
 
 
 Responsible Disclosure, Reporting Security Issues
-- 
2.34.1



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




[edk2-devel] [PATCH edk2-test 3/4] Point users to the URL for edk2-test-parser if it doesn't exist

2023-11-10 Thread Rebecca Cran
If edk2-test-parser doesn't exist, tell the user where they can clone it
from.

Signed-off-by: Rebecca Cran 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 uefi-sct/SctPkg/buildzip.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/uefi-sct/SctPkg/buildzip.sh b/uefi-sct/SctPkg/buildzip.sh
index c7f4673f62b2..cc02ad3056b6 100755
--- a/uefi-sct/SctPkg/buildzip.sh
+++ b/uefi-sct/SctPkg/buildzip.sh
@@ -54,6 +54,7 @@ cp Build/MdeModule/RELEASE_GCC5/${TARGET_ARCH}/CapsuleApp.efi 
${TARGET_ARCH}_SCT
 if [ ! -d "${pwd}edk2-test-parser" ]
 then
 echo "edk2-test-parser repo is missing from current directory, please 
clone and try again"
+   echo "The URL for edk2-test-parser is 
https://git.gitlab.arm.com/systemready/edk2-test-parser.git;
 exit
 fi
 
-- 
2.34.1



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




[edk2-devel] [PATCH edk2-test 1/4] Unbreak buildzip.sh

2023-11-10 Thread Rebecca Cran
Unbreak buildzip.sh by removing the line sourcing edksetup.sh: unless
WORKSPACE and PACKAGES_PATH are already configured, edksetup.sh will
error out.

Signed-off-by: Rebecca Cran 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 uefi-sct/SctPkg/buildzip.sh | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/uefi-sct/SctPkg/buildzip.sh b/uefi-sct/SctPkg/buildzip.sh
index 625475701f12..c7f4673f62b2 100755
--- a/uefi-sct/SctPkg/buildzip.sh
+++ b/uefi-sct/SctPkg/buildzip.sh
@@ -32,9 +32,6 @@ esac
 # clear all positional parameters
 set --
 
-source ./edk2/edksetup.sh
-
-
 NUM_CPUS=$((`getconf _NPROCESSORS_ONLN` + 2))
 
 make -j"$NUM_CPUS" -C edk2/BaseTools/
-- 
2.34.1



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




[edk2-devel] [PATCH edk2-test 2/4] Rename files in HowToBuild to avoid spaces in filenames

2023-11-10 Thread Rebecca Cran
Rename the text files in the HowToBuild directory to remove the spaces
and use CamelCase instead.

Signed-off-by: Rebecca Cran 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 uefi-sct/HowToBuild/{How to accelerate SCT execution.txt => 
HowToAccelerateSctExecution.txt} | 0
 uefi-sct/HowToBuild/{How to build SCT.txt => HowToBuildSct.txt}
  | 0
 uefi-sct/HowToBuild/{How to build SCT in UDK2017.txt => 
HowToBuildSctInUdk2017.txt}  | 0
 3 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/uefi-sct/HowToBuild/How to accelerate SCT execution.txt 
b/uefi-sct/HowToBuild/HowToAccelerateSctExecution.txt
similarity index 100%
rename from uefi-sct/HowToBuild/How to accelerate SCT execution.txt
rename to uefi-sct/HowToBuild/HowToAccelerateSctExecution.txt
diff --git a/uefi-sct/HowToBuild/How to build SCT.txt 
b/uefi-sct/HowToBuild/HowToBuildSct.txt
similarity index 100%
rename from uefi-sct/HowToBuild/How to build SCT.txt
rename to uefi-sct/HowToBuild/HowToBuildSct.txt
diff --git a/uefi-sct/HowToBuild/How to build SCT in UDK2017.txt 
b/uefi-sct/HowToBuild/HowToBuildSctInUdk2017.txt
similarity index 100%
rename from uefi-sct/HowToBuild/How to build SCT in UDK2017.txt
rename to uefi-sct/HowToBuild/HowToBuildSctInUdk2017.txt
-- 
2.34.1



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




[edk2-devel] [PATCH edk2-test 0/4] Various improvements to the repo

2023-11-10 Thread Rebecca Cran
Some improvements to the edk2-test repository.

Since buildzip.sh creates output that appears more useful for running on
the target machine, I wonder if we might want to mention it in the
documentation someplace?

Also, I suspect the HowToBuildSctInUdk2017.txt file is now pretty
outdated. Should we delete it?

Finally, is the TianoCore Contribution Agreement still relevant? I know
it is for the edk2 docs repositories, but not sure if edk2-test should
be updated to match the other code repos like edk2 and edk2-platforms?

Rebecca Cran (4):
  Unbreak buildzip.sh
  Rename files in HowToBuild to avoid spaces in filenames
  Point users to the URL for edk2-test-parser if it doesn't exist
  Fix the URL for the edk2-test repo

 Maintainers.txt
  | 2 +-
 uefi-sct/HowToBuild/{How to accelerate SCT execution.txt => 
HowToAccelerateSctExecution.txt} | 0
 uefi-sct/HowToBuild/{How to build SCT.txt => HowToBuildSct.txt}
  | 0
 uefi-sct/HowToBuild/{How to build SCT in UDK2017.txt => 
HowToBuildSctInUdk2017.txt}  | 0
 uefi-sct/SctPkg/buildzip.sh
  | 4 +---
 5 files changed, 2 insertions(+), 4 deletions(-)
 rename uefi-sct/HowToBuild/{How to accelerate SCT execution.txt => 
HowToAccelerateSctExecution.txt} (100%)
 rename uefi-sct/HowToBuild/{How to build SCT.txt => HowToBuildSct.txt} (100%)
 rename uefi-sct/HowToBuild/{How to build SCT in UDK2017.txt => 
HowToBuildSctInUdk2017.txt} (100%)

-- 
2.34.1



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




[edk2-devel] TPM2 NVM WRITE IN EDK2

2023-11-10 Thread Hamit Can Karaca
Hello,
I am a young UEFI developer and I am trying to use the functions in 
Tpm2CommandLib to write data to TPM2. I have defined the index that, I am going 
to write data to, using the DefineSpace function. But whenever I am trying to 
use the Tpm2NvWrite function, I keep getting EFI_DEVICE_ERROR with a response 
code 0x1D5. Is there anything to do before Tpm2NvWrite that I don't know or do 
I use the wrong parameters?
If anyone has used these functions please let me know, thanks!


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




[edk2-devel] [PATCH] IntelFsp2WrapperPkg: Add variable initialization

2023-11-10 Thread jasonx . hsu
From: "JasonX.Hsu" 

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

Fix build error when remove "-Wno-sometimes-uninitialized" option,
Add variable "FspMultiPhaseApiOffset" initialization.

Cc: Nate DeSimone 
Cc: Star Zeng 
Cc: Chasel Chiu 
Cc: Chen Gang C 
Cc: Duggapu Chinni B 
Cc: Ted Kuo 
Cc: Ashraf Ali S 
Cc: Susovan Mohapatra 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Jason Hsu 
---
 .../PeiFspWrapperMultiPhaseProcessLib.c  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
 
b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
index 834dca07a9..224c24881d 100644
--- 
a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
+++ 
b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
@@ -80,6 +80,7 @@ CallFspMultiPhaseEntry (
   BOOLEAN IsVariableServiceRequest;
   FSP_MULTI_PHASE_PARAMS  *FspMultiPhaseParamsPtr;
 
+  FspMultiPhaseApiOffset   = 0;
   FspMultiPhaseParamsPtr   = (FSP_MULTI_PHASE_PARAMS *)FspMultiPhaseParams;
   IsVariableServiceRequest = FALSE;
   if ((FspMultiPhaseParamsPtr->MultiPhaseAction == 
EnumMultiPhaseGetVariableRequestInfo) ||
-- 
2.39.1.windows.1



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




[edk2-devel] [PATCH] IntelFsp2WrapperPkg: Add variable initialization

2023-11-10 Thread jasonx . hsu
From: "JasonX.Hsu" 

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

Fix build error when remove "-Wno-sometimes-uninitialized" option,
Add variable "FspMultiPhaseApiOffset" initialization.
---
 .../PeiFspWrapperMultiPhaseProcessLib.c  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
 
b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
index 834dca07a9..224c24881d 100644
--- 
a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
+++ 
b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
@@ -80,6 +80,7 @@ CallFspMultiPhaseEntry (
   BOOLEAN IsVariableServiceRequest;
   FSP_MULTI_PHASE_PARAMS  *FspMultiPhaseParamsPtr;
 
+  FspMultiPhaseApiOffset   = 0;
   FspMultiPhaseParamsPtr   = (FSP_MULTI_PHASE_PARAMS *)FspMultiPhaseParams;
   IsVariableServiceRequest = FALSE;
   if ((FspMultiPhaseParamsPtr->MultiPhaseAction == 
EnumMultiPhaseGetVariableRequestInfo) ||
-- 
2.39.1.windows.1



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




[edk2-devel] [PATCH] IntelFsp2WrapperPkg: Add variable initialization

2023-11-10 Thread jasonx . hsu
From: "JasonX.Hsu" 

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

Fix build error when remove "-Wno-sometimes-uninitialized" option,
Add variable "FspMultiPhaseApiOffset" initialization.

Cc: Nate DeSimone 
Cc: Star Zeng 
Cc: James Lu 
Cc: Gua Guo 
Signed-off-by: Jason Hsu 
---
 .../PeiFspWrapperMultiPhaseProcessLib.c  | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
 
b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
index 834dca07a9..224c24881d 100644
--- 
a/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
+++ 
b/IntelFsp2WrapperPkg/Library/FspWrapperMultiPhaseProcessLib/PeiFspWrapperMultiPhaseProcessLib.c
@@ -80,6 +80,7 @@ CallFspMultiPhaseEntry (
   BOOLEAN IsVariableServiceRequest;
   FSP_MULTI_PHASE_PARAMS  *FspMultiPhaseParamsPtr;
 
+  FspMultiPhaseApiOffset   = 0;
   FspMultiPhaseParamsPtr   = (FSP_MULTI_PHASE_PARAMS *)FspMultiPhaseParams;
   IsVariableServiceRequest = FALSE;
   if ((FspMultiPhaseParamsPtr->MultiPhaseAction == 
EnumMultiPhaseGetVariableRequestInfo) ||
-- 
2.39.1.windows.1



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




[edk2-devel] [edk2-stable202311][Patch v2 2/4] BaseTools/Scripts/GetMaintainer: Handle reviewer only case

2023-11-10 Thread Michael D Kinney
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4593

If a package only has reviewers and no maintainers, then also
return the  maintainers.

In order to detect this case, get_maintainers() is updated to
return maintainers, reviews, and lists separately instead of
a single merged list.  This also allows this module to be used
by other scripts that need to distinguish between maintainers,
reviewers, and lists.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
---
 BaseTools/Scripts/GetMaintainer.py | 28 
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/BaseTools/Scripts/GetMaintainer.py 
b/BaseTools/Scripts/GetMaintainer.py
index 2a3147c059b5..081460451e9b 100644
--- a/BaseTools/Scripts/GetMaintainer.py
+++ b/BaseTools/Scripts/GetMaintainer.py
@@ -76,6 +76,7 @@ def get_section_maintainers(path, section):
 """Returns a list with email addresses to any M: and R: entries
matching the provided path in the provided section."""
 maintainers = []
+reviewers = []
 lists = []
 nowarn_status = ['Supported', 'Maintained']
 
@@ -83,12 +84,18 @@ def get_section_maintainers(path, section):
 for status in section['status']:
 if status not in nowarn_status:
 print('WARNING: Maintained status for "%s" is \'%s\'!' % 
(path, status))
-for address in section['maintainer'], section['reviewer']:
+for address in section['maintainer']:
 # Convert to list if necessary
 if isinstance(address, list):
 maintainers += address
 else:
 maintainers += [address]
+for address in section['reviewer']:
+# Convert to list if necessary
+if isinstance(address, list):
+reviewers += address
+else:
+reviewers += [address]
 for address in section['list']:
 # Convert to list if necessary
 if isinstance(address, list):
@@ -96,17 +103,20 @@ def get_section_maintainers(path, section):
 else:
 lists += [address]
 
-return maintainers, lists
+return maintainers, reviewers, lists
 
 def get_maintainers(path, sections, level=0):
 """For 'path', iterates over all sections, returning maintainers
for matching ones."""
 maintainers = []
+reviewers = []
 lists = []
 for section in sections:
-tmp_maint, tmp_lists = get_section_maintainers(path, section)
+tmp_maint, tmp_review, tmp_lists = get_section_maintainers(path, 
section)
 if tmp_maint:
 maintainers += tmp_maint
+if tmp_review:
+reviewers += tmp_review
 if tmp_lists:
 lists += tmp_lists
 
@@ -115,13 +125,15 @@ def get_maintainers(path, sections, level=0):
 # REPO.working_dir/
 print('"%s": no maintainers found, looking for default' % path)
 if level == 0:
-maintainers = get_maintainers('', sections, level=level + 
1)
+maintainers, tmp_review, tmp_lists = get_maintainers('', 
sections, level=level + 1)
+reviewers += tmp_review
+lists += tmp_lists
 else:
 print("No  maintainers set for project.")
 if not maintainers:
 return None
 
-return maintainers + lists
+return maintainers, reviewers, lists
 
 def parse_maintainers_line(line):
 """Parse one line of Maintainers.txt, returning any match group and its 
key."""
@@ -186,9 +198,9 @@ if __name__ == '__main__':
 
 for file in FILES:
 print(file)
-addresslist = get_maintainers(file, SECTIONS)
-if addresslist:
-ADDRESSES += addresslist
+maintainers, reviewers, lists = get_maintainers(file, SECTIONS)
+if maintainers or reviewers or lists:
+ADDRESSES += (maintainers + reviewers + lists)
 
 for address in list(OrderedDict.fromkeys(ADDRESSES)):
 if '<' in address and '>' in address:
-- 
2.40.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111046): https://edk2.groups.io/g/devel/message/111046
Mute This Topic: https://groups.io/mt/102510794/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-stable202311][Patch v2 1/4] BaseTools/Scripts/GetMaintainer: Fix logic bug collecting maintainers

2023-11-10 Thread Michael D Kinney
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4593

Fix logic bug where maintainers is incorrectly added to lists.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
---
 BaseTools/Scripts/GetMaintainer.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/GetMaintainer.py 
b/BaseTools/Scripts/GetMaintainer.py
index d1e042c0afe4..2a3147c059b5 100644
--- a/BaseTools/Scripts/GetMaintainer.py
+++ b/BaseTools/Scripts/GetMaintainer.py
@@ -88,7 +88,7 @@ def get_section_maintainers(path, section):
 if isinstance(address, list):
 maintainers += address
 else:
-lists += [address]
+maintainers += [address]
 for address in section['list']:
 # Convert to list if necessary
 if isinstance(address, list):
-- 
2.40.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111043): https://edk2.groups.io/g/devel/message/111043
Mute This Topic: https://groups.io/mt/102510789/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-stable202311][Patch v2 3/4] BaseTools/Scripts/GetMaintainer: Simplify logic

2023-11-10 Thread Michael D Kinney
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4593

get_section_maintainers() either returns a list with
valid entries or an empty list.  It never returns None.
Simplify logic that accumulates maintainers, reviewers,
and lists by unconditionally appending lists returned
from get_section_maintainers().

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
---
 BaseTools/Scripts/GetMaintainer.py | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Scripts/GetMaintainer.py 
b/BaseTools/Scripts/GetMaintainer.py
index 081460451e9b..a887962dd1bd 100644
--- a/BaseTools/Scripts/GetMaintainer.py
+++ b/BaseTools/Scripts/GetMaintainer.py
@@ -113,12 +113,9 @@ def get_maintainers(path, sections, level=0):
 lists = []
 for section in sections:
 tmp_maint, tmp_review, tmp_lists = get_section_maintainers(path, 
section)
-if tmp_maint:
-maintainers += tmp_maint
-if tmp_review:
-reviewers += tmp_review
-if tmp_lists:
-lists += tmp_lists
+maintainers += tmp_maint
+reviewers += tmp_review
+lists += tmp_lists
 
 if not maintainers:
 # If no match found, look for match for (nonexistent) file
-- 
2.40.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111044): https://edk2.groups.io/g/devel/message/111044
Mute This Topic: https://groups.io/mt/102510791/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-stable202311][Patch v2 4/4] BaseTools/Scripts/GetMaintainer: Sort output addresses

2023-11-10 Thread Michael D Kinney
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4593

Sort the list of output addresses alphabetically so this
script produces the same output even if the order of patches
in a patch series is modified such that that order of files
processed by this script changes.

Use set() logic instead of OrderedDict to accumulate the
list of unique addresses that are sorted alphabetically.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
---
 BaseTools/Scripts/GetMaintainer.py | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Scripts/GetMaintainer.py 
b/BaseTools/Scripts/GetMaintainer.py
index a887962dd1bd..b33546b10f21 100644
--- a/BaseTools/Scripts/GetMaintainer.py
+++ b/BaseTools/Scripts/GetMaintainer.py
@@ -191,15 +191,16 @@ if __name__ == '__main__':
 else:
 FILES = get_modified_files(REPO, ARGS)
 
-ADDRESSES = []
-
+# Accumulate a sorted list of addresses
+ADDRESSES = set([])
 for file in FILES:
 print(file)
 maintainers, reviewers, lists = get_maintainers(file, SECTIONS)
-if maintainers or reviewers or lists:
-ADDRESSES += (maintainers + reviewers + lists)
+ADDRESSES |= set(maintainers + reviewers + lists)
+ADDRESSES = list(ADDRESSES)
+ADDRESSES.sort()
 
-for address in list(OrderedDict.fromkeys(ADDRESSES)):
+for address in ADDRESSES:
 if '<' in address and '>' in address:
 address = address.split('>', 1)[0] + '>'
 print('  %s' % address)
-- 
2.40.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111045): https://edk2.groups.io/g/devel/message/111045
Mute This Topic: https://groups.io/mt/102510793/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-stable202311][Patch v2 0/4] BaseTools/Scripts/GetMaintainer: Handle reviewer only case

2023-11-10 Thread Michael D Kinney
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4593

New in V2: Split into patch series

Fix logic bug where maintainers was incorrectly added to lists.

If a package only has reviewers and no maintainers, then also
return the  maintainers.

In order to detect this case, get_maintainers() is updated to
return maintainers, reviews, and lists separately instead of
a single merged list.  This also allows this module to be used
by other scripts that need to distinguish between maintainers,
reviewers, and lists.

Simplify logic that accumulates maintainers, reviewers, lists.

Sort the list of output addresses alphabetically and use set()
instead of OrderedDict() to accumulate unique addresses.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 

Michael D Kinney (4):
  BaseTools/Scripts/GetMaintainer: Fix logic bug collecting maintainers
  BaseTools/Scripts/GetMaintainer: Handle reviewer only case
  BaseTools/Scripts/GetMaintainer: Simplify logic
  BaseTools/Scripts/GetMaintainer: Sort output addresses

 BaseTools/Scripts/GetMaintainer.py | 42 ++
 1 file changed, 26 insertions(+), 16 deletions(-)

-- 
2.40.1.windows.1



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




Re: [edk2-devel] [edk2-stable202311][Patch 1/1] BaseTools/Scripts: Handle reviewer only case in GetMaintainer.py

2023-11-10 Thread Leif Lindholm

On 2023-11-10 16:34, Kinney, Michael D wrote:

Hi Leif,

Agree with your points.  I was trying to make minimal changes to address
the reviewers with no maintainers case.  Returning a dictionary would make
more sense.

A couple questions:

1) Do you want to see this patch broken up into a series, with the
logic fix, reviewers with no maintainers feature, and code clean
up in separate patches?


Ideally, yes.
It will be helpful if I need to try to understand these changes again in 
future :)



2) Is this change approved for edk2-stable202311?


Yes.

Regards,

Leif


Thanks,

Mike


-Original Message-
From: devel@edk2.groups.io  On Behalf Of Leif
Lindholm
Sent: Friday, November 10, 2023 4:44 AM
To: Kinney, Michael D 
Cc: devel@edk2.groups.io; Rebecca Cran ; Gao,
Liming ; Feng, Bob C ;
Chen, Christine 
Subject: Re: [edk2-devel] [edk2-stable202311][Patch 1/1]
BaseTools/Scripts: Handle reviewer only case in GetMaintainer.py

On Wed, Nov 08, 2023 at 12:43:23 -0800, Michael D Kinney wrote:

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

If a package only has reviewers and no maintainers, then also
return the  maintainers.

Update get_maintainers() to return maintainers, reviews, and
lists separately instead of a single merged list to allow this
module to be used by other scripts and distinguish types.

Sort the list of output addresses alphabetically.

Fix logic bug where maintainers was incorrectly added to lists.

Cc: Rebecca Cran 
Cc: Liming Gao 
Cc: Bob Feng 
Cc: Yuwei Chen 
Cc: Leif Lindholm 
Signed-off-by: Michael D Kinney 
---
  BaseTools/Scripts/GetMaintainer.py | 42 ++-

---

  1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/BaseTools/Scripts/GetMaintainer.py

b/BaseTools/Scripts/GetMaintainer.py

index d1e042c0afe4..b33546b10f21 100644
--- a/BaseTools/Scripts/GetMaintainer.py
+++ b/BaseTools/Scripts/GetMaintainer.py
@@ -76,6 +76,7 @@ def get_section_maintainers(path, section):
  """Returns a list with email addresses to any M: and R: entries
 matching the provided path in the provided section."""
  maintainers = []
+reviewers = []
  lists = []
  nowarn_status = ['Supported', 'Maintained']

@@ -83,12 +84,18 @@ def get_section_maintainers(path, section):
  for status in section['status']:
  if status not in nowarn_status:
  print('WARNING: Maintained status for "%s" is

\'%s\'!' % (path, status))

-for address in section['maintainer'], section['reviewer']:
+for address in section['maintainer']:
  # Convert to list if necessary
  if isinstance(address, list):
  maintainers += address
  else:
-lists += [address]
+maintainers += [address]


That's a bugfix. Ought to be separate.
(Cleverly hidden by concatentaing the results when we didn't care
about keeping them separate other than for seeing if we'd found any
humans.)


+for address in section['reviewer']:
+# Convert to list if necessary
+if isinstance(address, list):
+reviewers += address
+else:
+reviewers += [address]
  for address in section['list']:
  # Convert to list if necessary
  if isinstance(address, list):
@@ -96,32 +103,34 @@ def get_section_maintainers(path, section):
  else:
  lists += [address]

-return maintainers, lists
+return maintainers, reviewers, lists

  def get_maintainers(path, sections, level=0):
  """For 'path', iterates over all sections, returning

maintainers

 for matching ones."""
  maintainers = []
+reviewers = []
  lists = []
  for section in sections:
-tmp_maint, tmp_lists = get_section_maintainers(path,

section)

-if tmp_maint:
-maintainers += tmp_maint
-if tmp_lists:
-lists += tmp_lists
+tmp_maint, tmp_review, tmp_lists =

get_section_maintainers(path, section)

+maintainers += tmp_maint
+reviewers += tmp_review
+lists += tmp_lists


Minor niggle at coding style cleanup as part of functional rework.



  if not maintainers:
  # If no match found, look for match for (nonexistent) file
  # REPO.working_dir/
  print('"%s": no maintainers found, looking for default' %

path)

  if level == 0:
-maintainers = get_maintainers('', sections,

level=level + 1)

+maintainers, tmp_review, tmp_lists =

get_maintainers('', sections, level=level + 1)

+reviewers += tmp_review
+lists += tmp_lists
  else:
  print("No  maintainers set for project.")
  if not maintainers:
  return None

-return maintainers + lists


Apart from the niggles mentioned above, I agree that this is a
reasonable way of adding the required functionality without 

Re: [edk2-devel] [edk2-stable202311][Patch 1/1] BaseTools/Scripts: Handle reviewer only case in GetMaintainer.py

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

Agree with your points.  I was trying to make minimal changes to address
the reviewers with no maintainers case.  Returning a dictionary would make
more sense.

A couple questions:

1) Do you want to see this patch broken up into a series, with the
   logic fix, reviewers with no maintainers feature, and code clean
   up in separate patches?

2) Is this change approved for edk2-stable202311?

Thanks,

Mike

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Leif
> Lindholm
> Sent: Friday, November 10, 2023 4:44 AM
> To: Kinney, Michael D 
> Cc: devel@edk2.groups.io; Rebecca Cran ; Gao,
> Liming ; Feng, Bob C ;
> Chen, Christine 
> Subject: Re: [edk2-devel] [edk2-stable202311][Patch 1/1]
> BaseTools/Scripts: Handle reviewer only case in GetMaintainer.py
> 
> On Wed, Nov 08, 2023 at 12:43:23 -0800, Michael D Kinney wrote:
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4593
> >
> > If a package only has reviewers and no maintainers, then also
> > return the  maintainers.
> >
> > Update get_maintainers() to return maintainers, reviews, and
> > lists separately instead of a single merged list to allow this
> > module to be used by other scripts and distinguish types.
> >
> > Sort the list of output addresses alphabetically.
> >
> > Fix logic bug where maintainers was incorrectly added to lists.
> >
> > Cc: Rebecca Cran 
> > Cc: Liming Gao 
> > Cc: Bob Feng 
> > Cc: Yuwei Chen 
> > Cc: Leif Lindholm 
> > Signed-off-by: Michael D Kinney 
> > ---
> >  BaseTools/Scripts/GetMaintainer.py | 42 ++-
> ---
> >  1 file changed, 26 insertions(+), 16 deletions(-)
> >
> > diff --git a/BaseTools/Scripts/GetMaintainer.py
> b/BaseTools/Scripts/GetMaintainer.py
> > index d1e042c0afe4..b33546b10f21 100644
> > --- a/BaseTools/Scripts/GetMaintainer.py
> > +++ b/BaseTools/Scripts/GetMaintainer.py
> > @@ -76,6 +76,7 @@ def get_section_maintainers(path, section):
> >  """Returns a list with email addresses to any M: and R: entries
> > matching the provided path in the provided section."""
> >  maintainers = []
> > +reviewers = []
> >  lists = []
> >  nowarn_status = ['Supported', 'Maintained']
> >
> > @@ -83,12 +84,18 @@ def get_section_maintainers(path, section):
> >  for status in section['status']:
> >  if status not in nowarn_status:
> >  print('WARNING: Maintained status for "%s" is
> \'%s\'!' % (path, status))
> > -for address in section['maintainer'], section['reviewer']:
> > +for address in section['maintainer']:
> >  # Convert to list if necessary
> >  if isinstance(address, list):
> >  maintainers += address
> >  else:
> > -lists += [address]
> > +maintainers += [address]
> 
> That's a bugfix. Ought to be separate.
> (Cleverly hidden by concatentaing the results when we didn't care
> about keeping them separate other than for seeing if we'd found any
> humans.)
> 
> > +for address in section['reviewer']:
> > +# Convert to list if necessary
> > +if isinstance(address, list):
> > +reviewers += address
> > +else:
> > +reviewers += [address]
> >  for address in section['list']:
> >  # Convert to list if necessary
> >  if isinstance(address, list):
> > @@ -96,32 +103,34 @@ def get_section_maintainers(path, section):
> >  else:
> >  lists += [address]
> >
> > -return maintainers, lists
> > +return maintainers, reviewers, lists
> >
> >  def get_maintainers(path, sections, level=0):
> >  """For 'path', iterates over all sections, returning
> maintainers
> > for matching ones."""
> >  maintainers = []
> > +reviewers = []
> >  lists = []
> >  for section in sections:
> > -tmp_maint, tmp_lists = get_section_maintainers(path,
> section)
> > -if tmp_maint:
> > -maintainers += tmp_maint
> > -if tmp_lists:
> > -lists += tmp_lists
> > +tmp_maint, tmp_review, tmp_lists =
> get_section_maintainers(path, section)
> > +maintainers += tmp_maint
> > +reviewers += tmp_review
> > +lists += tmp_lists
> 
> Minor niggle at coding style cleanup as part of functional rework.
> 
> >
> >  if not maintainers:
> >  # If no match found, look for match for (nonexistent) file
> >  # REPO.working_dir/
> >  print('"%s": no maintainers found, looking for default' %
> path)
> >  if level == 0:
> > -maintainers = get_maintainers('', sections,
> level=level + 1)
> > +maintainers, tmp_review, tmp_lists =
> get_maintainers('', sections, level=level + 1)
> > +reviewers += tmp_review
> > +lists += tmp_lists
> >  else:
> >  print("No  maintainers set for project.")
> >  if not 

Re: [edk2-devel] [edk2-libc Patch 1/1] ek2-libc: Sample python scripts for socket client capabilities on UEFI shell

2023-11-10 Thread Jayaprakash, N
These are simple Python apps to demonstrate the usage of socket communication 
using the HTTP library. 
Reviewed-by : Jayaprakash N 

Regards,
JP
-Original Message-
From: devel@edk2.groups.io  On Behalf Of Jayaprakash, N
Sent: Friday, October 27, 2023 9:57 PM
To: devel@edk2.groups.io
Cc: Jayaprakash, N ; Rebecca Cran ; 
Kinney, Michael D 
Subject: [edk2-devel] [edk2-libc Patch 1/1] ek2-libc: Sample python scripts for 
socket client capabilities on UEFI shell

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

This BZ has been created to provide the sample python scripts to demonstrate 
the socket client capabilities using http library on UEFI shell with the help 
of Python UEFI interpreter.
The http_echo_client.py and http_echo_server.py scripts are provided as sample 
scripts to exercise the python http library from UEFI shell.

Cc: Rebecca Cran 
Cc: Michael D Kinney 
Cc: Jayaprakash N 
Signed-off-by: Jayaprakash Nevara 
---
 .../PyMod-3.6.8/Lib/http_echo_client.py   | 81 +++
 .../PyMod-3.6.8/Lib/http_echo_server.py   | 61 ++
 2 files changed, 142 insertions(+)
 create mode 100644 
AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Lib/http_echo_client.py
 create mode 100644 
AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Lib/http_echo_server.py

diff --git 
a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Lib/http_echo_client.py 
b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Lib/http_echo_client.py
new file mode 100644
index 000..ea0368d
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Lib/http_echo_
+++ client.py
@@ -0,0 +1,81 @@
+"""
+This is a sample HTTP echo client sends data to the server and gets 
+echoed data from the server in response body and prints the same to the 
+console.
+
+Note: This application needs to be run from UEFI shell using the Python 
+UEFI interpreter.
+"""
+
+import sys
+import time
+from http import client
+from http.client import HTTPException
+import traceback
+
+_max_retries = 10
+_retry_count = 0
+
+
+def _print_usage():
+print("Sample http echo client application")
+print("Usage:")
+print("python.efi http_echo_client.py ")
+
+
+if len(sys.argv) != 2:
+_print_usage()
+sys.exit(0)
+
+if sys.argv[1] == "-h":
+_print_usage()
+sys.exit(0)
+
+http_server = sys.argv[1]
+while True:
+try:
+name = input("Enter the parameter name:")
+value = input("Enter parameter value:")
+print("Connecting to server to send a get request with following 
parameter")
+print("{}={}".format(name, value))
+# replace space with %20
+value = value.replace(" ", "%20")
+conn = client.HTTPConnection(http_server)
+# Send GET request with some data
+conn.request("GET", "/echo?{}={}".format(name, value))
+rsp = conn.getresponse()
+if rsp.status == 204:
+print("No content")
+break
+elif rsp.status == 200:
+data_received = rsp.read()
+# replace %20 with space character before displaying to console
+data_received = data_received.replace(b"%20", b" ")
+print("from server:{}".format(data_received))
+conn.close()
+print("Closing the connection")
+break
+else:
+print("Invalid response code {}".format(rsp.status))
+conn.close()
+print("Closing the connection")
+break
+except HTTPException as exp:
+print("Got exception while connecting to server : {}".format(exp))
+traceback.print_exc()
+break
+except ConnectionRefusedError as exp:
+print("Got exception while connecting to server : {}".format(exp))
+print("Check & start the server, if it is not started")
+print(
+"Retrying connection after 10 seconds, retry count = {}".format(
+_retry_count + 1
+)
+)
+if _retry_count == _max_retries:
+print(
+"Exceeded max retries {} exiting the 
application".format(_max_retries)
+)
+break
+time.sleep(10)
+_retry_count += 1
diff --git 
a/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Lib/http_echo_server.py 
b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Lib/http_echo_server.py
new file mode 100644
index 000..eebdf33
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-3.6.8/PyMod-3.6.8/Lib/http_echo_
+++ server.py
@@ -0,0 +1,61 @@
+"""
+This is a sample HTTP echo server that echos the command / data coming 
+from the client.
+Here the data is received from client through GET request in the form 
+of parameter of GET request.
+The parameter is extracted and sent back to the client in the response 
+body.
+
+Note that this server sample application needs to be run on a system 
+booted to OS.
+"""
+
+import os
+import socket
+import sys
+from http.server 

Re: [edk2-devel] [PATCH v2 01/11] ArmPkg/ArmScmiDxe: Rename PERFORMANCE_PROTOCOL_VERSION

2023-11-10 Thread Leif Lindholm

On 2023-11-10 09:11, Pierre Gondois wrote:

Hello Leif,

On 11/2/23 11:20, Pierre Gondois wrote:

Hello Leif,
Thanks for the review,

On 10/26/23 12:05, Leif Lindholm wrote:

On Wed, Oct 25, 2023 at 13:25:30 +0200, pierre.gond...@arm.com wrote:

From: Pierre Gondois 

Rename PERFORMANCE_PROTOCOL_VERSION to reflect the different
versions of the protocol. The macro is neither used in edk2 nor
in edk2-platforms.


OK, so slight nitpick, but mainly because it parses a bit weirdly...
*Will* it be used after this series is merged, or is this an update
for completeness?


The 'fast channels' were added in the v2.0 SCMI specification. This 
patch-set

relies on this feature, so it is checked in:
 [PATCH v2 10/11] DynamicTablesPkg: Add ArmScmiInfoLib
that the underlying SCP is at least at this version.

```
 // FastChannels were added in SCMI v2.0 spec.
 if (Version < PERFORMANCE_PROTOCOL_VERSION_V2) {
   DEBUG ((DEBUG_ERROR, "ArmScmiInfoLib requires SCMI version > 
2.0\n"));

   return EFI_UNSUPPORTED;
 }
```




Signed-off-by: Pierre Gondois 
---
   ArmPkg/Include/Library/ArmLib.h |  1 +
   .../Include/Protocol/ArmScmiPerformanceProtocol.h   | 13 
-

   2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/ArmPkg/Include/Library/ArmLib.h 
b/ArmPkg/Include/Library/ArmLib.h

index 0169dbc1092c..7b2b2238fed9 100644
--- a/ArmPkg/Include/Library/ArmLib.h
+++ b/ArmPkg/Include/Library/ArmLib.h
@@ -780,6 +780,7 @@ EFIAPI
   ArmHasVhe (
 VOID
 );
+
   #endif // MDE_CPU_AARCH64
   #ifdef MDE_CPU_ARM
diff --git a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h 
b/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h

index 7e548e4765c2..8e8e05d5a5f6 100644
--- a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h
+++ b/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h
@@ -1,12 +1,12 @@
   /** @file
-  Copyright (c) 2017-2021, Arm Limited. All rights reserved.
+  Copyright (c) 2017-2023, Arm Limited. All rights reserved.
 SPDX-License-Identifier: BSD-2-Clause-Patent
-  System Control and Management Interface V1.0
-    http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/
-    DEN0056A_System_Control_and_Management_Interface.pdf
+  System Control and Management Interface, latest version:


I see this as a pattern throughout the series.
But this statement will at some point become untrue; this
implementation is written against a specific version. I think this
version shold be reflected in the comment. (And that applies
throughout the series.)


+  - https://developer.arm.com/documentation/den0056/latest/


But I think the above is the most useful link.


I was referring to this point I'm not sure I understood.


Oh, right.

I was referring to "latest version" being a moving target.
If I go to https://developer.arm.com/documentation/den0056/latest/, that 
currently means "version 3.2". At some point in the future, that number 
will change, but this code won't automatically get updated.


So I'd prefer something like
"System Control and Management Interface v3.2,
Latest version of the specification can be downloaded from
https://developer.arm.com/documentation/den0056/latest/;

If that makes more sense?

Regards,

Leif


Regards,
Pierre



I am not sure I understand completely. Do you mean that the SCMI
structures/interfaces defined in:
 ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h
and that were written against the SCMI v1.0 specification should
not be used as such for other SCMI specification version ?
I.e. the same process as for the AcpiXX.h files
(MdePkg/Include/IndustryStandard/Acpi65.h) should be used ?

Or do you mean that the _CPC object generation implies that the
SCP should comply to the v2.0 version at least and this should be
reflected in the commit messages ?

Regards,
Pierre



/
  Leif


+
   **/
   #ifndef ARM_SCMI_PERFORMANCE_PROTOCOL_H_
@@ -14,7 +14,10 @@
   #include 
-#define PERFORMANCE_PROTOCOL_VERSION  0x1
+/// Arm Scmi performance protocol versions.
+#define PERFORMANCE_PROTOCOL_VERSION_V1  0x1
+#define PERFORMANCE_PROTOCOL_VERSION_V2  0x2
+#define PERFORMANCE_PROTOCOL_VERSION_V3  0x3
   #define ARM_SCMI_PERFORMANCE_PROTOCOL_GUID  { \
 0x9b8ba84, 0x3dd3, 0x49a6, {0xa0, 0x5a, 0x31, 0x34, 0xa5, 0xf0, 
0x7b, 0xad} \

--
2.25.1





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




Re: [edk2-devel] [PATCH v3] RedfishPkg: RedfishDiscoverDxe: Fix issue if IPv4 installed after RestEx

2023-11-10 Thread Leif Lindholm
On Fri, Nov 10, 2023 at 00:39:53 +, Chang, Abner wrote:
> [AMD Official Use Only - General]
> 
> Thanks Leif, some responses are given in line.
> As we would like to have this be part of edk2-stable202312,  we
> prefer letting this change gets in stable release first and address
> the comment in another patch afterward.
>
> Hi Igor,
> Could you please check my comment and help to send another patch after 
> edk2-stable202312?
> 
> Thanks
> Abner
> 
> 
> > -Original Message-
> > From: Leif Lindholm 
> > Sent: Thursday, November 9, 2023 11:12 PM
> > To: devel@edk2.groups.io; ig...@ami.com
> > Cc: Chang, Abner ; Nickle Wang
> > ; gaolim...@byosoft.com.cn
> > Subject: Re: [edk2-devel] [PATCH v3] RedfishPkg: RedfishDiscoverDxe: Fix
> > issue if IPv4 installed after RestEx
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > On 2023-11-07 12:06, Igor Kulchytskyy via groups.io wrote:
> > > Supported function of the driver changed to wait for all newtwork
> >
> > Typo:
> > newtwork ->
> > network
> >
> > > interface to be installed.
> > > Filer out the network interfaces which are not supported by
> >
> > Filer ->
> > Filter
> >
> > > Redfish Host Interface.
> >
> > These sound like two separate changes?
> This is for the same issue.

That means it should be in the same set, not in the same patch.

> > > Cc: Abner Chang 
> > > Cc: Nickle Wang 
> > > Signed-off-by: Igor Kulchytskyy 
> > > ---
> > >   RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 165
> > ++--
> > >   1 file changed, 117 insertions(+), 48 deletions(-)
> > >
> > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > index 23da3b968f..85e47843e4 100644
> > > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > > @@ -322,9 +322,16 @@ GetTargetNetworkInterfaceInternal (
> > >   {
> > > EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL
> > *ThisNetworkInterface;
> > >
> > > +  if (IsListEmpty ()) {
> > > +return NULL;
> > > +  }
> > > +
> > > ThisNetworkInterface =
> > (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode
> > ();
> > > while (TRUE) {
> > > -if (CompareMem ((VOID *)>MacAddress,
> > >MacAddress, ThisNetworkInterface-
> > >HwAddressSize) == 0) {
> > > +if ((CompareMem ((VOID *)>MacAddress,
> > >MacAddress, ThisNetworkInterface-
> > >HwAddressSize) == 0) &&
> > > +((TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> > >NetworkProtocolType == ProtocolTypeTcp6)) ||
> > > + (!TargetNetworkInterface->IsIpv6 && (ThisNetworkInterface-
> > >NetworkProtocolType == ProtocolTypeTcp4
> > > +{
> >
> > This could really benefit from some helper macros.
> > e.g. if the test could look like
> 
> Hi Igor,
> Could we consider this suggestion after stable release?
> 
> >
> > if ((MAC_COMPARE (ThisNetworkInterface, TargetNetworkInterface) == 0) &&
> >  (VALID_TCP6 (TargetNetworkInterface, ThisNetworkInterface) ||
> >   VALID_TCP4 (TargetNetworkInterface, ThisNetworkInterface))) {
> >
> > > return ThisNetworkInterface;
> > >   }
> > >
> > > @@ -354,6 +361,10 @@ GetTargetNetworkInterfaceInternalByController (
> > >   {
> > > EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL
> > *ThisNetworkInterface;
> > >
> > > +  if (IsListEmpty ()) {
> > > +return NULL;
> > > +  }
> > > +
> > > ThisNetworkInterface =
> > (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode
> > ();
> > > while (TRUE) {
> > >   if (ThisNetworkInterface->OpenDriverControllerHandle ==
> > ControllerHandle) {
> > > @@ -476,6 +487,42 @@ CheckIsIpVersion6 (
> > > return FALSE;
> > >   }
> > >
> > > +/**
> > > +  This function returns the  IP type supported by the Host Interface.
> > > +
> > > +  @retval 00h is Unknown
> > > +  01h is Ipv4
> > > +  02h is Ipv6
> > > +
> > > +**/
> > > +UINT8
> >
> > If this is just a local helper function, we probably want it STATIC.
> However, it is recommended that not using STATIC for local function
> for the source level debug purpose in 5.4.2.2.2 in edk2 C coding
> standard spec.

Yeah, we need to fix that doc. I have no idea what decade that comment
applied to, but I bet the year number started with a 1.

> > > +GetHiIpProtocolType (
> > > +  VOID
> > > +  )
> > > +{
> > > +  EFI_STATUS Status;
> > > +  REDFISH_OVER_IP_PROTOCOL_DATA  *Data;
> > > +  REDFISH_INTERFACE_DATA *DeviceDescriptor;
> > > +
> > > +  Data = NULL;
> > > +  DeviceDescriptor = NULL;
> > > +  if (mSmbios == NULL) {
> > > +Status = gBS->LocateProtocol (, NULL, (VOID
> > **));
> > > +if (EFI_ERROR (Status)) {
> > > +  return
> > REDFISH_HOST_INTERFACE_HOST_IP_ADDRESS_FORMAT_UNKNOWN;
> > > +}
> > > +  }
> > > +
> > > +  Status = 

Re: [edk2-devel] [edk2-stable202311][Patch 1/1] BaseTools/Scripts: Handle reviewer only case in GetMaintainer.py

2023-11-10 Thread Leif Lindholm
On Wed, Nov 08, 2023 at 12:43:23 -0800, Michael D Kinney wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4593
> 
> If a package only has reviewers and no maintainers, then also
> return the  maintainers.
> 
> Update get_maintainers() to return maintainers, reviews, and
> lists separately instead of a single merged list to allow this
> module to be used by other scripts and distinguish types.
> 
> Sort the list of output addresses alphabetically.
> 
> Fix logic bug where maintainers was incorrectly added to lists.
> 
> Cc: Rebecca Cran 
> Cc: Liming Gao 
> Cc: Bob Feng 
> Cc: Yuwei Chen 
> Cc: Leif Lindholm 
> Signed-off-by: Michael D Kinney 
> ---
>  BaseTools/Scripts/GetMaintainer.py | 42 ++
>  1 file changed, 26 insertions(+), 16 deletions(-)
> 
> diff --git a/BaseTools/Scripts/GetMaintainer.py 
> b/BaseTools/Scripts/GetMaintainer.py
> index d1e042c0afe4..b33546b10f21 100644
> --- a/BaseTools/Scripts/GetMaintainer.py
> +++ b/BaseTools/Scripts/GetMaintainer.py
> @@ -76,6 +76,7 @@ def get_section_maintainers(path, section):
>  """Returns a list with email addresses to any M: and R: entries
> matching the provided path in the provided section."""
>  maintainers = []
> +reviewers = []
>  lists = []
>  nowarn_status = ['Supported', 'Maintained']
>  
> @@ -83,12 +84,18 @@ def get_section_maintainers(path, section):
>  for status in section['status']:
>  if status not in nowarn_status:
>  print('WARNING: Maintained status for "%s" is \'%s\'!' % 
> (path, status))
> -for address in section['maintainer'], section['reviewer']:
> +for address in section['maintainer']:
>  # Convert to list if necessary
>  if isinstance(address, list):
>  maintainers += address
>  else:
> -lists += [address]
> +maintainers += [address]

That's a bugfix. Ought to be separate.
(Cleverly hidden by concatentaing the results when we didn't care
about keeping them separate other than for seeing if we'd found any
humans.)

> +for address in section['reviewer']:
> +# Convert to list if necessary
> +if isinstance(address, list):
> +reviewers += address
> +else:
> +reviewers += [address]
>  for address in section['list']:
>  # Convert to list if necessary
>  if isinstance(address, list):
> @@ -96,32 +103,34 @@ def get_section_maintainers(path, section):
>  else:
>  lists += [address]
>  
> -return maintainers, lists
> +return maintainers, reviewers, lists
>  
>  def get_maintainers(path, sections, level=0):
>  """For 'path', iterates over all sections, returning maintainers
> for matching ones."""
>  maintainers = []
> +reviewers = []
>  lists = []
>  for section in sections:
> -tmp_maint, tmp_lists = get_section_maintainers(path, section)
> -if tmp_maint:
> -maintainers += tmp_maint
> -if tmp_lists:
> -lists += tmp_lists
> +tmp_maint, tmp_review, tmp_lists = get_section_maintainers(path, 
> section)
> +maintainers += tmp_maint
> +reviewers += tmp_review
> +lists += tmp_lists

Minor niggle at coding style cleanup as part of functional rework.

>  
>  if not maintainers:
>  # If no match found, look for match for (nonexistent) file
>  # REPO.working_dir/
>  print('"%s": no maintainers found, looking for default' % path)
>  if level == 0:
> -maintainers = get_maintainers('', sections, level=level 
> + 1)
> +maintainers, tmp_review, tmp_lists = 
> get_maintainers('', sections, level=level + 1)
> +reviewers += tmp_review
> +lists += tmp_lists
>  else:
>  print("No  maintainers set for project.")
>  if not maintainers:
>  return None
>  
> -return maintainers + lists

Apart from the niggles mentioned above, I agree that this is a
reasonable way of adding the required functionality without completely
rewriting the existing code. (It does make me feel there must be a
better way of writing it than I did, though.)

> +return maintainers, reviewers, lists
>  
>  def parse_maintainers_line(line):
>  """Parse one line of Maintainers.txt, returning any match group and its 
> key."""
> @@ -182,15 +191,16 @@ if __name__ == '__main__':
>  else:
>  FILES = get_modified_files(REPO, ARGS)
>  
> -ADDRESSES = []
> -
> +# Accumulate a sorted list of addresses
> +ADDRESSES = set([])
>  for file in FILES:
>  print(file)
> -addresslist = get_maintainers(file, SECTIONS)
> -if addresslist:
> -ADDRESSES += addresslist
> +maintainers, reviewers, lists = get_maintainers(file, SECTIONS)
> +ADDRESSES |= 

[edk2-devel] [Patch V2] UefiCpuPkg/MpInitLib: Enable execute disable bit.

2023-11-10 Thread Yuanhao Xie
From: Yuanhao Xie 

This patch synchronizes the No-Execute bit in the IA32_EFER
register for the APs before the RestoreVolatileRegisters operation.

The commit 964a4f0, titled "Eliminate the second INIT-SIPI-SIPI
sequence," replaces the second INIT-SIPI-SIPI sequence with the BSP
calling the SwitchApContext function to initiate a specialized start-up
signal, waking up APs in the DXE instead of using INIT-SIPI-SIPI.

Due to this change, the logic for "Enable execute disable bit" in
MpFuncs.nasm is no longer executed. However, to ensure the proper setup
of the page table, it is necessary to synchronize the IA32_EFER.NXE for
APs before executing RestoreVolatileRegisters .

Based on SDM:
If IA32_EFER.NXE is set to 1, it signifies execute-disable, meaning
instruction fetches are not allowed from the 4-KByte page controlled by
this entry. Conversely, if it is set to 0, it is reserved.

Signed-off-by: Yuanhao Xie 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Cc: Gerd Hoffmann 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 17 +
 UefiCpuPkg/Library/MpInitLib/MpLib.h |  1 +
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 9a6ec5db5c..c7527f8662 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -910,11 +910,19 @@ DxeApEntryPoint (
   CPU_MP_DATA  *CpuMpData
   )
 {
-  UINTN  ProcessorNumber;
+  UINTN   ProcessorNumber;
+  MSR_IA32_EFER_REGISTER  EferMsr;
 
   GetProcessorNumber (CpuMpData, );
-  RestoreVolatileRegisters (>CpuData[0].VolatileRegisters, FALSE);
   InterlockedIncrement ((UINT32 *)>FinishedCount);
+
+  if (CpuMpData->EnableExecuteDisableForSwitchContext) {
+EferMsr.Uint64   = AsmReadMsr64 (MSR_IA32_EFER);
+EferMsr.Bits.NXE = 1;
+AsmWriteMsr64 (MSR_IA32_EFER, EferMsr.Uint64);
+  }
+
+  RestoreVolatileRegisters (>CpuData[0].VolatileRegisters, FALSE);
   PlaceAPInMwaitLoopOrRunLoop (
 CpuMpData->ApLoopMode,
 CpuMpData->CpuData[ProcessorNumber].StartupApSignal,
@@ -2188,8 +2196,9 @@ MpInitLibInitialize (
 if (MpHandOff->WaitLoopExecutionMode == sizeof (VOID *)) {
   ASSERT (CpuMpData->ApLoopMode != ApInHltLoop);
 
-  CpuMpData->FinishedCount = 0;
-  CpuMpData->InitFlag  = ApInitDone;
+  CpuMpData->FinishedCount= 0;
+  CpuMpData->InitFlag = ApInitDone;
+  CpuMpData->EnableExecuteDisableForSwitchContext = 
IsBspExecuteDisableEnabled ();
   SaveCpuMpData (CpuMpData);
   //
   // In scenarios where both the PEI and DXE phases run in the same
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h 
b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index 763db4963d..af296f6ac0 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -270,6 +270,7 @@ struct _CPU_MP_DATA {
   UINT64   TotalTime;
   EFI_EVENTWaitEvent;
   UINTN**FailedCpuList;
+  BOOLEAN  EnableExecuteDisableForSwitchContext;
 
   AP_INIT_STATEInitFlag;
   BOOLEAN  SwitchBspFlag;
-- 
2.39.1.windows.1



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




[edk2-devel] [PATCH v3 6/6] CryptoPkg: Enable Openssl Accel builds for AARCH64

2023-11-10 Thread PierreGondois
Enable the following modules builds for AARCH64:
- OpensslLibAccel.inf
- OpensslLibFullAccel.inf

Signed-off-by: Pierre Gondois 
---
 CryptoPkg/CryptoPkg.dsc | 23 ---
 CryptoPkg/Readme.md | 14 +++---
 2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/CryptoPkg/CryptoPkg.dsc b/CryptoPkg/CryptoPkg.dsc
index 6a0104a3bb68..f08808d5d18e 100644
--- a/CryptoPkg/CryptoPkg.dsc
+++ b/CryptoPkg/CryptoPkg.dsc
@@ -5,6 +5,7 @@
 #  Copyright (c) 2009 - 2022, Intel Corporation. All rights reserved.
 #  Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights 
reserved.
 #  Copyright (c) 2022, Loongson Technology Corporation Limited. All rights 
reserved.
+#  Copyright (c) 2023, Arm Limited. All rights reserved.
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -327,7 +328,7 @@ [Components.IA32, Components.X64, Components.ARM, 
Components.AARCH64]
   MSFT:NOOPT_*_*_DLINK_FLAGS = 
/EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x1
   }
 
-[Components.IA32, Components.X64]
+[Components.IA32, Components.X64, Components.AARCH64]
   CryptoPkg/Test/UnitTest/Library/BaseCryptLib/TestBaseCryptLibShell.inf {
 
   FILE_GUID = B91B9A95-4D52-4501-A98F-A1711C14ED93
@@ -396,9 +397,9 @@ [Components]
   TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
   }
 
-[Components.IA32, Components.X64]
+[Components.IA32, Components.X64, Components.AARCH64]
   #
-  # Build verification of IA32/X64 specific libraries
+  # Build verification of IA32/X64/AARCH64 specific libraries
   #
   CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
   CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
@@ -439,9 +440,9 @@ [Components.IA32, Components.X64, Components.ARM, 
Components.AARCH64]
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
   }
 
-[Components.IA32, Components.X64]
+[Components.IA32, Components.X64, Components.AARCH64]
   #
-  # CryptoPei with IA32/X64 performance optimized OpensslLib instance without 
EC services
+  # CryptoPei with IA32/X64/AARCH64 performance optimized OpensslLib instance 
without EC services
   # IA32/X64 assembly optimizations required larger alignments
   #
   CryptoPkg/Driver/CryptoPei.inf {
@@ -455,7 +456,7 @@ [Components.IA32, Components.X64]
   }
 
   #
-  # CryptoPei with IA32/X64 performance optimized OpensslLib instance all 
services
+  # CryptoPei with IA32/X64/AARCH64 performance optimized OpensslLib instance 
all services
   # IA32/X64 assembly optimizations required larger alignments
   #
   CryptoPkg/Driver/CryptoPei.inf {
@@ -505,9 +506,9 @@ [Components.IA32, Components.X64, Components.ARM, 
Components.AARCH64]
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
   }
 
-[Components.IA32, Components.X64]
+[Components.IA32, Components.X64, Components.AARCH64]
   #
-  # CryptoDxe with IA32/X64 performance optimized OpensslLib instance with no 
EC services
+  # CryptoDxe with IA32/X64/AARCH64 performance optimized OpensslLib instance 
with no EC services
   # with TLS feature enabled.
   # IA32/X64 assembly optimizations required larger alignments
   #
@@ -521,7 +522,7 @@ [Components.IA32, Components.X64]
   MSFT:*_*_X64_DLINK_FLAGS  = /ALIGN:256
   }
   #
-  # CryptoDxe with IA32/X64 performance optimized OpensslLib instance with all 
services.
+  # CryptoDxe with IA32/X64/AARCH64 performance optimized OpensslLib instance 
with all services.
   # IA32/X64 assembly optimizations required larger alignments
   #
   CryptoPkg/Driver/CryptoDxe.inf {
@@ -561,7 +562,7 @@ [Components.IA32, Components.X64]
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLibFull.inf
   }
   #
-  # CryptoSmm with IA32/X64 performance optimized OpensslLib instance with no 
EC services
+  # CryptoSmm with IA32/X64/AARCH64 performance optimized OpensslLib instance 
with no EC services
   # IA32/X64 assembly optimizations required larger alignments
   #
   CryptoPkg/Driver/CryptoSmm.inf {
@@ -574,7 +575,7 @@ [Components.IA32, Components.X64]
   MSFT:*_*_X64_DLINK_FLAGS  = /ALIGN:256
   }
   #
-  # CryptoSmm with IA32/X64 performance optimized OpensslLib instance with all 
services
+  # CryptoSmm with IA32/X64/AARCH64 performance optimized OpensslLib instance 
with all services
   # IA32/X64 assembly optimizations required larger alignments
   #
   CryptoPkg/Driver/CryptoSmm.inf {
diff --git a/CryptoPkg/Readme.md b/CryptoPkg/Readme.md
index 5a68dfb6abd4..cb2228b6b898 100644
--- a/CryptoPkg/Readme.md
+++ b/CryptoPkg/Readme.md
@@ -246,13 +246,13 @@ specific set of enabled cryptographic services. If ECC 
services are not
 required, then the size can be reduced by using OpensslLib.inf instead of
 `OpensslLibFull.inf`. Performance optimization requires a size increase.
 
-| OpensslLib Instance | SSL | ECC | Perf Opt | CPU Arch | Size  |
-|:|:---:|:---:|::|::|:-:|
-| OpensslLibCrypto.inf|  N  |  N  |N |   All|   +0K |
-| OpensslLib.inf  |  Y  |  N 

[edk2-devel] [PATCH v3 5/6] CryptoPkg/OpensslLib: Add AArch64Cap for arch specific hooks

2023-11-10 Thread PierreGondois
Add AARCH64 specific implementations of:
- OPENSSL_cpuid_setup(), probing hardware capabilitie
  (presence of FEAT_AES, etc.)
- OPENSSL_rdtsc(), returning non-trusted entropy by accessing
  system counter.

Signed-off-by: Pierre Gondois 
---
 .../Library/OpensslLib/OpensslLibAccel.inf|   7 ++
 .../OpensslLib/OpensslLibFullAccel.inf|   7 ++
 .../OpensslLib/OpensslStub/AArch64Cap.c   | 107 ++
 3 files changed, 121 insertions(+)
 create mode 100644 CryptoPkg/Library/OpensslLib/OpensslStub/AArch64Cap.c

diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
index 3d1a9638b1c1..08e8be6ea9e1 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
@@ -1329,6 +1329,7 @@ [Sources.X64]
 # Autogenerated files list ends here
 
 [Sources.AARCH64]
+  OpensslStub/AArch64Cap.c
 # Autogenerated files list starts here
   $(OPENSSL_PATH)/crypto/aes/aes_cbc.c
   $(OPENSSL_PATH)/crypto/aes/aes_cfb.c
@@ -1955,11 +1956,17 @@ [Packages]
   MdePkg/MdePkg.dec
   CryptoPkg/CryptoPkg.dec
 
+[Packages.AARCH64]
+  ArmPkg/ArmPkg.dec
+
 [LibraryClasses]
   BaseLib
   DebugLib
   RngLib
 
+[LibraryClasses.AARCH64]
+  ArmLib
+
 [BuildOptions]
   #
   # Disables the following Visual Studio compiler warnings brought by openssl 
source,
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
index e7e83d419f4b..2a01ffe06bd7 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
@@ -1432,6 +1432,7 @@ [Sources.X64]
 # Autogenerated files list ends here
 
 [Sources.AARCH64]
+  OpensslStub/AArch64Cap.c
 # Autogenerated files list starts here
   $(OPENSSL_PATH)/crypto/aes/aes_cbc.c
   $(OPENSSL_PATH)/crypto/aes/aes_cfb.c
@@ -2107,11 +2108,17 @@ [Packages]
   MdePkg/MdePkg.dec
   CryptoPkg/CryptoPkg.dec
 
+[Packages.AARCH64]
+  ArmPkg/ArmPkg.dec
+
 [LibraryClasses]
   BaseLib
   DebugLib
   RngLib
 
+[LibraryClasses.AARCH64]
+  ArmLib
+
 [BuildOptions]
   #
   # Disables the following Visual Studio compiler warnings brought by openssl 
source,
diff --git a/CryptoPkg/Library/OpensslLib/OpensslStub/AArch64Cap.c 
b/CryptoPkg/Library/OpensslLib/OpensslStub/AArch64Cap.c
new file mode 100644
index ..4c57334316ca
--- /dev/null
+++ b/CryptoPkg/Library/OpensslLib/OpensslStub/AArch64Cap.c
@@ -0,0 +1,107 @@
+/** @file
+  Arm capabilities probing.
+
+  Copyright (c) 2023, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include 
+#include "crypto/arm_arch.h"
+
+#include 
+
+/** Get bits from a value.
+
+  Shift the input value from 'shift' bits and apply 'mask'.
+
+  @param   valueThe value to get the bits from.
+  @param   shiftIndex of the bits to read.
+  @param   mask Mask to apply to the value once shifted.
+
+  @return  The desired bitfield from the value.
+**/
+#define GET_BITFIELD(value, shift, mask)\
+  ((value >> shift) & mask)
+
+UINT32  OPENSSL_armcap_P = 0;
+
+void
+OPENSSL_cpuid_setup (
+  void
+  )
+{
+  UINT64  Isar0;
+
+  OPENSSL_armcap_P = 0;
+  Isar0= ArmReadIdAA64Isar0 ();
+
+  /* Access to EL0 registers is possible from higher ELx. */
+  OPENSSL_armcap_P |= ARMV8_CPUID;
+  /* Access to Physical timer is possible. */
+  OPENSSL_armcap_P |= ARMV7_TICK;
+
+  /* Neon support is not guaranteed, but it is assumed to be present.
+ Arm ARM for Armv8, sA1.5 Advanced SIMD and floating-point support
+  */
+  OPENSSL_armcap_P |= ARMV7_NEON;
+
+  if (GET_BITFIELD (
+Isar0,
+ARM_ID_AA64ISAR0_EL1_AES_SHIFT,
+ARM_ID_AA64ISAR0_EL1_AES_MASK
+) != 0)
+  {
+OPENSSL_armcap_P |= ARMV8_AES;
+  }
+
+  if (GET_BITFIELD (
+Isar0,
+ARM_ID_AA64ISAR0_EL1_SHA1_SHIFT,
+ARM_ID_AA64ISAR0_EL1_SHA1_MASK
+) != 0)
+  {
+OPENSSL_armcap_P |= ARMV8_SHA1;
+  }
+
+  if (GET_BITFIELD (
+Isar0,
+ARM_ID_AA64ISAR0_EL1_SHA2_SHIFT,
+ARM_ID_AA64ISAR0_EL1_SHA2_MASK
+) != 0)
+  {
+OPENSSL_armcap_P |= ARMV8_SHA256;
+  }
+
+  if (GET_BITFIELD (
+Isar0,
+ARM_ID_AA64ISAR0_EL1_AES_SHIFT,
+ARM_ID_AA64ISAR0_EL1_AES_MASK
+) >= ARM_ID_AA64ISAR0_EL1_AES_FEAT_PMULL_MASK)
+  {
+OPENSSL_armcap_P |= ARMV8_PMULL;
+  }
+
+  if (GET_BITFIELD (
+Isar0,
+ARM_ID_AA64ISAR0_EL1_SHA2_SHIFT,
+ARM_ID_AA64ISAR0_EL1_SHA2_MASK
+) >= ARM_ID_AA64ISAR0_EL1_SHA2_FEAT_SHA512_MASK)
+  {
+OPENSSL_armcap_P |= ARMV8_SHA512;
+  }
+}
+
+/** Read system counter value.
+
+  Used to get some non-trusted entropy.
+
+  @return Lower bits of the physical counter.
+**/
+uint32_t
+OPENSSL_rdtsc (
+  void
+  )
+{
+  return (UINT32)ArmReadCntPct ();
+}
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111033): 

[edk2-devel] [PATCH v3 3/6] CryptoPkg/OpensslLib: Add native instruction support for AARCH64

2023-11-10 Thread PierreGondois
Add native instruction support for AARCH64.

Signed-off-by: Pierre Gondois 
---
 .../Library/OpensslLib/OpensslLibAccel.inf| 21 ++-
 .../OpensslLib/OpensslLibFullAccel.inf| 21 ++-
 CryptoPkg/Library/OpensslLib/UefiAsm.conf |  6 ++
 CryptoPkg/Library/OpensslLib/configure.py |  6 +-
 4 files changed, 51 insertions(+), 3 deletions(-)

diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
index a37347fbbfd6..a47e9087133b 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibAccel.inf
@@ -5,6 +5,7 @@
 #
 #  Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
 #  (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+#  Copyright (c) 2023, Arm Limited. All rights reserved.
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -24,9 +25,10 @@ [Defines]
   DEFINE OPENSSL_FLAGS   = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT 
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DEDK2_OPENSSL_NOEC=1
   DEFINE OPENSSL_FLAGS_IA32  = -DAES_ASM -DGHASH_ASM -DMD5_ASM 
-DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM
   DEFINE OPENSSL_FLAGS_X64   = -DAES_ASM -DBSAES_ASM -DGHASH_ASM 
-DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM 
-DSHA512_ASM -DVPAES_ASM
+  DEFINE OPENSSL_FLAGS_AARCH64   =
 
 #
-#  VALID_ARCHITECTURES   = IA32 X64
+#  VALID_ARCHITECTURES   = IA32 X64 AARCH64
 #
 
 [Sources]
@@ -1326,6 +1328,10 @@ [Sources.X64]
   $(OPENSSL_GEN_PATH)/X64-GCC/crypto/sha/sha512-x86_64.s | GCC
 # Autogenerated files list ends here
 
+[Sources.AARCH64]
+# Autogenerated files list starts here
+# Autogenerated files list ends here
+
 [Packages]
   MdePkg/MdePkg.dec
   CryptoPkg/CryptoPkg.dec
@@ -1403,3 +1409,16 @@ [BuildOptions]
   #   commit d9b8b89bec4480de3a10bdaf9425db371c19145b, and can be dropped 
then.)
   XCODE:*_*_IA32_CC_FLAGS   = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_IA32) -w -std=c99 -Wno-error=uninitialized
   XCODE:*_*_X64_CC_FLAGS= -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_X64) -w -std=c99 -Wno-error=uninitialized
+
+  GCC:*_*_AARCH64_CC_FLAGS= $(OPENSSL_FLAGS) $(OPENSSL_FLAGS_AARCH64) 
-Wno-error=format -Wno-format -D_BITS_STDINT_UINTN_H -D_BITS_STDINT_INTN_H
+
+  #
+  # AARCH64 uses strict alignment and avoids SIMD registers for code that may 
execute
+  # with the MMU off. This involves SEC, PEI_CORE and PEIM modules as well as 
BASE
+  # libraries, given that they may be included into such modules.
+  # This library, even though of the BASE type, is never used in such cases, 
and
+  # avoiding the SIMD register file (which is shared with the FPU) prevents the
+  # compiler from successfully building some of the OpenSSL source files that
+  # use floating point types, so clear the flags here.
+  #
+  GCC:*_*_AARCH64_CC_XIPFLAGS ==
diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf 
b/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
index 780d5febd72e..45a58c7d382e 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibFullAccel.inf
@@ -10,6 +10,7 @@
 #
 #  Copyright (c) 2010 - 2020, Intel Corporation. All rights reserved.
 #  (C) Copyright 2020 Hewlett Packard Enterprise Development LP
+#  Copyright (c) 2023, Arm Limited. All rights reserved.
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 ##
@@ -29,9 +30,10 @@ [Defines]
   DEFINE OPENSSL_FLAGS   = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT 
-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
   DEFINE OPENSSL_FLAGS_IA32  = -DAES_ASM -DGHASH_ASM -DMD5_ASM 
-DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM
   DEFINE OPENSSL_FLAGS_X64   = -DAES_ASM -DBSAES_ASM -DGHASH_ASM 
-DKECCAK1600_ASM -DMD5_ASM -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM 
-DSHA512_ASM -DVPAES_ASM
+  DEFINE OPENSSL_FLAGS_AARCH64   =
 
 #
-#  VALID_ARCHITECTURES   = IA32 X64
+#  VALID_ARCHITECTURES   = IA32 X64 AARCH64
 #
 
 [Sources]
@@ -1429,6 +1431,10 @@ [Sources.X64]
   $(OPENSSL_GEN_PATH)/X64-GCC/crypto/sha/sha512-x86_64.s | GCC
 # Autogenerated files list ends here
 
+[Sources.AARCH64]
+# Autogenerated files list starts here
+# Autogenerated files list ends here
+
 [Packages]
   MdePkg/MdePkg.dec
   CryptoPkg/CryptoPkg.dec
@@ -1506,3 +1512,16 @@ [BuildOptions]
   #   commit d9b8b89bec4480de3a10bdaf9425db371c19145b, and can be dropped 
then.)
   XCODE:*_*_IA32_CC_FLAGS   = -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_IA32) -w -std=c99 -Wno-error=uninitialized
   XCODE:*_*_X64_CC_FLAGS= -mmmx -msse -U_WIN32 -U_WIN64 $(OPENSSL_FLAGS) 
$(OPENSSL_FLAGS_X64) -w -std=c99 -Wno-error=uninitialized
+
+  GCC:*_*_AARCH64_CC_FLAGS= $(OPENSSL_FLAGS) $(OPENSSL_FLAGS_AARCH64) 
-Wno-error=format -Wno-format 

[edk2-devel] [PATCH v3 2/6] CryptoPkg/CryptoPkg.ci.yaml: Allow dependency upon ArmPkg

2023-11-10 Thread PierreGondois
Allow dependency upon ArmPkg to pass the dependency Check.

Signed-off-by: Pierre Gondois 
---
 CryptoPkg/CryptoPkg.ci.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CryptoPkg/CryptoPkg.ci.yaml b/CryptoPkg/CryptoPkg.ci.yaml
index f961d85927c0..3bbb220d3224 100644
--- a/CryptoPkg/CryptoPkg.ci.yaml
+++ b/CryptoPkg/CryptoPkg.ci.yaml
@@ -69,6 +69,7 @@
 },
 "DependencyCheck": {
 "AcceptableDependencies": [
+"ArmPkg/ArmPkg.dec",
 "MdePkg/MdePkg.dec",
 "MdeModulePkg/MdeModulePkg.dec",
 "CryptoPkg/CryptoPkg.dec",
-- 
2.25.1



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




[edk2-devel] [PATCH v3 1/6] ArmPkg/ArmLib: Move ArmReadIdAA64Isar0() to ArmLib

2023-11-10 Thread PierreGondois
Add ArmReadIdAA64Isar0() to ArmLib along with macros
to read specific register fields.

Signed-off-by: Pierre Gondois 
---
 ArmPkg/Include/Library/ArmLib.h| 68 ++
 ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h |  6 --
 2 files changed, 68 insertions(+), 6 deletions(-)

diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h
index 6aa8a48f07f3..1edaa8d45962 100644
--- a/ArmPkg/Include/Library/ArmLib.h
+++ b/ArmPkg/Include/Library/ArmLib.h
@@ -805,6 +805,74 @@ ArmHasEte (
   VOID
   );
 
+//
+// Bit shifts for the ID_AA64ISAR0_EL1 register.
+//
+#define ARM_ID_AA64ISAR0_EL1_AES_SHIFT (4U)
+#define ARM_ID_AA64ISAR0_EL1_SHA1_SHIFT(8U)
+#define ARM_ID_AA64ISAR0_EL1_SHA2_SHIFT(12U)
+#define ARM_ID_AA64ISAR0_EL1_CRC32_SHIFT   (16U)
+#define ARM_ID_AA64ISAR0_EL1_ATOMIC_SHIFT  (20U)
+#define ARM_ID_AA64ISAR0_EL1_RDM_SHIFT (28U)
+#define ARM_ID_AA64ISAR0_EL1_SHA3_SHIFT(32U)
+#define ARM_ID_AA64ISAR0_EL1_SM3_SHIFT (36U)
+#define ARM_ID_AA64ISAR0_EL1_SM4_SHIFT (40U)
+#define ARM_ID_AA64ISAR0_EL1_DP_SHIFT  (44U)
+#define ARM_ID_AA64ISAR0_EL1_FHM_SHIFT (48U)
+#define ARM_ID_AA64ISAR0_EL1_TS_SHIFT  (52U)
+#define ARM_ID_AA64ISAR0_EL1_TLB_SHIFT (56U)
+#define ARM_ID_AA64ISAR0_EL1_RNDR_SHIFT(60U)
+
+//
+// Bit masks for the ID_AA64ISAR0_EL1 fields.
+//
+#define ARM_ID_AA64ISAR0_EL1_AES_MASK (0xFU)
+#define ARM_ID_AA64ISAR0_EL1_SHA1_MASK(0xFU)
+#define ARM_ID_AA64ISAR0_EL1_SHA2_MASK(0xFU)
+#define ARM_ID_AA64ISAR0_EL1_CRC32_MASK   (0xFU)
+#define ARM_ID_AA64ISAR0_EL1_ATOMIC_MASK  (0xFU)
+#define ARM_ID_AA64ISAR0_EL1_RDM_MASK (0xFU)
+#define ARM_ID_AA64ISAR0_EL1_SHA3_MASK(0xFU)
+#define ARM_ID_AA64ISAR0_EL1_SM3_MASK (0xFU)
+#define ARM_ID_AA64ISAR0_EL1_SM4_MASK (0xFU)
+#define ARM_ID_AA64ISAR0_EL1_DP_MASK  (0xFU)
+#define ARM_ID_AA64ISAR0_EL1_FHM_MASK (0xFU)
+#define ARM_ID_AA64ISAR0_EL1_TS_MASK  (0xFU)
+#define ARM_ID_AA64ISAR0_EL1_TLB_MASK (0xFU)
+#define ARM_ID_AA64ISAR0_EL1_RNDR_MASK(0xFU)
+
+//
+// Bit masks for the ID_AA64ISAR0_EL1 field values.
+//
+#define ARM_ID_AA64ISAR0_EL1_AES_FEAT_AES_MASK(0x1U)
+#define ARM_ID_AA64ISAR0_EL1_AES_FEAT_PMULL_MASK  (0x2U)
+#define ARM_ID_AA64ISAR0_EL1_SHA1_FEAT_SHA1_MASK  (0x1U)
+#define ARM_ID_AA64ISAR0_EL1_SHA2_FEAT_SHA256_MASK(0x1U)
+#define ARM_ID_AA64ISAR0_EL1_SHA2_FEAT_SHA512_MASK(0x2U)
+#define ARM_ID_AA64ISAR0_EL1_CRC32_HAVE_CRC32_MASK(0x1U)
+#define ARM_ID_AA64ISAR0_EL1_ATOMIC_FEAT_LSE_MASK (0x2U)
+#define ARM_ID_AA64ISAR0_EL1_RDM_FEAT_RDM_MASK(0x1U)
+#define ARM_ID_AA64ISAR0_EL1_SHA3_FEAT_SHA3_MASK  (0x1U)
+#define ARM_ID_AA64ISAR0_EL1_SM3_FEAT_SM3_MASK(0x1U)
+#define ARM_ID_AA64ISAR0_EL1_SM4_FEAT_SM4_MASK(0x1U)
+#define ARM_ID_AA64ISAR0_EL1_DP_FEAT_DOTPROD_MASK (0x1U)
+#define ARM_ID_AA64ISAR0_EL1_FHM_FEAT_FHM_MASK(0x1U)
+#define ARM_ID_AA64ISAR0_EL1_TS_FEAT_FLAGM_MASK   (0x1U)
+#define ARM_ID_AA64ISAR0_EL1_TS_FEAT_FLAGM2_MASK  (0x2U)
+#define ARM_ID_AA64ISAR0_EL1_TLB_FEAT_TLBIOS_MASK (0x1U)
+#define ARM_ID_AA64ISAR0_EL1_TLB_FEAT_TLBIRANGE_MASK  (0x2U)
+#define ARM_ID_AA64ISAR0_EL1_RNDR_FEAT_RNG_MASK   (0x1U)
+
+/** Read AA64Isar0 register.
+
+   @return AA64Isar0's register value.
+**/
+UINTN
+EFIAPI
+ArmReadIdAA64Isar0 (
+  VOID
+  );
+
 #endif // MDE_CPU_AARCH64
 
 #ifdef MDE_CPU_ARM
diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h 
b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h
index 6380a019ddc5..07181d940bdd 100644
--- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h
+++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h
@@ -50,12 +50,6 @@ ArmReadIdAA64Dfr1 (
   VOID
   );
 
-UINTN
-EFIAPI
-ArmReadIdAA64Isar0 (
-  VOID
-  );
-
 UINTN
 EFIAPI
 ArmReadIdAA64Isar1 (
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111029): https://edk2.groups.io/g/devel/message/111029
Mute This Topic: https://groups.io/mt/102504418/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/6] CryptoPkg: Enable Openssl native instruction support for AARCH64

2023-11-10 Thread PierreGondois
v3:
- Use ArmPkg's function to access register:
  - Dropped:
- [PATCH v2 1/7] MdePkg/BaseLib: AARCH64: Add ArmReadCntPctReg()
- [PATCH v2 2/7] MdePkg/BaseLib: AARCH64: Add ArmReadIdAA64Isar0Reg()
- [PATCH v2 3/7] MdePkg/BaseRngLib: Prefer ArmReadIdAA64Isar0Reg() over 
ArmReadIdIsar0()
  - Added:
- [PATCH v3 1/6] ArmPkg/ArmLib: Move ArmReadIdAA64Isar0() to ArmLib
- Allow dependency of CryptoPkg over ArmPkg in CI:
  - Added:
- [PATCH v3 2/6] CryptoPkg/CryptoPkg.ci.yaml: Allow dependency upon

v2:
- [PATCH v2 2/7] MdePkg/BaseLib: AARCH64: Add ArmReadIdAA64Isar0Reg()
  - Correct bad mask values in MdePkg/Include/Library/BaseLib.h
- [PATCH v2 4/7] CryptoPkg/OpensslLib: Add native instruction support:
  - Add armcap.c to configure.py:sources_filter_fn() instead of
manually commenting the file in .inf files

Various OpensslLib implementations are available in edk2. The
OpensslLibAccel.inf and OpensslLibFullAccel.inf ones use
architecture specific instructions, e.g. AESE, PMULL, SHA256H, ...,
allowing to improve speed.

Enable support for Aarch64's native instructions:
- Add ArmReadCntPctReg() and ArmReadIdAA64Isar0Reg() to
  Aarch64's BaseLib.
- Generate Aarch64's specific Openssl functions.
- Add a OpensslStub/AArch64Cap.c file to allow Openssl
  to probe Aarch64 native instruction support.

This patch-set only enable support for GCC for now (MSFT support
not added).

 Testing 

The tests run are based on the TestBaseCryptLibShell module.
Each test is run 100 times, then the first 5 values
(considered as warmup) are removed.

The NoAccel column relies on the OpensslLibFull implementation,
the Accel column relies on the OpensslLibFullAccel implementation.
The 'Improvement' column is computed as:
   100 * ('Accel (ns)' - 'NoAccel (ns)') / 'NoAccel (ns)'

The std deviation of the TestVerifyDhGenerateKey is big.
It is due to [1] being called with the 'safe' parameter set, leading
to the prime number taking more time to generate. It requires ~10
iterations when safe=false, ~1000 iterations when safe=true.

The test was run on a Juno-r2. The native Openssl implementation makes
use of the following features (cf. [2]):
- ARMV7_NEON
- ARMV8_AES
- ARMV8_SHA1
- ARMV8_PMULL
- ARMV8_SHA256
and misses:
- ARMV8_SHA512

| TestName |   NoAccel (ns) |   NoAccel std |   Accel 
(ns) |   Accel std |   Improvement |
|:-|---:|--:|-:|:|--:|
| mPkcs7EkuTest|   14757511 | 14370 | 
14947276 |   35677 |   1.28589 |
| mAeadAesGcmTest  | 129667 |  2012 |   
113897 |1366 | -12.1619  |
| mBlockCipherTest |   7325 |   102 | 
6487 |  81 | -11.4403  |
| mAuthenticodeTest|   72852444 |   3097832 | 
67593102 | 3123627 |  -7.21917 |
| mBnTest  | 771921 | 57966 |   
737656 |   61354 |  -4.43893 |
| mDhTest  | 4082083501 |3340300622 |   
3502629757 |  3444890110 | -14.195   |
| mEcTest  |   24666075 |191971 | 
23250301 |  178985 |  -5.73976 |
| mHkdfTest| 848440 |  4295 |   
797966 |4320 |  -5.94904 |
| mHmacTest| 235527 | 36284 |   
204823 |   37936 | -13.0363  |
| mImageTimestampTest  |   12801070 | 18327 | 
12190046 |   23138 |  -4.77323 |
| mOaepTest|   20032245 | 46525 | 
18671388 |   36399 |  -6.79333 |
| mPkcs5Test   | 178624 |  1962 |   
114852 |1376 | -35.7018  |
| mPkcs7Test   |   28464572 | 70683 | 
25282753 |   82616 | -11.1782  |
| mPrngTest| 727013 |  3637 |   
460076 |2668 | -36.717   |
| mRsaCertTest |   39109865 | 90380 | 
36452412 |  220712 |  -6.79484 |
| mRsaTest |   22451367 | 60643 | 
16672060 |   53643 | -25.7414  |
| mRsaPssTest  |  142051533 |122172 | 
98638975 |   99131 | -30.5611  |
| mHashTest|  22033 |  6308 |
17650 |6622 | -19.8929  |
| mX509Test|   53796289 |123676 | 
51280121 |  187588 |  -4.67721 |

Pierre Gondois (6):
  ArmPkg/ArmLib: Move ArmReadIdAA64Isar0() to ArmLib
  CryptoPkg/CryptoPkg.ci.yaml: Allow dependency upon ArmPkg
  CryptoPkg/OpensslLib: Add native instruction support for AARCH64
  CryptoPkg/OpensslLib: Generate files for AARCH64 native support
  CryptoPkg/OpensslLib: 

[edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Enable execute disable bit.

2023-11-10 Thread Yuanhao Xie
From: Yuanhao Xie 

This patch synchronizes the No-Execute bit in the IA32_EFER
register for the APs before the RestoreVolatileRegisters operation.

The commit 964a4f0, titled "Eliminate the second INIT-SIPI-SIPI
sequence," replaces the second INIT-SIPI-SIPI sequence with the BSP
calling the SwitchApContext function to initiate a specialized start-up
signal, waking up APs in the DXE instead of using INIT-SIPI-SIPI.

Due to this change, the logic for "Enable execute disable bit" in
MpFuncs.nasm is no longer executed. However, to ensure the proper setup
of the page table, it is necessary to synchronize the IA32_EFER.NXE for
APs before executing RestoreVolatileRegisters .

Based on SDM:
If IA32_EFER.NXE is set to 1, it signifies execute-disable, meaning
instruction fetches are not allowed from the 4-KByte page controlled by
this entry. Conversely, if it is set to 0, it is reserved.

Signed-off-by: Yuanhao Xie 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Rahul Kumar 
Cc: Gerd Hoffmann 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 33 ++--
 UefiCpuPkg/Library/MpInitLib/MpLib.h |  1 +
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 9a6ec5db5c..a5ff7ef91f 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -906,21 +906,29 @@ ApWakeupFunction (
 **/
 VOID
 EFIAPI
-DxeApEntryPoint (
-  CPU_MP_DATA  *CpuMpData
+DxeApEntryPoint(
+  CPU_MP_DATA *CpuMpData
   )
 {
-  UINTN  ProcessorNumber;
+  UINTN ProcessorNumber;
+  MSR_IA32_EFER_REGISTER EferMsr;
 
-  GetProcessorNumber (CpuMpData, );
-  RestoreVolatileRegisters (>CpuData[0].VolatileRegisters, FALSE);
-  InterlockedIncrement ((UINT32 *)>FinishedCount);
-  PlaceAPInMwaitLoopOrRunLoop (
-CpuMpData->ApLoopMode,
-CpuMpData->CpuData[ProcessorNumber].StartupApSignal,
-CpuMpData->ApTargetCState
-);
-  ApWakeupFunction (CpuMpData, ProcessorNumber);
+  GetProcessorNumber(CpuMpData, );
+  InterlockedIncrement((UINT32 *)>FinishedCount);
+
+  if (CpuMpData->EnableExecuteDisableForSwitchContext)
+  {
+EferMsr.Uint64 = AsmReadMsr64(MSR_IA32_EFER);
+EferMsr.Bits.NXE = 1;
+AsmWriteMsr64(MSR_IA32_EFER, EferMsr.Uint64);
+  }
+
+  RestoreVolatileRegisters(>CpuData[0].VolatileRegisters, FALSE);
+  PlaceAPInMwaitLoopOrRunLoop(
+  CpuMpData->ApLoopMode,
+  CpuMpData->CpuData[ProcessorNumber].StartupApSignal,
+  CpuMpData->ApTargetCState);
+  ApWakeupFunction(CpuMpData, ProcessorNumber);
 }
 
 /**
@@ -2190,6 +2198,7 @@ MpInitLibInitialize (
 
   CpuMpData->FinishedCount = 0;
   CpuMpData->InitFlag  = ApInitDone;
+  CpuMpData->EnableExecuteDisableForSwitchContext = 
IsBspExecuteDisableEnabled ();
   SaveCpuMpData (CpuMpData);
   //
   // In scenarios where both the PEI and DXE phases run in the same
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h 
b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index d2f411f006..bf86a13820 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -265,6 +265,7 @@ struct _CPU_MP_DATA {
   UINT64   TotalTime;
   EFI_EVENTWaitEvent;
   UINTN**FailedCpuList;
+  BOOLEAN  EnableExecuteDisableForSwitchContext;
 
   AP_INIT_STATEInitFlag;
   BOOLEAN  SwitchBspFlag;
-- 
2.39.1.windows.1



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




Re: [edk2-devel] [PATCH v2 24/30] OvmfPkg/LoongArchVirt: Add platform boot manager library

2023-11-10 Thread Gerd Hoffmann
On Fri, Nov 10, 2023 at 03:09:47PM +0800, Chao Li wrote:
> Hi Laszlo,
> 
> Sorry, I'm not check carefully, it is really **copied**, and we not think
> the ARM version is not good enough.
> 
> So, can I move this library to OvmfPkg so other ARCH use it easily?

Moving code from ArmVirtPkg to OvmfPkg is fine.

OvmfPkg is the home for both x86 virtual machine bits and shared code.
The later used to be mostly virtio drivers, but with the arrival of
riscv some fdt support code has already moved from ArmVirtPkg to OvmfPkg
so arm and riscv can share it.  Doing the same for loongarch is
perfectly fine.

take care,
  Gerd



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




Re: [edk2-devel] [PATCH v2 01/11] ArmPkg/ArmScmiDxe: Rename PERFORMANCE_PROTOCOL_VERSION

2023-11-10 Thread PierreGondois

Hello Leif,

On 11/2/23 11:20, Pierre Gondois wrote:

Hello Leif,
Thanks for the review,

On 10/26/23 12:05, Leif Lindholm wrote:

On Wed, Oct 25, 2023 at 13:25:30 +0200, pierre.gond...@arm.com wrote:

From: Pierre Gondois 

Rename PERFORMANCE_PROTOCOL_VERSION to reflect the different
versions of the protocol. The macro is neither used in edk2 nor
in edk2-platforms.


OK, so slight nitpick, but mainly because it parses a bit weirdly...
*Will* it be used after this series is merged, or is this an update
for completeness?


The 'fast channels' were added in the v2.0 SCMI specification. This patch-set
relies on this feature, so it is checked in:
 [PATCH v2 10/11] DynamicTablesPkg: Add ArmScmiInfoLib
that the underlying SCP is at least at this version.

```
 // FastChannels were added in SCMI v2.0 spec.
 if (Version < PERFORMANCE_PROTOCOL_VERSION_V2) {
   DEBUG ((DEBUG_ERROR, "ArmScmiInfoLib requires SCMI version > 2.0\n"));
   return EFI_UNSUPPORTED;
 }
```




Signed-off-by: Pierre Gondois 
---
   ArmPkg/Include/Library/ArmLib.h |  1 +
   .../Include/Protocol/ArmScmiPerformanceProtocol.h   | 13 -
   2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLib.h
index 0169dbc1092c..7b2b2238fed9 100644
--- a/ArmPkg/Include/Library/ArmLib.h
+++ b/ArmPkg/Include/Library/ArmLib.h
@@ -780,6 +780,7 @@ EFIAPI
   ArmHasVhe (
 VOID
 );
+
   #endif // MDE_CPU_AARCH64
   
   #ifdef MDE_CPU_ARM

diff --git a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h 
b/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h
index 7e548e4765c2..8e8e05d5a5f6 100644
--- a/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h
+++ b/ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h
@@ -1,12 +1,12 @@
   /** @file
   
-  Copyright (c) 2017-2021, Arm Limited. All rights reserved.

+  Copyright (c) 2017-2023, Arm Limited. All rights reserved.
   
 SPDX-License-Identifier: BSD-2-Clause-Patent
   
-  System Control and Management Interface V1.0

-http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/
-DEN0056A_System_Control_and_Management_Interface.pdf
+  System Control and Management Interface, latest version:


I see this as a pattern throughout the series.
But this statement will at some point become untrue; this
implementation is written against a specific version. I think this
version shold be reflected in the comment. (And that applies
throughout the series.)


+  - https://developer.arm.com/documentation/den0056/latest/


But I think the above is the most useful link.


I was referring to this point I'm not sure I understood.

Regards,
Pierre



I am not sure I understand completely. Do you mean that the SCMI
structures/interfaces defined in:
 ArmPkg/Include/Protocol/ArmScmiPerformanceProtocol.h
and that were written against the SCMI v1.0 specification should
not be used as such for other SCMI specification version ?
I.e. the same process as for the AcpiXX.h files
(MdePkg/Include/IndustryStandard/Acpi65.h) should be used ?

Or do you mean that the _CPC object generation implies that the
SCP should comply to the v2.0 version at least and this should be
reflected in the commit messages ?

Regards,
Pierre



/
  Leif


+
   **/
   
   #ifndef ARM_SCMI_PERFORMANCE_PROTOCOL_H_

@@ -14,7 +14,10 @@
   
   #include 
   
-#define PERFORMANCE_PROTOCOL_VERSION  0x1

+/// Arm Scmi performance protocol versions.
+#define PERFORMANCE_PROTOCOL_VERSION_V1  0x1
+#define PERFORMANCE_PROTOCOL_VERSION_V2  0x2
+#define PERFORMANCE_PROTOCOL_VERSION_V3  0x3
   
   #define ARM_SCMI_PERFORMANCE_PROTOCOL_GUID  { \

 0x9b8ba84, 0x3dd3, 0x49a6, {0xa0, 0x5a, 0x31, 0x34, 0xa5, 0xf0, 0x7b, 
0xad} \
--
2.25.1




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




Re: [edk2-devel] [PATCH v2 10/11] DynamicTablesPkg: Add ArmScmiInfoLib

2023-11-10 Thread PierreGondois




On 11/9/23 12:26, Leif Lindholm wrote:

On Thu, Nov 09, 2023 at 10:58:58 +0100, Pierre Gondois wrote:

Hello Leif,

On 11/2/23 11:20, Pierre Gondois wrote:



On 10/26/23 13:03, Leif Lindholm wrote:

On Wed, Oct 25, 2023 at 13:25:39 +0200, PierreGondois wrote:

From: Pierre Gondois 

The SCP holds some power information that could be advertised
through the _CPC object. The communication with the SCP is done
through SCMI protocols (c.f. ArmScmiDxe).

Use the SCMI protocols to query information and feed it to
the DynamicTablesPkg.


Couple of questions:
With a generic name like ArmScmiInfoLib, does is belong in ArmPkg or
MdeModulePkg?

Or if it's more tightly integrated with DynamicTablesPkg (not
blatantly obvious from a quick skim below), should that be reflected
by the library name?


The library is tight to the DynamicTablesPkg as it produces DynamicTablesPkg
specific objects. It uses the SCMI interface to fetch information from the SCP.
The ScmiProtocol resides in the ArmPkg, thus the name.
Does the name 'ScmiInfoLib' sound better ?


Should I keep ArmScmiInfoLib / ScmiInfoLib ?


I know it gets tedious with the long names, but if it's fully
integrated with DynamicTablesPkg, then it's kind of important that the
name does not imply it's generic; i.e., the name should be DynamicTable*.

If it helps clarify my thinking, my litmus test for this is I
don't want to have to go searching through code to determine whether

#include 

imports an Arm-specification header or a package-local helper.


Ok right, I'll rename it DynamicTablesScmiInfoLib then.




Also I'm not sure if there is a change required to:
   [PATCH v2 01/11] ArmPkg/ArmScmiDxe: Rename PERFORMANCE_PROTOCOL_VERSION
regarding the spec. reference, cf. https://edk2.groups.io/g/devel/message/110515


I'm not sure I follow? A change in what way?


I was referring to your point about the fact some features might
be written against a specific SCMI spec. version, cf. the related thread.



I agree the name is too generic. I didn't flag it because it replaces
a non-ideal thing with something that isn't any worse, and I'm trying
to cut down on asking people to fix existing quirks when adding new
features.

If you're happy to rename it while you're at it, I'm happy to take it.

Regards,

Leif


Regards
Pierre





/
   Leif


Signed-off-by: Pierre Gondois 
---
DynamicTablesPkg/DynamicTables.dsc.inc|   1 +
DynamicTablesPkg/DynamicTablesPkg.dec |   3 +
DynamicTablesPkg/DynamicTablesPkg.dsc |   1 +
.../Include/Library/ArmScmiInfoLib.h  |  33 ++
.../Library/ArmScmiInfoLib/ArmScmiInfoLib.c   | 294 ++
.../Library/ArmScmiInfoLib/ArmScmiInfoLib.inf |  31 ++
6 files changed, 363 insertions(+)
create mode 100644 DynamicTablesPkg/Include/Library/ArmScmiInfoLib.h
create mode 100644 DynamicTablesPkg/Library/ArmScmiInfoLib/ArmScmiInfoLib.c
create mode 100644 
DynamicTablesPkg/Library/ArmScmiInfoLib/ArmScmiInfoLib.inf

diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc 
b/DynamicTablesPkg/DynamicTables.dsc.inc
index 9d4312c4e87d..be40ebc4b472 100644
--- a/DynamicTablesPkg/DynamicTables.dsc.inc
+++ b/DynamicTablesPkg/DynamicTables.dsc.inc
@@ -15,6 +15,7 @@ [BuildOptions]
[LibraryClasses.common]
  
AcpiHelperLib|DynamicTablesPkg/Library/Common/AcpiHelperLib/AcpiHelperLib.inf
  AmlLib|DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf
+  ArmScmiInfoLib|DynamicTablesPkg/Library/ArmScmiInfoLib/ArmScmiInfoLib.inf
  
SsdtPcieSupportLib|DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.inf
  
SsdtSerialPortFixupLib|DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
  
TableHelperLib|DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf
diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec 
b/DynamicTablesPkg/DynamicTablesPkg.dec
index cfbcbb9569f1..26498e5fec53 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dec
+++ b/DynamicTablesPkg/DynamicTablesPkg.dec
@@ -42,6 +42,9 @@ [LibraryClasses]
  ##  @libraryclass  Defines a set of SMBIOS string helper methods.
  SmbiosStringTableLib|Include/Library/SmbiosStringTableLib.h
+  ##  @libraryclass  Defines a set of APIs to populate CmObj using SCMI.
+  ArmScmiInfoLib|Include/Library/ArmScmiInfoLib.h
+
[Protocols]
  # Configuration Manager Protocol GUID
  gEdkiiConfigurationManagerProtocolGuid = { 0xd85a4835, 0x5a82, 0x4894, { 
0xac, 0x2, 0x70, 0x6f, 0x43, 0xd5, 0x97, 0x8e } }
diff --git a/DynamicTablesPkg/DynamicTablesPkg.dsc 
b/DynamicTablesPkg/DynamicTablesPkg.dsc
index bd5084a9008f..6ea86c9efdb0 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dsc
+++ b/DynamicTablesPkg/DynamicTablesPkg.dsc
@@ -39,6 +39,7 @@ [LibraryClasses.ARM, LibraryClasses.AARCH64]
  PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
[Components.common]
+  DynamicTablesPkg/Library/ArmScmiInfoLib/ArmScmiInfoLib.inf
  

Re: [edk2-devel] [PATCH v2 1/7] MdePkg/BaseLib: AARCH64: Add ArmReadCntPctReg()

2023-11-10 Thread PierreGondois




On 11/9/23 15:11, Leif Lindholm wrote:

On Thu, Nov 09, 2023 at 10:23:01 +0100, Pierre Gondois wrote:

To enable AARCH64 native instruction support for Openssl,
some interfaces must be implemented. OPENSSL_rdtsc() requests
an access to a counter to get some non-trusted entropy.

Add ArmReadCntPctReg() to read system count.
A similar ArmReadCntPct() function is available in the ArmPkg,
but the CryptoPkg where OPENSSL_rdtsc will reside cannot rely
on the ArmPkg.


This is patently untrue, as can be discovered by grepping for ArmPkg
under CryptoPkg already.


Yes right, I will update the serie in that sens,
Regards,
Pierre



Yes, we have a problematic history around how architectures that
weren't already in tree when edk2 was first published got
introduced at a later date. But this bit of contortionism helps no one.
Please move this to ArmPkg, which is effectively an exclave of MdePkg
anyway.

(Yes, there is an argument for moving ArmLib into MdePkg, but that
quickly escalates through dependencies to moving all of ArmPkg into
MdePkg, and that's a fairly big task.)

/
 Leif





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




Re: [edk2-devel] [PATCH v4] UefiCpuPkg/PiSmmCpuDxeSmm: Fix CP Exception when CET enable

2023-11-10 Thread Ni, Ray
merged.

Thanks,
Ray

From: Wu, Jiaxin 
Sent: Friday, November 10, 2023 8:43 AM
To: Kinney, Michael D ; Laszlo Ersek 
; devel@edk2.groups.io ; Gao, Liming 

Cc: Dong, Eric ; Ni, Ray ; Zeng, Star 
; Gerd Hoffmann ; Kumar, Rahul R 

Subject: RE: [edk2-devel] [PATCH v4] UefiCpuPkg/PiSmmCpuDxeSmm: Fix CP 
Exception when CET enable

Thank you, Mike, the PR (https://github.com/tianocore/edk2/pull/4867) has been 
synced & updated with reviewed by tag, and we can merge once pass the CI check.



> -Original Message-
> From: Kinney, Michael D 
> Sent: Friday, November 10, 2023 8:25 AM
> To: Wu, Jiaxin ; Laszlo Ersek ;
> devel@edk2.groups.io; Gao, Liming 
> Cc: Dong, Eric ; Ni, Ray ; Zeng, Star
> ; Gerd Hoffmann ; Kumar, Rahul R
> ; Kinney, Michael D 
> Subject: RE: [edk2-devel] [PATCH v4] UefiCpuPkg/PiSmmCpuDxeSmm: Fix CP
> Exception when CET enable
>
> I approve this change for edk2-stable202311
>
> The PR looks out of sync with this email patch.
>
> Can you please update PR with latest patch and commit
> message that was reviewed and add review tags?
>
> Mike
>
> > -Original Message-
> > From: Wu, Jiaxin 
> > Sent: Thursday, November 9, 2023 4:01 PM
> > To: Laszlo Ersek ; devel@edk2.groups.io; Gao,
> > Liming ; Kinney, Michael D
> > 
> > Cc: Dong, Eric ; Ni, Ray ;
> > Zeng, Star ; Gerd Hoffmann ;
> > Kumar, Rahul R 
> > Subject: RE: [edk2-devel] [PATCH v4] UefiCpuPkg/PiSmmCpuDxeSmm: Fix
> CP
> > Exception when CET enable
> >
> > Hi Liming & Mike,
> >
> > Could you help approve & merge this patch into stable tag? It has got
> > below reviewed-by:
> >
> > Reviewed-by: Laszlo Ersek 
> > Reviewed-by: Ray Ni 
> > Reviewed-by: Eric Dong 
> >
> > I also created the PR: https://github.com/tianocore/edk2/pull/4867
> >
> > Thanks,
> > Jiaxin
> >
> >
> > > -Original Message-
> > > From: Wu, Jiaxin
> > > Sent: Wednesday, November 8, 2023 9:17 AM
> > > To: Laszlo Ersek ; devel@edk2.groups.io; Gao,
> > Liming
> > > ; Kinney, Michael D
> > > 
> > > Cc: Dong, Eric ; Ni, Ray ;
> > Zeng, Star
> > > ; Gerd Hoffmann ; Kumar,
> > Rahul R
> > > 
> > > Subject: RE: [edk2-devel] [PATCH v4] UefiCpuPkg/PiSmmCpuDxeSmm: Fix
> > CP
> > > Exception when CET enable
> > >
> > > Hi Liming & Mike & Ray,
> > >
> > > Could you help approve this change for the coming edk2 stable tag?
> > This is
> > > critical bug fix in smm cpu driver to handler the CET check failure,
> > I think we
> > > need this change for the stable tag.
> > >
> > > Thanks,
> > > Jiaxin
> > >
> > > > -Original Message-
> > > > From: Laszlo Ersek 
> > > > Sent: Wednesday, November 8, 2023 2:57 AM
> > > > To: devel@edk2.groups.io; Wu, Jiaxin 
> > > > Cc: Dong, Eric ; Ni, Ray ;
> > Zeng, Star
> > > > ; Gerd Hoffmann ; Kumar,
> > Rahul
> > > R
> > > > 
> > > > Subject: Re: [edk2-devel] [PATCH v4] UefiCpuPkg/PiSmmCpuDxeSmm:
> > Fix
> > > CP
> > > > Exception when CET enable
> > > >
> > > > On 11/7/23 02:24, Wu, Jiaxin wrote:
> > > > > Root cause:
> > > > > 1. Before DisableReadonlyPageWriteProtect() is called, the
> > return
> > > > > address (#1) is pushed in shadow stack.
> > > > > 2. CET is disabled.
> > > > > 3. DisableReadonlyPageWriteProtect() returns to #1.
> > > > > 4. Page table is modified.
> > > > > 5. EnableReadonlyPageWriteProtect() is called, but the return
> > > > > address (#2) is not pushed in shadow stack.
> > > > > 6. CET is enabled.
> > > > > 7. EnableReadonlyPageWriteProtect() returns to #2.
> > > > > #CP exception happens because the actual return address (#2)
> > > > > doesn't match the return address stored in shadow stack (#1).
> > > > >
> > > > > Analysis:
> > > > > Shadow stack will stop update after CET disable (DisableCet() in
> > > > > DisableReadOnlyPageWriteProtect), but normal smi stack will be
> > > > > continue updated with the function called and return
> > > > > (DisableReadOnlyPageWriteProtect &
> > EnableReadOnlyPageWriteProtect),
> > > > > thus leading stack mismatch after CET re-enabled (EnableCet() in
> > > > > EnableReadOnlyPageWriteProtect).
> > > > >
> > > > > According SDM Vol 3, 6.15-Control Protection Exception:
> > > > > Normal smi stack and shadow stack must be matched when CET
> > enable,
> > > > > otherwise CP Exception will happen, which is caused by a near
> > RET
> > > > > instruction.
> > > > >
> > > > > CET is disabled in DisableCet(), while can be enabled in
> > > > > EnableCet(). This way won't cause the problem because they are
> > > > > implemented in a way that return address of DisableCet() is
> > > > > poped out from shadow stack (Incsspq performs a pop to increases
> > > > > the shadow stack) and EnableCet() doesn't use "RET" but "JMP" to
> > > > > return to caller. So calling EnableCet() and DisableCet()
> > doesn't
> > > > > have the same issue as calling DisableReadonlyPageWriteProtect()
> > > > > and EnableReadonlyPageWriteProtect().
> > > > >
> > > > > With above root cause & analysis, define below 2 macros instead
> > of
> > > > > functions for WP &