[edk2-devel] [PATCH 2/2] UefiPayloadPkg: Hookup BGRT build option

2022-02-01 Thread Sean Rhodes
Hook FOLLOW_BGRT_SPEC build option to FollowBGRTSpec PCD.

Signed-off-by: Sean Rhodes 
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 1ce96a51c1..115111c037 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -33,6 +33,7 @@
   DEFINE UNIVERSAL_PAYLOAD= FALSE
   DEFINE SECURITY_STUB_ENABLE = TRUE
   DEFINE SMM_SUPPORT  = FALSE
+  DEFINE FOLLOW_BGRT_SPEC = TRUE
   #
   # SBL:  UEFI payload for Slim Bootloader
   # COREBOOT: UEFI payload for coreboot
@@ -398,6 +399,7 @@
 !if $(PERFORMANCE_MEASUREMENT_ENABLE)
   gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask   | 0x1
 !endif
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowBGRTSpec|$(FOLLOW_BGRT_SPEC)
 
 [PcdsPatchableInModule.X64]
   gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER)
-- 
2.32.0



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




[edk2-devel] [PATCH 1/2] MdeModulePackage: Add option to follow BGRT spec

2022-02-01 Thread Sean Rhodes
Add option to centre the Boot Logo 38.2% from the top of screen, following
the BGRT specification.

Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Library/BootLogoLib/BootLogoLib.c   | 7 ++-
 MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf | 3 +++
 MdeModulePkg/MdeModulePkg.dec| 3 +++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c 
b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
index 478ec2d40e..a9b4c6444b 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
@@ -176,7 +176,12 @@ BootLogoEnableLogo (
 break;
   case EdkiiPlatformLogoDisplayAttributeCenter:
 DestX = (SizeOfX - Image.Width) / 2;
-DestY = (SizeOfY - Image.Height) / 2;
+if (FixedPcdGetBool (PcdFollowBGRTSpec) == TRUE) {
+  DestY = (SizeOfY * 382) / 1000 - Image.Height / 2;
+} else {
+  DestY = (SizeOfY - Image.Height) / 2;
+}
+
 break;
   case EdkiiPlatformLogoDisplayAttributeCenterRight:
 DestX = SizeOfX - Image.Width;
diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf 
b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
index 7d50f2dfa3..03ff038f47 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
@@ -48,5 +48,8 @@
   gEfiUserManagerProtocolGuid   ## CONSUMES
   gEdkiiPlatformLogoProtocolGuid## CONSUMES
 
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowBGRTSpec
+
 [FeaturePcd]
   gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## CONSUMES
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 463e889e9a..b4855431b0 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2079,6 +2079,9 @@
   # @Prompt Enable PCIe Resizable BAR Capability support.
   
gEfiMdeModulePkgTokenSpaceGuid.PcdPcieResizableBarSupport|FALSE|BOOLEAN|0x1024
 
+  # Follow BGRT Specifcation
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFollowBGRTSpec|FALSE|BOOLEAN|0x0025
+
 [PcdsPatchableInModule]
   ## Specify memory size with page number for PEI code when
   #  Loading Module at Fixed Address feature is enabled.
-- 
2.32.0



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




[edk2-devel] [PATCH] UefiPayloadPkg: Make Boot Manager Key configurable

2022-02-01 Thread Sean Rhodes
Provide a build option to use [Esc] instead of [F2] for devices
such as Chromebooks that don't have F-keys.

Signed-off-by: Sean Rhodes 
---
 .../PlatformBootManager.c | 44 +--
 .../PlatformBootManagerLib.inf|  1 +
 UefiPayloadPkg/UefiPayloadPkg.dec |  3 ++
 UefiPayloadPkg/UefiPayloadPkg.dsc |  4 ++
 4 files changed, 39 insertions(+), 13 deletions(-)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index a8ead775ea..0eb577313a 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -164,7 +164,7 @@ PlatformBootManagerBeforeConsole (
   )
 {
   EFI_INPUT_KEY Enter;
-  EFI_INPUT_KEY F2;
+  EFI_INPUT_KEY CustomKey;
   EFI_INPUT_KEY Down;
   EFI_BOOT_MANAGER_LOAD_OPTION  BootOption;
   EFI_STATUSStatus;
@@ -186,13 +186,22 @@ PlatformBootManagerBeforeConsole (
   Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;
   EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);
 
-  //
-  // Map F2 to Boot Manager Menu
-  //
-  F2.ScanCode= SCAN_F2;
-  F2.UnicodeChar = CHAR_NULL;
+  if (FixedPcdGetBool (PcdBootManagerEscape)) {
+//
+// Map Esc to Boot Manager Menu
+//
+CustomKey.ScanCode= SCAN_ESC;
+CustomKey.UnicodeChar = CHAR_NULL;
+  } else {
+//
+// Map Esc to Boot Manager Menu
+//
+CustomKey.ScanCode= SCAN_F2;
+CustomKey.UnicodeChar = CHAR_NULL;
+  }
+
   EfiBootManagerGetBootManagerMenu (&BootOption);
-  EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)BootOption.OptionNumber, 
0, &F2, NULL);
+  EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)BootOption.OptionNumber, 
0, &CustomKey, NULL);
 
   //
   // Also add Down key to Boot Manager Menu since some serial terminals don't 
support F2 key.
@@ -251,12 +260,21 @@ PlatformBootManagerAfterConsole (
   //
   PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", 
LOAD_OPTION_ACTIVE);
 
