diff options
author | xli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-07 09:34:50 +0000 |
---|---|---|
committer | xli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-07 09:34:50 +0000 |
commit | b3764698fa1aeed229e82abdddea18c9c3bb1eb4 (patch) | |
tree | a0a575d09683d7a90f6932d246a704aefc071268 /MdeModulePkg/Universal/MemoryTest | |
parent | a7cc3d261c0572739c0587af1a339237b7947159 (diff) | |
download | edk2-platforms-b3764698fa1aeed229e82abdddea18c9c3bb1eb4.tar.xz |
Code scrub for NullMemoryTest driver.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6429 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/MemoryTest')
3 files changed, 160 insertions, 119 deletions
diff --git a/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.c b/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.c index 61e2d21d09..e392d08a7b 100644 --- a/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.c +++ b/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.c @@ -1,5 +1,5 @@ /** @file
- Intall memory test protocol and bypass the real memory test procedure.
+ Implementation of Generic Memory Test Protocol which does not perform real memory test.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
@@ -15,16 +15,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "NullMemoryTest.h"
-//
-// Module global members
-//
UINT64 mTestedSystemMemory = 0;
UINT64 mTotalSystemMemory = 0;
EFI_HANDLE mGenericMemoryTestHandle;
-//
-// Driver entry here
-//
EFI_GENERIC_MEMORY_TEST_PROTOCOL mGenericMemoryTest = {
InitializeMemoryTest,
GenPerformMemoryTest,
@@ -32,51 +26,55 @@ EFI_GENERIC_MEMORY_TEST_PROTOCOL mGenericMemoryTest = { GenCompatibleRangeTest
};
+/**
+ Entry point of the NULL memory test driver.
+
+ This function is the entry point of the NULL memory test driver.
+ It simply installs the Generic Memory Test Protocol.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS Generic Memory Test Protocol is successfully installed.
+
+**/
EFI_STATUS
EFIAPI
GenericMemoryTestEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
-/*++
-
-Routine Description:
-
- The generic memory test driver's entry point, it can initialize private data
- to default value
-
-Arguments:
-
- ImageHandle of the loaded driver
- Pointer to the System Table
-
-Returns:
-
- Status
-
- EFI_SUCCESS - Protocol successfully installed
- EFI_OUT_OF_RESOURCES - Can not allocate protocol data structure in base
- memory
-
---*/
{
EFI_STATUS Status;
- //
- // Install the protocol
- //
Status = gBS->InstallProtocolInterface (
&mGenericMemoryTestHandle,
&gEfiGenericMemTestProtocolGuid,
EFI_NATIVE_INTERFACE,
&mGenericMemoryTest
);
+ ASSERT_EFI_ERROR (Status);
- return Status;
+ return EFI_SUCCESS;
}
-//
-// EFI_GENERIC_MEMORY_TEST_PROTOCOL implementation
-//
+
+/**
+ 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.
+
+ @param This Protocol instance pointer.
+ @param Level The coverage level of the memory test.
+ @param RequireSoftECCInit Indicate if the memory need software ECC init.
+
+ @retval EFI_SUCCESS The generic memory test initialized correctly.
+ @retval 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.
+
+**/
EFI_STATUS
EFIAPI
InitializeMemoryTest (
@@ -84,15 +82,6 @@ InitializeMemoryTest ( IN EXTENDMEM_COVERAGE_LEVEL Level,
OUT BOOLEAN *RequireSoftECCInit
)
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
{
UINTN NumberOfDescriptors;
EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;
@@ -104,6 +93,9 @@ Returns: (MemorySpaceMap[Index].Capabilities & (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED)) ==
(EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED)
) {
+ //
+ // For those reserved memory that have not been tested, simply promote to system memory.
+ //
gDS->RemoveMemorySpace (
MemorySpaceMap[Index].BaseAddress,
MemorySpaceMap[Index].Length
@@ -130,6 +122,29 @@ Returns: return EFI_SUCCESS;
}
+/**
+ Perform the memory test.
+
+ This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.PerformMemoryTest.
+ It simply returns EFI_NOT_FOUND.
+
+ @param This Protocol instance pointer.
+ @param TestedMemorySize Return the tested extended memory size.
+ @param TotalMemorySize Return the whole system physical memory size, this
+ value may be changed if in some case some error
+ DIMMs be disabled.
+ @param ErrorOut Any time the memory error occurs, this will be
+ TRUE.
+ @param IfTestAbort Indicate if the user press "ESC" to skip the memory
+ test.
+
+ @retval EFI_SUCCESS One block of memory test ok, the block size is hide
+ internally.
+ @retval EFI_NOT_FOUND Indicate all the non-tested memory blocks have
+ already go through.
+ @retval EFI_DEVICE_ERROR Mis-compare error, and no agent can handle it
+
+**/
EFI_STATUS
EFIAPI
GenPerformMemoryTest (
@@ -139,15 +154,6 @@ GenPerformMemoryTest ( OUT BOOLEAN *ErrorOut,
IN BOOLEAN TestAbort
)
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
{
*ErrorOut = FALSE;
*TestedMemorySize = mTestedSystemMemory;
@@ -157,24 +163,43 @@ Returns: }
+/**
+ The memory test finished.
+
+ This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.Finished.
+ It simply returns EFI_SUCCESS.
+
+ @param This Protocol instance pointer.
+
+ @retval EFI_SUCCESS Successful free all the generic memory test driver
+ allocated resource and notify to platform memory
+ test driver that memory test finished.
+
+**/
EFI_STATUS
EFIAPI
GenMemoryTestFinished (
IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This
)
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
{
return EFI_SUCCESS;
}
+/**
+ 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.
+
+ @param This Protocol instance pointer.
+ @param StartAddress The start address of the memory range.
+ @param Length The memory range's length.
+
+ @retval EFI_SUCCESS The compatible memory range pass the memory test.
+ @retval EFI_INVALID_PARAMETER The compatible memory range must be below 16M.
+
+**/
EFI_STATUS
EFIAPI
GenCompatibleRangeTest (
@@ -182,19 +207,10 @@ GenCompatibleRangeTest ( IN EFI_PHYSICAL_ADDRESS StartAddress,
IN UINT64 Length
)
-/*++
-
-Routine Description:
-
-Arguments:
-
-Returns:
-
---*/
{
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR descriptor;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
- gDS->GetMemorySpaceDescriptor (StartAddress, &descriptor);
+ gDS->GetMemorySpaceDescriptor (StartAddress, &Descriptor);
gDS->RemoveMemorySpace (StartAddress, Length);
@@ -202,7 +218,7 @@ Returns: EfiGcdMemoryTypeSystemMemory,
StartAddress,
Length,
- descriptor.Capabilities &~(EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME)
+ Descriptor.Capabilities &~(EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME)
);
return EFI_SUCCESS;
diff --git a/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.h b/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.h index 3bbc826153..1863af5bd9 100644 --- a/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.h +++ b/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.h @@ -1,5 +1,5 @@ /** @file
- The generic memory test driver definition
+ Include file of the NULL memory test driver.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
@@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
-#ifndef _NULL_MEMORY_TEST_H
-#define _NULL_MEMORY_TEST_H
+#ifndef _NULL_MEMORY_TEST_H_
+#define _NULL_MEMORY_TEST_H_
#include <PiDxe.h>
@@ -28,51 +28,29 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <Library/MemoryAllocationLib.h>
//
-// attributes for reserved memory before it is promoted to system memory
+// Definition of memory status.
//
#define EFI_MEMORY_PRESENT 0x0100000000000000ULL
#define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
#define EFI_MEMORY_TESTED 0x0400000000000000ULL
+/**
+ Initialize the generic memory test.
-//
-// Some global define
-//
-#define GENERIC_CACHELINE_SIZE 0x40
+ This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.MemoryTestInit.
+ It simply promotes untested reserved memory to system memory without real test.
-//
-// The SPARSE_SPAN_SIZE size can not small then the MonoTestSize
-//
-#define TEST_BLOCK_SIZE 0x2000000
-#define QUICK_SPAN_SIZE (TEST_BLOCK_SIZE >> 2)
-#define SPARSE_SPAN_SIZE (TEST_BLOCK_SIZE >> 4)
+ @param This Protocol instance pointer.
+ @param Level The coverage level of the memory test.
+ @param RequireSoftECCInit Indicate if the memory need software ECC init.
-//
-// This structure records every nontested memory range parsed through GCD
-// service.
-//
-#define EFI_NONTESTED_MEMORY_RANGE_SIGNATURE EFI_SIGNATURE_32 ('N', 'T', 'M', 'E')
-typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
- EFI_PHYSICAL_ADDRESS StartAddress;
- UINT64 Length;
- UINT64 Capabilities;
- BOOLEAN Above4G;
- BOOLEAN AlreadyMapped;
-} NONTESTED_MEMORY_RANGE;
-
-#define NONTESTED_MEMORY_RANGE_FROM_LINK(link) \
- CR(link, NONTESTED_MEMORY_RANGE, Link, EFI_NONTESTED_MEMORY_RANGE_SIGNATURE)
+ @retval EFI_SUCCESS The generic memory test initialized correctly.
+ @retval 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.
-//
-// This is the memory test driver's structure definition
-//
-#define EFI_GENERIC_MEMORY_TEST_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('G', 'E', 'M', 'T')
-
-//
-// Function Prototypes
-//
+**/
EFI_STATUS
EFIAPI
InitializeMemoryTest (
@@ -81,6 +59,29 @@ InitializeMemoryTest ( OUT BOOLEAN *RequireSoftECCInit
);
+/**
+ Perform the memory test.
+
+ This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.PerformMemoryTest.
+ It simply returns EFI_NOT_FOUND.
+
+ @param This Protocol instance pointer.
+ @param TestedMemorySize Return the tested extended memory size.
+ @param TotalMemorySize Return the whole system physical memory size, this
+ value may be changed if in some case some error
+ DIMMs be disabled.
+ @param ErrorOut Any time the memory error occurs, this will be
+ TRUE.
+ @param IfTestAbort Indicate if the user press "ESC" to skip the memory
+ test.
+
+ @retval EFI_SUCCESS One block of memory test ok, the block size is hide
+ internally.
+ @retval EFI_NOT_FOUND Indicate all the non-tested memory blocks have
+ already go through.
+ @retval EFI_DEVICE_ERROR Mis-compare error, and no agent can handle it
+
+**/
EFI_STATUS
EFIAPI
GenPerformMemoryTest (
@@ -91,12 +92,40 @@ GenPerformMemoryTest ( IN BOOLEAN TestAbort
);
+/**
+ The memory test finished.
+
+ This function implements EFI_GENERIC_MEMORY_TEST_PROTOCOL.Finished.
+ It simply returns EFI_SUCCESS.
+
+ @param This Protocol instance pointer.
+
+ @retval EFI_SUCCESS Successful free all the generic memory test driver
+ allocated resource and notify to platform memory
+ test driver that memory test finished.
+
+**/
EFI_STATUS
EFIAPI
GenMemoryTestFinished (
IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This
);
+/**
+ 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 set the memory range to system memory.
+
+ @param This Protocol instance pointer.
+ @param StartAddress The start address of the memory range.
+ @param Length The memory range's length.
+
+ @retval EFI_SUCCESS The compatible memory range pass the memory test.
+ @retval EFI_INVALID_PARAMETER The compatible memory range must be below 16M.
+
+**/
EFI_STATUS
EFIAPI
GenCompatibleRangeTest (
diff --git a/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf b/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf index cdceb9c0e9..cf3c39cf92 100644 --- a/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf +++ b/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf @@ -1,9 +1,5 @@ #/** @file
-#
-# Component description file for NullMemoryTest module.
-#
-# This driver installs EFI_GENERIC_MEMORY_TEST_PROTOCOL to
-# provide simple generic memory test functions.
+# This driver installs Generic Memory Test Protocol which does not perform real memory test.
#
# Copyright (c) 2006 - 2008, Intel Corporation. <BR>
# All rights reserved. This program and the accompanying materials
@@ -52,4 +48,4 @@ gEfiGenericMemTestProtocolGuid # PROTOCOL ALWAYS_PRODUCED
[Depex]
- TRUE
\ No newline at end of file + TRUE
|