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