diff options
author | xli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-07 08:05:42 +0000 |
---|---|---|
committer | xli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-07 08:05:42 +0000 |
commit | 378871863f99d1fbf1886d7c3ed5f9955b1556a7 (patch) | |
tree | 0a43de54c69313676038abba667fe031e1b1b7fe /MdeModulePkg/Universal/MemoryTest | |
parent | 8d85dc312644154cb6ba205914ef0734540c2e50 (diff) | |
download | edk2-platforms-378871863f99d1fbf1886d7c3ed5f9955b1556a7.tar.xz |
Code Scrub for BaseMemoryTest PEIM.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6427 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/MemoryTest')
3 files changed, 63 insertions, 94 deletions
diff --git a/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.c b/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.c index 834db0f70e..7ac082756a 100644 --- a/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.c +++ b/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.c @@ -1,5 +1,5 @@ /** @file
- The PEI memory test support
+ Support of memory test in PEI Phase.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
@@ -13,9 +13,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
#include "BaseMemoryTest.h"
-#include <Library/PeiServicesLib.h>
-PEI_BASE_MEMORY_TEST_PPI mPeiBaseMemoryTestPpi = { BaseMemoryTest };
+PEI_BASE_MEMORY_TEST_PPI mPeiBaseMemoryTestPpi = {
+ BaseMemoryTest
+};
EFI_PEI_PPI_DESCRIPTOR PpiListPeiBaseMemoryTest = {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
@@ -23,63 +24,54 @@ EFI_PEI_PPI_DESCRIPTOR PpiListPeiBaseMemoryTest = { &mPeiBaseMemoryTestPpi
};
+/**
+ Entry point of BaseMemoryTestPei PEIM.
+
+ This function is the entry point of BaseMemoryTestPei PEIM.
+ It installs the PEI_BASE_MEMORY_TEST_PPI.
+
+ @param FfsHeader Pointer to FFS File Header.
+ @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
+
+ @retval EFI_SUCCESS PEI_BASE_MEMORY_TEST_PPI is successfully installed.
+ @retval Others PEI_BASE_MEMORY_TEST_PPI is not successfully installed.
+
+**/
EFI_STATUS
EFIAPI
PeiBaseMemoryTestInit (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
)
-/*++
-Description:
-
- Entry point function of BaseMemoryTestInit Peim.
-
-Arguments:
-
- PeiServices - General purpose services available to every PEIM.
- FfsHeader - Ffs header pointer
-
-Returns:
-
- Status - Result of InstallPpi
-
---*/
{
-
return PeiServicesInstallPpi (&PpiListPeiBaseMemoryTest);
-
+
}
+/**
+ Test base memory.
+
+ @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param This Pointer to this PPI instance.
+ @param BeginAddress Beginning of the memory address to be checked.
+ @param MemoryLength Bytes of memory range to be checked.
+ @param Operation Type of memory check operation to be performed.
+ @param ErrorAddress Pointer to address of the error memory returned.
+
+ @retval EFI_SUCCESS Memory test passed.
+ @retval EFI_DEVICE_ERROR Memory test failed.
+
+**/
EFI_STATUS
EFIAPI
BaseMemoryTest (
IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_BASE_MEMORY_TEST_PPI *This,
+ IN PEI_BASE_MEMORY_TEST_PPI *This,
IN EFI_PHYSICAL_ADDRESS BeginAddress,
IN UINT64 MemoryLength,
IN PEI_MEMORY_TEST_OP Operation,
OUT EFI_PHYSICAL_ADDRESS *ErrorAddress
)
-/*++
-Description:
-
- Test base memory.
-
-Arguments:
-
- PeiServices - General purpose services available to every PEIM.
- This - Pei memory test PPI pointer.
- BeginAddress - Beginning of the memory address to be checked.
- MemoryLength - Bytes of memory range to be checked.
- Operation - Type of memory check operation to be performed.
- ErrorAddress - Return the address of the error memory address.
- ErrorAddress - Address which has error when checked.
-
-Returns:
-
- Status - Result of InstallPpi
-
---*/
{
UINT32 TestPattern;
EFI_PHYSICAL_ADDRESS TempAddress;
@@ -97,15 +89,26 @@ Returns: switch (Operation) {
case Extensive:
+ //
+ // Extensive means full and detailed check,
+ // so use small span size to cover the entire test range.
+ //
SpanSize = 0x4;
break;
case Sparse:
case Quick:
+ //
+ // Sparse and Quick indicates quick test,
+ // so use large span size for sample test.
+ //
SpanSize = COVER_SPAN;
break;
case Ignore:
+ //
+ // Ignore means no test.
+ //
goto Done;
break;
}
@@ -123,6 +126,9 @@ Returns: TempAddress = BeginAddress;
while (TempAddress < BeginAddress + MemoryLength) {
if ((*(UINT32 *) (UINTN) TempAddress) != TestPattern) {
+ //
+ // Value read back does not equal to the value written, so error is detected.
+ //
*ErrorAddress = TempAddress;
REPORT_STATUS_CODE (EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED, PcdGet32 (PcdStatusCodeValueUncorrectableMemoryError));
diff --git a/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.h b/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.h index f6eb93c49c..f0245f4cc4 100644 --- a/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.h +++ b/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.h @@ -1,5 +1,5 @@ /** @file
- Tiano PEIM to provide a PEI memory test service.
+ Internal include file for support of memory test in PEI Phase.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
@@ -21,38 +21,25 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <Library/PeimEntryPoint.h>
#include <Library/ReportStatusCodeLib.h>
#include <Library/PcdLib.h>
+#include <Library/PeiServicesLib.h>
-
-//
-// Some global define
-//
#define COVER_SPAN 0x40000
#define TEST_PATTERN 0x5A5A5A5A
-EFI_STATUS
-EFIAPI
-PeiBaseMemoryTestInit (
- IN EFI_FFS_FILE_HEADER *FfsHeader,
- IN EFI_PEI_SERVICES **PeiServices
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- FfsHeader - TODO: add argument description
- PeiServices - TODO: add argument description
-
-Returns:
+/**
+ Test base memory.
- TODO: add return values
+ @param PeiServices An indirect pointer to the PEI Services Table published by the PEI Foundation.
+ @param This Pointer to this PPI instance.
+ @param BeginAddress Beginning of the memory address to be checked.
+ @param MemoryLength Bytes of memory range to be checked.
+ @param Operation Type of memory check operation to be performed.
+ @param ErrorAddress Pointer to address of the error memory returned.
---*/
-;
+ @retval EFI_SUCCESS Memory test passed.
+ @retval EFI_DEVICE_ERROR Memory test failed.
+**/
EFI_STATUS
EFIAPI
BaseMemoryTest (
@@ -62,27 +49,6 @@ BaseMemoryTest ( IN UINT64 MemoryLength,
IN PEI_MEMORY_TEST_OP Operation,
OUT EFI_PHYSICAL_ADDRESS *ErrorAddress
- )
-/*++
-
-Routine Description:
-
- TODO: Add function description
-
-Arguments:
-
- PeiServices - TODO: add argument description
- This - TODO: add argument description
- BeginAddress - TODO: add argument description
- MemoryLength - TODO: add argument description
- Operation - TODO: add argument description
- ErrorAddress - TODO: add argument description
-
-Returns:
-
- TODO: add return values
-
---*/
-;
+ );
#endif
diff --git a/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTestPei.inf b/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTestPei.inf index 019984d3d9..c353762c2e 100644 --- a/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTestPei.inf +++ b/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTestPei.inf @@ -1,8 +1,5 @@ #/** @file
-#
-# Component description file for PeiBaseMemoryTestInit module.
-#
-# This driver provides memory test ppi for memory test in Pei Phase.
+# This PEIM provides memory test PPI for memory test in PEI Phase.
#
# Copyright (c) 2006 - 2008, Intel Corporation. <BR>
# All rights reserved. This program and the accompanying materials
@@ -17,7 +14,7 @@ [Defines]
INF_VERSION = 0x00010005
- BASE_NAME = PeiBaseMemoryTestInit
+ BASE_NAME = BaseMemoryTestPei
FILE_GUID = 736EB068-8C01-47c5-964B-1C57BD5D4D64
MODULE_TYPE = PEIM
VERSION_STRING = 1.0
|