Date   

[Patch 1/1] UefiCpuPkg/Library/MpInitLib: Fix AP VolatileRegisters race condition

Michael D Kinney
 

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

Fix the order of operations in ApWakeupFunction() when PcdCpuApLoopMode
is set to HLT mode that uses INIT-SIPI-SIPI to wake APs. In this mode,
volatile state is restored and saved each time a INIT-SIPI-SIPI is sent
to an AP to request a function to be executed on the AP. When the
function is completed the volatile state of the AP is saved. However,
the counters NumApsExecuting and FinishedCount are updated before
the volatile state is saved. This allows for a race condition window
for the BSP that is waiting on these counters to request a new
INIT-SIPI-SIPI before all the APs have completely saved their volatile
state. The fix is to save the AP volatile state before updating the
NumApsExecuting and FinishedCount counters.

Cc: Eric Dong <eric.dong@...>
Cc: Ray Ni <ray.ni@...>
Cc: Laszlo Ersek <lersek@...>
Cc: Rahul Kumar <rahul1.kumar@...>
Signed-off-by: Michael D Kinney <michael.d.kinney@...>
---
UefiCpuPkg/Library/MpInitLib/MpLib.c | 31 ++++++++++++++++------------
1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 681fa79b4cff..8b1f7f84bad6 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -769,15 +769,6 @@ ApWakeupFunction (
RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters, FALSE);
InitializeApData (CpuMpData, ProcessorNumber, BistData, ApTopOfStack);
ApStartupSignalBuffer = CpuMpData->CpuData[ProcessorNumber].StartupApSignal;
-
- //
- // Delay decrementing the APs executing count when SEV-ES is enabled
- // to allow the APs to issue an AP_RESET_HOLD before the BSP possibly
- // performs another INIT-SIPI-SIPI sequence.
- //
- if (!CpuMpData->SevEsIsEnabled) {
- InterlockedDecrement ((UINT32 *) &CpuMpData->MpCpuExchangeInfo->NumApsExecuting);
- }
} else {
//
// Execute AP function if AP is ready
@@ -866,19 +857,33 @@ ApWakeupFunction (
}
}

+ if (CpuMpData->ApLoopMode == ApInHltLoop) {
+ //
+ // Save AP volatile registers
+ //
+ SaveVolatileRegisters (&CpuMpData->CpuData[ProcessorNumber].VolatileRegisters);
+ }
+
//
// AP finished executing C code
//
InterlockedIncrement ((UINT32 *) &CpuMpData->FinishedCount);

+ if (CpuMpData->InitFlag == ApInitConfig) {
+ //
+ // Delay decrementing the APs executing count when SEV-ES is enabled
+ // to allow the APs to issue an AP_RESET_HOLD before the BSP possibly
+ // performs another INIT-SIPI-SIPI sequence.
+ //
+ if (!CpuMpData->SevEsIsEnabled) {
+ InterlockedDecrement ((UINT32 *) &CpuMpData->MpCpuExchangeInfo->NumApsExecuting);
+ }
+ }
+
//
// Place AP is specified loop mode
//
if (CpuMpData->ApLoopMode == ApInHltLoop) {
- //
- // Save AP volatile registers
- //
- SaveVolatileRegisters (&CpuMpData->CpuData[ProcessorNumber].VolatileRegisters);
//
// Place AP in HLT-loop
//
--
2.29.2.windows.2


[PATCH edk2-platforms v1 3/6] Platform/ARM: FVP: Fix serial port usage

Sami Mujawar
 

The serial ports on FVP are follows:
UART# Address Interrupt No.
----- ------- -------------
UART0 0x1c090000 0x25
UART1 0x1c0a0000 0x26
UART2 0x1c0b0000 0x27
UART3 0x1c0c0000 0x28

See Fast Model Reference Manual at:
https://developer.arm.com/documentation/100964/1113/

The FVP firmware configures the debug log output on UART1 and the
UEFI shell is configured to use UART0. The Serial Port Console
Redirector (SPCR) table is configured such that the UEFI shell is
migrated to the OS serial console.

When Dynamic Tables Framework is enabled, the FVP Configuration
Manager uses the PCDs PcdSerialRegisterBase and PL011UartInterrupt
to populate the SPCR table.
The current firmware implementation has two problems:
1. The PL011UartInterrupt was not set to the correct interrupt
number. Therefore, the OS serial console was not fully
functional (serial output was printed but input could not
be provided).
2. The OS serial console was setup on UART1, while it should
have been UART0.

Therefore, when Dynamic Tables Framework is enabled fix the UART
base address and interrupt number such that UART0 is configured
in the SPCR table. Also remove ConfigurationManager.dsc.inc as
this is now redundant.

Signed-off-by: Sami Mujawar <sami.mujawar@...>
---
Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc | 11 ++++++++---
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc | 19 -------------------
2 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc b/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc
index a6f536a332281a624403dac2e4bf18aa9ba96d0b..f8c703c4b22b2a26028ba0562e0eae5948c3292d 100644
--- a/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc
+++ b/Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011-2018, ARM Limited. All rights reserved.
+# Copyright (c) 2011-2021, ARM Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -34,7 +34,6 @@ [Defines]
!include Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
!ifdef DYNAMIC_TABLES_FRAMEWORK
!include DynamicTablesPkg/DynamicTables.dsc.inc
- !include Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc
!endif

[LibraryClasses.common]
@@ -126,7 +125,7 @@ [PcdsFixedAtBuild.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x1c0a0000
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200
gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|0
- gArmPlatformTokenSpaceGuid.PL011UartInterrupt|0x25
+ gArmPlatformTokenSpaceGuid.PL011UartInterrupt|0x26

## PL011 Serial Debug UART (DBG2)
gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase|0x1c0b0000
@@ -267,6 +266,12 @@ [Components.common]
!ifndef DYNAMIC_TABLES_FRAMEWORK
MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatformDxe.inf
Platform/ARM/VExpressPkg/AcpiTables/AcpiTables.inf
+!else
+ Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf {
+ <PcdsFixedAtBuild>
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x1c090000
+ gArmPlatformTokenSpaceGuid.PL011UartInterrupt|0x25
+ }
!endif

ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc
deleted file mode 100644
index 0915c154cce6b0686f67a383dc69231ed3ed6f36..0000000000000000000000000000000000000000
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc
+++ /dev/null
@@ -1,19 +0,0 @@
-## @file
-# dsc include file for Configuration Manager
-#
-# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-##
-
-[Defines]
-
-[BuildOptions]
-# Required for pre-processing ASL files that include ArmPlatform.h
- *_*_*_ASLPP_FLAGS = $(PLATFORM_FLAGS)
-
-[LibraryClasses.common]
-
-[Components.common]
- # Configuration Manager
- Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


[PATCH edk2-platforms v1 5/6] Platform/ARM: Juno: Remove Serial port SSDT

Sami Mujawar
 

Dynamic Tables Framework has been updated to add support for
Dynamic AML. The SPCR and DBG generators have also been updated
to dynamically generate the AML description for the Serial Ports.
Therefore, the SSDT serial port description is redundant when
Dynamic Tables Framework is enabled, so remove it.

Signed-off-by: Sami Mujawar <sami.mujawar@...>
---
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/SsdtUart.asl | 42 --------------------
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 7 ----
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h | 3 +-
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf | 3 +-
4 files changed, 2 insertions(+), 53 deletions(-)

diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/SsdtUart.asl b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/SsdtUart.asl
deleted file mode 100644
index 55a7ffc83fd6bb44ed9b9ca8b0a53e757aa2dd58..0000000000000000000000000000000000000000
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/SsdtUart.asl
+++ /dev/null
@@ -1,42 +0,0 @@
-/** @file
- SSDT for UART
-
- Copyright (c) 2014 - 2019, ARM Ltd. All rights reserved.<BR>
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-#include "ArmPlatform.h"
-
-DefinitionBlock("SsdtUart.aml", "SSDT", 1, "ARMLTD", "ARM-JUNO", EFI_ACPI_ARM_OEM_REVISION) {
- Scope(_SB) {
- // UART PL011
- Device(COM2) {
- Name(_HID, "ARMH0011")
- Name(_CID, "PL011")
- Name(_UID, Zero)
-
- Method(_STA) {
- Return (0xF)
- }
-
- Method(_CRS, 0x0, NotSerialized) {
- Name(RBUF, ResourceTemplate() {
- Memory32Fixed(
- ReadWrite,
- FixedPcdGet64 (PcdSerialRegisterBase),
- 0x1000
- )
- Interrupt(
- ResourceConsumer,
- Level,
- ActiveHigh,
- Exclusive
- ) {
- FixedPcdGet32 (PL011UartInterrupt)
- }
- })
- Return (RBUF)
- }
- }
- }
-}
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 8d92a8a666af4c5555343a929cb2d5063e54ffd5..80a98a10d869d48fc768db7bf5bfccb41f483fc3 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -83,13 +83,6 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = {
CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdt),
(EFI_ACPI_DESCRIPTION_HEADER*)ssdtjunousb_aml_code
},
- // SSDT table describing the PL011 UART
- {
- EFI_ACPI_6_2_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
- 0, // Unused
- CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdt),
- (EFI_ACPI_DESCRIPTION_HEADER*)ssdtuart_aml_code
- },
// PPTT Table
{
EFI_ACPI_6_3_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE,
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
index f382c7f967420c4fa8f272f3fee5c8f191999b23..771b00c31b9e168d2b416a87b8743d2e063f1744 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
@@ -19,7 +19,6 @@
extern CHAR8 dsdt_aml_code[];
extern CHAR8 ssdtjunousb_aml_code[];
extern CHAR8 ssdtpci_aml_code[];
-extern CHAR8 ssdtuart_aml_code[];

/** The configuration manager version
*/
@@ -116,7 +115,7 @@ typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) (

/** The number of ACPI tables to install
*/
-#define PLAT_ACPI_TABLE_COUNT 11
+#define PLAT_ACPI_TABLE_COUNT 10

/** The number of platform generic timer blocks
*/
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
index a3e7db12f8c913f7111b5ff4ad724a5bdcc35956..00be2c435bd6eefe4b26017608b62f085bb2d7f7 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
@@ -1,7 +1,7 @@
## @file
# Configuration Manager Dxe
#
-# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+# Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
@@ -25,7 +25,6 @@ [Sources]
AslTables/Dsdt.asl
AslTables/SsdtJunoUsb.asl
AslTables/SsdtPci.asl
- AslTables/SsdtUart.asl

[Packages]
ArmPkg/ArmPkg.dec
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


[PATCH edk2-platforms v1 4/6] Platform/ARM: Juno: Remove PL050 KMI description from DSDT

Sami Mujawar
 

Remove the PL050 PS/2 Keyboard/Mouse Interface (KMI) controller
description from the Juno DSDT as:
- PS/2 ports are now considered as legacy ports. Alternatively,
a USB Keyboard/Mouse can be connected to Juno USB ports.
- Concurrent usage of the Juno KMI and USB appear to trigger
I/O errors from the USB mass storage driver. This has proven
to be problematic as USB drivers typically cannot recover from
this issue.

Signed-off-by: Sami Mujawar <sami.mujawar@...>
---
Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl | 16 +---------------
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl | 16 +---------------
2 files changed, 2 insertions(+), 30 deletions(-)

diff --git a/Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl b/Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl
index 186fd6a471b45f43f407a620c1316c4b1006fba1..c17c74e174081836a61106224b687621854bcd29 100644
--- a/Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl
+++ b/Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl
@@ -1,7 +1,7 @@
/** @file
Differentiated System Description Table Fields (DSDT)

- Copyright (c) 2014-2018, ARM Ltd. All rights reserved.<BR>
+ Copyright (c) 2014-2021, ARM Ltd. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
@@ -233,20 +233,6 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-JUNO", EFI_ACPI_ARM_O
}

//
- // Keyboard and Mouse
- //
- Device(KMI0) {
- Name(_HID, "ARMH0501")
- Name(_CID, "PL050_KBD")
- Name(_CRS, ResourceTemplate() {
- Memory32Fixed(ReadWrite, 0x1C060008, 0x4)
- Memory32Fixed(ReadWrite, 0x1C060000, 0x4)
- Memory32Fixed(ReadOnly, 0x1C060004, 0x4)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 197 }
- })
- }
-
- //
// LAN9118 Ethernet
//
Device(ETH0) {
diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
index 6c045083873eecb02c7d3b4e25e8c28948f796af..63c70c1e4f060d089a3a02aee36a7e9cbf6ae6b0 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
@@ -1,7 +1,7 @@
/** @file
Differentiated System Description Table Fields (DSDT)

- Copyright (c) 2014 - 2019, ARM Ltd. All rights reserved.<BR>
+ Copyright (c) 2014 - 2021, ARM Ltd. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
@@ -233,20 +233,6 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-JUNO", EFI_ACPI_ARM_O
}

//
- // Keyboard and Mouse
- //
- Device(KMI0) {
- Name(_HID, "ARMH0501")
- Name(_CID, "PL050_KBD")
- Name(_CRS, ResourceTemplate() {
- Memory32Fixed(ReadWrite, 0x1C060008, 0x4)
- Memory32Fixed(ReadWrite, 0x1C060000, 0x4)
- Memory32Fixed(ReadOnly, 0x1C060004, 0x4)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 197 }
- })
- }
-
- //
// LAN9118 Ethernet
//
Device(ETH0) {
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


[PATCH edk2-platforms v1 0/6] Fix platform support for dynamic tables framework

Sami Mujawar
 

This patch series fixes the following issues for FVP & Juno platform
when Dynamic Tables Framework is enabled.
- Remove the usage of function macros as this does not comply with
the edk2 coding standard.
- Fix serial port usage on FVP.
- Remove serial port description from SSDT and DSDT as this is now
generated by Dynamic AML.

This series also includes a patch to remove PL050 KMI support on
Juno.

The changes can be seen at:
https://github.com/samimujawar/edk2-platforms/tree/1608_fix_config_mgr_handlers_v1

Sami Mujawar (6):
Platform/ARM: FVP: Remove usage of function macros
Platform/ARM: Juno: Remove usage of function macros
Platform/ARM: FVP: Fix serial port usage
Platform/ARM: Juno: Remove PL050 KMI description from DSDT
Platform/ARM: Juno: Remove Serial port SSDT
Platform/ARM: FVP: Remove Serial port description from DSDT

Platform/ARM/JunoPkg/AcpiTables/Dsdt.asl | 16 +-
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl | 16 +-
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/SsdtUart.asl | 42 --
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 455 ++++++++++++++------
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h | 107 +----
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf | 3 +-
Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc | 11 +-
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc | 19 -
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl | 22 +-
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 347 ++++++++++-----
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h | 73 +---
11 files changed, 615 insertions(+), 496 deletions(-)
delete mode 100644 Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/SsdtUart.asl
delete mode 100644 Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc

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


[PATCH edk2-platforms v1 6/6] Platform/ARM: FVP: Remove Serial port description from DSDT

Sami Mujawar
 

Dynamic Tables Framework has been updated to add support for
Dynamic AML. The SPCR and DBG generators have also been updated
to dynamically generate the AML description for the Serial Ports.
Therefore, the serial port description in the DSDT is redundant
when Dynamic Tables Framework is enabled, so remove it.

Signed-off-by: Sami Mujawar <sami.mujawar@...>
---
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl | 22 +-------------------
1 file changed, 1 insertion(+), 21 deletions(-)

diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
index 9192a0070772209e5cec8d7d9a71ea7a9e10aa69..eb5466229d1f10f465ca417166de5c1c1ea212e8 100644
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
@@ -1,7 +1,7 @@
/** @file
Differentiated System Description Table Fields (DSDT)

- Copyright (c) 2014-2017, ARM Ltd. All rights reserved.<BR>
+ Copyright (c) 2014-2021, ARM Ltd. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
@@ -43,25 +43,5 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-VEXP", 1) {
Name(_HID, "ACPI0007")
Name(_UID, 7)
}
-
- // UART PL011
- Device(COM2) {
- Name(_HID, "ARMH0011")
- Name(_CID, "PL011")
- Name(_UID, Zero)
-
- Method(_STA) {
- Return(0xF)
- }
-
- Method(_CRS, 0x0, NotSerialized) {
- Name(RBUF, ResourceTemplate() {
- Memory32Fixed(ReadWrite, 0x1c090000, 0x1000)
- Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x25 }
- })
- Return (RBUF)
- }
- }
-
} // Scope(_SB)
}
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


[PATCH edk2-platforms v1 1/6] Platform/ARM: FVP: Remove usage of function macros

Sami Mujawar
 

The Configuration Manager code for FVP uses function macros to
prepare and return CM objects.
However, according to section 5.5.2.1 of the edk2 coding standard,
use of functional macros is not allowed.
See https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/
5_source_files/55_preprocessor_directives#5-5-2-1-functional-macros-are-
generally-discouraged

Therefore, replace the function macros with static helper functions.

Signed-off-by: Sami Mujawar <sami.mujawar@...>
---
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 347 ++++++++++++++------
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h | 73 +---
2 files changed, 266 insertions(+), 154 deletions(-)

diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index a48eb0285c60177078324bdbcd8fa29c308e6a13..3298f9f9f79a2b23f181d3e961298f1c366976ee 100644
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -1,7 +1,7 @@
/** @file
Configuration Manager Dxe

- Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>

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

@@ -219,6 +219,98 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo = {
}
};

+/** A helper function for returning the Configuration Manager Objects.
+
+ @param [in] CmObjectId The Configuration Manager Object ID.
+ @param [in] Object Pointer to the Object(s).
+ @param [in] ObjectSize Total size of the Object(s).
+ @param [in] ObjectCount Number of Objects.
+ @param [in, out] CmObjectDesc Pointer to the Configuration Manager Object
+ descriptor describing the requested Object.
+
+ @retval EFI_SUCCESS Success.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+HandleCmObject (
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN VOID * Object,
+ IN CONST UINTN ObjectSize,
+ IN CONST UINTN ObjectCount,
+ IN OUT CM_OBJ_DESCRIPTOR * CONST CmObjectDesc
+ )
+{
+ CmObjectDesc->ObjectId = CmObjectId;
+ CmObjectDesc->Size = ObjectSize;
+ CmObjectDesc->Data = (VOID*)Object;
+ CmObjectDesc->Count = ObjectCount;
+ DEBUG ((
+ DEBUG_INFO,
+ "INFO: CmObjectId = %x, Ptr = 0x%p, Size = %d, Count = %d\n",
+ CmObjectId,
+ CmObjectDesc->Data,
+ CmObjectDesc->Size,
+ CmObjectDesc->Count
+ ));
+ return EFI_SUCCESS;
+}
+
+/** A helper function for returning the Configuration Manager Objects that
+ match the token.
+
+ @param [in] This Pointer to the Configuration Manager Protocol.
+ @param [in] CmObjectId The Configuration Manager Object ID.
+ @param [in] Object Pointer to the Object(s).
+ @param [in] ObjectSize Total size of the Object(s).
+ @param [in] ObjectCount Number of Objects.
+ @param [in] Token A token identifying the object.
+ @param [in] HandlerProc A handler function to search the object
+ referenced by the token.
+ @param [in, out] CmObjectDesc Pointer to the Configuration Manager Object
+ descriptor describing the requested Object.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object information is not found.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+HandleCmObjectRefByToken (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This,
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN VOID * Object,
+ IN CONST UINTN ObjectSize,
+ IN CONST UINTN ObjectCount,
+ IN CONST CM_OBJECT_TOKEN Token,
+ IN CONST CM_OBJECT_HANDLER_PROC HandlerProc,
+ IN OUT CM_OBJ_DESCRIPTOR * CONST CmObjectDesc
+ )
+{
+ EFI_STATUS Status;
+ CmObjectDesc->ObjectId = CmObjectId;
+ if (Token == CM_NULL_TOKEN) {
+ CmObjectDesc->Size = ObjectSize;
+ CmObjectDesc->Data = (VOID*)Object;
+ CmObjectDesc->Count = ObjectCount;
+ Status = EFI_SUCCESS;
+ } else {
+ Status = HandlerProc (This, CmObjectId, Token, CmObjectDesc);
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "INFO: Token = 0x%p, CmObjectId = %x, Ptr = 0x%p, Size = %d, Count = %d\n",
+ (VOID*)Token,
+ CmObjectId,
+ CmObjectDesc->Data,
+ CmObjectDesc->Size,
+ CmObjectDesc->Count
+ ));
+ return Status;
+}
+
/** Initialize the platform configuration repository.

@param [in] This Pointer to the Configuration Manager Protocol.
@@ -304,28 +396,36 @@ GetStandardNameSpaceObject (
EFI_STATUS Status;
EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo;

- Status = EFI_SUCCESS;
if ((This == NULL) || (CmObject == NULL)) {
ASSERT (This != NULL);
ASSERT (CmObject != NULL);
return EFI_INVALID_PARAMETER;
}
+
+ Status = EFI_NOT_FOUND;
PlatformRepo = This->PlatRepoInfo;

switch (GET_CM_OBJECT_ID (CmObjectId)) {
- HANDLE_CM_OBJECT (
- EStdObjCfgMgrInfo,
- CmObjectId,
- PlatformRepo->CmInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EStdObjAcpiTableList,
- CmObjectId,
- PlatformRepo->CmAcpiTableList,
- (sizeof (PlatformRepo->CmAcpiTableList) /
- sizeof (PlatformRepo->CmAcpiTableList[0]))
- );
+ case EStdObjCfgMgrInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->CmInfo,
+ sizeof (PlatformRepo->CmInfo),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EStdObjAcpiTableList:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->CmAcpiTableList,
+ sizeof (PlatformRepo->CmAcpiTableList),
+ ARRAY_SIZE (PlatformRepo->CmAcpiTableList),
+ CmObject
+ );
+ break;
+
default: {
Status = EFI_NOT_FOUND;
DEBUG ((
@@ -366,100 +466,149 @@ GetArmNameSpaceObject (
EFI_STATUS Status;
EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo;

- Status = EFI_SUCCESS;
if ((This == NULL) || (CmObject == NULL)) {
ASSERT (This != NULL);
ASSERT (CmObject != NULL);
return EFI_INVALID_PARAMETER;
}
+
+ Status = EFI_NOT_FOUND;
PlatformRepo = This->PlatRepoInfo;

switch (GET_CM_OBJECT_ID (CmObjectId)) {
- HANDLE_CM_OBJECT (
- EArmObjBootArchInfo,
- CmObjectId,
- PlatformRepo->BootArchInfo,
- 1
- );
+ case EArmObjBootArchInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->BootArchInfo,
+ sizeof (PlatformRepo->BootArchInfo),
+ 1,
+ CmObject
+ );
+ break;
+
#ifdef HEADLESS_PLATFORM
- HANDLE_CM_OBJECT (
- EArmObjFixedFeatureFlags,
- CmObjectId,
- PlatformRepo->FixedFeatureFlags,
- 1
- );
+ case EArmObjFixedFeatureFlags:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->FixedFeatureFlags,
+ sizeof (PlatformRepo->FixedFeatureFlags),
+ 1,
+ CmObject
+ );
+ break;
#endif
- HANDLE_CM_OBJECT (
- EArmObjPowerManagementProfileInfo,
- CmObjectId,
- PlatformRepo->PmProfileInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjGenericTimerInfo,
- CmObjectId,
- PlatformRepo->GenericTimerInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjPlatformGenericWatchdogInfo,
- CmObjectId,
- PlatformRepo->Watchdog,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjPlatformGTBlockInfo,
- CmObjectId,
- PlatformRepo->GTBlockInfo,
- (sizeof (PlatformRepo->GTBlockInfo) /
- sizeof (PlatformRepo->GTBlockInfo[0]))
- );
- HANDLE_CM_OBJECT_REF_BY_TOKEN (
- EArmObjGTBlockTimerFrameInfo,
- CmObjectId,
- PlatformRepo->GTBlock0TimerInfo,
- (sizeof (PlatformRepo->GTBlock0TimerInfo) /
- sizeof (PlatformRepo->GTBlock0TimerInfo[0])),
- Token,
- GetGTBlockTimerFrameInfo
- );
- HANDLE_CM_OBJECT (
- EArmObjGicCInfo,
- CmObjectId,
- PlatformRepo->GicCInfo,
- (sizeof (PlatformRepo->GicCInfo) /
- sizeof (PlatformRepo->GicCInfo[0]))
- );
- HANDLE_CM_OBJECT (
- EArmObjGicDInfo,
- CmObjectId,
- PlatformRepo->GicDInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjGicRedistributorInfo,
- CmObjectId,
- PlatformRepo->GicRedistInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjSerialConsolePortInfo,
- CmObjectId,
- PlatformRepo->SpcrSerialPort,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjSerialDebugPortInfo,
- CmObjectId,
- PlatformRepo->DbgSerialPort,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjGicItsInfo,
- CmObjectId,
- PlatformRepo->GicItsInfo,
- 1
- );
+ case EArmObjPowerManagementProfileInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->PmProfileInfo,
+ sizeof (PlatformRepo->PmProfileInfo),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjGenericTimerInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->GenericTimerInfo,
+ sizeof (PlatformRepo->GenericTimerInfo),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjPlatformGenericWatchdogInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->Watchdog,
+ sizeof (PlatformRepo->Watchdog),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjPlatformGTBlockInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ PlatformRepo->GTBlockInfo,
+ sizeof (PlatformRepo->GTBlockInfo),
+ ARRAY_SIZE (PlatformRepo->GTBlockInfo),
+ CmObject
+ );
+ break;
+
+ case EArmObjGTBlockTimerFrameInfo:
+ Status = HandleCmObjectRefByToken (
+ This,
+ CmObjectId,
+ PlatformRepo->GTBlock0TimerInfo,
+ sizeof (PlatformRepo->GTBlock0TimerInfo),
+ ARRAY_SIZE (PlatformRepo->GTBlock0TimerInfo),
+ Token,
+ GetGTBlockTimerFrameInfo,
+ CmObject
+ );
+ break;
+
+ case EArmObjGicCInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ PlatformRepo->GicCInfo,
+ sizeof (PlatformRepo->GicCInfo),
+ ARRAY_SIZE (PlatformRepo->GicCInfo),
+ CmObject
+ );
+ break;
+
+ case EArmObjGicDInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->GicDInfo,
+ sizeof (PlatformRepo->GicDInfo),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjGicRedistributorInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->GicRedistInfo,
+ sizeof (PlatformRepo->GicRedistInfo),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjSerialConsolePortInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->SpcrSerialPort,
+ sizeof (PlatformRepo->SpcrSerialPort),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjSerialDebugPortInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->DbgSerialPort,
+ sizeof (PlatformRepo->DbgSerialPort),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjGicItsInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->GicItsInfo,
+ sizeof (PlatformRepo->GicItsInfo),
+ 1,
+ CmObject
+ );
+ break;

default: {
Status = EFI_NOT_FOUND;
diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
index 6fb959ab7ae2c77f750781d05660957488fae8cd..c25ba9fac52fe049236948185dfc052c44a71e4b 100644
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
@@ -1,6 +1,6 @@
/** @file

- Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>

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

@@ -52,61 +52,24 @@ extern CHAR8 dsdt_aml_code[];
EnergyEfficiency /* UINT8 ProcessorPowerEfficiencyClass*/ \
}

-/** A helper macro for returning configuration manager objects
-*/
-#define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount) \
- case ObjId: { \
- CmObject->ObjectId = CmObjectId; \
- CmObject->Size = sizeof (Object); \
- CmObject->Data = (VOID*)&Object; \
- CmObject->Count = ObjectCount; \
- DEBUG (( \
- DEBUG_INFO, \
- #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n", \
- CmObject->Data, \
- CmObject->Size, \
- CmObject->Count \
- )); \
- break; \
- }
+/** A function that prepares Configuration Manager Objects for returning.

-/** A helper macro for returning configuration manager objects
- referenced by token
-*/
-#define HANDLE_CM_OBJECT_REF_BY_TOKEN( \
- ObjId, \
- CmObjectId, \
- Object, \
- ObjectCount, \
- Token, \
- HandlerProc \
- ) \
- case ObjId: { \
- CmObject->ObjectId = CmObjectId; \
- if (Token == CM_NULL_TOKEN) { \
- CmObject->Size = sizeof (Object); \
- CmObject->Data = (VOID*)&Object; \
- CmObject->Count = ObjectCount; \
- DEBUG (( \
- DEBUG_INFO, \
- #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n", \
- CmObject->Data, \
- CmObject->Size, \
- CmObject->Count \
- )); \
- } else { \
- Status = HandlerProc (This, CmObjectId, Token, CmObject); \
- DEBUG (( \
- DEBUG_INFO, \
- #CmObjectId ": Token = 0x%p, Ptr = 0x%p, Size = %d, Count = %d\n", \
- (VOID*)Token, \
- CmObject->Data, \
- CmObject->Size, \
- CmObject->Count \
- )); \
- } \
- break; \
- }
+ @param [in] This Pointer to the Configuration Manager Protocol.
+ @param [in] CmObjectId The Configuration Manager Object ID.
+ @param [in] Token A token for identifying the object.
+ @param [out] CmObject Pointer to the Configuration Manager Object
+ descriptor describing the requested Object.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object information is not found.
+**/
+typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This,
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token,
+ IN OUT CM_OBJ_DESCRIPTOR * CONST CmObject
+ );

