Date   

Re: [staging/LoongArch RESEND PATCH v1 00/33] Add a new architecture called LoongArch in EDK II

Abner Chang
 

Hi Li,
I found there is no 9/33 of the RESEND patch. Is that I miss it?
Regards,
Abner

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chao Li
Sent: Wednesday, February 9, 2022 2:51 PM
To: devel@edk2.groups.io
Cc: Ray Ni <ray.ni@...>; Liming Gao <gaoliming@...>;
Michael D Kinney <michael.d.kinney@...>; Guomin Jiang
<guomin.jiang@...>; Wei6 Xu <wei6.xu@...>; Maciej Rabeda
<maciej.rabeda@...>; Jiaxin Wu <jiaxin.wu@...>; Siyuan
Fu <siyuan.fu@...>; Jiewen Yao <jiewen.yao@...>; Jian J Wang
<jian.j.wang@...>; Xiaoyu Lu <xiaoyu1.lu@...>; Zhiguang Liu
<zhiguang.liu@...>; Zhichao Gao <zhichao.gao@...>; Bob Feng
<bob.c.feng@...>; Yuwei Chen <yuwei.chen@...>
Subject: [edk2-devel] [staging/LoongArch RESEND PATCH v1 00/33] Add a
new architecture called LoongArch in EDK II

This new Arch should go through the EDK II Code First Process and then
the USWG can review our ECR. This commit contains 34 patchs, patch 0 is
the cover, patch 33 is Readme modification, and the others are the new
Arch support.

Modified modules: FatPkg, FmpDevicePkg, NetworkPkg,
NetworkPkg/HttpBootDxe, CryptoPkg, MdePkg/Include, SecurityPkg,
ShellPkg, UnitTestFrameworkPkg, MdePkg/DxeServicesLib, MdeModulePkg,
.python/SpellCheck, BaseTools, .azurepipelines, .pytool, MdePkg,
MdeModulePkg.

Cc: Ray Ni <ray.ni@...>
Cc: Liming Gao <gaoliming@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Guomin Jiang <guomin.jiang@...>
Cc: Wei6 Xu <wei6.xu@...>
Cc: Maciej Rabeda <maciej.rabeda@...>
Cc: Jiaxin Wu <jiaxin.wu@...>
Cc: Siyuan Fu <siyuan.fu@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Jian J Wang <jian.j.wang@...>
Cc: Xiaoyu Lu <xiaoyu1.lu@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Zhichao Gao <zhichao.gao@...>
Cc: Bob Feng <bob.c.feng@...>
Cc: Yuwei Chen <yuwei.chen@...>

Chao Li (33):
FatPkg: Add LOONGARCH64 architecture for EDK2 CI.
FmpDevicePkg: Add LOONGARCH64 architecture for EDK2 CI.
NetworkPkg: Add LOONGARCH64 architecture for EDK2 CI.
NetworkPkg/HttpBootDxe: Add LOONGARCH64 architecture for EDK2 CI.
CryptoPkg: Add LOONGARCH64 architecture for EDK2 CI.
MdePkg/Include: Add LOONGARCH related definitions EDK2 CI.
SecurityPkg: Add LOONGARCH64 architecture for EDK2 CI.
ShellPkg: Add LOONGARCH64 architecture for EDK2 CI.
UnitTestFrameworkPkg: Add LOONGARCH64 architecture for EDK2 CI.
MdePkg/DxeServicesLib: Add LOONGARCH64 architecture
MdeModulePkg: Use LockBoxNullLib for LOONGARCH64
.python/SpellCheck: Add "Loongson" and "LOONGARCH" to "words" section
BaseTools: BaseTools changes for LoongArch platform.
BaseTools: BaseTools changes for LoongArch platform.
BaseTools: BaseTools changes for LoongArch platform.
BaseTools: Enable LoongArch64 architecture for LoongArch64 EDK2 CI.
.azurepipelines: Add LoongArch64 architecture on LoongArch64 EDK2 CI.
.pytool: Add LoongArch64 architecture on LoongArch64 EDK2 CI.
MdePkg: Add LoongArch LOONGARCH64 binding
MdePkg/Include: LoongArch definitions.
MdePkg/BaseLib: BaseLib for LOONGARCH64 architecture.
MdePkg/BaseCacheMaintenanceLib: LoongArch cache maintenance
implementation.
MdePkg/BaseIoLibIntrinsic: IoLibNoIo for LoongArch architecture.
MdePkg/BasePeCoff: Add LoongArch PE/Coff related code.
MdePkg/BaseCpuLib: LoongArch Base CPU library implementation.
MdePkg/BaseSynchronizationLib: LoongArch cache related code.
MdePkg/BaseSafeIntLib: Add LoongArch64 architecture for
BaseSafeIntLib.
MdeModulePkg/Logo: Add LoongArch64 architecture.
MdeModulePkg/CapsuleRuntimeDxe: Add LoongArch64 architecture.
MdeModulePkg/DxeIplPeim : LoongArch DxeIPL implementation.
NetworkPkg: Add LoongArch64 architecture.
BaseTools: Add LoongArch64 binding.
Readme: Update the readme

