]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/ArmVirtualizationPkg: Add PlatformPeiLib library
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 18 Sep 2014 17:58:01 +0000 (17:58 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 18 Sep 2014 17:58:01 +0000 (17:58 +0000)
This is a fork of the ARM PlatformPeiLib for virtual machines. The main
purpose of having this specific implementation is that it allows us to
preserve the device tree blob if it was passed to us in system DRAM.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16136 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.c [new file with mode: 0644]
ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.inf [new file with mode: 0644]

diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.c b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.c
new file mode 100644 (file)
index 0000000..41d506c
--- /dev/null
@@ -0,0 +1,47 @@
+/** @file\r
+*\r
+*  Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2014, Linaro Limited. All rights reserved.\r
+*\r
+*  This program and the accompanying materials\r
+*  are licensed and made available under the terms and conditions of the BSD License\r
+*  which accompanies this distribution.  The full text of the license may be found at\r
+*  http://opensource.org/licenses/bsd-license.php\r
+*\r
+*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+*\r
+**/\r
+\r
+#include <PiPei.h>\r
+\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/HobLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <libfdt.h>\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+PlatformPeim (\r
+  VOID\r
+  )\r
+{\r
+  VOID               *Base;\r
+  VOID               *NewBase;\r
+  UINTN              FdtSize;\r
+\r
+  Base = (VOID*)(UINTN)FixedPcdGet64 (PcdDeviceTreeInitialBaseAddress);\r
+  ASSERT (fdt_check_header (Base) == 0);\r
+\r
+  FdtSize = fdt_totalsize (Base);\r
+  NewBase = AllocatePages (EFI_SIZE_TO_PAGES (FdtSize));\r
+  ASSERT (NewBase != NULL);\r
+\r
+  CopyMem (NewBase, Base, FdtSize);\r
+  PcdSet64 (PcdDeviceTreeBaseAddress, (UINT64)(UINTN)NewBase);\r
+\r
+  BuildFvHob (PcdGet32(PcdFvBaseAddress), PcdGet32(PcdFvSize));\r
+\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.inf b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.inf
new file mode 100644 (file)
index 0000000..e544b52
--- /dev/null
@@ -0,0 +1,48 @@
+#/** @file\r
+#\r
+#  Copyright (c) 2011-2012, ARM Limited. All rights reserved.\r
+#  Copyright (c) 2014, Linaro Limited. All rights reserved.\r
+#\r
+#  This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution.  The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+#\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#**/\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = PlatformPeiLib\r
+  FILE_GUID                      = 59C11815-F8DA-4F49-B4FB-EC1E41ED1F06\r
+  MODULE_TYPE                    = SEC\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = PlatformPeiLib\r
+\r
+[Sources]\r
+  PlatformPeiLib.c\r
+\r
+[Packages]\r
+  ArmPkg/ArmPkg.dec\r
+  ArmPlatformPkg/ArmVirtualizationPkg/ArmVirtualizationPkg.dec\r
+  MdePkg/MdePkg.dec\r
+  MdeModulePkg/MdeModulePkg.dec\r
+  EmbeddedPkg/EmbeddedPkg.dec\r
+\r
+[LibraryClasses]\r
+  DebugLib\r
+  HobLib\r
+  FdtLib\r
+\r
+[FixedPcd]\r
+  gArmTokenSpaceGuid.PcdFvBaseAddress\r
+  gArmTokenSpaceGuid.PcdFvSize\r
+  gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress\r
+\r
+[Pcd]\r
+  gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeBaseAddress\r
+\r
+[Depex]\r
+  gEfiPeiMemoryDiscoveredPpiGuid\r