]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/Protocol/GenericMemoryTest.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Include / Protocol / GenericMemoryTest.h
1 /** @file
2 This protocol defines the generic memory test interfaces in Dxe phase.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef __GENERIC_MEMORY_TEST_H__
10 #define __GENERIC_MEMORY_TEST_H__
11
12 #define EFI_GENERIC_MEMORY_TEST_PROTOCOL_GUID \
13 { 0x309de7f1, 0x7f5e, 0x4ace, {0xb4, 0x9c, 0x53, 0x1b, 0xe5, 0xaa, 0x95, 0xef} }
14
15 typedef struct _EFI_GENERIC_MEMORY_TEST_PROTOCOL EFI_GENERIC_MEMORY_TEST_PROTOCOL;
16
17 ///
18 /// Memory test coverage level.
19 /// Ignore chooses not to test memory. Quick and Sparse test some memory, and Extensive performs a detailed memory test.
20 ///
21 typedef enum {
22 IGNORE,
23 QUICK,
24 SPARSE,
25 EXTENSIVE,
26 MAXLEVEL
27 } EXTENDMEM_COVERAGE_LEVEL;
28
29 /**
30 Initialize the generic memory test.
31
32 @param This The protocol instance pointer.
33 @param Level The coverage level of the memory test.
34 @param RequireSoftECCInit Indicate if the memory need software ECC init.
35
36 @retval EFI_SUCCESS The generic memory test is initialized correctly.
37 @retval EFI_NO_MEDIA The system had no memory to be tested.
38
39 **/
40 typedef
41 EFI_STATUS
42 (EFIAPI *EFI_MEMORY_TEST_INIT)(
43 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
44 IN EXTENDMEM_COVERAGE_LEVEL Level,
45 OUT BOOLEAN *RequireSoftECCInit
46 );
47
48 /**
49 Perform the memory test.
50
51 @param This The protocol instance pointer.
52 @param TestedMemorySize Return the tested extended memory size.
53 @param TotalMemorySize Return the whole system physical memory size.
54 The total memory size does not include memory in a slot with a disabled DIMM.
55 @param ErrorOut TRUE if the memory error occurred.
56 @param IfTestAbort Indicates that the user pressed "ESC" to skip the memory test.
57
58 @retval EFI_SUCCESS One block of memory passed the test.
59 @retval EFI_NOT_FOUND All memory blocks have already been tested.
60 @retval EFI_DEVICE_ERROR Memory device error occurred, and no agent can handle it.
61
62 **/
63 typedef
64 EFI_STATUS
65 (EFIAPI *EFI_PERFORM_MEMORY_TEST)(
66 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
67 OUT UINT64 *TestedMemorySize,
68 OUT UINT64 *TotalMemorySize,
69 OUT BOOLEAN *ErrorOut,
70 IN BOOLEAN IfTestAbort
71 );
72
73 /**
74 Finish the memory test.
75
76 @param This The protocol instance pointer.
77
78 @retval EFI_SUCCESS Success. All resources used in the memory test are freed.
79
80 **/
81 typedef
82 EFI_STATUS
83 (EFIAPI *EFI_MEMORY_TEST_FINISHED)(
84 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This
85 );
86
87 /**
88 Provides the capability to test the compatible range used by some special drivers.
89
90 @param This The protocol instance pointer.
91 @param StartAddress The start address of the compatible memory range that
92 must be below 16M.
93 @param Length The compatible memory range's length.
94
95 @retval EFI_SUCCESS The compatible memory range pass the memory test.
96 @retval EFI_INVALID_PARAMETER The compatible memory range are not below Low 16M.
97
98 **/
99 typedef
100 EFI_STATUS
101 (EFIAPI *EFI_MEMORY_TEST_COMPATIBLE_RANGE)(
102 IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This,
103 IN EFI_PHYSICAL_ADDRESS StartAddress,
104 IN UINT64 Length
105 );
106
107 struct _EFI_GENERIC_MEMORY_TEST_PROTOCOL {
108 EFI_MEMORY_TEST_INIT MemoryTestInit;
109 EFI_PERFORM_MEMORY_TEST PerformMemoryTest;
110 EFI_MEMORY_TEST_FINISHED Finished;
111 EFI_MEMORY_TEST_COMPATIBLE_RANGE CompatibleRangeTest;
112 };
113
114 extern EFI_GUID gEfiGenericMemTestProtocolGuid;
115
116 #endif