Date   

Re: [PATCH v2 8/9] MdePkg/BaseSynchronizationLib: RISC-V cache related code.

Zhiguang Liu
 

Reviewed-by: Zhiguang Liu <zhiguang.liu@...>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Abner Chang
Sent: Tuesday, April 21, 2020 3:53 PM
To: devel@edk2.groups.io
Cc: abner.chang@...; Gilbert Chen <gilbert.chen@...>; Leif Lindholm <leif.lindholm@...>; Kinney, Michael D <michael.d.kinney@...>; Gao, Liming <liming.gao@...>
Subject: [edk2-devel] [PATCH v2 8/9] MdePkg/BaseSynchronizationLib: RISC-V cache related code.

Support RISC-V cache related functions.

Signed-off-by: Abner Chang <abner.chang@...>
Co-authored-by: Gilbert Chen <gilbert.chen@...>
Reviewed-by: Leif Lindholm <leif.lindholm@...>

Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <liming.gao@...>
Cc: Leif Lindholm <leif.lindholm@...>
Cc: Gilbert Chen <gilbert.chen@...>
---
.../BaseSynchronizationLib.inf | 5 ++
.../RiscV64/Synchronization.S | 78 +++++++++++++++++++
2 files changed, 83 insertions(+)
create mode 100644 MdePkg/Library/BaseSynchronizationLib/RiscV64/Synchronization.S

diff --git a/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf b/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
index 446bc19b63..83d5b8ed7c 100755
--- a/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+++ b/MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
@@ -3,6 +3,7 @@
#

# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>

# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>

+# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>

#

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

#

@@ -78,6 +79,10 @@
AArch64/Synchronization.S | GCC

AArch64/Synchronization.asm | MSFT



+[Sources.RISCV64]

+ Synchronization.c

+ RiscV64/Synchronization.S

+

[Packages]

MdePkg/MdePkg.dec



diff --git a/MdePkg/Library/BaseSynchronizationLib/RiscV64/Synchronization.S b/MdePkg/Library/BaseSynchronizationLib/RiscV64/Synchronization.S
new file mode 100644
index 0000000000..bac80d6871
--- /dev/null
+++ b/MdePkg/Library/BaseSynchronizationLib/RiscV64/Synchronization.S
@@ -0,0 +1,78 @@
+//------------------------------------------------------------------------------

+//

+// RISC-V synchronization functions.

+//

+// Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>

+//

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

+//

+//------------------------------------------------------------------------------

+#include <Base.h>

+

+.data

+

+.text

+.align 3

+

+.global ASM_PFX(InternalSyncCompareExchange32)

+.global ASM_PFX(InternalSyncCompareExchange64)

+.global ASM_PFX(InternalSyncIncrement)

+.global ASM_PFX(InternalSyncDecrement)

+

+//

+// ompare and xchange a 32-bit value.

+//

+// @param a0 : Pointer to 32-bit value.

+// @param a1 : Compare value.

+// @param a2 : Exchange value.

+//

+ASM_PFX (InternalSyncCompareExchange32):

+ lr.w a3, (a0) // Load the value from a0 and make

+ // the reservation of address.

+ bne a3, a1, exit

+ sc.w a3, a2, (a0) // Write the value back to the address.

+ mv a3, a1

+exit:

+ mv a0, a3

+ ret

+

+.global ASM_PFX(InternalSyncCompareExchange64)

+

+//

+// Compare and xchange a 64-bit value.

+//

+// @param a0 : Pointer to 64-bit value.

+// @param a1 : Compare value.

+// @param a2 : Exchange value.

+//

+ASM_PFX (SyncCompareExchange64):

+ lr.d a3, (a0) // Load the value from a0 and make

+ // the reservation of address.

+ bne a3, a1, exit

+ sc.d a3, a2, (a0) // Write the value back to the address.

+ mv a3, a1

+exit2:

+ mv a0, a3

+ ret

+

+//

+// Performs an atomic increment of an 32-bit unsigned integer.

+//

+// @param a0 : Pointer to 32-bit value.

+//

+ASM_PFX (InternalSyncIncrement):

+ li a1, 1

+ amoadd.w a2, a1, (a0)

+ mv a0, a2

+ ret

+

+//

+// Performs an atomic decrement of an 32-bit unsigned integer.

+//

+// @param a0 : Pointer to 32-bit value.

+//

+ASM_PFX (InternalSyncDecrement):

+ li a1, -1

+ amoadd.w a2, a1, (a0)

+ mv a0, a2

+ ret

--
2.25.0


-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#57720): https://edk2.groups.io/g/devel/message/57720
Mute This Topic: https://groups.io/mt/73168213/1779286
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [zhiguang.liu@...]
-=-=-=-=-=-=


[PATCH v2 2/2] UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI.

Dong, Eric
 

From: "Dong, Eric" <eric.dong@...>

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

In PEI phase, AP already been waked up through ApInitConfig,
so it can directly wake up it through change wakup buffer
instead of use ApInitReconfig flag. It can save some time.

Change code to only use ApInitReconfig flag in DXE phase
which must need to update the wake up buffer.

Cc: Ray Ni <ray.ni@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Chandana Kumar <chandana.c.kumar@...>
Signed-off-by: Eric Dong <eric.dong@...>
---=0D
V2:=0D
1. Enhance code to remove CpuMpData->ApLoopMode =3D=3D ApInHltLoop check.=0D

