TianoCore EDK2 master
Loading...
Searching...
No Matches
LightMemoryTest.h
Go to the documentation of this file.
1
10#ifndef _GENERIC_MEMORY_TEST_H_
11#define _GENERIC_MEMORY_TEST_H_
12
15#include <Protocol/Cpu.h>
16
17#include <Library/DebugLib.h>
19#include <Library/HobLib.h>
22#include <Library/BaseLib.h>
26
27//
28// Some global define
29//
30#define GENERIC_CACHELINE_SIZE 0x40
31
32//
33// attributes for reserved memory before it is promoted to system memory
34//
35#define EFI_MEMORY_PRESENT 0x0100000000000000ULL
36#define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
37#define EFI_MEMORY_TESTED 0x0400000000000000ULL
38
39//
40// The SPARSE_SPAN_SIZE size can not small then the MonoTestSize
41//
42#define TEST_BLOCK_SIZE 0x2000000
43#define QUICK_SPAN_SIZE (TEST_BLOCK_SIZE >> 2)
44#define SPARSE_SPAN_SIZE (TEST_BLOCK_SIZE >> 4)
45
46//
47// This structure records every nontested memory range parsed through GCD
48// service.
49//
50#define EFI_NONTESTED_MEMORY_RANGE_SIGNATURE SIGNATURE_32 ('N', 'T', 'M', 'E')
51
52typedef struct {
53 UINTN Signature;
54 LIST_ENTRY Link;
55 EFI_PHYSICAL_ADDRESS StartAddress;
56 UINT64 Length;
57 UINT64 Capabilities;
58 BOOLEAN Above4G;
59 BOOLEAN AlreadyMapped;
61
62#define NONTESTED_MEMORY_RANGE_FROM_LINK(link) \
63 CR ( \
64 link, \
65 NONTESTED_MEMORY_RANGE, \
66 Link, \
67 EFI_NONTESTED_MEMORY_RANGE_SIGNATURE \
68 )
69
70//
71// This is the memory test driver's structure definition
72//
73#define EFI_GENERIC_MEMORY_TEST_PRIVATE_SIGNATURE SIGNATURE_32 ('G', 'E', 'M', 'T')
74
75typedef struct {
76 UINTN Signature;
77 EFI_HANDLE Handle;
78
79 //
80 // Cpu arch protocol's pointer
81 //
83
84 //
85 // generic memory test driver's protocol
86 //
87 EFI_GENERIC_MEMORY_TEST_PROTOCOL GenericMemoryTest;
88
89 //
90 // memory test covered spans
91 //
92 EXTENDMEM_COVERAGE_LEVEL CoverLevel;
93 UINTN CoverageSpan;
94 UINT64 BdsBlockSize;
95
96 //
97 // the memory test pattern and size every time R/W/V memory
98 //
99 VOID *MonoPattern;
100 UINTN MonoTestSize;
101
102 //
103 // base memory's size which tested in PEI phase
104 //
105 UINT64 BaseMemorySize;
106
107 //
108 // memory range list
109 //
110 LIST_ENTRY NonTestedMemRanList;
112
113#define GENERIC_MEMORY_TEST_PRIVATE_FROM_THIS(a) \
114 CR ( \
115 a, \
116 GENERIC_MEMORY_TEST_PRIVATE, \
117 GenericMemoryTest, \
118 EFI_GENERIC_MEMORY_TEST_PRIVATE_SIGNATURE \
119 )
120
121//
122// Function Prototypes
123//
124
138 );
139
153 );
154
169 );
170
177VOID
180 );
181
194 );
195
211 IN UINT64 Size
212 );
213
232 IN UINT64 Size
233 );
234
250 IN EFI_PHYSICAL_ADDRESS StartAddress,
251 IN UINT64 Length,
252 IN UINT64 Capabilities
253 );
254
267EFIAPI
271 OUT BOOLEAN *RequireSoftECCInit
272 );
273
290EFIAPI
293 OUT UINT64 *TestedMemorySize,
294 OUT UINT64 *TotalMemorySize,
295 OUT BOOLEAN *ErrorOut,
296 IN BOOLEAN TestAbort
297 );
298
308EFIAPI
311 );
312
326EFIAPI
329 IN EFI_PHYSICAL_ADDRESS StartAddress,
330 IN UINT64 Length
331 );
332
333#endif
UINT64 UINTN
EXTENDMEM_COVERAGE_LEVEL
EFI_STATUS EFIAPI GenPerformMemoryTest(IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This, OUT UINT64 *TestedMemorySize, OUT UINT64 *TotalMemorySize, OUT BOOLEAN *ErrorOut, IN BOOLEAN TestAbort)
EFI_STATUS ConstructNonTestedMemoryRange(IN GENERIC_MEMORY_TEST_PRIVATE *Private)
EFI_STATUS ConstructBaseMemoryRange(IN GENERIC_MEMORY_TEST_PRIVATE *Private)
EFI_STATUS EFIAPI InitializeMemoryTest(IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This, IN EXTENDMEM_COVERAGE_LEVEL Level, OUT BOOLEAN *RequireSoftECCInit)
EFI_STATUS PerformAddressDataLineTest(IN GENERIC_MEMORY_TEST_PRIVATE *Private)
EFI_STATUS DirectRangeTest(IN GENERIC_MEMORY_TEST_PRIVATE *Private, IN EFI_PHYSICAL_ADDRESS StartAddress, IN UINT64 Length, IN UINT64 Capabilities)
EFI_STATUS EFIAPI GenMemoryTestFinished(IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This)
EFI_STATUS EFIAPI GenCompatibleRangeTest(IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS StartAddress, IN UINT64 Length)
EFI_STATUS UpdateMemoryMap(IN GENERIC_MEMORY_TEST_PRIVATE *Private)
EFI_STATUS VerifyMemory(IN GENERIC_MEMORY_TEST_PRIVATE *Private, IN EFI_PHYSICAL_ADDRESS Start, IN UINT64 Size)
VOID DestroyLinkList(IN GENERIC_MEMORY_TEST_PRIVATE *Private)
EFI_STATUS WriteMemory(IN GENERIC_MEMORY_TEST_PRIVATE *Private, IN EFI_PHYSICAL_ADDRESS Start, IN UINT64 Size)
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33