27UINTN mValidNonMmramCount;
45 UINT8 PhysicalAddressBits;
52 PhysicalAddressBits = ((
EFI_HOB_CPU *)Hob)->SizeOfMemorySpace;
55 if (RegEax >= 0x80000008) {
57 PhysicalAddressBits = (UINT8)RegEax;
59 PhysicalAddressBits = 36;
66 ASSERT (PhysicalAddressBits <= 52);
67 if (PhysicalAddressBits > 48) {
68 PhysicalAddressBits = 48;
75 DEBUG ((DEBUG_INFO,
"mMmMemLibInternalMaximumSupportAddress = 0x%lx\n", mMmMemLibInternalMaximumSupportAddress));
101 MemoryRangeEntry = MemoryRange;
102 NewMemoryRangeEntry = MemoryRange;
104 while ((
UINTN)MemoryRangeEntry < (
UINTN)MemoryRangeEnd) {
105 NextMemoryRangeEntry = MemoryRangeEntry + 1;
108 if (((
UINTN)NextMemoryRangeEntry < (
UINTN)MemoryRangeEnd) &&
109 ((MemoryRangeEntry->Base + MemoryRangeEntry->Length) >= NextMemoryRangeEntry->Base))
115 MemoryRangeEntry->Base + MemoryRangeEntry->Length,
116 NextMemoryRangeEntry->Base + NextMemoryRangeEntry->Length
118 MemoryRangeEntry->Length = End - MemoryRangeEntry->Base;
120 NextMemoryRangeEntry++;
131 MemoryRangeEntry = NextMemoryRangeEntry;
132 NewMemoryRangeEntry++;
135 *MemoryRangeSize = (
UINTN)NewMemoryRangeEntry - (
UINTN)MemoryRange;
179 mValidNonMmramRanges =
NULL;
180 mValidNonMmramCount = 0;
189 Hob.Raw =
GetFirstHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR);
190 while (Hob.Raw !=
NULL) {
192 Hob.Raw = GET_NEXT_HOB (Hob);
193 Hob.Raw =
GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, Hob.Raw);
201 ASSERT (mValidNonMmramRanges !=
NULL);
203 Hob.Raw =
GetFirstHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR);
204 while (Hob.Raw !=
NULL) {
205 mValidNonMmramRanges[Index].Base = Hob.ResourceDescriptor->
PhysicalStart;
206 mValidNonMmramRanges[Index].Length = Hob.ResourceDescriptor->
ResourceLength;
209 Hob.Raw = GET_NEXT_HOB (Hob);
210 Hob.Raw =
GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, Hob.Raw);
213 ASSERT (Index == Count);
236 if (mValidNonMmramRanges !=
NULL) {
258 for (Index = 0; Index < mValidNonMmramCount; Index++) {
259 if ((Buffer >= mValidNonMmramRanges[Index].Base) &&
260 (Buffer + Length <= mValidNonMmramRanges[Index].Base + mValidNonMmramRanges[Index].Length))
VOID *EFIAPI GetFirstHob(IN UINT16 Type)
VOID *EFIAPI GetNextHob(IN UINT16 Type, IN CONST VOID *HobStart)
INTN(EFIAPI * BASE_SORT_COMPARE)(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
VOID EFIAPI QuickSort(IN OUT VOID *BufferToSort, IN CONST UINTN Count, IN CONST UINTN ElementSize, IN BASE_SORT_COMPARE CompareFunction, OUT VOID *BufferOneElement)
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define DEBUG(Expression)
UINT32 EFIAPI AsmCpuid(IN UINT32 Index, OUT UINT32 *RegisterEax OPTIONAL, OUT UINT32 *RegisterEbx OPTIONAL, OUT UINT32 *RegisterEcx OPTIONAL, OUT UINT32 *RegisterEdx OPTIONAL)
UINT64 EFI_PHYSICAL_ADDRESS
INTN EFIAPI NonMmMapCompare(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
BOOLEAN MmMemLibIsValidNonMmramRange(IN EFI_PHYSICAL_ADDRESS Buffer, IN UINT64 Length)
VOID MmMemLibInitializeValidNonMmramRanges(VOID)
VOID MmMemLibFreeValidNonMmramRanges(VOID)
STATIC VOID MergeOverlappedOrContinuousRanges(IN OUT NON_MM_MEMORY_RANGE *MemoryRange, IN OUT UINTN *MemoryRangeSize)
VOID MmMemLibCalculateMaximumSupportAddress(VOID)
EFI_PHYSICAL_ADDRESS PhysicalStart