Porting WinNtFwhPei and WinNtFlashMapPei to produce FvHob.
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 5 Jul 2007 15:27:43 +0000 (15:27 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 5 Jul 2007 15:27:43 +0000 (15:27 +0000)
Help to build DxeCore in Nt32Pkg platform.
Fix the wrong DebugLib used in Nt32Pkg platform.

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

13 files changed:
MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
MdeModulePkg/Include/Guid/FlashMapHob.h [new file with mode: 0644]
MdeModulePkg/Include/Ppi/FlashMap.h [new file with mode: 0644]
MdeModulePkg/MdeModulePkg.dec
Nt32Pkg/Nt32Pkg.dsc
Nt32Pkg/Nt32Pkg.fdf
Nt32Pkg/WinNtFirmwareVolumePei/WinNtFwh.dxs [new file with mode: 0644]
Nt32Pkg/WinNtFirmwareVolumePei/WinNtFwh.inf [new file with mode: 0644]
Nt32Pkg/WinNtFirmwareVolumePei/WinNtFwh.msa [new file with mode: 0644]
Nt32Pkg/WinNtFirmwareVolumePei/WinntFwh.c [new file with mode: 0644]
Nt32Pkg/WinNtFlashMapPei/FlashMap.c [new file with mode: 0644]
Nt32Pkg/WinNtFlashMapPei/FlashMap.inf [new file with mode: 0644]
Nt32Pkg/WinNtFlashMapPei/FlashMap.msa [new file with mode: 0644]

index 96e578f..19b2b49 100644 (file)
@@ -95,7 +95,7 @@
   CustomDecompressLib\r
   TianoDecompressLib\r
   UefiDecompressLib\r
-  EdkPeCoffLoaderLib\r
+  PeCoffLoaderLib\r
   CacheMaintenanceLib\r
   ReportStatusCodeLib\r
   PeiServicesLib\r
diff --git a/MdeModulePkg/Include/Guid/FlashMapHob.h b/MdeModulePkg/Include/Guid/FlashMapHob.h
new file mode 100644 (file)
index 0000000..a9e9b67
--- /dev/null
@@ -0,0 +1,33 @@
+/*++\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
+  FlashMapHob.h\r
+    \r
+Abstract:\r
+\r
+  GUID used for Flash Map HOB entries in the HOB list.\r
+\r
+--*/\r
+\r
+#ifndef _FLASH_MAP_HOB_GUID_H_\r
+#define _FLASH_MAP_HOB_GUID_H_\r
+\r
+//\r
+// Definitions for Flash Map\r
+//\r
+#define EFI_FLASH_MAP_HOB_GUID \\r
+  { 0xb091e7d2, 0x5a0, 0x4198, {0x94, 0xf0, 0x74, 0xb7, 0xb8, 0xc5, 0x54, 0x59 } }\r
+\r
+extern EFI_GUID gEfiFlashMapHobGuid;\r
+\r
+#endif // _FLASH_MAP_HOB_GUID_H_\r
diff --git a/MdeModulePkg/Include/Ppi/FlashMap.h b/MdeModulePkg/Include/Ppi/FlashMap.h
new file mode 100644 (file)
index 0000000..c979978
--- /dev/null
@@ -0,0 +1,54 @@
+/*++\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
+  FlashMap.h\r
+\r
+Abstract:\r
+\r
+  FlashMap PPI defined in Tiano\r
+\r
+  This code abstracts FlashMap access\r
+\r
+--*/\r
+\r
+#ifndef _PEI_FLASH_MAP_PPI_H_\r
+#define _PEI_FLASH_MAP_PPI_H_\r
+\r
+#include <common/FlashMap.h>\r
+\r
+#define PEI_FLASH_MAP_PPI_GUID \\r
+  { 0xf34c2fa0, 0xde88, 0x4270, {0x84, 0x14, 0x96, 0x12, 0x22, 0xf4, 0x52, 0x1c } }\r
+\r
+typedef struct _PEI_FLASH_MAP_PPI PEI_FLASH_MAP_PPI;\r
+//\r
+// Functions\r
+//\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *PEI_GET_FLASH_AREA_INFO) (\r
+  IN  EFI_PEI_SERVICES            **PeiServices,\r
+  IN  PEI_FLASH_MAP_PPI            *This,\r
+  IN  EFI_FLASH_AREA_TYPE         AreaType,\r
+  IN  EFI_GUID                    *AreaTypeGuid,\r
+  OUT UINT32                      *NumEntries,\r
+  OUT EFI_FLASH_SUBAREA_ENTRY     **Entries\r
+  );\r
+\r
+\r
+struct _PEI_FLASH_MAP_PPI {\r
+  PEI_GET_FLASH_AREA_INFO GetAreaInfo;\r
+};\r
+\r
+extern EFI_GUID gPeiFlashMapPpiGuid;\r
+\r
+#endif \r
index b4b46d9..76cff82 100644 (file)
@@ -69,7 +69,7 @@
   gEfiPeiCorePrivateGuid         = { 0xd641a0f5, 0xcb7c, 0x4846, { 0xa3, 0x80, 0x1d, 0x01, 0xb4, 0xd9, 0xe3, 0xb9 }}\r
   gEfiEndOfPeiSignalPpiGuid      = { 0x605EA650, 0xC65C, 0x42e1, { 0xBA, 0x80, 0x91, 0xA5, 0x2A, 0xB6, 0x18, 0xC6 }}\r
   gEfiPeiFvFileLoaderPpiGuid     = { 0x7e1f0d85, 0x04ff, 0x4bb2, { 0x86, 0x6a, 0x31, 0xa2, 0x99, 0x6a, 0x48, 0xa8 }}\r
-\r
+  \r
   \r
 ################################################################################\r
 #\r
 [Ppis.common]\r
   gPeiBaseMemoryTestPpiGuid      = { 0xB6EC423C, 0x21D2, 0x490D, { 0x85, 0xC6, 0xDD, 0x58, 0x64, 0xEA, 0xA6, 0x74 }}\r
   gEfiPeiFvFileLoaderPpiGuid     = { 0x7e1f0d85, 0x04ff, 0x4bb2, { 0x86, 0x6a, 0x31, 0xa2, 0x99, 0x6a, 0x48, 0xa8 }} \r
-\r
+  ##gPeiFlashMapPpiGuid will be removed in future\r
+  gPeiFlashMapPpiGuid            = { 0xf34c2fa0, 0xde88, 0x4270, {0x84, 0x14, 0x96, 0x12, 0x22, 0xf4, 0x52, 0x1c } }\r
 \r
 ################################################################################\r
 #\r
index 80846fe..3ddac71 100644 (file)
@@ -63,7 +63,7 @@
 [LibraryClasses.common]\r
   TimerLib|$(WORKSPACE)/MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf\r
   PrintLib|$(WORKSPACE)/MdePkg/Library/BasePrintLib/BasePrintLib.inf\r
-  DebugLib|$(WORKSPACE)/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf\r
+  DebugLib|$(WORKSPACE)/IntelFrameworkPkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf\r
   SerialPortLib|$(WORKSPACE)/MdePkg/Library/SerialPortLibNull/SerialPortLibNull.inf\r
   BaseMemoryLib|$(WORKSPACE)/MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf\r
   BaseLib|$(WORKSPACE)/MdePkg/Library/BaseLib/BaseLib.inf\r
@@ -88,9 +88,9 @@
   MemoryAllocationLib|$(WORKSPACE)/MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf\r
   UefiLib|$(WORKSPACE)/MdePkg/Library/UefiLib/UefiLib.inf\r
   ReportStatusCodeLib|$(WORKSPACE)/IntelFrameworkPkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf\r
-  EdkPeCoffLoaderLib|$(WORKSPACE)/Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.inf\r
+  PeCoffLoaderLib|$(WORKSPACE)/Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.inf\r
   PcdLib|$(WORKSPACE)/MdePkg/Library/DxePcdLib/DxePcdLib.inf\r
-\r
+  UefiRuntimeServicesTableLib|$(WORKSPACE)/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf\r
 \r
 \r
 [LibraryClasses.common.DXE_SMM_DRIVER]\r
   PeiServicesLib|$(WORKSPACE)/MdePkg/Library/PeiServicesLib/PeiServicesLib.inf\r
   MemoryAllocationLib|$(WORKSPACE)/MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf\r
   ReportStatusCodeLib|$(WORKSPACE)/IntelFrameworkPkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf\r
-  EdkPeCoffLoaderLib|$(WORKSPACE)/Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.inf\r
+  PeCoffLoaderLib|$(WORKSPACE)/Nt32Pkg/Library/Nt32PeCoffLoaderLib/Nt32PeCoffLoaderLib.inf\r
   PeiServicesTablePointerLib|$(WORKSPACE)/MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf\r
   OemHookStatusCodeLib|$(WORKSPACE)/Nt32Pkg/Library/PeiNt32OemHookStatusCodeLib/PeiNt32OemHookStatusCodeLib.inf\r
   PeCoffGetEntryPointLib|$(WORKSPACE)/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf\r
   PcdReportStatusCodePropertyMask|gEfiMdePkgTokenSpaceGuid|0x06\r
   PcdDebugPropertyMask|gEfiMdePkgTokenSpaceGuid|0x1f\r
   PcdDebugClearMemoryValue|gEfiMdePkgTokenSpaceGuid|0xAF\r
-  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000000\r
+  PcdDebugPrintErrorLevel|gEfiMdePkgTokenSpaceGuid|0x80000040\r
   PcdPerformanceLibraryPropertyMask|gEfiMdePkgTokenSpaceGuid|0\r
   PcdMaxPeiPcdCallBackNumberPerPcdEntry|gEfiMdeModulePkgTokenSpaceGuid|0x08\r
   PcdVpdBaseAddress|gEfiEdkModulePkgTokenSpaceGuid|0x0\r
   $(WORKSPACE)/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.inf    ##This driver follows UEFI specification definition\r
   $(WORKSPACE)/Nt32Pkg/Sec/SecMain.inf\r
   $(WORKSPACE)/MdeModulePkg/Core/Pei/PeiMain.inf\r
