2 Include file of the NULL memory test driver.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _NULL_MEMORY_TEST_H_
10 #define _NULL_MEMORY_TEST_H_
16 #include <Protocol/GenericMemoryTest.h>
18 #include <Library/DebugLib.h>
19 #include <Library/UefiDriverEntryPoint.h>
20 #include <Library/DxeServicesTableLib.h>
21 #include <Library/UefiBootServicesTableLib.h>
22 #include <Library/MemoryAllocationLib.h>
25 // Definition of memory status.
27 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
28 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
29 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
32 Initialize the generic memory test.
34 This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.MemoryTestInit.
35 It simply promotes untested reserved memory to system memory without real test.
37 @param This Protocol instance pointer.
38 @param Level The coverage level of the memory test.
39 @param RequireSoftECCInit Indicate if the memory need software ECC init.
41 @retval EFI_SUCCESS The generic memory test initialized correctly.
42 @retval EFI_NO_MEDIA There is not any non-tested memory found, in this
43 function if not any non-tesed memory found means
44 that the memory test driver have not detect any
45 non-tested extended memory of current system.
50 InitializeMemoryTest (
51 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL
*This
,
52 IN EXTENDMEM_COVERAGE_LEVEL Level
,
53 OUT BOOLEAN
*RequireSoftECCInit
57 Perform the memory test.
59 This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.PerformMemoryTest.
60 It simply returns EFI_NOT_FOUND.
62 @param This Protocol instance pointer.
63 @param TestedMemorySize Return the tested extended memory size.
64 @param TotalMemorySize Return the whole system physical memory size, this
65 value may be changed if in some case some error
67 @param ErrorOut Any time the memory error occurs, this will be
69 @param IfTestAbort Indicate if the user press "ESC" to skip the memory
72 @retval EFI_SUCCESS One block of memory test ok, the block size is hide
74 @retval EFI_NOT_FOUND Indicate all the non-tested memory blocks have
76 @retval EFI_DEVICE_ERROR Mis-compare error, and no agent can handle it
81 GenPerformMemoryTest (
82 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL
*This
,
83 IN OUT UINT64
*TestedMemorySize
,
84 OUT UINT64
*TotalMemorySize
,
85 OUT BOOLEAN
*ErrorOut
,
90 The memory test finished.
92 This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.Finished.
93 It simply returns EFI_SUCCESS.
95 @param This Protocol instance pointer.
97 @retval EFI_SUCCESS Successful free all the generic memory test driver
98 allocated resource and notify to platform memory
99 test driver that memory test finished.
104 GenMemoryTestFinished (
105 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL
*This
109 Provide capability to test compatible range which used by some special
110 driver required using memory range before BDS perform memory test.
112 This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.CompatibleRangeTest.
113 It simply set the memory range to system memory.
115 @param This Protocol instance pointer.
116 @param StartAddress The start address of the memory range.
117 @param Length The memory range's length.
119 @retval EFI_SUCCESS The compatible memory range pass the memory test.
120 @retval EFI_INVALID_PARAMETER The compatible memory range must be below 16M.
125 GenCompatibleRangeTest (
126 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL
*This
,
127 IN EFI_PHYSICAL_ADDRESS StartAddress
,