.azurepipelines/Ubuntu-GCC5.yml | 3 +-
.pytool/CISettings.py | 5 +-
.pytool/Plugin/SpellCheck/cspell.base.yaml | 4 +-
...gcc_loongarch64_unknown_linux_ext_dep.yaml | 22 ++
BaseTools/Conf/tools_def.template | 43 ++-
.../LinuxGcc5ToolChain/LinuxGcc5ToolChain.py | 31 +++
BaseTools/Source/C/Common/BasePeCoff.c | 15 +-
BaseTools/Source/C/Common/PeCoffLoaderEx.c | 76 ++++++
BaseTools/Source/C/GNUmakefile | 3 +
BaseTools/Source/C/GenFv/GenFvInternalLib.c | 128 ++++++++-
BaseTools/Source/C/GenFw/Elf64Convert.c | 153 ++++++++++-
BaseTools/Source/C/GenFw/elf_common.h | 58 ++++
.../C/Include/IndustryStandard/PeImage.h | 57 ++--
.../C/Include/LoongArch64/ProcessorBind.h | 80 ++++++
BaseTools/Source/Python/Common/DataType.py | 21 +-
.../Source/Python/UPT/Library/DataType.py | 24 +-
BaseTools/Source/Python/build/buildoptions.py | 3 +-
CryptoPkg/CryptoPkg.dsc | 3 +-
.../Library/BaseCryptLib/BaseCryptLib.inf | 6 +-
.../Library/BaseCryptLib/RuntimeCryptLib.inf | 4 +
.../BaseCryptLibNull/BaseCryptLibNull.inf | 3 +-
.../BaseCryptLibOnProtocolPpi/DxeCryptLib.inf | 3 +-
.../BaseCryptLibOnProtocolPpi/PeiCryptLib.inf | 3 +-
CryptoPkg/Library/Include/CrtLibSupport.h | 3 +-
CryptoPkg/Library/OpensslLib/OpensslLib.inf | 2 +
.../Library/OpensslLib/OpensslLibCrypto.inf | 2 +
CryptoPkg/Library/TlsLib/TlsLib.inf | 3 +-
CryptoPkg/Library/TlsLibNull/TlsLibNull.inf | 3 +-
FatPkg/FatPkg.dsc | 3 +-
FmpDevicePkg/FmpDevicePkg.dsc | 3 +-
MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf | 6 +-
.../Core/DxeIplPeim/LoongArch64/DxeLoadFunc.c | 61 +++++
MdeModulePkg/Logo/Logo.inf | 3 +-
MdeModulePkg/MdeModulePkg.dsc | 4 +-
.../CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf | 9 +-
MdePkg/Include/IndustryStandard/Dhcp.h | 41 +--
MdePkg/Include/IndustryStandard/PeImage.h | 9 +
MdePkg/Include/Library/BaseLib.h | 24 ++
MdePkg/Include/LoongArch64/ProcessorBind.h | 121 +++++++++
MdePkg/Include/Protocol/DebugSupport.h | 65 ++++-
MdePkg/Include/Protocol/PxeBaseCode.h | 3 +
MdePkg/Include/Uefi/UefiBaseType.h | 14 +
MdePkg/Include/Uefi/UefiSpec.h | 16 +-
.../BaseCacheMaintenanceLib.inf | 4 +
.../BaseCacheMaintenanceLib/LoongArchCache.c | 253
++++++++++++++++++
MdePkg/Library/BaseCpuLib/BaseCpuLib.inf | 7 +-
MdePkg/Library/BaseCpuLib/BaseCpuLib.uni | 5 +-
.../BaseCpuLib/LoongArch/CpuFlushTlb.S | 15 ++
.../Library/BaseCpuLib/LoongArch/CpuSleep.S | 15 ++
.../BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf | 10 +-
MdePkg/Library/BaseIoLibIntrinsic/IoLibNoIo.c | 3 +-
MdePkg/Library/BaseLib/BaseLib.inf | 13 +
.../BaseLib/LoongArch64/CpuBreakpoint.S | 24 ++
MdePkg/Library/BaseLib/LoongArch64/CpuPause.S | 31 +++
.../BaseLib/LoongArch64/DisableInterrupts.S | 21 ++
.../BaseLib/LoongArch64/EnableInterrupts.S | 21 ++
.../BaseLib/LoongArch64/GetInterruptState.S | 35 +++
.../BaseLib/LoongArch64/InternalSwitchStack.c | 58 ++++
.../Library/BaseLib/LoongArch64/MemoryFence.S | 19 ++
.../BaseLib/LoongArch64/SetJumpLongJump.S | 49 ++++
.../Library/BaseLib/LoongArch64/SwitchStack.S | 39 +++
.../Library/BaseLib/LoongArch64/Unaligned.c | 244 +++++++++++++++++
MdePkg/Library/BasePeCoffLib/BasePeCoff.c | 3 +-
.../Library/BasePeCoffLib/BasePeCoffLib.inf | 5 +
.../Library/BasePeCoffLib/BasePeCoffLib.uni | 2 +
.../BasePeCoffLib/LoongArch/PeCoffLoaderEx.c | 132 +++++++++
.../Library/BaseSafeIntLib/BaseSafeIntLib.inf | 9 +-
.../BaseSynchronizationLib.inf | 5 +
.../LoongArch64/Synchronization.c | 239 +++++++++++++++++
.../Library/DxeServicesLib/DxeServicesLib.inf | 4 +-
MdePkg/MdePkg.dec | 4 +
MdePkg/MdePkg.dsc | 3 +-
NetworkPkg/HttpBootDxe/HttpBootDhcp4.h | 3 +
NetworkPkg/Network.dsc.inc | 3 +-
NetworkPkg/NetworkPkg.dsc | 3 +-
ReadMe.md | 17 ++
SecurityPkg/SecurityPkg.dsc | 3 +-
ShellPkg/ShellPkg.dsc | 3 +-
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc | 3 +-
79 files changed, 2340 insertions(+), 110 deletions(-)
create mode 100644
BaseTools/Bin/gcc_loongarch64_unknown_linux_ext_dep.yaml
create mode 100644
BaseTools/Source/C/Include/LoongArch64/ProcessorBind.h
create mode 100644
MdeModulePkg/Core/DxeIplPeim/LoongArch64/DxeLoadFunc.c
create mode 100644 MdePkg/Include/LoongArch64/ProcessorBind.h
create mode 100644
MdePkg/Library/BaseCacheMaintenanceLib/LoongArchCache.c
create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/CpuFlushTlb.S
create mode 100644 MdePkg/Library/BaseCpuLib/LoongArch/CpuSleep.S
create mode 100644
MdePkg/Library/BaseLib/LoongArch64/CpuBreakpoint.S
create mode 100644 MdePkg/Library/BaseLib/LoongArch64/CpuPause.S
create mode 100644
MdePkg/Library/BaseLib/LoongArch64/DisableInterrupts.S
create mode 100644
MdePkg/Library/BaseLib/LoongArch64/EnableInterrupts.S
create mode 100644
MdePkg/Library/BaseLib/LoongArch64/GetInterruptState.S
create mode 100644
MdePkg/Library/BaseLib/LoongArch64/InternalSwitchStack.c
create mode 100644
MdePkg/Library/BaseLib/LoongArch64/MemoryFence.S
create mode 100644
MdePkg/Library/BaseLib/LoongArch64/SetJumpLongJump.S
create mode 100644 MdePkg/Library/BaseLib/LoongArch64/SwitchStack.S
create mode 100644 MdePkg/Library/BaseLib/LoongArch64/Unaligned.c
create mode 100644
MdePkg/Library/BasePeCoffLib/LoongArch/PeCoffLoaderEx.c
create mode 100644
MdePkg/Library/BaseSynchronizationLib/LoongArch64/Synchronization.c
create mode 100644 ReadMe.md

--
2.27.0





Re: [staging/LoongArch RESEND PATCH v1 04/33] NetworkPkg/HttpBootDxe: Add LOONGARCH64 architecture for EDK2 CI.

Abner Chang
 

Acked-by: Abner Chang <abner.chang@...>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chao Li
Sent: Wednesday, February 9, 2022 2:52 PM
To: devel@edk2.groups.io
Cc: Maciej Rabeda <maciej.rabeda@...>; Jiaxin Wu
<jiaxin.wu@...>; Siyuan Fu <siyuan.fu@...>
Subject: [edk2-devel] [staging/LoongArch RESEND PATCH v1 04/33]
NetworkPkg/HttpBootDxe: Add LOONGARCH64 architecture for EDK2 CI.

Add LOONGARCH architecture for EDK2 CI testing.

Cc: Maciej Rabeda <maciej.rabeda@...>
Cc: Jiaxin Wu <jiaxin.wu@...>
Cc: Siyuan Fu <siyuan.fu@...>

Signed-off-by: Chao Li <lichao@...>
---
NetworkPkg/HttpBootDxe/HttpBootDhcp4.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h
b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h
index d76f0e84d6..f00fabead2 100644
--- a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h
+++ b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.h
@@ -3,6 +3,7 @@

Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights
reserved.<BR>
+Copyright (c) 2022, Loongson Technology Corporation Limited. All rights
reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
@@ -40,6 +41,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE
HTTP_CLIENT_ARCH_RISCV64
#elif defined (MDE_CPU_EBC)
#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE
HTTP_CLIENT_ARCH_EBC
+#elif defined (MDE_CPU_LOONGARCH64)
+#define EFI_HTTP_BOOT_CLIENT_SYSTEM_ARCHITECTURE
HTTP_CLIENT_ARCH_LOONGARCH64
#endif

/// DHCP offer types among HTTP boot.
--
2.27.0





Re: [staging/LoongArch RESEND PATCH v1 03/33] NetworkPkg: Add LOONGARCH64 architecture for EDK2 CI.

Abner Chang
 

Acked-by: Abner Chang <abner.chang@...>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chao Li
Sent: Wednesday, February 9, 2022 2:52 PM
To: devel@edk2.groups.io
Cc: Maciej Rabeda <maciej.rabeda@...>; Jiaxin Wu
<jiaxin.wu@...>; Siyuan Fu <siyuan.fu@...>
Subject: [edk2-devel] [staging/LoongArch RESEND PATCH v1 03/33]
NetworkPkg: Add LOONGARCH64 architecture for EDK2 CI.

Add LOONGARCH64 architecture for EDK2 CI testing.

Cc: Maciej Rabeda <maciej.rabeda@...>
Cc: Jiaxin Wu <jiaxin.wu@...>
Cc: Siyuan Fu <siyuan.fu@...>

Signed-off-by: Chao Li <lichao@...>
---
NetworkPkg/NetworkPkg.dsc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/NetworkPkg/NetworkPkg.dsc b/NetworkPkg/NetworkPkg.dsc
index 762134023d..6c231c97b5 100644
--- a/NetworkPkg/NetworkPkg.dsc
+++ b/NetworkPkg/NetworkPkg.dsc
@@ -4,6 +4,7 @@
# (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
# Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights
reserved.<BR>
+# Copyright (c) 2022, Loongson Technology Corporation Limited. All rights
reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
@@ -14,7 +15,7 @@
PLATFORM_VERSION = 0.98
DSC_SPECIFICATION = 0x00010005
OUTPUT_DIRECTORY = Build/NetworkPkg
- SUPPORTED_ARCHITECTURES =
IA32|X64|EBC|ARM|AARCH64|RISCV64
+ SUPPORTED_ARCHITECTURES =
IA32|X64|EBC|ARM|AARCH64|RISCV64|LOONGARCH64
BUILD_TARGETS = DEBUG|RELEASE|NOOPT
SKUID_IDENTIFIER = DEFAULT

--
2.27.0





