]> git.proxmox.com Git - mirror_edk2.git/blame - StandaloneMmPkg/Library/StandaloneMmMemLib/ArmStandaloneMmMemLibInternal.c
StandaloneMmPkg: build for 32bit arm machines
[mirror_edk2.git] / StandaloneMmPkg / Library / StandaloneMmMemLib / ArmStandaloneMmMemLibInternal.c
CommitLineData
880086a2
SV
1/** @file\r
2 Internal ARCH Specific file of MM memory check library.\r
3\r
4 MM memory check library implementation. This library consumes MM_ACCESS_PROTOCOL\r
5 to get MMRAM information. In order to use this library instance, the platform should produce\r
6 all MMRAM range via MM_ACCESS_PROTOCOL, including the range for firmware (like MM Core\r
7 and MM driver) and/or specific dedicated hardware.\r
8\r
9 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
10 Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.<BR>\r
11\r
86094561 12 SPDX-License-Identifier: BSD-2-Clause-Patent\r
880086a2
SV
13\r
14**/\r
15#include <Library/BaseLib.h>\r
16#include <Library/BaseMemoryLib.h>\r
17#include <Library/DebugLib.h>\r
18//\r
19// Maximum support address used to check input buffer\r
20//\r
21extern EFI_PHYSICAL_ADDRESS mMmMemLibInternalMaximumSupportAddress;\r
22\r
a776bbab
EC
23#ifdef MDE_CPU_AARCH64\r
24#define ARM_PHYSICAL_ADDRESS_BITS 36\r
25#endif\r
26#ifdef MDE_CPU_ARM\r
27#define ARM_PHYSICAL_ADDRESS_BITS 32\r
28#endif\r
29\r
880086a2
SV
30/**\r
31 Calculate and save the maximum support address.\r
32\r
33**/\r
34VOID\r
35MmMemLibInternalCalculateMaximumSupportAddress (\r
36 VOID\r
37 )\r
38{\r
39 UINT8 PhysicalAddressBits;\r
40\r
a776bbab 41 PhysicalAddressBits = ARM_PHYSICAL_ADDRESS_BITS;\r
880086a2
SV
42\r
43 //\r
44 // Save the maximum support address in one global variable\r
45 //\r
46 mMmMemLibInternalMaximumSupportAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)(LShiftU64 (1, PhysicalAddressBits) - 1);\r
47 DEBUG ((DEBUG_INFO, "mMmMemLibInternalMaximumSupportAddress = 0x%lx\n", mMmMemLibInternalMaximumSupportAddress));\r
48}\r
49\r
037ccb09
KQ
50/**\r
51 Initialize cached Mmram Ranges from HOB.\r
52\r
53 @retval EFI_UNSUPPORTED The routine is unable to extract MMRAM information.\r
54 @retval EFI_SUCCESS MmRanges are populated successfully.\r
55\r
56**/\r
57EFI_STATUS\r
58MmMemLibInternalPopulateMmramRanges (\r
59 VOID\r
60 )\r
61{\r
62 // Not implemented for AARCH64.\r
63 return EFI_SUCCESS;\r
64}\r
65\r
66/**\r
67 Deinitialize cached Mmram Ranges.\r
68\r
69**/\r
70VOID\r
71MmMemLibInternalFreeMmramRanges (\r
72 VOID\r
73 )\r
74{\r
75 // Not implemented for AARCH64.\r
76}\r
880086a2 77\r