@param ErrorAddress Address of the memory where error is encountered.\r
\r
@retval RETURN_SUCCESS The memory range passes test.\r
- @retval RETURNEFI_DEVICE_ERROR The memory range does not pass test.\r
+ @retval RETURN_DEVICE_ERROR The memory range does not pass test.\r
\r
**/\r
RETURN_STATUS\r
EFIAPI\r
-SparseMemoryTest (\r
+QuickMemoryTest (\r
IN VOID *StartAddress,\r
IN UINT64 Length,\r
OUT VOID **ErrorAddress\r
@param ErrorAddress Address of the memory where error is encountered.\r
\r
@retval RETURN_SUCCESS The memory range passes test.\r
- @retval RETURNEFI_DEVICE_ERROR The memory range does not pass test.\r
+ @retval RETURN_DEVICE_ERROR The memory range does not pass test.\r
\r
**/\r
RETURN_STATUS\r
EFIAPI\r
-ExtensiveMemoryTest (\r
+SparseMemoryTest (\r
IN VOID *StartAddress,\r
IN UINT64 Length,\r
OUT VOID **ErrorAddress\r
);\r
\r
/**\r
- Test a system memory range with every memory unit checked.\r
+ Test a system memory range with extensively sampled memory units.\r
\r
This function tests a system memory range, whose memory units\r
- are fully checked. It leads to complete reliability with the\r
- cost of performance.\r
+ are sampled extensively. Compared with SparseMemoryTest, it achieves\r
+ more reliability and less performance.\r
\r
@param StartAddress Start address of the memory range to test.\r
@param Length Length of the memory range to test.\r
@param ErrorAddress Address of the memory where error is encountered.\r
\r
@retval RETURN_SUCCESS The memory range passes test.\r
- @retval RETURNEFI_DEVICE_ERROR The memory range does not pass test.\r
+ @retval RETURN_DEVICE_ERROR The memory range does not pass test.\r
\r
**/\r
RETURN_STATUS\r
EFIAPI\r
-FullMemoryTest (\r
+ExtensiveMemoryTest (\r
IN VOID *StartAddress,\r
IN UINT64 Length,\r
OUT VOID **ErrorAddress\r
);\r
\r
+/**\r
+ Check if soft ECC initialzation is needed for system\r
+\r
+ @retval TRUE Soft ECC initialzation is needed.\r
+ @retval FALSE Soft ECC initialzation is not needed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsSoftEccInitRequired (\r
+ VOID\r
+ );\r
+\r
#endif\r
--- /dev/null
+/** @file\r
+ Null instance of Memory Test Library.\r
+ \r
+Copyright (c) 2009, Intel Corporation.<BR>\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+\r
+#include <Base.h>\r
+#include <Library/BaseMemoryTestLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/CacheMaintenanceLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
+\r
+\r
+UINT32 TestPattern[] = {\r
+ 0x5a5a5a5a,\r
+ 0xa5a5a5a5,\r
+ 0x5a5a5a5a,\r
+ 0xa5a5a5a5,\r
+ 0x5a5a5a5a,\r
+ 0xa5a5a5a5,\r
+ 0x5a5a5a5a,\r
+ 0xa5a5a5a5,\r
+ 0x5a5a5a5a,\r
+ 0xa5a5a5a5,\r
+ 0x5a5a5a5a,\r
+ 0xa5a5a5a5,\r
+ 0x5a5a5a5a,\r
+ 0xa5a5a5a5,\r
+ 0x5a5a5a5a,\r
+ 0xa5a5a5a5\r
+};\r
+\r
+/**\r
+ Internal worker function for system memory range test.\r
+\r
+ This function is the internal worker function for system memory range test.\r
+ It writes test pattern to memory range and then reads back to check if memory\r
+ works well.\r
+\r
+ @param StartAddress Start address of the memory range to test.\r
+ @param Length Length of the memory range to test.\r
+ @param ErrorAddress Address of the memory where error is encountered.\r
+\r
+ @retval RETURN_SUCCESS The memory range passes test.\r
+ @retval RETURN_DEVICE_ERROR The memory range does not pass test.\r
+\r
+**/\r
+RETURN_STATUS\r
+MemoryTestWorker (\r
+ IN VOID *StartAddress,\r
+ IN UINT64 Length,\r
+ IN UINTN SpanSize,\r
+ OUT VOID **ErrorAddress\r
+ )\r
+{\r
+ VOID *TempAddress;\r
+\r
+ //\r
+ // Make sure we don't try and test anything above the max physical address range\r
+ //\r
+ ASSERT ((UINTN) StartAddress + Length < MAX_ADDRESS);\r
+\r
+ REPORT_STATUS_CODE (EFI_PROGRESS_CODE, PcdGet32 (PcdStatusCodeValueMemoryTestStarted));\r
+\r
+ //\r
+ // Write the test pattern into memory range\r
+ //\r
+ TempAddress = StartAddress;\r
+ while ((UINTN) TempAddress < (UINTN) StartAddress + Length) {\r
+ CopyMem (TempAddress, TestPattern, sizeof (TestPattern));\r
+ TempAddress = (VOID *) ((UINTN) TempAddress + SpanSize);\r
+ }\r
+\r
+ //\r
+ // Write back and invalidate cache to make sure data is in memory\r
+ //\r
+ WriteBackInvalidateDataCacheRange (StartAddress, (UINTN) Length);\r
+\r
+ //\r
+ // Read pattern from memory and compare it\r
+ //\r
+ TempAddress = StartAddress;\r
+ while ((UINTN) TempAddress < (UINTN) StartAddress + Length) {\r
+ if (CompareMem (TempAddress, TestPattern, sizeof (TestPattern)) != 0) {\r
+ //\r
+ // Value read back does not equal to the value written, so error is detected.\r
+ //\r
+ *ErrorAddress = TempAddress;\r
+ REPORT_STATUS_CODE (EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED, PcdGet32 (PcdStatusCodeValueUncorrectableMemoryError));\r
+\r
+ return RETURN_DEVICE_ERROR;\r
+ }\r
+\r
+ TempAddress = (VOID *) ((UINTN) TempAddress + SpanSize);\r
+ }\r
+\r
+ return RETURN_SUCCESS;\r
+}\r
+\r
+/**\r
+ Perform a quick system memory range test.\r
+\r
+ This function performs a quick system memory range test. It leads to quick performance\r
+ but least reliability.\r
+\r
+ @param StartAddress Start address of the memory range to test.\r
+ @param Length Length of the memory range to test.\r
+ @param ErrorAddress Address of the memory where error is encountered.\r
+\r
+ @retval RETURN_SUCCESS The memory range passes test.\r
+ @retval RETURN_DEVICE_ERROR The memory range does not pass test.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+QuickMemoryTest (\r
+ IN VOID *StartAddress,\r
+ IN UINT64 Length,\r
+ OUT VOID **ErrorAddress\r
+ )\r
+{\r
+ RETURN_STATUS Status;\r
+\r
+ Status = MemoryTestWorker (\r
+ StartAddress,\r
+ Length,\r
+ sizeof (TestPattern) * 0x20000,\r
+ ErrorAddress\r
+ );\r
+\r
+ return Status;\r
+}\r
+\r
+/**\r
+ Test a system memory range with sparsely sampled memory units.\r
+\r
+ This function tests a system memory range, whose memory units\r
+ are sampled sparsely. It leads to relatively good performance\r
+ and partial reliability.\r
+\r
+ @param StartAddress Start address of the memory range to test.\r
+ @param Length Length of the memory range to test.\r
+ @param ErrorAddress Address of the memory where error is encountered.\r
+\r
+ @retval RETURN_SUCCESS The memory range passes test.\r
+ @retval RETURN_DEVICE_ERROR The memory range does not pass test.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+SparseMemoryTest (\r
+ IN VOID *StartAddress,\r
+ IN UINT64 Length,\r
+ OUT VOID **ErrorAddress\r
+ )\r
+{\r
+ RETURN_STATUS Status;\r
+\r
+ Status = MemoryTestWorker (\r
+ StartAddress,\r
+ Length,\r
+ sizeof (TestPattern) * 0x8000,\r
+ ErrorAddress\r
+ );\r
+\r
+ return Status;\r
+}\r
+\r
+/**\r
+ Test a system memory range with extensively sampled memory units.\r
+\r
+ This function tests a system memory range, whose memory units\r
+ are sampled extensively. Compared with SparseMemoryTest, it achieves\r
+ more reliability and less performance.\r
+\r
+ @param StartAddress Start address of the memory range to test.\r
+ @param Length Length of the memory range to test.\r
+ @param ErrorAddress Address of the memory where error is encountered.\r
+\r
+ @retval RETURN_SUCCESS The memory range passes test.\r
+ @retval RETURN_DEVICE_ERROR The memory range does not pass test.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+ExtensiveMemoryTest (\r
+ IN VOID *StartAddress,\r
+ IN UINT64 Length,\r
+ OUT VOID **ErrorAddress\r
+ )\r
+{\r
+ RETURN_STATUS Status;\r
+\r
+ Status = MemoryTestWorker (\r
+ StartAddress,\r
+ Length,\r
+ sizeof (TestPattern),\r
+ ErrorAddress\r
+ );\r
+\r
+ return Status;\r
+}\r
+\r
+/**\r
+ Check if soft ECC initialzation is needed for system\r
+\r
+ @retval TRUE Soft ECC initialzation is needed.\r
+ @retval FALSE Soft ECC initialzation is not needed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsSoftEccInitRequired (\r
+ VOID\r
+ )\r
+{\r
+ return FALSE;\r
+}\r
--- /dev/null
+/** @file\r
+ Instance of Memory Test Library.\r
+\r
+Copyright (c) 2009, Intel Corporation.<BR>\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = BaseMemoryTestLib\r
+ FILE_GUID = 216CAA56-AF75-4BBB-9D74-CC0960E92ECB\r
+ MODULE_TYPE = BASE\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = BaseMemoryTestLib\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources.common]\r
+ BaseMemoryTestLib.c\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ MdeModulePkg/MdeModulePkg.dec\r
+\r
+[LibraryClasses]\r
+ BaseMemoryTestLib\r
+ BaseMemoryLib\r
+ CacheMaintenanceLib\r
+ DebugLib\r
+ PcdLib\r
+ ReportStatusCodeLib\r
+\r
+[FixedPcd]\r
+ gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueMemoryTestStarted\r
+ gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueUncorrectableMemoryError\r
#include <Library/BaseMemoryTestLib.h>\r
\r
/**\r
- Test a system memory range with sparsely sampled memory units.\r
+ Perform a quick system memory range test.\r
\r
- This function tests a system memory range, whose memory units\r
- are sampled sparsely. It leads to quick performance but less\r
- reliability.\r
+ This function performs a quick system memory range test. It leads to quick performance\r
+ but least reliability.\r
\r
@param StartAddress Start address of the memory range to test.\r
@param Length Length of the memory range to test.\r
@param ErrorAddress Address of the memory where error is encountered.\r
\r
@retval RETURN_SUCCESS The memory range passes test.\r
- @retval RETURNEFI_DEVICE_ERROR The memory range does not pass test.\r
+ @retval RETURN_DEVICE_ERROR The memory range does not pass test.\r
\r
**/\r
RETURN_STATUS\r
EFIAPI\r
-SparseMemoryTest (\r
+QuickMemoryTest (\r
IN VOID *StartAddress,\r
IN UINT64 Length,\r
OUT VOID **ErrorAddress\r
}\r
\r
/**\r
- Test a system memory range with extensively sampled memory units.\r
+ Test a system memory range with sparsely sampled memory units.\r
\r
This function tests a system memory range, whose memory units\r
- are sampled extensively. Compared with SparseMemoryTest, it achieves\r
- more reliability and less performance.\r
+ are sampled sparsely. It leads to relatively good performance\r
+ and partial reliability.\r
\r
@param StartAddress Start address of the memory range to test.\r
@param Length Length of the memory range to test.\r
@param ErrorAddress Address of the memory where error is encountered.\r
\r
@retval RETURN_SUCCESS The memory range passes test.\r
- @retval RETURNEFI_DEVICE_ERROR The memory range does not pass test.\r
+ @retval RETURN_DEVICE_ERROR The memory range does not pass test.\r
\r
**/\r
RETURN_STATUS\r
EFIAPI\r
-ExtensiveMemoryTest (\r
+SparseMemoryTest (\r
IN VOID *StartAddress,\r
IN UINT64 Length,\r
OUT VOID **ErrorAddress\r
}\r
\r
/**\r
- Test a system memory range with every memory unit checked.\r
+ Test a system memory range with extensively sampled memory units.\r
\r
This function tests a system memory range, whose memory units\r
- are fully checked. It leads to complete reliability with the\r
- cost of performance.\r
+ are sampled extensively. Compared with SparseMemoryTest, it achieves\r
+ more reliability and less performance.\r
\r
@param StartAddress Start address of the memory range to test.\r
@param Length Length of the memory range to test.\r
@param ErrorAddress Address of the memory where error is encountered.\r
\r
@retval RETURN_SUCCESS The memory range passes test.\r
- @retval RETURNEFI_DEVICE_ERROR The memory range does not pass test.\r
+ @retval RETURN_DEVICE_ERROR The memory range does not pass test.\r
\r
**/\r
RETURN_STATUS\r
EFIAPI\r
-FullMemoryTest (\r
+ExtensiveMemoryTest (\r
IN VOID *StartAddress,\r
IN UINT64 Length,\r
OUT VOID **ErrorAddress\r
{\r
return RETURN_SUCCESS;\r
}\r
+\r
+/**\r
+ Check if soft ECC initialzation is needed for system\r
+\r
+ @retval TRUE Soft ECC initialzation is needed.\r
+ @retval FALSE Soft ECC initialzation is not needed.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsSoftEccInitRequired (\r
+ VOID\r
+ )\r
+{\r
+ return FALSE;\r
+}\r
FILE_GUID = D519E511-9C1C-47F5-AE01-FD216E779269\r
MODULE_TYPE = BASE\r
VERSION_STRING = 1.0\r
- LIBRARY_CLASS = MemoryTestLib\r
+ LIBRARY_CLASS = BaseMemoryTestLib\r
\r
#\r
# The following information is for reference only and not required by the build tools.\r
MdeModulePkg/MdeModulePkg.dec\r
\r
[LibraryClasses]\r
- MemoryTestLib\r
+ BaseMemoryTestLib\r
\r
## @libraryclass Provides APIs for system memory test.\r
##\r
- MemoryTestLib|Include/Library/BaseMemoryTestLib.h\r
+ BaseMemoryTestLib|Include/Library/BaseMemoryTestLib.h\r
\r
[Guids.common]\r
## MdeModule package token space guid\r
OemHookStatusCodeLib|IntelFrameworkModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf\r
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf\r
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf\r
- MemoryTestLib|MdeModulePkg/Library/BaseMemoryTestLibNull/BaseMemoryTestLibNull.inf\r
+ BaseMemoryTestLib|MdeModulePkg/Library/BaseMemoryTestLibNull/BaseMemoryTestLibNull.inf\r
\r
[LibraryClasses.IA32]\r
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf\r
MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf\r
MdeModulePkg/Library/UefiIfrSupportLib/UefiIfrSupportLib.inf\r
MdeModulePkg/Library/BaseMemoryTestLibNull/BaseMemoryTestLibNull.inf\r
+ MdeModulePkg/Library/BaseMemoryTestLib/BaseMemoryTestLib.inf\r
\r
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf\r
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf\r