11UINT64 mTestedSystemMemory = 0;
12UINT64 mTotalSystemMemory = 0;
43 Status =
gBS->InstallProtocolInterface (
44 &mGenericMemoryTestHandle,
45 &gEfiGenericMemTestProtocolGuid,
66 IN UINT64 BaseAddress,
68 IN UINT64 Capabilities
73 Status =
gDS->RemoveMemorySpace (
77 if (!EFI_ERROR (Status)) {
78 Status =
gDS->AddMemorySpace (
79 ((Capabilities & EFI_MEMORY_MORE_RELIABLE) == EFI_MEMORY_MORE_RELIABLE) ?
84 (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME)
113 OUT BOOLEAN *RequireSoftECCInit
117 UINTN NumberOfDescriptors;
121 gDS->GetMemorySpaceMap (&NumberOfDescriptors, &MemorySpaceMap);
122 for (Index = 0; Index < NumberOfDescriptors; Index++) {
124 ((MemorySpaceMap[Index].Capabilities & (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED)) ==
125 (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED))
132 MemorySpaceMap[Index].BaseAddress,
133 MemorySpaceMap[Index].Length,
134 MemorySpaceMap[Index].Capabilities
137 mTestedSystemMemory += MemorySpaceMap[Index].
Length;
138 mTotalSystemMemory += MemorySpaceMap[Index].
Length;
142 mTotalSystemMemory += MemorySpaceMap[Index].
Length;
148 *RequireSoftECCInit =
FALSE;
179 IN OUT UINT64 *TestedMemorySize,
180 OUT UINT64 *TotalMemorySize,
181 OUT BOOLEAN *ErrorOut,
186 *TestedMemorySize = mTestedSystemMemory;
187 *TotalMemorySize = mTotalSystemMemory;
189 return EFI_NOT_FOUND;
240 UINT64 CurrentLength;
245 if (StartAddress + Length > SIZE_16MB) {
246 return EFI_INVALID_PARAMETER;
249 CurrentBase = StartAddress;
255 Status =
gDS->GetMemorySpaceDescriptor (
259 if (EFI_ERROR (Status)) {
264 ((Descriptor.
Capabilities & (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED)) ==
265 (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED))
269 if (CurrentBase + CurrentLength > StartAddress + Length) {
270 CurrentLength = StartAddress + Length - CurrentBase;
278 if (EFI_ERROR (Status)) {
284 }
while (CurrentBase < StartAddress + Length);
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ASSERT_EFI_ERROR(StatusParameter)
EFI_STATUS EFIAPI GenPerformMemoryTest(IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This, IN OUT UINT64 *TestedMemorySize, OUT UINT64 *TotalMemorySize, OUT BOOLEAN *ErrorOut, IN BOOLEAN TestAbort)
EFI_STATUS EFIAPI InitializeMemoryTest(IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This, IN EXTENDMEM_COVERAGE_LEVEL Level, OUT BOOLEAN *RequireSoftECCInit)
EFI_STATUS ConvertToTestedMemory(IN UINT64 BaseAddress, IN UINT64 Length, IN UINT64 Capabilities)
EFI_STATUS EFIAPI GenericMemoryTestEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI GenMemoryTestFinished(IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This)
EFI_STATUS EFIAPI GenCompatibleRangeTest(IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS StartAddress, IN UINT64 Length)
@ EfiGcdMemoryTypeReserved
@ EfiGcdMemoryTypeMoreReliable
@ EfiGcdMemoryTypeSystemMemory
UINT64 EFI_PHYSICAL_ADDRESS
EFI_GCD_MEMORY_TYPE GcdMemoryType
EFI_PHYSICAL_ADDRESS BaseAddress