TianoCore EDK2 master
Loading...
Searching...
No Matches
LightMemoryTest.h File Reference

Go to the source code of this file.

Data Structures

struct  NONTESTED_MEMORY_RANGE
 
struct  GENERIC_MEMORY_TEST_PRIVATE
 

Macros

#define GENERIC_CACHELINE_SIZE   0x40
 
#define EFI_MEMORY_PRESENT   0x0100000000000000ULL
 
#define EFI_MEMORY_INITIALIZED   0x0200000000000000ULL
 
#define EFI_MEMORY_TESTED   0x0400000000000000ULL
 
#define TEST_BLOCK_SIZE   0x2000000
 
#define QUICK_SPAN_SIZE   (TEST_BLOCK_SIZE >> 2)
 
#define SPARSE_SPAN_SIZE   (TEST_BLOCK_SIZE >> 4)
 
#define EFI_NONTESTED_MEMORY_RANGE_SIGNATURE   SIGNATURE_32 ('N', 'T', 'M', 'E')
 
#define NONTESTED_MEMORY_RANGE_FROM_LINK(link)
 
#define EFI_GENERIC_MEMORY_TEST_PRIVATE_SIGNATURE   SIGNATURE_32 ('G', 'E', 'M', 'T')
 
#define GENERIC_MEMORY_TEST_PRIVATE_FROM_THIS(a)
 

Functions

EFI_STATUS ConstructBaseMemoryRange (IN GENERIC_MEMORY_TEST_PRIVATE *Private)
 
EFI_STATUS ConstructNonTestedMemoryRange (IN GENERIC_MEMORY_TEST_PRIVATE *Private)
 
EFI_STATUS PerformAddressDataLineTest (IN GENERIC_MEMORY_TEST_PRIVATE *Private)
 
VOID DestroyLinkList (IN GENERIC_MEMORY_TEST_PRIVATE *Private)
 
EFI_STATUS UpdateMemoryMap (IN GENERIC_MEMORY_TEST_PRIVATE *Private)
 
EFI_STATUS WriteMemory (IN GENERIC_MEMORY_TEST_PRIVATE *Private, IN EFI_PHYSICAL_ADDRESS Start, IN UINT64 Size)
 
EFI_STATUS VerifyMemory (IN GENERIC_MEMORY_TEST_PRIVATE *Private, IN EFI_PHYSICAL_ADDRESS Start, IN UINT64 Size)
 
EFI_STATUS DirectRangeTest (IN GENERIC_MEMORY_TEST_PRIVATE *Private, IN EFI_PHYSICAL_ADDRESS StartAddress, IN UINT64 Length, IN UINT64 Capabilities)
 
EFI_STATUS EFIAPI InitializeMemoryTest (IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This, IN EXTENDMEM_COVERAGE_LEVEL Level, OUT BOOLEAN *RequireSoftECCInit)
 
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 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)
 

Detailed Description

The generic memory test driver definition

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file LightMemoryTest.h.

Macro Definition Documentation

◆ EFI_GENERIC_MEMORY_TEST_PRIVATE_SIGNATURE

#define EFI_GENERIC_MEMORY_TEST_PRIVATE_SIGNATURE   SIGNATURE_32 ('G', 'E', 'M', 'T')

Definition at line 73 of file LightMemoryTest.h.

◆ EFI_MEMORY_INITIALIZED

#define EFI_MEMORY_INITIALIZED   0x0200000000000000ULL

Definition at line 36 of file LightMemoryTest.h.

◆ EFI_MEMORY_PRESENT

#define EFI_MEMORY_PRESENT   0x0100000000000000ULL

Definition at line 35 of file LightMemoryTest.h.

◆ EFI_MEMORY_TESTED

#define EFI_MEMORY_TESTED   0x0400000000000000ULL

Definition at line 37 of file LightMemoryTest.h.

◆ EFI_NONTESTED_MEMORY_RANGE_SIGNATURE

#define EFI_NONTESTED_MEMORY_RANGE_SIGNATURE   SIGNATURE_32 ('N', 'T', 'M', 'E')

Definition at line 50 of file LightMemoryTest.h.

◆ GENERIC_CACHELINE_SIZE

#define GENERIC_CACHELINE_SIZE   0x40

Definition at line 30 of file LightMemoryTest.h.

◆ GENERIC_MEMORY_TEST_PRIVATE_FROM_THIS

#define GENERIC_MEMORY_TEST_PRIVATE_FROM_THIS (   a)
Value:
CR ( \
a, \
GenericMemoryTest, \
EFI_GENERIC_MEMORY_TEST_PRIVATE_SIGNATURE \
)
#define CR(Record, TYPE, Field, TestSignature)
Definition: DebugLib.h:659

Definition at line 113 of file LightMemoryTest.h.

