Success to build first Nt32 module.
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Jun 2007 09:35:19 +0000 (09:35 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Jun 2007 09:35:19 +0000 (09:35 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2753 6f19259b-4bc3-4df7-8a09-765794883524

39 files changed:
Nt32Pkg/Include/Library/WinNtLib.h
Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/CommonHeader.h [new file with mode: 0644]
Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.inf [new file with mode: 0644]
Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.msa [new file with mode: 0644]
Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c [new file with mode: 0644]
Nt32Pkg/Library/DxeWinNtLib/CommonHeader.h [new file with mode: 0644]
Nt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.inf [new file with mode: 0644]
Nt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.msa [new file with mode: 0644]
Nt32Pkg/Library/DxeWinNtLib/WinNtLib.c [new file with mode: 0644]
Nt32Pkg/Library/EdkGenericBdsLib/BdsBoot.c [new file with mode: 0644]
Nt32Pkg/Library/EdkGenericBdsLib/BdsConnect.c [new file with mode: 0644]
Nt32Pkg/Library/EdkGenericBdsLib/BdsConsole.c [new file with mode: 0644]
Nt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c [new file with mode: 0644]
Nt32Pkg/Library/EdkGenericBdsLib/CommonHeader.h [new file with mode: 0644]
Nt32Pkg/Library/EdkGenericBdsLib/DevicePath.c [new file with mode: 0644]
Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.inf [new file with mode: 0644]
Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa [new file with mode: 0644]
Nt32Pkg/Library/EdkGenericBdsLib/Performance.c [new file with mode: 0644]
Nt32Pkg/Library/EdkGenericBdsLib/Performance.h [new file with mode: 0644]
Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/CommonHeader.h [new file with mode: 0644]
Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf [new file with mode: 0644]
Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa [new file with mode: 0644]
Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c [new file with mode: 0644]
Nt32Pkg/Library/Nt32PeCoffLoaderLib/CommonHeader.h [new file with mode: 0644]
Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoader.c [new file with mode: 0644]
Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.inf [new file with mode: 0644]
Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.msa [new file with mode: 0644]
Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/CommonHeader.h [new file with mode: 0644]
Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c [new file with mode: 0644]
Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.inf [new file with mode: 0644]
Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.msa [new file with mode: 0644]
Nt32Pkg/Nt32.dsc
Nt32Pkg/Nt32Pkg.dec
Nt32Pkg/WinNtThunkDxe/CommonHeader.h [new file with mode: 0644]
Nt32Pkg/WinNtThunkDxe/WinNtThunk.c [new file with mode: 0644]
Nt32Pkg/WinNtThunkDxe/WinNtThunk.dxs [new file with mode: 0644]
Nt32Pkg/WinNtThunkDxe/WinNtThunk.h [new file with mode: 0644]
Nt32Pkg/WinNtThunkDxe/WinNtThunk.inf [new file with mode: 0644]
Nt32Pkg/WinNtThunkDxe/WinNtThunk.msa [new file with mode: 0644]

index b9bccfc..9210a57 100644 (file)
@@ -22,6 +22,7 @@ Abstract:
 #ifndef __WIN_NT_LIB_H__\r
 #define __WIN_NT_LIB_H__\r
 \r
+#include <WinNtThunk.h>\r
 extern EFI_WIN_NT_THUNK_PROTOCOL  *gWinNt;\r
 \r
 #endif
\ No newline at end of file
diff --git a/Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/CommonHeader.h b/Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/CommonHeader.h
new file mode 100644 (file)
index 0000000..32e7299
--- /dev/null
@@ -0,0 +1,41 @@
+/**@file\r
+  Common header file shared by all source files.\r
+\r
+  This file includes package header files, library classes and protocol, PPI & GUID definitions.\r
+\r
+  Copyright (c) 2007, Intel Corporation.\r
+  All rights reserved.\r
+   This software and associated documentation (if any) is furnished\r
+   under a license and may only be used or copied in accordance\r
+   with the terms of the license. Except as permitted by such\r
+   license, no part of this software or documentation may be\r
+   reproduced, stored in a retrieval system, or transmitted in any\r
+   form or by any means without the express written consent of\r
+   Intel Corporation.\r
+**/\r
+\r
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <Dxe.h>\r
+#include <EdkDxe.h>\r
+#include <WinNtDxe.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Guid/StatusCodeDataTypeId.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/OemHookStatusCodeLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/HobLib.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
+\r
+#endif\r
diff --git a/Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.inf b/Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.inf
new file mode 100644 (file)
index 0000000..d2e1277
--- /dev/null
@@ -0,0 +1,100 @@
+#/** @file\r
+# Memory Status Code Library for UEFI drivers\r
+#\r
+# Lib to provide memory journal status code reporting Routines\r
+# Copyright (c) 2007, Intel Corporation.\r
+#\r
+#  All rights reserved.\r
+#  This software and associated documentation (if any) is furnished\r
+#  under a license and may only be used or copied in accordance\r
+#  with the terms of the license. Except as permitted by such\r
+#  license, no part of this software or documentation may be\r
+#  reproduced, stored in a retrieval system, or transmitted in any\r
+#  form or by any means without the express written consent of\r
+#  Intel Corporation.\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                      = DxeNt32OemHookStatusCodeLib\r
+  FILE_GUID                      = EF172A23-C7C5-47b7-B24E-D10DFE15540F\r
+  MODULE_TYPE                    = DXE_DRIVER\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = OemHookStatusCodeLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER \r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32\r
+#\r
+#  HOB Guid C Name: gEfiWinNtThunkProtocolGuid Hob Type: GUID_EXTENSION\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
+  Nt32OemHookStatusCodeLib.c\r
+  CommonHeader.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
+  Nt32Pkg/Nt32Pkg.dec\r
+  EdkModulePkg/EdkModulePkg.dec\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
+  ReportStatusCodeLib\r
+  BaseMemoryLib\r
+  PrintLib\r
+  HobLib\r
+  DebugLib\r
+\r
+\r
+################################################################################\r
+#\r
+# Guid C Name Section - list of Guids that this module uses or produces.\r
+#\r
+################################################################################\r
+\r
+[Guids]\r
+  gEfiStatusCodeSpecificDataGuid                # ALWAYS_CONSUMED\r
+\r
diff --git a/Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.msa b/Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.msa
new file mode 100644 (file)
index 0000000..394fc24
--- /dev/null
@@ -0,0 +1,68 @@
+<?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>DxeNt32OemHookStatusCodeLib</ModuleName>\r
+    <ModuleType>DXE_DRIVER</ModuleType>\r
+    <GuidValue>EF172A23-C7C5-47b7-B24E-D10DFE15540F</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>Memory Status Code Library for UEFI drivers</Abstract>\r
+    <Description>Lib to provide memory journal status code reporting Routines</Description>\r
+    <Copyright>Copyright (c) 2007, Intel Corporation.</Copyright>\r
+    <License>All rights reserved.
+      This software and associated documentation (if any) is furnished
+      under a license and may only be used or copied in accordance
+      with the terms of the license. Except as permitted by such
+      license, no part of this software or documentation may be
+      reproduced, stored in a retrieval system, or transmitted in any
+      form or by any means without the express written consent of
+      Intel Corporation.</License>\r
+    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>\r
+  </MsaHeader>\r
+  <ModuleDefinitions>\r
+    <SupportedArchitectures>IA32</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>DxeNt32OemHookStatusCodeLib</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">\r
+      <Keyword>OemHookStatusCodeLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>DebugLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>HobLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PrintLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>BaseMemoryLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>ReportStatusCodeLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>Nt32OemHookStatusCodeLib.c</Filename>\r
+  </SourceFiles>\r
+  <PackageDependencies>\r
+    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
+    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>\r
+  </PackageDependencies>\r
+  <Hobs>\r
+    <HobTypes HobGuidCName="gEfiWinNtThunkProtocolGuid" Usage="ALWAYS_CONSUMED">\r
+      <HobType>GUID_EXTENSION</HobType>\r
+    </HobTypes>\r
+  </Hobs>\r
+  <Guids>\r
+    <GuidCNames Usage="ALWAYS_CONSUMED">\r
+      <GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>\r
+    </GuidCNames>\r
+  </Guids>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c b/Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c
new file mode 100644 (file)
index 0000000..75acde6
--- /dev/null
@@ -0,0 +1,236 @@
+/** @file\r
+  OEM hook status code library functions with no library constructor/destructor\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:  Nt32OemHookStatusCodeLib.c\r
+\r
+**/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+//\r
+// Cache of WinNtThunk protocol \r
+//\r
+STATIC\r
+EFI_WIN_NT_THUNK_PROTOCOL   *mWinNt;\r
+\r
+//\r
+// Cache of standard output handle . \r
+//\r
+STATIC\r
+HANDLE                      mStdOut;\r
+\r
+/**\r
+\r
+  Initialize OEM status code device .\r
+\r
+  @return    Always return EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+OemHookStatusCodeInitialize (\r
+  VOID\r
+  )\r
+{\r
+  EFI_HOB_GUID_TYPE   *GuidHob;\r
+\r
+  //\r
+  // Retrieve WinNtThunkProtocol from GUID'ed HOB\r
+  //\r
+  GuidHob = GetFirstGuidHob (&gEfiWinNtThunkProtocolGuid);\r
+  ASSERT (GuidHob != NULL);\r
+  mWinNt = (EFI_WIN_NT_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));\r
+  ASSERT (mWinNt != NULL);\r
+\r
+  //\r
+  // Cache standard output handle.\r
+  //\r
+  mStdOut = mWinNt->GetStdHandle (STD_OUTPUT_HANDLE);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Report status code to OEM device.\r
\r
+  @param  CodeType      Indicates the type of status code being reported.  Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r
\r
+  @param  Value         Describes the current status of a hardware or software entity.  \r
+                        This included information about the class and subclass that is used to classify the entity \r
+                        as well as an operation.  For progress codes, the operation is the current activity. \r
+                        For error codes, it is the exception.  For debug codes, it is not defined at this time. \r
+                        Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.  \r
+                        Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r
\r
+  @param  Instance      The enumeration of a hardware or software entity within the system.  \r
+                        A system may contain multiple entities that match a class/subclass pairing. \r
+                        The instance differentiates between them.  An instance of 0 indicates that instance information is unavailable, \r
+                        not meaningful, or not relevant.  Valid instance numbers start with 1.\r
+\r
+\r
+  @param  CallerId      This optional parameter may be used to identify the caller. \r
+                        This parameter allows the status code driver to apply different rules to different callers. \r
+                        Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.\r
+\r
+\r
+  @param  Data          This optional parameter may be used to pass additional data\r
\r
+  @return               The function always return EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+OemHookStatusCodeReport (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 *CallerId, OPTIONAL\r
+  IN EFI_STATUS_CODE_DATA     *Data      OPTIONAL\r
+  )\r
+{\r
+  CHAR8           *Filename;\r
+  CHAR8           *Description;\r
+  CHAR8           *Format;\r
+  CHAR8           Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];\r
+  UINT32          ErrorLevel;\r
+  UINT32          LineNumber;\r
+  UINTN           CharCount;\r
+  VA_LIST         Marker;\r
+  EFI_DEBUG_INFO  *DebugInfo;\r
+\r
+  Buffer[0] = '\0';\r
+\r
+  if (Data != NULL &&\r
+      ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {\r
+    //\r
+    // Print ASSERT() information into output buffer.\r
+    //\r
+    CharCount = AsciiSPrint (\r
+                  Buffer,\r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  "\n\rASSERT!: %a (%d): %a\n\r",\r
+                  Filename,\r
+                  LineNumber,\r
+                  Description\r
+                  );\r
+\r
+    //\r
+    // Callout to standard output.\r
+    //\r
+    mWinNt->WriteFile (\r
+              mStdOut,\r
+              Buffer,\r
+              CharCount,\r
+              &CharCount,\r
+              NULL\r
+              );\r
+\r
+    return EFI_SUCCESS;\r
+\r
+  } else if (Data != NULL &&\r
+             ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {\r
+    //\r
+    // Print DEBUG() information into output buffer.\r
+    //\r
+    CharCount = AsciiVSPrint (\r
+                  Buffer, \r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+                  Format, \r
+                  Marker\r
+                  );\r
+  } else if (Data != NULL && \r
+             CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid) &&\r
+             (CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {\r
+    //\r
+    // Print specific data into output buffer.\r
+    //\r
+    DebugInfo = (EFI_DEBUG_INFO *) (Data + 1);\r
+    Marker    = (VA_LIST) (DebugInfo + 1);\r
+    Format    = (CHAR8 *) (((UINT64 *) Marker) + 12);\r
+\r
+    CharCount = AsciiVSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, Format, Marker);\r
+  } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {\r
+    //\r
+    // Print ERROR information into output buffer.\r
+    //\r
+    CharCount = AsciiSPrint (\r
+                  Buffer, \r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+                  "ERROR: C%x:V%x I%x", \r
+                  CodeType, \r
+                  Value, \r
+                  Instance\r
+                  );\r
+\r
+    //\r
+    // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.\r
+    //\r
+    \r
+    if (CallerId != NULL) {\r
+      CharCount += AsciiSPrint (\r
+                     &Buffer[CharCount - 1],\r
+                     (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                     " %g",\r
+                     CallerId\r
+                     );\r
+    }\r
+\r
+    if (Data != NULL) {\r
+      CharCount += AsciiSPrint (\r
+                     &Buffer[CharCount - 1],\r
+                     (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                     " %x",\r
+                     Data\r
+                     );\r
+    }\r
+\r
+    CharCount += AsciiSPrint (\r
+                   &Buffer[CharCount - 1],\r
+                   (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                   "\n\r"\r
+                   );\r
+  } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {\r
+    CharCount = AsciiSPrint (\r
+                  Buffer, \r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+                  "PROGRESS CODE: V%x I%x\n\r", \r
+                  Value, \r
+                  Instance\r
+                  );\r
+  } else {\r
+    CharCount = AsciiSPrint (\r
+                  Buffer, \r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+                  "Undefined: C%x:V%x I%x\n\r", \r
+                  CodeType, \r
+                  Value, \r
+                  Instance\r
+                  );\r
+  }\r
+\r
+  //\r
+  // Callout to standard output.\r
+  //\r
+  mWinNt->WriteFile (\r
+            mStdOut,\r
+            Buffer,\r
+            CharCount,\r
+            &CharCount,\r
+            NULL\r
+            );\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
diff --git a/Nt32Pkg/Library/DxeWinNtLib/CommonHeader.h b/Nt32Pkg/Library/DxeWinNtLib/CommonHeader.h
new file mode 100644 (file)
index 0000000..c6f575f
--- /dev/null
@@ -0,0 +1,34 @@
+/**@file\r
+  Common header file shared by all source files.\r
+\r
+  This file includes package header files, library classes and protocol, PPI & GUID definitions.\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
+   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
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiDxe.h>\r
+#include <WinNtDxe.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/WinNtLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/HobLib.h>\r
+\r
+#endif\r
diff --git a/Nt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.inf b/Nt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.inf
new file mode 100644 (file)
index 0000000..9a165a3
--- /dev/null
@@ -0,0 +1,85 @@
+#/** @file\r
+# A library to produce the global variable 'gWinNt'\r
+#\r
+# This library contains a single global variable 'gWinNt' along with a constructor to initialize that global.\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                      = DxeWinNtLib\r
+  FILE_GUID                      = f6b5871d-5226-41b3-a569-3ff893fdc7bc\r
+  MODULE_TYPE                    = DXE_DRIVER\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = WinNtLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER \r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+  CONSTRUCTOR                    = WinNtLibConstructor\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32\r
+#\r
+#  HOB Guid C Name: gEfiWinNtThunkProtocolGuid Hob Type: GUID_EXTENSION\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
+  WinNtLib.c\r
+  CommonHeader.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
+  Nt32Pkg/Nt32Pkg.dec\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
+  HobLib\r
+  DebugLib\r
+\r
diff --git a/Nt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.msa b/Nt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.msa
new file mode 100644 (file)
index 0000000..562616c
--- /dev/null
@@ -0,0 +1,54 @@
+<?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>DxeWinNtLib</ModuleName>\r
+    <ModuleType>DXE_DRIVER</ModuleType>\r
+    <GuidValue>f6b5871d-5226-41b3-a569-3ff893fdc7bc</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>A library to produce the global variable 'gWinNt'</Abstract>\r
+    <Description>This library contains a single global variable 'gWinNt' along with a constructor to initialize that global.</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</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>DxeWinNtLib</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER">\r
+      <Keyword>WinNtLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>DebugLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>HobLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>WinNtLib.c</Filename>\r
+  </SourceFiles>\r
+  <PackageDependencies>\r
+    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>\r
+  </PackageDependencies>\r
+  <Hobs>\r
+    <HobTypes HobGuidCName="gEfiWinNtThunkProtocolGuid" Usage="ALWAYS_CONSUMED">\r
+      <HobType>GUID_EXTENSION</HobType>\r
+    </HobTypes>\r
+  </Hobs>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+    <Extern>\r
+      <Constructor>WinNtLibConstructor</Constructor>\r
+    </Extern>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/Nt32Pkg/Library/DxeWinNtLib/WinNtLib.c b/Nt32Pkg/Library/DxeWinNtLib/WinNtLib.c
new file mode 100644 (file)
index 0000000..ef04eca
--- /dev/null
@@ -0,0 +1,53 @@
+/*++\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
+  WinNtLib.c\r
+\r
+Abstract:\r
+\r
+  WinNt Library \r
+\r
+--*/\r
+\r
+\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+EFI_WIN_NT_THUNK_PROTOCOL *gWinNt;\r
+\r
+EFI_STATUS\r
+WinNtLibConstructor (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+Arguments:\r
+\r
+Returns:\r
+\r
+--*/\r
+{\r
+  EFI_HOB_GUID_TYPE        *GuidHob;\r
+\r
+  GuidHob = GetFirstGuidHob (&gEfiWinNtThunkProtocolGuid);\r
+  ASSERT (GuidHob != NULL);\r
+  gWinNt = (EFI_WIN_NT_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));\r
+  ASSERT (gWinNt != NULL);\r
+  return EFI_SUCCESS;\r
+}\r
diff --git a/Nt32Pkg/Library/EdkGenericBdsLib/BdsBoot.c b/Nt32Pkg/Library/EdkGenericBdsLib/BdsBoot.c
new file mode 100644 (file)
index 0000000..de11d2e
--- /dev/null
@@ -0,0 +1,1106 @@
+/*++\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
+  BdsBoot.c\r
+\r
+Abstract:\r
+\r
+  BDS Lib functions which relate with create or process the boot\r
+  option.\r
+\r
+--*/\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+#include "Performance.h"\r
+\r
+BOOLEAN mEnumBootDevice = FALSE;\r
+\r
+EFI_STATUS\r
+BdsLibDoLegacyBoot (\r
+  IN  BDS_COMMON_OPTION           *Option\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Boot the legacy system with the boot option\r
+\r
+Arguments:\r
+\r
+  Option           - The legacy boot option which have BBS device path\r
+\r
+Returns:\r
+\r
+  EFI_UNSUPPORTED  - There is no legacybios protocol, do not support\r
+                     legacy boot.\r
+\r
+  EFI_STATUS       - Return the status of LegacyBios->LegacyBoot ().\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                Status;\r
+  EFI_LEGACY_BIOS_PROTOCOL  *LegacyBios;\r
+\r
+  Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, &LegacyBios);\r
+  if (EFI_ERROR (Status)) {\r
+    //\r
+    // If no LegacyBios protocol we do not support legacy boot\r
+    //\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+  //\r
+  // Notes: if we seperate the int 19, then we don't need to refresh BBS\r
+  //\r
+  BdsRefreshBbsTableForBoot (Option);\r
+\r
+  //\r
+  // Write boot to OS performance data to a file\r
+  //\r
+  PERF_CODE (\r
+    WriteBootToOsPerformanceData ();\r
+  );\r
+\r
+\r
+  DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Legacy Boot: %S\n", Option->Description));\r
+  return LegacyBios->LegacyBoot (\r
+                      LegacyBios,\r
+                      (BBS_BBS_DEVICE_PATH *) Option->DevicePath,\r
+                      Option->LoadOptionsSize,\r
+                      Option->LoadOptions\r
+                      );\r
+}\r
+\r
+EFI_STATUS\r
+BdsLibBootViaBootOption (\r
+  IN  BDS_COMMON_OPTION             * Option,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL      * DevicePath,\r
+  OUT UINTN                         *ExitDataSize,\r
+  OUT CHAR16                        **ExitData OPTIONAL\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Process the boot option follow the EFI 1.1 specification and\r
+  special treat the legacy boot option with BBS_DEVICE_PATH.\r
+\r
+Arguments:\r
+\r
+  Option       - The boot option need to be processed\r
+\r
+  DevicePath   - The device path which describe where to load\r
+                 the boot image or the legcy BBS device path\r
+                 to boot the legacy OS\r
+\r
+  ExitDataSize - Returned directly from gBS->StartImage ()\r
+\r
+  ExitData     - Returned directly from gBS->StartImage ()\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS   - Status from gBS->StartImage (),\r
+                  or BdsBootByDiskSignatureAndPartition ()\r
+\r
+  EFI_NOT_FOUND - If the Device Path is not found in the system\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                Status;\r
+  EFI_HANDLE                Handle;\r
+  EFI_HANDLE                ImageHandle;\r
+  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *FilePath;\r
+  EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;\r
+  EFI_ACPI_S3_SAVE_PROTOCOL *AcpiS3Save;\r
+  EFI_BLOCK_IO_PROTOCOL     *BlkIo;\r
+  VOID                      *Buffer;\r
+\r
+  //\r
+  // Record the performance data for End of BDS\r
+  //\r
+  PERF_END (0, BDS_TOK, NULL, 0);\r
+\r
+  *ExitDataSize = 0;\r
+  *ExitData     = NULL;\r
+\r
+  //\r
+  // Notes: put EFI64 ROM Shadow Solution\r
+  //\r
+  EFI64_SHADOW_ALL_LEGACY_ROM ();\r
+\r
+  //\r
+  // Notes: this code can be remove after the s3 script table\r
+  // hook on the event EFI_EVENT_SIGNAL_READY_TO_BOOT or\r
+  // EFI_EVENT_SIGNAL_LEGACY_BOOT\r
+  //\r
+  Status = gBS->LocateProtocol (&gEfiAcpiS3SaveProtocolGuid, NULL, &AcpiS3Save);\r
+  if (!EFI_ERROR (Status)) {\r
+    AcpiS3Save->S3Save (AcpiS3Save, NULL);\r
+  }\r
+  //\r
+  // If it's Device Path that starts with a hard drive path,\r
+  // this routine will do the booting.\r
+  //\r
+  Status = BdsBootByDiskSignatureAndPartition (\r
+            Option,\r
+            (HARDDRIVE_DEVICE_PATH *) DevicePath,\r
+            Option->LoadOptionsSize,\r
+            Option->LoadOptions,\r
+            ExitDataSize,\r
+            ExitData\r
+            );\r
+  if (!EFI_ERROR (Status)) {\r
+    //\r
+    // If we found a disk signature and partition device path return success\r
+    //\r
+    return EFI_SUCCESS;\r
+  }\r
+  //\r
+  // Signal the EFI_EVENT_SIGNAL_READY_TO_BOOT event\r
+  //\r
+  EfiSignalEventReadyToBoot ();\r
+\r
+  //\r
+  // Set Boot Current\r
+  //\r
+  gRT->SetVariable (\r
+        L"BootCurrent",\r
+        &gEfiGlobalVariableGuid,\r
+        EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+        sizeof (UINT16),\r
+        &Option->BootCurrent\r
+        );\r
+\r
+  if ((DevicePathType (Option->DevicePath) == BBS_DEVICE_PATH) &&\r
+      (DevicePathSubType (Option->DevicePath) == BBS_BBS_DP)\r
+    ) {\r
+    //\r
+    // Check to see if we should legacy BOOT. If yes then do the legacy boot\r
+    //\r
+    return BdsLibDoLegacyBoot (Option);\r
+  }\r
+\r
+  DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Booting EFI 1.1 way %S\n", Option->Description));\r
+\r
+  Status = gBS->LoadImage (\r
+                  TRUE,\r
+                  mBdsImageHandle,\r
+                  DevicePath,\r
+                  NULL,\r
+                  0,\r
+                  &ImageHandle\r
+                  );\r
+\r
+  //\r
+  // If we didn't find an image, we may need to load the default\r
+  // boot behavior for the device.\r
+  //\r
+  if (EFI_ERROR (Status)) {\r
+    //\r
+    // Find a Simple File System protocol on the device path. If the remaining\r
+    // device path is set to end then no Files are being specified, so try\r
+    // the removable media file name.\r
+    //\r
+    TempDevicePath = DevicePath;\r
+    Status = gBS->LocateDevicePath (\r
+                    &gEfiSimpleFileSystemProtocolGuid,\r
+                    &TempDevicePath,\r
+                    &Handle\r
+                    );\r
+    if (!EFI_ERROR (Status) && IsDevicePathEnd (TempDevicePath)) {\r
+      FilePath = FileDevicePath (Handle, EFI_REMOVABLE_MEDIA_FILE_NAME);\r
+      if (FilePath) {\r
+        //\r
+        // Issue a dummy read to the device to check for media change.\r
+        // When the removable media is changed, any Block IO read/write will\r
+        // cause the BlockIo protocol be reinstalled and EFI_MEDIA_CHANGED is\r
+        // returned. After the Block IO protocol is reinstalled, subsequent\r
+        // Block IO read/write will success.\r
+        //\r
+        Status = gBS->HandleProtocol (\r
+                        Handle,\r
+                        &gEfiBlockIoProtocolGuid,\r
+                        (VOID **) &BlkIo\r
+                        );\r
+        if (!EFI_ERROR (Status)) {\r
+          Buffer = AllocatePool (BlkIo->Media->BlockSize);\r
+          if (Buffer != NULL) {\r
+            BlkIo->ReadBlocks (\r
+                     BlkIo,\r
+                     BlkIo->Media->MediaId,\r
+                     0,\r
+                     BlkIo->Media->BlockSize,\r
+                     Buffer\r
+                     );\r
+            FreePool (Buffer);\r
+          }\r
+        }\r
+\r
+        Status = gBS->LoadImage (\r
+                        TRUE,\r
+                        mBdsImageHandle,\r
+                        FilePath,\r
+                        NULL,\r
+                        0,\r
+                        &ImageHandle\r
+                        );\r
+        if (EFI_ERROR (Status)) {\r
+          //\r
+          // The DevicePath failed, and it's not a valid\r
+          // removable media device.\r
+          //\r
+          goto Done;\r
+        }\r
+      }\r
+    } else {\r
+      Status = EFI_NOT_FOUND;\r
+    }\r
+  }\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    //\r
+    // It there is any error from the Boot attempt exit now.\r
+    //\r
+    goto Done;\r
+  }\r
+  //\r
+  // Provide the image with it's load options\r
+  //\r
+  Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, &ImageInfo);\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  if (Option->LoadOptionsSize != 0) {\r
+    ImageInfo->LoadOptionsSize  = Option->LoadOptionsSize;\r
+    ImageInfo->LoadOptions      = Option->LoadOptions;\r
+  }\r
+  //\r
+  // Before calling the image, enable the Watchdog Timer for\r
+  // the 5 Minute period\r
+  //\r
+  gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);\r
+\r
+  Status = gBS->StartImage (ImageHandle, ExitDataSize, ExitData);\r
+  DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Image Return Status = %r\n", Status));\r
+\r
+  //\r
+  // Clear the Watchdog Timer after the image returns\r
+  //\r
+  gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);\r
+\r
+Done:\r
+  //\r
+  // Clear Boot Current\r
+  //\r
+  gRT->SetVariable (\r
+        L"BootCurrent",\r
+        &gEfiGlobalVariableGuid,\r
+        EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+        0,\r
+        &Option->BootCurrent\r
+        );\r
+\r
+  return Status;\r
+}\r
+\r
+EFI_STATUS\r
+BdsBootByDiskSignatureAndPartition (\r
+  IN  BDS_COMMON_OPTION          * Option,\r
+  IN  HARDDRIVE_DEVICE_PATH      * HardDriveDevicePath,\r
+  IN  UINT32                     LoadOptionsSize,\r
+  IN  VOID                       *LoadOptions,\r
+  OUT UINTN                      *ExitDataSize,\r
+  OUT CHAR16                     **ExitData OPTIONAL\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Check to see if a hard ware device path was passed in. If it was then search\r
+  all the block IO devices for the passed in hard drive device path.\r
+\r
+Arguments:\r
+\r
+  Option - The current processing boot option.\r
+\r
+  HardDriveDevicePath - EFI Device Path to boot, if it starts with a hard\r
+                        drive device path.\r
+\r
+  LoadOptionsSize - Passed into gBS->StartImage ()\r
+                    via the loaded image protocol.\r
+\r
+  LoadOptions     - Passed into gBS->StartImage ()\r
+                    via the loaded image protocol.\r
+\r
+  ExitDataSize - returned directly from gBS->StartImage ()\r
+\r
+  ExitData     - returned directly from gBS->StartImage ()\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS   - Status from gBS->StartImage (),\r
+                  or BootByDiskSignatureAndPartition ()\r
+\r
+  EFI_NOT_FOUND - If the Device Path is not found in the system\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                Status;\r
+  UINTN                     BlockIoHandleCount;\r
+  EFI_HANDLE                *BlockIoBuffer;\r
+  EFI_DEVICE_PATH_PROTOCOL  *BlockIoDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *BlockIoHdDevicePath;\r
+  HARDDRIVE_DEVICE_PATH     *TmpHdPath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;\r
+  UINTN                     Index;\r
+  BOOLEAN                   DevicePathMatch;\r
+  HARDDRIVE_DEVICE_PATH     *TempPath;\r
+\r
+  *ExitDataSize = 0;\r
+  *ExitData     = NULL;\r
+\r
+  if ( !((DevicePathType (&HardDriveDevicePath->Header) == MEDIA_DEVICE_PATH) &&\r
+          (DevicePathSubType (&HardDriveDevicePath->Header) == MEDIA_HARDDRIVE_DP))\r
+        ) {\r
+    //\r
+    // If the HardDriveDevicePath does not start with a Hard Drive Device Path\r
+    // exit.\r
+    //\r
+    return EFI_NOT_FOUND;\r
+  }\r
+  //\r
+  // The boot device have already been connected\r
+  //\r
+  Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &BlockIoHandleCount, &BlockIoBuffer);\r
+  if (EFI_ERROR (Status) || BlockIoHandleCount == 0) {\r
+    //\r
+    // If there was an error or there are no device handles that support\r
+    // the BLOCK_IO Protocol, then return.\r
+    //\r
+    return EFI_NOT_FOUND;\r
+  }\r
+  //\r
+  // Loop through all the device handles that support the BLOCK_IO Protocol\r
+  //\r
+  for (Index = 0; Index < BlockIoHandleCount; Index++) {\r
+\r
+    Status = gBS->HandleProtocol (BlockIoBuffer[Index], &gEfiDevicePathProtocolGuid, (VOID *) &BlockIoDevicePath);\r
+    if (EFI_ERROR (Status) || BlockIoDevicePath == NULL) {\r
+      continue;\r
+    }\r
+    //\r
+    // Make PreviousDevicePath == the device path node before the end node\r
+    //\r
+    DevicePath          = BlockIoDevicePath;\r
+    BlockIoHdDevicePath = NULL;\r
+\r
+    //\r
+    // find HardDriver device path node\r
+    //\r
+    while (!IsDevicePathEnd (DevicePath)) {\r
+      if ((DevicePathType (DevicePath) == MEDIA_DEVICE_PATH) &&\r
+          (DevicePathSubType (DevicePath) == MEDIA_HARDDRIVE_DP)\r
+          ) {\r
+        BlockIoHdDevicePath = DevicePath;\r
+        break;\r
+      }\r
+\r
+      DevicePath = NextDevicePathNode (DevicePath);\r
+    }\r
+\r
+    if (BlockIoHdDevicePath == NULL) {\r
+      continue;\r
+    }\r
+    //\r
+    // See if the harddrive device path in blockio matches the orig Hard Drive Node\r
+    //\r
+    DevicePathMatch = FALSE;\r
+\r
+    TmpHdPath       = (HARDDRIVE_DEVICE_PATH *) BlockIoHdDevicePath;\r
+    TempPath        = (HARDDRIVE_DEVICE_PATH *) BdsLibUnpackDevicePath ((EFI_DEVICE_PATH_PROTOCOL *) HardDriveDevicePath);\r
+\r
+    //\r
+    // Only several fields will be checked. NOT whole NODE\r
+    //\r
+    if ( TmpHdPath->PartitionNumber == TempPath->PartitionNumber &&\r
+        TmpHdPath->MBRType == TempPath->MBRType &&\r
+        TmpHdPath->SignatureType == TempPath->SignatureType &&\r
+        CompareGuid ((EFI_GUID *) TmpHdPath->Signature, (EFI_GUID *) TempPath->Signature)) {\r
+      //\r
+      // Get the matched device path\r
+      //\r
+      DevicePathMatch = TRUE;\r
+    }\r
+    //\r
+    // Only do the boot, when devicepath match\r
+    //\r
+    if (DevicePathMatch) {\r
+      //\r
+      // Combine the Block IO and Hard Drive Device path together and try\r
+      // to boot from it.\r
+      //\r
+      DevicePath    = NextDevicePathNode ((EFI_DEVICE_PATH_PROTOCOL *) HardDriveDevicePath);\r
+      NewDevicePath = AppendDevicePath (BlockIoDevicePath, DevicePath);\r
+\r
+      //\r
+      // Recursive boot with new device path\r
+      //\r
+      Status = BdsLibBootViaBootOption (Option, NewDevicePath, ExitDataSize, ExitData);\r
+      if (!EFI_ERROR (Status)) {\r
+        break;\r
+      }\r
+    }\r
+  }\r
+\r
+  FreePool (BlockIoBuffer);\r
+  return Status;\r
+}\r
+\r
+EFI_STATUS\r
+BdsLibDeleteOptionFromHandle (\r
+  IN  EFI_HANDLE                 Handle\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Delete the boot option associated with the handle passed in\r
+\r
+Arguments:\r
+\r
+  Handle - The handle which present the device path to create boot option\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS           - Delete the boot option success\r
+\r
+  EFI_NOT_FOUND         - If the Device Path is not found in the system\r
+\r
+  EFI_OUT_OF_RESOURCES  - Lack of memory resource\r
+\r
+  Other                 - Error return value from SetVariable()\r
+\r
+--*/\r
+{\r
+  UINT16                    *BootOrder;\r
+  UINT8                     *BootOptionVar;\r
+  UINTN                     BootOrderSize;\r
+  UINTN                     BootOptionSize;\r
+  EFI_STATUS                Status;\r
+  UINTN                     Index;\r
+  UINT16                    BootOption[BOOT_OPTION_MAX_CHAR];\r
+  UINTN                     DevicePathSize;\r
+  UINTN                     OptionDevicePathSize;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *OptionDevicePath;\r
+  UINT8                     *TempPtr;\r
+  CHAR16                    *Description;\r
+\r
+  Status        = EFI_SUCCESS;\r
+  BootOrder     = NULL;\r
+  BootOrderSize = 0;\r
+\r
+  BootOrder = BdsLibGetVariableAndSize (\r
+                L"BootOrder",\r
+                &gEfiGlobalVariableGuid,\r
+                &BootOrderSize\r
+                );\r
+  if (NULL == BootOrder) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  DevicePath = DevicePathFromHandle (Handle);\r
+  if (DevicePath == NULL) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+  DevicePathSize = GetDevicePathSize (DevicePath);\r
+\r
+  Index = 0;\r
+  while (Index < BootOrderSize / sizeof (UINT16)) {\r
+    UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);\r
+    BootOptionVar = BdsLibGetVariableAndSize (\r
+                      BootOption,\r
+                      &gEfiGlobalVariableGuid,\r
+                      &BootOptionSize\r
+                      );\r
+    if (NULL == BootOptionVar) {\r
+      FreePool (BootOrder);\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
+\r
+    TempPtr = BootOptionVar;\r
+    TempPtr += sizeof (UINT32) + sizeof (UINT16);\r
+    Description = (CHAR16 *) TempPtr;\r
+    TempPtr += StrSize ((CHAR16 *) TempPtr);\r
+    OptionDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;\r
+    OptionDevicePathSize = GetDevicePathSize (OptionDevicePath);\r
+\r
+    //\r
+    // Check whether the device path match\r
+    //\r
+    if ((OptionDevicePathSize == DevicePathSize) &&\r
+        (CompareMem (DevicePath, OptionDevicePath, DevicePathSize) == 0)) {\r
+      BdsDeleteBootOption (BootOrder[Index], BootOrder, &BootOrderSize);\r
+      FreePool (BootOptionVar);\r
+      break;\r
+    }\r
+\r
+    FreePool (BootOptionVar);\r
+    Index++;\r
+  }\r
+\r
+  Status = gRT->SetVariable (\r
+                  L"BootOrder",\r
+                  &gEfiGlobalVariableGuid,\r
+                  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
+                  BootOrderSize,\r
+                  BootOrder\r
+                  );\r
+\r
+  FreePool (BootOrder);\r
+\r
+  return Status;\r
+}\r
+\r
+EFI_STATUS\r
+BdsDeleteAllInvalidEfiBootOption (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Delete all invalid EFI boot options. The probable invalid boot option could\r
+  be Removable media or Network boot device.\r
+\r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS           - Delete all invalid boot option success\r
+\r
+  EFI_NOT_FOUND         - Variable "BootOrder" is not found\r
+\r
+  EFI_OUT_OF_RESOURCES  - Lack of memory resource\r
+\r
+  Other                 - Error return value from SetVariable()\r
+\r
+--*/\r
+{\r
+  UINT16                    *BootOrder;\r
+  UINT8                     *BootOptionVar;\r
+  UINTN                     BootOrderSize;\r
+  UINTN                     BootOptionSize;\r
+  EFI_STATUS                Status;\r
+  UINTN                     Index;\r
+  UINTN                     Index2;\r
+  UINT16                    BootOption[BOOT_OPTION_MAX_CHAR];\r
+  UINTN                     OptionDevicePathSize;\r
+  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *LastDeviceNode;\r
+  EFI_DEVICE_PATH_PROTOCOL  *OptionDevicePath;\r
+  UINT8                     *TempPtr;\r
+  CHAR16                    *Description;\r
+  EFI_HANDLE                Handle;\r
+  BOOLEAN                   NeedDelete;\r
+\r
+  Status        = EFI_SUCCESS;\r
+  BootOrder     = NULL;\r
+  BootOrderSize = 0;\r
+\r
+  BootOrder = BdsLibGetVariableAndSize (\r
+                L"BootOrder",\r
+                &gEfiGlobalVariableGuid,\r
+                &BootOrderSize\r
+                );\r
+  if (NULL == BootOrder) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  Index = 0;\r
+  while (Index < BootOrderSize / sizeof (UINT16)) {\r
+    UnicodeSPrint (BootOption, sizeof (BootOption), L"Boot%04x", BootOrder[Index]);\r
+    BootOptionVar = BdsLibGetVariableAndSize (\r
+                      BootOption,\r
+                      &gEfiGlobalVariableGuid,\r
+                      &BootOptionSize\r
+                      );\r
+    if (NULL == BootOptionVar) {\r
+      FreePool (BootOrder);\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
+\r
+    TempPtr = BootOptionVar;\r
+    TempPtr += sizeof (UINT32) + sizeof (UINT16);\r
+    Description = (CHAR16 *) TempPtr;\r
+    TempPtr += StrSize ((CHAR16 *) TempPtr);\r
+    OptionDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;\r
+    OptionDevicePathSize = GetDevicePathSize (OptionDevicePath);\r
+\r
+    //\r
+    // Skip legacy boot option (BBS boot device)\r
+    //\r
+    if ((DevicePathType (OptionDevicePath) == BBS_DEVICE_PATH) &&\r
+        (DevicePathSubType (OptionDevicePath) == BBS_BBS_DP)) {\r
+      FreePool (BootOptionVar);\r
+      Index++;\r
+      continue;\r
+    }\r
+\r
+    TempDevicePath = OptionDevicePath;\r
+    LastDeviceNode = OptionDevicePath;\r
+    while (!EfiIsDevicePathEnd (TempDevicePath)) {\r
+      LastDeviceNode = TempDevicePath;\r
+      TempDevicePath = EfiNextDevicePathNode (TempDevicePath);\r
+    }\r
+    //\r
+    // Skip the boot option that point to a file, since the device path in\r
+    // removable media boot option doesn't contains a file name.\r
+    //\r
+    if (((DevicePathType (LastDeviceNode) == MEDIA_DEVICE_PATH) &&\r
+         (DevicePathSubType (LastDeviceNode) == MEDIA_FILEPATH_DP)) ||\r
+        //\r
+        // Skip boot option for internal Shell, it's always valid\r
+        //\r
+        (EfiGetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) LastDeviceNode) != NULL)) {\r
+      FreePool (BootOptionVar);\r
+      Index++;\r
+      continue;\r
+    }\r
+\r
+    NeedDelete = TRUE;\r
+    //\r
+    // Check if it's a valid boot option for removable media\r
+    //\r
+    TempDevicePath = OptionDevicePath;\r
+    Status = gBS->LocateDevicePath (\r
+                    &gEfiSimpleFileSystemProtocolGuid,\r
+                    &TempDevicePath,\r
+                    &Handle\r
+                    );\r
+    if (!EFI_ERROR (Status)) {\r
+      NeedDelete = FALSE;\r
+    }\r
+    //\r
+    // Check if it's a valid boot option for network boot device\r
+    //\r
+    TempDevicePath = OptionDevicePath;\r
+    Status = gBS->LocateDevicePath (\r
+                    &gEfiLoadFileProtocolGuid,\r
+                    &TempDevicePath,\r
+                    &Handle\r
+                    );\r
+    if (!EFI_ERROR (Status)) {\r
+      NeedDelete = FALSE;\r
+    }\r
+\r
+    if (NeedDelete) {\r
+      //\r
+      // Delete this invalid boot option "Boot####"\r
+      //\r
+      Status = gRT->SetVariable (\r
+                      BootOption,\r
+                      &gEfiGlobalVariableGuid,\r
+                      EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
+                      0,\r
+                      NULL\r
+                      );\r
+      //\r
+      // Mark this boot option in boot order as deleted\r
+      //\r
+      BootOrder[Index] = 0xffff;\r
+    }\r
+\r
+    FreePool (BootOptionVar);\r
+    Index++;\r
+  }\r
+\r
+  //\r
+  // Adjust boot order array\r
+  //\r
+  Index2 = 0;\r
+  for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {\r
+    if (BootOrder[Index] != 0xffff) {\r
+      BootOrder[Index2] = BootOrder[Index];\r
+      Index2 ++;\r
+    }\r
+  }\r
+  Status = gRT->SetVariable (\r
+                  L"BootOrder",\r
+                  &gEfiGlobalVariableGuid,\r
+                  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
+                  Index2 * sizeof (UINT16),\r
+                  BootOrder\r
+                  );\r
+\r
+  FreePool (BootOrder);\r
+\r
+  return Status;\r
+}\r
+\r
+EFI_STATUS\r
+BdsLibEnumerateAllBootOption (\r
+  IN OUT LIST_ENTRY      *BdsBootOptionList\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  This function will enumerate all possible boot device in the system,\r
+  it will only excute once of every boot.\r
+\r
+Arguments:\r
+\r
+  BdsBootOptionList - The header of the link list which indexed all\r
+                      current boot options\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS - Finished all the boot device enumerate and create\r
+                the boot option base on that boot device\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                    Status;\r
+  UINT16                        BootOptionNumber;\r
+  UINTN                         NumberFileSystemHandles;\r
+  EFI_HANDLE                    *FileSystemHandles;\r
+  EFI_BLOCK_IO_PROTOCOL         *BlkIo;\r
+  UINTN                         Index;\r
+  UINTN                         NumberLoadFileHandles;\r
+  EFI_HANDLE                    *LoadFileHandles;\r
+  VOID                          *ProtocolInstance;\r
+  EFI_FIRMWARE_VOLUME_PROTOCOL  *Fv;\r
+  UINTN                         FvHandleCount;\r
+  EFI_HANDLE                    *FvHandleBuffer;\r
+  EFI_FV_FILETYPE               Type;\r
+  UINTN                         Size;\r
+  EFI_FV_FILE_ATTRIBUTES        Attributes;\r
+  UINT32                        AuthenticationStatus;\r
+  EFI_DEVICE_PATH_PROTOCOL      *FilePath;\r
+  EFI_HANDLE                    ImageHandle;\r
+  EFI_LOADED_IMAGE_PROTOCOL     *ImageInfo;\r
+  BOOLEAN                       NeedDelete;\r
+\r
+  BootOptionNumber = 0;\r
+\r
+  //\r
+  // If the boot device enumerate happened, just get the boot\r
+  // device from the boot order variable\r
+  //\r
+  if (mEnumBootDevice) {\r
+    BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");\r
+    return EFI_SUCCESS;\r
+  }\r
+  //\r
+  // Notes: this dirty code is to get the legacy boot option from the\r
+  // BBS table and create to variable as the EFI boot option, it should\r
+  // be removed after the CSM can provide legacy boot option directly\r
+  //\r
+  REFRESH_LEGACY_BOOT_OPTIONS;\r
+\r
+  //\r
+  // Delete invalid boot option\r
+  //\r
+  BdsDeleteAllInvalidEfiBootOption ();\r
+  //\r
+  // Parse removable media\r
+  //\r
+  gBS->LocateHandleBuffer (\r
+        ByProtocol,\r
+        &gEfiSimpleFileSystemProtocolGuid,\r
+        NULL,\r
+        &NumberFileSystemHandles,\r
+        &FileSystemHandles\r
+        );\r
+  for (Index = 0; Index < NumberFileSystemHandles; Index++) {\r
+    Status = gBS->HandleProtocol (\r
+                    FileSystemHandles[Index],\r
+                    &gEfiBlockIoProtocolGuid,\r
+                    (VOID **) &BlkIo\r
+                    );\r
+    if (!EFI_ERROR (Status)) {\r
+      if (!BlkIo->Media->RemovableMedia) {\r
+        //\r
+        // If the file system handle supports a BlkIo protocol,\r
+        // skip the removable media devices\r
+        //\r
+        continue;\r
+      }\r
+    }\r
+\r
+    //\r
+    // Do the removable Media thing. \EFI\BOOT\boot{machinename}.EFI\r
+    //  machinename is ia32, ia64, x64, ...\r
+    //\r
+    FilePath = FileDevicePath (FileSystemHandles[Index], EFI_REMOVABLE_MEDIA_FILE_NAME);\r
+    NeedDelete = TRUE;\r
+    Status = gBS->LoadImage (\r
+                    TRUE,\r
+                    mBdsImageHandle,\r
+                    FilePath,\r
+                    NULL,\r
+                    0,\r
+                    &ImageHandle\r
+                    );\r
+    if (!EFI_ERROR(Status)) {\r
+      //\r
+      // Verify the image is a EFI application (and not a driver)\r
+      //\r
+      Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &ImageInfo);\r
+      ASSERT (!EFI_ERROR(Status));\r
+\r
+      if (ImageInfo->ImageCodeType == EfiLoaderCode) {\r
+        NeedDelete = FALSE;\r
+      }\r
+    }\r
+\r
+    if (NeedDelete) {\r
+      //\r
+      // No such file or the file is not a EFI application, delete this boot option\r
+      //\r
+      BdsLibDeleteOptionFromHandle (FileSystemHandles[Index]);\r
+    } else {\r
+      BdsLibBuildOptionFromHandle (FileSystemHandles[Index], BdsBootOptionList);\r
+      BootOptionNumber++;\r
+    }\r
+  }\r
+\r
+  if (NumberFileSystemHandles) {\r
+    FreePool (FileSystemHandles);\r
+  }\r
+  //\r
+  // Parse Network Boot Device\r
+  //\r
+  gBS->LocateHandleBuffer (\r
+        ByProtocol,\r
+        &gEfiSimpleNetworkProtocolGuid,\r
+        NULL,\r
+        &NumberLoadFileHandles,\r
+        &LoadFileHandles\r
+        );\r
+  for (Index = 0; Index < NumberLoadFileHandles; Index++) {\r
+    Status = gBS->HandleProtocol (\r
+                    LoadFileHandles[Index],\r
+                    &gEfiLoadFileProtocolGuid,\r
+                    (VOID **) &ProtocolInstance\r
+                    );\r
+    if (EFI_ERROR (Status)) {\r
+      continue;\r
+    }\r
+\r
+    BdsLibBuildOptionFromHandle (LoadFileHandles[Index], BdsBootOptionList);\r
+    BootOptionNumber++;\r
+  }\r
+\r
+  if (NumberLoadFileHandles) {\r
+    FreePool (LoadFileHandles);\r
+  }\r
+  //\r
+  // Check if we have on flash shell\r
+  //\r
+  gBS->LocateHandleBuffer (\r
+        ByProtocol,\r
+        &gEfiFirmwareVolumeProtocolGuid,\r
+        NULL,\r
+        &FvHandleCount,\r
+        &FvHandleBuffer\r
+        );\r
+  for (Index = 0; Index < FvHandleCount; Index++) {\r
+    gBS->HandleProtocol (\r
+          FvHandleBuffer[Index],\r
+          &gEfiFirmwareVolumeProtocolGuid,\r
+          (VOID **) &Fv\r
+          );\r
+\r
+    Status = Fv->ReadFile (\r
+                  Fv,\r
+                  &gEfiShellFileGuid,\r
+                  NULL,\r
+                  &Size,\r
+                  &Type,\r
+                  &Attributes,\r
+                  &AuthenticationStatus\r
+                  );\r
+    if (EFI_ERROR (Status)) {\r
+      //\r
+      // Skip if no shell file in the FV\r
+      //\r
+      continue;\r
+    }\r
+    //\r
+    // Build the shell boot option\r
+    //\r
+    BdsLibBuildOptionFromShell (FvHandleBuffer[Index], BdsBootOptionList);\r
+    BootOptionNumber++;\r
+  }\r
+\r
+  if (FvHandleCount) {\r
+   FreePool (FvHandleBuffer);\r
+  }\r
+  //\r
+  // Make sure every boot only have one time\r
+  // boot device enumerate\r
+  //\r
+  BdsLibBuildOptionFromVar (BdsBootOptionList, L"BootOrder");\r
+  mEnumBootDevice = TRUE;\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+VOID\r
+BdsLibBuildOptionFromHandle (\r
+  IN  EFI_HANDLE             Handle,\r
+  IN  LIST_ENTRY             *BdsBootOptionList\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Build the boot option with the handle parsed in\r
+\r
+Arguments:\r
+\r
+  Handle - The handle which present the device path to create boot option\r
+\r
+  BdsBootOptionList - The header of the link list which indexed all current\r
+                      boot options\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+  CHAR16                    *TempString;\r
+\r
+  DevicePath  = DevicePathFromHandle (Handle);\r
+  TempString  = DevicePathToStr (DevicePath);\r
+\r
+  //\r
+  // Create and register new boot option\r
+  //\r
+  BdsLibRegisterNewOption (BdsBootOptionList, DevicePath, TempString, L"BootOrder");\r
+}\r
+\r
+VOID\r
+BdsLibBuildOptionFromShell (\r
+  IN EFI_HANDLE              Handle,\r
+  IN OUT LIST_ENTRY          *BdsBootOptionList\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Build the on flash shell boot option with the handle parsed in\r
+\r
+Arguments:\r
+\r
+  Handle - The handle which present the device path to create on flash shell\r
+           boot option\r
+\r
+  BdsBootOptionList - The header of the link list which indexed all current\r
+                      boot options\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  EFI_DEVICE_PATH_PROTOCOL          *DevicePath;\r
+  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH ShellNode;\r
+\r
+  DevicePath = DevicePathFromHandle (Handle);\r
+\r
+  //\r
+  // Build the shell device path\r
+  //\r
+  EfiInitializeFwVolDevicepathNode (&ShellNode, &gEfiShellFileGuid);\r
+  DevicePath = AppendDevicePathNode (DevicePath, (EFI_DEVICE_PATH_PROTOCOL *) &ShellNode);\r
+\r
+  //\r
+  // Create and register the shell boot option\r
+  //\r
+  BdsLibRegisterNewOption (BdsBootOptionList, DevicePath, L"Internal EFI Shell", L"BootOrder");\r
+\r
+}\r
+\r
+VOID\r
+BdsLibBootNext (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Boot from the EFI1.1 spec defined "BootNext" variable\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  UINT16            *BootNext;\r
+  UINTN             BootNextSize;\r
+  CHAR16            Buffer[20];\r
+  BDS_COMMON_OPTION *BootOption;\r
+  LIST_ENTRY        TempList;\r
+  UINTN             ExitDataSize;\r
+  CHAR16            *ExitData;\r
+\r
+  //\r
+  // Init the boot option name buffer and temp link list\r
+  //\r
+  InitializeListHead (&TempList);\r
+  ZeroMem (Buffer, sizeof (Buffer));\r
+\r
+  BootNext = BdsLibGetVariableAndSize (\r
+              L"BootNext",\r
+              &gEfiGlobalVariableGuid,\r
+              &BootNextSize\r
+              );\r
+\r
+  //\r
+  // Clear the boot next variable first\r
+  //\r
+  if (BootNext != NULL) {\r
+    gRT->SetVariable (\r
+          L"BootNext",\r
+          &gEfiGlobalVariableGuid,\r
+          EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
+          0,\r
+          BootNext\r
+          );\r
+\r
+    //\r
+    // Start to build the boot option and try to boot\r
+    //\r
+    UnicodeSPrint (Buffer, sizeof (Buffer), L"Boot%04x", *BootNext);\r
+    BootOption = BdsLibVariableToOption (&TempList, Buffer);\r
+    BdsLibConnectDevicePath (BootOption->DevicePath);\r
+    BdsLibBootViaBootOption (BootOption, BootOption->DevicePath, &ExitDataSize, &ExitData);\r
+  }\r
+\r
+}\r
diff --git a/Nt32Pkg/Library/EdkGenericBdsLib/BdsConnect.c b/Nt32Pkg/Library/EdkGenericBdsLib/BdsConnect.c
new file mode 100644 (file)
index 0000000..cb51488
--- /dev/null
@@ -0,0 +1,362 @@
+/*++\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
+  BdsConnect.c\r
+\r
+Abstract:\r
+\r
+  BDS Lib functions which relate with connect the device\r
+\r
+--*/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+VOID\r
+BdsLibConnectAll (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  This function will connect all the system driver to controller\r
+  first, and then special connect the default console, this make\r
+  sure all the system controller avialbe and the platform default\r
+  console connected.\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  //\r
+  // Connect the platform console first\r
+  //\r
+  BdsLibConnectAllDefaultConsoles ();\r
+\r
+  //\r
+  // Generic way to connect all the drivers\r
+  //\r
+  BdsLibConnectAllDriversToAllControllers ();\r
+\r
+  //\r
+  // Here we have the assumption that we have already had\r
+  // platform default console\r
+  //\r
+  BdsLibConnectAllDefaultConsoles ();\r
+}\r
+\r
+VOID\r
+BdsLibGenericConnectAll (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  This function will connect all the system drivers to all controllers\r
+  first, and then connect all the console devices the system current\r
+  have. After this we should get all the device work and console avariable\r
+  if the system have console device.\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  //\r
+  // Most generic way to connect all the drivers\r
+  //\r
+  BdsLibConnectAllDriversToAllControllers ();\r
+  BdsLibConnectAllConsoles ();\r
+}\r
+\r
+EFI_STATUS\r
+BdsLibConnectDevicePath (\r
+  IN EFI_DEVICE_PATH_PROTOCOL  *DevicePathToConnect\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+  This function will create all handles associate with every device\r
+  path node. If the handle associate with one device path node can not\r
+  be created success, then still give one chance to do the dispatch,\r
+  which load the missing drivers if possible.\r
+\r
+Arguments:\r
+\r
+  DevicePathToConnect  - The device path which will be connected, it can\r
+                         be a multi-instance device path\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS          - All handles associate with every device path\r
+                         node have been created\r
+\r
+  EFI_OUT_OF_RESOURCES - There is no resource to create new handles\r
+\r
+  EFI_NOT_FOUND        - Create the handle associate with one device\r
+                         path node failed\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                Status;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *CopyOfDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *Instance;\r
+  EFI_DEVICE_PATH_PROTOCOL  *RemainingDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *Next;\r
+  EFI_HANDLE                Handle;\r
+  EFI_HANDLE                PreviousHandle;\r
+  UINTN                     Size;\r
+\r
+  if (DevicePathToConnect == NULL) {\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
+  DevicePath        = DuplicateDevicePath (DevicePathToConnect);\r
+  CopyOfDevicePath  = DevicePath;\r
+  if (DevicePath == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+\r
+  do {\r
+    //\r
+    // The outer loop handles multi instance device paths.\r
+    // Only console variables contain multiple instance device paths.\r
+    //\r
+    // After this call DevicePath points to the next Instance\r
+    //\r
+    Instance  = GetNextDevicePathInstance (&DevicePath, &Size);\r
+    Next      = Instance;\r
+    while (!IsDevicePathEndType (Next)) {\r
+      Next = NextDevicePathNode (Next);\r
+    }\r
+\r
+    SetDevicePathEndNode (Next);\r
+\r
+    //\r
+    // Start the real work of connect with RemainingDevicePath\r
+    //\r
+    PreviousHandle = NULL;\r
+    do {\r
+      //\r
+      // Find the handle that best matches the Device Path. If it is only a\r
+      // partial match the remaining part of the device path is returned in\r
+      // RemainingDevicePath.\r
+      //\r
+      RemainingDevicePath = Instance;\r
+      Status              = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &Handle);\r
+\r
+      if (!EFI_ERROR (Status)) {\r
+        if (Handle == PreviousHandle) {\r
+          //\r
+          // If no forward progress is made try invoking the Dispatcher.\r
+          // A new FV may have been added to the system an new drivers\r
+          // may now be found.\r
+          // Status == EFI_SUCCESS means a driver was dispatched\r
+          // Status == EFI_NOT_FOUND means no new drivers were dispatched\r
+          //\r
+          Status = gDS->Dispatch ();\r
+        }\r
+\r
+        if (!EFI_ERROR (Status)) {\r
+          PreviousHandle = Handle;\r
+          //\r
+          // Connect all drivers that apply to Handle and RemainingDevicePath,\r
+          // the Recursive flag is FALSE so only one level will be expanded.\r
+          //\r
+          // Do not check the connect status here, if the connect controller fail,\r
+          // then still give the chance to do dispatch, because partial\r
+          // RemainingDevicepath may be in the new FV\r
+          //\r
+          // 1. If the connect fail, RemainingDevicepath and handle will not\r
+          //    change, so next time will do the dispatch, then dispatch's status\r
+          //    will take effect\r
+          // 2. If the connect success, the RemainingDevicepath and handle will\r
+          //    change, then avoid the dispatch, we have chance to continue the\r
+          //    next connection\r
+          //\r
+          gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE);\r
+        }\r
+      }\r
+      //\r
+      // Loop until RemainingDevicePath is an empty device path\r
+      //\r
+    } while (!EFI_ERROR (Status) && !IsDevicePathEnd (RemainingDevicePath));\r
+\r
+  } while (DevicePath != NULL);\r
+\r
+  if (CopyOfDevicePath != NULL) {\r
+    FreePool (CopyOfDevicePath);\r
+  }\r
+  //\r
+  // All handle with DevicePath exists in the handle database\r
+  //\r
+  return Status;\r
+}\r
+\r
+EFI_STATUS\r
+BdsLibConnectAllEfi (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  This function will connect all current system handles recursively. The\r
+  connection will finish until every handle's child handle created if it have.\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS          - All handles and it's child handle have been connected\r
+\r
+  EFI_STATUS           - Return the status of gBS->LocateHandleBuffer().\r
+\r
+--*/\r
+{\r
+  EFI_STATUS  Status;\r
+  UINTN       HandleCount;\r
+  EFI_HANDLE  *HandleBuffer;\r
+  UINTN       Index;\r
+\r
+  Status = gBS->LocateHandleBuffer (\r
+                  AllHandles,\r
+                  NULL,\r
+                  NULL,\r
+                  &HandleCount,\r
+                  &HandleBuffer\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  for (Index = 0; Index < HandleCount; Index++) {\r
+    Status = gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);\r
+  }\r
+\r
+  FreePool (HandleBuffer);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+BdsLibDisconnectAllEfi (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  This function will disconnect all current system handles. The disconnection\r
+  will finish until every handle have been disconnected.\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS          - All handles have been disconnected\r
+\r
+  EFI_STATUS           - Return the status of gBS->LocateHandleBuffer().\r
+\r
+--*/\r
+{\r
+  EFI_STATUS  Status;\r
+  UINTN       HandleCount;\r
+  EFI_HANDLE  *HandleBuffer;\r
+  UINTN       Index;\r
+\r
+  //\r
+  // Disconnect all\r
+  //\r
+  Status = gBS->LocateHandleBuffer (\r
+                  AllHandles,\r
+                  NULL,\r
+                  NULL,\r
+                  &HandleCount,\r
+                  &HandleBuffer\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  for (Index = 0; Index < HandleCount; Index++) {\r
+    Status = gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);\r
+  }\r
+\r
+  FreePool (HandleBuffer);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+VOID\r
+BdsLibConnectAllDriversToAllControllers (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Connects all drivers to all controllers.\r
+  This function make sure all the current system driver will manage\r
+  the correspoinding controllers if have. And at the same time, make\r
+  sure all the system controllers have driver to manage it if have.\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  do {\r
+    //\r
+    // Connect All EFI 1.10 drivers following EFI 1.10 algorithm\r
+    //\r
+    BdsLibConnectAllEfi ();\r
+\r
+    //\r
+    // Check to see if it's possible to dispatch an more DXE drivers.\r
+    // The BdsLibConnectAllEfi () may have made new DXE drivers show up.\r
+    // If anything is Dispatched Status == EFI_SUCCESS and we will try\r
+    // the connect again.\r
+    //\r
+    Status = gDS->Dispatch ();\r
+\r
+  } while (!EFI_ERROR (Status));\r
+\r
+}\r
diff --git a/Nt32Pkg/Library/EdkGenericBdsLib/BdsConsole.c b/Nt32Pkg/Library/EdkGenericBdsLib/BdsConsole.c
new file mode 100644 (file)
index 0000000..7a88792
--- /dev/null
@@ -0,0 +1,399 @@
+/*++\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
+  BdsConsole.c\r
+\r
+Abstract:\r
+\r
+  BDS Lib functions which contain all the code to connect console device\r
+\r
+--*/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+BOOLEAN\r
+IsNvNeed (\r
+  IN CHAR16 *ConVarName\r
+  )\r
+{\r
+  CHAR16 *Ptr;\r
+\r
+  Ptr = ConVarName;\r
+\r
+  //\r
+  // If the variable includes "Dev" at last, we consider\r
+  // it does not support NV attribute.\r
+  //\r
+  while (*Ptr) {\r
+    Ptr++;\r
+  }\r
+\r
+  if ((*(Ptr - 3) == 'D') && (*(Ptr - 2) == 'e') && (*(Ptr - 1) == 'v')) {\r
+    return FALSE;\r
+  } else {\r
+    return TRUE;\r
+  }\r
+}\r
+\r
+EFI_STATUS\r
+BdsLibUpdateConsoleVariable (\r
+  IN  CHAR16                    *ConVarName,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL  *CustomizedConDevicePath,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL  *ExclusiveDevicePath\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  This function update console variable based on ConVarName, it can\r
+  add or remove one specific console device path from the variable\r
+\r
+Arguments:\r
+\r
+  ConVarName   - Console related variable name, ConIn, ConOut, ErrOut.\r
+\r
+  CustomizedConDevicePath - The console device path which will be added to\r
+                            the console variable ConVarName, this parameter\r
+                            can not be multi-instance.\r
+\r
+  ExclusiveDevicePath     - The console device path which will be removed\r
+                            from the console variable ConVarName, this\r
+                            parameter can not be multi-instance.\r
+\r
+Returns:\r
+\r
+  EFI_UNSUPPORTED         - Add or remove the same device path.\r
+\r
+  EFI_SUCCESS             - Success add or remove the device path from\r
+                            the console variable.\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                Status;\r
+  EFI_DEVICE_PATH_PROTOCOL  *VarConsole;\r
+  UINTN                     DevicePathSize;\r
+  EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *TempNewDevicePath;\r
+  UINT32                    Attributes;\r
+\r
+  VarConsole      = NULL;\r
+  DevicePathSize  = 0;\r
+  Status          = EFI_UNSUPPORTED;\r
+\r
+  //\r
+  // Notes: check the device path point, here should check\r
+  // with compare memory\r
+  //\r
+  if (CustomizedConDevicePath == ExclusiveDevicePath) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+  //\r
+  // Delete the ExclusiveDevicePath from current default console\r
+  //\r
+  VarConsole = BdsLibGetVariableAndSize (\r
+                ConVarName,\r
+                &gEfiGlobalVariableGuid,\r
+                &DevicePathSize\r
+                );\r
+\r
+  //\r
+  // Initialize NewDevicePath\r
+  //\r
+  NewDevicePath  = VarConsole;\r
+\r
+  //\r
+  // If ExclusiveDevicePath is even the part of the instance in VarConsole, delete it.\r
+  // In the end, NewDevicePath is the final device path.\r
+  //\r
+  if (ExclusiveDevicePath != NULL && VarConsole != NULL) {\r
+      NewDevicePath = BdsLibDelPartMatchInstance (VarConsole, ExclusiveDevicePath);\r
+  }\r
+  //\r
+  // Try to append customized device path to NewDevicePath.\r
+  //\r
+  if (CustomizedConDevicePath != NULL) {\r
+    if (!BdsLibMatchDevicePaths (NewDevicePath, CustomizedConDevicePath)) {\r
+      //\r
+      // Check if there is part of CustomizedConDevicePath in NewDevicePath, delete it.\r
+      //\r
+      NewDevicePath = BdsLibDelPartMatchInstance (NewDevicePath, CustomizedConDevicePath);\r
+      //\r
+      // In the first check, the default console variable will be null,\r
+      // just append current customized device path\r
+      //\r
+      TempNewDevicePath = NewDevicePath;\r
+      NewDevicePath = AppendDevicePathInstance (NewDevicePath, CustomizedConDevicePath);\r
+      BdsLibSafeFreePool(TempNewDevicePath);\r
+    }\r
+  }\r
+\r
+  //\r
+  // The attribute for ConInDev, ConOutDev and ErrOutDev does not include NV.\r
+  //\r
+  if (IsNvNeed(ConVarName)) {\r
+    //\r
+    // ConVarName has NV attribute.\r
+    //\r
+    Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE;\r
+  } else {\r
+    //\r
+    // ConVarName does not have NV attribute.\r
+    //\r
+    Attributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;\r
+  }\r
+\r
+  //\r
+  // Finally, Update the variable of the default console by NewDevicePath\r
+  //\r
+  gRT->SetVariable (\r
+        ConVarName,\r
+        &gEfiGlobalVariableGuid,\r
+        Attributes,\r
+        GetDevicePathSize (NewDevicePath),\r
+        NewDevicePath\r
+        );\r
+\r
+  if (VarConsole == NewDevicePath) {\r
+    BdsLibSafeFreePool(VarConsole);\r
+  } else {\r
+    BdsLibSafeFreePool(VarConsole);\r
+    BdsLibSafeFreePool(NewDevicePath);\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+\r
+}\r
+\r
+EFI_STATUS\r
+BdsLibConnectConsoleVariable (\r
+  IN  CHAR16                 *ConVarName\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Connect the console device base on the variable ConVarName, if\r
+  device path of the ConVarName is multi-instance device path, if\r
+  anyone of the instances is connected success, then this function\r
+  will return success.\r
+\r
+Arguments:\r
+\r
+  ConVarName   - Console related variable name, ConIn, ConOut, ErrOut.\r
+\r
+Returns:\r
+\r
+  EFI_NOT_FOUND           - There is not any console devices connected success\r
+\r
+  EFI_SUCCESS             - Success connect any one instance of the console\r
+                            device path base on the variable ConVarName.\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                Status;\r
+  EFI_DEVICE_PATH_PROTOCOL  *StartDevicePath;\r
+  UINTN                     VariableSize;\r
+  EFI_DEVICE_PATH_PROTOCOL  *Instance;\r
+  EFI_DEVICE_PATH_PROTOCOL  *Next;\r
+  EFI_DEVICE_PATH_PROTOCOL  *CopyOfDevicePath;\r
+  UINTN                     Size;\r
+  BOOLEAN                   DeviceExist;\r
+\r
+  Status      = EFI_SUCCESS;\r
+  DeviceExist = FALSE;\r
+\r
+  //\r
+  // Check if the console variable exist\r
+  //\r
+  StartDevicePath = BdsLibGetVariableAndSize (\r
+                      ConVarName,\r
+                      &gEfiGlobalVariableGuid,\r
+                      &VariableSize\r
+                      );\r
+  if (StartDevicePath == NULL) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
+  CopyOfDevicePath = StartDevicePath;\r
+  do {\r
+    //\r
+    // Check every instance of the console variable\r
+    //\r
+    Instance  = GetNextDevicePathInstance (&CopyOfDevicePath, &Size);\r
+    Next      = Instance;\r
+    while (!IsDevicePathEndType (Next)) {\r
+      Next = NextDevicePathNode (Next);\r
+    }\r
+\r
+    SetDevicePathEndNode (Next);\r
+\r
+    //\r
+    // Connect the instance device path\r
+    //\r
+    Status = BdsLibConnectDevicePath (Instance);\r
+    if (EFI_ERROR (Status)) {\r
+      //\r
+      // Delete the instance from the console varialbe\r
+      //\r
+      BdsLibUpdateConsoleVariable (ConVarName, NULL, Instance);\r
+    } else {\r
+      DeviceExist = TRUE;\r
+    }\r
+    BdsLibSafeFreePool(Instance);\r
+  } while (CopyOfDevicePath != NULL);\r
+\r
+  FreePool (StartDevicePath);\r
+\r
+  if (DeviceExist == FALSE) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+VOID\r
+BdsLibConnectAllConsoles (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  This function will search every simpletxt devive in current system,\r
+  and make every simpletxt device as pertantial console device.\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                Status;\r
+  UINTN                     Index;\r
+  EFI_DEVICE_PATH_PROTOCOL  *ConDevicePath;\r
+  UINTN                     HandleCount;\r
+  EFI_HANDLE                *HandleBuffer;\r
+\r
+  Index         = 0;\r
+  HandleCount   = 0;\r
+  HandleBuffer  = NULL;\r
+  ConDevicePath = NULL;\r
+\r
+  //\r
+  // Update all the console varables\r
+  //\r
+  Status = gBS->LocateHandleBuffer (\r
+                  ByProtocol,\r
+                  &gEfiSimpleTextInProtocolGuid,\r
+                  NULL,\r
+                  &HandleCount,\r
+                  &HandleBuffer\r
+                  );\r
+  for (Index = 0; Index < HandleCount; Index++) {\r
+    Status = gBS->HandleProtocol (\r
+                    HandleBuffer[Index],\r
+                    &gEfiDevicePathProtocolGuid,\r
+                    (VOID **) &ConDevicePath\r
+                    );\r
+    BdsLibUpdateConsoleVariable (L"ConIn", ConDevicePath, NULL);\r
+  }\r
+\r
+  BdsLibSafeFreePool(HandleBuffer);\r
+\r
+  Status = gBS->LocateHandleBuffer (\r
+                  ByProtocol,\r
+                  &gEfiSimpleTextOutProtocolGuid,\r
+                  NULL,\r
+                  &HandleCount,\r
+                  &HandleBuffer\r
+                  );\r
+  for (Index = 0; Index < HandleCount; Index++) {\r
+    Status = gBS->HandleProtocol (\r
+                    HandleBuffer[Index],\r
+                    &gEfiDevicePathProtocolGuid,\r
+                    (VOID **) &ConDevicePath\r
+                    );\r
+    BdsLibUpdateConsoleVariable (L"ConOut", ConDevicePath, NULL);\r
+    BdsLibUpdateConsoleVariable (L"ErrOut", ConDevicePath, NULL);\r
+  }\r
+\r
+  BdsLibSafeFreePool(HandleBuffer);\r
+\r
+  //\r
+  // Connect all console variables\r
+  //\r
+  BdsLibConnectAllDefaultConsoles ();\r
+\r
+}\r
+\r
+EFI_STATUS\r
+BdsLibConnectAllDefaultConsoles (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  This function will connect console device base on the console\r
+  device variable ConIn, ConOut and ErrOut.\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS      - At least one of the ConIn and ConOut device have\r
+                     been connected success.\r
+\r
+  EFI_STATUS       - Return the status of BdsLibConnectConsoleVariable ().\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                Status;\r
+\r
+  //\r
+  // Connect all default console variables\r
+  //\r
+\r
+  //\r
+  // Because possibly the platform is legacy free, in such case,\r
+  // ConIn devices (Serial Port and PS2 Keyboard ) does not exist,\r
+  // so we need not check the status.\r
+  //\r
+  BdsLibConnectConsoleVariable (L"ConIn");\r
+\r
+  //\r
+  // It seems impossible not to have any ConOut device on platform,\r
+  // so we check the status here.\r
+  //\r
+  Status = BdsLibConnectConsoleVariable (L"ConOut");\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+  //\r
+  // Special treat the err out device, becaues the null\r
+  // err out var is legal.\r
+  //\r
+  BdsLibConnectConsoleVariable (L"ErrOut");\r
+\r
+  return EFI_SUCCESS;\r
+\r
+}\r
diff --git a/Nt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c b/Nt32Pkg/Library/EdkGenericBdsLib/BdsMisc.c
new file mode 100644 (file)
index 0000000..dc53a67
--- /dev/null
@@ -0,0 +1,1099 @@
+/*++\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
+  BdsMisc.c\r
+\r
+Abstract:\r
+\r
+  Misc BDS library function\r
+\r
+--*/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+#define MAX_STRING_LEN        200\r
+static BOOLEAN   mFeaturerSwitch = TRUE;\r
+static BOOLEAN   mResetRequired  = FALSE;\r
+extern UINT16 gPlatformBootTimeOutDefault;\r
+\r
+UINT16\r
+BdsLibGetTimeout (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Return the default value for system Timeout variable.\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  Timeout value.\r
+\r
+--*/\r
+{\r
+  UINT16      Timeout;\r
+  UINTN       Size;\r
+  EFI_STATUS  Status;\r
+\r
+  //\r
+  // Return Timeout variable or 0xffff if no valid\r
+  // Timeout variable exists.\r
+  //\r
+  Size    = sizeof (UINT16);\r
+  Status  = gRT->GetVariable (L"Timeout", &gEfiGlobalVariableGuid, NULL, &Size, &Timeout);\r
+  if (!EFI_ERROR (Status)) {\r
+    return Timeout;\r
+  }\r
+  //\r
+  // To make the current EFI Automatic-Test activity possible, just add\r
+  // following code to make AutoBoot enabled when this variable is not\r
+  // present.\r
+  // This code should be removed later.\r
+  //\r
+  Timeout = gPlatformBootTimeOutDefault;\r
+\r
+  //\r
+  // Notes: Platform should set default variable if non exists on all error cases!!!\r
+  //\r
+  Status = gRT->SetVariable (\r
+                  L"Timeout",\r
+                  &gEfiGlobalVariableGuid,\r
+                  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
+                  sizeof (UINT16),\r
+                  &Timeout\r
+                  );\r
+  return Timeout;\r
+}\r
+\r
+VOID\r
+BdsLibLoadDrivers (\r
+  IN LIST_ENTRY               *BdsDriverLists\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  The function will go through the driver optoin link list, load and start\r
+  every driver the driver optoin device path point to.\r
+\r
+Arguments:\r
+\r
+  BdsDriverLists   - The header of the current driver option link list\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                Status;\r
+  LIST_ENTRY                *Link;\r
+  BDS_COMMON_OPTION         *Option;\r
+  EFI_HANDLE                ImageHandle;\r
+  EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;\r
+  UINTN                     ExitDataSize;\r
+  CHAR16                    *ExitData;\r
+  BOOLEAN                   ReconnectAll;\r
+\r
+  ReconnectAll = FALSE;\r
+\r
+  //\r
+  // Process the driver option\r
+  //\r
+  for (Link = BdsDriverLists->ForwardLink; Link != BdsDriverLists; Link = Link->ForwardLink) {\r
+    Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);\r
+    //\r
+    // If a load option is not marked as LOAD_OPTION_ACTIVE,\r
+    // the boot manager will not automatically load the option.\r
+    //\r
+    if (!IS_LOAD_OPTION_TYPE (Option->Attribute, LOAD_OPTION_ACTIVE)) {\r
+      continue;\r
+    }\r
+    //\r
+    // If a driver load option is marked as LOAD_OPTION_FORCE_RECONNECT,\r
+    // then all of the EFI drivers in the system will be disconnected and\r
+    // reconnected after the last driver load option is processed.\r
+    //\r
+    if (IS_LOAD_OPTION_TYPE (Option->Attribute, LOAD_OPTION_FORCE_RECONNECT)) {\r
+      ReconnectAll = TRUE;\r
+    }\r
+    //\r
+    // Make sure the driver path is connected.\r
+    //\r
+    BdsLibConnectDevicePath (Option->DevicePath);\r
+\r
+    //\r
+    // Load and start the image that Driver#### describes\r
+    //\r
+    Status = gBS->LoadImage (\r
+                    FALSE,\r
+                    mBdsImageHandle,\r
+                    Option->DevicePath,\r
+                    NULL,\r
+                    0,\r
+                    &ImageHandle\r
+                    );\r
+\r
+    if (!EFI_ERROR (Status)) {\r
+      gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, &ImageInfo);\r
+\r
+      //\r
+      // Verify whether this image is a driver, if not,\r
+      // exit it and continue to parse next load option\r
+      //\r
+      if (ImageInfo->ImageCodeType != EfiBootServicesCode && ImageInfo->ImageCodeType != EfiRuntimeServicesCode) {\r
+        gBS->Exit (ImageHandle, EFI_INVALID_PARAMETER, 0, NULL);\r
+        continue;\r
+      }\r
+\r
+      if (Option->LoadOptionsSize != 0) {\r
+        ImageInfo->LoadOptionsSize  = Option->LoadOptionsSize;\r
+        ImageInfo->LoadOptions      = Option->LoadOptions;\r
+      }\r
+      //\r
+      // Before calling the image, enable the Watchdog Timer for\r
+      // the 5 Minute period\r
+      //\r
+      gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL);\r
+\r
+      Status = gBS->StartImage (ImageHandle, &ExitDataSize, &ExitData);\r
+      DEBUG ((EFI_D_INFO | EFI_D_LOAD, "Driver Return Status = %r\n", Status));\r
+\r
+      //\r
+      // Clear the Watchdog Timer after the image returns\r
+      //\r
+      gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL);\r
+    }\r
+  }\r
+  //\r
+  // Process the LOAD_OPTION_FORCE_RECONNECT driver option\r
+  //\r
+  if (ReconnectAll) {\r
+    BdsLibDisconnectAllEfi ();\r
+    BdsLibConnectAll ();\r
+  }\r
+\r
+}\r
+\r
+EFI_STATUS\r
+BdsLibRegisterNewOption (\r
+  IN  LIST_ENTRY                     *BdsOptionList,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL       *DevicePath,\r
+  IN  CHAR16                         *String,\r
+  IN  CHAR16                         *VariableName\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  This function will register the new boot#### or driver#### option base on\r
+  the VariableName. The new registered boot#### or driver#### will be linked\r
+  to BdsOptionList and also update to the VariableName. After the boot#### or\r
+  driver#### updated, the BootOrder or DriverOrder will also be updated.\r
+\r
+Arguments:\r
+\r
+  BdsOptionList    - The header of the boot#### or driver#### link list\r
+\r
+  DevicePath       - The device path which the boot####\r
+                     or driver#### option present\r
+\r
+  String           - The description of the boot#### or driver####\r
+\r
+  VariableName     - Indicate if the boot#### or driver#### option\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS      - The boot#### or driver#### have been success registered\r
+\r
+  EFI_STATUS       - Return the status of gRT->SetVariable ().\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                Status;\r
+  UINTN                     Index;\r
+  UINT16                    MaxOptionNumber;\r
+  UINT16                    RegisterOptionNumber;\r
+  UINT16                    *TempOptionPtr;\r
+  UINTN                     TempOptionSize;\r
+  UINT16                    *OptionOrderPtr;\r
+  VOID                      *OptionPtr;\r
+  UINTN                     OptionSize;\r
+  UINT8                     *TempPtr;\r
+  EFI_DEVICE_PATH_PROTOCOL  *OptionDevicePath;\r
+  CHAR16                    *Description;\r
+  CHAR16                    OptionName[10];\r
+  BOOLEAN                   UpdateBootDevicePath;\r
+\r
+  OptionPtr             = NULL;\r
+  OptionSize            = 0;\r
+  TempPtr               = NULL;\r
+  OptionDevicePath      = NULL;\r
+  Description           = NULL;\r
+  MaxOptionNumber       = 0;\r
+  OptionOrderPtr        = NULL;\r
+  UpdateBootDevicePath  = FALSE;\r
+  ZeroMem (OptionName, sizeof (OptionName));\r
+\r
+  TempOptionSize = 0;\r
+\r
+  TempOptionPtr = BdsLibGetVariableAndSize (\r
+                    VariableName,\r
+                    &gEfiGlobalVariableGuid,\r
+                    &TempOptionSize\r
+                    );\r
+\r
+  //\r
+  // Compare with current option variable\r
+  //\r
+  for (Index = 0; Index < TempOptionSize / sizeof (UINT16); Index++) {\r
+    //\r
+    // Got the max option#### number\r
+    //\r
+    if (MaxOptionNumber < TempOptionPtr[Index]) {\r
+      MaxOptionNumber = TempOptionPtr[Index];\r
+    }\r
+\r
+    if (*VariableName == 'B') {\r
+      UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", TempOptionPtr[Index]);\r
+    } else {\r
+      UnicodeSPrint (OptionName, sizeof (OptionName), L"Driver%04x", TempOptionPtr[Index]);\r
+    }\r
+\r
+    OptionPtr = BdsLibGetVariableAndSize (\r
+                  OptionName,\r
+                  &gEfiGlobalVariableGuid,\r
+                  &OptionSize\r
+                  );\r
+    TempPtr = OptionPtr;\r
+    TempPtr += sizeof (UINT32) + sizeof (UINT16);\r
+    Description = (CHAR16 *) TempPtr;\r
+    TempPtr += StrSize ((CHAR16 *) TempPtr);\r
+    OptionDevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;\r
+\r
+    //\r
+    // Notes: the description may will change base on the GetStringToken\r
+    //\r
+    if (CompareMem (Description, String, StrSize (Description)) == 0) {\r
+      if (CompareMem (OptionDevicePath, DevicePath, GetDevicePathSize (OptionDevicePath)) == 0) {\r
+        //\r
+        // Got the option, so just return\r
+        //\r
+        FreePool (OptionPtr);\r
+        FreePool (TempOptionPtr);\r
+        return EFI_SUCCESS;\r
+      } else {\r
+        //\r
+        // Boot device path changed, need update.\r
+        //\r
+        UpdateBootDevicePath = TRUE;\r
+        break;\r
+      }\r
+    }\r
+\r
+    FreePool (OptionPtr);\r
+  }\r
+\r
+  OptionSize          = sizeof (UINT32) + sizeof (UINT16) + StrSize (String) + GetDevicePathSize (DevicePath);\r
+  OptionPtr           = AllocateZeroPool (OptionSize);\r
+  TempPtr             = OptionPtr;\r
+  *(UINT32 *) TempPtr = LOAD_OPTION_ACTIVE;\r
+  TempPtr += sizeof (UINT32);\r
+  *(UINT16 *) TempPtr = (UINT16) GetDevicePathSize (DevicePath);\r
+  TempPtr += sizeof (UINT16);\r
+  CopyMem (TempPtr, String, StrSize (String));\r
+  TempPtr += StrSize (String);\r
+  CopyMem (TempPtr, DevicePath, GetDevicePathSize (DevicePath));\r
+\r
+  if (UpdateBootDevicePath) {\r
+    //\r
+    // The number in option#### to be updated\r
+    //\r
+    RegisterOptionNumber = TempOptionPtr[Index];\r
+  } else {\r
+    //\r
+    // The new option#### number\r
+    //\r
+    RegisterOptionNumber = MaxOptionNumber + 1;\r
+  }\r
+\r
+  if (*VariableName == 'B') {\r
+    UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", RegisterOptionNumber);\r
+  } else {\r
+    UnicodeSPrint (OptionName, sizeof (OptionName), L"Driver%04x", RegisterOptionNumber);\r
+  }\r
+\r
+  Status = gRT->SetVariable (\r
+                  OptionName,\r
+                  &gEfiGlobalVariableGuid,\r
+                  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
+                  OptionSize,\r
+                  OptionPtr\r
+                  );\r
+  if (EFI_ERROR (Status) || UpdateBootDevicePath) {\r
+    FreePool (OptionPtr);\r
+    FreePool (TempOptionPtr);\r
+    return Status;\r
+  }\r
+\r
+  FreePool (OptionPtr);\r
+\r
+  //\r
+  // Update the option order variable\r
+  //\r
+  OptionOrderPtr = AllocateZeroPool ((Index + 1) * sizeof (UINT16));\r
+  CopyMem (OptionOrderPtr, TempOptionPtr, Index * sizeof (UINT16));\r
+  OptionOrderPtr[Index] = RegisterOptionNumber;\r
+  Status = gRT->SetVariable (\r
+                  VariableName,\r
+                  &gEfiGlobalVariableGuid,\r
+                  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,\r
+                  (Index + 1) * sizeof (UINT16),\r
+                  OptionOrderPtr\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    FreePool (TempOptionPtr);\r
+    FreePool (OptionOrderPtr);\r
+    return Status;\r
+  }\r
+\r
+  if (TempOptionPtr != NULL) {\r
+    FreePool (TempOptionPtr);\r
+  }\r
+  FreePool (OptionOrderPtr);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+BDS_COMMON_OPTION *\r
+BdsLibVariableToOption (\r
+  IN OUT LIST_ENTRY               *BdsCommonOptionList,\r
+  IN  CHAR16                      *VariableName\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Build the boot#### or driver#### option from the VariableName, the\r
+  build boot#### or driver#### will also be linked to BdsCommonOptionList\r
+\r
+Arguments:\r
+\r
+  BdsCommonOptionList - The header of the boot#### or driver#### option link list\r
+\r
+  VariableName - EFI Variable name indicate if it is boot#### or driver####\r
+\r
+Returns:\r
+\r
+  BDS_COMMON_OPTION    - Get the option just been created\r
+\r
+  NULL                 - Failed to get the new option\r
+\r
+--*/\r
+{\r
+  UINT32                    Attribute;\r
+  UINT16                    FilePathSize;\r
+  UINT8                     *Variable;\r
+  UINT8                     *TempPtr;\r
+  UINTN                     VariableSize;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+  BDS_COMMON_OPTION         *Option;\r
+  VOID                      *LoadOptions;\r
+  UINT32                    LoadOptionsSize;\r
+  CHAR16                    *Description;\r
+\r
+  //\r
+  // Read the variable. We will never free this data.\r
+  //\r
+  Variable = BdsLibGetVariableAndSize (\r
+              VariableName,\r
+              &gEfiGlobalVariableGuid,\r
+              &VariableSize\r
+              );\r
+  if (Variable == NULL) {\r
+    return NULL;\r
+  }\r
+  //\r
+  // Notes: careful defined the variable of Boot#### or\r
+  // Driver####, consider use some macro to abstract the code\r
+  //\r
+  //\r
+  // Get the option attribute\r
+  //\r
+  TempPtr   = Variable;\r
+  Attribute = *(UINT32 *) Variable;\r
+  TempPtr += sizeof (UINT32);\r
+\r
+  //\r
+  // Get the option's device path size\r
+  //\r
+  FilePathSize = *(UINT16 *) TempPtr;\r
+  TempPtr += sizeof (UINT16);\r
+\r
+  //\r
+  // Get the option's description string\r
+  //\r
+  Description = (CHAR16 *) TempPtr;\r
+\r
+  //\r
+  // Get the option's description string size\r
+  //\r
+  TempPtr += StrSize ((CHAR16 *) TempPtr);\r
+\r
+  //\r
+  // Get the option's device path\r
+  //\r
+  DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) TempPtr;\r
+  TempPtr += FilePathSize;\r
+\r
+  LoadOptions     = TempPtr;\r
+  LoadOptionsSize = (UINT32) (VariableSize - (UINTN) (TempPtr - Variable));\r
+\r
+  //\r
+  // The Console variables may have multiple device paths, so make\r
+  // an Entry for each one.\r
+  //\r
+  Option = AllocateZeroPool (sizeof (BDS_COMMON_OPTION));\r
+  if (Option == NULL) {\r
+    return NULL;\r
+  }\r
+\r
+  Option->Signature   = BDS_LOAD_OPTION_SIGNATURE;\r
+  Option->DevicePath  = AllocateZeroPool (GetDevicePathSize (DevicePath));\r
+  CopyMem (Option->DevicePath, DevicePath, GetDevicePathSize (DevicePath));\r
+  Option->Attribute   = Attribute;\r
+  Option->Description = AllocateZeroPool (StrSize (Description));\r
+  CopyMem (Option->Description, Description, StrSize (Description));\r
+  Option->LoadOptions = AllocateZeroPool (LoadOptionsSize);\r
+  CopyMem (Option->LoadOptions, LoadOptions, LoadOptionsSize);\r
+  Option->LoadOptionsSize = LoadOptionsSize;\r
+\r
+  //\r
+  // Insert active entry to BdsDeviceList\r
+  //\r
+  if ((Option->Attribute & LOAD_OPTION_ACTIVE) == LOAD_OPTION_ACTIVE) {\r
+    InsertTailList (BdsCommonOptionList, &Option->Link);\r
+    FreePool (Variable);\r
+    return Option;\r
+  }\r
+\r
+  FreePool (Variable);\r
+  FreePool (Option);\r
+  return NULL;\r
+\r
+}\r
+\r
+EFI_STATUS\r
+BdsLibBuildOptionFromVar (\r
+  IN  LIST_ENTRY                  *BdsCommonOptionList,\r
+  IN  CHAR16                      *VariableName\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Process BootOrder, or DriverOrder variables, by calling\r
+  BdsLibVariableToOption () for each UINT16 in the variables.\r
+\r
+Arguments:\r
+\r
+  BdsCommonOptionList - The header of the option list base on variable\r
+                        VariableName\r
+\r
+  VariableName - EFI Variable name indicate the BootOrder or DriverOrder\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS - Success create the boot option or driver option list\r
+\r
+  EFI_OUT_OF_RESOURCES - Failed to get the boot option or driver option list\r
+\r
+--*/\r
+{\r
+  UINT16            *OptionOrder;\r
+  UINTN             OptionOrderSize;\r
+  UINTN             Index;\r
+  BDS_COMMON_OPTION *Option;\r
+  CHAR16            OptionName[20];\r
+\r
+  //\r
+  // Zero Buffer in order to get all BOOT#### variables\r
+  //\r
+  ZeroMem (OptionName, sizeof (OptionName));\r
+\r
+  //\r
+  // Read the BootOrder, or DriverOrder variable.\r
+  //\r
+  OptionOrder = BdsLibGetVariableAndSize (\r
+                  VariableName,\r
+                  &gEfiGlobalVariableGuid,\r
+                  &OptionOrderSize\r
+                  );\r
+  if (OptionOrder == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+\r
+  for (Index = 0; Index < OptionOrderSize / sizeof (UINT16); Index++) {\r
+    if (*VariableName == 'B') {\r
+      UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", OptionOrder[Index]);\r
+    } else {\r
+      UnicodeSPrint (OptionName, sizeof (OptionName), L"Driver%04x", OptionOrder[Index]);\r
+    }\r
+    Option              = BdsLibVariableToOption (BdsCommonOptionList, OptionName);\r
+    Option->BootCurrent = OptionOrder[Index];\r
+\r
+  }\r
+\r
+  FreePool (OptionOrder);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+VOID *\r
+BdsLibGetVariableAndSize (\r
+  IN  CHAR16              *Name,\r
+  IN  EFI_GUID            *VendorGuid,\r
+  OUT UINTN               *VariableSize\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Read the EFI variable (VendorGuid/Name) and return a dynamically allocated\r
+  buffer, and the size of the buffer. If failure return NULL.\r
+\r
+Arguments:\r
+\r
+  Name       - String part of EFI variable name\r
+\r
+  VendorGuid - GUID part of EFI variable name\r
+\r
+  VariableSize - Returns the size of the EFI variable that was read\r
+\r
+Returns:\r
+\r
+  Dynamically allocated memory that contains a copy of the EFI variable.\r
+  Caller is responsible freeing the buffer.\r
+\r
+  NULL - Variable was not read\r
+\r
+--*/\r
+{\r
+  EFI_STATUS  Status;\r
+  UINTN       BufferSize;\r
+  VOID        *Buffer;\r
+\r
+  Buffer = NULL;\r
+\r
+  //\r
+  // Pass in a zero size buffer to find the required buffer size.\r
+  //\r
+  BufferSize  = 0;\r
+  Status      = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);\r
+  if (Status == EFI_BUFFER_TOO_SMALL) {\r
+    //\r
+    // Allocate the buffer to return\r
+    //\r
+    Buffer = AllocateZeroPool (BufferSize);\r
+    if (Buffer == NULL) {\r
+      return NULL;\r
+    }\r
+    //\r
+    // Read variable into the allocated buffer.\r
+    //\r
+    Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);\r
+    if (EFI_ERROR (Status)) {\r
+      BufferSize = 0;\r
+    }\r
+  }\r
+\r
+  *VariableSize = BufferSize;\r
+  return Buffer;\r
+}\r
+\r
+VOID\r
+BdsLibSafeFreePool (\r
+  IN  VOID             *Buffer\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Free pool safely.\r
+\r
+Arguments:\r
+\r
+  Buffer          - The allocated pool entry to free\r
+\r
+Returns:\r
+\r
+  Pointer of the buffer allocated.\r
+\r
+--*/\r
+{\r
+  if (Buffer != NULL) {\r
+    FreePool (Buffer);\r
+    Buffer = NULL;\r
+  }\r
+}\r
+\r
+EFI_DEVICE_PATH_PROTOCOL *\r
+BdsLibDelPartMatchInstance (\r
+  IN     EFI_DEVICE_PATH_PROTOCOL  *Multi,\r
+  IN     EFI_DEVICE_PATH_PROTOCOL  *Single\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Delete the instance in Multi which matches partly with Single instance\r
+\r
+Arguments:\r
+\r
+  Multi        - A pointer to a multi-instance device path data structure.\r
+\r
+  Single       - A pointer to a single-instance device path data structure.\r
+\r
+Returns:\r
+\r
+  This function will remove the device path instances in Multi which partly\r
+  match with the Single, and return the result device path. If there is no\r
+  remaining device path as a result, this function will return NULL.\r
+\r
+--*/\r
+{\r
+  EFI_DEVICE_PATH_PROTOCOL  *Instance;\r
+  EFI_DEVICE_PATH_PROTOCOL  *NewDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *TempNewDevicePath;\r
+  UINTN                     InstanceSize;\r
+  UINTN                     SingleDpSize;\r
+  UINTN                     Size;\r
+\r
+  NewDevicePath     = NULL;\r
+  TempNewDevicePath = NULL;\r
+\r
+  if (Multi == NULL || Single == NULL) {\r
+    return Multi;\r
+  }\r
+\r
+  Instance        =  GetNextDevicePathInstance (&Multi, &InstanceSize);\r
+  SingleDpSize    =  GetDevicePathSize (Single) - END_DEVICE_PATH_LENGTH;\r
+  InstanceSize    -= END_DEVICE_PATH_LENGTH;\r
+\r
+  while (Instance != NULL) {\r
+\r
+    Size = (SingleDpSize < InstanceSize) ? SingleDpSize : InstanceSize;\r
+\r
+    if ((CompareMem (Instance, Single, Size) != 0)) {\r
+      //\r
+      // Append the device path instance which does not match with Single\r
+      //\r
+      TempNewDevicePath = NewDevicePath;\r
+      NewDevicePath = AppendDevicePathInstance (NewDevicePath, Instance);\r
+      BdsLibSafeFreePool(TempNewDevicePath);\r
+    }\r
+    BdsLibSafeFreePool(Instance);\r
+    Instance = GetNextDevicePathInstance (&Multi, &InstanceSize);\r
+    InstanceSize  -= END_DEVICE_PATH_LENGTH;\r
+  }\r
+\r
+  return NewDevicePath;\r
+}\r
+\r
+BOOLEAN\r
+BdsLibMatchDevicePaths (\r
+  IN  EFI_DEVICE_PATH_PROTOCOL  *Multi,\r
+  IN  EFI_DEVICE_PATH_PROTOCOL  *Single\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Function compares a device path data structure to that of all the nodes of a\r
+  second device path instance.\r
+\r
+Arguments:\r
+\r
+  Multi        - A pointer to a multi-instance device path data structure.\r
+\r
+  Single       - A pointer to a single-instance device path data structure.\r
+\r
+Returns:\r
+\r
+  TRUE   - If the Single is contained within Multi\r
+\r
+  FALSE  - The Single is not match within Multi\r
+\r
+\r
+--*/\r
+{\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePathInst;\r
+  UINTN                     Size;\r
+\r
+  if (!Multi || !Single) {\r
+    return FALSE;\r
+  }\r
+\r
+  DevicePath      = Multi;\r
+  DevicePathInst  = GetNextDevicePathInstance (&DevicePath, &Size);\r
+\r
+  //\r
+  // Search for the match of 'Single' in 'Multi'\r
+  //\r
+  while (DevicePathInst != NULL) {\r
+    //\r
+    // If the single device path is found in multiple device paths,\r
+    // return success\r
+    //\r
+    if (CompareMem (Single, DevicePathInst, Size) == 0) {\r
+      FreePool (DevicePathInst);\r
+      return TRUE;\r
+    }\r
+\r
+    FreePool (DevicePathInst);\r
+    DevicePathInst = GetNextDevicePathInstance (&DevicePath, &Size);\r
+  }\r
+\r
+  return FALSE;\r
+}\r
+\r
+EFI_STATUS\r
+BdsLibOutputStrings (\r
+  IN EFI_SIMPLE_TEXT_OUT_PROTOCOL   *ConOut,\r
+  ...\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  This function prints a series of strings.\r
+\r
+Arguments:\r
+\r
+  ConOut               - Pointer to EFI_SIMPLE_TEXT_OUT_PROTOCOL\r
+\r
+  ...                  - A variable argument list containing series of strings,\r
+                         the last string must be NULL.\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS          - Success print out the string using ConOut.\r
+\r
+  EFI_STATUS           - Return the status of the ConOut->OutputString ().\r
+\r
+--*/\r
+{\r
+  VA_LIST     args;\r
+  EFI_STATUS  Status;\r
+  CHAR16      *String;\r
+\r
+  Status = EFI_SUCCESS;\r
+  VA_START (args, ConOut);\r
+\r
+  while (!EFI_ERROR (Status)) {\r
+    //\r
+    // If String is NULL, then it's the end of the list\r
+    //\r
+    String = VA_ARG (args, CHAR16 *);\r
+    if (!String) {\r
+      break;\r
+    }\r
+\r
+    Status = ConOut->OutputString (ConOut, String);\r
+\r
+    if (EFI_ERROR (Status)) {\r
+      break;\r
+    }\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+//\r
+//  Following are BDS Lib functions which  contain all the code about setup browser reset reminder feature.\r
+//  Setup Browser reset reminder feature is that an reset reminder will be given before user leaves the setup browser  if\r
+//  user change any option setting which needs a reset to be effective, and  the reset will be applied according to  the user selection.\r
+//\r
+\r
+VOID\r
+EnableResetReminderFeature (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Enable the setup browser reset reminder feature.\r
+  This routine is used in platform tip. If the platform policy need the feature, use the routine to enable it.\r
+\r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  mFeaturerSwitch = TRUE;\r
+}\r
+\r
+VOID\r
+DisableResetReminderFeature (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Disable the setup browser reset reminder feature.\r
+  This routine is used in platform tip. If the platform policy do not want the feature, use the routine to disable it.\r
+\r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  mFeaturerSwitch = FALSE;\r
+}\r
+\r
+VOID\r
+EnableResetRequired (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+   Record the info that  a reset is required.\r
+   A  module boolean variable is used to record whether a reset is required.\r
+\r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  mResetRequired = TRUE;\r
+}\r
+\r
+VOID\r
+DisableResetRequired (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+   Record the info that  no reset is required.\r
+   A  module boolean variable is used to record whether a reset is required.\r
+\r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  mResetRequired = FALSE;\r
+}\r
+\r
+BOOLEAN\r
+IsResetReminderFeatureEnable (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Check whether platform policy enable the reset reminder feature. The default is enabled.\r
+\r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  return mFeaturerSwitch;\r
+}\r
+\r
+BOOLEAN\r
+IsResetRequired (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Check if  user changed any option setting which needs a system reset to be effective.\r
+\r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  return mResetRequired;\r
+}\r
+\r
+VOID\r
+SetupResetReminder (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Check whether a reset is needed, and finish the reset reminder feature.\r
+  If a reset is needed, Popup a menu to notice user, and finish the feature\r
+  according to the user selection.\r
+\r
+Arguments:\r
+\r
+  VOID\r
+\r
+Returns:\r
+\r
+  VOID\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                    Status;\r
+  EFI_FORM_BROWSER_PROTOCOL     *Browser;\r
+  EFI_INPUT_KEY                 Key;\r
+  CHAR16                        *StringBuffer1;\r
+  CHAR16                        *StringBuffer2;\r
+\r
+\r
+  //\r
+  //check any reset required change is applied? if yes, reset system\r
+  //\r
+  if (IsResetReminderFeatureEnable ()) {\r
+    if (IsResetRequired ()) {\r
+\r
+      Status = gBS->LocateProtocol (\r
+                      &gEfiFormBrowserProtocolGuid,\r
+                      NULL,\r
+                      &Browser\r
+                      );\r
+\r
+      ASSERT (Status != EFI_SUCCESS);\r
+\r
+      StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));\r
+      ASSERT (StringBuffer1 != NULL);\r
+      StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));\r
+      ASSERT (StringBuffer2 != NULL);\r
+      StrCpy (StringBuffer1, L"Configuration changed. Reset to apply it Now ? ");\r
+      StrCpy (StringBuffer2, L"Enter (YES)  /   Esc (NO)");\r
+      //\r
+      // Popup a menu to notice user\r
+      //\r
+      do {\r
+        Browser->CreatePopUp (2, TRUE, 0, NULL, &Key, StringBuffer1, StringBuffer2);\r
+      } while ((Key.ScanCode != SCAN_ESC) && (Key.UnicodeChar != CHAR_CARRIAGE_RETURN));\r
+\r
+      FreePool (StringBuffer1);\r
+      FreePool (StringBuffer2);\r
+      //\r
+      // If the user hits the YES Response key, reset\r
+      //\r
+      if ((Key.UnicodeChar == CHAR_CARRIAGE_RETURN)) {\r
+        gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);\r
+      }\r
+      gST->ConOut->ClearScreen (gST->ConOut);\r
+    }\r
+  }\r
+}\r
+\r
+EFI_STATUS\r
+BdsLibGetHiiHandles (\r
+  IN     EFI_HII_PROTOCOL *Hii,\r
+  IN OUT UINT16           *HandleBufferLength,\r
+  OUT    EFI_HII_HANDLE   **HiiHandleBuffer\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Determines the handles that are currently active in the database.\r
+  It's the caller's responsibility to free handle buffer.\r
+\r
+Arguments:\r
+\r
+  This                  - A pointer to the EFI_HII_PROTOCOL instance.\r
+  HandleBufferLength    - On input, a pointer to the length of the handle buffer. On output,\r
+                          the length of the handle buffer that is required for the handles found.\r
+  HiiHandleBuffer       - Pointer to an array of EFI_HII_PROTOCOL instances returned.\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS           - Get an array of EFI_HII_PROTOCOL instances successfully.\r
+  EFI_INVALID_PARAMETER - Hii is NULL.\r
+  EFI_NOT_FOUND         - Database not found.\r
+\r
+--*/\r
+{\r
+  UINT16      TempBufferLength;\r
+  EFI_STATUS  Status;\r
+\r
+  TempBufferLength = 0;\r
+\r
+  //\r
+  // Try to find the actual buffer size for HiiHandle Buffer.\r
+  //\r
+  Status = Hii->FindHandles (Hii, &TempBufferLength, *HiiHandleBuffer);\r
+\r
+  if (Status == EFI_BUFFER_TOO_SMALL) {\r
+    *HiiHandleBuffer = AllocateZeroPool (TempBufferLength);\r
+    Status = Hii->FindHandles (Hii, &TempBufferLength, *HiiHandleBuffer);\r
+    //\r
+    // we should not fail here.\r
+    //\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
+\r
+  *HandleBufferLength = TempBufferLength;\r
+\r
+  return Status;\r
+\r
+}\r
diff --git a/Nt32Pkg/Library/EdkGenericBdsLib/CommonHeader.h b/Nt32Pkg/Library/EdkGenericBdsLib/CommonHeader.h
new file mode 100644 (file)
index 0000000..8dbbba8
--- /dev/null
@@ -0,0 +1,62 @@
+/**@file\r
+  Common header file shared by all source files.\r
+\r
+  This file includes package header files, library classes and protocol, PPI & GUID definitions.\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
+   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
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <Dxe.h>\r
+#include <EdkDxe.h>\r
+#include <WinNtDxe.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Protocol/SimpleTextIn.h>\r
+#include <Protocol/SimpleTextOut.h>\r
+#include <Protocol/LoadedImage.h>\r
+#include <Guid/GenericPlatformVariable.h>\r
+#include <Guid/ShellFile.h>\r
+#include <Protocol/SimpleFileSystem.h>\r
+#include <Protocol/BlockIo.h>\r
+#include <Protocol/SimpleNetwork.h>\r
+#include <Protocol/AcpiS3Save.h>\r
+#include <Guid/GlobalVariable.h>\r
+#include <Protocol/FormBrowser.h>\r
+#include <Protocol/LegacyBios.h>\r
+#include <Protocol/DriverBinding.h>\r
+#include <Protocol/LoadFile.h>\r
+#include <Protocol/DevicePath.h>\r
+#include <Protocol/FirmwareVolume.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/EdkGenericBdsLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/DxeServicesTableLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/HobLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+#include <Library/DevicePathLib.h>\r
+#include <Library/PerformanceLib.h>\r
+#include <Library/PeCoffLib.h>\r
+\r
+#endif\r
diff --git a/Nt32Pkg/Library/EdkGenericBdsLib/DevicePath.c b/Nt32Pkg/Library/EdkGenericBdsLib/DevicePath.c
new file mode 100644 (file)
index 0000000..a8e796c
--- /dev/null
@@ -0,0 +1,1124 @@
+/*++\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
+  DevicePath.c\r
+\r
+Abstract:\r
+\r
+  BDS internal function define the default device path string, it can be\r
+  replaced by platform device path.\r
+\r
+--*/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+EFI_GUID  mEfiWinNtThunkProtocolGuid  = EFI_WIN_NT_THUNK_PROTOCOL_GUID;\r
+EFI_GUID  mEfiWinNtUgaGuid            = EFI_WIN_NT_UGA_GUID;\r
+EFI_GUID  mEfiWinNtGopGuid            = EFI_WIN_NT_GOP_GUID;\r
+EFI_GUID  mEfiWinNtSerialPortGuid     = EFI_WIN_NT_SERIAL_PORT_GUID;\r
+EFI_GUID  mEfiMsgPcAnsiGuid           = DEVICE_PATH_MESSAGING_PC_ANSI;\r
+EFI_GUID  mEfiMsgVt100Guid            = DEVICE_PATH_MESSAGING_VT_100;\r
+EFI_GUID  mEfiMsgVt100PlusGuid        = DEVICE_PATH_MESSAGING_VT_100_PLUS;\r
+EFI_GUID  mEfiMsgVt100Utf8Guid        = DEVICE_PATH_MESSAGING_VT_UTF8;\r
+\r
+VOID *\r
+ReallocatePool (\r
+  IN VOID                 *OldPool,\r
+  IN UINTN                OldSize,\r
+  IN UINTN                NewSize\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Adjusts the size of a previously allocated buffer.\r
+\r
+Arguments:\r
+\r
+  OldPool               - A pointer to the buffer whose size is being adjusted.\r
+\r
+  OldSize               - The size of the current buffer.\r
+\r
+  NewSize               - The size of the new buffer.\r
+\r
+Returns:\r
+\r
+  EFI_SUCEESS           - The requested number of bytes were allocated.\r
+\r
+  EFI_OUT_OF_RESOURCES  - The pool requested could not be allocated.\r
+\r
+  EFI_INVALID_PARAMETER - The buffer was invalid.\r
+\r
+--*/\r
+{\r
+  VOID  *NewPool;\r
+\r
+  NewPool = NULL;\r
+  if (NewSize) {\r
+    NewPool = AllocateZeroPool (NewSize);\r
+  }\r
+\r
+  if (OldPool) {\r
+    if (NewPool) {\r
+      CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize);\r
+    }\r
+\r
+    FreePool (OldPool);\r
+  }\r
+\r
+  return NewPool;\r
+}\r
+\r
+CHAR16 *\r
+CatPrint (\r
+  IN OUT POOL_PRINT   *Str,\r
+  IN CHAR16           *fmt,\r
+  ...\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+    Concatenates a formatted unicode string to allocated pool.\r
+    The caller must free the resulting buffer.\r
+\r
+Arguments:\r
+\r
+    Str         - Tracks the allocated pool, size in use, and\r
+                  amount of pool allocated.\r
+\r
+    fmt         - The format string\r
+\r
+Returns:\r
+\r
+    Allocated buffer with the formatted string printed in it.\r
+    The caller must free the allocated buffer.   The buffer\r
+    allocation is not packed.\r
+\r
+--*/\r
+{\r
+  UINT16  *AppendStr;\r
+  VA_LIST args;\r
+  UINTN   strsize;\r
+\r
+  AppendStr = AllocateZeroPool (0x1000);\r
+  if (AppendStr == NULL) {\r
+    return Str->str;\r
+  }\r
+\r
+  VA_START (args, fmt);\r
+  UnicodeVSPrint (AppendStr, 0x1000, fmt, args);\r
+  VA_END (args);\r
+  if (NULL == Str->str) {\r
+    strsize   = StrSize (AppendStr);\r
+    Str->str  = AllocateZeroPool (strsize);\r
+    ASSERT (Str->str != NULL);\r
+  } else {\r
+    strsize = StrSize (AppendStr) + StrSize (Str->str) - sizeof (UINT16);\r
+    Str->str = ReallocatePool (\r
+                Str->str,\r
+                StrSize (Str->str),\r
+                strsize\r
+                );\r
+    ASSERT (Str->str != NULL);\r
+  }\r
+\r
+  Str->maxlen = MAX_CHAR * sizeof (UINT16);\r
+  if (strsize < Str->maxlen) {\r
+    StrCat (Str->str, AppendStr);\r
+    Str->len = strsize - sizeof (UINT16);\r
+  }\r
+\r
+  FreePool (AppendStr);\r
+  return Str->str;\r
+}\r
+\r
+EFI_DEVICE_PATH_PROTOCOL *\r
+BdsLibUnpackDevicePath (\r
+  IN EFI_DEVICE_PATH_PROTOCOL  *DevPath\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Function unpacks a device path data structure so that all the nodes\r
+  of a device path are naturally aligned.\r
+\r
+Arguments:\r
+\r
+  DevPath        - A pointer to a device path data structure\r
+\r
+Returns:\r
+\r
+  If the memory for the device path is successfully allocated, then a\r
+  pointer to the new device path is returned.  Otherwise, NULL is returned.\r
+\r
+--*/\r
+{\r
+  EFI_DEVICE_PATH_PROTOCOL  *Src;\r
+  EFI_DEVICE_PATH_PROTOCOL  *Dest;\r
+  EFI_DEVICE_PATH_PROTOCOL  *NewPath;\r
+  UINTN                     Size;\r
+\r
+  //\r
+  // Walk device path and round sizes to valid boundries\r
+  //\r
+  Src   = DevPath;\r
+  Size  = 0;\r
+  for (;;) {\r
+    Size += DevicePathNodeLength (Src);\r
+    Size += ALIGN_SIZE (Size);\r
+\r
+    if (IsDevicePathEnd (Src)) {\r
+      break;\r
+    }\r
+\r
+    Src = NextDevicePathNode (Src);\r
+  }\r
+  //\r
+  // Allocate space for the unpacked path\r
+  //\r
+  NewPath = AllocateZeroPool (Size);\r
+  if (NewPath) {\r
+\r
+    ASSERT (((UINTN) NewPath) % MIN_ALIGNMENT_SIZE == 0);\r
+\r
+    //\r
+    // Copy each node\r
+    //\r
+    Src   = DevPath;\r
+    Dest  = NewPath;\r
+    for (;;) {\r
+      Size = DevicePathNodeLength (Src);\r
+      CopyMem (Dest, Src, Size);\r
+      Size += ALIGN_SIZE (Size);\r
+      SetDevicePathNodeLength (Dest, Size);\r
+      Dest->Type |= EFI_DP_TYPE_UNPACKED;\r
+      Dest = (EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) Dest) + Size);\r
+\r
+      if (IsDevicePathEnd (Src)) {\r
+        break;\r
+      }\r
+\r
+      Src = NextDevicePathNode (Src);\r
+    }\r
+  }\r
+\r
+  return NewPath;\r
+}\r
+\r
+VOID\r
+DevPathPci (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  PCI_DEVICE_PATH *Pci;\r
+\r
+  Pci = DevPath;\r
+  CatPrint (Str, L"Pci(%x|%x)", Pci->Device, Pci->Function);\r
+}\r
+\r
+VOID\r
+DevPathPccard (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  PCCARD_DEVICE_PATH  *Pccard;\r
+\r
+  Pccard = DevPath;\r
+  CatPrint (Str, L"Pcmcia(Function%x)", Pccard->FunctionNumber);\r
+}\r
+\r
+VOID\r
+DevPathMemMap (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  MEMMAP_DEVICE_PATH  *MemMap;\r
+\r
+  MemMap = DevPath;\r
+  CatPrint (\r
+    Str,\r
+    L"MemMap(%d:%.lx-%.lx)",\r
+    MemMap->MemoryType,\r
+    MemMap->StartingAddress,\r
+    MemMap->EndingAddress\r
+    );\r
+}\r
+\r
+VOID\r
+DevPathController (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  CONTROLLER_DEVICE_PATH  *Controller;\r
+\r
+  Controller = DevPath;\r
+  CatPrint (Str, L"Ctrl(%d)", Controller->ControllerNumber);\r
+}\r
+\r
+VOID\r
+DevPathVendor (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Convert Vendor device path to device name\r
+\r
+Arguments:\r
+\r
+  Str     - The buffer store device name\r
+  DevPath - Pointer to vendor device path\r
+\r
+Returns:\r
+\r
+  When it return, the device name have been stored in *Str.\r
+\r
+--*/\r
+{\r
+  VENDOR_DEVICE_PATH  *Vendor;\r
+  CHAR16              *Type;\r
+  INT32               *Temp;\r
+\r
+  Vendor  = DevPath;\r
+  Temp    = (INT32 *) (&Vendor->Guid);\r
+\r
+  switch (DevicePathType (&Vendor->Header)) {\r
+  case HARDWARE_DEVICE_PATH:\r
+    //\r
+    // If the device is a winntbus device, we will give it a readable device name.\r
+    //\r
+    if (CompareGuid (&Vendor->Guid, &mEfiWinNtThunkProtocolGuid)) {\r
+      CatPrint (Str, L"%s", L"WinNtBus");\r
+      return ;\r
+    } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtUgaGuid)) {\r
+      CatPrint (Str, L"%s", L"UGA");\r
+      return ;\r
+    } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtGopGuid)) {\r
+      CatPrint (Str, L"%s", L"GOP");\r
+      return ;\r
+    } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtSerialPortGuid)) {\r
+      CatPrint (Str, L"%s", L"Serial");\r
+      return ;\r
+    } else {\r
+      Type = L"Hw";\r
+      break;\r
+    }\r
+\r
+  case MESSAGING_DEVICE_PATH:\r
+    //\r
+    // If the device is a winntbus device, we will give it a readable device name.\r
+    //\r
+    if (CompareGuid (&Vendor->Guid, &mEfiMsgPcAnsiGuid)) {\r
+      CatPrint (Str, L"%s", L"PC-ANSI");\r
+      return ;\r
+    } else if (CompareGuid (&Vendor->Guid, &mEfiMsgVt100Guid)) {\r
+      CatPrint (Str, L"%s", L"VT100");\r
+      return ;\r
+    } else if (CompareGuid (&Vendor->Guid, &mEfiMsgVt100PlusGuid)) {\r
+      CatPrint (Str, L"%s", L"VT100+");\r
+      return ;\r
+    } else if (CompareGuid (&Vendor->Guid, &mEfiMsgVt100Utf8Guid)) {\r
+      CatPrint (Str, L"%s", L"VT100-UTF8");\r
+      return ;\r
+    } else {\r
+      Type = L"Msg";\r
+      break;\r
+    }\r
+\r
+  case MEDIA_DEVICE_PATH:\r
+    Type = L"Media";\r
+    break;\r
+\r
+  default:\r
+    Type = L"?";\r
+    break;\r
+  }\r
+\r
+  CatPrint (Str, L"Ven%s(%g)", Type, &Vendor->Guid);\r
+}\r
+\r
+VOID\r
+DevPathAcpi (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  ACPI_HID_DEVICE_PATH  *Acpi;\r
+\r
+  Acpi = DevPath;\r
+  if ((Acpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+    CatPrint (Str, L"Acpi(PNP%04x,%x)", EISA_ID_TO_NUM (Acpi->HID), Acpi->UID);\r
+  } else {\r
+    CatPrint (Str, L"Acpi(%08x,%x)", Acpi->HID, Acpi->UID);\r
+  }\r
+}\r
+\r
+VOID\r
+DevPathExtendedAcpi (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  ACPI_EXTENDED_HID_DEVICE_PATH   *ExtendedAcpi;\r
+  //\r
+  // Index for HID, UID and CID strings, 0 for non-exist\r
+  //\r
+  UINT16                          HIDSTRIdx;\r
+  UINT16                          UIDSTRIdx;\r
+  UINT16                          CIDSTRIdx;\r
+  UINT16                          Index;\r
+  UINT16                          Length;\r
+  UINT16                          Anchor;\r
+  CHAR8                           *AsChar8Array;\r
+\r
+  ASSERT (Str != NULL);\r
+  ASSERT (DevPath != NULL);\r
+\r
+  HIDSTRIdx    = 0;\r
+  UIDSTRIdx    = 0;\r
+  CIDSTRIdx    = 0;\r
+  ExtendedAcpi = DevPath;\r
+  Length       = DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) ExtendedAcpi);\r
+\r
+  ASSERT (Length >= 19);\r
+  AsChar8Array = (CHAR8 *) ExtendedAcpi;\r
+\r
+  //\r
+  // find HIDSTR\r
+  //\r
+  Anchor = 16;\r
+  for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) {\r
+    ;\r
+  }\r
+  if (Index > Anchor) {\r
+    HIDSTRIdx = Anchor;\r
+  }\r
+  //\r
+  // find UIDSTR\r
+  //\r
+  Anchor = Index + 1;\r
+  for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) {\r
+    ;\r
+  }\r
+  if (Index > Anchor) {\r
+    UIDSTRIdx = Anchor;\r
+  }\r
+  //\r
+  // find CIDSTR\r
+  //\r
+  Anchor = Index + 1;\r
+  for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) {\r
+    ;\r
+  }\r
+  if (Index > Anchor) {\r
+    CIDSTRIdx = Anchor;\r
+  }\r
+\r
+  if (HIDSTRIdx == 0 && CIDSTRIdx == 0 && ExtendedAcpi->UID == 0) {\r
+    CatPrint (Str, L"AcpiExp(");\r
+    if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->HID));\r
+    } else {\r
+      CatPrint (Str, L"%08x,", ExtendedAcpi->HID);\r
+    }\r
+    if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->CID));\r
+    } else {\r
+      CatPrint (Str, L"%08x,", ExtendedAcpi->CID);\r
+    }\r
+    if (UIDSTRIdx != 0) {\r
+      CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx);\r
+    } else {\r
+      CatPrint (Str, L"\"\")");\r
+    }\r
+  } else {\r
+    CatPrint (Str, L"AcpiEx(");\r
+    if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->HID));\r
+    } else {\r
+      CatPrint (Str, L"%08x,", ExtendedAcpi->HID);\r
+    }\r
+    if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->CID));\r
+    } else {\r
+      CatPrint (Str, L"%08x,", ExtendedAcpi->CID);\r
+    }\r
+    CatPrint (Str, L"%x,", ExtendedAcpi->UID);\r
+\r
+    if (HIDSTRIdx != 0) {\r
+      CatPrint (Str, L"%a,", AsChar8Array + HIDSTRIdx);\r
+    } else {\r
+      CatPrint (Str, L"\"\",");\r
+    }\r
+    if (CIDSTRIdx != 0) {\r
+      CatPrint (Str, L"%a,", AsChar8Array + CIDSTRIdx);\r
+    } else {\r
+      CatPrint (Str, L"\"\",");\r
+    }\r
+    if (UIDSTRIdx != 0) {\r
+      CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx);\r
+    } else {\r
+      CatPrint (Str, L"\"\")");\r
+    }\r
+  }\r
+\r
+}\r
+\r
+VOID\r
+DevPathAdrAcpi (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  ACPI_ADR_DEVICE_PATH    *AcpiAdr;\r
+  UINT16                  Index;\r
+  UINT16                  Length;\r
+  UINT16                  AdditionalAdrCount;\r
+\r
+  AcpiAdr            = DevPath;\r
+  Length             = DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr);\r
+  AdditionalAdrCount = (Length - 8) / 4;\r
+\r
+  CatPrint (Str, L"AcpiAdr(%x", AcpiAdr->ADR);\r
+  for (Index = 0; Index < AdditionalAdrCount; Index++) {\r
+    CatPrint (Str, L",%x", *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4));\r
+  }\r
+  CatPrint (Str, L")");\r
+}\r
+\r
+VOID\r
+DevPathAtapi (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  ATAPI_DEVICE_PATH *Atapi;\r
+\r
+  Atapi = DevPath;\r
+  CatPrint (\r
+    Str,\r
+    L"Ata(%s,%s)",\r
+    Atapi->PrimarySecondary ? L"Secondary" : L"Primary",\r
+    Atapi->SlaveMaster ? L"Slave" : L"Master"\r
+    );\r
+}\r
+\r
+VOID\r
+DevPathScsi (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  SCSI_DEVICE_PATH  *Scsi;\r
+\r
+  Scsi = DevPath;\r
+  CatPrint (Str, L"Scsi(Pun%x,Lun%x)", Scsi->Pun, Scsi->Lun);\r
+}\r
+\r
+VOID\r
+DevPathFibre (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  FIBRECHANNEL_DEVICE_PATH  *Fibre;\r
+\r
+  Fibre = DevPath;\r
+  CatPrint (Str, L"Fibre(Wwn%lx,Lun%x)", Fibre->WWN, Fibre->Lun);\r
+}\r
+\r
+VOID\r
+DevPath1394 (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  F1394_DEVICE_PATH *F1394;\r
+\r
+  F1394 = DevPath;\r
+  CatPrint (Str, L"1394(%g)", &F1394->Guid);\r
+}\r
+\r
+VOID\r
+DevPathUsb (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  USB_DEVICE_PATH *Usb;\r
+\r
+  Usb = DevPath;\r
+  CatPrint (Str, L"Usb(%x, %x)", Usb->ParentPortNumber, Usb->InterfaceNumber);\r
+}\r
+\r
+VOID\r
+DevPathUsbClass (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  USB_CLASS_DEVICE_PATH *UsbClass;\r
+\r
+  UsbClass = DevPath;\r
+  CatPrint (\r
+    Str,\r
+    L"Usb Class(%x, %x, %x, %x, %x)",\r
+    UsbClass->VendorId,\r
+    UsbClass->ProductId,\r
+    UsbClass->DeviceClass,\r
+    UsbClass->DeviceSubClass,\r
+    UsbClass->DeviceProtocol\r
+    );\r
+}\r
+\r
+VOID\r
+DevPathI2O (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  I2O_DEVICE_PATH *I2O;\r
+\r
+  I2O = DevPath;\r
+  CatPrint (Str, L"I2O(%x)", I2O->Tid);\r
+}\r
+\r
+VOID\r
+DevPathMacAddr (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  MAC_ADDR_DEVICE_PATH  *MAC;\r
+  UINTN                 HwAddressSize;\r
+  UINTN                 Index;\r
+\r
+  MAC           = DevPath;\r
+\r
+  HwAddressSize = sizeof (EFI_MAC_ADDRESS);\r
+  if (MAC->IfType == 0x01 || MAC->IfType == 0x00) {\r
+    HwAddressSize = 6;\r
+  }\r
+\r
+  CatPrint (Str, L"Mac(");\r
+\r
+  for (Index = 0; Index < HwAddressSize; Index++) {\r
+    CatPrint (Str, L"%02x", MAC->MacAddress.Addr[Index]);\r
+  }\r
+\r
+  CatPrint (Str, L")");\r
+}\r
+\r
+VOID\r
+DevPathIPv4 (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  IPv4_DEVICE_PATH  *IP;\r
+\r
+  IP = DevPath;\r
+  CatPrint (\r
+    Str,\r
+    L"IPv4(%d.%d.%d.%d:%d)",\r
+    IP->RemoteIpAddress.Addr[0],\r
+    IP->RemoteIpAddress.Addr[1],\r
+    IP->RemoteIpAddress.Addr[2],\r
+    IP->RemoteIpAddress.Addr[3],\r
+    IP->RemotePort\r
+    );\r
+}\r
+\r
+VOID\r
+DevPathIPv6 (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  IPv6_DEVICE_PATH  *IP;\r
+\r
+  IP = DevPath;\r
+  CatPrint (Str, L"IP-v6(not-done)");\r
+}\r
+\r
+VOID\r
+DevPathInfiniBand (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  INFINIBAND_DEVICE_PATH  *InfiniBand;\r
+\r
+  InfiniBand = DevPath;\r
+  CatPrint (Str, L"InfiniBand(not-done)");\r
+}\r
+\r
+VOID\r
+DevPathUart (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  UART_DEVICE_PATH  *Uart;\r
+  CHAR8             Parity;\r
+\r
+  Uart = DevPath;\r
+  switch (Uart->Parity) {\r
+  case 0:\r
+    Parity = 'D';\r
+    break;\r
+\r
+  case 1:\r
+    Parity = 'N';\r
+    break;\r
+\r
+  case 2:\r
+    Parity = 'E';\r
+    break;\r
+\r
+  case 3:\r
+    Parity = 'O';\r
+    break;\r
+\r
+  case 4:\r
+    Parity = 'M';\r
+    break;\r
+\r
+  case 5:\r
+    Parity = 'S';\r
+    break;\r
+\r
+  default:\r
+    Parity = 'x';\r
+    break;\r
+  }\r
+\r
+  if (Uart->BaudRate == 0) {\r
+    CatPrint (Str, L"Uart(DEFAULT %c", Parity);\r
+  } else {\r
+    CatPrint (Str, L"Uart(%d %c", Uart->BaudRate, Parity);\r
+  }\r
+\r
+  if (Uart->DataBits == 0) {\r
+    CatPrint (Str, L"D");\r
+  } else {\r
+    CatPrint (Str, L"%d", Uart->DataBits);\r
+  }\r
+\r
+  switch (Uart->StopBits) {\r
+  case 0:\r
+    CatPrint (Str, L"D)");\r
+    break;\r
+\r
+  case 1:\r
+    CatPrint (Str, L"1)");\r
+    break;\r
+\r
+  case 2:\r
+    CatPrint (Str, L"1.5)");\r
+    break;\r
+\r
+  case 3:\r
+    CatPrint (Str, L"2)");\r
+    break;\r
+\r
+  default:\r
+    CatPrint (Str, L"x)");\r
+    break;\r
+  }\r
+}\r
+\r
+VOID\r
+DevPathHardDrive (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  HARDDRIVE_DEVICE_PATH *Hd;\r
+\r
+  Hd = DevPath;\r
+  switch (Hd->SignatureType) {\r
+  case SIGNATURE_TYPE_MBR:\r
+    CatPrint (\r
+      Str,\r
+      L"HD(Part%d,Sig%08x)",\r
+      Hd->PartitionNumber,\r
+      *((UINT32 *) (&(Hd->Signature[0])))\r
+      );\r
+    break;\r
+\r
+  case SIGNATURE_TYPE_GUID:\r
+    CatPrint (\r
+      Str,\r
+      L"HD(Part%d,Sig%g)",\r
+      Hd->PartitionNumber,\r
+      (EFI_GUID *) &(Hd->Signature[0])\r
+      );\r
+    break;\r
+\r
+  default:\r
+    CatPrint (\r
+      Str,\r
+      L"HD(Part%d,MBRType=%02x,SigType=%02x)",\r
+      Hd->PartitionNumber,\r
+      Hd->MBRType,\r
+      Hd->SignatureType\r
+      );\r
+    break;\r
+  }\r
+}\r
+\r
+VOID\r
+DevPathCDROM (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  CDROM_DEVICE_PATH *Cd;\r
+\r
+  Cd = DevPath;\r
+  CatPrint (Str, L"CDROM(Entry%x)", Cd->BootEntry);\r
+}\r
+\r
+VOID\r
+DevPathFilePath (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  FILEPATH_DEVICE_PATH  *Fp;\r
+\r
+  Fp = DevPath;\r
+  CatPrint (Str, L"%s", Fp->PathName);\r
+}\r
+\r
+VOID\r
+DevPathMediaProtocol (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  MEDIA_PROTOCOL_DEVICE_PATH  *MediaProt;\r
+\r
+  MediaProt = DevPath;\r
+  CatPrint (Str, L"%g", &MediaProt->Protocol);\r
+}\r
+\r
+VOID\r
+DevPathFvFilePath (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFilePath;\r
+\r
+  FvFilePath = DevPath;\r
+  CatPrint (Str, L"%g", &FvFilePath->NameGuid);\r
+}\r
+\r
+VOID\r
+DevPathBssBss (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  BBS_BBS_DEVICE_PATH *Bbs;\r
+  CHAR16              *Type;\r
+\r
+  Bbs = DevPath;\r
+  switch (Bbs->DeviceType) {\r
+  case BBS_TYPE_FLOPPY:\r
+    Type = L"Floppy";\r
+    break;\r
+\r
+  case BBS_TYPE_HARDDRIVE:\r
+    Type = L"Harddrive";\r
+    break;\r
+\r
+  case BBS_TYPE_CDROM:\r
+    Type = L"CDROM";\r
+    break;\r
+\r
+  case BBS_TYPE_PCMCIA:\r
+    Type = L"PCMCIA";\r
+    break;\r
+\r
+  case BBS_TYPE_USB:\r
+    Type = L"Usb";\r
+    break;\r
+\r
+  case BBS_TYPE_EMBEDDED_NETWORK:\r
+    Type = L"Net";\r
+    break;\r
+\r
+  default:\r
+    Type = L"?";\r
+    break;\r
+  }\r
+  //\r
+  // Since current Print function hasn't implemented %a (for ansi string)\r
+  // we will only print Unicode strings.\r
+  //\r
+  CatPrint (Str, L"Legacy-%s", Type);\r
+}\r
+\r
+VOID\r
+DevPathEndInstance (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  CatPrint (Str, L",");\r
+}\r
+\r
+VOID\r
+DevPathNodeUnknown (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  CatPrint (Str, L"?");\r
+}\r
+\r
+DEVICE_PATH_STRING_TABLE  DevPathTable[] = {\r
+  HARDWARE_DEVICE_PATH,\r
+  HW_PCI_DP,\r
+  DevPathPci,\r
+  HARDWARE_DEVICE_PATH,\r
+  HW_PCCARD_DP,\r
+  DevPathPccard,\r
+  HARDWARE_DEVICE_PATH,\r
+  HW_MEMMAP_DP,\r
+  DevPathMemMap,\r
+  HARDWARE_DEVICE_PATH,\r
+  HW_VENDOR_DP,\r
+  DevPathVendor,\r
+  HARDWARE_DEVICE_PATH,\r
+  HW_CONTROLLER_DP,\r
+  DevPathController,\r
+  ACPI_DEVICE_PATH,\r
+  ACPI_DP,\r
+  DevPathAcpi,\r
+  ACPI_DEVICE_PATH,\r
+  ACPI_EXTENDED_DP,\r
+  DevPathExtendedAcpi,\r
+  ACPI_DEVICE_PATH,\r
+  ACPI_ADR_DP,\r
+  DevPathAdrAcpi,\r
+  MESSAGING_DEVICE_PATH,\r
+  MSG_ATAPI_DP,\r
+  DevPathAtapi,\r
+  MESSAGING_DEVICE_PATH,\r
+  MSG_SCSI_DP,\r
+  DevPathScsi,\r
+  MESSAGING_DEVICE_PATH,\r
+  MSG_FIBRECHANNEL_DP,\r
+  DevPathFibre,\r
+  MESSAGING_DEVICE_PATH,\r
+  MSG_1394_DP,\r
+  DevPath1394,\r
+  MESSAGING_DEVICE_PATH,\r
+  MSG_USB_DP,\r
+  DevPathUsb,\r
+  MESSAGING_DEVICE_PATH,\r
+  MSG_USB_CLASS_DP,\r
+  DevPathUsbClass,\r
+  MESSAGING_DEVICE_PATH,\r
+  MSG_I2O_DP,\r
+  DevPathI2O,\r
+  MESSAGING_DEVICE_PATH,\r
+  MSG_MAC_ADDR_DP,\r
+  DevPathMacAddr,\r
+  MESSAGING_DEVICE_PATH,\r
+  MSG_IPv4_DP,\r
+  DevPathIPv4,\r
+  MESSAGING_DEVICE_PATH,\r
+  MSG_IPv6_DP,\r
+  DevPathIPv6,\r
+  MESSAGING_DEVICE_PATH,\r
+  MSG_INFINIBAND_DP,\r
+  DevPathInfiniBand,\r
+  MESSAGING_DEVICE_PATH,\r
+  MSG_UART_DP,\r
+  DevPathUart,\r
+  MESSAGING_DEVICE_PATH,\r
+  MSG_VENDOR_DP,\r
+  DevPathVendor,\r
+  MEDIA_DEVICE_PATH,\r
+  MEDIA_HARDDRIVE_DP,\r
+  DevPathHardDrive,\r
+  MEDIA_DEVICE_PATH,\r
+  MEDIA_CDROM_DP,\r
+  DevPathCDROM,\r
+  MEDIA_DEVICE_PATH,\r
+  MEDIA_VENDOR_DP,\r
+  DevPathVendor,\r
+  MEDIA_DEVICE_PATH,\r
+  MEDIA_FILEPATH_DP,\r
+  DevPathFilePath,\r
+  MEDIA_DEVICE_PATH,\r
+  MEDIA_PROTOCOL_DP,\r
+  DevPathMediaProtocol,\r
+  BBS_DEVICE_PATH,\r
+  BBS_BBS_DP,\r
+  DevPathBssBss,\r
+  END_DEVICE_PATH_TYPE,\r
+  END_INSTANCE_DEVICE_PATH_SUBTYPE,\r
+  DevPathEndInstance,\r
+  0,\r
+  0,\r
+  NULL\r
+};\r
+\r
+CHAR16 *\r
+DevicePathToStr (\r
+  IN EFI_DEVICE_PATH_PROTOCOL     *DevPath\r
+  )\r
+/*++\r
+\r
+  Turns the Device Path into a printable string.  Allcoates\r
+  the string from pool.  The caller must SafeFreePool the returned\r
+  string.\r
+\r
+--*/\r
+{\r
+  POOL_PRINT                Str;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevPathNode;\r
+  VOID (*DumpNode) (POOL_PRINT *, VOID *);\r
+\r
+  UINTN Index;\r
+  UINTN NewSize;\r
+\r
+  ZeroMem (&Str, sizeof (Str));\r
+\r
+  if (DevPath == NULL) {\r
+    goto Done;\r
+  }\r
+  //\r
+  // Unpacked the device path\r
+  //\r
+  DevPath = BdsLibUnpackDevicePath (DevPath);\r
+  ASSERT (DevPath);\r
+\r
+  //\r
+  // Process each device path node\r
+  //\r
+  DevPathNode = DevPath;\r
+  while (!IsDevicePathEnd (DevPathNode)) {\r
+    //\r
+    // Find the handler to dump this device path node\r
+    //\r
+    DumpNode = NULL;\r
+    for (Index = 0; DevPathTable[Index].Function; Index += 1) {\r
+\r
+      if (DevicePathType (DevPathNode) == DevPathTable[Index].Type &&\r
+          DevicePathSubType (DevPathNode) == DevPathTable[Index].SubType\r
+          ) {\r
+        DumpNode = DevPathTable[Index].Function;\r
+        break;\r
+      }\r
+    }\r
+    //\r
+    // If not found, use a generic function\r
+    //\r
+    if (!DumpNode) {\r
+      DumpNode = DevPathNodeUnknown;\r
+    }\r
+    //\r
+    //  Put a path seperator in if needed\r
+    //\r
+    if (Str.len && DumpNode != DevPathEndInstance) {\r
+      CatPrint (&Str, L"/");\r
+    }\r
+    //\r
+    // Print this node of the device path\r
+    //\r
+    DumpNode (&Str, DevPathNode);\r
+\r
+    //\r
+    // Next device path node\r
+    //\r
+    DevPathNode = NextDevicePathNode (DevPathNode);\r
+  }\r
+  //\r
+  // Shrink pool used for string allocation\r
+  //\r
+  FreePool (DevPath);\r
+\r
+Done:\r
+  NewSize = (Str.len + 1) * sizeof (CHAR16);\r
+  Str.str = ReallocatePool (Str.str, NewSize, NewSize);\r
+  ASSERT (Str.str != NULL);\r
+  Str.str[Str.len] = 0;\r
+  return Str.str;\r
+}\r
+\r
+EFI_DEVICE_PATH_PROTOCOL *\r
+LibDuplicateDevicePathInstance (\r
+  IN EFI_DEVICE_PATH_PROTOCOL  *DevPath\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Function creates a device path data structure that identically matches the\r
+  device path passed in.\r
+\r
+Arguments:\r
+\r
+  DevPath      - A pointer to a device path data structure.\r
+\r
+Returns:\r
+\r
+  The new copy of DevPath is created to identically match the input.\r
+  Otherwise, NULL is returned.\r
+\r
+--*/\r
+{\r
+  EFI_DEVICE_PATH_PROTOCOL  *NewDevPath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePathInst;\r
+  EFI_DEVICE_PATH_PROTOCOL  *Temp;\r
+  UINTN                     Size;\r
+\r
+  //\r
+  // get the size of an instance from the input\r
+  //\r
+  Temp            = DevPath;\r
+  DevicePathInst  = GetNextDevicePathInstance (&Temp, &Size);\r
+\r
+  //\r
+  // Make a copy\r
+  //\r
+  NewDevPath = NULL;\r
+  if (Size) {\r
+    NewDevPath = AllocateZeroPool (Size);\r
+    ASSERT (NewDevPath != NULL);\r
+  }\r
+\r
+  if (NewDevPath) {\r
+    CopyMem (NewDevPath, DevicePathInst, Size);\r
+  }\r
+\r
+  return NewDevPath;\r
+}\r
diff --git a/Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.inf b/Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.inf
new file mode 100644 (file)
index 0000000..c13e625
--- /dev/null
@@ -0,0 +1,139 @@
+#/** @file\r
+# EDK Generic BDS Common APIs Library Instance.\r
+#\r
+# The library instance provides common library routines help in\r
+#  performance measurement, device path debug print, boot device selections,\r
+#  boot device connection, console supports in BDS phase and boot from boot\r
+#  device.\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                      = EdkGenericBdsLib\r
+  FILE_GUID                      = 1ec995b2-d15b-44f6-abd2-050ea7dd37d2\r
+  MODULE_TYPE                    = DXE_DRIVER\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = EdkGenericBdsLib|DXE_DRIVER \r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32\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
+  BdsMisc.c\r
+  Performance.c\r
+  Performance.h\r
+  DevicePath.c\r
+  BdsConnect.c\r
+  BdsConsole.c\r
+  BdsBoot.c\r
+  CommonHeader.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
+  Nt32Pkg/Nt32Pkg.dec\r
+  EdkModulePkg/EdkModulePkg.dec\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
+  PeCoffLib\r
+  PerformanceLib\r
+  DevicePathLib\r
+  UefiRuntimeServicesTableLib\r
+  UefiBootServicesTableLib\r
+  MemoryAllocationLib\r
+  BaseMemoryLib\r
+  HobLib\r
+  PrintLib\r
+  DebugLib\r
+  DxeServicesTableLib\r
+  UefiLib\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
+  gEfiGlobalVariableGuid                        # ALWAYS_CONSUMED\r
+  gEfiGenericPlatformVariableGuid               # ALWAYS_CONSUMED\r
+  gEfiShellFileGuid                             # ALWAYS_CONSUMED\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
+  gEfiSimpleFileSystemProtocolGuid              # PROTOCOL SOMETIMES_CONSUMED\r
+  gEfiLoadFileProtocolGuid                      # PROTOCOL SOMETIMES_CONSUMED\r
+  gEfiFormBrowserProtocolGuid                   # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiDriverBindingProtocolGuid                 # PROTOCOL SOMETIMES_CONSUMED\r
+  gEfiBlockIoProtocolGuid                       # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiLegacyBiosProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiCpuArchProtocolGuid                       # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiSimpleNetworkProtocolGuid                 # PROTOCOL SOMETIMES_CONSUMED\r
+  gEfiSimpleTextInProtocolGuid                  # PROTOCOL SOMETIMES_CONSUMED\r
+  gEfiSimpleTextOutProtocolGuid                 # PROTOCOL SOMETIMES_CONSUMED\r
+  gEfiAcpiS3SaveProtocolGuid                    # PROTOCOL SOMETIMES_CONSUMED\r
+  gEfiFirmwareVolumeProtocolGuid                # PROTOCOL SOMETIMES_CONSUMED\r
+  gEfiLoadedImageProtocolGuid                   # PROTOCOL ALWAYS_CONSUMED\r
+\r
diff --git a/Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa b/Nt32Pkg/Library/EdkGenericBdsLib/EdkGenericBdsLib.msa
new file mode 100644 (file)
index 0000000..0626602
--- /dev/null
@@ -0,0 +1,144 @@
+<?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>EdkGenericBdsLib</ModuleName>\r
+    <ModuleType>DXE_DRIVER</ModuleType>\r
+    <GuidValue>1ec995b2-d15b-44f6-abd2-050ea7dd37d2</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>EDK Generic BDS Common APIs Library Instance.</Abstract>\r
+    <Description>The library instance provides common library routines help in\r
+    performance measurement, device path debug print, boot device selections,\r
+    boot device connection, console supports in BDS phase and boot from boot\r
+    device.</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</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>EdkGenericBdsLib</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_DRIVER">\r
+      <Keyword>EdkGenericBdsLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>BaseLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>DxeServicesTableLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>DebugLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PrintLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>HobLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>BaseMemoryLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>MemoryAllocationLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiBootServicesTableLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiRuntimeServicesTableLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>DevicePathLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PerformanceLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PeCoffLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>BdsBoot.c</Filename>\r
+    <Filename>BdsConsole.c</Filename>\r
+    <Filename>BdsConnect.c</Filename>\r
+    <Filename>DevicePath.c</Filename>\r
+    <Filename>Performance.h</Filename>\r
+    <Filename>Performance.c</Filename>\r
+    <Filename>BdsMisc.c</Filename>\r
+  </SourceFiles>\r
+  <PackageDependencies>\r
+    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
+    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>\r
+  </PackageDependencies>\r
+  <Protocols>\r
+    <Protocol Usage="ALWAYS_CONSUMED">\r
+      <ProtocolCName>gEfiLoadedImageProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="SOMETIMES_CONSUMED">\r
+      <ProtocolCName>gEfiFirmwareVolumeProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="SOMETIMES_CONSUMED">\r
+      <ProtocolCName>gEfiAcpiS3SaveProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="SOMETIMES_CONSUMED">\r
+      <ProtocolCName>gEfiSimpleTextOutProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="SOMETIMES_CONSUMED">\r
+      <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="SOMETIMES_CONSUMED">\r
+      <ProtocolCName>gEfiSimpleNetworkProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="ALWAYS_CONSUMED">\r
+      <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="ALWAYS_CONSUMED">\r
+      <ProtocolCName>gEfiCpuArchProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="ALWAYS_CONSUMED">\r
+      <ProtocolCName>gEfiLegacyBiosProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="ALWAYS_CONSUMED">\r
+      <ProtocolCName>gEfiBlockIoProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="SOMETIMES_CONSUMED">\r
+      <ProtocolCName>gEfiDriverBindingProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="ALWAYS_CONSUMED">\r
+      <ProtocolCName>gEfiFormBrowserProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="SOMETIMES_CONSUMED">\r
+      <ProtocolCName>gEfiLoadFileProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="SOMETIMES_CONSUMED">\r
+      <ProtocolCName>gEfiSimpleFileSystemProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+  </Protocols>\r
+  <Guids>\r
+    <GuidCNames Usage="ALWAYS_CONSUMED">\r
+      <GuidCName>gEfiShellFileGuid</GuidCName>\r
+    </GuidCNames>\r
+    <GuidCNames Usage="ALWAYS_CONSUMED">\r
+      <GuidCName>gEfiGenericPlatformVariableGuid</GuidCName>\r
+    </GuidCNames>\r
+    <GuidCNames Usage="ALWAYS_CONSUMED">\r
+      <GuidCName>gEfiGlobalVariableGuid</GuidCName>\r
+    </GuidCNames>\r
+  </Guids>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/Nt32Pkg/Library/EdkGenericBdsLib/Performance.c b/Nt32Pkg/Library/EdkGenericBdsLib/Performance.c
new file mode 100644 (file)
index 0000000..e3013eb
--- /dev/null
@@ -0,0 +1,391 @@
+/*++\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
+  Performance.c\r
+\r
+Abstract:\r
+\r
+  This file include the file which can help to get the system\r
+  performance, all the function will only include if the performance\r
+  switch is set.\r
+\r
+--*/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+#include "Performance.h"\r
+\r
+\r
+STATIC\r
+VOID\r
+GetShortPdbFileName (\r
+  CHAR8  *PdbFileName,\r
+  CHAR8  *GaugeString\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+Arguments:\r
+\r
+Returns:\r
+\r
+--*/\r
+{\r
+  UINTN Index;\r
+  UINTN Index1;\r
+  UINTN StartIndex;\r
+  UINTN EndIndex;\r
+\r
+  if (PdbFileName == NULL) {\r
+    AsciiStrCpy (GaugeString, " ");\r
+  } else {\r
+    StartIndex = 0;\r
+    for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)\r
+      ;\r
+\r
+    for (Index = 0; PdbFileName[Index] != 0; Index++) {\r
+      if (PdbFileName[Index] == '\\') {\r
+        StartIndex = Index + 1;\r
+      }\r
+\r
+      if (PdbFileName[Index] == '.') {\r
+        EndIndex = Index;\r
+      }\r
+    }\r
+\r
+    Index1 = 0;\r
+    for (Index = StartIndex; Index < EndIndex; Index++) {\r
+      GaugeString[Index1] = PdbFileName[Index];\r
+      Index1++;\r
+      if (Index1 == PERF_TOKEN_LENGTH - 1) {\r
+        break;\r
+      }\r
+    }\r
+\r
+    GaugeString[Index1] = 0;\r
+  }\r
+\r
+  return ;\r
+}\r
+\r
+\r
+\r
+STATIC\r
+CHAR8 *\r
+GetPdbPath (\r
+  VOID *ImageBase\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Located PDB path name in PE image\r
+\r
+Arguments:\r
+\r
+  ImageBase - base of PE to search\r
+\r
+Returns:\r
+\r
+  Pointer into image at offset of PDB file name if PDB file name is found,\r
+  Otherwise a pointer to an empty string.\r
+\r
+--*/\r
+{\r
+  PE_COFF_LOADER_IMAGE_CONTEXT          ImageContext;\r
+\r
+  ZeroMem (&ImageContext, sizeof (ImageContext));\r
+  ImageContext.Handle    = ImageBase;\r
+  ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;\r
+\r
+  PeCoffLoaderGetImageInfo (&ImageContext);\r
+\r
+  return ImageContext.PdbPointer;\r
+}\r
+\r
+\r
+STATIC\r
+VOID\r
+GetNameFromHandle (\r
+  IN  EFI_HANDLE     Handle,\r
+  OUT CHAR8          *GaugeString\r
+  )\r
+{\r
+  EFI_STATUS                  Status;\r
+  EFI_LOADED_IMAGE_PROTOCOL   *Image;\r
+  CHAR8                       *PdbFileName;\r
+  EFI_DRIVER_BINDING_PROTOCOL *DriverBinding;\r
+\r
+  AsciiStrCpy (GaugeString, " ");\r
+\r
+  //\r
+  // Get handle name from image protocol\r
+  //\r
+  Status = gBS->HandleProtocol (\r
+                  Handle,\r
+                  &gEfiLoadedImageProtocolGuid,\r
+                  &Image\r
+                  );\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    Status = gBS->OpenProtocol (\r
+                    Handle,\r
+                    &gEfiDriverBindingProtocolGuid,\r
+                    (VOID **) &DriverBinding,\r
+                    NULL,\r
+                    NULL,\r
+                    EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                    );\r
+    if (EFI_ERROR (Status)) {\r
+      return ;\r
+    }\r
+    //\r
+    // Get handle name from image protocol\r
+    //\r
+    Status = gBS->HandleProtocol (\r
+                    DriverBinding->ImageHandle,\r
+                    &gEfiLoadedImageProtocolGuid,\r
+                    &Image\r
+                    );\r
+  }\r
+\r
+  PdbFileName = GetPdbPath (Image->ImageBase);\r
+\r
+  if (PdbFileName != NULL) {\r
+    GetShortPdbFileName (PdbFileName, GaugeString);\r
+  }\r
+\r
+  return ;\r
+}\r
+\r
+\r
+\r
+VOID\r
+WriteBootToOsPerformanceData (\r
+  VOID\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Allocates a block of memory and writes performance data of booting to OS into it.\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                Status;\r
+  EFI_CPU_ARCH_PROTOCOL     *Cpu;\r
+  EFI_PHYSICAL_ADDRESS      mAcpiLowMemoryBase;\r
+  UINT32                    mAcpiLowMemoryLength;\r
+  UINT32                    LimitCount;\r
+  PERF_HEADER               mPerfHeader;\r
+  PERF_DATA                 mPerfData;\r
+  EFI_HANDLE                *Handles;\r
+  UINTN                     NoHandles;\r
+  CHAR8                     GaugeString[PERF_TOKEN_LENGTH];\r
+  UINT8                     *Ptr;\r
+  UINT32                    mIndex;\r
+  UINT64                    Ticker;\r
+  UINT64                    Freq;\r
+  UINT32                    Duration;\r
+  UINT64                    CurrentTicker;\r
+  UINT64                    TimerPeriod;\r
+  UINTN                     LogEntryKey;\r
+  CONST VOID                *Handle;\r
+  CONST CHAR8               *Token;\r
+  CONST CHAR8               *Module;\r
+  UINT64                    StartTicker;\r
+  UINT64                    EndTicker;\r
+\r
+  //\r
+  // Retrive time stamp count as early as possilbe\r
+  //\r
+  Ticker = AsmReadTsc ();\r
+\r
+  //\r
+  // Allocate a block of memory that contain performance data to OS\r
+  //\r
+  mAcpiLowMemoryBase = 0xFFFFFFFF;\r
+  Status = gBS->AllocatePages (\r
+                  AllocateMaxAddress,\r
+                  EfiReservedMemoryType,\r
+                  4,\r
+                  &mAcpiLowMemoryBase\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    return ;\r
+  }\r
+\r
+  mAcpiLowMemoryLength  = EFI_PAGES_TO_SIZE(4);\r
+\r
+  Ptr                   = (UINT8 *) ((UINT32) mAcpiLowMemoryBase + sizeof (PERF_HEADER));\r
+  LimitCount            = (mAcpiLowMemoryLength - sizeof (PERF_HEADER)) / sizeof (PERF_DATA);\r
+\r
+  //\r
+  // Initialize performance data structure\r
+  //\r
+  ZeroMem (&mPerfHeader, sizeof (PERF_HEADER));\r
+\r
+  //\r
+  // Get CPU frequency\r
+  //\r
+  Status = gBS->LocateProtocol (\r
+                  &gEfiCpuArchProtocolGuid,\r
+                  NULL,\r
+                  &Cpu\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    gBS->FreePages (mAcpiLowMemoryBase, 4);\r
+    return ;\r
+  }\r
+  //\r
+  // Get Cpu Frequency\r
+  //\r
+  Status = Cpu->GetTimerValue (Cpu, 0, &(CurrentTicker), &TimerPeriod);\r
+  if (EFI_ERROR (Status)) {\r
+    gBS->FreePages (mAcpiLowMemoryBase, 4);\r
+    return ;\r
+  }\r
+\r
+  Freq                = DivU64x32 (1000000000000, (UINTN) TimerPeriod);\r
+\r
+  mPerfHeader.CpuFreq = Freq;\r
+\r
+  //\r
+  // Record BDS raw performance data\r
+  //\r
+  mPerfHeader.BDSRaw = Ticker;\r
+\r
+  //\r
+  // Put Detailed performance data into memory\r
+  //\r
+  Handles = NULL;\r
+  Status = gBS->LocateHandleBuffer (\r
+                  AllHandles,\r
+                  NULL,\r
+                  NULL,\r
+                  &NoHandles,\r
+                  &Handles\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    gBS->FreePages (mAcpiLowMemoryBase, 4);\r
+    return ;\r
+  }\r
+  //\r
+  // Get DXE drivers performance\r
+  //\r
+  for (mIndex = 0; mIndex < NoHandles; mIndex++) {\r
+    Ticker = 0;\r
+    LogEntryKey = 0;\r
+    while ((LogEntryKey = GetPerformanceMeasurement (\r
+                            LogEntryKey,\r
+                            &Handle,\r
+                            &Token,\r
+                            &Module,\r
+                            &StartTicker,\r
+                            &EndTicker)) != 0) {\r
+      if ((Handle == Handles[mIndex]) && (StartTicker < EndTicker)) {\r
+        Ticker += (EndTicker - StartTicker);\r
+      }\r
+    }\r
+\r
+    Duration = (UINT32) DivU64x32 (\r
+                          Ticker,\r
+                          (UINT32) Freq\r
+                          );\r
+\r
+    if (Duration > 0) {\r
+      ZeroMem (&mPerfData, sizeof (PERF_DATA));\r
+\r
+      GetNameFromHandle (Handles[mIndex], GaugeString);\r
+\r
+      AsciiStrCpy (mPerfData.Token, GaugeString);\r
+      mPerfData.Duration = Duration;\r
+\r
+      CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));\r
+      Ptr += sizeof (PERF_DATA);\r
+\r
+      mPerfHeader.Count++;\r
+      if (mPerfHeader.Count == LimitCount) {\r
+        goto Done;\r
+      }\r
+    }\r
+  }\r
+\r
+  FreePool (Handles);\r
+\r
+  //\r
+  // Get inserted performance data\r
+  //\r
+  LogEntryKey = 0;\r
+  while ((LogEntryKey = GetPerformanceMeasurement (\r
+                          LogEntryKey,\r
+                          &Handle,\r
+                          &Token,\r
+                          &Module,\r
+                          &StartTicker,\r
+                          &EndTicker)) != 0) {\r
+    if ((Handle == NULL) && (StartTicker <= EndTicker)) {\r
+\r
+      ZeroMem (&mPerfData, sizeof (PERF_DATA));\r
+\r
+      AsciiStrnCpy (mPerfData.Token, Token, DXE_PERFORMANCE_STRING_SIZE);\r
+      mPerfData.Duration = (UINT32) DivU64x32 (\r
+                                      EndTicker - StartTicker,\r
+                                      (UINT32) Freq\r
+                                      );\r
+\r
+      CopyMem (Ptr, &mPerfData, sizeof (PERF_DATA));\r
+      Ptr += sizeof (PERF_DATA);\r
+\r
+      mPerfHeader.Count++;\r
+      if (mPerfHeader.Count == LimitCount) {\r
+        goto Done;\r
+      }\r
+    }\r
+  }\r
+\r
+Done:\r
+\r
+  mPerfHeader.Signiture = 0x66726550;\r
+\r
+  //\r
+  // Put performance data to memory\r
+  //\r
+  CopyMem (\r
+    (UINT32 *) (UINT32) mAcpiLowMemoryBase,\r
+    &mPerfHeader,\r
+    sizeof (PERF_HEADER)\r
+    );\r
+\r
+  gRT->SetVariable (\r
+        L"PerfDataMemAddr",\r
+        &gEfiGenericPlatformVariableGuid,\r
+        EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
+        sizeof (UINT32),\r
+        (VOID *) &mAcpiLowMemoryBase\r
+        );\r
+\r
+  return ;\r
+}\r
diff --git a/Nt32Pkg/Library/EdkGenericBdsLib/Performance.h b/Nt32Pkg/Library/EdkGenericBdsLib/Performance.h
new file mode 100644 (file)
index 0000000..cc05d28
--- /dev/null
@@ -0,0 +1,60 @@
+/*++\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
+  Performance.h\r
+\r
+Abstract:\r
+\r
+  This file included the performance relete function header and \r
+  definition.\r
+\r
+--*/\r
+\r
+#ifndef _PERF_H_\r
+#define _PERF_H_\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+#define PERF_TOKEN_LENGTH       28\r
+#define PERF_PEI_ENTRY_MAX_NUM  50\r
+\r
+typedef struct {\r
+  CHAR8   Token[PERF_TOKEN_LENGTH];\r
+  UINT32  Duration;\r
+} PERF_DATA;\r
+\r
+typedef struct {\r
+  UINT64        BootToOs;\r
+  UINT64        S3Resume;\r
+  UINT32        S3EntryNum;\r
+  PERF_DATA     S3Entry[PERF_PEI_ENTRY_MAX_NUM];\r
+  UINT64        CpuFreq;\r
+  UINT64        BDSRaw;\r
+  UINT32        Count;\r
+  UINT32        Signiture;\r
+} PERF_HEADER;\r
+\r
+VOID\r
+WriteBootToOsPerformanceData (\r
+  VOID\r
+  );\r
+\r
+VOID\r
+ClearDebugRegisters (\r
+  VOID\r
+  );\r
+\r
+#endif\r
diff --git a/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/CommonHeader.h b/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/CommonHeader.h
new file mode 100644 (file)
index 0000000..1c7fc5b
--- /dev/null
@@ -0,0 +1,34 @@
+/**@file\r
+  Common header file shared by all source files.\r
+\r
+  This file includes package header files, library classes and protocol, PPI & GUID definitions.\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
+   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
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <Peim.h>\r
+#include <WinNtPeim.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Ppi/NtPeiLoadFile.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/PeCoffGetEntryPointLib.h>\r
+#include <Library/PeiServicesLib.h>\r
+\r
+#endif\r
diff --git a/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf b/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf
new file mode 100644 (file)
index 0000000..abf4780
--- /dev/null
@@ -0,0 +1,92 @@
+#/** @file\r
+# Component description file for the EdkNt32PeiPeCoffGetEntryPointLib library.\r
+#\r
+# PeCoffGetEntryPointLib library class for NT32 instance implemented by use NTPeiLoadFile PPI.\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                      = EdkNt32PeiPeCoffGetEntryPointLib\r
+  FILE_GUID                      = 434b164e-5fa6-4a3d-bc04-02da2a4eeb26\r
+  MODULE_TYPE                    = PEIM\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = PeCoffGetEntryPointLib|PEI_CORE PEIM \r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32\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
+  PeCoffGetEntryPoint.c\r
+  CommonHeader.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
+  Nt32Pkg/Nt32Pkg.dec\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
+  PeiServicesLib\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
+  gNtPeiLoadFilePpiGuid                         # PPI ALWAYS_CONSUMED\r
+\r
diff --git a/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa b/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.msa
new file mode 100644 (file)
index 0000000..79fc9ec
--- /dev/null
@@ -0,0 +1,48 @@
+<?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>EdkNt32PeiPeCoffGetEntryPointLib</ModuleName>\r
+    <ModuleType>PEIM</ModuleType>\r
+    <GuidValue>434b164e-5fa6-4a3d-bc04-02da2a4eeb26</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>Component description file for the EdkNt32PeiPeCoffGetEntryPointLib library.</Abstract>\r
+    <Description>PeCoffGetEntryPointLib library class for NT32 instance implemented by use NTPeiLoadFile PPI.</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</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>EdkNt32PeiPeCoffGetEntryPointLib</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_PRODUCED"  SupModuleList="PEI_CORE PEIM">\r
+      <Keyword>PeCoffGetEntryPointLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PeiServicesLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>PeCoffGetEntryPoint.c</Filename>\r
+  </SourceFiles>\r
+  <PackageDependencies>\r
+    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>\r
+  </PackageDependencies>\r
+  <PPIs>\r
+    <Ppi Usage="ALWAYS_CONSUMED">\r
+      <PpiCName>gNtPeiLoadFilePpiGuid</PpiCName>\r
+    </Ppi>\r
+  </PPIs>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c b/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/PeCoffGetEntryPoint.c
new file mode 100644 (file)
index 0000000..fd8f739
--- /dev/null
@@ -0,0 +1,118 @@
+/*++\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
+  PeCoffGetEntryPoint.c\r
+\r
+Abstract:\r
+\r
+  Tiano PE/COFF loader\r
+\r
+Revision History\r
+\r
+--*/\r
+\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+RETURN_STATUS\r
+EFIAPI\r
+PeCoffLoaderGetEntryPoint (\r
+  IN     VOID  *Pe32Data,\r
+  IN OUT VOID  **EntryPoint\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Loads a PE/COFF image into memory, this is not follow the original purpose of \r
+  PeCoffGetEntryPoint library class.  But it's ok that Unix package not run on a real \r
+  platform and this is for source level debug.\r
+\r
+Arguments:\r
+\r
+  Pe32Data   - Pointer to a PE/COFF Image\r
+\r
+  EntryPoint - Pointer to the entry point of the PE/COFF image\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS            if the EntryPoint was returned\r
+  EFI_INVALID_PARAMETER  if the EntryPoint could not be found from Pe32Data\r
+\r
+--*/\r
+{\r
+  EFI_STATUS              Status;\r
+  EFI_PEI_PPI_DESCRIPTOR  *PpiDescriptor;\r
+  NT_PEI_LOAD_FILE_PPI    *PeiNtService;\r
+  EFI_PHYSICAL_ADDRESS    ImageAddress;\r
+  UINT64                  ImageSize;\r
+  EFI_PHYSICAL_ADDRESS    ImageEntryPoint;\r
+\r
+  Status = PeiServicesLocatePpi (\r
+             &gNtPeiLoadFilePpiGuid,\r
+             0,\r
+             &PpiDescriptor,\r
+             &PeiNtService\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  Status = PeiNtService->PeiLoadFileService (\r
+                           Pe32Data,\r
+                           &ImageAddress,\r
+                           &ImageSize,\r
+                           &ImageEntryPoint\r
+                           );\r
+  *EntryPoint = (VOID*)(UINTN)ImageEntryPoint;\r
+  return Status;\r
+}\r
+\r
+/**\r
+  Returns the machine type of PE/COFF image. \r
+  This is copied from MDE BasePeCoffGetEntryPointLib, the code should be sync with it.\r
+  The reason is NT32 package needs to load the image to memory to support source\r
+  level debug.\r
+   \r
+\r
+  @param  Image   Pointer to a PE/COFF header\r
+\r
+  @return         Machine type or zero if not a valid iamge\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+PeCoffLoaderGetMachineType (\r
+  IN  VOID  *Pe32Data\r
+  )\r
+{  \r
+  EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION  Hdr;\r
+  EFI_IMAGE_DOS_HEADER                 *DosHdr;\r
+\r
+  DosHdr = (EFI_IMAGE_DOS_HEADER  *)Pe32Data;\r
+  if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {\r
+    Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data + DosHdr->e_lfanew);\r
+  } else {\r
+    Hdr.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)((UINTN)Pe32Data);\r
+  }\r
+\r
+  if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE)  {\r
+    return Hdr.Pe32->FileHeader.Machine;\r
+  }\r
+\r
+  return 0x0000;\r
+}\r
+\r
diff --git a/Nt32Pkg/Library/Nt32PeCoffLoaderLib/CommonHeader.h b/Nt32Pkg/Library/Nt32PeCoffLoaderLib/CommonHeader.h
new file mode 100644 (file)
index 0000000..28a2f5d
--- /dev/null
@@ -0,0 +1,33 @@
+/**@file\r
+  Common header file shared by all source files.\r
+\r
+  This file includes package header files, library classes and protocol, PPI & GUID definitions.\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
+   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
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <Peim.h>\r
+#include <EdkPeim.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Guid/PeiPeCoffLoader.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/EdkPeCoffLoaderLib.h>\r
+\r
+#endif\r
diff --git a/Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoader.c b/Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoader.c
new file mode 100644 (file)
index 0000000..6d273f4
--- /dev/null
@@ -0,0 +1,57 @@
+/*++\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
+  TianoPeCoffLoader.c\r
+\r
+Abstract:\r
+\r
+  Wrap the Base PE/COFF loader with the PE COFF Protocol\r
+\r
+\r
+--*/\r
+\r
+\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+EFI_PEI_PE_COFF_LOADER_PROTOCOL  *mPeiEfiPeiPeCoffLoader;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+PeCoffLoaderConstructor (\r
+  IN EFI_FFS_FILE_HEADER      *FfsHeader,\r
+  IN EFI_PEI_SERVICES          **PeiServices\r
+  )\r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  Status = (*PeiServices)->LocatePpi (\r
+                            PeiServices,\r
+                            &gEfiPeiPeCoffLoaderGuid,\r
+                            0,\r
+                            NULL,\r
+                            &mPeiEfiPeiPeCoffLoader\r
+                            );\r
+  return Status;\r
+}\r
+\r
+EFI_PEI_PE_COFF_LOADER_PROTOCOL *\r
+EFIAPI\r
+GetPeCoffLoaderProtocol (\r
+  )\r
+{\r
+  return mPeiEfiPeiPeCoffLoader;\r
+}\r
diff --git a/Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.inf b/Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.inf
new file mode 100644 (file)
index 0000000..40b4e68
--- /dev/null
@@ -0,0 +1,81 @@
+#/** @file\r
+# Component description file for the Nt32PeCoffLoaderLib library.\r
+#\r
+# EdkPeCoffLoaderLib library class for NT32 instance implemented by PeiPeCoffLoader PPI.\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                      = Nt32PeCoffLoaderLib\r
+  FILE_GUID                      = 3c5702f2-9b17-4273-b60c-b96e6cd13066\r
+  MODULE_TYPE                    = PEIM\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = EdkPeCoffLoaderLib|DXE_CORE PEIM \r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+  CONSTRUCTOR                    = PeCoffLoaderConstructor\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32\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
+  Nt32PeCoffLoader.c\r
+  CommonHeader.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
+\r
+################################################################################\r
+#\r
+# Package Dependency Section - list of Package files that are required for\r
+#                              this module.\r
+#\r
+################################################################################\r
+\r
+[Packages]\r
+  EdkModulePkg/EdkModulePkg.dec\r
+  MdePkg/MdePkg.dec\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
+  gEfiPeiPeCoffLoaderGuid                       # PPI ALWAYS_CONSUMED\r
+\r
diff --git a/Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.msa b/Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.msa
new file mode 100644 (file)
index 0000000..1759b4b
--- /dev/null
@@ -0,0 +1,48 @@
+<?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>Nt32PeCoffLoaderLib</ModuleName>\r
+    <ModuleType>PEIM</ModuleType>\r
+    <GuidValue>3c5702f2-9b17-4273-b60c-b96e6cd13066</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>Component description file for the Nt32PeCoffLoaderLib library.</Abstract>\r
+    <Description>EdkPeCoffLoaderLib library class for NT32 instance implemented by PeiPeCoffLoader PPI.</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</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>Nt32PeCoffLoaderLib</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE PEIM">\r
+      <Keyword>EdkPeCoffLoaderLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>Nt32PeCoffLoader.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_CONSUMED">\r
+      <PpiCName>gEfiPeiPeCoffLoaderGuid</PpiCName>\r
+    </Ppi>\r
+  </PPIs>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+    <Extern>\r
+      <Constructor>PeCoffLoaderConstructor</Constructor>\r
+    </Extern>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/CommonHeader.h b/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/CommonHeader.h
new file mode 100644 (file)
index 0000000..9afbd64
--- /dev/null
@@ -0,0 +1,42 @@
+/**@file\r
+  Common header file shared by all source files.\r
+\r
+  This file includes package header files, library classes and protocol, PPI & GUID definitions.\r
+\r
+  Copyright (c) 2007, Intel Corporation.\r
+  All rights reserved.\r
+   This software and associated documentation (if any) is furnished\r
+   under a license and may only be used or copied in accordance\r
+   with the terms of the license. Except as permitted by such\r
+   license, no part of this software or documentation may be\r
+   reproduced, stored in a retrieval system, or transmitted in any\r
+   form or by any means without the express written consent of\r
+   Intel Corporation.\r
+**/\r
+\r
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <Peim.h>\r
+#include <EdkPeim.h>\r
+#include <WinNtPeim.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Guid/StatusCodeDataTypeId.h>\r
+#include <Ppi/NtThunk.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/OemHookStatusCodeLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
+#include <Library/PeiServicesLib.h>\r
+\r
+#endif\r
diff --git a/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c b/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/Nt32OemHookStatusCodeLib.c
new file mode 100644 (file)
index 0000000..fcab103
--- /dev/null
@@ -0,0 +1,245 @@
+/** @file\r
+  OEM hook status code library functions with no library constructor/destructor\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:  Nt32OemHookStatusCodeLib.c\r
+\r
+**/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+//\r
+// Cache of WinNtThunk protocol \r
+//\r
+STATIC\r
+EFI_WIN_NT_THUNK_PROTOCOL   *mWinNt;\r
+\r
+//\r
+// Cache of standard output handle . \r
+//\r
+STATIC\r
+HANDLE                      mStdOut;\r
+\r
+/**\r
+\r
+  Initialize OEM status code device .\r
+\r
+  @return    Always return EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+OemHookStatusCodeInitialize (\r
+  VOID\r
+  )\r
+{\r
+  PEI_NT_THUNK_PPI  *NtThunkPpi;\r
+  EFI_STATUS        Status;\r
+\r
+  \r
+  //\r
+  // Locate NtThunkPpi for retrieving standard output handle\r
+  //\r
+  Status = PeiServicesLocatePpi (\r
+              &gPeiNtThunkPpiGuid,\r
+              0,\r
+              NULL,\r
+              (VOID **) &NtThunkPpi\r
+              );\r
+\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  mWinNt  = (EFI_WIN_NT_THUNK_PROTOCOL *) NtThunkPpi->NtThunk ();\r
+  \r
+\r
+  //\r
+  // Cache standard output handle.\r
+  //\r
+  mStdOut = mWinNt->GetStdHandle (STD_OUTPUT_HANDLE);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Report status code to OEM device.\r
\r
+  @param  CodeType      Indicates the type of status code being reported.  Type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r
\r
+  @param  Value         Describes the current status of a hardware or software entity.  \r
+                        This included information about the class and subclass that is used to classify the entity \r
+                        as well as an operation.  For progress codes, the operation is the current activity. \r
+                        For error codes, it is the exception.  For debug codes, it is not defined at this time. \r
+                        Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below.  \r
+                        Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r
\r
+  @param  Instance      The enumeration of a hardware or software entity within the system.  \r
+                        A system may contain multiple entities that match a class/subclass pairing. \r
+                        The instance differentiates between them.  An instance of 0 indicates that instance information is unavailable, \r
+                        not meaningful, or not relevant.  Valid instance numbers start with 1.\r
+\r
+\r
+  @param  CallerId      This optional parameter may be used to identify the caller. \r
+                        This parameter allows the status code driver to apply different rules to different callers. \r
+                        Type EFI_GUID is defined in InstallProtocolInterface() in the EFI 1.10 Specification.\r
+\r
+\r
+  @param  Data          This optional parameter may be used to pass additional data\r
\r
+  @return               The function always return EFI_SUCCESS.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+OemHookStatusCodeReport (\r
+  IN EFI_STATUS_CODE_TYPE     CodeType,\r
+  IN EFI_STATUS_CODE_VALUE    Value,\r
+  IN UINT32                   Instance,\r
+  IN EFI_GUID                 *CallerId, OPTIONAL\r
+  IN EFI_STATUS_CODE_DATA     *Data      OPTIONAL\r
+  )\r
+{\r
+  CHAR8           *Filename;\r
+  CHAR8           *Description;\r
+  CHAR8           *Format;\r
+  CHAR8           Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE];\r
+  UINT32          ErrorLevel;\r
+  UINT32          LineNumber;\r
+  UINTN           CharCount;\r
+  VA_LIST         Marker;\r
+  EFI_DEBUG_INFO  *DebugInfo;\r
+\r
+  Buffer[0] = '\0';\r
+\r
+  if (Data != NULL &&\r
+      ReportStatusCodeExtractAssertInfo (CodeType, Value, Data, &Filename, &Description, &LineNumber)) {\r
+    //\r
+    // Print ASSERT() information into output buffer.\r
+    //\r
+    CharCount = AsciiSPrint (\r
+                  Buffer,\r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE,\r
+                  "\n\rASSERT!: %a (%d): %a\n\r",\r
+                  Filename,\r
+                  LineNumber,\r
+                  Description\r
+                  );\r
+\r
+    //\r
+    // Callout to standard output.\r
+    //\r
+    mWinNt->WriteFile (\r
+              mStdOut,\r
+              Buffer,\r
+              CharCount,\r
+              &CharCount,\r
+              NULL\r
+              );\r
+\r
+    return EFI_SUCCESS;\r
+\r
+  } else if (Data != NULL &&\r
+             ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {\r
+    //\r
+    // Print DEBUG() information into output buffer.\r
+    //\r
+    CharCount = AsciiVSPrint (\r
+                  Buffer, \r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+                  Format, \r
+                  Marker\r
+                  );\r
+  } else if (Data != NULL && \r
+             CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid) &&\r
+             (CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {\r
+    //\r
+    // Print specific data into output buffer.\r
+    //\r
+    DebugInfo = (EFI_DEBUG_INFO *) (Data + 1);\r
+    Marker    = (VA_LIST) (DebugInfo + 1);\r
+    Format    = (CHAR8 *) (((UINT64 *) Marker) + 12);\r
+\r
+    CharCount = AsciiVSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, Format, Marker);\r
+  } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {\r
+    //\r
+    // Print ERROR information into output buffer.\r
+    //\r
+    CharCount = AsciiSPrint (\r
+                  Buffer, \r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+                  "ERROR: C%x:V%x I%x", \r
+                  CodeType, \r
+                  Value, \r
+                  Instance\r
+                  );\r
+\r
+    //\r
+    // Make sure we don't try to print values that weren't intended to be printed, especially NULL GUID pointers.\r
+    //\r
+    \r
+    if (CallerId != NULL) {\r
+      CharCount += AsciiSPrint (\r
+                     &Buffer[CharCount - 1],\r
+                     (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                     " %g",\r
+                     CallerId\r
+                     );\r
+    }\r
+\r
+    if (Data != NULL) {\r
+      CharCount += AsciiSPrint (\r
+                     &Buffer[CharCount - 1],\r
+                     (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                     " %x",\r
+                     Data\r
+                     );\r
+    }\r
+\r
+    CharCount += AsciiSPrint (\r
+                   &Buffer[CharCount - 1],\r
+                   (EFI_STATUS_CODE_DATA_MAX_SIZE - (sizeof (Buffer[0]) * CharCount)),\r
+                   "\n\r"\r
+                   );\r
+  } else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) {\r
+    CharCount = AsciiSPrint (\r
+                  Buffer, \r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+                  "PROGRESS CODE: V%x I%x\n\r", \r
+                  Value, \r
+                  Instance\r
+                  );\r
+  } else {\r
+    CharCount = AsciiSPrint (\r
+                  Buffer, \r
+                  EFI_STATUS_CODE_DATA_MAX_SIZE, \r
+                  "Undefined: C%x:V%x I%x\n\r", \r
+                  CodeType, \r
+                  Value, \r
+                  Instance\r
+                  );\r
+  }\r
+\r
+  //\r
+  // Callout to standard output.\r
+  //\r
+  mWinNt->WriteFile (\r
+            mStdOut,\r
+            Buffer,\r
+            CharCount,\r
+            &CharCount,\r
+            NULL\r
+            );\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
diff --git a/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.inf b/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.inf
new file mode 100644 (file)
index 0000000..6c2fa7e
--- /dev/null
@@ -0,0 +1,109 @@
+#/** @file\r
+# Memory Status Code Library for UEFI drivers\r
+#\r
+# Lib to provide memory journal status code reporting Routines\r
+# Copyright (c) 2007, Intel Corporation.\r
+#\r
+#  All rights reserved.\r
+#  This software and associated documentation (if any) is furnished\r
+#  under a license and may only be used or copied in accordance\r
+#  with the terms of the license. Except as permitted by such\r
+#  license, no part of this software or documentation may be\r
+#  reproduced, stored in a retrieval system, or transmitted in any\r
+#  form or by any means without the express written consent of\r
+#  Intel Corporation.\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                      = PeiNt32OemHookStatusCodeLib\r
+  FILE_GUID                      = 0C2070F9-02A7-4e8e-B584-84EA922363FB\r
+  MODULE_TYPE                    = PEIM\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = OemHookStatusCodeLib|PEIM \r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32\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
+  Nt32OemHookStatusCodeLib.c\r
+  CommonHeader.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
+  Nt32Pkg/Nt32Pkg.dec\r
+  EdkModulePkg/EdkModulePkg.dec\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
+  PeiServicesLib\r
+  ReportStatusCodeLib\r
+  BaseMemoryLib\r
+  PrintLib\r
+  DebugLib\r
+\r
+\r
+################################################################################\r
+#\r
+# Guid C Name Section - list of Guids that this module uses or produces.\r
+#\r
+################################################################################\r
+\r
+[Guids]\r
+  gEfiStatusCodeSpecificDataGuid                # SOMETIMES_CONSUMED\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
+  gPeiNtThunkPpiGuid                            # PPI ALWAYS_CONSUMED\r
+\r
diff --git a/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.msa b/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.msa
new file mode 100644 (file)
index 0000000..b9c3a56
--- /dev/null
@@ -0,0 +1,68 @@
+<?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>PeiNt32OemHookStatusCodeLib</ModuleName>\r
+    <ModuleType>PEIM</ModuleType>\r
+    <GuidValue>0C2070F9-02A7-4e8e-B584-84EA922363FB</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>Memory Status Code Library for UEFI drivers</Abstract>\r
+    <Description>Lib to provide memory journal status code reporting Routines</Description>\r
+    <Copyright>Copyright (c) 2007, Intel Corporation.</Copyright>\r
+    <License>All rights reserved.
+      This software and associated documentation (if any) is furnished
+      under a license and may only be used or copied in accordance
+      with the terms of the license. Except as permitted by such
+      license, no part of this software or documentation may be
+      reproduced, stored in a retrieval system, or transmitted in any
+      form or by any means without the express written consent of
+      Intel Corporation.</License>\r
+    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>\r
+  </MsaHeader>\r
+  <ModuleDefinitions>\r
+    <SupportedArchitectures>IA32</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>PeiNt32OemHookStatusCodeLib</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="PEIM">\r
+      <Keyword>OemHookStatusCodeLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>DebugLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PrintLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>BaseMemoryLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>ReportStatusCodeLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PeiServicesLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>Nt32OemHookStatusCodeLib.c</Filename>\r
+  </SourceFiles>\r
+  <PackageDependencies>\r
+    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
+    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>\r
+  </PackageDependencies>\r
+  <PPIs>\r
+    <Ppi Usage="ALWAYS_CONSUMED">\r
+      <PpiCName>gPeiNtThunkPpiGuid</PpiCName>\r
+    </Ppi>\r
+  </PPIs>\r
+  <Guids>\r
+    <GuidCNames Usage="SOMETIMES_CONSUMED">\r
+      <GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>\r
+    </GuidCNames>\r
+  </Guids>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
index 64f67df..c16fb7a 100644 (file)
 #\r
 ################################################################################\r
 \r
-[LibraryClass.IA32.DXE_CORE]\r
-  TimerLib|$(WORKSPACE)\MdePkg\Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
+[LibraryClasses.IA32.DXE_CORE]\r
+  TimerLib|$(WORKSPACE)\MdePkg\Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
   EdkPeCoffLoaderLib|$(WORKSPACE)\Nt32Pkg\Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.inf\r
 \r
-[LibraryClass.IA32]\r
+[LibraryClasses.IA32]\r
   IoLib|$(WORKSPACE)\MdePkg\Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf\r
 \r
-[LibraryClass.IA32.DXE_SAL_DRIVER]\r
-  TimerLib|$(WORKSPACE)\MdePkg\Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
+[LibraryClasses.IA32.DXE_SAL_DRIVER]\r
+  TimerLib|$(WORKSPACE)\MdePkg\Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
   EdkFvbServiceLib|$(WORKSPACE)\MdeModulePkg\Library/EdkFvbServiceLib/EdkFvbServiceLib.inf\r
   OemHookStatusCodeLib|$(WORKSPACE)\Nt32Pkg\Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.inf\r
 \r
-[LibraryClass.IA32.DXE_SMM_DRIVER]\r
+[LibraryClasses.IA32.DXE_SMM_DRIVER]\r
   WinNtLib|$(WORKSPACE)\Nt32Pkg\Library/DxeWinNtLib/DxeWinNtLib.inf\r
   EdkFvbServiceLib|$(WORKSPACE)\MdeModulePkg\Library/EdkFvbServiceLib/EdkFvbServiceLib.inf\r
   OemHookStatusCodeLib|$(WORKSPACE)\Nt32Pkg\Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.inf\r
 \r
-[LibraryClass.IA32.PEIM]\r
-  TimerLib|$(WORKSPACE)\MdePkg\Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
+[LibraryClasses.IA32.PEIM]\r
+  TimerLib|$(WORKSPACE)\MdePkg\Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
   EdkPeCoffLoaderLib|$(WORKSPACE)\Nt32Pkg\Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.inf\r
   PeiServicesTablePointerLib|$(WORKSPACE)\MdePkg\Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointerLibMm7.inf\r
   OemHookStatusCodeLib|$(WORKSPACE)\Nt32Pkg\Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.inf\r
   PeCoffGetEntryPointLib|$(WORKSPACE)\Nt32Pkg\Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf\r
 \r
-[LibraryClass.IA32.PEI_CORE]\r
-  TimerLib|$(WORKSPACE)\MdePkg\Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
+[LibraryClasses.IA32.PEI_CORE]\r
+  TimerLib|$(WORKSPACE)\MdePkg\Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
   PeiServicesTablePointerLib|$(WORKSPACE)\MdePkg\Library/PeiServicesTablePointerLibMm7/PeiServicesTablePointerLibMm7.inf\r
   PeCoffGetEntryPointLib|$(WORKSPACE)\Nt32Pkg\Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf\r
 \r
-[LibraryClass.IA32.DXE_RUNTIME_DRIVER]\r
+[LibraryClasses.IA32.DXE_RUNTIME_DRIVER]\r
   WinNtLib|$(WORKSPACE)\Nt32Pkg\Library/DxeWinNtLib/DxeWinNtLib.inf\r
   EdkFvbServiceLib|$(WORKSPACE)\MdeModulePkg\Library/EdkFvbServiceLib/EdkFvbServiceLib.inf\r
   OemHookStatusCodeLib|$(WORKSPACE)\Nt32Pkg\Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.inf\r
 \r
-[LibraryClass.IA32.BASE]\r
-  TimerLib|$(WORKSPACE)\MdePkg\Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
+[LibraryClasses.IA32.BASE]\r
+  TimerLib|$(WORKSPACE)\MdePkg\Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
 \r
-[LibraryClass.IA32.SEC]\r
-  TimerLib|$(WORKSPACE)\MdePkg\Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
+[LibraryClasses.IA32.SEC]\r
+  TimerLib|$(WORKSPACE)\MdePkg\Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
 \r
-[LibraryClass.IA32.UEFI_DRIVER]\r
-  TimerLib|$(WORKSPACE)\MdePkg\Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
+[LibraryClasses.IA32.UEFI_DRIVER]\r
+  TimerLib|$(WORKSPACE)\MdePkg\Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
   WinNtLib|$(WORKSPACE)\Nt32Pkg\Library/DxeWinNtLib/DxeWinNtLib.inf\r
   EdkFvbServiceLib|$(WORKSPACE)\MdeModulePkg\Library/EdkFvbServiceLib/EdkFvbServiceLib.inf\r
   OemHookStatusCodeLib|$(WORKSPACE)\Nt32Pkg\Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.inf\r
 \r
-[LibraryClass.IA32.DXE_DRIVER]\r
-  TimerLib|$(WORKSPACE)\MdePkg\Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
+[LibraryClasses.IA32.DXE_DRIVER]\r
+  TimerLib|$(WORKSPACE)\MdePkg\Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
   WinNtLib|$(WORKSPACE)\Nt32Pkg\Library/DxeWinNtLib/DxeWinNtLib.inf\r
   EdkFvbServiceLib|$(WORKSPACE)\MdeModulePkg\Library/EdkFvbServiceLib/EdkFvbServiceLib.inf\r
   OemHookStatusCodeLib|$(WORKSPACE)\Nt32Pkg\Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.inf\r
   EdkGenericBdsLib|$(WORKSPACE)\Nt32Pkg\Library/EdkGenericBdsLib/EdkGenericBdsLib.inf\r
 \r
-[LibraryClass.IA32.UEFI_APPLICATION]\r
-  TimerLib|$(WORKSPACE)\MdePkg\Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf\r
+[LibraryClasses.IA32.UEFI_APPLICATION]\r
+  TimerLib|$(WORKSPACE)\MdePkg\Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
   WinNtLib|$(WORKSPACE)\Nt32Pkg\Library/DxeWinNtLib/DxeWinNtLib.inf\r
   EdkFvbServiceLib|$(WORKSPACE)\MdeModulePkg\Library/EdkFvbServiceLib/EdkFvbServiceLib.inf\r
   OemHookStatusCodeLib|$(WORKSPACE)\Nt32Pkg\Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.inf\r
 \r
-[LibraryClass.common.DXE_CORE]\r
+[LibraryClasses.common.DXE_CORE]\r
   DebugLib|$(WORKSPACE)\MdePkg\Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
   DevicePathLib|$(WORKSPACE)\MdePkg\Library/UefiDevicePathLib/UefiDevicePathLib.inf\r
   UefiDecompressLib|$(WORKSPACE)\MdeModulePkg\Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.inf\r
   ReportStatusCodeLib|$(WORKSPACE)\MdePkg\Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf\r
   TianoDecompressLib|$(WORKSPACE)\MdeModulePkg\Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.inf\r
 \r
-[LibraryClass.common]\r
+[LibraryClasses.common]\r
   TimerLib|$(WORKSPACE)\MdePkg\Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
   PrintLib|$(WORKSPACE)\MdePkg\Library/BasePrintLib/BasePrintLib.inf\r
   UefiDecompressLib|$(WORKSPACE)\MdeModulePkg\Library/BaseUefiTianoDecompressLib/BaseUefiTianoDecompressLib.inf\r
   PciIncompatibleDeviceSupportLib|$(WORKSPACE)\MdeModulePkg\Library/EdkPciIncompatibleDeviceSupportLib/EdkPciIncompatibleDeviceSupportLib.inf\r
   CacheMaintenanceLib|$(WORKSPACE)\MdePkg\Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf\r
 \r
-[LibraryClass.common.DXE_SAL_DRIVER]\r
+[LibraryClasses.common.DXE_SAL_DRIVER]\r
   DebugLib|$(WORKSPACE)\MdePkg\Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
   UefiRuntimeServicesTableLib|$(WORKSPACE)\MdePkg\Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf\r
   HobLib|$(WORKSPACE)\MdePkg\Library/DxeHobLib/DxeHobLib.inf\r
   EdkUsbLib|$(WORKSPACE)\MdeModulePkg\Library/EdkUsbLib/EdkUsbLib.inf\r
   EdkScsiLib|$(WORKSPACE)\MdeModulePkg\Library/EdkScsiLib/EdkScsiLib.inf\r
 \r
-[LibraryClass.common.DXE_SMM_DRIVER]\r
+[LibraryClasses.common.DXE_SMM_DRIVER]\r
   EdkUsbLib|$(WORKSPACE)\MdeModulePkg\Library/EdkUsbLib/EdkUsbLib.inf\r
   DebugLib|$(WORKSPACE)\MdePkg\Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
   DxeServicesTableLib|$(WORKSPACE)\MdePkg\Library/DxeServicesTableLib/DxeServicesTableLib.inf\r
   TianoDecompressLib|$(WORKSPACE)\MdeModulePkg\Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.inf\r
   UefiRuntimeServicesTableLib|$(WORKSPACE)\MdePkg\Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf\r
 \r
-[LibraryClass.common.PEIM]\r
+[LibraryClasses.common.PEIM]\r
   HobLib|$(WORKSPACE)\MdePkg\Library/PeiHobLib/PeiHobLib.inf\r
   PeiServicesTablePointerLib|$(WORKSPACE)\MdePkg\Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf\r
   PcdLib|$(WORKSPACE)\MdePkg\Library/PeiPcdLib/PeiPcdLib.inf\r
   MemoryAllocationLib|$(WORKSPACE)\MdePkg\Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf\r
   ReportStatusCodeLib|$(WORKSPACE)\MdePkg\Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf\r
 \r
-[LibraryClass.common.PEI_CORE]\r
+[LibraryClasses.common.PEI_CORE]\r
   HobLib|$(WORKSPACE)\MdePkg\Library/PeiHobLib/PeiHobLib.inf\r
   PeiServicesTablePointerLib|$(WORKSPACE)\MdePkg\Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf\r
   PcdLib|$(WORKSPACE)\MdePkg\Library/PeiPcdLib/PeiPcdLib.inf\r
   PeiCoreEntryPoint|$(WORKSPACE)\MdePkg\Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf\r
   ReportStatusCodeLib|$(WORKSPACE)\MdePkg\Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf\r
 \r
-[LibraryClass.common.DXE_RUNTIME_DRIVER]\r
+[LibraryClasses.common.DXE_RUNTIME_DRIVER]\r
   DebugLib|$(WORKSPACE)\MdePkg\Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
   UefiRuntimeServicesTableLib|$(WORKSPACE)\MdePkg\Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf\r
   HobLib|$(WORKSPACE)\MdePkg\Library/DxeHobLib/DxeHobLib.inf\r
   EdkScsiLib|$(WORKSPACE)\MdeModulePkg\Library/EdkScsiLib/EdkScsiLib.inf\r
   UefiDriverModelLib|$(WORKSPACE)\MdePkg\Library/UefiDriverModelLib/UefiDriverModelLib.inf\r
 \r
-[LibraryClass.common.UEFI_DRIVER]\r
+[LibraryClasses.common.UEFI_DRIVER]\r
   DebugLib|$(WORKSPACE)\MdePkg\Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
   UefiRuntimeServicesTableLib|$(WORKSPACE)\MdePkg\Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf\r
   HobLib|$(WORKSPACE)\MdePkg\Library/DxeHobLib/DxeHobLib.inf\r
   EdkScsiLib|$(WORKSPACE)\MdeModulePkg\Library/EdkScsiLib/EdkScsiLib.inf\r
   UefiDriverModelLib|$(WORKSPACE)\MdePkg\Library/UefiDriverModelLib/UefiDriverModelLib.inf\r
 \r
-[LibraryClass.common.DXE_DRIVER]\r
-  DebugLib|$(WORKSPACE)\MdePkg\Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
+[LibraryClasses.common.DXE_DRIVER]\r
+  DebugLib|$(WORKSPACE)\MdePkg\Library/BaseDebugLibNull/BaseDebugLibNull.inf\r
   UefiRuntimeServicesTableLib|$(WORKSPACE)\MdePkg\Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf\r
   HobLib|$(WORKSPACE)\MdePkg\Library/DxeHobLib/DxeHobLib.inf\r
   EdkIfrSupportLib|$(WORKSPACE)\MdeModulePkg\Library/EdkIfrSupportLib/EdkIfrSupportLib.inf\r
   UefiDriverEntryPoint|$(WORKSPACE)\MdePkg\Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf\r
   EdkGraphicsLib|$(WORKSPACE)\MdeModulePkg\Library/EdkGraphicsLib/EdkGraphicsLib.inf\r
   ReportStatusCodeLib|$(WORKSPACE)\MdePkg\Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf\r
-  PrintLib|$(WORKSPACE)\MdeModulePkg\Library/EdkDxePrintLib/EdkDxePrintLib.inf\r
+  PrintLib|$(WORKSPACE)\MdePkg\Library/BasePrintLib/BasePrintLib.inf\r
   DxeServicesTableLib|$(WORKSPACE)\MdePkg\Library/DxeServicesTableLib/DxeServicesTableLib.inf\r
   UefiDecompressLib|$(WORKSPACE)\MdeModulePkg\Library/DxeCoreUefiDecompressLibFromHob/DxeCoreUefiDecompressLibFromHob.inf\r
   HiiLib|$(WORKSPACE)\MdePkg\Library/HiiLib/HiiLib.inf\r
   UefiBootServicesTableLib|$(WORKSPACE)\MdePkg\Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf\r
   DevicePathLib|$(WORKSPACE)\MdePkg\Library/UefiDevicePathLib/UefiDevicePathLib.inf\r
-  BaseMemoryLib|$(WORKSPACE)\MdePkg\Library/DxeMemoryLib/DxeMemoryLib.inf\r
+  BaseMemoryLib|$(WORKSPACE)\MdePkg\Library/BaseMemoryLib/BaseMemoryLib.inf\r
   TianoDecompressLib|$(WORKSPACE)\MdeModulePkg\Library/DxeCoreTianoDecompressLibFromHob/DxeCoreTianoDecompressLibFromHob.inf\r
   EdkUsbLib|$(WORKSPACE)\MdeModulePkg\Library/EdkUsbLib/EdkUsbLib.inf\r
   EdkScsiLib|$(WORKSPACE)\MdeModulePkg\Library/EdkScsiLib/EdkScsiLib.inf\r
   UefiDriverModelLib|$(WORKSPACE)\MdePkg\Library/UefiDriverModelLib/UefiDriverModelLib.inf\r
 \r
-[LibraryClass.common.UEFI_APPLICATION]\r
+[LibraryClasses.common.UEFI_APPLICATION]\r
   EdkUsbLib|$(WORKSPACE)\MdeModulePkg\Library/EdkUsbLib/EdkUsbLib.inf\r
   DebugLib|$(WORKSPACE)\MdePkg\Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
   DxeServicesTableLib|$(WORKSPACE)\MdePkg\Library/DxeServicesTableLib/DxeServicesTableLib.inf\r
 #\r
 ################################################################################\r
 \r
-[PcdPatchableInModule.IA32]\r
+[PcdsPatchableInModule.IA32]\r
   PcdStatusCodeMemorySize|gEfiMdeModulePkgTokenSpaceGuid|1\r
   PcdStatusCodeRuntimeMemorySize|gEfiMdeModulePkgTokenSpaceGuid|128\r
 \r
-[PcdFixedAtBuild.IA32]\r
+[PcdsFixedAtBuild.IA32]\r
   PcdWinNtMemorySizeForSecMain|gEfiNt32PkgTokenSpaceGuid|L"64!64"|VOID*|10\r
   PcdWinNtFirmwareVolume|gEfiNt32PkgTokenSpaceGuid|L"..\\Fv\\Fv_Recovery.fd"|VOID*|52\r
   PcdWinNtBootMode|gEfiNt32PkgTokenSpaceGuid|1\r
   PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
   PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
   PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
   PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
   PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
   PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
   PcdPerformanceLibraryPropertyMask|gEfiMdePkgTokenSpaceGuid|0\r
   PcdMaxPeiPcdCallBackNumberPerPcdEntry|gEfiMdeModulePkgTokenSpaceGuid|0x08\r
   PcdVpdBaseAddress|gEfiMdeModulePkgTokenSpaceGuid|0x0\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdFSBClock|gEfiMdePkgTokenSpaceGuid|200000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdPerformanceLibraryPropertyMask|gEfiMdePkgTokenSpaceGuid|0\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdVpdBaseAddress|gEfiMdeModulePkgTokenSpaceGuid|0x0\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdPerformanceLibraryPropertyMask|gEfiMdePkgTokenSpaceGuid|0\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
+\r
+\r
+[PcdsFeatureFlag.IA32]\r
+  PcdPeiPcdDatabaseTraverseEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
+  PcdPeiPcdDatabaseCallbackOnSetEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
+  PcdPeiPcdDatabaseExEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
+  PcdPeiPcdDatabaseGetSizeEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
+  PcdPeiPcdDatabaseSetEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
+  PcdStatusCodeUseSerial|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
+  PcdStatusCodeUseMemory|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
+  PcdStatusCodeUseOEM|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
+  PcdDxeIplSwitchToLongMode|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
+  PcdDxeIplSupportEfiDecompress|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
+  PcdDxeIplSupportTianoDecompress|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
+  PcdDxeIplSupportCustomDecompress|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
+  PcdDxeIplBuildShareCodeHobs|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
+  PcdDxePcdDatabaseTraverseEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
+  PcdStatusCodeUseHardSerial|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
+  PcdStatusCodeUseEfiSerial|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
+  PcdStatusCodeUseRuntimeMemory|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
+  PcdStatusCodeUseDataHub|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
+  PcdStatusCodeUseOEM|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
+  PcdStatusCodeReplayInSerial|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
+  PcdStatusCodeReplayInDataHub|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
+  PcdStatusCodeReplayInRuntimeMemory|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
+  PcdStatusCodeReplayInOEM|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
+  PcdSupportUpdateCapsuleRest|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
+  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
+  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
+  PcdNtEmulatorEnable|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
+  PcdDevicePathSupportDevicePathToText|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
+  PcdDevicePathSupportDevicePathFromText|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
+  PcdPciBusHotplugDeviceSupport|gEfiGenericPlatformTokenSpaceGuid|TRUE\r
+  PcdComponentName2Disable|gEfiMdePkgTokenSpaceGuid|TRUE\r
   PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaxSizePopulateCapsule|gEfiMdeModulePkgTokenSpaceGuid|0x0\r
-  PcdMaxSizeNonPopulateCapsule|gEfiMdeModulePkgTokenSpaceGuid|0x0\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdPciIncompatibleDeviceSupportMask|gEfiMdeModulePkgTokenSpaceGuid|0x0\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdPerformanceLibraryPropertyMask|gEfiMdePkgTokenSpaceGuid|0\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1F\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-  PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumAsciiStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdMaximumLinkedListLength|gEfiMdePkgTokenSpaceGuid|1000000\r
-  PcdSpinLockTimeout|gEfiMdePkgTokenSpaceGuid|10000000\r
-  PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
-  PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
-  PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320\r
-\r
-[PcdFeatureFlag.IA32]\r
-  PcdPeiPcdDatabaseTraverseEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
-  PcdPeiPcdDatabaseCallbackOnSetEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
-  PcdPeiPcdDatabaseExEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
-  PcdPeiPcdDatabaseGetSizeEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
-  PcdPeiPcdDatabaseSetEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
-  PcdStatusCodeUseSerial|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
-  PcdStatusCodeUseMemory|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
-  PcdStatusCodeUseOEM|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
-  PcdDxeIplSwitchToLongMode|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
-  PcdDxeIplSupportEfiDecompress|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
-  PcdDxeIplSupportTianoDecompress|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
-  PcdDxeIplSupportCustomDecompress|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
-  PcdDxeIplBuildShareCodeHobs|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
-  PcdDxePcdDatabaseTraverseEnabled|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
-  PcdStatusCodeUseHardSerial|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
-  PcdStatusCodeUseEfiSerial|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
-  PcdStatusCodeUseRuntimeMemory|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
-  PcdStatusCodeUseDataHub|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
-  PcdStatusCodeUseOEM|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
-  PcdStatusCodeReplayInSerial|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
-  PcdStatusCodeReplayInDataHub|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
-  PcdStatusCodeReplayInRuntimeMemory|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
-  PcdStatusCodeReplayInOEM|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
-  PcdSupportUpdateCapsuleRest|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdNtEmulatorEnable|gEfiMdeModulePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDevicePathSupportDevicePathToText|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
-  PcdDevicePathSupportDevicePathFromText|gEfiMdeModulePkgTokenSpaceGuid|TRUE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdPciIsaEnable|gEfiGenericPlatformTokenSpaceGuid|FALSE\r
-  PcdPciVgaEnable|gEfiGenericPlatformTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdPciBusHotplugDeviceSupport|gEfiGenericPlatformTokenSpaceGuid|TRUE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdComponentNameDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-  PcdDriverDiagnosticsDisable|gEfiMdePkgTokenSpaceGuid|FALSE\r
-\r
+  PcdDriverDiagnostics2Disable|gEfiMdePkgTokenSpaceGuid|TRUE\r
 \r
 ################################################################################\r
 #\r
 #\r
 ################################################################################\r
 \r
-[PcdDynamic.DEFAULT]\r
+[PcdsDynamic.DEFAULT]\r
   PcdFlashNvStorageFtwSpareBase|gEfiGenericPlatformTokenSpaceGuid|0x0\r
   PcdFlashNvStorageVariableSize|gEfiGenericPlatformTokenSpaceGuid|0x0\r
   PcdWinNtCpuSpeed|gEfiNt32PkgTokenSpaceGuid|L"3000"|8\r
 ################################################################################\r
 \r
 [Components.IA32]\r
+  $(WORKSPACE)\Nt32Pkg\WinNtThunkDxe\WinNtThunk.inf
\ No newline at end of file
index 6afdf90..812e452 100644 (file)
@@ -73,7 +73,7 @@
   gEfiWinNtFileSystemGuid        = { 0x0C95A935, 0xA006, 0x11D4, { 0xBC, 0xFA, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}\r
   gEfiWinNtPhysicalDisksGuid     = { 0x0C95A92F, 0xA006, 0x11D4, { 0xBC, 0xFA, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}\r
   gEfiWinNtVirtualDisksGuid      = { 0x0C95A928, 0xA006, 0x11D4, { 0xBC, 0xFA, 0x00, 0x80, 0xC7, 0x3C, 0x88, 0x81 }}\r
-  gEfiEdkNt32PkgTokenSpaceGuid   = { 0x0D79A645, 0x1D91, 0x40a6, { 0xA8, 0x1F, 0x61, 0xE6, 0x98, 0x2B, 0x32, 0xB4 }}\r
+  gEfiNt32PkgTokenSpaceGuid   = { 0x0D79A645, 0x1D91, 0x40a6, { 0xA8, 0x1F, 0x61, 0xE6, 0x98, 0x2B, 0x32, 0xB4 }}\r
 \r
 \r
 ################################################################################\r
 ################################################################################\r
 \r
 [PcdFixedAtBuild.common]\r
-  PcdWinNtBootMode|0x00001006|gEfiEdkNt32PkgTokenSpaceGuid|UINT32|1\r
-  PcdWinNtFirmwareVolume|0x00001009|gEfiEdkNt32PkgTokenSpaceGuid|VOID*|L"..\\Fv\\Fv_Recovery.fd"\r
-  PcdWinNtMemorySizeForSecMain|0x0000100c|gEfiEdkNt32PkgTokenSpaceGuid|VOID*|L"64!64"\r
+  PcdWinNtBootMode|0x00001006|gEfiNt32PkgTokenSpaceGuid|UINT32|1\r
+  PcdWinNtFirmwareVolume|0x00001009|gEfiNt32PkgTokenSpaceGuid|VOID*|L"..\\Fv\\Fv_Recovery.fd"\r
+  PcdWinNtMemorySizeForSecMain|0x0000100c|gEfiNt32PkgTokenSpaceGuid|VOID*|L"64!64"\r
 \r
 [PcdDynamic.common]\r
-  PcdWinNtPhysicalDisk|0x00001000|gEfiEdkNt32PkgTokenSpaceGuid|VOID*|L"E:RW;245760;512"\r
-  PcdWinNtVirtualDisk|0x00001001|gEfiEdkNt32PkgTokenSpaceGuid|VOID*|L"FW;40960;512"\r
-  PcdWinNtSerialPort|0x00001002|gEfiEdkNt32PkgTokenSpaceGuid|VOID*|L"COM1!COM2"\r
-  PcdWinNtUga|0x00001003|gEfiEdkNt32PkgTokenSpaceGuid|VOID*|L"UGA Window 1!UGA Window 2"\r
-  PcdWinNtFileSystem|0x00001004|gEfiEdkNt32PkgTokenSpaceGuid|VOID*|L".!..\\..\\..\\..\\EdkShellBinPkg\\bin\\ia32\\Apps"\r
-  PcdWinNtMemorySize|0x00001005|gEfiEdkNt32PkgTokenSpaceGuid|VOID*|L"64!64"\r
-  PcdWinNtCpuModel|0x00001007|gEfiEdkNt32PkgTokenSpaceGuid|VOID*|L"Intel(R) Processor Model"\r
-  PcdWinNtCpuSpeed|0x00001008|gEfiEdkNt32PkgTokenSpaceGuid|VOID*|L"3000"\r
-  PcdWinNtConsole|0x0000100a|gEfiEdkNt32PkgTokenSpaceGuid|VOID*|L"Bus Driver Console Window"\r
-  PcdWinNtGop|0x0000100d|gEfiEdkNt32PkgTokenSpaceGuid|VOID*|L"UGA Window 1!UGA Window 2"\r
+  PcdWinNtPhysicalDisk|0x00001000|gEfiNt32PkgTokenSpaceGuid|VOID*|L"E:RW;245760;512"\r
+  PcdWinNtVirtualDisk|0x00001001|gEfiNt32PkgTokenSpaceGuid|VOID*|L"FW;40960;512"\r
+  PcdWinNtSerialPort|0x00001002|gEfiNt32PkgTokenSpaceGuid|VOID*|L"COM1!COM2"\r
+  PcdWinNtUga|0x00001003|gEfiNt32PkgTokenSpaceGuid|VOID*|L"UGA Window 1!UGA Window 2"\r
+  PcdWinNtFileSystem|0x00001004|gEfiNt32PkgTokenSpaceGuid|VOID*|L".!..\\..\\..\\..\\EdkShellBinPkg\\bin\\ia32\\Apps"\r
+  PcdWinNtMemorySize|0x00001005|gEfiNt32PkgTokenSpaceGuid|VOID*|L"64!64"\r
+  PcdWinNtCpuModel|0x00001007|gEfiNt32PkgTokenSpaceGuid|VOID*|L"Intel(R) Processor Model"\r
+  PcdWinNtCpuSpeed|0x00001008|gEfiNt32PkgTokenSpaceGuid|VOID*|L"3000"\r
+  PcdWinNtConsole|0x0000100a|gEfiNt32PkgTokenSpaceGuid|VOID*|L"Bus Driver Console Window"\r
+  PcdWinNtGop|0x0000100d|gEfiNt32PkgTokenSpaceGuid|VOID*|L"UGA Window 1!UGA Window 2"\r
 \r
 [PcdPatchableInModule.common]\r
-  PcdWinNtBootMode|0x00001006|gEfiEdkNt32PkgTokenSpaceGuid|UINT32|1\r
-  PcdWinNtFirmwareVolume|0x00001009|gEfiEdkNt32PkgTokenSpaceGuid|VOID*|L"..\\Fv\\Fv_Recovery.fd"\r
-  PcdWinNtMemorySizeForSecMain|0x0000100c|gEfiEdkNt32PkgTokenSpaceGuid|VOID*|L"64!64"
\ No newline at end of file
+  PcdWinNtBootMode|0x00001006|gEfiNt32PkgTokenSpaceGuid|UINT32|1\r
+  PcdWinNtFirmwareVolume|0x00001009|gEfiNt32PkgTokenSpaceGuid|VOID*|L"..\\Fv\\Fv_Recovery.fd"\r
+  PcdWinNtMemorySizeForSecMain|0x0000100c|gEfiNt32PkgTokenSpaceGuid|VOID*|L"64!64"
\ No newline at end of file
diff --git a/Nt32Pkg/WinNtThunkDxe/CommonHeader.h b/Nt32Pkg/WinNtThunkDxe/CommonHeader.h
new file mode 100644 (file)
index 0000000..4faebd7
--- /dev/null
@@ -0,0 +1,37 @@
+/**@file\r
+  Common header file shared by all source files.\r
+\r
+  This file includes package header files, library classes and protocol, PPI & GUID definitions.\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
+   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
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiDxe.h>\r
+#include <WinNtDxe.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Protocol/WinNtThunk.h>\r
+#include <Protocol/DevicePath.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiDriverEntryPoint.h>\r
+#include <Library/WinNtLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+\r
+#endif\r
diff --git a/Nt32Pkg/WinNtThunkDxe/WinNtThunk.c b/Nt32Pkg/WinNtThunkDxe/WinNtThunk.c
new file mode 100644 (file)
index 0000000..b803e41
--- /dev/null
@@ -0,0 +1,92 @@
+/*++\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
+  WinNtThunk.c\r
+\r
+Abstract:\r
+\r
+  Produce WinNtThunk protocol and it's associated device path and controller \r
+  state protocols. WinNtThunk is to the NT emulation environment as \r
+  PCI_ROOT_BRIGE is to real hardware. The WinNtBusDriver is the child of this\r
+  driver.\r
+\r
+  Since we are a root hardware abstraction we do not install a Driver Binding\r
+  protocol on this handle. This driver can only support one one WinNtThunk protocol\r
+  in the system, since the device path is hard coded.\r
+\r
+--*/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+#include "WinNtThunk.h"\r
+\r
+//\r
+// WinNtThunk Device Path Protocol Instance\r
+//\r
+static WIN_NT_THUNK_DEVICE_PATH mWinNtThunkDevicePath = {\r
+  {\r
+    HARDWARE_DEVICE_PATH,\r
+    HW_VENDOR_DP,\r
+    (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r
+    (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),\r
+    EFI_WIN_NT_THUNK_PROTOCOL_GUID,\r
+  },\r
+  {\r
+    END_DEVICE_PATH_TYPE,\r
+    END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
+    END_DEVICE_PATH_LENGTH,\r
+    0\r
+  }\r
+};\r
+\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeWinNtThunk (\r
+  IN EFI_HANDLE                            ImageHandle,\r
+  IN EFI_SYSTEM_TABLE                      *SystemTable\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+  Install WinNtThunk Protocol and it's associated Device Path protocol\r
+\r
+Arguments:\r
+  (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)\r
+\r
+Returns:\r
+  EFI_SUCEESS - WinNtThunk protocol is added or error status from \r
+                gBS->InstallMultiProtocolInterfaces().\r
+\r
+--*/\r
+// TODO:    ImageHandle - add argument and description to function comment\r
+// TODO:    SystemTable - add argument and description to function comment\r
+{\r
+  EFI_STATUS  Status;\r
+  EFI_HANDLE  ControllerHandle;\r
+\r
+  ControllerHandle = NULL;\r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
+                  &ControllerHandle,\r
+                  &gEfiWinNtThunkProtocolGuid,\r
+                  gWinNt,\r
+                  &gEfiDevicePathProtocolGuid,\r
+                  &mWinNtThunkDevicePath,\r
+                  NULL\r
+                  );\r
+\r
+  return Status;\r
+}\r
diff --git a/Nt32Pkg/WinNtThunkDxe/WinNtThunk.dxs b/Nt32Pkg/WinNtThunkDxe/WinNtThunk.dxs
new file mode 100644 (file)
index 0000000..162c341
--- /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
+  WinNtThunk.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/Nt32Pkg/WinNtThunkDxe/WinNtThunk.h b/Nt32Pkg/WinNtThunkDxe/WinNtThunk.h
new file mode 100644 (file)
index 0000000..e52e0e1
--- /dev/null
@@ -0,0 +1,38 @@
+/*++\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
+  WinNtThunk.h\r
+\r
+Abstract:\r
+\r
+--*/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+#ifndef _WIN_NT_THUNK_H_\r
+#define _WIN_NT_THUNK_H_\r
+\r
+// TODO: add protective #ifndef\r
+\r
+\r
+//\r
+// WinNtThunk Device Path Protocol Instance Type\r
+//\r
+typedef struct {\r
+  VENDOR_DEVICE_PATH        Vendor;\r
+  EFI_DEVICE_PATH_PROTOCOL  EndDevicePath;\r
+} WIN_NT_THUNK_DEVICE_PATH;\r
+\r
+#endif
\ No newline at end of file
diff --git a/Nt32Pkg/WinNtThunkDxe/WinNtThunk.inf b/Nt32Pkg/WinNtThunkDxe/WinNtThunk.inf
new file mode 100644 (file)
index 0000000..a194d66
--- /dev/null
@@ -0,0 +1,98 @@
+#/** @file\r
+# A DXE driver to produce EFI_WIN_NT_THUNK_PROTOCOL\r
+#\r
+# EFI_WIN_NT_THUNK_PROTOCOL is a table of pointers to various Windows APIs used by various drivers to accomplish certain task in an NT32 emulator.\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                      = WinNtThunk\r
+  FILE_GUID                      = 0C95A916-A006-11d4-BCFA-0080C73C8881\r
+  MODULE_TYPE                    = DXE_DRIVER\r
+  VERSION_STRING                 = 1.0\r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+  ENTRY_POINT                    = InitializeWinNtThunk\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32\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
+  WinNtThunk.dxs\r
+  WinNtThunk.c\r
+  WinNtThunk.h\r
+  CommonHeader.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
+  $(WORKSPACE)/Nt32Pkg/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
+  Nt32Pkg/Nt32Pkg.dec\r
+\r
+################################################################################\r
+#\r
+# Library Class Section - list of Library Classes that are required for\r
+#                         this module.\r
+#\r
+################################################################################\r
+\r
+[LibraryClasses]\r
+  UefiBootServicesTableLib\r
+  WinNtLib\r
+  UefiDriverEntryPoint\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
+  gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_PRODUCED\r
+  gEfiWinNtThunkProtocolGuid                    # PROTOCOL ALWAYS_PRODUCED\r
+\r
diff --git a/Nt32Pkg/WinNtThunkDxe/WinNtThunk.msa b/Nt32Pkg/WinNtThunkDxe/WinNtThunk.msa
new file mode 100644 (file)
index 0000000..223f4e6
--- /dev/null
@@ -0,0 +1,62 @@
+<?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>WinNtThunk</ModuleName>\r
+    <ModuleType>DXE_DRIVER</ModuleType>\r
+    <GuidValue>0C95A916-A006-11d4-BCFA-0080C73C8881</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>A DXE driver to produce EFI_WIN_NT_THUNK_PROTOCOL</Abstract>\r
+    <Description>EFI_WIN_NT_THUNK_PROTOCOL is a table of pointers to various Windows APIs used by various drivers to accomplish certain task in an NT32 emulator.</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</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>WinNtThunk</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>WinNtLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiBootServicesTableLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>WinNtThunk.h</Filename>\r
+    <Filename>WinNtThunk.c</Filename>\r
+    <Filename>WinNtThunk.dxs</Filename>\r
+  </SourceFiles>\r
+  <PackageDependencies>\r
+    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>\r
+  </PackageDependencies>\r
+  <Protocols>\r
+    <Protocol Usage="ALWAYS_PRODUCED">\r
+      <ProtocolCName>gEfiWinNtThunkProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="ALWAYS_PRODUCED">\r
+      <ProtocolCName>gEfiDevicePathProtocolGuid</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>InitializeWinNtThunk</ModuleEntryPoint>\r
+    </Extern>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file