-  ${WORKSPACE}/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.inf\r
-  ${WORKSPACE}/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.inf\r
-  ${WORKSPACE}/MdeModulePkg/Universal/DevicePathDxe/DevicePath.inf\r
-  ${WORKSPACE}/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.inf\r
-  ${WORKSPACE}/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf\r
-  ${WORKSPACE}/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.inf  \r
+  $(WORKSPACE)/MdeModulePkg/Core/Dxe/DxeMain.inf\r
+  $(WORKSPACE)/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.inf\r
+  $(WORKSPACE)/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.inf\r
+  $(WORKSPACE)/MdeModulePkg/Universal/DevicePathDxe/DevicePath.inf\r
+  $(WORKSPACE)/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.inf\r
+  $(WORKSPACE)/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf\r
+  $(WORKSPACE)/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.inf  \r
+  $(WORKSPACE)/Nt32Pkg/WinNtFlashMapPei/FlashMap.inf\r
+  $(WORKSPACE)/Nt32Pkg/WinNtFirmwareVolumePei/WinNtFwh.inf
\ No newline at end of file
index 6b6a622..7784575 100644 (file)
@@ -110,6 +110,7 @@ READ_LOCK_STATUS   = TRUE
 #\r
 ################################################################################\r
 INF  $(WORKSPACE)/MdeModulePkg/Core/Pei/PeiMain.inf\r
+INF  $(WORKSPACE)/MdeModulePkg/Core/Dxe/DxeMain.inf\r
 INF  $(WORKSPACE)/Nt32Pkg/BootModePei/BootMode.inf\r
 INF  $(WORKSPACE)/Nt32Pkg/WinNtThunkDxe/WinNtThunk.inf\r
 #INF  $(WORKSPACE)/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriver.inf\r
@@ -160,6 +161,8 @@ INF  $(WORKSPACE)/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.inf     ##This driver
 INF  $(WORKSPACE)/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.inf    ##This driver follows UEFI specification definition\r
 INF  $(WORKSPACE)/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf\r
 INF  $(WORKSPACE)/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.inf  \r
+INF  $(WORKSPACE)/Nt32Pkg/WinNtFlashMapPei/FlashMap.inf\r
+INF  $(WORKSPACE)/Nt32Pkg/WinNtFirmwareVolumePei/WinNtFwh.inf\r
 \r
 ################################################################################\r
 #\r
