MdeModulePkg/NullMemoryTest: Change prototype of ConvertToTestedMemory

The patch should not impact the functionality.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Ruiyu Ni
2018-03-06 11:04:27 +08:00
parent 5e3719aeae
commit ee37e96479

View File

@ -59,37 +59,40 @@ GenericMemoryTestEntryPoint (
} }
/** /**
Convert the memory descriptor to tested. Convert the memory range to tested.
@param Descriptor Pointer to EFI_GCD_MEMORY_SPACE_DESCRIPTOR @param BaseAddress Base address of the memory range.
@param Length Length of the memory range.
@param Capabilities Capabilities of the memory range.
@retval EFI_SUCCESS The memory descriptor is converted to tested. @retval EFI_SUCCESS The memory range is converted to tested.
@retval others Error happens. @retval others Error happens.
**/ **/
EFI_STATUS EFI_STATUS
ConvertToTestedMemory ( ConvertToTestedMemory (
IN CONST EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor IN UINT64 BaseAddress,
IN UINT64 Length,
IN UINT64 Capabilities
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
Status = gDS->RemoveMemorySpace ( Status = gDS->RemoveMemorySpace (
Descriptor->BaseAddress, BaseAddress,
Descriptor->Length Length
); );
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
Status = gDS->AddMemorySpace ( Status = gDS->AddMemorySpace (
((Descriptor->Capabilities & EFI_MEMORY_MORE_RELIABLE) == EFI_MEMORY_MORE_RELIABLE) ? ((Capabilities & EFI_MEMORY_MORE_RELIABLE) == EFI_MEMORY_MORE_RELIABLE) ?
EfiGcdMemoryTypeMoreReliable : EfiGcdMemoryTypeSystemMemory, EfiGcdMemoryTypeMoreReliable : EfiGcdMemoryTypeSystemMemory,
Descriptor->BaseAddress, BaseAddress,
Descriptor->Length, Length,
Descriptor->Capabilities &~ Capabilities &~
(EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME) (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME)
); );
} }
return Status; return Status;
} }
/** /**
Initialize the generic memory test. Initialize the generic memory test.
@ -129,7 +132,11 @@ InitializeMemoryTest (
// //
// For those reserved memory that have not been tested, simply promote to system memory. // For those reserved memory that have not been tested, simply promote to system memory.
// //
Status = ConvertToTestedMemory (&MemorySpaceMap[Index]); Status = ConvertToTestedMemory (
MemorySpaceMap[Index].BaseAddress,
MemorySpaceMap[Index].Length,
MemorySpaceMap[Index].Capabilities
);
ASSERT_EFI_ERROR (Status); ASSERT_EFI_ERROR (Status);
mTestedSystemMemory += MemorySpaceMap[Index].Length; mTestedSystemMemory += MemorySpaceMap[Index].Length;
mTotalSystemMemory += MemorySpaceMap[Index].Length; mTotalSystemMemory += MemorySpaceMap[Index].Length;
@ -236,7 +243,11 @@ GenCompatibleRangeTest (
Status = gDS->GetMemorySpaceDescriptor (StartAddress, &Descriptor); Status = gDS->GetMemorySpaceDescriptor (StartAddress, &Descriptor);
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
Status = ConvertToTestedMemory (&Descriptor); Status = ConvertToTestedMemory (
Descriptor.BaseAddress,
Descriptor.Length,
Descriptor.Capabilities
);
} }
return Status; return Status;
} }