/** The number of CPUs
*/
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


[PATCH edk2-platforms v1 2/6] Platform/ARM: Juno: Remove usage of function macros

Sami Mujawar
 

The Configuration Manager code for Juno uses function macros to
prepare and return CM objects.
However, according to section 5.5.2.1 of the edk2 coding standard,
use of functional macros is not allowed.
See https://edk2-docs.gitbook.io/edk-ii-c-coding-standards-specification/
5_source_files/55_preprocessor_directives#5-5-2-1-functional-macros-are-
generally-discouraged

Therefore, replace the function macros with static helper functions.

Signed-off-by: Sami Mujawar <sami.mujawar@...>
---
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 448 ++++++++++++++------
Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h | 104 +----
2 files changed, 336 insertions(+), 216 deletions(-)

diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 913cffc9b994319065b5292b0d28970a0a0d8320..8d92a8a666af4c5555343a929cb2d5063e54ffd5 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -1,7 +1,7 @@
/** @file
Configuration Manager Dxe

- Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>

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

@@ -559,6 +559,149 @@ EDKII_PLATFORM_REPOSITORY_INFO ArmJunoPlatformRepositoryInfo = {
}
};

+/** A helper function for returning the Configuration Manager Objects.
+
+ @param [in] CmObjectId The Configuration Manager Object ID.
+ @param [in] Object Pointer to the Object(s).
+ @param [in] ObjectSize Total size of the Object(s).
+ @param [in] ObjectCount Number of Objects.
+ @param [in, out] CmObjectDesc Pointer to the Configuration Manager Object
+ descriptor describing the requested Object.
+
+ @retval EFI_SUCCESS Success.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+HandleCmObject (
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN VOID * Object,
+ IN CONST UINTN ObjectSize,
+ IN CONST UINTN ObjectCount,
+ IN OUT CM_OBJ_DESCRIPTOR * CONST CmObjectDesc
+ )
+{
+ CmObjectDesc->ObjectId = CmObjectId;
+ CmObjectDesc->Size = ObjectSize;
+ CmObjectDesc->Data = (VOID*)Object;
+ CmObjectDesc->Count = ObjectCount;
+ DEBUG ((
+ DEBUG_INFO,
+ "INFO: CmObjectId = %x, Ptr = 0x%p, Size = %d, Count = %d\n",
+ CmObjectId,
+ CmObjectDesc->Data,
+ CmObjectDesc->Size,
+ CmObjectDesc->Count
+ ));
+ return EFI_SUCCESS;
+}
+
+/** A helper function for returning the Configuration Manager Objects that
+ match the token.
+
+ @param [in] This Pointer to the Configuration Manager Protocol.
+ @param [in] CmObjectId The Configuration Manager Object ID.
+ @param [in] Object Pointer to the Object(s).
+ @param [in] ObjectSize Total size of the Object(s).
+ @param [in] ObjectCount Number of Objects.
+ @param [in] Token A token identifying the object.
+ @param [in] HandlerProc A handler function to search the object
+ referenced by the token.
+ @param [in, out] CmObjectDesc Pointer to the Configuration Manager Object
+ descriptor describing the requested Object.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object information is not found.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+HandleCmObjectRefByToken (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This,
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN VOID * Object,
+ IN CONST UINTN ObjectSize,
+ IN CONST UINTN ObjectCount,
+ IN CONST CM_OBJECT_TOKEN Token,
+ IN CONST CM_OBJECT_HANDLER_PROC HandlerProc,
+ IN OUT CM_OBJ_DESCRIPTOR * CONST CmObjectDesc
+ )
+{
+ EFI_STATUS Status;
+ CmObjectDesc->ObjectId = CmObjectId;
+ if (Token == CM_NULL_TOKEN) {
+ CmObjectDesc->Size = ObjectSize;
+ CmObjectDesc->Data = (VOID*)Object;
+ CmObjectDesc->Count = ObjectCount;
+ Status = EFI_SUCCESS;
+ } else {
+ Status = HandlerProc (This, CmObjectId, Token, CmObjectDesc);
+ }
+
+ DEBUG ((
+ DEBUG_INFO,
+ "INFO: Token = 0x%p, CmObjectId = %x, Ptr = 0x%p, Size = %d, Count = %d\n",
+ (VOID*)Token,
+ CmObjectId,
+ CmObjectDesc->Data,
+ CmObjectDesc->Size,
+ CmObjectDesc->Count
+ ));
+ return Status;
+}
+
+/** A helper function for returning Configuration Manager Object(s) referenced
+ by token when the entire platform repository is in scope and the
+ CM_NULL_TOKEN value is not allowed.
+
+ @param [in] This Pointer to the Configuration Manager Protocol.
+ @param [in] CmObjectId The Configuration Manager Object ID.
+ @param [in] Token A token identifying the object.
+ @param [in] HandlerProc A handler function to search the object(s)
+ referenced by the token.
+ @param [in, out] CmObjectDesc Pointer to the Configuration Manager Object
+ descriptor describing the requested Object.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object information is not found.
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+HandleCmObjectSearchPlatformRepo (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This,
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token,
+ IN CONST CM_OBJECT_HANDLER_PROC HandlerProc,
+ IN OUT CM_OBJ_DESCRIPTOR * CONST CmObjectDesc
+ )
+{
+ EFI_STATUS Status;
+ CmObjectDesc->ObjectId = CmObjectId;
+ if (Token == CM_NULL_TOKEN) {
+ DEBUG ((
+ DEBUG_ERROR,
+ "ERROR: CM_NULL_TOKEN value is not allowed when searching"
+ " the entire platform repository.\n"
+ ));
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = HandlerProc (This, CmObjectId, Token, CmObjectDesc);
+ DEBUG ((
+ DEBUG_INFO,
+ "INFO: Token = 0x%p, CmObjectId = %x, Ptr = 0x%p, Size = %d, Count = %d\n",
+ CmObjectId,
+ (VOID*)Token,
+ CmObjectDesc->Data,
+ CmObjectDesc->Size,
+ CmObjectDesc->Count
+ ));
+ return Status;
+}
+
/** Initialize the platform configuration repository.

@param [in] This Pointer to the Configuration Manager Protocol.
@@ -760,46 +903,42 @@ GetStandardNameSpaceObject (
EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo;
UINT32 TableCount;

- Status = EFI_SUCCESS;
if ((This == NULL) || (CmObject == NULL)) {
ASSERT (This != NULL);
ASSERT (CmObject != NULL);
return EFI_INVALID_PARAMETER;
}
+
+ Status = EFI_NOT_FOUND;
PlatformRepo = This->PlatRepoInfo;

switch (GET_CM_OBJECT_ID (CmObjectId)) {
- HANDLE_CM_OBJECT (
- EStdObjCfgMgrInfo,
- CmObjectId,
- PlatformRepo->CmInfo,
- 1
- );
+ case EStdObjCfgMgrInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->CmInfo,
+ sizeof (PlatformRepo->CmInfo),
+ 1,
+ CmObject
+ );
+ break;

case EStdObjAcpiTableList:
- CmObject->ObjectId = CmObjectId;
- TableCount = sizeof (PlatformRepo->CmAcpiTableList) /
- sizeof (PlatformRepo->CmAcpiTableList[0]);
- if (PlatformRepo->JunoRevision != JUNO_REVISION_R0) {
- CmObject->Size = sizeof (PlatformRepo->CmAcpiTableList);
- CmObject->Count = TableCount;
- } else {
+ TableCount = ARRAY_SIZE (PlatformRepo->CmAcpiTableList);
+ if (PlatformRepo->JunoRevision == JUNO_REVISION_R0) {
/* The last 2 tables in the ACPI table list enable PCIe support.
- Reduce the CmObject size so that the PCIe specific ACPI
+ Reduce the TableCount so that the PCIe specific ACPI
tables are not installed on Juno R0
*/
- CmObject->Size = sizeof (PlatformRepo->CmAcpiTableList[0]) *
- (TableCount - 2);
- CmObject->Count = TableCount - 2;
+ TableCount -= 2;
}
- CmObject->Data = (VOID*)&PlatformRepo->CmAcpiTableList;
- DEBUG ((
- DEBUG_INFO,
- "EStdObjAcpiTableList: Ptr = 0x%p. Size = %d, Count = %d\n",
- CmObject->Data,
- CmObject->Size,
- CmObject->Count
- ));
+ Status = HandleCmObject (
+ CmObjectId,
+ PlatformRepo->CmAcpiTableList,
+ (sizeof (PlatformRepo->CmAcpiTableList[0]) * TableCount),
+ TableCount,
+ CmObject
+ );
break;

default: {
@@ -842,120 +981,171 @@ GetArmNameSpaceObject (
EFI_STATUS Status;
EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo;

- Status = EFI_SUCCESS;
if ((This == NULL) || (CmObject == NULL)) {
ASSERT (This != NULL);
ASSERT (CmObject != NULL);
return EFI_INVALID_PARAMETER;
}
+
+ Status = EFI_NOT_FOUND;
PlatformRepo = This->PlatRepoInfo;

switch (GET_CM_OBJECT_ID (CmObjectId)) {
- HANDLE_CM_OBJECT (
- EArmObjBootArchInfo,
- CmObjectId,
- PlatformRepo->BootArchInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjPowerManagementProfileInfo,
- CmObjectId,
- PlatformRepo->PmProfileInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjGenericTimerInfo,
- CmObjectId,
- PlatformRepo->GenericTimerInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjPlatformGenericWatchdogInfo,
- CmObjectId,
- PlatformRepo->Watchdog,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjPlatformGTBlockInfo,
- CmObjectId,
- PlatformRepo->GTBlockInfo,
- (sizeof (PlatformRepo->GTBlockInfo) /
- sizeof (PlatformRepo->GTBlockInfo[0]))
- );
- HANDLE_CM_OBJECT_REF_BY_TOKEN (
- EArmObjGTBlockTimerFrameInfo,
- CmObjectId,
- PlatformRepo->GTBlock0TimerInfo,
- (sizeof (PlatformRepo->GTBlock0TimerInfo) /
- sizeof (PlatformRepo->GTBlock0TimerInfo[0])),
- Token,
- GetGTBlockTimerFrameInfo
- );
- HANDLE_CM_OBJECT_REF_BY_TOKEN (
- EArmObjGicCInfo,
- CmObjectId,
- PlatformRepo->GicCInfo,
- ARRAY_SIZE (PlatformRepo->GicCInfo),
- Token,
- GetGicCInfo
- );
- HANDLE_CM_OBJECT (
- EArmObjGicDInfo,
- CmObjectId,
- PlatformRepo->GicDInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjSerialConsolePortInfo,
- CmObjectId,
- PlatformRepo->SpcrSerialPort,
- 1
- );
+ case EArmObjBootArchInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->BootArchInfo,
+ sizeof (PlatformRepo->BootArchInfo),
+ 1,
+ CmObject
+ );
+ break;
+ case EArmObjPowerManagementProfileInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->PmProfileInfo,
+ sizeof (PlatformRepo->PmProfileInfo),
+ 1,
+ CmObject
+ );
+ break;

- HANDLE_CM_OBJECT (
- EArmObjSerialDebugPortInfo,
- CmObjectId,
- PlatformRepo->DbgSerialPort,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjGicMsiFrameInfo,
- CmObjectId,
- PlatformRepo->GicMsiFrameInfo,
- 1
- );
- HANDLE_CM_OBJECT (
- EArmObjProcHierarchyInfo,
- CmObjectId,
- PlatformRepo->ProcHierarchyInfo,
- ARRAY_SIZE (PlatformRepo->ProcHierarchyInfo)
- );
- HANDLE_CM_OBJECT (
- EArmObjCacheInfo,
- CmObjectId,
- PlatformRepo->CacheInfo,
- ARRAY_SIZE (PlatformRepo->CacheInfo)
- );
- HANDLE_CM_OBJECT_SEARCH_PLAT_REPO (
- EArmObjCmRef,
- CmObjectId,
- Token,
- GetCmObjRefs
- );
+ case EArmObjGenericTimerInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->GenericTimerInfo,
+ sizeof (PlatformRepo->GenericTimerInfo),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjPlatformGenericWatchdogInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->Watchdog,
+ sizeof (PlatformRepo->Watchdog),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjPlatformGTBlockInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ PlatformRepo->GTBlockInfo,
+ sizeof (PlatformRepo->GTBlockInfo),
+ ARRAY_SIZE (PlatformRepo->GTBlockInfo),
+ CmObject
+ );
+ break;
+
+ case EArmObjGTBlockTimerFrameInfo:
+ Status = HandleCmObjectRefByToken (
+ This,
+ CmObjectId,
+ PlatformRepo->GTBlock0TimerInfo,
+ sizeof (PlatformRepo->GTBlock0TimerInfo),
+ ARRAY_SIZE (PlatformRepo->GTBlock0TimerInfo),
+ Token,
+ GetGTBlockTimerFrameInfo,
+ CmObject
+ );
+ break;
+
+ case EArmObjGicCInfo:
+ Status = HandleCmObjectRefByToken (
+ This,
+ CmObjectId,
+ PlatformRepo->GicCInfo,
+ sizeof (PlatformRepo->GicCInfo),
+ ARRAY_SIZE (PlatformRepo->GicCInfo),
+ Token,
+ GetGicCInfo,
+ CmObject
+ );
+ break;
+
+ case EArmObjGicDInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->GicDInfo,
+ sizeof (PlatformRepo->GicDInfo),
+ 1,
+ CmObject
+ );
+ break;
+ case EArmObjSerialConsolePortInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->SpcrSerialPort,
+ sizeof (PlatformRepo->SpcrSerialPort),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjSerialDebugPortInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->DbgSerialPort,
+ sizeof (PlatformRepo->DbgSerialPort),
+ 1,
+ CmObject
+ );
+ break;
+ case EArmObjGicMsiFrameInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->GicMsiFrameInfo,
+ sizeof (PlatformRepo->GicMsiFrameInfo),
+ 1,
+ CmObject
+ );
+ break;
+
+ case EArmObjProcHierarchyInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ PlatformRepo->ProcHierarchyInfo,
+ sizeof (PlatformRepo->ProcHierarchyInfo),
+ ARRAY_SIZE (PlatformRepo->ProcHierarchyInfo),
+ CmObject
+ );
+ break;
+
+ case EArmObjCacheInfo:
+ Status = HandleCmObject (
+ CmObjectId,
+ PlatformRepo->CacheInfo,
+ sizeof (PlatformRepo->CacheInfo),
+ ARRAY_SIZE (PlatformRepo->CacheInfo),
+ CmObject
+ );
+ break;
+
+ case EArmObjCmRef:
+ Status = HandleCmObjectSearchPlatformRepo (
+ This,
+ CmObjectId,
+ Token,
+ GetCmObjRefs,
+ CmObject
+ );
+ break;

case EArmObjPciConfigSpaceInfo:
if (PlatformRepo->JunoRevision != JUNO_REVISION_R0) {
- CmObject->ObjectId = CmObjectId;
- CmObject->Size = sizeof (PlatformRepo->PciConfigInfo);
- CmObject->Count = 1;
- CmObject->Data = (VOID*)&PlatformRepo->PciConfigInfo;
- DEBUG ((
- DEBUG_INFO,
- "EArmObjPciConfigSpaceInfo: Ptr = 0x%p, Size = %d, Count = %d\n",
- CmObject->Data,
- CmObject->Size,
- CmObject->Count
- ));
+ Status = HandleCmObject (
+ CmObjectId,
+ &PlatformRepo->PciConfigInfo,
+ sizeof (PlatformRepo->PciConfigInfo),
+ 1,
+ CmObject
+ );
+ } else {
+ // No PCIe on Juno R0.
+ Status = EFI_NOT_FOUND;
}
break;

diff --git a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
index 2073ae4902e540de869612353bfaf0ebacaea50d..f382c7f967420c4fa8f272f3fee5c8f191999b23 100644
--- a/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
+++ b/Platform/ARM/JunoPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
@@ -1,6 +1,6 @@
/** @file

- Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>

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

@@ -91,94 +91,24 @@ extern CHAR8 ssdtuart_aml_code[];
(WritePolicy << 4) \
)

-/** A helper macro for returning configuration manager objects
-*/
-#define HANDLE_CM_OBJECT(ObjId, CmObjectId, Object, ObjectCount) \
- case ObjId: { \
- CmObject->ObjectId = CmObjectId; \
- CmObject->Size = sizeof (Object); \
- CmObject->Data = (VOID*)&Object; \
- CmObject->Count = ObjectCount; \
- DEBUG (( \
- DEBUG_INFO, \
- #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n", \
- CmObject->Data, \
- CmObject->Size, \
- CmObject->Count \
- )); \
- break; \
- }
+/** A function that prepares Configuration Manager Objects for returning.

-/** A helper macro for returning configuration manager objects
- referenced by token
-*/
-#define HANDLE_CM_OBJECT_REF_BY_TOKEN( \
- ObjId, \
- CmObjectId, \
- Object, \
- ObjectCount, \
- Token, \
- HandlerProc \
- ) \
- case ObjId: { \
- CmObject->ObjectId = CmObjectId; \
- if (Token == CM_NULL_TOKEN) { \
- CmObject->Size = sizeof (Object); \
- CmObject->Data = (VOID*)&Object; \
- CmObject->Count = ObjectCount; \
- DEBUG (( \
- DEBUG_INFO, \
- #CmObjectId ": Ptr = 0x%p, Size = %d, Count = %d\n", \
- CmObject->Data, \
- CmObject->Size, \
- CmObject->Count \
- )); \
- } else { \
- Status = HandlerProc (This, CmObjectId, Token, CmObject); \
- DEBUG (( \
- DEBUG_INFO, \
- #CmObjectId ": Token = 0x%p, Ptr = 0x%p, Size = %d, Count = %d\n", \
- (VOID*)Token, \
- CmObject->Data, \
- CmObject->Size, \
- CmObject->Count \
- )); \
- } \
- break; \
- }
+ @param [in] This Pointer to the Configuration Manager Protocol.
+ @param [in] CmObjectId The Configuration Manager Object ID.
+ @param [in] Token A token for identifying the object.
+ @param [out] CmObject Pointer to the Configuration Manager Object
+ descriptor describing the requested Object.

-/** A helper macro for returning configuration manager objects referenced
- by token when the entire platform repository is in scope and the
- CM_NULL_TOKEN value is not allowed.
-*/
-#define HANDLE_CM_OBJECT_SEARCH_PLAT_REPO( \
- ObjId, \
- CmObjectId, \
- Token, \
- HandlerProc \
- ) \
- case ObjId: { \
- CmObject->ObjectId = CmObjectId; \
- if (Token == CM_NULL_TOKEN) { \
- Status = EFI_INVALID_PARAMETER; \
- DEBUG (( \
- DEBUG_ERROR, \
- #ObjId ": CM_NULL_TOKEN value is not allowed when searching" \
- " the entire platform repository.\n" \
- )); \
- } else { \
- Status = HandlerProc (This, CmObjectId, Token, CmObject); \
- DEBUG (( \
- DEBUG_INFO, \
- #ObjId ": Token = 0x%p, Ptr = 0x%p, Size = %d, Count = %d\n", \
- (VOID*)Token, \
- CmObject->Data, \
- CmObject->Size, \
- CmObject->Count \
- )); \
- } \
- break; \
- }
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND The required object information is not found.
+**/
+typedef EFI_STATUS (*CM_OBJECT_HANDLER_PROC) (
+ IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL * CONST This,
+ IN CONST CM_OBJECT_ID CmObjectId,
+ IN CONST CM_OBJECT_TOKEN Token,
+ IN OUT CM_OBJ_DESCRIPTOR * CONST CmObject
+ );

/** The number of CPUs
*/
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


Re: [PATCH v1 01/10] Silicon/Phytium/: added PhytiumPlatformLib to Phytium2000-4

Leif Lindholm
 

On Fri, Jan 15, 2021 at 08:47:53 +0000, Ling Jia wrote:
From: Ling <jialing@...>

The PhytiumPlatformLib supported the system
library for Phytium2000-4 chip.
Maintainers.txt: Adds maintainers and reviewers for the DurianPkg.

Cc: Leif Lindholm <leif@...>
Signed-off-by: Ling Jia <jialing@...>
Signed-off-by: Peng Xie <xiepeng@...>
Reviewed-by: Yiqi Shu <shuyiqi@...>
Please include only your own Signed-off-by:.
This indicates the poster confirming the submission's conformance with
the developer certificate of origin. The poster cannot make the same
claim on the behalf of someone else.