diff --git a/Nt32Pkg/WinNtFirmwareVolumePei/WinNtFwh.dxs b/Nt32Pkg/WinNtFirmwareVolumePei/WinNtFwh.dxs
new file mode 100644 (file)
index 0000000..b69c227
--- /dev/null
@@ -0,0 +1,33 @@
+/*++\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
+  WinNtFwh.dxs\r
+\r
+Abstract:\r
+\r
+  Dependency expression file for WinNtFwh PEIM.\r
+\r
+--*/  \r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+#include <PeimDepex.h>\r
+\r
+DEPENDENCY_START\r
+  NT_FWH_PPI_GUID AND EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID\r
+DEPENDENCY_END\r
+\r
+\r
diff --git a/Nt32Pkg/WinNtFirmwareVolumePei/WinNtFwh.inf b/Nt32Pkg/WinNtFirmwareVolumePei/WinNtFwh.inf
new file mode 100644 (file)
index 0000000..d90d818
--- /dev/null
@@ -0,0 +1,96 @@
+#/** @file\r
+# Component description file for WinNtFwh module\r
+#\r
+# This PEIM will produce the HOB to describe Firmware Volume, Firmware Devices\r
+#  on the 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                      = WinNtFwh\r
+  FILE_GUID                      = F0384FFD-8633-452f-9010-F6B7D2EAE2F1\r
+  MODULE_TYPE                    = PEIM\r
+  VERSION_STRING                 = 1.0\r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+  ENTRY_POINT                    = PeimInitializeWinNtFwh\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+  WinntFwh.c\r
+\r
+\r
+################################################################################\r
+#\r
+# Includes Section - list of Include locations that are required for\r
+#                    this module.\r
+#\r
+################################################################################\r
+\r
+[Includes]\r
+  $(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
+  PeimEntryPoint\r
+  DebugLib\r
+\r
+\r
+################################################################################\r
+#\r
+# PPI C Name Section - list of PPI and PPI Notify C Names that this module\r
+#                      uses or produces.\r
+#\r
+################################################################################\r
+\r
+[Ppis]\r
+  gNtFwhPpiGuid                                 # PPI ALWAYS_CONSUMED\r
+\r
+[depex]\r
+  gNtFwhPpiGuid AND gEfiPeiMemoryDiscoveredPpiGuid
\ No newline at end of file
diff --git a/Nt32Pkg/WinNtFirmwareVolumePei/WinNtFwh.msa b/Nt32Pkg/WinNtFirmwareVolumePei/WinNtFwh.msa
new file mode 100644 (file)
index 0000000..9d600f2
--- /dev/null
@@ -0,0 +1,56 @@
+<?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>WinNtFwh</ModuleName>\r
+    <ModuleType>PEIM</ModuleType>\r
+    <GuidValue>F0384FFD-8633-452f-9010-F6B7D2EAE2F1</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>Component description file for WinNtFwh module</Abstract>\r
+    <Description>This PEIM will produce the HOB to describe Firmware Volume, Firmware Devices\r
+    on the 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 X64 IPF EBC</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>WinNtFwh</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>DebugLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PeimEntryPoint</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>HobLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>WinntFwh.c</Filename>\r
+    <Filename>WinNtFwh.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
+  <PPIs>\r
+    <Ppi Usage="ALWAYS_CONSUMED">\r
+      <PpiCName>gNtFwhPpiGuid</PpiCName>\r
+    </Ppi>\r
+  </PPIs>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+    <Extern>\r
+      <ModuleEntryPoint>PeimInitializeWinNtFwh</ModuleEntryPoint>\r
+    </Extern>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/Nt32Pkg/WinNtFirmwareVolumePei/WinntFwh.c b/Nt32Pkg/WinNtFirmwareVolumePei/WinntFwh.c
new file mode 100644 (file)
index 0000000..2431133
--- /dev/null
@@ -0,0 +1,138 @@
+/*++\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
+  WinNtFwh.c\r
+    \r
+Abstract:\r
+  PEIM to abstract construction of firmware volume in a Windows NT environment.\r
+\r
+Revision History\r
+\r
+--*/\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiPei.h>\r
+#include <WinNtPeim.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Ppi/NtFwh.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/DebugLib.h>\r
+#include <Library/PeimEntryPoint.h>\r
+#include <Library/HobLib.h>\r
+\r
+#include <FlashLayout.h>\r
+\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+PeimInitializeWinNtFwh (\r
+  IN EFI_FFS_FILE_HEADER       *FfsHeader,\r
+  IN EFI_PEI_SERVICES          **PeiServices\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+  Perform a call-back into the SEC simulator to get address of the Firmware Hub\r
+\r
+Arguments:\r
+  FfsHeader   - Ffs Header availible to every PEIM\r
+  PeiServices - General purpose services available to every PEIM.\r
+    \r
+Returns:\r
+  None\r
+\r
+--*/\r
+{\r
+  EFI_STATUS                  Status;\r
+  EFI_PEI_PPI_DESCRIPTOR      *PpiDescriptor;\r
+  NT_FWH_PPI                  *FwhPpi;\r
+  EFI_PHYSICAL_ADDRESS        FdBase;\r
+  EFI_FIRMWARE_VOLUME_HEADER  *FvHeader;\r
+  UINT64                      FdSize;\r
+  UINTN                       Index;\r
+\r
+  DEBUG ((EFI_D_ERROR, "NT 32 Firmware Volume PEIM Loaded\n"));\r
+\r
+  //\r
+  // Get the Fwh Information PPI\r
+  //\r
+  Status = (**PeiServices).LocatePpi (\r
+                            PeiServices,\r
+                            &gNtFwhPpiGuid, // GUID\r
+                            0,              // INSTANCE\r
+                            &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR\r
+                            &FwhPpi         // PPI\r
+                            );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  Index = 0;\r
+  do {\r
+    //\r
+    // Get information about all the FD's in the system\r
+    //\r
+    Status = FwhPpi->NtFwh (Index, &FdBase, &FdSize);\r
+    if (!EFI_ERROR (Status)) {\r
+      //\r
+      // Assume the FD starts with an FV header\r
+      //\r
+      FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) FdBase;\r
+\r
+      //\r
+      // Make an FV Hob for the first FV in the FD\r
+      //\r
+      BuildFvHob (FdBase, FvHeader->FvLength);\r
+\r
+      if (Index == 0) {\r
+        //\r
+        // Assume the first FD was produced by the NT32.DSC\r
+        //  All these strange offests are needed to keep in\r
+        //  sync with the FlashMap and NT32.dsc file\r
+        //\r
+        BuildResourceDescriptorHob (\r
+          EFI_RESOURCE_FIRMWARE_DEVICE,\r
+          (EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE),\r
+          FdBase,\r
+          (FvHeader->FvLength + EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH)\r
+          );\r
+\r
+        //\r
+        // Hard code the address of the spare block and variable services.\r
+        //  Assume it's a hard coded offset from FV0 in FD0.\r
+        //\r
+        FdBase  = FdBase + EFI_WINNT_RUNTIME_UPDATABLE_OFFSET;\r
+        FdSize  = EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH;\r
+\r
+        BuildFvHob (FdBase, FdSize);\r
+      } else {\r
+        //\r
+        // For other FD's just map them in.\r
+        //\r
+        BuildResourceDescriptorHob (\r
+          EFI_RESOURCE_FIRMWARE_DEVICE,\r
+          (EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE),\r
+          FdBase,\r
+          FdSize\r
+          );\r
+      }\r
+    }\r
+\r
+    Index++;\r
+  } while (!EFI_ERROR (Status));\r
+\r
+  return Status;\r
+}\r
diff --git a/Nt32Pkg/WinNtFlashMapPei/FlashMap.c b/Nt32Pkg/WinNtFlashMapPei/FlashMap.c
new file mode 100644 (file)
index 0000000..cc989c6
--- /dev/null
@@ -0,0 +1,330 @@
+/*++\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
+  FlashMap.c\r
+   \r
+Abstract:\r
+\r
+  PEIM to build GUIDed HOBs for platform specific flash map\r
+\r
+--*/\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiPei.h>\r
+#include <WinNtPeim.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Ppi/NtFwh.h>\r
+#include <Guid/FirmwareFileSystem2.h>\r
+#include <Ppi/FlashMap.h>\r
+#include <Guid/FlashMapHob.h>\r
+#include <Guid/SystemNvDataGuid.h>\r
+#include <Protocol/FirmwareVolumeBlock.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/DebugLib.h>\r
+#include <Library/PeimEntryPoint.h>\r
+#include <Library/HobLib.h>\r
+#include <Library/PeiServicesLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/PcdLib.h>\r
+\r
+\r
+#include <FlashLayout.h>\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+GetAreaInfo (\r
+  IN  EFI_PEI_SERVICES            **PeiServices,\r
+  IN PEI_FLASH_MAP_PPI            *This,\r
+  IN  EFI_FLASH_AREA_TYPE         AreaType,\r
+  IN  EFI_GUID                    *AreaTypeGuid,\r
+  OUT UINT32                      *NumEntries,\r
+  OUT EFI_FLASH_SUBAREA_ENTRY     **Entries\r
+  );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+MemoryDiscoveredPpiNotifyCallback (\r
+  IN EFI_PEI_SERVICES           **PeiServices,\r
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,\r
+  IN VOID                       *Ppi\r
+  );\r
+\r
+//\r
+// Module globals\r
+//\r
+static PEI_FLASH_MAP_PPI      mFlashMapPpi = { GetAreaInfo };\r
+\r
+static EFI_PEI_PPI_DESCRIPTOR mPpiListFlashMap = {\r
+  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
+  &gPeiFlashMapPpiGuid,\r
+  &mFlashMapPpi\r
+};\r
+\r
+static EFI_FLASH_AREA_DATA    mFlashAreaData[] = {\r
+  //\r
+  // Variable area\r
+  //\r
+  {\r
+    EFI_VARIABLE_STORE_OFFSET,\r
+    EFI_VARIABLE_STORE_LENGTH,\r
+    EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,\r
+    EFI_FLASH_AREA_EFI_VARIABLES,\r
+    0, 0, 0,\r
+    { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }\r
+  },\r
+  //\r
+  // FTW spare (backup) block\r
+  //\r
+  {\r
+    EFI_WINNT_FTW_SPARE_BLOCK_OFFSET,\r
+    EFI_WINNT_FTW_SPARE_BLOCK_LENGTH,\r
+    EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,\r
+    EFI_FLASH_AREA_FTW_BACKUP,\r
+    0, 0, 0,\r
+    { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }\r
+  },\r
+  //\r
+  // FTW private working (state) area\r
+  //\r
+  {\r
+    EFI_FTW_WORKING_OFFSET,\r
+    EFI_FTW_WORKING_LENGTH,\r
+    EFI_FLASH_AREA_SUBFV | EFI_FLASH_AREA_MEMMAPPED_FV,\r
+    EFI_FLASH_AREA_FTW_STATE,\r
+    0, 0, 0,\r
+    { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }\r
+  },\r
+  //\r
+  // Recovery FV\r
+  //\r
+  {\r
+    EFI_WINNT_FIRMWARE_OFFSET,\r
+    EFI_WINNT_FIRMWARE_LENGTH,\r
+    EFI_FLASH_AREA_FV | EFI_FLASH_AREA_MEMMAPPED_FV,\r
+    EFI_FLASH_AREA_RECOVERY_BIOS,\r
+    0, 0, 0,\r
+    { 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }\r
+  },\r
+  //\r
+  // System Non-Volatile Storage FV\r
+  //\r
+  {\r
+    EFI_WINNT_RUNTIME_UPDATABLE_OFFSET,\r
+    EFI_WINNT_RUNTIME_UPDATABLE_LENGTH + EFI_WINNT_FTW_SPARE_BLOCK_LENGTH,\r
+    EFI_FLASH_AREA_FV | EFI_FLASH_AREA_MEMMAPPED_FV,\r
+    EFI_FLASH_AREA_GUID_DEFINED,\r
+    0, 0, 0,\r
+    EFI_SYSTEM_NV_DATA_HOB_GUID\r
+  },\r
+};\r
+\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+PeimInitializeFlashMap (\r
+  IN EFI_FFS_FILE_HEADER       *FfsHeader,\r
+  IN EFI_PEI_SERVICES          **PeiServices\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+  Build GUIDed HOBs for platform specific flash map\r
+  \r
+Arguments:\r
+  FfsHeader   - A pointer to the EFI_FFS_FILE_HEADER structure.\r
+  PeiServices - General purpose services available to every PEIM.\r
+    \r
+Returns:\r
+  EFI_STATUS\r
+\r
+--*/\r
+// TODO:    EFI_SUCCESS - add return value to function comment\r
+{\r
+  EFI_STATUS              Status;\r
+  NT_FWH_PPI              *NtFwhPpi;\r
+  EFI_PEI_PPI_DESCRIPTOR  *PpiDescriptor;\r
+  EFI_PHYSICAL_ADDRESS    FdBase;\r
+  UINT64                  FdSize;\r
+  UINTN                   NumOfHobData;\r
+  UINTN                   Index;\r
+  EFI_FLASH_AREA_HOB_DATA FlashHobData;\r
+\r
+  DEBUG ((EFI_D_ERROR, "NT 32 Flash Map PEIM Loaded\n"));\r
+\r
+  //\r
+  // Install FlashMap PPI\r
+  //\r
+  Status = PeiServicesInstallPpi (&mPpiListFlashMap);\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+\r
+  //\r
+  // Get the Fwh Information PPI\r
+  //\r
+  Status = PeiServicesLocatePpi (\r
+            &gNtFwhPpiGuid, // GUID\r
+            0,              // INSTANCE\r
+            &PpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR\r
+            &NtFwhPpi       // PPI\r
+            );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  //\r
+  // Assume that FD0 contains the Flash map.\r
+  //\r
+  Status = NtFwhPpi->NtFwh (0, &FdBase, &FdSize);\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  //\r
+  // Get number of types\r
+  //\r
+  NumOfHobData = sizeof (mFlashAreaData) / sizeof (EFI_FLASH_AREA_DATA);\r
+\r
+  //\r
+  // Build flash area entries as GUIDed HOBs.\r
+  //\r
+  for (Index = 0; Index < NumOfHobData; Index++) {\r
+    (*PeiServices)->SetMem (&FlashHobData, sizeof (EFI_FLASH_AREA_HOB_DATA), 0);\r
+\r
+    FlashHobData.AreaType               = mFlashAreaData[Index].AreaType;\r
+    FlashHobData.NumberOfEntries        = 1;\r
+    FlashHobData.SubAreaData.Attributes = mFlashAreaData[Index].Attributes;\r
+    FlashHobData.SubAreaData.Base       = FdBase + (EFI_PHYSICAL_ADDRESS) (UINTN) mFlashAreaData[Index].Base;\r
+    FlashHobData.SubAreaData.Length     = (EFI_PHYSICAL_ADDRESS) (UINTN) mFlashAreaData[Index].Length;\r
+\r
+    //\r
+    // We also update a PCD entry so that any driver that depend on\r
+    // PCD entry will get the information.\r
+    //\r
+    if (FlashHobData.AreaType == EFI_FLASH_AREA_EFI_VARIABLES) {\r
+      // BUGBUG: Tool team does not enable dynamic PCD so comment out following code\r
+      //PcdSet32 (PcdFlashNvStorageVariableBase, (UINT32) FlashHobData.SubAreaData.Base);\r
+      //PcdSet32 (PcdFlashNvStorageVariableSize, (UINT32) FlashHobData.SubAreaData.Length);\r
+    }\r
+\r
+    if (FlashHobData.AreaType == EFI_FLASH_AREA_FTW_STATE) {\r
+      // BUGBUG: Tool team does not enable dynamic PCD so comment out following code\r
+      //PcdSet32 (PcdFlashNvStorageFtwWorkingBase, (UINT32) FlashHobData.SubAreaData.Base);\r
+      //PcdSet32 (PcdFlashNvStorageFtwWorkingSize, (UINT32) FlashHobData.SubAreaData.Length);\r
+    }\r
+\r
+    if (FlashHobData.AreaType == EFI_FLASH_AREA_FTW_BACKUP) {\r
+      // BUGBUG: Tool team does not enable dynamic PCD so comment out following code\r
+      //PcdSet32 (PcdFlashNvStorageFtwSpareBase, (UINT32) FlashHobData.SubAreaData.Base);\r
+      //PcdSet32 (PcdFlashNvStorageFtwSpareSize, (UINT32) FlashHobData.SubAreaData.Length);\r
+    }\r
+\r
+    switch (FlashHobData.AreaType) {\r
+    case EFI_FLASH_AREA_RECOVERY_BIOS:\r
+    case EFI_FLASH_AREA_MAIN_BIOS:\r
+      (*PeiServices)->CopyMem (\r
+                        &FlashHobData.AreaTypeGuid,\r
+                        &gEfiFirmwareFileSystem2Guid,\r
+                        sizeof (EFI_GUID)\r
+                        );\r
+      (*PeiServices)->CopyMem (\r
+                        &FlashHobData.SubAreaData.FileSystem,\r
+                        &gEfiFirmwareVolumeBlockProtocolGuid,\r
+                        sizeof (EFI_GUID)\r
+                        );\r
+      break;\r
+\r
+    case EFI_FLASH_AREA_GUID_DEFINED:\r
+      (*PeiServices)->CopyMem (\r
+                        &FlashHobData.AreaTypeGuid,\r
+                        &mFlashAreaData[Index].AreaTypeGuid,\r
+                        sizeof (EFI_GUID)\r
+                        );\r
+      (*PeiServices)->CopyMem (\r
+                        &FlashHobData.SubAreaData.FileSystem,\r
+                        &gEfiFirmwareVolumeBlockProtocolGuid,\r
+                        sizeof (EFI_GUID)\r
+                        );\r
+      break;\r
+\r
+    default:\r
+      break;\r
+    }\r
+\r
+    BuildGuidDataHob (\r
+      &gEfiFlashMapHobGuid,\r
+      &FlashHobData,\r
+      sizeof (EFI_FLASH_AREA_HOB_DATA)\r
+      );\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+GetAreaInfo (\r
+  IN  EFI_PEI_SERVICES            **PeiServices,\r
+  IN PEI_FLASH_MAP_PPI            *This,\r
+  IN  EFI_FLASH_AREA_TYPE         AreaType,\r
+  IN  EFI_GUID                    *AreaTypeGuid,\r
+  OUT UINT32                      *NumEntries,\r
+  OUT EFI_FLASH_SUBAREA_ENTRY     **Entries\r
+  )\r
+/*++\r
+\r
+  Routine Description:    \r
+    Implementation of Flash Map PPI\r
+    \r
+--*/\r
+// TODO: function comment is missing 'Arguments:'\r
+// TODO: function comment is missing 'Returns:'\r
+// TODO:    PeiServices - add argument and description to function comment\r
+// TODO:    This - add argument and description to function comment\r
+// TODO:    AreaType - add argument and description to function comment\r
+// TODO:    AreaTypeGuid - add argument and description to function comment\r
+// TODO:    NumEntries - add argument and description to function comment\r
+// TODO:    Entries - add argument and description to function comment\r
+// TODO:    EFI_SUCCESS - add return value to function comment\r
+// TODO:    EFI_NOT_FOUND - add return value to function comment\r
+{\r
+  EFI_STATUS                    Status;\r
+  EFI_PEI_HOB_POINTERS          Hob;\r
+  EFI_HOB_FLASH_MAP_ENTRY_TYPE  *FlashMapEntry;\r
+\r
+  Status = PeiServicesGetHobList (&Hob.Raw);\r
+  while (!END_OF_HOB_LIST (Hob)) {\r
+    if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION && CompareGuid (&Hob.Guid->Name, &gEfiFlashMapHobGuid)) {\r
+      FlashMapEntry = (EFI_HOB_FLASH_MAP_ENTRY_TYPE *) Hob.Raw;\r
+      if (AreaType == FlashMapEntry->AreaType) {\r
+        if (AreaType == EFI_FLASH_AREA_GUID_DEFINED) {\r
+          if (!CompareGuid (AreaTypeGuid, &FlashMapEntry->AreaTypeGuid)) {\r
+            goto NextHob;\r
+          }\r
+        }\r
+\r
+        *NumEntries = FlashMapEntry->NumEntries;\r
+        *Entries    = FlashMapEntry->Entries;\r
+        return EFI_SUCCESS;\r
+      }\r
+    }\r
+  NextHob:\r
+    Hob.Raw = GET_NEXT_HOB (Hob);\r
+  }\r
+\r
+  return EFI_NOT_FOUND;\r
+}\r
diff --git a/Nt32Pkg/WinNtFlashMapPei/FlashMap.inf b/Nt32Pkg/WinNtFlashMapPei/FlashMap.inf
new file mode 100644 (file)
index 0000000..bcd1367
--- /dev/null
@@ -0,0 +1,135 @@
+#/** @file\r
+# Component description file for FlashMap PEI module\r
+#\r
+# This module installs FlashMap PPI which is used to get flash layout information.\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                      = PeiFlashMap\r
+  FILE_GUID                      = 681F3771-6F1D-42DE-9AA2-F82BBCDBC5F9\r
+  MODULE_TYPE                    = PEIM\r
+  VERSION_STRING                 = 1.0\r
+  EDK_RELEASE_VERSION            = 0x00020000\r
+  EFI_SPECIFICATION_VERSION      = 0x00020000\r
+\r
+  ENTRY_POINT                    = PeimInitializeFlashMap\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+  FlashMap.c\r
+\r
+\r
+################################################################################\r
+#\r
+# Includes Section - list of Include locations that are required for\r
+#                    this module.\r
+#\r
+################################################################################\r
+\r
+[Includes]\r
+  $(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
+  MdeModulePkg/MdeModulePkg.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
+  PcdLib\r
+  BaseMemoryLib\r
+  PeiServicesLib\r
+  HobLib\r
+  PeimEntryPoint\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
+  gEfiFlashMapHobGuid                           # ALWAYS_CONSUMED  Hob: GUID_EXTENSION\r
+  gEfiFirmwareFileSystem2Guid                    # 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
+  gEfiFirmwareVolumeBlockProtocolGuid           # PROTOCOL ALWAYS_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
+  gNtFwhPpiGuid                                 # PPI ALWAYS_CONSUMED\r
+  gPeiFlashMapPpiGuid                           # PPI ALWAYS_PRODUCED\r
+\r
+\r
+################################################################################\r
+#\r
+# Pcd DYNAMIC - list of PCDs that this module is coded for.\r
+#\r
+################################################################################\r
+\r
+[PcdsDynamic.common]\r
+  PcdFlashNvStorageFtwWorkingSize|gEfiGenericPlatformTokenSpaceGuid\r
+  PcdFlashNvStorageFtwWorkingBase|gEfiGenericPlatformTokenSpaceGuid\r
+  PcdFlashNvStorageFtwSpareSize|gEfiGenericPlatformTokenSpaceGuid\r
+  PcdFlashNvStorageFtwSpareBase|gEfiGenericPlatformTokenSpaceGuid\r
+  PcdFlashNvStorageVariableSize|gEfiGenericPlatformTokenSpaceGuid\r
+  PcdFlashNvStorageVariableBase|gEfiGenericPlatformTokenSpaceGuid\r
+\r
diff --git a/Nt32Pkg/WinNtFlashMapPei/FlashMap.msa b/Nt32Pkg/WinNtFlashMapPei/FlashMap.msa
new file mode 100644 (file)
index 0000000..3bf00a0
--- /dev/null
@@ -0,0 +1,119 @@
+<?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>PeiFlashMap</ModuleName>\r
+    <ModuleType>PEIM</ModuleType>\r
+    <GuidValue>681F3771-6F1D-42DE-9AA2-F82BBCDBC5F9</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>Component description file for FlashMap PEI module</Abstract>\r
+    <Description>This module installs FlashMap PPI which is used to get flash layout information.</Description>\r
+    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>\r
+    <License>All rights reserved. This program and the accompanying materials\r
+      are licensed and made available under the terms and conditions of the BSD License\r
+      which accompanies this distribution.  The full text of the license may be found at\r
+      http://opensource.org/licenses/bsd-license.php\r
+      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
+    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>\r
+  </MsaHeader>\r
+  <ModuleDefinitions>\r
+    <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>PeiFlashMap</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>DebugLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PeimEntryPoint</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>HobLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PeiServicesLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>BaseMemoryLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>PcdLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>FlashMap.c</Filename>\r
+    <Filename>FlashMap.dxs</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>gEfiFirmwareVolumeBlockProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+  </Protocols>\r
+  <Hobs>\r
+    <HobTypes HobGuidCName="gEfiFlashMapHobGuid" Usage="ALWAYS_CONSUMED">\r
+      <HobType>GUID_EXTENSION</HobType>\r
+    </HobTypes>\r
+  </Hobs>\r
+  <PPIs>\r
+    <Ppi Usage="ALWAYS_PRODUCED">\r
+      <PpiCName>gPeiFlashMapPpiGuid</PpiCName>\r
+    </Ppi>\r
+    <Ppi Usage="ALWAYS_CONSUMED">\r
+      <PpiCName>gNtFwhPpiGuid</PpiCName>\r
+    </Ppi>\r
+  </PPIs>\r
+  <Guids>\r
+    <GuidCNames Usage="ALWAYS_CONSUMED">\r
+      <GuidCName>gEfiFirmwareFileSystemGuid</GuidCName>\r
+    </GuidCNames>\r
+  </Guids>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+    <Extern>\r
+      <ModuleEntryPoint>PeimInitializeFlashMap</ModuleEntryPoint>\r
+    </Extern>\r
+  </Externs>\r
+  <PcdCoded>\r
+    <PcdEntry PcdItemType="DYNAMIC">\r
+      <C_Name>PcdFlashNvStorageVariableBase</C_Name>\r
+      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>\r
+      <HelpText>The driver sets the NV Storage FV base address defined by this PCD.\r
+        This base address point to an EFI_FIRMWARE_VOLUMN_HEADER struct. Variable PEIM\r
+        will get the base address from this PCD. In NT emulator, this PCD is a DYNAMIC\r
+        type, as FD is mapped to process space by WinNT OS. On real platform, it is\r
+        normally a FIXED_AT_BUILD type as system memory map is fixed to BIOS.</HelpText>\r
+    </PcdEntry>\r
+    <PcdEntry PcdItemType="DYNAMIC">\r
+      <C_Name>PcdFlashNvStorageVariableSize</C_Name>\r
+      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>\r
+      <HelpText>To get the NvStorage Variable size from this PCD.</HelpText>\r
+    </PcdEntry>\r
+    <PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">\r
+      <C_Name>PcdFlashNvStorageFtwSpareBase</C_Name>\r
+      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>\r
+      <HelpText>To get base address of the FTW spare block section in NV firmware volume.</HelpText>\r
+    </PcdEntry>\r
+    <PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">\r
+      <C_Name>PcdFlashNvStorageFtwSpareSize</C_Name>\r
+      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>\r
+      <HelpText>To get size of the FTW spare block section in NV firmware volume.</HelpText>\r
+    </PcdEntry>\r
+    <PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">\r
+      <C_Name>PcdFlashNvStorageFtwWorkingBase</C_Name>\r
+      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>\r
+      <HelpText>To get base address of the FTW working block section in NV firmware volume.</HelpText>\r
+    </PcdEntry>\r
+    <PcdEntry PcdItemType="DYNAMIC" Usage="ALWAYS_CONSUMED">\r
+      <C_Name>PcdFlashNvStorageFtwWorkingSize</C_Name>\r
+      <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>\r
+      <HelpText>To get size of the FTW working block section in NV firmware volume.</HelpText>\r
+    </PcdEntry>\r
+  </PcdCoded>\r
+</ModuleSurfaceArea>\r