-  Print (
-L"\n"
-L"F2 or Down  to enter Boot Manager Menu.\n"
-L"ENTER   to boot directly.\n"
-L"\n"
-);
+  if (FixedPcdGetBool (PcdBootManagerEscape)) {
+Print (
+  L"\n"
+  L"Esc or Down  to enter Boot Manager Menu.\n"
+  L"ENTER   to boot directly.\n"
+  L"\n"
+  );
+  } else {
+Print (
+  L"\n"
+  L"F2 or Down  to enter Boot Manager Menu.\n"
+  L"ENTER   to boot directly.\n"
+  L"\n"
+  );
+  }
 }
 
 /**
diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 9c4a9da943..80390e0d98 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -73,3 +73,4 @@
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits
   gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile
+  gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec 
b/UefiPayloadPkg/UefiPayloadPkg.dec
index 551f0a4915..f2fcdf6a74 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dec
+++ b/UefiPayloadPkg/UefiPayloadPkg.dec
@@ -83,6 +83,9 @@ 
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x0400|UINT32|0x
 
 gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80, 0xab, 
0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 0xd8, 0x95, 0x41 
}|VOID*|0x0018
 
+# Boot Manager Key
+gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|FALSE|BOOLEAN|0x0020
+
 ## FFS filename to find the default variable initial data file.
 # @Prompt FFS Name of variable initial data file
  gUefiPayloadPkgTokenSpaceGuid.PcdNvsDataFile |{ 0x1a, 0xf1, 0xb1, 0xae, 0x42, 
0xcc, 0xcf, 0x4e, 0xac, 0x60, 0xdb, 0xab, 0xf6, 0xca, 0x69, 0xe6 
}|VOID*|0x0025
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 1ce96a51c1..5e1892458e 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -33,6 +33,8 @@
   DEFINE UNIVERSAL_PAYLOAD= FALSE
   DEFINE SECURITY_STUB_ENABLE = TRUE
   DEFINE SMM_SUPPORT  = FALSE
+  DEFINE BOOT_MANAGER_ESCAPE  = FALSE
+  DEFINE PLATFORM_BOOT_TIMEOUT= 3
   #
   # SBL:  UEFI payload for Slim Bootloader
   # COREBOOT: UEFI payload for coreboot
@@ -399,6 +401,8 @@
   gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask   | 0x1
 !endif
 
+  gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE)
+
 [PcdsPatchableInModule.X64]
   gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER)
   gPcAtChipsetPkgTokenSpac

Re: [edk2-devel] [PATCH V2 00/10] Platform/RaspberryPi: Utilize SPI flash for EFI variables

2022-02-01 Thread 0n0w1c
Tested-by: 0n0w1c 


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




Re: [edk2-devel] [PATCH 1/1] UefiPayloadPkg/PayloadLoaderPeim: Replace Delta type INTN with UINTN

2022-02-01 Thread Ma, Maurice
Shouldn't "Delta" be INTN type ?  It can be either positive or negative, right ?

For the case you explained below,  I think the caller should pass in INTN type 
instead of UINTN.  
So maybe a better fix is to change  "UINTNDelta" to "INTN   Delta" in the 
caller function RelocateElf64Sections() inside file 
UefiPayloadPkg\PayloadLoaderPeim\ElfLib\Elf64Lib.c.

Thanks
Maurice

> -Original Message-
> From: Jiang, Guomin 
> Sent: Saturday, January 29, 2022 0:31
> To: devel@edk2.groups.io
> Cc: Dong, Guo ; Ni, Ray ; Ma,
> Maurice ; You, Benjamin
> 
> Subject: [PATCH 1/1] UefiPayloadPkg/PayloadLoaderPeim: Replace Delta
> type INTN with UINTN
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3818
> 
> ProcessRelocation64 use INTN  Delta. However it force it to UINTN when call
> it.
> 
> It will have some potential issue when memory larger than 2G because the
> high memory address will be fill with 0x if use INTN.
> 
> Cc: Guo Dong 
> Cc: Ray Ni 
> Cc: Maurice Ma 
> Cc: Benjamin You 
> Signed-off-by: Guomin Jiang 
> ---
>  UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
> b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
> index dc47a05c6e4a..ee530322d7ed 100644
> --- a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
> +++ b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
> @@ -108,7 +108,7 @@ ProcessRelocation64 (
>IN  UINT64  RelaSize,
>IN  UINT64  RelaEntrySize,
>IN  UINT64  RelaType,
> -  IN  INTNDelta,
> +  IN  UINTN   Delta,
>IN  BOOLEAN DynamicLinking
>)
>  {
> --
> 2.30.0.windows.2



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




Re: [edk2-devel] [PATCH 32/32] UefiPayloadPkg: Add build option for Above 4G Memory

2022-02-01 Thread Sean Rhodes
Will do, thanks!

SeanRhodes

Technical Project Lead


On Tue, 1 Feb 2022 at 22:53, Dong, Guo  wrote:

>
>
> Yes, please re-send the patch once there is any update.
>
> And please CC the package maintainers when you send patches to edk2 devel
> list follow EDK2 process.
>
>
>
> Thanks,
>
> Guo
>
>
>
> *From:* Sean Rhodes 
> *Sent:* Saturday, January 29, 2022 1:47 AM
> *To:* Dong, Guo ; devel@edk2.groups.io
> *Subject:* Re: [edk2-devel] [PATCH 32/32] UefiPayloadPkg: Add build
> option for Above 4G Memory
>
>
>
> Thanks :)
>
> I've updated the PR. Do I need to resend the new patch again?
>
> [PATCH 33/33] UefiPayloadPkg: Add build option for Above 4G Memory
>
>
>
> When build option ABOVE_4G_MEMORY is set to true, nothing will change
>
> and EDKII will use all available memory.
>
>
>
> Setting it to false will create memory type information HOB in
>
> payload entry, so that EDKII will reserve enough memory below 4G
>
> for EDKII modules. This option is useful for bootloaders that are not
>
> fully 64-bit aware such as Qubes R4.0.4 bootloader, Zorin and Proxmox.
>
>
>
> Signed-off-by: Sean Rhodes 
>
> ---
>
>  .../UefiPayloadEntry/UefiPayloadEntry.c   | 41 +++
>
>  .../UefiPayloadEntry/UefiPayloadEntry.inf |  7 
>
>  UefiPayloadPkg/UefiPayloadPkg.dec |  3 ++
>
>  UefiPayloadPkg/UefiPayloadPkg.dsc |  3 ++
>
>  4 files changed, 54 insertions(+)
>
>
>
> diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
> b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
>
> index 0fed1e3691..d5c18dc343 100644
>
> --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
>
> +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
>
> @@ -5,10 +5,46 @@
>
>
>
>  **/
>
>
>
> +#include 
>
>  #include "UefiPayloadEntry.h"
>
>
>
>  STATIC UINT32  mTopOfLowerUsableDram = 0;
>
>
>
> +/**
>
> +   Function to reserve memory below 4GB for EDKII Modules.
>
> +
>
> +   This causes the DXE to dispatch everything under 4GB and allows
> Operating
>
> +   System's that require EFI_LOADED_IMAGE to be under 4GB to start.
>
> +   e.g. Xen hypervisor used in Qubes
>
> +
>
> +   @param  None
>
> +
>
> +  @retval None
>
> +**/
>
> +VOID
>
> +ForceModulesBelow4G (
>
> +  VOID
>
> +  )
>
> +{
>
> +  DEBUG ((DEBUG_INFO, "Building hob to restrict memory resorces to below
> 4G.\n"));
>
> +  EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] = {
>
> +{ EfiACPIReclaimMemory,   FixedPcdGet32
> (PcdMemoryTypeEfiACPIReclaimMemory) },
>
> +{ EfiACPIMemoryNVS,   FixedPcdGet32
> (PcdMemoryTypeEfiACPIMemoryNVS) },
>
> +{ EfiReservedMemoryType,  FixedPcdGet32
> (PcdMemoryTypeEfiReservedMemoryType) },
>
> +{ EfiRuntimeServicesData, FixedPcdGet32
> (PcdMemoryTypeEfiRuntimeServicesData) },
>
> +{ EfiRuntimeServicesCode, FixedPcdGet32
> (PcdMemoryTypeEfiRuntimeServicesCode) },
>
> +{ EfiMaxMemoryType,   0 }
>
> +  };
>
> +  //
>
> +  // Create Memory Type Information HOB
>
> +  //
>
> +  BuildGuidDataHob (
>
> +&gEfiMemoryTypeInformationGuid,
>
> +mDefaultMemoryTypeInformation,
>
> +sizeof(mDefaultMemoryTypeInformation)
>
> +  );
>
> +}
>
> +
>
>  /**
>
> Callback function to build resource descriptor HOB
>
>
>
> @@ -438,6 +474,11 @@ _ModuleEntryPoint (
>
>// Build other HOBs required by DXE
>
>BuildGenericHob ();
>
>
>
> +  // Create a HOB to make resources for EDKII modules below 4G
>
> +  if (!FixedPcdGetBool (PcdAbove4GMemory) ) {
>
> +ForceModulesBelow4G ();
>
> +  }
>
> +
>
>// Load the DXE Core
>
>Status = LoadDxeCore (&DxeCoreEntryPoint);
>
>ASSERT_EFI_ERROR (Status);
>
> diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
> b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
>
> index 1847d6481a..2ca47e3bb5 100644
>
> --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
>
> +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
>
> @@ -86,8 +86,15 @@
>
>gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
>
>gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter
>
>gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
>
> +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
>
> +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
>
> +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
>
> +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
>
> +  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode
>
>
>
>gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack   ##
> SOMETIMES_CONSUMES
>
>gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ##
> SOMETIMES_CONSUMES
>
>gEfiMdeModulePkgTokenSpaceGuid.PcdImageProtectionPolicy   ##
> SOMETIMES_CONSUMES
>
>
>
> +  gUefiPayloadPkgTokenSpaceGuid.PcdAbove4GMemory
>
> +
>
> diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec
> b/UefiPayloadPkg/UefiPayloadPkg.dec
>
> index 551f0a4915..653a52b5a7 100644
>
> --- a/UefiPayloadPkg/UefiPayloadPk

[edk2-devel] [PATCH] UefiPayloadPkg: Provide option to use Boot Splash

2022-02-01 Thread Sean Rhodes
Provide a build option to use a Boot Splash logo.

Signed-off-by: Sean Rhodes 
---
 .../Library/PlatformBootManagerLib/PlatformBootManager.c | 5 +
 .../PlatformBootManagerLib/PlatformBootManagerLib.inf| 2 ++
 UefiPayloadPkg/UefiPayloadPkg.dec| 3 +++
 UefiPayloadPkg/UefiPayloadPkg.dsc| 9 +
 UefiPayloadPkg/UefiPayloadPkg.fdf| 3 +++
 5 files changed, 22 insertions(+)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index a8ead775ea..3bded489ef 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -243,6 +243,11 @@ PlatformBootManagerAfterConsole (
   Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
   White.Blue = White.Green = White.Red = White.Reserved = 0xFF;
 
+  if (FixedPcdGetBool (PcdBootSplashImage)) {
+gST->ConOut->ClearScreen (gST->ConOut);
+BootLogoEnableLogo ();
+  }
+
   EfiBootManagerConnectAll ();
   EfiBootManagerRefreshAllBootOption ();
 
diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 9c4a9da943..306bd33b7a 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -39,6 +39,7 @@
   UefiRuntimeServicesTableLib
   UefiLib
   UefiBootManagerLib
+  BootLogoLib
   PcdLib
   DxeServicesLib
   MemoryAllocationLib
@@ -73,3 +74,4 @@
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits
   gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile
+  gUefiPayloadPkgTokenSpaceGuid.PcdBootSplashImage
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec 
b/UefiPayloadPkg/UefiPayloadPkg.dec
index 551f0a4915..4f5756d575 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dec
+++ b/UefiPayloadPkg/UefiPayloadPkg.dec
@@ -83,6 +83,9 @@ 
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x0400|UINT32|0x
 
 gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80, 0xab, 
0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 0xd8, 0x95, 0x41 
}|VOID*|0x0018
 
+# BootSplash Image
+gUefiPayloadPkgTokenSpaceGuid.PcdBootSplashImage|TRUE|BOOLEAN|0x0021
+
 ## FFS filename to find the default variable initial data file.
 # @Prompt FFS Name of variable initial data file
  gUefiPayloadPkgTokenSpaceGuid.PcdNvsDataFile |{ 0x1a, 0xf1, 0xb1, 0xae, 0x42, 
0xcc, 0xcf, 0x4e, 0xac, 0x60, 0xdb, 0xab, 0xf6, 0xca, 0x69, 0xe6 
}|VOID*|0x0025
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 1ce96a51c1..700ac02395 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -33,6 +33,7 @@
   DEFINE UNIVERSAL_PAYLOAD= FALSE
   DEFINE SECURITY_STUB_ENABLE = TRUE
   DEFINE SMM_SUPPORT  = FALSE
+  DEFINE BOOTSPLASH_IMAGE = FALSE
   #
   # SBL:  UEFI payload for Slim Bootloader
   # COREBOOT: UEFI payload for coreboot
@@ -209,6 +210,9 @@
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
   
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
   
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+!if $(BOOTSPLASH_IMAGE) == TRUE
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+!endif
   
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
   
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
 
@@ -399,6 +403,8 @@
   gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask   | 0x1
 !endif
 
+  gUefiPayloadPkgTokenSpaceGuid.PcdBootSplashImage|$(BOOTSPLASH_IMAGE)
+
 [PcdsPatchableInModule.X64]
   gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER)
   gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister|$(RTC_TARGET_REGISTER)
@@ -545,6 +551,9 @@
 !endif
   UefiCpuPkg/CpuDxe/CpuDxe.inf
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+!if $(BOOTSPLASH_IMAGE) == TRUE
+  MdeModulePkg/Logo/LogoDxe.inf
+!endif
   MdeModulePkg/Application/UiApp/UiApp.inf {
 
   NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index c7b04978ad..a71d655687 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -158,6 +158,9 @@ INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
 INF UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf
 
 INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+!if $(BOOTSPLASH_IMAGE) == TRUE
+INF MdeModulePkg/Logo/LogoDxe.inf
+!endif
 #
 # PCI Support
 #
-- 
2.32.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io

Re: [edk2-devel] [PATCH 43/43] UefiPayloadPkg: Provide option to use Boot Splash

2022-02-01 Thread Sean Rhodes
>From dc0d6d7175d132b28a2d3ce16cc4373644435793 Mon Sep 17 00:00:00 2001
Message-Id: 

From: Sean Rhodes 
Date: Thu, 6 Jan 2022 15:15:29 +
Subject: [PATCH] UefiPayloadPkg: Provide option to use Boot Splash

Provide a build option to use a Boot Splash logo.

Signed-off-by: Sean Rhodes 
---
.../Library/PlatformBootManagerLib/PlatformBootManager.c | 5 +
.../PlatformBootManagerLib/PlatformBootManagerLib.inf    | 2 ++
UefiPayloadPkg/UefiPayloadPkg.dec                        | 3 +++
UefiPayloadPkg/UefiPayloadPkg.dsc                        | 9 +
UefiPayloadPkg/UefiPayloadPkg.fdf                        | 3 +++
5 files changed, 22 insertions(+)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index a8ead775ea..3bded489ef 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -243,6 +243,11 @@ PlatformBootManagerAfterConsole (
Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
White.Blue = White.Green = White.Red = White.Reserved = 0xFF;

+  if (FixedPcdGetBool (PcdBootSplashImage)) {
+    gST->ConOut->ClearScreen (gST->ConOut);
+    BootLogoEnableLogo ();
+  }
+
EfiBootManagerConnectAll ();
EfiBootManagerRefreshAllBootOption ();

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 9c4a9da943..306bd33b7a 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -39,6 +39,7 @@
UefiRuntimeServicesTableLib
UefiLib
UefiBootManagerLib
+  BootLogoLib
PcdLib
DxeServicesLib
MemoryAllocationLib
@@ -73,3 +74,4 @@
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits
gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile
+  gUefiPayloadPkgTokenSpaceGuid.PcdBootSplashImage
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec 
b/UefiPayloadPkg/UefiPayloadPkg.dec
index 551f0a4915..4f5756d575 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dec
+++ b/UefiPayloadPkg/UefiPayloadPkg.dec
@@ -83,6 +83,9 @@ 
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x0400|UINT32|0x

gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80, 0xab, 
0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 0xd8, 0x95, 0x41 
}|VOID*|0x0018

+# BootSplash Image
+gUefiPayloadPkgTokenSpaceGuid.PcdBootSplashImage|TRUE|BOOLEAN|0x0021
+
## FFS filename to find the default variable initial data file.
# @Prompt FFS Name of variable initial data file
gUefiPayloadPkgTokenSpaceGuid.PcdNvsDataFile |{ 0x1a, 0xf1, 0xb1, 0xae, 0x42, 
0xcc, 0xcf, 0x4e, 0xac, 0x60, 0xdb, 0xab, 0xf6, 0xca, 0x69, 0xe6 
}|VOID*|0x0025
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 1ce96a51c1..700ac02395 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -33,6 +33,7 @@
DEFINE UNIVERSAL_PAYLOAD            = FALSE
DEFINE SECURITY_STUB_ENABLE         = TRUE
DEFINE SMM_SUPPORT                  = FALSE
+  DEFINE BOOTSPLASH_IMAGE             = FALSE
#
# SBL:      UEFI payload for Slim Bootloader
# COREBOOT: UEFI payload for coreboot
@@ -209,6 +210,9 @@
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+!if $(BOOTSPLASH_IMAGE) == TRUE
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+!endif
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf

@@ -399,6 +403,8 @@
gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask       | 0x1
!endif

+  gUefiPayloadPkgTokenSpaceGuid.PcdBootSplashImage|$(BOOTSPLASH_IMAGE)
+
[PcdsPatchableInModule.X64]
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER)
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister|$(RTC_TARGET_REGISTER)
@@ -545,6 +551,9 @@
!endif
UefiCpuPkg/CpuDxe/CpuDxe.inf
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+!if $(BOOTSPLASH_IMAGE) == TRUE
+  MdeModulePkg/Logo/LogoDxe.inf
+!endif
MdeModulePkg/Application/UiApp/UiApp.inf {

NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index c7b04978ad..a71d655687 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -158,6 +158,9 @@ INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
INF UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf

INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
+!if $(BOOTSPLASH_IMAGE) == TRUE
+INF MdeModulePkg/Logo/LogoDxe

Re: [edk2-devel] [PATCH 32/32] UefiPayloadPkg: Add build option for Above 4G Memory

2022-02-01 Thread Guo Dong

Yes, please re-send the patch once there is any update.

And please CC the package maintainers when you send patches to edk2 devel list 
follow EDK2 process.



Thanks,

Guo


From: Sean Rhodes 
Sent: Saturday, January 29, 2022 1:47 AM
To: Dong, Guo ; devel@edk2.groups.io
Subject: Re: [edk2-devel] [PATCH 32/32] UefiPayloadPkg: Add build option for 
Above 4G Memory

Thanks :)

I've updated the PR. Do I need to resend the new patch again?

[PATCH 33/33] UefiPayloadPkg: Add build option for Above 4G Memory

When build option ABOVE_4G_MEMORY is set to true, nothing will change
and EDKII will use all available memory.

Setting it to false will create memory type information HOB in
payload entry, so that EDKII will reserve enough memory below 4G
for EDKII modules. This option is useful for bootloaders that are not
fully 64-bit aware such as Qubes R4.0.4 bootloader, Zorin and Proxmox.

Signed-off-by: Sean Rhodes mailto:sean@starlabs.systems>>
---
 .../UefiPayloadEntry/UefiPayloadEntry.c   | 41 +++
 .../UefiPayloadEntry/UefiPayloadEntry.inf |  7 
 UefiPayloadPkg/UefiPayloadPkg.dec |  3 ++
 UefiPayloadPkg/UefiPayloadPkg.dsc |  3 ++
 4 files changed, 54 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c 
b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
index 0fed1e3691..d5c18dc343 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c
@@ -5,10 +5,46 @@

 **/

+#include 
 #include "UefiPayloadEntry.h"

 STATIC UINT32  mTopOfLowerUsableDram = 0;

+/**
+   Function to reserve memory below 4GB for EDKII Modules.
+
+   This causes the DXE to dispatch everything under 4GB and allows Operating
+   System's that require EFI_LOADED_IMAGE to be under 4GB to start.
+   e.g. Xen hypervisor used in Qubes
+
+   @param  None
+
+  @retval None
+**/
+VOID
+ForceModulesBelow4G (
+  VOID
+  )
+{
+  DEBUG ((DEBUG_INFO, "Building hob to restrict memory resorces to below 
4G.\n"));
+  EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] = {
+{ EfiACPIReclaimMemory,   FixedPcdGet32 
(PcdMemoryTypeEfiACPIReclaimMemory) },
+{ EfiACPIMemoryNVS,   FixedPcdGet32 (PcdMemoryTypeEfiACPIMemoryNVS) },
+{ EfiReservedMemoryType,  FixedPcdGet32 
(PcdMemoryTypeEfiReservedMemoryType) },
+{ EfiRuntimeServicesData, FixedPcdGet32 
(PcdMemoryTypeEfiRuntimeServicesData) },
+{ EfiRuntimeServicesCode, FixedPcdGet32 
(PcdMemoryTypeEfiRuntimeServicesCode) },
+{ EfiMaxMemoryType,   0 }
+  };
+  //
+  // Create Memory Type Information HOB
+  //
+  BuildGuidDataHob (
+&gEfiMemoryTypeInformationGuid,
+mDefaultMemoryTypeInformation,
+sizeof(mDefaultMemoryTypeInformation)
+  );
+}
+
 /**
Callback function to build resource descriptor HOB

@@ -438,6 +474,11 @@ _ModuleEntryPoint (
   // Build other HOBs required by DXE
   BuildGenericHob ();

+  // Create a HOB to make resources for EDKII modules below 4G
+  if (!FixedPcdGetBool (PcdAbove4GMemory) ) {
+ForceModulesBelow4G ();
+  }
+
   // Load the DXE Core
   Status = LoadDxeCore (&DxeCoreEntryPoint);
   ASSERT_EFI_ERROR (Status);
diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf 
b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
index 1847d6481a..2ca47e3bb5 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
+++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.inf
@@ -86,8 +86,15 @@
   gUefiPayloadPkgTokenSpaceGuid.PcdPayloadFdMemSize
   gUefiPayloadPkgTokenSpaceGuid.PcdBootloaderParameter
   gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize
+  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS
+  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory
+  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType
+  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData
+  gUefiPayloadPkgTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode

   gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack   ## 
SOMETIMES_CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdDxeNxMemoryProtectionPolicy ## 
SOMETIMES_CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdImageProtectionPolicy   ## 
SOMETIMES_CONSUMES

+  gUefiPayloadPkgTokenSpaceGuid.PcdAbove4GMemory
+
diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec 
b/UefiPayloadPkg/UefiPayloadPkg.dec
index 551f0a4915..653a52b5a7 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dec
+++ b/UefiPayloadPkg/UefiPayloadPkg.dec
@@ -83,6 +83,9 @@ 
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x0400|UINT32|0x

 gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80, 0xab, 
0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 0xd8, 0x95, 0x41 
}|VOID*|0x0018

+# Above 4G Memory
+gUefiPayloadPkgTokenSpaceGuid.PcdAbove4GMemory|TRUE|BOOLEAN|0x0019
+
 ## FFS filename to find the default variable initial data file.
 # @Prompt FFS Name of variable initial data file
  gUefiPayloadPkg

Re: [edk2-devel] [PATCH 43/43] UefiPayloadPkg: Add option to follow BGRT spec

2022-02-01 Thread Guo Dong


This patch has changes for MdeModulePkg which need review from MdeModulePkg 
maintainers.
Pease separate this patch into different patches for different package.

And please CC the package maintainers when you send patches to edk2 devel list 
follow EDK2 process. Else the patch might be not reviewed in time.

Thanks,
Guo

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Sean Rhodes
Sent: Monday, January 31, 2022 1:56 PM
To: devel@edk2.groups.io
Cc: Rhodes, Sean 
Subject: [edk2-devel] [PATCH 43/43] UefiPayloadPkg: Add option to follow BGRT 
spec

Add option to centre the Boot Logo 38.2% from the top of screen, following the 
BGRT specification.

Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Library/BootLogoLib/BootLogoLib.c   | 6 +-
 MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf | 3 +++
 MdeModulePkg/MdeModulePkg.dec| 3 +++
 UefiPayloadPkg/UefiPayloadPkg.dsc| 2 ++
 4 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c 
b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
index 478ec2d40e..f6d052eea2 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
@@ -176,7 +176,11 @@ BootLogoEnableLogo (
 break;   case EdkiiPlatformLogoDisplayAttributeCenter: 
DestX = (SizeOfX - Image.Width) / 2;-DestY = (SizeOfY - Image.Height) / 
2;+if (FixedPcdGetBool (PcdFollowBGRTSpec) == TRUE) {+  DestY = 
(SizeOfY * 382) / 1000 - Image.Height / 2;+} else {+  DestY = 
(SizeOfY - Image.Height) / 2;+} break;   case 
EdkiiPlatformLogoDisplayAttributeCenterRight: DestX = SizeOfX - 
Image.Width;diff --git a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf 
b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
index 7d50f2dfa3..03ff038f47 100644
--- a/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+++ b/MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
@@ -48,5 +48,8 @@
   gEfiUserManagerProtocolGuid   ## CONSUMES   
gEdkiiPlatformLogoProtocolGuid## CONSUMES +[Pcd]+  
gEfiMdeModulePkgTokenSpaceGuid.PcdFollowBGRTSpec+ [FeaturePcd]   
gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## CONSUMESdiff --git 
a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 463e889e9a..fb3eb7ab7f 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -2079,6 +2079,9 @@
   # @Prompt Enable PCIe Resizable BAR Capability support.   
gEfiMdeModulePkgTokenSpaceGuid.PcdPcieResizableBarSupport|FALSE|BOOLEAN|0x1024
 +  # Follow BGRT Specifcation+  
gEfiMdeModulePkgTokenSpaceGuid.PcdFollowBGRTSpec|TRUE|BOOLEAN|0x0025+ 
[PcdsPatchableInModule]   ## Specify memory size with page number for PEI code 
when   #  Loading Module at Fixed Address feature is enabled.diff --git 
a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 1ce96a51c1..115111c037 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -33,6 +33,7 @@
   DEFINE UNIVERSAL_PAYLOAD= FALSE   DEFINE SECURITY_STUB_ENABLE
 = TRUE   DEFINE SMM_SUPPORT  = FALSE+  DEFINE 
FOLLOW_BGRT_SPEC = TRUE   #   # SBL:  UEFI payload for Slim 
Bootloader   # COREBOOT: UEFI payload for coreboot@@ -398,6 +399,7 @@
 !if $(PERFORMANCE_MEASUREMENT_ENABLE)   
gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask   | 0x1 !endif+  
gEfiMdeModulePkgTokenSpaceGuid.PcdFollowBGRTSpec|$(FOLLOW_BGRT_SPEC)  
[PcdsPatchableInModule.X64]   
gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER)-- 
2.32.0



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




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




Re: [edk2-devel] [PATCH 43/43] UefiPayloadPkg: Make Boot Manager Key configurable

2022-02-01 Thread Guo Dong


Better change to:
gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|$(BOOT_MANAGER_ESCAPE)
for this change:
+!if $(BOOT_MANAGER_ESCAPE) == TRUE
+  gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|TRUE
+!else
+  gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|FALSE
+!endif
+

Thanks,
Guo

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Sean Rhodes
Sent: Monday, January 31, 2022 1:52 PM
To: devel@edk2.groups.io
Cc: Rhodes, Sean 
Subject: [edk2-devel] [PATCH 43/43] UefiPayloadPkg: Make Boot Manager Key 
configurable

Provide a build option to use [Esc] instead of [F2] for devices such as 
Chromebooks that don't have F-keys.

Signed-off-by: Sean Rhodes 
---
 .../PlatformBootManager.c | 43 +--
 .../PlatformBootManagerLib.inf|  1 +
 UefiPayloadPkg/UefiPayloadPkg.dec |  3 ++
 UefiPayloadPkg/UefiPayloadPkg.dsc |  8 
 4 files changed, 42 insertions(+), 13 deletions(-)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index a8ead775ea..6163e776c4 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.
+++ c
@@ -164,7 +164,7 @@ PlatformBootManagerBeforeConsole (
   ) {   EFI_INPUT_KEY Enter;-  EFI_INPUT_KEY 
F2;+  EFI_INPUT_KEY CustomKey;   EFI_INPUT_KEY 
Down;   EFI_BOOT_MANAGER_LOAD_OPTION  BootOption;   EFI_STATUS  
  Status;@@ -186,13 +186,21 @@ PlatformBootManagerBeforeConsole (
   Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;   
EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL); -  //-  // Map F2 to 
Boot Manager Menu-  //-  F2.ScanCode= SCAN_F2;-  F2.UnicodeChar = 
CHAR_NULL;+  if (FixedPcdGetBool (PcdBootManagerEscape) ) {+//+// Map 
Esc to Boot Manager Menu+//+CustomKey.ScanCode= SCAN_ESC;+
CustomKey.UnicodeChar = CHAR_NULL;+  } else {+//+// Map Esc to Boot 
Manager Menu+//+CustomKey.ScanCode= SCAN_F2;+
CustomKey.UnicodeChar = CHAR_NULL;+  }   EfiBootManagerGetBootManagerMenu 
(&BootOption);-  EfiBootManagerAddKeyOptionVariable (NULL, 
(UINT16)BootOption.OptionNumber, 0, &F2, NULL);+  
EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumber, 0, 
&CustomKey, NULL);//   // Also add Down key to Boot Manager Menu since some 
serial terminals don't support F2 key.@@ -251,12 +259,21 @@ 
PlatformBootManagerAfterConsole (
   //   PlatformRegisterFvBootOption (PcdGetPtr (PcdShellFile), L"UEFI Shell", 
LOAD_OPTION_ACTIVE); -  Print (-L"\n"-L"F2 or Down  to enter Boot 
Manager Menu.\n"-L"ENTER   to boot directly.\n"-L"\n"-);+  
if (FixedPcdGetBool (PcdBootManagerEscape) ) {+Print (+  L"\n"+  
L"Esc or Down  to enter Boot Manager Menu.\n"+  L"ENTER   to 
boot directly.\n"+  L"\n"+  );+  } else {+Print (+  L"\n"+  
L"F2 or Down  to enter Boot Manager Menu.\n"+  L"ENTER   to 
boot directly.\n"+  L"\n"+  );+  } }  /**diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 9c4a9da943..80390e0d98 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerL
+++ ib.inf
@@ -73,3 +73,4 @@
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity   
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits   
gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile+  
gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscapediff --git 
a/UefiPayloadPkg/UefiPayloadPkg.dec b/UefiPayloadPkg/UefiPayloadPkg.dec
index 551f0a4915..7246c3495b 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dec
+++ b/UefiPayloadPkg/UefiPayloadPkg.dec
@@ -83,6 +83,9 @@ 
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x0400|UINT32|0x
  gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80, 
0xab, 0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 0xd8, 0x95, 0x41 
}|VOID*|0x0018 +# Boot Manager 
Key+gUefiPayloadPkgTokenSpaceGuid.PcdBootManagerEscape|TRUE|BOOLEAN|0x0020+ 
## FFS filename to find the default variable initial data file. # @Prompt FFS 
Name of variable initial data file  
gUefiPayloadPkgTokenSpaceGuid.PcdNvsDataFile |{ 0x1a, 0xf1, 0xb1, 0xae, 0x42, 
0xcc, 0xcf, 0x4e, 0xac, 0x60, 0xdb, 0xab, 0xf6, 0xca, 0x69, 0xe6 
}|VOID*|0x0025diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 1ce96a51c1..3d7c7a6baf 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -33,6 +33,8 @@
   DEFINE UNIVERSAL_PAYLOAD= FALSE   DEFINE SECURITY_STUB_ENABLE
 = TRUE   DEFINE SMM_SUPPORT 

Re: [edk2-devel] [PATCH 1/1] UefiPayloadPkg/PayloadLoaderPeim: Replace Delta type INTN with UINTN

2022-02-01 Thread Guo Dong


Reviewed-by: Guo Dong 

-Original Message-
From: Jiang, Guomin  
Sent: Saturday, January 29, 2022 1:31 AM
To: devel@edk2.groups.io
Cc: Dong, Guo ; Ni, Ray ; Ma, Maurice 
; You, Benjamin 
Subject: [PATCH 1/1] UefiPayloadPkg/PayloadLoaderPeim: Replace Delta type INTN 
with UINTN

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

ProcessRelocation64 use INTN  Delta. However it force it to UINTN when call it.

It will have some potential issue when memory larger than 2G because the high 
memory address will be fill with 0x if use INTN.

Cc: Guo Dong 
Cc: Ray Ni 
Cc: Maurice Ma 
Cc: Benjamin You 
Signed-off-by: Guomin Jiang 
---
 UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c 
b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
index dc47a05c6e4a..ee530322d7ed 100644
--- a/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
+++ b/UefiPayloadPkg/PayloadLoaderPeim/ElfLib/Elf64Lib.c
@@ -108,7 +108,7 @@ ProcessRelocation64 (
   IN  UINT64  RelaSize,
   IN  UINT64  RelaEntrySize,
   IN  UINT64  RelaType,
-  IN  INTNDelta,
+  IN  UINTN   Delta,
   IN  BOOLEAN DynamicLinking
   )
 {
--
2.30.0.windows.2



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




Re: [edk2-devel] [PATCH 43/43] UefiPayloadPkg: Provide option to use Boot Splash

2022-02-01 Thread Guo Dong


Please help add some comments in the commit message on this patch.
And please don't build module LogoDxe when  BOOTSPLASH_IMAGE is FALSE.

Thanks,
Guo

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Sean Rhodes
Sent: Monday, January 31, 2022 1:43 PM
To: devel@edk2.groups.io
Cc: Rhodes, Sean 
Subject: [edk2-devel] [PATCH 43/43] UefiPayloadPkg: Provide option to use Boot 
Splash

Signed-off-by: Sean Rhodes 
---
 .../Library/PlatformBootManagerLib/PlatformBootManager.c | 5 +
 .../PlatformBootManagerLib/PlatformBootManagerLib.inf| 2 ++
 UefiPayloadPkg/UefiPayloadPkg.dec| 3 +++
 UefiPayloadPkg/UefiPayloadPkg.dsc| 5 +
 UefiPayloadPkg/UefiPayloadPkg.fdf| 1 +
 5 files changed, 16 insertions(+)

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
index a8ead775ea..a938144156 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c
@@ -243,6 +243,11 @@ PlatformBootManagerAfterConsole (
   Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;

   White.Blue = White.Green = White.Red = White.Reserved = 0xFF;

 

+  if (FixedPcdGetBool (PcdBootSplashImage) ) {

+gST->ConOut->ClearScreen (gST->ConOut);

+BootLogoEnableLogo ();

+  };

+

   EfiBootManagerConnectAll ();

   EfiBootManagerRefreshAllBootOption ();

 

diff --git 
a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 
b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
index 9c4a9da943..306bd33b7a 100644
--- a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+++ b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
@@ -39,6 +39,7 @@
   UefiRuntimeServicesTableLib

   UefiLib

   UefiBootManagerLib

+  BootLogoLib

   PcdLib

   DxeServicesLib

   MemoryAllocationLib

@@ -73,3 +74,4 @@
   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity

   gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits

   gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile

+  gUefiPayloadPkgTokenSpaceGuid.PcdBootSplashImage

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dec 
b/UefiPayloadPkg/UefiPayloadPkg.dec
index 551f0a4915..4f5756d575 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dec
+++ b/UefiPayloadPkg/UefiPayloadPkg.dec
@@ -83,6 +83,9 @@ 
gUefiPayloadPkgTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x0400|UINT32|0x
 

 gUefiPayloadPkgTokenSpaceGuid.PcdPcdDriverFile|{ 0x57, 0x72, 0xcf, 0x80, 0xab, 
0x87, 0xf9, 0x47, 0xa3, 0xfe, 0xD5, 0x0B, 0x76, 0xd8, 0x95, 0x41 
}|VOID*|0x0018

 

+# BootSplash Image

+gUefiPayloadPkgTokenSpaceGuid.PcdBootSplashImage|TRUE|BOOLEAN|0x0021

+

 ## FFS filename to find the default variable initial data file.

 # @Prompt FFS Name of variable initial data file

  gUefiPayloadPkgTokenSpaceGuid.PcdNvsDataFile |{ 0x1a, 0xf1, 0xb1, 0xae, 0x42, 
0xcc, 0xcf, 0x4e, 0xac, 0x60, 0xdb, 0xab, 0xf6, 0xca, 0x69, 0xe6 
}|VOID*|0x0025

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index 1ce96a51c1..9fd18d8ee0 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -33,6 +33,7 @@
   DEFINE UNIVERSAL_PAYLOAD= FALSE

   DEFINE SECURITY_STUB_ENABLE = TRUE

   DEFINE SMM_SUPPORT  = FALSE

+  DEFINE BOOTSPLASH_IMAGE = FALSE

   #

   # SBL:  UEFI payload for Slim Bootloader

   # COREBOOT: UEFI payload for coreboot

@@ -209,6 +210,7 @@
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf

   
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf

   
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf

+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf

   
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf

   
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf

 

@@ -399,6 +401,8 @@
   gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask   | 0x1

 !endif

 

+  gUefiPayloadPkgTokenSpaceGuid.PcdBootSplashImage|$(BOOTSPLASH_IMAGE)

+

 [PcdsPatchableInModule.X64]

   gPcAtChipsetPkgTokenSpaceGuid.PcdRtcIndexRegister|$(RTC_INDEX_REGISTER)

   gPcAtChipsetPkgTokenSpaceGuid.PcdRtcTargetRegister|$(RTC_TARGET_REGISTER)

@@ -545,6 +549,7 @@
 !endif

   UefiCpuPkg/CpuDxe/CpuDxe.inf

   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf

+  MdeModulePkg/Logo/LogoDxe.inf

   MdeModulePkg/Application/UiApp/UiApp.inf {

 

   NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf

diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index c7b04978ad..2c75f51f7a 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/

Re: [edk2-devel] [edk2-platforms PATCH] Platform/RaspberryPi: Add 'clock-frequency' property for miniuart

2022-02-01 Thread Adrien Thierry
> Hmm, I've had that problem a couple times too with these postings,
> although it usually appeared to be something groups.io was doing because
> direct cc's to myself were correct. I've got a little script to remove
> the double lines, which is what I ran this through before git am'ing it.

Thanks Ard and Jeremy! I think I might have found the reason for those
blank lines [1]

I will send a v2 that hopefully fixes this.

[1] https://edk2.groups.io/g/devel/topic/66206907#51715

Adrien



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




Re: [edk2-devel] [PATCH 2/6] uefi-sct/SctPkg: TCG2 Protocol: add GetCapability Test

2022-02-01 Thread Stuart Yoder

See inline comments...


+EFI_STATUS
+BBTestGetCapabilityConformanceTestCheckpoint2 (
+  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL*StandardLib,
+  IN EFI_TCG2_PROTOCOL *TCG2
+  )
+{
+  EFI_TEST_ASSERTIONAssertionType;
+  EFI_STATUSStatus;
+  char StructureVersionMajor;
+  char StructureVersionMinor;
+  char ProtocolVersionMajor;
+  char ProtocolVersionMinor;
+
+  EFI_TCG2_BOOT_SERVICE_CAPABILITY  BootServiceCap;
+  BootServiceCap.Size = sizeof(UINT8) + (sizeof(EFI_TCG2_VERSION) * 2);
+
+  Status = TCG2->GetCapability (
+   TCG2,
+   &BootServiceCap);
+
+  AssertionType = EFI_TEST_ASSERTION_PASSED;
+
+  // If the input ProtocolCapability.Size < 
sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY) the function should return 
EFI_BUFFER_TOO_SMALL
+  if (Status != EFI_BUFFER_TOO_SMALL) {
+ StandardLib->RecordMessage (

+ StandardLib,

+ EFI_VERBOSE_LEVEL_DEFAULT,

+ L"\r\nTCG2 Protocol GetCapablity Test: Did not return Status == 
EFI_BUFFER_TOO_SMALL with input ProtocolCapability.Size < 
sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY)"
+ );
+
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+  }
+
+  StructureVersionMajor = BootServiceCap.StructureVersion.Major;
+  StructureVersionMinor = BootServiceCap.StructureVersion.Minor;
+
+  // If the input ProtocolCapability.Size < 
sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY) the function will initialize the fields 
included in ProtocolCapability.Size.
+  if ((StructureVersionMajor != 1) | (StructureVersionMinor != 1)) {
+ StandardLib->RecordMessage (

+ StandardLib,

+ EFI_VERBOSE_LEVEL_DEFAULT,

+ L"\r\nTCG2 Protocol GetCapablity Test: Unexpected struct 
version numbers returned"
+ );
+
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+  }
+
+  ProtocolVersionMajor = BootServiceCap.ProtocolVersion.Major;
+  ProtocolVersionMinor = BootServiceCap.ProtocolVersion.Minor;
+
+  if ((ProtocolVersionMajor != 1) | (ProtocolVersionMinor != 1)) {
+ StandardLib->RecordMessage (

+ StandardLib,

+ EFI_VERBOSE_LEVEL_DEFAULT,

+ L"\r\nTCG2 Protocol GetCapablity Test: Unexpected protocol 
version numbers returned."
+ );
+
+ AssertionType = EFI_TEST_ASSERTION_FAILED;
+  }
+
+  StandardLib->RecordAssertion (
+ StandardLib,
+ AssertionType,
+ gTcg2ConformanceTestAssertionGuid002,
+ L"TCG2_PROTOCOL.GetCapability() - GetCapability() shall populate 
the included structure elements and return with a Status of EFI_BUFFER_TOO_SMALL when 
structure size is set to less than the size of EFI_TCG_BOOT_SERVICE_CAPABILITY.",
+ L"%a:%d: Status - %r",
+ __FILE__,
+ (UINTN)__LINE__,
+ Status
+ );


In the SCT spec draft there is a test:

  f. Verify returned Size equal to size of the
  EFI_TCG2_BOOT_SERVICE_CAPABILITY up to and including the vendor ID
  field.

...but I don't see that test covered in the code.


+  return EFI_SUCCESS;
+}
+
+EFI_STATUS
+BBTestGetCapabilityConformanceTestCheckpoint3 (
+  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL*StandardLib,
+  IN EFI_TCG2_PROTOCOL *TCG2
+  )
+{
+  EFI_TEST_ASSERTIONAssertionType;
+  EFI_STATUSStatus;
+  char StructureVersionMajor;
+  char StructureVersionMinor;
+  char ProtocolVersionMajor;
+  char ProtocolVersionMinor;
+  EFI_TCG2_BOOT_SERVICE_CAPABILITY  BootServiceCap;
+
+  BootServiceCap.Size = sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY);


BootServiceCap.Size is not used in this test, so should be able to 
delete the above line.



+  Status = TCG2->GetCapability (
+   TCG2,
+   &BootServiceCap);
+
+  AssertionType = EFI_TEST_ASSERTION_PASSED;
+
+  if (Status != EFI_SUCCESS) {
+StandardLib->RecordMessage (

+ StandardLib,

+ EFI_VERBOSE_LEVEL_DEFAULT,

+ L"\r\nTCG2 Protocol GetCapablity Test: GetCapabilty should 
return EFI_SUCCESS"
+ );
+
+AssertionType = EFI_TEST_ASSERTION_FAILED;
+  }
+
+  StructureVersionMajor = BootServiceCap.StructureVersion.Major;
+  StructureVersionMinor = BootServiceCap.StructureVersion.Minor;
+
+  // TCG EFI Protocol spec 6.4.4 #4
+  if ((StructureVersionMajor != 1) | (StructureVersionMinor != 1)) {
+StandardLib->RecordMessage (

+ StandardLib,

+ EFI_VERBOSE_LEVEL_DEFAULT,

+ L"\r\nTCG2 Protocol GetCapablity Test: GetCapabilty should 
have StructureVersion 1.1"
+ );
+
+AssertionType = EFI_TEST_ASSERTION_FAILED;
+  }
+
+  ProtocolVersionMajor 

Re: [edk2-devel] [PATCH v5 0/9] Add ACPI support for Kvmtool

2022-02-01 Thread Ard Biesheuvel
On Tue, 1 Feb 2022 at 18:23,  wrote:
>
> From: Pierre Gondois 
>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3742
> V1: https://edk2.groups.io/g/devel/message/76990
> V2:
> - New patch: "DynamicTablesPkg: Print specifier macro for
>   CM_OBJECT_ID" [Laszlo]
> - Only add AcpiView for ArmVirtKvmTool instead of all ArmVirt
>   platforms. This is done using a 'ACPIVIEW_ENABLE' switch.
>   [Laszlo]
> - Only generate ACPI tables for AARCH64. [Laszlo]
> - Various modifications (error handling, patch organization,
>   coding style, etc). [Laszlo]
> V3:
> - To fix bugs reported by Linux (signaled by Ard):
>   - Add patch to parse and populate PMU information.
>   - Add patch to strictly comply to the first model at ACPI
> 6.4 s6.2.13 to describe PCI legacy interrupts using _PRT.
>   - Add address size limit to IORT PCI root complex.
> V4:
> - Describe PCI legacy interrupts using GSI and remove link
>   device generation. [Pierre]
> - Add more description in ASSERT macros. [Ard]
> V5:
> - Update DSDT revision to 2. [Rebecca]
>
> The changes can be seen at:
> https://github.com/PierreARM/edk2/tree/1456_Add_ACPI_support_for_Kvmtool_v5
> The results of the CI can be seen at:
> https://github.com/tianocore/edk2/pull/2476
>

Merged as #2477

Thanks!

Btw, my patch 'ArmVirtPkg/ArmVirtMemoryInitPeiLib: avoid redundant
cache invalidation' reduces the startup time of the firmware
substantially when running on an actual KVM host.


> The patch depends on the KvmTool patch at:
> https://lists.cs.columbia.edu/pipermail/kvmarm/2022-January/051865.html
>
> Kvmtool dynamically generates a device tree describing the platform
> to boot on. Using the patch-sets listed below, the DynamicTables
> framework generates ACPI tables describing a similar platform.
>
> This patch-set:
>  - adds a ConfigurationManager and make use of the DynamicTablesPkg
>in for Kvmtool for AARCH64, allowing to generate ACPI tables
>  - adds the acpiview command line utility to the ArmVirtPkg
>platform that request if via the ACPIVIEW_ENABLE macro
>  - update ArmVirtPkg.ci.yaml to add new words and use the
>DynamicTablesPkg
>  - adds a print specifier macro for the CM_OBJECT_ID type
>
> With this patchset, KvmTool on AARCH64 will use ACPI tables instead
> of a Device Tree (cf PcdForceNoAcpi Pcd).
>
> Pierre Gondois (5):
>   DynamicTablesPkg: Print specifier macro for CM_OBJECT_ID
>   DynamicTablesPkg: FdtHwInfoParserLib: Parse Pmu info
>   DynamicTablesPkg: AmlLib: AmlAddPrtEntry() to handle GSI
>   DynamicTablesPkg: AcpiSsdtPcieLibArm: Remove link device generation
>   ArmVirtPkg: Add cspell exceptions
>
> Sami Mujawar (4):
>   ArmVirtPkg/Kvmtool: Add DSDT ACPI table
>   ArmVirtPkg/Kvmtool: Add Configuration Manager
>   ArmVirtPkg/Kvmtool: Enable ACPI support
>   ArmVirtPkg/Kvmtool: Enable Acpiview
>
>  ArmVirtPkg/ArmVirt.dsc.inc|5 +-
>  ArmVirtPkg/ArmVirtKvmTool.dsc |   22 +-
>  ArmVirtPkg/ArmVirtKvmTool.fdf |   15 +-
>  ArmVirtPkg/ArmVirtPkg.ci.yaml |6 +-
>  .../KvmtoolCfgMgrDxe/AslTables/Dsdt.asl   |   21 +
>  .../KvmtoolCfgMgrDxe/ConfigurationManager.c   | 1065 +
>  .../KvmtoolCfgMgrDxe/ConfigurationManager.h   |  125 ++
>  .../ConfigurationManagerDxe.inf   |   54 +
>  .../Include/ConfigurationManagerObject.h  |7 +-
>  .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c|  239 +---
>  .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.h|   64 +-
>  .../Common/AmlLib/CodeGen/AmlCodeGen.c|   89 +-
>  .../FdtHwInfoParserLib/Gic/ArmGicCParser.c|  132 +-
>  .../FdtHwInfoParserLib/Gic/ArmGicCParser.h|8 +-
>  14 files changed, 1518 insertions(+), 334 deletions(-)
>  create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/AslTables/Dsdt.asl
>  create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c
>  create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.h
>  create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf
>
> --
> 2.25.1
>


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




[edk2-devel] [PATCH] ArmVirtPkg/ArmVirtKvmTool: wire up configurable timeout

2022-02-01 Thread Ard Biesheuvel
Use the correct PCD type for PcdPlatformBootTimeOut so it gets wired up
to the Timeout EFI variable automatically, which is how the boot manager
stores the timeout preference.

Signed-off-by: Ard Biesheuvel 
---
 ArmVirtPkg/ArmVirtKvmTool.dsc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc
index a1bf4b9be87b..3bd3ebd6e0b3 100644
--- a/ArmVirtPkg/ArmVirtKvmTool.dsc
+++ b/ArmVirtPkg/ArmVirtKvmTool.dsc
@@ -170,9 +170,10 @@ [PcdsPatchableInModule.common]
 
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x0
 
+[PcdsDynamicHii]
+  
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|5
+
 [PcdsDynamicDefault.common]
-  gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|3
-
   gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum|0x0
   gArmTokenSpaceGuid.PcdArmArchTimerIntrNum|0x0
   gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum|0x0
-- 
2.30.2



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




[edk2-devel] [PATCH v5 9/9] ArmVirtPkg/Kvmtool: Enable Acpiview

2022-02-01 Thread PierreGondois
From: Sami Mujawar 

Acpiview is a command line tool allowing to display, dump, or check
installed ACPI tables. Add a 'ACPIVIEW_ENABLE' switch to enable it
on an ArmVirt platform.

The switch is set for the ArmVirtKvmTool platform.

Signed-off-by: Sami Mujawar 
Signed-off-by: Pierre Gondois 
Acked-by: Laszlo Ersek 
---

Notes:
v2:
- Only add AcpiView for ArmVirtKvmTool instead of all
  ArmVirt platforms. This is done using a
  'ACPIVIEW_ENABLE' switch. [Laszlo]

 ArmVirtPkg/ArmVirt.dsc.inc| 5 -
 ArmVirtPkg/ArmVirtKvmTool.dsc | 5 -
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 4db8ad5a7999..ba711deac025 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
+#  Copyright (c) 2011 - 2022, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
 #  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
 #  Copyright (c) Microsoft Corporation.
@@ -397,6 +397,9 @@ [Components.common]
   
NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
+!if $(ACPIVIEW_ENABLE) == TRUE
+  
NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
+!endif
   
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
 !if $(NETWORK_IP6_ENABLE) == TRUE
diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc
index 4b6090ab6075..a1bf4b9be87b 100644
--- a/ArmVirtPkg/ArmVirtKvmTool.dsc
+++ b/ArmVirtPkg/ArmVirtKvmTool.dsc
@@ -1,7 +1,7 @@
 #  @file
 #  Workspace file for KVMTool virtual platform.
 #
-#  Copyright (c) 2018 - 2021, ARM Limited. All rights reserved.
+#  Copyright (c) 2018 - 2022, ARM Limited. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -27,6 +27,9 @@ [Defines]
   SKUID_IDENTIFIER   = DEFAULT
   FLASH_DEFINITION   = ArmVirtPkg/ArmVirtKvmTool.fdf
 
+[Defines.AARCH64]
+  DEFINE ACPIVIEW_ENABLE = TRUE
+
 !include ArmVirtPkg/ArmVirt.dsc.inc
 
 !if $(ARCH) == AARCH64
-- 
2.25.1



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




[edk2-devel] [PATCH v5 8/9] ArmVirtPkg/Kvmtool: Enable ACPI support

2022-02-01 Thread PierreGondois
From: Sami Mujawar 

A Configuration Manager that uses the Dynamic Tables framework
to generate ACPI tables for Kvmtool Guests has been provided.
This Configuration Manager uses the FdtHwInfoParser module to
parse the Kvmtool Device Tree and generate the required
Configuration Manager objects for generating the ACPI tables.

Therefore, enable ACPI table generation for Kvmtool.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3742
Signed-off-by: Sami Mujawar 
Signed-off-by: Pierre Gondois 
---

Notes:
v2:
- Remove Pcds that are redefined to their default value,
  and modules already included in ArmVirtPkg/ArmVirt.dsc.inc
  [Laszlo]
- Use guards as '!if $(ARCH) == AARCH64' to conditionnaly
  generate ACPI tables. This allows to prevent the 32bits
  ARM/ACPI combination without restricting the DynamicTablesPkg
  to AARCH64. This means that KvmTool on ARM will use the DT.
  Not adding Laszlo's Acked-by since this is not exactly what
  was suggested. [Laszlo/Pierre]

 ArmVirtPkg/ArmVirtKvmTool.dsc | 17 ++---
 ArmVirtPkg/ArmVirtKvmTool.fdf | 15 ++-
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc
index 4a54d13735e9..4b6090ab6075 100644
--- a/ArmVirtPkg/ArmVirtKvmTool.dsc
+++ b/ArmVirtPkg/ArmVirtKvmTool.dsc
@@ -29,6 +29,10 @@ [Defines]
 
 !include ArmVirtPkg/ArmVirt.dsc.inc
 
+!if $(ARCH) == AARCH64
+!include DynamicTablesPkg/DynamicTables.dsc.inc
+!endif
+
 !include MdePkg/MdeLibs.dsc.inc
 
 [LibraryClasses.common]
@@ -71,6 +75,9 @@ [LibraryClasses.common]
   
PlatformHookLib|ArmVirtPkg/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.inf
   
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
 
+  
HwInfoParserLib|DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib.inf
+  
DynamicPlatRepoLib|DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoLib.inf
+
 [LibraryClasses.common.SEC, LibraryClasses.common.PEI_CORE, 
LibraryClasses.common.PEIM]
   PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
   
PlatformHookLib|ArmVirtPkg/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.inf
@@ -195,9 +202,6 @@ [PcdsDynamicDefault.common]
   gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640
   gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480
 
-  ## Force DTB
-  gArmVirtTokenSpaceGuid.PcdForceNoAcpi|TRUE
-
   # Setup Flash storage variables
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x4
@@ -353,3 +357,10 @@ [Components.common]
   }
   OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
   OvmfPkg/Virtio10Dxe/Virtio10.inf
+
+!if $(ARCH) == AARCH64
+  #
+  # ACPI Support
+  #
+  ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf
+!endif
diff --git a/ArmVirtPkg/ArmVirtKvmTool.fdf b/ArmVirtPkg/ArmVirtKvmTool.fdf
index 14a5fce43a09..9e006e83ee5c 100644
--- a/ArmVirtPkg/ArmVirtKvmTool.fdf
+++ b/ArmVirtPkg/ArmVirtKvmTool.fdf
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2018 - 2021, ARM Limited. All rights reserved.
+#  Copyright (c) 2018 - 2022, ARM Limited. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -201,6 +201,19 @@ [FV.FvMain]
   INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
   INF OvmfPkg/Virtio10Dxe/Virtio10.inf
 
+!if $(ARCH) == AARCH64
+  #
+  # ACPI Support
+  #
+  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+  #
+  # Dynamic Table fdf
+  #
+  !include DynamicTablesPkg/DynamicTables.fdf.inc
+
+  INF ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf
+!endif
+
   #
   # TianoCore logo (splash screen)
   #
-- 
2.25.1



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




[edk2-devel] [PATCH v5 7/9] ArmVirtPkg/Kvmtool: Add Configuration Manager

2022-02-01 Thread PierreGondois
From: Sami Mujawar 

Add Configuration Manager to enable ACPI tables for Kvmtool
firmware. The Configuration Manager for Kvmtool uses the DT
Hardware Information Parser module (FdtHwInfoParser) to parse
the DT provided by Kvmtool. The FdtHwInfoParser parses the DT
and invokes the callback function HW_INFO_ADD_OBJECT to add
the Configuration Manager objects to the Platform Information
repository.

The information for some Configuration Manager objects may not
be available in the DT. Such objects are initialised locally
by the Configuration Manager.

Support for the following ACPI tables is provided:
 - DBG2
 - DSDT (Empty stub)
 - FADT
 - GTDT
 - MADT
 - SPCR
 - SSDT (Cpu Hierarchy)
 - SSDT (Pcie bus)

Signed-off-by: Sami Mujawar 
Signed-off-by: Pierre Gondois 
Acked-by: Laszlo Ersek 
---

Notes:
v2:
- Only keep AARCH64 as a valid architecture. [Laszlo]
- Move modifications to ArmVirtKvmTool.dsc to the next
  patch. [Laszlo]
- Various coding style/error handling/ASSERT corrections.
  [Laszlo]
- Remove dependency to PcdForceNoAcpi and rely on DEPEX
  to load the module. [Laszlo]
- Not possible to make 'struct PlatformRepositoryInfo'
  an unamed struct since this is a redifinition.
  [Laszlo/Pierre]
- Define 'FMT_CM_OBJECT_ID' print formatter in an earlier
  patch and use it in this patch. [Laszlo/Pierre]

v3:
- Add address size limit for IORT PCI root complex. [Pierre]

 .../KvmtoolCfgMgrDxe/ConfigurationManager.c   | 1065 +
 .../KvmtoolCfgMgrDxe/ConfigurationManager.h   |  125 ++
 .../ConfigurationManagerDxe.inf   |   54 +
 3 files changed, 1244 insertions(+)
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.h
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf

diff --git a/ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c 
b/ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c
new file mode 100644
index ..e8c1b13c8f2c
--- /dev/null
+++ b/ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c
@@ -0,0 +1,1065 @@
+/** @file
+  Configuration Manager Dxe
+
+  Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Glossary:
+- Cm or CM   - Configuration Manager
+- Obj or OBJ - Object
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "ConfigurationManager.h"
+
+//
+// The platform configuration repository information.
+//
+STATIC
+EDKII_PLATFORM_REPOSITORY_INFO  mKvmtoolPlatRepositoryInfo = {
+  //
+  // Configuration Manager information
+  //
+  { CONFIGURATION_MANAGER_REVISION, CFG_MGR_OEM_ID },
+
+  //
+  // ACPI Table List
+  //
+  {
+//
+// FADT Table
+//
+{
+  EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt),
+  NULL
+},
+//
+// GTDT Table
+//
+{
+  EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdGtdt),
+  NULL
+},
+//
+// MADT Table
+//
+{
+  EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMadt),
+  NULL
+},
+//
+// SPCR Table
+//
+{
+  EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,
+  EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION,
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSpcr),
+  NULL
+},
+//
+// DSDT Table
+//
+{
+  EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
+  0, // Unused
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdDsdt),
+  (EFI_ACPI_DESCRIPTION_HEADER *)dsdt_aml_code
+},
+//
+// SSDT Cpu Hierarchy Table
+//
+{
+  EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
+  0, // Unused
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtCpuTopology),
+  NULL
+},
+//
+// DBG2 Table
+//
+{
+  EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE,
+  EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION,
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdDbg2),
+  NULL
+},
+//
+// PCI MCFG Table
+//
+{
+  
EFI_ACPI_6_3_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION,
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMcfg),
+  NULL
+},
+//
+// SSDT table describing the PCI root complex
+//
+{
+  EFI_ACPI_6

[edk2-devel] [PATCH v5 6/9] ArmVirtPkg/Kvmtool: Add DSDT ACPI table

2022-02-01 Thread PierreGondois
From: Sami Mujawar 

Most ACPI tables for Kvmtool firmware are dynamically
generated. The AML code is also generated at runtime
for most components in appropriate SSDTs.

Although there may not be much to describe in the DSDT,
the DSDT table is mandatory.

Therefore, add an empty stub for DSDT.

Signed-off-by: Sami Mujawar 
Signed-off-by: Pierre Gondois 
Reviewed-by: Laszlo Ersek 
---

Notes:
v2:
 - Coding style modifications. [Laszlo]
v5:
 - Update DSDT table revision to 2. [Rebecca]

 .../KvmtoolCfgMgrDxe/AslTables/Dsdt.asl   | 21 +++
 1 file changed, 21 insertions(+)
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/AslTables/Dsdt.asl

diff --git a/ArmVirtPkg/KvmtoolCfgMgrDxe/AslTables/Dsdt.asl 
b/ArmVirtPkg/KvmtoolCfgMgrDxe/AslTables/Dsdt.asl
new file mode 100644
index ..13d1e1d8d6bd
--- /dev/null
+++ b/ArmVirtPkg/KvmtoolCfgMgrDxe/AslTables/Dsdt.asl
@@ -0,0 +1,21 @@
+/** @file
+  Differentiated System Description Table Fields (DSDT)
+
+  Copyright (c) 2021 - 2022, ARM Ltd. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+DefinitionBlock ("DsdtTable.aml", "DSDT", 2, "ARMLTD", "ARM-KVMT", 1) {
+  Scope (_SB) {
+//
+// Most ACPI tables for Kvmtool firmware are
+// dynamically generated. The AML code is also
+// generated at runtime for most components in
+// appropriate SSDTs.
+// Although there may not be much to describe
+// in the DSDT, the DSDT table is mandatory.
+// Therefore, add an empty stub for DSDT.
+//
+  } // Scope (_SB)
+}
-- 
2.25.1



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




[edk2-devel] [PATCH v5 5/9] ArmVirtPkg: Add cspell exceptions

2022-02-01 Thread PierreGondois
From: Pierre Gondois 

The cpsell tool checks for unknown words in the upstream CI.
Add some new words to the list of exceptions.

Signed-off-by: Pierre Gondois 
---

Notes:
v2:
- Adding 'acpiview'. Since the patch change, Laszlo's
  Reviewed-by is not added. [Pierre]

 ArmVirtPkg/ArmVirtPkg.ci.yaml | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ArmVirtPkg/ArmVirtPkg.ci.yaml b/ArmVirtPkg/ArmVirtPkg.ci.yaml
index 67b0e9594f3e..d5d63ddd4fd7 100644
--- a/ArmVirtPkg/ArmVirtPkg.ci.yaml
+++ b/ArmVirtPkg/ArmVirtPkg.ci.yaml
@@ -6,7 +6,7 @@
 #
 # Copyright (c) Microsoft Corporation
 # Copyright (c) 2020, Intel Corporation. All rights reserved.
-# Copyright (c) 2020, ARM Limited. All rights reserved.
+# Copyright (c) 2020 - 2022, ARM Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
@@ -48,6 +48,7 @@
 "MdePkg/MdePkg.dec",
 "MdeModulePkg/MdeModulePkg.dec",
 "ArmVirtPkg/ArmVirtPkg.dec",
+"DynamicTablesPkg/DynamicTablesPkg.dec",
 "NetworkPkg/NetworkPkg.dec",
 "ArmPkg/ArmPkg.dec",
 "OvmfPkg/OvmfPkg.dec",
@@ -98,6 +99,9 @@
 "AuditOnly": False,   # Fails right now with over 270 errors
 "IgnoreFiles": [],   # use gitignore syntax to ignore errors 
in matching files
 "ExtendWords": [
+"acpiview",
+"armltd",
+"ssdts",
 "setjump",
 "plong",
 "lparam",
-- 
2.25.1



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




[edk2-devel] [PATCH v5 4/9] DynamicTablesPkg: AcpiSsdtPcieLibArm: Remove link device generation

2022-02-01 Thread PierreGondois
From: Pierre Gondois 

In ACPI 6.4, s6.2.13, _PRT objects describing PCI legacy interrupts
can be defined following 2 models.
In the first model, _PRT entries reference link devices. Link devices
then describe interrupts. This allows to dynamically modify
interrupts through _SRS and _PRS objects and to choose exactly the
interrupt type (level/edge triggered, active high/low).
In the second model, interrupt numbder are described in the _PRT entry.
The interrupt type is then assumed by the OS.

The Arm BSA, sE.6 "Legacy interrupts" states that PCI legacy
interrupts must be converted to SPIs, and programmed level-sensitive,
active high. Thus any OS must configure interrupts as such and there
is no need to specify the interrupt type.
Plus it is not possible to dynamically configure PCI interrupts.

Thus remove the link device generation and use the second model
for _PRT.

Suggested-by: Ard Biesheuvel 
Signed-off-by: Pierre Gondois 
---

Notes:
v4:
 - New patch. [Ard]

 .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c| 239 +-
 .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.h|  64 +
 2 files changed, 15 insertions(+), 288 deletions(-)

diff --git 
a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
index 3e22587d4a25..a34018151f2d 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
@@ -1,7 +1,7 @@
 /** @file
   SSDT Pcie Table Generator.
 
-  Copyright (c) 2021, Arm Limited. All rights reserved.
+  Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -12,6 +12,7 @@
- s6.1.1 "_ADR (Address)"
   - linux kernel code
   - Arm Base Boot Requirements v1.0
+  - Arm Base System Architecture v1.0
 **/
 
 #include 
@@ -279,171 +280,6 @@ GeneratePciDeviceInfo (
   return Status;
 }
 
-/** Generate a Link device.
-
-  The Link device is added at the beginning of the ASL Pci device definition.
-
-  Each Link device represents a Pci legacy interrupt (INTA-...-INTD).
-
-  ASL code:
-  Device () {
-Name (_UID, ])
-Name (_HID, EISAID ("PNP0C0F"))
-Name (CRS0, ResourceTemplate () {
-  Interrupt (ResourceProducer, Level, ActiveHigh, Exclusive) { ] }
-  })
-Method (_CRS, 0) {
-  Return CRS0
-  })
-Method (_DIS) { }
-  }
-
-  The list of objects to define is available at:
-  PCI Firmware Specification - Revision 3.3,
-  s3.5. "Device State at Firmware/Operating System Handoff"
-
-  The _PRS and _SRS are not supported, cf Arm Base Boot Requirements v1.0:
-  "The _PRS (Possible Resource Settings) and _SRS (Set Resource Settings)
-  are not supported."
-
-  @param [in]   Irq Interrupt controller interrupt.
-  @param [in]   IrqFlagsInterrupt flags.
-  @param [in]   LinkIndex   Legacy Pci interrupt index.
-Must be between 0-INTA and 3-INTD.
-  @param [in, out]  PciNode Pci node to amend.
-
-  @retval EFI_SUCCESSSuccess.
-  @retval EFI_INVALID_PARAMETER  Invalid parameter.
-  @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory.
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-GenerateLinkDevice (
-  IN  UINT32  Irq,
-  IN  UINT32  IrqFlags,
-  IN  UINT32  LinkIndex,
-  IN  OUT AML_OBJECT_NODE_HANDLE  PciNode
-  )
-{
-  EFI_STATUS  Status;
-  CHAR8   AslName[AML_NAME_SEG_SIZE + 1];
-  AML_OBJECT_NODE_HANDLE  LinkNode;
-  AML_OBJECT_NODE_HANDLE  CrsNode;
-  UINT32  EisaId;
-
-  ASSERT (LinkIndex < 4);
-  ASSERT (PciNode != NULL);
-
-  CopyMem (AslName, "LNKx", AML_NAME_SEG_SIZE + 1);
-  AslName[AML_NAME_SEG_SIZE - 1] = 'A' + LinkIndex;
-
-  // ASL: Device (LNKx) {}
-  Status = AmlCodeGenDevice (AslName, NULL, &LinkNode);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-return Status;
-  }
-
-  Status = AmlAttachNode (PciNode, LinkNode);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-// Failed to add.
-AmlDeleteTree ((AML_NODE_HANDLE)LinkNode);
-return Status;
-  }
-
-  // ASL: Name (_UID, )
-  Status = AmlCodeGenNameInteger ("_UID", LinkIndex, LinkNode, NULL);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-return Status;
-  }
-
-  // ASL: Name (_HID, EISAID ("PNP0C0F"))
-  Status = AmlGetEisaIdFromString ("PNP0C0F", &EisaId);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-return Status;
-  }
-
-  Status = AmlCodeGenNameInteger ("_HID", EisaId, LinkNode, NULL);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-return Status;
-  }
-
-  // ASL:
-  // Name (CRS0, ResourceTemplate () {
-  //   Interrupt (ResourceProducer, Level, ActiveHigh, Exclusive) {  }
-  // })
-  Status = AmlCodeGenNameResourceTemplate ("CRS0", LinkNode, &CrsNode);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-return Status;
-  }
-
-  Status = AmlCode

[edk2-devel] [PATCH v5 3/9] DynamicTablesPkg: AmlLib: AmlAddPrtEntry() to handle GSI

2022-02-01 Thread PierreGondois
From: Pierre Gondois 

In ACPI 6.4, s6.2.13, _PRT objects describing PCI legacy interrupts
can be defined following 2 models.
In the first model, _PRT entries reference link devices. Link devices
then describe interrupts. This allows to dynamically modify
interrupts through _SRS and _PRS objects and to choose exactly the
interrupt type (level/edge triggered, active high/low).
In the second model, interrupt numbers are described in the _PRT entry.
The interrupt type is then assumed by the OS.

AmlAddPrtEntry() currently only handles the first model. Make
changes to also handle the second model.

Signed-off-by: Pierre Gondois 
---

Notes:
v4:
 - New patch (to handle GSI description in _PRT). [Pierre]

 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 89 ---
 1 file changed, 55 insertions(+), 34 deletions(-)

diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c 
b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
index d245848ce3fa..2d55db97c7bf 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
@@ -1,7 +1,7 @@
 /** @file
   AML Code Generation.
 
-  Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.
+  Copyright (c) 2020 - 2022, Arm Limited. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
@@ -881,6 +881,9 @@ AmlCodeGenNameResourceTemplate (
// interrupt, so let it to index 0.
 }
 
+  The 2 models described in ACPI 6.4, s6.2.13 "_PRT (PCI Routing Table)" can
+  be generated by this function. The example above matches the first model.
+
   The package is added at the tail of the list of the input _PRT node
   name:
 Name (_PRT, Package () {
@@ -901,8 +904,10 @@ AmlCodeGenNameResourceTemplate (
   @param [in]  PinPCI pin number of the device (0-INTA ... 3-INTD).
   Must be between 0-3.
   @param [in]  LinkName   Link Name, i.e. device in the AML NameSpace
-  describing the interrupt used.
-  The input string is copied.
+  describing the interrupt used. The input string
+  is copied.
+  If NULL, generate 0 in the 'Source' field (cf.
+  second model, using GSIV).
   @param [in]  SourceIndexSource index or GSIV.
   @param [in]  PrtNameNodePrt Named node to add the object to 
 
@@ -930,7 +935,6 @@ AmlAddPrtEntry (
   AML_DATA_NODE  *DataNode;
 
   if ((Pin > 3) ||
-  (LinkName == NULL)||
   (PrtNameNode == NULL) ||
   (AmlGetNodeType ((AML_NODE_HANDLE)PrtNameNode) != EAmlNodeObject) ||
   (!AmlNodeHasOpCode (PrtNameNode, AML_NAME_OP, 0)) ||
@@ -999,41 +1003,58 @@ AmlAddPrtEntry (
 
   NewElementNode = NULL;
 
-  Status = ConvertAslNameToAmlName (LinkName, &AmlNameString);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-goto error_handler;
-  }
+  if (LinkName != NULL) {
+Status = ConvertAslNameToAmlName (LinkName, &AmlNameString);
+if (EFI_ERROR (Status)) {
+  ASSERT_EFI_ERROR (Status);
+  goto error_handler;
+}
 
-  Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-goto error_handler;
-  }
+Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize);
+if (EFI_ERROR (Status)) {
+  ASSERT_EFI_ERROR (Status);
+  goto error_handler;
+}
 
-  Status = AmlCreateDataNode (
- EAmlNodeDataTypeNameString,
- (UINT8 *)AmlNameString,
- AmlNameStringSize,
- &DataNode
- );
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-goto error_handler;
-  }
+Status = AmlCreateDataNode (
+   EAmlNodeDataTypeNameString,
+   (UINT8 *)AmlNameString,
+   AmlNameStringSize,
+   &DataNode
+   );
+if (EFI_ERROR (Status)) {
+  ASSERT_EFI_ERROR (Status);
+  goto error_handler;
+}
 
-  // AmlNameString will be freed before returning.
+// AmlNameString will be freed be fore returning.
 
-  Status = AmlVarListAddTail (
- (AML_NODE_HANDLE)PackageNode,
- (AML_NODE_HANDLE)DataNode
- );
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-goto error_handler;
-  }
+Status = AmlVarListAddTail (
+   (AML_NODE_HANDLE)PackageNode,
+   (AML_NODE_HANDLE)DataNode
+   );
+if (EFI_ERROR (Status)) {
+  ASSERT_EFI_ERROR (Status);
+  goto error_handler;
+}
+
+DataNode = NULL;
+  } else {
+Status = AmlCodeGenInteger (0, &NewElementNode);
+if (EFI_ERROR (Status)) {
+  ASSERT_EFI_ERROR (Status);
+  goto error_handler;
+}
 
-  DataNode = NULL;
+Status = AmlVarListAddTail (
+   (AML_NODE_HANDLE)PackageNode,
+

[edk2-devel] [PATCH v5 2/9] DynamicTablesPkg: FdtHwInfoParserLib: Parse Pmu info

2022-02-01 Thread PierreGondois
From: Pierre Gondois 

Parse the Pmu interrupts if a pmu compatible node is present,
and populate the MADT GicC structure accordingly.

Signed-off-by: Pierre Gondois 
---

Notes:
v3:
 - New patch. [Pierre]
v4:
 - Add more information in ASSERT () checks. [Ard]

 .../FdtHwInfoParserLib/Gic/ArmGicCParser.c| 132 +-
 .../FdtHwInfoParserLib/Gic/ArmGicCParser.h|   8 +-
 2 files changed, 136 insertions(+), 4 deletions(-)

diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c 
b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c
index b4e6729a4ab2..fb01aa0d19e2 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c
@@ -1,13 +1,14 @@
 /** @file
   Arm Gic cpu parser.
 
-  Copyright (c) 2021, ARM Limited. All rights reserved.
+  Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @par Reference(s):
   - linux/Documentation/devicetree/bindings/arm/cpus.yaml
   - linux/Documentation/devicetree/bindings/interrupt-controller/arm,gic.yaml
   - 
linux/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml
+  - linux/Documentation/devicetree/bindings/arm/pmu.yaml
 **/
 
 #include "FdtHwInfoParser.h"
@@ -34,6 +35,21 @@ STATIC CONST COMPATIBILITY_INFO  CpuCompatibleInfo = {
   CpuCompatibleStr
 };
 
+/** Pmu compatible strings.
+
+  Any other "compatible" value is not supported by this module.
+*/
+STATIC CONST COMPATIBILITY_STR  PmuCompatibleStr[] = {
+  { "arm,armv8-pmuv3" }
+};
+
+/** COMPATIBILITY_INFO structure for the PmuCompatibleStr.
+*/
+CONST COMPATIBILITY_INFO  PmuCompatibleInfo = {
+  ARRAY_SIZE (PmuCompatibleStr),
+  PmuCompatibleStr
+};
+
 /** Parse a "cpu" node.
 
   @param [in]  Fdt  Pointer to a Flattened Device Tree (Fdt).
@@ -639,6 +655,111 @@ GicCv3IntcNodeParser (
   return EFI_SUCCESS;
 }
 
+/** Parse a Pmu compatible node, extracting Pmu information.
+
+  This function modifies a CM_OBJ_DESCRIPTOR object.
+  The following CM_ARM_GICC_INFO fields are patched:
+- PerformanceInterruptGsiv;
+
+  @param [in]   Fdt  Pointer to a Flattened Device Tree (Fdt).
+  @param [in]   GicIntcNode  Offset of a Gic compatible
+ interrupt-controller node.
+  @param [in, out]  GicCCmObjDescThe CM_ARM_GICC_INFO to patch.
+
+  @retval EFI_SUCCESS The function completed successfully.
+  @retval EFI_ABORTED An error occurred.
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+GicCPmuNodeParser (
+  IN  CONST VOID   *Fdt,
+  ININT32  GicIntcNode,
+  IN  OUT   CM_OBJ_DESCRIPTOR  *GicCCmObjDesc
+  )
+{
+  EFI_STATUSStatus;
+  INT32 IntCells;
+  INT32 PmuNode;
+  UINT32PmuNodeCount;
+  UINT32PmuIrq;
+  UINT32Index;
+  CM_ARM_GICC_INFO  *GicCInfo;
+  CONST UINT8   *Data;
+  INT32 DataSize;
+
+  if (GicCCmObjDesc == NULL) {
+ASSERT (GicCCmObjDesc != NULL);
+return EFI_INVALID_PARAMETER;
+  }
+
+  GicCInfo = (CM_ARM_GICC_INFO *)GicCCmObjDesc->Data;
+  PmuNode  = 0;
+
+  // Count the number of pmu nodes.
+  Status = FdtCountCompatNodeInBranch (
+ Fdt,
+ 0,
+ &PmuCompatibleInfo,
+ &PmuNodeCount
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT_EFI_ERROR (Status);
+return Status;
+  }
+
+  if (PmuNodeCount == 0) {
+return EFI_NOT_FOUND;
+  }
+
+  Status = FdtGetNextCompatNodeInBranch (
+ Fdt,
+ 0,
+ &PmuCompatibleInfo,
+ &PmuNode
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT_EFI_ERROR (Status);
+if (Status == EFI_NOT_FOUND) {
+  // Should have found the node.
+  Status = EFI_ABORTED;
+}
+  }
+
+  // Get the number of cells used to encode an interrupt.
+  Status = FdtGetInterruptCellsInfo (Fdt, GicIntcNode, &IntCells);
+  if (EFI_ERROR (Status)) {
+ASSERT_EFI_ERROR (Status);
+return Status;
+  }
+
+  Data = fdt_getprop (Fdt, PmuNode, "interrupts", &DataSize);
+  if ((Data == NULL) || (DataSize != (IntCells * sizeof (UINT32 {
+// If error or not 1 interrupt.
+ASSERT (Data != NULL);
+ASSERT (DataSize == (IntCells * sizeof (UINT32)));
+return EFI_ABORTED;
+  }
+
+  PmuIrq = FdtGetInterruptId ((CONST UINT32 *)Data);
+
+  // Only supports PPI 23 for now.
+  // According to BSA 1.0 s3.6 PPI assignments, PMU IRQ ID is 23. A non BSA
+  // compliant system may assign a different IRQ for the PMU, however this
+  // is not implemented for now.
+  if (PmuIrq != BSA_PMU_IRQ) {
+ASSERT (PmuIrq == BSA_PMU_IRQ);
+return EFI_ABORTED;
+  }
+
+  for (Index = 0; Index < GicCCmObjDesc->Count; Index++) {
+GicCInfo[Index].PerformanceInterruptGsiv = PmuIrq;
+  }
+
+  retu

[edk2-devel] [PATCH v5 1/9] DynamicTablesPkg: Print specifier macro for CM_OBJECT_ID

2022-02-01 Thread PierreGondois
From: Pierre Gondois 

Add a macro that specifies the format for printing CM_OBJECT_ID.
This allows to print the CM_OBJECT_ID is a consistent way in the
output logs.

Signed-off-by: Pierre Gondois 
---

Notes:
v2:
- New patch, requested by Laszlo.

 DynamicTablesPkg/Include/ConfigurationManagerObject.h | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/Include/ConfigurationManagerObject.h 
b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
index 60d825a2b253..74ad25d5d94a 100644
--- a/DynamicTablesPkg/Include/ConfigurationManagerObject.h
+++ b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+  Copyright (c) 2017 - 2022, ARM Limited. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -84,6 +84,11 @@ Object ID's in the ARM Namespace:
 */
 typedef UINT32 CM_OBJECT_ID;
 
+//
+// Helper macro to format a CM_OBJECT_ID.
+//
+#define FMT_CM_OBJECT_ID  "0x%lx"
+
 /** A mask for Object ID
 */
 #define OBJECT_ID_MASK  0xFF
-- 
2.25.1



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




[edk2-devel] [PATCH v5 0/9] Add ACPI support for Kvmtool

2022-02-01 Thread PierreGondois
From: Pierre Gondois 

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3742
V1: https://edk2.groups.io/g/devel/message/76990
V2:
- New patch: "DynamicTablesPkg: Print specifier macro for
  CM_OBJECT_ID" [Laszlo]
- Only add AcpiView for ArmVirtKvmTool instead of all ArmVirt
  platforms. This is done using a 'ACPIVIEW_ENABLE' switch.
  [Laszlo]
- Only generate ACPI tables for AARCH64. [Laszlo]
- Various modifications (error handling, patch organization,
  coding style, etc). [Laszlo]
V3:
- To fix bugs reported by Linux (signaled by Ard):
  - Add patch to parse and populate PMU information.
  - Add patch to strictly comply to the first model at ACPI
6.4 s6.2.13 to describe PCI legacy interrupts using _PRT.
  - Add address size limit to IORT PCI root complex.
V4:
- Describe PCI legacy interrupts using GSI and remove link
  device generation. [Pierre]
- Add more description in ASSERT macros. [Ard]
V5:
- Update DSDT revision to 2. [Rebecca]

The changes can be seen at:
https://github.com/PierreARM/edk2/tree/1456_Add_ACPI_support_for_Kvmtool_v5
The results of the CI can be seen at:
https://github.com/tianocore/edk2/pull/2476

The patch depends on the KvmTool patch at:
https://lists.cs.columbia.edu/pipermail/kvmarm/2022-January/051865.html

Kvmtool dynamically generates a device tree describing the platform
to boot on. Using the patch-sets listed below, the DynamicTables
framework generates ACPI tables describing a similar platform.

This patch-set:
 - adds a ConfigurationManager and make use of the DynamicTablesPkg
   in for Kvmtool for AARCH64, allowing to generate ACPI tables
 - adds the acpiview command line utility to the ArmVirtPkg
   platform that request if via the ACPIVIEW_ENABLE macro
 - update ArmVirtPkg.ci.yaml to add new words and use the
   DynamicTablesPkg
 - adds a print specifier macro for the CM_OBJECT_ID type

With this patchset, KvmTool on AARCH64 will use ACPI tables instead
of a Device Tree (cf PcdForceNoAcpi Pcd).

Pierre Gondois (5):
  DynamicTablesPkg: Print specifier macro for CM_OBJECT_ID
  DynamicTablesPkg: FdtHwInfoParserLib: Parse Pmu info
  DynamicTablesPkg: AmlLib: AmlAddPrtEntry() to handle GSI
  DynamicTablesPkg: AcpiSsdtPcieLibArm: Remove link device generation
  ArmVirtPkg: Add cspell exceptions

Sami Mujawar (4):
  ArmVirtPkg/Kvmtool: Add DSDT ACPI table
  ArmVirtPkg/Kvmtool: Add Configuration Manager
  ArmVirtPkg/Kvmtool: Enable ACPI support
  ArmVirtPkg/Kvmtool: Enable Acpiview

 ArmVirtPkg/ArmVirt.dsc.inc|5 +-
 ArmVirtPkg/ArmVirtKvmTool.dsc |   22 +-
 ArmVirtPkg/ArmVirtKvmTool.fdf |   15 +-
 ArmVirtPkg/ArmVirtPkg.ci.yaml |6 +-
 .../KvmtoolCfgMgrDxe/AslTables/Dsdt.asl   |   21 +
 .../KvmtoolCfgMgrDxe/ConfigurationManager.c   | 1065 +
 .../KvmtoolCfgMgrDxe/ConfigurationManager.h   |  125 ++
 .../ConfigurationManagerDxe.inf   |   54 +
 .../Include/ConfigurationManagerObject.h  |7 +-
 .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c|  239 +---
 .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.h|   64 +-
 .../Common/AmlLib/CodeGen/AmlCodeGen.c|   89 +-
 .../FdtHwInfoParserLib/Gic/ArmGicCParser.c|  132 +-
 .../FdtHwInfoParserLib/Gic/ArmGicCParser.h|8 +-
 14 files changed, 1518 insertions(+), 334 deletions(-)
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/AslTables/Dsdt.asl
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.h
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf

-- 
2.25.1



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




Re: [edk2-devel] [PATCH 1/3] Platform/AMD: Move VariablePolicyHelperLib into LibraryClasses.common

2022-02-01 Thread Ard Biesheuvel
On Tue, 1 Feb 2022 at 17:59, Ard Biesheuvel  wrote:
>
> On Tue, 1 Feb 2022 at 17:58, Rebecca Cran  wrote:
> >
> > Sorry, I forgot to add a cover letter.
> >
> > I noticed some breakages in Arm platforms caused by additions of
> > VariablePolicyHelperLib: the 3 patches fix them by adding it to
> > LibraryClasses.common.
> >
> >
>
> No worries - I'll pick these up momentarily.
>

Series

Reviewed-by: Ard Biesheuvel 

Pushed as 5777ed5d604e..ce768c6535cd

Thanks,
Ard.

>
>
> >
> >
> > On 2/1/22 09:56, Rebecca Cran wrote:
> > > The VariablePolicyHelperLib is now used by a number of driver types, so
> > > instead of duplicating it, move it into the LibraryClasses.common section.
> > >
> > > Signed-off-by: Rebecca Cran 
> > > ---
> > >   Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 3 +--
> > >   1 file changed, 1 insertion(+), 2 deletions(-)
> > >
> > > diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
> > > b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > > index af207391209c..41c1cadc3425 100644
> > > --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > > +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > > @@ -125,6 +125,7 @@ DEFINE X64EMU_ENABLE  = FALSE
> > > OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
> > > RngLib|MdePkg/Library/DxeRngLib/DxeRngLib.inf
> > > TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
> > > +  
> > > VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
> > > 
> > > VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
> > >
> > > 
> > > UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> > > @@ -209,7 +210,6 @@ DEFINE X64EMU_ENABLE  = FALSE
> > > 
> > > PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
> > > 
> > > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
> > > 
> > > NonDiscoverableDeviceRegistrationLib|MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.inf
> > > -  
> > > VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
> > >
> > >   [LibraryClasses.common.DXE_RUNTIME_DRIVER]
> > > HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
> > > @@ -219,7 +219,6 @@ DEFINE X64EMU_ENABLE  = FALSE
> > > 
> > > DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
> > >   !endif
> > > 
> > > VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
> > > -  
> > > VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
> > >
> > >   [LibraryClasses.common.UEFI_APPLICATION]
> > > 
> > > PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
> >
> >
> > 
> >
> >


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




Re: [edk2-devel] [PATCH v3 5/8] ArmVirtPkg/Kvmtool: Add DSDT ACPI table

2022-02-01 Thread PierreGondois




On 2/1/22 6:04 PM, Ard Biesheuvel wrote:

On Tue, 1 Feb 2022 at 18:02, Pierre Gondois  wrote:




On 2/1/22 5:56 PM, Ard Biesheuvel wrote:

On Tue, 1 Feb 2022 at 17:56, Ard Biesheuvel  wrote:


On Tue, 1 Feb 2022 at 17:55, Pierre Gondois  wrote:


Hi Rebecca,

On 1/31/22 4:21 PM, Sami Mujawar wrote:

Hi Rebecca,

Thanks for catching this.

I think we also need to adda check in Acpiview to report this issue. However,
that would be another patch series.

Regards,

Sami Mujawar

*From: *Rebecca Cran 
*Date: *Monday, 31 January 2022 at 15:17
*To: *devel@edk2.groups.io , Pierre Gondois

*Cc: *Ard Biesheuvel , Sami Mujawar

*Subject: *Re: [edk2-devel] [PATCH v3 5/8] ArmVirtPkg/Kvmtool: Add DSDT ACPI 
table

On 1/28/22 08:41, PierreGondois wrote:


+  Differentiated System Description Table Fields (DSDT)
+
+  Copyright (c) 2021 - 2022, ARM Ltd. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-KVMT", 1) {


The Revision field should probably be 2, not 1. ACPI 6.4 says:


2. This field also sets the global integer width for the AML
interpreter. Values less than two will cause the inter-
preter to use 32-bit integers and math. Values of two
and greater will cause the interpreter to use full 64-bit
integers and math.

--
Rebecca Cran



Yes indeed. I forgot to add it in the v4... I will send a v5.


Please give me a minute before sending another version.

I am still seeing


No ACPI PMU IRQ for CPU26

errors and I am trying to figure out why.



There is a --pmu option in kvmtool, we are not populating pmu
interrupts if kvmtool doesn't receive this option. Maybe this is it ?


Yes you are right.

So this is all looking fine now - I tested booting Linux with
pci=nomsi, and the legacy interrupts are level and working as
expected.



Ok nice. Thanks for testing. I will send the v5 shortly.


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




Re: [edk2-devel] [PATCH v3 5/8] ArmVirtPkg/Kvmtool: Add DSDT ACPI table

2022-02-01 Thread Ard Biesheuvel
On Tue, 1 Feb 2022 at 18:02, Pierre Gondois  wrote:
>
>
>
> On 2/1/22 5:56 PM, Ard Biesheuvel wrote:
> > On Tue, 1 Feb 2022 at 17:56, Ard Biesheuvel  wrote:
> >>
> >> On Tue, 1 Feb 2022 at 17:55, Pierre Gondois  wrote:
> >>>
> >>> Hi Rebecca,
> >>>
> >>> On 1/31/22 4:21 PM, Sami Mujawar wrote:
>  Hi Rebecca,
> 
>  Thanks for catching this.
> 
>  I think we also need to adda check in Acpiview to report this issue. 
>  However,
>  that would be another patch series.
> 
>  Regards,
> 
>  Sami Mujawar
> 
>  *From: *Rebecca Cran 
>  *Date: *Monday, 31 January 2022 at 15:17
>  *To: *devel@edk2.groups.io , Pierre Gondois
>  
>  *Cc: *Ard Biesheuvel , Sami Mujawar
>  
>  *Subject: *Re: [edk2-devel] [PATCH v3 5/8] ArmVirtPkg/Kvmtool: Add DSDT 
>  ACPI table
> 
>  On 1/28/22 08:41, PierreGondois wrote:
> 
> > +  Differentiated System Description Table Fields (DSDT)
> > +
> > +  Copyright (c) 2021 - 2022, ARM Ltd. All rights reserved.
> > +SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-KVMT", 1) {
> 
>  The Revision field should probably be 2, not 1. ACPI 6.4 says:
> 
> 
>  2. This field also sets the global integer width for the AML
>  interpreter. Values less than two will cause the inter-
>  preter to use 32-bit integers and math. Values of two
>  and greater will cause the interpreter to use full 64-bit
>  integers and math.
> 
>  --
>  Rebecca Cran
> 
> >>>
> >>> Yes indeed. I forgot to add it in the v4... I will send a v5.
> >>
> >> Please give me a minute before sending another version.
> >>
> >> I am still seeing
> >
> > No ACPI PMU IRQ for CPU26
> >
> > errors and I am trying to figure out why.
> >
>
> There is a --pmu option in kvmtool, we are not populating pmu
> interrupts if kvmtool doesn't receive this option. Maybe this is it ?

Yes you are right.

So this is all looking fine now - I tested booting Linux with
pci=nomsi, and the legacy interrupts are level and working as
expected.


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




Re: [edk2-devel] [PATCH 3/3] Silicon/Marvell: Move VariablePolicyHelperLib into LibraryClasses.common

2022-02-01 Thread Marcin Wojtas
Hi,


wt., 1 lut 2022 o 17:56 Rebecca Cran  napisał(a):
>
> The VariablePolicyHelperLib is now used by a number of driver types, so
> instead of duplicating it, move it into the LibraryClasses.common section.
>
> Signed-off-by: Rebecca Cran 
> ---
>  Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc 
> b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> index 5e153782079c..9322ad881e69 100644
> --- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> +++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
> @@ -69,6 +69,7 @@
>
> UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
>UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
>UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
> +  
> VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
>
>PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
>
> @@ -175,7 +176,6 @@
>
> MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
>
> NonDiscoverableDeviceRegistrationLib|MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.inf
>
> DtPlatformDtbLoaderLib|EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf
> -  
> VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
>
>  [LibraryClasses.common.UEFI_APPLICATION]
>PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
> @@ -198,7 +198,6 @@
>  !endif
>
> DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
>
> VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
> -  
> VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
>
>  [LibraryClasses.ARM, LibraryClasses.AARCH64]
>#
> --
> 2.30.2
>

Reviewed-by: Marcin Wojtas 

Thanks,
Marcin


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




Re: [edk2-devel] [PATCH v3 5/8] ArmVirtPkg/Kvmtool: Add DSDT ACPI table

2022-02-01 Thread PierreGondois




On 2/1/22 5:56 PM, Ard Biesheuvel wrote:

On Tue, 1 Feb 2022 at 17:56, Ard Biesheuvel  wrote:


On Tue, 1 Feb 2022 at 17:55, Pierre Gondois  wrote:


Hi Rebecca,

On 1/31/22 4:21 PM, Sami Mujawar wrote:

Hi Rebecca,

Thanks for catching this.

I think we also need to adda check in Acpiview to report this issue. However,
that would be another patch series.

Regards,

Sami Mujawar

*From: *Rebecca Cran 
*Date: *Monday, 31 January 2022 at 15:17
*To: *devel@edk2.groups.io , Pierre Gondois

*Cc: *Ard Biesheuvel , Sami Mujawar

*Subject: *Re: [edk2-devel] [PATCH v3 5/8] ArmVirtPkg/Kvmtool: Add DSDT ACPI 
table

On 1/28/22 08:41, PierreGondois wrote:


+  Differentiated System Description Table Fields (DSDT)
+
+  Copyright (c) 2021 - 2022, ARM Ltd. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-KVMT", 1) {


The Revision field should probably be 2, not 1. ACPI 6.4 says:


2. This field also sets the global integer width for the AML
interpreter. Values less than two will cause the inter-
preter to use 32-bit integers and math. Values of two
and greater will cause the interpreter to use full 64-bit
integers and math.

--
Rebecca Cran



Yes indeed. I forgot to add it in the v4... I will send a v5.


Please give me a minute before sending another version.

I am still seeing


No ACPI PMU IRQ for CPU26

errors and I am trying to figure out why.



There is a --pmu option in kvmtool, we are not populating pmu
interrupts if kvmtool doesn't receive this option. Maybe this is it ?


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




Re: [edk2-devel] [PATCH 1/3] Platform/AMD: Move VariablePolicyHelperLib into LibraryClasses.common

2022-02-01 Thread Ard Biesheuvel
On Tue, 1 Feb 2022 at 17:58, Rebecca Cran  wrote:
>
> Sorry, I forgot to add a cover letter.
>
> I noticed some breakages in Arm platforms caused by additions of
> VariablePolicyHelperLib: the 3 patches fix them by adding it to
> LibraryClasses.common.
>
>

No worries - I'll pick these up momentarily.



>
>
> On 2/1/22 09:56, Rebecca Cran wrote:
> > The VariablePolicyHelperLib is now used by a number of driver types, so
> > instead of duplicating it, move it into the LibraryClasses.common section.
> >
> > Signed-off-by: Rebecca Cran 
> > ---
> >   Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 3 +--
> >   1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
> > b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > index af207391209c..41c1cadc3425 100644
> > --- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > +++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
> > @@ -125,6 +125,7 @@ DEFINE X64EMU_ENABLE  = FALSE
> > OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
> > RngLib|MdePkg/Library/DxeRngLib/DxeRngLib.inf
> > TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
> > +  
> > VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
> > 
> > VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
> >
> > 
> > UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> > @@ -209,7 +210,6 @@ DEFINE X64EMU_ENABLE  = FALSE
> > 
> > PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
> > 
> > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
> > 
> > NonDiscoverableDeviceRegistrationLib|MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.inf
> > -  
> > VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
> >
> >   [LibraryClasses.common.DXE_RUNTIME_DRIVER]
> > HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
> > @@ -219,7 +219,6 @@ DEFINE X64EMU_ENABLE  = FALSE
> > 
> > DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
> >   !endif
> > 
> > VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
> > -  
> > VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
> >
> >   [LibraryClasses.common.UEFI_APPLICATION]
> > 
> > PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
>
>
> 
>
>


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




Re: [edk2-devel] [PATCH 1/3] Platform/AMD: Move VariablePolicyHelperLib into LibraryClasses.common

2022-02-01 Thread Rebecca Cran

Sorry, I forgot to add a cover letter.

I noticed some breakages in Arm platforms caused by additions of 
VariablePolicyHelperLib: the 3 patches fix them by adding it to 
LibraryClasses.common.



--
Rebecca Cran


On 2/1/22 09:56, Rebecca Cran wrote:

The VariablePolicyHelperLib is now used by a number of driver types, so
instead of duplicating it, move it into the LibraryClasses.common section.

Signed-off-by: Rebecca Cran 
---
  Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
index af207391209c..41c1cadc3425 100644
--- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
+++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
@@ -125,6 +125,7 @@ DEFINE X64EMU_ENABLE  = FALSE
OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
RngLib|MdePkg/Library/DxeRngLib/DxeRngLib.inf
TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
+  
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf

VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
  
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf

@@ -209,7 +210,6 @@ DEFINE X64EMU_ENABLE  = FALSE
PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf

MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf

NonDiscoverableDeviceRegistrationLib|MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.inf
-  
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
  
  [LibraryClasses.common.DXE_RUNTIME_DRIVER]

HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
@@ -219,7 +219,6 @@ DEFINE X64EMU_ENABLE  = FALSE

DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
  !endif

VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
-  
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
  
  [LibraryClasses.common.UEFI_APPLICATION]

PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf



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




Re: [edk2-devel] [PATCH v3 5/8] ArmVirtPkg/Kvmtool: Add DSDT ACPI table

2022-02-01 Thread Ard Biesheuvel
On Tue, 1 Feb 2022 at 17:56, Ard Biesheuvel  wrote:
>
> On Tue, 1 Feb 2022 at 17:55, Pierre Gondois  wrote:
> >
> > Hi Rebecca,
> >
> > On 1/31/22 4:21 PM, Sami Mujawar wrote:
> > > Hi Rebecca,
> > >
> > > Thanks for catching this.
> > >
> > > I think we also need to adda check in Acpiview to report this issue. 
> > > However,
> > > that would be another patch series.
> > >
> > > Regards,
> > >
> > > Sami Mujawar
> > >
> > > *From: *Rebecca Cran 
> > > *Date: *Monday, 31 January 2022 at 15:17
> > > *To: *devel@edk2.groups.io , Pierre Gondois
> > > 
> > > *Cc: *Ard Biesheuvel , Sami Mujawar
> > > 
> > > *Subject: *Re: [edk2-devel] [PATCH v3 5/8] ArmVirtPkg/Kvmtool: Add DSDT 
> > > ACPI table
> > >
> > > On 1/28/22 08:41, PierreGondois wrote:
> > >
> > >> +  Differentiated System Description Table Fields (DSDT)
> > >> +
> > >> +  Copyright (c) 2021 - 2022, ARM Ltd. All rights reserved.
> > >> +SPDX-License-Identifier: BSD-2-Clause-Patent
> > >> +
> > >> +**/
> > >> +
> > >> +DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-KVMT", 1) {
> > >
> > > The Revision field should probably be 2, not 1. ACPI 6.4 says:
> > >
> > >
> > > 2. This field also sets the global integer width for the AML
> > > interpreter. Values less than two will cause the inter-
> > > preter to use 32-bit integers and math. Values of two
> > > and greater will cause the interpreter to use full 64-bit
> > > integers and math.
> > >
> > > --
> > > Rebecca Cran
> > >
> >
> > Yes indeed. I forgot to add it in the v4... I will send a v5.
>
> Please give me a minute before sending another version.
>
> I am still seeing

No ACPI PMU IRQ for CPU26

errors and I am trying to figure out why.


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




[edk2-devel] [PATCH 2/3] Platform/Socionext: Move VariablePolicyHelperLib to LibraryClasses.common

2022-02-01 Thread Rebecca Cran
The VariablePolicyHelperLib is now used by a number of driver types, so
instead of duplicating it, move it into the LibraryClasses.common section.

Signed-off-by: Rebecca Cran 
---
 Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc 
b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
index fd4cfa82330d..690cdef9d91c 100644
--- a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
+++ b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
@@ -128,6 +128,8 @@
 
   NorFlashInfoLib|EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf
 
+  
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
+
 [LibraryClasses.common.SEC]
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
   BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
@@ -182,8 +184,6 @@
   
PciHostBridgeLib|Silicon/Socionext/SynQuacer/Library/SynQuacerPciHostBridgeLib/SynQuacerPciHostBridgeLib.inf
   
NonDiscoverableDeviceRegistrationLib|MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.inf
 
-  
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
-
 [LibraryClasses.common.UEFI_APPLICATION]
   PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
@@ -210,7 +210,6 @@
 !if $(TARGET) != RELEASE
   
DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
 !endif
-  
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
 
 [LibraryClasses.ARM]
   ArmSoftFloatLib|ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
-- 
2.30.2



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




[edk2-devel] [PATCH 1/3] Platform/AMD: Move VariablePolicyHelperLib into LibraryClasses.common

2022-02-01 Thread Rebecca Cran
The VariablePolicyHelperLib is now used by a number of driver types, so
instead of duplicating it, move it into the LibraryClasses.common section.

Signed-off-by: Rebecca Cran 
---
 Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
index af207391209c..41c1cadc3425 100644
--- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
+++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
@@ -125,6 +125,7 @@ DEFINE X64EMU_ENABLE  = FALSE
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   RngLib|MdePkg/Library/DxeRngLib/DxeRngLib.inf
   TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf
+  
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
 
   
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
@@ -209,7 +210,6 @@ DEFINE X64EMU_ENABLE  = FALSE
   PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
   
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
   
NonDiscoverableDeviceRegistrationLib|MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.inf
-  
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
 
 [LibraryClasses.common.DXE_RUNTIME_DRIVER]
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
@@ -219,7 +219,6 @@ DEFINE X64EMU_ENABLE  = FALSE
   
DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
 !endif
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
-  
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
 
 [LibraryClasses.common.UEFI_APPLICATION]
   PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
-- 
2.30.2



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




[edk2-devel] [PATCH 3/3] Silicon/Marvell: Move VariablePolicyHelperLib into LibraryClasses.common

2022-02-01 Thread Rebecca Cran
The VariablePolicyHelperLib is now used by a number of driver types, so
instead of duplicating it, move it into the LibraryClasses.common section.

Signed-off-by: Rebecca Cran 
---
 Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc 
b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
index 5e153782079c..9322ad881e69 100644
--- a/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
+++ b/Silicon/Marvell/Armada7k8k/Armada7k8k.dsc.inc
@@ -69,6 +69,7 @@
   
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
   UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
   UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
+  
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
 
   PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
 
@@ -175,7 +176,6 @@
   
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
   
NonDiscoverableDeviceRegistrationLib|MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.inf
   
DtPlatformDtbLoaderLib|EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf
-  
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
 
 [LibraryClasses.common.UEFI_APPLICATION]
   PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
@@ -198,7 +198,6 @@
 !endif
   
DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
   
VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
-  
VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
 
 [LibraryClasses.ARM, LibraryClasses.AARCH64]
   #
-- 
2.30.2



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




Re: [edk2-devel] [PATCH v3 5/8] ArmVirtPkg/Kvmtool: Add DSDT ACPI table

2022-02-01 Thread Ard Biesheuvel
On Tue, 1 Feb 2022 at 17:56, Ard Biesheuvel  wrote:
>
> On Tue, 1 Feb 2022 at 17:55, Pierre Gondois  wrote:
> >
> > Hi Rebecca,
> >
> > On 1/31/22 4:21 PM, Sami Mujawar wrote:
> > > Hi Rebecca,
> > >
> > > Thanks for catching this.
> > >
> > > I think we also need to adda check in Acpiview to report this issue. 
> > > However,
> > > that would be another patch series.
> > >
> > > Regards,
> > >
> > > Sami Mujawar
> > >
> > > *From: *Rebecca Cran 
> > > *Date: *Monday, 31 January 2022 at 15:17
> > > *To: *devel@edk2.groups.io , Pierre Gondois
> > > 
> > > *Cc: *Ard Biesheuvel , Sami Mujawar
> > > 
> > > *Subject: *Re: [edk2-devel] [PATCH v3 5/8] ArmVirtPkg/Kvmtool: Add DSDT 
> > > ACPI table
> > >
> > > On 1/28/22 08:41, PierreGondois wrote:
> > >
> > >> +  Differentiated System Description Table Fields (DSDT)
> > >> +
> > >> +  Copyright (c) 2021 - 2022, ARM Ltd. All rights reserved.
> > >> +SPDX-License-Identifier: BSD-2-Clause-Patent
> > >> +
> > >> +**/
> > >> +
> > >> +DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-KVMT", 1) {
> > >
> > > The Revision field should probably be 2, not 1. ACPI 6.4 says:
> > >
> > >
> > > 2. This field also sets the global integer width for the AML
> > > interpreter. Values less than two will cause the inter-
> > > preter to use 32-bit integers and math. Values of two
> > > and greater will cause the interpreter to use full 64-bit
> > > integers and math.
> > >
> > > --
> > > Rebecca Cran
> > >
> >
> > Yes indeed. I forgot to add it in the v4... I will send a v5.
>
> Please give me a minute before sending another version.
>
> I am still seeing


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




Re: [edk2-devel] [PATCH v3 5/8] ArmVirtPkg/Kvmtool: Add DSDT ACPI table

2022-02-01 Thread Ard Biesheuvel
On Tue, 1 Feb 2022 at 17:55, Pierre Gondois  wrote:
>
> Hi Rebecca,
>
> On 1/31/22 4:21 PM, Sami Mujawar wrote:
> > Hi Rebecca,
> >
> > Thanks for catching this.
> >
> > I think we also need to adda check in Acpiview to report this issue. 
> > However,
> > that would be another patch series.
> >
> > Regards,
> >
> > Sami Mujawar
> >
> > *From: *Rebecca Cran 
> > *Date: *Monday, 31 January 2022 at 15:17
> > *To: *devel@edk2.groups.io , Pierre Gondois
> > 
> > *Cc: *Ard Biesheuvel , Sami Mujawar
> > 
> > *Subject: *Re: [edk2-devel] [PATCH v3 5/8] ArmVirtPkg/Kvmtool: Add DSDT 
> > ACPI table
> >
> > On 1/28/22 08:41, PierreGondois wrote:
> >
> >> +  Differentiated System Description Table Fields (DSDT)
> >> +
> >> +  Copyright (c) 2021 - 2022, ARM Ltd. All rights reserved.
> >> +SPDX-License-Identifier: BSD-2-Clause-Patent
> >> +
> >> +**/
> >> +
> >> +DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-KVMT", 1) {
> >
> > The Revision field should probably be 2, not 1. ACPI 6.4 says:
> >
> >
> > 2. This field also sets the global integer width for the AML
> > interpreter. Values less than two will cause the inter-
> > preter to use 32-bit integers and math. Values of two
> > and greater will cause the interpreter to use full 64-bit
> > integers and math.
> >
> > --
> > Rebecca Cran
> >
>
> Yes indeed. I forgot to add it in the v4... I will send a v5.

Please give me a minute before sending another version.

I am still seeing


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




Re: [edk2-devel] [PATCH v3 5/8] ArmVirtPkg/Kvmtool: Add DSDT ACPI table

2022-02-01 Thread PierreGondois

Hi Rebecca,

On 1/31/22 4:21 PM, Sami Mujawar wrote:

Hi Rebecca,

Thanks for catching this.

I think we also need to adda check in Acpiview to report this issue. However,
that would be another patch series.

Regards,

Sami Mujawar

*From: *Rebecca Cran 
*Date: *Monday, 31 January 2022 at 15:17
*To: *devel@edk2.groups.io , Pierre Gondois

*Cc: *Ard Biesheuvel , Sami Mujawar

*Subject: *Re: [edk2-devel] [PATCH v3 5/8] ArmVirtPkg/Kvmtool: Add DSDT ACPI 
table

On 1/28/22 08:41, PierreGondois wrote:


+  Differentiated System Description Table Fields (DSDT)
+
+  Copyright (c) 2021 - 2022, ARM Ltd. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-KVMT", 1) {


The Revision field should probably be 2, not 1. ACPI 6.4 says:


2. This field also sets the global integer width for the AML
interpreter. Values less than two will cause the inter-
preter to use 32-bit integers and math. Values of two
and greater will cause the interpreter to use full 64-bit
integers and math.

--
Rebecca Cran



Yes indeed. I forgot to add it in the v4... I will send a v5.
Regards,
Pierre


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




[edk2-devel] [PATCH v4 8/9] ArmVirtPkg/Kvmtool: Enable ACPI support

2022-02-01 Thread PierreGondois
From: Sami Mujawar 

A Configuration Manager that uses the Dynamic Tables framework
to generate ACPI tables for Kvmtool Guests has been provided.
This Configuration Manager uses the FdtHwInfoParser module to
parse the Kvmtool Device Tree and generate the required
Configuration Manager objects for generating the ACPI tables.

Therefore, enable ACPI table generation for Kvmtool.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3742
Signed-off-by: Sami Mujawar 
Signed-off-by: Pierre Gondois 
---

Notes:
v2:
- Remove Pcds that are redefined to their default value,
  and modules already included in ArmVirtPkg/ArmVirt.dsc.inc
  [Laszlo]
- Use guards as '!if $(ARCH) == AARCH64' to conditionnaly
  generate ACPI tables. This allows to prevent the 32bits
  ARM/ACPI combination without restricting the DynamicTablesPkg
  to AARCH64. This means that KvmTool on ARM will use the DT.
  Not adding Laszlo's Acked-by since this is not exactly what
  was suggested. [Laszlo/Pierre]

 ArmVirtPkg/ArmVirtKvmTool.dsc | 17 ++---
 ArmVirtPkg/ArmVirtKvmTool.fdf | 15 ++-
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc
index 4a54d13735e9..4b6090ab6075 100644
--- a/ArmVirtPkg/ArmVirtKvmTool.dsc
+++ b/ArmVirtPkg/ArmVirtKvmTool.dsc
@@ -29,6 +29,10 @@ [Defines]
 
 !include ArmVirtPkg/ArmVirt.dsc.inc
 
+!if $(ARCH) == AARCH64
+!include DynamicTablesPkg/DynamicTables.dsc.inc
+!endif
+
 !include MdePkg/MdeLibs.dsc.inc
 
 [LibraryClasses.common]
@@ -71,6 +75,9 @@ [LibraryClasses.common]
   
PlatformHookLib|ArmVirtPkg/Library/Fdt16550SerialPortHookLib/Fdt16550SerialPortHookLib.inf
   
SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf
 
+  
HwInfoParserLib|DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib.inf
+  
DynamicPlatRepoLib|DynamicTablesPkg/Library/Common/DynamicPlatRepoLib/DynamicPlatRepoLib.inf
+
 [LibraryClasses.common.SEC, LibraryClasses.common.PEI_CORE, 
LibraryClasses.common.PEIM]
   PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf
   
PlatformHookLib|ArmVirtPkg/Library/Fdt16550SerialPortHookLib/EarlyFdt16550SerialPortHookLib.inf
@@ -195,9 +202,6 @@ [PcdsDynamicDefault.common]
   gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640
   gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480
 
-  ## Force DTB
-  gArmVirtTokenSpaceGuid.PcdForceNoAcpi|TRUE
-
   # Setup Flash storage variables
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x4
@@ -353,3 +357,10 @@ [Components.common]
   }
   OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
   OvmfPkg/Virtio10Dxe/Virtio10.inf
+
+!if $(ARCH) == AARCH64
+  #
+  # ACPI Support
+  #
+  ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf
+!endif
diff --git a/ArmVirtPkg/ArmVirtKvmTool.fdf b/ArmVirtPkg/ArmVirtKvmTool.fdf
index 14a5fce43a09..9e006e83ee5c 100644
--- a/ArmVirtPkg/ArmVirtKvmTool.fdf
+++ b/ArmVirtPkg/ArmVirtKvmTool.fdf
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2018 - 2021, ARM Limited. All rights reserved.
+#  Copyright (c) 2018 - 2022, ARM Limited. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -201,6 +201,19 @@ [FV.FvMain]
   INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
   INF OvmfPkg/Virtio10Dxe/Virtio10.inf
 
+!if $(ARCH) == AARCH64
+  #
+  # ACPI Support
+  #
+  INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf
+  #
+  # Dynamic Table fdf
+  #
+  !include DynamicTablesPkg/DynamicTables.fdf.inc
+
+  INF ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf
+!endif
+
   #
   # TianoCore logo (splash screen)
   #
-- 
2.25.1



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




[edk2-devel] [PATCH v4 9/9] ArmVirtPkg/Kvmtool: Enable Acpiview

2022-02-01 Thread PierreGondois
From: Sami Mujawar 

Acpiview is a command line tool allowing to display, dump, or check
installed ACPI tables. Add a 'ACPIVIEW_ENABLE' switch to enable it
on an ArmVirt platform.

The switch is set for the ArmVirtKvmTool platform.

Signed-off-by: Sami Mujawar 
Signed-off-by: Pierre Gondois 
Acked-by: Laszlo Ersek 
---

Notes:
v2:
- Only add AcpiView for ArmVirtKvmTool instead of all
  ArmVirt platforms. This is done using a
  'ACPIVIEW_ENABLE' switch. [Laszlo]

 ArmVirtPkg/ArmVirt.dsc.inc| 5 -
 ArmVirtPkg/ArmVirtKvmTool.dsc | 5 -
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc
index 4db8ad5a7999..ba711deac025 100644
--- a/ArmVirtPkg/ArmVirt.dsc.inc
+++ b/ArmVirtPkg/ArmVirt.dsc.inc
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
+#  Copyright (c) 2011 - 2022, ARM Limited. All rights reserved.
 #  Copyright (c) 2014, Linaro Limited. All rights reserved.
 #  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
 #  Copyright (c) Microsoft Corporation.
@@ -397,6 +397,9 @@ [Components.common]
   
NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
+!if $(ACPIVIEW_ENABLE) == TRUE
+  
NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
+!endif
   
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
   
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
 !if $(NETWORK_IP6_ENABLE) == TRUE
diff --git a/ArmVirtPkg/ArmVirtKvmTool.dsc b/ArmVirtPkg/ArmVirtKvmTool.dsc
index 4b6090ab6075..a1bf4b9be87b 100644
--- a/ArmVirtPkg/ArmVirtKvmTool.dsc
+++ b/ArmVirtPkg/ArmVirtKvmTool.dsc
@@ -1,7 +1,7 @@
 #  @file
 #  Workspace file for KVMTool virtual platform.
 #
-#  Copyright (c) 2018 - 2021, ARM Limited. All rights reserved.
+#  Copyright (c) 2018 - 2022, ARM Limited. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -27,6 +27,9 @@ [Defines]
   SKUID_IDENTIFIER   = DEFAULT
   FLASH_DEFINITION   = ArmVirtPkg/ArmVirtKvmTool.fdf
 
+[Defines.AARCH64]
+  DEFINE ACPIVIEW_ENABLE = TRUE
+
 !include ArmVirtPkg/ArmVirt.dsc.inc
 
 !if $(ARCH) == AARCH64
-- 
2.25.1



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




[edk2-devel] [PATCH v4 7/9] ArmVirtPkg/Kvmtool: Add Configuration Manager

2022-02-01 Thread PierreGondois
From: Sami Mujawar 

Add Configuration Manager to enable ACPI tables for Kvmtool
firmware. The Configuration Manager for Kvmtool uses the DT
Hardware Information Parser module (FdtHwInfoParser) to parse
the DT provided by Kvmtool. The FdtHwInfoParser parses the DT
and invokes the callback function HW_INFO_ADD_OBJECT to add
the Configuration Manager objects to the Platform Information
repository.

The information for some Configuration Manager objects may not
be available in the DT. Such objects are initialised locally
by the Configuration Manager.

Support for the following ACPI tables is provided:
 - DBG2
 - DSDT (Empty stub)
 - FADT
 - GTDT
 - MADT
 - SPCR
 - SSDT (Cpu Hierarchy)
 - SSDT (Pcie bus)

Signed-off-by: Sami Mujawar 
Signed-off-by: Pierre Gondois 
Acked-by: Laszlo Ersek 
---

Notes:
v2:
- Only keep AARCH64 as a valid architecture. [Laszlo]
- Move modifications to ArmVirtKvmTool.dsc to the next
  patch. [Laszlo]
- Various coding style/error handling/ASSERT corrections.
  [Laszlo]
- Remove dependency to PcdForceNoAcpi and rely on DEPEX
  to load the module. [Laszlo]
- Not possible to make 'struct PlatformRepositoryInfo'
  an unamed struct since this is a redifinition.
  [Laszlo/Pierre]
- Define 'FMT_CM_OBJECT_ID' print formatter in an earlier
  patch and use it in this patch. [Laszlo/Pierre]

v3:
- Add address size limit for IORT PCI root complex. [Pierre]

 .../KvmtoolCfgMgrDxe/ConfigurationManager.c   | 1065 +
 .../KvmtoolCfgMgrDxe/ConfigurationManager.h   |  125 ++
 .../ConfigurationManagerDxe.inf   |   54 +
 3 files changed, 1244 insertions(+)
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.h
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf

diff --git a/ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c 
b/ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c
new file mode 100644
index ..e8c1b13c8f2c
--- /dev/null
+++ b/ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c
@@ -0,0 +1,1065 @@
+/** @file
+  Configuration Manager Dxe
+
+  Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+  @par Glossary:
+- Cm or CM   - Configuration Manager
+- Obj or OBJ - Object
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "ConfigurationManager.h"
+
+//
+// The platform configuration repository information.
+//
+STATIC
+EDKII_PLATFORM_REPOSITORY_INFO  mKvmtoolPlatRepositoryInfo = {
+  //
+  // Configuration Manager information
+  //
+  { CONFIGURATION_MANAGER_REVISION, CFG_MGR_OEM_ID },
+
+  //
+  // ACPI Table List
+  //
+  {
+//
+// FADT Table
+//
+{
+  EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_3_FIXED_ACPI_DESCRIPTION_TABLE_REVISION,
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdFadt),
+  NULL
+},
+//
+// GTDT Table
+//
+{
+  EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION,
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdGtdt),
+  NULL
+},
+//
+// MADT Table
+//
+{
+  EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_6_3_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION,
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMadt),
+  NULL
+},
+//
+// SPCR Table
+//
+{
+  EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,
+  EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION,
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSpcr),
+  NULL
+},
+//
+// DSDT Table
+//
+{
+  EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
+  0, // Unused
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdDsdt),
+  (EFI_ACPI_DESCRIPTION_HEADER *)dsdt_aml_code
+},
+//
+// SSDT Cpu Hierarchy Table
+//
+{
+  EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
+  0, // Unused
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtCpuTopology),
+  NULL
+},
+//
+// DBG2 Table
+//
+{
+  EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE,
+  EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION,
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdDbg2),
+  NULL
+},
+//
+// PCI MCFG Table
+//
+{
+  
EFI_ACPI_6_3_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
+  EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION,
+  CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdMcfg),
+  NULL
+},
+//
+// SSDT table describing the PCI root complex
+//
+{
+  EFI_ACPI_6

[edk2-devel] [PATCH v4 6/9] ArmVirtPkg/Kvmtool: Add DSDT ACPI table

2022-02-01 Thread PierreGondois
From: Sami Mujawar 

Most ACPI tables for Kvmtool firmware are dynamically
generated. The AML code is also generated at runtime
for most components in appropriate SSDTs.

Although there may not be much to describe in the DSDT,
the DSDT table is mandatory.

Therefore, add an empty stub for DSDT.

Signed-off-by: Sami Mujawar 
Signed-off-by: Pierre Gondois 
Reviewed-by: Laszlo Ersek 
---

Notes:
v2:
 - Coding style modifications. [Laszlo]

 .../KvmtoolCfgMgrDxe/AslTables/Dsdt.asl   | 21 +++
 1 file changed, 21 insertions(+)
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/AslTables/Dsdt.asl

diff --git a/ArmVirtPkg/KvmtoolCfgMgrDxe/AslTables/Dsdt.asl 
b/ArmVirtPkg/KvmtoolCfgMgrDxe/AslTables/Dsdt.asl
new file mode 100644
index ..5010beabfc4b
--- /dev/null
+++ b/ArmVirtPkg/KvmtoolCfgMgrDxe/AslTables/Dsdt.asl
@@ -0,0 +1,21 @@
+/** @file
+  Differentiated System Description Table Fields (DSDT)
+
+  Copyright (c) 2021 - 2022, ARM Ltd. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+DefinitionBlock ("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-KVMT", 1) {
+  Scope (_SB) {
+//
+// Most ACPI tables for Kvmtool firmware are
+// dynamically generated. The AML code is also
+// generated at runtime for most components in
+// appropriate SSDTs.
+// Although there may not be much to describe
+// in the DSDT, the DSDT table is mandatory.
+// Therefore, add an empty stub for DSDT.
+//
+  } // Scope (_SB)
+}
-- 
2.25.1



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




[edk2-devel] [PATCH v4 5/9] ArmVirtPkg: Add cspell exceptions

2022-02-01 Thread PierreGondois
From: Pierre Gondois 

The cpsell tool checks for unknown words in the upstream CI.
Add some new words to the list of exceptions.

Signed-off-by: Pierre Gondois 
---

Notes:
v2:
- Adding 'acpiview'. Since the patch change, Laszlo's
  Reviewed-by is not added. [Pierre]

 ArmVirtPkg/ArmVirtPkg.ci.yaml | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ArmVirtPkg/ArmVirtPkg.ci.yaml b/ArmVirtPkg/ArmVirtPkg.ci.yaml
index 67b0e9594f3e..d5d63ddd4fd7 100644
--- a/ArmVirtPkg/ArmVirtPkg.ci.yaml
+++ b/ArmVirtPkg/ArmVirtPkg.ci.yaml
@@ -6,7 +6,7 @@
 #
 # Copyright (c) Microsoft Corporation
 # Copyright (c) 2020, Intel Corporation. All rights reserved.
-# Copyright (c) 2020, ARM Limited. All rights reserved.
+# Copyright (c) 2020 - 2022, ARM Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
@@ -48,6 +48,7 @@
 "MdePkg/MdePkg.dec",
 "MdeModulePkg/MdeModulePkg.dec",
 "ArmVirtPkg/ArmVirtPkg.dec",
+"DynamicTablesPkg/DynamicTablesPkg.dec",
 "NetworkPkg/NetworkPkg.dec",
 "ArmPkg/ArmPkg.dec",
 "OvmfPkg/OvmfPkg.dec",
@@ -98,6 +99,9 @@
 "AuditOnly": False,   # Fails right now with over 270 errors
 "IgnoreFiles": [],   # use gitignore syntax to ignore errors 
in matching files
 "ExtendWords": [
+"acpiview",
+"armltd",
+"ssdts",
 "setjump",
 "plong",
 "lparam",
-- 
2.25.1



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




[edk2-devel] [PATCH v4 4/9] DynamicTablesPkg: AcpiSsdtPcieLibArm: Remove link device generation

2022-02-01 Thread PierreGondois
From: Pierre Gondois 

In ACPI 6.4, s6.2.13, _PRT objects describing PCI legacy interrupts
can be defined following 2 models.
In the first model, _PRT entries reference link devices. Link devices
then describe interrupts. This allows to dynamically modify
interrupts through _SRS and _PRS objects and to choose exactly the
interrupt type (level/edge triggered, active high/low).
In the second model, interrupt numbder are described in the _PRT entry.
The interrupt type is then assumed by the OS.

The Arm BSA, sE.6 "Legacy interrupts" states that PCI legacy
interrupts must be converted to SPIs, and programmed level-sensitive,
active high. Thus any OS must configure interrupts as such and there
is no need to specify the interrupt type.
Plus it is not possible to dynamically configure PCI interrupts.

Thus remove the link device generation and use the second model
for _PRT.

Suggested-by: Ard Biesheuvel 
Signed-off-by: Pierre Gondois 
---

Notes:
v4:
 - New patch. [Ard]

 .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c| 239 +-
 .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.h|  64 +
 2 files changed, 15 insertions(+), 288 deletions(-)

diff --git 
a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c 
b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
index 3e22587d4a25..a34018151f2d 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
@@ -1,7 +1,7 @@
 /** @file
   SSDT Pcie Table Generator.
 
-  Copyright (c) 2021, Arm Limited. All rights reserved.
+  Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -12,6 +12,7 @@
- s6.1.1 "_ADR (Address)"
   - linux kernel code
   - Arm Base Boot Requirements v1.0
+  - Arm Base System Architecture v1.0
 **/
 
 #include 
@@ -279,171 +280,6 @@ GeneratePciDeviceInfo (
   return Status;
 }
 
-/** Generate a Link device.
-
-  The Link device is added at the beginning of the ASL Pci device definition.
-
-  Each Link device represents a Pci legacy interrupt (INTA-...-INTD).
-
-  ASL code:
-  Device () {
-Name (_UID, ])
-Name (_HID, EISAID ("PNP0C0F"))
-Name (CRS0, ResourceTemplate () {
-  Interrupt (ResourceProducer, Level, ActiveHigh, Exclusive) { ] }
-  })
-Method (_CRS, 0) {
-  Return CRS0
-  })
-Method (_DIS) { }
-  }
-
-  The list of objects to define is available at:
-  PCI Firmware Specification - Revision 3.3,
-  s3.5. "Device State at Firmware/Operating System Handoff"
-
-  The _PRS and _SRS are not supported, cf Arm Base Boot Requirements v1.0:
-  "The _PRS (Possible Resource Settings) and _SRS (Set Resource Settings)
-  are not supported."
-
-  @param [in]   Irq Interrupt controller interrupt.
-  @param [in]   IrqFlagsInterrupt flags.
-  @param [in]   LinkIndex   Legacy Pci interrupt index.
-Must be between 0-INTA and 3-INTD.
-  @param [in, out]  PciNode Pci node to amend.
-
-  @retval EFI_SUCCESSSuccess.
-  @retval EFI_INVALID_PARAMETER  Invalid parameter.
-  @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory.
-**/
-STATIC
-EFI_STATUS
-EFIAPI
-GenerateLinkDevice (
-  IN  UINT32  Irq,
-  IN  UINT32  IrqFlags,
-  IN  UINT32  LinkIndex,
-  IN  OUT AML_OBJECT_NODE_HANDLE  PciNode
-  )
-{
-  EFI_STATUS  Status;
-  CHAR8   AslName[AML_NAME_SEG_SIZE + 1];
-  AML_OBJECT_NODE_HANDLE  LinkNode;
-  AML_OBJECT_NODE_HANDLE  CrsNode;
-  UINT32  EisaId;
-
-  ASSERT (LinkIndex < 4);
-  ASSERT (PciNode != NULL);
-
-  CopyMem (AslName, "LNKx", AML_NAME_SEG_SIZE + 1);
-  AslName[AML_NAME_SEG_SIZE - 1] = 'A' + LinkIndex;
-
-  // ASL: Device (LNKx) {}
-  Status = AmlCodeGenDevice (AslName, NULL, &LinkNode);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-return Status;
-  }
-
-  Status = AmlAttachNode (PciNode, LinkNode);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-// Failed to add.
-AmlDeleteTree ((AML_NODE_HANDLE)LinkNode);
-return Status;
-  }
-
-  // ASL: Name (_UID, )
-  Status = AmlCodeGenNameInteger ("_UID", LinkIndex, LinkNode, NULL);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-return Status;
-  }
-
-  // ASL: Name (_HID, EISAID ("PNP0C0F"))
-  Status = AmlGetEisaIdFromString ("PNP0C0F", &EisaId);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-return Status;
-  }
-
-  Status = AmlCodeGenNameInteger ("_HID", EisaId, LinkNode, NULL);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-return Status;
-  }
-
-  // ASL:
-  // Name (CRS0, ResourceTemplate () {
-  //   Interrupt (ResourceProducer, Level, ActiveHigh, Exclusive) {  }
-  // })
-  Status = AmlCodeGenNameResourceTemplate ("CRS0", LinkNode, &CrsNode);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-return Status;
-  }
-
-  Status = AmlCode

