From: "Leif Lindholm" <leif@nuviainc.com>
To: Ling Jia <jialing@phytium.com.cn>
Cc: devel@edk2.groups.io
Subject: Re: [PATCH v3 01/10] Silicon/Phytium: Added PlatformLib to FT2000/4
Date: Tue, 13 Apr 2021 19:00:18 +0100 [thread overview]
Message-ID: <20210413180018.GD1664@vanye> (raw)
In-Reply-To: <20210317072647.77340-2-jialing@phytium.com.cn>
On Wed, Mar 17, 2021 at 15:26:38 +0800, Ling Jia wrote:
> The PlatformLib supported the system library for FT2000/4 chip.
> Platform/Phytium: Added the dsc and fdf files of DurianPkg.
>
> v3:
> DurianPkg.dsc:Added OrderedCollectionLib to upstream changes in
> edk2, and some parameters omitted in V2 version.
Please summarise all changes between revisions in the cover letter
(0/5). The commit message should not include this information.
> Signed-off-by: Ling Jia <jialing@phytium.com.cn>
> Reviewed-by: Leif Lindholm <leif@nuviainc.com>
> ---
If there is anything you want to specifically highlight for an
individual patch, but does not belong in the commit message, you can
say it here - after the "---" line.
Typo comment below.
> Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 41 +++
> Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc | 345 ++++++++++++++++++++
> Platform/Phytium/DurianPkg/DurianPkg.dsc | 298 +++++++++++++++++
> Platform/Phytium/DurianPkg/DurianPkg.fdf | 210 ++++++++++++
> Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf | 55 ++++
> Silicon/Phytium/PhytiumCommonPkg/Include/SystemServiceInterface.h | 112 +++++++
> Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.c | 137 ++++++++
> Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLibMem.c | 156 +++++++++
> Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/AArch64/PhytiumPlatformHelper.S | 76 +++++
> Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.fdf.inc | 119 +++++++
> 10 files changed, 1549 insertions(+)
>
> diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
> new file mode 100644
> index 0000000000..48f430c88d
> --- /dev/null
> +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
> @@ -0,0 +1,41 @@
> +## @file
> +# This package provides common Phytium silicon modules.
> +#
> +# Copyright (C) 2020, Phytium Technology Co,Ltd. All rights reserved.
> +#
> +# SPDX-License-Identifier:BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> + DEC_SPECIFICATION = 0x0001001b
> + PACKAGE_NAME = PhytiumCommnonPkg
> + 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 } }
> +
> +[PcdsFixedAtBuild.common]
> + gPhytiumPlatformTokenSpaceGuid.PcdSystemIoBase|0x0|UINT64|0x00000000
> + gPhytiumPlatformTokenSpaceGuid.PcdSystemIoSize|0x0|UINT64|0x00000001
> +
> + #
> + # PCI configuration address space
> + #
> + gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x00000002
> + gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x00000003
> +
> +[Protocols]
> diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc
> new file mode 100644
> index 0000000000..121fe0e7c5
> --- /dev/null
> +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc
> @@ -0,0 +1,345 @@
> +## @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]
> + #
> + # ARM Architectural Libraries
> + #
> + 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
> +
> + AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf
> + AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
> +
> + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
> + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
> + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> + BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
> + BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
> +
> + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
> + CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
> + CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf
> + CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf
> + CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
> + !if $(TARGET) == RELEASE
> + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
> + !else
> + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
> + !endif
> +
> + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
> + DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
> + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
> + DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf
> + DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
> + DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf
> + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
> +
> + FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf
> + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
> + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
> +
> + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
> + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
> + HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
> +
> + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
> + IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
> +
> + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
> +
> + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
> + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
> + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
> + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
> + PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
> + PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf
> + PlatformSecureLib|SecurityPkg/Library/PlatformSecureLibNull/PlatformSecureLibNull.inf
> + PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
> + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
> +
> + RngLib|MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
> + ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
> +
> + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
> + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
> + SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
> + ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
> + SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
> +
> + TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
> + TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
> +
> + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
> + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
> + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf
> + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
> + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
> + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
> + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
> + UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
> + UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
> +
> + VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> + VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf
> +
> + #
> + # Scsi Requirements
> + #
> + UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
> +
> + #
> + # USB Requirements
> + #
> + UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf
> +
> + #
> + # Networking Requirements
> + #
> + DpcLib|NetworkPkg/Library/DxeDpcLib/DxeDpcLib.inf
> + IpIoLib|NetworkPkg/Library/DxeIpIoLib/DxeIpIoLib.inf
> + NetLib|NetworkPkg/Library/DxeNetLib/DxeNetLib.inf
> + UdpIoLib|NetworkPkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
> + HttpLib|NetworkPkg/Library/DxeHttpLib/DxeHttpLib.inf
> +
> +[LibraryClasses.common.SEC]
> + ArmGicArchLib|ArmPkg/Library/ArmGicArchSecLib/ArmGicArchSecLib.inf
> + DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsBaseLib.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
> + PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf
> + PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf
> + PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
> +
> +[LibraryClasses.common.SEC, LibraryClasses.common.PEIM]
> + MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf
> +
> +[LibraryClasses.common.DXE_CORE]
> + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
> + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
> + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
> + HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
> + MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
> + PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf
> +
> +[LibraryClasses.common.DXE_DRIVER]
> + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
> + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
> + SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
> + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
> + VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf
> +
> +[LibraryClasses.common.UEFI_APPLICATION]
> + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
> + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
> + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
> +
> + #
> + # UiApp dependencies
> + #
> + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf
> + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.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]
> + !if $(SECURE_BOOT_ENABLE) == TRUE
> + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
> + !endif
> +
> + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
> +
> + !if $(TARGET) != RELEASE
> + DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf
> + !endif
> +
> + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
> + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
> + ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCodeLib/RuntimeDxeReportStatusCodeLib.inf
> + VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf
> +
> +[LibraryClasses.AARCH64.DXE_RUNTIME_DRIVER]
> + EfiResetSystemLib|ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf
> +
> +[LibraryClasses.ARM, LibraryClasses.AARCH64]
> + 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]
> + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE
> + 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
> +
> + 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
> +
> +!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.PcdTimerPeriod|200000
> +
> + 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
> +
> + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
> +
> + gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
> +
> +!if $(SECURE_BOOT_ENABLE) == TRUE
> + 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/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc
> new file mode 100644
> index 0000000000..b523ecd658
> --- /dev/null
> +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc
> @@ -0,0 +1,298 @@
> +## @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 = 0x0001001c
> + OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
> + SUPPORTED_ARCHITECTURES = AARCH64
> + BUILD_TARGETS = DEBUG|RELEASE|NOOPT
> + SKUID_IDENTIFIER = DEFAULT
> + FLASH_DEFINITION = Platform/Phytium/DurianPkg/DurianPkg.fdf
> +
> +!include Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc
> +
> +[LibraryClasses.common]
> + # Phytium Platform library
> + ArmPlatformLib|Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.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"
> + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"V1.0"
> +
> + gArmTokenSpaceGuid.PcdVFPEnabled|1
> + gArmTokenSpaceGuid.PcdArmPrimaryCoreMask|0x101
> + gArmTokenSpaceGuid.PcdArmPrimaryCore|0x0
> + gArmPlatformTokenSpaceGuid.PcdCoreCount|4
> +
> + #
> + # 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(the processor basic firmware, Mainly deals the initialization
> + # of the chip).
> + #
> + 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
> +
> +################################################################################
> +#
> +# 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
> + OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.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
> +
> + #
> + # 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
> +
> + #
> + # 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
> +
> + #
> + # PCI Support
> + #
> + ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf
> + MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.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/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf
> new file mode 100644
> index 0000000000..9d75b072c6
> --- /dev/null
> +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf
> @@ -0,0 +1,210 @@
> +## @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 MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
> + INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.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
> +
> + #
> + # Usb Support
> + #
> + INF MdeModulePkg/Bus/Pci/UhciDxe/UhciDxe.inf
> + INF MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf
> + INF MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
> + INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
> + INF MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
> + INF MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
> + INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.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/PhytiumCommonPkg/PhytiumCommonPkg.fdf.inc
> diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf
> new file mode 100644
> index 0000000000..40c070767a
> --- /dev/null
> +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf
> @@ -0,0 +1,55 @@
> +#/** @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 = 0x0001001b
> + BASE_NAME = PlatformLib
> + FILE_GUID = fac08f56-40fe-11eb-a2a3-27b46864b1f3
> + MODULE_TYPE = BASE
> + VERSION_STRING = 1.0
> + LIBRARY_CLASS = ArmPlatformLib
> +
> +[Packages]
> + ArmPkg/ArmPkg.dec
> + ArmPlatformPkg/ArmPlatformPkg.dec
> + MdePkg/MdePkg.dec
> + MdeModulePkg/MdeModulePkg.dec
> + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec
> +
> +[LibraryClasses]
> + ArmSmcLib
> + HobLib
> +
> +[Sources.common]
> + PlatformLib.c
> + PlatformLibMem.c
> +
> +[Sources.AARCH64]
> + AArch64/PhytiumPlatformHelper.S
> +
> +[Guids]
> +
> +[FixedPcd]
> + 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/PhytiumCommonPkg/Include/SystemServiceInterface.h b/Silicon/Phytium/PhytiumCommonPkg/Include/SystemServiceInterface.h
> new file mode 100644
> index 0000000000..c4395153a3
> --- /dev/null
> +++ b/Silicon/Phytium/PhytiumCommonPkg/Include/SystemServiceInterface.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 SYSTEM_SERVICE_INTERFACE_H_
> +#define SYSTEM_SERVICE_INTERFACE_H_
> +
> +/* 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_INFO;
> +
> +
> +typedef struct {
> + UINT64 CpuFreq; // Hz
> + UINT64 CpuL3CacheSize; // Byte
> + UINT64 CpuL3CacheLineSize; // Byte
> +} PHYTIUM_CPU_COURE_INFO;
I believe this should be
CORE, not
COURE
?
> +
> +typedef struct {
> + UINT64 CupVersion; //cpu version
> + PHYTIUM_CPU_COURE_INFO CpuCoreInfo; //cpu core info
> + PHYTIUM_CPU_MAP_INFO 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 you add PHYTIUM_ prefixes for all of the remaining structures as
well please?
> +
> +#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_INFO;
> +
> +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;
Including this one.
If you address all these comments, you can add
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
to the commit message for this patch for v4.
/
Leif
> +
> +typedef struct {
> + UINT64 PciHostCount;
> + PCI_HOST_BLOCK PciHostBlock[1];
> +} PHYTIUM_PCI_HOST_BRIDGE;
> +
> +#pragma pack ()
> +
> +
> +#endif // SYSTEM_SERVICE_INTERFACE_H_
> diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.c b/Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.c
> new file mode 100644
> index 0000000000..6a8d226574
> --- /dev/null
> +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.c
> @@ -0,0 +1,137 @@
> +/** @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/ArmPlatformLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/IoLib.h>
> +#include <Library/PcdLib.h>
> +#include <Ppi/ArmMpCoreInfo.h>
> +
> +ARM_CORE_INFO mPhytiumMpCoreInfoTable[] = {
> + {
> + 0x0, 0x0, // Cluster 0, Core 0
> +
> + // 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/FT2000-4Pkg/Library/PlatformLib/PlatformLibMem.c b/Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLibMem.c
> new file mode 100644
> index 0000000000..7e54cb6e74
> --- /dev/null
> +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLibMem.c
> @@ -0,0 +1,156 @@
> +/** @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/MemoryAllocationLib.h>
> +#include <Library/ArmSmcLib.h>
> +#include <SystemServiceInterface.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;
> + MEMORY_INFO *MemInfo;
> + ARM_SMC_ARGS ArmSmcArgs;
> + UINT32 MemBlockCnt;
> + UINT32 Index1;
> + UINT32 Index2;
> +
> + MemBlock = NULL;
> + MemInfo = NULL;
> + MemBlockCnt = 0;
> + Index1 = 0;
> + Index2 = 0;
> + 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;
> +
> + MemInfo = AllocatePages (1);
> + ASSERT (MemInfo != NULL);
> +
> + ArmSmcArgs.Arg0 = PHYTIUM_OEM_SVC_MEM_REGIONS;
> + ArmSmcArgs.Arg1 = (UINTN) MemInfo;
> + ArmSmcArgs.Arg2 = EFI_PAGE_SIZE;
> + ArmCallSmc (&ArmSmcArgs);
> + if (ArmSmcArgs.Arg0 == 0) {
> + MemBlockCnt = MemInfo->MemBlockCount;
> + MemBlock = MemInfo->MemBlock;
> + } else {
> + ASSERT (FALSE);
> + }
> +
> + //Soc Io Space
> + VirtualMemoryTable[Index1].PhysicalBase = PcdGet64 (PcdSystemIoBase);
> + VirtualMemoryTable[Index1].VirtualBase = PcdGet64 (PcdSystemIoBase);
> + VirtualMemoryTable[Index1].Length = PcdGet64 (PcdSystemIoSize);
> + VirtualMemoryTable[Index1].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> +
> + //
> + // PCI Configuration Space
> + //
> + VirtualMemoryTable[++Index1].PhysicalBase = PcdGet64 (PcdPciConfigBase);
> + VirtualMemoryTable[Index1].VirtualBase = PcdGet64 (PcdPciConfigBase);
> + VirtualMemoryTable[Index1].Length = PcdGet64 (PcdPciConfigSize);
> + VirtualMemoryTable[Index1].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> +
> + //
> + // PCI Memory Space
> + //
> + VirtualMemoryTable[++Index1].PhysicalBase = PcdGet64 (PcdPciIoBase) + PcdGet64 (PcdPciIoTranslation);
> + VirtualMemoryTable[Index1].VirtualBase = PcdGet64 (PcdPciIoBase) + PcdGet64 (PcdPciIoTranslation);
> + VirtualMemoryTable[Index1].Length = PcdGet64 (PcdPciIoSize);
> + VirtualMemoryTable[Index1].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> +
> + //
> + // PCI Memory Space
> + //
> + VirtualMemoryTable[++Index1].PhysicalBase = PcdGet32 (PcdPciMmio32Base);
> + VirtualMemoryTable[Index1].VirtualBase = PcdGet32 (PcdPciMmio32Base);
> + VirtualMemoryTable[Index1].Length = PcdGet32 (PcdPciMmio32Size);
> + VirtualMemoryTable[Index1].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> +
> + //
> + // 64-bit PCI Memory Space
> + //
> + VirtualMemoryTable[++Index1].PhysicalBase = PcdGet64 (PcdPciMmio64Base);
> + VirtualMemoryTable[Index1].VirtualBase = PcdGet64 (PcdPciMmio64Base);
> + VirtualMemoryTable[Index1].Length = PcdGet64 (PcdPciMmio64Size);
> + VirtualMemoryTable[Index1].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;
> +
> + //DDR
> + for (Index2 = 0; Index2 < MemBlockCnt; Index2++) {
> + VirtualMemoryTable[++Index1].PhysicalBase = MemBlock->MemStart;
> + VirtualMemoryTable[Index1].VirtualBase = MemBlock->MemStart;
> + VirtualMemoryTable[Index1].Length = MemBlock->MemSize;
> + VirtualMemoryTable[Index1].Attributes = CacheAttributes;
> +
> + BuildResourceDescriptorHob (
> + EFI_RESOURCE_SYSTEM_MEMORY,
> + ResourceAttributes,
> + MemBlock->MemStart,
> + MemBlock->MemSize
> + );
> +
> + MemBlock++;
> + }
> +
> + // End of Table
> + VirtualMemoryTable[++Index1].PhysicalBase = 0;
> + VirtualMemoryTable[Index1].VirtualBase = 0;
> + VirtualMemoryTable[Index1].Length = 0;
> + VirtualMemoryTable[Index1].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0;
> +
> +
> + for (Index2 = 0; Index2 < Index1; Index2++) {
> + DEBUG ((DEBUG_ERROR, "PhysicalBase %12lx VirtualBase %12lx Length %12lx Attributes %12lx\n",\
> + VirtualMemoryTable[Index2].PhysicalBase, VirtualMemoryTable[Index2].VirtualBase, \
> + VirtualMemoryTable[Index2].Length, VirtualMemoryTable[Index2].Attributes));
> + }
> +
> + *VirtualMemoryMap = VirtualMemoryTable;
> +}
> diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/AArch64/PhytiumPlatformHelper.S b/Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/AArch64/PhytiumPlatformHelper.S
> new file mode 100644
> index 0000000000..cce23b7861
> --- /dev/null
> +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/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
> diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.fdf.inc b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.fdf.inc
> new file mode 100644
> index 0000000000..641266c601
> --- /dev/null
> +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.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
> + }
> --
> 2.25.1
>
next prev parent reply other threads:[~2021-04-13 18:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-17 7:26 [PATCH v3 00/10] Added support for FT2000/4 chip jialing
2021-03-17 7:26 ` [PATCH v3 01/10] Silicon/Phytium: Added PlatformLib to FT2000/4 jialing
2021-04-13 18:00 ` Leif Lindholm [this message]
2021-05-06 3:14 ` Ling Jia
2021-03-17 7:26 ` [PATCH v3 02/10] Silicon/Phytium: Added Acpi support " jialing
2021-03-17 7:26 ` [PATCH v3 03/10] Silicon/Phytium: Added SMBIOS " jialing
2021-03-17 7:26 ` [PATCH v3 04/10] Silicon/Phytium: Added PciSegmentLib " jialing
2021-03-17 7:26 ` [PATCH v3 05/10] Silicon/Phytium: Added PciHostBridgeLib " jialing
2021-03-17 7:26 ` [PATCH v3 06/10] Silicon/Phytium: Added Spi driver support " jialing
2021-03-17 7:26 ` [PATCH v3 07/10] Silicon/Phytium: Added flash driver support to Phytium Silicon jialing
2021-03-17 7:26 ` [PATCH v3 08/10] Silicon/Phytium: Added fvb driver for norflash Ling Jia
2021-03-17 7:26 ` [PATCH v3 09/10] Silicon/Phytium: Added Rtc driver to FT2000/4 Ling Jia
2021-03-17 7:26 ` [PATCH v3 10/10] Maintainers.txt: Added maintainers and reviewers for the DurianPkg Ling Jia
2021-04-13 2:35 ` [PATCH v3 00/10] Added support for FT2000/4 chip Ling Jia
2021-04-13 16:11 ` Leif Lindholm
2021-05-27 12:43 ` Leif Lindholm
2021-09-07 11:59 ` Leif Lindholm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210413180018.GD1664@vanye \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox