TianoCore EDK2 master
|
#include <Guid/StatusCodeDataTypeId.h>
#include <Protocol/GenericMemoryTest.h>
#include <Protocol/Cpu.h>
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/HobLib.h>
#include <Library/DxeServicesTableLib.h>
#include <Library/ReportStatusCodeLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
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) |
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.
#define EFI_GENERIC_MEMORY_TEST_PRIVATE_SIGNATURE SIGNATURE_32 ('G', 'E', 'M', 'T') |
Definition at line 73 of file LightMemoryTest.h.
#define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL |
Definition at line 36 of file LightMemoryTest.h.
#define EFI_MEMORY_PRESENT 0x0100000000000000ULL |
Definition at line 35 of file LightMemoryTest.h.
#define EFI_MEMORY_TESTED 0x0400000000000000ULL |
Definition at line 37 of file LightMemoryTest.h.
#define EFI_NONTESTED_MEMORY_RANGE_SIGNATURE SIGNATURE_32 ('N', 'T', 'M', 'E') |
Definition at line 50 of file LightMemoryTest.h.
#define GENERIC_CACHELINE_SIZE 0x40 |
Definition at line 30 of file LightMemoryTest.h.
#define GENERIC_MEMORY_TEST_PRIVATE_FROM_THIS | ( | a | ) |
Definition at line 113 of file LightMemoryTest.h.
#define NONTESTED_MEMORY_RANGE_FROM_LINK | ( | link | ) |
Definition at line 62 of file LightMemoryTest.h.
#define QUICK_SPAN_SIZE (TEST_BLOCK_SIZE >> 2) |
Definition at line 43 of file LightMemoryTest.h.
#define SPARSE_SPAN_SIZE (TEST_BLOCK_SIZE >> 4) |
Definition at line 44 of file LightMemoryTest.h.
#define TEST_BLOCK_SIZE 0x2000000 |
Definition at line 42 of file LightMemoryTest.h.
EFI_STATUS ConstructBaseMemoryRange | ( | IN GENERIC_MEMORY_TEST_PRIVATE * | Private | ) |
Construct the system base memory range through GCD service.
[in] | Private | Point to generic memory test driver's private data. |
EFI_SUCCESS | Successful construct the base memory range through GCD service. |
EFI_OUT_OF_RESOURCE | Could not allocate needed resource from base memory. |
Others | Failed to construct base memory range through GCD service. |
Definition at line 90 of file LightMemoryTest.c.
EFI_STATUS ConstructNonTestedMemoryRange | ( | IN GENERIC_MEMORY_TEST_PRIVATE * | Private | ) |
Construct the system non-tested memory range through GCD service.
[in] | Private | Point to generic memory test driver's private data. |
EFI_SUCCESS | Successful construct the non-tested memory range through GCD service. |
EFI_OUT_OF_RESOURCE | Could not allocate needed resource from base memory. |
Others | Failed to construct non-tested memory range through GCD service. |
Definition at line 268 of file LightMemoryTest.c.
VOID DestroyLinkList | ( | IN GENERIC_MEMORY_TEST_PRIVATE * | Private | ) |
Destroy the link list base on the correspond link list type.
[in] | Private | Point to generic memory test driver's private data. |
Definition at line 121 of file LightMemoryTest.c.
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 .
[in] | Private | Point to generic memory test driver's private data. |
[in] | StartAddress | Starting address of the memory range to be tested. |
[in] | Length | Length in bytes of the memory range to be tested. |
[in] | Capabilities | The bit mask of attributes that the memory range supports. |
EFI_SUCCESS | Successful test the range of memory. |
Others | Failed to test the range of memory. |
Definition at line 222 of file LightMemoryTest.c.
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.
[in] | This | The protocol instance pointer. |
[in] | StartAddress | The start address of the compatible memory range that must be below 16M. |
[in] | Length | The compatible memory range's length. |
EFI_SUCCESS | The compatible memory range pass the memory test. |
EFI_INVALID_PARAMETER | The 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.
This | Protocol instance pointer. |
StartAddress | The start address of the memory range. |
Length | The memory range's length. |
EFI_SUCCESS | The compatible memory range pass the memory test. |
EFI_INVALID_PARAMETER | The compatible memory range must be below 16M. |
Definition at line 727 of file LightMemoryTest.c.
EFI_STATUS EFIAPI GenMemoryTestFinished | ( | IN EFI_GENERIC_MEMORY_TEST_PROTOCOL * | This | ) |
Finish the memory test.
[in] | This | The protocol instance pointer. |
EFI_SUCCESS | Success. 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.
This | Protocol instance pointer. |
EFI_SUCCESS | Successful 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.
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.
[in] | This | The protocol instance pointer. |
[out] | TestedMemorySize | Return the tested extended memory size. |
[out] | TotalMemorySize | Return the whole system physical memory size. The total memory size does not include memory in a slot with a disabled DIMM. |
[out] | ErrorOut | TRUE if the memory error occurred. |
[in] | IfTestAbort | Indicates that the user pressed "ESC" to skip the memory test. |
EFI_SUCCESS | One block of memory passed the test. |
EFI_NOT_FOUND | All memory blocks have already been tested. |
EFI_DEVICE_ERROR | Memory device error occurred, and no agent can handle it. |
Definition at line 563 of file LightMemoryTest.c.
EFI_STATUS EFIAPI InitializeMemoryTest | ( | IN EFI_GENERIC_MEMORY_TEST_PROTOCOL * | This, |
IN EXTENDMEM_COVERAGE_LEVEL | Level, | ||
OUT BOOLEAN * | RequireSoftECCInit | ||
) |
Initialize the generic memory test.
[in] | This | The protocol instance pointer. |
[in] | Level | The coverage level of the memory test. |
[out] | RequireSoftECCInit | Indicate if the memory need software ECC init. |
EFI_SUCCESS | The generic memory test is initialized correctly. |
EFI_NO_MEDIA | The 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.
This | Protocol instance pointer. |
Level | The coverage level of the memory test. |
RequireSoftECCInit | Indicate if the memory need software ECC init. |
EFI_SUCCESS | The generic memory test initialized correctly. |
EFI_NO_MEDIA | There 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.
EFI_STATUS PerformAddressDataLineTest | ( | IN GENERIC_MEMORY_TEST_PRIVATE * | Private | ) |
Perform the address line walking ones test.
[in] | Private | Point to generic memory test driver's private data. |
EFI_SUCCESS | Successful finished walking ones test. |
EFI_OUT_OF_RESOURCE | Could not get resource in base memory. |
EFI_ACCESS_DENIED | Code may can not run here because if walking one test failed, system may be already halt. |
Definition at line 804 of file LightMemoryTest.c.
EFI_STATUS UpdateMemoryMap | ( | IN GENERIC_MEMORY_TEST_PRIVATE * | Private | ) |
Add the extened memory to whole system memory map.
[in] | Private | Point to generic memory test driver's private data. |
EFI_SUCCESS | Successful add all the extended memory to system memory map. |
Others | Failed to add the tested extended memory. |
Definition at line 185 of file LightMemoryTest.c.
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.
[in] | Private | Point to generic memory test driver's private data. |
[in] | Start | The memory range's start address. |
[in] | Size | The memory range's size. |
EFI_SUCCESS | Successful verify the range of memory, no errors' location found. |
Others | The range of memory have errors contained. |
Definition at line 379 of file LightMemoryTest.c.
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.
[in] | Private | Point to generic memory test driver's private data. |
[in] | Start | The memory range's start address. |
[in] | Size | The memory range's size. |
EFI_SUCCESS | Successful write the test pattern into the non-tested memory. |
Others | The test pattern may not really write into the physical memory. |
Definition at line 330 of file LightMemoryTest.c.