[edk2-devel] [PATCH v4 3/9] DynamicTablesPkg: AmlLib: AmlAddPrtEntry() to handle GSI

2022-02-01 Thread PierreGondois
From: Pierre Gondois 

In ACPI 6.4, s6.2.13, _PRT objects describing PCI legacy interrupts
can be defined following 2 models.
In the first model, _PRT entries reference link devices. Link devices
then describe interrupts. This allows to dynamically modify
interrupts through _SRS and _PRS objects and to choose exactly the
interrupt type (level/edge triggered, active high/low).
In the second model, interrupt numbers are described in the _PRT entry.
The interrupt type is then assumed by the OS.

AmlAddPrtEntry() currently only handles the first model. Make
changes to also handle the second model.

Signed-off-by: Pierre Gondois 
---

Notes:
v4:
 - New patch (to handle GSI description in _PRT). [Pierre]

 .../Common/AmlLib/CodeGen/AmlCodeGen.c| 89 ---
 1 file changed, 55 insertions(+), 34 deletions(-)

diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c 
b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
index d245848ce3fa..2d55db97c7bf 100644
--- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
+++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlCodeGen.c
@@ -1,7 +1,7 @@
 /** @file
   AML Code Generation.
 
-  Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.
+  Copyright (c) 2020 - 2022, Arm Limited. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
@@ -881,6 +881,9 @@ AmlCodeGenNameResourceTemplate (
// interrupt, so let it to index 0.
 }
 
+  The 2 models described in ACPI 6.4, s6.2.13 "_PRT (PCI Routing Table)" can
+  be generated by this function. The example above matches the first model.
+
   The package is added at the tail of the list of the input _PRT node
   name:
 Name (_PRT, Package () {
@@ -901,8 +904,10 @@ AmlCodeGenNameResourceTemplate (
   @param [in]  PinPCI pin number of the device (0-INTA ... 3-INTD).
   Must be between 0-3.
   @param [in]  LinkName   Link Name, i.e. device in the AML NameSpace
-  describing the interrupt used.
-  The input string is copied.
+  describing the interrupt used. The input string
+  is copied.
+  If NULL, generate 0 in the 'Source' field (cf.
+  second model, using GSIV).
   @param [in]  SourceIndexSource index or GSIV.
   @param [in]  PrtNameNodePrt Named node to add the object to 
 
@@ -930,7 +935,6 @@ AmlAddPrtEntry (
   AML_DATA_NODE  *DataNode;
 
   if ((Pin > 3) ||
-  (LinkName == NULL)||
   (PrtNameNode == NULL) ||
   (AmlGetNodeType ((AML_NODE_HANDLE)PrtNameNode) != EAmlNodeObject) ||
   (!AmlNodeHasOpCode (PrtNameNode, AML_NAME_OP, 0)) ||
@@ -999,41 +1003,58 @@ AmlAddPrtEntry (
 
   NewElementNode = NULL;
 
-  Status = ConvertAslNameToAmlName (LinkName, &AmlNameString);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-goto error_handler;
-  }
+  if (LinkName != NULL) {
+Status = ConvertAslNameToAmlName (LinkName, &AmlNameString);
+if (EFI_ERROR (Status)) {
+  ASSERT_EFI_ERROR (Status);
+  goto error_handler;
+}
 
-  Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize);
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-goto error_handler;
-  }
+Status = AmlGetNameStringSize (AmlNameString, &AmlNameStringSize);
+if (EFI_ERROR (Status)) {
+  ASSERT_EFI_ERROR (Status);
+  goto error_handler;
+}
 
-  Status = AmlCreateDataNode (
- EAmlNodeDataTypeNameString,
- (UINT8 *)AmlNameString,
- AmlNameStringSize,
- &DataNode
- );
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-goto error_handler;
-  }
+Status = AmlCreateDataNode (
+   EAmlNodeDataTypeNameString,
+   (UINT8 *)AmlNameString,
+   AmlNameStringSize,
+   &DataNode
+   );
+if (EFI_ERROR (Status)) {
+  ASSERT_EFI_ERROR (Status);
+  goto error_handler;
+}
 
-  // AmlNameString will be freed before returning.
+// AmlNameString will be freed be fore returning.
 
-  Status = AmlVarListAddTail (
- (AML_NODE_HANDLE)PackageNode,
- (AML_NODE_HANDLE)DataNode
- );
-  if (EFI_ERROR (Status)) {
-ASSERT (0);
-goto error_handler;
-  }
+Status = AmlVarListAddTail (
+   (AML_NODE_HANDLE)PackageNode,
+   (AML_NODE_HANDLE)DataNode
+   );
+if (EFI_ERROR (Status)) {
+  ASSERT_EFI_ERROR (Status);
+  goto error_handler;
+}
+
+DataNode = NULL;
+  } else {
+Status = AmlCodeGenInteger (0, &NewElementNode);
+if (EFI_ERROR (Status)) {
+  ASSERT_EFI_ERROR (Status);
+  goto error_handler;
+}
 
-  DataNode = NULL;
+Status = AmlVarListAddTail (
+   (AML_NODE_HANDLE)PackageNode,
+

[edk2-devel] [PATCH v4 1/9] DynamicTablesPkg: Print specifier macro for CM_OBJECT_ID

2022-02-01 Thread PierreGondois
From: Pierre Gondois 

Add a macro that specifies the format for printing CM_OBJECT_ID.
This allows to print the CM_OBJECT_ID is a consistent way in the
output logs.

Signed-off-by: Pierre Gondois 
---

Notes:
v2:
- New patch, requested by Laszlo.

 DynamicTablesPkg/Include/ConfigurationManagerObject.h | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/Include/ConfigurationManagerObject.h 
b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
index 60d825a2b253..74ad25d5d94a 100644
--- a/DynamicTablesPkg/Include/ConfigurationManagerObject.h
+++ b/DynamicTablesPkg/Include/ConfigurationManagerObject.h
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+  Copyright (c) 2017 - 2022, ARM Limited. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -84,6 +84,11 @@ Object ID's in the ARM Namespace:
 */
 typedef UINT32 CM_OBJECT_ID;
 
