]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg: fix StandaloneMmMmuLib subdirectory case
authorLeif Lindholm <leif.lindholm@linaro.org>
Tue, 27 Nov 2018 12:23:50 +0000 (12:23 +0000)
committerLeif Lindholm <leif.lindholm@linaro.org>
Tue, 27 Nov 2018 13:00:45 +0000 (13:00 +0000)
While this isn't the only Aarch64 directory in the tree, let's
keep from adding more of them.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c [new file with mode: 0644]
ArmPkg/Library/StandaloneMmMmuLib/Aarch64/ArmMmuStandaloneMmLib.c [deleted file]
ArmPkg/Library/StandaloneMmMmuLib/ArmMmuStandaloneMmLib.inf

diff --git a/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c b/ArmPkg/Library/StandaloneMmMmuLib/AArch64/ArmMmuStandaloneMmLib.c
new file mode 100644 (file)
index 0000000..3095d71
--- /dev/null
@@ -0,0 +1,185 @@
+/** @file\r
+*  File managing the MMU for ARMv8 architecture in S-EL0\r
+*\r
+*  Copyright (c) 2017 - 2018, 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 <Uefi.h>\r
+#include <IndustryStandard/ArmMmSvc.h>\r
+\r
+#include <Library/ArmLib.h>\r
+#include <Library/ArmMmuLib.h>\r
+#include <Library/ArmSvcLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+STATIC\r
+EFI_STATUS\r
+GetMemoryPermissions (\r
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,\r
+  OUT UINT32                    *MemoryAttributes\r
+  )\r
+{\r
+  ARM_SVC_ARGS  GetMemoryPermissionsSvcArgs = {0};\r
+\r
+  GetMemoryPermissionsSvcArgs.Arg0 = ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64;\r
+  GetMemoryPermissionsSvcArgs.Arg1 = BaseAddress;\r
+  GetMemoryPermissionsSvcArgs.Arg2 = 0;\r
+  GetMemoryPermissionsSvcArgs.Arg3 = 0;\r
+\r
+  ArmCallSvc (&GetMemoryPermissionsSvcArgs);\r
+  if (GetMemoryPermissionsSvcArgs.Arg0 == ARM_SVC_SPM_RET_INVALID_PARAMS) {\r
+    *MemoryAttributes = 0;\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  *MemoryAttributes = GetMemoryPermissionsSvcArgs.Arg0;\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+STATIC\r
+EFI_STATUS\r
+RequestMemoryPermissionChange (\r
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,\r
+  IN  UINT64                    Length,\r
+  IN  UINTN                     Permissions\r
+  )\r
+{\r
+  EFI_STATUS    Status;\r
+  ARM_SVC_ARGS  ChangeMemoryPermissionsSvcArgs = {0};\r
+\r
+  ChangeMemoryPermissionsSvcArgs.Arg0 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64;\r
+  ChangeMemoryPermissionsSvcArgs.Arg1 = BaseAddress;\r
+  ChangeMemoryPermissionsSvcArgs.Arg2 = EFI_SIZE_TO_PAGES(Length);\r
+  ChangeMemoryPermissionsSvcArgs.Arg3 = Permissions;\r
+\r
+  ArmCallSvc (&ChangeMemoryPermissionsSvcArgs);\r
+\r
+  Status = ChangeMemoryPermissionsSvcArgs.Arg0;\r
+\r
+  switch (Status) {\r
+  case ARM_SVC_SPM_RET_SUCCESS:\r
+    Status = EFI_SUCCESS;\r
+    break;\r
+\r
+  case ARM_SVC_SPM_RET_NOT_SUPPORTED:\r
+    Status = EFI_UNSUPPORTED;\r
+    break;\r
+\r
+  case ARM_SVC_SPM_RET_INVALID_PARAMS:\r
+    Status = EFI_INVALID_PARAMETER;\r
+    break;\r
+\r
+  case ARM_SVC_SPM_RET_DENIED:\r
+    Status = EFI_ACCESS_DENIED;\r
+    break;\r
+\r
+  case ARM_SVC_SPM_RET_NO_MEMORY:\r
+    Status = EFI_BAD_BUFFER_SIZE;\r
+    break;\r
+\r
+  default:\r
+    Status = EFI_ACCESS_DENIED;\r
+    ASSERT (0);\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+EFI_STATUS\r
+ArmSetMemoryRegionNoExec (\r
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,\r
+  IN  UINT64                    Length\r
+  )\r
+{\r
+  EFI_STATUS    Status;\r
+  UINT32 MemoryAttributes;\r
+  UINT32 CodePermission;\r
+\r
+  Status = GetMemoryPermissions (BaseAddress, &MemoryAttributes);\r
+  if (Status != EFI_INVALID_PARAMETER) {\r
+    CodePermission = SET_MEM_ATTR_CODE_PERM_XN << SET_MEM_ATTR_CODE_PERM_SHIFT;\r
+    return RequestMemoryPermissionChange (\r
+             BaseAddress,\r
+             Length,\r
+             MemoryAttributes | CodePermission\r
+             );\r
+  }\r
+  return EFI_INVALID_PARAMETER;\r
+}\r
+\r
+EFI_STATUS\r
+ArmClearMemoryRegionNoExec (\r
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,\r
+  IN  UINT64                    Length\r
+  )\r
+{\r
+  EFI_STATUS    Status;\r
+  UINT32 MemoryAttributes;\r
+  UINT32 CodePermission;\r
+\r
+  Status = GetMemoryPermissions (BaseAddress, &MemoryAttributes);\r
+  if (Status != EFI_INVALID_PARAMETER) {\r
+    CodePermission = SET_MEM_ATTR_CODE_PERM_XN << SET_MEM_ATTR_CODE_PERM_SHIFT;\r
+    return RequestMemoryPermissionChange (\r
+             BaseAddress,\r
+             Length,\r
+             MemoryAttributes & ~CodePermission\r
+             );\r
+  }\r
+  return EFI_INVALID_PARAMETER;\r
+}\r
+\r
+EFI_STATUS\r
+ArmSetMemoryRegionReadOnly (\r
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,\r
+  IN  UINT64                    Length\r
+  )\r
+{\r
+  EFI_STATUS    Status;\r
+  UINT32 MemoryAttributes;\r
+  UINT32 DataPermission;\r
+\r
+  Status = GetMemoryPermissions (BaseAddress, &MemoryAttributes);\r
+  if (Status != EFI_INVALID_PARAMETER) {\r
+    DataPermission = SET_MEM_ATTR_DATA_PERM_RO << SET_MEM_ATTR_DATA_PERM_SHIFT;\r
+    return RequestMemoryPermissionChange (\r
+             BaseAddress,\r
+             Length,\r
+             MemoryAttributes | DataPermission\r
+             );\r
+  }\r
+  return EFI_INVALID_PARAMETER;\r
+}\r
+\r
+EFI_STATUS\r
+ArmClearMemoryRegionReadOnly (\r
+  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,\r
+  IN  UINT64                    Length\r
+  )\r
+{\r
+  EFI_STATUS    Status;\r
+  UINT32 MemoryAttributes;\r
+  UINT32 PermissionRequest;\r
+\r
+  Status = GetMemoryPermissions (BaseAddress, &MemoryAttributes);\r
+  if (Status != EFI_INVALID_PARAMETER) {\r
+    PermissionRequest = SET_MEM_ATTR_MAKE_PERM_REQUEST (SET_MEM_ATTR_DATA_PERM_RW,\r
+                                                        MemoryAttributes);\r
+    return RequestMemoryPermissionChange (\r
+             BaseAddress,\r
+             Length,\r
+             PermissionRequest\r
+             );\r
+  }\r
+  return EFI_INVALID_PARAMETER;\r
+}\r
diff --git a/ArmPkg/Library/StandaloneMmMmuLib/Aarch64/ArmMmuStandaloneMmLib.c b/ArmPkg/Library/StandaloneMmMmuLib/Aarch64/ArmMmuStandaloneMmLib.c
deleted file mode 100644 (file)
index 3095d71..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-/** @file\r
-*  File managing the MMU for ARMv8 architecture in S-EL0\r
-*\r
-*  Copyright (c) 2017 - 2018, 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 <Uefi.h>\r
-#include <IndustryStandard/ArmMmSvc.h>\r
-\r
-#include <Library/ArmLib.h>\r
-#include <Library/ArmMmuLib.h>\r
-#include <Library/ArmSvcLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/DebugLib.h>\r
-\r
-STATIC\r
-EFI_STATUS\r
-GetMemoryPermissions (\r
-  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,\r
-  OUT UINT32                    *MemoryAttributes\r
-  )\r
-{\r
-  ARM_SVC_ARGS  GetMemoryPermissionsSvcArgs = {0};\r
-\r
-  GetMemoryPermissionsSvcArgs.Arg0 = ARM_SVC_ID_SP_GET_MEM_ATTRIBUTES_AARCH64;\r
-  GetMemoryPermissionsSvcArgs.Arg1 = BaseAddress;\r
-  GetMemoryPermissionsSvcArgs.Arg2 = 0;\r
-  GetMemoryPermissionsSvcArgs.Arg3 = 0;\r
-\r
-  ArmCallSvc (&GetMemoryPermissionsSvcArgs);\r
-  if (GetMemoryPermissionsSvcArgs.Arg0 == ARM_SVC_SPM_RET_INVALID_PARAMS) {\r
-    *MemoryAttributes = 0;\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  *MemoryAttributes = GetMemoryPermissionsSvcArgs.Arg0;\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-STATIC\r
-EFI_STATUS\r
-RequestMemoryPermissionChange (\r
-  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,\r
-  IN  UINT64                    Length,\r
-  IN  UINTN                     Permissions\r
-  )\r
-{\r
-  EFI_STATUS    Status;\r
-  ARM_SVC_ARGS  ChangeMemoryPermissionsSvcArgs = {0};\r
-\r
-  ChangeMemoryPermissionsSvcArgs.Arg0 = ARM_SVC_ID_SP_SET_MEM_ATTRIBUTES_AARCH64;\r
-  ChangeMemoryPermissionsSvcArgs.Arg1 = BaseAddress;\r
-  ChangeMemoryPermissionsSvcArgs.Arg2 = EFI_SIZE_TO_PAGES(Length);\r
-  ChangeMemoryPermissionsSvcArgs.Arg3 = Permissions;\r
-\r
-  ArmCallSvc (&ChangeMemoryPermissionsSvcArgs);\r
-\r
-  Status = ChangeMemoryPermissionsSvcArgs.Arg0;\r
-\r
-  switch (Status) {\r
-  case ARM_SVC_SPM_RET_SUCCESS:\r
-    Status = EFI_SUCCESS;\r
-    break;\r
-\r
-  case ARM_SVC_SPM_RET_NOT_SUPPORTED:\r
-    Status = EFI_UNSUPPORTED;\r
-    break;\r
-\r
-  case ARM_SVC_SPM_RET_INVALID_PARAMS:\r
-    Status = EFI_INVALID_PARAMETER;\r
-    break;\r
-\r
-  case ARM_SVC_SPM_RET_DENIED:\r
-    Status = EFI_ACCESS_DENIED;\r
-    break;\r
-\r
-  case ARM_SVC_SPM_RET_NO_MEMORY:\r
-    Status = EFI_BAD_BUFFER_SIZE;\r
-    break;\r
-\r
-  default:\r
-    Status = EFI_ACCESS_DENIED;\r
-    ASSERT (0);\r
-  }\r
-\r
-  return Status;\r
-}\r
-\r
-EFI_STATUS\r
-ArmSetMemoryRegionNoExec (\r
-  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,\r
-  IN  UINT64                    Length\r
-  )\r
-{\r
-  EFI_STATUS    Status;\r
-  UINT32 MemoryAttributes;\r
-  UINT32 CodePermission;\r
-\r
-  Status = GetMemoryPermissions (BaseAddress, &MemoryAttributes);\r
-  if (Status != EFI_INVALID_PARAMETER) {\r
-    CodePermission = SET_MEM_ATTR_CODE_PERM_XN << SET_MEM_ATTR_CODE_PERM_SHIFT;\r
-    return RequestMemoryPermissionChange (\r
-             BaseAddress,\r
-             Length,\r
-             MemoryAttributes | CodePermission\r
-             );\r
-  }\r
-  return EFI_INVALID_PARAMETER;\r
-}\r
-\r
-EFI_STATUS\r
-ArmClearMemoryRegionNoExec (\r
-  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,\r
-  IN  UINT64                    Length\r
-  )\r
-{\r
-  EFI_STATUS    Status;\r
-  UINT32 MemoryAttributes;\r
-  UINT32 CodePermission;\r
-\r
-  Status = GetMemoryPermissions (BaseAddress, &MemoryAttributes);\r
-  if (Status != EFI_INVALID_PARAMETER) {\r
-    CodePermission = SET_MEM_ATTR_CODE_PERM_XN << SET_MEM_ATTR_CODE_PERM_SHIFT;\r
-    return RequestMemoryPermissionChange (\r
-             BaseAddress,\r
-             Length,\r
-             MemoryAttributes & ~CodePermission\r
-             );\r
-  }\r
-  return EFI_INVALID_PARAMETER;\r
-}\r
-\r
-EFI_STATUS\r
-ArmSetMemoryRegionReadOnly (\r
-  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,\r
-  IN  UINT64                    Length\r
-  )\r
-{\r
-  EFI_STATUS    Status;\r
-  UINT32 MemoryAttributes;\r
-  UINT32 DataPermission;\r
-\r
-  Status = GetMemoryPermissions (BaseAddress, &MemoryAttributes);\r
-  if (Status != EFI_INVALID_PARAMETER) {\r
-    DataPermission = SET_MEM_ATTR_DATA_PERM_RO << SET_MEM_ATTR_DATA_PERM_SHIFT;\r
-    return RequestMemoryPermissionChange (\r
-             BaseAddress,\r
-             Length,\r
-             MemoryAttributes | DataPermission\r
-             );\r
-  }\r
-  return EFI_INVALID_PARAMETER;\r
-}\r
-\r
-EFI_STATUS\r
-ArmClearMemoryRegionReadOnly (\r
-  IN  EFI_PHYSICAL_ADDRESS      BaseAddress,\r
-  IN  UINT64                    Length\r
-  )\r
-{\r
-  EFI_STATUS    Status;\r
-  UINT32 MemoryAttributes;\r
-  UINT32 PermissionRequest;\r
-\r
-  Status = GetMemoryPermissions (BaseAddress, &MemoryAttributes);\r
-  if (Status != EFI_INVALID_PARAMETER) {\r
-    PermissionRequest = SET_MEM_ATTR_MAKE_PERM_REQUEST (SET_MEM_ATTR_DATA_PERM_RW,\r
-                                                        MemoryAttributes);\r
-    return RequestMemoryPermissionChange (\r
-             BaseAddress,\r
-             Length,\r
-             PermissionRequest\r
-             );\r
-  }\r
-  return EFI_INVALID_PARAMETER;\r
-}\r
index d589b236033c4ab72cdc41ebfbc75003c7c2147d..7219b59e6f2901d017af728b152a1c8e495de241 100644 (file)
@@ -22,7 +22,7 @@
   PI_SPECIFICATION_VERSION       = 0x00010032\r
 \r
 [Sources.AARCH64]\r
-  Aarch64/ArmMmuStandaloneMmLib.c\r
+  AArch64/ArmMmuStandaloneMmLib.c\r
 \r
 [Packages]\r
   ArmPkg/ArmPkg.dec\r