From 04f1a7096adf2fc5fd6d70e37a9a4a8e47dfa4d1 Mon Sep 17 00:00:00 2001 From: Ronald Cron Date: Thu, 26 Feb 2015 10:54:39 +0000 Subject: [PATCH] ArmPlatformPkg/ArmVExpressDxe: Load FDT into the EFI Configuration Table Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ronald Cron Reviewed-by: Olivier Martin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16937 6f19259b-4bc3-4df7-8a09-765794883524 --- ArmPkg/ArmPkg.dsc | 2 +- ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc | 2 +- ArmPlatformPkg/ArmPlatformPkg.dsc | 2 +- .../ArmRealViewEbPkg/ArmRealViewEb.dsc.inc | 2 +- .../ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc | 12 +- .../ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf | 18 +- .../ArmVExpressPkg/ArmVExpress-CTA9x4.dsc | 12 +- .../ArmVExpressPkg/ArmVExpress-CTA9x4.fdf | 12 +- .../ArmVExpress-FVP-AArch64.dsc | 16 + .../ArmVExpress-FVP-AArch64.fdf | 12 +- .../ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc | 18 +- .../ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf | 17 +- .../ArmVExpress-RTSM-A15_MPCore.dsc | 18 +- .../ArmVExpress-RTSM-A15_MPCore.fdf | 17 +- .../ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc | 19 +- .../ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf | 17 +- .../ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc | 19 +- .../ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf | 12 +- .../ArmVExpress-RTSM-AEMv8Ax4.dsc | 19 +- .../ArmVExpress-RTSM-AEMv8Ax4.fdf | 12 +- .../ArmVExpressPkg/ArmVExpress.dsc.inc | 2 + .../ArmVExpressDxe/AArch64/ArmFvpDxeAArch64.c | 16 +- .../ArmVExpressDxe/Arm/ArmFvpDxeArm.c | 10 +- .../ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.c | 33 ++- .../ArmVExpressDxe/ArmFvpDxe.inf | 9 + .../ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.c | 16 +- .../ArmVExpressDxe/ArmHwDxe.inf | 9 +- .../ArmVExpressDxe/ArmVExpressInternal.h | 7 +- .../ArmVExpressPkg/ArmVExpressPkg.dec | 35 ++- .../ArmVirtualization.dsc.inc | 2 +- EmbeddedPkg/EmbeddedPkg.dsc | 3 +- .../FdtLoadLib/FdtConfigurationTable.c | 280 ------------------ EmbeddedPkg/Library/FdtLoadLib/FdtLoadLib.inf | 45 --- 33 files changed, 342 insertions(+), 383 deletions(-) delete mode 100644 EmbeddedPkg/Library/FdtLoadLib/FdtConfigurationTable.c delete mode 100644 EmbeddedPkg/Library/FdtLoadLib/FdtLoadLib.inf diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc index be5126ccef..6959fde22c 100644 --- a/ArmPkg/ArmPkg.dsc +++ b/ArmPkg/ArmPkg.dsc @@ -2,7 +2,7 @@ # ARM processor package. # # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
-# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
+# Copyright (c) 2011 - 2015, ARM Ltd. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License diff --git a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc index 66a9797a1c..9d14a3e757 100644 --- a/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc +++ b/ArmPlatformPkg/ArmPlatformPkg-2ndstage.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License diff --git a/ArmPlatformPkg/ArmPlatformPkg.dsc b/ArmPlatformPkg/ArmPlatformPkg.dsc index 81402da5b3..ada59bdeb8 100644 --- a/ArmPlatformPkg/ArmPlatformPkg.dsc +++ b/ArmPlatformPkg/ArmPlatformPkg.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License diff --git a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc index 2a6a5b755a..be58e6bfc3 100644 --- a/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc +++ b/ArmPlatformPkg/ArmRealViewEbPkg/ArmRealViewEb.dsc.inc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc index 521f4ed813..e765617d69 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2012-2014, ARM Limited. All rights reserved. +# Copyright (c) 2012-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -73,6 +73,11 @@ # It could be set FALSE to save size. gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE + # + # FDT installation : enable the development specific features + # + gEmbeddedTokenSpaceGuid.PcdOverridePlatformFdt|TRUE + [PcdsFixedAtBuild.common] gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Versatile Express" gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmVExpress-CTA15-A7" @@ -171,6 +176,11 @@ # Ethernet (SMSC LAN9118) gEmbeddedTokenSpaceGuid.PcdLan9118DxeBaseAddress|0x1A000000 + # + # Define the device path to the FDT for the platform + # + gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/MemoryMapped(0x0,0x0E800000,0x0E803000)" + # # ARM OS Loader # diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf index 323be8a43c..7390db30b9 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA15-A7.fdf @@ -1,5 +1,5 @@ # -# Copyright (c) 2012-2014, ARM Limited. All rights reserved. +# Copyright (c) 2012-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -26,12 +26,12 @@ [FD.ARM_VEXPRESS_CTA15A7_EFI] BaseAddress = 0xB0000000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in remapped DRAM. -Size = 0x000B8000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device +Size = 0x000C0000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device ErasePolarity = 1 BlockSize = 0x00001000 -NumBlocks = 0xB8 +NumBlocks = 0xC0 -0x00000000|0x000B8000 +0x00000000|0x000C0000 gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize FV = FVMAIN_COMPACT @@ -104,6 +104,11 @@ READ_LOCK_STATUS = TRUE # INF ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf + # + # FDT installation + # + INF EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf + # # Multimedia Card Interface # @@ -174,6 +179,11 @@ READ_LOCK_STATUS = TRUE # FV Filesystem INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf + # Example to add a Device Tree to the Firmware Volume + #FILE FREEFORM = PCD(gArmVExpressTokenSpaceGuid.PcdFdtVExpressHwA15x2A7x3) { + # SECTION RAW = ArmPlatformPkg/ArmVExpressPkg/Fdts/vexpress-v2p-ca15_a7.dtb + #} + [FV.FVMAIN_COMPACT] FvBaseAddress = 0xB0000000 FvForceRebase = TRUE diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc index 83774798a0..e23dc6d0de 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -98,6 +98,11 @@ # It could be set FALSE to save size. gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE + # + # FDT installation : enable the development specific features + # + gEmbeddedTokenSpaceGuid.PcdOverridePlatformFdt|TRUE + [PcdsFixedAtBuild.common] gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Versatile Express" gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmVExpress" @@ -172,6 +177,11 @@ gArmTokenSpaceGuid.PcdGicDistributorBase|0x1e001000 gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x1e000100 + # + # Define the device path to the FDT for the platform + # + gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L"VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)/MemoryMapped(0x0,0x46800000,0x46803000)" + # # ARM OS Loader # diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf index d3d6ba14cf..a2a4add74d 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-CTA9x4.fdf @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -194,6 +194,11 @@ READ_LOCK_STATUS = TRUE # Versatile Express FileSystem INF ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf + # + # FDT installation + # + INF EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf + # # Multimedia Card Interface # @@ -243,6 +248,11 @@ READ_LOCK_STATUS = TRUE # FV Filesystem INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf + # Example to add a Device Tree to the Firmware Volume + #FILE FREEFORM = PCD(gArmVExpressTokenSpaceGuid.PcdFdtVExpressHwA9x4) { + # SECTION RAW = ArmPlatformPkg/ArmVExpressPkg/Fdts/vexpress-v2p-ca9.dtb + #} + [FV.FVMAIN_COMPACT] FvAlignment = 8 ERASE_POLARITY = 1 diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc index 685b5047bb..f0c99dae94 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.dsc @@ -56,6 +56,9 @@ ArmPlatformSecLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf +[LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.DXE_DRIVER] + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + [BuildOptions] GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM @@ -77,6 +80,10 @@ # to configure the Non-Secure interrupts in the GIC Redistributors # which is not supported at the moment. gArmTokenSpaceGuid.PcdArmGicV3WithV2Legacy|TRUE + # + # FDT installation : enable the development specific features + # + gEmbeddedTokenSpaceGuid.PcdOverridePlatformFdt|TRUE [PcdsFixedAtBuild.common] gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Fixed Virtual Platform" @@ -188,6 +195,15 @@ # Set tick frequency value to 100Mhz gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|100000000 +[PcdsDynamicDefault.common] + # + # The size of a dynamic PCD of the (VOID*) type can not be increased at run + # time from its size at build time. Set the "PcdFdtDevicePaths" PCD to a 128 + # character "empty" string, to allow to be able to set FDT text device paths + # up to 128 characters long. + # + gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L" " + ################################################################################ # # Components Section - list of all EDK II Modules needed by this Platform diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf index 80acb9508f..1c709771b5 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-FVP-AArch64.fdf @@ -1,5 +1,5 @@ # -# Copyright (c) 2011 - 2014, ARM Limited. All rights reserved. +# Copyright (c) 2011 - 2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -124,7 +124,12 @@ READ_STATUS = TRUE READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE + APRIORI DXE { + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + } + INF MdeModulePkg/Core/Dxe/DxeMain.inf + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf # # PI DXE Drivers producing Architectural Protocols (EFI Services) @@ -186,6 +191,11 @@ READ_LOCK_STATUS = TRUE INF ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf + # + # FDT installation + # + INF EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf + # # UEFI application (Shell Embedded Boot Loader) # diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc index 78f40779bd..6c84980777 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -51,6 +51,9 @@ ArmPlatformSecLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf +[LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.DXE_DRIVER] + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + [BuildOptions] RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A15 -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM @@ -74,6 +77,11 @@ # It could be set FALSE to save size. gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE + # + # FDT installation : enable the development specific features + # + gEmbeddedTokenSpaceGuid.PcdOverridePlatformFdt|TRUE + [PcdsFixedAtBuild.common] gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Versatile Express" gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmVExpress-RTSM" @@ -170,6 +178,14 @@ # gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|100000000 +[PcdsDynamicDefault.common] + # + # The size of a dynamic PCD of the (VOID*) type can not be increased at run + # time from its size at build time. Set the "PcdFdtDevicePaths" PCD to a 128 + # character "empty" string, to allow to be able to set FDT text device paths + # up to 128 characters long. + # + gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L" " ################################################################################ # diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf index 547f8cf999..e787190328 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15.fdf @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -110,7 +110,12 @@ READ_STATUS = TRUE READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE + APRIORI DXE { + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + } + INF MdeModulePkg/Core/Dxe/DxeMain.inf + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf # # PI DXE Drivers producing Architectural Protocols (EFI Services) @@ -187,6 +192,11 @@ READ_LOCK_STATUS = TRUE INF ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf + # + # FDT installation + # + INF EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf + # # UEFI application (Shell Embedded Boot Loader) # @@ -201,6 +211,11 @@ READ_LOCK_STATUS = TRUE # FV Filesystem INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf + # Example to add a Device Tree to the Firmware Volume + #FILE FREEFORM = PCD(gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA15x1) { + # SECTION RAW = ArmPlatformPkg/ArmVExpressPkg/Fdts/rtsm_ve-ca15x1.dtb + #} + [FV.FVMAIN_COMPACT] FvAlignment = 8 ERASE_POLARITY = 1 diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc index 2a81c85c6f..0021a0a235 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -51,6 +51,9 @@ ArmPlatformSecLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf +[LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.DXE_DRIVER] + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + [BuildOptions] RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A15 -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM @@ -74,6 +77,11 @@ # It could be set FALSE to save size. gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE + # + # FDT installation : enable the development specific features + # + gEmbeddedTokenSpaceGuid.PcdOverridePlatformFdt|TRUE + [PcdsFixedAtBuild.common] gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Versatile Express" gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmVExpress-RTSM" @@ -172,6 +180,14 @@ # gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|100000000 +[PcdsDynamicDefault.common] + # + # The size of a dynamic PCD of the (VOID*) type can not be increased at run + # time from its size at build time. Set the "PcdFdtDevicePaths" PCD to a 128 + # character "empty" string, to allow to be able to set FDT text device paths + # up to 128 characters long. + # + gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L" " ################################################################################ # diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf index b2be83ba88..f62ae424e6 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A15_MPCore.fdf @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -110,7 +110,12 @@ READ_STATUS = TRUE READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE + APRIORI DXE { + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + } + INF MdeModulePkg/Core/Dxe/DxeMain.inf + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf # # PI DXE Drivers producing Architectural Protocols (EFI Services) @@ -187,6 +192,11 @@ READ_LOCK_STATUS = TRUE INF ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf + # + # FDT installation + # + INF EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf + # # UEFI application (Shell Embedded Boot Loader) # @@ -201,6 +211,11 @@ READ_LOCK_STATUS = TRUE # FV Filesystem INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf + # Example to add a Device Tree to the Firmware Volume + #FILE FREEFORM = PCD(gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA15x4) { + # SECTION RAW = ArmPlatformPkg/ArmVExpressPkg/Fdts/rtsm_ve-ca15x4.dtb + #} + [FV.FVMAIN_COMPACT] FvAlignment = 8 ERASE_POLARITY = 1 diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc index 0923a1e3b6..a13f443712 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -53,6 +53,9 @@ # Uncomment to turn on GDB stub in SEC. #DebugAgentLib|EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.inf +[LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.DXE_DRIVER] + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + [BuildOptions] RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A9 -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM @@ -77,6 +80,11 @@ # It could be set FALSE to save size. gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE + # + # FDT installation : enable the development specific features + # + gEmbeddedTokenSpaceGuid.PcdOverridePlatformFdt|TRUE + [PcdsFixedAtBuild.common] gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Versatile Express" gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmVExpress-RTSM" @@ -173,6 +181,15 @@ # gArmTokenSpaceGuid.PcdL2x0ControllerBase|0x1E00A000 +[PcdsDynamicDefault.common] + # + # The size of a dynamic PCD of the (VOID*) type can not be increased at run + # time from its size at build time. Set the "PcdFdtDevicePaths" PCD to a 128 + # character "empty" string, to allow to be able to set FDT text device paths + # up to 128 characters long. + # + gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L" " + ################################################################################ # # Components Section - list of all EDK II Modules needed by this Platform diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf index a46d341e99..f0182bb532 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-A9x4.fdf @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2014, ARM Limited. All rights reserved. +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -110,7 +110,12 @@ READ_STATUS = TRUE READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE + APRIORI DXE { + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + } + INF MdeModulePkg/Core/Dxe/DxeMain.inf + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf # # PI DXE Drivers producing Architectural Protocols (EFI Services) @@ -173,6 +178,11 @@ READ_LOCK_STATUS = TRUE INF ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf + # + # FDT installation + # + INF EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf + # # UEFI application (Shell Embedded Boot Loader) # @@ -187,6 +197,11 @@ READ_LOCK_STATUS = TRUE # FV Filesystem INF MdeModulePkg/Universal/FvSimpleFileSystemDxe/FvSimpleFileSystemDxe.inf + # Example to add a Device Tree to the Firmware Volume + #FILE FREEFORM = PCD(gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA9x4) { + # SECTION RAW = ArmPlatformPkg/ArmVExpressPkg/Fdts/rtsm_ve-ca9x4.dtb + #} + [FV.FVMAIN_COMPACT] FvAlignment = 8 ERASE_POLARITY = 1 diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc index 725ce203ad..c05043533d 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -50,6 +50,9 @@ ArmPlatformSecLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressFoundationSecLib.inf ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressFoundationLibSec.inf +[LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.DXE_DRIVER] + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + [BuildOptions] GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM @@ -71,6 +74,11 @@ # It could be set FALSE to save size. gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|FALSE + # + # FDT installation : enable the development specific features + # + gEmbeddedTokenSpaceGuid.PcdOverridePlatformFdt|TRUE + [PcdsFixedAtBuild.common] gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Foundation Model" gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmFoundation" @@ -136,6 +144,15 @@ # Set model tick to 100Mhz. This depends a lot on workstation performance. gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|100000000 +[PcdsDynamicDefault.common] + # + # The size of a dynamic PCD of the (VOID*) type can not be increased at run + # time from its size at build time. Set the "PcdFdtDevicePaths" PCD to a 128 + # character "empty" string, to allow to be able to set FDT text device paths + # up to 128 characters long. + # + gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L" " + ################################################################################ # # Components Section - list of all EDK II Modules needed by this Platform diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf index b971d4eb36..7db45d2cf3 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4-foundation.fdf @@ -1,5 +1,5 @@ # -# Copyright (c) 2011 - 2014, ARM Limited. All rights reserved. +# Copyright (c) 2011 - 2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -110,7 +110,12 @@ READ_STATUS = TRUE READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE + APRIORI DXE { + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + } + INF MdeModulePkg/Core/Dxe/DxeMain.inf + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf # # PI DXE Drivers producing Architectural Protocols (EFI Services) @@ -160,6 +165,11 @@ READ_LOCK_STATUS = TRUE INF ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf + # + # FDT installation + # + INF EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf + # # UEFI application (Shell Embedded Boot Loader) # diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc index b2ffd37d73..4d4c62555c 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.dsc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2013, ARM Limited. All rights reserved. +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -49,6 +49,9 @@ ArmPlatformSecLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSecLibRTSM/ArmVExpressSecLib.inf ArmPlatformLib|ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/ArmVExpressLibSec.inf +[LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.UEFI_APPLICATION, LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.DXE_DRIVER] + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + [BuildOptions] GCC:*_*_AARCH64_PLATFORM_FLAGS == -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include -I$(WORKSPACE)/ArmPlatformPkg/ArmVExpressPkg/Include/Platform/RTSM @@ -73,6 +76,11 @@ # This PCD ensures the secondary cores are parked into the AArch64 Linux parking protocol. gArmTokenSpaceGuid.PcdArmLinuxSpinTable|TRUE + # + # FDT installation : enable the development specific features + # + gEmbeddedTokenSpaceGuid.PcdOverridePlatformFdt|TRUE + [PcdsFixedAtBuild.common] gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"ARM Versatile Express" gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"ArmVExpress-RTSM" @@ -165,6 +173,15 @@ # Set model tick to 100Mhz. This depends a lot on workstation performance. gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|100000000 +[PcdsDynamicDefault.common] + # + # The size of a dynamic PCD of the (VOID*) type can not be increased at run + # time from its size at build time. Set the "PcdFdtDevicePaths" PCD to a 128 + # character "empty" string, to allow to be able to set FDT text device paths + # up to 128 characters long. + # + gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths|L" " + ################################################################################ # # Components Section - list of all EDK II Modules needed by this Platform diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.fdf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.fdf index 48074c88e6..9f940235ec 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.fdf +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress-RTSM-AEMv8Ax4.fdf @@ -1,5 +1,5 @@ # -# Copyright (c) 2011 - 2014, ARM Limited. All rights reserved. +# Copyright (c) 2011 - 2015, ARM Limited. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -112,7 +112,12 @@ READ_STATUS = TRUE READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE + APRIORI DXE { + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + } + INF MdeModulePkg/Core/Dxe/DxeMain.inf + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf # # PI DXE Drivers producing Architectural Protocols (EFI Services) @@ -170,6 +175,11 @@ READ_LOCK_STATUS = TRUE INF ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf + # + # FDT installation + # + INF EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf + # # UEFI application (Shell Embedded Boot Loader) # diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc index ddc796dc04..745f9025b8 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpress.dsc.inc @@ -378,6 +378,8 @@ gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE [Components.common] + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + # Versatile Express FileSystem ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/AArch64/ArmFvpDxeAArch64.c b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/AArch64/ArmFvpDxeAArch64.c index 41d94eda1d..09e859f0c5 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/AArch64/ArmFvpDxeAArch64.c +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/AArch64/ArmFvpDxeAArch64.c @@ -23,14 +23,14 @@ // model or hardware platforms). // CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[] = { - { ARM_FVP_VEXPRESS_AEMv8x4 }, - { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2 }, - { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY }, - { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3 }, - { ARM_FVP_FOUNDATION_GICV2 }, - { ARM_FVP_FOUNDATION_GICV2_LEGACY }, - { ARM_FVP_FOUNDATION_GICV3 }, - { ARM_FVP_VEXPRESS_UNKNOWN } + { ARM_FVP_VEXPRESS_AEMv8x4, { 0x240d627e, 0xeb4d, 0x447d, { 0x86, 0x30, 0xf2, 0x12, 0x3b, 0xc3, 0x89, 0x3f } }, L"rtsm_ve-aemv8a.dtb" }, + { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2, { 0xfbed0b94, 0x3c81, 0x49e4, { 0xbd, 0xec, 0xd4, 0xf4, 0xa8, 0x47, 0xeb, 0x51 } }, L"fvp-base-gicv2-psci.dtb" }, + { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV2_LEGACY, { 0x6d8dfd91, 0x431a, 0x4e6c, { 0x84, 0x5a, 0x15, 0xf1, 0xfc, 0x8d, 0x9b, 0xe2 } }, L"fvp-base-gicv2legacy-psci.dtb" }, + { ARM_FVP_BASE_AEMv8x4_AEMv8x4_GICV3, { 0xa8ac2953, 0xc4bb, 0x4914, { 0x87, 0xf5, 0xc5, 0x97, 0x5d, 0x7b, 0x32, 0xd1 } }, L"fvp-base-gicv3-psci.dtb" }, + { ARM_FVP_FOUNDATION_GICV2, { 0x4328cb83, 0x6e50, 0x4cb8, { 0xaa, 0x8c, 0xfb, 0x7a, 0xba, 0xba, 0x37, 0xd8 } }, L"fvp-foundation-gicv2-psci.dtb" }, + { ARM_FVP_FOUNDATION_GICV2_LEGACY, { 0x6af00d18, 0x6dfe, 0x45ed, { 0xa6, 0xc4, 0xb4, 0x4d, 0x57, 0xfd, 0xd8, 0xf5 } }, L"fvp-foundation-gicv2legacy-psci.dtb" }, + { ARM_FVP_FOUNDATION_GICV3, { 0x4a17b7fa, 0xf052, 0x4dc1, { 0x92, 0x79, 0x43, 0x80, 0x92, 0x41, 0xf9, 0x98 } }, L"fvp-foundation-gicv3-psci.dtb" }, + { ARM_FVP_VEXPRESS_UNKNOWN, { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } } } }; /** diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/Arm/ArmFvpDxeArm.c b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/Arm/ArmFvpDxeArm.c index 7ac89ad90a..5ec27a5bb9 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/Arm/ArmFvpDxeArm.c +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/Arm/ArmFvpDxeArm.c @@ -23,11 +23,11 @@ // model or hardware platforms). // CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[] = { - { ARM_FVP_VEXPRESS_A9x4 }, - { ARM_FVP_VEXPRESS_A15x1 }, - { ARM_FVP_VEXPRESS_A15x2 }, - { ARM_FVP_VEXPRESS_A15x4 }, - { ARM_FVP_VEXPRESS_UNKNOWN } + { ARM_FVP_VEXPRESS_A9x4, { 0x943f2ae9, 0x51b2, 0x48b2, { 0x82, 0xc4, 0x9a, 0xeb, 0x2c, 0x21, 0xd8, 0xe1 } }, L"rtsm_ve-cortex_a9x4.dtb" }, + { ARM_FVP_VEXPRESS_A15x1, { 0x581930c3, 0x9f53, 0x4c53, { 0x91, 0x23, 0x43, 0xb8, 0x65, 0xdf, 0x3f, 0x23} }, L"rtsm_ve-cortex_a15x1.dtb" }, + { ARM_FVP_VEXPRESS_A15x2, { 0x3f10b34a, 0xa310, 0x472c, { 0xac, 0xb9, 0x36, 0x0b, 0x1d, 0xb5, 0x7a, 0x8b} }, L"rtsm_ve-cortex_a15x2.dtb" }, + { ARM_FVP_VEXPRESS_A15x4, { 0x9a783838, 0x8a77, 0x4cdb, { 0x82, 0xa4, 0x35, 0x91, 0x2c, 0x08, 0x8a, 0x2e} }, L"rtsm_ve-cortex_a15x4.dtb" }, + { ARM_FVP_VEXPRESS_UNKNOWN, { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } } } }; /** diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.c b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.c index 6a3d350382..9a60f1d611 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.c +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2013-2014, ARM Ltd. All rights reserved.
+ Copyright (c) 2013-2015, ARM Ltd. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -16,6 +16,7 @@ #include #include +#include #define ARM_FVP_BASE_VIRTIO_BLOCK_BASE 0x1c130000 @@ -49,6 +50,10 @@ VIRTIO_BLK_DEVICE_PATH mVirtioBlockDevicePath = } }; +/** + * Generic UEFI Entrypoint for 'ArmFvpDxe' driver + * See UEFI specification for the details of the parameters + */ EFI_STATUS EFIAPI ArmFvpInitialise ( @@ -56,7 +61,11 @@ ArmFvpInitialise ( IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_STATUS Status; + CONST ARM_VEXPRESS_PLATFORM* Platform; + EFI_STATUS Status; + CHAR16 *TextDevicePath; + UINTN TextDevicePathSize; + VOID *Buffer; Status = gBS->InstallProtocolInterface (&ImageHandle, &gEfiDevicePathProtocolGuid, EFI_NATIVE_INTERFACE, @@ -65,6 +74,26 @@ ArmFvpInitialise ( return Status; } + Status = ArmVExpressGetPlatform (&Platform); + if (!EFI_ERROR (Status)) { + TextDevicePathSize = StrSize ((CHAR16*)PcdGetPtr (PcdFvpFdtDevicePathsBase)) - sizeof (CHAR16); + TextDevicePathSize += StrSize (Platform->FdtName); + + TextDevicePath = AllocatePool (TextDevicePathSize); + if (TextDevicePath != NULL) { + StrCpy (TextDevicePath, ((CHAR16*)PcdGetPtr (PcdFvpFdtDevicePathsBase))); + StrCat (TextDevicePath, Platform->FdtName); + Buffer = PcdSetPtr (PcdFdtDevicePaths, &TextDevicePathSize, TextDevicePath); + if (Buffer == NULL) { + DEBUG (( + EFI_D_ERROR, + "ArmFvpDxe: Setting of FDT device path in PcdFdtDevicePaths failed - %r\n", EFI_BUFFER_TOO_SMALL + )); + } + FreePool (TextDevicePath); + } + } + // Declare the Virtio BlockIo device Status = VirtioMmioInstallDevice (ARM_FVP_BASE_VIRTIO_BLOCK_BASE, ImageHandle); if (EFI_ERROR (Status)) { diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf index a69601ba12..01d9f5002b 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf @@ -35,16 +35,25 @@ ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec + EmbeddedPkg/EmbeddedPkg.dec OvmfPkg/OvmfPkg.dec [LibraryClasses] + PcdLib ArmShellCmdRunAxfLib ArmLib ArmPlatformLib BaseMemoryLib + MemoryAllocationLib UefiDriverEntryPoint UefiBootServicesTableLib VirtioMmioDeviceLib [LibraryClasses.AARCH64] ArmGicLib + +[FixedPcd] + gArmVExpressTokenSpaceGuid.PcdFvpFdtDevicePathsBase + +[Pcd] + gEmbeddedTokenSpaceGuid.PcdFdtDevicePaths diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.c b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.c index 66ec9963ca..d1b393ccab 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.c +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2013-2014, ARM Ltd. All rights reserved.
+ Copyright (c) 2013-2015, ARM Ltd. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -23,11 +23,11 @@ // model or hardware platforms). // CONST ARM_VEXPRESS_PLATFORM ArmVExpressPlatforms[] = { - { ARM_HW_A9x4 }, - { ARM_HW_A15x2_A7x3 }, - { ARM_HW_A15 }, - { ARM_HW_A5 }, - { ARM_FVP_VEXPRESS_UNKNOWN } + { ARM_HW_A9x4, { 0x2fd21cf6, 0xe6e8, 0x4ff2, { 0xa9, 0xca, 0x3b, 0x9f, 0x00, 0xe9, 0x28, 0x89 } }, L"vexpress-v2p-ca9.dtb" }, + { ARM_HW_A15x2_A7x3, { 0xd5e606eb, 0x83df, 0x4e90, { 0x81, 0xe8, 0xc3, 0xdb, 0x2f, 0x77, 0x17, 0x9a } }, L"vexpress-v2p-ca15_a7.dtb" }, + { ARM_HW_A15, { 0x6b8947c2, 0x4287, 0x4d91, { 0x8f, 0xe0, 0xa3, 0x81, 0xea, 0x5b, 0x56, 0x8f } }, L"vexpress-v2p-ca15-tc1.dtb" }, + { ARM_HW_A5, { 0xa2cc7663, 0x4d7c, 0x448a, { 0xaa, 0xb5, 0x4c, 0x03, 0x4b, 0x6f, 0xda, 0xb7 } }, L"vexpress-v2p-ca5s.dtb" }, + { ARM_FVP_VEXPRESS_UNKNOWN, { 0x0, 0x0, 0x0, { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } } } }; /** @@ -49,6 +49,10 @@ ArmVExpressGetPlatform ( return EFI_NOT_FOUND; } +/** + * Generic UEFI Entrypoint for 'ArmHwDxe' driver + * See UEFI specification for the details of the parameters + */ EFI_STATUS EFIAPI ArmHwInitialise ( diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf index 92a193f8a0..952d624b45 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf @@ -1,6 +1,6 @@ #/** @file # -# Copyright (c) 2013-2014, ARM Ltd. All rights reserved.
+# Copyright (c) 2013-2015, ARM Ltd. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -14,7 +14,7 @@ [Defines] INF_VERSION = 0x00010006 - BASE_NAME = ArmFvpDxe + BASE_NAME = ArmHwDxe FILE_GUID = fe61bb5f-1b67-4c24-b346-73db42e873e5 MODULE_TYPE = UEFI_DRIVER VERSION_STRING = 1.0 @@ -27,8 +27,13 @@ [Packages] ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec MdePkg/MdePkg.dec [LibraryClasses] ArmShellCmdRunAxfLib + MemoryAllocationLib UefiDriverEntryPoint + +[Protocols] + gEfiDevicePathProtocolGuid diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmVExpressInternal.h b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmVExpressInternal.h index 075ced8e89..41019c1198 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmVExpressInternal.h +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmVExpressInternal.h @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2014, ARM Ltd. All rights reserved. + Copyright (c) 2014-2015, ARM Ltd. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this @@ -50,7 +50,10 @@ typedef enum { typedef struct { ARM_VEXPRESS_PLATFORM_ID Id; - // Will be extended with platform specific information + + // Flattened Device Tree (FDT) File + EFI_GUID FdtGuid; /// Name of the FDT when present into the FV + CONST CHAR16* FdtName; /// Name of the FDT when present into a File System } ARM_VEXPRESS_PLATFORM; // Array that contains the list of the VExpress based platform supported by this DXE driver diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec index f54733a8a4..e8108bc34b 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressPkg.dec @@ -1,11 +1,11 @@ #/** @file # Arm Versatile Express package. # -# Copyright (c) 2012, ARM Limited. All rights reserved. +# Copyright (c) 2012-2015, ARM Limited. All rights reserved. # -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php # # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, @@ -47,11 +47,30 @@ # # For a list of mode numbers look in LcdArmVExpress.c # - gArmVExpressTokenSpaceGuid.PcdPL111LcdMaxMode|3|UINT32|0x00000003 - gArmVExpressTokenSpaceGuid.PcdPL111LcdVideoModeOscId|1|UINT32|0x00000004 - gArmVExpressTokenSpaceGuid.PcdHdLcdVideoModeOscId|0|UINT32|0x00000009 + gArmVExpressTokenSpaceGuid.PcdPL111LcdMaxMode|3|UINT32|0x00000001 + gArmVExpressTokenSpaceGuid.PcdPL111LcdVideoModeOscId|1|UINT32|0x00000002 + gArmVExpressTokenSpaceGuid.PcdHdLcdVideoModeOscId|0|UINT32|0x00000003 # # Device path of block device on which Fastboot will flash partitions # - gArmVExpressTokenSpaceGuid.PcdAndroidFastbootNvmDevicePath|""|VOID*|0x00000001 + gArmVExpressTokenSpaceGuid.PcdAndroidFastbootNvmDevicePath|""|VOID*|0x00000004 + + # FVP platforms : install FDT from SemiHosting + gArmVExpressTokenSpaceGuid.PcdFvpFdtDevicePathsBase|L"VenHw(C5B9C74A-6D72-4719-99AB-C59F199091EB)/"|VOID*|0x00000005 + # HW platforms : install FDT from NOR Flash + gArmVExpressTokenSpaceGuid.PcdHwFdtDevicePathsBase|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59)/"|VOID*|0x00000006 + + # + # ARM Versatile Express FDT Guids + # + # FVP platforms + gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA9x4|{ 0xe9, 0x2a, 0x3f, 0x94, 0xb2, 0x51, 0xb2, 0x48, 0x48, 0xb2, 0x82, 0xc4, 0x9a, 0xeb, 0x2c, 0x21, 0xd8, 0xe1 }|VOID*|0x00000007 + gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA15x1|{ 0xc3, 0x30, 0x19, 0x58 0x53, 0x9f, 0x53, 0x4c, 0x4, 0xc53, 0x91, 0x23, 0x43, 0xb8, 0x65, 0xdf, 0x3f, 0x23 }|VOID*|0x00000008 + gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA15x2|{ 0x4a, 0xb3, 0x10, 0x3f 0x10, 0xa3, 0x2c, 0x47, 0xac, 0xb9, 0x36, 0x0b, 0x1d, 0xb5, 0x7a, 0x8b }|VOID*|0x00000009 + gArmVExpressTokenSpaceGuid.PcdFdtVExpressFvpA15x4|{ 0x38, 0x38, 0x78, 0x9a, 0x77, 0x8a, 0xdb, 0x4c, 0x82, 0xa4, 0x35, 0x91, 0x2c, 0x08, 0x8a, 0x2e }|VOID*|0x0000000A + # HW platforms + gArmVExpressTokenSpaceGuid.PcdFdtVExpressHwA9x4|{ 0xf6, 0x1c, 0xd2, 0x2f, 0xe8, 0xe6, 0xf2, 0x4f, 0xa9, 0xca, 0x3b, 0x9f, 0x00, 0xe9, 0x28, 0x89 }|VOID*|0x0000000B + gArmVExpressTokenSpaceGuid.PcdFdtVExpressHwA15x2A7x3|{ 0xeb, 0x06, e6, 0xd5, 0xdf, 0x83, 0x90, 0x4e, 0x81, 0xe8, 0xc3, 0xdb, 0x2f, 0x77, 0x17, 0x9a }|VOID*|0x0000000C + gArmVExpressTokenSpaceGuid.PcdFdtVExpressHwA15|{ 0xc2, 0x47, 0x89, 0x6b, 0x87, 0x42, 0x91, 0x4d, 0x8f, 0xe0, 0xa3, 0x81, 0xea, 0x5b, 0x56, 0x8f }|VOID*|0x0000000D + gArmVExpressTokenSpaceGuid.PcdFdtVExpressHwA5|{ 0x63, 0x76, 0xcc, 0xa2, 0x7c, 0x4d, 0x8a, 0x44, 0xaa, 0xb5, 0x4c, 0x03, 0x4b, 0x6f, 0xda, 0xb7 }|VOID*|0x0000000E diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc index a1e10d7d79..1a82762cbc 100644 --- a/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc +++ b/ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualization.dsc.inc @@ -1,5 +1,5 @@ # -# Copyright (c) 2011-2012, ARM Limited. All rights reserved. +# Copyright (c) 2011-2015, ARM Limited. All rights reserved. # Copyright (c) 2014, Linaro Limited. All rights reserved. # # This program and the accompanying materials diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc index fc42fe5128..d3f8e7c507 100644 --- a/EmbeddedPkg/EmbeddedPkg.dsc +++ b/EmbeddedPkg/EmbeddedPkg.dsc @@ -3,7 +3,7 @@ # # # Copyright (c) 2007, Intel Corporation. All rights reserved.
-# Copyright (c) 2012-2014, ARM Ltd. All rights reserved.
+# Copyright (c) 2012-2015, ARM Ltd. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -270,7 +270,6 @@ EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf # FDT installation - EmbeddedPkg/Library/FdtLoadLib/FdtLoadLib.inf EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.inf diff --git a/EmbeddedPkg/Library/FdtLoadLib/FdtConfigurationTable.c b/EmbeddedPkg/Library/FdtLoadLib/FdtConfigurationTable.c deleted file mode 100644 index a95e24958b..0000000000 --- a/EmbeddedPkg/Library/FdtLoadLib/FdtConfigurationTable.c +++ /dev/null @@ -1,280 +0,0 @@ -/** @file -* -* Copyright (c) 2014, ARM Limited. All rights reserved. -* -* This program and the accompanying materials -* are licensed and made available under the terms and conditions of the BSD License -* which accompanies this distribution. The full text of the license may be found at -* http://opensource.org/licenses/bsd-license.php -* -* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -* -**/ - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include - -// -// Device path for SemiHosting -// -STATIC CONST struct { - VENDOR_DEVICE_PATH Guid; - EFI_DEVICE_PATH_PROTOCOL End; -} mSemihostingDevicePath = { - { - { HARDWARE_DEVICE_PATH, HW_VENDOR_DP, { sizeof (VENDOR_DEVICE_PATH), 0 } }, - { 0xC5B9C74A, 0x6D72, 0x4719, { 0x99, 0xAB, 0xC5, 0x9F, 0x19, 0x90, 0x91, 0xEB } } - }, - { END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, { sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 } } -}; - - -/** - This function declares the passed FDT into the UEFI Configuration Table - - @param FdtBlob Base address of the Fdt Blob in System Memory - @param FdtSize Size of the Fdt Blob in System Memory - - @return EFI_SUCCESS Fdt Blob was successfully installed into the configuration table - @return !EFI_SUCCESS Error returned by BS.InstallConfigurationTable() - -**/ -STATIC -EFI_STATUS -InstallFdtIntoConfigurationTable ( - IN VOID* FdtBlob, - IN UINTN FdtSize - ) -{ - EFI_STATUS Status; - - // Check the FDT header is valid. We only make this check in DEBUG mode in case the FDT header change on - // production device and this ASSERT() becomes not valid. - ASSERT (fdt_check_header (FdtBlob) == 0); - - // Ensure the Size of the Device Tree is smaller than the size of the read file - ASSERT ((UINTN)fdt_totalsize (FdtBlob) <= FdtSize); - - // Install the FDT into the Configuration Table - Status = gBS->InstallConfigurationTable (&gFdtTableGuid, FdtBlob); - - return Status; -} - - -/** - Load and Install FDT from Semihosting - - @param Filename Name of the file to load from semihosting - - @return EFI_SUCCESS Fdt Blob was successfully installed into the configuration table - from semihosting - @return EFI_NOT_FOUND Fail to locate the file in semihosting - @return EFI_OUT_OF_RESOURCES Fail to allocate memory to contain the blob -**/ -EFI_STATUS -InstallFdtFromSemihosting ( - IN CONST CHAR16* FileName - ) -{ - EFI_STATUS Status; - EFI_DEVICE_PATH* Remaining; - EFI_HANDLE Handle; - EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SemihostingFs; - EFI_FILE_PROTOCOL *Fs; - EFI_FILE_PROTOCOL *File; - EFI_PHYSICAL_ADDRESS FdtBase; - EFI_FILE_INFO *FileInfo; - UINTN FdtSize; - UINTN FileInfoSize; - - // Ensure the Semihosting driver is initialized - Remaining = (EFI_DEVICE_PATH*)&mSemihostingDevicePath; - // The LocateDevicePath() function locates all devices on DevicePath that support Protocol and returns - // the handle to the device that is closest to DevicePath. On output, the device path pointer is modified - // to point to the remaining part of the device path - Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &Remaining, &Handle); - if (EFI_ERROR (Status)) { - ASSERT_EFI_ERROR (Status); - return Status; - } - - // Recursive = FALSE: We do not want to start the whole device tree - Status = gBS->ConnectController (Handle, NULL, Remaining, FALSE); - if (EFI_ERROR (Status)) { - return Status; - } - - // Locate the FileSystem - Status = gBS->HandleProtocol (Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&SemihostingFs); - if (EFI_ERROR (Status)) { - ASSERT_EFI_ERROR (Status); - return Status; - } - - // Try to Open the volume and get root directory - Status = SemihostingFs->OpenVolume (SemihostingFs, &Fs); - if (EFI_ERROR (Status)) { - DEBUG ((EFI_D_WARN, "Warning: Fail to open semihosting filesystem that should contain FDT file.\n")); - return Status; - } - - File = NULL; - Status = Fs->Open (Fs, &File, (CHAR16*)FileName, EFI_FILE_MODE_READ, 0); - if (EFI_ERROR (Status)) { - DEBUG ((EFI_D_WARN, "Warning: Fail to load FDT file '%s'.\n", FileName)); - Fs->Close (Fs); - return Status; - } - - FileInfoSize = 0; - File->GetInfo (File, &gEfiFileInfoGuid, &FileInfoSize, NULL); - FileInfo = AllocatePool (FileInfoSize); - if (FileInfo == NULL) { - Status = EFI_OUT_OF_RESOURCES; - goto CLOSE_FILES; - } - Status = File->GetInfo (File, &gEfiFileInfoGuid, &FileInfoSize, FileInfo); - if (EFI_ERROR (Status)) { - FreePool (FileInfo); - goto CLOSE_FILES; - } - - // Get the file size - FdtSize = FileInfo->FileSize; - FreePool (FileInfo); - - // The FDT blob is attached to the Configuration Table. It is recommended to load it as Runtime Service Data - // to prevent the kernel to overwrite its data - Status = gBS->AllocatePages (AllocateAnyPages, EfiRuntimeServicesData, EFI_SIZE_TO_PAGES (FdtSize), &FdtBase); - if (!EFI_ERROR (Status)) { - Status = File->Read (File, &FdtSize, (VOID*)(UINTN)(FdtBase)); - if (EFI_ERROR (Status)) { - gBS->FreePages (FdtBase, EFI_SIZE_TO_PAGES (FdtSize)); - } else { - // Install the FDT as part of the UEFI Configuration Table - Status = InstallFdtIntoConfigurationTable ((VOID*)(UINTN)FdtBase, FdtSize); - if (EFI_ERROR (Status)) { - gBS->FreePages (FdtBase, EFI_SIZE_TO_PAGES (FdtSize)); - } - } - } - -CLOSE_FILES: - File->Close (File); - Fs->Close (Fs); - return Status; -} - -/** - Load and Install FDT from Firmware Volume - - @param Filename Guid of the FDT blob to load from firmware volume - - @return EFI_SUCCESS Fdt Blob was successfully installed into the configuration table - from firmware volume - @return EFI_NOT_FOUND Fail to locate the file in firmware volume - @return EFI_OUT_OF_RESOURCES Fail to allocate memory to contain the blob -**/ -EFI_STATUS -InstallFdtFromFv ( - IN CONST EFI_GUID *FileName - ) -{ - EFI_STATUS Status; - EFI_HANDLE *HandleBuffer; - UINTN NumberOfHandles; - UINT32 FvStatus; - UINTN Index; - EFI_FIRMWARE_VOLUME2_PROTOCOL *FvInstance; - INTN SectionInstance; - UINTN FdtSize; - VOID* FdtBlob; - EFI_PHYSICAL_ADDRESS FdtBase; - - FvStatus = 0; - SectionInstance = 0; - - // Locate all the Firmware Volume protocols. - Status = gBS->LocateHandleBuffer ( - ByProtocol, - &gEfiFirmwareVolume2ProtocolGuid, - NULL, - &NumberOfHandles, - &HandleBuffer - ); - if (EFI_ERROR (Status)) { - return Status; - } - - // Looking for FV that contains the FDT blob - for (Index = 0; Index < NumberOfHandles; Index++) { - // - // Get the protocol on this handle - // This should not fail because of LocateHandleBuffer - // - Status = gBS->HandleProtocol ( - HandleBuffer[Index], - &gEfiFirmwareVolume2ProtocolGuid, - (VOID**) &FvInstance - ); - if (EFI_ERROR (Status)) { - goto FREE_HANDLE_BUFFER; - } - - while (Status == EFI_SUCCESS) { - // FdtBlob must be allocated by ReadSection - FdtBlob = NULL; - - // See if it contains the FDT file - Status = FvInstance->ReadSection ( - FvInstance, - FileName, - EFI_SECTION_RAW, - SectionInstance, - &FdtBlob, - &FdtSize, - &FvStatus - ); - if (!EFI_ERROR (Status)) { - // When the FDT blob is attached to the Configuration Table it is recommended to load it as Runtime Service Data - // to prevent the kernel to overwrite its data - Status = gBS->AllocatePages (AllocateAnyPages, EfiRuntimeServicesData, EFI_SIZE_TO_PAGES (FdtSize), &FdtBase); - if (EFI_ERROR (Status)) { - goto FREE_HANDLE_BUFFER; - } - - // Copy the FDT to the Runtime memory - gBS->CopyMem ((VOID*)(UINTN)FdtBase, FdtBlob, FdtSize); - // Free the buffer allocated by FvInstance->ReadSection() - gBS->FreePool (FdtBlob); - - // Install the FDT as part of the UEFI Configuration Table - Status = InstallFdtIntoConfigurationTable ((VOID*)(UINTN)FdtBase, FdtSize); - if (EFI_ERROR (Status)) { - gBS->FreePages (FdtBase, EFI_SIZE_TO_PAGES (FdtSize)); - } - break; - } - } - } - -FREE_HANDLE_BUFFER: - // Free any allocated buffers - gBS->FreePool (HandleBuffer); - - return Status; -} diff --git a/EmbeddedPkg/Library/FdtLoadLib/FdtLoadLib.inf b/EmbeddedPkg/Library/FdtLoadLib/FdtLoadLib.inf deleted file mode 100644 index a50aa3607a..0000000000 --- a/EmbeddedPkg/Library/FdtLoadLib/FdtLoadLib.inf +++ /dev/null @@ -1,45 +0,0 @@ -#/* @file -# Copyright (c) 2014, Linaro Limited. All rights reserved. -# -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -#*/ - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = FdtLoadLib - FILE_GUID = F00298C1-BBC3-445F-8906-AAEAFE7729A4 - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = FdtLoadLib - -# -# The following information is for reference only and not required by the build tools. -# -# VALID_ARCHITECTURES = ARM AARCH64 -# - -[Sources] - FdtConfigurationTable.c - -[Packages] - MdePkg/MdePkg.dec - EmbeddedPkg/EmbeddedPkg.dec - -[LibraryClasses] - FdtLib - -[Protocols] - gEfiDevicePathProtocolGuid - gEfiSimpleFileSystemProtocolGuid - gEfiFirmwareVolume2ProtocolGuid - -[Guids] - gEfiFileInfoGuid - gFdtTableGuid -- 2.39.2