Re: [PATCH] UefiPayloadPkg: Fix bug that Elf loader doesn't relocate in some case

Zhiguang Liu
 

Sorry, it is a typo. the example should be
The first segment is located at 0x1000, and the desired address is 0x2000.
The second segment is located at 0x2000, and the desired address is 0x1000.
The current ELF loader may copy first segment to 0x2000, which will erase the second segment.

Thanks
Zhiguang

-----Original Message-----
From: Ni, Ray <ray.ni@...>
Sent: Thursday, April 7, 2022 8:06 AM
To: Liu, Zhiguang <zhiguang.liu@...>; devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@...>; Ma, Maurice <maurice.ma@...>;
You, Benjamin <benjamin.you@...>; Rhodes, Sean
<sean@...>
Subject: RE: [PATCH] UefiPayloadPkg: Fix bug that Elf loader doesn't relocate in
some case



-----Original Message-----
From: Liu, Zhiguang <zhiguang.liu@...>
Sent: Wednesday, April 6, 2022 9:52 PM
To: devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@...>; Ni, Ray <ray.ni@...>; Ma,
Maurice <maurice.ma@...>; You, Benjamin
<benjamin.you@...>; Rhodes, Sean <sean@...>
Subject: [PATCH] UefiPayloadPkg: Fix bug that Elf loader doesn't
relocate in some case

Current implementation of the Elf loader reuses the same memory range
if the desired memory range is covered by [file base, file base + file size].
However, there is a potentil bug, for example:
If the first segment is located at 0x1000, and the desired address is
0x2000. While the second segment is located at 0x2000, and the desired
address is 0x2000. When we parse and try to load the elf file, current
Why the desired address for both segments is 0x2000?


Re: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures

Nate DeSimone
 

-----Original Message-----
From: mikuback@... <mikuback@...>
Sent: Tuesday, March 22, 2022 6:11 PM
To: devel@edk2.groups.io
Cc: Bret Barkelew <bret@...>; Chiu, Chasel <chasel.chiu@...>; Desimone, Nathaniel L <nathaniel.l.desimone@...>; Gao, Liming <gaoliming@...>; Dong, Eric <eric.dong@...>
Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures

From: Michael Kubacki <michael.kubacki@...>

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

Printing corruption can occur if the DumpHsti helper function encounters a structure from the IHV (i.e. one that contains the 'Required' field).

Co-authored-by: Bret Barkelew <bret@...>
Cc: Chasel Chiu <chasel.chiu@...>
Cc: Nate DeSimone <nathaniel.l.desimone@...>
Cc: Liming Gao <gaoliming@...>
Cc: Eric Dong <eric.dong@...>
Signed-off-by: Michael Kubacki <michael.kubacki@...>
---
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckHsti.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckHsti.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckHsti.c
index 7756369ae17b..f2f3fa83a57c 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckHsti.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh
+++ eckHsti.c
@@ -40,6 +40,16 @@ DumpHsti (
DEBUG ((DEBUG_INFO, " SecurityFeaturesSize - 0x%08x\n", Hsti->SecurityFeaturesSize));

SecurityFeatures = (UINT8 *) (Hsti + 1);
+
+ if (Hsti->Role == PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE) {
+ DEBUG ((DEBUG_INFO, " SecurityFeaturesRequired - "));
+ for (Index = 0; Index < Hsti->SecurityFeaturesSize; Index++) {
+ DEBUG ((DEBUG_INFO, "%02x ", SecurityFeatures[Index]));
+ }
+ DEBUG ((DEBUG_INFO, "\n"));
+ SecurityFeatures = (UINT8 *) (SecurityFeatures +
+ Hsti->SecurityFeaturesSize); }
+
DEBUG ((DEBUG_INFO, " SecurityFeaturesImplemented - "));
for (Index = 0; Index < Hsti->SecurityFeaturesSize; Index++) {
DEBUG ((DEBUG_INFO, "%02x ", SecurityFeatures[Index])); @@ -81,7 +91,7 @@ TestPointCheckHsti (
EFI_STATUS Status;
UINTN Index;
BOOLEAN Result;
-
+
Result = TRUE;
DEBUG ((DEBUG_INFO, "==== TestPointCheckHsti - Enter\n"));
for (Index = 0; Index < sizeof(mRole)/sizeof(mRole[0]); Index++) {
--
2.28.0.windows.1


Re: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg: Add missing libraries to [Components] in DSC

Nate DeSimone
 

-----Original Message-----
From: mikuback@... <mikuback@...>
Sent: Tuesday, March 22, 2022 6:28 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@...>; Desimone, Nathaniel L <nathaniel.l.desimone@...>; Gao, Liming <gaoliming@...>; Dong, Eric <eric.dong@...>
Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg: Add missing libraries to [Components] in DSC

From: Michael Kubacki <michael.kubacki@...>

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

Adds libraries implemented in MinPlatformPkg to the [Components] section in MinPlatformPkg.dsc so they are included in the package build.

Cc: Chasel Chiu <chasel.chiu@...>
Cc: Nate DeSimone <nathaniel.l.desimone@...>
Cc: Liming Gao <gaoliming@...>
Cc: Eric Dong <eric.dong@...>
Signed-off-by: Michael Kubacki <michael.kubacki@...>
---
Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 0f47182c2647..a8373a4ecb37 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -211,6 +211,13 @@ [Components]
MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVariableReadLibNull.inf
MinPlatformPkg/Library/SmmVariableReadLib/StandaloneMmVariableReadLib.inf
MinPlatformPkg/Library/SmmVariableWriteLib/StandaloneMmVariableWriteLib.inf
+ MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.inf
+
+ MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRuntimeVariableRea
+ dLib.inf
+ MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRuntimeVariableWr
+ iteLib.inf
+ MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMmVariableReadLib
+ .inf
+ MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalMmVariableWriteL
+ ib.inf
+ MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableReadLib.i
+ nf
+ MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableWriteLib.
+ inf

[BuildOptions]
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
--
2.28.0.windows.1


Re: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures

Nate DeSimone
 

Reviewed-by: Nate DeSimone <nathaniel.l.desimone@...>

-----Original Message-----
From: mikuback@... <mikuback@...>
Sent: Tuesday, March 22, 2022 6:11 PM
To: devel@edk2.groups.io
Cc: Bret Barkelew <bret@...>; Chiu, Chasel <chasel.chiu@...>; Desimone, Nathaniel L <nathaniel.l.desimone@...>; Gao, Liming <gaoliming@...>; Dong, Eric <eric.dong@...>
Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg/TestPointCheckLib: Fix mis-parsed HSTI structures

From: Michael Kubacki <michael.kubacki@...>

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

Printing corruption can occur if the DumpHsti helper function encounters a structure from the IHV (i.e. one that contains the 'Required' field).

Co-authored-by: Bret Barkelew <bret@...>
Cc: Chasel Chiu <chasel.chiu@...>
Cc: Nate DeSimone <nathaniel.l.desimone@...>
Cc: Liming Gao <gaoliming@...>
Cc: Eric Dong <eric.dong@...>
Signed-off-by: Michael Kubacki <michael.kubacki@...>
---
Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckHsti.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckHsti.c b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckHsti.c
index 7756369ae17b..f2f3fa83a57c 100644
--- a/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCheckHsti.c
+++ b/Platform/Intel/MinPlatformPkg/Test/Library/TestPointCheckLib/DxeCh
+++ eckHsti.c
@@ -40,6 +40,16 @@ DumpHsti (
DEBUG ((DEBUG_INFO, " SecurityFeaturesSize - 0x%08x\n", Hsti->SecurityFeaturesSize));

SecurityFeatures = (UINT8 *) (Hsti + 1);
+
+ if (Hsti->Role == PLATFORM_SECURITY_ROLE_PLATFORM_REFERENCE) {
+ DEBUG ((DEBUG_INFO, " SecurityFeaturesRequired - "));
+ for (Index = 0; Index < Hsti->SecurityFeaturesSize; Index++) {
+ DEBUG ((DEBUG_INFO, "%02x ", SecurityFeatures[Index]));
+ }
+ DEBUG ((DEBUG_INFO, "\n"));
+ SecurityFeatures = (UINT8 *) (SecurityFeatures +
+ Hsti->SecurityFeaturesSize); }
+
DEBUG ((DEBUG_INFO, " SecurityFeaturesImplemented - "));
for (Index = 0; Index < Hsti->SecurityFeaturesSize; Index++) {
DEBUG ((DEBUG_INFO, "%02x ", SecurityFeatures[Index])); @@ -81,7 +91,7 @@ TestPointCheckHsti (
EFI_STATUS Status;
UINTN Index;
BOOLEAN Result;
-
+
Result = TRUE;
DEBUG ((DEBUG_INFO, "==== TestPointCheckHsti - Enter\n"));
for (Index = 0; Index < sizeof(mRole)/sizeof(mRole[0]); Index++) {
--
2.28.0.windows.1


Re: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg: Add missing libraries to [Components] in DSC

Nate DeSimone
 

Reviewed-by: Nate DeSimone <nathaniel.l.desimone@...>

-----Original Message-----
From: mikuback@... <mikuback@...>
Sent: Tuesday, March 22, 2022 6:28 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel <chasel.chiu@...>; Desimone, Nathaniel L <nathaniel.l.desimone@...>; Gao, Liming <gaoliming@...>; Dong, Eric <eric.dong@...>
Subject: [edk2-platforms][PATCH v1 1/1] MinPlatformPkg: Add missing libraries to [Components] in DSC

From: Michael Kubacki <michael.kubacki@...>

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

Adds libraries implemented in MinPlatformPkg to the [Components] section in MinPlatformPkg.dsc so they are included in the package build.

Cc: Chasel Chiu <chasel.chiu@...>
Cc: Nate DeSimone <nathaniel.l.desimone@...>
Cc: Liming Gao <gaoliming@...>
Cc: Eric Dong <eric.dong@...>
Signed-off-by: Michael Kubacki <michael.kubacki@...>
---
Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 0f47182c2647..a8373a4ecb37 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -211,6 +211,13 @@ [Components]
MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVariableReadLibNull.inf
MinPlatformPkg/Library/SmmVariableReadLib/StandaloneMmVariableReadLib.inf
MinPlatformPkg/Library/SmmVariableWriteLib/StandaloneMmVariableWriteLib.inf
+ MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableReadLib.inf
+
+ MinPlatformPkg/Library/DxeRuntimeVariableReadLib/DxeRuntimeVariableRea
+ dLib.inf
+ MinPlatformPkg/Library/DxeRuntimeVariableWriteLib/DxeRuntimeVariableWr
+ iteLib.inf
+ MinPlatformPkg/Library/SmmVariableReadLib/TraditionalMmVariableReadLib
+ .inf
+ MinPlatformPkg/Library/SmmVariableWriteLib/TraditionalMmVariableWriteL
+ ib.inf
+ MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableReadLib.i
+ nf
+ MinPlatformPkg/Library/BaseLargeVariableLib/BaseLargeVariableWriteLib.
+ inf

[BuildOptions]
*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
--
2.28.0.windows.1


Re: [PATCH v3 1/8] IntelFsp2Pkg: X64 compatible changes to support PEI in 64bit

Ni, Ray
 

-; UINT32
+; UINTN
; EFIAPI
-; AsmReadEsp (
+; AsmReadStackPointer (
; VOID
; );
;------------------------------------------------------------------------------
-global ASM_PFX(AsmReadEsp)
-ASM_PFX(AsmReadEsp):
+global ASM_PFX(AsmReadStackPointer)
+ASM_PFX(AsmReadStackPointer):
mov eax, esp
ret
I guess it's possible that bootloader sets up the stack above 4G.
If that's the case, above code doesn't work.

Is there an issue with the SecSwitchStack too?
I didn't read the whole patchūüėä.


Re: [PATCH] UefiPayloadPkg: Fix bug that Elf loader doesn't relocate in some case

Ni, Ray
 

-----Original Message-----
From: Liu, Zhiguang <zhiguang.liu@...>
Sent: Wednesday, April 6, 2022 9:52 PM
To: devel@edk2.groups.io
Cc: Dong, Guo <guo.dong@...>; Ni, Ray <ray.ni@...>; Ma, Maurice <maurice.ma@...>; You, Benjamin
<benjamin.you@...>; Rhodes, Sean <sean@...>
Subject: [PATCH] UefiPayloadPkg: Fix bug that Elf loader doesn't relocate in some case

Current implementation of the Elf loader reuses the same memory range if
the desired memory range is covered by [file base, file base + file size].
However, there is a potentil bug, for example:
If the first segment is located at 0x1000, and the desired address is
0x2000. While the second segment is located at 0x2000, and the desired
address is 0x2000. When we parse and try to load the elf file, current
Why the desired address for both segments is 0x2000?


Re: [PATCH v3 1/8] IntelFsp2Pkg: X64 compatible changes to support PEI in 64bit

Andrew Fish
 

On Apr 6, 2022, at 4:57 PM, Ni, Ray <ray.ni@...> wrote:

-; UINT32
+; UINTN
; EFIAPI
-; AsmReadEsp (
+; AsmReadStackPointer (
; VOID
; );
;------------------------------------------------------------------------------
-global ASM_PFX(AsmReadEsp)
-ASM_PFX(AsmReadEsp):
+global ASM_PFX(AsmReadStackPointer)
+ASM_PFX(AsmReadStackPointer):
mov eax, esp
ret
I guess it's possible that bootloader sets up the stack above 4G.
If that's the case, above code doesn't work.

Is there an issue with the SecSwitchStack too?

Thanks,

Andrew Fish





Re: [PATCH v3 1/8] IntelFsp2Pkg: X64 compatible changes to support PEI in 64bit

Ni, Ray
 

-; UINT32
+; UINTN
; EFIAPI
-; AsmReadEsp (
+; AsmReadStackPointer (
; VOID
; );
;------------------------------------------------------------------------------
-global ASM_PFX(AsmReadEsp)
-ASM_PFX(AsmReadEsp):
+global ASM_PFX(AsmReadStackPointer)
+ASM_PFX(AsmReadStackPointer):
mov eax, esp
ret
I guess it's possible that bootloader sets up the stack above 4G.
If that's the case, above code doesn't work.


Re: [PATCH v2 0/3] BaseTools: Add support for gdb and lldb

Rebecca Cran
 

Could I have some more reviews on this please? I'd like to get this into the tree soon.

--
Rebecca Cran

On 3/21/22 14:20, Rebecca Cran wrote:
This patch set adds debugging support for gdb and lldb.
It also adds generic debugging classes that use a file like object to
make it easy to import into any debugger that supports Python.

Changes from v1 to v2:
- Moved scripts from the root of the repo into BaseTools/Scripts.
- Fixed typo of "RISCV" as "RISKV".

Testing:
- Tested gdb on Ubuntu and lldb on macOS for IA32 and X64.
- Tested gdb on openSUSE for AARCH64.

Rebecca Cran (3):
BaseTools: efi_debugging.py: Add debugger agnostic dbg Python Classes
BaseTools: Scripts/efi_gdb.py: Add gdb EFI commands and pretty Print
BaseTools: Scripts/efi_lldb.py: Add lldb EFI commands and pretty Print

BaseTools/Scripts/efi_debugging.py | 2185 ++++++++++++++++++++
BaseTools/Scripts/efi_gdb.py | 918 ++++++++
BaseTools/Scripts/efi_lldb.py | 1044 ++++++++++
3 files changed, 4147 insertions(+)
create mode 100755 BaseTools/Scripts/efi_debugging.py
create mode 100755 BaseTools/Scripts/efi_gdb.py
create mode 100755 BaseTools/Scripts/efi_lldb.py


Re: Applying for GSoC 2022: Add Rust Support to EDK II

Pedro Falcato
 

Hi Ayush!

I had a decent look at your proposal, and I have some questions (note that you can always re-submit proposals until April 19th):

1) How are you planning to reconcile the cargo build system with EDK2's build system?

2) If you go ahead with cargo, will the new Rust code require a lot of tiny crates? I'm personally not very enthusiastic about having lots of dependencies all over the place,
especially somewhere Tianocore doesn't control. I've seen Rust crates that were integrated into an operating system (https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/third_party/rust_crates/),
where they essentially maintain their own versions of the crate, with the "proper" build system that the project uses.

3) How much of std are you going to implement? Note that traditionally, EDK2, like a lot of this firmware/kernel/bootloader code, doesn't actually implement much of the standard library (and that's the reasoning behind edk2-libc).

4) Do you have any idea of what DXE driver you're going to implement? Do you have any experience writing drivers?

5) Any plans for generation of C <-> Rust bindings? Does https://github.com/rust-lang/rust-bindgen work out of the box?

Best regards,
Pedro 

On Mon, Apr 4, 2022 at 6:18 PM Ayush Singh <ayushdevel1325@...> wrote:
Hello everyone, I am a 2nd-year University Student from India. I am
interested in applying for adding Rust support to EDK2. I have already
introduced myself to the mailing list earlier
(https://edk2.groups.io/g/devel/message/87637) and have even submitted
some patches for the edkii-rust branch in edk2-staging (which were not
merged since that branch seems to be abandoned now).
- https://edk2.groups.io/g/devel/message/87753
- https://edk2.groups.io/g/devel/message/87754
- https://edk2.groups.io/g/devel/message/87755
- https://edk2.groups.io/g/devel/message/87756

Anyway, since no mentor has been listed for this project, I was
wondering who should I discuss the proposal with? Normally, I think
one is supposed to discuss the proposal details with a mentor in form
of a google doc or something before submitting an application. So
should I directly start by submitting a proposal through the GSoC
application portal? Or is there someone I should contact first?

Ayush Singh







--
Pedro Falcato


Re: [edk2-platforms PATCH] Marvell/SolidRun: Rework Readme.md files

Marcin Wojtas
 

Hi,

pon., 14 mar 2022 o 18:17 Sunny Wang <Sunny.Wang@...> napisaŇā(a):

Looks good. Thanks much, Marcin.

This will be helpful as http://wiki.macchiatobin.net/tiki-index.php has been not accessible for quite a while.

Reviewed-by: Sunny Wang <sunny.wang@...>
Do you have any feedback about the patch?

Best regards,
Marcin

Best Regards,
Sunny
-----Original Message-----
From: Marcin Wojtas <mw@...>
Sent: 14 March 2022 12:06
To: devel@edk2.groups.io
Cc: quic_llindhol@...; ardb+tianocore@...; jaz@...; gjb@...; Sunny Wang <Sunny.Wang@...>; Marcin Wojtas <mw@...>
Subject: [edk2-platforms PATCH] Marvell/SolidRun: Rework Readme.md files

From: Grzegorz Bernacki <gjb@...>

This patch reworks Readme.md files of Marvell and SolidRun
platforms as follows:
* Add supported features list.
* Leave minmal EDK2 build command.
* Add 'NOTE' box about INCLUDE_TFTP_COMMAND build flag.
* Move full firmware image build/burn howtos to external wiki pages.
* Add links and update paragraphs.

Signed-off-by: Marcin Wojtas <mw@...>

---
In order to ease review/merge the patch is available in a public repository:
https://github.com/Semihalf/edk2-platforms/commits/marvell-howtos-upstream-r20220314

Platform/Marvell/Cn913xDb/Readme.md | 104 +++++++-----------
Platform/SolidRun/Armada80x0McBin/Readme.md | 113 ++++++++------------
Platform/SolidRun/Cn913xCEx7Eval/Readme.md | 109 ++++++++-----------
3 files changed, 124 insertions(+), 202 deletions(-)

diff --git a/Platform/Marvell/Cn913xDb/Readme.md b/Platform/Marvell/Cn913xDb/Readme.md
index ecdb78302b..0b2ab676f8 100644
--- a/Platform/Marvell/Cn913xDb/Readme.md
+++ b/Platform/Marvell/Cn913xDb/Readme.md
@@ -5,93 +5,65 @@


This is a port of 64-bit TianoCore EDK II firmware for the Marvell CN913x Development Board.



-# Building the firmware

-

-## Prepare toolchain (for cross-compilation only):

-

-1. Download the toolchain:

-

- ```

- wget https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz

- ```

+# Supported features



-1. After extracting, setup the path and compiler prefix to GCC5\_AARCH64\_PREFIX variable:

+Features supported in EDK2:



- ```

- export GCC5_AARCH64_PREFIX=<toolchain_path>/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

- ```

+* 1x PCIE root complex

+* Networking:

+ * 3x 10 GbE via SFP+

+ * 2x 1 GbE RGMII via RJ45

+* 5x USB 2.0/3.0

+* 3x SATA

+* 2x uSD

+* 1x eMMC

+* RTC

+* SPI flash & memory-mapped variable storage access

+* I2C

+* GPIO



-## Prepare prerequisites

+Hardware description:



-1. Create a new folder (directory) on your local development machine

- for use as your workspace. This example uses `/work/git/tianocore`, modify as

- appropriate for your needs.

+* ACPI (default)

+* Device Tree



- ```

- $ export WORKSPACE=/work/git/tianocore

- $ mkdir -p $WORKSPACE

- $ cd $WORKSPACE

- ```

+Others:



-1. Clone the Trusted Firmware repository:

+* Signed capsule update

+* X64 option ROM emulator



- ```

- $ cd ${WORKSPACE}

- $ git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git

- ```

-1. Clone repository for auxiliary firmware on the SoC co-processors and checkout to binaries-marvell-armada-SDK10.0.1.0:

-

- ```

- $ cd ${WORKSPACE}

- $ git clone https://github.com/MarvellEmbeddedProcessors/binaries-marvell.git

- $ cd binaries-marvell/

- $ git checkout -b binaries-marvell-armada-SDK10.0.1.0 origin/binaries-marvell-armada-SDK10.0.1.0

- ```

-1. Clone the DDR training code from:

+# Building the firmware



- ```

- $ cd ${WORKSPACE}

- $ git clone https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git

- ```

## Prepare EDKII environment:



-Please follow instructions from "Obtaining source code" and "Manual building" from the top level edk2-platforms [Readme.md](https://github.com/tianocore/edk2-platforms#readme).

+Please follow instructions from [Obtaining source code](https://github.com/tianocore/edk2-platforms#obtaining-source-code)

+and [Manual building](https://github.com/tianocore/edk2-platforms#manual-building) from the

+top level edk2-platforms [Readme.md](https://github.com/tianocore/edk2-platforms#readme).



## Build EDKII:



-1. Use below build command:

+Use below build command:



- ```

- $ cd ${WORKSPACE}

- $ build -a AARCH64 -t GCC5 -b RELEASE -D CN9132 -D INCLUDE_TFTP_COMMAND -D CAPSULE_ENABLE -p Platform/Marvell/Cn913xDb/Cn913xDbA.dsc

- ```

+ ```

+ $ build -a AARCH64 -t GCC5 -b RELEASE -D CN9132 -D CAPSULE_ENABLE -D X64EMU_ENABLE -p Platform/Marvell/Cn913xDb/Cn913xDbA.dsc

+ ```



-## Build the final firmware image:

+---

+**NOTE**



-1. Set BL33 variable to path to EDK II output binary:

+'-D INCLUDE_TFTP_COMMAND' is optional and can be added in order to enable `tftp` command in UEFI Shell.



- ```

- $ export BL33=${WORKSPACE}/Build/Cn9132DbA-AARCH64/RELEASE_GCC5/FV/ARMADA_EFI.fd

- ```

-1. Export SCP_BL2 variable:

+---



- ```

- $ export SCP_BL2=${WORKSKPACE}/binaries-marvell/mrvl_scp_bl2.img

- ```

-1. Export compiler variables (for cross-compilation only):

+## Build the final firmware image:



- ```

- $ export ARCH=arm64

- $ export CROSS_COMPILE=<toolchain_path>/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

- ```

-1. Build the image:

+In addition to EDKII binary, the complete firmware image comprises the TF-A and other components.

+A complete build instruction can be found at [wiki page](https://github.com/Semihalf/edk2-platforms/wiki/Build_firmware).



- ```

- $ cd ${WORKSPACE}/trusted-firmware-a/

- $ make LOG_LEVEL=20 MV_DDR_PATH=${WORKSPACE}/mv-ddr-marvell CP_NUM=3 PLAT=t9130 all fip mrvl_flash

+## Burning the firmware



- ```

-The firmware image `flash-image.bin` can be found in `build/t9130/release/` directory.

+Please follow instruction at [wiki page](https://github.com/Semihalf/edk2-platforms/wiki/Burning_firmware)

+to burn image to desired boot device.



# ARM System Ready certification.



diff --git a/Platform/SolidRun/Armada80x0McBin/Readme.md b/Platform/SolidRun/Armada80x0McBin/Readme.md
index c63cf41b2d..8c514835c4 100644
--- a/Platform/SolidRun/Armada80x0McBin/Readme.md
+++ b/Platform/SolidRun/Armada80x0McBin/Readme.md
@@ -3,94 +3,69 @@


# Summary



-This is a port of 64-bit TianoCore EDK II firmware for the SolidRun MacchiatoBin platform based on the Marvell ARMADA 8040 SoC.

+This is a port of 64-bit TianoCore EDK II firmware for the [SolidRun MacchiatoBin Double Shot](https://solidrun.atlassian.net/wiki/spaces/developer/pages/286655749/MACCHIATObin+Single+Double+Shot+Quick+Start+Guide)

+platform based on the Marvell ARMADA 8040 SoC.



-# Building the firmware

+# Supported features



-## Prepare toolchain (for cross-compilation only):

+Features supported in EDK2:



-1. Download the toolchain:

+* 1x PCIE x4

+* Networking:

+ * 2x 10 GbE via SFP+ / RJ45

+ * 1x 2500 Base-X via SFP+

+ * 1x 1 GbE SGMII via RJ45

+* 1x USB 3.0

+* 2x USB 2.0

+* 3x SATA

+* 1x uSD

+* 1x eMMC

+* RTC

+* SPI flash & memory-mapped variable storage access

+* GPIO



- ```

- wget https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz

- ```

+Hardware description:



-1. After extracting, setup the path and compiler prefix to GCC5\_AARCH64\_PREFIX variable:

+* ACPI (default)

+* Device Tree



- ```

- export GCC5_AARCH64_PREFIX=<toolchain_path>/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

- ```

+Others:



-## Prepare prerequisites

+* Signed capsule update

+* X64 option ROM emulator



-1. Create a new folder (directory) on your local development machine

- for use as your workspace. This example uses `/work/git/tianocore`, modify as

- appropriate for your needs.

+# Building the firmware



- ```

- $ export WORKSPACE=/work/git/tianocore

- $ mkdir -p $WORKSPACE

- $ cd $WORKSPACE

- ```

+## Prepare EDKII environment:



-1. Clone the Trusted Firmware repository:

+Please follow instructions from [Obtaining source code](https://github.com/tianocore/edk2-platforms#obtaining-source-code)

+and [Manual building](https://github.com/tianocore/edk2-platforms#manual-building) from the

+top level edk2-platforms [Readme.md](https://github.com/tianocore/edk2-platforms#readme).



- ```

- $ cd ${WORKSPACE}

- $ git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git

- ```

-1. Clone repository for auxiliary firmware on the SoC co-processors and checkout to binaries-marvell-armada-SDK10.0.1.0:

+## Build EDKII:



- ```

- $ cd ${WORKSPACE}

- $ git clone https://github.com/MarvellEmbeddedProcessors/binaries-marvell.git

- $ cd binaries-marvell/

- $ git checkout -b binaries-marvell-armada-SDK10.0.1.0 origin/binaries-marvell-armada-SDK10.0.1.0

- ```

-1. Clone the DDR training code from:

+Use below build command:



- ```

- $ cd ${WORKSPACE}

- $ git clone https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git

- ```

-## Prepare EDKII environment:

+ ```

+ $ build -a AARCH64 -t GCC5 -b RELEASE -D X64EMU_ENABLE -p Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc

+ ```



-Please follow instructions from "Obtaining source code" and "Manual building" from the top level edk2-platforms [Readme.md](https://github.com/tianocore/edk2-platforms#readme).

+---

+**NOTE**



-## Build EDKII:

-

-1. Use below build command:

+'-D INCLUDE_TFTP_COMMAND' is optional and can be added in order to enable `tftp` command in UEFI Shell.



- ```

- $ cd ${WORKSPACE}

- $ build -a AARCH64 -t GCC5 -b RELEASE -D INCLUDE_TFTP_COMMAND -D X64EMU_ENABLE -p Platform/SolidRun/Armada80x0McBin/Armada80x0McBin.dsc

- ```

+---



## Build the final firmware image:



-1. Set BL33 variable to path to EDK II output binary:

-

- ```

- $ export BL33=${WORKSPACE}/Build/Armada80x0McBin-AARCH64/RELEASE_GCC5/FV/ARMADA_EFI.fd

- ```

-1. Export SCP_BL2 variable:

-

- ```

- $ export SCP_BL2=${WORKSKPACE}/binaries-marvell/mrvl_scp_bl2.img

- ```

-1. Export compiler variables (for cross-compilation only):

-

- ```

- $ export ARCH=arm64

- $ export CROSS_COMPILE=<toolchain_path>/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

- ```

-1. Build the image:

-

- ```

- $ cd ${WORKSPACE}/trusted-firmware-a/

- $ make LOG_LEVEL=20 MV_DDR_PATH=${WORKSPACE}/mv-ddr-marvell PLAT=a80x0_mcbin all fip mrvl_flash

- ```

-The firmware image `flash-image.bin` can be found in `build/a80x0_mcbin/release/` directory.

+In addition to EDKII binary, the complete firmware image comprises the TF-A and other components.

+A complete build instruction can be found at [wiki page](https://github.com/Semihalf/edk2-platforms/wiki/Build_firmware).

+

+## Burning the firmware

+

+Please follow instruction at [wiki page](https://github.com/Semihalf/edk2-platforms/wiki/Burning_firmware)

+to burn image to desired boot device.



# ARM System Ready certification.



diff --git a/Platform/SolidRun/Cn913xCEx7Eval/Readme.md b/Platform/SolidRun/Cn913xCEx7Eval/Readme.md
index 813e723b65..0db22b5175 100644
--- a/Platform/SolidRun/Cn913xCEx7Eval/Readme.md
+++ b/Platform/SolidRun/Cn913xCEx7Eval/Readme.md
@@ -3,95 +3,70 @@


# Summary



-This is a port of 64-bit TianoCore EDK II firmware for the SolidRun CN913x CEx7 Evaluation Board.

+This is a port of 64-bit TianoCore EDK II firmware for the [SolidRun CN913x CEx7 Evaluation Board](https://solidrun.atlassian.net/wiki/spaces/developer/pages/197493948/CN9132+COM+EVK+Quick+Start+Guide).



-# Building the firmware

-

-## Prepare toolchain (for cross-compilation only):

-

-1. Download the toolchain:

-

- ```

- wget https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz

- ```

+# Supported features



-1. After extracting, setup the path and compiler prefix to GCC5\_AARCH64\_PREFIX variable:

+Features supported in EDK2:



- ```

- export GCC5_AARCH64_PREFIX=<toolchain_path>/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

- ```

+* 1x PCIE x4 + 6x PCIE x1

+* Networking:

+ * 1x 10 GbE via SFP+

+ * 2x 5 GbE via RJ45

+ * 1x 2500 Base-X via quad 1 Gbps switch

+ * 1x 1 GbE RGMII via RJ45

+* 2x USB 3.0

+* 4x USB 2.0

+* 2x SATA

+* 1x uSD

+* 1x eMMC

+* RTC

+* SPI flash & memory-mapped variable storage access

+* I2C

+* GPIO



-## Prepare prerequisites

+Hardware description:



-1. Create a new folder (directory) on your local development machine

- for use as your workspace. This example uses `/work/git/tianocore`, modify as

- appropriate for your needs.

+* ACPI (default)

+* Device Tree



- ```

- $ export WORKSPACE=/work/git/tianocore

- $ mkdir -p $WORKSPACE

- $ cd $WORKSPACE

- ```

+Others:



-1. Clone the Trusted Firmware repository:

+* Signed capsule update

+* X64 option ROM emulator



- ```

- $ cd ${WORKSPACE}

- $ git clone https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git

- ```

-1. Clone repository for auxiliary firmware on the SoC co-processors and checkout to binaries-marvell-armada-SDK10.0.1.0:

-

- ```

- $ cd ${WORKSPACE}

- $ git clone https://github.com/MarvellEmbeddedProcessors/binaries-marvell.git

- $ cd binaries-marvell/

- $ git checkout -b binaries-marvell-armada-SDK10.0.1.0 origin/binaries-marvell-armada-SDK10.0.1.0

- ```

-1. Clone the DDR training code from:

+# Building the firmware



- ```

- $ cd ${WORKSPACE}

- $ git clone https://github.com/MarvellEmbeddedProcessors/mv-ddr-marvell.git

- ```

## Prepare EDKII environment:



-Please follow instructions from "Obtaining source code" and "Manual building" from the top level edk2-platforms [Readme.md](https://github.com/tianocore/edk2-platforms#readme).

+Please follow instructions from [Obtaining source code](https://github.com/tianocore/edk2-platforms#obtaining-source-code)

+and [Manual building](https://github.com/tianocore/edk2-platforms#manual-building) from the

+top level edk2-platforms [Readme.md](https://github.com/tianocore/edk2-platforms#readme).



## Build EDKII:



-1. Use below build command:

+Use below build command:



- ```

- $ cd ${WORKSPACE}

- $ build -a AARCH64 -t GCC5 -b RELEASE -D INCLUDE_TFTP_COMMAND -D CAPSULE_ENABLE -D X64EMU_ENABLE -p Platform/SolidRun/Cn913xCEx7Eval/Cn913xCEx7Eval.dsc

- ```

+ ```

+ build -a AARCH64 -t GCC5 -b RELEASE -D CAPSULE_ENABLE -D X64EMU_ENABLE -p Platform/SolidRun/Cn913xCEx7Eval/Cn913xCEx7Eval.dsc

+ ```



-## Build the final firmware image:

+---

+**NOTE**



-1. Set BL33 variable to path to EDK II output binary:

+'-D INCLUDE_TFTP_COMMAND' is optional and can be added in order to enable `tftp` command in UEFI Shell.



- ```

- $ export BL33=${WORKSPACE}/Build/Cn913xCEx7Eval-AARCH64/RELEASE_GCC5/FV/ARMADA_EFI.fd

- ```

-1. Export SCP_BL2 variable:

+---



- ```

- $ export SCP_BL2=${WORKSKPACE}/binaries-marvell/mrvl_scp_bl2.img

- ```

-1. Export compiler variables (for cross-compilation only):

+## Build the final firmware image:



- ```

- $ export ARCH=arm64

- $ export CROSS_COMPILE=<toolchain_path>/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-

- ```

-1. Build the image:

+In addition to EDKII binary, the complete firmware image comprises the TF-A and other components.

+A complete build instruction can be found at [wiki page](https://github.com/Semihalf/edk2-platforms/wiki/Build_firmware).



- ```

- $ cd ${WORKSPACE}/trusted-firmware-a/

- $ make LOG_LEVEL=20 MV_DDR_PATH=${WORKSPACE}/mv-ddr-marvell CP_NUM=3 PLAT=t9130_cex7_eval all fip mrvl_flash

+## Burning the firmware



- ```

-The firmware image `flash-image.bin` can be found in `build/t9130_cex7_eval/release/` directory.

+Please follow instruction at [wiki page](https://github.com/Semihalf/edk2-platforms/wiki/Burning_firmware)

+to burn image to desired boot device.



# ARM System Ready certification.



--
2.29.0

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


Re: [edk2-platforms PATCH 0/8] Marvell Pp2Dxe fixes

Marcin Wojtas
 

Hi,


pon., 14 mar 2022 o 16:38 Marcin Wojtas <mw@...> napisaŇā(a):

Hi,

ES ACS v1.0 test suite (https://github.com/ARM-software/arm-systemready)
unveiled a number of issues in Pp2Dxe SNP callbacks.
This patchset fixes all of them and allow for
successful SCT tests run.

For convenience, the patches are exposed on a public branch:
https://github.com/semihalf-wojtas-marcin/edk2-platforms/commits/pp2dxe-upstream-r20220314

Any comments or remarks would be welcome.

Best regards,
Marcin

Marcin Wojtas (8):
Marvell/Drivers: Pp2Dxe: Fix Pp2SnpShutdown
Marvell/Drivers: Pp2Dxe: Fix Pp2SnpReceiveFilters
Marvell/Drivers: Pp2Dxe: Fix Pp2SnpStart & Pp2SnpStop
Marvell/Drivers: Pp2Dxe: Implement Pp2SnpIpToMac
Marvell/Drivers: Pp2Dxe: Fix Pp2SnpGetStatus
Marvell/Drivers: Pp2Dxe: Fix Pp2SnpTransmit
Marvell/Drivers: Pp2Dxe: Fix Pp2SnpReset
Marvell/Drivers: Pp2Dxe: Fix Pp2SnpReceive

Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c | 333 ++++++++++++++++++--
1 file changed, 299 insertions(+), 34 deletions(-)
Do you have any feedback about the patchset?

Best regards,
Marcin


Re: [PATCH v2] OvmfPkg/BhyveBhfPkg: add support for QemuFwCfg

Peter Grehan
 

[re-posting from my personal email account, since my mail to > freebsd-virtualization got rejected]> > I seem to remember seeing
previous feedback that Bhyve developers > strongly preferred the BhyveFwCtl mechanism. I've been out of the loop > though (busy with $dayjob) so I don't know if things have changed. > Hopefully other people can provide feedback.
I'm fine with phasing out BhyveFwCtl, so long as backwards compat is maintained.

later,

Peter.


edk2-libc Python Build issue

M.T.
 

Hello

I am trying to build the Python environment for UEFI as per Py368ReadMe.txt.
I am doing this on Ubuntu 20.04.4 LTS with GCC5 for X64, all instructions seem to be meant for windows and MSFT.
I was able to build everything else and verify that it works, so I don't see why this should be an issue, but I am running into several issues.

Initial error is missing Python.h.
The path to AppPkg/Applications/Python/Python-3.6.8/Include seems to be missing from the build command, I was able to fix that by modifying Python368.inf and under BuildOptions, adding: 
GCC:*_*_*_CC_FLAGS = -I$(WORKSPACE)/AppPkg/Applications/Python/Python-3.6.8/Include
However this then results in other errors such as unused functions - fixed with -Wno-unused-functions added to the same line above, and then finally redfinitions.

Is the build process of Python 3.6.8 documented anywhere that might help me out, or if someone could point me in the right direction, that would be greatly appreciated.

Thank you
xp


Re: [PATCH v2] OvmfPkg/BhyveBhfPkg: add support for QemuFwCfg

Rebecca Cran
 

[re-posting from my personal email account, since my mail to freebsd-virtualization got rejected]

I seem to remember seeing previous feedback that Bhyve developers strongly preferred the BhyveFwCtl mechanism. I've been out of the loop though (busy with $dayjob) so I don't know if things have changed. Hopefully other people can provide feedback.

--
Rebecca Cran

On 4/6/22 01:00, Corvin Köhne wrote:
Any comments from bhyve folks on that?


Best regards
Corvin

Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany | Register court: Guetersloh HRA 7075


-----Original Message-----
From: Corvin Köhne <C.Koehne@...>
Sent: Tuesday, March 29, 2022 12:14 PM
Cc: Corvin Köhne <C.Koehne@...>; Corvin Köhne <C.Koehne@...>; Ard Biesheuvel <ardb+tianocore@...>; Jiewen Yao <jiewen.yao@...>; Jordan Justen <jordan.l.justen@...>; Rebecca Cran <rebecca@...>; Peter Grehan <grehan@...>; devel@edk2.groups.io; FreeBSD Virtualization <freebsd-virtualization@...>; Gerd Hoffmann <kraxel@...>
Subject: [PATCH v2] OvmfPkg/BhyveBhfPkg: add support for QemuFwCfg

From: Corvin Köhne <CorvinK@...>

QemuFwCfg is much more powerful than BhyveFwCtl. Sadly, BhyveFwCtl
decided to use the same IO ports as QemuFwCfg. It's not possible to use
both interfaces simultaneously. So, prefer QemuFwCfg over BhyveFwCtl.

Signed-off-by: Corvin Köhne <c.koehne@...>
Acked-by: Gerd Hoffmann <kraxel@...>
CC: Ard Biesheuvel <ardb+tianocore@...>
CC: Jiewen Yao <jiewen.yao@...>
CC: Jordan Justen <jordan.l.justen@...>
CC: Rebecca Cran <rebecca@...>
CC: Peter Grehan <grehan@...>
CC: devel@edk2.groups.io
CC: FreeBSD Virtualization <freebsd-virtualization@...>
---
OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf | 1 +
OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c | 41 ++++++++++++++++++++---
OvmfPkg/Bhyve/BhyveX64.dsc | 4 +--
3 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
index 595fd055f9..94c65f32dc 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -43,6 +43,7 @@
MemoryAllocationLib
OrderedCollectionLib
PcdLib
+ QemuFwCfgLib
UefiBootServicesTableLib
UefiDriverEntryPoint
UefiLib
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
index 8e80aa33e1..e216a21bfa 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
@@ -11,6 +11,41 @@
#include <Library/BaseMemoryLib.h>
#include <Library/BhyveFwCtlLib.h>
#include <Library/MemoryAllocationLib.h>
+#include <Library/QemuFwCfgLib.h> // QemuFwCfgFindFile()
+
+STATIC
+EFI_STATUS
+EFIAPI
+BhyveGetCpuCount (
+ OUT UINT32 *CpuCount
+ )
+{
+ FIRMWARE_CONFIG_ITEM Item;
+ UINTN Size;
+
+ if (QemuFwCfgIsAvailable ()) {
+ if (EFI_ERROR (QemuFwCfgFindFile ("opt/bhyve/hw.ncpu", &Item, &Size))) {
+ return EFI_NOT_FOUND;
+ } else if (Size != sizeof (*CpuCount)) {
+ return EFI_BAD_BUFFER_SIZE;
+ }
+
+ QemuFwCfgSelectItem (Item);
+ QemuFwCfgReadBytes (Size, CpuCount);
+
+ return EFI_SUCCESS;
+ }
+
+ //
+ // QemuFwCfg not available, try BhyveFwCtl.
+ //
+ Size = sizeof (*CpuCount);
+ if (BhyveFwCtlGet ("hw.ncpu", CpuCount, &Size) == RETURN_SUCCESS) {
+ return EFI_SUCCESS;
+ }
+
+ return EFI_UNSUPPORTED;
+}

STATIC
EFI_STATUS
@@ -23,7 +58,6 @@ BhyveInstallAcpiMadtTable (
)
{
UINT32 CpuCount;
- UINTN cSize;
UINTN NewBufferSize;
EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *Madt;
EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE *LocalApic;
@@ -36,9 +70,8 @@ BhyveInstallAcpiMadtTable (
ASSERT (AcpiTableBufferSize >= sizeof (EFI_ACPI_DESCRIPTION_HEADER));

// Query the host for the number of vCPUs
- CpuCount = 0;
- cSize = sizeof (CpuCount);
- if (BhyveFwCtlGet ("hw.ncpu", &CpuCount, &cSize) == RETURN_SUCCESS) {
+ Status = BhyveGetCpuCount (&CpuCount);
+ if (!EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "Retrieved CpuCount %d\n", CpuCount));
ASSERT (CpuCount >= 1);
} else {
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 5fa08bebd7..14070fd6dd 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -163,8 +163,7 @@
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
- QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf
- QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
+ QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
BhyveFwCtlLib|OvmfPkg/Library/BhyveFwCtlLib/BhyveFwCtlLib.inf
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf
@@ -355,6 +354,7 @@
!endif
PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
+ QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf

[LibraryClasses.common.UEFI_APPLICATION]
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
--
2.11.0

Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany | Register court: Guetersloh HRA 7075







Re: [PATCH v2] OvmfPkg/BhyveBhfPkg: add support for QemuFwCfg

Rebecca Cran
 

I seem to remember seeing previous feedback that Bhyve developers strongly preferred the BhyveFwCtl mechanism. I've been out of the loop though (busy with $dayjob) so I don't know if things have changed. Hopefully other people can provide feedback.

--
Rebecca Cran

On 4/6/22 01:00, Corvin Köhne wrote:
Any comments from bhyve folks on that?


Best regards
Corvin

Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany | Register court: Guetersloh HRA 7075


-----Original Message-----
From: Corvin Köhne <C.Koehne@...>
Sent: Tuesday, March 29, 2022 12:14 PM
Cc: Corvin Köhne <C.Koehne@...>; Corvin Köhne <C.Koehne@...>; Ard Biesheuvel <ardb+tianocore@...>; Jiewen Yao <jiewen.yao@...>; Jordan Justen <jordan.l.justen@...>; Rebecca Cran <rebecca@...>; Peter Grehan <grehan@...>; devel@edk2.groups.io; FreeBSD Virtualization <freebsd-virtualization@...>; Gerd Hoffmann <kraxel@...>
Subject: [PATCH v2] OvmfPkg/BhyveBhfPkg: add support for QemuFwCfg

From: Corvin Köhne <CorvinK@...>

QemuFwCfg is much more powerful than BhyveFwCtl. Sadly, BhyveFwCtl
decided to use the same IO ports as QemuFwCfg. It's not possible to use
both interfaces simultaneously. So, prefer QemuFwCfg over BhyveFwCtl.

Signed-off-by: Corvin Köhne <c.koehne@...>
Acked-by: Gerd Hoffmann <kraxel@...>
CC: Ard Biesheuvel <ardb+tianocore@...>
CC: Jiewen Yao <jiewen.yao@...>
CC: Jordan Justen <jordan.l.justen@...>
CC: Rebecca Cran <rebecca@...>
CC: Peter Grehan <grehan@...>
CC: devel@edk2.groups.io
CC: FreeBSD Virtualization <freebsd-virtualization@...>
---
OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf | 1 +
OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c | 41 ++++++++++++++++++++---
OvmfPkg/Bhyve/BhyveX64.dsc | 4 +--
3 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
index 595fd055f9..94c65f32dc 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -43,6 +43,7 @@
MemoryAllocationLib
OrderedCollectionLib
PcdLib
+ QemuFwCfgLib
UefiBootServicesTableLib
UefiDriverEntryPoint
UefiLib
diff --git a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
index 8e80aa33e1..e216a21bfa 100644
--- a/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
+++ b/OvmfPkg/Bhyve/AcpiPlatformDxe/Bhyve.c
@@ -11,6 +11,41 @@
#include <Library/BaseMemoryLib.h>
#include <Library/BhyveFwCtlLib.h>
#include <Library/MemoryAllocationLib.h>
+#include <Library/QemuFwCfgLib.h> // QemuFwCfgFindFile()
+
+STATIC
+EFI_STATUS
+EFIAPI
+BhyveGetCpuCount (
+ OUT UINT32 *CpuCount
+ )
+{
+ FIRMWARE_CONFIG_ITEM Item;
+ UINTN Size;
+
+ if (QemuFwCfgIsAvailable ()) {
+ if (EFI_ERROR (QemuFwCfgFindFile ("opt/bhyve/hw.ncpu", &Item, &Size))) {
+ return EFI_NOT_FOUND;
+ } else if (Size != sizeof (*CpuCount)) {
+ return EFI_BAD_BUFFER_SIZE;
+ }
+
+ QemuFwCfgSelectItem (Item);
+ QemuFwCfgReadBytes (Size, CpuCount);
+
+ return EFI_SUCCESS;
+ }
+
+ //
+ // QemuFwCfg not available, try BhyveFwCtl.
+ //
+ Size = sizeof (*CpuCount);
+ if (BhyveFwCtlGet ("hw.ncpu", CpuCount, &Size) == RETURN_SUCCESS) {
+ return EFI_SUCCESS;
+ }
+
+ return EFI_UNSUPPORTED;
+}

STATIC
EFI_STATUS
@@ -23,7 +58,6 @@ BhyveInstallAcpiMadtTable (
)
{
UINT32 CpuCount;
- UINTN cSize;
UINTN NewBufferSize;
EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *Madt;
EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE *LocalApic;
@@ -36,9 +70,8 @@ BhyveInstallAcpiMadtTable (
ASSERT (AcpiTableBufferSize >= sizeof (EFI_ACPI_DESCRIPTION_HEADER));

// Query the host for the number of vCPUs
- CpuCount = 0;
- cSize = sizeof (CpuCount);
- if (BhyveFwCtlGet ("hw.ncpu", &CpuCount, &cSize) == RETURN_SUCCESS) {
+ Status = BhyveGetCpuCount (&CpuCount);
+ if (!EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "Retrieved CpuCount %d\n", CpuCount));
ASSERT (CpuCount >= 1);
} else {
diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc
index 5fa08bebd7..14070fd6dd 100644
--- a/OvmfPkg/Bhyve/BhyveX64.dsc
+++ b/OvmfPkg/Bhyve/BhyveX64.dsc
@@ -163,8 +163,7 @@
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf
- QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf
- QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf
+ QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf
BhyveFwCtlLib|OvmfPkg/Library/BhyveFwCtlLib/BhyveFwCtlLib.inf
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf
MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf
@@ -355,6 +354,7 @@
!endif
PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf
MpInitLib|UefiCpuPkg/Library/MpInitLibUp/MpInitLibUp.inf
+ QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf

[LibraryClasses.common.UEFI_APPLICATION]
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
--
2.11.0

Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany | Register court: Guetersloh HRA 7075






8141 - 8160 of 96543