[edk2-devel] [PATCH v2 1/1] MdePkg/Cpuid.h: Change and add some macro definitions.

2021-01-20 Thread Jason Lou
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3105

Change and add some macro definitions about
CPUID_HYBRID_INFORMATION Leaf(1Ah).

Signed-off-by: Jason Lou 
Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Zhiguang Liu 
Cc: Ray Ni 
Cc: Eric Dong 
Cc: Laszlo Ersek 
Cc: Rahul Kumar 
---
 UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c |  2 +-
 MdePkg/Include/Register/Intel/Cpuid.h| 17 +
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c 
b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
index 6b87be261acf..d1f9830c91e7 100644
--- a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
+++ b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
@@ -175,7 +175,7 @@ CpuCacheInfoCollectCoreAndCacheData (
   //
   Context->ProcessorInfo[ProcessorIndex].CoreType = 0;
   if (CpuidMaxInput >= CPUID_HYBRID_INFORMATION) {
-AsmCpuidEx (CPUID_HYBRID_INFORMATION, CPUID_HYBRID_INFORMATION_SUB_LEAF, 
, NULL, NULL, NULL);
+AsmCpuidEx (CPUID_HYBRID_INFORMATION, CPUID_HYBRID_INFORMATION_MAIN_LEAF, 
, NULL, NULL, NULL);
 Context->ProcessorInfo[ProcessorIndex].CoreType = (UINT8) 
NativeModelIdAndCoreTypeEax.Bits.CoreType;
   }
 
diff --git a/MdePkg/Include/Register/Intel/Cpuid.h 
b/MdePkg/Include/Register/Intel/Cpuid.h
index dd1b64a1e50b..a670ab436c37 100644
--- a/MdePkg/Include/Register/Intel/Cpuid.h
+++ b/MdePkg/Include/Register/Intel/Cpuid.h
@@ -3601,7 +3601,7 @@ typedef union {
   CPUID Hybrid Information Enumeration Leaf
 
   @param   EAX  CPUID_HYBRID_INFORMATION (0x1A)
-  @param   ECX  CPUID_HYBRID_INFORMATION_SUB_LEAF (0x00).
+  @param   ECX  CPUID_HYBRID_INFORMATION_MAIN_LEAF (0x00).
 
   @retval  EAX  Enumerates the native model ID and core type described
 by the type CPUID_NATIVE_MODEL_ID_AND_CORE_TYPE_EAX
@@ -3615,7 +3615,7 @@ typedef union {
 
   AsmCpuidEx (
 CPUID_HYBRID_INFORMATION,
-CPUID_HYBRID_INFORMATION_SUB_LEAF,
+CPUID_HYBRID_INFORMATION_MAIN_LEAF,
 , NULL, NULL, NULL
 );
   @endcode
@@ -3626,11 +3626,11 @@ typedef union {
 ///
 /// CPUID Hybrid Information Enumeration sub-leaf
 ///
-#define CPUID_HYBRID_INFORMATION_SUB_LEAF   0x00
+#define CPUID_HYBRID_INFORMATION_MAIN_LEAF  0x00
 
 /**
   CPUID Hybrid Information EAX for CPUID leaf #CPUID_HYBRID_INFORMATION,
-  sub-leaf #CPUID_HYBRID_INFORMATION_SUB_LEAF.
+  sub-leaf #CPUID_HYBRID_INFORMATION_MAIN_LEAF.
 **/
 typedef union {
   ///
@@ -3657,6 +3657,15 @@ typedef union {
   UINT32  Uint32;
 } CPUID_NATIVE_MODEL_ID_AND_CORE_TYPE_EAX;
 
+///
+/// @{ Define value for CPUID_NATIVE_MODEL_ID_AND_CORE_TYPE_EAX.CoreType
+///
+#define   CPUID_CORE_TYPE_INTEL_ATOM0x20
+#define   CPUID_CORE_TYPE_INTEL_CORE0x40
+///
+/// @}
+///
+
 
 /**
   CPUID V2 Extended Topology Enumeration Leaf
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70610): https://edk2.groups.io/g/devel/message/70610
Mute This Topic: https://groups.io/mt/79998848/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 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list

2021-01-20 Thread Kun Qin
Hi Liming,

It trips on the coding style where “Function name does not follow the rules: 1. 
First character should be upper case 2. Must contain lower case characters 3. 
No white space characters”. Please see detailed error info here:
https://dev.azure.com/tianocore/edk2-ci/_build/results?buildId=18722=logs=dc79cb3a-f339-5fc0-73b1-0ff8c522379e=b5b21d01-2921-57ea-8401-4c0ebee10613=69

This patch ([PATCH v3 02/18] StandaloneMmPkg: StandaloneMmCoreEntryPoint: 
Extends support for X64 
(groups.io)) added a new instance 
for StandaloneMmCoreEntryPoint library and failed on ECC check 8006 due to the 
function name involved.

Regards,
Kun

From: gaoliming
Sent: Wednesday, January 20, 2021 17:45
To: 'Kun Qin'; 
devel@edk2.groups.io
Cc: 'Bob Feng'; 'Yuwei 
Chen'
Subject: 回复: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added 
_ModuleEntryPoint into exception list

Qin:
 This change makes sense. Can you let me know which case trigs this ECC issue? 
Does your patch include such case?

Thanks
Liming
发件人: Kun Qin 
发送时间: 2021年1月21日 9:37
收件人: devel@edk2.groups.io
抄送: Bob Feng ; Liming Gao ; 
Yuwei Chen 
主题: RE: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added 
_ModuleEntryPoint into exception list

Hi Bob/Liming/Yuwei,

Do you mind providing some feedback on this patch? This is to unblock the 
second patch (adding driver entry point instance for Standalone X64) of this 
patch series. Thanks in advance!

Regards,
Kun

From: Kun Qin
Sent: Thursday, January 14, 2021 14:34
To: devel@edk2.groups.io
Cc: Bob Feng; Liming 
Gao; Yuwei Chen
Subject: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added 
_ModuleEntryPoint into exception list

Function '_ModuleEntryPoint' is a pre-defined interface for various EFI
module types and should not be caught violating EFI coding style. This
change added '_ModuleEntryPoint' into exception list to fix EFI coding
style error 8006 during CI build.

Cc: Bob Feng mailto:bob.c.f...@intel.com>>
Cc: Liming Gao mailto:gaolim...@byosoft.com.cn>>
Cc: Yuwei Chen mailto:yuwei.c...@intel.com>>

Signed-off-by: Kun Qin mailto:ku...@outlook.com>>
---

Notes:
v3:
- Newly added to fix CI build on changing '_ModuleEntryPoint'

 BaseTools/Source/Python/Ecc/exception.xml | 4 
 1 file changed, 4 insertions(+)

diff --git a/BaseTools/Source/Python/Ecc/exception.xml 
b/BaseTools/Source/Python/Ecc/exception.xml
index 8133904fbc7f..f2334aab8e52 100644
--- a/BaseTools/Source/Python/Ecc/exception.xml
+++ b/BaseTools/Source/Python/Ecc/exception.xml
@@ -296,6 +296,10 @@
 _DriverUnloadHandler
 8006
   
+  
+_ModuleEntryPoint
+8006
+  
   
 ASSERT
 10015
--
2.30.0.windows.1









-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70609): https://edk2.groups.io/g/devel/message/70609
Mute This Topic: https://groups.io/mt/79994670/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 12/18] PcAtChipsetPkg: AcpiTimerLib: Added StandaloneMm instance of AcpiTimerLib

2021-01-20 Thread Kun Qin
Hi Ray,

I updated the file names as suggested on the previous round. Do you have any 
further comments/feedback?

Thanks,
Kun

From: Kun Qin
Sent: Thursday, January 14, 2021 14:37
To: devel@edk2.groups.io
Cc: Ray Ni
Subject: [edk2-devel] [PATCH v3 12/18] PcAtChipsetPkg: AcpiTimerLib: Added 
StandaloneMm instance of AcpiTimerLib

This change added a new instance of AcpiTimerLib for StandaloneMm core
and drivers. It centralizes the common routines into shared files and
abstract the library constructor into corresponding files to accommodate
each constructor function prototypes.

Cc: Ray Ni 

Signed-off-by: Kun Qin 
---

Notes:
v3:
- Renamed "CommonAcpiTimerLib" to "DxeStandaloneMmAcpiTimerLib" to
avoid confusion [Ray]
- Renamed BASE NAME (and file name) to StandaloneMmAcpiTimerLib [Ray]

v2:
- Removed "EFIAPI" for internal functions.

 PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c  
   | 81 +---
 PcAtChipsetPkg/Library/AcpiTimerLib/{DxeAcpiTimerLib.c => 
DxeStandaloneMmAcpiTimerLib.c}  |  9 +--
 PcAtChipsetPkg/Library/AcpiTimerLib/StandaloneMmAcpiTimerLib.c 
   | 31 
 PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.inf
   |  2 +
 PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.h  
   | 24 ++
 PcAtChipsetPkg/Library/AcpiTimerLib/{DxeAcpiTimerLib.inf => 
StandaloneMmAcpiTimerLib.inf} | 19 +++--
 PcAtChipsetPkg/PcAtChipsetPkg.dsc  
   |  1 +
 7 files changed, 74 insertions(+), 93 deletions(-)

diff --git a/PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c 
b/PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c
index 3ad831b15e8a..9ac2a446e365 100644
--- a/PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c
+++ b/PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c
@@ -2,72 +2,14 @@
   ACPI Timer implements one instance of Timer Library.

   Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) Microsoft Corporation.
   SPDX-License-Identifier: BSD-2-Clause-Patent

 **/

 #include 
-#include 
-#include 
-#include 

-extern GUID mFrequencyHobGuid;
-
-/**
-  The constructor function enables ACPI IO space.
-
-  If ACPI I/O space not enabled, this function will enable it.
-  It will always return RETURN_SUCCESS.
-
-  @retval EFI_SUCCESS   The constructor always returns RETURN_SUCCESS.
-
-**/
-RETURN_STATUS
-EFIAPI
-AcpiTimerLibConstructor (
-  VOID
-  );
-
-/**
-  Calculate TSC frequency.
-
-  The TSC counting frequency is determined by comparing how far it counts
-  during a 101.4 us period as determined by the ACPI timer.
-  The ACPI timer is used because it counts at a known frequency.
-  The TSC is sampled, followed by waiting 363 counts of the ACPI timer,
-  or 101.4 us. The TSC is then sampled again. The difference multiplied by
-  9861 is the TSC frequency. There will be a small error because of the
-  overhead of reading the ACPI timer. An attempt is made to determine and
-  compensate for this error.
-
-  @return The number of TSC counts per second.
-
-**/
-UINT64
-InternalCalculateTscFrequency (
-  VOID
-  );
-
-//
-// Cached performance counter frequency
-//
-UINT64  mPerformanceCounterFrequency = 0;
-
-/**
-  Internal function to retrieves the 64-bit frequency in Hz.
-
-  Internal function to retrieves the 64-bit frequency in Hz.
-
-  @return The frequency in Hz.
-
-**/
-UINT64
-InternalGetPerformanceCounterFrequency (
-  VOID
-  )
-{
-  return  mPerformanceCounterFrequency;
-}
+#include "DxeStandaloneMmAcpiTimerLib.h"

 /**
   The constructor function enables ACPI IO space, and caches 
PerformanceCounterFrequency.
@@ -85,22 +27,5 @@ DxeAcpiTimerLibConstructor (
   IN EFI_SYSTEM_TABLE  *SystemTable
   )
 {
-  EFI_HOB_GUID_TYPE   *GuidHob;
-
-  //
-  // Enable ACPI IO space.
-  //
-  AcpiTimerLibConstructor ();
-
-  //
-  // Initialize PerformanceCounterFrequency
-  //
-  GuidHob = GetFirstGuidHob ();
-  if (GuidHob != NULL) {
-mPerformanceCounterFrequency = *(UINT64*)GET_GUID_HOB_DATA (GuidHob);
-  } else {
-mPerformanceCounterFrequency = InternalCalculateTscFrequency ();
-  }
-
-  return EFI_SUCCESS;
+  return CommonAcpiTimerLibConstructor ();
 }
diff --git a/PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c 
b/PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.c
similarity index 86%
copy from PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c
copy to PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.c
index 3ad831b15e8a..0e401194d01d 100644
--- a/PcAtChipsetPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c
+++ b/PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.c
@@ -72,17 +72,12 @@ InternalGetPerformanceCounterFrequency (
 /**
   The constructor function enables ACPI IO space, and caches 

回复: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list

2021-01-20 Thread gaoliming
Qin:

 This change makes sense. Can you let me know which case trigs this ECC
issue? Does your patch include such case?

 

Thanks

Liming

发件人: Kun Qin  
发送时间: 2021年1月21日 9:37
收件人: devel@edk2.groups.io
抄送: Bob Feng ; Liming Gao
; Yuwei Chen 
主题: RE: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added
_ModuleEntryPoint into exception list

 

Hi Bob/Liming/Yuwei,

 

Do you mind providing some feedback on this patch? This is to unblock the
second patch (adding driver entry point instance for Standalone X64) of this
patch series. Thanks in advance!

 

Regards,

Kun

 

From: Kun Qin  
Sent: Thursday, January 14, 2021 14:34
To: devel@edk2.groups.io  
Cc: Bob Feng  ; Liming Gao
 ; Yuwei Chen 

Subject: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added
_ModuleEntryPoint into exception list

 

Function '_ModuleEntryPoint' is a pre-defined interface for various EFI
module types and should not be caught violating EFI coding style. This
change added '_ModuleEntryPoint' into exception list to fix EFI coding
style error 8006 during CI build.

Cc: Bob Feng mailto:bob.c.f...@intel.com> >
Cc: Liming Gao mailto:gaolim...@byosoft.com.cn> >
Cc: Yuwei Chen mailto:yuwei.c...@intel.com> >

Signed-off-by: Kun Qin mailto:ku...@outlook.com> >
---

Notes:
v3:
- Newly added to fix CI build on changing '_ModuleEntryPoint'

 BaseTools/Source/Python/Ecc/exception.xml | 4 
 1 file changed, 4 insertions(+)

diff --git a/BaseTools/Source/Python/Ecc/exception.xml
b/BaseTools/Source/Python/Ecc/exception.xml
index 8133904fbc7f..f2334aab8e52 100644
--- a/BaseTools/Source/Python/Ecc/exception.xml
+++ b/BaseTools/Source/Python/Ecc/exception.xml
@@ -296,6 +296,10 @@
 _DriverUnloadHandler
 8006
   
+  
+_ModuleEntryPoint
+8006
+  
   
 ASSERT
 10015
-- 
2.30.0.windows.1





 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70607): https://edk2.groups.io/g/devel/message/70607
Mute This Topic: https://groups.io/mt/79994517/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 05/18] StandaloneMmPkg: StandaloneMmMemLib: Extends support for X64 architecture

2021-01-20 Thread Kun Qin
Hi Jiewen,

Do you have further concerns about this specific patch? I did created a 
Bugzilla ticket to track the OS memory protection concern here: 3168 – Add 
non-MMRAM memory protection for Standalone MM environment 
(tianocore.org). It 
introduces a new proposal to allow access of DXE/RT regions from MMRAM, but 
requires non trivial change. Please let me know if you hold different opinions 
towards the proposal or this patch.

Thanks,
Kun

From: Kun Qin
Sent: Thursday, January 14, 2021 14:36
To: devel@edk2.groups.io
Cc: Ard Biesheuvel; Sami 
Mujawar; Jiewen Yao; 
Supreeth Venkatesh
Subject: [edk2-devel] [PATCH v3 05/18] StandaloneMmPkg: StandaloneMmMemLib: 
Extends support for X64 architecture

This change extends StandaloneMmMemLib library to support X64
architecture. The implementation is ported from MdePkg/Library/SmmMemLib.

Cc: Ard Biesheuvel 
Cc: Sami Mujawar 
Cc: Jiewen Yao 
Cc: Supreeth Venkatesh 

Signed-off-by: Kun Qin 
---

Notes:
v3:
- Updated destructor description of varibales to pass CI build.

v2:
- Added routine to fix bug of not initializing MmRanges [Jiewen]
- Extends support to x86 instead of x64 only [Hao]

 
StandaloneMmPkg/Library/StandaloneMmMemLib/AArch64/StandaloneMmMemLibInternal.c 
|  27 
 StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.c
 |  52 +++
 StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c 
 | 155 
 StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.inf  
 |  13 +-
 4 files changed, 246 insertions(+), 1 deletion(-)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmMemLib/AArch64/StandaloneMmMemLibInternal.c
 
b/StandaloneMmPkg/Library/StandaloneMmMemLib/AArch64/StandaloneMmMemLibInternal.c
index cb7c5e677a6b..4124959e0435 100644
--- 
a/StandaloneMmPkg/Library/StandaloneMmMemLib/AArch64/StandaloneMmMemLibInternal.c
+++ 
b/StandaloneMmPkg/Library/StandaloneMmMemLib/AArch64/StandaloneMmMemLibInternal.c
@@ -40,4 +40,31 @@ MmMemLibInternalCalculateMaximumSupportAddress (
   DEBUG ((DEBUG_INFO, "mMmMemLibInternalMaximumSupportAddress = 0x%lx\n", 
mMmMemLibInternalMaximumSupportAddress));
 }

+/**
+  Initialize cached Mmram Ranges from HOB.
+
+  @retval EFI_UNSUPPORTED   The routine is unable to extract MMRAM information.
+  @retval EFI_SUCCESS   MmRanges are populated successfully.
+
+**/
+EFI_STATUS
+MmMemLibInternalPopulateMmramRanges (
+  VOID
+  )
+{
+  // Not implemented for AARCH64.
+  return EFI_SUCCESS;
+}
+
+/**
+  Deinitialize cached Mmram Ranges.
+
+**/
+VOID
+MmMemLibInternalFreeMmramRanges (
+  VOID
+  )
+{
+  // Not implemented for AARCH64.
+}

diff --git a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.c 
b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.c
index b533bd8390cd..2737f95315eb 100644
--- a/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.c
+++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/StandaloneMmMemLib.c
@@ -37,6 +37,27 @@ MmMemLibInternalCalculateMaximumSupportAddress (
   VOID
   );

+/**
+  Initialize cached Mmram Ranges from HOB.
+
+  @retval EFI_UNSUPPORTED   The routine is unable to extract MMRAM information.
+  @retval EFI_SUCCESS   MmRanges are populated successfully.
+
+**/
+EFI_STATUS
+MmMemLibInternalPopulateMmramRanges (
+  VOID
+  );
+
+/**
+  Deinitialize cached Mmram Ranges.
+
+**/
+VOID
+MmMemLibInternalFreeMmramRanges (
+  VOID
+  );
+
 /**
   This function check if the buffer is valid per processor architecture and 
not overlap with MMRAM.

@@ -253,11 +274,42 @@ MemLibConstructor (
   IN EFI_MM_SYSTEM_TABLE*MmSystemTable
   )
 {
+  EFI_STATUS Status;

   //
   // Calculate and save maximum support address
   //
   MmMemLibInternalCalculateMaximumSupportAddress ();

+  //
+  // Initialize cached Mmram Ranges from HOB.
+  //
+  Status = MmMemLibInternalPopulateMmramRanges ();
+
+  return Status;
+}
+
+/**
+  Destructor for Mm Mem library.
+
+  @param ImageHandleThe image handle of the process.
+  @param MmSystemTable  The EFI System Table pointer.
+
+  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+MemLibDestructor (
+  IN EFI_HANDLE ImageHandle,
+  IN EFI_MM_SYSTEM_TABLE*MmSystemTable
+  )
+{
+
+  //
+  // Deinitialize cached Mmram Ranges.
+  //
+  MmMemLibInternalFreeMmramRanges ();
+
   return EFI_SUCCESS;
 }
diff --git 
a/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c 
b/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c
new file mode 100644
index ..1a978541716a
--- /dev/null
+++ b/StandaloneMmPkg/Library/StandaloneMmMemLib/X86StandaloneMmMemLibInternal.c
@@ -0,0 +1,155 @@
+/** 

回复: [edk2-devel] [PATCH v1 1/2] DynamicTablesPkg: Don't use gEfiMdeModulePkgTokenSpaceGuid

2021-01-20 Thread gaoliming
This change is correct. 

Reviewed-by: Liming Gao 

Thanks
Liming
> -邮件原件-
> 发件人: bounce+27952+70589+4905953+8761...@groups.io
>  代表 Joey Gouly
> 发送时间: 2021年1月21日 2:20
> 收件人: devel@edk2.groups.io
> 抄送: joey.go...@arm.com; ardb+tianoc...@kernel.org;
> sami.muja...@arm.com; jbra...@nvidia.com; ip...@nvidia.com;
> samer.el-haj-mahm...@arm.com; n...@arm.com
> 主题: [edk2-devel] [PATCH v1 1/2] DynamicTablesPkg: Don't use
> gEfiMdeModulePkgTokenSpaceGuid
> 
> Introduce gEdkiiDynamicTablesPkgTokenSpaceGuid and use that instead.
> 
> Signed-off-by: Joey Gouly 
> ---
>  DynamicTablesPkg/DynamicTablesPkg.dec
> | 10 ++
> 
> DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDx
> e.inf |  8 
>  2 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec
> b/DynamicTablesPkg/DynamicTablesPkg.dec
> index
> f36a6e8bb7c17f82acff3c766b15202b064a64b5..291a45a69679ae82219ecd2
> f26dfabfbab1f7f65 100644
> --- a/DynamicTablesPkg/DynamicTablesPkg.dec
> +++ b/DynamicTablesPkg/DynamicTablesPkg.dec
> @@ -1,7 +1,7 @@
>  ## @file
>  # dec file for Dynamic Tables Framework.
>  #
> -# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.
> +# Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -36,11 +36,13 @@ [Protocols]
>  [PcdsFixedAtBuild]
> 
># Maximum number of Custom ACPI Generators
> -
> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomACPIGenerators|1|UINT1
> 6|0xC001
> +
> gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomACPIGenerators|1|U
> INT16|0xC001
> 
># Maximum number of Custom SMBIOS Generators
> -
> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomSMBIOSGenerators|1|UI
> NT16|0xC002
> +
> gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomSMBIOSGenerators|
> 1|UINT16|0xC002
> 
># Maximum number of Custom DT Generators
> -
> gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomDTGenerators|1|UINT16|
> 0xC003
> +
> gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomDTGenerators|1|UI
> NT16|0xC003
> 
> +[Guids]
> +  gEdkiiDynamicTablesPkgTokenSpaceGuid = { 0xab226e66, 0x31d8, 0x4613,
> { 0x87, 0x9d, 0xd2, 0xfa, 0xb6, 0x10, 0x26, 0x3c } }
> diff --git
> a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactory
> Dxe.inf
> b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactory
> Dxe.inf
> index
> 56b69591ac52ca3ba51250dc01a0846b22442ce9..29ed3dc2e5029206f8852c
> 4b11240e7b493bbc57 100644
> ---
> a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactory
> Dxe.inf
> +++
> b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactory
> Dxe.inf
> @@ -1,7 +1,7 @@
>  ## @file
>  #  Module to manage the list of available table factories.
>  #
> -#  Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
> +#  Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  ##
> @@ -41,9 +41,9 @@ [LibraryClasses]
>UefiDriverEntryPoint
> 
>  [FixedPcd]
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomACPIGenerators
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomSMBIOSGenerators
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomDTGenerators
> +  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomACPIGenerators
> +
> gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomSMBIOSGenerators
> +  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomDTGenerators
> 
>  [Protocols]
>gEdkiiDynamicTableFactoryProtocolGuid # PRODUCES
> --
> Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70605): https://edk2.groups.io/g/devel/message/70605
Mute This Topic: https://groups.io/mt/79994422/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 01/18] BaseTools: Ecc/exception: Added _ModuleEntryPoint into exception list

2021-01-20 Thread Kun Qin
Hi Bob/Liming/Yuwei,

Do you mind providing some feedback on this patch? This is to unblock the 
second patch (adding driver entry point instance for Standalone X64) of this 
patch series. Thanks in advance!

Regards,
Kun

From: Kun Qin
Sent: Thursday, January 14, 2021 14:34
To: devel@edk2.groups.io
Cc: Bob Feng; Liming 
Gao; Yuwei Chen
Subject: [edk2-devel] [PATCH v3 01/18] BaseTools: Ecc/exception: Added 
_ModuleEntryPoint into exception list

Function '_ModuleEntryPoint' is a pre-defined interface for various EFI
module types and should not be caught violating EFI coding style. This
change added '_ModuleEntryPoint' into exception list to fix EFI coding
style error 8006 during CI build.

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 

Signed-off-by: Kun Qin 
---

Notes:
v3:
- Newly added to fix CI build on changing '_ModuleEntryPoint'

 BaseTools/Source/Python/Ecc/exception.xml | 4 
 1 file changed, 4 insertions(+)

diff --git a/BaseTools/Source/Python/Ecc/exception.xml 
b/BaseTools/Source/Python/Ecc/exception.xml
index 8133904fbc7f..f2334aab8e52 100644
--- a/BaseTools/Source/Python/Ecc/exception.xml
+++ b/BaseTools/Source/Python/Ecc/exception.xml
@@ -296,6 +296,10 @@
 _DriverUnloadHandler
 8006
   
+  
+_ModuleEntryPoint
+8006
+  
   
 ASSERT
 10015
--
2.30.0.windows.1








-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70604): https://edk2.groups.io/g/devel/message/70604
Mute This Topic: https://groups.io/mt/79688538/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 03/18] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core

2021-01-20 Thread Kun Qin
Hi Jiewen/Ard/Sami/Supreeth,

I updated this patch in v2 to centralize common implementations for certain 
library functions. Do you by any chance have more comments on this patch? Any 
input is appreciated.

Regards,
Kun

From: Kun Qin
Sent: Thursday, January 14, 2021 14:34
To: devel@edk2.groups.io
Cc: Ard Biesheuvel; Sami 
Mujawar; Jiewen Yao; 
Supreeth Venkatesh
Subject: [edk2-devel] [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCoreHobLib: 
Extend support for x64 Mm Core

This change adds support of x64 version of StandaloneMmCoreHobLib. It
brings in global variable "gHobList" through StandaloneMmCoreEntryPoint,
imports implementation from DxeCoreHobLib.inf to support x64 Mm Core and
moved shared functional plementations into a common file.

Cc: Ard Biesheuvel 
Cc: Sami Mujawar 
Cc: Jiewen Yao 
Cc: Supreeth Venkatesh 

Signed-off-by: Kun Qin 
---

Notes:
v3:
- Pertains gHobList for AARCH64 instance.

v2:
- Moved common function implementations into Common.c [Jiewen]

 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ => 
AArch64}/StandaloneMmCoreHobLib.c | 272 --
 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c
   | 291 +++
 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib.c
   | 298 
 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf  
   |  11 +-
 4 files changed, 597 insertions(+), 275 deletions(-)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c 
b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c
similarity index 55%
rename from 
StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c
rename to 
StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c
index e3d4743b63f2..0ec2d4ad6f6b 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.c
+++ 
b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLib.c
@@ -21,188 +21,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 VOID *gHobList = NULL;

-/**
-  Returns the pointer to the HOB list.
-
-  This function returns the pointer to first HOB in the list.
-  If the pointer to the HOB list is NULL, then ASSERT().
-
-  @return The pointer to the HOB list.
-
-**/
-VOID *
-EFIAPI
-GetHobList (
-  VOID
-  )
-{
-  ASSERT (gHobList != NULL);
-  return gHobList;
-}
-
-/**
-  Returns the next instance of a HOB type from the starting HOB.
-
-  This function searches the first instance of a HOB type from the starting 
HOB pointer.
-  If there does not exist such HOB type from the starting HOB pointer, it will 
return NULL.
-  In contrast with macro GET_NEXT_HOB(), this function does not skip the 
starting HOB pointer
-  unconditionally: it returns HobStart back if HobStart itself meets the 
requirement;
-  caller is required to use GET_NEXT_HOB() if it wishes to skip current 
HobStart.
-
-  If HobStart is NULL, then ASSERT().
-
-  @param  Type  The HOB type to return.
-  @param  HobStart  The starting HOB pointer to search from.
-
-  @return The next instance of a HOB type from the starting HOB.
-
-**/
-VOID *
-EFIAPI
-GetNextHob (
-  IN UINT16 Type,
-  IN CONST VOID *HobStart
-  )
-{
-  EFI_PEI_HOB_POINTERS  Hob;
-
-  ASSERT (HobStart != NULL);
-
-  Hob.Raw = (UINT8 *) HobStart;
-  //
-  // Parse the HOB list until end of list or matching type is found.
-  //
-  while (!END_OF_HOB_LIST (Hob)) {
-if (Hob.Header->HobType == Type) {
-  return Hob.Raw;
-}
-Hob.Raw = GET_NEXT_HOB (Hob);
-  }
-  return NULL;
-}
-
-/**
-  Returns the first instance of a HOB type among the whole HOB list.
-
-  This function searches the first instance of a HOB type among the whole HOB 
list.
-  If there does not exist such HOB type in the HOB list, it will return NULL.
-
-  If the pointer to the HOB list is NULL, then ASSERT().
-
-  @param  Type  The HOB type to return.
-
-  @return The next instance of a HOB type from the starting HOB.
-
-**/
-VOID *
-EFIAPI
-GetFirstHob (
-  IN UINT16 Type
-  )
-{
-  VOID  *HobList;
-
-  HobList = GetHobList ();
-  return GetNextHob (Type, HobList);
-}
-
-/**
-  Returns the next instance of the matched GUID HOB from the starting HOB.
-
-  This function searches the first instance of a HOB from the starting HOB 
pointer.
-  Such HOB should satisfy two conditions:
-  its HOB type is EFI_HOB_TYPE_GUID_EXTENSION, and its GUID Name equals to the 
input Guid.
-  If such a HOB from the starting HOB pointer does not exist, it will return 
NULL.
-  Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE 
()
-  to extract the data section and its size 

Re: [edk2-devel] [PATCH v6 00/11] Add extra pci roots support for Arm

2021-01-20 Thread Jiahui Cen via groups.io
Hi Laszlo,

On 2021/1/21 0:26, Laszlo Ersek wrote:
> On 01/19/21 02:12, Jiahui Cen via groups.io wrote:
>> v5->v6:
>> * Annotate library functions with EFIAPI, IN/OUT, @param[in]/[out].
>> * Split BusMin/BusMax addtion in PciHostBridgeUtilityGetRootBridges() into
>>   a separate patch [09/11].
>> * Add more detailed commit message for patch [10/11].
> 
> Merged via  as commit range
> ca272b9513a6..e843a21e23ea.
> 

Thanks for the review and these fixups.

Thanks,
Jiahui

> The following git-range-diff output shows my fixups on top of the posted
> v6 series:
> 
>>  1:  b757f3127929 =  1:  7a6172f88bb0 OvmfPkg: Introduce 
>> PciHostBridgeUtilityLib class
>>  2:  87b14160b8ec =  2:  166a32d09ad9 ArmVirtPkg: Refactor with 
>> PciHostBridgeUtilityLib
>>  3:  c31534b6ac1e !  3:  517055d29886 OvmfPkg/PciHostBridgeLib: List missing 
>> PcdLib dependency
>> @@ -15,6 +15,7 @@
>>  Cc: Julien Grall 
>>  Signed-off-by: Jiahui Cen 
>>  Message-Id: <20210119011302.10908-4-cenjia...@huawei.com>
>> +Reviewed-by: Laszlo Ersek 
>>
>>  diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
>> b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
>>  --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
>>  4:  b4a56730b94a !  4:  7ac1f28d4dbd OvmfPkg/PciHostBridgeLib: Extract 
>> InitRootBridge() / UninitRootBridge()
>> @@ -15,6 +15,7 @@
>>  Signed-off-by: Jiahui Cen 
>>  Signed-off-by: Yubo Miao 
>>  Message-Id: <20210119011302.10908-5-cenjia...@huawei.com>
>> +Reviewed-by: Laszlo Ersek 
>>
>>  diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
>> b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
>>  --- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
>>  5:  edb622820369 !  5:  e1b259da426b OvmfPkg/PciHostBridgeUtilityLib: 
>> Extend parameters of InitRootBridge()
>> @@ -16,6 +16,7 @@
>>  Signed-off-by: Jiahui Cen 
>>  Signed-off-by: Yubo Miao 
>>  Message-Id: <20210119011302.10908-6-cenjia...@huawei.com>
>> +Reviewed-by: Laszlo Ersek 
>>
>>  diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
>> b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
>>  --- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
>>  6:  a678abfd5f0c !  6:  aa445ce02b69 ArmVirtPkg/FdtPciHostBridgeLib: 
>> Refactor init/uninit of root bridge
>> @@ -14,6 +14,7 @@
>>  Signed-off-by: Jiahui Cen 
>>  Signed-off-by: Yubo Miao 
>>  Message-Id: <20210119011302.10908-7-cenjia...@huawei.com>
>> +Reviewed-by: Laszlo Ersek 
>>
>>  diff --git 
>> a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf 
>> b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
>>  --- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
>>  7:  f072f24ca41f !  7:  4edba29651e3 OvmfPkg/PciHostBridgeLib: Extract 
>> GetRootBridges() / FreeRootBridges()
>> @@ -16,6 +16,8 @@
>>  Signed-off-by: Jiahui Cen 
>>  Signed-off-by: Yubo Miao 
>>  Message-Id: <20210119011302.10908-8-cenjia...@huawei.com>
>> +[ler...@redhat.com: keep zeroing of (*Count) centralized]
>> +Reviewed-by: Laszlo Ersek 
>>
>>  diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
>> b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
>>  --- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
>> @@ -355,6 +357,8 @@
>>  +  UINTNLastRootBridgeNumber;
>>  +  UINTNRootBridgeNumber;
>>  +
>> ++  *Count = 0;
>> ++
>>  +  //
>>  +  // QEMU provides the number of extra root buses, shortening the 
>> exhaustive
>>  +  // search below. If there is no hint, the feature is missing.
>> @@ -369,7 +373,6 @@
>>  +if (ExtraRootBridges > PCI_MAX_BUS) {
>>  +  DEBUG ((DEBUG_ERROR, "%a: invalid count of extra root buses 
>> (%Lu) "
>>  +"reported by QEMU\n", __FUNCTION__, ExtraRootBridges));
>> -+  *Count = 0;
>>  +  return NULL;
>>  +}
>>  +DEBUG ((DEBUG_INFO, "%a: %Lu extra root buses reported by QEMU\n",
>> @@ -382,7 +385,6 @@
>>  +  Bridges = AllocatePool ((1 + (UINTN)ExtraRootBridges) * sizeof 
>> *Bridges);
>>  +  if (Bridges == NULL) {
>>  +DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, 
>> EFI_OUT_OF_RESOURCES));
>> -+*Count = 0;
>>  +return NULL;
>>  +  }
>>  +  Initialized = 0;
>> @@ -471,7 +473,6 @@
>>  +  }
>>  +
>>  +  FreePool (Bridges);
>> -+  *Count = 0;
>>  +  return NULL;
>>  +}
>>  +
>>  8:  5607d15dab2f !  8:  14d4b6be568d OvmfPkg/PciHostBridgeUtilityLib: 
>> Extend parameter list of GetRootBridges
>> @@ -13,6 +13,7 @@
>>  Signed-off-by: Jiahui Cen 
>>  Signed-off-by: Yubo Miao 
>>  Message-Id: 

Re: [edk2-devel] [PATCH] UefiPayloadPkg/BlSupportDxe: Use EfiSmbiosProtocol to install tables

2021-01-20 Thread Ma, Maurice
Hi, Patrick

In this patch I noticed that we changed the BlSupportDxe dependency from True 
to gEfiSmbiosProtocolGuid.
Since BlSupportDxe is considered as critical for UEFI payload,  and on the 
other side SMBIOS driver could be optional in some case,  do you think it is 
better to handle it through RegisterProtocolNotify() ?   In this way,  if 
gEfiSmbiosProtocolGuid is not installed for any reason,  BlSupportDxe can still 
be dispatched and the boot flow can continue.

Some other comments:
-  Please add function and parameter description for BlDxeInstallSMBIOStables().
-  To follow the naming convention in EDK2,   maybe  use 
BlDxeInstallSmbiosTables instead of BlDxeInstallSMBIOStables().

Thanks
Maurice
> -Original Message-
> From: Patrick Rudolph 
> Sent: Wednesday, January 20, 2021 8:02
> To: devel@edk2.groups.io
> Cc: Ma, Maurice ; Dong, Guo ;
> You, Benjamin 
> Subject: [PATCH] UefiPayloadPkg/BlSupportDxe: Use EfiSmbiosProtocol to
> install tables
> 
> The default EfiSmbiosProtocol operates on an empty SMBIOS table.
> As the SMBIOS tables are provided by the bootloader, install the SMBIOS tables
> using the EfiSmbiosProtocol.
> 
> This fixes the settings menu not showing any hardware information, instead 
> only
> "0 MB RAM" was displayed.
> 
> Tests showed that the OS can still see the SMBIOS tables.
> 
> Signed-off-by: Patrick Rudolph 
> ---
>  UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c   | 111
> +++-
>  UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h   |   3 +
>  UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf |   5 +-
>  3 files changed, 115 insertions(+), 4 deletions(-)
> 
> diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
> b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
> index a746d0581e..db478c1abc 100644
> --- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
> +++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
> @@ -79,6 +79,107 @@ ReserveResourceInGcd (
>return Status; } +EFI_STATUS+EFIAPI+BlDxeInstallSMBIOStables(+  IN UINT64
> SmbiosTableBase,+  IN UINT32SmbiosTableSize+)+{+  EFI_STATUS
> Status;+  SMBIOS_TABLE_ENTRY_POINT  *SmbiosTable;+
> SMBIOS_TABLE_3_0_ENTRY_POINT  *Smbios30Table;+
> SMBIOS_STRUCTURE_POINTER  Smbios;+  SMBIOS_STRUCTURE_POINTER
> SmbiosEnd;+  CHAR8 *String;+  EFI_SMBIOS_HANDLE
> SmbiosHandle;+  EFI_SMBIOS_PROTOCOL   *SmbiosProto;++  //+  // Locate
> Smbios protocol.+  //+  Status = gBS->LocateProtocol (,
> NULL, (VOID **));+  if (EFI_ERROR (Status)) {+DEBUG
> ((DEBUG_ERROR, "%a: Failed to locate gEfiSmbiosProtocolGuid\n",+
> __FUNCTION__));+return Status;+  }++  Smbios30Table =
> (SMBIOS_TABLE_3_0_ENTRY_POINT *)(UINTN)(SmbiosTableBase);+
> SmbiosTable = (SMBIOS_TABLE_ENTRY_POINT *)(UINTN)(SmbiosTableBase);++
> if (CompareMem (Smbios30Table->AnchorString, "_SM3_", 5) == 0) {+
> Smbios.Hdr = (SMBIOS_STRUCTURE *) (UINTN) Smbios30Table-
> >TableAddress;+SmbiosEnd.Raw = (UINT8 *) (UINTN) (Smbios30Table-
> >TableAddress + Smbios30Table->TableMaximumSize);+if (Smbios30Table-
> >TableMaximumSize > SmbiosTableSize) {+  DEBUG((DEBUG_INFO, "%a:
> SMBIOS table size greater than reported by bootloader\n",+
> __FUNCTION__));+}+  } else if (CompareMem (SmbiosTable->AnchorString,
> "_SM_", 4) == 0) {+Smbios.Hdr= (SMBIOS_STRUCTURE *) (UINTN)
> SmbiosTable->TableAddress;+SmbiosEnd.Raw = (UINT8 *) ((UINTN)
> SmbiosTable->TableAddress + SmbiosTable->TableLength);++if (SmbiosTable-
> >TableLength > SmbiosTableSize) {+  DEBUG((DEBUG_INFO, "%a: SMBIOS
> table size greater than reported by bootloader\n",+
> __FUNCTION__));+}+  } else {+DEBUG ((DEBUG_ERROR, "%a: No valid
> SMBIOS table found\n", __FUNCTION__ ));+return EFI_NOT_FOUND;+  }++
> do {+// Check for end marker+if (Smbios.Hdr->Type == 127) {+
> break;+}++// Install the table+SmbiosHandle =
> SMBIOS_HANDLE_PI_RESERVED;+Status = SmbiosProto->Add (+
> SmbiosProto,+  gImageHandle,+ 
>  ,+
> Smbios.Hdr+  );+ASSERT_EFI_ERROR (Status);+if 
> (EFI_ERROR
> (Status)) {+  return Status;+}+//+// Go to the next SMBIOS 
> structure.
> Each SMBIOS structure may include 2 parts:+// 1. Formatted section; 2.
> Unformatted string section. So, 2 steps are needed+// to skip one SMBIOS
> structure.+//++//+// Step 1: Skip over formatted section.+//+ 
>String =
> (CHAR8 *) (Smbios.Raw + Smbios.Hdr->Length);++//+// Step 2: Skip over
> unformatted string section.+//+do {+  //+  // Each string is 
> terminated
> with a NULL(00h) BYTE and the sets of strings+  // is terminated with an
> additional NULL(00h) BYTE.+  //+  for ( ; *String != 0; String++) {+  
> }++  if
> (*(UINT8*)++String == 0) {+//+// Pointer to the next SMBIOS
> structure.+//+Smbios.Raw = (UINT8 *)++String;+break;+ 
>  }+}
> while (TRUE);+  

Re: [edk2-devel] [PATCH] UefiPayloadPkg: Add RNG support

2021-01-20 Thread Ma, Maurice
Hi,  Patrick

There is a BaseRngLib in MdePkg package already.  I am wondering why a new 
instance was created under UefiPayloadPkg in the patch.
Could we just reuse the same library in MdePkg?   
If not, what is the reason?   Can we try to enhance the library in MdePkg to 
address it if required?

Thanks
Maurice
> -Original Message-
> From: Patrick Rudolph 
> Sent: Wednesday, January 20, 2021 7:52
> To: devel@edk2.groups.io
> Cc: Ma, Maurice ; Dong, Guo ;
> You, Benjamin 
> Subject: [PATCH] UefiPayloadPkg: Add RNG support
> 
> Uses the RDRAND instruction if available and install EfiRngProtocol.
> The protocol may be used by iPXE or the Linux kernel to gather entropy.
> 
> Signed-off-by: Patrick Rudolph 
> ---
>  UefiPayloadPkg/Library/BaseRngLib/BaseRng.c  | 199
> 
>  UefiPayloadPkg/Library/BaseRngLib/BaseRngLib.inf |  32 
> UefiPayloadPkg/Library/BaseRngLib/BaseRngLib.uni |  17 ++
>  UefiPayloadPkg/UefiPayloadPkg.dsc|   8 +
>  UefiPayloadPkg/UefiPayloadPkg.fdf|   4 +
>  5 files changed, 260 insertions(+)
> 
> diff --git a/UefiPayloadPkg/Library/BaseRngLib/BaseRng.c
> b/UefiPayloadPkg/Library/BaseRngLib/BaseRng.c
> new file mode 100644
> index 00..1fe9e1dbe0
> --- /dev/null
> +++ b/UefiPayloadPkg/Library/BaseRngLib/BaseRng.c
> @@ -0,0 +1,199 @@
> +/** @file+  Random number generator services that uses RdRand instruction
> access+  to provide high-quality random numbers.++Copyright (c) 2015, Intel
> Corporation. All rights reserved.+SPDX-License-Identifier: BSD-2-Clause-
> Patent++**/++#include +#include
> +#include ++STATIC BOOLEAN
> mHasRdRand;++//+// Bit mask used to determine if RdRand instruction is
> supported.+//+#define RDRAND_MASK  BIT30++//+// Limited retry
> number when valid random data is returned.+// Uses the recommended value
> defined in Section 7.3.17 of "Intel 64 and IA-32+// Architectures Software
> Developer's Mannual".+//+#define RDRAND_RETRY_LIMIT   10++/**+  The
> constructor function checks whether or not RDRAND instruction is supported+
> by the host hardware.++  The constructor function checks whether or not
> RDRAND instruction is supported.+  It will always return RETURN_SUCCESS.++
> @retval RETURN_SUCCESS   The constructor always returns
> EFI_SUCCESS.++**/+RETURN_STATUS+EFIAPI+BaseRngLibConstructor (+
> VOID+  )+{+  UINT32  RegEax;+  UINT32  RegEcx;++  AsmCpuid
> (CPUID_SIGNATURE, , NULL, NULL, NULL);+  if (RegEax < 1) {+
> mHasRdRand = FALSE;+return RETURN_SUCCESS;+  }++  //+  // Determine
> RDRAND support by examining bit 30 of the ECX register returned by+  // CPUID.
> A value of 1 indicates that processor support RDRAND instruction.+  //+
> AsmCpuid (CPUID_VERSION_INFO, 0, 0, , 0);++  mHasRdRand =
> ((RegEcx & RDRAND_MASK) == RDRAND_MASK);++  return
> RETURN_SUCCESS;+}++/**+  Generates a 16-bit random number.++  if Rand is
> NULL, then ASSERT().++  @param[out] Rand Buffer pointer to store the 
> 16-bit
> random value.++  @retval TRUE Random number generated successfully.+
> @retval FALSEFailed to generate the random
> number.++**/+BOOLEAN+EFIAPI+GetRandomNumber16 (+  OUT UINT16
> *Rand+  )+{+  UINT32  Index;++  ASSERT (Rand != NULL);++  if (mHasRdRand) {+
> //+// A loop to fetch a 16 bit random value with a retry count limit.+
> //+
> for (Index = 0; Index < RDRAND_RETRY_LIMIT; Index++) {+  if (AsmRdRand16
> (Rand)) {+return TRUE;+  }+}+  }++  return FALSE;+}++/**+  
> Generates a
> 32-bit random number.++  if Rand is NULL, then ASSERT().++  @param[out]
> Rand Buffer pointer to store the 32-bit random value.++  @retval TRUE
> Random number generated successfully.+  @retval FALSEFailed to 
> generate
> the random number.++**/+BOOLEAN+EFIAPI+GetRandomNumber32 (+  OUT
> UINT32*Rand+  )+{+  UINT32  Index;++  ASSERT (Rand != 
> NULL);++  if
> (mHasRdRand) {+//+// A loop to fetch a 32 bit random value with a 
> retry
> count limit.+//+for (Index = 0; Index < RDRAND_RETRY_LIMIT; Index++) 
> {+
> if (AsmRdRand32 (Rand)) {+return TRUE;+  }+}+  }++  return
> FALSE;+}++/**+  Generates a 64-bit random number.++  if Rand is NULL, then
> ASSERT().++  @param[out] Rand Buffer pointer to store the 64-bit random
> value.++  @retval TRUE Random number generated successfully.+  @retval
> FALSEFailed to generate the random
> number.++**/+BOOLEAN+EFIAPI+GetRandomNumber64 (+  OUT UINT64
> *Rand+  )+{+  UINT32  Index;++  ASSERT (Rand != NULL);++  if (mHasRdRand) {+
> //+// A loop to fetch a 64 bit random value with a retry count limit.+
> //+
> for (Index = 0; Index < RDRAND_RETRY_LIMIT; Index++) {+  if (AsmRdRand64
> (Rand)) {+return TRUE;+  }+}+  }++  return FALSE;+}++/**+  
> Generates a
> 128-bit random number.++  if Rand is NULL, then ASSERT().++  @param[out]
> Rand Buffer pointer to store the 128-bit random value.++  

Re: 回复: [EXTERNAL] [edk2-devel] building the shell for edk2-stable202102

2021-01-20 Thread Laszlo Ersek
On 01/20/21 02:06, gaoliming wrote:
> Laszlo:
>   Now, all release content (Source code Zip, Submodule Zip and ShellBinPkg
> Zip) are manually generated. I will submit one BZ to enhance the release
> process and generate them on CI. 

Right, that's , I
believe.

>   For this request, can you submit one BZ and assign it to me? So, I will do
> it for new release tag edk2-stable202102. 

I've filed .

Thank you!
Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70599): https://edk2.groups.io/g/devel/message/70599
Mute This Topic: https://groups.io/mt/79968305/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 11/13] StandaloneMmMmuLib: Allow FF-A calls to set memory region's attributes

2021-01-20 Thread Sami Mujawar
Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70598): https://edk2.groups.io/g/devel/message/70598
Mute This Topic: https://groups.io/mt/79696448/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 10/13] StandaloneMmMmuLib: Allow FF-A calls to get memory region's attributes

2021-01-20 Thread Sami Mujawar
Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar


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




Re: [edk2-devel] [PATCH v2 0/4] UefiCpuPkg, OvmfPkg: do not allocate useless register tables for S3 resume

2021-01-20 Thread Laszlo Ersek
On 01/20/21 10:28, Zeng, Star wrote:
> Series Reviewed-by: Star Zeng 

Series merged as commit range e843a21e23ea..339371ef78eb, via
.

Thanks!
Laszlo

> 
>> -Original Message-
>> From: Laszlo Ersek 
>> Sent: Tuesday, January 19, 2021 11:55 PM
>> To: edk2-devel-groups-io 
>> Cc: Ard Biesheuvel ; Dong, Eric
>> ; Justen, Jordan L ;
>> Philippe Mathieu-Daudé ; Kumar, Rahul1
>> ; Ni, Ray ; Zeng, Star
>> 
>> Subject: [PATCH v2 0/4] UefiCpuPkg, OvmfPkg: do not allocate useless
>> register tables for S3 resume
>>
>> Ref:https://bugzilla.tianocore.org/show_bug.cgi?id=3159
>> Repo:   https://pagure.io/lersek/edk2.git
>> Branch: remove-cpu-reg-table-alloc-3159-v2
>>
>> Updates in v2:
>>
>> - v1 patches have not received any updates, I've only picked up the
>>   feedback tags.
>>
>> - Patch v2 #1 -- for RegisterCpuFeaturesLib -- is new; authored by Ray
>>   and updated slightly by myself. Star and/or Eric should please approve
>>   this patch.
>>
>> v1 was posted at:
>>
>>   [edk2-devel] [PATCH 0/3] UefiCpuPkg, OvmfPkg: do not allocate useless
>>   register tables for S3 resume
>>
>>   Message-Id: <20210112191934.12459-1-ler...@redhat.com>
>>   https://edk2.groups.io/g/devel/message/70167
>>   https://www.redhat.com/archives/edk2-devel-archive/2021-
>> January/msg00652.html
>>
>> Cc: Ard Biesheuvel 
>> Cc: Eric Dong 
>> Cc: Jordan Justen 
>> Cc: Philippe Mathieu-Daudé 
>> Cc: Rahul Kumar 
>> Cc: Ray Ni 
>> Cc: Star Zeng 
>>
>> Thanks
>> Laszlo
>>
>> Laszlo Ersek (3):
>>   UefiCpuPkg/AcpiCpuData: update comments on register table fields
>>   UefiCpuPkg/CpuS3DataDxe: do not allocate useless register tables
>>   OvmfPkg/CpuS3DataDxe: do not allocate useless register tables
>>
>> Ray Ni (1):
>>   UefiCpuPkg/CpuFeature: Don't assume CpuS3DataDxe alloc RegisterTable
>>
>>  OvmfPkg/CpuS3DataDxe/CpuS3Data.c   | 70 
>> +---
>> -
>>  OvmfPkg/CpuS3DataDxe/CpuS3DataDxe.inf  |  1 -
>>  UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c| 32 
>> 
>>  UefiCpuPkg/Include/AcpiCpuData.h   |  4 +
>>  UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 80
>> +++-
>>  5 files changed, 48 insertions(+), 139 deletions(-)
>>
>>
>> base-commit: 83facfd184021874f95a6a34b2e47e0ebb34a762
>> --
>> 2.19.1.3.g30247aa5d201
> 
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70596): https://edk2.groups.io/g/devel/message/70596
Mute This Topic: https://groups.io/mt/79954423/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 08/13] StandaloneMmPkg: Add option to use FF-A calls for communication with SPM

2021-01-20 Thread Sami Mujawar
Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70595): https://edk2.groups.io/g/devel/message/70595
Mute This Topic: https://groups.io/mt/79696446/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 06/13] StandaloneMmPkg: Add the SPM version for FF-A

2021-01-20 Thread Sami Mujawar
Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70594): https://edk2.groups.io/g/devel/message/70594
Mute This Topic: https://groups.io/mt/79696443/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 05/13] StandaloneMmPkg: Add macros for SPM version

2021-01-20 Thread Sami Mujawar
Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar


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




Re: [edk2-devel] [PATCH v1 2/2] DynamicTablesPkg: Add an override for 16550 HID in SSDT

2021-01-20 Thread Samer El-Haj-Mahmoud
> -Original Message-
> From: Joey Gouly 
> Sent: Wednesday, January 20, 2021 1:20 PM
> To: devel@edk2.groups.io
> Cc: Joey Gouly ; ardb+tianoc...@kernel.org; Sami
> Mujawar ; Jeff Brasen (jbra...@nvidia.com)
> ; ip...@nvidia.com; Samer El-Haj-Mahmoud
> ; nd 
> Subject: [PATCH v1 2/2] DynamicTablesPkg: Add an override for 16550 HID in
> SSDT
> 
> Some platforms advertise support for a 16550 UART, but are not compatible
> with the PNP0500 HID. Allow them to override the HID by setting
> PcdNonSbsaCompliantSerialHid.
> 
> Signed-off-by: Joey Gouly 
> ---
>  DynamicTablesPkg/DynamicTablesPkg.dec
>  |  3 +++
> 
> DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFix
> upLib.inf |  4 +++-
> 
> DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFix
> upLib.c   | 14 +++---
>  3 files changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec
> b/DynamicTablesPkg/DynamicTablesPkg.dec
> index
> 291a45a69679ae82219ecd2f26dfabfbab1f7f65..3ec4fff116a8f538be331edf34
> 1867948c025116 100644
> --- a/DynamicTablesPkg/DynamicTablesPkg.dec
> +++ b/DynamicTablesPkg/DynamicTablesPkg.dec
> @@ -44,5 +44,8 @@ [PcdsFixedAtBuild]
># Maximum number of Custom DT Generators
> 
> gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomDTGenerators|1|UI
> NT16|0xC003
> 
> +  # Non SBSA Compliant Serial HID
> +
> +
> gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdNonSbsaCompliantSerialHid|""|
> V
> + OID*|0x4008
> +
>  [Guids]
>gEdkiiDynamicTablesPkgTokenSpaceGuid = { 0xab226e66, 0x31d8, 0x4613, {
> 0x87, 0x9d, 0xd2, 0xfa, 0xb6, 0x10, 0x26, 0x3c } } diff --git
> a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort
> FixupLib.inf
> b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort
> FixupLib.inf
> index
> af3d404393f5f1385ab2d40f45f7222ab66f9b3a..b64825982e8fb7aaf78f3fd68
> 992e1c78d20c408 100644
> ---
> a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort
> FixupLib.inf
> +++
> b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialP
> +++ ortFixupLib.inf
> @@ -1,7 +1,7 @@
>  ## @file
>  #  SSDT Serial Port fixup Library
>  #
> -#  Copyright (c) 2020, Arm Limited. All rights reserved.
> +#  Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent  ## @@ -28,3 +28,5 @@
> [LibraryClasses]
>AmlLib
>BaseLib
> 
> +[Pcd]
> +  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdNonSbsaCompliantSerialHid
> diff --git
> a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort
> FixupLib.c
> b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort
> FixupLib.c
> index
> 0ff071485ef25f4ca63de0eeab5120d1beece4db..73a8087ed8a8ff84b64531a3c
> 73d319585dfb6cf 100644
> ---
> a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort
> FixupLib.c
> +++
> b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialP
> +++ ortFixupLib.c
> @@ -1,7 +1,7 @@
>  /** @file
>SSDT Serial Port Fixup Library.
> 
> -  Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.
> +  Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.
> 
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -139,13 +139,21 @@ FixupIds (
>AML_OBJECT_NODE_HANDLENameOpIdNode;
>CONST CHAR8 * HidString;
>CONST CHAR8 * CidString;
> +  CONST CHAR8 * NonSbsaHid;
> 
>// Get the _CID and _HID value to write.
>switch (SerialPortInfo->PortSubtype) {
>  case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550:
>  {
> -  HidString = "PNP0501";
> -  CidString = "PNP0500";
> +  // If there is a non-SBSA compliant HID, use that.
> +  NonSbsaHid = (CONST CHAR8*)PcdGetPtr
> (PcdNonSbsaCompliantSerialHid);
> +  if ((NonSbsaHid != NULL) && (AsciiStrLen (NonSbsaHid) != 0)) {
> +HidString = NonSbsaHid;
> +CidString = "";
> +  } else {
> +HidString = "PNP0501";
> +CidString = "PNP0500";
> +  }
>break;
>  }
>  case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART:
> --

Since you are using PcdNonSbsaCompliantSerialHid to indicate that this is a 
non-BSA compliant 16550 UART, maybe rename the PCD to reflect that? The name 
PcdNonSbsaCompliantSerialHid may imply that this is not a PL011/ Arm SBSA 
Generic UART. BSA 1.0 allows both PL011/Generic UART (the definition moved from 
SBSA spec to the BSA spec)  OR a 16550 standard UART. In this case, we are 
saying the UART is a 16550-like UART, but not exactly standard (i.e. do not use 
the standard 16550 IDs)

Maybe PcdNon16550CompliantSerialHid or PcdNonBsa16550CompliantSerialHid  is a 
better name that matches what the code is doing?

The comments will need to change as well.



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

[edk2-devel] [PATCH v1 0/2] Add a Pcd to override the 16650 HID in SSDT

2021-01-20 Thread Joey Gouly
This series adds PcdNonSbsaCompliantSerialHid so that firmware can
override the PNP0501 HID used by 16550 UART in the SSDT table, in case
they are not compatible with the generic PNP0501 HID.

I have tested this with acpiview, some extra testing would be
appreciated.

Changes available at https://github.com/jgouly/edk2/tree/1588_non_sbsa_hid_v1

Joey Gouly (2):
  DynamicTablesPkg: Don't use gEfiMdeModulePkgTokenSpaceGuid
  DynamicTablesPkg: Add an override for 16550 HID in SSDT

 DynamicTablesPkg/DynamicTablesPkg.dec  | 13 +
 .../DynamicTableFactoryDxe.inf |  8 
 .../SsdtSerialPortFixupLib.inf |  4 +++-
 .../SsdtSerialPortFixupLib.c   | 14 +++---
 4 files changed, 27 insertions(+), 12 deletions(-)

-- 
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")



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




[edk2-devel] [PATCH v1 2/2] DynamicTablesPkg: Add an override for 16550 HID in SSDT

2021-01-20 Thread Joey Gouly
Some platforms advertise support for a 16550 UART, but are not
compatible with the PNP0500 HID. Allow them to override the HID by
setting PcdNonSbsaCompliantSerialHid.

Signed-off-by: Joey Gouly 
---
 DynamicTablesPkg/DynamicTablesPkg.dec  
   |  3 +++
 
DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
 |  4 +++-
 
DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c 
  | 14 +++---
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec 
b/DynamicTablesPkg/DynamicTablesPkg.dec
index 
291a45a69679ae82219ecd2f26dfabfbab1f7f65..3ec4fff116a8f538be331edf341867948c025116
 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dec
+++ b/DynamicTablesPkg/DynamicTablesPkg.dec
@@ -44,5 +44,8 @@ [PcdsFixedAtBuild]
   # Maximum number of Custom DT Generators
   
gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomDTGenerators|1|UINT16|0xC003
 
+  # Non SBSA Compliant Serial HID
+  
gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdNonSbsaCompliantSerialHid|""|VOID*|0x4008
+
 [Guids]
   gEdkiiDynamicTablesPkgTokenSpaceGuid = { 0xab226e66, 0x31d8, 0x4613, { 0x87, 
0x9d, 0xd2, 0xfa, 0xb6, 0x10, 0x26, 0x3c } }
diff --git 
a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
 
b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
index 
af3d404393f5f1385ab2d40f45f7222ab66f9b3a..b64825982e8fb7aaf78f3fd68992e1c78d20c408
 100644
--- 
a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
+++ 
b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
@@ -1,7 +1,7 @@
 ## @file
 #  SSDT Serial Port fixup Library
 #
-#  Copyright (c) 2020, Arm Limited. All rights reserved.
+#  Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
@@ -28,3 +28,5 @@ [LibraryClasses]
   AmlLib
   BaseLib
 
+[Pcd]
+  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdNonSbsaCompliantSerialHid
diff --git 
a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c
 
b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c
index 
0ff071485ef25f4ca63de0eeab5120d1beece4db..73a8087ed8a8ff84b64531a3c73d319585dfb6cf
 100644
--- 
a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c
+++ 
b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c
@@ -1,7 +1,7 @@
 /** @file
   SSDT Serial Port Fixup Library.
 
-  Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.
+  Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
@@ -139,13 +139,21 @@ FixupIds (
   AML_OBJECT_NODE_HANDLENameOpIdNode;
   CONST CHAR8 * HidString;
   CONST CHAR8 * CidString;
+  CONST CHAR8 * NonSbsaHid;
 
   // Get the _CID and _HID value to write.
   switch (SerialPortInfo->PortSubtype) {
 case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550:
 {
-  HidString = "PNP0501";
-  CidString = "PNP0500";
+  // If there is a non-SBSA compliant HID, use that.
+  NonSbsaHid = (CONST CHAR8*)PcdGetPtr (PcdNonSbsaCompliantSerialHid);
+  if ((NonSbsaHid != NULL) && (AsciiStrLen (NonSbsaHid) != 0)) {
+HidString = NonSbsaHid;
+CidString = "";
+  } else {
+HidString = "PNP0501";
+CidString = "PNP0500";
+  }
   break;
 }
 case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART:
-- 
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")



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




[edk2-devel] [PATCH v1 1/2] DynamicTablesPkg: Don't use gEfiMdeModulePkgTokenSpaceGuid

2021-01-20 Thread Joey Gouly
Introduce gEdkiiDynamicTablesPkgTokenSpaceGuid and use that instead.

Signed-off-by: Joey Gouly 
---
 DynamicTablesPkg/DynamicTablesPkg.dec  | 
10 ++
 DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf |  
8 
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec 
b/DynamicTablesPkg/DynamicTablesPkg.dec
index 
f36a6e8bb7c17f82acff3c766b15202b064a64b5..291a45a69679ae82219ecd2f26dfabfbab1f7f65
 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dec
+++ b/DynamicTablesPkg/DynamicTablesPkg.dec
@@ -1,7 +1,7 @@
 ## @file
 # dec file for Dynamic Tables Framework.
 #
-# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.
+# Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -36,11 +36,13 @@ [Protocols]
 [PcdsFixedAtBuild]
 
   # Maximum number of Custom ACPI Generators
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomACPIGenerators|1|UINT16|0xC001
+  
gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomACPIGenerators|1|UINT16|0xC001
 
   # Maximum number of Custom SMBIOS Generators
-  
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomSMBIOSGenerators|1|UINT16|0xC002
+  
gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomSMBIOSGenerators|1|UINT16|0xC002
 
   # Maximum number of Custom DT Generators
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomDTGenerators|1|UINT16|0xC003
+  
gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomDTGenerators|1|UINT16|0xC003
 
+[Guids]
+  gEdkiiDynamicTablesPkgTokenSpaceGuid = { 0xab226e66, 0x31d8, 0x4613, { 0x87, 
0x9d, 0xd2, 0xfa, 0xb6, 0x10, 0x26, 0x3c } }
diff --git 
a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf 
b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
index 
56b69591ac52ca3ba51250dc01a0846b22442ce9..29ed3dc2e5029206f8852c4b11240e7b493bbc57
 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
+++ b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Module to manage the list of available table factories.
 #
-#  Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+#  Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
@@ -41,9 +41,9 @@ [LibraryClasses]
   UefiDriverEntryPoint
 
 [FixedPcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomACPIGenerators
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomSMBIOSGenerators
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomDTGenerators
+  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomACPIGenerators
+  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomSMBIOSGenerators
+  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomDTGenerators
 
 [Protocols]
   gEdkiiDynamicTableFactoryProtocolGuid # PRODUCES
-- 
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")



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




Re: [edk2-devel] [PATCH v6 00/11] Add extra pci roots support for Arm

2021-01-20 Thread Laszlo Ersek
On 01/19/21 02:12, Jiahui Cen via groups.io wrote:
> v5->v6:
> * Annotate library functions with EFIAPI, IN/OUT, @param[in]/[out].
> * Split BusMin/BusMax addtion in PciHostBridgeUtilityGetRootBridges() into
>   a separate patch [09/11].
> * Add more detailed commit message for patch [10/11].

Merged via  as commit range
ca272b9513a6..e843a21e23ea.

The following git-range-diff output shows my fixups on top of the posted
v6 series:

>  1:  b757f3127929 =  1:  7a6172f88bb0 OvmfPkg: Introduce 
> PciHostBridgeUtilityLib class
>  2:  87b14160b8ec =  2:  166a32d09ad9 ArmVirtPkg: Refactor with 
> PciHostBridgeUtilityLib
>  3:  c31534b6ac1e !  3:  517055d29886 OvmfPkg/PciHostBridgeLib: List missing 
> PcdLib dependency
> @@ -15,6 +15,7 @@
>  Cc: Julien Grall 
>  Signed-off-by: Jiahui Cen 
>  Message-Id: <20210119011302.10908-4-cenjia...@huawei.com>
> +Reviewed-by: Laszlo Ersek 
>
>  diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
> b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
>  --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
>  4:  b4a56730b94a !  4:  7ac1f28d4dbd OvmfPkg/PciHostBridgeLib: Extract 
> InitRootBridge() / UninitRootBridge()
> @@ -15,6 +15,7 @@
>  Signed-off-by: Jiahui Cen 
>  Signed-off-by: Yubo Miao 
>  Message-Id: <20210119011302.10908-5-cenjia...@huawei.com>
> +Reviewed-by: Laszlo Ersek 
>
>  diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
> b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
>  --- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
>  5:  edb622820369 !  5:  e1b259da426b OvmfPkg/PciHostBridgeUtilityLib: Extend 
> parameters of InitRootBridge()
> @@ -16,6 +16,7 @@
>  Signed-off-by: Jiahui Cen 
>  Signed-off-by: Yubo Miao 
>  Message-Id: <20210119011302.10908-6-cenjia...@huawei.com>
> +Reviewed-by: Laszlo Ersek 
>
>  diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
> b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
>  --- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
>  6:  a678abfd5f0c !  6:  aa445ce02b69 ArmVirtPkg/FdtPciHostBridgeLib: 
> Refactor init/uninit of root bridge
> @@ -14,6 +14,7 @@
>  Signed-off-by: Jiahui Cen 
>  Signed-off-by: Yubo Miao 
>  Message-Id: <20210119011302.10908-7-cenjia...@huawei.com>
> +Reviewed-by: Laszlo Ersek 
>
>  diff --git 
> a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf 
> b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
>  --- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
>  7:  f072f24ca41f !  7:  4edba29651e3 OvmfPkg/PciHostBridgeLib: Extract 
> GetRootBridges() / FreeRootBridges()
> @@ -16,6 +16,8 @@
>  Signed-off-by: Jiahui Cen 
>  Signed-off-by: Yubo Miao 
>  Message-Id: <20210119011302.10908-8-cenjia...@huawei.com>
> +[ler...@redhat.com: keep zeroing of (*Count) centralized]
> +Reviewed-by: Laszlo Ersek 
>
>  diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
> b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
>  --- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> @@ -355,6 +357,8 @@
>  +  UINTNLastRootBridgeNumber;
>  +  UINTNRootBridgeNumber;
>  +
> ++  *Count = 0;
> ++
>  +  //
>  +  // QEMU provides the number of extra root buses, shortening the 
> exhaustive
>  +  // search below. If there is no hint, the feature is missing.
> @@ -369,7 +373,6 @@
>  +if (ExtraRootBridges > PCI_MAX_BUS) {
>  +  DEBUG ((DEBUG_ERROR, "%a: invalid count of extra root buses (%Lu) 
> "
>  +"reported by QEMU\n", __FUNCTION__, ExtraRootBridges));
> -+  *Count = 0;
>  +  return NULL;
>  +}
>  +DEBUG ((DEBUG_INFO, "%a: %Lu extra root buses reported by QEMU\n",
> @@ -382,7 +385,6 @@
>  +  Bridges = AllocatePool ((1 + (UINTN)ExtraRootBridges) * sizeof 
> *Bridges);
>  +  if (Bridges == NULL) {
>  +DEBUG ((DEBUG_ERROR, "%a: %r\n", __FUNCTION__, 
> EFI_OUT_OF_RESOURCES));
> -+*Count = 0;
>  +return NULL;
>  +  }
>  +  Initialized = 0;
> @@ -471,7 +473,6 @@
>  +  }
>  +
>  +  FreePool (Bridges);
> -+  *Count = 0;
>  +  return NULL;
>  +}
>  +
>  8:  5607d15dab2f !  8:  14d4b6be568d OvmfPkg/PciHostBridgeUtilityLib: Extend 
> parameter list of GetRootBridges
> @@ -13,6 +13,7 @@
>  Signed-off-by: Jiahui Cen 
>  Signed-off-by: Yubo Miao 
>  Message-Id: <20210119011302.10908-9-cenjia...@huawei.com>
> +Reviewed-by: Laszlo Ersek 
>
>  diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
> b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
>  --- 

[edk2-devel] [PATCH] UefiPayloadPkg/BlSupportDxe: Use EfiSmbiosProtocol to install tables

2021-01-20 Thread Patrick Rudolph
The default EfiSmbiosProtocol operates on an empty SMBIOS table.
As the SMBIOS tables are provided by the bootloader, install the
SMBIOS tables using the EfiSmbiosProtocol.

This fixes the settings menu not showing any hardware information, instead
only "0 MB RAM" was displayed.

Tests showed that the OS can still see the SMBIOS tables.

Signed-off-by: Patrick Rudolph 
---
 UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c   | 111 +++-
 UefiPayloadPkg/BlSupportDxe/BlSupportDxe.h   |   3 +
 UefiPayloadPkg/BlSupportDxe/BlSupportDxe.inf |   5 +-
 3 files changed, 115 insertions(+), 4 deletions(-)

diff --git a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c 
b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
index a746d0581e..db478c1abc 100644
--- a/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
+++ b/UefiPayloadPkg/BlSupportDxe/BlSupportDxe.c
@@ -79,6 +79,107 @@ ReserveResourceInGcd (
   return Status;
 }
 
+EFI_STATUS
+EFIAPI
+BlDxeInstallSMBIOStables(
+  IN UINT64SmbiosTableBase,
+  IN UINT32SmbiosTableSize
+)
+{
+  EFI_STATUSStatus;
+  SMBIOS_TABLE_ENTRY_POINT  *SmbiosTable;
+  SMBIOS_TABLE_3_0_ENTRY_POINT  *Smbios30Table;
+  SMBIOS_STRUCTURE_POINTER  Smbios;
+  SMBIOS_STRUCTURE_POINTER  SmbiosEnd;
+  CHAR8 *String;
+  EFI_SMBIOS_HANDLE SmbiosHandle;
+  EFI_SMBIOS_PROTOCOL   *SmbiosProto;
+
+  //
+  // Locate Smbios protocol.
+  //
+  Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+  if (EFI_ERROR (Status)) {
+DEBUG ((DEBUG_ERROR, "%a: Failed to locate gEfiSmbiosProtocolGuid\n",
+  __FUNCTION__));
+return Status;
+  }
+
+  Smbios30Table = (SMBIOS_TABLE_3_0_ENTRY_POINT *)(UINTN)(SmbiosTableBase);
+  SmbiosTable = (SMBIOS_TABLE_ENTRY_POINT *)(UINTN)(SmbiosTableBase);
+
+  if (CompareMem (Smbios30Table->AnchorString, "_SM3_", 5) == 0) {
+Smbios.Hdr = (SMBIOS_STRUCTURE *) (UINTN) Smbios30Table->TableAddress;
+SmbiosEnd.Raw = (UINT8 *) (UINTN) (Smbios30Table->TableAddress + 
Smbios30Table->TableMaximumSize);
+if (Smbios30Table->TableMaximumSize > SmbiosTableSize) {
+  DEBUG((DEBUG_INFO, "%a: SMBIOS table size greater than reported by 
bootloader\n",
+__FUNCTION__));
+}
+  } else if (CompareMem (SmbiosTable->AnchorString, "_SM_", 4) == 0) {
+Smbios.Hdr= (SMBIOS_STRUCTURE *) (UINTN) SmbiosTable->TableAddress;
+SmbiosEnd.Raw = (UINT8 *) ((UINTN) SmbiosTable->TableAddress + 
SmbiosTable->TableLength);
+
+if (SmbiosTable->TableLength > SmbiosTableSize) {
+  DEBUG((DEBUG_INFO, "%a: SMBIOS table size greater than reported by 
bootloader\n",
+__FUNCTION__));
+}
+  } else {
+DEBUG ((DEBUG_ERROR, "%a: No valid SMBIOS table found\n", __FUNCTION__ ));
+return EFI_NOT_FOUND;
+  }
+
+  do {
+// Check for end marker
+if (Smbios.Hdr->Type == 127) {
+  break;
+}
+
+// Install the table
+SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
+Status = SmbiosProto->Add (
+  SmbiosProto,
+  gImageHandle,
+  ,
+  Smbios.Hdr
+  );
+ASSERT_EFI_ERROR (Status);
+if (EFI_ERROR (Status)) {
+  return Status;
+}
+//
+// Go to the next SMBIOS structure. Each SMBIOS structure may include 2 
parts:
+// 1. Formatted section; 2. Unformatted string section. So, 2 steps are 
needed
+// to skip one SMBIOS structure.
+//
+
+//
+// Step 1: Skip over formatted section.
+//
+String = (CHAR8 *) (Smbios.Raw + Smbios.Hdr->Length);
+
+//
+// Step 2: Skip over unformatted string section.
+//
+do {
+  //
+  // Each string is terminated with a NULL(00h) BYTE and the sets of 
strings
+  // is terminated with an additional NULL(00h) BYTE.
+  //
+  for ( ; *String != 0; String++) {
+  }
+
+  if (*(UINT8*)++String == 0) {
+//
+// Pointer to the next SMBIOS structure.
+//
+Smbios.Raw = (UINT8 *)++String;
+break;
+  }
+} while (TRUE);
+  } while (Smbios.Raw < SmbiosEnd.Raw);
+
+  return EFI_SUCCESS;
+}
 
 /**
   Main entry for the bootloader support DXE module.
@@ -133,9 +234,13 @@ BlDxeEntryPoint (
   // Install Smbios Table
   //
   if (SystemTableInfo->SmbiosTableBase != 0 && 
SystemTableInfo->SmbiosTableSize != 0) {
-DEBUG ((DEBUG_ERROR, "Install Smbios Table at 0x%lx, length 0x%x\n", 
SystemTableInfo->SmbiosTableBase, SystemTableInfo->SmbiosTableSize));
-Status = gBS->InstallConfigurationTable (, (VOID 
*)(UINTN)SystemTableInfo->SmbiosTableBase);
-ASSERT_EFI_ERROR (Status);
+DEBUG ((DEBUG_ERROR, "Install Smbios Table at 0x%lx, length 0x%x\n",
+  SystemTableInfo->SmbiosTableBase, SystemTableInfo->SmbiosTableSize));
+
+if (BlDxeInstallSMBIOStables(SystemTableInfo->SmbiosTableBase, 
SystemTableInfo->SmbiosTableSize) != EFI_SUCCESS) {
+  Status = gBS->InstallConfigurationTable (, (VOID 

[edk2-devel] [PATCH 2/2] MdeModulePkg/Usb/Keyboard.c: don't request protocol before setting

2021-01-20 Thread Patrick Rudolph
From: Matt DeVillier 

No need to check the interface protocol then conditionally setting,
just set it to BOOT_PROTOCOL and check for error.

This is what Linux does for HID devices as some don't follow the USB spec.
One example is the Aspeed BMC HID keyboard device, which adds a massive
boot delay without this patch as it doesn't respond to 'GetProtocolRequest'.

Signed-off-by: Matt DeVillier 
Signed-off-by: Patrick Rudolph 
---
 MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c | 28 
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c 
b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
index 77e20b203f..5914174b4d 100644
--- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
+++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
@@ -801,7 +801,6 @@ InitUSBKeyboard (
   IN OUT USB_KB_DEV   *UsbKeyboardDevice
   )
 {
-  UINT8   Protocol;
   EFI_STATUS  Status;
 
   REPORT_STATUS_CODE_WITH_DEVICE_PATH (
@@ -814,21 +813,28 @@ InitUSBKeyboard (
   InitQueue (>EfiKeyQueue, sizeof (EFI_KEY_DATA));
   InitQueue (>EfiKeyQueueForNotify, sizeof (EFI_KEY_DATA));
 
-  UsbGetProtocolRequest (
-UsbKeyboardDevice->UsbIo,
-UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
-
-);
   //
   // Set boot protocol for the USB Keyboard.
   // This driver only supports boot protocol.
   //
-  if (Protocol != BOOT_PROTOCOL) {
-UsbSetProtocolRequest (
-  UsbKeyboardDevice->UsbIo,
-  UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
-  BOOT_PROTOCOL
+  Status = UsbSetProtocolRequest (
+ UsbKeyboardDevice->UsbIo,
+ UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
+ BOOT_PROTOCOL
+ );
+  if (EFI_ERROR (Status)) {
+//
+// If protocol could not be set here, it means
+// the keyboard interface has some errors and could
+// not be initialized
+//
+REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+  EFI_ERROR_CODE | EFI_ERROR_MINOR,
+  (EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INTERFACE_ERROR),
+  UsbKeyboardDevice->DevicePath
   );
+
+return EFI_DEVICE_ERROR;
   }
 
   UsbKeyboardDevice->CtrlOn = FALSE;
-- 
2.26.2



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




[edk2-devel] [PATCH 1/2] MdeModulePkg/Usb/Keyboard.c: remove Get/SetConfig calls

2021-01-20 Thread Patrick Rudolph
From: Matt DeVillier 

SetConfig is already called during device enumeration,
no need to do it again here.

Signed-off-by: Matt DeVillier 
---
 MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c | 37 
 1 file changed, 37 deletions(-)

diff --git a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c 
b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
index 5faf82ea57..77e20b203f 100644
--- a/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
+++ b/MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
@@ -801,10 +801,8 @@ InitUSBKeyboard (
   IN OUT USB_KB_DEV   *UsbKeyboardDevice
   )
 {
-  UINT16  ConfigValue;
   UINT8   Protocol;
   EFI_STATUS  Status;
-  UINT32  TransferResult;
 
   REPORT_STATUS_CODE_WITH_DEVICE_PATH (
 EFI_PROGRESS_CODE,
@@ -816,41 +814,6 @@ InitUSBKeyboard (
   InitQueue (>EfiKeyQueue, sizeof (EFI_KEY_DATA));
   InitQueue (>EfiKeyQueueForNotify, sizeof (EFI_KEY_DATA));
 
-  //
-  // Use the config out of the descriptor
-  // Assumed the first config is the correct one and this is not always the 
case
-  //
-  Status = UsbGetConfiguration (
- UsbKeyboardDevice->UsbIo,
- ,
- 
- );
-  if (EFI_ERROR (Status)) {
-ConfigValue = 0x01;
-//
-// Uses default configuration to configure the USB Keyboard device.
-//
-Status = UsbSetConfiguration (
-   UsbKeyboardDevice->UsbIo,
-   ConfigValue,
-   
-   );
-if (EFI_ERROR (Status)) {
-  //
-  // If configuration could not be set here, it means
-  // the keyboard interface has some errors and could
-  // not be initialized
-  //
-  REPORT_STATUS_CODE_WITH_DEVICE_PATH (
-EFI_ERROR_CODE | EFI_ERROR_MINOR,
-(EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INTERFACE_ERROR),
-UsbKeyboardDevice->DevicePath
-);
-
-  return EFI_DEVICE_ERROR;
-}
-  }
-
   UsbGetProtocolRequest (
 UsbKeyboardDevice->UsbIo,
 UsbKeyboardDevice->InterfaceDescriptor.InterfaceNumber,
-- 
2.26.2



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




[edk2-devel] [PATCH] UefiPayloadPkg: Add RNG support

2021-01-20 Thread Patrick Rudolph
Uses the RDRAND instruction if available and install EfiRngProtocol.
The protocol may be used by iPXE or the Linux kernel to gather entropy.

Signed-off-by: Patrick Rudolph 
---
 UefiPayloadPkg/Library/BaseRngLib/BaseRng.c  | 199 
 UefiPayloadPkg/Library/BaseRngLib/BaseRngLib.inf |  32 
 UefiPayloadPkg/Library/BaseRngLib/BaseRngLib.uni |  17 ++
 UefiPayloadPkg/UefiPayloadPkg.dsc|   8 +
 UefiPayloadPkg/UefiPayloadPkg.fdf|   4 +
 5 files changed, 260 insertions(+)

diff --git a/UefiPayloadPkg/Library/BaseRngLib/BaseRng.c 
b/UefiPayloadPkg/Library/BaseRngLib/BaseRng.c
new file mode 100644
index 00..1fe9e1dbe0
--- /dev/null
+++ b/UefiPayloadPkg/Library/BaseRngLib/BaseRng.c
@@ -0,0 +1,199 @@
+/** @file
+  Random number generator services that uses RdRand instruction access
+  to provide high-quality random numbers.
+
+Copyright (c) 2015, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+
+STATIC BOOLEAN mHasRdRand;
+
+//
+// Bit mask used to determine if RdRand instruction is supported.
+//
+#define RDRAND_MASK  BIT30
+
+//
+// Limited retry number when valid random data is returned.
+// Uses the recommended value defined in Section 7.3.17 of "Intel 64 and IA-32
+// Architectures Software Developer's Mannual".
+//
+#define RDRAND_RETRY_LIMIT   10
+
+/**
+  The constructor function checks whether or not RDRAND instruction is 
supported
+  by the host hardware.
+
+  The constructor function checks whether or not RDRAND instruction is 
supported.
+  It will always return RETURN_SUCCESS.
+
+  @retval RETURN_SUCCESS   The constructor always returns EFI_SUCCESS.
+
+**/
+RETURN_STATUS
+EFIAPI
+BaseRngLibConstructor (
+  VOID
+  )
+{
+  UINT32  RegEax;
+  UINT32  RegEcx;
+
+  AsmCpuid (CPUID_SIGNATURE, , NULL, NULL, NULL);
+  if (RegEax < 1) {
+mHasRdRand = FALSE;
+return RETURN_SUCCESS;
+  }
+
+  //
+  // Determine RDRAND support by examining bit 30 of the ECX register returned 
by
+  // CPUID. A value of 1 indicates that processor support RDRAND instruction.
+  //
+  AsmCpuid (CPUID_VERSION_INFO, 0, 0, , 0);
+
+  mHasRdRand = ((RegEcx & RDRAND_MASK) == RDRAND_MASK);
+
+  return RETURN_SUCCESS;
+}
+
+/**
+  Generates a 16-bit random number.
+
+  if Rand is NULL, then ASSERT().
+
+  @param[out] Rand Buffer pointer to store the 16-bit random value.
+
+  @retval TRUE Random number generated successfully.
+  @retval FALSEFailed to generate the random number.
+
+**/
+BOOLEAN
+EFIAPI
+GetRandomNumber16 (
+  OUT UINT16*Rand
+  )
+{
+  UINT32  Index;
+
+  ASSERT (Rand != NULL);
+
+  if (mHasRdRand) {
+//
+// A loop to fetch a 16 bit random value with a retry count limit.
+//
+for (Index = 0; Index < RDRAND_RETRY_LIMIT; Index++) {
+  if (AsmRdRand16 (Rand)) {
+return TRUE;
+  }
+}
+  }
+
+  return FALSE;
+}
+
+/**
+  Generates a 32-bit random number.
+
+  if Rand is NULL, then ASSERT().
+
+  @param[out] Rand Buffer pointer to store the 32-bit random value.
+
+  @retval TRUE Random number generated successfully.
+  @retval FALSEFailed to generate the random number.
+
+**/
+BOOLEAN
+EFIAPI
+GetRandomNumber32 (
+  OUT UINT32*Rand
+  )
+{
+  UINT32  Index;
+
+  ASSERT (Rand != NULL);
+
+  if (mHasRdRand) {
+//
+// A loop to fetch a 32 bit random value with a retry count limit.
+//
+for (Index = 0; Index < RDRAND_RETRY_LIMIT; Index++) {
+  if (AsmRdRand32 (Rand)) {
+return TRUE;
+  }
+}
+  }
+
+  return FALSE;
+}
+
+/**
+  Generates a 64-bit random number.
+
+  if Rand is NULL, then ASSERT().
+
+  @param[out] Rand Buffer pointer to store the 64-bit random value.
+
+  @retval TRUE Random number generated successfully.
+  @retval FALSEFailed to generate the random number.
+
+**/
+BOOLEAN
+EFIAPI
+GetRandomNumber64 (
+  OUT UINT64*Rand
+  )
+{
+  UINT32  Index;
+
+  ASSERT (Rand != NULL);
+
+  if (mHasRdRand) {
+//
+// A loop to fetch a 64 bit random value with a retry count limit.
+//
+for (Index = 0; Index < RDRAND_RETRY_LIMIT; Index++) {
+  if (AsmRdRand64 (Rand)) {
+return TRUE;
+  }
+}
+  }
+
+  return FALSE;
+}
+
+/**
+  Generates a 128-bit random number.
+
+  if Rand is NULL, then ASSERT().
+
+  @param[out] Rand Buffer pointer to store the 128-bit random value.
+
+  @retval TRUE Random number generated successfully.
+  @retval FALSEFailed to generate the random number.
+
+**/
+BOOLEAN
+EFIAPI
+GetRandomNumber128 (
+  OUT UINT64*Rand
+  )
+{
+  ASSERT (Rand != NULL);
+
+  //
+  // Read first 64 bits
+  //
+  if (!GetRandomNumber64 (Rand)) {
+return FALSE;
+  }
+
+  //
+  // Read second 64 bits
+  //
+  return GetRandomNumber64 (++Rand);
+}
diff --git 

Re: [edk2-devel] [PATCH v6 11/11] ArmVirtPkg/ArmVirtQemu: Add support for HotPlug

2021-01-20 Thread Laszlo Ersek
On 01/19/21 02:13, Jiahui Cen via groups.io wrote:
> It is necessary to add padding for hotplugable PCI Devices like
> pcie-root-port.
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059
> 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Signed-off-by: Jiahui Cen 
> Signed-off-by: Yubo Miao 
> ---
>  ArmVirtPkg/ArmVirtQemu.dsc   | 1 +
>  ArmVirtPkg/ArmVirtQemuKernel.dsc | 1 +
>  ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc
> index a11ffd9ba553..d77c226d80ee 100644
> --- a/ArmVirtPkg/ArmVirtQemu.dsc
> +++ b/ArmVirtPkg/ArmVirtQemu.dsc
> @@ -488,6 +488,7 @@ [Components.common]
>  
>NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
>}
> +  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
>OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
>OvmfPkg/Virtio10Dxe/Virtio10.inf
>  
> diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc 
> b/ArmVirtPkg/ArmVirtQemuKernel.dsc
> index c27752b4d5e5..92f327eec4fb 100644
> --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc
> +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc
> @@ -424,6 +424,7 @@ [Components.common]
>  
>NULL|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
>}
> +  OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
>OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
>OvmfPkg/Virtio10Dxe/Virtio10.inf
>  
> diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc 
> b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
> index 1752fee12b79..5b1d10057545 100644
> --- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
> +++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc
> @@ -162,6 +162,7 @@ [FV.FvMain]
>INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
>INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
>INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
> +  INF OvmfPkg/PciHotPlugInitDxe/PciHotPlugInit.inf
>INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf
>INF OvmfPkg/Virtio10Dxe/Virtio10.inf
>  
> 

This patch is identical to v4 9/9, but you forgot to pick up my R-b from
there: .

So, once again:

Reviewed-by: Laszlo Ersek 

I'm going to fix up the v6 patches now as described, and then merge the
series.

Thanks
Laszlo



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




Re: [edk2-devel] [PATCH v6 10/11] ArmVirtPkg/FdtPciHostBridgeLib: Add extra pci root buses support

2021-01-20 Thread Laszlo Ersek
On 01/19/21 02:13, Jiahui Cen via groups.io wrote:
> In order to take advantages of extra pci root buses in ArmVirtPkg, it is
> necessary to scan extra root buses when getting root briges. And now
> PciHostBridgeUtilityLib already provides a set of utility functions that
> support for extra pci root buses, like PciHostBridgeUtilityGetRootBridges()
> / PciHostBridgeUtilityFreeRootBridges(). So let's rebase
> ArmVirtPkg/FdtPciHostBridgeLib to PciHostBridgeUtilityGetRootBridges() /
> PciHostBridgeUtilityFreeRootBridges() to extend ArmVirtPkg with extra
> pci root buses support.
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059
> 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Signed-off-by: Jiahui Cen 
> Signed-off-by: Yubo Miao 
> ---
>  ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c | 22 
> 
>  1 file changed, 4 insertions(+), 18 deletions(-)
> 
> diff --git a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c 
> b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
> index 3ec7992b6331..0099b8e3c391 100644
> --- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
> +++ b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
> @@ -272,8 +272,6 @@ ProcessPciHost (
>return Status;
>  }
>  
> -STATIC PCI_ROOT_BRIDGE mRootBridge;
> -
>  /**
>Return all the root bridge instances in an array.
>  
> @@ -361,8 +359,8 @@ PciHostBridgeGetRootBridges (
>PMemAbove4G.Base = MAX_UINT64;
>PMemAbove4G.Limit= 0;
>  
> -  Status = PciHostBridgeUtilityInitRootBridge (
> -Attributes,
> +  return PciHostBridgeUtilityGetRootBridges (
> +Count,
>  Attributes,
>  AllocationAttributes,
>  TRUE,
> @@ -373,19 +371,8 @@ PciHostBridgeGetRootBridges (
>  ,
>  ,
>  ,
> -,
> -
> +
>  );
> -  if (EFI_ERROR (Status)) {
> -DEBUG ((DEBUG_ERROR, "%a: failed to initialize PCI host bridge: %r\n",
> -  __FUNCTION__, Status));
> -*Count = 0;
> -return NULL;
> -  }
> -
> -  *Count = 1;
> -
> -  return 
>  }
>  
>  /**
> @@ -402,8 +389,7 @@ PciHostBridgeFreeRootBridges (
>UINTN   Count
>)
>  {
> -  ASSERT (Count == 1);
> -  PciHostBridgeUtilityUninitRootBridge (Bridges);
> +  PciHostBridgeUtilityFreeRootBridges (Bridges, Count);
>  }
>  
>  /**
> 

Reviewed-by: Laszlo Ersek 



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




Re: [edk2-devel] [PATCH v6 09/11] OvmfPkg/PciHostBridgeUtilityLib: Extend GetRootBridges() with BusMin/BusMax

2021-01-20 Thread Laszlo Ersek
On 01/19/21 02:13, Jiahui Cen via groups.io wrote:
> Extend parameter list of PciHostBridgeUtilityGetRootBridges() with BusMin/
> BusMax, so that the utility function could be compatible with ArmVirtPkg
> who uses mutable bus range [BusMin, BusMax] insteand of [0, PCI_MAX_BUS].
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Signed-off-by: Jiahui Cen 
> ---
>  OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h |  6 
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   |  2 ++
>  OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c | 30 
> 
>  3 files changed, 33 insertions(+), 5 deletions(-)
> 
> diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
> b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> index a0ea44d96a67..d2dc18a1afad 100644
> --- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> +++ b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> @@ -112,6 +112,10 @@ PciHostBridgeUtilityUninitRootBridge (
>  
>@param[in]  NoExtendedConfigSpace  No Extended Config Space.
>  
> +  @param[in]  BusMin Minimum Bus number, inclusive.
> +
> +  @param[in]  BusMax Maximum Bus number, inclusive.
> +
>@param[in]  Io IO aperture.
>  
>@param[in]  MemMMIO aperture.
> @@ -132,6 +136,8 @@ PciHostBridgeUtilityGetRootBridges (
>IN  UINT64   AllocationAttributes,
>IN  BOOLEAN  DmaAbove4G,
>IN  BOOLEAN  NoExtendedConfigSpace,
> +  IN  UINTNBusMin,
> +  IN  UINTNBusMax,
>IN  PCI_ROOT_BRIDGE_APERTURE *Io,
>IN  PCI_ROOT_BRIDGE_APERTURE *Mem,
>IN  PCI_ROOT_BRIDGE_APERTURE *MemAbove4G,
> diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
> b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
> index 91b9e6baa1e8..7d9fb0fb293a 100644
> --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
> +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
> @@ -85,6 +85,8 @@ PciHostBridgeGetRootBridges (
>  AllocationAttributes,
>  FALSE,
>  PcdGet16 (PcdOvmfHostBridgePciDevId) != INTEL_Q35_MCH_DEVICE_ID,
> +0,
> +PCI_MAX_BUS,
>  ,
>  ,
>  ,
> diff --git 
> a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c 
> b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
> index 1d78984b83ad..69bed5c7843f 100644
> --- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
> +++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
> @@ -200,6 +200,10 @@ PciHostBridgeUtilityUninitRootBridge (
>  
>@param[in]  NoExtendedConfigSpace  No Extended Config Space.
>  
> +  @param[in]  BusMin Minimum Bus number, inclusive.
> +
> +  @param[in]  BusMax Maximum Bus number, inclusive.
> +
>@param[in]  Io IO aperture.
>  
>@param[in]  MemMMIO aperture.
> @@ -220,6 +224,8 @@ PciHostBridgeUtilityGetRootBridges (
>IN  UINT64   AllocationAttributes,
>IN  BOOLEAN  DmaAbove4G,
>IN  BOOLEAN  NoExtendedConfigSpace,
> +  IN  UINTNBusMin,
> +  IN  UINTNBusMax,
>IN  PCI_ROOT_BRIDGE_APERTURE *Io,
>IN  PCI_ROOT_BRIDGE_APERTURE *Mem,
>IN  PCI_ROOT_BRIDGE_APERTURE *MemAbove4G,
> @@ -236,6 +242,13 @@ PciHostBridgeUtilityGetRootBridges (
>UINTNLastRootBridgeNumber;
>UINTNRootBridgeNumber;
>  
> +  if (BusMin > BusMax || BusMax > PCI_MAX_BUS) {
> +DEBUG ((DEBUG_ERROR, "%a: invalid bus range with BusMin %d and BusMax 
> %d\n",
> +  __FUNCTION__, BusMin, BusMax));

(1) The "%d" format specifier is appropriate for INT32 values. But UINTN
is either UINT32 or UINT64 (dependent on the edk2 architecture the
platform is built for).

The safe way to print a UINTN value is to (a) cast it to UINT64, and (b)
use the "%Lu" (or "%Lx") format specifier.

I'll fix this up for you.

> +*Count = 0;

(2) As I said under patch v6 07/11, this zeroing should be centralized
at the top of the function. I'll fix it up for you.

> +return NULL;
> +  }
> +
>//
>// QEMU provides the number of extra root buses, shortening the exhaustive
>// search below. If there is no hint, the feature is missing.
> @@ -247,7 +260,14 @@ PciHostBridgeUtilityGetRootBridges (
>  QemuFwCfgSelectItem (FwCfgItem);
>  QemuFwCfgReadBytes (FwCfgSize, );
>  
> -if (ExtraRootBridges > PCI_MAX_BUS) {
> +//
> +// Validate the number of extra root bridges. As BusMax is inclusive, the
> +// max bus count is (BusMax - BusMin + 1). From that, the "main" root bus
> +// is always givin, so the max count for the "extra" root bridges is one

(3) s/givin/a given/

I'll fix it.

> +// 

Re: [edk2-devel] [PATCH v6 08/11] OvmfPkg/PciHostBridgeUtilityLib: Extend parameter list of GetRootBridges

2021-01-20 Thread Laszlo Ersek
On 01/19/21 02:12, Jiahui Cen via groups.io wrote:
> Extend parameter list of PciHostBridgeUtilityGetRootBridges() with
> DmaAbove4G, NoExtendedConfigSpace to support for ArmVirtPkg.
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Signed-off-by: Jiahui Cen 
> Signed-off-by: Yubo Miao 
> ---
>  OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf |  4 ---
>  OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h   | 24 
> --
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c |  5 +++
>  OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c   | 34 
> +++-
>  4 files changed, 39 insertions(+), 28 deletions(-)
> 
> diff --git 
> a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf 
> b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
> index fdae8cfe872e..83a734c1725e 100644
> --- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
> +++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
> @@ -39,9 +39,5 @@ [LibraryClasses]
>DebugLib
>DevicePathLib
>MemoryAllocationLib
> -  PcdLib
>PciLib
>QemuFwCfgLib
> -
> -[Pcd]
> -  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
> diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
> b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> index 2b7d5d3725c3..a0ea44d96a67 100644
> --- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> +++ b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> @@ -102,23 +102,27 @@ PciHostBridgeUtilityUninitRootBridge (
>  /**
>Utility function to return all the root bridge instances in an array.
>  
> -  @param[out] CountThe number of root bridge instances.
> +  @param[out] Count  The number of root bridge instances.
>  
> -  @param[in]  Attributes   Initial attributes.
> +  @param[in]  Attributes Initial attributes.
>  
> -  @param[in]  AllocAttributes  Allocation attributes.
> +  @param[in]  AllocAttributesAllocation attributes.
>  
> -  @param[in]  Io   IO aperture.
> +  @param[in]  DmaAbove4G DMA above 4GB memory.
>  
> -  @param[in]  Mem  MMIO aperture.
> +  @param[in]  NoExtendedConfigSpace  No Extended Config Space.
>  
> -  @param[in]  MemAbove4G   MMIO aperture above 4G.
> +  @param[in]  Io IO aperture.
>  
> -  @param[in]  PMem Prefetchable MMIO aperture.
> +  @param[in]  MemMMIO aperture.
>  
> -  @param[in]  PMemAbove4G  Prefetchable MMIO aperture above 4G.
> +  @param[in]  MemAbove4G MMIO aperture above 4G.
>  
> -  @return  All the root bridge instances in an array.
> +  @param[in]  PMem   Prefetchable MMIO aperture.
> +
> +  @param[in]  PMemAbove4GPrefetchable MMIO aperture above 4G.
> +
> +  @returnAll the root bridge instances in an 
> array.
>  **/
>  PCI_ROOT_BRIDGE *
>  EFIAPI
> @@ -126,6 +130,8 @@ PciHostBridgeUtilityGetRootBridges (
>OUT UINTN*Count,
>IN  UINT64   Attributes,
>IN  UINT64   AllocationAttributes,
> +  IN  BOOLEAN  DmaAbove4G,
> +  IN  BOOLEAN  NoExtendedConfigSpace,
>IN  PCI_ROOT_BRIDGE_APERTURE *Io,
>IN  PCI_ROOT_BRIDGE_APERTURE *Mem,
>IN  PCI_ROOT_BRIDGE_APERTURE *MemAbove4G,
> diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
> b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
> index 6ac41ff853a9..91b9e6baa1e8 100644
> --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
> +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
> @@ -9,6 +9,9 @@
>  **/
>  #include 
>  
> +#include 

(1) This #include directive does not belong in this patch. It is needed
in the next patch in the series (i.e., #9), where a reference to
PCI_MAX_BUS is added to this source file.

IOW, you didn't split patch v4 7/9 entirely correctly.

I guess I'm too tired to obsess about this though.

Reviewed-by: Laszlo Ersek 

Laszlo


> +#include 
> +
>  #include 
>  #include 
>  
> @@ -80,6 +83,8 @@ PciHostBridgeGetRootBridges (
>  Count,
>  Attributes,
>  AllocationAttributes,
> +FALSE,
> +PcdGet16 (PcdOvmfHostBridgePciDevId) != INTEL_Q35_MCH_DEVICE_ID,
>  ,
>  ,
>  ,
> diff --git 
> a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c 
> b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
> index b1e74a469d50..1d78984b83ad 100644
> --- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
> +++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c
> @@ -12,12 +12,10 @@
>  
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 

Re: [edk2-devel] [PATCH v6 03/11] OvmfPkg/PciHostBridgeLib: List missing PcdLib dependency

2021-01-20 Thread Laszlo Ersek
On 01/20/21 13:14, Laszlo Ersek wrote:
> On 01/19/21 02:12, Jiahui Cen via groups.io wrote:
>> OvmfPkg/PciHostBridgeLib instance fails to list its PcdLib dependency,
>> both between the #include directives, and in the INF file. So let's list
>> the dependency.
>>
>> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059
>>
>> Cc: Jordan Justen 
>> Cc: Laszlo Ersek 
>> Cc: Ard Biesheuvel 
>> Cc: Anthony Perard 
>> Cc: Julien Grall 
>> Signed-off-by: Jiahui Cen 
>> ---
>>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 1 +
>>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   | 1 +
>>  OvmfPkg/Library/PciHostBridgeLib/XenSupport.c | 1 +
>>  3 files changed, 3 insertions(+)
>>
>> diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
>> b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
>> index 4c56f3c90b3b..cec3f1631a72 100644
>> --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
>> +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
>> @@ -39,6 +39,7 @@ [LibraryClasses]
>>DebugLib
>>DevicePathLib
>>MemoryAllocationLib
>> +  PcdLib
>>PciHostBridgeUtilityLib
>>PciLib
>>QemuFwCfgLib
>> diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
>> b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
>> index 4a176347fd49..bf32455b9f0d 100644
>> --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
>> +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
>> @@ -19,6 +19,7 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>>  #include 
>> diff --git a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c 
>> b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
>> index e161f14375ca..95ed0a280b9b 100644
>> --- a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
>> +++ b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
>> @@ -17,6 +17,7 @@
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>>  #include 
>>  #include 
>>  #include "PciHostBridge.h"
>>
> 
> At this stage, "XenSupport.c" doesn't seem to call any PcdLib API.

... Yes, the #include directive belongs to patch#5, where XenSupport.c
gains a PcdGet16() call.

But, don't bother.

Laszlo

> 
> But, it's not a big deal.
> 
> Reviewed-by: Laszlo Ersek 
> 
> Thanks,
> Laszlo
> 



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




Re: [edk2-devel] [PATCH v6 07/11] OvmfPkg/PciHostBridgeLib: Extract GetRootBridges() / FreeRootBridges()

2021-01-20 Thread Laszlo Ersek
On 01/19/21 02:12, Jiahui Cen via groups.io wrote:
> Extract PciHostBridgeGetRootBridges() / PciHostBridgeFreeRootBridges() to
> PciHostBridgeUtilityLib as common utility functions to share support for
> scanning extra root bridges.
> 
> No change of functionality.
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Signed-off-by: Jiahui Cen 
> Signed-off-by: Yubo Miao 
> ---
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf   |   1 -
>  OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf |   6 +
>  OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h   |  50 
> +
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 138 
> +-
>  OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c   | 197 
> 
>  5 files changed, 257 insertions(+), 135 deletions(-)
> 
> diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
> b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> index 72458262cb42..4610a0c1490b 100644
> --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> @@ -41,7 +41,6 @@ [LibraryClasses]
>PcdLib
>PciHostBridgeUtilityLib
>PciLib
> -  QemuFwCfgLib
>  
>  [Pcd]
>gUefiOvmfPkgTokenSpaceGuid.PcdPciIoBase
> diff --git 
> a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf 
> b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
> index 4d6764b702f4..fdae8cfe872e 100644
> --- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
> +++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
> @@ -39,3 +39,9 @@ [LibraryClasses]
>DebugLib
>DevicePathLib
>MemoryAllocationLib
> +  PcdLib
> +  PciLib
> +  QemuFwCfgLib
> +
> +[Pcd]
> +  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
> diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
> b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> index a44ad5034520..2b7d5d3725c3 100644
> --- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> +++ b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> @@ -99,6 +99,56 @@ PciHostBridgeUtilityUninitRootBridge (
>);
>  
>  
> +/**
> +  Utility function to return all the root bridge instances in an array.
> +
> +  @param[out] CountThe number of root bridge instances.
> +
> +  @param[in]  Attributes   Initial attributes.
> +
> +  @param[in]  AllocAttributes  Allocation attributes.
> +
> +  @param[in]  Io   IO aperture.
> +
> +  @param[in]  Mem  MMIO aperture.
> +
> +  @param[in]  MemAbove4G   MMIO aperture above 4G.
> +
> +  @param[in]  PMem Prefetchable MMIO aperture.
> +
> +  @param[in]  PMemAbove4G  Prefetchable MMIO aperture above 4G.
> +
> +  @return  All the root bridge instances in an array.
> +**/
> +PCI_ROOT_BRIDGE *
> +EFIAPI
> +PciHostBridgeUtilityGetRootBridges (
> +  OUT UINTN*Count,
> +  IN  UINT64   Attributes,
> +  IN  UINT64   AllocationAttributes,
> +  IN  PCI_ROOT_BRIDGE_APERTURE *Io,
> +  IN  PCI_ROOT_BRIDGE_APERTURE *Mem,
> +  IN  PCI_ROOT_BRIDGE_APERTURE *MemAbove4G,
> +  IN  PCI_ROOT_BRIDGE_APERTURE *PMem,
> +  IN  PCI_ROOT_BRIDGE_APERTURE *PMemAbove4G
> +  );
> +
> +
> +/**
> +  Utility function to free root bridge instances array from
> +  PciHostBridgeUtilityGetRootBridges().
> +
> +  @param[in] Bridges  The root bridge instances array.
> +  @param[in] CountThe count of the array.
> +**/
> +VOID
> +EFIAPI
> +PciHostBridgeUtilityFreeRootBridges (
> +  IN PCI_ROOT_BRIDGE *Bridges,
> +  IN UINTN   Count
> +  );
> +
> +
>  /**
>Utility function to inform the platform that the resource conflict happens.
>  
> diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
> b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
> index 8758d7c12bf0..6ac41ff853a9 100644
> --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
> +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
> @@ -9,9 +9,6 @@
>  **/
>  #include 
>  
> -#include 
> -#include 
> -
>  #include 
>  #include 
>  
> @@ -21,8 +18,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
> -#include 
>  #include "PciHostBridge.h"
>  
>  
> @@ -44,14 +39,6 @@ PciHostBridgeGetRootBridges (
>UINTN *Count
>)
>  {
> -  EFI_STATUS   Status;
> -  FIRMWARE_CONFIG_ITEM FwCfgItem;
> -  UINTNFwCfgSize;
> -  UINT64   ExtraRootBridges;
> -  PCI_ROOT_BRIDGE  *Bridges;
> -  UINTNInitialized;
> -  UINTNLastRootBridgeNumber;
> -  UINTNRootBridgeNumber;
>UINT64   Attributes;
>UINT64   AllocationAttributes;
>PCI_ROOT_BRIDGE_APERTURE Io;
> @@ -89,123 +76,16 @@ PciHostBridgeGetRootBridges (
>

Re: [edk2-devel] [PATCH v6 06/11] ArmVirtPkg/FdtPciHostBridgeLib: Refactor init/uninit of root bridge

2021-01-20 Thread Laszlo Ersek
On 01/19/21 02:12, Jiahui Cen via groups.io wrote:
> Rebase ArmVirtPkg/FdtPciHostBridgeLib to the new
> PciHostBridgeUtilityInitRootBridge()/PciHostBridgeUtilityUninitRootBridge()
> utility functions.
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059
> 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Signed-off-by: Jiahui Cen 
> Signed-off-by: Yubo Miao 
> ---
>  ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf |   1 +
>  ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c   | 124 
> ++--
>  2 files changed, 61 insertions(+), 64 deletions(-)

Reviewed-by: Laszlo Ersek 

Thanks
Laszlo

> 
> diff --git a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf 
> b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
> index 01d39626d14c..b813a0851d2a 100644
> --- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
> +++ b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
> @@ -34,6 +34,7 @@ [Packages]
>OvmfPkg/OvmfPkg.dec
>  
>  [LibraryClasses]
> +  BaseMemoryLib
>DebugLib
>DevicePathLib
>DxeServicesTableLib
> diff --git a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c 
> b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
> index d554479bf0de..3ec7992b6331 100644
> --- a/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
> +++ b/ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.c
> @@ -7,6 +7,7 @@
>  
>  **/
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -20,37 +21,6 @@
>  #include 
>  #include 
>  
> -#pragma pack(1)
> -typedef struct {
> -  ACPI_HID_DEVICE_PATH AcpiDevicePath;
> -  EFI_DEVICE_PATH_PROTOCOL EndDevicePath;
> -} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
> -#pragma pack ()
> -
> -STATIC EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath = {
> -  {
> -{
> -  ACPI_DEVICE_PATH,
> -  ACPI_DP,
> -  {
> -(UINT8) (sizeof(ACPI_HID_DEVICE_PATH)),
> -(UINT8) ((sizeof(ACPI_HID_DEVICE_PATH)) >> 8)
> -  }
> -},
> -EISA_PNP_ID(0x0A03),
> -0
> -  },
> -
> -  {
> -END_DEVICE_PATH_TYPE,
> -END_ENTIRE_DEVICE_PATH_SUBTYPE,
> -{
> -  END_DEVICE_PATH_LENGTH,
> -  0
> -}
> -  }
> -};
> -
>  //
>  // We expect the "ranges" property of "pci-host-ecam-generic" to consist of
>  // records like this.
> @@ -319,11 +289,18 @@ PciHostBridgeGetRootBridges (
>UINTN *Count
>)
>  {
> -  UINT64  IoBase, IoSize;
> -  UINT64  Mmio32Base, Mmio32Size;
> -  UINT64  Mmio64Base, Mmio64Size;
> -  UINT32  BusMin, BusMax;
> -  EFI_STATUS  Status;
> +  UINT64   IoBase, IoSize;
> +  UINT64   Mmio32Base, Mmio32Size;
> +  UINT64   Mmio64Base, Mmio64Size;
> +  UINT32   BusMin, BusMax;
> +  EFI_STATUS   Status;
> +  UINT64   Attributes;
> +  UINT64   AllocationAttributes;
> +  PCI_ROOT_BRIDGE_APERTURE Io;
> +  PCI_ROOT_BRIDGE_APERTURE Mem;
> +  PCI_ROOT_BRIDGE_APERTURE MemAbove4G;
> +  PCI_ROOT_BRIDGE_APERTURE PMem;
> +  PCI_ROOT_BRIDGE_APERTURE PMemAbove4G;
>  
>if (PcdGet64 (PcdPciExpressBaseAddress) == 0) {
>  DEBUG ((EFI_D_INFO, "%a: PCI host bridge not present\n", __FUNCTION__));
> @@ -341,33 +318,29 @@ PciHostBridgeGetRootBridges (
>  return NULL;
>}
>  
> -  *Count = 1;
> +  ZeroMem (, sizeof (Io));
> +  ZeroMem (, sizeof (Mem));
> +  ZeroMem (, sizeof (MemAbove4G));
> +  ZeroMem (, sizeof (PMem));
> +  ZeroMem (, sizeof (PMemAbove4G));
>  
> -  mRootBridge.Segment   = 0;
> -  mRootBridge.Supports  = EFI_PCI_ATTRIBUTE_ISA_IO_16 |
> -  EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO |
> -  EFI_PCI_ATTRIBUTE_VGA_IO_16  |
> -  EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16;
> -  mRootBridge.Attributes= mRootBridge.Supports;
> +  Attributes   = EFI_PCI_ATTRIBUTE_ISA_IO_16 |
> + EFI_PCI_ATTRIBUTE_ISA_MOTHERBOARD_IO |
> + EFI_PCI_ATTRIBUTE_VGA_IO_16  |
> + EFI_PCI_ATTRIBUTE_VGA_PALETTE_IO_16;
>  
> -  mRootBridge.DmaAbove4G= TRUE;
> -  mRootBridge.NoExtendedConfigSpace = FALSE;
> -  mRootBridge.ResourceAssigned  = FALSE;
> +  AllocationAttributes = EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM;
>  
> -  mRootBridge.AllocationAttributes  = EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM;
> -
> -  mRootBridge.Bus.Base  = BusMin;
> -  mRootBridge.Bus.Limit = BusMax;
> -  mRootBridge.Io.Base   = IoBase;
> -  mRootBridge.Io.Limit  = IoBase + IoSize - 1;
> -  mRootBridge.Mem.Base  = Mmio32Base;
> -  mRootBridge.Mem.Limit = Mmio32Base + Mmio32Size - 1;
> +  Io.Base  = IoBase;
> +  Io.Limit = IoBase + IoSize - 

Re: [edk2-devel] [PATCH v6 05/11] OvmfPkg/PciHostBridgeUtilityLib: Extend parameters of InitRootBridge()

2021-01-20 Thread Laszlo Ersek
On 01/19/21 02:12, Jiahui Cen via groups.io wrote:
> Extend parameter list of PciHostBridgeUtilityInitRootBridge() with
> DmaAbove4G and NoExtendedConfigSpace to prepare for sharing with
> ArmVirtPkg.
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Cc: Anthony Perard 
> Cc: Julien Grall 
> Signed-off-by: Jiahui Cen 
> Signed-off-by: Yubo Miao 
> ---
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf   |  1 +
>  OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf |  4 --
>  OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h   | 56 
> +
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c |  5 ++
>  OvmfPkg/Library/PciHostBridgeLib/XenSupport.c   |  1 +
>  OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c   | 63 
> +++-
>  6 files changed, 73 insertions(+), 57 deletions(-)

Reviewed-by: Laszlo Ersek 

Thanks
Laszlo

> 
> diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
> b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> index 7944f94b7743..72458262cb42 100644
> --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> @@ -50,4 +50,5 @@ [Pcd]
>gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size
>gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base
>gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size
> +  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
>gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
> diff --git 
> a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf 
> b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
> index e3d0a3740952..4d6764b702f4 100644
> --- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
> +++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
> @@ -39,7 +39,3 @@ [LibraryClasses]
>DebugLib
>DevicePathLib
>MemoryAllocationLib
> -  PcdLib
> -
> -[Pcd]
> -  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
> diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
> b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> index 8a1ddc2f5e02..a44ad5034520 100644
> --- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> +++ b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> @@ -20,43 +20,49 @@
>  /**
>Utility function to initialize a PCI_ROOT_BRIDGE structure.
>  
> -  @param[in]  Supports Supported attributes.
> +  @param[in]  Supports   Supported attributes.
>  
> -  @param[in]  Attributes   Initial attributes.
> +  @param[in]  Attributes Initial attributes.
>  
> -  @param[in]  AllocAttributes  Allocation attributes.
> +  @param[in]  AllocAttributesAllocation attributes.
>  
> -  @param[in]  RootBusNumberThe bus number to store in RootBus.
> +  @param[in]  DmaAbove4G DMA above 4GB memory.
>  
> -  @param[in]  MaxSubBusNumber  The inclusive maximum bus number that can be
> -   assigned to any subordinate bus found behind 
> any
> -   PCI bridge hanging off this root bus.
> +  @param[in]  NoExtendedConfigSpace  No Extended Config Space.
>  
> -   The caller is repsonsible for ensuring that
> -   RootBusNumber <= MaxSubBusNumber. If
> -   RootBusNumber equals MaxSubBusNumber, then the
> -   root bus has no room for subordinate buses.
> +  @param[in]  RootBusNumber  The bus number to store in RootBus.
>  
> -  @param[in]  Io   IO aperture.
> +  @param[in]  MaxSubBusNumberThe inclusive maximum bus number that 
> can
> + be assigned to any subordinate bus found
> + behind any PCI bridge hanging off this
> + root bus.
>  
> -  @param[in]  Mem  MMIO aperture.
> + The caller is repsonsible for ensuring
> + that RootBusNumber <= MaxSubBusNumber. 
> If
> + RootBusNumber equals MaxSubBusNumber, 
> then
> + the root bus has no room for subordinate
> + buses.
>  
> -  @param[in]  MemAbove4G   MMIO aperture above 4G.
> +  @param[in]  Io IO aperture.
>  
> -  @param[in]  PMem Prefetchable MMIO aperture.
> +  @param[in]  MemMMIO aperture.
>  
> -  @param[in]  PMemAbove4G  Prefetchable MMIO aperture above 4G.
> +  @param[in]  MemAbove4G MMIO aperture above 4G.
>  
> -  @param[out] RootBus  The PCI_ROOT_BRIDGE structure (allocated by 
> the
> -   

Re: [edk2-devel] [PATCH] NetworkPkg/Library/DxeHttpIoLib: Http boot failure with no initializes timeout value.

2021-01-20 Thread Maciej Rabeda

Patch merged.
PR: https://github.com/tianocore/edk2/pull/1371
Commit: 
https://github.com/tianocore/edk2/commit/ca272b9513a6de5772e6e8ef5bbecd2e23cf9fb3


On 20-Jan-21 12:54, Maciej Rabeda wrote:

Thanks for the patch!

Reviewed-by: Maciej Rabeda 

On 15-Jan-21 07:22, GregX Yeh wrote:

https://bugzilla.tianocore.org/show_bug.cgi?id=3170
Using PcdHttpIoTimeout to set default timeout value to HttpIoLib.

Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Signed-off-by: GregX Yeh 
---
  NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c   | 1 +
  NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf | 1 +
  NetworkPkg/NetworkPkg.dec    | 6 +-
  3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c 
b/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c

index 67583fb220..04b01adec5 100644
--- a/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c
+++ b/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c
@@ -189,6 +189,7 @@ HttpIoCreateIo (
    HttpIo->Http    = Http;
    HttpIo->Callback    = Callback;
    HttpIo->Context = Context;
+  HttpIo->Timeout = PcdGet32 (PcdHttpIoTimeout);
      if (ConfigData != NULL) {
  if (HttpIo->IpVersion == IP_VERSION_4) {
diff --git a/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf 
b/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf

index 25f5eb2ec6..347f8d5508 100644
--- a/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf
+++ b/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf
@@ -43,3 +43,4 @@
    [Pcd]
    gEfiNetworkPkgTokenSpaceGuid.PcdMaxHttpChunkTransfer  ## 
SOMETIMES_CONSUMES
+  gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout ## 
SOMETIMES_CONSUMES

diff --git a/NetworkPkg/NetworkPkg.dec b/NetworkPkg/NetworkPkg.dec
index 2d0d7fd2dc..87725674e9 100644
--- a/NetworkPkg/NetworkPkg.dec
+++ b/NetworkPkg/NetworkPkg.dec
@@ -3,7 +3,7 @@
  #
  # This package provides network modules that conform to UEFI 2.4 
specification.

  #
-# Copyright (c) 2009 - 2019, Intel Corporation. All rights 
reserved.
+# Copyright (c) 2009 - 2021, Intel Corporation. All rights 
reserved.
  # (C) Copyright 2015-2020 Hewlett Packard Enterprise Development 
LP

  #
  # SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -96,6 +96,10 @@
    ## The maximum size of total HTTP chunk transfer.
    # @Prompt Max size of total HTTP chunk transfer. the default 
value is 12MB.

gEfiNetworkPkgTokenSpaceGuid.PcdMaxHttpChunkTransfer|0x0C0|UINT32|0x000E
+
+  ## The Timeout value of HTTP IO.
+  # @Prompt The Timeout value of HTTP Io. Default value is 5000.
+ gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout|5000|UINT32|0x000F
    [PcdsFixedAtBuild, PcdsPatchableInModule]
    ## Indicates whether HTTP connections (i.e., unsecured) are 
permitted or not.











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




Re: [edk2-devel] [PATCH v6 04/11] OvmfPkg/PciHostBridgeLib: Extract InitRootBridge() / UninitRootBridge()

2021-01-20 Thread Laszlo Ersek
On 01/19/21 02:12, Jiahui Cen via groups.io wrote:
> Extract InitRootBridge() / UninitRootBridge() to PciHostBridgeUtilityLib
> as common utility functions. No change of functionality.
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Cc: Anthony Perard 
> Cc: Julien Grall 
> Signed-off-by: Jiahui Cen 
> Signed-off-by: Yubo Miao 
> ---
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf   |   2 -
>  OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf |   8 +
>  OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h   |  77 
> ++
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridge.h|  56 
> ---
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 158 
> +---
>  OvmfPkg/Library/PciHostBridgeLib/XenSupport.c   |   3 +-
>  OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c   | 158 
> 
>  7 files changed, 249 insertions(+), 213 deletions(-)
> 

Reviewed-by: Laszlo Ersek 

Thanks
Laszlo

> diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
> b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> index cec3f1631a72..7944f94b7743 100644
> --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> @@ -37,7 +37,6 @@ [Packages]
>  [LibraryClasses]
>BaseMemoryLib
>DebugLib
> -  DevicePathLib
>MemoryAllocationLib
>PcdLib
>PciHostBridgeUtilityLib
> @@ -51,5 +50,4 @@ [Pcd]
>gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio32Size
>gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Base
>gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size
> -  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
>gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
> diff --git 
> a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf 
> b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
> index 1ba8ec3e03c7..e3d0a3740952 100644
> --- a/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
> +++ b/OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
> @@ -30,8 +30,16 @@ [Sources]
>PciHostBridgeUtilityLib.c
>  
>  [Packages]
> +  MdeModulePkg/MdeModulePkg.dec
>MdePkg/MdePkg.dec
>OvmfPkg/OvmfPkg.dec
>  
>  [LibraryClasses]
> +  BaseMemoryLib
>DebugLib
> +  DevicePathLib
> +  MemoryAllocationLib
> +  PcdLib
> +
> +[Pcd]
> +  gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
> diff --git a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h 
> b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> index 5ea25ed2f4f4..8a1ddc2f5e02 100644
> --- a/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> +++ b/OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
> @@ -14,6 +14,83 @@
>  #define __PCI_HOST_BRIDGE_UTILITY_LIB_H__
>  
>  
> +#include 
> +
> +
> +/**
> +  Utility function to initialize a PCI_ROOT_BRIDGE structure.
> +
> +  @param[in]  Supports Supported attributes.
> +
> +  @param[in]  Attributes   Initial attributes.
> +
> +  @param[in]  AllocAttributes  Allocation attributes.
> +
> +  @param[in]  RootBusNumberThe bus number to store in RootBus.
> +
> +  @param[in]  MaxSubBusNumber  The inclusive maximum bus number that can be
> +   assigned to any subordinate bus found behind 
> any
> +   PCI bridge hanging off this root bus.
> +
> +   The caller is repsonsible for ensuring that
> +   RootBusNumber <= MaxSubBusNumber. If
> +   RootBusNumber equals MaxSubBusNumber, then the
> +   root bus has no room for subordinate buses.
> +
> +  @param[in]  Io   IO aperture.
> +
> +  @param[in]  Mem  MMIO aperture.
> +
> +  @param[in]  MemAbove4G   MMIO aperture above 4G.
> +
> +  @param[in]  PMem Prefetchable MMIO aperture.
> +
> +  @param[in]  PMemAbove4G  Prefetchable MMIO aperture above 4G.
> +
> +  @param[out] RootBus  The PCI_ROOT_BRIDGE structure (allocated by 
> the
> +   caller) that should be filled in by this
> +   function.
> +
> +  @retval EFI_SUCCESS   Initialization successful. A device path
> +consisting of an ACPI device path node, with
> +UID = RootBusNumber, has been allocated and
> +linked into RootBus.
> +
> +  @retval EFI_OUT_OF_RESOURCES  Memory allocation failed.
> +**/
> +EFI_STATUS
> +EFIAPI
> +PciHostBridgeUtilityInitRootBridge (
> +  IN  UINT64   Supports,
> +  IN  UINT64   Attributes,
> +  IN  UINT64   AllocAttributes,
> +  IN  UINT8RootBusNumber,
> +  IN  UINT8 

Re: [edk2-devel] [PATCH v6 03/11] OvmfPkg/PciHostBridgeLib: List missing PcdLib dependency

2021-01-20 Thread Laszlo Ersek
On 01/19/21 02:12, Jiahui Cen via groups.io wrote:
> OvmfPkg/PciHostBridgeLib instance fails to list its PcdLib dependency,
> both between the #include directives, and in the INF file. So let's list
> the dependency.
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Cc: Anthony Perard 
> Cc: Julien Grall 
> Signed-off-by: Jiahui Cen 
> ---
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 1 +
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c   | 1 +
>  OvmfPkg/Library/PciHostBridgeLib/XenSupport.c | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf 
> b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> index 4c56f3c90b3b..cec3f1631a72 100644
> --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> @@ -39,6 +39,7 @@ [LibraryClasses]
>DebugLib
>DevicePathLib
>MemoryAllocationLib
> +  PcdLib
>PciHostBridgeUtilityLib
>PciLib
>QemuFwCfgLib
> diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c 
> b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
> index 4a176347fd49..bf32455b9f0d 100644
> --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
> +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c
> @@ -19,6 +19,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c 
> b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
> index e161f14375ca..95ed0a280b9b 100644
> --- a/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
> +++ b/OvmfPkg/Library/PciHostBridgeLib/XenSupport.c
> @@ -17,6 +17,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include "PciHostBridge.h"
> 

At this stage, "XenSupport.c" doesn't seem to call any PcdLib API.

But, it's not a big deal.

Reviewed-by: Laszlo Ersek 

Thanks,
Laszlo



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




Re: [edk2-devel] [PATCH] NetworkPkg/Library/DxeHttpIoLib: Http boot failure with no initializes timeout value.

2021-01-20 Thread Maciej Rabeda

Thanks for the patch!

Reviewed-by: Maciej Rabeda 

On 15-Jan-21 07:22, GregX Yeh wrote:

https://bugzilla.tianocore.org/show_bug.cgi?id=3170
Using PcdHttpIoTimeout to set default timeout value to HttpIoLib.

Cc: Maciej Rabeda 
Cc: Jiaxin Wu 
Cc: Siyuan Fu 
Signed-off-by: GregX Yeh 
---
  NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c   | 1 +
  NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf | 1 +
  NetworkPkg/NetworkPkg.dec| 6 +-
  3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c 
b/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c
index 67583fb220..04b01adec5 100644
--- a/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c
+++ b/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c
@@ -189,6 +189,7 @@ HttpIoCreateIo (
HttpIo->Http= Http;
HttpIo->Callback= Callback;
HttpIo->Context = Context;
+  HttpIo->Timeout = PcdGet32 (PcdHttpIoTimeout);
  
if (ConfigData != NULL) {

  if (HttpIo->IpVersion == IP_VERSION_4) {
diff --git a/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf 
b/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf
index 25f5eb2ec6..347f8d5508 100644
--- a/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf
+++ b/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf
@@ -43,3 +43,4 @@
  
  [Pcd]

gEfiNetworkPkgTokenSpaceGuid.PcdMaxHttpChunkTransfer  ## SOMETIMES_CONSUMES
+  gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout ## SOMETIMES_CONSUMES
diff --git a/NetworkPkg/NetworkPkg.dec b/NetworkPkg/NetworkPkg.dec
index 2d0d7fd2dc..87725674e9 100644
--- a/NetworkPkg/NetworkPkg.dec
+++ b/NetworkPkg/NetworkPkg.dec
@@ -3,7 +3,7 @@
  #
  # This package provides network modules that conform to UEFI 2.4 
specification.
  #
-# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.
  # (C) Copyright 2015-2020 Hewlett Packard Enterprise Development LP
  #
  # SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -96,6 +96,10 @@
## The maximum size of total HTTP chunk transfer.
# @Prompt Max size of total HTTP chunk transfer. the default value is 12MB.

gEfiNetworkPkgTokenSpaceGuid.PcdMaxHttpChunkTransfer|0x0C0|UINT32|0x000E
+
+  ## The Timeout value of HTTP IO.
+  # @Prompt The Timeout value of HTTP Io. Default value is 5000.
+  gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout|5000|UINT32|0x000F
  
  [PcdsFixedAtBuild, PcdsPatchableInModule]

## Indicates whether HTTP connections (i.e., unsecured) are permitted or 
not.




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




Re: [edk2-devel] [PATCH v6 01/11] OvmfPkg: Introduce PciHostBridgeUtilityLib class

2021-01-20 Thread Laszlo Ersek
On 01/19/21 02:12, Jiahui Cen via groups.io wrote:
> Introduce a new PciHostBridgeUtilityLib class to share duplicate code
> between OvmfPkg and ArmVirtPkg.
> 
> Extract function PciHostBridgeUtilityResourceConflict from
> PciHostBridgeResourceConflict in OvmfPkg/PciHostBridgeLib.
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059
> 
> Cc: Jordan Justen 
> Cc: Laszlo Ersek 
> Cc: Ard Biesheuvel 
> Cc: Rebecca Cran 
> Cc: Peter Grehan 
> Cc: Anthony Perard 
> Cc: Julien Grall 
> Signed-off-by: Jiahui Cen 
> Signed-off-by: Yubo Miao 
> Reviewed-by: Laszlo Ersek 
> ---
>  OvmfPkg/OvmfPkg.dec |  4 +
>  OvmfPkg/AmdSev/AmdSevX64.dsc|  1 +
>  OvmfPkg/Bhyve/BhyveX64.dsc  |  1 +
>  OvmfPkg/OvmfPkgIa32.dsc |  1 +
>  OvmfPkg/OvmfPkgIa32X64.dsc  |  1 +
>  OvmfPkg/OvmfPkgX64.dsc  |  1 +
>  OvmfPkg/OvmfXen.dsc |  1 +
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf   |  1 +
>  OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf | 37 
> ++
>  OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h   | 38 
> ++
>  OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 41 
> +-
>  OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.c   | 78 
> 
>  12 files changed, 166 insertions(+), 39 deletions(-)

Thanks for updating the patch, it looks OK.
Laszlo

> diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec
> index 54804962ec02..4348bb45c64a 100644
> --- a/OvmfPkg/OvmfPkg.dec
> +++ b/OvmfPkg/OvmfPkg.dec
> @@ -49,6 +49,10 @@ [LibraryClasses]
>#  access.
>PciCapPciSegmentLib|Include/Library/PciCapPciSegmentLib.h
>  
> +  ##  @libraryclass  Provide common utility functions to PciHostBridgeLib
> +  #  instances in ArmVirtPkg and OvmfPkg.
> +  PciHostBridgeUtilityLib|Include/Library/PciHostBridgeUtilityLib.h
> +
>##  @libraryclass  Register a status code handler for printing the Boot
>#  Manager's LoadImage() and StartImage() preparations, and
>#  return codes, to the UEFI console.
> diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc
> index dad8635c3388..62e97dbe320a 100644
> --- a/OvmfPkg/AmdSev/AmdSevX64.dsc
> +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc
> @@ -669,6 +669,7 @@ [Components]
>MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
>  
>PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> +  
> PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
>NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf
>}
>MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
> diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
> index 33edf3d2d6b5..9547523018e9 100644
> --- a/OvmfPkg/Bhyve/BhyveX64.dsc
> +++ b/OvmfPkg/Bhyve/BhyveX64.dsc
> @@ -662,6 +662,7 @@ [Components]
>MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
>  
>PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> +  
> PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
>NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf
>}
>MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc
> index 75c5f46a7786..3555bd1691f2 100644
> --- a/OvmfPkg/OvmfPkgIa32.dsc
> +++ b/OvmfPkg/OvmfPkgIa32.dsc
> @@ -747,6 +747,7 @@ [Components]
>MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
>  
>PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> +  
> PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
>NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf
>}
>MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc
> index 8693248b4ea0..d668c5c8eda8 100644
> --- a/OvmfPkg/OvmfPkgIa32X64.dsc
> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc
> @@ -761,6 +761,7 @@ [Components.X64]
>MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf {
>  
>PciHostBridgeLib|OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf
> +  
> PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
>NULL|OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf
>}
>MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf {
> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
> index 70ff2bcf2342..ff32efb5ba8b 100644
> --- a/OvmfPkg/OvmfPkgX64.dsc
> +++ 

Re: [edk2-devel] [PATCH] NetworkPkg/Library/DxeHttpIoLib: Http boot failure with no initializes timeout value.

2021-01-20 Thread Siyuan, Fu
This seems good with me. 

Reviewed-by: Siyuan Fu 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Yeh, GregX
> Sent: 2021年1月15日 14:23
> To: devel@edk2.groups.io
> Cc: Maciej Rabeda ; Wu, Jiaxin
> ; Fu, Siyuan 
> Subject: [edk2-devel] [PATCH] NetworkPkg/Library/DxeHttpIoLib: Http boot
> failure with no initializes timeout value.
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=3170
> Using PcdHttpIoTimeout to set default timeout value to HttpIoLib.
> 
> Cc: Maciej Rabeda 
> Cc: Jiaxin Wu 
> Cc: Siyuan Fu 
> Signed-off-by: GregX Yeh 
> ---
>  NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c   | 1 +
>  NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf | 1 +
>  NetworkPkg/NetworkPkg.dec| 6 +-
>  3 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c
> b/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c
> index 67583fb220..04b01adec5 100644
> --- a/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c
> +++ b/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.c
> @@ -189,6 +189,7 @@ HttpIoCreateIo (
>HttpIo->Http= Http;
>HttpIo->Callback= Callback;
>HttpIo->Context = Context;
> +  HttpIo->Timeout = PcdGet32 (PcdHttpIoTimeout);
> 
>if (ConfigData != NULL) {
>  if (HttpIo->IpVersion == IP_VERSION_4) {
> diff --git a/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf
> b/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf
> index 25f5eb2ec6..347f8d5508 100644
> --- a/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf
> +++ b/NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf
> @@ -43,3 +43,4 @@
> 
>  [Pcd]
>gEfiNetworkPkgTokenSpaceGuid.PcdMaxHttpChunkTransfer  ##
> SOMETIMES_CONSUMES
> +  gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout ##
> SOMETIMES_CONSUMES
> diff --git a/NetworkPkg/NetworkPkg.dec b/NetworkPkg/NetworkPkg.dec
> index 2d0d7fd2dc..87725674e9 100644
> --- a/NetworkPkg/NetworkPkg.dec
> +++ b/NetworkPkg/NetworkPkg.dec
> @@ -3,7 +3,7 @@
>  #
>  # This package provides network modules that conform to UEFI 2.4
> specification.
>  #
> -# Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
> +# Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.
>  # (C) Copyright 2015-2020 Hewlett Packard Enterprise Development LP
>  #
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
> @@ -96,6 +96,10 @@
>## The maximum size of total HTTP chunk transfer.
># @Prompt Max size of total HTTP chunk transfer. the default value is 12MB.
> 
> gEfiNetworkPkgTokenSpaceGuid.PcdMaxHttpChunkTransfer|0x0C0|UINT3
> 2|0x000E
> +
> +  ## The Timeout value of HTTP IO.
> +  # @Prompt The Timeout value of HTTP Io. Default value is 5000.
> +
> gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout|5000|UINT32|0x000F
> 
>  [PcdsFixedAtBuild, PcdsPatchableInModule]
>## Indicates whether HTTP connections (i.e., unsecured) are permitted or 
> not.
> --
> 2.16.2.windows.1
> 
> 
> 
> 
> 



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




Re: [edk2-devel] [PATCH v2 0/4] UefiCpuPkg, OvmfPkg: do not allocate useless register tables for S3 resume

2021-01-20 Thread Zeng, Star
Series Reviewed-by: Star Zeng 

> -Original Message-
> From: Laszlo Ersek 
> Sent: Tuesday, January 19, 2021 11:55 PM
> To: edk2-devel-groups-io 
> Cc: Ard Biesheuvel ; Dong, Eric
> ; Justen, Jordan L ;
> Philippe Mathieu-Daudé ; Kumar, Rahul1
> ; Ni, Ray ; Zeng, Star
> 
> Subject: [PATCH v2 0/4] UefiCpuPkg, OvmfPkg: do not allocate useless
> register tables for S3 resume
> 
> Ref:https://bugzilla.tianocore.org/show_bug.cgi?id=3159
> Repo:   https://pagure.io/lersek/edk2.git
> Branch: remove-cpu-reg-table-alloc-3159-v2
> 
> Updates in v2:
> 
> - v1 patches have not received any updates, I've only picked up the
>   feedback tags.
> 
> - Patch v2 #1 -- for RegisterCpuFeaturesLib -- is new; authored by Ray
>   and updated slightly by myself. Star and/or Eric should please approve
>   this patch.
> 
> v1 was posted at:
> 
>   [edk2-devel] [PATCH 0/3] UefiCpuPkg, OvmfPkg: do not allocate useless
>   register tables for S3 resume
> 
>   Message-Id: <20210112191934.12459-1-ler...@redhat.com>
>   https://edk2.groups.io/g/devel/message/70167
>   https://www.redhat.com/archives/edk2-devel-archive/2021-
> January/msg00652.html
> 
> Cc: Ard Biesheuvel 
> Cc: Eric Dong 
> Cc: Jordan Justen 
> Cc: Philippe Mathieu-Daudé 
> Cc: Rahul Kumar 
> Cc: Ray Ni 
> Cc: Star Zeng 
> 
> Thanks
> Laszlo
> 
> Laszlo Ersek (3):
>   UefiCpuPkg/AcpiCpuData: update comments on register table fields
>   UefiCpuPkg/CpuS3DataDxe: do not allocate useless register tables
>   OvmfPkg/CpuS3DataDxe: do not allocate useless register tables
> 
> Ray Ni (1):
>   UefiCpuPkg/CpuFeature: Don't assume CpuS3DataDxe alloc RegisterTable
> 
>  OvmfPkg/CpuS3DataDxe/CpuS3Data.c   | 70 
> +---
> -
>  OvmfPkg/CpuS3DataDxe/CpuS3DataDxe.inf  |  1 -
>  UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c| 32 
> 
>  UefiCpuPkg/Include/AcpiCpuData.h   |  4 +
>  UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 80
> +++-
>  5 files changed, 48 insertions(+), 139 deletions(-)
> 
> 
> base-commit: 83facfd184021874f95a6a34b2e47e0ebb34a762
> --
> 2.19.1.3.g30247aa5d201



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




Re: [edk2-devel] [PATCH v1 2/2] UefiCpuPkg/CpuCacheInfoLib: Update reference to the macro definitions.

2021-01-20 Thread Ni, Ray
Yun,
You should NOT split the patch because only applying patch #1 will break the 
build.
You can combine them with one patch.

Thanks,
Ray

> -Original Message-
> From: Lou, Yun 
> Sent: Wednesday, January 20, 2021 3:44 PM
> To: devel@edk2.groups.io
> Cc: Lou, Yun ; Ni, Ray ; Dong, Eric
> ; Laszlo Ersek ; Kumar, Rahul1
> 
> Subject: [PATCH v1 2/2] UefiCpuPkg/CpuCacheInfoLib: Update reference to the
> macro definitions.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3105
> 
> Update reference to some macro definitions about
> CPUID_HYBRID_INFORMATION Leaf(1Ah).
> 
> Signed-off-by: Jason Lou 
> Cc: Ray Ni 
> Cc: Eric Dong 
> Cc: Laszlo Ersek 
> Cc: Rahul Kumar 
> ---
>  UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
> b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
> index 6b87be261acf..d1f9830c91e7 100644
> --- a/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
> +++ b/UefiCpuPkg/Library/CpuCacheInfoLib/CpuCacheInfoLib.c
> @@ -175,7 +175,7 @@ CpuCacheInfoCollectCoreAndCacheData (
>//
> 
>Context->ProcessorInfo[ProcessorIndex].CoreType = 0;
> 
>if (CpuidMaxInput >= CPUID_HYBRID_INFORMATION) {
> 
> -AsmCpuidEx (CPUID_HYBRID_INFORMATION,
> CPUID_HYBRID_INFORMATION_SUB_LEAF,
> , NULL, NULL, NULL);
> 
> +AsmCpuidEx (CPUID_HYBRID_INFORMATION,
> CPUID_HYBRID_INFORMATION_MAIN_LEAF,
> , NULL, NULL, NULL);
> 
>  Context->ProcessorInfo[ProcessorIndex].CoreType = (UINT8)
> NativeModelIdAndCoreTypeEax.Bits.CoreType;
> 
>}
> 
> 
> 
> --
> 2.28.0.windows.1



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