• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2  /*++
3 
4 Copyright (c) 2004 - 2007, 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
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 Module Name:
14 
15   PlatformMemtest.h
16 
17 Abstract:
18   This files defines the protocol produced by platform memory test driver.
19 
20 --*/
21 
22 #ifndef __PLATFORM_MEMTEST_H__
23 #define __PLATFORM_MEMTEST_H__
24 
25 #if (EFI_SPECIFICATION_VERSION >= 0x0002000A)
26 #include EFI_PROTOCOL_CONSUMER (HiiDatabase)
27 #else
28 #include EFI_PROTOCOL_CONSUMER (Hii)
29 #endif
30 #include EFI_PROTOCOL_CONSUMER (GenericMemoryTest)
31 
32 
33 #define EFI_PLATFORM_MEMTEST_PROTOCOL_GUID \
34   { 0x859ba18, 0x7dd7, 0x4ed7, {0xa8, 0x8e, 0x10, 0x9c, 0x63, 0x91, 0x7b, 0xdd} }
35 
36 //
37 // Forward reference for pure ANSI compatability
38 //
39 EFI_FORWARD_DECLARATION (EFI_PLATFORM_MEMTEST_PROTOCOL);
40 
41 
42 //
43 // Basic type definitions
44 //
45 typedef UINT16  EFI_DIMM_ID;
46 #define EFI_INVALID_DIMM_ID 0xFFFF
47 
48 //
49 // This describes the capabilities
50 //
51 typedef struct {
52   UINT32                HwCap;
53   EFI_PHYSICAL_ADDRESS  InitBlockSize;
54   EFI_PHYSICAL_ADDRESS  TestBlockSize;
55 } EFI_PLATFORM_MEMTEST_CAPABILITIES;
56 
57 //
58 // This defines the platform driver phases to use in notify phase
59 //
60 typedef enum {
61   EfiMemtestPhaseBegin,
62   EfiMemtestPhaseEnd,
63   EfiMemtestPhaseMaximum
64 } EFI_MEMTEST_PHASE ;
65 
66 
67 //
68 // Definitions of Capability bits
69 //
70 #define EFI_MEMTEST_CAP_NONE          0X00000000
71 #define EFI_MEMTEST_CAP_ECC            0X00000001
72 #define EFI_MEMTEST_CAP_HW_TEST        0X00000002
73 #define EFI_MEMTEST_CAP_HW_INIT        0X00000004
74 
75 //
76 // This describes the pattern for testing all memory cells
77 //
78 typedef struct {
79   UINT32         Count;      // Number of patterns
80   UINT32         Width;      // Width of patterns
81   VOID          *Pattern;    // Array of patterns
82 }EFI_MEMTEST_DATA_PATTERN;
83 
84 //
85 // This describes the data and address line patterns
86 //
87 typedef struct {
88   UINT32                 Count;    // Number of patterns
89   EFI_PHYSICAL_ADDRESS  *Address;  // Array of addresses
90   EFI_PHYSICAL_ADDRESS  *Pattern;  // Array of patterns
91 } EFI_MEMTEST_ADDRESS_PATTERN;
92 
93 
94 #define   EFI_INVALID_DIMM_ID   0xFFFF
95 
96 //
97 // DIMM information exported by the platform driver
98 //
99 
100 typedef struct {
101   EFI_DIMM_ID         DimmId;
102   STRING_REF           DimmReference;
103 } EFI_MEMTEST_DIMM_INFO;
104 
105 
106 //
107 // Various types of errors
108 //
109 typedef enum {
110   EfiMemtestCorrectableError = 1,
111   EfiMemtestUncorrectableError,
112   EfiMemtestErrorMaximum
113 } EFI_DIMM_ERROR;
114 
115 //
116 // Actions to be taken.
117 //
118 typedef enum {
119   EfiMemtestActionReport = 1,
120   EfiMemtestActionDisableMem,
121   EfiMemtestActionMaximum
122 } EFI_MEMTEST_ERROR_ACTION;
123 
124 
125 //
126 // Structure indicating a policy entry.
127 //
128 
129 typedef struct {
130   EFI_DIMM_ERROR            ErrorType;
131   UINT32                    Threshold;
132   EFI_MEMTEST_ERROR_ACTION  Action;
133 } EFI_MEMTEST_POLICY_ENTRY;
134 
135 
136 
137 //
138 // Error Information.
139 //
140 typedef struct {
141   EFI_DIMM_ERROR  Error;
142   EFI_DIMM_ID     DimmId;
143 } EFI_PLATFORM_MEMTEST_ERROR;
144 
145 
146 typedef
147 EFI_STATUS
148 (EFIAPI *EFI_PLATFORM_MEMTEST_NOTIFY_PHASE) (
149   IN EFI_PLATFORM_MEMTEST_PROTOCOL    *This,
150   IN EFI_MEMTEST_PHASE                        Phase
151   );
152 
153 typedef
154 EFI_STATUS
155 (EFIAPI *EFI_PLATFORM_MEMTEST_GET_PLATFORM_INFO) (
156   IN EFI_PLATFORM_MEMTEST_PROTOCOL  *This,
157   OUT  EFI_PLATFORM_MEMTEST_CAPABILITIES      *Capabilities,
158   OUT  EFI_MEMTEST_ADDRESS_PATTERN            *AddressPattern,
159   OUT  EFI_MEMTEST_DATA_PATTERN               *DataPattern,
160   OUT  EFI_MEMTEST_DATA_PATTERN               *MemoryPattern,
161   OUT  UINT32                                 *EntryCount,
162   OUT  EFI_MEMTEST_POLICY_ENTRY               **PolicyGrid
163   );
164 
165 typedef
166 EFI_STATUS
167 (EFIAPI * EFI_PLATFORM_MEMTEST_GET_NEXT_DIMM_INFO) (
168   IN EFI_PLATFORM_MEMTEST_PROTOCOL         *This,
169   IN OUT EFI_MEMTEST_DIMM_INFO                    *DimmInfo
170   );
171 
172 typedef
173 EFI_STATUS
174 (EFIAPI *EFI_PLATFORM_MEMTEST_INITIALIZE_MEMORY) (
175   IN EFI_PLATFORM_MEMTEST_PROTOCOL    *This,
176   IN EFI_PHYSICAL_ADDRESS                     Start,
177   IN EFI_PHYSICAL_ADDRESS                     Size
178   );
179 
180 typedef
181 EFI_STATUS
182 (EFIAPI * EFI_PLATFORM_MEMTEST_HW_MEMORY_TEST) (
183   IN EFI_PLATFORM_MEMTEST_PROTOCOL  *This,
184   IN EXTENDMEM_COVERAGE_LEVEL               Level,
185   IN EFI_PHYSICAL_ADDRESS                   Start,
186   IN EFI_PHYSICAL_ADDRESS                   Size,
187   OUT UINTN                                 *ErrorCount,
188   OUT EFI_PLATFORM_MEMTEST_ERROR            **ErrorInfo
189   );
190 
191 typedef
192 EFI_STATUS
193 (EFIAPI * EFI_PLATFORM_MEMTEST_FLUSH_BUFFER) (
194   IN EFI_PLATFORM_MEMTEST_PROTOCOL   *This
195   );
196 
197 typedef
198 EFI_STATUS
199 (EFIAPI * EFI_PLATFORM_MEMTEST_CHECK_FOR_ERROR)  (
200   IN EFI_PLATFORM_MEMTEST_PROTOCOL   *This,
201   OUT  UINT32                                *ErrorCount,
202   OUT EFI_PLATFORM_MEMTEST_ERROR             **ErrorInfo
203 
204   );
205 
206 typedef
207 EFI_STATUS
208 (EFIAPI * EFI_PLATFORM_MEMTEST_LOCATE_BAD_DIMM) (
209   IN EFI_PLATFORM_MEMTEST_PROTOCOL  *This,
210   IN  EFI_PHYSICAL_ADDRESS                  FailingAddress,
211   IN  UINT8                                 Expected,
212   IN  UINT8                                 Found,
213   OUT  UINT32                               *ErrorInfoCount,
214   OUT EFI_PLATFORM_MEMTEST_ERROR            **ErrorInfoBuffer
215   );
216 
217 typedef
218 EFI_STATUS
219 (EFIAPI * EFI_PLATFORM_MEMTEST_CLEAR_ERROR) (
220   IN EFI_PLATFORM_MEMTEST_PROTOCOL   *This
221   );
222 
223 typedef
224 EFI_STATUS
225 (EFIAPI * EFI_PLATFORM_MEMTEST_DISABLE_DIMM) (
226   IN EFI_PLATFORM_MEMTEST_PROTOCOL   *This,
227   IN UINT16                                 *DimmCount,
228   IN EFI_DIMM_ID                            *DimmIds,
229   IN BOOLEAN                                 RebootRequired
230 
231   );
232 
233 typedef
234 EFI_STATUS
235 (EFIAPI * EFI_PLATFORM_MEMTEST_OVERLAP) (
236   IN EFI_PLATFORM_MEMTEST_PROTOCOL   *This,
237   IN  EFI_DIMM_ID                           DimmId,
238   IN  EFI_PHYSICAL_ADDRESS                  start,
239   IN  EFI_PHYSICAL_ADDRESS                  Size,
240   OUT BOOLEAN                               *Overlap
241   );
242 
243 struct _EFI_PLATFORM_MEMTEST_PROTOCOL {
244   EFI_PLATFORM_MEMTEST_NOTIFY_PHASE       NotifyPhase;
245   EFI_PLATFORM_MEMTEST_GET_PLATFORM_INFO  GetPlatformInfo;
246   EFI_PLATFORM_MEMTEST_GET_NEXT_DIMM_INFO GetNextDimmInfo;
247   EFI_PLATFORM_MEMTEST_INITIALIZE_MEMORY  InitializeMem;
248   EFI_PLATFORM_MEMTEST_HW_MEMORY_TEST     HwTest;
249   EFI_PLATFORM_MEMTEST_FLUSH_BUFFER       FlushBuffer;
250   EFI_PLATFORM_MEMTEST_CHECK_FOR_ERROR    CheckError;
251   EFI_PLATFORM_MEMTEST_LOCATE_BAD_DIMM    LocateBadDimm;
252   EFI_PLATFORM_MEMTEST_CLEAR_ERROR        ClearError;
253   EFI_PLATFORM_MEMTEST_DISABLE_DIMM       DisableDimm;
254   EFI_PLATFORM_MEMTEST_OVERLAP            Overlap;
255 };
256 
257 
258 
259 extern EFI_GUID gEfiPlatformMemTestGuid;
260 
261 #endif
262