--- /dev/null
+#\r
+# Copyright (c) 2011-2013, ARM 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 <AsmMacroIoLibV8.h>\r
+#include <Base.h>\r
+#include <Library/ArmLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <AutoGen.h>\r
+\r
+.text\r
+.align 2\r
+\r
+GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
+GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
+GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
+GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
+GCC_ASM_EXPORT(ArmGetPhysAddrTop)\r
+\r
+GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
+GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
+GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)\r
+\r
+.LArm64LinuxMagic:\r
+ .byte 0x41, 0x52, 0x4d, 0x64\r
+\r
+// VOID\r
+// ArmPlatformPeiBootAction (\r
+// VOID *DeviceTreeBaseAddress, // passed by loader in x0\r
+// VOID *ImageBase // passed by FDF trampoline in x1\r
+// );\r
+ASM_PFX(ArmPlatformPeiBootAction):\r
+ //\r
+ // If we are booting from RAM using the Linux kernel boot protocol, x0 will\r
+ // point to the DTB image in memory. Otherwise, use the default value defined\r
+ // by the platform.\r
+ //\r
+ cbnz x0, 0f\r
+ ldr x0, PcdGet64 (PcdDeviceTreeInitialBaseAddress)\r
+\r
+0:mov x29, x30 // preserve LR\r
+ mov x28, x0 // preserve DTB pointer\r
+ mov x27, x1 // preserve base of image pointer\r
+\r
+ //\r
+ // The base of the runtime image has been preserved in x1. Check whether\r
+ // the expected magic number can be found in the header.\r
+ //\r
+ ldr w8, .LArm64LinuxMagic\r
+ ldr w9, [x1, #0x38]\r
+ cmp w8, w9\r
+ bne .Lout\r
+\r
+ //\r
+ //\r
+ // OK, so far so good. We have confirmed that we likely have a DTB and are\r
+ // booting via the arm64 Linux boot protocol. Update the base-of-image PCD\r
+ // to the actual relocated value, and add the shift of PcdFdBaseAddress to\r
+ // PcdFvBaseAddress as well\r
+ //\r
+ adr x8, PcdGet64 (PcdFdBaseAddress)\r
+ adr x9, PcdGet64 (PcdFvBaseAddress)\r
+ ldr x6, [x8]\r
+ ldr x7, [x9]\r
+ sub x7, x7, x6\r
+ add x7, x7, x1\r
+ str x1, [x8]\r
+ str x7, [x9]\r
+\r
+ //\r
+ // Discover the memory size and offset from the DTB, and record in the\r
+ // respective PCDs. This will also return false if a corrupt DTB is\r
+ // encountered. Since we are calling a C function, use the window at the\r
+ // beginning of the FD image as a temp stack.\r
+ //\r
+ adr x1, PcdGet64 (PcdSystemMemorySize)\r
+ adr x2, PcdGet64 (PcdSystemMemoryBase)\r
+ mov sp, x7\r
+ bl FindMemnode\r
+ cbz x0, .Lout\r
+\r
+ //\r
+ // Copy the DTB to the slack space right after the 64 byte arm64/Linux style\r
+ // image header at the base of this image (defined in the FDF), and record the\r
+ // pointer in PcdDeviceTreeInitialBaseAddress.\r
+ //\r
+ adr x8, PcdGet64 (PcdDeviceTreeInitialBaseAddress)\r
+ add x27, x27, #0x40\r
+ str x27, [x8]\r
+\r
+ mov x0, x27\r
+ mov x1, x28\r
+ bl CopyFdt\r
+\r
+.Lout:\r
+ ret x29\r
+\r
+//UINTN\r
+//ArmPlatformGetPrimaryCoreMpId (\r
+// VOID\r
+// );\r
+ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
+ LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0)\r
+ ldrh w0, [x0]\r
+ ret\r
+\r
+//UINTN\r
+//ArmPlatformIsPrimaryCore (\r
+// IN UINTN MpId\r
+// );\r
+ASM_PFX(ArmPlatformIsPrimaryCore):\r
+ mov x0, #1\r
+ ret\r
+\r
+//UINTN\r
+//ArmPlatformGetCorePosition (\r
+// IN UINTN MpId\r
+// );\r
+// With this function: CorePos = (ClusterId * 4) + CoreId\r
+ASM_PFX(ArmPlatformGetCorePosition):\r
+ and x1, x0, #ARM_CORE_MASK\r
+ and x0, x0, #ARM_CLUSTER_MASK\r
+ add x0, x1, x0, LSR #6\r
+ ret\r
+\r
+//EFI_PHYSICAL_ADDRESS\r
+//GetPhysAddrTop (\r
+// VOID\r
+// );\r
+ASM_PFX(ArmGetPhysAddrTop):\r
+ mrs x0, id_aa64mmfr0_el1\r
+ adr x1, .LPARanges\r
+ and x0, x0, #7\r
+ ldrb w1, [x1, x0]\r
+ mov x0, #1\r
+ lsl x0, x0, x1\r
+ ret\r
+\r
+//\r
+// Bits 0..2 of the AA64MFR0_EL1 system register encode the size of the\r
+// physical address space support on this CPU:\r
+// 0 == 32 bits, 1 == 36 bits, etc etc\r
+// 6 and 7 are reserved\r
+//\r
+.LPARanges:\r
+ .byte 32, 36, 40, 42, 44, 48, -1, -1\r
+\r
+ASM_FUNCTION_REMOVE_IF_UNREFERENCED\r
--- /dev/null
+#\r
+# Copyright (c) 2011-2013, 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 <AsmMacroIoLib.h>\r
+#include <Base.h>\r
+#include <Library/ArmLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <AutoGen.h>\r
+\r
+.text\r
+.align 2\r
+\r
+GCC_ASM_EXPORT(ArmPlatformPeiBootAction)\r
+GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)\r
+GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)\r
+GCC_ASM_EXPORT(ArmPlatformGetCorePosition)\r
+GCC_ASM_EXPORT(ArmGetPhysAddrTop)\r
+\r
+GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)\r
+GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)\r
+GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)\r
+\r
+.LArm32LinuxMagic:\r
+ .byte 0x18, 0x28, 0x6f, 0x01\r
+\r
+ASM_PFX(ArmPlatformPeiBootAction):\r
+ //\r
+ // If we are booting from RAM using the Linux kernel boot protocol, r0 will\r
+ // point to the DTB image in memory. Otherwise, use the default value defined\r
+ // by the platform.\r
+ //\r
+ teq r0, #0\r
+ bne 0f\r
+ ldr r0, =PcdGet64 (PcdDeviceTreeInitialBaseAddress)\r
+\r
+0:mov r11, r14 // preserve LR\r
+ mov r10, r0 // preserve DTB pointer\r
+ mov r9, r1 // preserve base of image pointer\r
+\r
+ //\r
+ // The base of the runtime image has been preserved in r1. Check whether\r
+ // the expected magic number can be found in the header.\r
+ //\r
+ ldr r8, .LArm32LinuxMagic\r
+ ldr r7, [r1, #0x24]\r
+ cmp r7, r8\r
+ bne .Lout\r
+\r
+ //\r
+ //\r
+ // OK, so far so good. We have confirmed that we likely have a DTB and are\r
+ // booting via the ARM Linux boot protocol. Update the base-of-image PCD\r
+ // to the actual relocated value, and add the shift of PcdFdBaseAddress to\r
+ // PcdFvBaseAddress as well\r
+ //\r
+ ldr r8, =PcdGet64 (PcdFdBaseAddress)\r
+ ldr r7, =PcdGet64 (PcdFvBaseAddress)\r
+ ldr r6, [r8]\r
+ ldr r5, [r7]\r
+ sub r5, r5, r6\r
+ add r5, r5, r1\r
+ str r1, [r8]\r
+ str r5, [r7]\r
+\r
+ //\r
+ // Discover the memory size and offset from the DTB, and record in the\r
+ // respective PCDs. This will also return false if a corrupt DTB is\r
+ // encountered. Since we are calling a C function, use the window at the\r
+ // beginning of the FD image as a temp stack.\r
+ //\r
+ ldr r1, =PcdGet64 (PcdSystemMemorySize)\r
+ ldr r2, =PcdGet64 (PcdSystemMemoryBase)\r
+ mov sp, r5\r
+ bl FindMemnode\r
+ teq r0, #0\r
+ beq .Lout\r
+\r
+ //\r
+ // Copy the DTB to the slack space right after the 64 byte arm64/Linux style\r
+ // image header at the base of this image (defined in the FDF), and record the\r
+ // pointer in PcdDeviceTreeInitialBaseAddress.\r
+ //\r
+ ldr r8, =PcdGet64 (PcdDeviceTreeInitialBaseAddress)\r
+ add r9, r9, #0x40\r
+ str r9, [r8]\r
+\r
+ mov r0, r9\r
+ mov r1, r10\r
+ bl CopyFdt\r
+\r
+.Lout:\r
+ bx r11\r
+\r
+//UINTN\r
+//ArmPlatformGetPrimaryCoreMpId (\r
+// VOID\r
+// );\r
+ASM_PFX(ArmPlatformGetPrimaryCoreMpId):\r
+ LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)\r
+ ldr r0, [r0]\r
+ bx lr\r
+\r
+//UINTN\r
+//ArmPlatformIsPrimaryCore (\r
+// IN UINTN MpId\r
+// );\r
+ASM_PFX(ArmPlatformIsPrimaryCore):\r
+ mov r0, #1\r
+ bx lr\r
+\r
+//UINTN\r
+//ArmPlatformGetCorePosition (\r
+// IN UINTN MpId\r
+// );\r
+// With this function: CorePos = (ClusterId * 4) + CoreId\r
+ASM_PFX(ArmPlatformGetCorePosition):\r
+ and r1, r0, #ARM_CORE_MASK\r
+ and r0, r0, #ARM_CLUSTER_MASK\r
+ add r0, r1, r0, LSR #6\r
+ bx lr\r
+\r
+//EFI_PHYSICAL_ADDRESS\r
+//GetPhysAddrTop (\r
+// VOID\r
+// );\r
+ASM_PFX(ArmGetPhysAddrTop):\r
+ mov r0, #0x00000000\r
+ mov r1, #0x10000\r
+ bx lr\r
+\r
--- /dev/null
+#/* @file\r
+# Copyright (c) 2011-2015, 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 = ArmXenRelocatablePlatformLib\r
+ FILE_GUID = c8602718-4faa-4119-90ca-cae72509ac4c\r
+ MODULE_TYPE = BASE\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = ArmPlatformLib|SEC PEIM\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ MdeModulePkg/MdeModulePkg.dec\r
+ EmbeddedPkg/EmbeddedPkg.dec\r
+ ArmPkg/ArmPkg.dec\r
+ ArmPlatformPkg/ArmPlatformPkg.dec\r
+ ArmVirtPkg/ArmVirtPkg.dec\r
+\r
+[LibraryClasses]\r
+ IoLib\r
+ ArmLib\r
+ PrintLib\r
+ FdtLib\r
+\r
+[Sources.common]\r
+ RelocatableVirt.c\r
+ QemuVirtMem.c\r
+ FdtParser.c\r
+\r
+[Sources.AARCH64]\r
+ AARCH64/RelocatableVirtHelper.S\r
+\r
+[Sources.ARM]\r
+ ARM/RelocatableVirtHelper.S\r
+\r
+[FeaturePcd]\r
+ gEmbeddedTokenSpaceGuid.PcdCacheEnable\r
+ gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec\r
+\r
+[PatchPcd]\r
+ gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress\r
+ gArmTokenSpaceGuid.PcdFdBaseAddress\r
+ gArmTokenSpaceGuid.PcdFvBaseAddress\r
+ gArmTokenSpaceGuid.PcdSystemMemoryBase\r
+ gArmTokenSpaceGuid.PcdSystemMemorySize\r
+\r
+[FixedPcd]\r
+ gArmPlatformTokenSpaceGuid.PcdCoreCount\r
+ gArmTokenSpaceGuid.PcdArmPrimaryCoreMask\r
+ gArmTokenSpaceGuid.PcdArmPrimaryCore\r
+ gArmTokenSpaceGuid.PcdFdSize\r
+ gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize\r
--- /dev/null
+/*\r
+ * Copyright (c) 2015, Linaro Ltd. 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
+#include <Uefi.h>\r
+#include <Include/libfdt.h>\r
+\r
+BOOLEAN\r
+FindMemnode (\r
+ IN VOID *DeviceTreeBlob,\r
+ OUT UINT64 *SystemMemoryBase,\r
+ OUT UINT64 *SystemMemorySize\r
+ )\r
+{\r
+ INT32 MemoryNode;\r
+ INT32 AddressCells;\r
+ INT32 SizeCells;\r
+ INT32 Length;\r
+ CONST INT32 *Prop;\r
+\r
+ if (fdt_check_header (DeviceTreeBlob) != 0) {\r
+ return FALSE;\r
+ }\r
+\r
+ //\r
+ // Look for a node called "memory" at the lowest level of the tree\r
+ //\r
+ MemoryNode = fdt_path_offset (DeviceTreeBlob, "/memory");\r
+ if (MemoryNode <= 0) {\r
+ return FALSE;\r
+ }\r
+\r
+ //\r
+ // Retrieve the #address-cells and #size-cells properties\r
+ // from the root node, or use the default if not provided.\r
+ //\r
+ AddressCells = 1;\r
+ SizeCells = 1;\r
+\r
+ Prop = fdt_getprop (DeviceTreeBlob, 0, "#address-cells", &Length);\r
+ if (Length == 4) {\r
+ AddressCells = fdt32_to_cpu (*Prop);\r
+ }\r
+\r
+ Prop = fdt_getprop (DeviceTreeBlob, 0, "#size-cells", &Length);\r
+ if (Length == 4) {\r
+ SizeCells = fdt32_to_cpu (*Prop);\r
+ }\r
+\r
+ //\r
+ // Now find the 'reg' property of the /memory node, and read the first\r
+ // range listed.\r
+ //\r
+ Prop = fdt_getprop (DeviceTreeBlob, MemoryNode, "reg", &Length);\r
+\r
+ if (Length < (AddressCells + SizeCells) * sizeof (INT32)) {\r
+ return FALSE;\r
+ }\r
+\r
+ if (AddressCells == 1) {\r
+ *SystemMemoryBase = fdt32_to_cpu (*Prop);\r
+ } else {\r
+ *SystemMemoryBase = fdt64_to_cpu (*(UINT64 *)Prop);\r
+ }\r
+ Prop += AddressCells;\r
+\r
+ if (SizeCells == 1) {\r
+ *SystemMemorySize = fdt32_to_cpu (*Prop);\r
+ } else {\r
+ *SystemMemorySize = fdt64_to_cpu (*(UINT64 *)Prop);\r
+ }\r
+\r
+ return TRUE;\r
+}\r
+\r
+VOID\r
+CopyFdt (\r
+ IN VOID *FdtDest,\r
+ IN VOID *FdtSource\r
+ )\r
+{\r
+ fdt_pack(FdtSource);\r
+ CopyMem (FdtDest, FdtSource, fdt_totalsize (FdtSource));\r
+}\r
--- /dev/null
+/** @file\r
+*\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 <Library/ArmPlatformLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/IoLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <ArmPlatform.h>\r
+\r
+// Number of Virtual Memory Map Descriptors\r
+#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5\r
+\r
+// DDR attributes\r
+#define DDR_ATTRIBUTES_CACHED ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK\r
+#define DDR_ATTRIBUTES_UNCACHED ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED\r
+\r
+EFI_PHYSICAL_ADDRESS\r
+ArmGetPhysAddrTop (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ Return the Virtual Memory Map of your platform\r
+\r
+ This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU\r
+ on your platform.\r
+\r
+ @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR\r
+ describing a Physical-to-Virtual Memory\r
+ mapping. This array must be ended by a\r
+ zero-filled entry\r
+\r
+**/\r
+VOID\r
+ArmPlatformGetVirtualMemoryMap (\r
+ IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap\r
+ )\r
+{\r
+ ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;\r
+\r
+ ASSERT (VirtualMemoryMap != NULL);\r
+\r
+ VirtualMemoryTable = AllocatePages (\r
+ EFI_SIZE_TO_PAGES (\r
+ sizeof (ARM_MEMORY_REGION_DESCRIPTOR)\r
+ * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS\r
+ )\r
+ );\r
+\r
+ if (VirtualMemoryTable == NULL) {\r
+ DEBUG ((EFI_D_ERROR, "%a: Error: Failed AllocatePages()\n", __FUNCTION__));\r
+ return;\r
+ }\r
+\r
+ // System DRAM\r
+ VirtualMemoryTable[0].PhysicalBase = PcdGet64 (PcdSystemMemoryBase);\r
+ VirtualMemoryTable[0].VirtualBase = VirtualMemoryTable[0].PhysicalBase;\r
+ VirtualMemoryTable[0].Length = PcdGet64 (PcdSystemMemorySize);\r
+ VirtualMemoryTable[0].Attributes = DDR_ATTRIBUTES_CACHED;\r
+\r
+ DEBUG ((EFI_D_INFO, "%a: Dumping System DRAM Memory Map:\n"\r
+ "\tPhysicalBase: 0x%lX\n"\r
+ "\tVirtualBase: 0x%lX\n"\r
+ "\tLength: 0x%lX\n",\r
+ __FUNCTION__,\r
+ VirtualMemoryTable[0].PhysicalBase,\r
+ VirtualMemoryTable[0].VirtualBase,\r
+ VirtualMemoryTable[0].Length));\r
+\r
+ // Peripheral space before DRAM\r
+ VirtualMemoryTable[1].PhysicalBase = 0x0;\r
+ VirtualMemoryTable[1].VirtualBase = 0x0;\r
+ VirtualMemoryTable[1].Length = VirtualMemoryTable[0].PhysicalBase;\r
+ VirtualMemoryTable[1].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;\r
+\r
+ // Peripheral space after DRAM\r
+ VirtualMemoryTable[2].PhysicalBase = VirtualMemoryTable[0].Length + VirtualMemoryTable[1].Length;\r
+ VirtualMemoryTable[2].VirtualBase = VirtualMemoryTable[2].PhysicalBase;\r
+ VirtualMemoryTable[2].Length = MIN (1ULL << FixedPcdGet8 (PcdPrePiCpuMemorySize),\r
+ ArmGetPhysAddrTop ()) -\r
+ VirtualMemoryTable[2].PhysicalBase;\r
+ VirtualMemoryTable[2].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;\r
+\r
+ // Remap the FD region as normal executable memory\r
+ VirtualMemoryTable[3].PhysicalBase = PcdGet64 (PcdFdBaseAddress);\r
+ VirtualMemoryTable[3].VirtualBase = VirtualMemoryTable[3].PhysicalBase;\r
+ VirtualMemoryTable[3].Length = FixedPcdGet32 (PcdFdSize);\r
+ VirtualMemoryTable[3].Attributes = DDR_ATTRIBUTES_CACHED;\r
+\r
+ // End of Table\r
+ ZeroMem (&VirtualMemoryTable[4], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));\r
+\r
+ *VirtualMemoryMap = VirtualMemoryTable;\r
+}\r
--- /dev/null
+/** @file\r
+*\r
+* Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
+* Copyright (c) 2014, Linaro Limited. All rights reserved.\r
+* Copyright (c) 2014, Red Hat, Inc.\r
+*\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 <Library/IoLib.h>\r
+#include <Library/ArmPlatformLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <ArmPlatform.h>\r
+#include <Pi/PiBootMode.h>\r
+\r
+/**\r
+ Return the current Boot Mode\r
+\r
+ This function returns the boot reason on the platform\r
+\r
+ @return Return the current Boot Mode of the platform\r
+\r
+**/\r
+EFI_BOOT_MODE\r
+ArmPlatformGetBootMode (\r
+ VOID\r
+ )\r
+{\r
+ return BOOT_WITH_FULL_CONFIGURATION;\r
+}\r
+\r
+/**\r
+ This function is called by PrePeiCore, in the SEC phase.\r
+**/\r
+RETURN_STATUS\r
+ArmPlatformInitialize (\r
+ IN UINTN MpId\r
+ )\r
+{\r
+ //\r
+ // We are relying on ArmPlatformInitializeSystemMemory () being called from\r
+ // InitializeMemory (), which only occurs if the following feature is disabled\r
+ //\r
+ ASSERT (!FeaturePcdGet (PcdSystemMemoryInitializeInSec));\r
+ return RETURN_SUCCESS;\r
+}\r
+\r
+VOID\r
+ArmPlatformInitializeSystemMemory (\r
+ VOID\r
+ )\r
+{\r
+}\r
+\r
+VOID\r
+ArmPlatformGetPlatformPpiList (\r
+ OUT UINTN *PpiListSize,\r
+ OUT EFI_PEI_PPI_DESCRIPTOR **PpiList\r
+ )\r
+{\r
+ *PpiListSize = 0;\r
+ *PpiList = NULL;\r
+}\r