Also, please do not include any internal "Reviewed-by:" statements in
the posted patch. Reviewed-by: is added to subsequent submissions
after reviewers have given them in replies to the mailing list. Or by
the maintainer pushing the patches, for the final version.

---
Silicon/Phytium/Phytium.dec | 60 +++
Silicon/Phytium/Phytium.dsc.inc | 388 ++++++++++++++++++++
Platform/Phytium/Durian/DurianPkg.dsc | 302 +++++++++++++++
Platform/Phytium/Durian/DurianPkg.fdf | 199 ++++++++++
Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLib.inf | 66 ++++
Silicon/Phytium/Include/PhytiumSystemServiceInterface.h | 112 ++++++
Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLib.c | 135 +++++++
Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLibMem.c | 148 ++++++++
Maintainers.txt | 7 +
Silicon/Phytium/Phytium.fdf.inc | 119 ++++++
Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/AArch64/PhytiumPlatformHelper.S | 76 ++++
11 files changed, 1612 insertions(+)

diff --git a/Silicon/Phytium/Phytium.dec b/Silicon/Phytium/Phytium.dec
new file mode 100644
index 000000000000..a064fd60a9c5
--- /dev/null
+++ b/Silicon/Phytium/Phytium.dec
@@ -0,0 +1,60 @@
+## @file
+# This package provides common open source Phytium silicon modules.
+#
+# Copyright (C) 2020, Phytium Technology Co,Ltd. All rights reserved.
+#
+# SPDX-License-Identifier:BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010005
This is correct, but a very old version.
Unless you are building with a *very* old version of BaseTools, it
would make sense to specify a recent version.

These can be found for all tianocore configuration file formats at
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Documentation

Note that these versions can also be expressed in decimal form.
0x00010005 corresponds to 1.5.
The current .dec format, 1.27, would be written in hexadecimal as
0x0001001b.

Please consider updating this across all config files.

+ PACKAGE_NAME = PhytiumPkg
This is the file I would like to see as
Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec.
If it is renamed, this PACKAGE_NAME should be changed to PhytiumCommonPkg.

+ PACKAGE_GUID = b34af0b4-3e7c-11eb-a9d0-0738806d2dec
+ PACKAGE_VERSION = 0.1
+
+################################################################################
+#
+# Include Section - list of Include Paths that are provided by this package.
+# Comments are used for Keywords and Module Types.
+#
+# Supported Module Types:
+# BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION
+#
+################################################################################
+[Includes]
+ Include # Root include for the package
+
+[Guids.common]
+ gPhytiumPlatformTokenSpaceGuid = { 0x8c3abed4, 0x1fc8, 0x46d3, { 0xb4, 0x17, 0xa3, 0x22, 0x38, 0x14, 0xde, 0x76 } }
+ gPhytiumPlatformMemoryInforGuid = { 0xe5d0f31b, 0x18b2, 0x4ec1, { 0xba, 0x20, 0x9c, 0x6d, 0xb7, 0x87, 0x91, 0x79 } }
This does not appear to be used?
It is declared in some .inf files, but never referenced.

+ gPhytiumPlatformCpuInforGuid = { 0x60c3c4b0, 0xe189, 0x4cbb, { 0x88, 0x6a, 0x96, 0x87, 0x21, 0xe0, 0xe0, 0xb0 } }
Same as above.

+ gPhytiumPlatformPciHostInforGuid = { 0x24b99cf4, 0x2e51, 0x440e, { 0x8c, 0x7a, 0xea, 0xa2, 0xe0, 0x29, 0x32, 0xf } }
Same as above.

+ gShellSfHiiGuid = {0x7e57433d, 0x1016, 0x407a, { 0x9d, 0xb8, 0xf9, 0x56, 0x12, 0x19, 0x66, 0x16 } }
This does not appear to be used at all, even in .inf?

+
+[PcdsFixedAtBuild.common]
+ #
+ # PCI configuration address space
Not PCI?

+ #
+ gPhytiumPlatformTokenSpaceGuid.PcdSystemIoBase|0x0|UINT64|0x00000000
+ gPhytiumPlatformTokenSpaceGuid.PcdSystemIoSize|0x0|UINT64|0x00000001
+
+ #
+ # PCI configuration address space
+ #
+ gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x00000002
+ gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x00000003
+
+ #
+ # SPI Flash Controller Register Base Address and Size
+ #
+ gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase|0x0|UINT64|0x00000004
+ gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x00000005
+ gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x00000006
+ gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x00000007
+ gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress|0x0|UINT32|0x00000008
+ gPhytiumPlatformTokenSpaceGuid.PcdLogoFile |{ 0x99, 0x8b, 0xAA, 0x7B, 0xBB, 0x61, 0xD5, 0x11, 0x9A, 0x5D, 0xBB, 0x90, 0x27, 0x3F, 0xC2, 0x4D }|VOID*|0x40000013
+
+[Protocols]
+ gPhytiumSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}}
+ gPhytiumFlashProtocolGuid = { 0x00b4af42, 0xfbd0, 0x11ea, { 0x80, 0x3a, 0x27, 0xea, 0x5e, 0x65, 0xe3, 0xf6}}
diff --git a/Silicon/Phytium/Phytium.dsc.inc b/Silicon/Phytium/Phytium.dsc.inc
new file mode 100644
index 000000000000..15b66f6bd55d
--- /dev/null
+++ b/Silicon/Phytium/Phytium.dsc.inc
@@ -0,0 +1,388 @@
+## @file
+# This package provides common open source Phytium silicon modules.
+#
+# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved.
+#
+# SPDX-License-Identifier:BSD-2-Clause-Patent
+#
+##
+
+
+[LibraryClasses.common]
+ ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
+ HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
+
+!if $(TARGET) == RELEASE
+ DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
+!else
+ DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
+!endif
+
+ DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
+ BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
+ SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
+ PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
+ PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
+ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
+ UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
+ CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+
+ UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
+ DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+ UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
+ DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
+ UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
+ UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
+ HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+ UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
+
+ UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
+ FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
+ HttpLib|NetworkPkg/Library/DxeHttpLib/DxeHttpLib.inf
+
+ #
+ # Assume everything is fixed at build
+ #
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ #BaseMemoryLib|MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
Could delete commented-out line.

+ BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
+
+ # ARM Architectural Libraries
+ CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
+ DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
+ CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf
+ ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf
+ ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf
+ ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf
+ ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
+ ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
+ ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
+ ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf
+
+ ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+
+ TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
+ PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
+
+ #
+ # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window
+ # in the debugger will show load and unload commands for symbols. You can cut and paste this
+ # into the command window to load symbols. We should be able to use a script to do this, but
+ # the version of RVD I have does not support scripts accessing system memory.
+ #
+ PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
+ DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
+ DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf
+ AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf
+ FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
+ ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
+ FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
+ SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
+
+ #
+ TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
+ AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
+ PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
+ VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+ VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
+ CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+
+ # Scsi Requirements
+ UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
+
+ # USB Requirements
+ UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
+
+ # Networking Requirements
+ NetLib|NetworkPkg/Library/DxeNetLib/DxeNetLib.inf
+ DpcLib|NetworkPkg/Library/DxeDpcLib/DxeDpcLib.inf
+ UdpIoLib|NetworkPkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
+ IpIoLib|NetworkPkg/Library/DxeIpIoLib/DxeIpIoLib.inf
+
+ CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
+ IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+ OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
+ RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
+
+ BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+ ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+ BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
+ SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
+
+ UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+ PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
+ BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
+
+[LibraryClasses.common.SEC]
+ DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.inf
+ PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
+ ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
+ LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
+ MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf
+ HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf
+ PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
+ PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
+ ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
+
+[LibraryClasses.common.SEC, LibraryClasses.common.PEIM]
+ MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
+
+[LibraryClasses.common.DXE_CORE]
+ HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
+ MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
+ DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
+ ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+ PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
+
+[LibraryClasses.common.DXE_DRIVER]
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+ SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
+ PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
+
+[LibraryClasses.common.UEFI_APPLICATION]
+ PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
+
+ # UiApp dependencies
+ FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+
+[LibraryClasses.common.UEFI_DRIVER]
+ ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+ PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
+ DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+
+[LibraryClasses.common.DXE_RUNTIME_DRIVER]
+ HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
+ MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
+ CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
+ ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf
+
+!if $(SECURE_BOOT_ENABLE) == TRUE
+ BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
+!endif
+
+!if $(TARGET) != RELEASE
+ DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
+!endif
+ VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
+[LibraryClasses.AARCH64.DXE_RUNTIME_DRIVER]
+ #
+ # PSCI support in EL3 may not be available if we are not running under a PSCI
+ # compliant secure firmware, but since the default VExpress EfiResetSystemLib
+ # cannot be supported at runtime (due to the fact that the syscfg MMIO registers
+ # cannot be runtime remapped), it is our best bet to get ResetSystem functionality
+ # on these platforms.
+ #
The above comment should not be true anymore.
Presumably, you have a working PSCI implementation?

+ EfiResetSystemLib|ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf
+
+[LibraryClasses.ARM, LibraryClasses.AARCH64]
+ #
+ # It is not possible to prevent the ARM compiler for generic intrinsic functions.
+ # This library provides the instrinsic functions generate by a given compiler.
+ # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.
+ #
+ NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf
+
+ # Add support for GCC stack protector
+ NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
+
+[LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.DXE_DRIVER]
+ PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
+
+[BuildOptions]
+ RVCT:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
+ GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG
+
+[BuildOptions.AARCH64.EDKII.DXE_RUNTIME_DRIVER]
+ GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000
+
+################################################################################
+#
+# Pcd Section - list of all EDK II PCD Entries defined by this Platform
+#
+################################################################################
+
+[PcdsFeatureFlag.common]
+ # If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe.
+ # It could be set FALSE to save size.
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
+
+ # Force the UEFI GIC driver to use GICv2 legacy mode. To use
+ # GICv3 without GICv2 legacy in UEFI, the ARM Trusted Firmware needs
+ # to configure the Non-Secure interrupts in the GIC Redistributors
+ # which is not supported at the moment.
+ gArmTokenSpaceGuid.PcdArmGicV3WithV2Legacy|FALSE
+ gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|FALSE
+ gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|TRUE
+ gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|TRUE
+ gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE
+
+ gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE
+
+ gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE
+
+ # Use the Vector Table location in CpuDxe. We will not copy the Vector Table at PcdCpuVectorBaseAddress
+ gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE
+
+ # Indicates if EFI 1.1 ISO 639-2 language supports are obsolete
+ # TRUE - Deprecate global variable LangCodes.
+ # FALSE - Does not deprecate global variable LangCodes.
+ # Deprecate Global Variable LangCodes.
+ gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate|TRUE
+ gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE
+ gEfiMdeModulePkgTokenSpaceGuid.PcdPciBusHotplugDeviceSupport|FALSE
+
+[PcdsFixedAtBuild.common]
+ gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000
+ gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000
+ gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000
+ gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000
+ gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF
+ gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|0
+ gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0
+ gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320
+ gEfiNetworkPkgTokenSpaceGuid.PcdAllowHttpConnections|TRUE
+
+ # DEBUG_ASSERT_ENABLED 0x01
+ # DEBUG_PRINT_ENABLED 0x02
+ # DEBUG_CODE_ENABLED 0x04
+ # CLEAR_MEMORY_ENABLED 0x08
+ # ASSERT_BREAKPOINT_ENABLED 0x10
+ # ASSERT_DEADLOOP_ENABLED 0x20
+!if $(TARGET) == RELEASE
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21
+!else
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
+!endif
+
+ # DEBUG_INIT 0x00000001 // Initialization
+ # DEBUG_WARN 0x00000002 // Warnings
+ # DEBUG_LOAD 0x00000004 // Load events
+ # DEBUG_FS 0x00000008 // EFI File system
+ # DEBUG_POOL 0x00000010 // Alloc & Free's
+ # DEBUG_PAGE 0x00000020 // Alloc & Free's
+ # DEBUG_INFO 0x00000040 // Verbose
+ # DEBUG_DISPATCH 0x00000080 // PEI/DXE Dispatchers
+ # DEBUG_VARIABLE 0x00000100 // Variable
+ # DEBUG_BM 0x00000400 // Boot Manager
+ # DEBUG_BLKIO 0x00001000 // BlkIo Driver
+ # DEBUG_NET 0x00004000 // SNI Driver
+ # DEBUG_UNDI 0x00010000 // UNDI Driver
+ # DEBUG_LOADFILE 0x00020000 // UNDI Driver
+ # DEBUG_EVENT 0x00080000 // Event messages
+ # DEBUG_GCD 0x00100000 // Global Coherency Database changes
+ # DEBUG_CACHE 0x00200000 // Memory range cachability changes
+ # DEBUG_ERROR 0x80000000 // Error
+ gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000046
+
+ gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07
+
+ #gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|""
+ #gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07
+ #gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize|0x10000
The above threee lines can be deleted (the Pcds no longer exist in edk2).

+ # 20ms
+ gEmbeddedTokenSpaceGuid.PcdTimerPeriod|200000
+
+ #
+ # Optional feature to help prevent EFI memory map fragments
+ # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob
+ # Values are in EFI Pages (4K). DXE Core will make sure that
+ # at least this much of each type of memory can be allocated
+ # from a single memory range. This way you only end up with
+ # maximum of two fragements for each type in the memory map
+ # (the memory used, and the free memory that was prereserved
+ # but not used).
+ #
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|80
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|65
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|20000
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20
+ gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0
+
+ # RunAxf support via Dynamic Shell Command protocol
+ # We want to use the Shell Libraries but don't want it to initialise
+ # automatically. We initialise the libraries when the command is called by the
+ # Shell.
+ gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
+
+ gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
+
+!if $(SECURE_BOOT_ENABLE) == TRUE
+ # override the default values from SecurityPkg to ensure images from all sources are verified in secure boot
+ gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
+ gEfiSecurityPkgTokenSpaceGuid.PcdFixedMediaImageVerificationPolicy|0x04
+ gEfiSecurityPkgTokenSpaceGuid.PcdRemovableMediaImageVerificationPolicy|0x04
+!endif
+
+!if $(SECURE_BOOT_ENABLE) == TRUE
+ gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x10000
+!else
+ gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x4000
+!endif
+
+ # Default platform supported RFC 4646 languages: English & French & Chinese Simplified.
+ # Default Value of PlatformLangCodes Variable.
+ gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes|"en-US;zh-Hans"
+
+ # Default current RFC 4646 language: Chinese Simplified.
+ # Default Value of PlatformLang Variable.
+ gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang|"en-US"
+ gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4
+ #
+ # ACPI Table Version
+ #
+ gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x20
+ gArmPlatformTokenSpaceGuid.PL011UartInterrupt|67
+
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSrIovSupport|FALSE
+
+[PcdsDynamicDefault.common.DEFAULT]
+ ## This PCD defines the video horizontal resolution.
+ # This PCD could be set to 0 then video resolution could be at highest resolution.
+ gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|640
+ ## This PCD defines the video vertical resolution.
+ # This PCD could be set to 0 then video resolution could be at highest resolution.
+ gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|480
+
+ ## This PCD defines the Console output row and the default value is 80 according to UEFI spec.
+ # This PCD could be set to 0 then console output could be at max column and max row.
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|128
+ ## This PCD defines the Console output column and the default value is 25 according to UEFI spec.
+ # This PCD could be set to 0 then console output could be at max column and max row.
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|40
+
+ ## Specify the video horizontal resolution of text setup.
+ # @Prompt Video Horizontal Resolution of Text Setup
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640
+
+ ## Specify the video vertical resolution of text setup.
+ # @Prompt Video Vertical Resolution of Text Setup
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480
+
+ ## Specify the console output column of text setup.
+ # @Prompt Console Output Column of Text Setup
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn|128
+ ## Specify the console output row of text setup.
+ # @Prompt Console Output Row of Text Setup
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow|40
+
+ ## The number of seconds that the firmware will wait before initiating the original default boot selection.
+ # A value of 0 indicates that the default boot selection is to be initiated immediately on boot.
+ # The value of 0xFFFF then firmware will wait for user input before booting.
+ # @Prompt Boot Timeout (s)
+ gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|5
diff --git a/Platform/Phytium/Durian/DurianPkg.dsc b/Platform/Phytium/Durian/DurianPkg.dsc
new file mode 100644
index 000000000000..ef01cc217ace
--- /dev/null
+++ b/Platform/Phytium/Durian/DurianPkg.dsc
@@ -0,0 +1,302 @@
+## @file
+# This package provides common open source Phytium Platform modules.
+#
+# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved.
+#
+# SPDX-License-Identifier:BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# Defines Section - statements that will be processed to create a Makefile.
+#
+################################################################################
+[Defines]
+ PLATFORM_NAME = DurianPkg
+ PLATFORM_GUID = 8f7ac876-3e7c-11eb-86cb-33f68535d613
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
+ SUPPORTED_ARCHITECTURES = AARCH64
+ BUILD_TARGETS = DEBUG|RELEASE
Could you also add NOOPT?

