]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEbMem.c
ArmPlatformPkg/ArmPlatformLib: Added support for ArmPlatformIsPrimaryCore()
[mirror_edk2.git] / ArmPlatformPkg / ArmRealViewEbPkg / Library / ArmRealViewEbLibRTSM / ArmRealViewEbMem.c
index 616fa0ef8cafcd4863143e3462745b5d786109d3..c7a413dc2e66b6ce688e190b55a03544f2d27d4d 100644 (file)
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/IoLib.h>\r
 \r
+#include <ArmPlatform.h>\r
+\r
 #define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS          6\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
-#define DDR_ATTRIBUTES_SECURE_CACHED    ARM_MEMORY_REGION_ATTRIBUTE_SECURE_WRITE_BACK\r
-#define DDR_ATTRIBUTES_SECURE_UNCACHED  ARM_MEMORY_REGION_ATTRIBUTE_SECURE_UNCACHED_UNBUFFERED\r
 \r
 /**\r
   Return the Virtual Memory Map of your platform\r
@@ -42,21 +42,20 @@ ArmPlatformGetVirtualMemoryMap (
   )\r
 {\r
   UINT32                        CacheAttributes;\r
-  BOOLEAN                       bTrustzoneSupport = FALSE;\r
   UINTN                         Index = 0;\r
   ARM_MEMORY_REGION_DESCRIPTOR  *VirtualMemoryTable;\r
 \r
   ASSERT(VirtualMemoryMap != NULL);\r
 \r
-  VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages(EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS));\r
+  VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages (EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS));\r
   if (VirtualMemoryTable == NULL) {\r
       return;\r
   }\r
 \r
   if (FeaturePcdGet(PcdCacheEnable) == TRUE) {\r
-    CacheAttributes = (bTrustzoneSupport ? DDR_ATTRIBUTES_CACHED : DDR_ATTRIBUTES_SECURE_CACHED);\r
+    CacheAttributes = DDR_ATTRIBUTES_CACHED;\r
   } else {\r
-    CacheAttributes = (bTrustzoneSupport ? DDR_ATTRIBUTES_UNCACHED : DDR_ATTRIBUTES_SECURE_UNCACHED);\r
+    CacheAttributes = DDR_ATTRIBUTES_UNCACHED;\r
   }\r
 \r
   // ReMap (Either NOR Flash or DRAM)\r
@@ -66,22 +65,22 @@ ArmPlatformGetVirtualMemoryMap (
   VirtualMemoryTable[Index].Attributes   = (ARM_MEMORY_REGION_ATTRIBUTES)CacheAttributes;\r
 \r
   // DDR\r
-  VirtualMemoryTable[++Index].PhysicalBase = ARM_EB_DRAM_BASE;\r
-  VirtualMemoryTable[Index].VirtualBase  = ARM_EB_DRAM_BASE;\r
-  VirtualMemoryTable[Index].Length       = ARM_EB_DRAM_SZ;\r
+  VirtualMemoryTable[++Index].PhysicalBase = PcdGet32 (PcdSystemMemoryBase);\r
+  VirtualMemoryTable[Index].VirtualBase  = PcdGet32 (PcdSystemMemoryBase);\r
+  VirtualMemoryTable[Index].Length       = PcdGet32 (PcdSystemMemorySize);\r
   VirtualMemoryTable[Index].Attributes   = (ARM_MEMORY_REGION_ATTRIBUTES)CacheAttributes;\r
 \r
   // SMC CS7\r
   VirtualMemoryTable[++Index].PhysicalBase = ARM_EB_SMB_MB_ON_CHIP_PERIPH_BASE;\r
   VirtualMemoryTable[Index].VirtualBase  = ARM_EB_SMB_MB_ON_CHIP_PERIPH_BASE;\r
   VirtualMemoryTable[Index].Length       = ARM_EB_SMB_MB_ON_CHIP_PERIPH_SZ;\r
-  VirtualMemoryTable[Index].Attributes   = (bTrustzoneSupport ? ARM_MEMORY_REGION_ATTRIBUTE_DEVICE : ARM_MEMORY_REGION_ATTRIBUTE_SECURE_DEVICE);\r
+  VirtualMemoryTable[Index].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;\r
 \r
   // SMB CS0-CS1 - NOR Flash 1 & 2\r
   VirtualMemoryTable[++Index].PhysicalBase = ARM_EB_SMB_NOR_BASE;\r
   VirtualMemoryTable[Index].VirtualBase  = ARM_EB_SMB_NOR_BASE;\r
   VirtualMemoryTable[Index].Length       = ARM_EB_SMB_NOR_SZ + ARM_EB_SMB_DOC_SZ;\r
-  VirtualMemoryTable[Index].Attributes   = (bTrustzoneSupport ? ARM_MEMORY_REGION_ATTRIBUTE_DEVICE : ARM_MEMORY_REGION_ATTRIBUTE_SECURE_DEVICE);\r
+  VirtualMemoryTable[Index].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;\r
 \r
   // SMB CS2 - SRAM\r
   VirtualMemoryTable[++Index].PhysicalBase = ARM_EB_SMB_SRAM_BASE;\r
@@ -93,14 +92,14 @@ ArmPlatformGetVirtualMemoryMap (
   VirtualMemoryTable[++Index].PhysicalBase = ARM_EB_SMB_PERIPH_BASE;\r
   VirtualMemoryTable[Index].VirtualBase  = ARM_EB_SMB_PERIPH_BASE;\r
   VirtualMemoryTable[Index].Length       = ARM_EB_SMB_PERIPH_SZ;\r
-  VirtualMemoryTable[Index].Attributes   = (bTrustzoneSupport ? ARM_MEMORY_REGION_ATTRIBUTE_DEVICE : ARM_MEMORY_REGION_ATTRIBUTE_SECURE_DEVICE);\r
+  VirtualMemoryTable[Index].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;\r
 \r
   // If a Logic Tile is connected to The ARM Versatile Express Motherboard\r
   if (MmioRead32(ARM_EB_SYS_PROCID1_REG) != 0) {\r
       VirtualMemoryTable[++Index].PhysicalBase = ARM_EB_LOGIC_TILE_BASE;\r
       VirtualMemoryTable[Index].VirtualBase  = ARM_EB_LOGIC_TILE_BASE;\r
       VirtualMemoryTable[Index].Length       = ARM_EB_LOGIC_TILE_SZ;\r
-      VirtualMemoryTable[Index].Attributes   = (bTrustzoneSupport ? ARM_MEMORY_REGION_ATTRIBUTE_DEVICE : ARM_MEMORY_REGION_ATTRIBUTE_SECURE_DEVICE);\r
+      VirtualMemoryTable[Index].Attributes   = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE;\r
 \r
       ASSERT((Index + 1) == (MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS + 1));\r
   } else {\r
@@ -115,21 +114,3 @@ ArmPlatformGetVirtualMemoryMap (
 \r
   *VirtualMemoryMap = VirtualMemoryTable;\r
 }\r
-\r
-/**\r
-  Return the EFI Memory Map of your platform\r
-\r
-  This EFI Memory Map of the System Memory is used by MemoryInitPei module to create the Resource\r
-  Descriptor HOBs used by DXE core.\r
-\r
-  @param[out]   EfiMemoryMap        Array of ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR describing an\r
-                                    EFI Memory region. This array must be ended by a zero-filled entry\r
-\r
-**/\r
-EFI_STATUS\r
-ArmPlatformGetAdditionalSystemMemory (\r
-  OUT ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR** EfiMemoryMap\r
-  )\r
-{\r
-  return EFI_UNSUPPORTED;\r
-}\r