2 Include file of the NULL memory test driver.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _NULL_MEMORY_TEST_H_
16 #define _NULL_MEMORY_TEST_H_
22 #include <Protocol/GenericMemoryTest.h>
24 #include <Library/DebugLib.h>
25 #include <Library/UefiDriverEntryPoint.h>
26 #include <Library/DxeServicesTableLib.h>
27 #include <Library/UefiBootServicesTableLib.h>
28 #include <Library/MemoryAllocationLib.h>
31 // Definition of memory status.
33 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
34 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
35 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
38 Initialize the generic memory test.
40 This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.MemoryTestInit.
41 It simply promotes untested reserved memory to system memory without real test.
43 @param This Protocol instance pointer.
44 @param Level The coverage level of the memory test.
45 @param RequireSoftECCInit Indicate if the memory need software ECC init.
47 @retval EFI_SUCCESS The generic memory test initialized correctly.
48 @retval EFI_NO_MEDIA There is not any non-tested memory found, in this
49 function if not any non-tesed memory found means
50 that the memory test driver have not detect any
51 non-tested extended memory of current system.
56 InitializeMemoryTest (
57 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL
*This
,
58 IN EXTENDMEM_COVERAGE_LEVEL Level
,
59 OUT BOOLEAN
*RequireSoftECCInit
63 Perform the memory test.
65 This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.PerformMemoryTest.
66 It simply returns EFI_NOT_FOUND.
68 @param This Protocol instance pointer.
69 @param TestedMemorySize Return the tested extended memory size.
70 @param TotalMemorySize Return the whole system physical memory size, this
71 value may be changed if in some case some error
73 @param ErrorOut Any time the memory error occurs, this will be
75 @param IfTestAbort Indicate if the user press "ESC" to skip the memory
78 @retval EFI_SUCCESS One block of memory test ok, the block size is hide
80 @retval EFI_NOT_FOUND Indicate all the non-tested memory blocks have
82 @retval EFI_DEVICE_ERROR Mis-compare error, and no agent can handle it
87 GenPerformMemoryTest (
88 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL
*This
,
89 IN OUT UINT64
*TestedMemorySize
,
90 OUT UINT64
*TotalMemorySize
,
91 OUT BOOLEAN
*ErrorOut
,
96 The memory test finished.
98 This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.Finished.
99 It simply returns EFI_SUCCESS.
101 @param This Protocol instance pointer.
103 @retval EFI_SUCCESS Successful free all the generic memory test driver
104 allocated resource and notify to platform memory
105 test driver that memory test finished.
110 GenMemoryTestFinished (
111 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL
*This
115 Provide capability to test compatible range which used by some special
116 driver required using memory range before BDS perform memory test.
118 This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.CompatibleRangeTest.
119 It simply set the memory range to system memory.
121 @param This Protocol instance pointer.
122 @param StartAddress The start address of the memory range.
123 @param Length The memory range's length.
125 @retval EFI_SUCCESS The compatible memory range pass the memory test.
126 @retval EFI_INVALID_PARAMETER The compatible memory range must be below 16M.
131 GenCompatibleRangeTest (
132 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL
*This
,
133 IN EFI_PHYSICAL_ADDRESS StartAddress
,