]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c
Add flag to make UEFI run from DRAM or FLASH for FVPs
[mirror_edk2.git] / ArmPlatformPkg / MemoryInitPei / MemoryInitPeiLib.c
index e5dd29c7e1e50e4ecf5afe5d163bb70530542fc8..0214897d8b5cdecfa0c8cffb9e089a0b835f90ca 100755 (executable)
@@ -33,13 +33,17 @@ InitMmu (
   ARM_MEMORY_REGION_DESCRIPTOR  *MemoryTable;\r
   VOID                          *TranslationTableBase;\r
   UINTN                         TranslationTableSize;\r
+  RETURN_STATUS                 Status;\r
 \r
   // Get Virtual Memory Map from the Platform Library\r
-  ArmPlatformGetVirtualMemoryMap(&MemoryTable);\r
+  ArmPlatformGetVirtualMemoryMap (&MemoryTable);\r
 \r
   //Note: Because we called PeiServicesInstallPeiMemory() before to call InitMmu() the MMU Page Table resides in\r
   //      DRAM (even at the top of DRAM as it is the first permanent memory allocation)\r
-  ArmConfigureMmu (MemoryTable, &TranslationTableBase, &TranslationTableSize);\r
+  Status = ArmConfigureMmu (MemoryTable, &TranslationTableBase, &TranslationTableSize);\r
+  if (EFI_ERROR (Status)) {\r
+    DEBUG ((EFI_D_ERROR, "Error: Failed to enable MMU\n"));\r
+  }\r
 }\r
 \r
 /*++\r
@@ -74,7 +78,7 @@ MemoryPeim (
   BOOLEAN                     Found;\r
 \r
   // Ensure PcdSystemMemorySize has been set\r
-  ASSERT (PcdGet32 (PcdSystemMemorySize) != 0);\r
+  ASSERT (PcdGet64 (PcdSystemMemorySize) != 0);\r
 \r
   //\r
   // Now, the permanent memory has been installed, we can call AllocatePages()\r
@@ -93,16 +97,16 @@ MemoryPeim (
   BuildResourceDescriptorHob (\r
       EFI_RESOURCE_SYSTEM_MEMORY,\r
       ResourceAttributes,\r
-      PcdGet32 (PcdSystemMemoryBase),\r
-      PcdGet32 (PcdSystemMemorySize)\r
+      PcdGet64 (PcdSystemMemoryBase),\r
+      PcdGet64 (PcdSystemMemorySize)\r
   );\r
 \r
-  SystemMemoryTop = PcdGet32 (PcdSystemMemoryBase) + PcdGet32 (PcdSystemMemorySize);\r
-  FdTop = PcdGet32(PcdFdBaseAddress) + PcdGet32(PcdFdSize);\r
+  SystemMemoryTop = (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemoryBase) + (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemorySize);\r
+  FdTop = (EFI_PHYSICAL_ADDRESS)PcdGet32(PcdFdBaseAddress) + (EFI_PHYSICAL_ADDRESS)PcdGet32(PcdFdSize);\r
 \r
   // EDK2 does not have the concept of boot firmware copied into DRAM. To avoid the DXE\r
   // core to overwrite this area we must mark the region with the attribute non-present\r
-  if ((PcdGet32 (PcdFdBaseAddress) >= PcdGet32 (PcdSystemMemoryBase)) && (FdTop <= SystemMemoryTop)) {\r
+  if ((PcdGet32 (PcdFdBaseAddress) >= PcdGet64 (PcdSystemMemoryBase)) && (FdTop <= SystemMemoryTop)) {\r
     Found = FALSE;\r
 \r
     // Search for System Memory Hob that contains the firmware\r