+//
+// Helper macro to format a CM_OBJECT_ID.
+//
+#define FMT_CM_OBJECT_ID  "0x%lx"
+
 /** A mask for Object ID
 */
 #define OBJECT_ID_MASK  0xFF
-- 
2.25.1



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




[edk2-devel] [PATCH v4 2/9] DynamicTablesPkg: FdtHwInfoParserLib: Parse Pmu info

2022-02-01 Thread PierreGondois
From: Pierre Gondois 

Parse the Pmu interrupts if a pmu compatible node is present,
and populate the MADT GicC structure accordingly.

Signed-off-by: Pierre Gondois 
---

Notes:
v3:
 - New patch. [Pierre]
v4:
 - Add more information in ASSERT () checks. [Ard]

 .../FdtHwInfoParserLib/Gic/ArmGicCParser.c| 132 +-
 .../FdtHwInfoParserLib/Gic/ArmGicCParser.h|   8 +-
 2 files changed, 136 insertions(+), 4 deletions(-)

diff --git a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c 
b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c
index b4e6729a4ab2..fb01aa0d19e2 100644
--- a/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c
+++ b/DynamicTablesPkg/Library/FdtHwInfoParserLib/Gic/ArmGicCParser.c
@@ -1,13 +1,14 @@
 /** @file
   Arm Gic cpu parser.
 
-  Copyright (c) 2021, ARM Limited. All rights reserved.
+  Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
   @par Reference(s):
   - linux/Documentation/devicetree/bindings/arm/cpus.yaml
   - linux/Documentation/devicetree/bindings/interrupt-controller/arm,gic.yaml
   - 
linux/Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml
+  - linux/Documentation/devicetree/bindings/arm/pmu.yaml
 **/
 
 #include "FdtHwInfoParser.h"
