Code Scrub for BaseMemoryTest PEIM.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6427 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
/** @file
|
/** @file
|
||||||
The PEI memory test support
|
Support of memory test in PEI Phase.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
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 "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 PpiListPeiBaseMemoryTest = {
|
||||||
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||||
@ -23,33 +24,44 @@ EFI_PEI_PPI_DESCRIPTOR PpiListPeiBaseMemoryTest = {
|
|||||||
&mPeiBaseMemoryTestPpi
|
&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
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PeiBaseMemoryTestInit (
|
PeiBaseMemoryTestInit (
|
||||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
||||||
IN EFI_PEI_SERVICES **PeiServices
|
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);
|
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
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
BaseMemoryTest (
|
BaseMemoryTest (
|
||||||
@ -60,26 +72,6 @@ BaseMemoryTest (
|
|||||||
IN PEI_MEMORY_TEST_OP Operation,
|
IN PEI_MEMORY_TEST_OP Operation,
|
||||||
OUT EFI_PHYSICAL_ADDRESS *ErrorAddress
|
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;
|
UINT32 TestPattern;
|
||||||
EFI_PHYSICAL_ADDRESS TempAddress;
|
EFI_PHYSICAL_ADDRESS TempAddress;
|
||||||
@ -97,15 +89,26 @@ Returns:
|
|||||||
|
|
||||||
switch (Operation) {
|
switch (Operation) {
|
||||||
case Extensive:
|
case Extensive:
|
||||||
|
//
|
||||||
|
// Extensive means full and detailed check,
|
||||||
|
// so use small span size to cover the entire test range.
|
||||||
|
//
|
||||||
SpanSize = 0x4;
|
SpanSize = 0x4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Sparse:
|
case Sparse:
|
||||||
case Quick:
|
case Quick:
|
||||||
|
//
|
||||||
|
// Sparse and Quick indicates quick test,
|
||||||
|
// so use large span size for sample test.
|
||||||
|
//
|
||||||
SpanSize = COVER_SPAN;
|
SpanSize = COVER_SPAN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Ignore:
|
case Ignore:
|
||||||
|
//
|
||||||
|
// Ignore means no test.
|
||||||
|
//
|
||||||
goto Done;
|
goto Done;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -123,6 +126,9 @@ Returns:
|
|||||||
TempAddress = BeginAddress;
|
TempAddress = BeginAddress;
|
||||||
while (TempAddress < BeginAddress + MemoryLength) {
|
while (TempAddress < BeginAddress + MemoryLength) {
|
||||||
if ((*(UINT32 *) (UINTN) TempAddress) != TestPattern) {
|
if ((*(UINT32 *) (UINTN) TempAddress) != TestPattern) {
|
||||||
|
//
|
||||||
|
// Value read back does not equal to the value written, so error is detected.
|
||||||
|
//
|
||||||
*ErrorAddress = TempAddress;
|
*ErrorAddress = TempAddress;
|
||||||
REPORT_STATUS_CODE (EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED, PcdGet32 (PcdStatusCodeValueUncorrectableMemoryError));
|
REPORT_STATUS_CODE (EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED, PcdGet32 (PcdStatusCodeValueUncorrectableMemoryError));
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/** @file
|
/** @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>
|
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||||
All rights reserved. This program and the accompanying materials
|
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/PeimEntryPoint.h>
|
||||||
#include <Library/ReportStatusCodeLib.h>
|
#include <Library/ReportStatusCodeLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
#include <Library/PeiServicesLib.h>
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Some global define
|
|
||||||
//
|
|
||||||
#define COVER_SPAN 0x40000
|
#define COVER_SPAN 0x40000
|
||||||
#define TEST_PATTERN 0x5A5A5A5A
|
#define TEST_PATTERN 0x5A5A5A5A
|
||||||
|
|
||||||
EFI_STATUS
|
/**
|
||||||
EFIAPI
|
Test base memory.
|
||||||
PeiBaseMemoryTestInit (
|
|
||||||
IN EFI_FFS_FILE_HEADER *FfsHeader,
|
|
||||||
IN EFI_PEI_SERVICES **PeiServices
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
@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.
|
||||||
|
|
||||||
TODO: Add function description
|
@retval EFI_SUCCESS Memory test passed.
|
||||||
|
@retval EFI_DEVICE_ERROR Memory test failed.
|
||||||
Arguments:
|
|
||||||
|
|
||||||
FfsHeader - TODO: add argument description
|
|
||||||
PeiServices - TODO: add argument description
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
TODO: add return values
|
|
||||||
|
|
||||||
--*/
|
|
||||||
;
|
|
||||||
|
|
||||||
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
BaseMemoryTest (
|
BaseMemoryTest (
|
||||||
@ -62,27 +49,6 @@ BaseMemoryTest (
|
|||||||
IN UINT64 MemoryLength,
|
IN UINT64 MemoryLength,
|
||||||
IN PEI_MEMORY_TEST_OP Operation,
|
IN PEI_MEMORY_TEST_OP Operation,
|
||||||
OUT EFI_PHYSICAL_ADDRESS *ErrorAddress
|
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
|
#endif
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
#/** @file
|
#/** @file
|
||||||
#
|
# This PEIM provides memory test PPI for memory test in PEI Phase.
|
||||||
# Component description file for PeiBaseMemoryTestInit module.
|
|
||||||
#
|
|
||||||
# This driver provides memory test ppi for memory test in Pei Phase.
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
# Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
@ -17,7 +14,7 @@
|
|||||||
|
|
||||||
[Defines]
|
[Defines]
|
||||||
INF_VERSION = 0x00010005
|
INF_VERSION = 0x00010005
|
||||||
BASE_NAME = PeiBaseMemoryTestInit
|
BASE_NAME = BaseMemoryTestPei
|
||||||
FILE_GUID = 736EB068-8C01-47c5-964B-1C57BD5D4D64
|
FILE_GUID = 736EB068-8C01-47c5-964B-1C57BD5D4D64
|
||||||
MODULE_TYPE = PEIM
|
MODULE_TYPE = PEIM
|
||||||
VERSION_STRING = 1.0
|
VERSION_STRING = 1.0
|
||||||
|
Reference in New Issue
Block a user