◆ NONTESTED_MEMORY_RANGE_FROM_LINK

#define NONTESTED_MEMORY_RANGE_FROM_LINK (   link)
Value:
CR ( \
link, \
Link, \
EFI_NONTESTED_MEMORY_RANGE_SIGNATURE \
)

Definition at line 62 of file LightMemoryTest.h.

◆ QUICK_SPAN_SIZE

#define QUICK_SPAN_SIZE   (TEST_BLOCK_SIZE >> 2)

Definition at line 43 of file LightMemoryTest.h.

◆ SPARSE_SPAN_SIZE

#define SPARSE_SPAN_SIZE   (TEST_BLOCK_SIZE >> 4)

Definition at line 44 of file LightMemoryTest.h.

◆ TEST_BLOCK_SIZE

#define TEST_BLOCK_SIZE   0x2000000

Definition at line 42 of file LightMemoryTest.h.

Function Documentation

◆ ConstructBaseMemoryRange()

EFI_STATUS ConstructBaseMemoryRange ( IN GENERIC_MEMORY_TEST_PRIVATE Private)

Construct the system base memory range through GCD service.

Parameters
[in]PrivatePoint to generic memory test driver's private data.
Return values
EFI_SUCCESSSuccessful construct the base memory range through GCD service.
EFI_OUT_OF_RESOURCECould not allocate needed resource from base memory.
OthersFailed to construct base memory range through GCD service.

Definition at line 90 of file LightMemoryTest.c.

◆ ConstructNonTestedMemoryRange()

EFI_STATUS ConstructNonTestedMemoryRange ( IN GENERIC_MEMORY_TEST_PRIVATE Private)

Construct the system non-tested memory range through GCD service.

Parameters
[in]PrivatePoint to generic memory test driver's private data.
Return values
EFI_SUCCESSSuccessful construct the non-tested memory range through GCD service.
EFI_OUT_OF_RESOURCECould not allocate needed resource from base memory.
OthersFailed to construct non-tested memory range through GCD service.

Definition at line 268 of file LightMemoryTest.c.

◆ DestroyLinkList()

VOID DestroyLinkList ( IN GENERIC_MEMORY_TEST_PRIVATE Private)

Destroy the link list base on the correspond link list type.

Parameters
[in]PrivatePoint to generic memory test driver's private data.

Definition at line 121 of file LightMemoryTest.c.

◆ DirectRangeTest()

EFI_STATUS DirectRangeTest ( IN GENERIC_MEMORY_TEST_PRIVATE Private,
IN EFI_PHYSICAL_ADDRESS  StartAddress,
IN UINT64  Length,
IN UINT64  Capabilities 
)

Test a range of the memory directly .

Parameters
[in]PrivatePoint to generic memory test driver's private data.
[in]StartAddressStarting address of the memory range to be tested.
[in]LengthLength in bytes of the memory range to be tested.
[in]CapabilitiesThe bit mask of attributes that the memory range supports.
Return values
EFI_SUCCESSSuccessful test the range of memory.
OthersFailed to test the range of memory.

Definition at line 222 of file LightMemoryTest.c.

◆ GenCompatibleRangeTest()

EFI_STATUS EFIAPI GenCompatibleRangeTest ( IN EFI_GENERIC_MEMORY_TEST_PROTOCOL This,
IN EFI_PHYSICAL_ADDRESS  StartAddress,
IN UINT64  Length 
)

Provides the capability to test the compatible range used by some special drivers.

Parameters
[in]ThisThe protocol instance pointer.
[in]StartAddressThe start address of the compatible memory range that must be below 16M.
[in]LengthThe compatible memory range's length.
Return values
EFI_SUCCESSThe compatible memory range pass the memory test.
EFI_INVALID_PARAMETERThe compatible memory range are not below Low 16M.

Provide capability to test compatible range which used by some special driver required using memory range before BDS perform memory test.

This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.CompatibleRangeTest. It simply sets the memory range to system memory.

Parameters
ThisProtocol instance pointer.
StartAddressThe start address of the memory range.
LengthThe memory range's length.
Return values
EFI_SUCCESSThe compatible memory range pass the memory test.
EFI_INVALID_PARAMETERThe compatible memory range must be below 16M.

Definition at line 727 of file LightMemoryTest.c.

◆ GenMemoryTestFinished()

EFI_STATUS EFIAPI GenMemoryTestFinished ( IN EFI_GENERIC_MEMORY_TEST_PROTOCOL This)

Finish the memory test.

Parameters
[in]ThisThe protocol instance pointer.
Return values
EFI_SUCCESSSuccess. All resources used in the memory test are freed.

The memory test finished.

This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.Finished. It simply returns EFI_SUCCESS.

Parameters
ThisProtocol instance pointer.
Return values
EFI_SUCCESSSuccessful free all the generic memory test driver allocated resource and notify to platform memory test driver that memory test finished.