@@ -34,6 +35,21 @@ STATIC CONST COMPATIBILITY_INFO  CpuCompatibleInfo = {
   CpuCompatibleStr
 };
 
+/** Pmu compatible strings.
+
+  Any other "compatible" value is not supported by this module.
+*/
+STATIC CONST COMPATIBILITY_STR  PmuCompatibleStr[] = {
+  { "arm,armv8-pmuv3" }
+};
+
+/** COMPATIBILITY_INFO structure for the PmuCompatibleStr.
+*/
+CONST COMPATIBILITY_INFO  PmuCompatibleInfo = {
+  ARRAY_SIZE (PmuCompatibleStr),
+  PmuCompatibleStr
+};
+
 /** Parse a "cpu" node.
 
   @param [in]  Fdt  Pointer to a Flattened Device Tree (Fdt).
@@ -639,6 +655,111 @@ GicCv3IntcNodeParser (
   return EFI_SUCCESS;
 }
 
+/** Parse a Pmu compatible node, extracting Pmu information.
+
+  This function modifies a CM_OBJ_DESCRIPTOR object.
+  The following CM_ARM_GICC_INFO fields are patched:
+- PerformanceInterruptGsiv;
+
+  @param [in]   Fdt  Pointer to a Flattened Device Tree (Fdt).
+  @param [in]   GicIntcNode  Offset of a Gic compatible
+ interrupt-controller node.
+  @param [in, out]  GicCCmObjDescThe CM_ARM_GICC_INFO to patch.
+
+  @retval EFI_SUCCESS The function completed successfully.
+  @retval EFI_ABORTED An error occurred.
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+GicCPmuNodeParser (
+  IN  CONST VOID   *Fdt,
+  ININT32  GicIntcNode,
+  IN  OUT   CM_OBJ_DESCRIPTOR  *GicCCmObjDesc
+  )
+{
+  EFI_STATUSStatus;
+  INT32 IntCells;
+  INT32 PmuNode;
+  UINT32PmuNodeCount;
+  UINT32PmuIrq;
+  UINT32Index;
+  CM_ARM_GICC_INFO  *GicCInfo;
+  CONST UINT8   *Data;
+  INT32 DataSize;
+
+  if (GicCCmObjDesc == NULL) {
+ASSERT (GicCCmObjDesc != NULL);
+return EFI_INVALID_PARAMETER;
+  }
+
+  GicCInfo = (CM_ARM_GICC_INFO *)GicCCmObjDesc->Data;
+  PmuNode  = 0;
+
+  // Count the number of pmu nodes.
+  Status = FdtCountCompatNodeInBranch (
+ Fdt,
+ 0,
+ &PmuCompatibleInfo,
+ &PmuNodeCount
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT_EFI_ERROR (Status);
+return Status;
+  }
+
+  if (PmuNodeCount == 0) {
+return EFI_NOT_FOUND;
+  }
+
+  Status = FdtGetNextCompatNodeInBranch (
+ Fdt,
+ 0,
+ &PmuCompatibleInfo,
+ &PmuNode
+ );
+  if (EFI_ERROR (Status)) {
+ASSERT_EFI_ERROR (Status);
+if (Status == EFI_NOT_FOUND) {
+  // Should have found the node.
+  Status = EFI_ABORTED;
+}
+  }
+
+  // Get the number of cells used to encode an interrupt.
+  Status = FdtGetInterruptCellsInfo (Fdt, GicIntcNode, &IntCells);
+  if (EFI_ERROR (Status)) {
+ASSERT_EFI_ERROR (Status);
+return Status;
+  }
+
+  Data = fdt_getprop (Fdt, PmuNode, "interrupts", &DataSize);
+  if ((Data == NULL) || (DataSize != (IntCells * sizeof (UINT32 {
+// If error or not 1 interrupt.
+ASSERT (Data != NULL);
+ASSERT (DataSize == (IntCells * sizeof (UINT32)));
+return EFI_ABORTED;
+  }
+
+  PmuIrq = FdtGetInterruptId ((CONST UINT32 *)Data);
+
+  // Only supports PPI 23 for now.
+  // According to BSA 1.0 s3.6 PPI assignments, PMU IRQ ID is 23. A non BSA
+  // compliant system may assign a different IRQ for the PMU, however this
+  // is not implemented for now.
+  if (PmuIrq != BSA_PMU_IRQ) {
+ASSERT (PmuIrq == BSA_PMU_IRQ);
+return EFI_ABORTED;
+  }
+
+  for (Index = 0; Index < GicCCmObjDesc->Count; Index++) {
+GicCInfo[Index].PerformanceInterruptGsiv = PmuIrq;
+  }
+
+  retu

[edk2-devel] [PATCH v4 0/9] Add ACPI support for Kvmtool

2022-02-01 Thread PierreGondois
From: Pierre Gondois 

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3742
V1: https://edk2.groups.io/g/devel/message/76990
V2:
- New patch: "DynamicTablesPkg: Print specifier macro for
  CM_OBJECT_ID" [Laszlo]
- Only add AcpiView for ArmVirtKvmTool instead of all ArmVirt
  platforms. This is done using a 'ACPIVIEW_ENABLE' switch.
  [Laszlo]
- Only generate ACPI tables for AARCH64. [Laszlo]
- Various modifications (error handling, patch organization,
  coding style, etc). [Laszlo]
V3:
- To fix bugs reported by Linux (signaled by Ard):
  - Add patch to parse and populate PMU information.
  - Add patch to strictly comply to the first model at ACPI
6.4 s6.2.13 to describe PCI legacy interrupts using _PRT.
  - Add address size limit to IORT PCI root complex.
V4:
- Describe PCI legacy interrupts using GSI and remove link
  device generation. [Pierre]
- Add more description in ASSERT macros. [Ard]

The changes can be seen at:
https://github.com/PierreARM/edk2/tree/1456_Add_ACPI_support_for_Kvmtool_v4
The results of the CI can be seen at:
https://github.com/tianocore/edk2/pull/2475

The patch depends on the KvmTool patch at:
https://lists.cs.columbia.edu/pipermail/kvmarm/2022-January/051865.html

Kvmtool dynamically generates a device tree describing the platform
to boot on. Using the patch-sets listed below, the DynamicTables
framework generates ACPI tables describing a similar platform.

This patch-set:
 - adds a ConfigurationManager and make use of the DynamicTablesPkg
   in for Kvmtool for AARCH64, allowing to generate ACPI tables
 - adds the acpiview command line utility to the ArmVirtPkg
   platform that request if via the ACPIVIEW_ENABLE macro
 - update ArmVirtPkg.ci.yaml to add new words and use the
   DynamicTablesPkg
 - adds a print specifier macro for the CM_OBJECT_ID type

With this patchset, KvmTool on AARCH64 will use ACPI tables instead
of a Device Tree (cf PcdForceNoAcpi Pcd).

Pierre Gondois (5):
  DynamicTablesPkg: Print specifier macro for CM_OBJECT_ID
  DynamicTablesPkg: FdtHwInfoParserLib: Parse Pmu info
  DynamicTablesPkg: AmlLib: AmlAddPrtEntry() to handle GSI
  DynamicTablesPkg: AcpiSsdtPcieLibArm: Remove link device generation
  ArmVirtPkg: Add cspell exceptions

Sami Mujawar (4):
  ArmVirtPkg/Kvmtool: Add DSDT ACPI table
  ArmVirtPkg/Kvmtool: Add Configuration Manager
  ArmVirtPkg/Kvmtool: Enable ACPI support
  ArmVirtPkg/Kvmtool: Enable Acpiview

 ArmVirtPkg/ArmVirt.dsc.inc|5 +-
 ArmVirtPkg/ArmVirtKvmTool.dsc |   22 +-
 ArmVirtPkg/ArmVirtKvmTool.fdf |   15 +-
 ArmVirtPkg/ArmVirtPkg.ci.yaml |6 +-
 .../KvmtoolCfgMgrDxe/AslTables/Dsdt.asl   |   21 +
 .../KvmtoolCfgMgrDxe/ConfigurationManager.c   | 1065 +
 .../KvmtoolCfgMgrDxe/ConfigurationManager.h   |  125 ++
 .../ConfigurationManagerDxe.inf   |   54 +
 .../Include/ConfigurationManagerObject.h  |7 +-
 .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c|  239 +---
 .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.h|   64 +-
 .../Common/AmlLib/CodeGen/AmlCodeGen.c|   89 +-
 .../FdtHwInfoParserLib/Gic/ArmGicCParser.c|  132 +-
 .../FdtHwInfoParserLib/Gic/ArmGicCParser.h|8 +-
 14 files changed, 1518 insertions(+), 334 deletions(-)
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/AslTables/Dsdt.asl
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.c
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManager.h
 create mode 100644 ArmVirtPkg/KvmtoolCfgMgrDxe/ConfigurationManagerDxe.inf

-- 
2.25.1



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




[edk2-devel] [PATCH edk2-platforms] Platform/Overdrive: enable resizable BAR support

2022-02-01 Thread Ard Biesheuvel
Enable resizable BAR support so that BARs for, e.g., GPU cards that are
sized conservatively by default, but can be resized to cover all of the
GPU's VRAM, are resized by the firmware before handing over to the OS.
This is a more appropriate time to perform the resize, as usually, the
boot time GPU driver and the GOP will be up during PCI discovery of the
OS.

Tested on Overdrive B1 with an AMD GPU based on the Oland ASIC and the
Linux radeon driver (which does not implement PCI BAR resizing in the
first place)

Signed-off-by: Ard Biesheuvel 
---
 Platform/AMD/OverdriveBoard/OverdriveBoard.dsc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc 
b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
index af207391209c..01d320a6d0ef 100644
--- a/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
+++ b/Platform/AMD/OverdriveBoard/OverdriveBoard.dsc
@@ -452,6 +452,8 @@ [PcdsFixedAtBuild.common]
   gAmdModulePkgTokenSpaceGuid.PcdPort0NetSpeed|1
   gAmdModulePkgTokenSpaceGuid.PcdPort1NetSpeed|1
 
+  gEfiMdeModulePkgTokenSpaceGuid.PcdPcieResizableBarSupport|TRUE
+
 [PcdsDynamicDefault.common]
   gAmdStyxTokenSpaceGuid.PcdEthMacA|{0x2,0xA1,0xA2,0xA3,0xA4,0xA5}
   gAmdStyxTokenSpaceGuid.PcdEthMacB|{0x2,0xB1,0xB2,0xB3,0xB4,0xB5}
-- 
2.30.2



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




Re: [edk2-devel] [PATCH 1/2] Maintainers.txt: add missing github IDs to OvmfPkf/Fdt reviewers

2022-02-01 Thread Gerd Hoffmann
On Mon, Jan 31, 2022 at 11:40:41AM +, Leif Lindholm wrote:
> This section seems to have been missed when introducing github IDs,
> so add them.
> 
> Cc: Andrew Fish 
> Cc: Michael D Kinney 
> Signed-off-by: Leif Lindholm 
> ---
>  Maintainers.txt | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/Maintainers.txt b/Maintainers.txt
> index 4c5d3111c2ec..5d0679cb713c 100644
> --- a/Maintainers.txt
> +++ b/Maintainers.txt
> @@ -477,9 +477,9 @@ R: Tom Lendacky  [tlendacky]
>  
>  OvmfPkg: FDT related modules
>  F: OvmfPkg/Fdt
> -R: Leif Lindholm 
> -R: Gerd Hoffmann 
> -R: Abner Chang 
> +R: Leif Lindholm  [leiflindholm]
> +R: Gerd Hoffmann  [kraxel]
> +R: Abner Chang  [changab]

Acked-by: Gerd Hoffmann 



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




Re: [edk2-devel] [PATCH] MdeModulePkg/Frontpage: Get SMBIOS Data from table directly

2022-02-01 Thread Michael Brown

On 01/02/2022 09:34, Sean Rhodes wrote:

Gather information from SMBIOS table rather than getting it
from the EFI SMBIOS protocol for coreboot builds.


Could you not avoid code duplication by exposing the SMBIOS table via 
EFI_SMBIOS_PROTOCOL?  This would provide a much more general solution 
that would not be specific to UiApp/Frontpage.c.


Michael


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#86276): https://edk2.groups.io/g/devel/message/86276
Mute This Topic: https://groups.io/mt/88828789/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/24] CryptoPkg/openssl: update openssl submodule to v3.0

2022-02-01 Thread Gerd Hoffmann
  Hi,

> That means I believe GCCINTRINx86-32.lib, CLANGINTRINx86-32.lib and 
> XCODEINTRINx86-32.lib could be simply created
> using these files her:
> https://opensource.apple.com/source/clang/clang-600.0.57/src/projects/compiler-rt/lib/i386/
> or
> https://github.com/llvm/llvm-project/tree/main/compiler-rt/lib/builtins/i386
> Than we have the space saving assembler implementation for all GCC derivates.

Yes, using the source and compiling our own probably works better
because we don't run into abi problems that way.

> BTW: Microsoft source is leaked here:
> https://github.com/microsoft/Ironclad/blob/main/ironclad-apps/src/Checked/BootLoader/SingLdrPc/x86/blcrtasm.asm

I doubt using leaked sources is a good idea from a legal/licensing point
of view ...

> There is also a library INT64.LIB in the current Windows 10 SDK, and also in 
> the old WinDDK 7600.
> C:\WinDDK\7600.16385.1\lib\wxp\i386\int64.lib

... but if there is a library with only the 64bit math intrinsics and
nothing else it is maybe easy enough to use the library as-is when
building with the microsoft compiler.

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#86275): https://edk2.groups.io/g/devel/message/86275
Mute This Topic: https://groups.io/mt/87479913/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/24] CryptoPkg/openssl: update openssl submodule to v3.0

2022-02-01 Thread Gerd Hoffmann
On Fri, Jan 28, 2022 at 04:00:26PM +, Pedro Falcato wrote:
> Also, quick note: I've seen linking blowing up because the ABIs being used
> in the bare metal code and in libgcc were different; this was in riscv64. I
> know x86 doesn't do such checks but a few others do, including RISCV (they
> tag object files with the ABI). This makes libgcc unusable in such
> architectures.

Same on arm, object files seem to be tagged with the floating point abi
used (even in case the object files doesn't actually use floating point
instructions) and the linker throws errors in case there is a mismatch.

> If we want to provide intrinsics, then possibly shipping our own
> compiler-rt would be the only solid option.

Yes, I suspect that'll work better than trying to use the
compiler-shipped intrinsics.

But in any case we should have a single intrinsic library for
everybody to use.

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#86274): https://edk2.groups.io/g/devel/message/86274
Mute This Topic: https://groups.io/mt/87479913/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/24] CryptoPkg/openssl: update openssl submodule to v3.0

2022-02-01 Thread Gerd Hoffmann
On Fri, Jan 28, 2022 at 03:54:00PM +, Pedro Falcato wrote:
> Gerd,
> 
> As I mentioned earlier, abort() is one of 5 functions GCC expects in
> freestanding mode (plus memset, mempy and two others).
> 
> Is there any floating point enabled somewhere? I really don't remember
> having seen those undefined references to fprintf, ever.

That is one of the things I havn't figured yet ...

libgcc is basically a collection of object files, and the linker should
cherry-pick those which it needs (for example add the _divdi3.o object
to resolve the __divdi3 symbol) and ignore everything else.

The "ignore everything else" part seems to not work though:

> > /usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/libgcc.a(_absvsi2.o): in
> > function `__absvdi2':
> > (.text+0x18): undefined reference to `abort'

Nothing in edk2 needs __absvdi2.  Nevertheless the linker looks at
_absvsi2.o and tries to resolve the symbols used.

Unpacking libgcc, cherry-picking the object files actually needed, then
packing the picked object files into a library and use that works.  But
IMHO that is something the linker should be able to figure on its own.

take care,
  Gerd



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




[edk2-devel] [PATCH] MdeModulePkg/Frontpage: Get SMBIOS Data from table directly

2022-02-01 Thread Sean Rhodes
Gather information from SMBIOS table rather than getting it
from the EFI SMBIOS protocol for coreboot builds.

Signed-off-by: Matt DeVillier 
Signed-off-by: Sean Rhodes 
---
 MdeModulePkg/Application/UiApp/FrontPage.c | 196 -
 MdeModulePkg/Application/UiApp/UiApp.inf   |   2 +
 MdeModulePkg/MdeModulePkg.dec  |   2 +
 UefiPayloadPkg/UefiPayloadPkg.dsc  |   6 +
 4 files changed, 205 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Application/UiApp/FrontPage.c 
b/MdeModulePkg/Application/UiApp/FrontPage.c
index cc9569e225..1a7182c4dc 100644
--- a/MdeModulePkg/Application/UiApp/FrontPage.c
+++ b/MdeModulePkg/Application/UiApp/FrontPage.c
@@ -293,7 +293,11 @@ InitializeFrontPage (
   //
   // Updata Front Page banner strings
   //
-  UpdateFrontPageBannerStrings ();
+  if (FixedPcdGetBool (PcdCoreboot)) {
+DirectUpdateFrontPageBannerStrings ();
+  } else {
+UpdateFrontPageBannerStrings ();
+  }
 
   //
   // Update front page menus.
@@ -496,6 +500,55 @@ GetOptionalStringByIndex (
   return EFI_SUCCESS;
 }
 
+UINT16
+SmbiosTableLength (
+  SMBIOS_STRUCTURE_POINTER  SmbiosTableN
+  )
+{
+  CHAR8   *AChar;
+  UINT16  Length;
+
+  AChar = (CHAR8 *)(SmbiosTableN.Raw + SmbiosTableN.Hdr->Length);
+  while ((*AChar != 0) || (*(AChar + 1) != 0)) {
+AChar++;  // stop at 00 - first 0
+  }
+
+  Length = (UINT16)((UINTN)AChar - (UINTN)SmbiosTableN.Raw + 2); // length 
includes 00
+  return Length;
+}
+
+SMBIOS_STRUCTURE_POINTER
+GetSmbiosTableFromType (
+  SMBIOS_TABLE_ENTRY_POINT  *SmbiosPoint,
+  UINT8 SmbiosType,
+  UINTN IndexTable
+  )
+{
+  SMBIOS_STRUCTURE_POINTER  SmbiosTableN;
+  UINTN SmbiosTypeIndex;
+
+  SmbiosTypeIndex  = 0;
+  SmbiosTableN.Raw = (UINT8 *)((UINTN)SmbiosPoint->TableAddress);
+  if (SmbiosTableN.Raw == NULL) {
+return SmbiosTableN;
+  }
+
+  while ((SmbiosTypeIndex != IndexTable) || (SmbiosTableN.Hdr->Type != 
SmbiosType)) {
+if (SmbiosTableN.Hdr->Type == SMBIOS_TYPE_END_OF_TABLE) {
+  SmbiosTableN.Raw = NULL;
+  return SmbiosTableN;
+}
+
+if (SmbiosTableN.Hdr->Type == SmbiosType) {
+  SmbiosTypeIndex++;
+}
+
+SmbiosTableN.Raw = (UINT8 *)(SmbiosTableN.Raw + SmbiosTableLength 
(SmbiosTableN));
+  }
+
+  return SmbiosTableN;
+}
+
 /**
 
   Update the banner information for the Front Page based on Smbios information.
@@ -662,6 +715,147 @@ UpdateFrontPageBannerStrings (
   FreePool (NewString);
 }
 
+/**
+
+  Update the banner information for the Front Page based on table.
+
+**/
+VOID
+DirectUpdateFrontPageBannerStrings (
+  VOID
+  )
+{
+  CHAR16*MemoryStr;
+  EFI_STATUSStatus;
+  EFI_STRING_ID TokenToUpdate;
+  EFI_PHYSICAL_ADDRESS  *Table;
+  SMBIOS_TABLE_ENTRY_POINT  *EntryPoint;
+  SMBIOS_STRUCTURE_POINTER  SmbiosTable;
+  UINT64InstalledMemory;
+
+  InstalledMemory = 0;
+
+  //
+  // Update Front Page strings
+  //
+  Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID 
**)&Table);
+  if (EFI_ERROR (Status) || (Table == NULL)) {
+  } else {
+EntryPoint = (SMBIOS_TABLE_ENTRY_POINT *)Table;
+
+SmbiosTable = GetSmbiosTableFromType (EntryPoint, 
EFI_SMBIOS_TYPE_BIOS_INFORMATION, 0);
+
+if (SmbiosTable.Raw != NULL) {
+  CHAR16  *FwVersion;
+  CHAR16  *FwDate;
+  CHAR16  *TmpBuffer;
+  UINT8   VersionIdx;
+  UINT8   DateIdx;
+
+  TmpBuffer = AllocateZeroPool (0x60);
+
+  VersionIdx = SmbiosTable.Type0->BiosVersion;
+  DateIdx= SmbiosTable.Type0->BiosReleaseDate;
+
+  GetOptionalStringByIndex ((CHAR8 *)((UINT8 *)SmbiosTable.Raw + 
SmbiosTable.Hdr->Length), VersionIdx, &FwVersion);
+  GetOptionalStringByIndex ((CHAR8 *)((UINT8 *)SmbiosTable.Raw + 
SmbiosTable.Hdr->Length), DateIdx, &FwDate);
+
+  StrCatS (TmpBuffer, 0x60 / sizeof (CHAR16), L"FW: ");
+  StrCatS (TmpBuffer, 0x60 / sizeof (CHAR16), FwVersion);
+  StrCatS (TmpBuffer, 0x60 / sizeof (CHAR16), L" ");
+  StrCatS (TmpBuffer, 0x60 / sizeof (CHAR16), FwDate);
+
+  TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION);
+  HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, TmpBuffer, 
NULL);
+
+  FreePool (FwVersion);
+  FreePool (FwDate);
+  FreePool (TmpBuffer);
+}
+
+SmbiosTable = GetSmbiosTableFromType (EntryPoint, 
SMBIOS_TYPE_SYSTEM_INFORMATION, 0);
+
+if (SmbiosTable.Raw != NULL) {
+  CHAR16  *ProductName;
+  CHAR16  *Manufacturer;
+  CHAR16  *DeviceName;
+  CHAR16  *TmpBuffer;
+  UINT8   ProductIdx;
+  UINT8   ManIdx;
+
+  TmpBuffer  = AllocateZeroPool (0x60);
+  DeviceName = AllocateZeroPool (0x60);
+
+  ProductIdx = SmbiosTable.Type1->ProductName;
+  ManIdx = SmbiosTable.Type1->Manufacturer;
+
+  GetOptionalStringByIndex ((CHAR8 *)((UINT8 *)SmbiosTable.Raw + 
SmbiosTable.Hdr->Length), ProductIdx, &ProductName);
+  GetOptionalStringB