diff --git a/Makefile b/Makefile index b1d8a4173..673e6812c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -BOARDS ?= QUARTZ64 SOQUARTZ ROC-RK3566-PC ROC-RK3568-PC ORANGEPI3B +BOARDS ?= QUARTZ64 SOQUARTZ ROC-RK3566-PC ROC-RK3568-PC ORANGEPI3B PINETAB2 TARGET ?= RELEASE .PHONY: all diff --git a/build.sh b/build.sh index d3ce90343..0940b364a 100755 --- a/build.sh +++ b/build.sh @@ -106,6 +106,10 @@ for board in ${RKUEFIBOARDS}; do build_uefi OrangePi OrangePi3B build_fit OrangePi3B rk3566-orangepi-3b ;; + PINETAB2) + build_uefi Pine64 PineTab2 + build_fit PineTab2 rk3566-pinetab2 + ;; *) echo "Unknown board ${board}" exit 1 diff --git a/dtb/rk3566-pinetab2.dtb b/dtb/rk3566-pinetab2.dtb new file mode 100644 index 000000000..467db09e7 Binary files /dev/null and b/dtb/rk3566-pinetab2.dtb differ diff --git a/edk2-rockchip/Platform/Pine64/PineTab2/Drivers/BoardInitDxe/BoardInitDxe.c b/edk2-rockchip/Platform/Pine64/PineTab2/Drivers/BoardInitDxe/BoardInitDxe.c new file mode 100755 index 000000000..838f68e85 --- /dev/null +++ b/edk2-rockchip/Platform/Pine64/PineTab2/Drivers/BoardInitDxe/BoardInitDxe.c @@ -0,0 +1,189 @@ +/** @file + * + * Board init for the PineTab2 platform + * + * Copyright (c) 2021, Jared McNeill + * Copyright (c) 2023, Dang Huynh + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/* + * PMIC registers +*/ +#define PMIC_I2C_ADDR 0x20 + +#define PMIC_CHIP_NAME 0xed +#define PMIC_CHIP_VER 0xee +#define PMIC_POWER_EN1 0xb2 +#define PMIC_POWER_EN2 0xb3 +#define PMIC_POWER_EN3 0xb4 +#define PMIC_LDO1_ON_VSEL 0xcc +#define PMIC_LDO2_ON_VSEL 0xce +#define PMIC_LDO3_ON_VSEL 0xd0 +#define PMIC_LDO4_ON_VSEL 0xd2 +#define PMIC_LDO6_ON_VSEL 0xd6 +#define PMIC_LDO7_ON_VSEL 0xd8 +#define PMIC_LDO8_ON_VSEL 0xda +#define PMIC_LDO9_ON_VSEL 0xdc + +/* + * CPU_GRF registers +*/ +#define GRF_CPU_COREPVTPLL_CON0 (CPU_GRF + 0x0010) +#define CORE_PVTPLL_RING_LENGTH_SEL_SHIFT 3 +#define CORE_PVTPLL_RING_LENGTH_SEL_MASK (0x1FU << CORE_PVTPLL_RING_LENGTH_SEL_SHIFT) +#define CORE_PVTPLL_OSC_EN BIT1 +#define CORE_PVTPLL_START BIT0 + +/* + * PMU registers + */ +#define PMU_NOC_AUTO_CON0 (PMU_BASE + 0x0070) +#define PMU_NOC_AUTO_CON1 (PMU_BASE + 0x0074) + +STATIC +EFI_STATUS +PmicRead ( + IN UINT8 Register, + OUT UINT8 *Value + ) +{ + return I2cRead (I2C0_BASE, PMIC_I2C_ADDR, + &Register, sizeof (Register), + Value, sizeof (*Value)); +} + +STATIC +EFI_STATUS +PmicWrite ( + IN UINT8 Register, + IN UINT8 Value + ) +{ + return I2cWrite (I2C0_BASE, PMIC_I2C_ADDR, + &Register, sizeof (Register), + &Value, sizeof (Value)); +} + +STATIC +VOID +BoardInitPmic ( + VOID + ) +{ + EFI_STATUS Status; + UINT16 ChipName; + UINT8 ChipVer; + UINT8 Value; + + DEBUG ((DEBUG_INFO, "BOARD: PMIC init\n")); + + GpioPinSetPull (0, GPIO_PIN_PB1, GPIO_PIN_PULL_NONE); + GpioPinSetInput (0, GPIO_PIN_PB1, GPIO_PIN_INPUT_SCHMITT); + GpioPinSetFunction (0, GPIO_PIN_PB1, 1); + GpioPinSetPull (0, GPIO_PIN_PB2, GPIO_PIN_PULL_NONE); + GpioPinSetInput (0, GPIO_PIN_PB2, GPIO_PIN_INPUT_SCHMITT); + GpioPinSetFunction (0, GPIO_PIN_PB2, 1); + + Status = PmicRead (PMIC_CHIP_NAME, &Value); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "Failed to read PMIC chip name! %r\n", Status)); + ASSERT (FALSE); + } + ChipName = (UINT16)Value << 4; + + Status = PmicRead (PMIC_CHIP_VER, &Value); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "Failed to read PMIC chip version! %r\n", Status)); + ASSERT (FALSE); + } + ChipName |= (Value >> 4) & 0xF; + ChipVer = Value & 0xF; + + DEBUG ((DEBUG_INFO, "PMIC: Detected RK%03X ver 0x%X\n", ChipName, ChipVer)); + ASSERT (ChipName == 0x817); + + /* Initialize PMIC */ + PmicWrite (PMIC_LDO1_ON_VSEL, 0x30); /* 1.8V - vcca1v8_pmu */ + PmicWrite (PMIC_LDO2_ON_VSEL, 0x0c); /* 0.9V - vdda_0v9 */ + PmicWrite (PMIC_LDO3_ON_VSEL, 0x0c); /* 0.9V - vdd0v9_pmu */ + PmicWrite (PMIC_LDO4_ON_VSEL, 0x6c); /* 3.3V - vccio_acodec */ + /* Skip LDO5 for now; 1.8V/3.3V - vccio_sd */ + PmicWrite (PMIC_LDO6_ON_VSEL, 0x6c); /* 3.3V - vcc3v3_pmu */ + PmicWrite (PMIC_LDO7_ON_VSEL, 0x30); /* 1.8V - vcca_1v8 */ + PmicWrite (PMIC_LDO8_ON_VSEL, 0x30); /* 1.8V - vcca1v8_dvp */ + PmicWrite (PMIC_LDO9_ON_VSEL, 0x58); /* 2.8V - vcca2v8_dvp */ + + PmicWrite (PMIC_POWER_EN1, 0xff); /* LDO1, LDO2, LDO3, LDO4 */ + PmicWrite (PMIC_POWER_EN2, 0xee); /* LDO6, LDO7, LDO8 */ + PmicWrite (PMIC_POWER_EN3, 0x33); /* LDO9, BOOST */ +} + +EFI_STATUS +EFIAPI +BoardInitDriverEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + DEBUG ((DEBUG_INFO, "BOARD: BoardInitDriverEntryPoint() called\n")); + + SocSetDomainVoltage (PMUIO2, VCC_1V8); /* VCCA1V8_PMU */ + SocSetDomainVoltage (VCCIO1, VCC_3V3); /* VCCIO_ACODEC (PCIe) */ + SocSetDomainVoltage (VCCIO2, VCC_1V8); /* VCCIO_FLASH */ + SocSetDomainVoltage (VCCIO3, VCC_3V3); /* VCCIO_SD */ + SocSetDomainVoltage (VCCIO4, VCC_1V8); + SocSetDomainVoltage (VCCIO5, VCC_1V8); + SocSetDomainVoltage (VCCIO6, VCC_1V8); + SocSetDomainVoltage (VCCIO7, VCC_3V3); + + BoardInitPmic (); + + /* Enable automatic clock gating */ + MmioWrite32 (PMU_NOC_AUTO_CON0, 0xFFFFFFFFU); + MmioWrite32 (PMU_NOC_AUTO_CON1, 0x000F000FU); + + /* Set core_pvtpll ring length */ + MmioWrite32 (GRF_CPU_COREPVTPLL_CON0, + ((CORE_PVTPLL_RING_LENGTH_SEL_MASK | CORE_PVTPLL_OSC_EN | CORE_PVTPLL_START) << 16) | + (5U << CORE_PVTPLL_RING_LENGTH_SEL_SHIFT) | CORE_PVTPLL_OSC_EN | CORE_PVTPLL_START); + + /* Configure MULTI-PHY 0 and 1 for USB3 mode */ + MultiPhySetMode (0, MULTIPHY_MODE_USB3); + MultiPhySetMode (1, MULTIPHY_MODE_USB3); + + /* Set GPIO4 PC4 and PC5 (USB_HOST_PWREN) output high to power USB ports */ + GpioPinSetDirection (4, GPIO_PIN_PC4, GPIO_PIN_OUTPUT); + GpioPinWrite (4, GPIO_PIN_PC4, TRUE); + GpioPinSetDirection (4, GPIO_PIN_PC5, GPIO_PIN_OUTPUT); + GpioPinWrite (4, GPIO_PIN_PC5, TRUE); + + return EFI_SUCCESS; +} diff --git a/edk2-rockchip/Platform/Pine64/PineTab2/Drivers/BoardInitDxe/BoardInitDxe.inf b/edk2-rockchip/Platform/Pine64/PineTab2/Drivers/BoardInitDxe/BoardInitDxe.inf new file mode 100755 index 000000000..09471fc79 --- /dev/null +++ b/edk2-rockchip/Platform/Pine64/PineTab2/Drivers/BoardInitDxe/BoardInitDxe.inf @@ -0,0 +1,57 @@ +#/** @file +# +# Board init PineTab2 platforms +# +# Copyright (c) 2021 Jared McNeill +# Copyright (c) 2023, Dang Huynh +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION = 0x0001001A + BASE_NAME = BoardInitDxe + FILE_GUID = D595E3B3-A972-4A6D-94F6-11309E3FA496 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = BoardInitDriverEntryPoint + +[Sources] + BoardInitDxe.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + CryptoPkg/CryptoPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + ArmPkg/ArmPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + Platform/Rockchip/Rk356x/Rk356x.dec + Silicon/Rockchip/Rk356x/Rk356x.dec + +[LibraryClasses] + ArmLib + UefiBootServicesTableLib + MemoryAllocationLib + BaseMemoryLib + BaseCryptLib + BaseLib + UefiLib + UefiDriverEntryPoint + DebugLib + PrintLib + TimeBaseLib + TimerLib + CruLib + GpioLib + I2cLib + MultiPhyLib + OtpLib + SocLib + +[Protocols] + + +[Depex] + TRUE diff --git a/edk2-rockchip/Platform/Pine64/PineTab2/PineTab2.dsc b/edk2-rockchip/Platform/Pine64/PineTab2/PineTab2.dsc new file mode 100644 index 000000000..8f3726b0f --- /dev/null +++ b/edk2-rockchip/Platform/Pine64/PineTab2/PineTab2.dsc @@ -0,0 +1,719 @@ +# @file +# +# Copyright (c) 2011 - 2020, ARM Limited. All rights reserved. +# Copyright (c) 2014, Linaro Limited. All rights reserved. +# Copyright (c) 2015 - 2021, Intel Corporation. All rights reserved. +# Copyright (c) 2017 - 2021, Andrei Warkentin +# Copyright (C) 2021, Jared McNeill +# Copyright (c) 2023, Dang Huynh +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +################################################################################ +# +# Defines Section - statements that will be processed to create a Makefile. +# +################################################################################ +[Defines] + PLATFORM_NAME = PineTab2 + PLATFORM_GUID = 2EDE49F2-1EFA-4149-AE6E-EA4D1BA2A23F + PLATFORM_VERSION = 1.0 + DSC_SPECIFICATION = 0x0001001A + OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME) + SUPPORTED_ARCHITECTURES = AARCH64 + BUILD_TARGETS = DEBUG|RELEASE|NOOPT + SKUID_IDENTIFIER = DEFAULT + FLASH_DEFINITION = Platform/Rockchip/Rk356x/Rk356x.fdf + BOARD_DXE_FV_COMPONENTS = Platform/Pine64/PineTab2/PineTab2.fdf.inc + + # + # Defines for default states. These can be changed on the command line. + # -D FLAG=VALUE + # + DEFINE DEBUG_PRINT_ERROR_LEVEL = 0x8000004F + +################################################################################ +# +# Library Class section - list of all Library Classes needed by this Platform. +# +################################################################################ + +!include MdePkg/MdeLibs.dsc.inc + +[LibraryClasses.common] +!if $(TARGET) == RELEASE + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf +!else + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf +!endif + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf + + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf + BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf + ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf + PciExpressLib|MdePkg/Library/BasePciExpressLib/BasePciExpressLib.inf + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.inf + CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf + + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf + DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf + SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf + + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf + + # + # Ramdisk Requirements + # + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf + + # Allow dynamic PCDs + # + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + + # use the accelerated BaseMemoryLibOptDxe by default, overrides for SEC/PEI below + BaseMemoryLib|MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf + + # + # It is not possible to prevent the ARM compiler from inserting calls to intrinsic functions. + # This library provides the instrinsic functions such a compiler may generate calls to. + # + NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf + + # Add support for GCC stack protector + NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf + + # ARM Architectural Libraries + CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMaintenanceLib.inf + DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerLib.inf + CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf + ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf + ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf + ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf + DmaLib|EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf + TimeBaseLib|EmbeddedPkg/Library/TimeBaseLib/TimeBaseLib.inf + ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf + ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf + ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf + + # Rockchip SoC libraries + CpuVoltageLib|Silicon/Rockchip/Rk356x/Library/Tsc4525CpuVoltageLib/CpuVoltageLib.inf + CruLib|Silicon/Rockchip/Rk356x/Library/CruLib/CruLib.inf + GpioLib|Silicon/Rockchip/Rk356x/Library/GpioLib/GpioLib.inf + I2cLib|Silicon/Rockchip/Rk356x/Library/I2cLib/I2cLib.inf + MultiPhyLib|Silicon/Rockchip/Rk356x/Library/MultiPhyLib/MultiPhyLib.inf + OtpLib|Silicon/Rockchip/Rk356x/Library/OtpLib/OtpLib.inf + SdramLib|Silicon/Rockchip/Rk356x/Library/SdramLib/SdramLib.inf + SocLib|Silicon/Rockchip/Rk356x/Library/SocLib/SocLib.inf + Pcie30PhyLib|Silicon/Rockchip/Rk356x/Library/Pcie30PhyLib/Pcie30PhyLib.inf + + # Devices + NonDiscoverableDeviceRegistrationLib|MdeModulePkg/Library/NonDiscoverableDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.inf + + # UART + #PciCf8Lib|MdePkg/Library/BasePciCf8Lib/BasePciCf8Lib.inf + #PciLib|MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf + SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf + PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf + + # Cryptographic libraries + RngLib|MdePkg/Library/DxeRngLib/DxeRngLib.inf + IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf + BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf + OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf + TlsLib|CryptoPkg/Library/TlsLib/TlsLib.inf + + # + # Uncomment (and comment out the next line) For RealView Debugger. The Standard IO window + # in the debugger will show load and unload commands for symbols. You can cut and paste this + # into the command window to load symbols. We should be able to use a script to do this, but + # the version of RVD I have does not support scripts accessing system memory. + # + #PeCoffExtraActionLib|ArmPkg/Library/RvdPeCoffExtraActionLib/RvdPeCoffExtraActionLib.inf + PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCoffExtraActionLib.inf + #PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf + + DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf + DebugAgentTimerLib|EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf + + # Flattened Device Tree (FDT) access library + FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf + + # USB Libraries + UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf + + # SCMI Mailbox Transport Layer + ArmMtlLib|Platform/Rockchip/Rk356x/Library/RkMtlLib/RkMtlLib.inf + + # + # Secure Boot dependencies + # + TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf + AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf + VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf + VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLib.inf + VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf + + # + # PCI support + # + PciSegmentLib|Silicon/Rockchip/Rk356x/Library/Rk356xPciSegmentLib/Rk356xPciSegmentLib.inf + PciLib|MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf + PciHostBridgeLib|Silicon/Rockchip/Rk356x/Library/Rk356xPciHostBridgeLib/Rk356xPciHostBridgeLib.inf + + # Storage + UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf + +[LibraryClasses.common.SEC] + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + MemoryInitPeiLib|Platform/Rockchip/Rk356x/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf + PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf + ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf + LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf + PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf + HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf + PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf + MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf + +[LibraryClasses.common.DXE_CORE] + HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf + MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf + PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf + +[LibraryClasses.common.DXE_DRIVER] + SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/VariablePolicyHelperLib.inf + +[LibraryClasses.common.UEFI_APPLICATION] + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf + +[LibraryClasses.common.UEFI_DRIVER] + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + +[LibraryClasses.common.DXE_RUNTIME_DRIVER] + # Runtime debug messages may crash an OS unless serial output to MMIO mapped UARTs is inhibited + DebugLib|MdePkg/Library/DxeRuntimeDebugLibSerialPort/DxeRuntimeDebugLibSerialPort.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + EfiResetSystemLib|Platform/Rockchip/Rk356x/Library/ResetLib/ResetLib.inf + ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLibRuntimeDxe.inf + +################################################################################################### +# BuildOptions Section - Define the module specific tool chain flags that should be used as +# the default flags for a module. These flags are appended to any +# standard flags that are defined by the build process. +################################################################################################### + +[BuildOptions] + GCC:*_*_*_CC_FLAGS = -DRK356X -DPINETAB2 + GCC:*_*_*_PP_FLAGS = -DRK356X -DPINETAB2 + GCC:*_*_*_ASLPP_FLAGS = -DRK356X -DPINETAB2 + GCC:*_*_*_ASLCC_FLAGS = -DRK356X -DPINETAB2 + GCC:*_*_*_VFRPP_FLAGS = -DRK356X -DPINETAB2 + GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG -DNDEBUG + +[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] + GCC:*_*_AARCH64_DLINK_FLAGS = -z common-page-size=0x10000 + +################################################################################ +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform +# +################################################################################ + +[PcdsFeatureFlag.common] + # Use the Vector Table location in CpuDxe. We will not copy the Vector Table at PcdCpuVectorBaseAddress + gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE + + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE + + ## If TRUE, Graphics Output Protocol will be installed on virtual handle created by ConsplitterDxe. + # It could be set FALSE to save size. + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE + gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport|FALSE + + gArmTokenSpaceGuid.PcdArmGicV3WithV2Legacy|FALSE + + +[PcdsFixedAtBuild.common] + gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000 + gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF + gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1 + gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0 + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320 + + # DEBUG_ASSERT_ENABLED 0x01 + # DEBUG_PRINT_ENABLED 0x02 + # DEBUG_CODE_ENABLED 0x04 + # CLEAR_MEMORY_ENABLED 0x08 + # ASSERT_BREAKPOINT_ENABLED 0x10 + # ASSERT_DEADLOOP_ENABLED 0x20 +!if $(TARGET) == RELEASE + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x21 +!else + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f +!endif + + # DEBUG_INIT 0x00000001 // Initialization + # DEBUG_WARN 0x00000002 // Warnings + # DEBUG_LOAD 0x00000004 // Load events + # DEBUG_FS 0x00000008 // EFI File system + # DEBUG_POOL 0x00000010 // Alloc & Free (pool) + # DEBUG_PAGE 0x00000020 // Alloc & Free (page) + # DEBUG_INFO 0x00000040 // Informational debug messages + # DEBUG_DISPATCH 0x00000080 // PEI/DXE/SMM Dispatchers + # DEBUG_VARIABLE 0x00000100 // Variable + # DEBUG_BM 0x00000400 // Boot Manager + # DEBUG_BLKIO 0x00001000 // BlkIo Driver + # DEBUG_NET 0x00004000 // SNP Driver + # DEBUG_UNDI 0x00010000 // UNDI Driver + # DEBUG_LOADFILE 0x00020000 // LoadFile + # DEBUG_EVENT 0x00080000 // Event messages + # DEBUG_GCD 0x00100000 // Global Coherency Database changes + # DEBUG_CACHE 0x00200000 // Memory range cachability changes + # DEBUG_VERBOSE 0x00400000 // Detailed debug messages that may + # // significantly impact boot performance + # DEBUG_ERROR 0x80000000 // Error + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|$(DEBUG_PRINT_ERROR_LEVEL) + + gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 + + # + # Optional feature to help prevent EFI memory map fragments + # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob + # Values are in EFI Pages (4K). DXE Core will make sure that + # at least this much of each type of memory can be allocated + # from a single memory range. This way you only end up with + # maximum of two fragments for each type in the memory map + # (the memory used, and the free memory that was prereserved + # but not used). + # + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|300 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|150 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|1000 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|12000 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|20 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0 + + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString|L"EDK2-DEV" + + # Default platform supported RFC 4646 languages: (American) English + gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLangCodes|"en-US" + + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x10000 + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x8000 + gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x10000 + +[LibraryClasses.common] + ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf + ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf + ArmPlatformLib|Platform/Rockchip/Rk356x/Library/PlatformLib/PlatformLib.inf + TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf + BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf + PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf + CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf + AcpiLib|EmbeddedPkg/Library/AcpiLib/AcpiLib.inf + +[LibraryClasses.common.UEFI_DRIVER] + +################################################################################ +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform +# +################################################################################ + +[PcdsFeatureFlag.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdInstallAcpiSdtProtocol|TRUE + +[PcdsFixedAtBuild.common] + gArmPlatformTokenSpaceGuid.PcdCoreCount|4 + gArmPlatformTokenSpaceGuid.PcdClusterCount|1 + + gArmTokenSpaceGuid.PcdVFPEnabled|1 + + # ARM Architectural Timer Frequency + gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|24000000 + gEmbeddedTokenSpaceGuid.PcdMetronomeTickPeriod|1000 + gEmbeddedTokenSpaceGuid.PcdTimerPeriod|1000 + + gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize|0x4000 + + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800 + + # Smallest possible memory size + gArmTokenSpaceGuid.PcdSystemMemoryBase|0 + gArmTokenSpaceGuid.PcdSystemMemorySize|0x80000000 + + # Size of the region used by UEFI in permanent memory (Reserved 64MB) + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x04000000 + + # UART2 + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0xFE660000 + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseMmio|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate|24000000 + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterStride|4 + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterAccessWidth|32 + + # TODO: Use 1.5M baud + #gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|1500000 + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200 + + # + # ARM General Interrupt Controller (GIC600) + # + gArmTokenSpaceGuid.PcdGicDistributorBase|0xFD400000 + gArmTokenSpaceGuid.PcdGicRedistributorsBase|0xFD460000 + gRk356xTokenSpaceGuid.PcdGicPmuIrq0|260 + gRk356xTokenSpaceGuid.PcdGicPmuIrq1|261 + gRk356xTokenSpaceGuid.PcdGicPmuIrq2|262 + gRk356xTokenSpaceGuid.PcdGicPmuIrq3|263 + + ## Default Terminal Type + ## 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8, 4-TTYTERM + gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4 + + gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0x31 } + + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor|L"EDK2" + gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdImageProtectionPolicy|0x3 + gRk356xTokenSpaceGuid.PcdPlatformName|"PINE64 PineTab2" + gRk356xTokenSpaceGuid.PcdCpuName|"Rockchip RK3566 (Cortex-A55)" + gRk356xTokenSpaceGuid.PcdPlatformVendorName|"Pine64" + gRk356xTokenSpaceGuid.PcdFamilyName|"PineTab2" + gRk356xTokenSpaceGuid.PcdProductUrl|"https://www.pine64.org/pinetab2/" + gRk356xTokenSpaceGuid.PcdMemoryVendorName|"Micron" + + # + # USB support + # + gRk356xTokenSpaceGuid.PcdOhc0Status|0xF + gRk356xTokenSpaceGuid.PcdOhc1Status|0xF + gRk356xTokenSpaceGuid.PcdEhc0Status|0xF + gRk356xTokenSpaceGuid.PcdEhc1Status|0xF + gRk356xTokenSpaceGuid.PcdXhc0Status|0xF + gRk356xTokenSpaceGuid.PcdXhc1Status|0xF + + # + # SATA support + # + gRk356xTokenSpaceGuid.PcdSata1Status|0xF + + # + # PCI support + # + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress|0x0000000300000000 + gArmTokenSpaceGuid.PcdPciBusMin|0 + gArmTokenSpaceGuid.PcdPciBusMax|1 + gArmTokenSpaceGuid.PcdPciMmio32Base|0xF4000000 + gArmTokenSpaceGuid.PcdPciMmio32Size|0x02000000 + gArmTokenSpaceGuid.PcdPciMmio64Base|0x0000000310000000 + gArmTokenSpaceGuid.PcdPciMmio64Size|0x000000002FFF0000 + gArmTokenSpaceGuid.PcdPciIoBase|0x0000 + gArmTokenSpaceGuid.PcdPciIoSize|0x10000 + gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize|34 + + gEfiMdePkgTokenSpaceGuid.PcdPciIoTranslation|0x000000033FFF0000 + gRk356xTokenSpaceGuid.PcdPcieResetGpioBank|1 + gRk356xTokenSpaceGuid.PcdPcieResetGpioPin|10 + gRk356xTokenSpaceGuid.PcdPciePowerGpioBank|4 + gRk356xTokenSpaceGuid.PcdPciePowerGpioPin|19 + + # + # This board has inverted polarity for the PWREN pin on the SD card slot + # + gRk356xTokenSpaceGuid.PcdMshcDxePwrEnUsed|TRUE + gRk356xTokenSpaceGuid.PcdMshcDxePwrEnInverted|TRUE + +[PcdsDynamicHii.common.DEFAULT] + + # + # Reset-related. + # + gRk356xTokenSpaceGuid.PcdPlatformResetDelay|L"ResetDelay"|gRk356xTokenSpaceGuid|0x0|0 + + # + # ConfigDxe + # + gRk356xTokenSpaceGuid.PcdSystemTableMode|L"SystemTableMode"|gConfigDxeFormSetGuid|0x0|0 + gRk356xTokenSpaceGuid.PcdCpuClock|L"CpuClock"|gConfigDxeFormSetGuid|0x0|2 + gRk356xTokenSpaceGuid.PcdCustomCpuClock|L"CustomCpuClock"|gConfigDxeFormSetGuid|0x0|816 + gRk356xTokenSpaceGuid.PcdMultiPhy1Mode|L"MultiPhy1Mode"|gConfigDxeFormSetGuid|0x0|0 + + # + # Common UEFI ones. + # + + gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|5 + +[PcdsDynamicDefault.common] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0 + + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|0 + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|1280 + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|720 + +################################################################################ +# +# Components Section - list of all EDK II Modules needed by this Platform +# +################################################################################ +[Components.common] + # + # PEI Phase modules + # + ArmPlatformPkg/PrePi/PeiUniCore.inf { + + SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf + } + + # + # DXE + # + MdeModulePkg/Core/Dxe/DxeMain.inf { + + NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf + } + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + + # + # Architectural Protocols + # + ArmPkg/Drivers/CpuDxe/CpuDxe.inf + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + Platform/Rockchip/Rk356x/Drivers/VarBlockServiceDxe/VarBlockServiceDxe.inf + MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf { + + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf + } + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf { + + NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + VariableFlashInfoLib|MdeModulePkg/Library/BaseVariableFlashInfoLib/BaseVariableFlashInfoLib.inf + } + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf + EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf { + + RealTimeClockLib|EmbeddedPkg/Library/VirtualRealTimeClockLib/VirtualRealTimeClockLib.inf + } + EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + + MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + MdeModulePkg/Universal/SerialDxe/SerialDxe.inf { + + SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf + } + Silicon/Rockchip/Rk356x/Drivers/DisplayDxe/DisplayDxe.inf + EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.inf + + MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + + ArmPkg/Drivers/ArmGic/ArmGicDxe.inf + ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf + ArmPkg/Drivers/TimerDxe/TimerDxe.inf + MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf + MdeModulePkg/Universal/EbcDxe/EbcDxe.inf + + # + # SCMI Driver + # + ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf + + # + # Board specific + # + Platform/Pine64/PineTab2/Drivers/BoardInitDxe/BoardInitDxe.inf + + # + # Config + # + Platform/Rockchip/Rk356x/Drivers/ConfigDxe/ConfigDxe.inf + + # + # FAT filesystem + GPT/MBR partitioning + # + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + FatPkg/EnhancedFatDxe/Fat.inf + + # + # USB + # + Silicon/Rockchip/Rk356x/Drivers/OhciDxe/OhciDxe.inf + MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf + MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf + MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf + MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf + MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf + + MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceDxe.inf + Silicon/Rockchip/Rk356x/Drivers/UsbHcdInitDxe/UsbHcd.inf + + # + # SD + # + EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf + Silicon/Rockchip/Rk356x/Drivers/MshcDxe/MshcDxe.inf + + # + # eMMC + # + MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.inf + MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDxe.inf + Silicon/Rockchip/Rk356x/Drivers/EmmcDxe/EmmcDxe.inf + + # + # Devicetree support + # + Platform/Rockchip/Rk356x/Drivers/FdtDxe/FdtDxe.inf + + # + # ACPI Support + # + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf + Platform/Rockchip/Rk356x/Drivers/PlatformAcpiDxe/PlatformAcpiDxe.inf + Platform/Rockchip/Rk356x/AcpiTables/$(PLATFORM_NAME).inf + + # + # SMBIOS Support + # + Platform/Rockchip/Rk356x/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + + # + # PCI Support + # + MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf + MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf + EmbeddedPkg/Drivers/NonCoherentIoMmuDxe/NonCoherentIoMmuDxe.inf + MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf + + # + # AHCI Support + # + MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf + MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf + MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf + MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf + MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf + Silicon/Rockchip/Rk356x/Drivers/SataDxe/SataDxe.inf + + # + # TRNG Support + # + Silicon/Rockchip/Rk356x/Drivers/TrngDxe/TrngDxe.inf + + # + # TS-ADC Support + # + Silicon/Rockchip/Rk356x/Drivers/TsadcDxe/TsadcDxe.inf + + # + # RAM Disk Support + # + MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDxe.inf + + # + # Bds + # + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf + MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + MdeModulePkg/Universal/DriverHealthManagerDxe/DriverHealthManagerDxe.inf + MdeModulePkg/Universal/BdsDxe/BdsDxe.inf + Platform/Pine64/Drivers/LogoDxe/LogoDxe.inf + MdeModulePkg/Application/UiApp/UiApp.inf { + + NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf + NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf + NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf + } + + # + # UEFI application (Shell Embedded Boot Loader) + # + ShellPkg/Application/Shell/Shell.inf { + + ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf + NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf + NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf + NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf + NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf + NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf + NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf + NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf + HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf + OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf + + + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000 + gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize|0x200000 + } diff --git a/edk2-rockchip/Platform/Pine64/PineTab2/PineTab2.fdf.inc b/edk2-rockchip/Platform/Pine64/PineTab2/PineTab2.fdf.inc new file mode 100755 index 000000000..3ef431036 --- /dev/null +++ b/edk2-rockchip/Platform/Pine64/PineTab2/PineTab2.fdf.inc @@ -0,0 +1,35 @@ +# +# Copyright (c) 2021, Jared McNeill +# Copyright (c) 2023, Dang Huynh +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +# +# Board specific initialization +# +INF Platform/Pine64/PineTab2/Drivers/BoardInitDxe/BoardInitDxe.inf + +# +# Devicetree support +# +INF Platform/Rockchip/Rk356x/Drivers/FdtDxe/FdtDxe.inf + +# +# ACPI Support +# +INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf +INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf +INF Platform/Rockchip/Rk356x/Drivers/PlatformAcpiDxe/PlatformAcpiDxe.inf +INF RuleOverride = ACPITABLE Platform/Rockchip/Rk356x/AcpiTables/$(PLATFORM_NAME).inf + +# +# SMBIOS Support +# +INF Platform/Rockchip/Rk356x/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.inf +INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + +# +# PINE64 logo (splash screen) +# +INF Platform/Pine64/Drivers/LogoDxe/LogoDxe.inf diff --git a/edk2-rockchip/Platform/Rockchip/Rk356x/AcpiTables/PineTab2.inf b/edk2-rockchip/Platform/Rockchip/Rk356x/AcpiTables/PineTab2.inf new file mode 100755 index 000000000..db358d69b --- /dev/null +++ b/edk2-rockchip/Platform/Rockchip/Rk356x/AcpiTables/PineTab2.inf @@ -0,0 +1,74 @@ +## @file +# +# ACPI table data and ASL sources required to boot the platform. +# +# Copyright (c) 2021, Jared McNeill +# Copyright (c) 2020, Linaro Ltd. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001A + BASE_NAME = Rk356xAcpiTables + FILE_GUID = 0FBE0D20-3528-4F07-838B-9A711C62654F + MODULE_TYPE = USER_DEFINED + VERSION_STRING = 1.0 + +[Sources] + PineTab2/Dsdt.asl + Dbg2.aslc + Fadt.aslc + Gtdt.aslc + Madt.aslc + Mcfg.aslc + Spcr.aslc + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + ArmPkg/ArmPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Platform/Rockchip/Rk356x/Rk356x.dec + Silicon/Rockchip/Rk356x/Rk356x.dec + +[FixedPcd] + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicRedistributorsBase + + gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum + gArmTokenSpaceGuid.PcdArmArchTimerVirtIntrNum + + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision + + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialClockRate + + gRk356xTokenSpaceGuid.PcdOhc0Status + gRk356xTokenSpaceGuid.PcdOhc1Status + gRk356xTokenSpaceGuid.PcdEhc0Status + gRk356xTokenSpaceGuid.PcdEhc1Status + gRk356xTokenSpaceGuid.PcdXhc0Status + gRk356xTokenSpaceGuid.PcdXhc1Status + gRk356xTokenSpaceGuid.PcdMac0Status + gRk356xTokenSpaceGuid.PcdMac1Status + + gRk356xTokenSpaceGuid.PcdMshc1Status + gRk356xTokenSpaceGuid.PcdMshc1SdioIrq + gRk356xTokenSpaceGuid.PcdMshc1NonRemovable + gRk356xTokenSpaceGuid.PcdMshc2Status + gRk356xTokenSpaceGuid.PcdMshc2SdioIrq + gRk356xTokenSpaceGuid.PcdMshc2NonRemovable + + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress + +[BuildOptions] + GCC:*_*_*_ASL_FLAGS = -vw3133 -vw3150 diff --git a/edk2-rockchip/Platform/Rockchip/Rk356x/AcpiTables/PineTab2/Dsdt.asl b/edk2-rockchip/Platform/Rockchip/Rk356x/AcpiTables/PineTab2/Dsdt.asl new file mode 100755 index 000000000..7f7dc8781 --- /dev/null +++ b/edk2-rockchip/Platform/Rockchip/Rk356x/AcpiTables/PineTab2/Dsdt.asl @@ -0,0 +1,28 @@ +/** @file +* Differentiated System Description Table Fields (DSDT) for the PINE64 PineTab2. +* +* Copyright (c) 2022, Jared McNeill +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +DefinitionBlock ("DsdtTable.aml", "DSDT", + EFI_ACPI_6_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_REVISION, + "RKCP ", "RK356X ", FixedPcdGet32 (PcdAcpiDefaultOemRevision)) { + Scope (_SB) { + + include ("Cpu.asl") + include ("Tsadc.asl") + include ("Uart.asl") + include ("Wdt.asl") + include ("Usb2.asl") + include ("Usb3.asl") + include ("Gmac.asl") + include ("Mshc.asl") + include ("Emmc.asl") + include ("Pcie2x1.asl") + + } // Scope (_SB) +}