UefiCpuPkg/Library/MpInitLib/MpLib.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn=
itLib/MpLib.c
index 2e87aa1f06..6d3a0ccc72 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1818,7 +1818,14 @@ MpInitLibInitialize (
// Wakeup APs to do some AP initialize sync (Microcode & MTRR)=0D
//=0D
if (CpuMpData->CpuCount > 1) {=0D
- CpuMpData->InitFlag =3D ApInitReconfig;=0D
+ if (OldCpuMpData !=3D NULL) {=0D
+ //=0D
+ // Only needs to use this flag for DXE phase to update the wake up=0D
+ // buffer. Wakeup buffer allocated in PEI phase is no longer valid=0D
+ // in DXE.=0D
+ //=0D
+ CpuMpData->InitFlag =3D ApInitReconfig;=0D
+ }=0D
WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData, TRUE);=0D
//=0D
// Wait for all APs finished initialization=0D
@@ -1826,7 +1833,9 @@ MpInitLibInitialize (
while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {=0D
CpuPause ();=0D
}=0D
- CpuMpData->InitFlag =3D ApInitDone;=0D
+ if (OldCpuMpData !=3D NULL) {=0D
+ CpuMpData->InitFlag =3D ApInitDone;=0D
+ }=0D
for (Index =3D 0; Index < CpuMpData->CpuCount; Index++) {=0D
SetApState (&CpuMpData->CpuData[Index], CpuStateIdle);=0D
}=0D
--=20
2.23.0.windows.1


[PATCH v2 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.

Dong, Eric
 

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

This patch fixes an assertion because AP can't find the CpuMpData.
When AP is waken up through Init-Sipi-Sipi, AP's IDT should
be restored to pre-allocated buffer so AP can get the CpuMpData
through the IDT base address.
Current code already has logic to handle this when CpuMpData->
InitFlag is ApInitConfig but misses the logic
when CpuMpData->InitFlag is ApInitReconfig.
This patch fixes this gap.

Cc: Ray Ni <ray.ni@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Chandana Kumar <chandana.c.kumar@...>
Signed-off-by: Eric Dong <eric.dong@...>
---=0D
V2:=0D
1. Enhance code comments.=0D

UefiCpuPkg/Library/MpInitLib/MpLib.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn=
itLib/MpLib.c
index 64a4c3546e..2e87aa1f06 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -692,6 +692,16 @@ ApWakeupFunction (
//=0D
RestoreVolatileRegisters (&CpuMpData->CpuData[ProcessorNumber].Vol=
atileRegisters, TRUE);=0D
} else {=0D
+ if (CpuMpData->InitFlag =3D=3D ApInitReconfig) {=0D
+ //=0D
+ // Initialize AP volatile registers in ApInitReconfig path.=0D
+ // ApInitReconfig happens when:=0D
+ // 1. AP is re-enabled after it's disabled, in either PEI or DXE=
phase.=0D
+ // 2. AP is initialized in DXE phase.=0D
+ //=0D
+ RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegiste=
rs, FALSE);=0D
+ }=0D
+=0D
//=0D
// The CPU driver might not flush TLB for APs on spot after updati=
ng=0D
// page attributes. AP in mwait loop mode needs to take care of it=
when=0D
--=20
2.23.0.windows.1


Re: [PATCH 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.

Dong, Eric
 

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Dong, Eric
Sent: Wednesday, April 22, 2020 4:23 PM
To: Ni, Ray <ray.ni@...>; devel@edk2.groups.io
Cc: Laszlo Ersek <lersek@...>; Kumar, Chandana C
<chandana.c.kumar@...>
Subject: Re: [edk2-devel] [PATCH 1/2] UefiCpuPkg/MpInitLib: Restore IDT
context for APs.

-----Original Message-----
From: Ni, Ray
Sent: Wednesday, April 22, 2020 3:54 PM
To: Dong, Eric <eric.dong@...>; devel@edk2.groups.io
Cc: Laszlo Ersek <lersek@...>; Kumar, Chandana C
<chandana.c.kumar@...>
Subject: RE: [PATCH 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for
APs.

Please check my comments in below.

-----Original Message-----
From: Dong, Eric <eric.dong@...>
Sent: Wednesday, April 22, 2020 9:35 AM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Laszlo Ersek <lersek@...>;
Kumar, Chandana C <chandana.c.kumar@...>
Subject: [PATCH 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.

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



This patch used to fix a ASSERT because AP can't find the CpuMpData.
1. This patch fixes an assertion because AP can't find the CpuMpData.



When AP been waked up through Init-Sipi-Sipi, the IDT should been
restore to preallcated buffer to make it can get the CpuMpData
through IDT base address.
Not when CpuMpData->InitFlag is ApInitReconfig or ApInitConfig, AP
will be wake up through Init-Sipi-Sipi. Current code already has
logic to handle ApInitConfig, but miss the handler for
ApInitReconfig. This patch fixes this gap.
2. When AP is waken up through Init-Sipi-Sipi, AP's IDT should be
restored to pre-allocated buffer so AP can get the CpuMpData through
the IDT base address.
Current code already has logic to handle this when CpuMpData->
InitFlag is ApInitConfig but misses the logic when CpuMpData->InitFlag
is ApInitReconfig.
This patch fixes this gap.




Cc: Ray Ni <ray.ni@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Chandana Kumar <chandana.c.kumar@...>
Signed-off-by: Eric Dong <eric.dong@...>
---
UefiCpuPkg/Library/MpInitLib/MpLib.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 64a4c3546e..ac7f92fd48 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -664,8 +664,9 @@ ApWakeupFunction (
BistData = *(UINT32 *) ((UINTN) ApTopOfStack - sizeof
(UINTN));

//

// CpuMpData->CpuData[0].VolatileRegisters is initialized
based on BSP environment,

- // to initialize AP in InitConfig path.

- // NOTE: IDTR.BASE stored in CpuMpData-
CpuData[0].VolatileRegisters
points to a different IDT shared by all APs.

+ // to initialize AP in InitConfig/ApInitReconfig path.

+ // NOTE: IDTR.BASE stored in CpuMpData-
CpuData[0].VolatileRegisters
points to a

+ // different IDT shared by all APs.

//

RestoreVolatileRegisters
(&CpuMpData->CpuData[0].VolatileRegisters,
FALSE);

InitializeApData (CpuMpData, ProcessorNumber, BistData,
ApTopOfStack);

@@ -673,6 +674,16 @@ ApWakeupFunction (


InterlockedDecrement ((UINT32 *) &CpuMpData-
MpCpuExchangeInfo-
NumApsExecuting);
} else {

+ if ((CpuMpData->InitFlag == ApInitReconfig) && (CpuMpData-
ApLoopMode != ApInHltLoop)) {
+ //

+ // CpuMpData->CpuData[0].VolatileRegisters is initialized
+ based on
BSP environment,

+ // to initialize AP in InitConfig/ApInitReconfig path.
3.
Initialize AP volatile registers in ApInitReconfig path.
ApInitReconfig happens when:
1. AP is re-enabled after it's disabled, in either PEI or DXE phase.
2. AP is initialized in DXE phase.


+ // NOTE: IDTR.BASE stored in CpuMpData-
CpuData[0].VolatileRegisters points to a
+ // different IDT shared by all APs.

+ //

+ RestoreVolatileRegisters (&CpuMpData-
CpuData[0].VolatileRegisters,
FALSE);
4. Is it possible to combine this function call with the restoration code
below?
I move the code into the else of " if (CpuMpData->ApLoopMode == ApInHltLoop)", it's truly better than original.
Please see my v2 change.

Thanks,
Eric

New logic changes code flow when CpuMpData->InitFlag == ApInitReconfig.
In original flow, the code does RestoreVolatileRegisters and CpuFlushTlb, but
new code only does CpuFlushTlb.
Is CpuFlushTlb not needs if wake up through Init-Sipi-Sipi? I prefer to not
change this code flow.

Thanks,
Eric

if (CpuMpData->InitFlag == ApInitReconfig) {
//
// ApInitReconfig happens when:
// 1. AP is re-enabled after it's disabled, in either PEI or DXE phase.
// 2. AP is initialized in DXE phase.
// In either case, use the volatile registers value derived from BSP.
// NOTE: IDTR.BASE stored in
CpuMpData->CpuData[0].VolatileRegisters
points to a
// different IDT shared by all APs.
//
RestoreVolatileRegisters
(&CpuMpData->CpuData[0].VolatileRegisters,
FALSE);
} else {
if (CpuMpData->ApLoopMode == ApInHltLoop) {
//
// Restore AP's volatile registers saved before AP is halted
//
RestoreVolatileRegisters (&CpuMpData-
CpuData[ProcessorNumber].VolatileRegisters, TRUE);
} else {
//
// The CPU driver might not flush TLB for APs on spot after updating
// page attributes. AP in mwait loop mode needs to take care of it
when
// woken up.
//
CpuFlushTlb ();
}
}

+ }

+

//

// Execute AP function if AP is ready

//

--
2.23.0.windows.1


[PATCH 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.

Dong, Eric
 

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

This patch fixes an assertion because AP can't find the CpuMpData.
When AP is waken up through Init-Sipi-Sipi, AP's IDT should
be restored to pre-allocated buffer so AP can get the CpuMpData
through the IDT base address.
Current code already has logic to handle this when CpuMpData->
InitFlag is ApInitConfig but misses the logic
when CpuMpData->InitFlag is ApInitReconfig.
This patch fixes this gap.

Cc: Ray Ni <ray.ni@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Chandana Kumar <chandana.c.kumar@...>
Signed-off-by: Eric Dong <eric.dong@...>
---=0D
V2:=0D
Enhance code to remove CpuMpData->ApLoopMode =3D=3D ApInHltLoop check.=0D

UefiCpuPkg/Library/MpInitLib/MpLib.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn=
itLib/MpLib.c
index 64a4c3546e..2e87aa1f06 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -692,6 +692,16 @@ ApWakeupFunction (
//=0D
RestoreVolatileRegisters (&CpuMpData->CpuData[ProcessorNumber].Vol=
atileRegisters, TRUE);=0D
} else {=0D
+ if (CpuMpData->InitFlag =3D=3D ApInitReconfig) {=0D
+ //=0D
+ // Initialize AP volatile registers in ApInitReconfig path.=0D
+ // ApInitReconfig happens when:=0D
+ // 1. AP is re-enabled after it's disabled, in either PEI or DXE=
phase.=0D
+ // 2. AP is initialized in DXE phase.=0D
+ //=0D
+ RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegiste=
rs, FALSE);=0D
+ }=0D
+=0D
//=0D
// The CPU driver might not flush TLB for APs on spot after updati=
ng=0D
// page attributes. AP in mwait loop mode needs to take care of it=
when=0D
--=20
2.23.0.windows.1


[PATCH v2 0/2] UefiCpuPkg/MpInitLib: Fix ASSERT in AP procedure

Dong, Eric
 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2683 =0D
=0D
This patch serial used to fix an ASSERT issue. Because AP can't find =0D
the CpuMpData through IDT, it raised the ASSERT.=0D

V2:=0D
1. Enhance code comments.=0D
2. Enhance code to remove CpuMpData->ApLoopMode =3D=3D ApInHltLoop check.=0D
=0D
Cc: Ray Ni <ray.ni@...>=0D
Cc: Laszlo Ersek <lersek@...>=0D
Cc: Chandana Kumar <chandana.c.kumar@...>=0D

Eric Dong (2):
UefiCpuPkg/MpInitLib: Restore IDT context for APs.
UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI.

UefiCpuPkg/Library/MpInitLib/MpLib.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)

--=20
2.23.0.windows.1


Re: [PATCH v1 0/7] Add definitions introduced in UEFI 2.8

Zhiguang Liu
 

Hi Oleksiy,

There are tabs and Trailing whitespace in this patch set, which is not consistent with edk2 coding type.
Please run ECC tool to check your code.
https://github.com/tianocore/tianocore.github.io/wiki/ECC-tool

Thanks
Zhiguang

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Oleksiy Yakovlev
Sent: Friday, April 10, 2020 4:26 AM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@...>; Gao, Liming <liming.gao@...>; Kinney, Michael D <michael.d.kinney@...>; Felixp@...; oleksiyy@...
Subject: [edk2-devel] [PATCH v1 0/7] Add definitions introduced in UEFI 2.8

Following patches add/update structures/definitions, that was introduced/modified by UEFI Spec v.2.8.
Oleksiy Yakovlev (7):
MdePkg: Extend SERIAL_IO with DeviceTypeGuid (UEFI 2.8 mantis 1832)
BaseTools: REST style formset (UEFI 2.8 mantis 1853)
MdePkg: REST style formset (UEFI 2.8 mantis 1853)
BaseTools: Bootable NVDIMM namespaces (UEFI 2.8 mantis 1858)
MdePkg: Bootable NVDIMM namespaces (UEFI 2.8 mantis 1858)
MdePkg: Add UEFI Spec Revision 2.8 (UEFI 2.8 mantis 1926)
MdePkg: UEFI JSON Capsule Support (UEFI 2.8 mantis 1935)

.../Common/UefiInternalFormRepresentation.h | 1 +
BaseTools/Source/C/Include/Protocol/DevicePath.h | 12 +++
MdePkg/Include/Guid/CapsuleReport.h | 32 ++++++-
MdePkg/Include/Guid/HiiPlatformSetupFormset.h | 4 +
MdePkg/Include/Guid/JsonCapsule.h | 99 ++++++++++++++++++++++
MdePkg/Include/Protocol/DevicePath.h | 12 +++
MdePkg/Include/Protocol/SerialIo.h | 3 +-
.../Include/Uefi/UefiInternalFormRepresentation.h | 1 +
MdePkg/Include/Uefi/UefiSpec.h | 2 +
MdePkg/MdePkg.dec | 12 +++
10 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 MdePkg/Include/Guid/JsonCapsule.h

--
2.9.0.windows.1


Please consider the environment before printing this email.

The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


Re: [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support

Zhiguang Liu
 

Hi Oleksiy,

The definition of EFI_JSON_CONFIG_DATA_ITEM doesn't totally follow the spec.
It is as below in spec without commenting ConfigData.

typedef struct {
UINT32 ConfigDataLength;
UINT8 ConfigData[ConfigDataLength];
} EFI_JSON_CONFIG_DATA_ITEM;

Can you explain why?

Thanks
Zhiguang

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Oleksiy Yakovlev
Sent: Friday, April 10, 2020 4:26 AM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@...>; Gao, Liming <liming.gao@...>; Kinney, Michael D <michael.d.kinney@...>; Felixp@...; oleksiyy@...
Subject: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support

Added Guids and structures, that defines the work flow to perform capsule
update using JSON objects.
(UEFI 2.8 mantis 1935)

Signed-off-by: Oleksiy Yakovlev <oleksiyy@...>
---
MdePkg/Include/Guid/CapsuleReport.h | 32 +++++++++++-
MdePkg/Include/Guid/JsonCapsule.h | 99 +++++++++++++++++++++++++++++++++++++
MdePkg/Include/Uefi/UefiSpec.h | 1 +
MdePkg/MdePkg.dec | 12 +++++
4 files changed, 143 insertions(+), 1 deletion(-)
create mode 100644 MdePkg/Include/Guid/JsonCapsule.h

diff --git a/MdePkg/Include/Guid/CapsuleReport.h b/MdePkg/Include/Guid/CapsuleReport.h
index 93d2bb7..bdaf275 100644
--- a/MdePkg/Include/Guid/CapsuleReport.h
+++ b/MdePkg/Include/Guid/CapsuleReport.h
@@ -93,7 +93,37 @@ typedef struct {
///
} EFI_CAPSULE_RESULT_VARIABLE_FMP;

-
+typedef struct {
+
+ ///
+ /// Version of this structure, currently 0x00000001
+ ///
+ UINT32 Version;
+
+ ///
+ /// The unique identifier of the capsule whose processing result is recorded in this variable.
+ /// 0x00000000 b 0xEFFFFFFF b Implementation Reserved
+ /// 0xF0000000 b 0xFFFFFFFF b Specification Reserved
+ /// #define REDFISH_DEFINED_JSON_SCHEMA 0xF000000
+ /// The JSON payload shall conform to a Redfish-defined JSON schema, see DMTF-Redfish
+ /// Specification.
+ ///
+ UINT32 CapsuleId;
+
+ ///
+ /// The length of Resp in bytes.
+ ///
+ UINT32 RespLength;
+
+ ///
+ /// Variable length buffer containing the replied JSON payload to the caller who delivered JSON
+ /// capsule to system. The definition of the JSON schema used in the replied payload is beyond
+ /// the scope of this specification.
+ ///
+ /// UINT8 Resp[];
+ ///
+ } EFI_CAPSULE_RESULT_VARIABLE_JSON;
+
extern EFI_GUID gEfiCapsuleReportGuid;

#endif
diff --git a/MdePkg/Include/Guid/JsonCapsule.h b/MdePkg/Include/Guid/JsonCapsule.h
new file mode 100644
index 0000000..eaa126f
--- /dev/null
+++ b/MdePkg/Include/Guid/JsonCapsule.h
@@ -0,0 +1,99 @@
+/** @file
+Guid & data structure for tables defined for reporting firmware configuration data to EFI
+Configuration Tables and also for processing JSON payload capsule.
+
+
+Copyright (c) 2020, American Megatrends International LLC. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef _JSON_CAPSULE_GUID_H__
+#define _JSON_CAPSULE_GUID_H__
+
+//
+// The address reported in the table entry identified by EFI_JSON_CAPSULE_DATA_TABLE_GUID will be
+// referenced as physical and will not be fixed up when transition from preboot to runtime phase. The
+// addresses reported in these table entries identified by EFI_JSON_CONFIG_DATA_TABLE_GUID and
+// EFI_JSON_CAPSULE_RESULT_TABLE_GUID will be referenced as virtual and will be fixed up when
+// transition from preboot to runtime phase.
+//
+#define EFI_JSON_CONFIG_DATA_TABLE_GUID \
+ {0x87367f87, 0x1119, 0x41ce, \
+ {0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }}
+#define EFI_JSON_CAPSULE_DATA_TABLE_GUID \
+ {0x35e7a725, 0x8dd2, 0x4cac, \
+ {0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }}
+#define EFI_JSON_CAPSULE_RESULT_TABLE_GUID \
+ {0xdbc461c3, 0xb3de, 0x422a,\
+ {0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }}
+#define EFI_JSON_CAPSULE_ID_GUID \
+ {0x67d6f4cd, 0xd6b8, 0x4573, \
+ {0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }}
+
+
+
+
+#pragma pack(1)
+
+typedef struct {
+ ///
+ /// Version of the structure, initially 0x00000001.
+ ///
+ UINT32 Version;
+
+ ///
+ /// The unique identifier of this capsule.
+ ///
+ UINT32 CapsuleId;
+
+ ///
+ /// The length of the JSON payload immediately following this header, in bytes.
+ ///
+ UINT32 PayloadLength;
+
+ ///
+ /// Variable length buffer containing the JSON payload that should be parsed and applied to the system. The
+ /// definition of the JSON schema used in the payload is beyond the scope of this specification.
+ /// UINT8 Payload[];
+} EFI_JSON_CAPSULE_HEADER;
+
+typedef struct {
+ ///
+ /// The length of the following ConfigData, in bytes.
+ ///
+ UINT32 ConfigDataLength;
+
+ ///
+ /// Variable length buffer containing the JSON payload that describes one group of configuration data within
+ /// current system. The definition of the JSON schema used in this payload is beyond the scope of this specification.
+ ///
+ ///UINT8 ConfigData[ConfigDataLength];
+} EFI_JSON_CONFIG_DATA_ITEM;
+
+typedef struct {
+ ///
+ /// Version of the structure, initially 0x00000001.
+ ///
+ UINT32 Version;
+
+ ///
+ ////The total length of EFI_JSON_CAPSULE_CONFIG_DATA, in bytes.
+ ///
+ UINT32 TotalLength;
+
+ ///
+ /// Array of configuration data groups.
+ ///
+ /// EFI_JSON_CONFIG_DATA_ITEM ConfigDataList[];
+} EFI_JSON_CAPSULE_CONFIG_DATA;
+
+#pragma pack()
+
+extern EFI_GUID gEfiJsonConfigDataTableGuid;
+extern EFI_GUID gEfiJsonCapsuleDataTableGuid;
+extern EFI_GUID gEfiJsonCapsuleResultTableGuid;
+extern EFI_GUID gEfiJsonCapsuleIdGuid;
+
+
+#endif
diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h
index c6d306d..ce1b624 100644
--- a/MdePkg/Include/Uefi/UefiSpec.h
+++ b/MdePkg/Include/Uefi/UefiSpec.h
@@ -1781,6 +1781,7 @@ EFI_STATUS
#define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008
#define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010
#define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0000000000000040
+#define EFI_OS_INDICATIONS_JSON_CONFIG_DATA_REFRESH 0x0000000000000080

//
// EFI Runtime Services Table
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index ac1f533..77c573e 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -646,6 +646,18 @@
gEfiBttAbstractionGuid = { 0x18633bfc, 0x1735, 0x4217, { 0x8a, 0xc9, 0x17, 0x23, 0x92, 0x82, 0xd3, 0xf8 }}

#
+ # GUIDs defined in UEFI2.8
+ #
+ ## Include/Guid/JsonCapsule.h
+ gEfiJsonConfigDataTableGuid = { 0x87367f87, 0x1119, 0x41ce, { 0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }}
+ gEfiJsonCapsuleDataTableGuid = { 0x35e7a725, 0x8dd2, 0x4cac, { 0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }}
+ gEfiJsonCapsuleResultTableGuid = { 0xdbc461c3, 0xb3de, 0x422a, { 0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }}
+ gEfiJsonCapsuleIdGuid = { 0x67d6f4cd, 0xd6b8, 0x4573, { 0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }}
+
+ ## Include\Guid\HiiPlatformSetupFormset.h
+ gEfiHiiResetStyleFormsetGuid = { 0x790217bd, 0xbecf, 0x485b, { 0x91, 0x70, 0x5f, 0xf7, 0x11, 0x31, 0x8b, 0x27 }}
+
+ #
# GUID defined in PI1.0
#
## Include/Guid/AprioriFileName.h
--
2.9.0.windows.1


Please consider the environment before printing this email.

The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


[PATCH 2/2] UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI.

Dong, Eric
 

From: "Dong, Eric" <eric.dong@...>

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

In PEI phase, AP already been waked up through ApInitConfig,
so it can directly wake up it through change wakup buffer
instead of use ApInitReconfig flag. It can save some time.

Change code to only use ApInitReconfig flag in DXE phase
which must need to update the wake up buffer.

Cc: Ray Ni <ray.ni@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Chandana Kumar <chandana.c.kumar@...>
Signed-off-by: Eric Dong <eric.dong@...>
---=0D
V2:=0D
Enhance the code comments.=0D

UefiCpuPkg/Library/MpInitLib/MpLib.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn=
itLib/MpLib.c
index 2e87aa1f06..6d3a0ccc72 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1818,7 +1818,14 @@ MpInitLibInitialize (
// Wakeup APs to do some AP initialize sync (Microcode & MTRR)=0D
//=0D
if (CpuMpData->CpuCount > 1) {=0D
- CpuMpData->InitFlag =3D ApInitReconfig;=0D
+ if (OldCpuMpData !=3D NULL) {=0D
+ //=0D
+ // Only needs to use this flag for DXE phase to update the wake up=0D
+ // buffer. Wakeup buffer allocated in PEI phase is no longer valid=0D
+ // in DXE.=0D
+ //=0D
+ CpuMpData->InitFlag =3D ApInitReconfig;=0D
+ }=0D
WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData, TRUE);=0D
//=0D
// Wait for all APs finished initialization=0D
@@ -1826,7 +1833,9 @@ MpInitLibInitialize (
while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {=0D
CpuPause ();=0D
}=0D
- CpuMpData->InitFlag =3D ApInitDone;=0D
+ if (OldCpuMpData !=3D NULL) {=0D
+ CpuMpData->InitFlag =3D ApInitDone;=0D
+ }=0D
for (Index =3D 0; Index < CpuMpData->CpuCount; Index++) {=0D
SetApState (&CpuMpData->CpuData[Index], CpuStateIdle);=0D
}=0D
--=20
2.23.0.windows.1


[PATCH v2 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.

Dong, Eric
 

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

This patch fixes an assertion because AP can't find the CpuMpData.
When AP is waken up through Init-Sipi-Sipi, AP's IDT should
be restored to pre-allocated buffer so AP can get the CpuMpData
through the IDT base address.
Current code already has logic to handle this when CpuMpData->
InitFlag is ApInitConfig but misses the logic
when CpuMpData->InitFlag is ApInitReconfig.
This patch fixes this gap.

Cc: Ray Ni <ray.ni@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Chandana Kumar <chandana.c.kumar@...>
Signed-off-by: Eric Dong <eric.dong@...>
---=0D
V2:=0D
Enhance code to remove CpuMpData->ApLoopMode =3D=3D ApInHltLoop check.=0D

UefiCpuPkg/Library/MpInitLib/MpLib.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn=
itLib/MpLib.c
index 64a4c3546e..2e87aa1f06 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -692,6 +692,16 @@ ApWakeupFunction (
//=0D
RestoreVolatileRegisters (&CpuMpData->CpuData[ProcessorNumber].Vol=
atileRegisters, TRUE);=0D
} else {=0D
+ if (CpuMpData->InitFlag =3D=3D ApInitReconfig) {=0D
+ //=0D
+ // Initialize AP volatile registers in ApInitReconfig path.=0D
+ // ApInitReconfig happens when:=0D
+ // 1. AP is re-enabled after it's disabled, in either PEI or DXE=
phase.=0D
+ // 2. AP is initialized in DXE phase.=0D
+ //=0D
+ RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegiste=
rs, FALSE);=0D
+ }=0D
+=0D
//=0D
// The CPU driver might not flush TLB for APs on spot after updati=
ng=0D
// page attributes. AP in mwait loop mode needs to take care of it=
when=0D
--=20
2.23.0.windows.1


[PATCH v2 0/2] UefiCpuPkg/MpInitLib: Fix ASSERT in AP procedure

Dong, Eric
 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2683 =0D
=0D
This patch serial used to fix an ASSERT issue. Because AP can't find =0D
the CpuMpData through IDT, it raised the ASSERT.=0D

V2:=0D
1. Enhance code comments.=0D
2. Enhance code to remove CpuMpData->ApLoopMode =3D=3D ApInHltLoop check.=0D
=0D
Cc: Ray Ni <ray.ni@...>=0D
Cc: Laszlo Ersek <lersek@...>=0D
Cc: Chandana Kumar <chandana.c.kumar@...>=0D

Eric Dong (2):
UefiCpuPkg/MpInitLib: Restore IDT context for APs.
UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI.

UefiCpuPkg/Library/MpInitLib/MpLib.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)

--=20
2.23.0.windows.1


Re: [PATCH 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.

Dong, Eric
 

-----Original Message-----
From: Ni, Ray
Sent: Wednesday, April 22, 2020 3:54 PM
To: Dong, Eric <eric.dong@...>; devel@edk2.groups.io
Cc: Laszlo Ersek <lersek@...>; Kumar, Chandana C
<chandana.c.kumar@...>
Subject: RE: [PATCH 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.

Please check my comments in below.

-----Original Message-----
From: Dong, Eric <eric.dong@...>
Sent: Wednesday, April 22, 2020 9:35 AM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Laszlo Ersek <lersek@...>;
Kumar, Chandana C <chandana.c.kumar@...>
Subject: [PATCH 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.

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



This patch used to fix a ASSERT because AP can't find the CpuMpData.
1. This patch fixes an assertion because AP can't find the CpuMpData.



When AP been waked up through Init-Sipi-Sipi, the IDT should been
restore to preallcated buffer to make it can get the CpuMpData through
IDT base address.
Not when CpuMpData->InitFlag is ApInitReconfig or ApInitConfig, AP
will be wake up through Init-Sipi-Sipi. Current code already has logic
to handle ApInitConfig, but miss the handler for ApInitReconfig. This
patch fixes this gap.
2. When AP is waken up through Init-Sipi-Sipi, AP's IDT should be restored to
pre-allocated buffer so AP can get the CpuMpData through the IDT base
address.
Current code already has logic to handle this when CpuMpData-> InitFlag is
ApInitConfig but misses the logic when CpuMpData->InitFlag is
ApInitReconfig.
This patch fixes this gap.




Cc: Ray Ni <ray.ni@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Chandana Kumar <chandana.c.kumar@...>
Signed-off-by: Eric Dong <eric.dong@...>
---
UefiCpuPkg/Library/MpInitLib/MpLib.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 64a4c3546e..ac7f92fd48 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -664,8 +664,9 @@ ApWakeupFunction (
BistData = *(UINT32 *) ((UINTN) ApTopOfStack - sizeof (UINTN));

//

// CpuMpData->CpuData[0].VolatileRegisters is initialized based on BSP
environment,

- // to initialize AP in InitConfig path.

- // NOTE: IDTR.BASE stored in CpuMpData-
CpuData[0].VolatileRegisters
points to a different IDT shared by all APs.

+ // to initialize AP in InitConfig/ApInitReconfig path.

+ // NOTE: IDTR.BASE stored in CpuMpData-
CpuData[0].VolatileRegisters
points to a

+ // different IDT shared by all APs.

//

RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters,
FALSE);

InitializeApData (CpuMpData, ProcessorNumber, BistData,
ApTopOfStack);

@@ -673,6 +674,16 @@ ApWakeupFunction (


InterlockedDecrement ((UINT32 *) &CpuMpData-
MpCpuExchangeInfo-
NumApsExecuting);
} else {

+ if ((CpuMpData->InitFlag == ApInitReconfig) && (CpuMpData-
ApLoopMode != ApInHltLoop)) {
+ //

+ // CpuMpData->CpuData[0].VolatileRegisters is initialized based on
BSP environment,

+ // to initialize AP in InitConfig/ApInitReconfig path.
3.
Initialize AP volatile registers in ApInitReconfig path.
ApInitReconfig happens when:
1. AP is re-enabled after it's disabled, in either PEI or DXE phase.
2. AP is initialized in DXE phase.


+ // NOTE: IDTR.BASE stored in CpuMpData-
CpuData[0].VolatileRegisters points to a
+ // different IDT shared by all APs.

+ //

+ RestoreVolatileRegisters (&CpuMpData-
CpuData[0].VolatileRegisters,
FALSE);
4. Is it possible to combine this function call with the restoration code below?
New logic changes code flow when CpuMpData->InitFlag == ApInitReconfig. In original flow, the code does RestoreVolatileRegisters and CpuFlushTlb, but new code only does CpuFlushTlb.
Is CpuFlushTlb not needs if wake up through Init-Sipi-Sipi? I prefer to not change this code flow.

Thanks,
Eric

if (CpuMpData->InitFlag == ApInitReconfig) {
//
// ApInitReconfig happens when:
// 1. AP is re-enabled after it's disabled, in either PEI or DXE phase.
// 2. AP is initialized in DXE phase.
// In either case, use the volatile registers value derived from BSP.
// NOTE: IDTR.BASE stored in CpuMpData->CpuData[0].VolatileRegisters
points to a
// different IDT shared by all APs.
//
RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters,
FALSE);
} else {
if (CpuMpData->ApLoopMode == ApInHltLoop) {
//
// Restore AP's volatile registers saved before AP is halted
//
RestoreVolatileRegisters (&CpuMpData-
CpuData[ProcessorNumber].VolatileRegisters, TRUE);
} else {
//
// The CPU driver might not flush TLB for APs on spot after updating
// page attributes. AP in mwait loop mode needs to take care of it when
// woken up.
//
CpuFlushTlb ();
}
}

+ }

+

//

// Execute AP function if AP is ready

//

--
2.23.0.windows.1


Re: [PATCH v1] UefiCpuPkg/MpInitLib: Add missing explicit PcdLib dependency

Ni, Ray
 

Reviewed-by: Ray Ni <ray.ni@...>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, Hao
A
Sent: Wednesday, April 22, 2020 2:56 PM
To: devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>; Dong, Eric <eric.dong@...>; Ni,
Ray <ray.ni@...>; Laszlo Ersek <lersek@...>
Subject: [edk2-devel] [PATCH v1] UefiCpuPkg/MpInitLib: Add missing explicit
PcdLib dependency

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

Both PEI and DXE instances of the MpInitLib are using PcdLib APIs, but
none of them list the dependency of the PcdLib in INF & header files.

This commit will explicitly add such dependency in .H and .INF files.

Test done:
Library level build pass for VS2015x86 tool chain

Cc: Eric Dong <eric.dong@...>
Cc: Ray Ni <ray.ni@...>
Cc: Laszlo Ersek <lersek@...>
Signed-off-by: Hao A Wu <hao.a.wu@...>
---
UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf | 1 +
UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf | 1 +
UefiCpuPkg/Library/MpInitLib/MpLib.h | 1 +
3 files changed, 3 insertions(+)

diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
index a51a9ec1d2..9907f4157b 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
@@ -51,6 +51,7 @@ [LibraryClasses]
UefiBootServicesTableLib
DebugAgentLib
SynchronizationLib
+ PcdLib

[Protocols]
gEfiTimerArchProtocolGuid ## SOMETIMES_CONSUMES
diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
index d78d328b42..89ee9a79d8 100644
--- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
@@ -50,6 +50,7 @@ [LibraryClasses]
UefiCpuLib
SynchronizationLib
PeiServicesLib
+ PcdLib

[Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ##
CONSUMES
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h
b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index 74e919dae0..a8ca03efb8 100755
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -31,6 +31,7 @@
#include <Library/SynchronizationLib.h>
#include <Library/MtrrLib.h>
#include <Library/HobLib.h>
+#include <Library/PcdLib.h>

#include <Guid/MicrocodePatchHob.h>

--
2.12.0.windows.1



Re: [PATCH 2/2] UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI.

Ni, Ray
 

Reviewed-by: Ray Ni <ray.ni@...> with a bit comments update:

"Current been used wake up buffer is allocated in PEI phase and no long valid at this time."
->
"Wakeup buffer allocated in PEI phase is no longer valid in DXE."

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Dong,
Eric
Sent: Wednesday, April 22, 2020 9:35 AM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Laszlo Ersek <lersek@...>; Kumar,
Chandana C <chandana.c.kumar@...>
Subject: [edk2-devel] [PATCH 2/2] UefiCpuPkg/MpInitLib: Avoid
ApInitReconfig in PEI.

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


In PEI phase, AP already been waked up through ApInitConfig,
so it can directly wake up it through change wakup buffer
instead of use ApInitReconfig flag. It can save some time.

Change code to only use ApInitReconfig flag in DXE phase
which must need to update the wake up buffer.

Cc: Ray Ni <ray.ni@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Chandana Kumar <chandana.c.kumar@...>
Signed-off-by: Eric Dong <eric.dong@...>
---
UefiCpuPkg/Library/MpInitLib/MpLib.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index ac7f92fd48..644971b68f 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1819,7 +1819,14 @@ MpInitLibInitialize (
// Wakeup APs to do some AP initialize sync (Microcode & MTRR)

//

if (CpuMpData->CpuCount > 1) {

- CpuMpData->InitFlag = ApInitReconfig;

+ if (OldCpuMpData != NULL) {

+ //

+ // Only needs to use this flag for DXE phase to update the wake up

+ // buffer. Current been used wake up buffer is allocated in PEI phase

+ // and no long valid at this time.

+ //

+ CpuMpData->InitFlag = ApInitReconfig;

+ }

WakeUpAP (CpuMpData, TRUE, 0, ApInitializeSync, CpuMpData, TRUE);

//

// Wait for all APs finished initialization

@@ -1827,7 +1834,9 @@ MpInitLibInitialize (
while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {

CpuPause ();

}

- CpuMpData->InitFlag = ApInitDone;

+ if (OldCpuMpData != NULL) {

+ CpuMpData->InitFlag = ApInitDone;

+ }

for (Index = 0; Index < CpuMpData->CpuCount; Index++) {

SetApState (&CpuMpData->CpuData[Index], CpuStateIdle);

}

--
2.23.0.windows.1


-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#57774): https://edk2.groups.io/g/devel/message/57774
Mute This Topic: https://groups.io/mt/73187417/1712937
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni@...]
-=-=-=-=-=-=


Re: [PATCH 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.

Ni, Ray
 

Please check my comments in below.

-----Original Message-----
From: Dong, Eric <eric.dong@...>
Sent: Wednesday, April 22, 2020 9:35 AM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Laszlo Ersek <lersek@...>; Kumar,
Chandana C <chandana.c.kumar@...>
Subject: [PATCH 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.

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



This patch used to fix a ASSERT because AP can't find the CpuMpData.
1. This patch fixes an assertion because AP can't find the CpuMpData.



When AP been waked up through Init-Sipi-Sipi, the IDT should
been restore to preallcated buffer to make it can get the
CpuMpData through IDT base address.
Not when CpuMpData->InitFlag is ApInitReconfig or ApInitConfig,
AP will be wake up through Init-Sipi-Sipi. Current code already
has logic to handle ApInitConfig, but miss the handler for
ApInitReconfig. This patch fixes this gap.
2. When AP is waken up through Init-Sipi-Sipi, AP's IDT should
be restored to pre-allocated buffer so AP can get the CpuMpData
through the IDT base address.
Current code already has logic to handle this when CpuMpData->
InitFlag is ApInitConfig but misses the logic
when CpuMpData->InitFlag is ApInitReconfig.
This patch fixes this gap.




Cc: Ray Ni <ray.ni@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Chandana Kumar <chandana.c.kumar@...>
Signed-off-by: Eric Dong <eric.dong@...>
---
UefiCpuPkg/Library/MpInitLib/MpLib.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 64a4c3546e..ac7f92fd48 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -664,8 +664,9 @@ ApWakeupFunction (
BistData = *(UINT32 *) ((UINTN) ApTopOfStack - sizeof (UINTN));

//

// CpuMpData->CpuData[0].VolatileRegisters is initialized based on BSP
environment,

- // to initialize AP in InitConfig path.

- // NOTE: IDTR.BASE stored in CpuMpData->CpuData[0].VolatileRegisters
points to a different IDT shared by all APs.

+ // to initialize AP in InitConfig/ApInitReconfig path.

+ // NOTE: IDTR.BASE stored in CpuMpData->CpuData[0].VolatileRegisters
points to a

+ // different IDT shared by all APs.

//

RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters,
FALSE);

InitializeApData (CpuMpData, ProcessorNumber, BistData,
ApTopOfStack);

@@ -673,6 +674,16 @@ ApWakeupFunction (


InterlockedDecrement ((UINT32 *) &CpuMpData->MpCpuExchangeInfo-
NumApsExecuting);
} else {

+ if ((CpuMpData->InitFlag == ApInitReconfig) && (CpuMpData-
ApLoopMode != ApInHltLoop)) {
+ //

+ // CpuMpData->CpuData[0].VolatileRegisters is initialized based on
BSP environment,

+ // to initialize AP in InitConfig/ApInitReconfig path.
3.
Initialize AP volatile registers in ApInitReconfig path.
ApInitReconfig happens when:
1. AP is re-enabled after it's disabled, in either PEI or DXE phase.
2. AP is initialized in DXE phase.


+ // NOTE: IDTR.BASE stored in CpuMpData-
CpuData[0].VolatileRegisters points to a
+ // different IDT shared by all APs.

+ //

+ RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters,
FALSE);
4. Is it possible to combine this function call with the restoration code below?

if (CpuMpData->InitFlag == ApInitReconfig) {
//
// ApInitReconfig happens when:
// 1. AP is re-enabled after it's disabled, in either PEI or DXE phase.
// 2. AP is initialized in DXE phase.
// In either case, use the volatile registers value derived from BSP.
// NOTE: IDTR.BASE stored in CpuMpData->CpuData[0].VolatileRegisters points to a
// different IDT shared by all APs.
//
RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters, FALSE);
} else {
if (CpuMpData->ApLoopMode == ApInHltLoop) {
//
// Restore AP's volatile registers saved before AP is halted
//
RestoreVolatileRegisters (&CpuMpData->CpuData[ProcessorNumber].VolatileRegisters, TRUE);
} else {
//
// The CPU driver might not flush TLB for APs on spot after updating
// page attributes. AP in mwait loop mode needs to take care of it when
// woken up.
//
CpuFlushTlb ();
}
}

+ }

+

//

// Execute AP function if AP is ready

//

--
2.23.0.windows.1


Re: [PATCH] BaseTools/PatchCheck.py: Add LicenseCheck

Liming Gao
 

Shenglei:
Please submit BZ to describe it. The license should be BSD-2-Clause-Patent.

Thanks
Liming

-----Original Message-----
From: Zhang, Shenglei <shenglei.zhang@...>
Sent: Wednesday, April 22, 2020 2:57 PM
To: devel@edk2.groups.io
Cc: Feng, Bob C <bob.c.feng@...>; Gao, Liming <liming.gao@...>
Subject: [PATCH] BaseTools/PatchCheck.py: Add LicenseCheck

For files to be added to the tree, this feature will check
whether it has BSD license.

Cc: Bob Feng <bob.c.feng@...>
Cc: Liming Gao <liming.gao@...>
Signed-off-by: Shenglei Zhang <shenglei.zhang@...>
---
BaseTools/Scripts/PatchCheck.py | 52 ++++++++++++++++++++++++++++++++-
1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 13da6967785d..15663d02a3c0 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -491,6 +491,53 @@ class GitDiffCheck:
print(prefix, line)
count += 1

+class LicenseCheck():
+
+ def __init__(self, diff):
+ self.ok = True
+ self.startcheck = False
+ self.license = True
+ lines = diff.splitlines(True)
+ count = len(lines)
+ line_index = 0
+ for line in lines:
+ if line.startswith('--- /dev/null'):
+ nextline = lines[line_index + 1]
+ added_file = self.Readdedfileformat.search(nextline).group(1)
+ added_file_extension = os.path.splitext(added_file)[1]
+ if added_file_extension in self.file_extension_list:
+ self.startcheck = True
+ self.license = False
+ if self.startcheck and self.license_name in line:
+ self.license = True
+ if line_index + 1 == count or lines[line_index + 1].startswith('diff --') and self.startcheck:
+ if not self.license:
+ self.error(added_file)
+ self.startcheck = False
+ self.license = True
+ line_index = line_index + 1
+
+ def error(self, *err):
+ if self.ok and Verbose.level > Verbose.ONELINE:
+ print('License is missing!')
+ self.ok = False
+ if Verbose.level < Verbose.NORMAL:
+ return
+ count = 0
+ for line in err:
+ prefix = (' *', ' ')[count > 0]
+ error_format = 'Missing license in:'
+ print(prefix, error_format, line)
+ count += 1
+
+
+ license_name = 'BSD-2-Clause-Patent'
+
+ Readdedfileformat = re.compile(r'\+\+\+ b\/(.*)\n')
+
+ file_extension_list = [".c", ".h", ".inf", ".dsc", ".dec", ".py", ".bat", ".sh", ".uni", ".yaml", ".fdf", ".inc"]
+
+
class CheckOnePatch:
"""Checks the contents of a git email formatted patch.

@@ -508,12 +555,15 @@ class CheckOnePatch:
msg_check = CommitMessageCheck(self.commit_subject, self.commit_msg)
msg_ok = msg_check.ok

+ license_check = LicenseCheck(self.diff)
+ license_ok = license_check.ok
+
diff_ok = True
if self.diff is not None:
diff_check = GitDiffCheck(self.diff)
diff_ok = diff_check.ok

- self.ok = email_ok and msg_ok and diff_ok
+ self.ok = email_ok and msg_ok and diff_ok and license_ok

if Verbose.level == Verbose.ONELINE:
if self.ok:
--
2.18.0.windows.1


[PATCH] BaseTools/PatchCheck.py: Add LicenseCheck

Zhang, Shenglei
 

For files to be added to the tree, this feature will check
whether it has BSD license.

Cc: Bob Feng <bob.c.feng@...>
Cc: Liming Gao <liming.gao@...>
Signed-off-by: Shenglei Zhang <shenglei.zhang@...>
---
BaseTools/Scripts/PatchCheck.py | 52 ++++++++++++++++++++++++++++++++-
1 file changed, 51 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck.py
index 13da6967785d..15663d02a3c0 100755
--- a/BaseTools/Scripts/PatchCheck.py
+++ b/BaseTools/Scripts/PatchCheck.py
@@ -491,6 +491,53 @@ class GitDiffCheck:
print(prefix, line)
count += 1

+class LicenseCheck():
+
+ def __init__(self, diff):
+ self.ok = True
+ self.startcheck = False
+ self.license = True
+ lines = diff.splitlines(True)
+ count = len(lines)
+ line_index = 0
+ for line in lines:
+ if line.startswith('--- /dev/null'):
+ nextline = lines[line_index + 1]
+ added_file = self.Readdedfileformat.search(nextline).group(1)
+ added_file_extension = os.path.splitext(added_file)[1]
+ if added_file_extension in self.file_extension_list:
+ self.startcheck = True
+ self.license = False
+ if self.startcheck and self.license_name in line:
+ self.license = True
+ if line_index + 1 == count or lines[line_index + 1].startswith('diff --') and self.startcheck:
+ if not self.license:
+ self.error(added_file)
+ self.startcheck = False
+ self.license = True
+ line_index = line_index + 1
+
+ def error(self, *err):
+ if self.ok and Verbose.level > Verbose.ONELINE:
+ print('License is missing!')
+ self.ok = False
+ if Verbose.level < Verbose.NORMAL:
+ return
+ count = 0
+ for line in err:
+ prefix = (' *', ' ')[count > 0]
+ error_format = 'Missing license in:'
+ print(prefix, error_format, line)
+ count += 1
+
+
+ license_name = 'BSD-2-Clause-Patent'
+
+ Readdedfileformat = re.compile(r'\+\+\+ b\/(.*)\n')
+
+ file_extension_list = [".c", ".h", ".inf", ".dsc", ".dec", ".py", ".bat", ".sh", ".uni", ".yaml", ".fdf", ".inc"]
+
+
class CheckOnePatch:
"""Checks the contents of a git email formatted patch.

@@ -508,12 +555,15 @@ class CheckOnePatch:
msg_check = CommitMessageCheck(self.commit_subject, self.commit_msg)
msg_ok = msg_check.ok

+ license_check = LicenseCheck(self.diff)
+ license_ok = license_check.ok
+
diff_ok = True
if self.diff is not None:
diff_check = GitDiffCheck(self.diff)
diff_ok = diff_check.ok

- self.ok = email_ok and msg_ok and diff_ok
+ self.ok = email_ok and msg_ok and diff_ok and license_ok

if Verbose.level == Verbose.ONELINE:
if self.ok:
--
2.18.0.windows.1


[PATCH v1] UefiCpuPkg/MpInitLib: Add missing explicit PcdLib dependency

Wu, Hao A
 

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

Both PEI and DXE instances of the MpInitLib are using PcdLib APIs, but
none of them list the dependency of the PcdLib in INF & header files.

This commit will explicitly add such dependency in .H and .INF files.

Test done:
Library level build pass for VS2015x86 tool chain

Cc: Eric Dong <eric.dong@...>
Cc: Ray Ni <ray.ni@...>
Cc: Laszlo Ersek <lersek@...>
Signed-off-by: Hao A Wu <hao.a.wu@...>
---
UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf | 1 +
UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf | 1 +
UefiCpuPkg/Library/MpInitLib/MpLib.h | 1 +
3 files changed, 3 insertions(+)

diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
index a51a9ec1d2..9907f4157b 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
@@ -51,6 +51,7 @@ [LibraryClasses]
UefiBootServicesTableLib
DebugAgentLib
SynchronizationLib
+ PcdLib

[Protocols]
gEfiTimerArchProtocolGuid ## SOMETIMES_CONSUMES
diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
index d78d328b42..89ee9a79d8 100644
--- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf
@@ -50,6 +50,7 @@ [LibraryClasses]
UefiCpuLib
SynchronizationLib
PeiServicesLib
+ PcdLib

[Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## CONSUMES
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index 74e919dae0..a8ca03efb8 100755
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -31,6 +31,7 @@
#include <Library/SynchronizationLib.h>
#include <Library/MtrrLib.h>
#include <Library/HobLib.h>
+#include <Library/PcdLib.h>

#include <Guid/MicrocodePatchHob.h>

--
2.12.0.windows.1


Re: [PATCH v4 3/3] BaseTools: BaseTools changes for RISC-V platform.

Abner Chang
 

Sure, I will do it next time. Thanks for the advice.

-----Original Message-----
From: Liu, Zhiguang [mailto:zhiguang.liu@...]
Sent: Tuesday, April 21, 2020 4:52 PM
To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist)
<abner.chang@...>
Cc: Chen, Gilbert <gilbert.chen@...>; Schaefer, Daniel (DualStudy)
<daniel.schaefer@...>; Leif Lindholm <leif.lindholm@...>; Feng,
Bob C <bob.c.feng@...>; Gao, Liming <liming.gao@...>
Subject: RE: [edk2-devel] [PATCH v4 3/3] BaseTools: BaseTools changes for
RISC-V platform.

Hi Abner
Thanks very much for the contribution.
According to the process, if you want to update your patch, please re-send all
the patch in the same patch set with the version updated.
If some patch already get reviewed-by, you can update the commit message.
Thanks
Zhiguang

The code change is good for me.
Reviewed-by: Zhiguang Liu <zhiguang.liu@...>


-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Abner
Chang
Sent: Tuesday, April 21, 2020 3:42 PM
To: devel@edk2.groups.io
Cc: abner.chang@...; Gilbert Chen <gilbert.chen@...>; Daniel
Helmut Schaefer <daniel.schaefer@...>; Leif Lindholm
<leif.lindholm@...>; Feng, Bob C <bob.c.feng@...>; Gao,
Liming <liming.gao@...>
Subject: [edk2-devel] [PATCH v4 3/3] BaseTools: BaseTools changes for RISC-
V platform.

Tools definitions template file changes for building EDK2 RISC-V platform.

Signed-off-by: Abner Chang <abner.chang@...>
Co-authored-by: Gilbert Chen <gilbert.chen@...>
Co-authored-by: Daniel Helmut Schaefer <daniel.schaefer@...>
Reviewed-by: Leif Lindholm <leif.lindholm@...>

Cc: Bob Feng <bob.c.feng@...>
Cc: Liming Gao <liming.gao@...>
Cc: Leif Lindholm <leif.lindholm@...>
Cc: Gilbert Chen <gilbert.chen@...>
---
BaseTools/Conf/tools_def.template | 53
+++++++++++++++++++++++++++++--
1 file changed, 51 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template
b/BaseTools/Conf/tools_def.template
index 88d7ab8cab..c7e19f4544 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -3,7 +3,7 @@
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>

# Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>

# Copyright (c) 2015, Hewlett-Packard Development Company, L.P.<BR>

-# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>

+# (C) Copyright 2020, Hewlett Packard Enterprise Development LP<BR>

# Copyright (c) Microsoft Corporation

#

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

@@ -267,11 +267,12 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
# Intel(r) ACPI Compiler from

# https://acpica.org/downloads

# GCC5 -Linux,Windows- Requires:

-# GCC 5 with LTO support, targeting x86_64-linux-gnu,
aarch64-linux-gnu, or arm-linux-gnueabi

+# GCC 5 with LTO support, targeting x86_64-linux-gnu,
aarch64-linux-gnu, arm-linux-gnueabi or riscv64-linux-gnu

# Optional:

# Required to build platforms or ACPI tables:

# Intel(r) ACPI Compiler from

# https://acpica.org/downloads

+#

# CLANG35 -Linux,Windows- Requires:

# Clang v3.5 or later, and GNU binutils targeting aarch64-linux-
gnu or arm-linux-gnueabi

# Optional:

@@ -1946,6 +1947,7 @@ DEFINE GCC_IA32_RC_FLAGS = -I binary -O
elf32-i386 -B i386
DEFINE GCC_X64_RC_FLAGS = -I binary -O elf64-x86-64 -B i386 --
rename-section .data=.hii

DEFINE GCC_ARM_RC_FLAGS = -I binary -O elf32-littlearm -B arm --
rename-section .data=.hii

DEFINE GCC_AARCH64_RC_FLAGS = -I binary -O elf64-littleaarch64 -B
aarch64 --rename-section .data=.hii

+DEFINE GCC_RISCV64_RC_FLAGS = -I binary -O elf64-littleriscv -B riscv
--rename-section .data=.hii



# GCC Build Flag for included header file list generation

DEFINE GCC_DEPS_FLAGS = -MMD -MF $@.deps

@@ -2020,6 +2022,22 @@ DEFINE GCC5_ARM_ASLDLINK_FLAGS =
DEF(GCC49_ARM_ASLDLINK_FLAGS)
DEFINE GCC5_AARCH64_ASLDLINK_FLAGS =
DEF(GCC49_AARCH64_ASLDLINK_FLAGS)

DEFINE GCC5_ASLCC_FLAGS = DEF(GCC49_ASLCC_FLAGS) -fno-lto



+DEFINE GCC5_RISCV_ALL_CC_FLAGS = -g -fshort-wchar -fno-
strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections -fdata-
sections -include AutoGen.h -fno-common -
DSTRING_ARRAY_NAME=$(BASE_NAME)Strings -msmall-data-limit=0

+DEFINE GCC5_RISCV_ALL_DLINK_COMMON = -nostdlib -Wl,-n,-q,--
gc-sections -z common-page-size=0x40

+DEFINE GCC5_RISCV_ALL_DLINK_FLAGS =
DEF(GCC5_RISCV_ALL_DLINK_COMMON) -Wl,--
entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-
Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map

+DEFINE GCC5_RISCV_ALL_DLINK2_FLAGS = -Wl,--
defsym=PECOFF_HEADER_SIZE=0x220,--
script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds

+DEFINE GCC5_RISCV_ALL_ASM_FLAGS = -c -x assembler -imacros
$(DEST_DIR_DEBUG)/AutoGen.h

+DEFINE GCC5_RISCV_ALL_CC_FLAGS_WARNING_DISABLE = -Wno-
tautological-compare -Wno-pointer-compare

+

+DEFINE GCC5_RISCV_OPENSBI_TYPES = -
DOPENSBI_EXTERNAL_SBI_TYPES=OpensbiTypes.h

+

+DEFINE GCC5_RISCV64_ARCH = rv64imafdc

+DEFINE GCC5_RISCV32_RISCV64_ASLDLINK_FLAGS =
DEF(GCC5_RISCV_ALL_DLINK_COMMON) -Wl,--entry,ReferenceAcpiTable -u
ReferenceAcpiTable

+DEFINE GCC5_RISCV64_CC_FLAGS =
DEF(GCC5_RISCV_ALL_CC_FLAGS)
DEF(GCC5_RISCV_ALL_CC_FLAGS_WARNING_DISABLE)
DEF(GCC5_RISCV_OPENSBI_TYPES) -march=DEF(GCC5_RISCV64_ARCH) -fno-
builtin -fno-builtin-memcpy -fno-stack-protector -Wno-address -fno-
asynchronous-unwind-tables -Wno-unused-but-set-variable -fpack-struct=8
-mcmodel=medany -mabi=lp64 -mno-relax

+DEFINE GCC5_RISCV64_DLINK_FLAGS =
DEF(GCC5_RISCV_ALL_DLINK_FLAGS) -Wl,-melf64lriscv,--oformat=elf64-
littleriscv,--no-relax

+DEFINE GCC5_RISCV64_DLINK2_FLAGS =
DEF(GCC5_RISCV_ALL_DLINK2_FLAGS)

+DEFINE GCC5_RISCV64_ASM_FLAGS =
DEF(GCC5_RISCV_ALL_ASM_FLAGS) -march=DEF(GCC5_RISCV64_ARCH) -
mcmodel=medany -mabi=lp64

+


##########################################################
##########################

#

# GCC 4.8 - This configuration is used to compile under Linux to produce

@@ -2464,6 +2482,37 @@ RELEASE_GCC5_AARCH64_DLINK_XIPFLAGS = -z
common-page-size=0x20
NOOPT_GCC5_AARCH64_DLINK_FLAGS =
DEF(GCC5_AARCH64_DLINK_FLAGS) -O0

NOOPT_GCC5_AARCH64_DLINK_XIPFLAGS = -z common-page-size=0x20 -
O0



+#########################################################
###########################

+#

+# GCC RISC-V This configuration is used to compile under Linux to produce

+# PE/COFF binaries using GCC RISC-V tool chain

+#

+#########################################################
###########################

+

+##################

+# GCC5 RISCV64 definitions

+##################

+*_GCC5_RISCV64_OBJCOPY_PATH =
ENV(GCC5_RISCV64_PREFIX)objcopy

+*_GCC5_RISCV64_CC_PATH = ENV(GCC5_RISCV64_PREFIX)gcc

+*_GCC5_RISCV64_SLINK_PATH = ENV(GCC5_RISCV64_PREFIX)gcc-ar

+*_GCC5_RISCV64_DLINK_PATH = ENV(GCC5_RISCV64_PREFIX)gcc

+*_GCC5_RISCV64_ASLDLINK_PATH = ENV(GCC5_RISCV64_PREFIX)gcc

+*_GCC5_RISCV64_ASM_PATH = ENV(GCC5_RISCV64_PREFIX)gcc

+*_GCC5_RISCV64_PP_PATH = ENV(GCC5_RISCV64_PREFIX)gcc

+*_GCC5_RISCV64_VFRPP_PATH = ENV(GCC5_RISCV64_PREFIX)gcc

+*_GCC5_RISCV64_ASLCC_PATH = ENV(GCC5_RISCV64_PREFIX)gcc

+*_GCC5_RISCV64_ASLPP_PATH = ENV(GCC5_RISCV64_PREFIX)gcc

+*_GCC5_RISCV64_RC_PATH = ENV(GCC5_RISCV64_PREFIX)objcopy

+

+*_GCC5_RISCV64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS)

+*_GCC5_RISCV64_ASLDLINK_FLAGS =
DEF(GCC5_RISCV32_RISCV64_ASLDLINK_FLAGS)

+*_GCC5_RISCV64_ASM_FLAGS = DEF(GCC5_RISCV64_ASM_FLAGS)

+*_GCC5_RISCV64_CC_FLAGS = DEF(GCC5_RISCV64_CC_FLAGS) -
save-temps

+*_GCC5_RISCV64_DLINK_FLAGS = DEF(GCC5_RISCV64_DLINK_FLAGS)

+*_GCC5_RISCV64_DLINK2_FLAGS = DEF(GCC5_RISCV64_DLINK2_FLAGS)

+*_GCC5_RISCV64_RC_FLAGS = DEF(GCC_RISCV64_RC_FLAGS)

+*_GCC5_RISCV64_OBJCOPY_FLAGS =

+


##########################################################
##########################

#

# CLANG35 - This configuration is used to compile under Linux to produce

--
2.25.0


-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#57717):
INVALID URI REMOVED
3A__edk2.groups.io_g_devel_message_57717&d=DwIFAg&c=C5b8zRQO1mi
GmBeVZ2LFWg&r=_SN6FZBN4Vgi4Ulkskz6qU3NYRO03nHp9P7Z5q59A3E&m=
9XiZr_Ooj6nuzkV3BFWyksfxIu2yKQO1eNMFwbL6rQg&s=WJQevQaS_uw7gZl
_UevOSd1MtHe8INHmDKG9XfoEYbY&e=
Mute This Topic: INVALID URI REMOVED
3A__groups.io_mt_73168089_1779286&d=DwIFAg&c=C5b8zRQO1miGmBeV
Z2LFWg&r=_SN6FZBN4Vgi4Ulkskz6qU3NYRO03nHp9P7Z5q59A3E&m=9XiZr_
Ooj6nuzkV3BFWyksfxIu2yKQO1eNMFwbL6rQg&s=juUmLTBdfN4ddFcopYqB
gLJUVjCagN1agT2OuvTKdbo&e=
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: INVALID URI REMOVED
3A__edk2.groups.io_g_devel_unsub&d=DwIFAg&c=C5b8zRQO1miGmBeVZ2
LFWg&r=_SN6FZBN4Vgi4Ulkskz6qU3NYRO03nHp9P7Z5q59A3E&m=9XiZr_Ooj
6nuzkV3BFWyksfxIu2yKQO1eNMFwbL6rQg&s=Ih-
auq26FKty6hI3MQyDE2sorxHasKRnwfOewuT2xkU&e=
[zhiguang.liu@...]
-=-=-=-=-=-=


Re: [edk2-staging/EdkRepo] [PATCH 2/2] EdkRepo: Update pull_latest_manifest_repo to use pull_single_manifest_repo

Nate DeSimone
 

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

´╗┐On 4/21/20, 2:47 PM, "Desimone, Ashley E" <ashley.e.desimone@...> wrote:

Updates the implementation for pull_latest_manifest_repo to
call pull_single_manifest repo.
Removes definitions of strings used by pull_latest_manifest_repo
from common/humble.py and from the imports of
common_repo_functions.py

Signed-off-by: Ashley E Desimone <ashley.e.desimone@...>
Cc: Nate DeSimone <nathaniel.l.desimone@...>
Cc: Puja Pandya <puja.pandya@...>
Cc: Erik Bjorge <erik.c.bjorge@...>
Cc: Bret Barkelew <Bret.Barkelew@...>
Cc: Prince Agyeman <prince.agyeman@...>
---
edkrepo/common/common_repo_functions.py | 33 ++++-----------------------------
edkrepo/common/humble.py | 8 --------
2 files changed, 4 insertions(+), 37 deletions(-)

diff --git a/edkrepo/common/common_repo_functions.py b/edkrepo/common/common_repo_functions.py
index 0d39291..3ec171a 100644
--- a/edkrepo/common/common_repo_functions.py
+++ b/edkrepo/common/common_repo_functions.py
@@ -46,12 +46,10 @@ from edkrepo.common.humble import COMMIT_TEMPLATE_NOT_FOUND, COMMIT_TEMPLATE_CUS
from edkrepo.common.humble import ADD_PRIMARY_REMOTE, REMOVE_PRIMARY_REMOTE
from edkrepo.common.humble import FETCH_PRIMARY_REMOTE, MIRROR_PRIMARY_SHA, TAG_AND_BRANCH_SPECIFIED
from edkrepo.common.humble import MIRROR_BEHIND_PRIMARY_REPO, HOOK_NOT_FOUND_ERROR, SUBMODULE_FAILURE
-from edkrepo.common.humble import MANIFEST_REPO_DIRTY, MANIFEST_REPO_MOVED, CLONING_MANIFEST_REPO, SYNCING_MANIFEST_REPO
from edkrepo.common.humble import INCLUDED_URL_LINE, INCLUDED_INSTEAD_OF_LINE, INCLUDED_FILE_NAME
from edkrepo.common.humble import ERROR_WRITING_INCLUDE, MULTIPLE_SOURCE_ATTRIBUTES_SPECIFIED
from edkrepo.common.humble import VERIFY_GLOBAL, VERIFY_ARCHIVED, VERIFY_PROJ, VERIFY_PROJ_FAIL
-from edkrepo.common.humble import VERIFY_PROJ_NOT_IN_INDEX, VERIFY_GLOBAL_FAIL, MANIFEST_REPO_NOT_CONFIG_BRANCH
-from edkrepo.common.humble import MANIFEST_REPO_CHECKOUT_CONFIG_BRANCH
+from edkrepo.common.humble import VERIFY_PROJ_NOT_IN_INDEX, VERIFY_GLOBAL_FAIL
from edkrepo.common.pathfix import get_actual_path
from project_utils.sparse import BuildInfo, process_sparse_checkout
from edkrepo.config.config_factory import get_workspace_path
@@ -61,6 +59,7 @@ from edkrepo_manifest_parser.edk_manifest import CiIndexXml, ManifestXml
from edkrepo.common.edkrepo_exception import EdkrepoNotFoundException, EdkrepoGitException, EdkrepoWarningException
from edkrepo.common.edkrepo_exception import EdkrepoFoundMultipleException, EdkrepoHookNotFoundException
from edkrepo.common.edkrepo_exception import EdkrepoGitConfigSetupException, EdkrepoManifestInvalidException
+from edkrepo.common.workspace_mgmt.manifest_repos_mgmt import pull_single_manifest_repo
from edkrepo.common.ui_functions import init_color_console
from edkrepo_manifest_parser import edk_manifest
from edkrepo_manifest_parser.edk_manifest_validation import validate_manifestrepo
@@ -77,32 +76,8 @@ def pull_latest_manifest_repo(args, config, reset_hard=False):
branch = config['cfg_file'].manifest_repo_branch
local_path = config['cfg_file'].manifest_repo_local_path
init_color_console(False)
- if not (os.path.isabs(local_path)):
- #since only a relative path was specified it must be joined to the Edkrepo Application Data Directory
- local_path = os.path.join(get_edkrepo_global_data_directory(), local_path)
- if not os.path.exists(local_path):
- print (CLONING_MANIFEST_REPO.format(local_path, repo_url))
- repo = Repo.clone_from(repo_url, local_path, progress=GitProgressHandler(), branch=branch)
- else:
- repo = Repo(local_path)
- if repo_url in repo.remotes['origin'].urls:
- if repo.is_dirty(untracked_files=True) and not reset_hard:
- raise EdkrepoWarningException(MANIFEST_REPO_DIRTY)
- elif repo.is_dirty(untracked_files=True) and reset_hard:
- repo.git.reset('--hard')
- print (SYNCING_MANIFEST_REPO)
- if repo.active_branch.name != branch:
- print(MANIFEST_REPO_NOT_CONFIG_BRANCH.format(repo.active_branch.name))
- print(MANIFEST_REPO_CHECKOUT_CONFIG_BRANCH.format(branch))
- repo.git.checkout(branch)
- repo.remotes.origin.pull()
- else:
- new_path = generate_name_for_obsolete_backup(local_path)
- new_path = os.path.join(os.path.dirname(local_path), new_path)
- print(MANIFEST_REPO_MOVED.format(new_path))
- shutil.move(local_path, new_path)
- print (CLONING_MANIFEST_REPO.format(local_path, repo_url))
- repo = Repo.clone_from(repo_url, local_path, progress=GitProgressHandler(), branch=branch)
+ pull_single_manifest_repo(repo_url, branch, local_path, reset_hard)
+

def clone_repos(args, workspace_dir, repos_to_clone, project_client_side_hooks, config, skip_submodule, manifest):
for repo_to_clone in repos_to_clone:
diff --git a/edkrepo/common/humble.py b/edkrepo/common/humble.py
index 64b9519..8ca38bb 100644
--- a/edkrepo/common/humble.py
+++ b/edkrepo/common/humble.py
@@ -34,14 +34,6 @@ MULTIPLE_SOURCE_ATTRIBUTES_SPECIFIED = 'BRANCH or TAG name present with COMMIT I
TAG_AND_BRANCH_SPECIFIED = 'BRANCH AND TAG name present in combination field for {} repo. Using TAG.\n'
CHECKING_CONNECTION = 'Checking connection to remote url: {}\n'

-# Informational messages and warnings for pull_latest_manifest_repo()
-MANIFEST_REPO_DIRTY = 'Uncommited changes present in the global manifest repository. Run edkrepo update-manifest-repo --hard to revert these changes and sync the global manifest repository.\n'
-MANIFEST_REPO_MOVED = '{}{}WARNING:{}{} The Global manifest repository has moved. Backing up previous global manifest repository to: {{}}{}\n'.format(Style.BRIGHT, Fore.RED, Style.RESET_ALL, Fore.RED, Style.RESET_ALL)
-CLONING_MANIFEST_REPO = 'Cloning global manifest repository to: {} from: {}\n'
-SYNCING_MANIFEST_REPO = 'Syncing the global manifest repository.\n'
-MANIFEST_REPO_NOT_CONFIG_BRANCH = 'The current active branch, {}, is not the specified manifest repository branch'
-MANIFEST_REPO_CHECKOUT_CONFIG_BRANCH = 'Checking out the specified manifest repository branch, {}, prior to syncing'
-
#Error messages for sync_command.py
SYNC_EXIT = 'Exiting without performing sync operations.'
SYNC_UNCOMMITED_CHANGES = UNCOMMITED_CHANGES + SYNC_EXIT
--
2.16.2.windows.1