Definition at line 683 of file LightMemoryTest.c.

◆ GenPerformMemoryTest()

EFI_STATUS EFIAPI GenPerformMemoryTest ( IN EFI_GENERIC_MEMORY_TEST_PROTOCOL This,
OUT UINT64 *  TestedMemorySize,
OUT UINT64 *  TotalMemorySize,
OUT BOOLEAN *  ErrorOut,
IN BOOLEAN  TestAbort 
)

Perform the memory test.

Parameters
[in]ThisThe protocol instance pointer.
[out]TestedMemorySizeReturn the tested extended memory size.
[out]TotalMemorySizeReturn the whole system physical memory size. The total memory size does not include memory in a slot with a disabled DIMM.
[out]ErrorOutTRUE if the memory error occurred.
[in]IfTestAbortIndicates that the user pressed "ESC" to skip the memory test.
Return values
EFI_SUCCESSOne block of memory passed the test.
EFI_NOT_FOUNDAll memory blocks have already been tested.
EFI_DEVICE_ERRORMemory device error occurred, and no agent can handle it.

Definition at line 563 of file LightMemoryTest.c.

◆ InitializeMemoryTest()

EFI_STATUS EFIAPI InitializeMemoryTest ( IN EFI_GENERIC_MEMORY_TEST_PROTOCOL This,
IN EXTENDMEM_COVERAGE_LEVEL  Level,
OUT BOOLEAN *  RequireSoftECCInit 
)

Initialize the generic memory test.

Parameters
[in]ThisThe protocol instance pointer.
[in]LevelThe coverage level of the memory test.
[out]RequireSoftECCInitIndicate if the memory need software ECC init.
Return values
EFI_SUCCESSThe generic memory test is initialized correctly.
EFI_NO_MEDIAThe system had no memory to be tested.

Initialize the generic memory test.

This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.MemoryTestInit. It simply promotes untested reserved memory to system memory without real test.

Parameters
ThisProtocol instance pointer.
LevelThe coverage level of the memory test.
RequireSoftECCInitIndicate if the memory need software ECC init.
Return values
EFI_SUCCESSThe generic memory test initialized correctly.
EFI_NO_MEDIAThere is not any non-tested memory found, in this function if not any non-tesed memory found means that the memory test driver have not detect any non-tested extended memory of current system.

Definition at line 460 of file LightMemoryTest.c.

◆ PerformAddressDataLineTest()

EFI_STATUS PerformAddressDataLineTest ( IN GENERIC_MEMORY_TEST_PRIVATE Private)

Perform the address line walking ones test.

Parameters
[in]PrivatePoint to generic memory test driver's private data.
Return values
EFI_SUCCESSSuccessful finished walking ones test.
EFI_OUT_OF_RESOURCECould not get resource in base memory.
EFI_ACCESS_DENIEDCode may can not run here because if walking one test failed, system may be already halt.

Definition at line 804 of file LightMemoryTest.c.

◆ UpdateMemoryMap()

EFI_STATUS UpdateMemoryMap ( IN GENERIC_MEMORY_TEST_PRIVATE Private)

Add the extened memory to whole system memory map.

Parameters
[in]PrivatePoint to generic memory test driver's private data.
Return values
EFI_SUCCESSSuccessful add all the extended memory to system memory map.
OthersFailed to add the tested extended memory.

Definition at line 185 of file LightMemoryTest.c.

◆ VerifyMemory()

EFI_STATUS VerifyMemory ( IN GENERIC_MEMORY_TEST_PRIVATE Private,
IN EFI_PHYSICAL_ADDRESS  Start,
IN UINT64  Size 
)

Verify the range of physical memory which covered by memory test pattern.

This function will also do not return any informatin just cause system reset, because the handle error encount fatal error and disable the bad DIMMs.

Parameters
[in]PrivatePoint to generic memory test driver's private data.
[in]StartThe memory range's start address.
[in]SizeThe memory range's size.
Return values
EFI_SUCCESSSuccessful verify the range of memory, no errors' location found.
OthersThe range of memory have errors contained.

Definition at line 379 of file LightMemoryTest.c.

◆ WriteMemory()

EFI_STATUS WriteMemory ( IN GENERIC_MEMORY_TEST_PRIVATE Private,
IN EFI_PHYSICAL_ADDRESS  Start,
IN UINT64  Size 
)

Write the memory test pattern into a range of physical memory.

Parameters
[in]PrivatePoint to generic memory test driver's private data.
[in]StartThe memory range's start address.
[in]SizeThe memory range's size.
Return values
EFI_SUCCESSSuccessful write the test pattern into the non-tested memory.
OthersThe test pattern may not really write into the physical memory.

Definition at line 330 of file LightMemoryTest.c.