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