[edk2-devel] [PATCH v8 3/4] Silicon/Phytium: Added fvb driver for flash
From: Ling Jia The FlashFvbDxe provided the fvb protocol, which requested by the flash operators. Signed-off-by: Ling Jia --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc|3 +- Platform/Phytium/DurianPkg/DurianPkg.dsc |1 + Platform/Phytium/DurianPkg/DurianPkg.fdf |2 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 62 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 117 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 1450 6 files changed, 1634 insertions(+), 1 deletion(-) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc index 7166212875ec..5dd5ce0390f3 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc @@ -1,7 +1,7 @@ ## @file # This package provides common open source Phytium silicon modules. # -# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# Copyright (C) 2020-2023, Phytium Technology Co., Ltd. All rights reserved. # # SPDX-License-Identifier:BSD-2-Clause-Patent # @@ -23,6 +23,7 @@ [LibraryClasses.common] AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf + PlatformPKProtectionLib|SecurityPkg/Library/PlatformPKProtectionLibVarPolicy/PlatformPKProtectionLibVarPolicy.inf BaseLib|MdePkg/Library/BaseLib/BaseLib.inf BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 7a390fbe1383..b541e407ac8b 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -267,6 +267,7 @@ [Components.common] # NOR Flash driver # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf # # Usb Support diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 560be98199d2..70b7e99270c2 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -88,6 +88,7 @@ [FV.FvMain] INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf +INF Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf } INF MdeModulePkg/Core/Dxe/DxeMain.inf @@ -104,6 +105,7 @@ [FV.FvMain] INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf new file mode 100755 index ..96df8de51115 --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf @@ -0,0 +1,62 @@ +## @file +# Phytium NorFlash Fvb Drivers. +# +# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved. +# Copyright (C) 2023, Phytium Technology Co., Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = FlashFvbDxe + FILE_GUID = b8923820-3e7c-11eb-b12c-17525e90ecc8 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 0.1 + ENTRY_POINT= FvbEntryPoint + +[Sources] + FlashFvbDxe.c + FlashFvbDxe.h + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + DxeServicesTableLib + HobLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + UefiRuntimeServicesTableLib + +[Guids] + gEfiAuthenticatedVariableGuid + gEfiEventVirtualAddressChangeGuid + gEfiSystemNvDataFvGuid + gEfiVariableGuid + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiFirmwareVolumeBlockProtocolGuid + gSpiNorFlashProtocolGuid + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64
[edk2-devel] [PATCH v8 4/4] Silicon/Phytium: Added runtime support to spi master
From: Ling Jia Solved the problem of virtual address translation in runtime access under OS. Signed-off-by: Ling Jia --- Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 11 ++- Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h | 4 +- Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 88 +--- 3 files changed, 86 insertions(+), 17 deletions(-) diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf index 21d75f268da4..d7ee1999c4ed 100644 --- a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf @@ -1,11 +1,11 @@ -#/** @file +## @file # Phytium Spi Master Drivers. # -# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# Copyright (C) 2020-2023, Phytium Technology Co., Ltd. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # -#**/ +# [Defines] INF_VERSION= 0x0001001b @@ -27,18 +27,23 @@ [Packages] [LibraryClasses] BaseLib DebugLib + DxeServicesTableLib IoLib UefiLib UefiBootServicesTableLib UefiDriverEntryPoint + UefiRuntimeLib + UefiRuntimeServicesTableLib [Guids] + gEfiEventVirtualAddressChangeGuid [Protocols] gSpiMasterProtocolGuid [FixedPcd] gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize [Depex] TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h index 8795ea238d83..80d1db79ebbc 100644 --- a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h @@ -1,7 +1,7 @@ /** @file Phytium Spi Drivers Header - Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + Copyright (C) 2020-2023, Phytium Technology Co., Ltd. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -10,6 +10,8 @@ #ifndef SPI_DXE_H_ #define SPI_DXE_H_ +#include +#include #include #define SPI_MASTER_SIGNATURE SIGNATURE_32 ('M', 'S', 'P', 'I') diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c index 7602a3e0cd63..6915c95f40b0 100644 --- a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c @@ -1,7 +1,7 @@ /** @file Phytium Spi Master Drivers. - Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + Copyright (C) 2020-2023, Phytium Technology Co., Ltd. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -13,8 +13,9 @@ #include #include "SpiDxe.h" -PHYT_SPI_MASTER *pSpiMasterInstance; -static UINTN mSpiControlBase; +STATIC EFI_EVENT mSpiMasterVirtualAddrChangeEvent; +STATIC UINTN mSpiMasterControlBase; +PHYT_SPI_MASTER *mSpiMasterInstance; /** This function inited a spi driver. @@ -66,7 +67,7 @@ SpiMasterSetConfig ( Value = Config; } - SpiAddr = mSpiControlBase + RegAddr; + SpiAddr = mSpiMasterControlBase + RegAddr; MmioWrite32 (SpiAddr, Value); return EFI_SUCCESS; @@ -78,7 +79,7 @@ SpiMasterSetConfig ( @param[in] CmdIdThe id of command. - @param[out] Config The pointer of the config. + @param[out] Config The pointer to the config. @param[in] RegAddr The address of spi registers. @@ -99,7 +100,7 @@ SpiMasterGetConfig ( SpiAddr = 0; Value = 0; - SpiAddr = mSpiControlBase + RegAddr; + SpiAddr = mSpiMasterControlBase + RegAddr; Value = MmioRead32 (SpiAddr); if (CmdId != 0) { @@ -157,6 +158,34 @@ SpiMasterInitProtocol ( return EFI_SUCCESS; } +/** + Fixup internal data so that EFI can be call in virtual mode. + Call the passed in Child Notify event and convert any pointers + in lib to virtual mode. + + @param[in]Event The Event that is being processed. + + @param[in]Context Event Context. + + @retval None. + +**/ +STATIC +VOID +EFIAPI +SpiMasterVirtualNotifyEvent ( + IN EFI_EVENTEvent, + IN VOID *Context + ) +{ + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterControlBase)); + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterInstance->SpiMasterProtocol.SpiGetConfig)); + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterInstance->SpiMasterProtocol.SpiSetConfig)); + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterInstance->SpiMasterProtocol)); + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterInstance)); + + return; +} /** This function is the entrypoint of the spi driver. @@ -178,25 +207,58 @@ SpiMasterDrvEntryPoint ( ) { EFI_STATUS Status; + UINTN SpiMasterControlSize; - pSpiMasterInstance = AllocateRuntimeZeroPool (sizeof (PHYT_SPI_MASTER)); - if (pSpiMasterInstance == NULL) { + mSpiMasterControlBase
[edk2-devel] [PATCH v8 1/4] Platform/Phytium: Solved problems during boot
From: Ling Jia 1.Solved the problem of missing of dependent Library in PciHostBridgeDxe. 2.Solved the problem of missing boot management menu. Signed-off-by: Ling Jia --- Platform/Phytium/DurianPkg/DurianPkg.fdf | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 2d4427e5eaa7..968e93ed80d1 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -1,7 +1,7 @@ ## @file # This package provides common open source Phytium Platform modules. # -# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# Copyright (C) 2020-2023, Phytium Technology Co., Ltd. All rights reserved. # # SPDX-License-Identifier:BSD-2-Clause-Patent # @@ -142,6 +142,7 @@ [FV.FvMain] # # PCI Support # + INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf @@ -204,6 +205,11 @@ [FV.FvMain] INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf INF MdeModulePkg/Application/UiApp/UiApp.inf + # + # Setup + # + INF MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf + [FV.FVMAIN_COMPACT] FvAlignment= 16 ERASE_POLARITY = 1 -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#99289): https://edk2.groups.io/g/devel/message/99289 Mute This Topic: https://groups.io/mt/96623622/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v8 0/4] Improved supports for FT-2000/4 chip.
Completed the flash driver and fvb driver, solved the problems in boot process and added runtime supports for flash operations. The public git repository is : https://github.com/jialing2020/edk2-platforms/tree/Phytium_Opensource_For_FT-2000/4_v8 Cc: Leif Lindholm Cc: Liming Gao Cc: Michael D Kinney Cc: Yiqi Shu Cc: Peng Xie Ling Jia (4): Platform/Phytium: Solved problems during boot Silicon/Phytium: Added flash driver support for flash operation Silicon/Phytium: Added fvb driver for flash Silicon/Phytium: Added runtime support to spi master Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec |3 +- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc |3 +- Platform/Phytium/DurianPkg/DurianPkg.dsc| 16 +- Platform/Phytium/DurianPkg/DurianPkg.fdf| 16 +- Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 11 +- Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 51 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf| 62 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h |4 +- Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 102 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 117 ++ Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 88 +- Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 409 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 1450 14 files changed, 2385 insertions(+), 21 deletions(-) create mode 100755 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf create mode 100755 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf create mode 100755 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h create mode 100755 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h create mode 100755 Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h create mode 100755 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c create mode 100755 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#99287): https://edk2.groups.io/g/devel/message/99287 Mute This Topic: https://groups.io/mt/96623620/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v8 2/4] Silicon/Phytium: Added flash driver support for flash operation
From: Ling Jia The SpiNorFlashDxe provided norflash initialization, read-write, erase and other interfaces. This is a special communication protocol for FT-2000/4 chip. Signed-off-by: Ling Jia --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 3 +- Platform/Phytium/DurianPkg/DurianPkg.dsc| 15 +- Platform/Phytium/DurianPkg/DurianPkg.fdf| 6 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 51 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 102 + Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 409 7 files changed, 658 insertions(+), 2 deletions(-) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 8427f32211f4..dc00f4d89716 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -1,7 +1,7 @@ ## @file # This package provides common Phytium silicon modules. # -# Copyright (C) 2020, Phytium Technology Co,Ltd. All rights reserved. +# Copyright (C) 2020-2023, Phytium Technology Co., Ltd. All rights reserved. # # SPDX-License-Identifier:BSD-2-Clause-Patent # @@ -49,3 +49,4 @@ [PcdsFixedAtBuild.common] [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} + gSpiNorFlashProtocolGuid = { 0x00b4af42, 0xfbd0, 0x11ea, { 0x80, 0x3a, 0x27, 0xea, 0x5e, 0x65, 0xe3, 0xf6}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index c1519070d616..7a390fbe1383 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -1,7 +1,7 @@ ## @file # This package provides common open source Phytium Platform modules. # -# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# Copyright (C) 2020-2023, Phytium Technology Co., Ltd. All rights reserved. # # SPDX-License-Identifier:BSD-2-Clause-Patent # @@ -100,6 +100,14 @@ [PcdsFixedAtBuild.common] # Stack Size gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000 + # + # SPI Flash Control Register Base Address and Size + # + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase|0x0 + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x100 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x28014000 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x1000 + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress|0x2800D000 # # Designware PCI Root Complex # @@ -255,6 +263,11 @@ [Components.common] # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # + # NOR Flash driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 968e93ed80d1..560be98199d2 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -83,6 +83,11 @@ [FV.FvMain] APRIORI DXE { INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf +INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf +INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf +INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf +INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf +INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf } INF MdeModulePkg/Core/Dxe/DxeMain.inf @@ -98,6 +103,7 @@ [FV.FvMain] INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf new file mode 100755 index ..e90b03489dd9 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf @@ -0,0 +1,51 @@ +## @file +# +# Component file for the Phytium NorFlash Drivers. +# +# Copyright (C) 2023, Phytium Technology Co., Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION= 0x0001001B + BASE_NAME = SpiNorFlashDxe + FILE_GUID = F37EF706-187C-48FD-9102-DDBF86F551BE + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= NorFlashPlatformEntryPoint + +[Sources.common] + SpiNorFlashDxe.c + SpiNorFlashDxe.h
[edk2-devel] [PATCH v8 3/4] Silicon/Phytium: Added fvb driver for flash
From: Ling Jia The FlashFvbDxe provided the fvb protocol, which requested by the flash operators. Signed-off-by: Ling Jia --- Platform/Phytium/DurianPkg/DurianPkg.dsc |1 + Platform/Phytium/DurianPkg/DurianPkg.fdf |2 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 63 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 105 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 1329 5 files changed, 1500 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index cc0d41855584..cedf7480a5d6 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -267,6 +267,7 @@ [Components.common] # NOR Flash driver # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf # # Usb Support diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index fffbc5b19565..9e97f614ea8a 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -88,6 +88,7 @@ [FV.FvMain] INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf +INF Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf } INF MdeModulePkg/Core/Dxe/DxeMain.inf @@ -104,6 +105,7 @@ [FV.FvMain] INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf new file mode 100755 index ..7e947e6e753d --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf @@ -0,0 +1,63 @@ +#/** @file +# Phytium NorFlash Fvb Drivers. +# +# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved. +# Copyright (C) 2022, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = FlashFvbDxe + FILE_GUID = b8923820-3e7c-11eb-b12c-17525e90ecc8 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 0.1 + ENTRY_POINT= FvbEntryPoint + +[Sources] + FlashFvbDxe.c + FlashFvbDxe.h + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + DxeServicesTableLib + HobLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + UefiRuntimeServicesTableLib + +[Guids] + gEfiAuthenticatedVariableGuid + gEfiEventVirtualAddressChangeGuid + gEfiSystemNvDataFvGuid + gEfiVariableGuid + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiFirmwareVolumeBlockProtocolGuid + gSpiNorFlashProtocolGuid + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 + + +[Depex] + TRUE diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h new file mode 100755 index ..19a32fa7ff9b --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h @@ -0,0 +1,105 @@ +/** @file + Phytium NorFlash Fvb Drivers Header. + + Copyright (C) 2022, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#ifndef FVB_FLASH_DXE_H_ +#define FVB_FLASH_DXE_H_ + +#include +#include +#include +#include + +#define GET_DATA_OFFSET(BaseAddr, Lba, LbaSize) ((BaseAddr) + (UINTN)((Lba) * (LbaSize))) +#define FVB_FLASH_SIGNATURE SIGNATURE_32('S', 'N', 'O', 'R') +#define INSTANCE_FROM_FVB_THIS(a) CR(a, FT_FVB_DEVICE, FvbProtocol, FVB_FLASH_SIGNATURE) + +typedef struct _FT_FVB_DEVICEFT_FVB_DEVICE; + +#define NOR_FLASH_
[edk2-devel] [PATCH v8 4/4] Silicon/Phytium: Added runtime support to spi master
From: Ling Jia Solved the problem of virtual address translation in runtime access under OS. Signed-off-by: Ling Jia --- Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 5 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h | 2 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 84 +--- 3 files changed, 80 insertions(+), 11 deletions(-) diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf index 21d75f268da4..0b23821c6523 100644 --- a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf @@ -27,18 +27,23 @@ [Packages] [LibraryClasses] BaseLib DebugLib + DxeServicesTableLib IoLib UefiLib UefiBootServicesTableLib UefiDriverEntryPoint + UefiRuntimeLib + UefiRuntimeServicesTableLib [Guids] + gEfiEventVirtualAddressChangeGuid [Protocols] gSpiMasterProtocolGuid [FixedPcd] gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize [Depex] TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h index 8795ea238d83..842d0c3d1861 100644 --- a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h @@ -10,6 +10,8 @@ #ifndef SPI_DXE_H_ #define SPI_DXE_H_ +#include +#include #include #define SPI_MASTER_SIGNATURE SIGNATURE_32 ('M', 'S', 'P', 'I') diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c index 7602a3e0cd63..5358ff6090dd 100644 --- a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c @@ -13,8 +13,9 @@ #include #include "SpiDxe.h" -PHYT_SPI_MASTER *pSpiMasterInstance; -static UINTN mSpiControlBase; +STATIC EFI_EVENT mSpiMasterVirtualAddrChangeEvent; +STATIC UINTN mSpiMasterControlBase; +PHYT_SPI_MASTER *mSpiMasterInstance; /** This function inited a spi driver. @@ -66,7 +67,7 @@ SpiMasterSetConfig ( Value = Config; } - SpiAddr = mSpiControlBase + RegAddr; + SpiAddr = mSpiMasterControlBase + RegAddr; MmioWrite32 (SpiAddr, Value); return EFI_SUCCESS; @@ -99,7 +100,7 @@ SpiMasterGetConfig ( SpiAddr = 0; Value = 0; - SpiAddr = mSpiControlBase + RegAddr; + SpiAddr = mSpiMasterControlBase + RegAddr; Value = MmioRead32 (SpiAddr); if (CmdId != 0) { @@ -157,6 +158,34 @@ SpiMasterInitProtocol ( return EFI_SUCCESS; } +/** + Fixup internal data so that EFI can be call in virtual mode. + Call the passed in Child Notify event and convert any pointers + in lib to virtual mode. + + @param[in]Event The Event that is being processed. + + @param[in]Context Event Context. + + @retval None. + +**/ +STATIC +VOID +EFIAPI +SpiMasterVirtualNotifyEvent ( + IN EFI_EVENTEvent, + IN VOID *Context + ) +{ + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterControlBase)); + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterInstance->SpiMasterProtocol.SpiGetConfig)); + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterInstance->SpiMasterProtocol.SpiSetConfig)); + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterInstance->SpiMasterProtocol)); + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterInstance)); + + return; +} /** This function is the entrypoint of the spi driver. @@ -178,25 +207,58 @@ SpiMasterDrvEntryPoint ( ) { EFI_STATUS Status; + UINTN SpiMasterControlSize; - pSpiMasterInstance = AllocateRuntimeZeroPool (sizeof (PHYT_SPI_MASTER)); - if (pSpiMasterInstance == NULL) { + mSpiMasterControlBase = FixedPcdGet64 (PcdSpiControllerBase); + SpiMasterControlSize = FixedPcdGet64 (PcdSpiControllerSize); + + mSpiMasterInstance = AllocateRuntimeZeroPool (sizeof (PHYT_SPI_MASTER)); + if (mSpiMasterInstance == NULL) { return EFI_OUT_OF_RESOURCES; } - mSpiControlBase = FixedPcdGet64 (PcdSpiControllerBase); + mSpiMasterControlBase = FixedPcdGet64 (PcdSpiControllerBase); - SpiMasterInitProtocol (&pSpiMasterInstance->SpiMasterProtocol); + SpiMasterInitProtocol (&mSpiMasterInstance->SpiMasterProtocol); - pSpiMasterInstance->Signature = SPI_MASTER_SIGNATURE; + mSpiMasterInstance->Signature = SPI_MASTER_SIGNATURE; Status = gBS->InstallMultipleProtocolInterfaces ( -&(pSpiMasterInstance->Handle), +&(mSpiMasterInstance->Handle), &gSpiMasterProtocolGuid, -&(pSpiMasterInstance->SpiMasterProtocol), +&(mSpiMasterInstance->SpiMasterProtocol), NULL ); ASSERT_EFI_ERROR (Status); + // + // Declare th
[edk2-devel] [PATCH v8 2/4] Silicon/Phytium: Added flash driver support for flash operation
From: Ling Jia The SpiNorFlashDxe provided norflash initialization, read-write, erase and other interfaces. This is a special communication protocol for FT-2000/4 chip. Signed-off-by: Ling Jia --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 1 + Platform/Phytium/DurianPkg/DurianPkg.dsc| 13 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 6 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 49 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 95 + Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 412 7 files changed, 650 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 8427f32211f4..4c6c5c5f1118 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -49,3 +49,4 @@ [PcdsFixedAtBuild.common] [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} + gSpiNorFlashProtocolGuid = { 0x00b4af42, 0xfbd0, 0x11ea, { 0x80, 0x3a, 0x27, 0xea, 0x5e, 0x65, 0xe3, 0xf6}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index c1519070d616..cc0d41855584 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -100,6 +100,14 @@ [PcdsFixedAtBuild.common] # Stack Size gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000 + # + # SPI Flash Control Register Base Address and Size + # + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase|0x0 + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x100 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x28014000 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x1000 + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress|0x2800D000 # # Designware PCI Root Complex # @@ -255,6 +263,11 @@ [Components.common] # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # + # NOR Flash driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index efb855c5da9e..fffbc5b19565 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -83,6 +83,11 @@ [FV.FvMain] APRIORI DXE { INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf +INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf +INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf +INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf +INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf +INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf } INF MdeModulePkg/Core/Dxe/DxeMain.inf @@ -98,6 +103,7 @@ [FV.FvMain] INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf new file mode 100755 index ..94e7d0633467 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf @@ -0,0 +1,49 @@ +#/** @file +# Phytium NorFlash Drivers. +# +# Copyright (C) 2022, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SpiNorFlashDxe + FILE_GUID = f37ef706-187c-48fd-9102-ddbf86f551be + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= NorFlashPlatformEntryPoint + +[Sources.common] + SpiNorFlashDxe.c + SpiNorFlashDxe.h + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + UefiLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + UefiRuntimeServicesTableLib + +[FixedPcd] + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase +[Guids] + gEfiEventVirtualAddressChangeGuid + +[Protocols] + gSpiMasterProtocolGuid + gSpiNorFlashProtocolGuid + + [Depex] + TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers
[edk2-devel] [PATCH v8 1/4] Platform/Phytium: Solved problems during boot
From: Ling Jia Solved the problem of lack of dependent Library in PciHostBridgeDxe. Solved the problem of missing boot management menu. Signed-off-by: Ling Jia --- Platform/Phytium/DurianPkg/DurianPkg.fdf | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 2d4427e5eaa7..efb855c5da9e 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -142,6 +142,7 @@ [FV.FvMain] # # PCI Support # + INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf @@ -204,6 +205,11 @@ [FV.FvMain] INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf INF MdeModulePkg/Application/UiApp/UiApp.inf + # + #Setup + # + INF MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf + [FV.FVMAIN_COMPACT] FvAlignment= 16 ERASE_POLARITY = 1 -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#92245): https://edk2.groups.io/g/devel/message/92245 Mute This Topic: https://groups.io/mt/92911788/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v8 0/4] Improved supports for FT-2000/4 chip.
Completed the flash driver and fvb driver, solved the problems in boot process and added runtime supports for flash operations under OS. The public git repository is : https://github.com/jialing2020/edk2-platforms/tree/Phytium_Opensource_For_FT-2000/4_v8 Cc: Leif Lindholm Cc: Liming Gao Cc: Michael D Kinney Cc: Yiqi Shu Cc: Peng Xie Ling Jia (4): Platform/Phytium: Solved problems during boot Silicon/Phytium: Added flash driver support for flash operation Silicon/Phytium: Added fvb driver for flash Silicon/Phytium: Added runtime support to spi master Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec |1 + Platform/Phytium/DurianPkg/DurianPkg.dsc | 14 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 14 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf |5 + Silicon/Phytium/FT2000-4Pkg/Drivers/{SpiDxe/SpiDxe.inf => SpiNorFlashDxe/SpiNorFlashDxe.inf} | 27 +- Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 63 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h |2 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 95 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 105 ++ Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 84 +- Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 412 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 1329 13 files changed, 2203 insertions(+), 22 deletions(-) copy Silicon/Phytium/FT2000-4Pkg/Drivers/{SpiDxe/SpiDxe.inf => SpiNorFlashDxe/SpiNorFlashDxe.inf} (50%) mode change 100644 => 100755 create mode 100755 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf create mode 100755 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h create mode 100755 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h create mode 100755 Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h create mode 100755 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c create mode 100755 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#92246): https://edk2.groups.io/g/devel/message/92246 Mute This Topic: https://groups.io/mt/92911789/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v7 1/4] Platform/Phytium: Solved problems during boot.
Solved the problem of lack of dependent Library in PciHostBridgeDxe. Solved the problem of missing boot magager menu. Signed-off-by: Ling Jia Reviewed-by: leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.fdf | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 2d4427e5ea..efb855c5da 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -142,6 +142,7 @@ READ_LOCK_STATUS = TRUE # # PCI Support # + INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf @@ -204,6 +205,11 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf INF MdeModulePkg/Application/UiApp/UiApp.inf + # + #Setup + # + INF MdeModulePkg/Application/BootManagerMenuApp/BootManagerMenuApp.inf + [FV.FVMAIN_COMPACT] FvAlignment= 16 ERASE_POLARITY = 1 -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88903): https://edk2.groups.io/g/devel/message/88903 Mute This Topic: https://groups.io/mt/90458875/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v7 2/4] Silicon/Phytium: Added flash driver support to Phytium Silicon.
The SpiNorFlashDxe provided norflash initialization, read-write, erase and other interfaces. This is a set of special communication protocol for ft2004/4 chip QSPI controller. Signed-off-by: Ling Jia Reviewed-by: leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 1 + Platform/Phytium/DurianPkg/DurianPkg.dsc| 13 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 24 +- Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 49 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 95 + Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 412 7 files changed, 658 insertions(+), 10 deletions(-) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 8427f32211..4c6c5c5f11 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -49,3 +49,4 @@ [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} + gSpiNorFlashProtocolGuid = { 0x00b4af42, 0xfbd0, 0x11ea, { 0x80, 0x3a, 0x27, 0xea, 0x5e, 0x65, 0xe3, 0xf6}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index c1519070d6..cc0d418555 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -100,6 +100,14 @@ # Stack Size gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000 + # + # SPI Flash Control Register Base Address and Size + # + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase|0x0 + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x100 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x28014000 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x1000 + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress|0x2800D000 # # Designware PCI Root Complex # @@ -255,6 +263,11 @@ # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # + # NOR Flash driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index efb855c5da..5c1471d8ed 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -83,6 +83,11 @@ READ_LOCK_STATUS = TRUE APRIORI DXE { INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf +INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf +INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf +INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf +INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf +INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf } INF MdeModulePkg/Core/Dxe/DxeMain.inf @@ -91,29 +96,28 @@ READ_LOCK_STATUS = TRUE # # PI DXE Drivers producing Architectural Protocols (EFI Services) # + INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf + INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf - INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf - INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.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 + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf # # Variable services # INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf + INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf + INF ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf + INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf # # ACPI Support diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf new file mode 100755 index 00..2173405809 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe
[edk2-devel] [PATCH v7 3/4] Silicon/Phytium: Added fvb driver for flash
The FlashFvbDxe provided the fvb protocol, which requested by the flash operators. Signed-off-by: Ling Jia Reviewed-by: leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc |1 + Platform/Phytium/DurianPkg/DurianPkg.fdf |2 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 63 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 105 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 1329 5 files changed, 1500 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index cc0d418555..cedf7480a5 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -267,6 +267,7 @@ # NOR Flash driver # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf # # Usb Support diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 5c1471d8ed..1a52250db2 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -88,6 +88,7 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf +INF Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf } INF MdeModulePkg/Core/Dxe/DxeMain.inf @@ -105,6 +106,7 @@ READ_LOCK_STATUS = TRUE INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf # # Variable services diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf new file mode 100755 index 00..9121be921c --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf @@ -0,0 +1,63 @@ +#/** @file +# Phytium NorFlash Fvb Drivers. +# +# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved. +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = FlashFvbDxe + FILE_GUID = b8923820-3e7c-11eb-b12c-17525e90ecc8 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 0.1 + ENTRY_POINT= FvbEntryPoint + +[Sources] + FlashFvbDxe.c + FlashFvbDxe.h + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + DxeServicesTableLib + HobLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + UefiRuntimeServicesTableLib + +[Guids] + gEfiAuthenticatedVariableGuid + gEfiEventVirtualAddressChangeGuid + gEfiSystemNvDataFvGuid + gEfiVariableGuid + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiFirmwareVolumeBlockProtocolGuid + gSpiNorFlashProtocolGuid + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 + + +[Depex] + TRUE diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h new file mode 100755 index 00..923ad3ccbb --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h @@ -0,0 +1,105 @@ +/** @file + Phytium NorFlash Fvb Drivers Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#ifndef FVB_FLASH_DXE_H_ +#define FVB_FLASH_DXE_H_ + +#include +#include +#include +#include + +#define GET_DATA_OFFSET(BaseAddr, Lba, LbaSize) ((BaseAddr) + (UINTN)((Lba) * (LbaSize))) +#define FVB_FLASH_SIGNATURE SIGNATURE_32('S', 'N', 'O', 'R') +#define INSTANCE_FROM_FVB_THIS(a) CR(a, FT_FVB_DEVICE, FvbProtocol, FVB_FLASH_SIGNATURE) + +typedef struct _FT_FVB_DEVICEFT_FVB_DEVICE; + +#define NOR_FLASH_ERASE_RETRY 10 + +typedef struct { + VENDOR_DEVICE_PATH Vendor; + EFI_DEVICE_PATH_PROTOCOL
[edk2-devel] [PATCH v7 0/4] Improved support for FT2004/4 chip.
Completed the flash driver and fvb driver. Solved the problems in boot process. Added virtual address conversion. The public git repository is : https://github.com/jialing2020/edk2-platforms/tree/Phytium_Opensource_For_FT2000-4_v7 Ling Jia (4): Platform/Phytium: Solved problems during boot. Silicon/Phytium: Added flash driver support to Phytium Silicon. Silicon/Phytium: Added fvb driver for flash Silicon/Phytium: Added runtime support to spi master. Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec |1 + Platform/Phytium/DurianPkg/DurianPkg.dsc | 14 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 32 +- Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf |5 + Silicon/Phytium/FT2000-4Pkg/Drivers/{SpiDxe/SpiDxe.inf => SpiNorFlashDxe/SpiNorFlashDxe.inf} | 25 +- Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 63 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h |2 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 95 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 105 ++ Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 84 +- Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 412 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 1329 13 files changed, 2210 insertions(+), 31 deletions(-) copy Silicon/Phytium/FT2000-4Pkg/Drivers/{SpiDxe/SpiDxe.inf => SpiNorFlashDxe/SpiNorFlashDxe.inf} (55%) mode change 100644 => 100755 create mode 100755 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf create mode 100755 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h create mode 100755 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h create mode 100755 Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h create mode 100755 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c create mode 100755 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88906): https://edk2.groups.io/g/devel/message/88906 Mute This Topic: https://groups.io/mt/90458878/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v7 4/4] Silicon/Phytium: Added runtime support to spi master.
Solved the problem of virtual address translation in runtime access under OS Signed-off-by: Ling Jia Reviewed-by: leif Lindholm --- Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 5 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h | 2 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 84 +--- 3 files changed, 80 insertions(+), 11 deletions(-) diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf index 21d75f268d..0b23821c65 100644 --- a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf @@ -27,18 +27,23 @@ [LibraryClasses] BaseLib DebugLib + DxeServicesTableLib IoLib UefiLib UefiBootServicesTableLib UefiDriverEntryPoint + UefiRuntimeLib + UefiRuntimeServicesTableLib [Guids] + gEfiEventVirtualAddressChangeGuid [Protocols] gSpiMasterProtocolGuid [FixedPcd] gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize [Depex] TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h index 8795ea238d..842d0c3d18 100644 --- a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h @@ -10,6 +10,8 @@ #ifndef SPI_DXE_H_ #define SPI_DXE_H_ +#include +#include #include #define SPI_MASTER_SIGNATURE SIGNATURE_32 ('M', 'S', 'P', 'I') diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c index 7602a3e0cd..5358ff6090 100644 --- a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c @@ -13,8 +13,9 @@ #include #include "SpiDxe.h" -PHYT_SPI_MASTER *pSpiMasterInstance; -static UINTN mSpiControlBase; +STATIC EFI_EVENT mSpiMasterVirtualAddrChangeEvent; +STATIC UINTN mSpiMasterControlBase; +PHYT_SPI_MASTER *mSpiMasterInstance; /** This function inited a spi driver. @@ -66,7 +67,7 @@ SpiMasterSetConfig ( Value = Config; } - SpiAddr = mSpiControlBase + RegAddr; + SpiAddr = mSpiMasterControlBase + RegAddr; MmioWrite32 (SpiAddr, Value); return EFI_SUCCESS; @@ -99,7 +100,7 @@ SpiMasterGetConfig ( SpiAddr = 0; Value = 0; - SpiAddr = mSpiControlBase + RegAddr; + SpiAddr = mSpiMasterControlBase + RegAddr; Value = MmioRead32 (SpiAddr); if (CmdId != 0) { @@ -157,6 +158,34 @@ SpiMasterInitProtocol ( return EFI_SUCCESS; } +/** + Fixup internal data so that EFI can be call in virtual mode. + Call the passed in Child Notify event and convert any pointers + in lib to virtual mode. + + @param[in]Event The Event that is being processed. + + @param[in]Context Event Context. + + @retval None. + +**/ +STATIC +VOID +EFIAPI +SpiMasterVirtualNotifyEvent ( + IN EFI_EVENTEvent, + IN VOID *Context + ) +{ + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterControlBase)); + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterInstance->SpiMasterProtocol.SpiGetConfig)); + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterInstance->SpiMasterProtocol.SpiSetConfig)); + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterInstance->SpiMasterProtocol)); + EfiConvertPointer (0x0, (VOID **)&(mSpiMasterInstance)); + + return; +} /** This function is the entrypoint of the spi driver. @@ -178,25 +207,58 @@ SpiMasterDrvEntryPoint ( ) { EFI_STATUS Status; + UINTN SpiMasterControlSize; - pSpiMasterInstance = AllocateRuntimeZeroPool (sizeof (PHYT_SPI_MASTER)); - if (pSpiMasterInstance == NULL) { + mSpiMasterControlBase = FixedPcdGet64 (PcdSpiControllerBase); + SpiMasterControlSize = FixedPcdGet64 (PcdSpiControllerSize); + + mSpiMasterInstance = AllocateRuntimeZeroPool (sizeof (PHYT_SPI_MASTER)); + if (mSpiMasterInstance == NULL) { return EFI_OUT_OF_RESOURCES; } - mSpiControlBase = FixedPcdGet64 (PcdSpiControllerBase); + mSpiMasterControlBase = FixedPcdGet64 (PcdSpiControllerBase); - SpiMasterInitProtocol (&pSpiMasterInstance->SpiMasterProtocol); + SpiMasterInitProtocol (&mSpiMasterInstance->SpiMasterProtocol); - pSpiMasterInstance->Signature = SPI_MASTER_SIGNATURE; + mSpiMasterInstance->Signature = SPI_MASTER_SIGNATURE; Status = gBS->InstallMultipleProtocolInterfaces ( -&(pSpiMasterInstance->Handle), +&(mSpiMasterInstance->Handle), &gSpiMasterProtocolGuid, -&(pSpiMasterInstance->SpiMasterProtocol), +&(mSpiMasterInstance->SpiMasterProtocol), NULL ); ASSERT_EFI_ERROR (Status); + // + // Declare the SPI Controller Space as EFI_MEMORY_RUNTIM
Re: [edk2-devel] [PATCH v6 04/10] Silicon/Phytium: Added PciSegmentLib to FT2000/4
Hi Leif, Thank you for your reply! I think your suggestion is very good. There is no dependency between patches 8 / 10 and 7 / 10. I think it would be great if we could merge. For patch 7, Please point out what can be changed better, I will modify it according to your suggestions. Best Regards, Ling > -原始邮件- > 发件人: "Leif Lindholm" > 发送时间: 2021-09-13 20:42:18 (星期一) > 收件人: "Ling Jia" > 抄送: devel@edk2.groups.io > 主题: Re: [PATCH v6 04/10] Silicon/Phytium: Added PciSegmentLib to FT2000/4 > > Hi Ling, > > Having had a look at this version, I propose folding in this change: > > diff --git > a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c > b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c > index 273443fd5d68..124909cc015e 100644 > --- a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c > +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c > @@ -1286,9 +1286,8 @@ PciSegmentReadBuffer ( >if ((StartAddress & BIT0) != 0) { > // > // Read a byte if StartAddress is byte aligned, > -// Volatile ensure that the latest values are read every time. > // > -*(UINT8 *)Buffer = PciSegmentRead8 (StartAddress); > +MmioWrite8 ((UINTN)Buffer, PciSegmentRead8 (StartAddress)); > StartAddress += sizeof (UINT8); > Size -= sizeof (UINT8); > Buffer = (UINT8 *)Buffer + 1; > @@ -1328,7 +1327,7 @@ PciSegmentReadBuffer ( > // > // Read the last remaining byte if exist > // > -*(UINT8 *)Buffer = PciSegmentRead8 (StartAddress); > +MmioWrite8 ((UINTN)Buffer, PciSegmentRead8 (StartAddress)); >} > >return ReturnValue; > > > > If you are OK with that, I feel that patches 1-6 and 9-10 are ready to > be merged. > > I would like to discuss 7/10 to see if we can improve the readability > of the code, based on the additional information you provided. > (And I think there is no point to include 8/10 without 7/10?) > > Best Regards, > > Leif > > > On Fri, Sep 10, 2021 at 16:20:57 +0800, Ling Jia wrote: > > The PCI Segment Library for Phytium platform. > > with multiple RCs. > > > > Signed-off-by: Ling Jia > > Reviewed-by: Leif Lindholm > > --- > > Platform/Phytium/DurianPkg/DurianPkg.dsc|9 > > +- > > Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf | 28 > > + > > Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c | 1434 > > > > 3 files changed, 1464 insertions(+), 7 deletions(-) > > > > diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc > > b/Platform/Phytium/DurianPkg/DurianPkg.dsc > > index 28e52e15e3..093b2cd9db 100644 > > --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc > > +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc > > @@ -35,7 +35,8 @@ > >PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf > > > > [LibraryClasses.common.DXE_DRIVER] > > - > > + # Pci dependencies > > + > > PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf > > > > > > > > # > > @@ -262,12 +263,6 @@ > >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. > > diff --git > > a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf > > b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf > > new file mode 100644 > > index 00..67360016ef > > --- /dev/null > > +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf > > @@ -0,0 +1,28 @@ > > +#/** @file > > +# PCI Segment Library for Phytium platform with multiple RCs. > > +# > > +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. > > +# > > +# SPDX-License-Identifier: BSD-2-Clause-Patent > > +# > > +#**/ > > + > > +[Defines] > > + INF_VERSION= 0x0001001b > > + BASE_NAME = PciSegmentLib > > + FILE_GUID
[edk2-devel] [PATCH v6 06/10] Silicon/Phytium: Added Spi driver support to FT2000/4
The SpiDxe is to provide Spi bus read-write interfaces. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 9 + Platform/Phytium/DurianPkg/DurianPkg.dsc| 5 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 2 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 44 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h | 59 ++ Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiProtocol.h | 51 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 202 7 files changed, 372 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 48f430c88d..69842b89e0 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -38,4 +38,13 @@ gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x0002 gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x0003 + # + # SPI Flash Controller Register Base Address and Size + # + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase|0x0|UINT64|0x0004 + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x0005 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x0006 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x0007 + [Protocols] + gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 3a9bc2289c..68698d613f 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -244,6 +244,11 @@ # ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf + # + # Spi driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index a443d0f3a4..1cf1927484 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -95,6 +95,8 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf new file mode 100644 index 00..21d75f268d --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf @@ -0,0 +1,44 @@ +#/** @file +# Phytium Spi Master Drivers. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SpiDxe + FILE_GUID = 2ba95e5c-f7f5-11ea-bf18-67fdc5787495 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= SpiMasterDrvEntryPoint + +[Sources.common] + SpiDxe.c + SpiDxe.h + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + UefiLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + +[Protocols] + gSpiMasterProtocolGuid + +[FixedPcd] + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase + +[Depex] + TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h new file mode 100644 index 00..8795ea238d --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h @@ -0,0 +1,59 @@ +/** @file + Phytium Spi Drivers Header + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SPI_DXE_H_ +#define SPI_DXE_H_ + +#include + +#define SPI_MASTER_SIGNATURE SIGNATURE_32 ('M', 'S', 'P', 'I') +#define REG_MODE_REG 0x02C + +EFI_STATUS +EFIAPI +SpiMasterGetConfig ( + IN UINT8CmdId, + OUT UINT32 *Config, + IN UINTNRegAddr + ); + +EFI_STATUS +EFIAPI +SpiMasterSetConfig ( + IN UINT8 CmdId, + IN UINT32Config, + IN UINTN RegAddr + ); + +EFI_STATUS +EFIAPI +SpiMasterSetMode ( + IN UINT32Config + ); + +EFI_STATUS +EFIAPI +SpiMasterInit ( + VOID + ); + +typedef struct { + EFI_SPI_DRV_PROTOCOLSpiMasterProtocol; + UINTN Signature; + EFI_HANDLE H
[edk2-devel] [PATCH v6 10/10] Maintainers.txt: Added maintainers and reviewers for the DurianPkg
Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Maintainers.txt | 8 1 file changed, 8 insertions(+) diff --git a/Maintainers.txt b/Maintainers.txt index 979553b610..c839c71b22 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -371,3 +371,11 @@ F: Silicon/SiFive/ M: Abner Chang M: Gilbert Chen R: Daniel Schaefer + +Phytium platforms and silicon +F: Platform/Phytium/ +F: Silicon/silicon/ +M: Leif Lindholm +R: Peng Xie +R: Ling Jia +R: Yiqi Shu -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#80487): https://edk2.groups.io/g/devel/message/80487 Mute This Topic: https://groups.io/mt/85504853/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v6 09/10] Silicon/Phytium: Added Rtc driver to FT2000/4
The RealTimeClockLib implemented EFI RealTimeClock runtime services via RTC Lib. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 1 + Platform/Phytium/DurianPkg/DurianPkg.dsc | 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 2 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf | 39 ++ Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h | 24 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.c | 462 6 files changed, 534 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 2686ba3cc3..4c6c5c5f11 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -45,6 +45,7 @@ gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x0005 gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x0006 gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x0007 + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress|0x0|UINT32|0x0008 [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 99034365d3..9579f8e9b7 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -29,6 +29,10 @@ # Phytium Platform library ArmPlatformLib|Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf + #FT2000-4Pkg RTC Driver + RealTimeClockLib|Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.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 @@ -168,6 +172,8 @@ NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf } MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf + EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf # # Common Arm Timer and Gic Components diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 67458458dd..242f647ca1 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -93,6 +93,8 @@ READ_LOCK_STATUS = TRUE # INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf new file mode 100644 index 00..09a06d53ae --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf @@ -0,0 +1,39 @@ +#/** @file +# Phytium RealTime Clock Library file. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = RealTimeClockLib + FILE_GUID = fb320c94-40fe-11eb-b990-171865af292c + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = RealTimeClockLib + +[Sources.common] + RealTimeClockLib.c + RealTimeClockLib.h + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + DxeServicesTableLib + IoLib + TimeBaseLib + UefiRuntimeLib + +[Guids] + gEfiEventVirtualAddressChangeGuid + +[Pcd] + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h new file mode 100644 index 00..41ce002dc3 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h @@ -0,0 +1,24 @@ +/** @file + Phytium RealTime Clock Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef REAL_TIME_CLOCK_H_ +#define REAL_TIME_CLOCK_H_ + +#define RTC_CMR
[edk2-devel] [PATCH v6 07/10] Silicon/Phytium: Added flash driver support to Phytium Silicon
The SpiNorFlashDxe provided norflash initialization, read-write, erase and other interfaces. This is a set of special communication protocol for ft2000/4 chip QSPI controller. Signed-off-by: Ling Jia --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 1 + Platform/Phytium/DurianPkg/DurianPkg.dsc| 5 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 1 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 48 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 95 + Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 412 7 files changed, 636 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 69842b89e0..2686ba3cc3 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -48,3 +48,4 @@ [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} + gSpiNorFlashProtocolGuid = { 0x00b4af42, 0xfbd0, 0x11ea, { 0x80, 0x3a, 0x27, 0xea, 0x5e, 0x65, 0xe3, 0xf6}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 68698d613f..1c47051441 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -249,6 +249,11 @@ # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # + # NOR Flash driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 1cf1927484..831f7a6828 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -96,6 +96,7 @@ READ_LOCK_STATUS = TRUE INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf new file mode 100644 index 00..2933dc502e --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf @@ -0,0 +1,48 @@ +#/** @file +# Phytium NorFlash Drivers. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SpiNorFlashDxe + FILE_GUID = f37ef706-187c-48fd-9102-ddbf86f551be + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= NorFlashPlatformEntryPoint + +[Sources.common] + SpiNorFlashDxe.c + SpiNorFlashDxe.h + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + UefiLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + +[FixedPcd] + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase +[Guids] + gEfiEventVirtualAddressChangeGuid + +[Protocols] + gSpiMasterProtocolGuid + gSpiNorFlashProtocolGuid + + [Depex] + TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h new file mode 100644 index 00..40d9607233 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h @@ -0,0 +1,95 @@ +/** @file + Phytium NorFlash Drivers Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SPI_NORFLASH_DXE_H_ +#define SPI_NORFLASH_DXE_H_ + +#include +#include + +// +// Norflash registers +// +#define REG_FLASH_CAP 0x000 +#define REG_RD_CFG0x004 +#define REG_WR_CFG0x008 +#define REG_FLUSH_REG 0x00C +#define REG_CMD_PORT 0x010 +#define REG_ADDR_PORT 0x014 +#define REG_HD_PORT 0x018 +#define REG_LD_PORT 0x01C +#define REG_CS_CFG0x020 +#define REG_WIP_CFG 0x024 +#define REG_WP_REG0x028 + +#define NORFLASH_SIGNATURE SIGNATURE_32 ('F', 'T', 'S', 'F') +#define SPI_FLASH_BASE FixedPcdGet64 (PcdSpiFlashBase) +#def
[edk2-devel] [PATCH v6 08/10] Silicon/Phytium: Added fvb driver for norflash
The FlashFvbDxe provided the fvb protocol, which requested by the flash operators. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc |1 + Platform/Phytium/DurianPkg/DurianPkg.fdf |1 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 61 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 104 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 1304 5 files changed, 1471 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 1c47051441..99034365d3 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -253,6 +253,7 @@ # NOR Flash driver # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf # # Usb Support diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 831f7a6828..67458458dd 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -103,6 +103,7 @@ READ_LOCK_STATUS = TRUE INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf INF ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf new file mode 100644 index 00..ff23721d6e --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf @@ -0,0 +1,61 @@ +#/** @file +# Phytium NorFlash Fvb Drivers. +# +# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved. +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = FlashFvbDxe + FILE_GUID = b8923820-3e7c-11eb-b12c-17525e90ecc8 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 0.1 + ENTRY_POINT= FvbEntryPoint + +[Sources] + FlashFvbDxe.c + FlashFvbDxe.h + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + DxeServicesTableLib + HobLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + +[Guids] + gEfiAuthenticatedVariableGuid + gEfiEventVirtualAddressChangeGuid + gEfiSystemNvDataFvGuid + gEfiVariableGuid + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiFirmwareVolumeBlockProtocolGuid + gSpiNorFlashProtocolGuid + +[Pcd.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize + +[Depex] + gSpiNorFlashProtocolGuid diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h new file mode 100644 index 00..e63ff9f220 --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h @@ -0,0 +1,104 @@ +/** @file + Phytium NorFlash Fvb Drivers Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#ifndef FVB_FLASH_DXE_H_ +#define FVB_FLASH_DXE_H_ + +#include +#include +#include + +#define GET_DATA_OFFSET(BaseAddr, Lba, LbaSize) ((BaseAddr) + (UINTN)((Lba) * (LbaSize))) +#define FVB_FLASH_SIGNATURE SIGNATURE_32('S', 'N', 'O', 'R') +#define INSTANCE_FROM_FVB_THIS(a) CR(a, FT_FVB_DEVICE, FvbProtocol, FVB_FLASH_SIGNATURE) + +typedef struct _FT_FVB_DEVICEFT_FVB_DEVICE; + +#define NOR_FLASH_ERASE_RETRY 10 + +typedef struct { + VENDOR_DEVICE_PATH Vendor; + EFI_DEVICE_PATH_PROTOCOLEnd; + } FT_FVB_DEVICE_PATH; + +struct _FT_FVB_DEVICE { + UINT32 Signature; + EFI_HANDLE Handle; + + UINTN DeviceBaseAddress; + UINTN
[edk2-devel] [PATCH v6 05/10] Silicon/Phytium: Added PciHostBridgeLib to FT2000/4
The Pci host bridge library is mainly to get Pci bridge information. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc | 9 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 6 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 181 4 files changed, 243 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 093b2cd9db..3a9bc2289c 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -37,6 +37,7 @@ [LibraryClasses.common.DXE_DRIVER] # Pci dependencies PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf + PciHostBridgeLib|Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf # @@ -263,6 +264,14 @@ MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf + # + # PCI Support + # + ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf + MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.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. diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 3106a43fb7..a443d0f3a4 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -135,6 +135,12 @@ READ_LOCK_STATUS = TRUE INF FatPkg/EnhancedFatDxe/Fat.inf INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + # + # PCI Support + # + INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf + INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + # # SATA Controller # diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf new file mode 100644 index 00..0e6f0797b0 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf @@ -0,0 +1,47 @@ +#/** @file +# PCI Host Bridge Library instance for Phytium SOC. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = PciHostBridgeLib + FILE_GUID = f965de0e-40fe-11eb-8290-3f9d1f895a80 + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = PciHostBridgeLib|DXE_DRIVER + +# +# The following information is for reference only and not required by the build +# tools. +# +# VALID_ARCHITECTURES = ARM AARCH64 +# + +[Sources] + PciHostBridgeLib.c + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + +[Guids] + +[FixedPcd] + gArmTokenSpaceGuid.PcdPciBusMin + gArmTokenSpaceGuid.PcdPciBusMax + gArmTokenSpaceGuid.PcdPciIoBase + gArmTokenSpaceGuid.PcdPciIoSize + gArmTokenSpaceGuid.PcdPciMmio32Base + gArmTokenSpaceGuid.PcdPciMmio32Size + gArmTokenSpaceGuid.PcdPciMmio64Base + gArmTokenSpaceGuid.PcdPciMmio64Size diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c new file mode 100644 index 00..8ed3516749 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c @@ -0,0 +1,181 @@ +/** @file + PCI host bridge library instance for Phytium SOC. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#pragma pack(1) + +typedef struct { + ACPI_HID_DEVICE_PATH AcpiDevicePath; + EFI_DEVICE_PATH_PROTOCOL EndDevicePath; +} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH; + +#pragma pack () + +#define END_DEVICE_PATH_DEF { END_DEVICE_PATH_TYPE, \ + END_ENTIRE_DEVICE_PATH_SUBTYPE, \ + { END_DEVICE_PATH_LENGTH, 0 } \ +} + +#define ACPI_DEVICE_PATH_DEF(UID) {{ ACPI_DEVICE_PATH, ACPI_DP, \ + { (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \ + (UINT8) (sizeof (ACPI_HID_DEVICE_PATH) >
[edk2-devel] [PATCH v6 04/10] Silicon/Phytium: Added PciSegmentLib to FT2000/4
The PCI Segment Library for Phytium platform. with multiple RCs. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc|9 +- Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf | 28 + Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c | 1434 3 files changed, 1464 insertions(+), 7 deletions(-) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 28e52e15e3..093b2cd9db 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -35,7 +35,8 @@ PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf [LibraryClasses.common.DXE_DRIVER] - + # Pci dependencies + PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf # @@ -262,12 +263,6 @@ 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. diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf new file mode 100644 index 00..67360016ef --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf @@ -0,0 +1,28 @@ +#/** @file +# PCI Segment Library for Phytium platform with multiple RCs. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = PciSegmentLib + FILE_GUID = fa5173d2-40fe-11eb-9b2f-cb20dc669fd3 + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = PciSegmentLib + +[Sources] + PciSegmentLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c new file mode 100644 index 00..273443fd5d --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c @@ -0,0 +1,1434 @@ +/** @file + PCI Segment Library for SoC with multiple RCs. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#define PCI_SEG_CONFIG_BASE 0x4000 +#define PCIE_BIF_MODE 0x29100800 + +typedef enum { + PciCfgWidthUint8 = 0, + PciCfgWidthUint16, + PciCfgWidthUint32, + PciCfgWidthMax +} PCI_CFG_WIDTH; + +/** + Assert the validity of a PCI Segment address. + A valid PCI Segment address should not contain 1's in bits 28..31 and 48..63 + + @param[in] A The address to validate. + @param[in] M Additional bits to assert to be zero. + +**/ +#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \ +ASSERT (((A) & (0xf000ULL | (M))) == 0) + + +#define EXTRACT_PCIE_ADDRESS(Address, Bus, Device, Function) \ +{ \ + (Bus) = (((Address) >> 20) & 0xff); \ + (Device) = (((Address) >> 15) & 0x1f); \ + (Function) = (((Address) >> 12) & 0x07); \ +} + + +/** + This function geted the config base of PCI device. + @param[in] Address The address that encodes the PCI Bus, Device, Function and + Register. + + @return The value of the config base of PCI device. + +**/ +STATIC +UINT64 +PciSegmentLibGetConfigBase ( + IN UINT64 Address + ) +{ + UINT8 Bus; + UINT8 Device; + UINT8 Function; + UINT8 RootPortCount; + UINT8 Peu0RootPortCount; + UINT8 Peu1RootPortCount; + UINT32 BifMode; + UINT32 Peu0BifMode; + UINT32 Peu1BifMode; + + EXTRACT_PCIE_ADDRESS (Address, Bus, Device, Function); + BifMode = MmioRead32 (PCIE_BIF_MODE); + Peu0BifMode = BifMode & 0x3; + Peu1BifMode = (BifMode >> 2) & 0x3; + + if ((Peu0BifMode == 1)) { +Peu0RootPortCount = 3; + } else { +Peu0RootPortCount = 2; + } + + if ((Peu1BifMode == 1)) { +Peu1RootPortCount = 3; + } else { +Peu1RootPortCount = 2; + } + RootPortCount = Peu0RootPortCount + Peu1RootPortCount; + //ignore device > 0 or function > 0 on root port + if (RootPortCount == 4) { +if ((Bus == 1) || (Bus == 2) || (Bus == 3) || (Bus == 4)) { + if (Device != 0 || Function != 0) { +return 0x; +
[edk2-devel] [PATCH v6 03/10] Silicon/Phytium: Added SMBIOS support to FT2000/4
This driver installs SMBIOS information for FT2000/4. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc| 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 6 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 943 4 files changed, 1002 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 6f38acb636..28e52e15e3 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -286,6 +286,12 @@ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + # + # SMBIOS + # + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + # # Bds # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index f435f7cb51..3106a43fb7 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -178,6 +178,12 @@ READ_LOCK_STATUS = TRUE # INF ShellPkg/Application/Shell/Shell.inf + # + # SMBIOS + # + INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + # # Bds # diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf new file mode 100644 index 00..69a021e048 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -0,0 +1,47 @@ +#/** @file +# This driver installs SMBIOS information for Phytium. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SmbiosPlatformDxe + FILE_GUID = d64f09f8-40dc-11eb-9be6-f7a038f956ba + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= SmbiosTablePublishEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = AARCH64 +# +[Sources] + SmbiosPlatformDxe.c + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + IoLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + gEfiGlobalVariableGuid + +[Protocols] + gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED + +[Guids] + +[Depex] + gEfiSmbiosProtocolGuid diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c new file mode 100644 index 00..4a1f77dfb2 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -0,0 +1,943 @@ +/** @file + This driver installs SMBIOS information for Phytium Durian platforms. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +#include +#include +#include +#include +#include + +// SMBIOS tables often reference each other using +// fixed constants, define a list of these constants +// for our hardcoded tables + +#define TYPE0_STRINGS \ + "PHYTIUM LTD\0" /* Vendor */\ + "V1.0\0"/* BiosVersion */ \ + __DATE__"\0"/* BiosReleaseDate */ + +#define TYPE1_STRINGS\ + "PHYTIUM LTD\0" /* Manufacturer */ \ + "Phytium Durian Development Platform\0" /* Product Name */ \ + "None\0"/* Version */ \ + "Not Set\0" /* SerialNumber */ \ + "Not set\0" /* SKUNumber */\ + "FT-2000/4\0" /* Family */ \ + +#define TYPE2_STRINGS\ + "PHYTIUM LTD\0" /* Manufacturer */ \ + "Phytium Durian Development Platform\0" /* Product Name */ \ + "None\0"/* Version */\ + "Not Set\0" /* Serial */ \ + "Not Set\0"
[edk2-devel] [PATCH v6 01/10] Silicon/Phytium: Added PlatformLib to FT2000/4
The PlatformLib supported the system library for FT2000/4 chip. Platform/Phytium: Added the dsc and fdf files of DurianPkg. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 41 +++ Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc | 348 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, 1552 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec new file mode 100644 index 00..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|0x + gPhytiumPlatformTokenSpaceGuid.PcdSystemIoSize|0x0|UINT64|0x0001 + + # + # PCI configuration address space + # + gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x0002 + gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x0003 + +[Protocols] diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc new file mode 100644 index 00..2565b8ac62 --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc @@ -0,0 +1,348 @@ +## @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
[edk2-devel] [PATCH v6 02/10] Silicon/Phytium: Added Acpi support to FT2000/4
Added Acpi driver and table to FT2000/4, the ACPI Tables providing library AcpiTables.inf uses a lot of information that is available in the form of PCDs for differnt platforms. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc | 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 7 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf| 56 + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 53 + Silicon/Phytium/PhytiumCommonPkg/Include/Platform.h | 80 +++ Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 250 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiSsdtRootPci.asl | 209 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dbg2.aslc | 80 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Cpu.asl | 85 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Dsdt.asl | 15 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Uart.asl | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Fadt.aslc | 77 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Gtdt.aslc | 83 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Iort.aslc | 89 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Madt.aslc | 67 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Mcfg.aslc | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Pptt.aslc | 219 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Spcr.aslc | 73 ++ 18 files changed, 1579 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index b523ecd658..6f38acb636 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -279,6 +279,12 @@ # MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf + # + # ACPI Support + # + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf # # Bds diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 9d75b072c6..f435f7cb51 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -111,6 +111,13 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + # + # ACPI Support + # + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + INF RuleOverride=ACPITABLE Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + # # Multiple Console IO support # diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf new file mode 100644 index 00..e3fd86f197 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf @@ -0,0 +1,56 @@ +#/** @file +# +# ACPI table data and ASL sources required to boot the platform. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = AcpiTables + FILE_GUID = 7E374E25-8E01-4FEE-87F2-390C23C606CD + MODULE_TYPE= USER_DEFINED + VERSION_STRING = 1.0 + +[Sources] + AcpiSsdtRootPci.asl + Dsdt/Dsdt.asl + Fadt.aslc + Iort.aslc + Gtdt.aslc + Madt.aslc + Mcfg.aslc + Pptt.aslc + Spcr.aslc + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[FixedPcd] + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase + gArmTokenSpaceGuid.PcdGicRedistributorsBase + + gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum + + gArmTokenSpaceGuid.PcdGenericWatchdogControlBase + gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase + + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gArmPlatformTokenSpaceGuid.PL011UartClkInHz + gArmPlatformTokenSpaceGuid.PL011UartInterrupt
[edk2-devel] [PATCH v6 00/10] Added support for FT2000/4 chip
This series added packages to support FT2000/4 chip. Platform/Phytium: Added DurianPkg, include DurianPkg.dsc and DurianPkg.fdf. Silicon/Phytium: Added FT2000-4Pkg and PhytiumCommonPkg. The modules could be runed at the silicon of FT2000/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_FT2000-4_v5 About patch 7: This is a set of special communication protocol for ft2000/4 chip QSPI controller. It has twoaccess modes: direct address access and command port access. At present, the read and write operations of flash are completed through direct address access (address mapping has been done on the hardware, and the write access is configured to put the data into the buffer first and merge and write multiple times). The erase operation is completed through command port access. Every time you operate norflash, you need to configure the command code, command format and other information through the command port register (such as erasing 0xd8), if the command requires an address, fill in the address port register; if the command requires data, access it in the order of high- order data register and low-order data register. Once the low-order data register is accessed, trigger the controller to send a command to flash. v6: The latest edk2 master has been updated, and the project has been compiled successfully. Ling Jia (10): Silicon/Phytium: Added PlatformLib to FT2000/4 Silicon/Phytium: Added Acpi support to FT2000/4 Silicon/Phytium: Added SMBIOS support to FT2000/4 Silicon/Phytium: Added PciSegmentLib to FT2000/4 Silicon/Phytium: Added PciHostBridgeLib to FT2000/4 Silicon/Phytium: Added Spi driver support to FT2000/4 Silicon/Phytium: Added flash driver support to Phytium Silicon Silicon/Phytium: Added fvb driver for norflash Silicon/Phytium: Added Rtc driver to FT2000/4 Maintainers.txt: Added maintainers and reviewers for the DurianPkg Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 52 + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc | 348 + Platform/Phytium/DurianPkg/DurianPkg.dsc | 331 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 235 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf | 56 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 44 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 48 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf | 28 + Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf | 55 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf | 39 + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 53 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 61 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h | 59 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 95 ++ Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h | 24 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 104 ++ Silicon/Phytium/PhytiumCommonPkg/Include/Platform.h | 80 ++ Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 + Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiProtocol.h | 51 + Silicon/Phytium/PhytiumCommonPkg/Include/SystemServiceInterface.h | 112 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 943 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 202 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 412 ++ Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 181 +++ Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c | 1434 Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.c | 137 ++ Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLibMem.c | 156 +++ Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.c | 462 +++ Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe
[edk2-devel] [PATCH v5 07/10] Silicon/Phytium: Added flash driver support to Phytium Silicon
The SpiNorFlashDxe provided norflash initialization, read-write, erase and other interfaces. This is a set of special communication protocol for ft2000/4 chip QSPI controller. Signed-off-by: Ling Jia --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 1 + Platform/Phytium/DurianPkg/DurianPkg.dsc| 5 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 1 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 48 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 95 + Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 412 7 files changed, 636 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 69842b89e0..2686ba3cc3 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -48,3 +48,4 @@ [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} + gSpiNorFlashProtocolGuid = { 0x00b4af42, 0xfbd0, 0x11ea, { 0x80, 0x3a, 0x27, 0xea, 0x5e, 0x65, 0xe3, 0xf6}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 68698d613f..1c47051441 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -249,6 +249,11 @@ # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # + # NOR Flash driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 1cf1927484..831f7a6828 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -96,6 +96,7 @@ READ_LOCK_STATUS = TRUE INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf new file mode 100644 index 00..2933dc502e --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf @@ -0,0 +1,48 @@ +#/** @file +# Phytium NorFlash Drivers. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SpiNorFlashDxe + FILE_GUID = f37ef706-187c-48fd-9102-ddbf86f551be + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= NorFlashPlatformEntryPoint + +[Sources.common] + SpiNorFlashDxe.c + SpiNorFlashDxe.h + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + UefiLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + +[FixedPcd] + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase +[Guids] + gEfiEventVirtualAddressChangeGuid + +[Protocols] + gSpiMasterProtocolGuid + gSpiNorFlashProtocolGuid + + [Depex] + TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h new file mode 100644 index 00..40d9607233 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h @@ -0,0 +1,95 @@ +/** @file + Phytium NorFlash Drivers Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SPI_NORFLASH_DXE_H_ +#define SPI_NORFLASH_DXE_H_ + +#include +#include + +// +// Norflash registers +// +#define REG_FLASH_CAP 0x000 +#define REG_RD_CFG0x004 +#define REG_WR_CFG0x008 +#define REG_FLUSH_REG 0x00C +#define REG_CMD_PORT 0x010 +#define REG_ADDR_PORT 0x014 +#define REG_HD_PORT 0x018 +#define REG_LD_PORT 0x01C +#define REG_CS_CFG0x020 +#define REG_WIP_CFG 0x024 +#define REG_WP_REG0x028 + +#define NORFLASH_SIGNATURE SIGNATURE_32 ('F', 'T', 'S', 'F') +#define SPI_FLASH_BASE FixedPcdGet64 (PcdSpiFlashBase) +#def
[edk2-devel] [PATCH v5 10/10] Maintainers.txt: Added maintainers and reviewers for the DurianPkg
Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Maintainers.txt | 8 1 file changed, 8 insertions(+) diff --git a/Maintainers.txt b/Maintainers.txt index 979553b610..c839c71b22 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -371,3 +371,11 @@ F: Silicon/SiFive/ M: Abner Chang M: Gilbert Chen R: Daniel Schaefer + +Phytium platforms and silicon +F: Platform/Phytium/ +F: Silicon/silicon/ +M: Leif Lindholm +R: Peng Xie +R: Ling Jia +R: Yiqi Shu -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#80419): https://edk2.groups.io/g/devel/message/80419 Mute This Topic: https://groups.io/mt/85480517/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v5 09/10] Silicon/Phytium: Added Rtc driver to FT2000/4
The RealTimeClockLib implemented EFI RealTimeClock runtime services via RTC Lib. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 1 + Platform/Phytium/DurianPkg/DurianPkg.dsc | 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 2 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf | 39 ++ Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h | 24 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.c | 462 6 files changed, 534 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 2686ba3cc3..4c6c5c5f11 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -45,6 +45,7 @@ gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x0005 gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x0006 gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x0007 + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress|0x0|UINT32|0x0008 [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 99034365d3..9579f8e9b7 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -29,6 +29,10 @@ # Phytium Platform library ArmPlatformLib|Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf + #FT2000-4Pkg RTC Driver + RealTimeClockLib|Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.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 @@ -168,6 +172,8 @@ NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf } MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf + EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf # # Common Arm Timer and Gic Components diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 67458458dd..242f647ca1 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -93,6 +93,8 @@ READ_LOCK_STATUS = TRUE # INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf new file mode 100644 index 00..09a06d53ae --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf @@ -0,0 +1,39 @@ +#/** @file +# Phytium RealTime Clock Library file. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = RealTimeClockLib + FILE_GUID = fb320c94-40fe-11eb-b990-171865af292c + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = RealTimeClockLib + +[Sources.common] + RealTimeClockLib.c + RealTimeClockLib.h + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + DxeServicesTableLib + IoLib + TimeBaseLib + UefiRuntimeLib + +[Guids] + gEfiEventVirtualAddressChangeGuid + +[Pcd] + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h new file mode 100644 index 00..41ce002dc3 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h @@ -0,0 +1,24 @@ +/** @file + Phytium RealTime Clock Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef REAL_TIME_CLOCK_H_ +#define REAL_TIME_CLOCK_H_ + +#define RTC_CMR
[edk2-devel] [PATCH v5 06/10] Silicon/Phytium: Added Spi driver support to FT2000/4
The SpiDxe is to provide Spi bus read-write interfaces. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 9 + Platform/Phytium/DurianPkg/DurianPkg.dsc| 5 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 2 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 44 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h | 59 ++ Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiProtocol.h | 51 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 202 7 files changed, 372 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 48f430c88d..69842b89e0 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -38,4 +38,13 @@ gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x0002 gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x0003 + # + # SPI Flash Controller Register Base Address and Size + # + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase|0x0|UINT64|0x0004 + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x0005 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x0006 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x0007 + [Protocols] + gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 3a9bc2289c..68698d613f 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -244,6 +244,11 @@ # ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf + # + # Spi driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index a443d0f3a4..1cf1927484 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -95,6 +95,8 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf new file mode 100644 index 00..21d75f268d --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf @@ -0,0 +1,44 @@ +#/** @file +# Phytium Spi Master Drivers. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SpiDxe + FILE_GUID = 2ba95e5c-f7f5-11ea-bf18-67fdc5787495 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= SpiMasterDrvEntryPoint + +[Sources.common] + SpiDxe.c + SpiDxe.h + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + UefiLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + +[Protocols] + gSpiMasterProtocolGuid + +[FixedPcd] + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase + +[Depex] + TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h new file mode 100644 index 00..8795ea238d --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h @@ -0,0 +1,59 @@ +/** @file + Phytium Spi Drivers Header + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SPI_DXE_H_ +#define SPI_DXE_H_ + +#include + +#define SPI_MASTER_SIGNATURE SIGNATURE_32 ('M', 'S', 'P', 'I') +#define REG_MODE_REG 0x02C + +EFI_STATUS +EFIAPI +SpiMasterGetConfig ( + IN UINT8CmdId, + OUT UINT32 *Config, + IN UINTNRegAddr + ); + +EFI_STATUS +EFIAPI +SpiMasterSetConfig ( + IN UINT8 CmdId, + IN UINT32Config, + IN UINTN RegAddr + ); + +EFI_STATUS +EFIAPI +SpiMasterSetMode ( + IN UINT32Config + ); + +EFI_STATUS +EFIAPI +SpiMasterInit ( + VOID + ); + +typedef struct { + EFI_SPI_DRV_PROTOCOLSpiMasterProtocol; + UINTN Signature; + EFI_HANDLE H
[edk2-devel] [PATCH v5 08/10] Silicon/Phytium: Added fvb driver for norflash
The FlashFvbDxe provided the fvb protocol, which requested by the flash operators. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc |1 + Platform/Phytium/DurianPkg/DurianPkg.fdf |1 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 61 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 104 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 1304 5 files changed, 1471 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 1c47051441..99034365d3 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -253,6 +253,7 @@ # NOR Flash driver # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf # # Usb Support diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 831f7a6828..67458458dd 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -103,6 +103,7 @@ READ_LOCK_STATUS = TRUE INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf INF ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf new file mode 100644 index 00..ff23721d6e --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf @@ -0,0 +1,61 @@ +#/** @file +# Phytium NorFlash Fvb Drivers. +# +# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved. +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = FlashFvbDxe + FILE_GUID = b8923820-3e7c-11eb-b12c-17525e90ecc8 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 0.1 + ENTRY_POINT= FvbEntryPoint + +[Sources] + FlashFvbDxe.c + FlashFvbDxe.h + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + DxeServicesTableLib + HobLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + +[Guids] + gEfiAuthenticatedVariableGuid + gEfiEventVirtualAddressChangeGuid + gEfiSystemNvDataFvGuid + gEfiVariableGuid + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiFirmwareVolumeBlockProtocolGuid + gSpiNorFlashProtocolGuid + +[Pcd.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize + +[Depex] + gSpiNorFlashProtocolGuid diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h new file mode 100644 index 00..e63ff9f220 --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h @@ -0,0 +1,104 @@ +/** @file + Phytium NorFlash Fvb Drivers Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#ifndef FVB_FLASH_DXE_H_ +#define FVB_FLASH_DXE_H_ + +#include +#include +#include + +#define GET_DATA_OFFSET(BaseAddr, Lba, LbaSize) ((BaseAddr) + (UINTN)((Lba) * (LbaSize))) +#define FVB_FLASH_SIGNATURE SIGNATURE_32('S', 'N', 'O', 'R') +#define INSTANCE_FROM_FVB_THIS(a) CR(a, FT_FVB_DEVICE, FvbProtocol, FVB_FLASH_SIGNATURE) + +typedef struct _FT_FVB_DEVICEFT_FVB_DEVICE; + +#define NOR_FLASH_ERASE_RETRY 10 + +typedef struct { + VENDOR_DEVICE_PATH Vendor; + EFI_DEVICE_PATH_PROTOCOLEnd; + } FT_FVB_DEVICE_PATH; + +struct _FT_FVB_DEVICE { + UINT32 Signature; + EFI_HANDLE Handle; + + UINTN DeviceBaseAddress; + UINTN
[edk2-devel] [PATCH v5 05/10] Silicon/Phytium: Added PciHostBridgeLib to FT2000/4
The Pci host bridge library is mainly to get Pci bridge information. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc | 9 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 6 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 181 4 files changed, 243 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 093b2cd9db..3a9bc2289c 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -37,6 +37,7 @@ [LibraryClasses.common.DXE_DRIVER] # Pci dependencies PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf + PciHostBridgeLib|Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf # @@ -263,6 +264,14 @@ MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf + # + # PCI Support + # + ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf + MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.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. diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 3106a43fb7..a443d0f3a4 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -135,6 +135,12 @@ READ_LOCK_STATUS = TRUE INF FatPkg/EnhancedFatDxe/Fat.inf INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + # + # PCI Support + # + INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf + INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + # # SATA Controller # diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf new file mode 100644 index 00..0e6f0797b0 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf @@ -0,0 +1,47 @@ +#/** @file +# PCI Host Bridge Library instance for Phytium SOC. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = PciHostBridgeLib + FILE_GUID = f965de0e-40fe-11eb-8290-3f9d1f895a80 + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = PciHostBridgeLib|DXE_DRIVER + +# +# The following information is for reference only and not required by the build +# tools. +# +# VALID_ARCHITECTURES = ARM AARCH64 +# + +[Sources] + PciHostBridgeLib.c + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + +[Guids] + +[FixedPcd] + gArmTokenSpaceGuid.PcdPciBusMin + gArmTokenSpaceGuid.PcdPciBusMax + gArmTokenSpaceGuid.PcdPciIoBase + gArmTokenSpaceGuid.PcdPciIoSize + gArmTokenSpaceGuid.PcdPciMmio32Base + gArmTokenSpaceGuid.PcdPciMmio32Size + gArmTokenSpaceGuid.PcdPciMmio64Base + gArmTokenSpaceGuid.PcdPciMmio64Size diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c new file mode 100644 index 00..8ed3516749 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c @@ -0,0 +1,181 @@ +/** @file + PCI host bridge library instance for Phytium SOC. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#pragma pack(1) + +typedef struct { + ACPI_HID_DEVICE_PATH AcpiDevicePath; + EFI_DEVICE_PATH_PROTOCOL EndDevicePath; +} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH; + +#pragma pack () + +#define END_DEVICE_PATH_DEF { END_DEVICE_PATH_TYPE, \ + END_ENTIRE_DEVICE_PATH_SUBTYPE, \ + { END_DEVICE_PATH_LENGTH, 0 } \ +} + +#define ACPI_DEVICE_PATH_DEF(UID) {{ ACPI_DEVICE_PATH, ACPI_DP, \ + { (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \ + (UINT8) (sizeof (ACPI_HID_DEVICE_PATH) >
[edk2-devel] [PATCH v5 02/10] Silicon/Phytium: Added Acpi support to FT2000/4
Added Acpi driver and table to FT2000/4, the ACPI Tables providing library AcpiTables.inf uses a lot of information that is available in the form of PCDs for differnt platforms. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc | 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 7 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf| 56 + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 53 + Silicon/Phytium/PhytiumCommonPkg/Include/Platform.h | 80 +++ Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 250 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiSsdtRootPci.asl | 209 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dbg2.aslc | 80 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Cpu.asl | 85 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Dsdt.asl | 15 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Uart.asl | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Fadt.aslc | 77 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Gtdt.aslc | 83 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Iort.aslc | 89 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Madt.aslc | 67 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Mcfg.aslc | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Pptt.aslc | 219 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Spcr.aslc | 73 ++ 18 files changed, 1579 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index b523ecd658..6f38acb636 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -279,6 +279,12 @@ # MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf + # + # ACPI Support + # + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf # # Bds diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 9d75b072c6..f435f7cb51 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -111,6 +111,13 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + # + # ACPI Support + # + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + INF RuleOverride=ACPITABLE Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + # # Multiple Console IO support # diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf new file mode 100644 index 00..e3fd86f197 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf @@ -0,0 +1,56 @@ +#/** @file +# +# ACPI table data and ASL sources required to boot the platform. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = AcpiTables + FILE_GUID = 7E374E25-8E01-4FEE-87F2-390C23C606CD + MODULE_TYPE= USER_DEFINED + VERSION_STRING = 1.0 + +[Sources] + AcpiSsdtRootPci.asl + Dsdt/Dsdt.asl + Fadt.aslc + Iort.aslc + Gtdt.aslc + Madt.aslc + Mcfg.aslc + Pptt.aslc + Spcr.aslc + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[FixedPcd] + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase + gArmTokenSpaceGuid.PcdGicRedistributorsBase + + gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum + + gArmTokenSpaceGuid.PcdGenericWatchdogControlBase + gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase + + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gArmPlatformTokenSpaceGuid.PL011UartClkInHz + gArmPlatformTokenSpaceGuid.PL011UartInterrupt
[edk2-devel] [PATCH v5 04/10] Silicon/Phytium: Added PciSegmentLib to FT2000/4
The PCI Segment Library for Phytium platform. with multiple RCs. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc|9 +- Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf | 28 + Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c | 1434 3 files changed, 1464 insertions(+), 7 deletions(-) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 28e52e15e3..093b2cd9db 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -35,7 +35,8 @@ PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf [LibraryClasses.common.DXE_DRIVER] - + # Pci dependencies + PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf # @@ -262,12 +263,6 @@ 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. diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf new file mode 100644 index 00..67360016ef --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf @@ -0,0 +1,28 @@ +#/** @file +# PCI Segment Library for Phytium platform with multiple RCs. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = PciSegmentLib + FILE_GUID = fa5173d2-40fe-11eb-9b2f-cb20dc669fd3 + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = PciSegmentLib + +[Sources] + PciSegmentLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c new file mode 100644 index 00..273443fd5d --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c @@ -0,0 +1,1434 @@ +/** @file + PCI Segment Library for SoC with multiple RCs. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#define PCI_SEG_CONFIG_BASE 0x4000 +#define PCIE_BIF_MODE 0x29100800 + +typedef enum { + PciCfgWidthUint8 = 0, + PciCfgWidthUint16, + PciCfgWidthUint32, + PciCfgWidthMax +} PCI_CFG_WIDTH; + +/** + Assert the validity of a PCI Segment address. + A valid PCI Segment address should not contain 1's in bits 28..31 and 48..63 + + @param[in] A The address to validate. + @param[in] M Additional bits to assert to be zero. + +**/ +#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \ +ASSERT (((A) & (0xf000ULL | (M))) == 0) + + +#define EXTRACT_PCIE_ADDRESS(Address, Bus, Device, Function) \ +{ \ + (Bus) = (((Address) >> 20) & 0xff); \ + (Device) = (((Address) >> 15) & 0x1f); \ + (Function) = (((Address) >> 12) & 0x07); \ +} + + +/** + This function geted the config base of PCI device. + @param[in] Address The address that encodes the PCI Bus, Device, Function and + Register. + + @return The value of the config base of PCI device. + +**/ +STATIC +UINT64 +PciSegmentLibGetConfigBase ( + IN UINT64 Address + ) +{ + UINT8 Bus; + UINT8 Device; + UINT8 Function; + UINT8 RootPortCount; + UINT8 Peu0RootPortCount; + UINT8 Peu1RootPortCount; + UINT32 BifMode; + UINT32 Peu0BifMode; + UINT32 Peu1BifMode; + + EXTRACT_PCIE_ADDRESS (Address, Bus, Device, Function); + BifMode = MmioRead32 (PCIE_BIF_MODE); + Peu0BifMode = BifMode & 0x3; + Peu1BifMode = (BifMode >> 2) & 0x3; + + if ((Peu0BifMode == 1)) { +Peu0RootPortCount = 3; + } else { +Peu0RootPortCount = 2; + } + + if ((Peu1BifMode == 1)) { +Peu1RootPortCount = 3; + } else { +Peu1RootPortCount = 2; + } + RootPortCount = Peu0RootPortCount + Peu1RootPortCount; + //ignore device > 0 or function > 0 on root port + if (RootPortCount == 4) { +if ((Bus == 1) || (Bus == 2) || (Bus == 3) || (Bus == 4)) { + if (Device != 0 || Function != 0) { +return 0x; +
[edk2-devel] [PATCH v5 03/10] Silicon/Phytium: Added SMBIOS support to FT2000/4
This driver installs SMBIOS information for FT2000/4. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc| 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 6 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 943 4 files changed, 1002 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 6f38acb636..28e52e15e3 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -286,6 +286,12 @@ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + # + # SMBIOS + # + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + # # Bds # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index f435f7cb51..3106a43fb7 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -178,6 +178,12 @@ READ_LOCK_STATUS = TRUE # INF ShellPkg/Application/Shell/Shell.inf + # + # SMBIOS + # + INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + # # Bds # diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf new file mode 100644 index 00..69a021e048 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -0,0 +1,47 @@ +#/** @file +# This driver installs SMBIOS information for Phytium. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SmbiosPlatformDxe + FILE_GUID = d64f09f8-40dc-11eb-9be6-f7a038f956ba + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= SmbiosTablePublishEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = AARCH64 +# +[Sources] + SmbiosPlatformDxe.c + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + IoLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + gEfiGlobalVariableGuid + +[Protocols] + gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED + +[Guids] + +[Depex] + gEfiSmbiosProtocolGuid diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c new file mode 100644 index 00..4a1f77dfb2 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -0,0 +1,943 @@ +/** @file + This driver installs SMBIOS information for Phytium Durian platforms. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +#include +#include +#include +#include +#include + +// SMBIOS tables often reference each other using +// fixed constants, define a list of these constants +// for our hardcoded tables + +#define TYPE0_STRINGS \ + "PHYTIUM LTD\0" /* Vendor */\ + "V1.0\0"/* BiosVersion */ \ + __DATE__"\0"/* BiosReleaseDate */ + +#define TYPE1_STRINGS\ + "PHYTIUM LTD\0" /* Manufacturer */ \ + "Phytium Durian Development Platform\0" /* Product Name */ \ + "None\0"/* Version */ \ + "Not Set\0" /* SerialNumber */ \ + "Not set\0" /* SKUNumber */\ + "FT-2000/4\0" /* Family */ \ + +#define TYPE2_STRINGS\ + "PHYTIUM LTD\0" /* Manufacturer */ \ + "Phytium Durian Development Platform\0" /* Product Name */ \ + "None\0"/* Version */\ + "Not Set\0" /* Serial */ \ + "Not Set\0"
[edk2-devel] [PATCH v5 01/10] Silicon/Phytium: Added PlatformLib to FT2000/4
The PlatformLib supported the system library for FT2000/4 chip. Platform/Phytium: Added the dsc and fdf files of DurianPkg. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- 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 00..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|0x + gPhytiumPlatformTokenSpaceGuid.PcdSystemIoSize|0x0|UINT64|0x0001 + + # + # PCI configuration address space + # + gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x0002 + gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x0003 + +[Protocols] diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc new file mode 100644 index 00..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
[edk2-devel] [PATCH v5 00/10] Added support for FT2000/4 chip
This series added packages to support FT2000/4 chip. Platform/Phytium: Added DurianPkg, include DurianPkg.dsc and DurianPkg.fdf. Silicon/Phytium: Added FT2000-4Pkg and PhytiumCommonPkg. The modules could be runed at the silicon of FT2000/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_FT2000-4_v5 About patch 7: This is a set of special communication protocol for ft2000/4 chip QSPI controller. It has twoaccess modes: direct address access and command port access. At present, the read and write operations of flash are completed through direct address access (address mapping has been done on the hardware, and the write access is configured to put the data into the buffer first and merge and write multiple times). The erase operation is completed through command port access. Every time you operate norflash, you need to configure the command code, command format and other information through the command port register (such as erasing 0xd8), if the command requires an address, fill in the address port register; if the command requires data, access it in the order of high- order data register and low-order data register. Once the low-order data register is accessed, trigger the controller to send a command to flash. Ling Jia (10): Silicon/Phytium: Added PlatformLib to FT2000/4 Silicon/Phytium: Added Acpi support to FT2000/4 Silicon/Phytium: Added SMBIOS support to FT2000/4 Silicon/Phytium: Added PciSegmentLib to FT2000/4 Silicon/Phytium: Added PciHostBridgeLib to FT2000/4 Silicon/Phytium: Added Spi driver support to FT2000/4 Silicon/Phytium: Added flash driver support to Phytium Silicon Silicon/Phytium: Added fvb driver for norflash Silicon/Phytium: Added Rtc driver to FT2000/4 Maintainers.txt: Added maintainers and reviewers for the DurianPkg Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 52 + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc | 345 + Platform/Phytium/DurianPkg/DurianPkg.dsc | 331 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 235 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf | 56 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 44 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 48 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf | 28 + Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf | 55 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf | 39 + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 53 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 61 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h | 59 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 95 ++ Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h | 24 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 104 ++ Silicon/Phytium/PhytiumCommonPkg/Include/Platform.h | 80 ++ Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 + Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiProtocol.h | 51 + Silicon/Phytium/PhytiumCommonPkg/Include/SystemServiceInterface.h | 112 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 943 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 202 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 412 ++ Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 181 +++ Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c | 1434 Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.c | 137 ++ Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLibMem.c | 156 +++ Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.c | 462 +++ Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 250 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe
[edk2-devel] [PATCH v4 09/10] Silicon/Phytium: Added Rtc driver to FT2000/4
The RealTimeClockLib implemented EFI RealTimeClock runtime services via RTC Lib. Signed-off-by: Ling Jia --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 1 + Platform/Phytium/DurianPkg/DurianPkg.dsc | 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 2 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf | 39 ++ Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h | 24 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.c | 462 6 files changed, 534 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 2686ba3cc3..4c6c5c5f11 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -45,6 +45,7 @@ gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x0005 gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x0006 gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x0007 + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress|0x0|UINT32|0x0008 [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 99034365d3..9579f8e9b7 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -29,6 +29,10 @@ # Phytium Platform library ArmPlatformLib|Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf + #FT2000-4Pkg RTC Driver + RealTimeClockLib|Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.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 @@ -168,6 +172,8 @@ NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf } MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf + EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf # # Common Arm Timer and Gic Components diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 67458458dd..242f647ca1 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -93,6 +93,8 @@ READ_LOCK_STATUS = TRUE # INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf new file mode 100644 index 00..09a06d53ae --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf @@ -0,0 +1,39 @@ +#/** @file +# Phytium RealTime Clock Library file. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = RealTimeClockLib + FILE_GUID = fb320c94-40fe-11eb-b990-171865af292c + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = RealTimeClockLib + +[Sources.common] + RealTimeClockLib.c + RealTimeClockLib.h + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + DxeServicesTableLib + IoLib + TimeBaseLib + UefiRuntimeLib + +[Guids] + gEfiEventVirtualAddressChangeGuid + +[Pcd] + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h new file mode 100644 index 00..41ce002dc3 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h @@ -0,0 +1,24 @@ +/** @file + Phytium RealTime Clock Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef REAL_TIME_CLOCK_H_ +#define REAL_TIME_CLOCK_H_ + +#define RTC_CMR 0x4 +#define RTC_AES_SEL
[edk2-devel] [PATCH v4 10/10] Maintainers.txt: Added maintainers and reviewers for the DurianPkg
Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Maintainers.txt | 8 1 file changed, 8 insertions(+) diff --git a/Maintainers.txt b/Maintainers.txt index 9b8d6aead9..7266b434d5 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -363,3 +363,11 @@ F: Silicon/SiFive/ M: Abner Chang M: Gilbert Chen R: Daniel Schaefer + +Phytium platforms and silicon +F: Platform/Phytium/ +F: Silicon/silicon/ +M: Leif Lindholm +R: Peng Xie +R: Ling Jia +R: Yiqi Shu -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#79484): https://edk2.groups.io/g/devel/message/79484 Mute This Topic: https://groups.io/mt/84968668/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v4 07/10] Silicon/Phytium: Added flash driver support to Phytium Silicon
The SpiNorFlashDxe provided norflash initialization, read-write, erase and other interfaces. Signed-off-by: Ling Jia --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 1 + Platform/Phytium/DurianPkg/DurianPkg.dsc| 5 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 1 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 48 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 95 + Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 412 7 files changed, 636 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 69842b89e0..2686ba3cc3 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -48,3 +48,4 @@ [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} + gSpiNorFlashProtocolGuid = { 0x00b4af42, 0xfbd0, 0x11ea, { 0x80, 0x3a, 0x27, 0xea, 0x5e, 0x65, 0xe3, 0xf6}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 68698d613f..1c47051441 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -249,6 +249,11 @@ # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # + # NOR Flash driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 1cf1927484..831f7a6828 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -96,6 +96,7 @@ READ_LOCK_STATUS = TRUE INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf new file mode 100644 index 00..2933dc502e --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf @@ -0,0 +1,48 @@ +#/** @file +# Phytium NorFlash Drivers. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SpiNorFlashDxe + FILE_GUID = f37ef706-187c-48fd-9102-ddbf86f551be + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= NorFlashPlatformEntryPoint + +[Sources.common] + SpiNorFlashDxe.c + SpiNorFlashDxe.h + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + UefiLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + +[FixedPcd] + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase +[Guids] + gEfiEventVirtualAddressChangeGuid + +[Protocols] + gSpiMasterProtocolGuid + gSpiNorFlashProtocolGuid + + [Depex] + TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h new file mode 100644 index 00..40d9607233 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h @@ -0,0 +1,95 @@ +/** @file + Phytium NorFlash Drivers Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SPI_NORFLASH_DXE_H_ +#define SPI_NORFLASH_DXE_H_ + +#include +#include + +// +// Norflash registers +// +#define REG_FLASH_CAP 0x000 +#define REG_RD_CFG0x004 +#define REG_WR_CFG0x008 +#define REG_FLUSH_REG 0x00C +#define REG_CMD_PORT 0x010 +#define REG_ADDR_PORT 0x014 +#define REG_HD_PORT 0x018 +#define REG_LD_PORT 0x01C +#define REG_CS_CFG0x020 +#define REG_WIP_CFG 0x024 +#define REG_WP_REG0x028 + +#define NORFLASH_SIGNATURE SIGNATURE_32 ('F', 'T', 'S', 'F') +#define SPI_FLASH_BASE FixedPcdGet64 (PcdSpiFlashBase) +#define SPI_FLASH_SIZE FixedPcdGet64 (PcdSpiFlashSize) + +extern EFI_GUID
[edk2-devel] [PATCH v4 08/10] Silicon/Phytium: Added fvb driver for norflash
The FlashFvbDxe provided the fvb protocol, which requested by the flash operators. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc |1 + Platform/Phytium/DurianPkg/DurianPkg.fdf |1 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 61 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 104 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 1304 5 files changed, 1471 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 1c47051441..99034365d3 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -253,6 +253,7 @@ # NOR Flash driver # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf # # Usb Support diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 831f7a6828..67458458dd 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -103,6 +103,7 @@ READ_LOCK_STATUS = TRUE INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf INF ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf new file mode 100644 index 00..ff23721d6e --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf @@ -0,0 +1,61 @@ +#/** @file +# Phytium NorFlash Fvb Drivers. +# +# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved. +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = FlashFvbDxe + FILE_GUID = b8923820-3e7c-11eb-b12c-17525e90ecc8 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 0.1 + ENTRY_POINT= FvbEntryPoint + +[Sources] + FlashFvbDxe.c + FlashFvbDxe.h + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + DxeServicesTableLib + HobLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + +[Guids] + gEfiAuthenticatedVariableGuid + gEfiEventVirtualAddressChangeGuid + gEfiSystemNvDataFvGuid + gEfiVariableGuid + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiFirmwareVolumeBlockProtocolGuid + gSpiNorFlashProtocolGuid + +[Pcd.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize + +[Depex] + gSpiNorFlashProtocolGuid diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h new file mode 100644 index 00..e63ff9f220 --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h @@ -0,0 +1,104 @@ +/** @file + Phytium NorFlash Fvb Drivers Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#ifndef FVB_FLASH_DXE_H_ +#define FVB_FLASH_DXE_H_ + +#include +#include +#include + +#define GET_DATA_OFFSET(BaseAddr, Lba, LbaSize) ((BaseAddr) + (UINTN)((Lba) * (LbaSize))) +#define FVB_FLASH_SIGNATURE SIGNATURE_32('S', 'N', 'O', 'R') +#define INSTANCE_FROM_FVB_THIS(a) CR(a, FT_FVB_DEVICE, FvbProtocol, FVB_FLASH_SIGNATURE) + +typedef struct _FT_FVB_DEVICEFT_FVB_DEVICE; + +#define NOR_FLASH_ERASE_RETRY 10 + +typedef struct { + VENDOR_DEVICE_PATH Vendor; + EFI_DEVICE_PATH_PROTOCOLEnd; + } FT_FVB_DEVICE_PATH; + +struct _FT_FVB_DEVICE { + UINT32 Signature; + EFI_HANDLE Handle; + + UINTN DeviceBaseAddress; + UINTN
[edk2-devel] [PATCH v4 06/10] Silicon/Phytium: Added Spi driver support to FT2000/4
The SpiDxe is to provide Spi bus read-write interfaces. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 9 + Platform/Phytium/DurianPkg/DurianPkg.dsc| 5 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 2 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 44 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h | 59 ++ Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiProtocol.h | 51 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 202 7 files changed, 372 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 48f430c88d..69842b89e0 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -38,4 +38,13 @@ gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x0002 gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x0003 + # + # SPI Flash Controller Register Base Address and Size + # + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase|0x0|UINT64|0x0004 + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x0005 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x0006 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x0007 + [Protocols] + gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 3a9bc2289c..68698d613f 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -244,6 +244,11 @@ # ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf + # + # Spi driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index a443d0f3a4..1cf1927484 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -95,6 +95,8 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf new file mode 100644 index 00..21d75f268d --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf @@ -0,0 +1,44 @@ +#/** @file +# Phytium Spi Master Drivers. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SpiDxe + FILE_GUID = 2ba95e5c-f7f5-11ea-bf18-67fdc5787495 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= SpiMasterDrvEntryPoint + +[Sources.common] + SpiDxe.c + SpiDxe.h + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + UefiLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + +[Protocols] + gSpiMasterProtocolGuid + +[FixedPcd] + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase + +[Depex] + TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h new file mode 100644 index 00..8795ea238d --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h @@ -0,0 +1,59 @@ +/** @file + Phytium Spi Drivers Header + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SPI_DXE_H_ +#define SPI_DXE_H_ + +#include + +#define SPI_MASTER_SIGNATURE SIGNATURE_32 ('M', 'S', 'P', 'I') +#define REG_MODE_REG 0x02C + +EFI_STATUS +EFIAPI +SpiMasterGetConfig ( + IN UINT8CmdId, + OUT UINT32 *Config, + IN UINTNRegAddr + ); + +EFI_STATUS +EFIAPI +SpiMasterSetConfig ( + IN UINT8 CmdId, + IN UINT32Config, + IN UINTN RegAddr + ); + +EFI_STATUS +EFIAPI +SpiMasterSetMode ( + IN UINT32Config + ); + +EFI_STATUS +EFIAPI +SpiMasterInit ( + VOID + ); + +typedef struct { + EFI_SPI_DRV_PROTOCOLSpiMasterProtocol; + UINTN Signature; + EFI_HANDLE H
[edk2-devel] [PATCH v4 04/10] Silicon/Phytium: Added PciSegmentLib to FT2000/4
The PCI Segment Library for Phytium platform. with multiple RCs. Signed-off-by: Ling Jia --- Platform/Phytium/DurianPkg/DurianPkg.dsc|9 +- Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf | 28 + Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c | 1434 3 files changed, 1464 insertions(+), 7 deletions(-) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 28e52e15e3..093b2cd9db 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -35,7 +35,8 @@ PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf [LibraryClasses.common.DXE_DRIVER] - + # Pci dependencies + PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf # @@ -262,12 +263,6 @@ 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. diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf new file mode 100644 index 00..67360016ef --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf @@ -0,0 +1,28 @@ +#/** @file +# PCI Segment Library for Phytium platform with multiple RCs. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = PciSegmentLib + FILE_GUID = fa5173d2-40fe-11eb-9b2f-cb20dc669fd3 + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = PciSegmentLib + +[Sources] + PciSegmentLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c new file mode 100644 index 00..c10b152e0d --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c @@ -0,0 +1,1434 @@ +/** @file + PCI Segment Library for SoC with multiple RCs. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#define PCI_SEG_CONFIG_BASE 0x4000 +#define PCIE_BIF_MODE 0x29100800 + +typedef enum { + PciCfgWidthUint8 = 0, + PciCfgWidthUint16, + PciCfgWidthUint32, + PciCfgWidthMax +} PCI_CFG_WIDTH; + +/** + Assert the validity of a PCI Segment address. + A valid PCI Segment address should not contain 1's in bits 28..31 and 48..63 + + @param[in] A The address to validate. + @param[in] M Additional bits to assert to be zero. + +**/ +#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \ +ASSERT (((A) & (0xf000ULL | (M))) == 0) + + +#define EXTRACT_PCIE_ADDRESS(Address, Bus, Device, Function) \ +{ \ + (Bus) = (((Address) >> 20) & 0xff); \ + (Device) = (((Address) >> 15) & 0x1f); \ + (Function) = (((Address) >> 12) & 0x07); \ +} + + +/** + This function geted the config base of PCI device. + @param[in] Address The address that encodes the PCI Bus, Device, Function and + Register. + + @return The value of the config base of PCI device. + +**/ +STATIC +UINT64 +PciSegmentLibGetConfigBase ( + IN UINT64 Address + ) +{ + UINT8 Bus; + UINT8 Device; + UINT8 Function; + UINT8 RootPortCount; + UINT8 Peu0RootPortCount; + UINT8 Peu1RootPortCount; + UINT32 BifMode; + UINT32 Peu0BifMode; + UINT32 Peu1BifMode; + + EXTRACT_PCIE_ADDRESS (Address, Bus, Device, Function); + BifMode = MmioRead32 (PCIE_BIF_MODE); + Peu0BifMode = BifMode & 0x3; + Peu1BifMode = (BifMode >> 2) & 0x3; + + if ((Peu0BifMode == 1)) { +Peu0RootPortCount = 3; + } else { +Peu0RootPortCount = 2; + } + + if ((Peu1BifMode == 1)) { +Peu1RootPortCount = 3; + } else { +Peu1RootPortCount = 2; + } + RootPortCount = Peu0RootPortCount + Peu1RootPortCount; + //ignore device > 0 or function > 0 on root port + if (RootPortCount == 4) { +if ((Bus == 1) || (Bus == 2) || (Bus == 3) || (Bus == 4)) { + if (Device != 0 || Function != 0) { +return 0x; + } + return PCI_SEG_CONF
[edk2-devel] [PATCH v4 01/10] Silicon/Phytium: Added PlatformLib to FT2000/4
The PlatformLib supported the system library for FT2000/4 chip. Platform/Phytium: Added the dsc and fdf files of DurianPkg. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- 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 00..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|0x + gPhytiumPlatformTokenSpaceGuid.PcdSystemIoSize|0x0|UINT64|0x0001 + + # + # PCI configuration address space + # + gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x0002 + gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x0003 + +[Protocols] diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc new file mode 100644 index 00..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
[edk2-devel] [PATCH v4 00/10] Added support for FT2000/4 chip
This series added packages to support FT2000/4 chip. Platform/Phytium: Added DurianPkg, include DurianPkg.dsc and DurianPkg.fdf. Silicon/Phytium: Added FT2000-4Pkg and PhytiumCommonPkg. The modules could be runed at the silicon of FT2000/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_FT2000-4_v4 Ling Jia (10): Silicon/Phytium: Added PlatformLib to FT2000/4 Silicon/Phytium: Added Acpi support to FT2000/4 Silicon/Phytium: Added SMBIOS support to FT2000/4 Silicon/Phytium: Added PciSegmentLib to FT2000/4 Silicon/Phytium: Added PciHostBridgeLib to FT2000/4 Silicon/Phytium: Added Spi driver support to FT2000/4 Silicon/Phytium: Added flash driver support to Phytium Silicon Silicon/Phytium: Added fvb driver for norflash Silicon/Phytium: Added Rtc driver to FT2000/4 Maintainers.txt: Added maintainers and reviewers for the DurianPkg Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 52 + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc | 345 + Platform/Phytium/DurianPkg/DurianPkg.dsc | 331 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 235 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf | 56 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 44 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 48 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf | 28 + Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf | 55 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf | 39 + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 53 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 61 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h | 59 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 95 ++ Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h | 24 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 104 ++ Silicon/Phytium/PhytiumCommonPkg/Include/Platform.h | 80 ++ Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 + Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiProtocol.h | 51 + Silicon/Phytium/PhytiumCommonPkg/Include/SystemServiceInterface.h | 112 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 943 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 202 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 412 ++ Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 181 +++ Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c | 1434 Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.c | 137 ++ Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLibMem.c | 156 +++ Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.c | 462 +++ Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 250 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 1304 ++ Maintainers.txt |8 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiSsdtRootPci.asl | 209 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dbg2.aslc | 80 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Cpu.asl | 85 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Dsdt.asl | 15 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Uart.asl | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Fadt.aslc | 77 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Gtdt.aslc | 83 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Iort.aslc | 89 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Madt.aslc
[edk2-devel] [PATCH v4 05/10] Silicon/Phytium: Added PciHostBridgeLib to FT2000/4
The Pci host bridge library is mainly to get Pci bridge information. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc | 9 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 6 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 181 4 files changed, 243 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 093b2cd9db..3a9bc2289c 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -37,6 +37,7 @@ [LibraryClasses.common.DXE_DRIVER] # Pci dependencies PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf + PciHostBridgeLib|Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf # @@ -263,6 +264,14 @@ MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf + # + # PCI Support + # + ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf + MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.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. diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 3106a43fb7..a443d0f3a4 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -135,6 +135,12 @@ READ_LOCK_STATUS = TRUE INF FatPkg/EnhancedFatDxe/Fat.inf INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + # + # PCI Support + # + INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf + INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + # # SATA Controller # diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf new file mode 100644 index 00..0e6f0797b0 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf @@ -0,0 +1,47 @@ +#/** @file +# PCI Host Bridge Library instance for Phytium SOC. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = PciHostBridgeLib + FILE_GUID = f965de0e-40fe-11eb-8290-3f9d1f895a80 + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = PciHostBridgeLib|DXE_DRIVER + +# +# The following information is for reference only and not required by the build +# tools. +# +# VALID_ARCHITECTURES = ARM AARCH64 +# + +[Sources] + PciHostBridgeLib.c + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + +[Guids] + +[FixedPcd] + gArmTokenSpaceGuid.PcdPciBusMin + gArmTokenSpaceGuid.PcdPciBusMax + gArmTokenSpaceGuid.PcdPciIoBase + gArmTokenSpaceGuid.PcdPciIoSize + gArmTokenSpaceGuid.PcdPciMmio32Base + gArmTokenSpaceGuid.PcdPciMmio32Size + gArmTokenSpaceGuid.PcdPciMmio64Base + gArmTokenSpaceGuid.PcdPciMmio64Size diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c new file mode 100644 index 00..8ed3516749 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c @@ -0,0 +1,181 @@ +/** @file + PCI host bridge library instance for Phytium SOC. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#pragma pack(1) + +typedef struct { + ACPI_HID_DEVICE_PATH AcpiDevicePath; + EFI_DEVICE_PATH_PROTOCOL EndDevicePath; +} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH; + +#pragma pack () + +#define END_DEVICE_PATH_DEF { END_DEVICE_PATH_TYPE, \ + END_ENTIRE_DEVICE_PATH_SUBTYPE, \ + { END_DEVICE_PATH_LENGTH, 0 } \ +} + +#define ACPI_DEVICE_PATH_DEF(UID) {{ ACPI_DEVICE_PATH, ACPI_DP, \ + { (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \ + (UINT8) (sizeof (ACPI_HID_DEVICE_PATH) >
[edk2-devel] [PATCH v4 02/10] Silicon/Phytium: Added Acpi support to FT2000/4
Added Acpi driver and table to FT2000/4, the ACPI Tables providing library AcpiTables.inf uses a lot of information that is available in the form of PCDs for differnt platforms. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc | 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 7 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf| 56 + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 53 + Silicon/Phytium/PhytiumCommonPkg/Include/Platform.h | 80 +++ Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 250 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiSsdtRootPci.asl | 209 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dbg2.aslc | 80 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Cpu.asl | 85 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Dsdt.asl | 15 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Uart.asl | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Fadt.aslc | 77 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Gtdt.aslc | 83 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Iort.aslc | 89 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Madt.aslc | 67 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Mcfg.aslc | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Pptt.aslc | 219 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Spcr.aslc | 73 ++ 18 files changed, 1579 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index b523ecd658..6f38acb636 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -279,6 +279,12 @@ # MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf + # + # ACPI Support + # + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf # # Bds diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 9d75b072c6..f435f7cb51 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -111,6 +111,13 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + # + # ACPI Support + # + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + INF RuleOverride=ACPITABLE Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + # # Multiple Console IO support # diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf new file mode 100644 index 00..e3fd86f197 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf @@ -0,0 +1,56 @@ +#/** @file +# +# ACPI table data and ASL sources required to boot the platform. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = AcpiTables + FILE_GUID = 7E374E25-8E01-4FEE-87F2-390C23C606CD + MODULE_TYPE= USER_DEFINED + VERSION_STRING = 1.0 + +[Sources] + AcpiSsdtRootPci.asl + Dsdt/Dsdt.asl + Fadt.aslc + Iort.aslc + Gtdt.aslc + Madt.aslc + Mcfg.aslc + Pptt.aslc + Spcr.aslc + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[FixedPcd] + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase + gArmTokenSpaceGuid.PcdGicRedistributorsBase + + gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum + + gArmTokenSpaceGuid.PcdGenericWatchdogControlBase + gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase + + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gArmPlatformTokenSpaceGuid.PL011UartClkInHz + gArmPlatformTokenSpaceGuid.PL011UartInterrupt
[edk2-devel] [PATCH v4 03/10] Silicon/Phytium: Added SMBIOS support to FT2000/4
This driver installs SMBIOS information for FT2000/4. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc| 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 6 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 943 4 files changed, 1002 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 6f38acb636..28e52e15e3 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -286,6 +286,12 @@ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + # + # SMBIOS + # + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + # # Bds # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index f435f7cb51..3106a43fb7 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -178,6 +178,12 @@ READ_LOCK_STATUS = TRUE # INF ShellPkg/Application/Shell/Shell.inf + # + # SMBIOS + # + INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + # # Bds # diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf new file mode 100644 index 00..69a021e048 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -0,0 +1,47 @@ +#/** @file +# This driver installs SMBIOS information for Phytium. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SmbiosPlatformDxe + FILE_GUID = d64f09f8-40dc-11eb-9be6-f7a038f956ba + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= SmbiosTablePublishEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = AARCH64 +# +[Sources] + SmbiosPlatformDxe.c + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + IoLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + gEfiGlobalVariableGuid + +[Protocols] + gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED + +[Guids] + +[Depex] + gEfiSmbiosProtocolGuid diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c new file mode 100644 index 00..4a1f77dfb2 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -0,0 +1,943 @@ +/** @file + This driver installs SMBIOS information for Phytium Durian platforms. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +#include +#include +#include +#include +#include + +// SMBIOS tables often reference each other using +// fixed constants, define a list of these constants +// for our hardcoded tables + +#define TYPE0_STRINGS \ + "PHYTIUM LTD\0" /* Vendor */\ + "V1.0\0"/* BiosVersion */ \ + __DATE__"\0"/* BiosReleaseDate */ + +#define TYPE1_STRINGS\ + "PHYTIUM LTD\0" /* Manufacturer */ \ + "Phytium Durian Development Platform\0" /* Product Name */ \ + "None\0"/* Version */ \ + "Not Set\0" /* SerialNumber */ \ + "Not set\0" /* SKUNumber */\ + "FT-2000/4\0" /* Family */ \ + +#define TYPE2_STRINGS\ + "PHYTIUM LTD\0" /* Manufacturer */ \ + "Phytium Durian Development Platform\0" /* Product Name */ \ + "None\0"/* Version */\ + "Not Set\0" /* Serial */ \ + "Not Set\0"
Re: [edk2-devel] [PATCH v3 00/10] Added support for FT2000/4 chip
Hi Leif, It's been a few days since I sent V3 patches. Do you have any suggestions for this patches? Looking forward to your reply! Best Regards, Ling > -原始邮件- > 发件人: "Ling Jia" > 发送时间: 2021-03-17 15:26:37 (星期三) > 收件人: devel@edk2.groups.io > 抄送: "Leif Lindholm" , "Ling Jia" > 主题: [PATCH v3 00/10] Added support for FT2000/4 chip > > This series added packages to support FT2000/4 chip. > Platform/Phytium: Added DurianPkg, include DurianPkg.dsc and DurianPkg.fdf. > Silicon/Phytium: Added FT2000-4Pkg and PhytiumCommonPkg. > > The modules could be runed at the silicon of FT2000/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_FT2000-4_v3 > > v3: > Optimized the codes to meet the edk2 coding specification. > > Ling Jia (10): > Silicon/Phytium: Added PlatformLib to FT2000/4 > Silicon/Phytium: Added Acpi support to FT2000/4 > Silicon/Phytium: Added SMBIOS support to FT2000/4 > Silicon/Phytium: Added PciSegmentLib to FT2000/4 > Silicon/Phytium: Added PciHostBridgeLib to FT2000/4 > Silicon/Phytium: Added Spi driver support to FT2000/4 > Silicon/Phytium: Added flash driver support to Phytium Silicon > Silicon/Phytium: Added fvb driver for norflash > Silicon/Phytium: Added Rtc driver to FT2000/4 > Maintainers.txt: Added maintainers and reviewers for the DurianPkg > > Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec >| 52 + > Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc >| 345 + > Platform/Phytium/DurianPkg/DurianPkg.dsc >| 331 + > Platform/Phytium/DurianPkg/DurianPkg.fdf >| 235 > Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf >| 56 + > Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf >| 47 + > Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf >| 44 + > Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf >| 48 + > Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf >| 47 + > Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf >| 28 + > Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf >| 55 + > Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf >| 39 + > Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf >| 53 + > Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf >| 61 + > Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h >| 64 + > Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h >| 99 ++ > Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h >| 24 + > Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h >| 104 ++ > Silicon/Phytium/PhytiumCommonPkg/Include/Platform.h >| 80 ++ > Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h >| 74 + > Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiProtocol.h >| 51 + > Silicon/Phytium/PhytiumCommonPkg/Include/SystemServiceInterface.h >| 112 ++ > Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c >| 943 + > Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c >| 198 +++ > Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c >| 424 ++ > Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c >| 181 +++ > Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c >| 1434 > Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.c >| 137 ++ > Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLibMem.c >| 156 +++ > Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.c >| 462 +++ > Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatform.c >| 250 > Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c
Re: [edk2-devel] [PATCH v3 01/46] TigerlakeOpenBoardPkg: Fix build errors with GCC5
Hi, Nate, Yes, It was an error message. I'm sorry about this, because I didn't operate git cherry pick well, resulting in the wrong patches. But I have corrected it. Please ignore it. Thanks, Ling > -原始邮件- > 发件人: "Desimone, Nathaniel L" > 发送时间: 2021-04-02 03:19:58 (星期五) > 收件人: "Ling Jia" , "devel@edk2.groups.io" > > 抄送: "Leif Lindholm" , "Peng Xie" , > "Yiqi Shu" , "Takuto Naito" , > "Chaganty, Rangasai V" , "Luo, Heng" > > 主题: RE: [PATCH v3 01/46] TigerlakeOpenBoardPkg: Fix build errors with GCC5 > > Hi Ling, > > This appears to be a duplicate of a patch that has already been applied: > > https://edk2.groups.io/g/devel/message/71894 > https://github.com/tianocore/edk2-platforms/commit/12ef75dc > > Was this message sent in error? > > Thanks, > Nate > > > > -Original Message- > > From: Ling Jia > > Sent: Friday, March 12, 2021 2:56 AM > > To: devel@edk2.groups.io > > Cc: Leif Lindholm ; Peng Xie > > ; Yiqi Shu ; Takuto > > Naito ; Chaganty, Rangasai V > > ; Desimone, Nathaniel L > > ; Luo, Heng > > Subject: [PATCH v3 01/46] TigerlakeOpenBoardPkg: Fix build errors with > > GCC5 > > > > From: Takuto Naito > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3224 > > > > - Fix the path of TigerLakeFspBinPkg > > - Fix misuse of RETURN_ERROR > > - Remove unused function CheckNationalSio. > > > > Cc: Sai Chaganty > > Cc: Nate DeSimone > > Cc: Heng Luo > > Signed-off-by: Takuto Naito > > Reviewed-by: Heng Luo > > Reviewed-by: Nate DeSimone > > --- > > > > Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInit > > Lib/PeiFspPolicyInitLib.inf| 2 +- > > > > Platform/Intel/TigerlakeOpenBoardPkg/Library/BasePlatformHookLib/BasePl > > atformHookLib.c | 188 > > > > Platform/Intel/TigerlakeOpenBoardPkg/Policy/Library/DxeSiliconPolicyUpdat > > eLib/DxeSiliconPolicyUpdateLate.c | 2 +- > > 3 files changed, 2 insertions(+), 190 deletions(-) > > > > diff --git > > a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyI > > nitLib/PeiFspPolicyInitLib.inf > > b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyI > > nitLib/PeiFspPolicyInitLib.inf > > index 9d85d855f501..708fbac08fd6 100644 > > --- > > a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyI > > nitLib/PeiFspPolicyInitLib.inf > > +++ > > b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyI > > nitLib/PeiFspPolicyInitLib.inf > > @@ -52,7 +52,7 @@ [Packages] > >MdeModulePkg/MdeModulePkg.dec > > > >IntelFsp2Pkg/IntelFsp2Pkg.dec > > > >TigerlakeSiliconPkg/SiPkg.dec > > > > - TigerLakeFspBinPkg/TigerLakeFspBinPkg.dec > > > > + TigerLakeFspBinPkg/Client/TigerLakeFspBinPkg.dec > > > >TigerlakeOpenBoardPkg/OpenBoardPkg.dec > > > >UefiCpuPkg/UefiCpuPkg.dec > > > >IntelSiliconPkg/IntelSiliconPkg.dec > > > > diff --git > > a/Platform/Intel/TigerlakeOpenBoardPkg/Library/BasePlatformHookLib/Bas > > ePlatformHookLib.c > > b/Platform/Intel/TigerlakeOpenBoardPkg/Library/BasePlatformHookLib/Bas > > ePlatformHookLib.c > > index 6209e5045061..cc5337698b8a 100644 > > --- > > a/Platform/Intel/TigerlakeOpenBoardPkg/Library/BasePlatformHookLib/Bas > > ePlatformHookLib.c > > +++ > > b/Platform/Intel/TigerlakeOpenBoardPkg/Library/BasePlatformHookLib/Bas > > ePlatformHookLib.c > > @@ -94,194 +94,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED > > EFI_SIO_TABLE mSioTableWinbond_x374[] = { > >{0x30, 0x01}// Enable it with Activation bit > > > > }; > > > > > > > > -/** > > > > - Detect if a National 393 SIO is docked. If yes, enable the docked SIO > > > > - and its serial port, and disable the onboard serial port. > > > > - > > > > - @retval EFI_SUCCESS Operations performed successfully. > > > > -**/ > > > > -STATIC > > > > -VOID > > > > -CheckNationalSio ( > > > > - VOID > > > > - ) > > > > -{ > > > > - UINT8 Data8; > > > > - > > > > - // > > > > - // Pc87393 access is through either (0x2e, 0x2f) or (0x4e, 0x4f). > > > > -
[edk2-devel] [PATCH v3 06/10] Silicon/Phytium: Added Spi driver support to FT2000/4
The SpiDxe is to provide Spi bus read-write interfaces. v3: Optimized the codes to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 9 + Platform/Phytium/DurianPkg/DurianPkg.dsc| 5 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 2 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 44 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h | 64 +++ Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiProtocol.h | 51 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 198 7 files changed, 373 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 48f430c88d..69842b89e0 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -38,4 +38,13 @@ gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x0002 gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x0003 + # + # SPI Flash Controller Register Base Address and Size + # + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase|0x0|UINT64|0x0004 + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x0005 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x0006 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x0007 + [Protocols] + gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 3a9bc2289c..68698d613f 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -244,6 +244,11 @@ # ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf + # + # Spi driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index a443d0f3a4..1cf1927484 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -95,6 +95,8 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf new file mode 100644 index 00..21d75f268d --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf @@ -0,0 +1,44 @@ +#/** @file +# Phytium Spi Master Drivers. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SpiDxe + FILE_GUID = 2ba95e5c-f7f5-11ea-bf18-67fdc5787495 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= SpiMasterDrvEntryPoint + +[Sources.common] + SpiDxe.c + SpiDxe.h + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + UefiLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + +[Protocols] + gSpiMasterProtocolGuid + +[FixedPcd] + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase + +[Depex] + TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h new file mode 100644 index 00..fbadd01921 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h @@ -0,0 +1,64 @@ +/** @file + Phytium Spi Drivers Header + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SPI_DXE_H_ +#define SPI_DXE_H_ + +#include +#include +#include +#include +#include +#include + +#define SPI_MASTER_SIGNATURE SIGNATURE_32 ('M', 'S', 'P', 'I') +#define REG_MODE_REG 0x02C + +EFI_STATUS +EFIAPI +SpiMasterGetConfig ( + IN UINT8CmdId, + OUT UINT32 *Config, + IN UINTNRegAddr + ); + +EFI_STATUS +EFIAPI +SpiMasterSetConfig ( + IN UINT8 CmdId, + IN UINT32Config, + IN UINTN RegAddr + ); + +EFI_STATUS +EFIAPI +SpiMasterSetMode ( + IN UINT32Config + ); + +EFI_STATUS +EFIAPI +SpiMasterInit ( + VOID + ); + +typedef struct { + E
[edk2-devel] [PATCH v3 01/10] Silicon/Phytium: Added PlatformLib to FT2000/4
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. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- 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 00..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|0x + gPhytiumPlatformTokenSpaceGuid.PcdSystemIoSize|0x0|UINT64|0x0001 + + # + # PCI configuration address space + # + gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x0002 + gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x0003 + +[Protocols] diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc new file mode 100644 index 00..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
[edk2-devel] [PATCH v3 04/10] Silicon/Phytium: Added PciSegmentLib to FT2000/4
The PCI Segment Library for Phytium platform. with multiple RCs. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc|9 +- Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf | 28 + Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c | 1434 3 files changed, 1464 insertions(+), 7 deletions(-) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 28e52e15e3..093b2cd9db 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -35,7 +35,8 @@ PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf [LibraryClasses.common.DXE_DRIVER] - + # Pci dependencies + PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf # @@ -262,12 +263,6 @@ 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. diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf new file mode 100644 index 00..67360016ef --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf @@ -0,0 +1,28 @@ +#/** @file +# PCI Segment Library for Phytium platform with multiple RCs. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = PciSegmentLib + FILE_GUID = fa5173d2-40fe-11eb-9b2f-cb20dc669fd3 + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = PciSegmentLib + +[Sources] + PciSegmentLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c new file mode 100644 index 00..c10b152e0d --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c @@ -0,0 +1,1434 @@ +/** @file + PCI Segment Library for SoC with multiple RCs. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#define PCI_SEG_CONFIG_BASE 0x4000 +#define PCIE_BIF_MODE 0x29100800 + +typedef enum { + PciCfgWidthUint8 = 0, + PciCfgWidthUint16, + PciCfgWidthUint32, + PciCfgWidthMax +} PCI_CFG_WIDTH; + +/** + Assert the validity of a PCI Segment address. + A valid PCI Segment address should not contain 1's in bits 28..31 and 48..63 + + @param[in] A The address to validate. + @param[in] M Additional bits to assert to be zero. + +**/ +#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \ +ASSERT (((A) & (0xf000ULL | (M))) == 0) + + +#define EXTRACT_PCIE_ADDRESS(Address, Bus, Device, Function) \ +{ \ + (Bus) = (((Address) >> 20) & 0xff); \ + (Device) = (((Address) >> 15) & 0x1f); \ + (Function) = (((Address) >> 12) & 0x07); \ +} + + +/** + This function geted the config base of PCI device. + @param[in] Address The address that encodes the PCI Bus, Device, Function and + Register. + + @return The value of the config base of PCI device. + +**/ +STATIC +UINT64 +PciSegmentLibGetConfigBase ( + IN UINT64 Address + ) +{ + UINT8 Bus; + UINT8 Device; + UINT8 Function; + UINT8 RootPortCount; + UINT8 Peu0RootPortCount; + UINT8 Peu1RootPortCount; + UINT32 BifMode; + UINT32 Peu0BifMode; + UINT32 Peu1BifMode; + + EXTRACT_PCIE_ADDRESS (Address, Bus, Device, Function); + BifMode = MmioRead32 (PCIE_BIF_MODE); + Peu0BifMode = BifMode & 0x3; + Peu1BifMode = (BifMode >> 2) & 0x3; + + if ((Peu0BifMode == 1)) { +Peu0RootPortCount = 3; + } else { +Peu0RootPortCount = 2; + } + + if ((Peu1BifMode == 1)) { +Peu1RootPortCount = 3; + } else { +Peu1RootPortCount = 2; + } + RootPortCount = Peu0RootPortCount + Peu1RootPortCount; + //ignore device > 0 or function > 0 on root port + if (RootPortCount == 4) { +if ((Bus == 1) || (Bus == 2) || (Bus == 3) || (Bus == 4)) { + if (Device != 0 || Function != 0) { +return 0x; +
[edk2-devel] [PATCH v3 02/10] Silicon/Phytium: Added Acpi support to FT2000/4
Added Acpi driver and table to FT2000/4, the ACPI Tables providing library AcpiTables.inf uses a lot of information that is available in the form of PCDs for differnt platforms. v3: Optimize code to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc | 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 7 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf| 56 + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 53 + Silicon/Phytium/PhytiumCommonPkg/Include/Platform.h | 80 +++ Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 250 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiSsdtRootPci.asl | 209 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dbg2.aslc | 80 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Cpu.asl | 85 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Dsdt.asl | 15 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Uart.asl | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Fadt.aslc | 77 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Gtdt.aslc | 83 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Iort.aslc | 89 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Madt.aslc | 67 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Mcfg.aslc | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Pptt.aslc | 219 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Spcr.aslc | 73 ++ 18 files changed, 1579 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index b523ecd658..6f38acb636 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -279,6 +279,12 @@ # MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf + # + # ACPI Support + # + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf # # Bds diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 9d75b072c6..f435f7cb51 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -111,6 +111,13 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + # + # ACPI Support + # + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + INF RuleOverride=ACPITABLE Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + # # Multiple Console IO support # diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf new file mode 100644 index 00..e3fd86f197 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf @@ -0,0 +1,56 @@ +#/** @file +# +# ACPI table data and ASL sources required to boot the platform. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = AcpiTables + FILE_GUID = 7E374E25-8E01-4FEE-87F2-390C23C606CD + MODULE_TYPE= USER_DEFINED + VERSION_STRING = 1.0 + +[Sources] + AcpiSsdtRootPci.asl + Dsdt/Dsdt.asl + Fadt.aslc + Iort.aslc + Gtdt.aslc + Madt.aslc + Mcfg.aslc + Pptt.aslc + Spcr.aslc + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[FixedPcd] + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase + gArmTokenSpaceGuid.PcdGicRedistributorsBase + + gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum + + gArmTokenSpaceGuid.PcdGenericWatchdogControlBase + gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase + + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gArmPlatformTokenSpaceGuid.PL011UartClkInHz
[edk2-devel] [PATCH v3 07/10] Silicon/Phytium: Added flash driver support to Phytium Silicon
The SpiNorFlashDxe provided norflash initialization, read-write, erase and other interfaces. v3: Optimized the codes to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 1 + Platform/Phytium/DurianPkg/DurianPkg.dsc| 5 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 1 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 48 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 99 + Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 424 7 files changed, 652 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 69842b89e0..2686ba3cc3 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -48,3 +48,4 @@ [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} + gSpiNorFlashProtocolGuid = { 0x00b4af42, 0xfbd0, 0x11ea, { 0x80, 0x3a, 0x27, 0xea, 0x5e, 0x65, 0xe3, 0xf6}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 68698d613f..1c47051441 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -249,6 +249,11 @@ # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # + # NOR Flash driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 1cf1927484..831f7a6828 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -96,6 +96,7 @@ READ_LOCK_STATUS = TRUE INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf new file mode 100644 index 00..2933dc502e --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf @@ -0,0 +1,48 @@ +#/** @file +# Phytium NorFlash Drivers. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SpiNorFlashDxe + FILE_GUID = f37ef706-187c-48fd-9102-ddbf86f551be + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= NorFlashPlatformEntryPoint + +[Sources.common] + SpiNorFlashDxe.c + SpiNorFlashDxe.h + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + UefiLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + +[FixedPcd] + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase +[Guids] + gEfiEventVirtualAddressChangeGuid + +[Protocols] + gSpiMasterProtocolGuid + gSpiNorFlashProtocolGuid + + [Depex] + TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h new file mode 100644 index 00..55f5e8273f --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h @@ -0,0 +1,99 @@ +/** @file + Phytium NorFlash Drivers Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SPI_NORFLASH_DXE_H_ +#define SPI_NORFLASH_DXE_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +// +// Norflash registers +// +#define REG_FLASH_CAP 0x000 +#define REG_RD_CFG0x004 +#define REG_WR_CFG0x008 +#define REG_FLUSH_REG 0x00C +#define REG_CMD_PORT 0x010 +#define REG_ADDR_PORT 0x014 +#define REG_HD_PORT 0x018 +#define REG_LD_PORT 0x01C +#define REG_CS_CFG0x020 +#define REG_WIP_CFG 0x024 +#define REG_WP_REG0x028 + +#define NORFLASH_SIGNATURE SIGNATURE_32 ('F', 'T', 'S', 'F') + +extern
[edk2-devel] [PATCH v3 03/10] Silicon/Phytium: Added SMBIOS support to FT2000/4
This driver installs SMBIOS information for FT2000/4. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc| 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 6 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 943 4 files changed, 1002 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 6f38acb636..28e52e15e3 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -286,6 +286,12 @@ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + # + # SMBIOS + # + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + # # Bds # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index f435f7cb51..3106a43fb7 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -178,6 +178,12 @@ READ_LOCK_STATUS = TRUE # INF ShellPkg/Application/Shell/Shell.inf + # + # SMBIOS + # + INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + # # Bds # diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf new file mode 100644 index 00..69a021e048 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -0,0 +1,47 @@ +#/** @file +# This driver installs SMBIOS information for Phytium. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SmbiosPlatformDxe + FILE_GUID = d64f09f8-40dc-11eb-9be6-f7a038f956ba + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= SmbiosTablePublishEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = AARCH64 +# +[Sources] + SmbiosPlatformDxe.c + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + IoLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + gEfiGlobalVariableGuid + +[Protocols] + gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED + +[Guids] + +[Depex] + gEfiSmbiosProtocolGuid diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c new file mode 100644 index 00..4a1f77dfb2 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -0,0 +1,943 @@ +/** @file + This driver installs SMBIOS information for Phytium Durian platforms. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +#include +#include +#include +#include +#include + +// SMBIOS tables often reference each other using +// fixed constants, define a list of these constants +// for our hardcoded tables + +#define TYPE0_STRINGS \ + "PHYTIUM LTD\0" /* Vendor */\ + "V1.0\0"/* BiosVersion */ \ + __DATE__"\0"/* BiosReleaseDate */ + +#define TYPE1_STRINGS\ + "PHYTIUM LTD\0" /* Manufacturer */ \ + "Phytium Durian Development Platform\0" /* Product Name */ \ + "None\0"/* Version */ \ + "Not Set\0" /* SerialNumber */ \ + "Not set\0" /* SKUNumber */\ + "FT-2000/4\0" /* Family */ \ + +#define TYPE2_STRINGS\ + "PHYTIUM LTD\0" /* Manufacturer */ \ + "Phytium Durian Development Platform\0" /* Product Name */ \ + "None\0"/* Version */\ + "Not Set\0" /* Serial */ \ + "Not Set\0"
[edk2-devel] [PATCH v3 08/10] Silicon/Phytium: Added fvb driver for norflash
The FlashFvbDxe provided the fvb protocol, which requested by the flash operators. v3: Optimized the codes to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc |1 + Platform/Phytium/DurianPkg/DurianPkg.fdf |1 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 61 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 104 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 1304 5 files changed, 1471 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 1c47051441..99034365d3 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -253,6 +253,7 @@ # NOR Flash driver # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf # # Usb Support diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 831f7a6828..67458458dd 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -103,6 +103,7 @@ READ_LOCK_STATUS = TRUE INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf INF ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf new file mode 100644 index 00..ff23721d6e --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf @@ -0,0 +1,61 @@ +#/** @file +# Phytium NorFlash Fvb Drivers. +# +# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved. +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = FlashFvbDxe + FILE_GUID = b8923820-3e7c-11eb-b12c-17525e90ecc8 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 0.1 + ENTRY_POINT= FvbEntryPoint + +[Sources] + FlashFvbDxe.c + FlashFvbDxe.h + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + DxeServicesTableLib + HobLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + +[Guids] + gEfiAuthenticatedVariableGuid + gEfiEventVirtualAddressChangeGuid + gEfiSystemNvDataFvGuid + gEfiVariableGuid + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiFirmwareVolumeBlockProtocolGuid + gSpiNorFlashProtocolGuid + +[Pcd.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize + +[Depex] + gSpiNorFlashProtocolGuid diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h new file mode 100644 index 00..e63ff9f220 --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h @@ -0,0 +1,104 @@ +/** @file + Phytium NorFlash Fvb Drivers Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#ifndef FVB_FLASH_DXE_H_ +#define FVB_FLASH_DXE_H_ + +#include +#include +#include + +#define GET_DATA_OFFSET(BaseAddr, Lba, LbaSize) ((BaseAddr) + (UINTN)((Lba) * (LbaSize))) +#define FVB_FLASH_SIGNATURE SIGNATURE_32('S', 'N', 'O', 'R') +#define INSTANCE_FROM_FVB_THIS(a) CR(a, FT_FVB_DEVICE, FvbProtocol, FVB_FLASH_SIGNATURE) + +typedef struct _FT_FVB_DEVICEFT_FVB_DEVICE; + +#define NOR_FLASH_ERASE_RETRY 10 + +typedef struct { + VENDOR_DEVICE_PATH Vendor; + EFI_DEVICE_PATH_PROTOCOLEnd; + } FT_FVB_DEVICE_PATH; + +struct _FT_FVB_DEVICE { + UINT32 Signature; + EFI_HANDLE Handle; + + UINTN
[edk2-devel] [PATCH v3 10/10] Maintainers.txt: Added maintainers and reviewers for the DurianPkg
Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Maintainers.txt | 8 1 file changed, 8 insertions(+) diff --git a/Maintainers.txt b/Maintainers.txt index afbd2cff0e..b6cfe74e09 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -321,3 +321,11 @@ F: Silicon/SiFive/ M: Abner Chang M: Gilbert Chen R: Daniel Schaefer + +Phytium platforms and silicon +F: Platform/Phytium/ +F: Silicon/silicon/ +M: Leif Lindholm +R: Peng Xie +R: Ling Jia +R: Yiqi Shu -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#72987): https://edk2.groups.io/g/devel/message/72987 Mute This Topic: https://groups.io/mt/81410919/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v3 09/10] Silicon/Phytium: Added Rtc driver to FT2000/4
The RealTimeClockLib implemented EFI RealTimeClock runtime services via RTC Lib. v3: Optimized the codes to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 1 + Platform/Phytium/DurianPkg/DurianPkg.dsc | 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 2 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf | 39 ++ Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h | 24 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.c | 462 6 files changed, 534 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 2686ba3cc3..4c6c5c5f11 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -45,6 +45,7 @@ gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x0005 gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x0006 gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x0007 + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress|0x0|UINT32|0x0008 [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 99034365d3..9579f8e9b7 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -29,6 +29,10 @@ # Phytium Platform library ArmPlatformLib|Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf + #FT2000-4Pkg RTC Driver + RealTimeClockLib|Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.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 @@ -168,6 +172,8 @@ NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf } MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf + EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf # # Common Arm Timer and Gic Components diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 67458458dd..242f647ca1 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -93,6 +93,8 @@ READ_LOCK_STATUS = TRUE # INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf new file mode 100644 index 00..09a06d53ae --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf @@ -0,0 +1,39 @@ +#/** @file +# Phytium RealTime Clock Library file. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = RealTimeClockLib + FILE_GUID = fb320c94-40fe-11eb-b990-171865af292c + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = RealTimeClockLib + +[Sources.common] + RealTimeClockLib.c + RealTimeClockLib.h + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + DxeServicesTableLib + IoLib + TimeBaseLib + UefiRuntimeLib + +[Guids] + gEfiEventVirtualAddressChangeGuid + +[Pcd] + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h new file mode 100644 index 00..41ce002dc3 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h @@ -0,0 +1,24 @@ +/** @file + Phytium RealTime Clock Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef
[edk2-devel] [PATCH v3 00/10] Added support for FT2000/4 chip
This series added packages to support FT2000/4 chip. Platform/Phytium: Added DurianPkg, include DurianPkg.dsc and DurianPkg.fdf. Silicon/Phytium: Added FT2000-4Pkg and PhytiumCommonPkg. The modules could be runed at the silicon of FT2000/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_FT2000-4_v3 v3: Optimized the codes to meet the edk2 coding specification. Ling Jia (10): Silicon/Phytium: Added PlatformLib to FT2000/4 Silicon/Phytium: Added Acpi support to FT2000/4 Silicon/Phytium: Added SMBIOS support to FT2000/4 Silicon/Phytium: Added PciSegmentLib to FT2000/4 Silicon/Phytium: Added PciHostBridgeLib to FT2000/4 Silicon/Phytium: Added Spi driver support to FT2000/4 Silicon/Phytium: Added flash driver support to Phytium Silicon Silicon/Phytium: Added fvb driver for norflash Silicon/Phytium: Added Rtc driver to FT2000/4 Maintainers.txt: Added maintainers and reviewers for the DurianPkg Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 52 + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc | 345 + Platform/Phytium/DurianPkg/DurianPkg.dsc | 331 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 235 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf | 56 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 44 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 48 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf | 28 + Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf | 55 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf | 39 + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 53 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 61 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h | 64 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 99 ++ Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h | 24 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 104 ++ Silicon/Phytium/PhytiumCommonPkg/Include/Platform.h | 80 ++ Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 + Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiProtocol.h | 51 + Silicon/Phytium/PhytiumCommonPkg/Include/SystemServiceInterface.h | 112 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 943 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 198 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 424 ++ Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 181 +++ Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c | 1434 Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.c | 137 ++ Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLibMem.c | 156 +++ Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.c | 462 +++ Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 250 Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 1304 ++ Maintainers.txt |8 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiSsdtRootPci.asl | 209 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dbg2.aslc | 80 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Cpu.asl | 85 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Dsdt.asl | 15 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Uart.asl | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Fadt.aslc | 77 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Gtdt.aslc | 83 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Iort.aslc | 89
[edk2-devel] [PATCH v3 05/10] Silicon/Phytium: Added PciHostBridgeLib to FT2000/4
The Pci host bridge library is mainly to get Pci bridge information. v3: Optimize the codes of PciHostBridgeLib.c to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc | 9 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 6 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 181 4 files changed, 243 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 093b2cd9db..3a9bc2289c 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -37,6 +37,7 @@ [LibraryClasses.common.DXE_DRIVER] # Pci dependencies PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf + PciHostBridgeLib|Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf # @@ -263,6 +264,14 @@ MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf + # + # PCI Support + # + ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf + MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.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. diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 3106a43fb7..a443d0f3a4 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -135,6 +135,12 @@ READ_LOCK_STATUS = TRUE INF FatPkg/EnhancedFatDxe/Fat.inf INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + # + # PCI Support + # + INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf + INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + # # SATA Controller # diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf new file mode 100644 index 00..0e6f0797b0 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf @@ -0,0 +1,47 @@ +#/** @file +# PCI Host Bridge Library instance for Phytium SOC. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = PciHostBridgeLib + FILE_GUID = f965de0e-40fe-11eb-8290-3f9d1f895a80 + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = PciHostBridgeLib|DXE_DRIVER + +# +# The following information is for reference only and not required by the build +# tools. +# +# VALID_ARCHITECTURES = ARM AARCH64 +# + +[Sources] + PciHostBridgeLib.c + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + +[Guids] + +[FixedPcd] + gArmTokenSpaceGuid.PcdPciBusMin + gArmTokenSpaceGuid.PcdPciBusMax + gArmTokenSpaceGuid.PcdPciIoBase + gArmTokenSpaceGuid.PcdPciIoSize + gArmTokenSpaceGuid.PcdPciMmio32Base + gArmTokenSpaceGuid.PcdPciMmio32Size + gArmTokenSpaceGuid.PcdPciMmio64Base + gArmTokenSpaceGuid.PcdPciMmio64Size diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c new file mode 100644 index 00..8ed3516749 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c @@ -0,0 +1,181 @@ +/** @file + PCI host bridge library instance for Phytium SOC. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#pragma pack(1) + +typedef struct { + ACPI_HID_DEVICE_PATH AcpiDevicePath; + EFI_DEVICE_PATH_PROTOCOL EndDevicePath; +} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH; + +#pragma pack () + +#define END_DEVICE_PATH_DEF { END_DEVICE_PATH_TYPE, \ + END_ENTIRE_DEVICE_PATH_SUBTYPE, \ + { END_DEVICE_PATH_LENGTH, 0 } \ +} + +#define ACPI_DEVICE_PATH_DEF(UID) {{ ACPI_DEVICE_PATH, ACPI_DP, \ + { (UINT8) (sizeof (ACPI_HID_DEVICE_PATH
[edk2-devel] [PATCH v3 23/46] Maintainers.txt: Added maintainers and reviewers for the DurianPkg
Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Maintainers.txt | 8 1 file changed, 8 insertions(+) diff --git a/Maintainers.txt b/Maintainers.txt index 2e6e87bb6dab..e81e55c456dd 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -322,3 +322,11 @@ F: Silicon/SiFive/ M: Abner Chang M: Gilbert Chen R: Daniel Schaefer + +Phytium platforms and silicon +F: Platform/Phytium/ +F: Silicon/silicon/ +M: Leif Lindholm +R: Peng Xie +R: Ling Jia +R: Yiqi Shu -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#72823): https://edk2.groups.io/g/devel/message/72823 Mute This Topic: https://groups.io/mt/81361277/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v3 00/46] Added support for FT2000/4 chip
The modules could be runed at the silicon of FT2000/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_FT2000-4_v3 v3: Optimized the codes to meet the specification. In the process of submitting V3 version, the master branch is ahead of the current branch. So, there was a lot of submission from someone else. In this case, what should we to do? *** BLURB HERE *** Heng Luo (2): Fix wrong information of TigerLake in Readme.md Fix wrong information of TigerLake in Readme.md Jeremy Linton (2): Platform/RaspberryPi/Acpitables: Correct duplicate _UIDs Platform/RaspberryPi/Acpitables: Correct duplicate _UIDs Leif Lindholm (2): Silicon/Qemu: Move SbsaQemu MPIDR-retrieval function to FdtHelperLib Silicon/Qemu: Move SbsaQemu MPIDR-retrieval function to FdtHelperLib Ling Jia (20): Silicon/Phytium: Added PlatformLib to FT2000/4 Silicon/Phytium: Added Acpi support to FT2000/4 Silicon/Phytium: Added SMBIOS support to FT2000/4 Silicon/Phytium: Added PciSegmentLib to FT2000/4 Silicon/Phytium: Added PciHostBridgeLib to FT2000/4 Silicon/Phytium: Added Spi driver support to FT2000/4 Silicon/Phytium: Added flash driver support to Phytium Silicon Silicon/Phytium: Added fvb driver for norflash Silicon/Phytium: Added Rtc driver to FT2000/4 Maintainers.txt: Added maintainers and reviewers for the DurianPkg Silicon/Phytium: Added PlatformLib to FT2000/4 Silicon/Phytium: Added Acpi support to FT2000/4 Silicon/Phytium: Added SMBIOS support to FT2000/4 Silicon/Phytium: Added PciSegmentLib to FT2000/4 Silicon/Phytium: Added PciHostBridgeLib to FT2000/4 Silicon/Phytium: Added Spi driver support to FT2000/4 Silicon/Phytium: Added flash driver support to Phytium Silicon Silicon/Phytium: Added fvb driver for norflash Silicon/Phytium: Added Rtc driver to FT2000/4 Maintainers.txt: Added maintainers and reviewers for the DurianPkg Liu, Zhiguang (2): Intel/BoardModulePkg: sort load option in the first boot Intel/BoardModulePkg: sort load option in the first boot Marcin Juszkiewicz (2): drop Tanmay Jagdale from sbsa-ref maintainers drop Tanmay Jagdale from sbsa-ref maintainers Rebecca Cran (8): SbsaQemu: Add FdtHelperLib SbsaQemu: Update SbsaQemuAcpiDxe to use FdtHelperLib Platform/Qemu/SbsaQemu: Add SMBIOS tables Silicon/Qemu: Don't re-use NumCores as loop index in AddMadtTable SbsaQemu: Add FdtHelperLib SbsaQemu: Update SbsaQemuAcpiDxe to use FdtHelperLib Platform/Qemu/SbsaQemu: Add SMBIOS tables Silicon/Qemu: Don't re-use NumCores as loop index in AddMadtTable Takuto Naito (8): TigerlakeOpenBoardPkg: Fix build errors with GCC5 TigerlakeSiliconPkg/IpBlock: Fix build errors with GCC5 TigerlakeSiliconPkg: Fix build error with GCC5 TigerlakeOpenBoardPkg: Fix build error with GCC5 TigerlakeOpenBoardPkg: Fix build errors with GCC5 TigerlakeSiliconPkg/IpBlock: Fix build errors with GCC5 TigerlakeSiliconPkg: Fix build error with GCC5 TigerlakeOpenBoardPkg: Fix build error with GCC5 Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 52 + Silicon/Qemu/SbsaQemu/SbsaQemu.dec | 17 + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc | 345 + Platform/Phytium/DurianPkg/DurianPkg.dsc | 331 + Platform/Qemu/SbsaQemu/SbsaQemu.dsc | 50 +- Platform/Phytium/DurianPkg/DurianPkg.fdf | 235 Platform/Qemu/SbsaQemu/SbsaQemu.fdf |7 + Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf |2 +- Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.inf | 53 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf | 56 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 44 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 48 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 47 + Silicon/Phytium/FT2000-4P
[edk2-devel] [PATCH v3 39/46] Silicon/Phytium: Added SMBIOS support to FT2000/4
This driver installs SMBIOS information for FT2000/4. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc| 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 6 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 943 4 files changed, 1002 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 6f38acb6361c..28e52e15e393 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -286,6 +286,12 @@ [Components.common] Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + # + # SMBIOS + # + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + # # Bds # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index f435f7cb51c2..3106a43fb744 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -178,6 +178,12 @@ [FV.FvMain] # INF ShellPkg/Application/Shell/Shell.inf + # + # SMBIOS + # + INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + # # Bds # diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf new file mode 100644 index ..69a021e04823 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -0,0 +1,47 @@ +#/** @file +# This driver installs SMBIOS information for Phytium. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SmbiosPlatformDxe + FILE_GUID = d64f09f8-40dc-11eb-9be6-f7a038f956ba + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= SmbiosTablePublishEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = AARCH64 +# +[Sources] + SmbiosPlatformDxe.c + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + IoLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + gEfiGlobalVariableGuid + +[Protocols] + gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED + +[Guids] + +[Depex] + gEfiSmbiosProtocolGuid diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c new file mode 100644 index ..4a1f77dfb2a6 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -0,0 +1,943 @@ +/** @file + This driver installs SMBIOS information for Phytium Durian platforms. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +#include +#include +#include +#include +#include + +// SMBIOS tables often reference each other using +// fixed constants, define a list of these constants +// for our hardcoded tables + +#define TYPE0_STRINGS \ + "PHYTIUM LTD\0" /* Vendor */\ + "V1.0\0"/* BiosVersion */ \ + __DATE__"\0"/* BiosReleaseDate */ + +#define TYPE1_STRINGS\ + "PHYTIUM LTD\0" /* Manufacturer */ \ + "Phytium Durian Development Platform\0" /* Product Name */ \ + "None\0"/* Version */ \ + "Not Set\0" /* SerialNumber */ \ + "Not set\0" /* SKUNumber */\ + "FT-2000/4\0" /* Family */ \ + +#define TYPE2_STRINGS\ + "PHYTIUM LTD\0" /* Manufacturer */ \ + "Phytium Durian Development Platform\0" /* Product Name */ \ + "None\0"/* Version */\ + "Not Set\0" /* Serial */ \ + "Not Set\0"
[edk2-devel] [PATCH v3 46/46] Maintainers.txt: Added maintainers and reviewers for the DurianPkg
Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Maintainers.txt | 8 1 file changed, 8 insertions(+) diff --git a/Maintainers.txt b/Maintainers.txt index afbd2cff0e9c..b6cfe74e09da 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -321,3 +321,11 @@ F: Silicon/SiFive/ M: Abner Chang M: Gilbert Chen R: Daniel Schaefer + +Phytium platforms and silicon +F: Platform/Phytium/ +F: Silicon/silicon/ +M: Leif Lindholm +R: Peng Xie +R: Ling Jia +R: Yiqi Shu -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#72832): https://edk2.groups.io/g/devel/message/72832 Mute This Topic: https://groups.io/mt/81361289/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v3 45/46] Silicon/Phytium: Added Rtc driver to FT2000/4
The RealTimeClockLib implemented EFI RealTimeClock runtime services via RTC Lib. v3: Optimized the codes to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 1 + Platform/Phytium/DurianPkg/DurianPkg.dsc | 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 2 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf | 39 ++ Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h | 24 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.c | 462 6 files changed, 534 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 2686ba3cc3a2..4c6c5c5f1118 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -45,6 +45,7 @@ [PcdsFixedAtBuild.common] gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x0005 gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x0006 gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x0007 + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress|0x0|UINT32|0x0008 [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 99034365d38f..9579f8e9b7d0 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -29,6 +29,10 @@ [LibraryClasses.common] # Phytium Platform library ArmPlatformLib|Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf + #FT2000-4Pkg RTC Driver + RealTimeClockLib|Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.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 @@ -168,6 +172,8 @@ [Components.common] NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf } MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf + EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf # # Common Arm Timer and Gic Components diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 67458458ddd5..242f647ca1b1 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -93,6 +93,8 @@ [FV.FvMain] # INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf new file mode 100644 index ..09a06d53aef7 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf @@ -0,0 +1,39 @@ +#/** @file +# Phytium RealTime Clock Library file. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = RealTimeClockLib + FILE_GUID = fb320c94-40fe-11eb-b990-171865af292c + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = RealTimeClockLib + +[Sources.common] + RealTimeClockLib.c + RealTimeClockLib.h + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + DxeServicesTableLib + IoLib + TimeBaseLib + UefiRuntimeLib + +[Guids] + gEfiEventVirtualAddressChangeGuid + +[Pcd] + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h new file mode 100644 index ..41ce002dc3be --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h @@ -0,0 +1,24 @@ +/** @file + Phytium RealTime Clock Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX
[edk2-devel] [PATCH v3 00/46] Added support for FT2000/4 chip
The modules could be runed at the silicon of FT2000/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_FT2000-4_v3 v3: Optimized the codes to meet the specification. In the process of submitting V3 version, the master branch is ahead of the current branch. So, there was a lot of submission from someone else. In this case, what should we to do? *** BLURB HERE *** Heng Luo (2): Fix wrong information of TigerLake in Readme.md Fix wrong information of TigerLake in Readme.md Jeremy Linton (2): Platform/RaspberryPi/Acpitables: Correct duplicate _UIDs Platform/RaspberryPi/Acpitables: Correct duplicate _UIDs Leif Lindholm (2): Silicon/Qemu: Move SbsaQemu MPIDR-retrieval function to FdtHelperLib Silicon/Qemu: Move SbsaQemu MPIDR-retrieval function to FdtHelperLib Ling Jia (20): Silicon/Phytium: Added PlatformLib to FT2000/4 Silicon/Phytium: Added Acpi support to FT2000/4 Silicon/Phytium: Added SMBIOS support to FT2000/4 Silicon/Phytium: Added PciSegmentLib to FT2000/4 Silicon/Phytium: Added PciHostBridgeLib to FT2000/4 Silicon/Phytium: Added Spi driver support to FT2000/4 Silicon/Phytium: Added flash driver support to Phytium Silicon Silicon/Phytium: Added fvb driver for norflash Silicon/Phytium: Added Rtc driver to FT2000/4 Maintainers.txt: Added maintainers and reviewers for the DurianPkg Silicon/Phytium: Added PlatformLib to FT2000/4 Silicon/Phytium: Added Acpi support to FT2000/4 Silicon/Phytium: Added SMBIOS support to FT2000/4 Silicon/Phytium: Added PciSegmentLib to FT2000/4 Silicon/Phytium: Added PciHostBridgeLib to FT2000/4 Silicon/Phytium: Added Spi driver support to FT2000/4 Silicon/Phytium: Added flash driver support to Phytium Silicon Silicon/Phytium: Added fvb driver for norflash Silicon/Phytium: Added Rtc driver to FT2000/4 Maintainers.txt: Added maintainers and reviewers for the DurianPkg Liu, Zhiguang (2): Intel/BoardModulePkg: sort load option in the first boot Intel/BoardModulePkg: sort load option in the first boot Marcin Juszkiewicz (2): drop Tanmay Jagdale from sbsa-ref maintainers drop Tanmay Jagdale from sbsa-ref maintainers Rebecca Cran (8): SbsaQemu: Add FdtHelperLib SbsaQemu: Update SbsaQemuAcpiDxe to use FdtHelperLib Platform/Qemu/SbsaQemu: Add SMBIOS tables Silicon/Qemu: Don't re-use NumCores as loop index in AddMadtTable SbsaQemu: Add FdtHelperLib SbsaQemu: Update SbsaQemuAcpiDxe to use FdtHelperLib Platform/Qemu/SbsaQemu: Add SMBIOS tables Silicon/Qemu: Don't re-use NumCores as loop index in AddMadtTable Takuto Naito (8): TigerlakeOpenBoardPkg: Fix build errors with GCC5 TigerlakeSiliconPkg/IpBlock: Fix build errors with GCC5 TigerlakeSiliconPkg: Fix build error with GCC5 TigerlakeOpenBoardPkg: Fix build error with GCC5 TigerlakeOpenBoardPkg: Fix build errors with GCC5 TigerlakeSiliconPkg/IpBlock: Fix build errors with GCC5 TigerlakeSiliconPkg: Fix build error with GCC5 TigerlakeOpenBoardPkg: Fix build error with GCC5 Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 52 + Silicon/Qemu/SbsaQemu/SbsaQemu.dec | 17 + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc | 345 + Platform/Phytium/DurianPkg/DurianPkg.dsc | 331 + Platform/Qemu/SbsaQemu/SbsaQemu.dsc | 50 +- Platform/Phytium/DurianPkg/DurianPkg.fdf | 235 Platform/Qemu/SbsaQemu/SbsaQemu.fdf |7 + Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf |2 +- Platform/Qemu/SbsaQemu/OemMiscLib/OemMiscLib.inf | 53 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf | 56 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 44 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 48 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 47 + Silicon/Phytium/FT2000-4P
[edk2-devel] [PATCH v3 44/46] Silicon/Phytium: Added fvb driver for norflash
The FlashFvbDxe provided the fvb protocol, which requested by the flash operators. v3: Optimized the codes to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc |1 + Platform/Phytium/DurianPkg/DurianPkg.fdf |1 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 61 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 104 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 1304 5 files changed, 1471 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 1c4705144151..99034365d38f 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -253,6 +253,7 @@ [Components.common] # NOR Flash driver # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf # # Usb Support diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 831f7a682837..67458458ddd5 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -103,6 +103,7 @@ [FV.FvMain] INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf INF ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf new file mode 100644 index ..ff23721d6e41 --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf @@ -0,0 +1,61 @@ +#/** @file +# Phytium NorFlash Fvb Drivers. +# +# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved. +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = FlashFvbDxe + FILE_GUID = b8923820-3e7c-11eb-b12c-17525e90ecc8 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 0.1 + ENTRY_POINT= FvbEntryPoint + +[Sources] + FlashFvbDxe.c + FlashFvbDxe.h + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + DxeServicesTableLib + HobLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + +[Guids] + gEfiAuthenticatedVariableGuid + gEfiEventVirtualAddressChangeGuid + gEfiSystemNvDataFvGuid + gEfiVariableGuid + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiFirmwareVolumeBlockProtocolGuid + gSpiNorFlashProtocolGuid + +[Pcd.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize + +[Depex] + gSpiNorFlashProtocolGuid diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h new file mode 100644 index ..e63ff9f220f6 --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h @@ -0,0 +1,104 @@ +/** @file + Phytium NorFlash Fvb Drivers Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#ifndef FVB_FLASH_DXE_H_ +#define FVB_FLASH_DXE_H_ + +#include +#include +#include + +#define GET_DATA_OFFSET(BaseAddr, Lba, LbaSize) ((BaseAddr) + (UINTN)((Lba) * (LbaSize))) +#define FVB_FLASH_SIGNATURE SIGNATURE_32('S', 'N', 'O', 'R') +#define INSTANCE_FROM_FVB_THIS(a) CR(a, FT_FVB_DEVICE, FvbProtocol, FVB_FLASH_SIGNATURE) + +typedef struct _FT_FVB_DEVICEFT_FVB_DEVICE; + +#define NOR_FLASH_ERASE_RETRY 10 + +typedef struct { + VENDOR_DEVICE_PATH Vendor; + EFI_DEVICE_PATH_PROTOCOLEnd; + } FT_FVB_DEVICE_PATH; + +struct _FT_FVB_DEVICE { + UINT32 Signature; + EFI_HANDLE Handle; + + UINTN
[edk2-devel] [PATCH v3 41/46] Silicon/Phytium: Added PciHostBridgeLib to FT2000/4
The Pci host bridge library is mainly to get Pci bridge information. v3: Optimize the codes of PciHostBridgeLib.c to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc | 9 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 6 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 181 4 files changed, 243 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 093b2cd9dbd4..3a9bc2289cf3 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -37,6 +37,7 @@ [LibraryClasses.common] [LibraryClasses.common.DXE_DRIVER] # Pci dependencies PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf + PciHostBridgeLib|Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf # @@ -263,6 +264,14 @@ [Components.common] MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf + # + # PCI Support + # + ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf + MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.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. diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 3106a43fb744..a443d0f3a4ac 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -135,6 +135,12 @@ [FV.FvMain] INF FatPkg/EnhancedFatDxe/Fat.inf INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + # + # PCI Support + # + INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf + INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + # # SATA Controller # diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf new file mode 100644 index ..0e6f0797b0fe --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf @@ -0,0 +1,47 @@ +#/** @file +# PCI Host Bridge Library instance for Phytium SOC. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = PciHostBridgeLib + FILE_GUID = f965de0e-40fe-11eb-8290-3f9d1f895a80 + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = PciHostBridgeLib|DXE_DRIVER + +# +# The following information is for reference only and not required by the build +# tools. +# +# VALID_ARCHITECTURES = ARM AARCH64 +# + +[Sources] + PciHostBridgeLib.c + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + +[Guids] + +[FixedPcd] + gArmTokenSpaceGuid.PcdPciBusMin + gArmTokenSpaceGuid.PcdPciBusMax + gArmTokenSpaceGuid.PcdPciIoBase + gArmTokenSpaceGuid.PcdPciIoSize + gArmTokenSpaceGuid.PcdPciMmio32Base + gArmTokenSpaceGuid.PcdPciMmio32Size + gArmTokenSpaceGuid.PcdPciMmio64Base + gArmTokenSpaceGuid.PcdPciMmio64Size diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c new file mode 100644 index ..8ed3516749a1 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c @@ -0,0 +1,181 @@ +/** @file + PCI host bridge library instance for Phytium SOC. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#pragma pack(1) + +typedef struct { + ACPI_HID_DEVICE_PATH AcpiDevicePath; + EFI_DEVICE_PATH_PROTOCOL EndDevicePath; +} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH; + +#pragma pack () + +#define END_DEVICE_PATH_DEF { END_DEVICE_PATH_TYPE, \ + END_ENTIRE_DEVICE_PATH_SUBTYPE, \ + { END_DEVICE_PATH_LENGTH, 0 } \ +} + +#define ACPI_DEVICE_PATH_DEF(UID) {{ ACPI_DEVICE_PATH, ACPI_DP, \ + { (UINT8) (sizeof
[edk2-devel] [PATCH v3 21/46] Silicon/Phytium: Added fvb driver for norflash
The FlashFvbDxe provided the fvb protocol, which requested by the flash operators. v3: Optimized the codes to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc |1 + Platform/Phytium/DurianPkg/DurianPkg.fdf |1 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 61 + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h | 104 ++ Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c | 1304 5 files changed, 1471 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 1c4705144151..99034365d38f 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -253,6 +253,7 @@ [Components.common] # NOR Flash driver # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf # # Usb Support diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 831f7a682837..67458458ddd5 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -103,6 +103,7 @@ [FV.FvMain] INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf INF ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf new file mode 100644 index ..ff23721d6e41 --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf @@ -0,0 +1,61 @@ +#/** @file +# Phytium NorFlash Fvb Drivers. +# +# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved. +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = FlashFvbDxe + FILE_GUID = b8923820-3e7c-11eb-b12c-17525e90ecc8 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 0.1 + ENTRY_POINT= FvbEntryPoint + +[Sources] + FlashFvbDxe.c + FlashFvbDxe.h + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + DxeServicesTableLib + HobLib + MemoryAllocationLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + +[Guids] + gEfiAuthenticatedVariableGuid + gEfiEventVirtualAddressChangeGuid + gEfiSystemNvDataFvGuid + gEfiVariableGuid + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiFirmwareVolumeBlockProtocolGuid + gSpiNorFlashProtocolGuid + +[Pcd.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize + +[Depex] + gSpiNorFlashProtocolGuid diff --git a/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h new file mode 100644 index ..e63ff9f220f6 --- /dev/null +++ b/Silicon/Phytium/PhytiumCommonPkg/Drivers/FlashFvbDxe/FlashFvbDxe.h @@ -0,0 +1,104 @@ +/** @file + Phytium NorFlash Fvb Drivers Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#ifndef FVB_FLASH_DXE_H_ +#define FVB_FLASH_DXE_H_ + +#include +#include +#include + +#define GET_DATA_OFFSET(BaseAddr, Lba, LbaSize) ((BaseAddr) + (UINTN)((Lba) * (LbaSize))) +#define FVB_FLASH_SIGNATURE SIGNATURE_32('S', 'N', 'O', 'R') +#define INSTANCE_FROM_FVB_THIS(a) CR(a, FT_FVB_DEVICE, FvbProtocol, FVB_FLASH_SIGNATURE) + +typedef struct _FT_FVB_DEVICEFT_FVB_DEVICE; + +#define NOR_FLASH_ERASE_RETRY 10 + +typedef struct { + VENDOR_DEVICE_PATH Vendor; + EFI_DEVICE_PATH_PROTOCOLEnd; + } FT_FVB_DEVICE_PATH; + +struct _FT_FVB_DEVICE { + UINT32 Signature; + EFI_HANDLE Handle; + + UINTN
[edk2-devel] [PATCH v3 16/46] Silicon/Phytium: Added SMBIOS support to FT2000/4
This driver installs SMBIOS information for FT2000/4. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc| 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 6 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 943 4 files changed, 1002 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 6f38acb6361c..28e52e15e393 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -286,6 +286,12 @@ [Components.common] Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + # + # SMBIOS + # + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + # # Bds # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index f435f7cb51c2..3106a43fb744 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -178,6 +178,12 @@ [FV.FvMain] # INF ShellPkg/Application/Shell/Shell.inf + # + # SMBIOS + # + INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + # # Bds # diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf new file mode 100644 index ..69a021e04823 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -0,0 +1,47 @@ +#/** @file +# This driver installs SMBIOS information for Phytium. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SmbiosPlatformDxe + FILE_GUID = d64f09f8-40dc-11eb-9be6-f7a038f956ba + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= SmbiosTablePublishEntry + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = AARCH64 +# +[Sources] + SmbiosPlatformDxe.c + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + IoLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + gEfiGlobalVariableGuid + +[Protocols] + gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED + +[Guids] + +[Depex] + gEfiSmbiosProtocolGuid diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c new file mode 100644 index ..4a1f77dfb2a6 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -0,0 +1,943 @@ +/** @file + This driver installs SMBIOS information for Phytium Durian platforms. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +#include +#include +#include +#include +#include + +// SMBIOS tables often reference each other using +// fixed constants, define a list of these constants +// for our hardcoded tables + +#define TYPE0_STRINGS \ + "PHYTIUM LTD\0" /* Vendor */\ + "V1.0\0"/* BiosVersion */ \ + __DATE__"\0"/* BiosReleaseDate */ + +#define TYPE1_STRINGS\ + "PHYTIUM LTD\0" /* Manufacturer */ \ + "Phytium Durian Development Platform\0" /* Product Name */ \ + "None\0"/* Version */ \ + "Not Set\0" /* SerialNumber */ \ + "Not set\0" /* SKUNumber */\ + "FT-2000/4\0" /* Family */ \ + +#define TYPE2_STRINGS\ + "PHYTIUM LTD\0" /* Manufacturer */ \ + "Phytium Durian Development Platform\0" /* Product Name */ \ + "None\0"/* Version */\ + "Not Set\0" /* Serial */ \ + "Not Set\0"
[edk2-devel] [PATCH v3 14/46] Silicon/Phytium: Added Acpi support to FT2000/4
Added Acpi driver and table to FT2000/4, the ACPI Tables providing library AcpiTables.inf uses a lot of information that is available in the form of PCDs for differnt platforms. v3: Optimize code to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc | 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 7 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf| 56 + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 53 + Silicon/Phytium/PhytiumCommonPkg/Include/Platform.h | 80 +++ Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 250 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiSsdtRootPci.asl | 209 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dbg2.aslc | 80 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Cpu.asl | 85 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Dsdt.asl | 15 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Uart.asl | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Fadt.aslc | 77 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Gtdt.aslc | 83 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Iort.aslc | 89 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Madt.aslc | 67 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Mcfg.aslc | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Pptt.aslc | 219 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Spcr.aslc | 73 ++ 18 files changed, 1579 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index b523ecd6584b..6f38acb6361c 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -279,6 +279,12 @@ [Components.common] # MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf + # + # ACPI Support + # + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf # # Bds diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 9d75b072c6dc..f435f7cb51c2 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -111,6 +111,13 @@ [FV.FvMain] INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + # + # ACPI Support + # + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + INF RuleOverride=ACPITABLE Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + # # Multiple Console IO support # diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf new file mode 100644 index ..e3fd86f19733 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf @@ -0,0 +1,56 @@ +#/** @file +# +# ACPI table data and ASL sources required to boot the platform. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = AcpiTables + FILE_GUID = 7E374E25-8E01-4FEE-87F2-390C23C606CD + MODULE_TYPE= USER_DEFINED + VERSION_STRING = 1.0 + +[Sources] + AcpiSsdtRootPci.asl + Dsdt/Dsdt.asl + Fadt.aslc + Iort.aslc + Gtdt.aslc + Madt.aslc + Mcfg.aslc + Pptt.aslc + Spcr.aslc + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[FixedPcd] + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase + gArmTokenSpaceGuid.PcdGicRedistributorsBase + + gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum + + gArmTokenSpaceGuid.PcdGenericWatchdogControlBase + gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase + + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gArmPlatformTokenSpaceGuid.PL011UartClkInHz
[edk2-devel] [PATCH v3 38/46] Silicon/Phytium: Added Acpi support to FT2000/4
Added Acpi driver and table to FT2000/4, the ACPI Tables providing library AcpiTables.inf uses a lot of information that is available in the form of PCDs for differnt platforms. v3: Optimize code to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc | 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 7 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf| 56 + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 53 + Silicon/Phytium/PhytiumCommonPkg/Include/Platform.h | 80 +++ Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 250 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiSsdtRootPci.asl | 209 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dbg2.aslc | 80 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Cpu.asl | 85 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Dsdt.asl | 15 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Uart.asl | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Fadt.aslc | 77 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Gtdt.aslc | 83 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Iort.aslc | 89 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Madt.aslc | 67 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Mcfg.aslc | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Pptt.aslc | 219 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Spcr.aslc | 73 ++ 18 files changed, 1579 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index b523ecd6584b..6f38acb6361c 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -279,6 +279,12 @@ [Components.common] # MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf + # + # ACPI Support + # + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf # # Bds diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 9d75b072c6dc..f435f7cb51c2 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -111,6 +111,13 @@ [FV.FvMain] INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + # + # ACPI Support + # + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + INF RuleOverride=ACPITABLE Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + # # Multiple Console IO support # diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf new file mode 100644 index ..e3fd86f19733 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf @@ -0,0 +1,56 @@ +#/** @file +# +# ACPI table data and ASL sources required to boot the platform. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = AcpiTables + FILE_GUID = 7E374E25-8E01-4FEE-87F2-390C23C606CD + MODULE_TYPE= USER_DEFINED + VERSION_STRING = 1.0 + +[Sources] + AcpiSsdtRootPci.asl + Dsdt/Dsdt.asl + Fadt.aslc + Iort.aslc + Gtdt.aslc + Madt.aslc + Mcfg.aslc + Pptt.aslc + Spcr.aslc + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[FixedPcd] + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase + gArmTokenSpaceGuid.PcdGicRedistributorsBase + + gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum + + gArmTokenSpaceGuid.PcdGenericWatchdogControlBase + gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase + + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gArmPlatformTokenSpaceGuid.PL011UartClkInHz
[edk2-devel] [PATCH v3 17/46] Silicon/Phytium: Added PciSegmentLib to FT2000/4
The PCI Segment Library for Phytium platform. with multiple RCs. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc|9 +- Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf | 28 + Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c | 1434 3 files changed, 1464 insertions(+), 7 deletions(-) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 28e52e15e393..093b2cd9dbd4 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -35,7 +35,8 @@ [LibraryClasses.common] PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf [LibraryClasses.common.DXE_DRIVER] - + # Pci dependencies + PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf # @@ -262,12 +263,6 @@ [Components.common] 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. diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf new file mode 100644 index ..67360016eff9 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf @@ -0,0 +1,28 @@ +#/** @file +# PCI Segment Library for Phytium platform with multiple RCs. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = PciSegmentLib + FILE_GUID = fa5173d2-40fe-11eb-9b2f-cb20dc669fd3 + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = PciSegmentLib + +[Sources] + PciSegmentLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c new file mode 100644 index ..c10b152e0dbb --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c @@ -0,0 +1,1434 @@ +/** @file + PCI Segment Library for SoC with multiple RCs. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#define PCI_SEG_CONFIG_BASE 0x4000 +#define PCIE_BIF_MODE 0x29100800 + +typedef enum { + PciCfgWidthUint8 = 0, + PciCfgWidthUint16, + PciCfgWidthUint32, + PciCfgWidthMax +} PCI_CFG_WIDTH; + +/** + Assert the validity of a PCI Segment address. + A valid PCI Segment address should not contain 1's in bits 28..31 and 48..63 + + @param[in] A The address to validate. + @param[in] M Additional bits to assert to be zero. + +**/ +#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \ +ASSERT (((A) & (0xf000ULL | (M))) == 0) + + +#define EXTRACT_PCIE_ADDRESS(Address, Bus, Device, Function) \ +{ \ + (Bus) = (((Address) >> 20) & 0xff); \ + (Device) = (((Address) >> 15) & 0x1f); \ + (Function) = (((Address) >> 12) & 0x07); \ +} + + +/** + This function geted the config base of PCI device. + @param[in] Address The address that encodes the PCI Bus, Device, Function and + Register. + + @return The value of the config base of PCI device. + +**/ +STATIC +UINT64 +PciSegmentLibGetConfigBase ( + IN UINT64 Address + ) +{ + UINT8 Bus; + UINT8 Device; + UINT8 Function; + UINT8 RootPortCount; + UINT8 Peu0RootPortCount; + UINT8 Peu1RootPortCount; + UINT32 BifMode; + UINT32 Peu0BifMode; + UINT32 Peu1BifMode; + + EXTRACT_PCIE_ADDRESS (Address, Bus, Device, Function); + BifMode = MmioRead32 (PCIE_BIF_MODE); + Peu0BifMode = BifMode & 0x3; + Peu1BifMode = (BifMode >> 2) & 0x3; + + if ((Peu0BifMode == 1)) { +Peu0RootPortCount = 3; + } else { +Peu0RootPortCount = 2; + } + + if ((Peu1BifMode == 1)) { +Peu1RootPortCount = 3; + } else { +Peu1RootPortCount = 2; + } + RootPortCount = Peu0RootPortCount + Peu1RootPortCount; + //ignore device > 0 or function > 0 on root port + if (RootPortCount == 4) { +if ((Bus == 1) || (Bus == 2) || (Bus == 3) || (Bus == 4)) { + if
[edk2-devel] [PATCH v3 22/46] Silicon/Phytium: Added Rtc driver to FT2000/4
The RealTimeClockLib implemented EFI RealTimeClock runtime services via RTC Lib. v3: Optimized the codes to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 1 + Platform/Phytium/DurianPkg/DurianPkg.dsc | 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 2 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf | 39 ++ Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h | 24 + Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.c | 462 6 files changed, 534 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 2686ba3cc3a2..4c6c5c5f1118 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -45,6 +45,7 @@ [PcdsFixedAtBuild.common] gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x0005 gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x0006 gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x0007 + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress|0x0|UINT32|0x0008 [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 99034365d38f..9579f8e9b7d0 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -29,6 +29,10 @@ [LibraryClasses.common] # Phytium Platform library ArmPlatformLib|Silicon/Phytium/FT2000-4Pkg/Library/PlatformLib/PlatformLib.inf + #FT2000-4Pkg RTC Driver + RealTimeClockLib|Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.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 @@ -168,6 +172,8 @@ [Components.common] NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf } MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf + EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf # # Common Arm Timer and Gic Components diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 67458458ddd5..242f647ca1b1 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -93,6 +93,8 @@ [FV.FvMain] # INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf new file mode 100644 index ..09a06d53aef7 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.inf @@ -0,0 +1,39 @@ +#/** @file +# Phytium RealTime Clock Library file. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = RealTimeClockLib + FILE_GUID = fb320c94-40fe-11eb-b990-171865af292c + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = RealTimeClockLib + +[Sources.common] + RealTimeClockLib.c + RealTimeClockLib.h + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + DxeServicesTableLib + IoLib + TimeBaseLib + UefiRuntimeLib + +[Guids] + gEfiEventVirtualAddressChangeGuid + +[Pcd] + gPhytiumPlatformTokenSpaceGuid.PcdRtcBaseAddress diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h new file mode 100644 index ..41ce002dc3be --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/RealTimeClockLib/RealTimeClockLib.h @@ -0,0 +1,24 @@ +/** @file + Phytium RealTime Clock Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX
[edk2-devel] [PATCH v3 43/46] Silicon/Phytium: Added flash driver support to Phytium Silicon
The SpiNorFlashDxe provided norflash initialization, read-write, erase and other interfaces. v3: Optimized the codes to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 1 + Platform/Phytium/DurianPkg/DurianPkg.dsc| 5 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 1 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 48 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 99 + Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 424 7 files changed, 652 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 69842b89e021..2686ba3cc3a2 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -48,3 +48,4 @@ [PcdsFixedAtBuild.common] [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} + gSpiNorFlashProtocolGuid = { 0x00b4af42, 0xfbd0, 0x11ea, { 0x80, 0x3a, 0x27, 0xea, 0x5e, 0x65, 0xe3, 0xf6}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 68698d613f96..1c4705144151 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -249,6 +249,11 @@ [Components.common] # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # + # NOR Flash driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 1cf1927484db..831f7a682837 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -96,6 +96,7 @@ [FV.FvMain] INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf new file mode 100644 index ..2933dc502eed --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf @@ -0,0 +1,48 @@ +#/** @file +# Phytium NorFlash Drivers. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SpiNorFlashDxe + FILE_GUID = f37ef706-187c-48fd-9102-ddbf86f551be + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= NorFlashPlatformEntryPoint + +[Sources.common] + SpiNorFlashDxe.c + SpiNorFlashDxe.h + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + UefiLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + +[FixedPcd] + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase +[Guids] + gEfiEventVirtualAddressChangeGuid + +[Protocols] + gSpiMasterProtocolGuid + gSpiNorFlashProtocolGuid + + [Depex] + TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h new file mode 100644 index ..55f5e8273f7f --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h @@ -0,0 +1,99 @@ +/** @file + Phytium NorFlash Drivers Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SPI_NORFLASH_DXE_H_ +#define SPI_NORFLASH_DXE_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +// +// Norflash registers +// +#define REG_FLASH_CAP 0x000 +#define REG_RD_CFG0x004 +#define REG_WR_CFG0x008 +#define REG_FLUSH_REG 0x00C +#define REG_CMD_PORT 0x010 +#define REG_ADDR_PORT 0x014 +#define REG_HD_PORT 0x018 +#define REG_LD_PORT 0x01C +#define REG_CS_CFG0x020 +#define REG_WIP_CFG 0x024 +#define REG_WP_REG0x028 + +#define NORFLASH_SIGNATURE SIGNATURE_32 ('F',
[edk2-devel] [PATCH v3 01/46] TigerlakeOpenBoardPkg: Fix build errors with GCC5
From: Takuto Naito REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3224 - Fix the path of TigerLakeFspBinPkg - Fix misuse of RETURN_ERROR - Remove unused function CheckNationalSio. Cc: Sai Chaganty Cc: Nate DeSimone Cc: Heng Luo Signed-off-by: Takuto Naito Reviewed-by: Heng Luo Reviewed-by: Nate DeSimone --- Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf | 2 +- Platform/Intel/TigerlakeOpenBoardPkg/Library/BasePlatformHookLib/BasePlatformHookLib.c | 188 Platform/Intel/TigerlakeOpenBoardPkg/Policy/Library/DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLate.c | 2 +- 3 files changed, 2 insertions(+), 190 deletions(-) diff --git a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf index 9d85d855f501..708fbac08fd6 100644 --- a/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf +++ b/Platform/Intel/TigerlakeOpenBoardPkg/FspWrapper/Library/PeiFspPolicyInitLib/PeiFspPolicyInitLib.inf @@ -52,7 +52,7 @@ [Packages] MdeModulePkg/MdeModulePkg.dec IntelFsp2Pkg/IntelFsp2Pkg.dec TigerlakeSiliconPkg/SiPkg.dec - TigerLakeFspBinPkg/TigerLakeFspBinPkg.dec + TigerLakeFspBinPkg/Client/TigerLakeFspBinPkg.dec TigerlakeOpenBoardPkg/OpenBoardPkg.dec UefiCpuPkg/UefiCpuPkg.dec IntelSiliconPkg/IntelSiliconPkg.dec diff --git a/Platform/Intel/TigerlakeOpenBoardPkg/Library/BasePlatformHookLib/BasePlatformHookLib.c b/Platform/Intel/TigerlakeOpenBoardPkg/Library/BasePlatformHookLib/BasePlatformHookLib.c index 6209e5045061..cc5337698b8a 100644 --- a/Platform/Intel/TigerlakeOpenBoardPkg/Library/BasePlatformHookLib/BasePlatformHookLib.c +++ b/Platform/Intel/TigerlakeOpenBoardPkg/Library/BasePlatformHookLib/BasePlatformHookLib.c @@ -94,194 +94,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_SIO_TABLE mSioTableWinbond_x374[] = { {0x30, 0x01}// Enable it with Activation bit }; -/** - Detect if a National 393 SIO is docked. If yes, enable the docked SIO - and its serial port, and disable the onboard serial port. - - @retval EFI_SUCCESS Operations performed successfully. -**/ -STATIC -VOID -CheckNationalSio ( - VOID - ) -{ - UINT8 Data8; - - // - // Pc87393 access is through either (0x2e, 0x2f) or (0x4e, 0x4f). - // We use (0x2e, 0x2f) which is determined by BADD default strapping - // - - // - // Read the Pc87393 signature - // - IoWrite8 (0x2e, 0x20); - Data8 = IoRead8 (0x2f); - - if (Data8 == 0xea) { -// -// Signature matches - National PC87393 SIO is docked -// - -// -// Enlarge the LPC decode scope to accommodate the Docking LPC Switch -// Register (SIO_DOCKING_LPC_SWITCH_REGISTER_ADDRESS is allocated at -// SIO_BASE_ADDRESS + 0x10) -// -PchLpcGenIoRangeSet ((FixedPcdGet16 (PcdSioBaseAddress) & (UINT16)~0x7F), 0x20); - -// -// Enable port switch -// -IoWrite8 (SIO_DOCKING_LPC_SWITCH_REGISTER_ADDRESS, 0x06); - -// -// Turn on docking power -// -IoWrite8 (FixedPcdGet16 (PcdSioBaseAddress) + 0x0E, 0x8c); - -IoWrite8 (FixedPcdGet16 (PcdSioBaseAddress) + 0x0E, 0x9c); - -IoWrite8 (FixedPcdGet16 (PcdSioBaseAddress) + 0x0E, 0xBc); - -// -// Enable port switch -// -IoWrite8 (SIO_DOCKING_LPC_SWITCH_REGISTER_ADDRESS, 0x7); - -// -// GPIO setting -// -IoWrite8 (0x2e, 0x24); -IoWrite8 (0x2f, 0x29); - -// -// Enable chip clock -// -IoWrite8 (0x2e, 0x29); -IoWrite8 (0x2f, 0x1e); - - -// -// Enable serial port -// - -// -// Select com1 -// -IoWrite8 (0x2e, 0x7); -IoWrite8 (0x2f, 0x3); - -// -// Base address: 0x3f8 -// -IoWrite8 (0x2e, 0x60); -IoWrite8 (0x2f, 0x03); -IoWrite8 (0x2e, 0x61); -IoWrite8 (0x2f, 0xf8); - -// -// Interrupt: 4 -// -IoWrite8 (0x2e, 0x70); -IoWrite8 (0x2f, 0x04); - -// -// Enable bank selection -// -IoWrite8 (0x2e, 0xf0); -IoWrite8 (0x2f, 0x82); - -// -// Activate -// -IoWrite8 (0x2e, 0x30); -IoWrite8 (0x2f, 0x01); - -// -// Disable onboard serial port -// -IoWrite8 (FixedPcdGet16 (PcdLpcSioConfigDefaultPort), 0x55); - -// -// Power Down UARTs -// -IoWrite8 (PcdGet16 (PcdLpcSioIndexPort), 0x2); -IoWrite8 (PcdGet16 (PcdLpcSioDataPort), 0x00); - -// -// Dissable COM1 decode -// -IoWrite8 (PcdGet16 (PcdLpcSioIndexPort), 0x24); -IoWrite8 (PcdGet16 (PcdLpcSioDataPort), 0); - -// -// Disable COM2 decode -// -IoWrite8 (PcdGet16 (PcdLpcSioIndexPort), 0x25); -IoWrite8 (PcdGet16 (PcdLpcSioDataPort), 0); - -// -// Disable interrupt -// -IoWrite8 (PcdGet16 (PcdLpcSioIndexPort), 0x28); -IoWrite8 (PcdGet16
[edk2-devel] [PATCH v3 42/46] Silicon/Phytium: Added Spi driver support to FT2000/4
The SpiDxe is to provide Spi bus read-write interfaces. v3: Optimized the codes to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 9 + Platform/Phytium/DurianPkg/DurianPkg.dsc| 5 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 2 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 44 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h | 64 +++ Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiProtocol.h | 51 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 198 7 files changed, 373 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 48f430c88de6..69842b89e021 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -38,4 +38,13 @@ [PcdsFixedAtBuild.common] gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x0002 gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x0003 + # + # SPI Flash Controller Register Base Address and Size + # + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase|0x0|UINT64|0x0004 + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x0005 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x0006 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x0007 + [Protocols] + gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 3a9bc2289cf3..68698d613f96 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -244,6 +244,11 @@ [Components.common] # ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf + # + # Spi driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index a443d0f3a4ac..1cf1927484db 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -95,6 +95,8 @@ [FV.FvMain] INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf new file mode 100644 index ..21d75f268da4 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf @@ -0,0 +1,44 @@ +#/** @file +# Phytium Spi Master Drivers. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SpiDxe + FILE_GUID = 2ba95e5c-f7f5-11ea-bf18-67fdc5787495 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= SpiMasterDrvEntryPoint + +[Sources.common] + SpiDxe.c + SpiDxe.h + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + UefiLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + +[Protocols] + gSpiMasterProtocolGuid + +[FixedPcd] + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase + +[Depex] + TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h new file mode 100644 index ..fbadd01921ff --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h @@ -0,0 +1,64 @@ +/** @file + Phytium Spi Drivers Header + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SPI_DXE_H_ +#define SPI_DXE_H_ + +#include +#include +#include +#include +#include +#include + +#define SPI_MASTER_SIGNATURE SIGNATURE_32 ('M', 'S', 'P', 'I') +#define REG_MODE_REG 0x02C + +EFI_STATUS +EFIAPI +SpiMasterGetConfig ( + IN UINT8CmdId, + OUT UINT32 *Config, + IN UINTNRegAddr + ); + +EFI_STATUS +EFIAPI +SpiMasterSetConfig ( + IN UINT8 CmdId, + IN UINT32Config, + IN UINTN RegAddr + ); + +EFI_STATUS +EFIAPI +SpiMasterSetMode ( + IN UINT32Config + ); + +EFI_STATUS +EFIAPI +
[edk2-devel] [PATCH v3 20/46] Silicon/Phytium: Added flash driver support to Phytium Silicon
The SpiNorFlashDxe provided norflash initialization, read-write, erase and other interfaces. v3: Optimized the codes to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 1 + Platform/Phytium/DurianPkg/DurianPkg.dsc| 5 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 1 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf | 48 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h | 99 + Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiNorFlashProtocol.h | 74 Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.c | 424 7 files changed, 652 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 69842b89e021..2686ba3cc3a2 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -48,3 +48,4 @@ [PcdsFixedAtBuild.common] [Protocols] gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} + gSpiNorFlashProtocolGuid = { 0x00b4af42, 0xfbd0, 0x11ea, { 0x80, 0x3a, 0x27, 0xea, 0x5e, 0x65, 0xe3, 0xf6}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 68698d613f96..1c4705144151 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -249,6 +249,11 @@ [Components.common] # Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # + # NOR Flash driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 1cf1927484db..831f7a682837 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -96,6 +96,7 @@ [FV.FvMain] INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf new file mode 100644 index ..2933dc502eed --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.inf @@ -0,0 +1,48 @@ +#/** @file +# Phytium NorFlash Drivers. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SpiNorFlashDxe + FILE_GUID = f37ef706-187c-48fd-9102-ddbf86f551be + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= NorFlashPlatformEntryPoint + +[Sources.common] + SpiNorFlashDxe.c + SpiNorFlashDxe.h + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + UefiLib + UefiBootServicesTableLib + UefiRuntimeLib + UefiDriverEntryPoint + +[FixedPcd] + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase +[Guids] + gEfiEventVirtualAddressChangeGuid + +[Protocols] + gSpiMasterProtocolGuid + gSpiNorFlashProtocolGuid + + [Depex] + TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h new file mode 100644 index ..55f5e8273f7f --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiNorFlashDxe/SpiNorFlashDxe.h @@ -0,0 +1,99 @@ +/** @file + Phytium NorFlash Drivers Header. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SPI_NORFLASH_DXE_H_ +#define SPI_NORFLASH_DXE_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +// +// Norflash registers +// +#define REG_FLASH_CAP 0x000 +#define REG_RD_CFG0x004 +#define REG_WR_CFG0x008 +#define REG_FLUSH_REG 0x00C +#define REG_CMD_PORT 0x010 +#define REG_ADDR_PORT 0x014 +#define REG_HD_PORT 0x018 +#define REG_LD_PORT 0x01C +#define REG_CS_CFG0x020 +#define REG_WIP_CFG 0x024 +#define REG_WP_REG0x028 + +#define NORFLASH_SIGNATURE SIGNATURE_32 ('F',
[edk2-devel] [PATCH v3 19/46] Silicon/Phytium: Added Spi driver support to FT2000/4
The SpiDxe is to provide Spi bus read-write interfaces. v3: Optimized the codes to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec | 9 + Platform/Phytium/DurianPkg/DurianPkg.dsc| 5 + Platform/Phytium/DurianPkg/DurianPkg.fdf| 2 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf | 44 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h | 64 +++ Silicon/Phytium/PhytiumCommonPkg/Include/Protocol/SpiProtocol.h | 51 + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.c | 198 7 files changed, 373 insertions(+) diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec index 48f430c88de6..69842b89e021 100644 --- a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec +++ b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec @@ -38,4 +38,13 @@ [PcdsFixedAtBuild.common] gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x0002 gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x0003 + # + # SPI Flash Controller Register Base Address and Size + # + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashBase|0x0|UINT64|0x0004 + gPhytiumPlatformTokenSpaceGuid.PcdSpiFlashSize|0x0|UINT64|0x0005 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase|0x0|UINT64|0x0006 + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerSize|0x0|UINT64|0x0007 + [Protocols] + gSpiMasterProtocolGuid = { 0xdf093560, 0xf955, 0x11ea, { 0x96, 0x42, 0x43, 0x9d, 0x80, 0xdd, 0x0b, 0x7c}} diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 3a9bc2289cf3..68698d613f96 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -244,6 +244,11 @@ [Components.common] # ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf + # + # Spi driver + # + Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + # # Usb Support # diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index a443d0f3a4ac..1cf1927484db 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -95,6 +95,8 @@ [FV.FvMain] INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + INF Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf + INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf new file mode 100644 index ..21d75f268da4 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.inf @@ -0,0 +1,44 @@ +#/** @file +# Phytium Spi Master Drivers. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = SpiDxe + FILE_GUID = 2ba95e5c-f7f5-11ea-bf18-67fdc5787495 + MODULE_TYPE= DXE_RUNTIME_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT= SpiMasterDrvEntryPoint + +[Sources.common] + SpiDxe.c + SpiDxe.h + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib + UefiLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + +[Protocols] + gSpiMasterProtocolGuid + +[FixedPcd] + gPhytiumPlatformTokenSpaceGuid.PcdSpiControllerBase + +[Depex] + TRUE diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h new file mode 100644 index ..fbadd01921ff --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/SpiDxe/SpiDxe.h @@ -0,0 +1,64 @@ +/** @file + Phytium Spi Drivers Header + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SPI_DXE_H_ +#define SPI_DXE_H_ + +#include +#include +#include +#include +#include +#include + +#define SPI_MASTER_SIGNATURE SIGNATURE_32 ('M', 'S', 'P', 'I') +#define REG_MODE_REG 0x02C + +EFI_STATUS +EFIAPI +SpiMasterGetConfig ( + IN UINT8CmdId, + OUT UINT32 *Config, + IN UINTNRegAddr + ); + +EFI_STATUS +EFIAPI +SpiMasterSetConfig ( + IN UINT8 CmdId, + IN UINT32Config, + IN UINTN RegAddr + ); + +EFI_STATUS +EFIAPI +SpiMasterSetMode ( + IN UINT32Config + ); + +EFI_STATUS +EFIAPI +
[edk2-devel] [PATCH v3 40/46] Silicon/Phytium: Added PciSegmentLib to FT2000/4
The PCI Segment Library for Phytium platform. with multiple RCs. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc|9 +- Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf | 28 + Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c | 1434 3 files changed, 1464 insertions(+), 7 deletions(-) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 28e52e15e393..093b2cd9dbd4 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -35,7 +35,8 @@ [LibraryClasses.common] PL011UartLib|ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.inf [LibraryClasses.common.DXE_DRIVER] - + # Pci dependencies + PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf # @@ -262,12 +263,6 @@ [Components.common] 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. diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf new file mode 100644 index ..67360016eff9 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf @@ -0,0 +1,28 @@ +#/** @file +# PCI Segment Library for Phytium platform with multiple RCs. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = PciSegmentLib + FILE_GUID = fa5173d2-40fe-11eb-9b2f-cb20dc669fd3 + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = PciSegmentLib + +[Sources] + PciSegmentLib.c + +[Packages] + MdePkg/MdePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + BaseLib + DebugLib + IoLib diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c new file mode 100644 index ..c10b152e0dbb --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.c @@ -0,0 +1,1434 @@ +/** @file + PCI Segment Library for SoC with multiple RCs. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#define PCI_SEG_CONFIG_BASE 0x4000 +#define PCIE_BIF_MODE 0x29100800 + +typedef enum { + PciCfgWidthUint8 = 0, + PciCfgWidthUint16, + PciCfgWidthUint32, + PciCfgWidthMax +} PCI_CFG_WIDTH; + +/** + Assert the validity of a PCI Segment address. + A valid PCI Segment address should not contain 1's in bits 28..31 and 48..63 + + @param[in] A The address to validate. + @param[in] M Additional bits to assert to be zero. + +**/ +#define ASSERT_INVALID_PCI_SEGMENT_ADDRESS(A,M) \ +ASSERT (((A) & (0xf000ULL | (M))) == 0) + + +#define EXTRACT_PCIE_ADDRESS(Address, Bus, Device, Function) \ +{ \ + (Bus) = (((Address) >> 20) & 0xff); \ + (Device) = (((Address) >> 15) & 0x1f); \ + (Function) = (((Address) >> 12) & 0x07); \ +} + + +/** + This function geted the config base of PCI device. + @param[in] Address The address that encodes the PCI Bus, Device, Function and + Register. + + @return The value of the config base of PCI device. + +**/ +STATIC +UINT64 +PciSegmentLibGetConfigBase ( + IN UINT64 Address + ) +{ + UINT8 Bus; + UINT8 Device; + UINT8 Function; + UINT8 RootPortCount; + UINT8 Peu0RootPortCount; + UINT8 Peu1RootPortCount; + UINT32 BifMode; + UINT32 Peu0BifMode; + UINT32 Peu1BifMode; + + EXTRACT_PCIE_ADDRESS (Address, Bus, Device, Function); + BifMode = MmioRead32 (PCIE_BIF_MODE); + Peu0BifMode = BifMode & 0x3; + Peu1BifMode = (BifMode >> 2) & 0x3; + + if ((Peu0BifMode == 1)) { +Peu0RootPortCount = 3; + } else { +Peu0RootPortCount = 2; + } + + if ((Peu1BifMode == 1)) { +Peu1RootPortCount = 3; + } else { +Peu1RootPortCount = 2; + } + RootPortCount = Peu0RootPortCount + Peu1RootPortCount; + //ignore device > 0 or function > 0 on root port + if (RootPortCount == 4) { +if ((Bus == 1) || (Bus == 2) || (Bus == 3) || (Bus == 4)) { + if
[edk2-devel] [PATCH v3 13/46] Silicon/Phytium: Added PlatformLib to FT2000/4
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. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- 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 ..48f430c88de6 --- /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|0x + gPhytiumPlatformTokenSpaceGuid.PcdSystemIoSize|0x0|UINT64|0x0001 + + # + # PCI configuration address space + # + gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x0002 + gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x0003 + +[Protocols] diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc new file mode 100644 index ..121fe0e7c549 --- /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
[edk2-devel] [PATCH v3 15/46] Intel/BoardModulePkg: sort load option in the first boot
From: "Liu, Zhiguang" Currently, load option is only sorted when setup is the first priority in boot option. However, Below change in UefiBootManagerLib puts setup in the end, which causes the sort function won't be called. MdeModulePkg/UefiBootManagerLib: Put BootMenu at the end of BootOrder SHA-1: 7f34681c488aee2563eaa2afcc6a2c8aa7c5b912 This patch will set a NV variable in the first boot, and sort the boot option in first boot. Reviewed-by: Eric Dong Cc: Liming Gao Cc: Nate DeSimone Cc: Prince Agyeman Reviewed-by: Ray Ni Cc: Zhichao Gao Signed-off-by: Zhiguang Liu --- Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c | 72 ++-- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c index d7612fb80a95..a37139a0074e 100644 --- a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c +++ b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBdsHookLib.c @@ -20,6 +20,8 @@ #include "BoardBdsHook.h" +#define IS_FIRST_BOOT_VAR_NAME L"IsFirstBoot" + GLOBAL_REMOVE_IF_UNREFERENCED EFI_BOOT_MODEgBootMode; BOOLEANgPPRequireUIConfirm; extern UINTN mBootMenuOptionNumber; @@ -992,37 +994,6 @@ ConnectSequence ( EfiBootManagerConnectAll (); } - -/** - The function is to consider the boot order which is not in our expectation. - In the case that we need to re-sort the boot option. - - @retval TRUE Need to sort Boot Option. - @retval FALSEDon't need to sort Boot Option. -**/ -BOOLEAN -IsNeedSortBootOption ( - VOID - ) -{ - EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions; - UINTN BootOptionCount; - - BootOptions = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot); - - // - // If setup is the first priority in boot option, we need to sort boot option. - // - if ((BootOptionCount > 1) && -(((StrnCmp (BootOptions->Description, L"Enter Setup", StrLen (L"Enter Setup"))) == 0) || -((StrnCmp (BootOptions->Description, L"BootManagerMenuApp", StrLen (L"BootManagerMenuApp"))) == 0))) { -return TRUE; - } - - return FALSE; -} - - /** Connects Root Bridge **/ @@ -1332,6 +1303,9 @@ BdsAfterConsoleReadyBeforeBootOptionCallback ( ) { EFI_BOOT_MODE LocalBootMode; + EFI_STATUSStatus; + BOOLEAN IsFirstBoot; + UINTN DataSize; DEBUG ((DEBUG_INFO, "Event gBdsAfterConsoleReadyBeforeBootOptionEvent callback starts\n")); // @@ -1376,14 +1350,42 @@ BdsAfterConsoleReadyBeforeBootOptionCallback ( // // PXE boot option may appear after boot option enumeration // + + EfiBootManagerRefreshAllBootOption (); + DataSize = sizeof (BOOLEAN); + Status = gRT->GetVariable ( + IS_FIRST_BOOT_VAR_NAME, + &gEfiCallerIdGuid, + NULL, + &DataSize, + &IsFirstBoot + ); + if (EFI_ERROR (Status)) { +// +// If can't find the variable, see it as the first boot +// +IsFirstBoot = TRUE; + } + + if (IsFirstBoot) { +// +// In the first boot, sort the boot option +// +EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, CompareBootOption); +IsFirstBoot = FALSE; +Status = gRT->SetVariable ( +IS_FIRST_BOOT_VAR_NAME, +&gEfiCallerIdGuid, +EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS, +sizeof (BOOLEAN), +&IsFirstBoot +); + } + break; } Print (L"Press F7 for BootMenu!\n"); - EfiBootManagerRefreshAllBootOption (); - if (IsNeedSortBootOption()) { -EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot, CompareBootOption); - } } -- 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#72814): https://edk2.groups.io/g/devel/message/72814 Mute This Topic: https://groups.io/mt/81361267/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] [PATCH v3 37/46] Silicon/Phytium: Added PlatformLib to FT2000/4
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. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- 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 ..48f430c88de6 --- /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|0x + gPhytiumPlatformTokenSpaceGuid.PcdSystemIoSize|0x0|UINT64|0x0001 + + # + # PCI configuration address space + # + gPhytiumPlatformTokenSpaceGuid.PcdPciConfigBase|0x0|UINT64|0x0002 + gPhytiumPlatformTokenSpaceGuid.PcdPciConfigSize|0x0|UINT64|0x0003 + +[Protocols] diff --git a/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc b/Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dsc.inc new file mode 100644 index ..121fe0e7c549 --- /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
[edk2-devel] [PATCH v3 14/46] Silicon/Phytium: Added Acpi support to FT2000/4
Added Acpi driver and table to FT2000/4, the ACPI Tables providing library AcpiTables.inf uses a lot of information that is available in the form of PCDs for differnt platforms. v3: Optimize code to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc | 6 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 7 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf| 56 + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 53 + Silicon/Phytium/PhytiumCommonPkg/Include/Platform.h | 80 +++ Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 250 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiSsdtRootPci.asl | 209 Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dbg2.aslc | 80 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Cpu.asl | 85 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Dsdt.asl | 15 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Dsdt/Uart.asl | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Fadt.aslc | 77 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Gtdt.aslc | 83 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Iort.aslc | 89 +++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Madt.aslc | 67 ++ Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Mcfg.aslc | 65 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Pptt.aslc | 219 + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/Spcr.aslc | 73 ++ 18 files changed, 1579 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index b523ecd6584b..6f38acb6361c 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -279,6 +279,12 @@ [Components.common] # MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf + # + # ACPI Support + # + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf + Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf # # Bds diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 9d75b072c6dc..f435f7cb51c2 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -111,6 +111,13 @@ [FV.FvMain] INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + # + # ACPI Support + # + INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + INF RuleOverride=ACPITABLE Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf + INF Silicon/Phytium/PhytiumCommonPkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf + # # Multiple Console IO support # diff --git a/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf new file mode 100644 index ..e3fd86f19733 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Drivers/AcpiTables/AcpiTables.inf @@ -0,0 +1,56 @@ +#/** @file +# +# ACPI table data and ASL sources required to boot the platform. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = AcpiTables + FILE_GUID = 7E374E25-8E01-4FEE-87F2-390C23C606CD + MODULE_TYPE= USER_DEFINED + VERSION_STRING = 1.0 + +[Sources] + AcpiSsdtRootPci.asl + Dsdt/Dsdt.asl + Fadt.aslc + Iort.aslc + Gtdt.aslc + Madt.aslc + Mcfg.aslc + Pptt.aslc + Spcr.aslc + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[FixedPcd] + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase + gArmTokenSpaceGuid.PcdGicRedistributorsBase + + gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum + + gArmTokenSpaceGuid.PcdGenericWatchdogControlBase + gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase + + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gArmPlatformTokenSpaceGuid.PL011UartClkInHz
[edk2-devel] [PATCH v3 18/46] Silicon/Phytium: Added PciHostBridgeLib to FT2000/4
The Pci host bridge library is mainly to get Pci bridge information. v3: Optimize the codes of PciHostBridgeLib.c to conform to specifications. Signed-off-by: Ling Jia Reviewed-by: Leif Lindholm --- Platform/Phytium/DurianPkg/DurianPkg.dsc | 9 + Platform/Phytium/DurianPkg/DurianPkg.fdf | 6 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf | 47 + Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c | 181 4 files changed, 243 insertions(+) diff --git a/Platform/Phytium/DurianPkg/DurianPkg.dsc b/Platform/Phytium/DurianPkg/DurianPkg.dsc index 093b2cd9dbd4..3a9bc2289cf3 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.dsc +++ b/Platform/Phytium/DurianPkg/DurianPkg.dsc @@ -37,6 +37,7 @@ [LibraryClasses.common] [LibraryClasses.common.DXE_DRIVER] # Pci dependencies PciSegmentLib|Silicon/Phytium/FT2000-4Pkg/Library/PciSegmentLib/PciSegmentLib.inf + PciHostBridgeLib|Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf # @@ -263,6 +264,14 @@ [Components.common] MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf + # + # PCI Support + # + ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf + MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.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. diff --git a/Platform/Phytium/DurianPkg/DurianPkg.fdf b/Platform/Phytium/DurianPkg/DurianPkg.fdf index 3106a43fb744..a443d0f3a4ac 100644 --- a/Platform/Phytium/DurianPkg/DurianPkg.fdf +++ b/Platform/Phytium/DurianPkg/DurianPkg.fdf @@ -135,6 +135,12 @@ [FV.FvMain] INF FatPkg/EnhancedFatDxe/Fat.inf INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + # + # PCI Support + # + INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf + INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + # # SATA Controller # diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf new file mode 100644 index ..0e6f0797b0fe --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.inf @@ -0,0 +1,47 @@ +#/** @file +# PCI Host Bridge Library instance for Phytium SOC. +# +# Copyright (C) 2020, Phytium Technology Co, Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION= 0x0001001b + BASE_NAME = PciHostBridgeLib + FILE_GUID = f965de0e-40fe-11eb-8290-3f9d1f895a80 + MODULE_TYPE= DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = PciHostBridgeLib|DXE_DRIVER + +# +# The following information is for reference only and not required by the build +# tools. +# +# VALID_ARCHITECTURES = ARM AARCH64 +# + +[Sources] + PciHostBridgeLib.c + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Silicon/Phytium/PhytiumCommonPkg/PhytiumCommonPkg.dec + +[LibraryClasses] + DebugLib + +[Guids] + +[FixedPcd] + gArmTokenSpaceGuid.PcdPciBusMin + gArmTokenSpaceGuid.PcdPciBusMax + gArmTokenSpaceGuid.PcdPciIoBase + gArmTokenSpaceGuid.PcdPciIoSize + gArmTokenSpaceGuid.PcdPciMmio32Base + gArmTokenSpaceGuid.PcdPciMmio32Size + gArmTokenSpaceGuid.PcdPciMmio64Base + gArmTokenSpaceGuid.PcdPciMmio64Size diff --git a/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c new file mode 100644 index ..8ed3516749a1 --- /dev/null +++ b/Silicon/Phytium/FT2000-4Pkg/Library/PciHostBridgeLib/PciHostBridgeLib.c @@ -0,0 +1,181 @@ +/** @file + PCI host bridge library instance for Phytium SOC. + + Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#pragma pack(1) + +typedef struct { + ACPI_HID_DEVICE_PATH AcpiDevicePath; + EFI_DEVICE_PATH_PROTOCOL EndDevicePath; +} EFI_PCI_ROOT_BRIDGE_DEVICE_PATH; + +#pragma pack () + +#define END_DEVICE_PATH_DEF { END_DEVICE_PATH_TYPE, \ + END_ENTIRE_DEVICE_PATH_SUBTYPE, \ + { END_DEVICE_PATH_LENGTH, 0 } \ +} + +#define ACPI_DEVICE_PATH_DEF(UID) {{ ACPI_DEVICE_PATH, ACPI_DP, \ + { (UINT8) (sizeof