+ SKUID_IDENTIFIER = DEFAULT
+ FLASH_DEFINITION = Platform/Phytium/Durian/DurianPkg.fdf
+
+!include Silicon/Phytium/Phytium.dsc.inc
+
+[LibraryClasses.common]
+ # Phytium Platform library
+ ArmPlatformLib|Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLib.inf
+
+ TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf
+
+ # PL011 UART Driver and Dependency Libraries
+ SerialPortLib|ArmPlatformPkg/Library/PL011SerialPortLib/PL011SerialPortLib.inf
+ PL011UartClockLib|ArmPlatformPkg/Library/PL011UartClockLib/PL011UartClockLib.inf
+ PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf
+
+[LibraryClasses.common.DXE_DRIVER]
+
+
+################################################################################
+#
+# Pcd Section - list of all EDK II PCD Entries defined by this Platform
+#
+################################################################################
+[PcdsFixedAtBuild.common]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor|L"Durian Platform"
+
+ gArmTokenSpaceGuid.PcdVFPEnabled|1
+ gArmTokenSpaceGuid.PcdArmPrimaryCoreMask|0x303
+
+ gArmPlatformTokenSpaceGuid.PcdCoreCount|4
+ gArmPlatformTokenSpaceGuid.PcdClusterCount|2
+
+ #
+ # NV Storage PCDs.
+ #
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0xe00000
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00010000
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0xe10000
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0xe20000
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000
+
+ # Size of the region used by UEFI in permanent memory (Reserved 64MB)
+ gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000
+
+ #
+ # PL011 - Serial Terminal
+ #
+ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x28001000
+ gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|0
+ gArmPlatformTokenSpaceGuid.PL011UartClkInHz|48000000
+ gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200
+
+
+ #
+ # ARM General Interrupt Controller
+ #
+ gArmTokenSpaceGuid.PcdGicDistributorBase|0x29900000
+ gArmTokenSpaceGuid.PcdGicRedistributorsBase|0x29980000
+ gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x29c00000
+
+ # System IO space
+ gPhytiumPlatformTokenSpaceGuid.PcdSystemIoBase|0x0
+ gPhytiumPlatformTokenSpaceGuid.PcdSystemIoSize|0x40000000
+
+ # System Memory (2GB ~ 4GB - 64MB), the top 64MB is reserved for PBF
What is PBF? The EL3 firmware? Please clarify in comment.

+ gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000
+ gArmTokenSpaceGuid.PcdSystemMemorySize|0x7B000000
+
+ # Stack Size
+ gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000
+
+ #
+ # Designware PCI Root Complex
+ #
+ gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x40000000
+ gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|28
+ gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x40000000
+ gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x10000000
+ gArmTokenSpaceGuid.PcdPciBusMin|0
+ gArmTokenSpaceGuid.PcdPciBusMax|255
+ gArmTokenSpaceGuid.PcdPciIoBase|0x00000
+ gArmTokenSpaceGuid.PcdPciIoSize|0xf00000
+ gArmTokenSpaceGuid.PcdPciIoTranslation|0x50000000
+ gArmTokenSpaceGuid.PcdPciMmio32Base|0x58000000
+ gArmTokenSpaceGuid.PcdPciMmio32Size|0x28000000
+ gArmTokenSpaceGuid.PcdPciMmio32Translation|0x0
+ gArmTokenSpaceGuid.PcdPciMmio64Base|0x1000000000
+ gArmTokenSpaceGuid.PcdPciMmio64Size|0x1000000000
+ gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration|FALSE
+
+ #
+ # SPI Flash Control Register Base Address and Size
+ #
+ gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase|0x0
+ gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x1000000
+ gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x28014000
+ gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x1000
+
+ #
+ # RTC I2C Controller Register Base Address and Speed
+ #
+ gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress|0x2800D000
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"V1.0"
Could make sense to move the firmware version string next to the
firmware vendor one.

+
+################################################################################
+#
+# Components Section - list of all EDK II Modules needed by this Platform
+#
+################################################################################
+[Components.common]
+ #
+ # PCD database
+ #
+ MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
+
+ ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf
+ ShellPkg/Application/Shell/Shell.inf {
+ <LibraryClasses>
+ ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
+ NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
+ NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
+ HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
+ PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
+ BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
+ }
+
+ ArmPlatformPkg/PrePi/PeiMPCore.inf {
+ <LibraryClasses>
+ ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
+ }
+
+ #
+ #Dxe core entry
+ #
+ MdeModulePkg/Core/Dxe/DxeMain.inf {
+ <LibraryClasses>
+ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
+ NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
+ }
+
+ #DXE driver
+ MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+ MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+ MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
+ <LibraryClasses>
+ NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
+ }
+ MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+ EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
+
+ #
+ # Common Arm Timer and Gic Components
+ #
+ ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+ ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
+ EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
+ ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+
+ #
+ # security system
+ #
+ MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf {
+ <LibraryClasses>
+ NULL|SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf
+ }
+
+ #
+ #network, mod for https boot.
+ #
+ NetworkPkg/SnpDxe/SnpDxe.inf
+ NetworkPkg/DpcDxe/DpcDxe.inf
+ NetworkPkg/MnpDxe/MnpDxe.inf
+ NetworkPkg/ArpDxe/ArpDxe.inf
+ NetworkPkg/Dhcp4Dxe/Dhcp4Dxe.inf
+ NetworkPkg/Ip4Dxe/Ip4Dxe.inf
+ NetworkPkg/Mtftp4Dxe/Mtftp4Dxe.inf
+ NetworkPkg/Udp4Dxe/Udp4Dxe.inf
+ NetworkPkg/VlanConfigDxe/VlanConfigDxe.inf
+
+ NetworkPkg/Ip6Dxe/Ip6Dxe.inf
+ NetworkPkg/Udp6Dxe/Udp6Dxe.inf
+ NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf
+ NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf
+ NetworkPkg/TcpDxe/TcpDxe.inf
+
+ NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf
+
+ NetworkPkg/DnsDxe/DnsDxe.inf
+ NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
+ NetworkPkg/HttpDxe/HttpDxe.inf
+ #NetworkPkg/HttpBootDxe/HttpBootDxe.inf
+
+ # FV Filesystem
+ MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf
+
+ #
+ # Common Console Components
+ #
+ # ConIn,ConOut,StdErr
+ MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+ MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
+ MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
+ MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+ MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
+
+ SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
+
+ #
+ # Hii database init
+ #
+ MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+
+ #
+ # FAT filesystem + GPT/MBR partitioning
+ #
+ MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+ MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
+ MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+ FatPkg/EnhancedFatDxe/Fat.inf
+
+ #
+ # Generic Watchdog Timer
+ #
+ ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
+
+ #
+ # Usb Support
+ #
+ MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf
+ MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
+ MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
+ MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
+ MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
+ MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
+ MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
+
+ #
+ # IDE/AHCI Support
+ #
+ MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf
+ MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
+ MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
+ MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
+ MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
+
+ #
+ # The following 2 module perform the same work except one operate variable.
+ # Only one of both should be put into fdf.
+ #
+ MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
+
+ #
+ # NVME Support
+ #
+ MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
+
+ #
+ # Bds
+ #
+ MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
+ MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
+ MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+ MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+ MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
+ MdeModulePkg/Application/UiApp/UiApp.inf {
+ <LibraryClasses>
+ NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf
+ NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf
+ NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
+ }
+ MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf
+
diff --git a/Platform/Phytium/Durian/DurianPkg.fdf b/Platform/Phytium/Durian/DurianPkg.fdf
new file mode 100644
index 000000000000..f2f4cbc9ac7f
--- /dev/null
+++ b/Platform/Phytium/Durian/DurianPkg.fdf
@@ -0,0 +1,199 @@
+## @file
+# This package provides common open source Phytium Platform modules.
+#
+# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved.
+#
+# SPDX-License-Identifier:BSD-2-Clause-Patent
+#
+##
+
+################################################################################
+#
+# FD Section
+# The [FD] Section is made up of the definition statements and a
+# description of what goes into the Flash Device Image. Each FD section
+# defines one flash "device" image. A flash device image may be one of
+# the following: Removable media bootable image (like a boot floppy
+# image,) an Option ROM image (that would be "flashed" into an add-in
+# card,) a System "Flash" image (that would be burned into a system's
+# flash) or an Update ("Capsule") image that will be used to update and
+# existing system flash.
+#
+################################################################################
+
+[FD.PHYTIUM]
+BaseAddress = 0x88000000|gArmTokenSpaceGuid.PcdFdBaseAddress
+Size = 0x01000000|gArmTokenSpaceGuid.PcdFdSize
+ErasePolarity = 1
+
+# This one is tricky, it must be: BlockSize * NumBlocks = Size
+BlockSize = 0x10000
+NumBlocks = 0x100
+
+################################################################################
+#
+# Following are lists of FD Region layout which correspond to the locations of different
+# images within the flash device.
+#
+# Regions must be defined in ascending order and may not overlap.
+#
+# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
+# the pipe "|" character, followed by the size of the region, also in hex with the leading
+# "0x" characters. Like:
+# Offset|Size
+# PcdOffsetCName|PcdSizeCName
+# RegionType <FV, DATA, or FILE>
+#
+################################################################################
+
+0x00000000|0x200000
+gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize
+FV = FVMAIN_COMPACT
+
+################################################################################
+#
+# FV Section
+#
+# [FV] section is used to define what components or modules are placed within a flash
+# device file. This section also defines order the components and modules are positioned
+# within the image. The [FV] section consists of define statements, set statements and
+# module statements.
+#
+################################################################################
+
+[FV.FvMain]
+BlockSize = 0x40
+NumBlocks = 0 # This FV gets compressed so make it just big enough
+FvAlignment = 16 # FV alignment and FV attributes setting.
+ERASE_POLARITY = 1
+MEMORY_MAPPED = TRUE
+STICKY_WRITE = TRUE
+LOCK_CAP = TRUE
+LOCK_STATUS = TRUE
+WRITE_DISABLED_CAP = TRUE
+WRITE_ENABLED_CAP = TRUE
+WRITE_STATUS = TRUE
+WRITE_LOCK_CAP = TRUE
+WRITE_LOCK_STATUS = TRUE
+READ_DISABLED_CAP = TRUE
+READ_ENABLED_CAP = TRUE
+READ_STATUS = TRUE
+READ_LOCK_CAP = TRUE
+READ_LOCK_STATUS = TRUE
+
+ APRIORI DXE {
+ INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
+ }
+
+ INF MdeModulePkg/Core/Dxe/DxeMain.inf
+ INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
+
+ #
+ # PI DXE Drivers producing Architectural Protocols (EFI Services)
+ #
+ #INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+ INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
+ INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
+ INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf
+ INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf
+
+ INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
+ INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
+
+ INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
+ INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf
+ INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
+ INF ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
+
+ # Variable services
+ INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
+ INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+
+ INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
+
+ #
+ # Multiple Console IO support
+ #
+ INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+ INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
+ INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
+ INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+ INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf
+
+ #
+ # FAT filesystem + GPT/MBR partitioning
+ #
+ INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
+ INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
+ INF FatPkg/EnhancedFatDxe/Fat.inf
+ INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
+
+ #
+ # SATA Controller
+ #
+ INF MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf
+ INF MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf
+ INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
+ INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
+ INF MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf
+
+ #
+ # NVMe boot devices
+ #
+ INF MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf
+
+ #
+ # NetWork
+ #
+ INF NetworkPkg/SnpDxe/SnpDxe.inf
+ INF NetworkPkg/DpcDxe/DpcDxe.inf
+ INF NetworkPkg/MnpDxe/MnpDxe.inf
+ INF NetworkPkg/ArpDxe/ArpDxe.inf
+ INF NetworkPkg/Dhcp4Dxe/Dhcp4Dxe.inf
+ INF NetworkPkg/Ip4Dxe/Ip4Dxe.inf
+ INF NetworkPkg/Mtftp4Dxe/Mtftp4Dxe.inf
+ INF NetworkPkg/Udp4Dxe/Udp4Dxe.inf
+ INF NetworkPkg/VlanConfigDxe/VlanConfigDxe.inf
+
+ #
+ # UEFI applications
+ #
+ INF ShellPkg/Application/Shell/Shell.inf
+
+ #
+ # Bds
+ #
+ INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
+ INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf
+ INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+ INF MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
+ INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+ INF MdeModulePkg/Application/UiApp/UiApp.inf
+
+[FV.FVMAIN_COMPACT]
+FvAlignment = 16
+ERASE_POLARITY = 1
+MEMORY_MAPPED = TRUE
+STICKY_WRITE = TRUE
+LOCK_CAP = TRUE
+LOCK_STATUS = TRUE
+WRITE_DISABLED_CAP = TRUE
+WRITE_ENABLED_CAP = TRUE
+WRITE_STATUS = TRUE
+WRITE_LOCK_CAP = TRUE
+WRITE_LOCK_STATUS = TRUE
+READ_DISABLED_CAP = TRUE
+READ_ENABLED_CAP = TRUE
+READ_STATUS = TRUE
+READ_LOCK_CAP = TRUE
+READ_LOCK_STATUS = TRUE
+
+ INF ArmPlatformPkg/PrePi/PeiMPCore.inf
+
+ FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {
+ SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE {
+ SECTION FV_IMAGE = FVMAIN
+ }
+ }
+
+!include Silicon/Phytium/Phytium.fdf.inc
diff --git a/Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLib.inf b/Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLib.inf
new file mode 100644
index 000000000000..7ad0f31549ef
--- /dev/null
+++ b/Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLib.inf
@@ -0,0 +1,66 @@
+#/** @file
+# Library for Phytium Platform.
+#
+# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#**/
+
+[Defines]
+ INF_VERSION = 0x00010019
+ BASE_NAME = PhytiumPlatformLib
+ FILE_GUID = fac08f56-40fe-11eb-a2a3-27b46864b1f3
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = ArmPlatformLib
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ EmbeddedPkg/EmbeddedPkg.dec
+ ArmPkg/ArmPkg.dec
+ ArmPlatformPkg/ArmPlatformPkg.dec
+ Silicon/Phytium/Phytium.dec
Can you please sort paths alphabetically - throughout all of the .inf
files in all the patches?

+
+[LibraryClasses]
+ IoLib
+ ArmLib
+ ArmSmcLib
+ MemoryAllocationLib
+ SerialPortLib
+ HobLib
+ BaseMemoryLib
And again for all the libraryclasses, sources, guids, fixedpcd, pcd...?
It makes it much quicker to read through the list.

+
+[Sources.common]
+ PhytiumPlatformLib.c
+ PhytiumPlatformLibMem.c
+
+[Sources.AARCH64]
+ AArch64/PhytiumPlatformHelper.S
+
+[Guids]
+ gPhytiumPlatformMemoryInforGuid
+ gPhytiumPlatformCpuInforGuid
+ gPhytiumPlatformPciHostInforGuid
+
+[FixedPcd]
+ gArmTokenSpaceGuid.PcdSystemMemoryBase
+ gArmTokenSpaceGuid.PcdSystemMemorySize
+ gPhytiumPlatformTokenSpaceGuid.PcdSystemIoBase
+ gPhytiumPlatformTokenSpaceGuid.PcdSystemIoSize
+ gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase
+ gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize
+ gArmTokenSpaceGuid.PcdPciBusMin
+ gArmTokenSpaceGuid.PcdPciBusMax
+ gArmTokenSpaceGuid.PcdPciIoBase
+ gArmTokenSpaceGuid.PcdPciIoSize
+ gArmTokenSpaceGuid.PcdPciIoTranslation
+ gArmTokenSpaceGuid.PcdPciMmio32Base
+ gArmTokenSpaceGuid.PcdPciMmio32Size
+ gArmTokenSpaceGuid.PcdPciMmio32Translation
+ gArmTokenSpaceGuid.PcdPciMmio64Base
+ gArmTokenSpaceGuid.PcdPciMmio64Size
+
+[Pcd]
+ gArmPlatformTokenSpaceGuid.PcdCoreCount
diff --git a/Silicon/Phytium/Include/PhytiumSystemServiceInterface.h b/Silicon/Phytium/Include/PhytiumSystemServiceInterface.h
new file mode 100644
index 000000000000..ddea33dbc275
--- /dev/null
+++ b/Silicon/Phytium/Include/PhytiumSystemServiceInterface.h
@@ -0,0 +1,112 @@
+/** @file
+
+ Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __OEMSVC_H_
+#define __OEMSVC_H_
Please don't use leading __ (or _) in macro names - they are reserved
for toolchain use.

+
+/* SMC function IDs for OEM Service queries */
+#define PHYTIUM_OEM_SVC_PSSI_VERSION 0x8200ff03
+#define PHYTIUM_OEM_SVC_PBF_VERSION 0x82000001
+#define PHYTIUM_OEM_SVC_CPU_VERSION 0xc2000002
+#define PHYTIUM_OEM_SVC_CPU_MAPS 0xc2000003
+#define PHYTIUM_OEM_SVC_CPU_CONF 0xc2000004
+#define PHYTIUM_OEM_SVC_MEM_REGIONS 0xc2000005
+#define PHYTIUM_OEM_SVC_MCU_DIMMS 0xc2000006
+#define PHYTIUM_OEM_SVC_PCI_CONTROLLER 0xc2000007
+#define PHYTIUM_OEM_SVC_HOST_BRIDGE 0xc2000008
+#define PHYTIUM_OEM_SVC_GET_FLASH_CMD 0xC200000C
+
+#define PHYTIUM_IOBASE_MASK 0xfffffff
+#define PHYTIUM_MEMIO32_MASK 0xffffffff
+#define PHYTIUM_MEMIO64_MASK 0xffffffffff
+
+#pragma pack(1)
+
+typedef struct {
+ UINT64 CpuMapCount;
+ UINT64 CpuMap[1];
+} PHYTIUM_CPU_MAP_INFOR;
I see this abbreviation of "information" to "infor" in many places.
Could this be shortened to "info", which is a more common
abbreviation? In all locations.

+
+
+typedef struct {
+ UINT64 CpuFreq; // Hz
+ UINT64 CpuL3CacheSize; // Byte
+ UINT64 CpuL3CacheLineSize; // Byte
+} PHYTIUM_CPU_COURE_INFOR;
+
+typedef struct {
+ UINT64 CupVersion; //cpu version
+ PHYTIUM_CPU_COURE_INFOR CpuCoreInfo; //cpu core info
+ PHYTIUM_CPU_MAP_INFOR CpuMapInfo; //cpu map info
+}PHYTIUM_CPU_INFO;
+
+typedef struct {
+ UINT64 MemSize; // MB
+ UINT64 MemDramId;
+ UINT64 MemModuleId;
+ UINT64 MemSerial;
+ UINT64 MemSlotNumber;
+ UINT64 MemFeatures;
+} MCU_DIMM;
Could all of these struct names have PHYTIUM_ prefix?
Some of them are very generic, and could potentially clash with common
code in future.

+
+#define MCU_DIMM_MAXCOUNT 2
+
+typedef struct {
+ UINT64 MemFreq; // MHz
+ UINT64 MemDimmCount;
+ MCU_DIMM McuDimm[1];
+} MCU_DIMMS;
+
+typedef struct {
+ UINT64 MemStart;
+ UINT64 MemSize;
+ UINT64 MemNodeId;
+} MEMORY_BLOCK;
+
+typedef struct {
+ UINT64 MemBlockCount;
+ MEMORY_BLOCK MemBlock[1];
+} MEMORY_INFOR;
+
+typedef struct {
+ UINT8 PciLane;
+ UINT8 PciSpeed;
+ UINT8 Reserved[6];
+} PCI_BLOCK;
+
+typedef struct {
+ UINT64 PciCount;
+ PCI_BLOCK PciBlock[1];
+} PHYTIUM_PCI_CONTROLLER;
+
+typedef struct {
+ UINT8 BusStart;
+ UINT8 BusEnd;
+ UINT8 Reserved[6];
+ UINT64 PciConfigBase;
+ UINT64 IoBase;
+ UINT64 IoSize;
+ UINT64 Mem32Base;
+ UINT64 Mem32Size;
+ UINT64 Mem64Base;
+ UINT64 Mem64Size;
+ UINT16 IntA;
+ UINT16 IntB;
+ UINT16 IntC;
+ UINT16 IntD;
+} PCI_HOST_BLOCK;
+
+typedef struct {
+ UINT64 PciHostCount;
+ PCI_HOST_BLOCK PciHostBlock[1];
+} PHYTIUM_PCI_HOST_BRIDGE;
+
+#pragma pack ()
+
+
+#endif /* __OEMSVC_H_ */
diff --git a/Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLib.c b/Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLib.c
new file mode 100644
index 000000000000..2affc9c131b9
--- /dev/null
+++ b/Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLib.c
@@ -0,0 +1,135 @@
+/** @file
+ Library for Phytium platform.
+
+ Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/IoLib.h>
+#include <Library/ArmPlatformLib.h>
+#include <Library/DebugLib.h>
+#include <Library/PcdLib.h>
Can we sort include statements alphabetically as well?
In this case, Library/IoLib.h after Library/DebugLib.h?

+
+#include <Ppi/ArmMpCoreInfo.h>
+
+ARM_CORE_INFO mPhytiumMpCoreInfoTable[] = {
+ {
+ // Cluster 0, Core 0
+ 0x0, 0x0,
+
+ // MP Core MailBox Set/Get/Clear Addresses and Clear Value
+ (EFI_PHYSICAL_ADDRESS)0,
+ (EFI_PHYSICAL_ADDRESS)0,
+ (EFI_PHYSICAL_ADDRESS)0,
+ (UINT64)0xFFFFFFFF
+ }
+};
+
+/*
+ This function geted the current Boot Mode.
+
+ This function returns the boot reason on the platform.
+
+ @return Return the current Boot Mode of the platform.
+
+*/
+EFI_BOOT_MODE
+ArmPlatformGetBootMode (
+ VOID
+ )
+{
+ return BOOT_WITH_FULL_CONFIGURATION;
+}
+
+
+/**
+ Initialize controllers that must setup in the normal world.
+
+ This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim
+ in the PEI phase.
+
+ @retval EFI_SUCCESS ArmPlatformInitialize() is executed successfully.
+
+**/
+RETURN_STATUS
+ArmPlatformInitialize (
+ IN UINTN MpId
+ )
+{
+ return RETURN_SUCCESS;
+}
+
+
+/**
+ This function Inited the system (or sometimes called permanent) memory.
+
+ This memory is generally represented by the DRAM.
+
+ @param[in] None.
+
+ @retval None.
+
+**/
+VOID
+ArmPlatformInitializeSystemMemory (
+ VOID
+ )
+{
+ // Nothing to do here
+}
+
+
+/**
+ This function geted the information of core.
+
+ @param[out] CoreCount The count of CoreInfoTable.
+ @param[out] ArmCoreTable The pointer of CoreInfoTable.
+
+ @retval EFI_SUCCESS PrePeiCoreGetMpCoreInfo() is executed successfully.
+
+**/
+EFI_STATUS
+PrePeiCoreGetMpCoreInfo (
+ OUT UINTN *CoreCount,
+ OUT ARM_CORE_INFO **ArmCoreTable
+ )
+{
+ *CoreCount = PcdGet32 (PcdCoreCount);
+ *ArmCoreTable = mPhytiumMpCoreInfoTable;
+ return EFI_SUCCESS;
+}
+
+// Needs to be declared in the file. Otherwise gArmMpCoreInfoPpiGuid is undefined in the contect of PrePeiCore
+EFI_GUID mArmMpCoreInfoPpiGuid = ARM_MP_CORE_INFO_PPI_GUID;
+ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo };
+
+EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] =
+{
+ {
+ EFI_PEI_PPI_DESCRIPTOR_PPI,
+ &mArmMpCoreInfoPpiGuid,
+ &mMpCoreInfoPpi
+ }
+};
+
+
+/**
+ This function geted the information of Ppitable.
+
+ @param[out] PpiListSize The size of Ppitable.
+ @param[out] PpiList The pointer of Ppitable.
+
+ @retval None.
+
+**/
+VOID
+ArmPlatformGetPlatformPpiList (
+ OUT UINTN *PpiListSize,
+ OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
+ )
+{
+ *PpiListSize = sizeof(gPlatformPpiTable);
+ *PpiList = gPlatformPpiTable;
+}
diff --git a/Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLibMem.c b/Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLibMem.c
new file mode 100644
index 000000000000..ff70cb28a20a
--- /dev/null
+++ b/Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLibMem.c
@@ -0,0 +1,148 @@
+/** @file
+ Library of memory map for Phytium platform.
+
+ Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/ArmPlatformLib.h>
+#include <Library/DebugLib.h>
+#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
+#include <Library/IoLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/ArmSmcLib.h>
Sort alphabetically?

+#include <PhytiumSystemServiceInterface.h>
+
+// Number of Virtual Memory Map Descriptors
+#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 32
+
+// DDR attributes
+#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK
+#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED
+
+/**
+ Return the Virtual Memory Map of your platform
+
+ This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform.
+
+ @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to-
+ Virtual Memory mapping. This array must be ended by a zero-filled
+ entry
+**/
+VOID
+ArmPlatformGetVirtualMemoryMap (
+ IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap
+ )
+{
+ ARM_MEMORY_REGION_ATTRIBUTES CacheAttributes;
+ ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;
+ EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes;
+ MEMORY_BLOCK *MemBlock = NULL;
+ MEMORY_INFOR *MemInfor = NULL;
Coding style says no to initialize variables on defintion.
You can set these to NULL if SMC call fails.

+ ARM_SMC_ARGS ArmSmcArgs;
+ UINT32 MemBlockCnt = 0, Index, Index1;
Coding style also says only one variable defined per line.
And having Index and Index1 becomes tricky to read. Just call the
second one J.

+
+ CacheAttributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;
+
+ ASSERT (VirtualMemoryMap != NULL);
+ VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages(EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS));
+ if (VirtualMemoryTable == NULL) {
+ return;
+ }
+
+ ResourceAttributes =
+ EFI_RESOURCE_ATTRIBUTE_PRESENT |
+ EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |
+ EFI_RESOURCE_ATTRIBUTE_TESTED;
+
+ MemInfor = AllocatePages(1);
+ ASSERT(MemInfor != NULL);
Space before (

+
+ ArmSmcArgs.Arg0 = PHYTIUM_OEM_SVC_MEM_REGIONS;
+ ArmSmcArgs.Arg1 = (UINTN)MemInfor;
+ ArmSmcArgs.Arg2 = EFI_PAGE_SIZE;
+ ArmCallSmc (&ArmSmcArgs);
+ if (ArmSmcArgs.Arg0 == 0) {
+ MemBlockCnt = MemInfor->MemBlockCount;
+ MemBlock = MemInfor->MemBlock;
+ } else {
+ ASSERT(FALSE);
Space before (

+ }
Actually, this SMC call should be broken out into a separate helper
function.

+
+ //Soc Io Space
+ VirtualMemoryTable[Index].PhysicalBase = PcdGet64 (PcdSystemIoBase);
+ VirtualMemoryTable[Index].VirtualBase = PcdGet64 (PcdSystemIoBase);
+ VirtualMemoryTable[Index].Length = PcdGet64 (PcdSystemIoSize);
+ VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+
+ //
+ // PCI Configuration Space
+ //
+ VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdPciConfigBase);
+ VirtualMemoryTable[Index].VirtualBase = PcdGet64 (PcdPciConfigBase);
+ VirtualMemoryTable[Index].Length = PcdGet64 (PcdPciConfigSize);
+ VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+
+ //
+ // PCI Memory Space
+ //
+ VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdPciIoBase) + PcdGet64(PcdPciIoTranslation);
+ VirtualMemoryTable[Index].VirtualBase = PcdGet64 (PcdPciIoBase) + PcdGet64(PcdPciIoTranslation);
+ VirtualMemoryTable[Index].Length = PcdGet64 (PcdPciIoSize);
+ VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+
+ //
+ // PCI Memory Space
+ //
+ VirtualMemoryTable[++Index].PhysicalBase = PcdGet32 (PcdPciMmio32Base);
+ VirtualMemoryTable[Index].VirtualBase = PcdGet32 (PcdPciMmio32Base);
+ VirtualMemoryTable[Index].Length = PcdGet32 (PcdPciMmio32Size);
+ VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+
+ //
+ // 64-bit PCI Memory Space
+ //
+ VirtualMemoryTable[++Index].PhysicalBase = PcdGet64 (PcdPciMmio64Base);
+ VirtualMemoryTable[Index].VirtualBase = PcdGet64 (PcdPciMmio64Base);
+ VirtualMemoryTable[Index].Length = PcdGet64 (PcdPciMmio64Size);
+ VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
+
+ //DDR
+ for (Index1 = 0; Index1 < MemBlockCnt; Index1++) {
+ VirtualMemoryTable[++Index].PhysicalBase = MemBlock->MemStart;
+ VirtualMemoryTable[Index].VirtualBase = MemBlock->MemStart;
+ VirtualMemoryTable[Index].Length = MemBlock->MemSize;
+ VirtualMemoryTable[Index].Attributes = CacheAttributes;
+
+ BuildResourceDescriptorHob (
+ EFI_RESOURCE_SYSTEM_MEMORY,
+ ResourceAttributes,
+ MemBlock->MemStart,
+ MemBlock->MemSize);
+
+ MemBlock ++;
No space before ++.

+ }
+
+ // End of Table
+ VirtualMemoryTable[++Index].PhysicalBase = 0;
+ VirtualMemoryTable[Index].VirtualBase = 0;
+ VirtualMemoryTable[Index].Length = 0;
+ VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;
+
+ ASSERT((Index + 1) <= MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS);
+
+ for (Index1 = 0; Index1 < Index; Index1++) {
+ DEBUG((DEBUG_ERROR, "PhysicalBase %12lx VirtualBase %12lx Length %12lx Attributes %12lx\n", VirtualMemoryTable[Index1].PhysicalBase,\
Please break long line after ",

+ VirtualMemoryTable[Index1].VirtualBase, VirtualMemoryTable[Index1].Length, VirtualMemoryTable[Index1].Attributes));
Please break long line.

+ }
Actually, this loop should also be a static helper function.

+
+ *VirtualMemoryMap = VirtualMemoryTable;
+}
diff --git a/Maintainers.txt b/Maintainers.txt
index 56e16fc48cb4..a23dab394a61 100644
--- a/Maintainers.txt
+++ b/Maintainers.txt
@@ -310,3 +310,10 @@ F: Silicon/SiFive/
M: Abner Chang <abner.chang@...>
M: Gilbert Chen <gilbert.chen@...>
R: Daniel Schaefer <daniel.schaefer@...>
+
+Phytium platforms and silicon
+F: Platform/Phytium/
+F: Silicon/silicon/
+M: Peng Xie <xiepeng@...>
+M: Ling Jia <jialing@...>
Can you change these to R: for now?
We use M to indicate who has responsibility for actually getting the
patches into the repo. So could you add me as M for now?

/
Leif

