]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add BaseMemoryTestDxe in MdeModulePkg.dsc
authoryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 2 Jul 2007 03:48:40 +0000 (03:48 +0000)
committeryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 2 Jul 2007 03:48:40 +0000 (03:48 +0000)
Add RuntimeDxe in MdeModulePkg.dsc
Move Security/SecurityStub/Dxe to SecurityStubDxe.
Add EFI_MAX_ADDRESS in Uefi/UefiBaseType.h.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2930 6f19259b-4bc3-4df7-8a09-765794883524

15 files changed:
MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.c [new file with mode: 0644]
MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.h [new file with mode: 0644]
MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.inf [new file with mode: 0644]
MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.msa [new file with mode: 0644]
MdeModulePkg/Universal/RuntimeDxe/Crc32.c [new file with mode: 0644]
MdeModulePkg/Universal/RuntimeDxe/Runtime.c [new file with mode: 0644]
MdeModulePkg/Universal/RuntimeDxe/Runtime.h [new file with mode: 0644]
MdeModulePkg/Universal/RuntimeDxe/Runtime.inf [new file with mode: 0644]
MdeModulePkg/Universal/RuntimeDxe/Runtime.msa [new file with mode: 0644]
MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c [new file with mode: 0644]
MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.dxs [new file with mode: 0644]
MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.h [new file with mode: 0644]
MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.inf [new file with mode: 0644]
MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.msa [new file with mode: 0644]
MdePkg/Include/Uefi/UefiBaseType.h

