• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Include file of the NULL memory test driver.
3 
4 Copyright (c) 2006 - 2008, 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 **/
14 
15 #ifndef _NULL_MEMORY_TEST_H_
16 #define _NULL_MEMORY_TEST_H_
17 
18 
19 #include <PiDxe.h>
20 
21 
22 #include <Protocol/GenericMemoryTest.h>
23 
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>
29 
30 //
31 // Definition of memory status.
32 //
33 #define EFI_MEMORY_PRESENT      0x0100000000000000ULL
34 #define EFI_MEMORY_INITIALIZED  0x0200000000000000ULL
35 #define EFI_MEMORY_TESTED       0x0400000000000000ULL
36 
37 /**
38   Initialize the generic memory test.
39 
40   This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.MemoryTestInit.
41   It simply promotes untested reserved memory to system memory without real test.
42 
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.
46 
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.
52 
53 **/
54 EFI_STATUS
55 EFIAPI
56 InitializeMemoryTest (
57   IN EFI_GENERIC_MEMORY_TEST_PROTOCOL          *This,
58   IN  EXTENDMEM_COVERAGE_LEVEL                 Level,
59   OUT BOOLEAN                                  *RequireSoftECCInit
60   );
61 
62 /**
63   Perform the memory test.
64 
65   This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.PerformMemoryTest.
66   It simply returns EFI_NOT_FOUND.
67 
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
72                               DIMMs be disabled.
73   @param  ErrorOut            Any time the memory error occurs, this will be
74                               TRUE.
75   @param  IfTestAbort         Indicate if the user press "ESC" to skip the memory
76                               test.
77 
78   @retval EFI_SUCCESS         One block of memory test ok, the block size is hide
79                               internally.
80   @retval EFI_NOT_FOUND       Indicate all the non-tested memory blocks have
81                               already go through.
82   @retval EFI_DEVICE_ERROR    Mis-compare error, and no agent can handle it
83 
84 **/
85 EFI_STATUS
86 EFIAPI
87 GenPerformMemoryTest (
88   IN EFI_GENERIC_MEMORY_TEST_PROTOCOL          *This,
89   IN OUT UINT64                                *TestedMemorySize,
90   OUT UINT64                                   *TotalMemorySize,
91   OUT BOOLEAN                                  *ErrorOut,
92   IN BOOLEAN                                   TestAbort
93   );
94 
95 /**
96   The memory test finished.
97 
98   This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.Finished.
99   It simply returns EFI_SUCCESS.
100 
101   @param  This                Protocol instance pointer.
102 
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.
106 
107 **/
108 EFI_STATUS
109 EFIAPI
110 GenMemoryTestFinished (
111   IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This
112   );
113 
114 /**
115   Provide capability to test compatible range which used by some special
116   driver required using memory range before BDS perform memory test.
117 
118   This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.CompatibleRangeTest.
119   It simply set the memory range to system memory.
120 
121   @param  This                Protocol instance pointer.
122   @param  StartAddress        The start address of the memory range.
123   @param  Length              The memory range's length.
124 
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.
127 
128 **/
129 EFI_STATUS
130 EFIAPI
131 GenCompatibleRangeTest (
132   IN EFI_GENERIC_MEMORY_TEST_PROTOCOL          *This,
133   IN  EFI_PHYSICAL_ADDRESS                     StartAddress,
134   IN  UINT64                                   Length
135   );
136 
137 #endif
138