+R: Yiqi Shu <shuyiqi@...>
diff --git a/Silicon/Phytium/Phytium.fdf.inc b/Silicon/Phytium/Phytium.fdf.inc
new file mode 100644
index 000000000000..641266c6012f
--- /dev/null
+++ b/Silicon/Phytium/Phytium.fdf.inc
@@ -0,0 +1,119 @@
+## @file
+# This package provides common open source Phytium silicon modules.
+#
+# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved.
+#
+# SPDX-License-Identifier:BSD-2-Clause-Patent
+#
+##
+
+############################################################################
+# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
+############################################################################
+#
+#[Rule.Common.DXE_DRIVER]
+# FILE DRIVER = $(NAMED_GUID) {
+# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
+# COMPRESS PI_STD {
+# GUIDED {
+# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+# UI STRING="$(MODULE_NAME)" Optional
+# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+# }
+# }
+# }
+#
+############################################################################
+
+[Rule.Common.SEC]
+ FILE SEC = $(NAMED_GUID) RELOCS_STRIPPED FIXED {
+ TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
+ }
+
+[Rule.Common.PEI_CORE]
+ FILE PEI_CORE = $(NAMED_GUID) FIXED {
+ TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING ="$(MODULE_NAME)" Optional
+ }
+
+[Rule.Common.PEIM]
+ FILE PEIM = $(NAMED_GUID) FIXED {
+ PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
+ TE TE Align = Auto $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING="$(MODULE_NAME)" Optional
+ }
+
+[Rule.Common.PEIM.TIANOCOMPRESSED]
+ FILE PEIM = $(NAMED_GUID) DEBUG_MYTOOLS_IA32 {
+ PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
+ GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED = TRUE {
+ PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING="$(MODULE_NAME)" Optional
+ }
+ }
+
+[Rule.Common.DXE_CORE]
+ FILE DXE_CORE = $(NAMED_GUID) {
+ PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING="$(MODULE_NAME)" Optional
+ }
+
+[Rule.Common.UEFI_DRIVER]
+ FILE DRIVER = $(NAMED_GUID) {
+ DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
+ PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING="$(MODULE_NAME)" Optional
+ }
+
+[Rule.Common.DXE_DRIVER]
+ FILE DRIVER = $(NAMED_GUID) {
+ DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
+ PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING="$(MODULE_NAME)" Optional
+ }
+
+[Rule.Common.DXE_RUNTIME_DRIVER]
+ FILE DRIVER = $(NAMED_GUID) {
+ DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
+ PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING="$(MODULE_NAME)" Optional
+ }
+
+[Rule.Common.UEFI_APPLICATION]
+ FILE APPLICATION = $(NAMED_GUID) {
+ UI STRING ="$(MODULE_NAME)" Optional
+ PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+ }
+
+[Rule.Common.UEFI_DRIVER.BINARY]
+ FILE DRIVER = $(NAMED_GUID) {
+ DXE_DEPEX DXE_DEPEX Optional |.depex
+ PE32 PE32 |.efi
+ UI STRING="$(MODULE_NAME)" Optional
+ VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+ }
+
+[Rule.Common.UEFI_APPLICATION.BINARY]
+ FILE APPLICATION = $(NAMED_GUID) {
+ PE32 PE32 |.efi
+ UI STRING="$(MODULE_NAME)" Optional
+ VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+ }
+
+[Rule.Common.USER_DEFINED.BIOSINFO]
+ FILE FREEFORM = $(NAMED_GUID) {
+ RAW BIN Align = 16 $(INF_OUTPUT)/$(MODULE_NAME).acpi
+ }
+
+[Rule.Common.UEFI_APPLICATION.UI]
+ FILE APPLICATION = $(NAMED_GUID) {
+ PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
+ UI STRING="Enter Setup"
+ VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
+ }
+
+[Rule.Common.USER_DEFINED.ACPITABLE]
+ FILE FREEFORM = $(NAMED_GUID) {
+ RAW ACPI |.acpi
+ RAW ASL |.aml
+ }
diff --git a/Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/AArch64/PhytiumPlatformHelper.S b/Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/AArch64/PhytiumPlatformHelper.S
new file mode 100644
index 000000000000..cce23b786197
--- /dev/null
+++ b/Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/AArch64/PhytiumPlatformHelper.S
@@ -0,0 +1,76 @@
+#
+# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
+#
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+#
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#
+
+#include <AsmMacroIoLibV8.h>
+#include <Base.h>
+#include <Library/ArmLib.h>
+#include <Library/PcdLib.h>
+#include <AutoGen.h>
+
+.text
+.align 2
+
+GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
+GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
+GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
+GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
+
+PrimaryCoreMpid: .word 0x0
+
+
+ASM_PFX(ArmPlatformPeiBootAction):
+ // Save MPIDR_EL1[23:0] in a variable.
+ mov x20, x30
+ bl ASM_PFX(ArmReadMpidr)
+ lsl w0, w0, #8
+ lsr w0, w0, #8
+ ldr x1, =PrimaryCoreMpid
+ str w0, [x1]
+ ret x20
+
+//UINTN
+//ArmPlatformGetPrimaryCoreMpId (
+// VOID
+// );
+ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
+ ldr x0, =PrimaryCoreMpid
+ ldr w0, [x0]
+ ret
+
+//UINTN
+//ArmPlatformIsPrimaryCore (
+// IN UINTN MpId
+// );
+ASM_PFX(ArmPlatformIsPrimaryCore):
+ mov x20, x30
+ bl ASM_PFX(ArmReadMpidr)
+ lsl w0, w0, #8
+ lsr w0, w0, #8
+ ldr x1, =PrimaryCoreMpid
+ ldr w1, [x1]
+ cmp w0, w1
+ cset x0, eq
+ ret x20
+
+//UINTN
+//ArmPlatformGetCorePosition (
+// IN UINTN MpId
+// );
+// With this function: CorePos = (ClusterId * 4) + CoreId
+ASM_PFX(ArmPlatformGetCorePosition):
+ and x1, x0, #ARM_CORE_MASK
+ and x0, x0, #ARM_CLUSTER_MASK
+ add x0, x1, x0, LSR #6
+ ret
+
+ASM_FUNCTION_REMOVE_IF_UNREFERENCED
--
2.25.1


[PATCH v2 2/2] DynamicTablesPkg: Add an override for 16550 HID in SSDT

Joey Gouly
 

Some platforms advertise support for a 16550 UART, but are not
compatible with the PNP0500 HID. Allow them to override the HID by
setting PcdNonBsaCompliant16550SerialHid.

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

diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec b/DynamicTablesPkg/DynamicTablesPkg.dec
index 291a45a69679ae82219ecd2f26dfabfbab1f7f65..b242df01058729ce74d40c1fcf931acc3bc66fa5 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dec
+++ b/DynamicTablesPkg/DynamicTablesPkg.dec
@@ -44,5 +44,8 @@ [PcdsFixedAtBuild]
# Maximum number of Custom DT Generators
gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomDTGenerators|1|UINT16|0xC0000003

+ # Non BSA Compliant 16550 Serial HID
+ gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdNonBsaCompliant16550SerialHid|""|VOID*|0x40000008
+
[Guids]
gEdkiiDynamicTablesPkgTokenSpaceGuid = { 0xab226e66, 0x31d8, 0x4613, { 0x87, 0x9d, 0xd2, 0xfa, 0xb6, 0x10, 0x26, 0x3c } }
diff --git a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
index af3d404393f5f1385ab2d40f45f7222ab66f9b3a..54bf71a3b73949a9c834445a81bdade02d49e9d3 100644
--- a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
+++ b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf
@@ -1,7 +1,7 @@
## @file
# SSDT Serial Port fixup Library
#
-# Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
+# Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
@@ -28,3 +28,5 @@ [LibraryClasses]
AmlLib
BaseLib

