These libraries are no longer used, so remove them from the tree.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
QemuFwCfgLib|ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.inf\r
QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/BaseQemuFwCfgS3LibNull.inf\r
\r
- ArmPlatformLib|ArmVirtPkg/Library/ArmQemuRelocatablePlatformLib/ArmQemuRelocatablePlatformLib.inf\r
ArmVirtMemInfoLib|ArmVirtPkg/Library/QemuVirtMemInfoLib/QemuVirtMemInfoLib.inf\r
\r
TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf\r
VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf\r
VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf\r
\r
- ArmPlatformLib|ArmVirtPkg/Library/ArmXenRelocatablePlatformLib/ArmXenRelocatablePlatformLib.inf\r
ArmVirtMemInfoLib|ArmVirtPkg/Library/XenVirtMemInfoLib/XenVirtMemInfoLib.inf\r
\r
TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf\r
+++ /dev/null
-#\r
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-# Copyright (c) 2016, 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 <AsmMacroIoLibV8.h>\r
-#include <Library/ArmLib.h>\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_FUNC(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 (PcdSystemMemoryBase)\r
- adr x2, PcdGet64 (PcdSystemMemorySize)\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
-.LArm64LinuxMagic:\r
- .byte 0x41, 0x52, 0x4d, 0x64\r
-\r
-//UINTN\r
-//ArmPlatformGetPrimaryCoreMpId (\r
-// VOID\r
-// );\r
-ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
- MOV32 (w0, FixedPcdGet32 (PcdArmPrimaryCore))\r
- ret\r
-\r
-//UINTN\r
-//ArmPlatformIsPrimaryCore (\r
-// IN UINTN MpId\r
-// );\r
-ASM_FUNC(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_FUNC(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_FUNC(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-2016, 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 <Library/ArmLib.h>\r
-\r
-ASM_FUNC(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
- LDRL (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
- ADRL (r8, PcdGet64 (PcdFdBaseAddress))\r
- ADRL (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
- ADRL (r1, PcdGet64 (PcdSystemMemoryBase))\r
- ADRL (r2, PcdGet64 (PcdSystemMemorySize))\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
- ADRL (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
-.LArm32LinuxMagic:\r
- .byte 0x18, 0x28, 0x6f, 0x01\r
-\r
-//UINTN\r
-//ArmPlatformGetPrimaryCoreMpId (\r
-// VOID\r
-// );\r
-ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
- MOV32 (r0, FixedPcdGet32 (PcdArmPrimaryCore))\r
- bx lr\r
-\r
-//UINTN\r
-//ArmPlatformIsPrimaryCore (\r
-// IN UINTN MpId\r
-// );\r
-ASM_FUNC(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_FUNC(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_FUNC(ArmGetPhysAddrTop)\r
- mov r0, #0x00000000\r
- mov r1, #0x10000\r
- bx lr\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
- *SystemMemoryBase = fdt32_to_cpu (Prop[0]);\r
- if (AddressCells > 1) {\r
- *SystemMemoryBase = (*SystemMemoryBase << 32) | fdt32_to_cpu (Prop[1]);\r
- }\r
- Prop += AddressCells;\r
-\r
- *SystemMemorySize = fdt32_to_cpu (Prop[0]);\r
- if (SizeCells > 1) {\r
- *SystemMemorySize = (*SystemMemorySize << 32) | fdt32_to_cpu (Prop[1]);\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
-\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 <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
+++ /dev/null
-#\r
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-# Copyright (c) 2016, 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 <AsmMacroIoLibV8.h>\r
-#include <Library/ArmLib.h>\r
-\r
-ASM_FUNC(ArmPlatformPeiBootAction)\r
- ret\r
-\r
-//UINTN\r
-//ArmPlatformGetPrimaryCoreMpId (\r
-// VOID\r
-// );\r
-ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
- MOV32 (w0, FixedPcdGet32 (PcdArmPrimaryCore))\r
- ret\r
-\r
-//UINTN\r
-//ArmPlatformIsPrimaryCore (\r
-// IN UINTN MpId\r
-// );\r
-ASM_FUNC(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_FUNC(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_FUNC(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-2016, 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 <Library/ArmLib.h>\r
-\r
-ASM_FUNC(ArmPlatformPeiBootAction)\r
- bx lr\r
-\r
-//UINTN\r
-//ArmPlatformGetPrimaryCoreMpId (\r
-// VOID\r
-// );\r
-ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
- MOV32 (r0, FixedPcdGet32 (PcdArmPrimaryCore))\r
- bx lr\r
-\r
-//UINTN\r
-//ArmPlatformIsPrimaryCore (\r
-// IN UINTN MpId\r
-// );\r
-ASM_FUNC(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_FUNC(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_FUNC(ArmGetPhysAddrTop)\r
- mov r0, #0x00000000\r
- mov r1, #0x10000\r
- bx lr\r
-\r
-ASM_FUNCTION_REMOVE_IF_UNREFERENCED\r
+++ /dev/null
-//\r
-// Copyright (c) 2011-2014, 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
-#include <Library/ArmLib.h>\r
-#include <AutoGen.h>\r
-\r
- INCLUDE AsmMacroIoLib.inc\r
-\r
- EXPORT ArmPlatformPeiBootAction\r
- EXPORT ArmPlatformIsPrimaryCore\r
- EXPORT ArmPlatformGetPrimaryCoreMpId\r
- EXPORT ArmPlatformGetCorePosition\r
- EXPORT ArmGetPhysAddrTop\r
-\r
- AREA VirtHelper, CODE, READONLY\r
-\r
-ArmPlatformPeiBootAction FUNCTION\r
- bx lr\r
- ENDFUNC\r
-\r
-//UINTN\r
-//ArmPlatformGetPrimaryCoreMpId (\r
-// VOID\r
-// );\r
-ArmPlatformGetPrimaryCoreMpId FUNCTION\r
- MOV32 r0, FixedPcdGet32 (PcdArmPrimaryCore)\r
- bx lr\r
- ENDFUNC\r
-\r
-//UINTN\r
-//ArmPlatformIsPrimaryCore (\r
-// IN UINTN MpId\r
-// );\r
-ArmPlatformIsPrimaryCore FUNCTION\r
- mov r0, #1\r
- bx lr\r
- ENDFUNC\r
-\r
-//UINTN\r
-//ArmPlatformGetCorePosition (\r
-// IN UINTN MpId\r
-// );\r
-// With this function: CorePos = (ClusterId * 4) + CoreId\r
-ArmPlatformGetCorePosition FUNCTION\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
- ENDFUNC\r
-\r
-//EFI_PHYSICAL_ADDRESS\r
-//GetPhysAddrTop (\r
-// VOID\r
-// );\r
-ArmGetPhysAddrTop FUNCTION\r
- mov r0, #0x00000000\r
- mov r1, #0x10000\r
- bx lr\r
- ENDFUNC\r
-\r
- END\r
+++ /dev/null
-#/* @file\r
-# Copyright (c) 2011-2014, 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 = ArmVirtPlatformLib\r
- FILE_GUID = 00214cc1-06d1-45fe-9700-dca5726ad7bf\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
- MemoryAllocationLib\r
- ArmLib\r
- PrintLib\r
- FdtLib\r
-\r
-[Sources.common]\r
- Virt.c\r
- VirtMem.c\r
-\r
-[Sources.AARCH64]\r
- AARCH64/VirtHelper.S\r
-\r
-[Sources.ARM]\r
- ARM/VirtHelper.S | GCC\r
- ARM/VirtHelper.asm | RVCT\r
-\r
-[FeaturePcd]\r
- gEmbeddedTokenSpaceGuid.PcdCacheEnable\r
- gArmPlatformTokenSpaceGuid.PcdSystemMemoryInitializeInSec\r
-\r
-[Pcd]\r
- gArmTokenSpaceGuid.PcdSystemMemorySize\r
-\r
-[FixedPcd]\r
- gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress\r
- gArmPlatformTokenSpaceGuid.PcdCoreCount\r
- gArmTokenSpaceGuid.PcdSystemMemoryBase\r
- gArmTokenSpaceGuid.PcdArmPrimaryCoreMask\r
- gArmTokenSpaceGuid.PcdArmPrimaryCore\r
- gArmTokenSpaceGuid.PcdFdBaseAddress\r
- gArmTokenSpaceGuid.PcdFdSize\r
- gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize\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 <Library/PcdLib.h>\r
-#include <libfdt.h>\r
-#include <Pi/PiBootMode.h>\r
-#include <Uefi/UefiBaseType.h>\r
-#include <Uefi/UefiMultiPhase.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
-/**\r
- Initialize the system (or sometimes called permanent) memory\r
-\r
- This memory is generally represented by the DRAM.\r
-\r
- This function is called from InitializeMemory() in MemoryInitPeim, in the PEI\r
- phase.\r
-**/\r
-VOID\r
-ArmPlatformInitializeSystemMemory (\r
- VOID\r
- )\r
-{\r
- VOID *DeviceTreeBase;\r
- INT32 Node, Prev;\r
- UINT64 NewBase, CurBase;\r
- UINT64 NewSize, CurSize;\r
- CONST CHAR8 *Type;\r
- INT32 Len;\r
- CONST UINT64 *RegProp;\r
- RETURN_STATUS PcdStatus;\r
-\r
- NewBase = 0;\r
- NewSize = 0;\r
-\r
- DeviceTreeBase = (VOID *)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress);\r
- ASSERT (DeviceTreeBase != NULL);\r
-\r
- //\r
- // Make sure we have a valid device tree blob\r
- //\r
- ASSERT (fdt_check_header (DeviceTreeBase) == 0);\r
-\r
- //\r
- // Look for the lowest memory node\r
- //\r
- for (Prev = 0;; Prev = Node) {\r
- Node = fdt_next_node (DeviceTreeBase, Prev, NULL);\r
- if (Node < 0) {\r
- break;\r
- }\r
-\r
- //\r
- // Check for memory node\r
- //\r
- Type = fdt_getprop (DeviceTreeBase, Node, "device_type", &Len);\r
- if (Type && AsciiStrnCmp (Type, "memory", Len) == 0) {\r
- //\r
- // Get the 'reg' property of this node. For now, we will assume\r
- // two 8 byte quantities for base and size, respectively.\r
- //\r
- RegProp = fdt_getprop (DeviceTreeBase, Node, "reg", &Len);\r
- if (RegProp != 0 && Len == (2 * sizeof (UINT64))) {\r
-\r
- CurBase = fdt64_to_cpu (ReadUnaligned64 (RegProp));\r
- CurSize = fdt64_to_cpu (ReadUnaligned64 (RegProp + 1));\r
-\r
- DEBUG ((EFI_D_INFO, "%a: System RAM @ 0x%lx - 0x%lx\n",\r
- __FUNCTION__, CurBase, CurBase + CurSize - 1));\r
-\r
- if (NewBase > CurBase || NewBase == 0) {\r
- NewBase = CurBase;\r
- NewSize = CurSize;\r
- }\r
- } else {\r
- DEBUG ((EFI_D_ERROR, "%a: Failed to parse FDT memory node\n",\r
- __FUNCTION__));\r
- }\r
- }\r
- }\r
-\r
- //\r
- // Make sure the start of DRAM matches our expectation\r
- //\r
- ASSERT (FixedPcdGet64 (PcdSystemMemoryBase) == NewBase);\r
- PcdStatus = PcdSet64S (PcdSystemMemorySize, NewSize);\r
- ASSERT_RETURN_ERROR (PcdStatus);\r
-\r
- //\r
- // We need to make sure that the machine we are running on has at least\r
- // 128 MB of memory configured, and is currently executing this binary from\r
- // NOR flash. This prevents a device tree image in DRAM from getting\r
- // clobbered when our caller installs permanent PEI RAM, before we have a\r
- // chance of marking its location as reserved or copy it to a freshly\r
- // allocated block in the permanent PEI RAM in the platform PEIM.\r
- //\r
- ASSERT (NewSize >= SIZE_128MB);\r
- ASSERT (\r
- (((UINT64)PcdGet64 (PcdFdBaseAddress) +\r
- (UINT64)PcdGet32 (PcdFdSize)) <= NewBase) ||\r
- ((UINT64)PcdGet64 (PcdFdBaseAddress) >= (NewBase + NewSize)));\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
+++ /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
-\r
-// Number of Virtual Memory Map Descriptors\r
-#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 5\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 = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;\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 = FixedPcdGet64 (PcdFdBaseAddress);\r
- VirtualMemoryTable[3].VirtualBase = VirtualMemoryTable[3].PhysicalBase;\r
- VirtualMemoryTable[3].Length = FixedPcdGet32 (PcdFdSize);\r
- VirtualMemoryTable[3].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK;\r
-\r
- // End of Table\r
- ZeroMem (&VirtualMemoryTable[4], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));\r
-\r
- *VirtualMemoryMap = VirtualMemoryTable;\r
-}\r
+++ /dev/null
-#\r
-# Copyright (c) 2011-2013, ARM Limited. All rights reserved.\r
-# Copyright (c) 2016, 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 <AsmMacroIoLibV8.h>\r
-#include <Library/ArmLib.h>\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_FUNC(ArmPlatformPeiBootAction)\r
- mov x29, x30 // preserve LR\r
- mov x28, x0 // preserve DTB pointer\r
- mov x27, x1 // preserve base of image pointer\r
-\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, we are just coming out of\r
- // reset, and x0 will be 0.\r
- //\r
- cbz x0, .Lout\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 (PcdSystemMemoryBase)\r
- adr x2, PcdGet64 (PcdSystemMemorySize)\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
-.LArm64LinuxMagic:\r
- .byte 0x41, 0x52, 0x4d, 0x64\r
-\r
-//UINTN\r
-//ArmPlatformGetPrimaryCoreMpId (\r
-// VOID\r
-// );\r
-ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
- MOV32 (w0, FixedPcdGet32 (PcdArmPrimaryCore))\r
- ret\r
-\r
-//UINTN\r
-//ArmPlatformIsPrimaryCore (\r
-// IN UINTN MpId\r
-// );\r
-ASM_FUNC(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_FUNC(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_FUNC(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-2016, 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 <Library/ArmLib.h>\r
-\r
-ASM_FUNC(ArmPlatformPeiBootAction)\r
- mov r11, r14 // preserve LR\r
- mov r10, r0 // preserve DTB pointer\r
- mov r9, r1 // preserve base of image pointer\r
-\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, we are just coming out of\r
- // reset, and r0 will be 0.\r
- //\r
- teq r0, #0\r
- beq .Lout\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
- ADRL (r8, PcdGet64 (PcdFdBaseAddress))\r
- ADRL (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
- ADRL (r1, PcdGet64 (PcdSystemMemoryBase))\r
- ADRL (r2, PcdGet64 (PcdSystemMemorySize))\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
- ADRL (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
-.LArm32LinuxMagic:\r
- .byte 0x18, 0x28, 0x6f, 0x01\r
-\r
-//UINTN\r
-//ArmPlatformGetPrimaryCoreMpId (\r
-// VOID\r
-// );\r
-ASM_FUNC(ArmPlatformGetPrimaryCoreMpId)\r
- MOV32 (r0, FixedPcdGet32 (PcdArmPrimaryCore))\r
- bx lr\r
-\r
-//UINTN\r
-//ArmPlatformIsPrimaryCore (\r
-// IN UINTN MpId\r
-// );\r
-ASM_FUNC(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_FUNC(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_FUNC(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
- XenVirtMem.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
+++ /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
- *SystemMemoryBase = fdt32_to_cpu (Prop[0]);\r
- if (AddressCells > 1) {\r
- *SystemMemoryBase = (*SystemMemoryBase << 32) | fdt32_to_cpu (Prop[1]);\r
- }\r
- Prop += AddressCells;\r
-\r
- *SystemMemorySize = fdt32_to_cpu (Prop[0]);\r
- if (SizeCells > 1) {\r
- *SystemMemorySize = (*SystemMemorySize << 32) | fdt32_to_cpu (Prop[1]);\r
- }\r
-\r
- return TRUE;\r
-}\r
-\r
-VOID\r
-CopyFdt (\r
- IN VOID *FdtDest,\r
- IN VOID *FdtSource\r
- )\r
-{\r
- CopyMem (FdtDest, FdtSource, fdt_totalsize (FdtSource));\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 <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
+++ /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
-\r
-// Number of Virtual Memory Map Descriptors\r
-#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 2\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
- //\r
- // Map the entire physical memory space as cached. The only device\r
- // we care about is the GIC, which will be stage 2 mapped as a device\r
- // by the hypervisor, which will override the cached mapping we install\r
- // here.\r
- //\r
- VirtualMemoryTable[0].PhysicalBase = 0x0;\r
- VirtualMemoryTable[0].VirtualBase = 0x0;\r
- VirtualMemoryTable[0].Length = ArmGetPhysAddrTop ();\r
- VirtualMemoryTable[0].Attributes = DDR_ATTRIBUTES_CACHED;\r
-\r
- // End of Table\r
- ZeroMem (&VirtualMemoryTable[1], sizeof (ARM_MEMORY_REGION_DESCRIPTOR));\r
-\r
- *VirtualMemoryMap = VirtualMemoryTable;\r
-}\r