diff --git a/MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.c b/MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.c
new file mode 100644 (file)
index 0000000..7b207b9
--- /dev/null
@@ -0,0 +1,167 @@
+/*++\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
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiPei.h>\r
+#include <FrameworkPei.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Ppi/BaseMemoryTest.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/DebugLib.h>\r
+#include <Library/PeimEntryPoint.h>\r
+#include <Library/ReportStatusCodeLib.h>\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 (\r
+    EFI_PROGRESS_CODE,\r
+    EFI_COMPUTING_UNIT_MEMORY + EFI_CU_MEMORY_PC_TEST\r
+    );\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 (\r
+        EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED,\r
+        EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UNCORRECTABLE\r
+        );\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/BaseMemoryTestPei/BaseMemoryTest.h b/MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.h
new file mode 100644 (file)
index 0000000..791a66c
--- /dev/null
@@ -0,0 +1,87 @@
+/*++\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
+//\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/BaseMemoryTestPei/BaseMemoryTest.inf b/MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.inf
new file mode 100644 (file)
index 0000000..6010077
--- /dev/null
@@ -0,0 +1,91 @@
+#/** @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
+################################################################################\r
+#\r
+# Defines Section - statements that will be processed to create a Makefile.\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
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+  BaseMemoryTest.c\r
+  BaseMemoryTest.h\r
+\r
+\r
+################################################################################\r
+#\r
+# Includes Section - list of Include locations that are required for\r
+#                    this module.\r
+#\r
+################################################################################\r
+\r
+################################################################################\r
+#\r
+# Package Dependency Section - list of Package files that are required for\r
+#                              this module.\r
+#\r
+################################################################################\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  IntelFrameworkPkg/IntelFrameworkPkg.dec\r
+\r
+\r
+################################################################################\r
+#\r
+# Library Class Section - list of Library Classes that are required for\r
+#                         this module.\r
+#\r
+################################################################################\r
+\r
+[LibraryClasses]\r
+  ReportStatusCodeLib\r
+  PeimEntryPoint\r
+  DebugLib\r
+\r
+\r
+################################################################################\r
+#\r
+# PPI C Name Section - list of PPI and PPI Notify C Names that this module\r
+#                      uses or produces.\r
+#\r
+################################################################################\r
+\r
+[Ppis]\r
+  gPeiBaseMemoryTestPpiGuid                     # PPI ALWAYS_PRODUCED\r
+\r
diff --git a/MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.msa b/MdeModulePkg/Universal/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/RuntimeDxe/Crc32.c b/MdeModulePkg/Universal/RuntimeDxe/Crc32.c
new file mode 100644 (file)
index 0000000..910738e
--- /dev/null
@@ -0,0 +1,150 @@
+/*++\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
+  Crc32.c\r
+\r
+Abstract:\r
+\r
+  CalculateCrc32 Boot Services as defined in DXE CIS.\r
+\r
+  This Boot Services is in the Runtime Driver because this service is\r
+  also required by SetVirtualAddressMap() when the EFI System Table and\r
+  EFI Runtime Services Table are converted from physical address to \r
+  virtual addresses.  This requires that the 32-bit CRC be recomputed.\r
+\r
+Revision History:\r
+\r
+--*/\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiDxe.h>\r
+\r
+UINT32  mCrcTable[256];\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+RuntimeDriverCalculateCrc32 (\r
+  IN  VOID    *Data,\r
+  IN  UINTN   DataSize,\r
+  OUT UINT32  *CrcOut\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Calculate CRC32 for target data\r
+\r
+Arguments:\r
+\r
+  Data     - The target data.\r
+  DataSize - The target data size.\r
+  CrcOut   - The CRC32 for target data.\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS           - The CRC32 for target data is calculated successfully.\r
+  EFI_INVALID_PARAMETER - Some parameter is not valid, so the CRC32 is not \r
+                          calculated.\r
+\r
+--*/\r
+{\r
+  UINT32  Crc;\r
+  UINTN   Index;\r
+  UINT8   *Ptr;\r
+\r
+  if (Data == NULL || DataSize == 0 || CrcOut == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  Crc = 0xffffffff;\r
+  for (Index = 0, Ptr = Data; Index < DataSize; Index++, Ptr++) {\r
+    Crc = (Crc >> 8) ^ mCrcTable[(UINT8) Crc ^ *Ptr];\r
+  }\r
+\r
+  *CrcOut = Crc ^ 0xffffffff;\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+STATIC\r
+UINT32\r
+ReverseBits (\r
+  UINT32  Value\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Reverse bits for 32bit data.\r
+\r
+Arguments:\r
+\r
+  Value - the data to be reversed.\r
+\r
+Returns:\r
+\r
+  UINT32 data reversed.\r
+\r
+--*/\r
+{\r
+  UINTN   Index;\r
+  UINT32  NewValue;\r
+\r
+  NewValue = 0;\r
+  for (Index = 0; Index < 32; Index++) {\r
+    if (Value & (1 << Index)) {\r
+      NewValue = NewValue | (1 << (31 - Index));\r
+    }\r
+  }\r
+\r
+  return NewValue;\r
+}\r
+\r
+VOID\r
+RuntimeDriverInitializeCrc32Table (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Initialize CRC32 table.\r
+\r
+Arguments:\r
+\r
+  None.\r
+\r
+Returns:\r
+\r
+  None.\r
+\r
+--*/\r
+{\r
+  UINTN   TableEntry;\r
+  UINTN   Index;\r
+  UINT32  Value;\r
+\r
+  for (TableEntry = 0; TableEntry < 256; TableEntry++) {\r
+    Value = ReverseBits ((UINT32) TableEntry);\r
+    for (Index = 0; Index < 8; Index++) {\r
+      if (Value & 0x80000000) {\r
+        Value = (Value << 1) ^ 0x04c11db7;\r
+      } else {\r
+        Value = Value << 1;\r
+      }\r
+    }\r
+\r
+    mCrcTable[TableEntry] = ReverseBits (Value);\r
+  }\r
+}\r
diff --git a/MdeModulePkg/Universal/RuntimeDxe/Runtime.c b/MdeModulePkg/Universal/RuntimeDxe/Runtime.c
new file mode 100644 (file)
index 0000000..4bf2e40
--- /dev/null
@@ -0,0 +1,486 @@
+/*++\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
+  Runtime.c\r
+\r
+Abstract:\r
+\r
+  Runtime Architectural Protocol as defined in the DXE CIS\r
+\r
+  This code is used to produce the EFI runtime virtual switch over\r
+\r
+  THIS IS VERY DANGEROUS CODE BE VERY CAREFUL IF YOU CHANGE IT\r
+\r
+  The transition for calling EFI Runtime functions in physical mode to calling\r
+  them in virtual mode is very very complex. Every pointer in needs to be\r
+  converted from physical mode to virtual mode. Be very careful walking linked\r
+  lists! Then to make it really hard the code it's self needs be relocated into\r
+  the new virtual address space.\r
+\r
+  So here is the concept. The code in this module will never ever be called in\r
+  virtual mode. This is the code that collects the information needed to convert\r
+  to virtual mode (DXE core registers runtime stuff with this code). Since this\r
+  code is used to fixup all runtime images, it CAN NOT fix it's self up. So some\r
+  code has to stay behind and that is us.\r
+\r
+  Also you need to be careful about when you allocate memory, as once we are in\r
+  runtime (including our EVT_SIGNAL_EXIT_BOOT_SERVICES event) you can no longer\r
+  allocate memory.\r
+\r
+  Any runtime driver that gets loaded before us will not be callable in virtual\r
+  mode. This is due to the fact that the DXE core can not register the info\r
+  needed with us. This is good, since it keeps the code in this file from\r
+  getting registered.\r
+\r
+\r
+Revision History:\r
+\r
+  - Move the CalculateCrc32 function from Runtime Arch Protocol to Boot Service.\r
+  Runtime Arch Protocol definition no longer contains CalculateCrc32. Boot Service\r
+  Table now contains an item named CalculateCrc32.\r
+\r
+--*/\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiDxe.h>\r
+#include <FrameworkDxe.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Protocol/LoadedImage.h>\r
+#include <Protocol/Runtime.h>\r
+#include <Protocol/UgaIo.h>\r
+\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/BaseLib.h>\r
+#include <Library/UefiDriverEntryPoint.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/CacheMaintenanceLib.h>\r
+#include <Library/PeCoffLib.h>\r
+\r
+#include "Runtime.h"\r
+\r
+//\r
+// Global Variables\r
+//\r
+EFI_MEMORY_DESCRIPTOR         *mVirtualMap                = NULL;\r
+UINTN                         mVirtualMapDescriptorSize;\r
+UINTN                         mVirtualMapMaxIndex;\r
+VOID                          *mMyImageBase;\r
+\r
+//\r
+// The handle onto which the Runtime Architectural Protocol instance is installed\r
+//\r
+EFI_HANDLE                    mRuntimeHandle = NULL;\r
+\r
+//\r
+// The Runtime Architectural Protocol instance produced by this driver\r
+//\r
+EFI_RUNTIME_ARCH_PROTOCOL     mRuntime = {\r
+  INITIALIZE_LIST_HEAD_VARIABLE (mRuntime.ImageHead),\r
+  INITIALIZE_LIST_HEAD_VARIABLE (mRuntime.EventHead),\r
+\r
+  //\r
+  // Make sure Size != sizeof (EFI_MEMORY_DESCRIPTOR). This will\r
+  // prevent people from having pointer math bugs in their code.\r
+  // now you have to use *DescriptorSize to make things work.\r
+  //\r
+  sizeof (EFI_MEMORY_DESCRIPTOR) + sizeof (UINT64) - (sizeof (EFI_MEMORY_DESCRIPTOR) % sizeof (UINT64)),\r
+  EFI_MEMORY_DESCRIPTOR_VERSION,\r
+  0,\r
+  NULL,\r
+  NULL,\r
+  FALSE,\r
+  FALSE\r
+};\r
+\r
+//\r
+// Worker Functions\r
+//\r
+STATIC\r
+VOID\r
+RuntimeDriverCalculateEfiHdrCrc (\r
+  IN OUT EFI_TABLE_HEADER  *Hdr\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Calcualte the 32-bit CRC in a EFI table using the Runtime Drivers\r
+  internal function.  The EFI Boot Services Table can not be used because\r
+  the EFI Boot Services Table was destroyed at ExitBootServices()\r
+\r
+Arguments:\r
+\r
+  Hdr  - Pointer to an EFI standard header\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  UINT32  Crc;\r
+\r
+  Hdr->CRC32  = 0;\r
+\r
+  Crc         = 0;\r
+  RuntimeDriverCalculateCrc32 ((UINT8 *) Hdr, Hdr->HeaderSize, &Crc);\r
+  Hdr->CRC32 = Crc;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+RuntimeDriverConvertPointer (\r
+  IN     UINTN  DebugDisposition,\r
+  IN OUT VOID   **ConvertAddress\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Determines the new virtual address that is to be used on subsequent memory accesses.\r
+\r
+Arguments:\r
+\r
+  DebugDisposition    - Supplies type information for the pointer being converted.\r
+  ConvertAddress      - A pointer to a pointer that is to be fixed to be the value needed\r
+                        for the new virtual address mappings being applied.\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS             - The pointer pointed to by Address was modified.\r
+  EFI_NOT_FOUND           - The pointer pointed to by Address was not found to be part\r
+                            of the current memory map. This is normally fatal.\r
+  EFI_INVALID_PARAMETER   - One of the parameters has an invalid value.\r
+\r
+--*/\r
+{\r
+  UINTN                 Address;\r
+  VOID                  *PlabelConvertAddress;\r
+  UINT64                VirtEndOfRange;\r
+  EFI_MEMORY_DESCRIPTOR *VirtEntry;\r
+  UINTN                 Index;\r
+\r
+  //\r
+  // Make sure ConvertAddress is a valid pointer\r
+  //\r
+  if (ConvertAddress == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+  //\r
+  // Get the address to convert\r
+  //\r
+  Address = (UINTN) *ConvertAddress;\r
+\r
+  //\r
+  // If this is a null pointer, return if it's allowed\r
+  //\r
+  if (Address == 0) {\r
+    if (DebugDisposition & EFI_OPTIONAL_POINTER) {\r
+      return EFI_SUCCESS;\r
+    }\r
+\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  PlabelConvertAddress  = NULL;\r
+  VirtEntry             = mVirtualMap;\r
+  for (Index = 0; Index < mVirtualMapMaxIndex; Index++) {\r
+    //\r
+    // To prevent the inclusion of 64-bit math functions a UINTN was placed in\r
+    //  front of VirtEntry->NumberOfPages to cast it to a 32-bit thing on IA-32\r
+    //  platforms. If you get this ASSERT remove the UINTN and do a 64-bit\r
+    //  multiply.\r
+    //\r
+    ASSERT (((UINTN) VirtEntry->NumberOfPages < 0xffffffff) || (sizeof (UINTN) > 4));\r
+\r
+    if ((VirtEntry->Attribute & EFI_MEMORY_RUNTIME) == EFI_MEMORY_RUNTIME) {\r
+      if (Address >= VirtEntry->PhysicalStart) {\r
+        VirtEndOfRange = VirtEntry->PhysicalStart + (((UINTN) VirtEntry->NumberOfPages) * EFI_PAGE_SIZE);\r
+        if (Address < VirtEndOfRange) {\r
+          //\r
+          // Compute new address\r
+          //\r
+          *ConvertAddress = (VOID *) (Address - (UINTN) VirtEntry->PhysicalStart + (UINTN) VirtEntry->VirtualStart);\r
+          return EFI_SUCCESS;\r
+        }\r
+      }\r
+    }\r
+\r
+    VirtEntry = NextMemoryDescriptor (VirtEntry, mVirtualMapDescriptorSize);\r
+  }\r
+\r
+  return EFI_NOT_FOUND;\r
+}\r
+\r
+STATIC\r
+EFI_STATUS\r
+RuntimeDriverConvertInternalPointer (\r
+  IN OUT VOID   **ConvertAddress\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Determines the new virtual address that is to be used on subsequent memory accesses\r
+  for internal pointers.\r
+\r
+Arguments:\r
+\r
+  ConvertAddress  - A pointer to a pointer that is to be fixed to be the value needed\r
+                    for the new virtual address mappings being applied.\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS             - The pointer pointed to by Address was modified.\r
+  EFI_NOT_FOUND           - The pointer pointed to by Address was not found to be part\r
+                            of the current memory map. This is normally fatal.\r
+  EFI_INVALID_PARAMETER   - One of the parameters has an invalid value.\r
+\r
+--*/\r
+{\r
+  return RuntimeDriverConvertPointer (0x0, ConvertAddress);\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+RuntimeDriverSetVirtualAddressMap (\r
+  IN UINTN                  MemoryMapSize,\r
+  IN UINTN                  DescriptorSize,\r
+  IN UINT32                 DescriptorVersion,\r
+  IN EFI_MEMORY_DESCRIPTOR  *VirtualMap\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Changes the runtime addressing mode of EFI firmware from physical to virtual.\r
+\r
+Arguments:\r
+\r
+  MemoryMapSize     - The size in bytes of VirtualMap.\r
+  DescriptorSize    - The size in bytes of an entry in the VirtualMap.\r
+  DescriptorVersion - The version of the structure entries in VirtualMap.\r
+  VirtualMap        - An array of memory descriptors which contain new virtual\r
+                      address mapping information for all runtime ranges.\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS           - The virtual address map has been applied.\r
+  EFI_UNSUPPORTED       - EFI firmware is not at runtime, or the EFI firmware is already in\r
+                          virtual address mapped mode.\r
+  EFI_INVALID_PARAMETER - DescriptorSize or DescriptorVersion is invalid.\r
+  EFI_NO_MAPPING        - A virtual address was not supplied for a range in the memory\r
+                          map that requires a mapping.\r
+  EFI_NOT_FOUND         - A virtual address was supplied for an address that is not found\r
+                          in the memory map.\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                    Status;\r
+  EFI_RUNTIME_EVENT_ENTRY       *RuntimeEvent;\r
+  EFI_RUNTIME_IMAGE_ENTRY       *RuntimeImage;\r
+  LIST_ENTRY                    *Link;\r
+  EFI_PHYSICAL_ADDRESS          VirtImageBase;\r
+\r
+  //\r
+  // Can only switch to virtual addresses once the memory map is locked down,\r
+  // and can only set it once\r
+  //\r
+  if (!mRuntime.AtRuntime || mRuntime.VirtualMode) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+  //\r
+  // Only understand the original descriptor format\r
+  //\r
+  if (DescriptorVersion != EFI_MEMORY_DESCRIPTOR_VERSION || DescriptorSize < sizeof (EFI_MEMORY_DESCRIPTOR)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+  //\r
+  // We are now committed to go to virtual mode, so lets get to it!\r
+  //\r
+  mRuntime.VirtualMode = TRUE;\r
+\r
+  //\r
+  // ConvertPointer() needs this mVirtualMap to do the conversion. So set up\r
+  // globals we need to parse the virtual address map.\r
+  //\r
+  mVirtualMapDescriptorSize = DescriptorSize;\r
+  mVirtualMapMaxIndex       = MemoryMapSize / DescriptorSize;\r
+  mVirtualMap               = VirtualMap;\r
+\r
+  //\r
+  // Currently the bug in StatusCode/RuntimeLib has been fixed, it will\r
+  // check whether in Runtime or not (this is judged by looking at\r
+  // mEfiAtRuntime global So this ReportStatusCode will work\r
+  //\r
+  REPORT_STATUS_CODE (\r
+          EFI_PROGRESS_CODE,\r
+          (EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_RS_PC_SET_VIRTUAL_ADDRESS_MAP)\r
+          );\r
+\r
+  //\r
+  // Signal all the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE events.\r
+  // All runtime events are stored in a list in Runtime AP.\r
+  //\r
+  for (Link = mRuntime.EventHead.ForwardLink; Link != &mRuntime.EventHead; Link = Link->ForwardLink) {\r
+    RuntimeEvent = _CR (Link, EFI_RUNTIME_EVENT_ENTRY, Link);\r
+    if ((RuntimeEvent->Type & EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) == EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE) {\r
+      RuntimeEvent->NotifyFunction (\r
+                      RuntimeEvent->Event,\r
+                      RuntimeEvent->NotifyContext\r
+                      );\r
+    }\r
+  }\r
+\r
+  //\r
+  // Relocate runtime images. All runtime images are stored in a list in Runtime AP.\r
+  //\r
+  for (Link = mRuntime.ImageHead.ForwardLink; Link != &mRuntime.ImageHead; Link = Link->ForwardLink) {\r
+    RuntimeImage = _CR (Link, EFI_RUNTIME_IMAGE_ENTRY, Link);\r
+    //\r
+    // We don't want to relocate our selves, as we only run in physical mode.\r
+    //\r
+    if (mMyImageBase != RuntimeImage->ImageBase) {\r
+\r
+      VirtImageBase = (EFI_PHYSICAL_ADDRESS) (UINTN) RuntimeImage->ImageBase;\r
+      Status  = RuntimeDriverConvertPointer (0, (VOID **) &VirtImageBase);\r
+      ASSERT_EFI_ERROR (Status);\r
+\r
+      PeCoffLoaderRelocateImageForRuntime (\r
+        (EFI_PHYSICAL_ADDRESS) (UINTN) RuntimeImage->ImageBase,\r
+        VirtImageBase,\r
+        (UINTN) RuntimeImage->ImageSize,\r
+        RuntimeImage->RelocationData\r
+        );\r
+\r
+      InvalidateInstructionCacheRange (RuntimeImage->ImageBase, (UINTN)RuntimeImage->ImageSize);\r
+    }\r
+  }\r
+\r
+  //\r
+  // Convert all the Runtime Services except ConvertPointer() and SetVirtualAddressMap()\r
+  // and recompute the CRC-32\r
+  //\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetTime);\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gRT->SetTime);\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetWakeupTime);\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gRT->SetWakeupTime);\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gRT->ResetSystem);\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetNextHighMonotonicCount);\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetVariable);\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gRT->SetVariable);\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gRT->GetNextVariableName);\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gRT->QueryVariableInfo);\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gRT->UpdateCapsule);\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gRT->QueryCapsuleCapabilities);\r
+  RuntimeDriverCalculateEfiHdrCrc (&gRT->Hdr);\r
+\r
+  //\r
+  // BugBug: PI requires System Configuration Tables Conversion. \r
+  // Currently, we do not implement it.\r
+  // \r
+\r
+  //\r
+  // Convert the runtime fields of the EFI System Table and recompute the CRC-32\r
+  //\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gST->FirmwareVendor);\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gST->ConfigurationTable);\r
+  RuntimeDriverConvertInternalPointer ((VOID **) &gST->RuntimeServices);\r
+  RuntimeDriverCalculateEfiHdrCrc (&gST->Hdr);\r
+\r
+  //\r
+  // At this point, gRT and gST are physical pointers, but the contents of these tables\r
+  // have been converted to runtime.\r
+  //\r
+  //\r
+  // mVirtualMap is only valid during SetVirtualAddressMap() call\r
+  //\r
+  mVirtualMap = NULL;\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+RuntimeDriverInitialize (\r
+  IN EFI_HANDLE                            ImageHandle,\r
+  IN EFI_SYSTEM_TABLE                      *SystemTable\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+  Install Runtime AP. This code includes the EfiDriverLib, but it functions at\r
+  RT in physical mode. The only Lib services are gBS, gRT, and the DEBUG and\r
+  ASSERT macros (they do ReportStatusCode).\r
+\r
+Arguments:\r
+  (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r
+\r
+Returns:\r
+\r
+  EFI_SUCEESS - Runtime Driver Architectural Protocol Installed\r
+\r
+  Other       - Return value from gBS->InstallMultipleProtocolInterfaces\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                Status;\r
+  EFI_LOADED_IMAGE_PROTOCOL *MyLoadedImage;\r
+\r
+  //\r
+  // This image needs to be exclued from relocation for virtual mode, so cache\r
+  // a copy of the Loaded Image protocol to test later.\r
+  //\r
+  Status = gBS->HandleProtocol (\r
+                  ImageHandle,\r
+                  &gEfiLoadedImageProtocolGuid,\r
+                  (VOID**)&MyLoadedImage\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+  mMyImageBase = MyLoadedImage->ImageBase;\r
+\r
+  //\r
+  // Initialize the table used to compute 32-bit CRCs\r
+  //\r
+  RuntimeDriverInitializeCrc32Table ();\r
+\r
+  //\r
+  // Fill in the entries of the EFI Boot Services and EFI Runtime Services Tables\r
+  //\r
+  gBS->CalculateCrc32       = RuntimeDriverCalculateCrc32;\r
+  gRT->SetVirtualAddressMap = RuntimeDriverSetVirtualAddressMap;\r
+  gRT->ConvertPointer       = RuntimeDriverConvertPointer;\r
+\r
+  //\r
+  // Install the Runtime Architectural Protocol onto a new handle\r
+  //\r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
+                  &mRuntimeHandle,\r
+                  &gEfiRuntimeArchProtocolGuid,\r
+                  &mRuntime,\r
+                  NULL\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/MdeModulePkg/Universal/RuntimeDxe/Runtime.h b/MdeModulePkg/Universal/RuntimeDxe/Runtime.h
new file mode 100644 (file)
index 0000000..c2e4b39
--- /dev/null
@@ -0,0 +1,168 @@
+/*++\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
+  Runtime.h\r
+\r
+Abstract:\r
+\r
+  Runtime Architectural Protocol as defined in the DXE CIS\r
+\r
+  This code is used to produce the EFI runtime architectural protocol.\r
+\r
+--*/\r
+\r
+#ifndef _RUNTIME_H_\r
+#define _RUNTIME_H_\r
+\r
+//\r
+// Function Prototypes\r
+//\r
+EFI_STATUS\r
+EFIAPI\r
+RuntimeDriverCalculateCrc32 (\r
+  IN  VOID    *Data,\r
+  IN  UINTN   DataSize,\r
+  OUT UINT32  *CrcOut\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Calculate CRC32 for target data\r
+\r
+Arguments:\r
+\r
+  Data     - The target data.\r
+  DataSize - The target data size.\r
+  CrcOut   - The CRC32 for target data.\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS           - The CRC32 for target data is calculated successfully.\r
+  EFI_INVALID_PARAMETER - Some parameter is not valid, so the CRC32 is not \r
+                          calculated.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+RuntimeDriverConvertPointer (\r
+  IN     UINTN  DebugDisposition,\r
+  IN OUT VOID   **ConvertAddress\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Determines the new virtual address that is to be used on subsequent memory accesses.\r
+\r
+Arguments:\r
+  \r
+  DebugDisposition    - Supplies type information for the pointer being converted.\r
+  ConvertAddress      - A pointer to a pointer that is to be fixed to be the value needed\r
+                        for the new virtual address mappings being applied.\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS             - The pointer pointed to by Address was modified.\r
+  EFI_NOT_FOUND           - The pointer pointed to by Address was not found to be part\r
+                            of the current memory map. This is normally fatal.\r
+  EFI_INVALID_PARAMETER   - One of the parameters has an invalid value.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+RuntimeDriverSetVirtualAddressMap (\r
+  IN UINTN                  MemoryMapSize,\r
+  IN UINTN                  DescriptorSize,\r
+  IN UINT32                 DescriptorVersion,\r
+  IN EFI_MEMORY_DESCRIPTOR  *VirtualMap\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Changes the runtime addressing mode of EFI firmware from physical to virtual.\r
+\r
+Arguments:\r
+  \r
+  MemoryMapSize     - The size in bytes of VirtualMap.\r
+  DescriptorSize    - The size in bytes of an entry in the VirtualMap.\r
+  DescriptorVersion - The version of the structure entries in VirtualMap.\r
+  VirtualMap        - An array of memory descriptors which contain new virtual\r
+                      address mapping information for all runtime ranges.\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS           - The virtual address map has been applied.\r
+  EFI_UNSUPPORTED       - EFI firmware is not at runtime, or the EFI firmware is already in\r
+                          virtual address mapped mode.\r
+  EFI_INVALID_PARAMETER - DescriptorSize or DescriptorVersion is invalid.\r
+  EFI_NO_MAPPING        - A virtual address was not supplied for a range in the memory\r
+                          map that requires a mapping.\r
+  EFI_NOT_FOUND         - A virtual address was supplied for an address that is not found\r
+                          in the memory map.\r
+\r
+--*/\r
+;\r
+\r
+VOID\r
+RuntimeDriverInitializeCrc32Table (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Initialize CRC32 table.\r
+\r
+Arguments:\r
+\r
+  None.\r
+\r
+Returns:\r
+\r
+  None.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+RuntimeDriverInitialize (\r
+  IN EFI_HANDLE                            ImageHandle,\r
+  IN EFI_SYSTEM_TABLE                      *SystemTable\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Install Runtime AP. This code includes the EfiRuntimeLib, but it only \r
+  functions at RT in physical mode. \r
+\r
+Arguments:\r
+  \r
+  ImageHandle   - Image handle of this driver.\r
+  SystemTable   - Pointer to the EFI System Table.\r
+\r
+Returns:\r
+\r
+  EFI_SUCEESS - Runtime Driver Architectural Protocol installed.\r
+\r
+--*/\r
+;\r
+\r
+#endif\r
diff --git a/MdeModulePkg/Universal/RuntimeDxe/Runtime.inf b/MdeModulePkg/Universal/RuntimeDxe/Runtime.inf
new file mode 100644 (file)
index 0000000..288e5d0
--- /dev/null
@@ -0,0 +1,110 @@
+#/** @file\r
+# Component description file for Runtime module.\r
+#\r
+# This module is used to produce the EFI runtime virtual switch over services.\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
+################################################################################\r
+#\r
+# Defines Section - statements that will be processed to create a Makefile.\r
+#\r
+################################################################################\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = Runtime\r
+  FILE_GUID                      = B601F8C4-43B7-4784-95B1-F4226CB40CEE\r
+  MODULE_TYPE                    = DXE_RUNTIME_DRIVER\r
+  VERSION_STRING                 = 1.0\r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+  ENTRY_POINT                    = RuntimeDriverInitialize\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+  Crc32.c\r
+  Runtime.h\r
+  Runtime.c\r
\r
+\r
+################################################################################\r
+#\r
+# Includes Section - list of Include locations that are required for\r
+#                    this module.\r
+#\r
+################################################################################\r
+\r
+[Includes]\r
+\r
+################################################################################\r
+#\r
+# Package Dependency Section - list of Package files that are required for\r
+#                              this module.\r
+#\r
+################################################################################\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  IntelFrameworkPkg/IntelFrameworkPkg.dec\r
+\r
+\r
+################################################################################\r
+#\r
+# Library Class Section - list of Library Classes that are required for\r
+#                         this module.\r
+#\r
+################################################################################\r
+\r
+[LibraryClasses]\r
+  PeCoffLib\r
+  CacheMaintenanceLib\r
+  UefiBootServicesTableLib\r
+  UefiRuntimeServicesTableLib\r
+  BaseMemoryLib\r
+  ReportStatusCodeLib\r
+  DebugLib\r
+  UefiDriverEntryPoint\r
+  BaseLib\r
+\r
+\r
+################################################################################\r
+#\r
+# Guid C Name Section - list of Guids that this module uses or produces.\r
+#\r
+################################################################################\r
+\r
+[Guids]\r
+\r
+\r
+################################################################################\r
+#\r
+# Protocol C Name Section - list of Protocol and Protocol Notify C Names\r
+#                           that this module uses or produces.\r
+#\r
+################################################################################\r
+\r
+[Protocols]\r
+  gEfiRuntimeArchProtocolGuid                   # PROTOCOL ALWAYS_PRODUCED\r
+  gEfiLoadedImageProtocolGuid                   # PROTOCOL ALWAYS_CONSUMED\r
+\r
diff --git a/MdeModulePkg/Universal/RuntimeDxe/Runtime.msa b/MdeModulePkg/Universal/RuntimeDxe/Runtime.msa
new file mode 100644 (file)
index 0000000..207b44c
--- /dev/null
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">\r
+  <MsaHeader>\r
+    <ModuleName>Runtime</ModuleName>\r
+    <ModuleType>DXE_RUNTIME_DRIVER</ModuleType>\r
+    <GuidValue>B601F8C4-43B7-4784-95B1-F4226CB40CEE</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>Component description file for Runtime module.</Abstract>\r
+    <Description>This module is used to produce the EFI runtime virtual switch over services.</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>Runtime</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>BaseLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiDriverEntryPoint</Keyword>\r
+    </LibraryClass>\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>ReportStatusCodeLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>BaseMemoryLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiRuntimeServicesTableLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiBootServicesTableLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>CacheMaintenanceLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PeCoffLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>Runtime.dxs</Filename>\r
+    <Filename>Runtime.c</Filename>\r
+    <Filename>Runtime.h</Filename>\r
+    <Filename>Crc32.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
+  <Protocols>\r
+    <Protocol Usage="ALWAYS_CONSUMED">\r
+      <ProtocolCName>gEfiLoadedImageProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="ALWAYS_PRODUCED">\r
+      <ProtocolCName>gEfiRuntimeArchProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+  </Protocols>\r
+  <SystemTables>\r
+    <SystemTableCNames Usage="SOMETIMES_CONSUMED">\r
+      <SystemTableCName>gEfiUgaIoProtocolGuid</SystemTableCName>\r
+    </SystemTableCNames>\r
+    <SystemTableCNames Usage="SOMETIMES_CONSUMED">\r
+      <SystemTableCName>gEfiCapsuleGuid</SystemTableCName>\r
+    </SystemTableCNames>\r
+  </SystemTables>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+    <Extern>\r
+      <ModuleEntryPoint>RuntimeDriverInitialize</ModuleEntryPoint>\r
+    </Extern>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c b/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c
new file mode 100644 (file)
index 0000000..2eb325e
--- /dev/null
@@ -0,0 +1,130 @@
+/** @file\r
+  This driver supports platform security service.\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
+**/\r
+\r
+\r
+#include "SecurityStub.h"\r
+\r
+//\r
+// Handle for the Security Architectural Protocol instance produced by this driver\r
+//\r
+EFI_HANDLE                  mSecurityArchProtocolHandle = NULL;\r
+\r
+//\r
+// Security Architectural Protocol instance produced by this driver\r
+//\r
+EFI_SECURITY_ARCH_PROTOCOL  mSecurityStub = { \r
+  SecurityStubAuthenticateState \r
+};\r
+\r
+\r
+/**\r
+  The EFI_SECURITY_ARCH_PROTOCOL (SAP) is used to abstract platform-specific \r
+  policy from the DXE core response to an attempt to use a file that returns a \r
+  given status for the authentication check from the section extraction protocol.  \r
+\r
+  The possible responses in a given SAP implementation may include locking \r
+  flash upon failure to authenticate, attestation logging for all signed drivers, \r
+  and other exception operations.  The File parameter allows for possible logging \r
+  within the SAP of the driver.\r
+\r
+  If File is NULL, then EFI_INVALID_PARAMETER is returned.\r
+\r
+  If the file specified by File with an authentication status specified by \r
+  AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned.\r
+\r
+  If the file specified by File with an authentication status specified by \r
+  AuthenticationStatus is not safe for the DXE Core to use under any circumstances, \r
+  then EFI_ACCESS_DENIED is returned.\r
+\r
+  If the file specified by File with an authentication status specified by \r
+  AuthenticationStatus is not safe for the DXE Core to use right now, but it \r
+  might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is \r
+  returned.\r
+\r
+  @param  This             The EFI_SECURITY_ARCH_PROTOCOL instance.\r
+  @param  AuthenticationStatus \r
+                           This is the authentication type returned from the Section\r
+                           Extraction protocol. See the Section Extraction Protocol\r
+                           Specification for details on this type.\r
+  @param  File             This is a pointer to the device path of the file that is\r
+                           being dispatched. This will optionally be used for logging.\r
+\r
+  @retval EFI_SUCCESS           The file specified by File did authenticate, and the\r
+                                platform policy dictates that the DXE Core may use File.\r
+  @retval EFI_INVALID_PARAMETER Driver is NULL.\r
+  @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and\r
+                                the platform policy dictates that File should be placed\r
+                                in the untrusted state. A file may be promoted from\r
+                                the untrusted to the trusted state at a future time\r
+                                with a call to the Trust() DXE Service.\r
+  @retval EFI_ACCESS_DENIED     The file specified by File did not authenticate, and\r
+                                the platform policy dictates that File should not be\r
+                                used for any purpose.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SecurityStubAuthenticateState (\r
+  IN EFI_SECURITY_ARCH_PROTOCOL  *This,\r
+  IN UINT32                      AuthenticationStatus,\r
+  IN EFI_DEVICE_PATH_PROTOCOL    *File\r
+  )\r
+{\r
+  if (File == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+\r
+/**\r
+  The user Entry Point for DXE driver. The user code starts with this function\r
+  as the real entry point for the image goes into a library that calls this \r
+  function.\r
+\r
+  @param[in] ImageHandle    The firmware allocated handle for the EFI image.  \r
+  @param[in] SystemTable    A pointer to the EFI System Table.\r
+  \r
+  @retval EFI_SUCCESS       The entry point is executed successfully.\r
+  @retval other             Some error occurs when executing this entry point.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SecurityStubInitialize (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  )\r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  //\r
+  // Make sure the Security Architectural Protocol is not already installed in the system\r
+  //\r
+  ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiSecurityArchProtocolGuid);\r
+\r
+  //\r
+  // Install the Security Architectural Protocol onto a new handle\r
+  //\r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
+                  &mSecurityArchProtocolHandle,\r
+                  &gEfiSecurityArchProtocolGuid,\r
+                  &mSecurityStub,\r
+                  NULL\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return Status;\r
+}\r
diff --git a/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.dxs b/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.dxs
new file mode 100644 (file)
index 0000000..88a0d2b
--- /dev/null
@@ -0,0 +1,31 @@
+/*++\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
+  SecurityStub.dxs\r
+\r
+Abstract:\r
+\r
+  Dependency expression source file.\r
+  \r
+--*/  \r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+#include <DxeDepex.h>\r
+\r
+DEPENDENCY_START\r
+  TRUE\r
+DEPENDENCY_END\r
diff --git a/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.h b/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.h
new file mode 100644 (file)
index 0000000..dedc14a
--- /dev/null
@@ -0,0 +1,46 @@
+/** @file\r
+  Some definitions for Security Architectural Protocol stub driver\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
+**/\r
+\r
+#ifndef _SECURITY_STUB_ARCH_PROTOCOL_H\r
+#define _SECURITY_STUB_ARCH_PROTOCOL_H\r
+\r
+\r
+//\r
+// Common header files for this module.\r
+//\r
+#include <PiDxe.h>\r
+#include <Protocol/Security.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiDriverEntryPoint.h>\r
+\r
+//\r
+// Function prototypes\r
+//\r
+EFI_STATUS\r
+EFIAPI\r
+SecurityStubAuthenticateState (\r
+  IN EFI_SECURITY_ARCH_PROTOCOL          *This,\r
+  IN UINT32                              AuthenticationStatus,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL           *File\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+SecurityStubInitialize (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  );\r
+\r
+#endif\r
diff --git a/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.inf b/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.inf
new file mode 100644 (file)
index 0000000..fbfe272
--- /dev/null
@@ -0,0 +1,101 @@
+#/** @file\r
+#  Component description file for SecurityStub module\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
+#\r
+#**/\r
+\r
+################################################################################\r
+#\r
+# Defines Section - statements that will be processed to create a Makefile.\r
+#\r
+################################################################################\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = SecurityStub\r
+  FILE_GUID                      = F80697E9-7FD6-4665-8646-88E33EF71DFC\r
+  MODULE_TYPE                    = DXE_DRIVER\r
+  VERSION_STRING                 = 1.0\r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+  ENTRY_POINT                    = SecurityStubInitialize\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+  SecurityStub.c\r
+  SecurityStub.h\r
+\r
+\r
+################################################################################\r
+#\r
+# Includes Section - list of Include locations that are required for\r
+#                    this module.\r
+#\r
+################################################################################\r
+\r
+[Includes]\r
+  $(WORKSPACE)/MdePkg/Include/Library\r
+\r
+################################################################################\r
+#\r
+# Package Dependency Section - list of Package files that are required for\r
+#                              this module.\r
+#\r
+################################################################################\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+\r
+\r
+################################################################################\r
+#\r
+# Library Class Section - list of Library Classes that are required for\r
+#                         this module.\r
+#\r
+################################################################################\r
+\r
+[LibraryClasses]\r
+  UefiDriverEntryPoint\r
+  UefiBootServicesTableLib\r
+  DebugLib\r
+\r
+\r
+################################################################################\r
+#\r
+# Protocol C Name Section - list of Protocol and Protocol Notify C Names\r
+#                           that this module uses or produces.\r
+#\r
+################################################################################\r
+\r
+[Protocols]\r
+  gEfiSecurityArchProtocolGuid                  # PROTOCOL ALWAYS_PRODUCED\r
+\r
+################################################################################\r
+#\r
+# Dependency Expression Section - list of Dependency expressions that are required for\r
+#                              this module.\r
+#\r
+################################################################################\r
+\r
+[Depex]\r
+  TRUE
\ No newline at end of file
diff --git a/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.msa b/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.msa
new file mode 100644 (file)
index 0000000..7bf5d22
--- /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>SecurityStub</ModuleName>\r
+    <ModuleType>DXE_DRIVER</ModuleType>\r
+    <GuidValue>F80697E9-7FD6-4665-8646-88E33EF71DFC</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>Component description file for SecurityStub module</Abstract>\r
+    <Description>This driver supports platform security service.</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>SecurityStub</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>UefiBootServicesTableLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiDriverEntryPoint</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>SecurityStub.dxs</Filename>\r
+    <Filename>SecurityStub.h</Filename>\r
+    <Filename>SecurityStub.c</Filename>\r
+  </SourceFiles>\r
+  <PackageDependencies>\r
+    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+  </PackageDependencies>\r
+  <Protocols>\r
+    <Protocol Usage="ALWAYS_PRODUCED">\r
+      <ProtocolCName>gEfiSecurityArchProtocolGuid</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>SecurityStubInitialize</ModuleEntryPoint>\r
+    </Extern>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
index e0c77f6b478340920cf7829fe45e7ed2b4dcce54..a31a40b23448fad69caf918a3d1d5e78f2ca015d 100644 (file)
@@ -164,4 +164,8 @@ typedef union {
 \r
 #define EFI_PAGES_TO_SIZE(a)   ( (a) << EFI_PAGE_SHIFT)\r
 \r
+\r
+#define EFI_MAX_BIT               MAX_BIT\r
+#define EFI_MAX_ADDRESS           MAX_ADDRESS\r
+\r
 #endif\r