+[Pcd]
+ gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdNonBsaCompliant16550SerialHid
diff --git a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c
index 0ff071485ef25f4ca63de0eeab5120d1beece4db..3c4356097c3bf25e8d1432b45ba8ca59d33e8d09 100644
--- a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c
+++ b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.c
@@ -1,7 +1,7 @@
/** @file
SSDT Serial Port Fixup Library.

- Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
+ Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>

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

@@ -139,13 +139,21 @@ FixupIds (
AML_OBJECT_NODE_HANDLE NameOpIdNode;
CONST CHAR8 * HidString;
CONST CHAR8 * CidString;
+ CONST CHAR8 * NonBsaHid;

// Get the _CID and _HID value to write.
switch (SerialPortInfo->PortSubtype) {
case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550:
{
- HidString = "PNP0501";
- CidString = "PNP0500";
+ // If there is a non-BSA compliant HID, use that.
+ NonBsaHid = (CONST CHAR8*)PcdGetPtr (PcdNonBsaCompliant16550SerialHid);
+ if ((NonBsaHid != NULL) && (AsciiStrLen (NonBsaHid) != 0)) {
+ HidString = NonBsaHid;
+ CidString = "";
+ } else {
+ HidString = "PNP0501";
+ CidString = "PNP0500";
+ }
break;
}
case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART:
--
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")


[PATCH v2 0/2] Add a Pcd to override the 16650 HID in SSDT

Joey Gouly
 

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

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

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

v2:
- Renamed PcdNonSbsaCompliantSerialHid to PcdNonBsaCompliant16550SerialHid

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

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

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


[PATCH v2 1/2] DynamicTablesPkg: Don't use gEfiMdeModulePkgTokenSpaceGuid

Joey Gouly
 

Introduce gEdkiiDynamicTablesPkgTokenSpaceGuid and use that instead.

Signed-off-by: Joey Gouly <joey.gouly@...>
Reviewed-by: Liming Gao <gaoliming@...>
---
DynamicTablesPkg/DynamicTablesPkg.dec | 10 ++++++----
DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf | 8 ++++----
2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec b/DynamicTablesPkg/DynamicTablesPkg.dec
index f36a6e8bb7c17f82acff3c766b15202b064a64b5..291a45a69679ae82219ecd2f26dfabfbab1f7f65 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dec
+++ b/DynamicTablesPkg/DynamicTablesPkg.dec
@@ -1,7 +1,7 @@
## @file
# dec file for Dynamic Tables Framework.
#
-# Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
+# Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -36,11 +36,13 @@ [Protocols]
[PcdsFixedAtBuild]

# Maximum number of Custom ACPI Generators
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomACPIGenerators|1|UINT16|0xC0000001
+ gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomACPIGenerators|1|UINT16|0xC0000001

# Maximum number of Custom SMBIOS Generators
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomSMBIOSGenerators|1|UINT16|0xC0000002
+ gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomSMBIOSGenerators|1|UINT16|0xC0000002

# Maximum number of Custom DT Generators
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomDTGenerators|1|UINT16|0xC0000003
+ gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomDTGenerators|1|UINT16|0xC0000003

+[Guids]
+ gEdkiiDynamicTablesPkgTokenSpaceGuid = { 0xab226e66, 0x31d8, 0x4613, { 0x87, 0x9d, 0xd2, 0xfa, 0xb6, 0x10, 0x26, 0x3c } }
diff --git a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
index 56b69591ac52ca3ba51250dc01a0846b22442ce9..29ed3dc2e5029206f8852c4b11240e7b493bbc57 100644
--- a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
+++ b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.inf
@@ -1,7 +1,7 @@
## @file
# Module to manage the list of available table factories.
#
-# Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+# Copyright (c) 2017 - 2021, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
@@ -41,9 +41,9 @@ [LibraryClasses]
UefiDriverEntryPoint

[FixedPcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomACPIGenerators
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomSMBIOSGenerators
- gEfiMdeModulePkgTokenSpaceGuid.PcdMaxCustomDTGenerators
+ gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomACPIGenerators
+ gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomSMBIOSGenerators
+ gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomDTGenerators

[Protocols]
gEdkiiDynamicTableFactoryProtocolGuid # PRODUCES
--
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")


Re: [PATCH v4 0/9] support CPU hot-unplug

Laszlo Ersek
 

On 01/22/21 07:32, Ankur Arora wrote:
On 2021-01-21 11:51 a.m., Laszlo Ersek wrote:
So perhaps try to investigate this latter avenue, and see if you are
willing to deal with what ECC throws at you. :)
Can't guarantee that I'll see it through but my curiosity on what ECC
will throw at me is piqued. Will try.
Thanks!
Laszlo


Re: [PATCH v3 17/18] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm

Laszlo Ersek
 

Hi

On 01/22/21 05:40, Kun Qin wrote:
Hi Ray,

I was suggested not to rename the file for review easiness and git history concern during v2 patch. Thread here: Re: [PATCH v2 15/16] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm (groups.io)<https://edk2.groups.io/g/devel/message/69857>
I think you misunderstood my v2 comments.

I requested that we please separate the renaming of *variables* to
dediacted patches. And, this referred primarily to the gSmst --> gMmst
replacement.

I didn't even *intend* to comment on the renaming of *files*, as far as
I can tell.

Renaming the *files*, as Ray suggests, seems reasonable. And if you can
split those actions to yet another patch, that's best.

Thanks
Laszlo



Please let me know if you still recommend renaming the files. If so, would you suggest ```CpuIo2Smm.c/h --> CpuIo2Mm.c/h # remove the "S"``` to be a separate patch between gSmst change and adding Standalone MM instance?

Thanks in advance.

Regards,
Kun

From: Ni, Ray<mailto:ray.ni@...>
Sent: Thursday, January 21, 2021 20:17
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; kun.q@...<mailto:kun.q@...>
Cc: Dong, Eric<mailto:eric.dong@...>; Laszlo Ersek<mailto:lersek@...>; Kumar, Rahul1<mailto:rahul1.kumar@...>
Subject: RE: [edk2-devel] [PATCH v3 17/18] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm


UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.c | 9 ++----
UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.c | 32 ++++++++++++++++++++
UefiCpuPkg/CpuIo2Smm/CpuIo2TraditionalMm.c | 32 ++++++++++++++++++++
UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.h | 12 ++++++++
UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf | 3 +-
UefiCpuPkg/CpuIo2Smm/{CpuIo2Smm.inf => CpuIo2StandaloneMm.inf} | 18 +++++------
UefiCpuPkg/UefiCpuPkg.dsc | 5 +++

How about do the file name change as below?
CpuIo2Smm.c/h --> CpuIo2Mm.c/h # remove the "S"
CpuIo2TraditionalMm.c -> CpuIo2Smm.c # Traditional MM equals to SMM. It also matches to CpuIo2Smm.inf.
CpuIo2StandaloneMm.c/inf # looks good to me.



Re: added support for DurianPkg.

Leif Lindholm
 

Hi Ling,

Apologies for not responding sooner. As you can imagine, the news last
week that NUVIA was being acquired by Qualcomm has caused some
distractions.

I will get on with reviewing the individual patches, but I will start
by proposing some name changes and structure changes to better fit
with tianocore design principles.

First of all - the concept of "packages" is fairly central to edk2.
Any directory that contains a .dec file is a package, and this can be
more strongly indicated by giving the directory a name ending in Pkg.
Personally, I also tend to see directories containing .dsc/.fdf as
packages, even if they don't currently hold a .dec.

Platform
Phytium
DurianPkg
DurianPkg.dsc
DurianPkg.fdf
Silicon
Phytium
Phytium2000-4Pkg
Drivers
Include
Library
Protocol
Library
PhytiumCommonPkg
PhytiumCommon.dec
PhytiumCommon.dsc.inc
Drivers
Include
Library
Protocol
Library
Logo

You could then have a new Phytium2000-4Pkg.dec, to provide the
[Include] statement for that package.

Does this make sense?

On Fri, Jan 15, 2021 at 08:47:52 +0000, Ling Jia wrote:
From: Ling <jialing@...>

The modules could be runed at the silicon of Phytium2000-4.
They supported Acpi parameter configuration, Pci bus scaning,
flash read-write and erase abd operating system boot function.
Maintainers.txt: Added maintainers and reviewers for the DurianPkg.

The public git repository is :
https://github.com/jialing2020/edk2-platforms/tree/phytium_opensource_for_2004_v1

*** BLURB HERE ***
You can delete this line - it's just there to remind you to write a
message :)

Best Regards,

Leif


Ling (10):
Silicon/Phytium/: added PhytiumPlatformLib to Phytium2000-4
Silicon/Phytium: Added Acpi support to Phytium2000-4
Silicon/Phytium: Added SMBIOS support to Phytium2000-4
Silicon/Phytium/Phytium2000-4/Library: Added PciSegmentLib to
Phytium2000-4
Silicon/Phytium: Added PciHostBridgeLib to Phytium2000-4
Silicon/Phytium: Added Logo support to Phytium Silicon
Silicon/Phytium: Added Spi driver support to Phytium2000-4
Silicon/Phytium: Added flash driver support to Phytium Silicon
Silicon/Phytium: Added fvb driver for norflash
Silicon/Phytium: Added Rtc driver to Phytium2000-4

Silicon/Phytium/Phytium.dec | 60 +
Silicon/Phytium/Phytium.dsc.inc | 388 ++++++
Platform/Phytium/Durian/DurianPkg.dsc | 340 +++++
Platform/Phytium/Durian/DurianPkg.fdf | 241 ++++
Silicon/Phytium/CommonDrivers/PhytiumFlashFvbDxe/PhytiumFlashFvbDxe.inf | 72 +
Silicon/Phytium/CommonDrivers/PhytiumSpiNorFlashDxe/PhytiumSpiNorFlashDxe.inf | 54 +
Silicon/Phytium/Library/LogoLib/LogoLib.inf | 58 +
Silicon/Phytium/Phytium2000-4/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 58 +
Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/AcpiTables.inf | 61 +
Silicon/Phytium/Phytium2000-4/Drivers/PhytiumSpiDxe/PhytiumSpiDxe.inf | 52 +
Silicon/Phytium/Phytium2000-4/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 55 +
Silicon/Phytium/Phytium2000-4/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 55 +
Silicon/Phytium/Phytium2000-4/Library/PciSegmentLib/PciSegmentLib.inf | 28 +
Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLib.inf | 66 +
Silicon/Phytium/Phytium2000-4/Library/PhytiumRealTimeClockLib/PhytiumRealTimeClockLib.inf | 44 +
Silicon/Phytium/CommonDrivers/PhytiumFlashFvbDxe/PhytiumFlashFvbDxe.h | 106 ++
Silicon/Phytium/CommonDrivers/PhytiumSpiNorFlashDxe/PhytiumSpiNorFlashDxe.h | 106 ++
Silicon/Phytium/Include/PhytiumPlatform.h | 93 ++
Silicon/Phytium/Include/PhytiumSystemServiceInterface.h | 112 ++
Silicon/Phytium/Include/Protocol/PhytiumSpi.h | 51 +
Silicon/Phytium/Include/Protocol/PhytiumSpiNorFlash.h | 74 +
Silicon/Phytium/Phytium2000-4/Drivers/PhytiumSpiDxe/PhytiumSpiDxe.h | 73 +
Silicon/Phytium/Phytium2000-4/Library/PhytiumRealTimeClockLib/PhytiumRealTimeClockLib.h | 24 +
Silicon/Phytium/CommonDrivers/PhytiumFlashFvbDxe/PhytiumFlashFvbDxe.c | 1235 +++++++++++++++++
Silicon/Phytium/CommonDrivers/PhytiumSpiNorFlashDxe/PhytiumSpiNorFlashDxe.c | 435 ++++++
Silicon/Phytium/Library/LogoLib/Logo.c | 133 ++
Silicon/Phytium/Phytium2000-4/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 254 ++++
Silicon/Phytium/Phytium2000-4/Drivers/PhytiumSpiDxe/PhytiumSpiDxe.c | 189 +++
Silicon/Phytium/Phytium2000-4/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 959 +++++++++++++
Silicon/Phytium/Phytium2000-4/Library/PciHostBridgeLib/PciHostBridgeLib.c | 182 +++
Silicon/Phytium/Phytium2000-4/Library/PciSegmentLib/PciSegmentLib.c | 1440 ++++++++++++++++++++
Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLib.c | 135 ++
Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLibMem.c | 148 ++
Silicon/Phytium/Phytium2000-4/Library/PhytiumRealTimeClockLib/PhytiumRealTimeClockLib.c | 468 +++++++
Maintainers.txt | 7 +
Silicon/Phytium/Logo/PhytiumLogo.bmp | Bin 0 -> 32454 bytes
Silicon/Phytium/Phytium.fdf.inc | 119 ++
Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/AcpiSsdtRootPci.asl | 234 ++++
Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Dbg2.aslc | 85 ++
Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Dsdt/Cpu.asl | 85 ++
Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Dsdt/Dsdt.asl | 15 +
Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Dsdt/Uart.asl | 65 +
Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Fadt.aslc | 81 ++
Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Gtdt.aslc | 87 ++
Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Iort.aslc | 89 ++
Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Madt.aslc | 66 +
Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Mcfg.aslc | 69 +
Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Pptt.aslc | 219 +++
Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Spcr.aslc | 83 ++
Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/AArch64/PhytiumPlatformHelper.S | 76 ++
50 files changed, 9229 insertions(+)
create mode 100644 Silicon/Phytium/Phytium.dec
create mode 100644 Silicon/Phytium/Phytium.dsc.inc
create mode 100644 Platform/Phytium/Durian/DurianPkg.dsc
create mode 100644 Platform/Phytium/Durian/DurianPkg.fdf
create mode 100644 Silicon/Phytium/CommonDrivers/PhytiumFlashFvbDxe/PhytiumFlashFvbDxe.inf
create mode 100644 Silicon/Phytium/CommonDrivers/PhytiumSpiNorFlashDxe/PhytiumSpiNorFlashDxe.inf
create mode 100644 Silicon/Phytium/Library/LogoLib/LogoLib.inf
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/AcpiTables.inf
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/PhytiumSpiDxe/PhytiumSpiDxe.inf
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf
create mode 100644 Silicon/Phytium/Phytium2000-4/Library/PciHostBridgeLib/PciHostBridgeLib.inf
create mode 100644 Silicon/Phytium/Phytium2000-4/Library/PciSegmentLib/PciSegmentLib.inf
create mode 100644 Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLib.inf
create mode 100644 Silicon/Phytium/Phytium2000-4/Library/PhytiumRealTimeClockLib/PhytiumRealTimeClockLib.inf
create mode 100644 Silicon/Phytium/CommonDrivers/PhytiumFlashFvbDxe/PhytiumFlashFvbDxe.h
create mode 100644 Silicon/Phytium/CommonDrivers/PhytiumSpiNorFlashDxe/PhytiumSpiNorFlashDxe.h
create mode 100644 Silicon/Phytium/Include/PhytiumPlatform.h
create mode 100644 Silicon/Phytium/Include/PhytiumSystemServiceInterface.h
create mode 100644 Silicon/Phytium/Include/Protocol/PhytiumSpi.h
create mode 100644 Silicon/Phytium/Include/Protocol/PhytiumSpiNorFlash.h
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/PhytiumSpiDxe/PhytiumSpiDxe.h
create mode 100644 Silicon/Phytium/Phytium2000-4/Library/PhytiumRealTimeClockLib/PhytiumRealTimeClockLib.h
create mode 100644 Silicon/Phytium/CommonDrivers/PhytiumFlashFvbDxe/PhytiumFlashFvbDxe.c
create mode 100644 Silicon/Phytium/CommonDrivers/PhytiumSpiNorFlashDxe/PhytiumSpiNorFlashDxe.c
create mode 100644 Silicon/Phytium/Library/LogoLib/Logo.c
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiPlatformDxe/AcpiPlatform.c
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/PhytiumSpiDxe/PhytiumSpiDxe.c
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c
create mode 100644 Silicon/Phytium/Phytium2000-4/Library/PciHostBridgeLib/PciHostBridgeLib.c
create mode 100644 Silicon/Phytium/Phytium2000-4/Library/PciSegmentLib/PciSegmentLib.c
create mode 100644 Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLib.c
create mode 100644 Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/PhytiumPlatformLibMem.c
create mode 100644 Silicon/Phytium/Phytium2000-4/Library/PhytiumRealTimeClockLib/PhytiumRealTimeClockLib.c
create mode 100644 Silicon/Phytium/Logo/PhytiumLogo.bmp
create mode 100644 Silicon/Phytium/Phytium.fdf.inc
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/AcpiSsdtRootPci.asl
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Dbg2.aslc
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Dsdt/Cpu.asl
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Dsdt/Dsdt.asl
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Dsdt/Uart.asl
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Fadt.aslc
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Gtdt.aslc
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Iort.aslc
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Madt.aslc
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Mcfg.aslc
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Pptt.aslc
create mode 100644 Silicon/Phytium/Phytium2000-4/Drivers/AcpiTables/Spcr.aslc
create mode 100644 Silicon/Phytium/Phytium2000-4/Library/PhytiumPlatformLib/AArch64/PhytiumPlatformHelper.S

--
2.25.1


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

gaoliming
 

I mean the comments sub-leaf should be replaced by main-leaf. But, current patch still uses sub-leaf for CPUID_HYBRID_INFORMATION_MAIN_LEAF.

 

Thanks

Liming

发件人: tosubbounce+27952+0+0+0@groups.io <tosubbounce+27952+0+0+0@groups.io> 代表 Jason Lou
发送时间: 2021122 13:47
收件人: gaoliming <gaoliming@...>; devel@edk2.groups.io
主题: Re: [edk2-devel] 回复: [edk2-devel] [PATCH v2 1/1] MdePkg/Cpuid.h: Change and add some macro definitions.

 

Hi Liming,
Yes, I replaced all the CPUID_HYBRID_INFORMATION_SUB_LEAF with CPUID_HYBRID_INFORMATION_MAIN_LEAF.


Re: [PATCH v3 17/18] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm

Kun Qin <kun.q@...>
 

Ray,

 

Thanks for confirming. I will add the renaming patch in v4.

 

Regards,

Kun

 

From: Ni, Ray
Sent: Thursday, January 21, 2021 22:29
To: Kun Qin; devel@edk2.groups.io
Cc: Dong, Eric; Laszlo Ersek; Kumar, Rahul1
Subject: RE: [edk2-devel] [PATCH v3 17/18] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm

 

Kun,

Yes. I recommend renaming the files. This can make future developers easy to understand which file stands for which purpose.

A separate rename patch looks good to me.

 

Thanks,

Ray

 

From: Kun Qin <kun.q@...>
Sent: Friday, January 22, 2021 12:41 PM
To: Ni, Ray <ray.ni@...>; devel@edk2.groups.io
Cc: Dong, Eric <eric.dong@...>; Laszlo Ersek <lersek@...>; Kumar, Rahul1 <rahul1.kumar@...>
Subject: RE: [edk2-devel] [PATCH v3 17/18] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm

 

Hi Ray,

 

I was suggested not to rename the file for review easiness and git history concern during v2 patch. Thread here: Re: [PATCH v2 15/16] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm (groups.io)

 

Please let me know if you still recommend renaming the files. If so, would you suggest ```CpuIo2Smm.c/h --> CpuIo2Mm.c/h  # remove the "S"``` to be a separate patch between gSmst change and adding Standalone MM instance?

 

Thanks in advance.

 

Regards,

Kun

 

From: Ni, Ray
Sent: Thursday, January 21, 2021 20:17
To: devel@edk2.groups.io; kun.q@...
Cc: Dong, Eric; Laszlo Ersek; Kumar, Rahul1
Subject: RE: [edk2-devel] [PATCH v3 17/18] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm

 

>
>  UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.c                               |  9 ++----
>  UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.c                      | 32 ++++++++++++++++++++
>  UefiCpuPkg/CpuIo2Smm/CpuIo2TraditionalMm.c                     | 32 ++++++++++++++++++++
>  UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.h                               | 12 ++++++++
>  UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf                             |  3 +-
>  UefiCpuPkg/CpuIo2Smm/{CpuIo2Smm.inf => CpuIo2StandaloneMm.inf} | 18 +++++------
>  UefiCpuPkg/UefiCpuPkg.dsc                                      |  5 +++


How about do the file name change as below?
CpuIo2Smm.c/h --> CpuIo2Mm.c/h  # remove the "S"
CpuIo2TraditionalMm.c -> CpuIo2Smm.c # Traditional MM equals to SMM. It also matches to CpuIo2Smm.inf.
CpuIo2StandaloneMm.c/inf # looks good to me.

 

 


Re: [PATCH v4 0/9] support CPU hot-unplug

Ankur Arora
 

On 2021-01-21 11:51 a.m., Laszlo Ersek wrote:
On 01/21/21 20:11, Ankur Arora wrote:
On 2021-01-21 4:29 a.m., Laszlo Ersek wrote:
For catching such issues early on, please run "PatchCheck.py" before
posting, e.g. as in:

$ python3 BaseTools/Scripts/PatchCheck.py master..topic_branch

(In the present case, PatchCheck reports lots of "not CRLF" errors.)
PatchCheck.py is great. Thanks.


An even better idea is to push your topic branch (which you're about to
post to the list) to your edk2 fork on github.com, and then submit a
pull request against the "tianocore/edk2" project. The pull request will
be auto-closed in the end (it will never be merged), but the goal is to
trigger a CI run on the patch set, and to give you the error messages if
any. PatchCheck runs as a part of CI, too.

(github.com PRs are used for actual merging by edk2 maintainers, but for
that, they set the "push" label on the subject PRs, and the "push" label
is restricted to maintainers.)

I apologize about the extra delay. Would you be OK posting v5?
Sure.
Thanks for your understanding, I'm relieved.

Just a side question which I should have asked you earlier: are
the coding standards listed somewhere?
Yes, see "C Coding Standards" at
<https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Documentation#specifications>.
Although...

I had looked for answers to similar questions but the "TianoCore C style
guide" doesn't mention either PatchCheck.py or rules around CRLF.
... you may have found exactly that, already. Unfortunately, like all
documentation in the world, this document is somewhat out of date.
There is also a tool, called ECC, that contains a builtin C language
parser, that enforces various style requirements. It's built into the CI
system and runs on github -- however, we have it disabled for OVMF, in
commit ef3e73c6a0c0 ("OvmfPkg: Disable EccCheck CI until EccCheck issues
are fixed", 2020-12-14). There are two reasons for that:
- Some stuff that ECC enforces is just overzealous -- in some cases, we
relax the coding style under OvmfPkg specifically, but ECC cannot easily
be configured to tolerate those relaxations (for example, you cannot
configure it to ignore a particular error code *regardless* of where it
occurs under OvmfPkg).
- In some cases, ECC rejects C language constructs that are both valid
and conformant to the coding style (i.e., ECC has its own bugs).
So we usually "teach" these quirks to contributors during review. It's
quite a lot of investment, which is part of why we hope that
contributors stick around.
A very understandable sentiment :).

An alternative is this: in your topic branch that you intend to post to
edk2-devel, include an *extra* patch (not to be posted to the list) that
*reverts* commit ef3e73c6a0c0. And submit a github.com PR with this
variant of your topic branch. As a result, ECC will be unleashed on (the
end-stage of) your patch series. If you fix all of the ECC issues, then
reviewers should make next to zero *style* complaints -- on the other
hand, you could be updating code that ECC complains about *incorrectly*
(due to an ECC bug, or because the subject style rule is something we
deem superfluous, or at least "possible to bend", under OvmfPkg).
So perhaps try to investigate this latter avenue, and see if you are
willing to deal with what ECC throws at you. :)
Can't guarantee that I'll see it through but my curiosity on what ECC
will throw at me is piqued. Will try.


Thanks for the comments and my apologies for making you review all of
these non-substantive changes.
It's a standard part of reviewing the first few contributions of a new
community member; it's too bad we don't have better stuff in place. We
do have docs but they are slightly outdated, and we do have ECC but with
warts.
We also have recommendations (not official requirements!) on setting up
git, as a part of
<https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers>
-- which is likely out of date somewhat --; the
I guess that's the nature of non-executable bits... out of date
soon as they are written. Thanks, this and the scripts below both
were pretty useful.

BaseTools/Scripts/SetupGit.py
utility automates more or less the same settings.
We also have
BaseTools/Scripts/GetMaintainer.py
which lets you determine the Cc:'s you should put in each commit message...
And when you dump all this *process* on a new contributor, they run away
screaming -- kind of justifiedly. :/
Heh, I think I see the appeal of this gradual introduction of process.

Personally speaking, it is after working on this feature and seeing
things like SafeUintnMult(), that you see that FW generally and EDK2
specifically really does need to be written differently from, for
instance the kernel.

Thanks
Ankur

Thanks
Laszlo


Re: [PATCH v3 17/18] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm

Ni, Ray
 

Kun,

Yes. I recommend renaming the files. This can make future developers easy to understand which file stands for which purpose.

A separate rename patch looks good to me.

 

Thanks,

Ray

 

From: Kun Qin <kun.q@...>
Sent: Friday, January 22, 2021 12:41 PM
To: Ni, Ray <ray.ni@...>; devel@edk2.groups.io
Cc: Dong, Eric <eric.dong@...>; Laszlo Ersek <lersek@...>; Kumar, Rahul1 <rahul1.kumar@...>
Subject: RE: [edk2-devel] [PATCH v3 17/18] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm

 

Hi Ray,

 

I was suggested not to rename the file for review easiness and git history concern during v2 patch. Thread here: Re: [PATCH v2 15/16] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm (groups.io)

 

Please let me know if you still recommend renaming the files. If so, would you suggest ```CpuIo2Smm.c/h --> CpuIo2Mm.c/h  # remove the "S"``` to be a separate patch between gSmst change and adding Standalone MM instance?

 

Thanks in advance.

 

Regards,

Kun

 

From: Ni, Ray
Sent: Thursday, January 21, 2021 20:17
To: devel@edk2.groups.io; kun.q@...
Cc: Dong, Eric; Laszlo Ersek; Kumar, Rahul1
Subject: RE: [edk2-devel] [PATCH v3 17/18] UefiCpuPkg: CpuIo2Smm: Support of CpuIo driver under StandaloneMm

 

>
>  UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.c                               |  9 ++----
>  UefiCpuPkg/CpuIo2Smm/CpuIo2StandaloneMm.c                      | 32 ++++++++++++++++++++
>  UefiCpuPkg/CpuIo2Smm/CpuIo2TraditionalMm.c                     | 32 ++++++++++++++++++++
>  UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.h                               | 12 ++++++++
>  UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf                             |  3 +-
>  UefiCpuPkg/CpuIo2Smm/{CpuIo2Smm.inf => CpuIo2StandaloneMm.inf} | 18 +++++------
>  UefiCpuPkg/UefiCpuPkg.dsc                                      |  5 +++


How about do the file name change as below?
CpuIo2Smm.c/h --> CpuIo2Mm.c/h  # remove the "S"
CpuIo2TraditionalMm.c -> CpuIo2Smm.c # Traditional MM equals to SMM. It also matches to CpuIo2Smm.inf.
CpuIo2StandaloneMm.c/inf # looks good to me.

 


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

Jason Lou
 

Hi Liming,
Yes, I replaced all the CPUID_HYBRID_INFORMATION_SUB_LEAF with CPUID_HYBRID_INFORMATION_MAIN_LEAF.