Rename the MemoryTest Pei and Dxe.
authoryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 19 Jul 2007 08:26:33 +0000 (08:26 +0000)
committeryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 19 Jul 2007 08:26:33 +0000 (08:26 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3361 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/MdeModulePkg.dsc
MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.c [new file with mode: 0644]
MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.h [new file with mode: 0644]
MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.msa [new file with mode: 0644]
MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTestPei.inf [new file with mode: 0644]
MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.c [new file with mode: 0644]
MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.h [new file with mode: 0644]
MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf [new file with mode: 0644]
MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.msa [new file with mode: 0644]
Nt32Pkg/Nt32Pkg.dsc
Nt32Pkg/Nt32Pkg.fdf

index 0ee36812c9d4c67908b131a36789c9a9ebd83cf4..c505adfe099434e6f793b1037321b54fd34430e0 100644 (file)
   $(WORKSPACE)/MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf\r
   $(WORKSPACE)/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.inf\r
 \r
-  $(WORKSPACE)/MdeModulePkg/Universal/GenericMemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf\r
   $(WORKSPACE)/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteDxe/FtwLite.inf\r
-  $(WORKSPACE)/MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.inf\r
+  $(WORKSPACE)/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf\r
+  $(WORKSPACE)/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTestPei.inf\r
   $(WORKSPACE)/MdeModulePkg/Universal/FirmwareVolume/Crc32SectionExtractDxe/Crc32SectionExtractDxe.inf\r
   $(WORKSPACE)/MdeModulePkg/Universal/RuntimeDxe/Runtime.inf\r
 \r
diff --git a/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.c b/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.c
new file mode 100644 (file)
index 0000000..f1ab82d
--- /dev/null
@@ -0,0 +1,145 @@
+/*++\r
+\r
+Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Module Name:\r
+\r
+  BaseMemoryTest.c\r
+  \r
+Abstract:\r
+  \r
+  The PEI memory test support\r
+\r
+--*/\r
+\r
+#include <BaseMemoryTest.h>\r
+\r
+static PEI_BASE_MEMORY_TEST_PPI mPeiBaseMemoryTestPpi = { BaseMemoryTest };\r
+\r
+static EFI_PEI_PPI_DESCRIPTOR   PpiListPeiBaseMemoryTest = {\r
+  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
+  &gPeiBaseMemoryTestPpiGuid,\r
+  &mPeiBaseMemoryTestPpi\r
+};\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+PeiBaseMemoryTestInit (\r
+  IN EFI_FFS_FILE_HEADER       *FfsHeader,\r
+  IN EFI_PEI_SERVICES          **PeiServices\r
+  )\r
+/*++\r
+Description:\r
+\r
+  Entry point function of BaseMemoryTestInit Peim.\r
+\r
+Arguments:\r
+\r
+  PeiServices           - General purpose services available to every PEIM.\r
+  FfsHeader             - Ffs header pointer\r
+\r
+Returns:\r
+\r
+  Status                - Result of InstallPpi\r
+\r
+--*/  \r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  Status = (**PeiServices).InstallPpi (PeiServices, &PpiListPeiBaseMemoryTest);\r
+\r
+  return Status;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BaseMemoryTest (\r
+  IN  EFI_PEI_SERVICES                   **PeiServices,\r
+  IN PEI_BASE_MEMORY_TEST_PPI            *This,\r
+  IN  EFI_PHYSICAL_ADDRESS               BeginAddress,\r
+  IN  UINT64                             MemoryLength,\r
+  IN  PEI_MEMORY_TEST_OP                 Operation,\r
+  OUT EFI_PHYSICAL_ADDRESS               *ErrorAddress\r
+  )\r
+/*++\r
+Description:\r
+\r
+  Test base memory.\r
+\r
+Arguments:\r
+\r
+  PeiServices   - General purpose services available to every PEIM.\r
+  This          - Pei memory test PPI pointer.\r
+  BeginAddress  - Beginning of the memory address to be checked.\r
+  MemoryLength  - Bytes of memory range to be checked.\r
+  Operation     - Type of memory check operation to be performed.\r
+  ErrorAddress  - Return the address of the error memory address.\r
+  ErrorAddress  - Address which has error when checked.\r
+\r
+Returns:\r
+\r
+  Status        - Result of InstallPpi\r
+\r
+--*/    \r
+{\r
+  UINT32                TestPattern;\r
+  EFI_PHYSICAL_ADDRESS  TempAddress;\r
+  UINT32                SpanSize;\r
+\r
+  REPORT_STATUS_CODE (EFI_PROGRESS_CODE,  PcdGet32 (PcdStatusCodeValueMemoryTestStarted));\r
+\r
+  TestPattern = TEST_PATTERN;\r
+  SpanSize    = 0;\r
+\r
+  //\r
+  // Make sure we don't try and test anything above the max physical address range\r
+  //\r
+  ASSERT (BeginAddress + MemoryLength < EFI_MAX_ADDRESS);\r
+\r
+  switch (Operation) {\r
+  case Extensive:\r
+    SpanSize = 0x4;\r
+    break;\r
+\r
+  case Sparse:\r
+  case Quick:\r
+    SpanSize = COVER_SPAN;\r
+    break;\r
+\r
+  case Ignore:\r
+    goto Done;\r
+    break;\r
+  }\r
+  //\r
+  // Write the test pattern into memory range\r
+  //\r
+  TempAddress = BeginAddress;\r
+  while (TempAddress < BeginAddress + MemoryLength) {\r
+    (*(UINT32 *) (UINTN) TempAddress) = TestPattern;\r
+    TempAddress += SpanSize;\r
+  }\r
+  //\r
+  // Read pattern from memory and compare it\r
+  //\r
+  TempAddress = BeginAddress;\r
+  while (TempAddress < BeginAddress + MemoryLength) {\r
+    if ((*(UINT32 *) (UINTN) TempAddress) != TestPattern) {\r
+      *ErrorAddress = TempAddress;\r
+      REPORT_STATUS_CODE (EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED, PcdGet32 (PcdStatusCodeValueUncorrectableMemoryError));\r
+\r
+      return EFI_DEVICE_ERROR;\r
+    }\r
+\r
+    TempAddress += SpanSize;\r
+  }\r
+\r
+Done:\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.h b/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.h
new file mode 100644 (file)
index 0000000..ed6081a
--- /dev/null
@@ -0,0 +1,95 @@
+/*++\r
+\r
+Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Module Name:\r
+\r
+  BaseMemoryTest.h\r
+   \r
+Abstract:\r
+\r
+  Tiano PEIM to provide a PEI memory test service.\r
+\r
+--*/\r
+\r
+#ifndef _PEI_BASE_MEMORY_TEST_H_\r
+#define _PEI_BASE_MEMORY_TEST_H_\r
+\r
+#include <PiPei.h>\r
+#include <Ppi/BaseMemoryTest.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/PeimEntryPoint.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
+#include <Library/PcdLib.h>\r
+\r
+\r
+//\r
+// Some global define\r
+//\r
+#define COVER_SPAN    0x40000\r
+#define TEST_PATTERN  0x5A5A5A5A\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+PeiBaseMemoryTestInit (\r
+  IN EFI_FFS_FILE_HEADER       *FfsHeader,\r
+  IN EFI_PEI_SERVICES          **PeiServices\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  TODO: Add function description\r
+\r
+Arguments:\r
+\r
+  FfsHeader   - TODO: add argument description\r
+  PeiServices - TODO: add argument description\r
+\r
+Returns:\r
+\r
+  TODO: add return values\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BaseMemoryTest (\r
+  IN  EFI_PEI_SERVICES                   **PeiServices,\r
+  IN PEI_BASE_MEMORY_TEST_PPI            *This,\r
+  IN  EFI_PHYSICAL_ADDRESS               BeginAddress,\r
+  IN  UINT64                             MemoryLength,\r
+  IN  PEI_MEMORY_TEST_OP                 Operation,\r
+  OUT EFI_PHYSICAL_ADDRESS               *ErrorAddress\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  TODO: Add function description\r
+\r
+Arguments:\r
+\r
+  PeiServices   - TODO: add argument description\r
+  This          - TODO: add argument description\r
+  BeginAddress  - TODO: add argument description\r
+  MemoryLength  - TODO: add argument description\r
+  Operation     - TODO: add argument description\r
+  ErrorAddress  - TODO: add argument description\r
+\r
+Returns:\r
+\r
+  TODO: add return values\r
+\r
+--*/\r
+;\r
+\r
+#endif\r
diff --git a/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.msa b/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTest.msa
new file mode 100644 (file)
index 0000000..95c5c27
--- /dev/null
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">\r
+  <MsaHeader>\r
+    <ModuleName>PeiBaseMemoryTestInit</ModuleName>\r
+    <ModuleType>PEIM</ModuleType>\r
+    <GuidValue>736EB068-8C01-47c5-964B-1C57BD5D4D64</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>Component description file for PeiBaseMemoryTestInit module.</Abstract>\r
+    <Description>This driver provides memory test ppi for memory test in Pei Phase.</Description>\r
+    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>\r
+    <License>All rights reserved. This program and the accompanying materials\r
+      are licensed and made available under the terms and conditions of the BSD License\r
+      which accompanies this distribution.  The full text of the license may be found at\r
+      http://opensource.org/licenses/bsd-license.php\r
+      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
+    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>\r
+  </MsaHeader>\r
+  <ModuleDefinitions>\r
+    <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>PeiBaseMemoryTestInit</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED" RecommendedInstanceGuid="bda39d3a-451b-4350-8266-81ab10fa0523">\r
+      <Keyword>DebugLib</Keyword>\r
+      <HelpText>Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg.</HelpText>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PeimEntryPoint</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>ReportStatusCodeLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>BaseMemoryTest.h</Filename>\r
+    <Filename>BaseMemoryTest.c</Filename>\r
+  </SourceFiles>\r
+  <PackageDependencies>\r
+    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
+  </PackageDependencies>\r
+  <PPIs>\r
+    <Ppi Usage="ALWAYS_PRODUCED">\r
+      <PpiCName>gPeiBaseMemoryTestPpiGuid</PpiCName>\r
+    </Ppi>\r
+  </PPIs>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+    <Extern>\r
+      <ModuleEntryPoint>PeiBaseMemoryTestInit</ModuleEntryPoint>\r
+    </Extern>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTestPei.inf b/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTestPei.inf
new file mode 100644 (file)
index 0000000..7e119bb
--- /dev/null
@@ -0,0 +1,48 @@
+#/** @file\r
+# Component description file for PeiBaseMemoryTestInit module.\r
+#\r
+# This driver provides memory test ppi for memory test in Pei Phase.\r
+# Copyright (c) 2006 - 2007, Intel Corporation\r
+#\r
+#  All rights reserved. This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution. The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+#**/\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = PeiBaseMemoryTestInit\r
+  FILE_GUID                      = 736EB068-8C01-47c5-964B-1C57BD5D4D64\r
+  MODULE_TYPE                    = PEIM\r
+  VERSION_STRING                 = 1.0\r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+  ENTRY_POINT                    = PeiBaseMemoryTestInit\r
+\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+\r
+[Sources.common]\r
+  BaseMemoryTest.c\r
+  BaseMemoryTest.h\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+\r
+[LibraryClasses]\r
+  ReportStatusCodeLib\r
+  PeimEntryPoint\r
+  DebugLib\r
+\r
+[Ppis]\r
+  gPeiBaseMemoryTestPpiGuid                     # PPI ALWAYS_PRODUCED\r
+\r
+[PcdsFixedAtBuild.common]\r
+  PcdStatusCodeValueMemoryTestStarted|gEfiMdePkgTokenSpaceGuid\r
+  PcdStatusCodeValueUncorrectableMemoryError|gEfiMdePkgTokenSpaceGuid\r
+\r
diff --git a/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.c b/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.c
new file mode 100644 (file)
index 0000000..7a20a41
--- /dev/null
@@ -0,0 +1,214 @@
+/*++\r
+\r
+Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Module Name:\r
+\r
+  NullMemoryTest.c\r
+  \r
+Abstract:\r
+\r
+--*/\r
+\r
+\r
+#include "NullMemoryTest.h"\r
+\r
+//\r
+// Module global members\r
+//\r
+UINT64                            mTestedSystemMemory = 0;\r
+UINT64                            mTotalSystemMemory  = 0;\r
+EFI_HANDLE                        mGenericMemoryTestHandle;\r
+\r
+//\r
+// Driver entry here\r
+//\r
+EFI_GENERIC_MEMORY_TEST_PROTOCOL  mGenericMemoryTest = {\r
+  InitializeMemoryTest,\r
+  GenPerformMemoryTest,\r
+  GenMemoryTestFinished,\r
+  GenCompatibleRangeTest\r
+};\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+GenericMemoryTestEntryPoint (\r
+  IN  EFI_HANDLE           ImageHandle,\r
+  IN  EFI_SYSTEM_TABLE     *SystemTable\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  The generic memory test driver's entry point, it can initialize private data\r
+  to default value\r
+\r
+Arguments:\r
+\r
+  ImageHandle of the loaded driver\r
+  Pointer to the System Table\r
+\r
+Returns:\r
+\r
+  Status\r
+\r
+  EFI_SUCCESS           - Protocol successfully installed\r
+  EFI_OUT_OF_RESOURCES  - Can not allocate protocol data structure in base\r
+                          memory\r
+\r
+--*/\r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  //\r
+  // Install the protocol\r
+  //\r
+  Status = gBS->InstallProtocolInterface (\r
+                  &mGenericMemoryTestHandle,\r
+                  &gEfiGenericMemTestProtocolGuid,\r
+                  EFI_NATIVE_INTERFACE,\r
+                  &mGenericMemoryTest\r
+                  );\r
+\r
+  return Status;\r
+}\r
+//\r
+// EFI_GENERIC_MEMORY_TEST_PROTOCOL implementation\r
+//\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeMemoryTest (\r
+  IN EFI_GENERIC_MEMORY_TEST_PROTOCOL          *This,\r
+  IN  EXTENDMEM_COVERAGE_LEVEL                 Level,\r
+  OUT BOOLEAN                                  *RequireSoftECCInit\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+Arguments:\r
+\r
+Returns:\r
+\r
+--*/\r
+{\r
+  UINTN                           NumberOfDescriptors;\r
+  EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;\r
+  UINTN                           Index;\r
+\r
+  gDS->GetMemorySpaceMap (&NumberOfDescriptors, &MemorySpaceMap);\r
+  for (Index = 0; Index < NumberOfDescriptors; Index++) {\r
+    if (MemorySpaceMap[Index].GcdMemoryType == EfiGcdMemoryTypeReserved &&\r
+        (MemorySpaceMap[Index].Capabilities & (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED)) ==\r
+          (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED)\r
+          ) {\r
+      gDS->RemoveMemorySpace (\r
+            MemorySpaceMap[Index].BaseAddress,\r
+            MemorySpaceMap[Index].Length\r
+            );\r
+\r
+      gDS->AddMemorySpace (\r
+            EfiGcdMemoryTypeSystemMemory,\r
+            MemorySpaceMap[Index].BaseAddress,\r
+            MemorySpaceMap[Index].Length,\r
+            MemorySpaceMap[Index].Capabilities &~\r
+            (EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME)\r
+            );\r
+\r
+      mTestedSystemMemory += MemorySpaceMap[Index].Length;\r
+      mTotalSystemMemory += MemorySpaceMap[Index].Length;\r
+    } else if (MemorySpaceMap[Index].GcdMemoryType == EfiGcdMemoryTypeSystemMemory) {\r
+      mTotalSystemMemory += MemorySpaceMap[Index].Length;\r
+    }\r
+  }\r
+\r
+  FreePool (MemorySpaceMap);\r
+\r
+  *RequireSoftECCInit = FALSE;\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+GenPerformMemoryTest (\r
+  IN EFI_GENERIC_MEMORY_TEST_PROTOCOL          *This,\r
+  IN OUT UINT64                                *TestedMemorySize,\r
+  OUT UINT64                                   *TotalMemorySize,\r
+  OUT BOOLEAN                                  *ErrorOut,\r
+  IN BOOLEAN                                   TestAbort\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+Arguments:\r
+\r
+Returns:\r
+\r
+--*/\r
+{\r
+  *ErrorOut         = FALSE;\r
+  *TestedMemorySize = mTestedSystemMemory;\r
+  *TotalMemorySize  = mTotalSystemMemory;\r
+\r
+  return EFI_NOT_FOUND;\r
+\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+GenMemoryTestFinished (\r
+  IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+Arguments:\r
+\r
+Returns:\r
+\r
+--*/\r
+{\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+GenCompatibleRangeTest (\r
+  IN EFI_GENERIC_MEMORY_TEST_PROTOCOL          *This,\r
+  IN  EFI_PHYSICAL_ADDRESS                     StartAddress,\r
+  IN  UINT64                                   Length\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+Arguments:\r
+\r
+Returns:\r
+\r
+--*/\r
+{\r
+  EFI_GCD_MEMORY_SPACE_DESCRIPTOR descriptor;\r
+\r
+  gDS->GetMemorySpaceDescriptor (StartAddress, &descriptor);\r
+\r
+  gDS->RemoveMemorySpace (StartAddress, Length);\r
+\r
+  gDS->AddMemorySpace (\r
+        EfiGcdMemoryTypeSystemMemory,\r
+        StartAddress,\r
+        Length,\r
+        descriptor.Capabilities &~(EFI_MEMORY_PRESENT | EFI_MEMORY_INITIALIZED | EFI_MEMORY_TESTED | EFI_MEMORY_RUNTIME)\r
+        );\r
+\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.h b/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTest.h
new file mode 100644 (file)
index 0000000..4b04381
--- /dev/null
@@ -0,0 +1,124 @@
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation                                                         \r
+All rights reserved. This program and the accompanying materials                          \r
+are licensed and made available under the terms and conditions of the BSD License         \r
+which accompanies this distribution.  The full text of the license may be found at        \r
+http://opensource.org/licenses/bsd-license.php                                            \r
+                                                                                          \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+Module Name:\r
+  \r
+    NullMemoryTest.h\r
+  \r
+Abstract:\r
+  The generic memory test driver definition\r
+\r
+--*/\r
+\r
+#ifndef _NULL_MEMORY_TEST_H\r
+#define _NULL_MEMORY_TEST_H\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiDxe.h>\r
+\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Protocol/GenericMemoryTest.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiDriverEntryPoint.h>\r
+#include <Library/DxeServicesTableLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+\r
+//\r
+// attributes for reserved memory before it is promoted to system memory\r
+//\r
+#define EFI_MEMORY_PRESENT      0x0100000000000000ULL\r
+#define EFI_MEMORY_INITIALIZED  0x0200000000000000ULL\r
+#define EFI_MEMORY_TESTED       0x0400000000000000ULL\r
+\r
+\r
+//\r
+// Some global define\r
+//\r
+#define GENERIC_CACHELINE_SIZE  0x40\r
+\r
+//\r
+// The SPARSE_SPAN_SIZE size can not small then the MonoTestSize\r
+//\r
+#define TEST_BLOCK_SIZE   0x2000000\r
+#define QUICK_SPAN_SIZE   (TEST_BLOCK_SIZE >> 2)\r
+#define SPARSE_SPAN_SIZE  (TEST_BLOCK_SIZE >> 4)\r
+\r
+//\r
+// This structure records every nontested memory range parsed through GCD\r
+// service.\r
+//\r
+#define EFI_NONTESTED_MEMORY_RANGE_SIGNATURE  EFI_SIGNATURE_32 ('N', 'T', 'M', 'E')\r
+typedef struct {\r
+  UINTN                 Signature;\r
+  LIST_ENTRY            Link;\r
+  EFI_PHYSICAL_ADDRESS  StartAddress;\r
+  UINT64                Length;\r
+  UINT64                Capabilities;\r
+  BOOLEAN               Above4G;\r
+  BOOLEAN               AlreadyMapped;\r
+} NONTESTED_MEMORY_RANGE;\r
+\r
+#define NONTESTED_MEMORY_RANGE_FROM_LINK(link) \\r
+        CR(link, NONTESTED_MEMORY_RANGE, Link, EFI_NONTESTED_MEMORY_RANGE_SIGNATURE)\r
+\r
+//\r
+// This is the memory test driver's structure definition\r
+//\r
+#define EFI_GENERIC_MEMORY_TEST_PRIVATE_SIGNATURE EFI_SIGNATURE_32 ('G', 'E', 'M', 'T')\r
+\r
+//\r
+// Function Prototypes\r
+//\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeMemoryTest (\r
+  IN EFI_GENERIC_MEMORY_TEST_PROTOCOL          *This,\r
+  IN  EXTENDMEM_COVERAGE_LEVEL                 Level,\r
+  OUT BOOLEAN                                  *RequireSoftECCInit\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+GenPerformMemoryTest (\r
+  IN EFI_GENERIC_MEMORY_TEST_PROTOCOL          *This,\r
+  IN OUT UINT64                                *TestedMemorySize,\r
+  OUT UINT64                                   *TotalMemorySize,\r
+  OUT BOOLEAN                                  *ErrorOut,\r
+  IN BOOLEAN                                   TestAbort\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+GenMemoryTestFinished (\r
+  IN EFI_GENERIC_MEMORY_TEST_PROTOCOL *This\r
+  )\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+GenCompatibleRangeTest (\r
+  IN EFI_GENERIC_MEMORY_TEST_PROTOCOL          *This,\r
+  IN  EFI_PHYSICAL_ADDRESS                     StartAddress,\r
+  IN  UINT64                                   Length\r
+  )\r
+;\r
+\r
+#endif\r
diff --git a/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf b/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
new file mode 100644 (file)
index 0000000..fb0c7ee
--- /dev/null
@@ -0,0 +1,50 @@
+#/** @file\r
+# Component description file for NullMemoryTest module.\r
+#\r
+# This driver installs EFI_GENERIC_MEMORY_TEST_PROTOCOL to \r
+#  provide simple generic memory test functions.\r
+# Copyright (c) 2006 - 2007, Intel Corporation\r
+#\r
+#  All rights reserved. This program and the accompanying materials\r
+#  are licensed and made available under the terms and conditions of the BSD License\r
+#  which accompanies this distribution. The full text of the license may be found at\r
+#  http://opensource.org/licenses/bsd-license.php\r
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+#**/\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = NullMemoryTestDxe\r
+  FILE_GUID                      = 96B5C032-DF4C-4b6e-8232-438DCF448D0E\r
+  MODULE_TYPE                    = DXE_DRIVER\r
+  VERSION_STRING                 = 1.0\r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+  ENTRY_POINT                    = GenericMemoryTestEntryPoint\r
+\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+\r
+[Sources.common]\r
+  NullMemoryTest.h\r
+  NullMemoryTest.c\r
+\r
+[Packages]\r
+  MdeModulePkg/MdeModulePkg.dec\r
+  MdePkg/MdePkg.dec\r
+\r
+[LibraryClasses]\r
+  MemoryAllocationLib\r
+  UefiBootServicesTableLib\r
+  DxeServicesTableLib\r
+  UefiDriverEntryPoint\r
+  DebugLib\r
+\r
+[Protocols]\r
+  gEfiGenericMemTestProtocolGuid                # PROTOCOL ALWAYS_PRODUCED\r
+\r
+[Depex]\r
+  TRUE
\ No newline at end of file
diff --git a/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.msa b/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.msa
new file mode 100644 (file)
index 0000000..ade8ce1
--- /dev/null
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+  <MsaHeader>\r
+    <ModuleName>NullMemoryTest</ModuleName>\r
+    <ModuleType>DXE_DRIVER</ModuleType>\r
+    <GuidValue>96B5C032-DF4C-4b6e-8232-438DCF448D0E</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>Component description file for NullMemoryTest module.</Abstract>\r
+    <Description>This driver installs EFI_GENERIC_MEMORY_TEST_PROTOCOL to \r
+      provide simple generic memory test functions.</Description>\r
+    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>\r
+    <License>All rights reserved. This program and the accompanying materials\r
+      are licensed and made available under the terms and conditions of the BSD License\r
+      which accompanies this distribution.  The full text of the license may be found at\r
+      http://opensource.org/licenses/bsd-license.php\r
+      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
+    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>\r
+  </MsaHeader>\r
+  <ModuleDefinitions>\r
+    <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>NullMemoryTest</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>DebugLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiDriverEntryPoint</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>DxeServicesTableLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiBootServicesTableLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>MemoryAllocationLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>Common.h</Filename>\r
+    <Filename>NullMemoryTest.c</Filename>\r
+    <Filename>NullMemoryTest.h</Filename>\r
+    <Filename>NullMemoryTest.dxs</Filename>\r
+  </SourceFiles>\r
+  <PackageDependencies>\r
+    <Package PackageGuid="1E73767F-8F52-4603-AEB4-F29B510B6766"/>\r
+    <Package PackageGuid="BA0D78D6-2CAF-414b-BD4D-B6762A894288"/>\r
+  </PackageDependencies>\r
+  <Protocols>\r
+    <Protocol Usage="ALWAYS_PRODUCED">\r
+      <ProtocolCName>gEfiGenericMemTestProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+  </Protocols>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+    <Extern>\r
+      <ModuleEntryPoint>GenericMemoryTestEntryPoint</ModuleEntryPoint>\r
+    </Extern>\r
+  </Externs>\r
+</ModuleSurfaceArea>\r
index d34d5ed5694014f056d06c9f54e28534784c2c40..4421862d0343e2632c5c9d7dc3a1a0463af41366 100644 (file)
   $(WORKSPACE)/IntelFrameworkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.inf\r
   $(WORKSPACE)/Nt32Pkg/BootModePei/BootModePei.inf\r
   $(WORKSPACE)/Nt32Pkg/WinNtFlashMapPei/WinNtFlashMapPei.inf\r
-  $(WORKSPACE)/MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.inf\r
+  $(WORKSPACE)/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTestPei.inf\r
   $(WORKSPACE)/MdeModulePkg/Universal/VariablePei/VariablePei.inf\r
   $(WORKSPACE)/Nt32Pkg/WinNtAutoScanPei/WinNtAutoScanPei.inf\r
   $(WORKSPACE)/Nt32Pkg/WinNtFirmwareVolumePei/WinNtFirmwareVolumePei.inf\r
   $(WORKSPACE)/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.inf\r
   $(WORKSPACE)/IntelFrameworkModulePkg/Universal/DataHubDxe/DataHubDxe.inf\r
   $(WORKSPACE)/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf\r
-  $(WORKSPACE)/MdeModulePkg/Universal/GenericMemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf\r
+  $(WORKSPACE)/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf\r
   $(WORKSPACE)/IntelFrameworkModulePkg/Universal/HiiDataBaseDxe/HiiDatabase.inf\r
   $(WORKSPACE)/Nt32Pkg/WinNtThunkDxe/WinNtThunkDxe.inf\r
   $(WORKSPACE)/MdeModulePkg/Universal/FirmwareVolume/Crc32SectionExtractDxe/Crc32SectionExtractDxe.inf  \r
index 1708dbf9b26b3d2700aab6e2a6c619db28a0287b..0e195db644e6738567e08dfd21c1145e63963ce9 100644 (file)
@@ -117,7 +117,7 @@ INF  $(WORKSPACE)/MdeModulePkg/Universal/PCD/Pei/Pcd.inf
 INF  $(WORKSPACE)/IntelFrameworkModulePkg/Universal/StatusCode/Pei/PeiStatusCode.inf\r
 INF  $(WORKSPACE)/Nt32Pkg/BootModePei/BootModePei.inf\r
 INF  $(WORKSPACE)/Nt32Pkg/WinNtFlashMapPei/WinNtFlashMapPei.inf\r
-INF  $(WORKSPACE)/MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.inf\r
+INF  $(WORKSPACE)/MdeModulePkg/Universal/MemoryTest/BaseMemoryTestPei/BaseMemoryTestPei.inf\r
 INF  $(WORKSPACE)/MdeModulePkg/Universal/VariablePei/VariablePei.inf\r
 INF  $(WORKSPACE)/Nt32Pkg/WinNtAutoScanPei/WinNtAutoScanPei.inf\r
 INF  $(WORKSPACE)/Nt32Pkg/WinNtFirmwareVolumePei/WinNtFirmwareVolumePei.inf\r
@@ -137,7 +137,7 @@ INF  $(WORKSPACE)/Nt32Pkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
 INF  $(WORKSPACE)/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.inf\r
 INF  $(WORKSPACE)/IntelFrameworkModulePkg/Universal/DataHubDxe/DataHubDxe.inf\r
 INF  $(WORKSPACE)/MdeModulePkg/Universal/EbcDxe/EbcDxe.inf\r
-INF  $(WORKSPACE)/MdeModulePkg/Universal/GenericMemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf\r
+INF  $(WORKSPACE)/MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf\r
 INF  $(WORKSPACE)/IntelFrameworkModulePkg/Universal/HiiDataBaseDxe/HiiDatabase.inf\r
 INF  $(WORKSPACE)/Nt32Pkg/WinNtThunkDxe/WinNtThunkDxe.inf\r
 INF  $(WORKSPACE)/MdeModulePkg/Universal/FirmwareVolume/Crc32SectionExtractDxe/Crc32SectionExtractDxe.inf\r