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_
14 #include <Protocol/GenericMemoryTest.h>
16 #include <Library/DebugLib.h>
17 #include <Library/UefiDriverEntryPoint.h>
18 #include <Library/DxeServicesTableLib.h>
19 #include <Library/UefiBootServicesTableLib.h>
20 #include <Library/MemoryAllocationLib.h>
23 // Definition of memory status.
25 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
26 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
27 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
30 Initialize the generic memory test.
32 This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.MemoryTestInit.
33 It simply promotes untested reserved memory to system memory without real test.
35 @param This Protocol instance pointer.
36 @param Level The coverage level of the memory test.
37 @param RequireSoftECCInit Indicate if the memory need software ECC init.
39 @retval EFI_SUCCESS The generic memory test initialized correctly.
40 @retval EFI_NO_MEDIA There is not any non-tested memory found, in this
41 function if not any non-tesed memory found means
42 that the memory test driver have not detect any
43 non-tested extended memory of current system.
48 InitializeMemoryTest (
49 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL
*This
,
50 IN EXTENDMEM_COVERAGE_LEVEL Level
,
51 OUT BOOLEAN
*RequireSoftECCInit
55 Perform the memory test.
57 This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.PerformMemoryTest.
58 It simply returns EFI_NOT_FOUND.
60 @param This Protocol instance pointer.
61 @param TestedMemorySize Return the tested extended memory size.
62 @param TotalMemorySize Return the whole system physical memory size, this
63 value may be changed if in some case some error
65 @param ErrorOut Any time the memory error occurs, this will be
67 @param IfTestAbort Indicate if the user press "ESC" to skip the memory
70 @retval EFI_SUCCESS One block of memory test ok, the block size is hide
72 @retval EFI_NOT_FOUND Indicate all the non-tested memory blocks have
74 @retval EFI_DEVICE_ERROR Mis-compare error, and no agent can handle it
79 GenPerformMemoryTest (
80 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL
*This
,
81 IN OUT UINT64
*TestedMemorySize
,
82 OUT UINT64
*TotalMemorySize
,
83 OUT BOOLEAN
*ErrorOut
,
88 The memory test finished.
90 This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.Finished.
91 It simply returns EFI_SUCCESS.
93 @param This Protocol instance pointer.
95 @retval EFI_SUCCESS Successful free all the generic memory test driver
96 allocated resource and notify to platform memory
97 test driver that memory test finished.
102 GenMemoryTestFinished (
103 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL
*This
107 Provide capability to test compatible range which used by some special
108 driver required using memory range before BDS perform memory test.
110 This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.CompatibleRangeTest.
111 It simply set the memory range to system memory.
113 @param This Protocol instance pointer.
114 @param StartAddress The start address of the memory range.
115 @param Length The memory range's length.
117 @retval EFI_SUCCESS The compatible memory range pass the memory test.
118 @retval EFI_INVALID_PARAMETER The compatible memory range must be below 16M.
123 GenCompatibleRangeTest (
124 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL
*This
,
125 IN EFI_PHYSICAL_ADDRESS StartAddress
,